lang
stringclasses
3 values
file_path
stringlengths
5
150
repo_name
stringlengths
6
110
commit
stringlengths
40
40
file_code
stringlengths
1.52k
18.9k
prefix
stringlengths
82
16.5k
suffix
stringlengths
0
15.1k
middle
stringlengths
121
8.18k
strategy
stringclasses
8 values
context_items
listlengths
0
100
C++
src/BabylonCpp/src/maths/spherical_polynomial.cpp
samdauwe/BabylonCpp
eea9f761a49bb460ff1324c20e4674ef120e94f1
#include <babylon/maths/spherical_polynomial.h> #include <babylon/maths/color3.h> #include <babylon/maths/tmp_vectors.h> namespace BABYLON { SphericalPolynomial::SphericalPolynomial() : x{Vector3::Zero()} , y{Vector3::Zero()} , z{Vector3::Zero()} , xx{Vector3::Zero()} , yy{Vector3::Zero()} , zz{Vector3::Zero()} , xy{Vector3::Zero()} , yz{Vector3::Zero()} , zx{Vector3::Zero()} , _harmonics{std::nullopt} { } SphericalPolynomial::SphericalPolynomial(const SphericalPolynomial& other) = default; SphericalPolynomial::SphericalPolynomial(SphericalPolynomial&& other) = default; SphericalPolynomial& SphericalPolynomial::operator=(const SphericalPolynomial& other) = default; SphericalPolynomial& SphericalPolynomial::operator=(SphericalPolynomial&& other) = default; SphericalPolynomial::~SphericalPolynomial() = default; SphericalPolynomial SphericalPolynomial::copy() const { return SphericalPolynomial(*this); } std::unique_ptr<SphericalPolynomial> SphericalPolynomial::clone() const { return std::make_unique<SphericalPolynomial>(*this); } SphericalHarmonics& SphericalPolynomial::preScaledHarmonics() { if (!_harmonics.has_value()) { _harmonics = SphericalHarmonics::FromPolynomial(*this); } if (!_harmonics->preScaled) { _harmonics->preScaleForRendering(); } return *_harmonics; } void SphericalPolynomial::addAmbient(const Color3& color) { TmpVectors::Vector3Array[0].copyFromFloats(color.r, color.g, color.b); auto& colorVector = TmpVectors::Vector3Array[0]; xx.addInPlace(colorVector); yy.addInPlace(colorVector); zz.addInPlace(colorVector); } void SphericalPolynomial::scaleInPlace(float scale) { x.scaleInPlace(scale); y.scaleInPlace(scale); z.scaleInPlace(scale); xx.scaleInPlace(scale); yy.scaleInPlace(scale); zz.scaleInPlace(scale); yz.scaleInPlace(scale); zx.scaleInPlace(scale); xy.scaleInPlace(scale); } SphericalPolynomial& SphericalPolynomial::updateFromHarmonics(const SphericalHarmonics& harmonics) { _harmonics = harmonics; x.copyFrom(harmonics.l11); x.scaleInPlace(1.02333f).scaleInPlace(-1.f); y.copyFrom(harmonics.l1_1); y.scaleInPlace(1.02333f).scaleInPlace(-1.f); z.copyFrom(harmonics.l10); z.scaleInPlace(1.02333f); xx.copyFrom(harmonics.l00); TmpVectors::Vector3Array[0].copyFrom(harmonics.l20).scaleInPlace(0.247708f); TmpVectors::Vector3Array[1].copyFrom(harmonics.l22).scaleInPlace(0.429043f); xx.scaleInPlace(0.886277f) .subtractInPlace(TmpVectors::Vector3Array[0]) .addInPlace(TmpVectors::Vector3Array[1]); yy.copyFrom(harmonics.l00); yy.scaleInPlace(0.886277f) .subtractInPlace(TmpVectors::Vector3Array[0]) .subtractInPlace(TmpVectors::Vector3Array[1]); zz.copyFrom(harmonics.l00); TmpVectors::Vector3Array[0].copyFrom(harmonics.l20).scaleInPlace(0.495417f); zz.scaleInPlace(0.886277f).addInPlace(TmpVectors::Vector3Array[0]); yz.copyFrom(harmonics.l2_1); yz.scaleInPlace(0.858086f).scaleInPlace(-1.f); zx.copyFrom(harmonics.l21); zx.scaleInPlace(0.858086f).scaleInPlace(-1.f); xy.copyFrom(harmonics.l2_2); xy.scaleInPlace(0.858086f); scaleInPlace(1.f / Math::PI); return *this; } SphericalPolynomial SphericalPolynomial::FromHarmonics(const SphericalHarmonics& harmonics) { SphericalPolynomial result; return result.updateFromHarmonics(harmonics); } SphericalPolynomial SphericalPolynomial::FromArray(const std::vector<Float32Array>& data) { SphericalPolynomial sp; if (data.size() < 9) { return sp; } Vector3::FromArrayToRef(data[0], 0, sp.x); Vector3::FromArrayToRef(data[1], 0, sp.y); Vector3::FromArrayToRef(data[2], 0, sp.z); Vector3::FromArrayToRef(data[3], 0, sp.xx); Vector3::FromArrayToRef(data[4], 0, sp.yy); Vector3::FromArrayToRef(data[5], 0, sp.zz); Vector3::FromArrayToRef(data[6], 0, sp.yz); Vector3::FromArrayToRef(data[7], 0, sp.zx); Vector3::FromArrayToRef(data[8], 0, sp.xy); return sp; } }
#include <babylon/maths/spherical_polynomial.h> #include <babylon/maths/color3.h> #include <babylon/maths/tmp_vectors.h> namespace BABYLON { SphericalPolynomial::SphericalPolynomial() : x{Vector3::Zero()} , y{Vector3::Zero()} , z{Vector3::Zero()} , xx{Vector3::Zero()} , yy{Vector3::Zero()} , zz{Vector3::Zero()} , xy{Vector3::Zero()} , yz{Vector3::Zero()} , zx{Vector3::Zero()} , _harmonics{std::nullopt} { } SphericalPolynomial::SphericalPolynomial(const SphericalPolynomial& other) = default; SphericalPolynomial::SphericalPolynomial(SphericalPolynomial&& other) = default; SphericalPolynomial& SphericalPolynomial::operator=(const SphericalPolynomial& other) = default; SphericalPolynomial& SphericalPolynomial::operator=(SphericalPolynomial&& other) = default; SphericalPolynomial::~SphericalPolynomial() = default; SphericalPolynomial SphericalPolynomial::copy() const { return SphericalPolynomial(*this); } std::unique_ptr<SphericalPolynomial> SphericalPolynomial::clone() const { return std::make_unique<SphericalPolynomial>(*this); } SphericalHarmonics& SphericalPolynomial::preScaledHarmonics() { if (!_harmonics.has_value()) { _harmonics = SphericalHarmonics::FromPolynomial(*this); } if (!_harmonics->preScaled) { _harmonics->preScaleForRendering(); } return *_harmonics; } void SphericalPolynomial::addAmbient(const Color3& color) { TmpVectors::Vector3Array[0].copyFromFloats(color.r, color.g, color.b); auto& colorVector = TmpVectors::Vector3Array[0]; xx.addInPlace(colorVector); yy.addInPlace(colorVector); zz.addInPlace(colorVector); } void SphericalPolynomial::scaleInPlace(float scale) { x.scaleInPlace(scale); y.scaleInPlace(scale); z.scaleInPlace(scale); xx.scaleInPlace(scale); yy.scaleInPlace(scale); zz.scaleInPlace(scale); yz.scaleInPlace(scale); zx.scaleInPlace(scale); xy.scaleInPlace(scale); } SphericalPolynomial& SphericalPolynomial::updateFromHarmonics(const SphericalHarmonics& harmonics) { _harmonics = harmonics; x.copyFrom(harmonics.l11); x.scaleInPlace(1.02333f).scaleInPlace(-1.f); y.copyFrom(harmonics.l1_1); y.scaleInPlace(1.02333f).scaleInPlace(-1.f); z.copyFrom(harmonics.l10); z.scaleInPlace(1.02333f); xx.copyFrom(harmonics.l00); TmpVectors::Vector3Array[0].copyFrom(harmonics.l20).scaleInPlace(0.247708f); TmpVectors::Vector3Array[1].copyFrom(harmonics.l22).scaleInPlace(0.429043f); xx.scaleInPlace(0.886277f) .subtractInPlace(TmpVectors::Vector3Array[0]) .addInPlace(TmpVectors::Vector3Array[1]); yy.copyFrom(harmonics.l00); yy.scaleInPlace(0.886277f) .subtractInPlace(TmpVectors::Vector3Array[0]) .subtractInPlace(TmpVectors::Vector3Array[1]); zz.copyFrom(harmonics.l00); TmpVectors::Vector3Array[0].copyFrom(harmonics.l20).scaleInPlace(0.495417f); zz.scaleInPlace(0.886277f).addInPlace(TmpVectors::Vector3Array[0]); yz.copyFrom(harmonics.l2_1); yz.scaleInPlace(0.858086f).scaleInPlace(-1.f); zx.copyFrom(harmonics.l21); zx.scaleInPlace(0.858086f).scaleInPlace(-1.f); xy.copyFrom(harmonics.l2_2); xy.scaleInPlace(0.858086f); scaleInPlace(1.f / Math::PI); return *this; } SphericalPolynomial SphericalPolynomial::FromHarmonics(const SphericalHarmonics& harmonics) { SphericalPolynomial result; return result.updateFromHarmonics(harmonics); } SphericalPolynomial SphericalPolynomial::FromArray(const std::vector<Float32Array>& data) { SphericalPolynomial sp; if (data.size() <
}
9) { return sp; } Vector3::FromArrayToRef(data[0], 0, sp.x); Vector3::FromArrayToRef(data[1], 0, sp.y); Vector3::FromArrayToRef(data[2], 0, sp.z); Vector3::FromArrayToRef(data[3], 0, sp.xx); Vector3::FromArrayToRef(data[4], 0, sp.yy); Vector3::FromArrayToRef(data[5], 0, sp.zz); Vector3::FromArrayToRef(data[6], 0, sp.yz); Vector3::FromArrayToRef(data[7], 0, sp.zx); Vector3::FromArrayToRef(data[8], 0, sp.xy); return sp; }
function_block-function_prefixed
[ { "content": "class Color3;\n", "file_path": "src/BabylonCpp/include/babylon/maths/spherical_harmonics.h", "rank": 0, "score": 282209.0951003985 }, { "content": "namespace BABYLON {\n\n\n\n/**\n\n * @brief Defines One Image in the file. It requires only the position in the\n\n * file as well as the length.\n\n */\n\nstruct BABYLON_SHARED_EXPORT BufferImageData {\n\n /**\n\n * Length of the image data.\n\n */\n\n size_t length;\n\n /**\n\n * Position of the data from the null terminator delimiting the end of the\n\n * JSON.\n\n */\n\n size_t position;\n\n}; // end of struct BufferImageData\n\n\n", "file_path": "src/BabylonCpp/include/babylon/misc/buffer_image_data.h", "rank": 1, "score": 278482.85706731764 }, { "content": "namespace BABYLON {\n\n\n\n/**\n\n * @brief Hidden\n\n */\n\nstruct BABYLON_SHARED_EXPORT _CreationDataStorage {\n\n std::optional<bool> closePath = std::nullopt;\n\n std::optional<bool> closeArray = std::nullopt;\n\n IndicesArray idx;\n\n float dashSize;\n\n float gapSize;\n\n Path3D path3D;\n\n std::vector<std::vector<Vector3>> pathArray;\n\n float arc;\n\n float radius;\n\n unsigned int cap;\n\n unsigned int tessellation;\n\n}; // end of struct _CreationDataStorage\n\n\n", "file_path": "src/BabylonCpp/include/babylon/meshes/_creation_data_storage.h", "rank": 2, "score": 278482.85706731764 }, { "content": "namespace BABYLON {\n\n\n\n/**\n\n * @brief Hidden\n\n */\n\nstruct BABYLON_SHARED_EXPORT VertexDataConstants {\n\n /**\n\n * Mesh side orientation : usually the external or front surface\n\n */\n\n static constexpr unsigned int FRONTSIDE = 0;\n\n /**\n\n * Mesh side orientation : usually the internal or back surface\n\n */\n\n static constexpr unsigned int BACKSIDE = 1;\n\n /**\n\n * Mesh side orientation : both internal and external or front and back\n\n * surfaces\n\n */\n\n static constexpr unsigned int DOUBLESIDE = 2;\n\n /**\n\n * Mesh side orientation : by default, `FRONTSIDE`\n\n */\n\n static constexpr unsigned int DEFAULTSIDE = 0;\n\n}; // end of struct VertexDataConstants\n\n\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data_constants.h", "rank": 3, "score": 278482.85706731764 }, { "content": "namespace BABYLON {\n\n\n\n/**\n\n * @brief Joint data for a Distance-Joint.\n\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\n\n */\n\nstruct BABYLON_SHARED_EXPORT DistanceJointData : public PhysicsJointData {\n\n /**\n\n * Max distance the 2 joint objects can be apart\n\n */\n\n float maxDistance;\n\n // Oimo - minDistance\n\n // Cannon - maxForce\n\n}; // end of struct DistanceJointData\n\n\n", "file_path": "src/BabylonCpp/include/babylon/physics/joint/distance_joint_data.h", "rank": 4, "score": 274420.71182538336 }, { "content": "namespace BABYLON {\n\n\n\n/**\n\n * @brief Interface for a physics hit data\n\n * @see\n\n * https://doc.babylonjs.com/how_to/using_the_physics_engine#further-functionality-of-the-impostor-class\n\n */\n\nstruct BABYLON_SHARED_EXPORT PhysicsHitData {\n\n /**\n\n * The force applied at the contact point\n\n */\n\n Vector3 force;\n\n /**\n\n * The contact point\n\n */\n\n Vector3 contactPoint;\n\n /**\n\n * The distance from the origin to the contact point\n\n */\n\n float distanceFromOrigin = 0.f;\n\n}; // end of struct PhysicsHitData\n\n\n", "file_path": "src/BabylonCpp/include/babylon/physics/helper/physics_hit_data.h", "rank": 5, "score": 274420.71182538336 }, { "content": "namespace BABYLON {\n\n\n\n/**\n\n * @brief Joint data from a spring joint.\n\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\n\n */\n\nstruct BABYLON_SHARED_EXPORT SpringJointData : public PhysicsJointData {\n\n /**\n\n * Length of the spring\n\n */\n\n float length = 0.f;\n\n /**\n\n * Stiffness of the spring\n\n */\n\n float stiffness = 0.f;\n\n /**\n\n * Damping of the spring\n\n */\n\n float damping = 0.f;\n\n /**\n\n * This callback will be called when applying the force to the impostors.\n\n */\n\n std::function<void()> forceApplicationCallback = nullptr;\n\n}; // end of struct DistanceJointData\n\n\n", "file_path": "src/BabylonCpp/include/babylon/physics/joint/spring_joint_data.h", "rank": 6, "score": 274420.71182538336 }, { "content": "namespace BABYLON {\n\n\n\nFWD_CLASS_SPTR(Buffer)\n\n\n\n/**\n\n * @brief Hidden\n\n */\n\nstruct BABYLON_SHARED_EXPORT _ThinInstanceDataStorage {\n\n size_t instancesCount = 0;\n\n BufferPtr matrixBuffer = nullptr;\n\n BufferPtr previousMatrixBuffer = nullptr;\n\n Float32Array previousMatrixData = {};\n\n size_t matrixBufferSize = 32 * 16; // let's start with a maximum of 32 thin instances\n\n Float32Array matrixData = {};\n\n std::vector<Vector3> boundingVectors = {};\n\n std::optional<std::vector<Matrix>> worldMatrices = std::nullopt;\n\n}; // end of struct _ThinInstanceDataStorage\n\n\n", "file_path": "src/BabylonCpp/include/babylon/meshes/_thin_instance_data_storage.h", "rank": 7, "score": 274420.71182538336 }, { "content": "namespace BABYLON {\n\n\n\n/**\n\n * @brief Interface for Physics-Joint data.\n\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\n\n */\n\nstruct BABYLON_SHARED_EXPORT PhysicsJointData {\n\n // Important for some engines, optional!\n\n /**\n\n * The main pivot of the joint\n\n */\n\n std::optional<Vector3> mainPivot = std::nullopt;\n\n /**\n\n * The connected pivot of the joint\n\n */\n\n std::optional<Vector3> connectedPivot = std::nullopt;\n\n /**\n\n * The main axis of the joint\n\n */\n\n std::optional<Vector3> mainAxis = std::nullopt;\n\n /**\n\n * The connected axis of the joint\n\n */\n\n std::optional<Vector3> connectedAxis = std::nullopt;\n\n /**\n\n * The collision of the joint\n\n */\n\n std::optional<bool> collision = std::nullopt;\n\n /**\n\n * Native Oimo/Cannon/Energy data\n\n */\n\n PhysicsParams nativeParams;\n\n}; // end of struct PhysicsJointData\n\n\n", "file_path": "src/BabylonCpp/include/babylon/physics/joint/physics_joint_data.h", "rank": 8, "score": 274420.71182538336 }, { "content": "namespace BABYLON {\n\n\n\nFWD_CLASS_SPTR(PhysicsImpostor)\n\nFWD_STRUCT_SPTR(PhysicsHitData)\n\n\n\n/**\n\n * @brief Interface for an affected physics impostor.\n\n * @see\n\n * https://doc.babylonjs.com/how_to/using_the_physics_engine#further-functionality-of-the-impostor-class\n\n */\n\nstruct BABYLON_SHARED_EXPORT PhysicsAffectedImpostorWithData {\n\n /**\n\n * The impostor affected by the effect\n\n */\n\n PhysicsImpostorPtr impostor = nullptr;\n\n\n\n /**\n\n * The data about the hit/force from the explosion\n\n */\n\n PhysicsHitDataPtr hitData = nullptr;\n\n}; // end of struct PhysicsAffectedImpostorWithData\n\n\n", "file_path": "src/BabylonCpp/include/babylon/physics/helper/physics_affected_impostor_with_data.h", "rank": 9, "score": 270519.58469736134 }, { "content": "namespace BABYLON {\n\n\n\nFWD_CLASS_SPTR(_MeshCollisionData)\n\nFWD_CLASS_SPTR(AbstractMesh)\n\nFWD_CLASS_SPTR(Material)\n\nFWD_CLASS_SPTR(MorphTargetManager)\n\nFWD_CLASS_SPTR(Skeleton)\n\n\n\n/**\n\n * @brief Hidden\n\n */\n\nstruct BABYLON_SHARED_EXPORT _InternalAbstractMeshDataInfo {\n\n bool _hasVertexAlpha = false;\n\n bool _useVertexColors = true;\n\n unsigned int _numBoneInfluencers = 4;\n\n bool _applyFog = true;\n\n bool _receiveShadows = false;\n\n _FacetDataStorage _facetData = {};\n\n float _visibility = 1.f;\n\n SkeletonPtr _skeleton = nullptr;\n\n unsigned int _layerMask = 0x0FFFFFFF;\n\n bool _computeBonesUsingShaders = true;\n\n bool _isActive = false;\n\n bool _onlyForInstances = false;\n\n bool _isActiveIntermediate = false;\n\n bool _onlyForInstancesIntermediate = false;\n\n bool _actAsRegularMesh = false;\n\n AbstractMesh* _currentLOD = nullptr;\n\n bool _currentLODIsUpToDate = false;\n\n unsigned int _collisionRetryCount = 3;\n\n MorphTargetManagerPtr _morphTargetManager = nullptr;\n\n unsigned int _renderingGroupId = 0;\n\n MaterialPtr _material = nullptr;\n\n std::vector<Vector3> _positions = {};\n\n // Collisions\n\n _MeshCollisionDataPtr _meshCollisionData = nullptr;\n\n}; // end of struct _InternalAbstractMeshDataInfo\n\n\n", "file_path": "src/BabylonCpp/include/babylon/meshes/_internal_abstract_mesh_data_info.h", "rank": 10, "score": 270519.58469736134 }, { "content": "class BABYLON_SHARED_EXPORT DataView {\n\n\n\npublic:\n\n DataView();\n\n\n\n /**\n\n * @brief Constructor\n\n * @param buffer An existing ArrayBuffer to use as the storage for the new\n\n * DataView object.\n\n */\n\n DataView(const ArrayBuffer& buffer);\n\n\n\n /**\n\n * @brief Constructor\n\n * @param buffer An existing ArrayBuffer to use as the storage for the new\n\n * DataView object.\n\n * @param byteOffset The offset, in bytes, to the first byte in the specified\n\n * buffer for the new view to reference. If not specified, the view of the\n\n * buffer will start with the first byte.\n\n * @param byteLength The number of elements in the byte array. If unspecified,\n", "file_path": "src/BabylonCpp/include/babylon/core/data_view.h", "rank": 11, "score": 257774.43308189922 }, { "content": "class BABYLON_SHARED_EXPORT VertexData {\n\n\n\npublic:\n\n /**\n\n * Mesh side orientation : usually the external or front surface\n\n */\n\n static constexpr unsigned int FRONTSIDE = VertexDataConstants::FRONTSIDE;\n\n /**\n\n * Mesh side orientation : usually the internal or back surface\n\n */\n\n static constexpr unsigned int BACKSIDE = VertexDataConstants::BACKSIDE;\n\n /**\n\n * Mesh side orientation : both internal and external or front and back\n\n * surfaces\n\n */\n\n static constexpr unsigned int DOUBLESIDE = VertexDataConstants::DOUBLESIDE;\n\n /**\n\n * Mesh side orientation : by default, `FRONTSIDE`\n\n */\n\n static constexpr unsigned int DEFAULTSIDE = VertexDataConstants::DEFAULTSIDE;\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 12, "score": 257774.43308189922 }, { "content": "class BABYLON_SHARED_EXPORT DataBuffer {\n\n\n\npublic:\n\n DataBuffer() : uniqueId{DataBuffer::_Counter++}\n\n {\n\n }\n\n virtual ~DataBuffer() = default;\n\n\n\n /**\n\n * Gets or sets the number of objects referencing this buffer\n\n */\n\n size_t references = 0;\n\n\n\n /**\n\n * Gets or sets the size of the underlying buffer\n\n */\n\n size_t capacity = 0;\n\n\n\n /**\n\n * Gets or sets a boolean indicating if the buffer contains 32bits indices\n", "file_path": "src/BabylonCpp/include/babylon/buffers/data_buffer.h", "rank": 13, "score": 257774.43308189922 }, { "content": " stbi_uc *data;\n", "file_path": "external/stb_image/include/stb_image/stb_image.h", "rank": 14, "score": 257535.0171300436 }, { "content": "namespace BABYLON {\n\n\n\nstruct BABYLON_SHARED_EXPORT AnimationControl {\n\n float from = 0.f;\n\n float to = 0.f;\n\n bool loop = false;\n\n}; // end of struct AnimationControl\n\n\n\nstruct BABYLON_SHARED_EXPORT AnimationReservedDataStore {\n\n bool intialized = false;\n\n Scene* scene = nullptr;\n\n float currentFrame = 0.f;\n\n std::vector<AnimationPtr> _animations;\n\n std::vector<AnimationRangePtr> _ranges;\n\n AnimationControl _animationControl;\n\n AnimatablePtr _runningAnimatable = nullptr;\n\n Observer<Scene>::Ptr _onBeforeRenderObserver = nullptr;\n\n bool _isPlaying = false;\n\n}; // end of struct AnimationReservedDataStore\n\n\n", "file_path": "src/BabylonImGui/include/babylon/inspector/components/actiontabs/tabs/propertygrids/animations/animation_reserved_data_store.h", "rank": 15, "score": 253109.74944844976 }, { "content": "namespace BABYLON {\n\n\n\nstruct BABYLON_SHARED_EXPORT TextureReservedDataStore {\n\n int width = 256;\n\n int height = 256;\n\n bool displayRed = true;\n\n bool displayGreen = true;\n\n bool displayBlue = true;\n\n bool displayAlpha = true;\n\n unsigned int face = 0;\n\n}; // end of struct SkeletonReservedDataStore\n\n\n", "file_path": "src/BabylonImGui/include/babylon/inspector/components/actiontabs/tabs/propertygrids/materials/texture_reserved_data_store.h", "rank": 16, "score": 253109.74944844976 }, { "content": "namespace BABYLON {\n\nnamespace Debug {\n\nFWD_CLASS_SPTR(SkeletonViewer)\n\n} // end of namespace Debug\n\n\n\nstruct BABYLON_SHARED_EXPORT SkeletonReservedDataStore {\n\n bool skeletonViewersEnabled = false;\n\n std::vector<Debug::SkeletonViewerPtr> skeletonViewers = {};\n\n Debug::SkeletonViewerPtr skeletonViewer = nullptr;\n\n}; // end of struct SkeletonReservedDataStore\n\n\n", "file_path": "src/BabylonImGui/include/babylon/inspector/components/actiontabs/tabs/propertygrids/meshes/skeleton_reserved_data_store.h", "rank": 17, "score": 253109.74944844976 }, { "content": "namespace BABYLON {\n\n\n\nFWD_CLASS_SPTR(AbstractMesh)\n\nFWD_CLASS_SPTR(LinesMesh)\n\nFWD_CLASS_SPTR(Material)\n\n\n\nstruct BABYLON_SHARED_EXPORT MeshReservedDataStore {\n\n bool hidden = false;\n\n bool displayNormals = false;\n\n bool renderGridEnabled = false;\n\n bool renderWireframeOver = false;\n\n bool renderNormalVectors = false;\n\n bool normalMaterialHidden = true;\n\n bool isInspectorGrid = false;\n\n bool isVertexColorMaterial = false;\n\n bool displayVertexColors = false;\n\n AbstractMeshPtr gridMesh = nullptr;\n\n LinesMeshPtr normalLines = nullptr;\n\n MaterialPtr originalMaterial = nullptr;\n\n}; // end of struct MeshReservedDataStore\n\n\n", "file_path": "src/BabylonImGui/include/babylon/inspector/components/actiontabs/tabs/propertygrids/meshes/mesh_reserved_data_store.h", "rank": 18, "score": 253109.7494484497 }, { "content": "class BABYLON_SHARED_EXPORT _MeshCollisionData {\n\n\n\npublic:\n\n _MeshCollisionData();\n\n _MeshCollisionData(const _MeshCollisionData& other);\n\n _MeshCollisionData(_MeshCollisionData&& other);\n\n _MeshCollisionData& operator=(const _MeshCollisionData& other);\n\n _MeshCollisionData& operator=(_MeshCollisionData&& other);\n\n ~_MeshCollisionData(); // = default\n\n\n\npublic:\n\n bool _checkCollisions;\n\n int _collisionMask;\n\n int _collisionGroup;\n\n std::vector<AbstractMeshPtr> _surroundingMeshes;\n\n ColliderPtr _collider;\n\n Vector3 _oldPositionForCollisions;\n\n Vector3 _diffPositionForCollisions;\n\n Observer<AbstractMesh>::Ptr _onCollideObserver;\n\n Observer<Vector3>::Ptr _onCollisionPositionChangeObserver;\n\n bool _collisionResponse;\n\n\n\n}; // end of class _MeshCollisionData\n\n\n\n} // end of namespace BABYLON\n\n\n\n#endif // end of BABYLON_COLLISIONS_MESH_COLLISION_DATA_H\n", "file_path": "src/BabylonCpp/include/babylon/collisions/_mesh_collision_data.h", "rank": 19, "score": 249819.5403824199 }, { "content": "struct BABYLON_SHARED_EXPORT _InstanceDataStorage {\n\n _VisibleInstancesPtr visibleInstances = nullptr;\n\n Int32Array renderIdForInstances;\n\n _InstancesBatchPtr batchCache = nullptr;\n\n // let's start with a maximum of 32 instances\n\n unsigned int instancesBufferSize = 32 * 16 * 4;\n\n BufferPtr instancesBuffer = nullptr;\n\n Float32Array instancesData;\n\n size_t overridenInstanceCount;\n\n bool isFrozen = false;\n\n _InstancesBatchPtr previousBatch = nullptr;\n\n bool hardwareInstancedRendering = false;\n\n std::optional<unsigned int> sideOrientation = std::nullopt;\n\n bool manualUpdate = false;\n\n std::optional<unsigned int> previousRenderId = std::nullopt;\n\n}; // end of struct _InstanceDataStorage\n\n\n\n} // end of namespace BABYLON\n\n\n\n#endif // end of BABYLON_MESHES_INSTANCE_DATA_STORAGE_H\n", "file_path": "src/BabylonCpp/include/babylon/meshes/_instance_data_storage.h", "rank": 20, "score": 249819.5403824199 }, { "content": "#ifndef BABYLON_MESHES_VERTEX_DATA_H\n\n#define BABYLON_MESHES_VERTEX_DATA_H\n\n\n\n#include <optional>\n\n\n\n#include <babylon/babylon_api.h>\n\n#include <babylon/maths/vector4.h>\n\n#include <babylon/meshes/mesh.h>\n\n#include <babylon/meshes/vertex_data_constants.h>\n\n\n\nnamespace BABYLON {\n\n\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 21, "score": 242746.34670099593 }, { "content": "#ifndef BABYLON_BUFFERS_DATA_BUFFER_H\n\n#define BABYLON_BUFFERS_DATA_BUFFER_H\n\n\n\n#include <babylon/babylon_api.h>\n\n#include <babylon/babylon_common.h>\n\n\n\nnamespace BABYLON {\n\n\n\n/**\n\n * @brief Class used to store gfx data (like WebGLBuffer).\n\n */\n\ntemplate <class T>\n", "file_path": "src/BabylonCpp/include/babylon/buffers/data_buffer.h", "rank": 22, "score": 242744.77108928346 }, { "content": "#ifndef BABYLON_CORE_DATA_VIEW_H\n\n#define BABYLON_CORE_DATA_VIEW_H\n\n\n\n#include <babylon/babylon_api.h>\n\n#include <babylon/babylon_common.h>\n\n\n\nnamespace BABYLON {\n\n\n\n/**\n\n * @brief The DataView view provides a low-level interface for reading and\n\n * writing multiple number types in an ArrayBuffer irrespective of the\n\n * platform's endianness.\n\n */\n", "file_path": "src/BabylonCpp/include/babylon/core/data_view.h", "rank": 23, "score": 242744.1485595127 }, { "content": "\n\n /**\n\n * An array of i, j, k the three vertex indices required for each triangular facet [...., i, j, k\n\n * .....]\n\n */\n\n IndicesArray indices;\n\n\n\npublic:\n\n Uint32Array _idx;\n\n\n\n}; // end of class VertexData\n\n\n\n} // end of namespace BABYLON\n\n\n\n#endif // end of BABYLON_MESHES_VERTEX_DATA_H\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 24, "score": 242736.46047418407 }, { "content": " * The length (in bytes) of this view from the start of its ArrayBuffer\n\n */\n\n size_t _byteLength;\n\n\n\n /**\n\n * The offset (in bytes) of this view from the start of its ArrayBuffer\n\n */\n\n size_t _byteOffset;\n\n\n\n}; // end of class DataView\n\n\n\n} // end of namespace BABYLON\n\n\n\n#endif // end of BABYLON_CORE_DATA_VIEW_H\n", "file_path": "src/BabylonCpp/include/babylon/core/data_view.h", "rank": 25, "score": 242735.58263203438 }, { "content": " */\n\n bool is32Bits = false;\n\n\n\n /**\n\n * @brief Gets the underlying buffer\n\n */\n\n virtual T underlyingResource()\n\n {\n\n return nullptr;\n\n }\n\n\n\n /**\n\n * @brief Gets the unique id of this buffer\n\n */\n\n const size_t uniqueId;\n\n\n\nprivate:\n\n static inline size_t _Counter = 0;\n\n\n\n}; // end of class DataBuffer\n\n\n\n} // end of namespace BABYLON\n\n\n\n#endif // end of BABYLON_BUFFERS_DATA_BUFFER_H\n", "file_path": "src/BabylonCpp/include/babylon/buffers/data_buffer.h", "rank": 26, "score": 242734.44427930765 }, { "content": "\n\npublic:\n\n VertexData();\n\n ~VertexData(); // = default\n\n\n\n /**\n\n * @brief Uses the passed data array to set the set the values for the specified kind of data.\n\n * @param data a linear array of floating numbers\n\n * @param kind the type of data that is being set, eg positions, colors etc\n\n */\n\n void set(const Float32Array& data, const std::string& kind);\n\n\n\n /**\n\n * @brief Associates the vertexData to the passed Mesh.\n\n * Sets it as updatable or not (default `false`)\n\n * @param mesh the mesh the vertexData is applied to\n\n * @param updatable when used and having the value true allows new data to update the vertexData\n\n * @returns the VertexData\n\n */\n\n VertexData& applyToMesh(Mesh& mesh, const std::optional<bool>& updatable = std::nullopt);\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 27, "score": 242733.60249920381 }, { "content": " * @returns the VertexData of the TiledGround\n\n */\n\n // clang-format on\n\n static std::unique_ptr<VertexData> CreateTiledGround(TiledGroundOptions& options);\n\n\n\n // clang-format off\n\n /**\n\n * @brief Creates the VertexData of the Ground designed from a heightmap.\n\n * @param options an object used to set the following parameters for the Ground, required and provided by MeshBuilder.CreateGroundFromHeightMap\n\n * * width the width (x direction) of the ground\n\n * * height the height (z direction) of the ground\n\n * * subdivisions the number of subdivisions per side\n\n * * minHeight the minimum altitude on the ground, optional, default 0\n\n * * maxHeight the maximum altitude on the ground, optional default 1\n\n * * colorFilter the filter to apply to the image pixel colors to compute the height, optional Color3, default (0.3, 0.59, 0.11)\n\n * * buffer the array holding the image color data\n\n * * bufferWidth the width of image\n\n * * bufferHeight the height of image\n\n * * alphaFilter Remove any data where the alpha channel is below this value, defaults 0 (all data visible)\n\n * @returns the VertexData of the Ground designed from a heightmap\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 28, "score": 242732.79250361345 }, { "content": " * * bbSize : optional bounding box size data, required for facetPartitioning computation\n\n * * subDiv : optional partitioning data about subdivisions on each axis (int), required for facetPartitioning computation\n\n * * useRightHandedSystem: optional boolean to for right handed system computation\n\n * * depthSort : optional boolean to enable the facet depth sort computation\n\n * * distanceTo : optional Vector3 to compute the facet depth from this location\n\n * * depthSortedFacets : optional array of depthSortedFacets to store the facet distances from the reference location\n\n */\n\n // clang-format on\n\n static void ComputeNormals(const Float32Array& positions, const Uint32Array& indices,\n\n Float32Array& normals,\n\n std::optional<FacetParameters> options = std::nullopt);\n\n\n\n /**\n\n * @brief Applies VertexData created from the imported parameters to the\n\n * geometry.\n\n * @param parsedVertexData the parsed data from an imported file\n\n * @param geometry the geometry to apply the VertexData to\n\n */\n\n static void ImportVertexData(const json& parsedVertexData, Geometry& geometry);\n\n\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 29, "score": 242728.48017013868 }, { "content": " * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n\n * @returns the VertexData of the box\n\n */\n\n // clang-format on\n\n static std::unique_ptr<VertexData> CreateBox(BoxOptions& options);\n\n\n\n // clang-format off\n\n /**\n\n * @brief Creates the VertexData for a tiled box.\n\n * @param options an object used to set the following optional parameters for the box, required but can be empty\n\n * * faceTiles sets the pattern, tile size and number of tiles for a face\n\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\n\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\n\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n\n * @returns the VertexData of the box\n\n */\n\n // clang-format on\n\n static std::unique_ptr<VertexData> CreateTiledBox(TiledBoxOptions& options);\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 30, "score": 242728.44293349437 }, { "content": " * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n\n * * invertUV swaps in the U and V coordinates when applying a texture, optional, default false\n\n * * uvs a linear array, of length 2 * number of vertices, of custom UV values, optional\n\n * * colors a linear array, of length 4 * number of vertices, of custom color values, optional\n\n * @returns the VertexData of the ribbon\n\n */\n\n // clang-format on\n\n static std::unique_ptr<VertexData> CreateRibbon(RibbonOptions& options);\n\n\n\n // clang-format off\n\n /**\n\n * @brief Creates the VertexData for a box.\n\n * @param options an object used to set the following optional parameters for the box, required but can be empty\n\n * * size sets the width, height and depth of the box to the value of size, optional default 1\n\n * * width sets the width (x direction) of the box, overwrites the width set by size, optional, default size\n\n * * height sets the height (y direction) of the box, overwrites the height set by size, optional, default size\n\n * * depth sets the depth (z direction) of the box, overwrites the depth set by size, optional, default size\n\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\n\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 31, "score": 242726.45364409222 }, { "content": " /**\n\n * @brief Creates the VertexData for a torus.\n\n * @param options an object used to set the following optional parameters for the box, required but can be empty\n\n * * diameter the diameter of the torus, optional default 1\n\n * * thickness the diameter of the tube forming the torus, optional default 0.5\n\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\n\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n\n * @returns the VertexData of the torus\n\n */\n\n // clang-format on\n\n static std::unique_ptr<VertexData> CreateTorus(TorusOptions& options);\n\n\n\n // clang-format off\n\n /**\n\n * @brief Creates the VertexData of the LineSystem.\n\n * @param options an object used to set the following optional parameters for the LineSystem, required but can be empty\n\n * - lines an array of lines, each line being an array of successive Vector3\n\n * - colors an array of line colors, each of the line colors being an array of successive Color4, one per line point\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 32, "score": 242725.73760956386 }, { "content": " /**\n\n * @brief Hidden\n\n * @param sideOrientation\n\n * @param positions\n\n * @param indices\n\n * @param normals\n\n * @param uvs\n\n * @param frontUVs\n\n * @param backUVs\n\n */\n\n static void _ComputeSides(std::optional<uint32_t> sideOrientation, Float32Array& positions,\n\n Uint32Array& indices, Float32Array& normals, Float32Array& uvs,\n\n const std::optional<Vector4>& frontUVs = std::nullopt,\n\n const std::optional<Vector4>& backUVs = std::nullopt);\n\n\n\nprivate:\n\n VertexData& _applyTo(IGetSetVerticesData& meshOrGeometry,\n\n const std::optional<bool>& updatable = std::nullopt);\n\n VertexData& _update(IGetSetVerticesData* meshOrGeometry, bool updateExtends = false,\n\n bool makeItUnique = false);\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 33, "score": 242725.69488371973 }, { "content": " [[nodiscard]] Float32Array _mergeElement(const Float32Array& source,\n\n const Float32Array& other) const;\n\n void _validate();\n\n static std::unique_ptr<VertexData> _ExtractFrom(IGetSetVerticesData* meshOrGeometry,\n\n bool copyWhenShared = false,\n\n bool forceCopy = false);\n\n\n\npublic:\n\n /**\n\n * An array of the x, y, z position of each vertex [...., x, y, z, .....]\n\n */\n\n Float32Array positions;\n\n\n\n /**\n\n * An array of the x, y, z normal vector of each vertex [...., x, y, z, .....]\n\n */\n\n Float32Array normals;\n\n\n\n /**\n\n * An array of the x, y, z tangent vector of each vertex [...., x, y, z, .....]\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 34, "score": 242725.6664446638 }, { "content": " * length of the view will match the buffer's length.\n\n */\n\n DataView(const ArrayBuffer& buffer, size_t byteOffset, size_t byteLength);\n\n\n\n DataView(const DataView& other); // Copy constructor\n\n DataView(DataView&& other); // Move constructor\n\n DataView& operator=(const DataView& other); // Copy assignment operator\n\n DataView& operator=(DataView&& other); // Move assignment operator\n\n ~DataView(); // = default\n\n\n\n /**\n\n * @brief Gets a signed 8-bit integer (byte) at the specified byte offset from\n\n * the start of the DataView.\n\n * @param byteOffset The offset, in byte, from the start of the view where to\n\n * read the data.\n\n * @param littleEndian\n\n * @return A signed 8-bit integer number.\n\n */\n\n [[nodiscard]] int8_t getInt8(size_t byteOffset) const;\n\n\n", "file_path": "src/BabylonCpp/include/babylon/core/data_view.h", "rank": 35, "score": 242725.4578551883 }, { "content": " * @returns VertexData.\n\n */\n\n VertexData& updateGeometry(Geometry* geometry);\n\n\n\n /**\n\n * @brief Transforms each position and each normal of the vertexData according to the passed\n\n * Matrix.\n\n * @param matrix the transforming matrix\n\n * @returns the VertexData\n\n */\n\n VertexData& transform(const Matrix& matrix);\n\n\n\n /**\n\n * @brief Merges the passed VertexData into the current one\n\n * @param other the VertexData to be merged into the current one\n\n * @param use32BitsIndices defines a boolean indicating if indices must be store in a 32 bits\n\n * array\n\n * @returns the modified VertexData\n\n */\n\n VertexData& merge(VertexData& other, bool use32BitsIndices = false);\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 36, "score": 242725.4528457165 }, { "content": "\n\n /**\n\n * @brief Associates the vertexData to the passed Geometry.\n\n * Sets it as updatable or not (default `false`)\n\n * @param geometry the geometry the vertexData is applied to\n\n * @param updatable when used and having the value true allows new data to update the vertexData\n\n * @returns VertexData\n\n */\n\n VertexData& applyToGeometry(Geometry& geometry, bool updatable = false);\n\n\n\n /**\n\n * @brief Updates the associated mesh.\n\n * @param mesh the mesh to be updated\n\n * @returns VertexData\n\n */\n\n VertexData& updateMesh(Mesh* mesh);\n\n\n\n /**\n\n * @brief Updates the associated geometry.\n\n * @param geometry the geometry to be updated\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 37, "score": 242725.08044815346 }, { "content": "\n\n /**\n\n * @brief Serializes the VertexData.\n\n * @returns a serialized object\n\n */\n\n [[nodiscard]] json serialize() const;\n\n\n\n /** Statics **/\n\n\n\n /**\n\n * @brief Extracts the vertexData from a mesh.\n\n * @param mesh the mesh from which to extract the VertexData\n\n * @param copyWhenShared defines if the VertexData must be cloned when shared between multiple\n\n * meshes, optional, default false\n\n * @param forceCopy indicating that the VertexData must be cloned, optional, default false\n\n * @returns the object VertexData associated to the passed mesh\n\n */\n\n static std::unique_ptr<VertexData> ExtractFromMesh(Mesh* mesh, bool copyWhenShared = false,\n\n bool forceCopy = false);\n\n\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 38, "score": 242724.58364996145 }, { "content": " * * size the size of the IcoSphere, optional default 1\n\n * * sizeX allows stretching in the x direction, optional, default size\n\n * * sizeY allows stretching in the y direction, optional, default size\n\n * * sizeZ allows stretching in the z direction, optional, default size\n\n * * custom a number that overwrites the type to create from an extended set of polyhedron from https://www.babylonjs-playground.com/#21QRSK#15 with minimised editor\n\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\n\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\n\n * * flat when true creates a flat shaded mesh, optional, default true\n\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\n\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n\n * @returns the VertexData of the Polyhedron\n\n */\n\n // clang-format on\n\n static std::unique_ptr<VertexData> CreatePolyhedron(PolyhedronOptions& options);\n\n\n\n /**\n\n * @brief Creates the VertexData for a Capsule, inspired from\n\n * https://github.com/maximeq/three-js-capsule-geometry/blob/master/src/CapsuleBufferGeometry.js\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 39, "score": 242724.56656918526 }, { "content": " * * height sets the height (y direction) of the cylinder, optional, default 2\n\n * * diameterTop sets the diameter of the top of the cone, overwrites diameter, optional, default diameter\n\n * * diameterBottom sets the diameter of the bottom of the cone, overwrites diameter, optional, default diameter\n\n * * diameter sets the diameter of the top and bottom of the cone, optional default 1\n\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\n\n * * subdivisions` the number of rings along the cylinder height, optional, default 1\n\n * * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1\n\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\n\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\n\n * * hasRings when true makes each subdivision independantly treated as a face for faceUV and faceColors, optional, default false\n\n * * enclose when true closes an open cylinder by adding extra flat faces between the height axis and vertical edges, think cut cake\n\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n\n * @returns the VertexData of the cylinder, cone or prism\n\n */\n\n // clang-format on\n\n static std::unique_ptr<VertexData> CreateCylinder(CylinderOptions& options);\n\n\n\n // clang-format off\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 40, "score": 242722.866765618 }, { "content": " * @returns the VertexData of the LineSystem\n\n */\n\n // clang-format on\n\n static std::unique_ptr<VertexData> CreateLineSystem(LineSystemOptions& options);\n\n\n\n // clang-format off\n\n /**\n\n * @brief Create the VertexData for a DashedLines.\n\n * @param options an object used to set the following optional parameters for the DashedLines, required but can be empty\n\n * - points an array successive Vector3\n\n * - dashSize the size of the dashes relative to the dash number, optional, default 3\n\n * - gapSize the size of the gap between two successive dashes relative to the dash number, optional, default 1\n\n * - dashNb the intended total number of dashes, optional, default 200\n\n * @returns the VertexData for the DashedLines\n\n */\n\n // clang-format on\n\n static std::unique_ptr<VertexData> CreateDashedLines(DashedLinesOptions& options);\n\n\n\n // clang-format off\n\n /**\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 41, "score": 242722.73250359567 }, { "content": " /**\n\n * @brief Extracts the vertexData from the geometry.\n\n * @param geometry the geometry from which to extract the VertexData\n\n * @param copyWhenShared defines if the VertexData must be cloned when the geometry is shared\n\n * between multiple meshes, optional, default false\n\n * @param forceCopy indicating that the VertexData must be cloned, optional, default false\n\n * @returns the object VertexData associated to the passed mesh\n\n */\n\n static std::unique_ptr<VertexData> ExtractFromGeometry(Geometry* geometry, bool copyWhenShared,\n\n bool forceCopy = false);\n\n\n\n // clang-format off\n\n /**\n\n * C@brief reates the VertexData for a Ribbon.\n\n * @param options an object used to set the following optional parameters for the ribbon, required but can be empty\n\n * * pathArray array of paths, each of which an array of successive Vector3\n\n * * closeArray creates a seam between the first and the last paths of the pathArray, optional, default false\n\n * * closePath creates a seam between the first and the last points of each path of the path array, optional, default false\n\n * * offset a positive integer, only used when pathArray contains a single path (offset = 10 means the point 1 is joined to the point 11), default rounded half size of the pathArray length\n\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 42, "score": 242722.6238963251 }, { "content": " * @param fUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\n\n * @param fColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\n\n * @param frontUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n\n * @param backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n\n * @param wrap a boolean, default false, when true and fUVs used texture is wrapped around all sides, when false texture is applied side\n\n * @returns the VertexData of the Polygon\n\n */\n\n // clang-format on\n\n static std::unique_ptr<VertexData> CreatePolygon(\n\n Mesh* polygon, unsigned int sideOrientation, const std::array<std::optional<Vector4>, 3>& fUV,\n\n const std::optional<std::array<std::optional<Color4>, 3>>& fColors, Vector4& frontUVs,\n\n Vector4& backUVs, const std::optional<bool>& wrap = std::nullopt);\n\n\n\n // clang-format off\n\n /**\n\n * @brief Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided\n\n * * The parameter `radius` sets the radius size (float) of the icosphere (default 1)\n\n * * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value of `radius`)\n\n * * The parameter `subdivisions` sets the number of subdivisions (positive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size\n\n * * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 43, "score": 242722.5355849987 }, { "content": " /**\n\n * @brief Gets an unsigned 8-bit integer (unsigned byte) at the specified byte\n\n * offset from the start of the DataView.\n\n * @param byteOffset The offset, in byte, from the start of the view where to\n\n * read the data.\n\n * @param littleEndian\n\n * @return An unsigned 8-bit integer number.\n\n */\n\n [[nodiscard]] uint8_t getUint8(size_t byteOffset) const;\n\n\n\n /**\n\n * @brief Gets a signed 16-bit integer (short) at the specified byte offset\n\n * from the start of the DataView.\n\n * @param byteOffset The offset, in byte, from the start of the view where to\n\n * read the data.\n\n * @param littleEndian Indicates whether the 16-bit int is stored in little-\n\n * or big-endian format. If false or undefined, a big-endian value is read.\n\n * @return A signed 16-bit integer number.\n\n */\n\n [[nodiscard]] int16_t getInt16(size_t byteOffset, bool littleEndian = true) const;\n", "file_path": "src/BabylonCpp/include/babylon/core/data_view.h", "rank": 44, "score": 242721.96900292012 }, { "content": " */\n\n [[nodiscard]] uint16_t getUint16(size_t byteOffset, bool littleEndian = true) const;\n\n\n\n /**\n\n * @brief Gets an unsigned 32-bit integer (unsigned short) at the specified\n\n * byte offset from the start of the DataView.\n\n * @param byteOffset The offset, in byte, from the start of the view where to\n\n * read the data.\n\n * @param littleEndian Indicates whether the 16-bit int is stored in little-\n\n * or big-endian format. If false or undefined, a big-endian value is read.\n\n * @return An unsigned 32-bit integer number.\n\n */\n\n [[nodiscard]] uint32_t getUint32(size_t byteOffset, bool littleEndian = true) const;\n\n\n\n /**\n\n * @brief Gets a signed 32-bit float (float) at the specified byte offset from\n\n * the start of the DataView.\n\n * @param byteOffset The offset, in byte, from the start of the view where to\n\n * read the data.\n\n * @param littleEndian Indicates whether the 32-bit float is stored in little-\n", "file_path": "src/BabylonCpp/include/babylon/core/data_view.h", "rank": 45, "score": 242721.75145879746 }, { "content": "\n\n /**\n\n * @brief Gets a signed 32-bit integer (signed short) at the specified byte\n\n * offset from the start of the DataView.\n\n * @param byteOffset The offset, in byte, from the start of the view where to\n\n * read the data.\n\n * @param littleEndian Indicates whether the 32-bit int is stored in little-\n\n * or big-endian format. If false or undefined, a big-endian value is read.\n\n * @return A signed 32-bit integer number.\n\n */\n\n [[nodiscard]] int32_t getInt32(size_t byteOffset, bool littleEndian = true) const;\n\n\n\n /**\n\n * @brief Gets an unsigned 16-bit integer (unsigned short) at the specified\n\n * byte offset from the start of the DataView.\n\n * @param byteOffset The offset, in byte, from the start of the view where to\n\n * read the data.\n\n * @param littleEndian Indicates whether the 16-bit int is stored in little-\n\n * or big-endian format. If false or undefined, a big-endian value is read.\n\n * @return An unsigned 16-bit integer number.\n", "file_path": "src/BabylonCpp/include/babylon/core/data_view.h", "rank": 46, "score": 242721.64519622977 }, { "content": " * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\n\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\n\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n\n * @param name defines the name of the mesh\n\n * @param options defines the options used to create the mesh\n\n * @param scene defines the hosting scene\n\n * @returns the icosahedron mesh\n\n * @see https://doc.babylonjs.com/how_to/polyhedra_shapes#icosphere\n\n */\n\n // clang-format on\n\n static std::unique_ptr<VertexData> CreateIcoSphere(IcoSphereOptions& options);\n\n\n\n // clang-format off\n\n // inspired from // http://stemkoski.github.io/Three.js/Polyhedra.html\n\n /**\n\n * @brief Creates the VertexData for a Polyhedron.\n\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\n\n * * type provided types are:\n\n * * 0 : Tetrahedron, 1 : Octahedron, 2 : Dodecahedron, 3 : Icosahedron, 4 : Rhombicuboctahedron, 5 : Triangular Prism, 6 : Pentagonal Prism, 7 : Hexagonal Prism, 8 : Square Pyramid (J1)\n\n * * 9 : Pentagonal Pyramid (J2), 10 : Triangular Dipyramid (J12), 11 : Pentagonal Dipyramid (J13), 12 : Elongated Square Dipyramid (J15), 13 : Elongated Pentagonal Dipyramid (J16), 14 : Elongated Pentagonal Cupola (J20)\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 47, "score": 242721.26625314326 }, { "content": " * @brief Creates the VertexData for a Ground.\n\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\n\n * - width the width (x direction) of the ground, optional, default 1\n\n * - height the height (z direction) of the ground, optional, default 1\n\n * - subdivisions the number of subdivisions per side, optional, default 1\n\n * @returns the VertexData of the Ground\n\n */\n\n // clang-format on\n\n static std::unique_ptr<VertexData> CreateGround(GroundOptions& options);\n\n\n\n // clang-format off\n\n /**\n\n * @brief Creates the VertexData for a TiledGround by subdividing the ground into tiles.\n\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\n\n * * xmin the ground minimum X coordinate, optional, default -1\n\n * * zmin the ground minimum Z coordinate, optional, default -1\n\n * * xmax the ground maximum X coordinate, optional, default 1\n\n * * zmax the ground maximum Z coordinate, optional, default 1\n\n * * subdivisions a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the ground width and height creating 'tiles', default {w: 6, h: 6}\n\n * * precision a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the tile width and height, default {w: 2, h: 2}\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 48, "score": 242720.72694837398 }, { "content": " */\n\n // clang-format on\n\n static std::unique_ptr<VertexData> CreateGroundFromHeightMap(GroundFromHeightMapOptions& options);\n\n\n\n // clang-format off\n\n /**\n\n * @brief Creates the VertexData for a Plane.\n\n * @param options an object used to set the following optional parameters for the plane, required but can be empty\n\n * * size sets the width and height of the plane to the value of size, optional default 1\n\n * * width sets the width (x direction) of the plane, overwrites the width set by size, optional, default size\n\n * * height sets the height (y direction) of the plane, overwrites the height set by size, optional, default size\n\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n\n * @returns the VertexData of the box\n\n */\n\n // clang-format on\n\n static std::unique_ptr<VertexData> CreatePlane(PlaneOptions& options);\n\n\n\n // clang-format off\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 49, "score": 242720.42811271426 }, { "content": "\n\n // clang-format off\n\n /**\n\n * @brief Creates the VertexData for a tiled plane.\n\n * @param options an object used to set the following optional parameters for the box, required but can be empty\n\n * * pattern a limited pattern arrangement depending on the number\n\n * * tileSize sets the width, height and depth of the tile to the value of size, optional default 1\n\n * * tileWidth sets the width (x direction) of the tile, overwrites the width set by size, optional, default size\n\n * * tileHeight sets the height (y direction) of the tile, overwrites the height set by size, optional, default size\n\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n\n * @returns the VertexData of the tiled plane\n\n */\n\n // clang-format on\n\n static std::unique_ptr<VertexData> CreateTiledPlane(TiledPlaneOptions& options);\n\n\n\n // clang-format off\n\n /**\n\n * @brief Creates the VertexData for an ellipsoid, defaults to a sphere.\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 50, "score": 242720.31245136703 }, { "content": " /**\n\n * @brief Creates the VertexData of the Disc or regular Polygon.\n\n * @param options an object used to set the following optional parameters for the disc, required but can be empty\n\n * * radius the radius of the disc, optional default 0.5\n\n * * tessellation the number of polygon sides, optional, default 64\n\n * * arc a number from 0 to 1, to create an unclosed polygon based on the fraction of the circumference given by the arc value, optional, default 1\n\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n\n * @returns the VertexData of the box\n\n */\n\n // clang-format on\n\n static std::unique_ptr<VertexData> CreateDisc(DiscOptions& options);\n\n\n\n // clang-format off\n\n /**\n\n * @brief Creates the VertexData for an irregular Polygon in the XoZ plane using a mesh built by polygonTriangulation.build().\n\n * All parameters are provided by MeshBuilder.CreatePolygon as needed\n\n * @param polygon a mesh built from polygonTriangulation.build()\n\n * @param sideOrientation takes the values Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 51, "score": 242720.00515010004 }, { "content": " * @param options an object used to set the following optional parameters for the capsule,\n\n * required but can be empty\n\n * @returns the VertexData of the Capsule\n\n * @see https://doc.babylonjs.com/how_to/capsule_shape\n\n */\n\n static std::unique_ptr<VertexData> CreateCapsule(const ICreateCapsuleOptions& options);\n\n\n\n // clang-format off\n\n // based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3D/src/away3d/primitives/TorusKnot.as?spec=svn2473&r=2473\n\n /**\n\n * @brief Creates the VertexData for a TorusKnot.\n\n * @param options an object used to set the following optional parameters for the TorusKnot, required but can be empty\n\n * * radius the radius of the torus knot, optional, default 2\n\n * * tube the thickness of the tube, optional, default 0.5\n\n * * radialSegments the number of sides on each tube segments, optional, default 32\n\n * * tubularSegments the number of tubes to decompose the knot into, optional, default 32\n\n * * p the number of windings around the z axis, optional, default 2\n\n * * q the number of windings around the x axis, optional, default 3\n\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 52, "score": 242718.94254400345 }, { "content": " * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n\n * @returns the VertexData of the Torus Knot\n\n */\n\n // clang-format on\n\n static std::unique_ptr<VertexData> CreateTorusKnot(TorusKnotOptions& options);\n\n\n\n /** Tools **/\n\n\n\n // clang-format off\n\n /**\n\n * @brief Compute normals for given positions and indices.\n\n * @param positions an array of vertex positions, [...., x, y, z, ......]\n\n * @param indices an array of indices in groups of three for each triangular facet, [...., i, j, k, ......]\n\n * @param normals an array of vertex normals, [...., x, y, z, ......]\n\n * @param options an object used to set the following optional parameters for the TorusKnot, optional\n\n * * facetNormals : optional array of facet normals (vector3)\n\n * * facetPositions : optional array of facet positions (vector3)\n\n * * facetPartitioning : optional partitioning array. facetPositions is required for facetPartitioning computation\n\n * * ratio : optional partitioning ratio / bounding box, required for facetPartitioning computation\n\n * * bInfo : optional bounding info, required for facetPartitioning computation\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 53, "score": 242717.66937879243 }, { "content": " * @param options an object used to set the following optional parameters for the box, required but can be empty\n\n * * segments sets the number of horizontal strips optional, default 32\n\n * * diameter sets the axes dimensions, diameterX, diameterY and diameterZ to the value of diameter, optional default 1\n\n * * diameterX sets the diameterX (x direction) of the ellipsoid, overwrites the diameterX set by diameter, optional, default diameter\n\n * * diameterY sets the diameterY (y direction) of the ellipsoid, overwrites the diameterY set by diameter, optional, default diameter\n\n * * diameterZ sets the diameterZ (z direction) of the ellipsoid, overwrites the diameterZ set by diameter, optional, default diameter\n\n * * arc a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the circumference (latitude) given by the arc value, optional, default 1\n\n * * slice a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the height (latitude) given by the arc value, optional, default 1\n\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n\n * @returns the VertexData of the ellipsoid\n\n */\n\n // clang-format on\n\n static std::unique_ptr<VertexData> CreateSphere(SphereOptions& options);\n\n\n\n // clang-format off\n\n /**\n\n * @brief Creates the VertexData for a cylinder, cone or prism.\n\n * @param options an object used to set the following optional parameters for the box, required but can be empty\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 54, "score": 242717.5909740402 }, { "content": " */\n\n Float32Array uvs4;\n\n\n\n /**\n\n * A fifth array of u,v which maps a texture image onto each vertex [...., u, v, .....]\n\n */\n\n Float32Array uvs5;\n\n\n\n /**\n\n * A sixth array of u,v which maps a texture image onto each vertex [...., u, v, .....]\n\n */\n\n Float32Array uvs6;\n\n\n\n /**\n\n * An array of the r, g, b, a, color of each vertex [...., r, g, b, a, .....]\n\n */\n\n Float32Array colors;\n\n\n\n /**\n\n * An array containing the list of indices to the array of matrices produced by bones, each vertex\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 55, "score": 242714.84709076048 }, { "content": " * or big-endian format. If false or undefined, a big-endian value is read.\n\n * @return A signed 32-bit float number.\n\n */\n\n [[nodiscard]] float getFloat32(size_t byteOffset, bool littleEndian = true) const;\n\n\n\n /**\n\n * @brief Revert the endianness of a value.\n\n * Not as fast hardware based, but will probably never need to use\n\n * @param val defines the value to convert\n\n * @returns the new value\n\n */\n\n static int switchEndianness(int val);\n\n\n\nprivate:\n\n /**\n\n * The ArrayBuffer referenced by this view\n\n */\n\n ArrayBuffer _buffer;\n\n\n\n /**\n", "file_path": "src/BabylonCpp/include/babylon/core/data_view.h", "rank": 56, "score": 242707.93385243078 }, { "content": " */\n\n Float32Array tangents;\n\n\n\n /**\n\n * An array of u,v which maps a texture image onto each vertex [...., u, v, .....]\n\n */\n\n Float32Array uvs;\n\n\n\n /**\n\n * A second array of u,v which maps a texture image onto each vertex [...., u, v, .....]\n\n */\n\n Float32Array uvs2;\n\n\n\n /**\n\n * A third array of u,v which maps a texture image onto each vertex [...., u, v, .....]\n\n */\n\n Float32Array uvs3;\n\n\n\n /**\n\n * A fourth array of u,v which maps a texture image onto each vertex [...., u, v, .....]\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 57, "score": 242707.93385243078 }, { "content": " * have up to 4 indices (8 if the matricesIndicesExtra is set).\n\n */\n\n Float32Array matricesIndices;\n\n\n\n /**\n\n * An array containing the list of weights defining the weight of each indexed matrix in the final\n\n * computation\n\n */\n\n Float32Array matricesWeights;\n\n\n\n /**\n\n * An array extending the number of possible indices\n\n */\n\n Float32Array matricesIndicesExtra;\n\n\n\n /**\n\n * An array extending the number of possible weights when the number of\n\n * indices is extended\n\n */\n\n Float32Array matricesWeightsExtra;\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 58, "score": 242707.93385243078 }, { "content": "struct BABYLON_SHARED_EXPORT PhysicsVortexEventData {\n\n /**\n\n * A cylinder used for the vortex event\n\n */\n\n MeshPtr cylinder = nullptr;\n\n}; // end of struct PhysicsVortexEventData\n\n\n\n} // end of namespace BABYLON\n\n\n\n#endif // end of BABYLON_PHYSICS_HELPER_PHYSICS_EVENT_DATA_H\n", "file_path": "src/BabylonCpp/include/babylon/physics/helper/physics_event_data.h", "rank": 59, "score": 242367.3081322092 }, { "content": "struct BABYLON_SHARED_EXPORT _InternalMeshDataInfo {\n\n // Events\n\n Observable<Mesh> _onBeforeRenderObservable;\n\n Observable<Mesh> _onBeforeBindObservable;\n\n Observable<Mesh> _onAfterRenderObservable;\n\n Observable<Mesh> _onBeforeDrawObservable;\n\n Observable<SubMesh> _onBetweenPassObservable;\n\n\n\n // Will be used by ribbons mainly\n\n bool _areNormalsFrozen = false;\n\n // Will be used to save original positions when using software skinning\n\n Float32Array _sourcePositions;\n\n // Will be used to save original normals when using software skinning\n\n Float32Array _sourceNormals;\n\n\n\n // Will be used to save a source mesh reference, If any\n\n Mesh* _source = nullptr;\n\n // Will be used to for fast cloned mesh lookup\n\n std::unordered_map<std::string, Mesh*> meshMap;\n\n\n", "file_path": "src/BabylonCpp/include/babylon/meshes/_internal_mesh_data_info.h", "rank": 60, "score": 242367.3081322092 }, { "content": "struct BABYLON_SHARED_EXPORT PhysicsUpdraftEventData {\n\n /**\n\n * A cylinder used for the updraft event\n\n */\n\n MeshPtr cylinder = nullptr;\n\n}; // end of struct PhysicsUpdraftEventData\n\n\n\n/**\n\n * @brief Interface for vortex event data.\n\n * @see\n\n * https://doc.babylonjs.com/how_to/using_the_physics_engine#further-functionality-of-the-impostor-class\n\n */\n", "file_path": "src/BabylonCpp/include/babylon/physics/helper/physics_event_data.h", "rank": 61, "score": 242367.3081322092 }, { "content": "struct BABYLON_SHARED_EXPORT IGetSetVerticesData {\n\n virtual ~IGetSetVerticesData() = default;\n\n /**\n\n * @brief Gets a boolean indicating if specific vertex data is present.\n\n * @param kind defines the vertex data kind to use\n\n * @returns true is data kind is present\n\n */\n\n [[nodiscard]] virtual bool isVerticesDataPresent(const std::string& kind) const = 0;\n\n\n\n /**\n\n * @brief Gets a specific vertex data attached to this geometry. Float data is constructed if the\n\n * vertex buffer data cannot be returned directly.\n\n * @param kind defines the data kind (Position, normal, etc...)\n\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the\n\n * current geometry is shared between multiple meshes\n\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon\n\n * returning it\n\n * @returns a float array containing vertex data\n\n */\n\n virtual Float32Array getVerticesData(const std::string& kind, bool copyWhenShared = false,\n", "file_path": "src/BabylonCpp/include/babylon/meshes/iget_set_vertices_data.h", "rank": 62, "score": 242367.3081322092 }, { "content": "class BABYLON_SHARED_EXPORT WebGLDataBuffer : public DataBuffer<GL::IGLBufferPtr> {\n\n\n\npublic:\n\n WebGLDataBuffer(const GL::IGLBufferPtr& resource);\n\n ~WebGLDataBuffer() override; // = default\n\n\n\n GL::IGLBufferPtr underlyingResource() override;\n\n\n\nprivate:\n\n GL::IGLBufferPtr _buffer;\n\n\n\n}; // end of class ISimplifier\n\n\n\n} // end of namespace BABYLON\n\n\n\n#endif // end of BABYLON_MESHES_WEBGL_DATA_BUFFER_H\n", "file_path": "src/BabylonCpp/include/babylon/meshes/webgl/webgl_data_buffer.h", "rank": 63, "score": 238926.704617612 }, { "content": "struct BABYLON_SHARED_EXPORT PhysicsRadialExplosionEventData {\n\n /**\n\n * A sphere used for the radial explosion event\n\n */\n\n MeshPtr sphere = nullptr;\n\n}; // end of struct PhysicsRadialExplosionEventData\n\n\n\n/**\n\n * @brief Interface for gravitational field event data.\n\n * @see\n\n * https://doc.babylonjs.com/how_to/using_the_physics_engine#further-functionality-of-the-impostor-class\n\n */\n", "file_path": "src/BabylonCpp/include/babylon/physics/helper/physics_event_data.h", "rank": 64, "score": 238814.23051768215 }, { "content": "struct BABYLON_SHARED_EXPORT PhysicsGravitationalFieldEventData {\n\n /**\n\n * A sphere mesh used for the gravitational field event\n\n */\n\n MeshPtr sphere = nullptr;\n\n}; // end of struct PhysicsGravitationalFieldEventData\n\n\n\n/**\n\n * @brief Interface for updraft event data.\n\n * @see\n\n * https://doc.babylonjs.com/how_to/using_the_physics_engine#further-functionality-of-the-impostor-class\n\n */\n", "file_path": "src/BabylonCpp/include/babylon/physics/helper/physics_event_data.h", "rank": 65, "score": 238814.23051768215 }, { "content": "#ifndef BABYLON_MESHES_INSTANCE_DATA_STORAGE_H\n\n#define BABYLON_MESHES_INSTANCE_DATA_STORAGE_H\n\n\n\n#include <unordered_map>\n\n\n\n#include <babylon/babylon_api.h>\n\n#include <babylon/babylon_common.h>\n\n#include <babylon/babylon_fwd.h>\n\n#include <babylon/maths/path3d.h>\n\n\n\nnamespace BABYLON {\n\n\n", "file_path": "src/BabylonCpp/include/babylon/meshes/_instance_data_storage.h", "rank": 66, "score": 237097.69119341313 }, { "content": "#ifndef BABYLON_COLLISIONS_MESH_COLLISION_DATA_H\n\n#define BABYLON_COLLISIONS_MESH_COLLISION_DATA_H\n\n\n\n#include <memory>\n\n\n\n#include <babylon/babylon_api.h>\n\n#include <babylon/babylon_common.h>\n\n#include <babylon/babylon_fwd.h>\n\n#include <babylon/maths/vector3.h>\n\n#include <babylon/misc/observer.h>\n\n\n\nnamespace BABYLON {\n\n\n\nFWD_CLASS_SPTR(AbstractMesh)\n\nFWD_CLASS_SPTR(Collider)\n\n\n\n/**\n\n * @brief Hidden\n\n */\n", "file_path": "src/BabylonCpp/include/babylon/collisions/_mesh_collision_data.h", "rank": 67, "score": 237096.03446046135 }, { "content": "class VertexData;\n\nFWD_CLASS_SPTR(Effect)\n\nFWD_CLASS_SPTR(Geometry)\n\nFWD_CLASS_SPTR(Mesh)\n\nFWD_CLASS_SPTR(VertexBuffer)\n\nFWD_CLASS_SPTR(WebGLDataBuffer)\n\nusing WebGLVertexArrayObjectPtr = std::shared_ptr<GL::IGLVertexArrayObject>;\n\n\n\n/**\n\n * @brief Class used to store geometry data (vertex buffers + index buffer).\n\n */\n", "file_path": "src/BabylonCpp/include/babylon/meshes/geometry.h", "rank": 68, "score": 237060.75278445147 }, { "content": "class BABYLON_SHARED_EXPORT Color3 {\n\n\n\nprivate:\n\n static const Color3 _BlackReadOnly;\n\n\n\npublic:\n\n /**\n\n * @brief Creates a new Color3 object from red, green, blue values, all\n\n * between 0 and 1.\n\n * @param r defines the red component (between 0 and 1, default is 0)\n\n * @param g defines the green component (between 0 and 1, default is 0)\n\n * @param b defines the blue component (between 0 and 1, default is 0)\n\n */\n\n Color3(float red = 0.f, float green = 0.f, float blue = 0.f);\n\n Color3(const Color3& otherColor); // Copy constructor\n\n Color3(Color3&& otherColor); // Move constructor\n\n Color3& operator=(const Color3& otherColor); // Copy assignment operator\n\n Color3& operator=(const Color4& otherColor); // Copy assignment operator\n\n Color3& operator=(Color3&& otherColor); // Move assignment operator\n\n ~Color3(); // = default\n", "file_path": "src/BabylonCpp/include/babylon/maths/color3.h", "rank": 69, "score": 232158.17972465497 }, { "content": "#ifndef BABYLON_MESHES_WEBGL_DATA_BUFFER_H\n\n#define BABYLON_MESHES_WEBGL_DATA_BUFFER_H\n\n\n\n#include <memory>\n\n\n\n#include <babylon/babylon_api.h>\n\n#include <babylon/babylon_fwd.h>\n\n#include <babylon/buffers/data_buffer.h>\n\n\n\nnamespace BABYLON {\n\n\n\nnamespace GL {\n\nFWD_CLASS_SPTR(IGLBuffer)\n\n} // end of namespace GL\n\n\n\n/**\n\n * @brief Hidden\n\n */\n", "file_path": "src/BabylonCpp/include/babylon/meshes/webgl/webgl_data_buffer.h", "rank": 70, "score": 231717.5518073625 }, { "content": "#ifndef BABYLON_PHYSICS_HELPER_PHYSICS_EVENT_DATA_H\n\n#define BABYLON_PHYSICS_HELPER_PHYSICS_EVENT_DATA_H\n\n\n\n#include <memory>\n\n\n\n#include <babylon/babylon_api.h>\n\n\n\nnamespace BABYLON {\n\n\n", "file_path": "src/BabylonCpp/include/babylon/physics/helper/physics_event_data.h", "rank": 71, "score": 231715.0322350293 }, { "content": "#ifndef BABYLON_MESHES_IGET_SET_VERTICES_DATA_H\n\n#define BABYLON_MESHES_IGET_SET_VERTICES_DATA_H\n\n\n\n#include <babylon/babylon_api.h>\n\n#include <babylon/babylon_common.h>\n\n\n\nnamespace BABYLON {\n\n\n", "file_path": "src/BabylonCpp/include/babylon/meshes/iget_set_vertices_data.h", "rank": 72, "score": 231714.94381589736 }, { "content": "#ifndef BABYLON_MESHES_INTERNAL_MESH_DATA_INFO_H\n\n#define BABYLON_MESHES_INTERNAL_MESH_DATA_INFO_H\n\n\n\n#include <memory>\n\n#include <unordered_map>\n\n\n\n#include <babylon/babylon_api.h>\n\n#include <babylon/babylon_common.h>\n\n#include <babylon/babylon_fwd.h>\n\n#include <babylon/misc/observable.h>\n\n\n\nnamespace BABYLON {\n\n\n", "file_path": "src/BabylonCpp/include/babylon/meshes/_internal_mesh_data_info.h", "rank": 73, "score": 231714.70652524554 }, { "content": " int _preActivateId = -1;\n\n std::vector<MeshLODLevelPtr> _LODLevels;\n\n\n\n // Morph\n\n MorphTargetManagerPtr _morphTargetManager = nullptr;\n\n}; // end of struct _InternalMeshDataInfo\n\n\n\n} // end of namespace BABYLON\n\n\n\n#endif // end of BABYLON_MESHES_INTERNAL_MESH_DATA_INFO_H\n", "file_path": "src/BabylonCpp/include/babylon/meshes/_internal_mesh_data_info.h", "rank": 74, "score": 231704.656862073 }, { "content": " * - VertexBuffer.MatricesWeightsKind\n\n * - VertexBuffer.MatricesWeightsExtraKind\n\n * @param data defines the data source\n\n * @param updateExtends defines if extends info of the mesh must be updated (can be null). This is\n\n * mostly useful for \"position\" kind\n\n * @param makeItUnique defines if the geometry associated with the mesh must be cloned to make the\n\n * change only for this mesh (and not all meshes associated with the same geometry)\n\n */\n\n virtual AbstractMesh* updateVerticesData(const std::string& kind, const Float32Array& data,\n\n bool updateExtends = false, bool makeItUnique = false)\n\n = 0;\n\n\n\n /**\n\n * @brief Creates a new index buffer.\n\n * @param indices defines the indices to store in the index buffer\n\n * @param totalVertices defines the total number of vertices (could be null)\n\n * @param updatable defines if the index buffer must be flagged as updatable (false by default)\n\n */\n\n virtual AbstractMesh* setIndices(const IndicesArray& indices, size_t totalVertices = 0,\n\n bool updatable = false)\n\n = 0;\n\n}; // end of struct IGetSetVerticesData\n\n\n\n} // end of namespace BABYLON\n\n\n\n#endif // end of BABYLON_MESHES_IGET_SET_VERTICES_DATA_H\n", "file_path": "src/BabylonCpp/include/babylon/meshes/iget_set_vertices_data.h", "rank": 75, "score": 231700.81635857662 }, { "content": " bool forceCopy = false)\n\n = 0;\n\n /**\n\n * @brief Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array)\n\n * populated with the mesh indices.\n\n * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some\n\n * other meshes, the returned array is a copy of the internal one.\n\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon\n\n * returning it\n\n * @returns the indices array or an empty array if the mesh has no geometry\n\n */\n\n virtual IndicesArray getIndices(bool copyWhenShared = false, bool forceCopy = false) = 0;\n\n\n\n /**\n\n * @brief Set specific vertex data.\n\n * @param kind defines the data kind (Position, normal, etc...)\n\n * @param data defines the vertex data to use\n\n * @param updatable defines if the vertex must be flagged as updatable (false as default)\n\n * @param stride defines the stride to use (0 by default). This value is deduced from the kind\n\n * value if not specified\n", "file_path": "src/BabylonCpp/include/babylon/meshes/iget_set_vertices_data.h", "rank": 76, "score": 231695.19552384788 }, { "content": " */\n\n virtual AbstractMesh* setVerticesData(const std::string& kind, const Float32Array& data,\n\n bool updatable = false,\n\n const std::optional<size_t>& stride = std::nullopt)\n\n = 0;\n\n\n\n /**\n\n * @brief Update a specific associated vertex buffer.\n\n * @param kind defines which buffer to write to (positions, indices, normals,\n\n * etc). Possible `kind` values :\n\n * - VertexBuffer.PositionKind\n\n * - VertexBuffer.UVKind\n\n * - VertexBuffer.UV2Kind\n\n * - VertexBuffer.UV3Kind\n\n * - VertexBuffer.UV4Kind\n\n * - VertexBuffer.UV5Kind\n\n * - VertexBuffer.UV6Kind\n\n * - VertexBuffer.ColorKind\n\n * - VertexBuffer.MatricesIndicesKind\n\n * - VertexBuffer.MatricesIndicesExtraKind\n", "file_path": "src/BabylonCpp/include/babylon/meshes/iget_set_vertices_data.h", "rank": 77, "score": 231693.3357928698 }, { "content": "class SphereOptions;\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 78, "score": 231678.14643519613 }, { "content": "class BoxOptions;\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 79, "score": 231678.14643519613 }, { "content": "class DataView;\n", "file_path": "src/BabylonCpp/include/babylon/buffers/vertex_buffer.h", "rank": 80, "score": 231678.14643519613 }, { "content": "class PlaneOptions;\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 81, "score": 231678.14643519613 }, { "content": "class GroundOptions;\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 82, "score": 231678.14643519613 }, { "content": "class DiscOptions;\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 83, "score": 231678.14643519613 }, { "content": "class RibbonOptions;\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 84, "score": 231678.14643519613 }, { "content": "class CylinderOptions;\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 85, "score": 231678.14643519613 }, { "content": "class TorusOptions;\n\n\n\n/**\n\n * @brief This class contains the various kinds of data on every vertex of a mesh used in\n\n * determining its shape and appearance.\n\n */\n", "file_path": "src/BabylonCpp/include/babylon/meshes/vertex_data.h", "rank": 86, "score": 231678.14643519613 }, { "content": "class Buffer;\n\nFWD_STRUCT_SPTR(_InstancesBatch)\n\nFWD_STRUCT_SPTR(_VisibleInstances)\n\nFWD_CLASS_SPTR(Buffer)\n\n\n\n/**\n\n * @brief Hidden\n\n */\n", "file_path": "src/BabylonCpp/include/babylon/meshes/_instance_data_storage.h", "rank": 87, "score": 231678.14643519613 }, { "content": "struct _InstanceDataStorage;\n", "file_path": "src/BabylonCpp/include/babylon/meshes/mesh.h", "rank": 88, "score": 231678.14643519613 }, { "content": "namespace BABYLON {\n\n\n\n/**\n\n * @brief Class used to store color3 gradient.\n\n */\n\nstruct BABYLON_SHARED_EXPORT Color3Gradient : public IValueGradient {\n\n\n\n /**\n\n * @brief Creates a new color3 gradient.\n\n * @param gradient gets or sets the gradient value (between 0 and 1)\n\n * @param color gets or sets associated color\n\n */\n\n Color3Gradient(float gradient, const Color3& color);\n\n ~Color3Gradient(); // = default\n\n\n\n /**\n\n * Gets or sets the associated color\n\n */\n\n Color3 color;\n\n\n\n}; // end of struct Color3Gradient\n\n\n\nbool operator==(const Color3Gradient& lhs, const Color3Gradient& rhs);\n\nbool operator!=(const Color3Gradient& lhs, const Color3Gradient& rhs);\n\n\n", "file_path": "src/BabylonCpp/include/babylon/misc/color3_gradient.h", "rank": 89, "score": 229561.5208571987 }, { "content": "enum class Color {\n\n MONOCHROME = 0,\n\n RED = 1,\n\n ORANGE = 2,\n\n YELLOW = 3,\n\n GREEN = 4,\n\n BLUE = 5,\n\n PURPLE = 6,\n\n PINK = 7\n\n}; // end of enum class Color\n\n\n", "file_path": "src/BabylonCpp/include/babylon/utils/random_color.h", "rank": 90, "score": 228916.62788376526 }, { "content": " std::vector<std::string> ids{};\n", "file_path": "src/BabylonCpp/include/babylon/meshes/_waiting_data.h", "rank": 91, "score": 228502.5284424966 }, { "content": "class Color3;\n", "file_path": "src/BabylonCpp/include/babylon/materials/effect.h", "rank": 92, "score": 227530.9745875037 }, { "content": "class Color3;\n\n\n\n/**\n\n * @brief Class used to hold a RBGA color.\n\n */\n", "file_path": "src/BabylonCpp/include/babylon/maths/color4.h", "rank": 93, "score": 227530.9745875037 }, { "content": "struct _InternalMeshDataInfo;\n", "file_path": "src/BabylonCpp/include/babylon/meshes/mesh.h", "rank": 94, "score": 226541.55847962512 }, { "content": "struct _InternalNodeDataInfo {\n\n bool _doNotSerialize = false;\n\n bool _isDisposed = false;\n\n int _sceneRootNodesIndex = -1;\n\n bool _isEnabled = true;\n\n bool _isParentEnabled = true;\n\n bool _isReady = true;\n\n Observable<bool> _onEnabledStateChangedObservable;\n\n Observable<Node> _onClonedObservable;\n\n}; // end of struct _InternalNodeDataInfo\n\n\n\n/**\n\n * @brief Node is the basic class for all scene objects (Mesh, Light, Camera.)\n\n */\n", "file_path": "src/BabylonCpp/include/babylon/engines/node.h", "rank": 95, "score": 226541.55847962512 }, { "content": "struct CubeTextureData;\n", "file_path": "src/BabylonCpp/include/babylon/engines/thin_engine.h", "rank": 96, "score": 226541.55847962512 }, { "content": "class Mesh;\n", "file_path": "src/BabylonCpp/include/babylon/meshes/_internal_mesh_data_info.h", "rank": 97, "score": 226541.55847962512 }, { "content": "struct PhysicsJointData;\n", "file_path": "src/BabylonCpp/include/babylon/physics/physics_impostor.h", "rank": 98, "score": 226541.55847962512 }, { "content": "class Mesh;\n\nusing MeshPtr = std::shared_ptr<Mesh>;\n\n\n\n/**\n\n * @brief Interface for radial explosion event data.\n\n * @see\n\n * https://doc.babylonjs.com/how_to/using_the_physics_engine#further-functionality-of-the-impostor-class\n\n */\n", "file_path": "src/BabylonCpp/include/babylon/physics/helper/physics_event_data.h", "rank": 99, "score": 226541.55847962512 } ]
C++
examples/UseOptiXGeometryInstancedStandalone/UseOptiXGeometryInstancedStandalone.cc
hanswenzel/opticks
b75b5929b6cf36a5eedeffb3031af2920f75f9f0
#include <chrono> #include <iomanip> #include <iostream> #include <cstdlib> #include <cstring> #include <sstream> #include <fstream> #include <optix_world.h> #include <optixu/optixpp_namespace.h> #include <glm/glm.hpp> #include <glm/gtx/transform.hpp> #include <glm/gtc/type_ptr.hpp> void getEyeUVW(const glm::vec4& ce, const unsigned width, const unsigned height, glm::vec3& eye, glm::vec3& U, glm::vec3& V, glm::vec3& W ) { glm::vec3 tr(ce.x, ce.y, ce.z); glm::vec3 sc(ce.w); glm::vec3 isc(1.f/ce.w); glm::mat4 model2world = glm::scale(glm::translate(glm::mat4(1.0), tr), sc); glm::vec4 eye_m( 0.f, 0.f, 0.1f,1.f); glm::vec4 look_m( 0.7f, 0.7f, -0.7,1.f); glm::vec4 up_m( 0.f, 0.f, 1.f,1.f); glm::vec4 gze_m( look_m - eye_m ) ; const glm::mat4& m2w = model2world ; glm::vec3 eye_ = glm::vec3( m2w * eye_m ) ; glm::vec3 up = glm::vec3( m2w * up_m ) ; glm::vec3 gaze = glm::vec3( m2w * gze_m ) ; glm::vec3 forward_ax = glm::normalize(gaze); glm::vec3 right_ax = glm::normalize(glm::cross(forward_ax,up)); glm::vec3 top_ax = glm::normalize(glm::cross(right_ax,forward_ax)); float aspect = float(width)/float(height) ; float tanYfov = 1.f ; float gazelength = glm::length( gaze ) ; float v_half_height = gazelength * tanYfov ; float u_half_width = v_half_height * aspect ; U = right_ax * u_half_width ; V = top_ax * v_half_height ; W = forward_ax * gazelength ; eye = eye_ ; } const char* PTXPath( const char* install_prefix, const char* cmake_target, const char* cu_stem, const char* cu_ext=".cu" ) { std::stringstream ss ; ss << install_prefix << "/ptx/" << cmake_target << "_generated_" << cu_stem << cu_ext << ".ptx" ; std::string path = ss.str(); return strdup(path.c_str()); } const char* PPMPath( const char* install_prefix, const char* stem, const char* ext=".ppm" ) { std::stringstream ss ; ss << install_prefix << "/ppm/" << stem << ext ; std::string path = ss.str(); return strdup(path.c_str()); } void SPPM_write( const char* filename, const unsigned char* image, int width, int height, int ncomp, bool yflip ) { FILE * fp; fp = fopen(filename, "wb"); fprintf(fp, "P6\n%d %d\n%d\n", width, height, 255); unsigned size = height*width*3 ; unsigned char* data = new unsigned char[size] ; for( int h=0; h < height ; h++ ) { int y = yflip ? height - 1 - h : h ; for( int x=0; x < width ; ++x ) { *(data + (y*width+x)*3+0) = image[(h*width+x)*ncomp+0] ; *(data + (y*width+x)*3+1) = image[(h*width+x)*ncomp+1] ; *(data + (y*width+x)*3+2) = image[(h*width+x)*ncomp+2] ; } } fwrite(data, sizeof(unsigned char)*size, 1, fp); fclose(fp); std::cout << "Wrote file (unsigned char*) " << filename << std::endl ; delete[] data; } float angle_radians(float angle_degrees) { return glm::pi<float>()*angle_degrees/180.f ; } glm::mat4 make_transform(const std::string& order, const glm::vec3& tlat, const glm::vec4& axis_angle, const glm::vec3& scal ) { glm::mat4 mat(1.f) ; float angle = angle_radians(axis_angle.w) ; for(unsigned i=0 ; i < order.length() ; i++) { switch(order[i]) { case 's': mat = glm::scale(mat, scal) ; break ; case 'r': mat = glm::rotate(mat, angle , glm::vec3(axis_angle)) ; break ; case 't': mat = glm::translate(mat, tlat ) ; break ; } } return mat ; } glm::mat4 make_transform(const std::string& order) { glm::vec3 tla(0,0,100) ; glm::vec4 rot(0,0,1,45); glm::vec3 sca(1,1,1) ; return make_transform(order, tla, rot, sca ); } struct APIError { APIError( RTresult c, const std::string& f, int l ) : code( c ), file( f ), line( l ) {} RTresult code; std::string file; int line; }; #define RT_CHECK_ERROR( func ) \ do { \ RTresult code = func; \ if( code != RT_SUCCESS ) \ throw APIError( code, __FILE__, __LINE__ ); \ } while(0) void InitRTX(int rtxmode) { if(rtxmode == -1) { } else { #if OPTIX_VERSION_MAJOR >= 6 int rtx0(-1) ; RT_CHECK_ERROR( rtGlobalGetAttribute(RT_GLOBAL_ATTRIBUTE_ENABLE_RTX, sizeof(rtx0), &rtx0) ); assert( rtx0 == 0 ); int rtx = rtxmode > 0 ? 1 : 0 ; RT_CHECK_ERROR( rtGlobalSetAttribute(RT_GLOBAL_ATTRIBUTE_ENABLE_RTX, sizeof(rtx), &rtx)); int rtx2(-1) ; RT_CHECK_ERROR(rtGlobalGetAttribute(RT_GLOBAL_ATTRIBUTE_ENABLE_RTX, sizeof(rtx2), &rtx2)); assert( rtx2 == rtx ); #else printf("RTX requires optix version >= 6 \n"); #endif } } int main(int argc, char** argv) { const char* rtxstr = getenv("RTX"); int rtxmode = rtxstr ? atoi(rtxstr) : -1 ; assert( rtxmode == -1 || rtxmode == 0 || rtxmode == 1 ); const char* ppmstr = getenv("PPM"); int ppmsave = ppmstr ? atoi(ppmstr) : -1 ; const char* name = getenv("STANDALONE_NAME") ; assert( name && "expecting STANDALONE_NAME envvar with name of the CMake target " ); const char* prefix = getenv("STANDALONE_PREFIX"); assert( prefix && "expecting STANDALONE_PREFIX envvar pointing to writable directory" ); const char* cmake_target = name ; unsigned factor = 1u ; unsigned width = factor*1440u ; unsigned height = factor*900u ; const unsigned nu = 100u; const unsigned nv = 100u; const unsigned nw = 4u; float extent = 100.0 ; glm::vec4 ce(float(nu),float(nv), 0.f, extent ); glm::vec3 eye ; glm::vec3 U ; glm::vec3 V ; glm::vec3 W ; getEyeUVW( ce, width, height, eye, U, V, W ); InitRTX(rtxmode); optix::Context context = optix::Context::create(); context->setRayTypeCount(1); bool prnt = false ; context->setPrintEnabled(prnt); context->setPrintBufferSize(4096); context->setEntryPointCount(1); unsigned entry_point_index = 0u ; const char* ptx = PTXPath( prefix, cmake_target, name ) ; context->setRayGenerationProgram( entry_point_index, context->createProgramFromPTXFile( ptx , "raygen" )); context->setMissProgram( entry_point_index, context->createProgramFromPTXFile( ptx , "miss" )); float sz = 10.f ; unsigned nbox = 10u ; #define RUBOX 1 #ifdef RUBOX optix::Geometry rubox ; rubox = context->createGeometry(); rubox->setPrimitiveCount( nbox ); const char* rubox_ptx = PTXPath( prefix, cmake_target, "rubox" ) ; rubox->setBoundingBoxProgram( context->createProgramFromPTXFile( rubox_ptx , "rubox_bounds" ) ); rubox->setIntersectionProgram( context->createProgramFromPTXFile( rubox_ptx , "rubox_intersect" ) ) ; optix::Geometry& instance = rubox ; #else optix::Geometry box ; box = context->createGeometry(); box->setPrimitiveCount( 1u ); const char* box_ptx = PTXPath( prefix, cmake_target, "box" ) ; box->setBoundingBoxProgram( context->createProgramFromPTXFile( box_ptx , "box_bounds" ) ); box->setIntersectionProgram( context->createProgramFromPTXFile( box_ptx , "box_intersect" ) ) ; optix::Geometry& instance = box ; #endif instance["boxmin"]->setFloat( -sz/2.f, -sz/2.f, -sz/2.f ); instance["boxmax"]->setFloat( sz/2.f, sz/2.f, sz/2.f ); optix::Material mat = context->createMaterial(); mat->setClosestHitProgram( entry_point_index, context->createProgramFromPTXFile( ptx, "closest_hit_radiance0" )); optix::Group top = context->createGroup() ; top->setAcceleration( context->createAcceleration( "Trbvh" ) ); context["top_object"]->set( top ); optix::Group assembly = context->createGroup(); assembly->setChildCount( nu*nv*nw ); assembly->setAcceleration( context->createAcceleration( "Trbvh" ) ); top->addChild(assembly); optix::Acceleration instance_accel = context->createAcceleration( "Trbvh" ); unsigned ichild(0); for( unsigned u = 0; u < nu; ++u ) { for( unsigned v = 0; v < nv ; ++v ) { for( unsigned w = 0; w < nw ; ++w ) { optix::Transform xform = context->createTransform(); glm::vec4 rot( rand(), rand(), rand(), rand()*360.f ); glm::vec3 sca( 0.5 ) ; glm::vec3 tla( 10.f*u , 10.f*v , -10.f*w ) ; glm::mat4 m4 = make_transform("trs", tla, rot, sca ); bool transpose = true ; optix::Matrix4x4 m4_( glm::value_ptr(m4) ) ; xform->setMatrix(transpose, m4_.getData(), 0); assembly->setChild(ichild, xform); unsigned instance_index = ichild ; ichild++ ; optix::GeometryInstance pergi = context->createGeometryInstance() ; pergi->setMaterialCount(1); pergi->setMaterial(0, mat ); pergi->setGeometry( instance ); optix::GeometryGroup perxform = context->createGeometryGroup(); perxform->addChild(pergi); perxform->setAcceleration(instance_accel) ; xform->setChild(perxform); } } } float near = 11.f ; float scene_epsilon = near ; context[ "scene_epsilon"]->setFloat( scene_epsilon ); context[ "eye"]->setFloat( eye.x, eye.y, eye.z ); context[ "U" ]->setFloat( U.x, U.y, U.z ); context[ "V" ]->setFloat( V.x, V.y, V.z ); context[ "W" ]->setFloat( W.x, W.y, W.z ); context[ "radiance_ray_type" ]->setUint( 0u ); optix::Buffer output_buffer = context->createBuffer( RT_BUFFER_OUTPUT, RT_FORMAT_UNSIGNED_BYTE4, width, height); context["output_buffer"]->set( output_buffer ); auto t0 = std::chrono::high_resolution_clock::now(); context->launch( entry_point_index , 0, 0 ); auto t1 = std::chrono::high_resolution_clock::now(); context->launch( entry_point_index , width, height ); auto t2 = std::chrono::high_resolution_clock::now(); std::chrono::duration<double> t_prelaunch = t1 - t0; std::chrono::duration<double> t_launch = t2 - t1; std::cout << " nbox " << nbox << " rtxmode " << std::setw(2) << rtxmode << " prelaunch " << std::setprecision(4) << std::fixed << std::setw(15) << t_prelaunch.count() << " launch " << std::setprecision(4) << std::fixed << std::setw(15) << t_launch.count() << std::endl ; if(ppmsave > 0) { const char* path = PPMPath( prefix, name ); bool yflip = true ; int ncomp = 4 ; void* ptr = output_buffer->map() ; SPPM_write(path, (unsigned char*)ptr , width, height, ncomp, yflip ); output_buffer->unmap(); } return 0 ; }
#include <chrono> #include <iomanip> #include <iostream> #include <cstdlib> #include <cstring> #include <sstream> #include <fstream> #include <optix_world.h> #include <optixu/optixpp_namespace.h> #include <glm/glm.hpp> #include <glm/gtx/transform.hpp> #include <glm/gtc/type_ptr.hpp> void getEyeUVW(const glm::vec4& ce, const unsigned width, const unsigned height, glm::vec3& eye, glm::vec3& U, glm::vec3& V, glm::vec3& W ) { glm::vec3 tr(ce.x, ce.y, ce.z); glm::vec3 sc(ce.w); glm::vec3 isc(1.f/ce.w); glm::mat4 model2world = glm::scale(glm::translate(glm::mat4(1.0), tr), sc); glm::vec4 eye_m( 0.f, 0.f, 0.1f,1.f); glm::vec4 look_m( 0.7f, 0.7f, -0.7,1.f); glm::vec4 up_m( 0.f, 0.f, 1.f,1.f); glm::vec4 gze_m( look_m - eye_m ) ; const glm::mat4& m2w = model2world ; glm::vec3 eye_ = glm::vec3( m2w * eye_m ) ; glm::vec3 up = glm::vec3( m2w * up_m ) ; glm::vec3 gaze = glm::vec3( m2w * gze_m ) ; glm::vec3 forward_ax = glm::normalize(gaze); glm::vec3 right_ax = glm::normalize(glm::cross(forward_ax,up)); glm::vec3 top_ax = glm::normalize(glm::cross(right_ax,forward_ax)); float aspect = float(width)/float(height) ; float tanYfov = 1.f ; float gazelength = glm::length( gaze ) ; float v_half_height = gazelength * tanYfov ; float u_half_width = v_half_height * aspect ; U = right_ax * u_half_width ; V = top_ax * v_half_height ; W = forward_ax * gazelength ; eye = eye_ ; } const char* PTXPath( const char* install_prefix, const char* cmake_target, const char* cu_stem, const char* cu_ext=".cu" ) { std::stringstream ss ; ss << install_prefix << "/ptx/" << cmake_target << "_generated_" << cu_stem << cu_ext << ".ptx" ; std::string path = ss.str(); return strdup(path.c_str()); } const char* PPMPath( const char* install_prefix, const char* stem, const char* ext=".ppm" ) { std::stringstream ss ; ss << install_prefix << "/ppm/" << stem << ext ; std::string path = ss.str(); return strdup(path.c_str()); } void SPPM_write( const char* filename, const unsigned char* image, int width, int height, int ncomp, bool yflip ) { FILE * fp; fp = fopen(filename, "wb"); fprintf(fp, "P6\n%d %d\n%d\n", width, height, 255); unsigned size = height*width*3 ; unsigned char* data = new unsigned char[size] ; for( int h=0; h < height ; h++ ) { int y = yflip ? height - 1 - h : h ; for( int x=0; x < width ; ++x ) { *(data + (y*width+x)*3+0) = image[(h*width+x)*ncomp+0] ; *(data + (y*width+x)*3+1) = image[(h*width+x)*ncomp+1] ; *(data + (y*width+x)*3+2) = image[(h*width+x)*ncomp+2] ; } } fwrite(data, sizeof(unsigned char)*size, 1, fp); fclose(fp); std::cout << "Wrote file (unsigned char*) " << filename << std::endl ; delete[] data; } float angle_radians(float angle_degrees) { return glm::pi<float>()*angle_degrees/180.f ; } glm::mat4 make_transform(const std::string& order, const glm::vec3& tlat, const glm::vec4& axis_angle, const glm::vec3& scal ) { glm::mat4 mat(1.f) ; float angle = angle_radians(axis_angle.w) ; for(unsigned i=0 ; i < order.length() ; i++) { switch(order[i]) { case 's': mat = glm::scale(mat, scal) ; break ; case 'r': mat = glm::rotate(mat, angle , glm::v
tion( context->createAcceleration( "Trbvh" ) ); top->addChild(assembly); optix::Acceleration instance_accel = context->createAcceleration( "Trbvh" ); unsigned ichild(0); for( unsigned u = 0; u < nu; ++u ) { for( unsigned v = 0; v < nv ; ++v ) { for( unsigned w = 0; w < nw ; ++w ) { optix::Transform xform = context->createTransform(); glm::vec4 rot( rand(), rand(), rand(), rand()*360.f ); glm::vec3 sca( 0.5 ) ; glm::vec3 tla( 10.f*u , 10.f*v , -10.f*w ) ; glm::mat4 m4 = make_transform("trs", tla, rot, sca ); bool transpose = true ; optix::Matrix4x4 m4_( glm::value_ptr(m4) ) ; xform->setMatrix(transpose, m4_.getData(), 0); assembly->setChild(ichild, xform); unsigned instance_index = ichild ; ichild++ ; optix::GeometryInstance pergi = context->createGeometryInstance() ; pergi->setMaterialCount(1); pergi->setMaterial(0, mat ); pergi->setGeometry( instance ); optix::GeometryGroup perxform = context->createGeometryGroup(); perxform->addChild(pergi); perxform->setAcceleration(instance_accel) ; xform->setChild(perxform); } } } float near = 11.f ; float scene_epsilon = near ; context[ "scene_epsilon"]->setFloat( scene_epsilon ); context[ "eye"]->setFloat( eye.x, eye.y, eye.z ); context[ "U" ]->setFloat( U.x, U.y, U.z ); context[ "V" ]->setFloat( V.x, V.y, V.z ); context[ "W" ]->setFloat( W.x, W.y, W.z ); context[ "radiance_ray_type" ]->setUint( 0u ); optix::Buffer output_buffer = context->createBuffer( RT_BUFFER_OUTPUT, RT_FORMAT_UNSIGNED_BYTE4, width, height); context["output_buffer"]->set( output_buffer ); auto t0 = std::chrono::high_resolution_clock::now(); context->launch( entry_point_index , 0, 0 ); auto t1 = std::chrono::high_resolution_clock::now(); context->launch( entry_point_index , width, height ); auto t2 = std::chrono::high_resolution_clock::now(); std::chrono::duration<double> t_prelaunch = t1 - t0; std::chrono::duration<double> t_launch = t2 - t1; std::cout << " nbox " << nbox << " rtxmode " << std::setw(2) << rtxmode << " prelaunch " << std::setprecision(4) << std::fixed << std::setw(15) << t_prelaunch.count() << " launch " << std::setprecision(4) << std::fixed << std::setw(15) << t_launch.count() << std::endl ; if(ppmsave > 0) { const char* path = PPMPath( prefix, name ); bool yflip = true ; int ncomp = 4 ; void* ptr = output_buffer->map() ; SPPM_write(path, (unsigned char*)ptr , width, height, ncomp, yflip ); output_buffer->unmap(); } return 0 ; }
ec3(axis_angle)) ; break ; case 't': mat = glm::translate(mat, tlat ) ; break ; } } return mat ; } glm::mat4 make_transform(const std::string& order) { glm::vec3 tla(0,0,100) ; glm::vec4 rot(0,0,1,45); glm::vec3 sca(1,1,1) ; return make_transform(order, tla, rot, sca ); } struct APIError { APIError( RTresult c, const std::string& f, int l ) : code( c ), file( f ), line( l ) {} RTresult code; std::string file; int line; }; #define RT_CHECK_ERROR( func ) \ do { \ RTresult code = func; \ if( code != RT_SUCCESS ) \ throw APIError( code, __FILE__, __LINE__ ); \ } while(0) void InitRTX(int rtxmode) { if(rtxmode == -1) { } else { #if OPTIX_VERSION_MAJOR >= 6 int rtx0(-1) ; RT_CHECK_ERROR( rtGlobalGetAttribute(RT_GLOBAL_ATTRIBUTE_ENABLE_RTX, sizeof(rtx0), &rtx0) ); assert( rtx0 == 0 ); int rtx = rtxmode > 0 ? 1 : 0 ; RT_CHECK_ERROR( rtGlobalSetAttribute(RT_GLOBAL_ATTRIBUTE_ENABLE_RTX, sizeof(rtx), &rtx)); int rtx2(-1) ; RT_CHECK_ERROR(rtGlobalGetAttribute(RT_GLOBAL_ATTRIBUTE_ENABLE_RTX, sizeof(rtx2), &rtx2)); assert( rtx2 == rtx ); #else printf("RTX requires optix version >= 6 \n"); #endif } } int main(int argc, char** argv) { const char* rtxstr = getenv("RTX"); int rtxmode = rtxstr ? atoi(rtxstr) : -1 ; assert( rtxmode == -1 || rtxmode == 0 || rtxmode == 1 ); const char* ppmstr = getenv("PPM"); int ppmsave = ppmstr ? atoi(ppmstr) : -1 ; const char* name = getenv("STANDALONE_NAME") ; assert( name && "expecting STANDALONE_NAME envvar with name of the CMake target " ); const char* prefix = getenv("STANDALONE_PREFIX"); assert( prefix && "expecting STANDALONE_PREFIX envvar pointing to writable directory" ); const char* cmake_target = name ; unsigned factor = 1u ; unsigned width = factor*1440u ; unsigned height = factor*900u ; const unsigned nu = 100u; const unsigned nv = 100u; const unsigned nw = 4u; float extent = 100.0 ; glm::vec4 ce(float(nu),float(nv), 0.f, extent ); glm::vec3 eye ; glm::vec3 U ; glm::vec3 V ; glm::vec3 W ; getEyeUVW( ce, width, height, eye, U, V, W ); InitRTX(rtxmode); optix::Context context = optix::Context::create(); context->setRayTypeCount(1); bool prnt = false ; context->setPrintEnabled(prnt); context->setPrintBufferSize(4096); context->setEntryPointCount(1); unsigned entry_point_index = 0u ; const char* ptx = PTXPath( prefix, cmake_target, name ) ; context->setRayGenerationProgram( entry_point_index, context->createProgramFromPTXFile( ptx , "raygen" )); context->setMissProgram( entry_point_index, context->createProgramFromPTXFile( ptx , "miss" )); float sz = 10.f ; unsigned nbox = 10u ; #define RUBOX 1 #ifdef RUBOX optix::Geometry rubox ; rubox = context->createGeometry(); rubox->setPrimitiveCount( nbox ); const char* rubox_ptx = PTXPath( prefix, cmake_target, "rubox" ) ; rubox->setBoundingBoxProgram( context->createProgramFromPTXFile( rubox_ptx , "rubox_bounds" ) ); rubox->setIntersectionProgram( context->createProgramFromPTXFile( rubox_ptx , "rubox_intersect" ) ) ; optix::Geometry& instance = rubox ; #else optix::Geometry box ; box = context->createGeometry(); box->setPrimitiveCount( 1u ); const char* box_ptx = PTXPath( prefix, cmake_target, "box" ) ; box->setBoundingBoxProgram( context->createProgramFromPTXFile( box_ptx , "box_bounds" ) ); box->setIntersectionProgram( context->createProgramFromPTXFile( box_ptx , "box_intersect" ) ) ; optix::Geometry& instance = box ; #endif instance["boxmin"]->setFloat( -sz/2.f, -sz/2.f, -sz/2.f ); instance["boxmax"]->setFloat( sz/2.f, sz/2.f, sz/2.f ); optix::Material mat = context->createMaterial(); mat->setClosestHitProgram( entry_point_index, context->createProgramFromPTXFile( ptx, "closest_hit_radiance0" )); optix::Group top = context->createGroup() ; top->setAcceleration( context->createAcceleration( "Trbvh" ) ); context["top_object"]->set( top ); optix::Group assembly = context->createGroup(); assembly->setChildCount( nu*nv*nw ); assembly->setAccelera
random
[ { "content": "struct DescriptorDataType<unsigned int> { static const char value = 'u'; };\n\ntemplate<>\n", "file_path": "npy/numpy.hpp", "rank": 0, "score": 339528.31468513457 }, { "content": "struct DescriptorDataType<unsigned char> { static const char value = 'u'; };\n\ntemplate<>\n", "file_path": "npy/numpy.hpp", "rank": 1, "score": 298205.32356596633 }, { "content": "struct DescriptorDataType<float> { static const char value = 'f'; };\n\n\n\n\n\ntemplate<>\n", "file_path": "npy/numpy.hpp", "rank": 2, "score": 278785.3972356941 }, { "content": "struct DescriptorDataType<int> { static const char value = 'i'; };\n\ntemplate<>\n", "file_path": "npy/numpy.hpp", "rank": 3, "score": 278781.69108589273 }, { "content": "struct DescriptorDataType<unsigned short> { static const char value = 'u'; };\n\ntemplate<>\n", "file_path": "npy/numpy.hpp", "rank": 4, "score": 267763.09640779265 }, { "content": "struct DescriptorDataType<unsigned long> { static const char value = 'u'; };\n\ntemplate<>\n", "file_path": "npy/numpy.hpp", "rank": 5, "score": 267763.09640779265 }, { "content": "struct DescriptorDataType<std::complex<float> > { static const char value = 'c'; };\n\ntemplate<>\n", "file_path": "npy/numpy.hpp", "rank": 6, "score": 257846.71466545374 }, { "content": "struct DescriptorDataType<unsigned long long> { static const char value = 'u'; };\n\n\n\n\n\n\n\ntemplate<>\n", "file_path": "npy/numpy.hpp", "rank": 7, "score": 257845.42344528835 }, { "content": "struct DescriptorDataType<char> { static const char value = 'i'; };\n\ntemplate<>\n", "file_path": "npy/numpy.hpp", "rank": 8, "score": 234754.4329339727 }, { "content": "struct DescriptorDataType<long> { static const char value = 'i'; };\n\ntemplate<>\n", "file_path": "npy/numpy.hpp", "rank": 9, "score": 203825.44852637008 }, { "content": "struct DescriptorDataType<double> { static const char value = 'f'; };\n\ntemplate<>\n", "file_path": "npy/numpy.hpp", "rank": 10, "score": 203825.44852637008 }, { "content": "struct DescriptorDataType<short> { static const char value = 'i'; };\n\ntemplate<>\n", "file_path": "npy/numpy.hpp", "rank": 11, "score": 203825.44852637008 }, { "content": "struct V { float x,y,z,w ; };\n\n\n\nstatic const unsigned NUM_VERT = 3 ; \n\n\n\nV verts[NUM_VERT] = {\n\n { -1.f , -1.f, 0.f, 1.f }, \n\n { -1.f , 1.f, 0.f, 1.f },\n\n { 1.f , 0.f, 0.f, 1.f }\n\n};\n\n\n\n\n\nint main()\n\n{\n\n Frame frame ; \n\n\n\n Prog prog(vertSrc, NULL, fragSrc ) ; \n\n prog.compile();\n\n prog.create();\n\n prog.link();\n\n\n", "file_path": "examples/UseInstance/tests/OneTriangleTest.cc", "rank": 12, "score": 203374.9565907303 }, { "content": "struct V { float x,y,z,w ; };\n\nstatic const unsigned NUM_VPOS = 3 ; \n\n\n\nV vpos[NUM_VPOS] = \n\n{\n\n { -0.1f , -0.1f, 0.f, 1.f }, \n\n { -0.1f , 0.1f, 0.f, 1.f },\n\n { 0.f , 0.f, 0.f, 1.f }\n\n};\n\n\n\nstatic const unsigned NUM_IPOS = 8 ; \n\nV ipos[NUM_IPOS] = \n\n{\n\n { 0.1f , 0.1f, 0.f, 1.f }, \n\n { 0.2f , 0.2f, 0.f, 1.f },\n\n { 0.3f , 0.3f, 0.f, 1.f },\n\n { 0.4f , 0.4f, 0.f, 1.f },\n\n { -0.1f , -0.1f, 0.f, 1.f }, \n\n { -0.2f , -0.2f, 0.f, 1.f },\n\n { -0.3f , -0.3f, 0.f, 1.f },\n", "file_path": "examples/UseInstance/tests/UseInstanceTest.cc", "rank": 13, "score": 203374.9565907303 }, { "content": "struct DescriptorDataType<long long> { static const char value = 'i'; };\n\n\n\n\n\ntemplate<>\n", "file_path": "npy/numpy.hpp", "rank": 14, "score": 195995.68613502703 }, { "content": "struct DescriptorDataType<std::complex<double> > { static const char value = 'c'; };\n\n\n\ntemplate<typename Scalar>\n\ninline std::string CreateDescriptor() {\n\n std::string descriptor;\n\n#ifdef AOBA_NUMPY_LITTLE_ENDIAN\n\n descriptor.push_back('<');\n\n#else\n\n descriptor.push_back('>');\n\n#endif\n\n descriptor.push_back(DescriptorDataType<Scalar>::value);\n\n std::stringstream stream;\n\n stream << sizeof(Scalar);\n\n descriptor.append(stream.str());\n\n return descriptor;\n\n}\n\n\n\n\n\n\n\n\n", "file_path": "npy/numpy.hpp", "rank": 15, "score": 188926.61768611195 }, { "content": "NCSG::NCSG(const char* treedir) \n\n---------------------------------\n\n\n\nPrivate constructor used by NCSG::Load deserialization of a tree directory \n\n\n\n**/\n\nNCSG::NCSG(const char* treedir) \n\n :\n\n m_treedir(treedir ? strdup(treedir) : NULL),\n\n m_index(0),\n\n m_surface_epsilon(SURFACE_EPSILON),\n\n m_verbosity(0),\n\n m_usedglobally(true), // changed to true : June 2018, see notes/issues/subtree_instances_missing_transform.rst\n\n m_root(NULL),\n\n m_points(NULL),\n\n m_uncoincide(NULL),\n\n m_nudger(NULL),\n\n m_csgdata(new NCSGData),\n\n m_meta(new NPYMeta),\n\n m_adopted(false), \n", "file_path": "npy/NCSG.cpp", "rank": 16, "score": 178931.39161842223 }, { "content": " stbi_uc size,type,channel;\n", "file_path": "sysrap/stb_image.h", "rank": 17, "score": 178436.40875783237 }, { "content": " stbi_uc *data;\n", "file_path": "sysrap/stb_image.h", "rank": 18, "score": 178418.99903834486 }, { "content": " int height ; \n", "file_path": "CSGOptiX/Frame.h", "rank": 19, "score": 174720.56895255722 }, { "content": " Frame(int width, int height, int depth );\n", "file_path": "CSGOptiX/Frame.h", "rank": 20, "score": 174719.96240187946 }, { "content": "OpticksMode::OpticksMode(const char* tag)\n\n--------------------------------------------\n\n\n\nUsed by OpticksEvent to instanciate from loaded metadata string.\n\n\n\n**/\n\n\n\nOpticksMode::OpticksMode(const char* tag)\n\n :\n\n m_mode(Parse(tag)),\n\n m_compute_requested(false),\n\n m_noviz(false),\n\n m_forced_compute(false)\n\n{\n\n LOG(LEVEL) << \" tag \" << tag ; \n\n}\n\n\n\nOpticksMode::OpticksMode(Opticks* ok) \n\n : \n\n m_mode(UNSET_MODE),\n", "file_path": "optickscore/OpticksMode.cc", "rank": 21, "score": 168607.30529301887 }, { "content": "OKConf::PTXPath\n\n-----------------\n\n\n\nThe path elements configured here must match those from the CMakeLists.txt \n\nthat compiles the <name>.cu to <target>_generated_<name>.cu.ptx eg in optixrap/CMakeLists.txt::\n\n\n\n 091 set(CU_SOURCES\n\n 092 \n\n 093 cu/pinhole_camera.cu\n\n 094 cu/constantbg.cu\n\n ...\n\n 120 cu/intersect_analytic_test.cu\n\n 121 cu/Roots3And4Test.cu\n\n 122 )\n\n ...\n\n 131 CUDA_WRAP_SRCS( ${name} PTX _generated_PTX_files ${CU_SOURCES} )\n\n 132 CUDA_WRAP_SRCS( ${name} OBJ _generated_OBJ_files ${SOURCES} )\n\n 133 \n\n 134 \n\n 135 add_library( ${name} SHARED ${_generated_OBJ_files} ${_generated_PTX_files} ${SOURCES} )\n", "file_path": "okconf/OKConf.cc", "rank": 22, "score": 167168.03488443175 }, { "content": "size_t X4::GetOpticksIndex( const G4LogicalSurface* const surf )\n\n==================================================================\n\n\n\nNB Implicit assumption that are not going to be adding more surfaces, \n\nso only use this once that is true. \n\n \n\n**/\n\n\n\nsize_t X4::GetOpticksIndex( const G4LogicalSurface* const surf )\n\n{\n\n if( surface_index_cache == nullptr ) surface_index_cache = MakeSurfaceIndexCache() ; \n\n int index = surface_index_cache->find(surf ); \n\n assert( index != MISSING_SURFACE ); \n\n //LOG(LEVEL) << \" index \" << index ; \n\n return index ; \n\n}\n\n\n\n \n", "file_path": "extg4/X4.cc", "rank": 23, "score": 157267.0608508138 }, { "content": " static const char* PTXPath( const char* install_prefix, const char* cmake_target, const char* cu_stem, const char* cu_ext=\".cu\" );\n", "file_path": "examples/UseOptiX7GeometryInstancedGASCompDyn/Util.h", "rank": 24, "score": 154357.33119513758 }, { "content": " stbi_uc size,type,channel;\n", "file_path": "examples/UseOptiX7GeometryInstancedGASCompDyn/stb_image.h", "rank": 25, "score": 154334.414678869 }, { "content": " stbi_uc *data;\n", "file_path": "examples/UseOptiX7GeometryInstancedGASCompDyn/stb_image.h", "rank": 26, "score": 154320.1657346601 }, { "content": "const char* GSurfaceLib::AssignSurfaceType(BMeta* surfmeta )\n\n--------------------------------------------------------------\n\n\n\nReturn SKINSURFACE, BORDERSURFACE or TESTSURFACE depending on the\n\nSSLV, BPV1, BPV2, name keys present in the surfmeta.\n\n\n\n\n\n**/\n\n\n\nconst char* GSurfaceLib::AssignSurfaceType( BMeta* surfmeta ) // static \n\n{\n\n assert( surfmeta );\n\n const char* surftype = NULL ; \n\n\n\n if( surfmeta->hasItem(SSLV)) \n\n { \n\n surftype = SKINSURFACE ; \n\n }\n\n else if( surfmeta->hasItem(BPV1) && surfmeta->hasItem(BPV2) ) \n\n {\n", "file_path": "ggeo/GSurfaceLib.cc", "rank": 27, "score": 148459.28246884642 }, { "content": "Opticks::getOutPath namestem ext index \n\n------------------------------------------\n\n\n\n::\n\n \n\n <outdir>/<nameprefix><namestem><index><ext>\n\n\n\noutdir \n\n default evar:OUTDIR that is overridden by --outdir option \n\nnameprefix\n\n --nameprefix option\n\nnamestem\n\n method argument defauting to \"output\"\n\nindex \n\n method argument with -1 default\n\n when the index is negative the field is skipped \n\n otherwise the integer is %0.5d formatted, eg 00000, 00001\n\next\n\n file extension eg .jpg .npy \n\n\n", "file_path": "optickscore/Opticks.cc", "rank": 28, "score": 146419.4359880125 }, { "content": "inline char *sdkFindFilePath(const char *filename, const char *executable_path)\n\n{\n\n // <executable_name> defines a variable that is replaced with the name of the executable\n\n\n\n // Typical relative search paths to locate needed companion files (e.g. sample input data, or JIT source files)\n\n // The origin for the relative search may be the .exe file, a .bat file launching an .exe, a browser .exe launching the .exe or .bat, etc\n\n const char *searchPath[] =\n\n {\n\n \"./\", // same dir\n\n \"./<executable_name>_data_files/\",\n\n \"./common/\", // \"/common/\" subdir\n\n \"./common/data/\", // \"/common/data/\" subdir\n\n \"./data/\", // \"/data/\" subdir\n\n \"./src/\", // \"/src/\" subdir\n\n \"./src/<executable_name>/data/\", // \"/src/<executable_name>/data/\" subdir\n\n \"./inc/\", // \"/inc/\" subdir\n\n \"./0_Simple/\", // \"/0_Simple/\" subdir\n\n \"./1_Utilities/\", // \"/1_Utilities/\" subdir\n\n \"./2_Graphics/\", // \"/2_Graphics/\" subdir\n\n \"./3_Imaging/\", // \"/3_Imaging/\" subdir\n\n \"./4_Finance/\", // \"/4_Finance/\" subdir\n\n \"./5_Simulations/\", // \"/5_Simulations/\" subdir\n\n \"./6_Advanced/\", // \"/6_Advanced/\" subdir\n\n \"./7_CUDALibraries/\", // \"/7_CUDALibraries/\" subdir\n\n \"./8_Android/\", // \"/8_Android/\" subdir\n\n \"./samples/\", // \"/samples/\" subdir\n\n\n\n \"./0_Simple/<executable_name>/data/\", // \"/0_Simple/<executable_name>/data/\" subdir\n\n \"./1_Utilities/<executable_name>/data/\", // \"/1_Utilities/<executable_name>/data/\" subdir\n\n \"./2_Graphics/<executable_name>/data/\", // \"/2_Graphics/<executable_name>/data/\" subdir\n\n \"./3_Imaging/<executable_name>/data/\", // \"/3_Imaging/<executable_name>/data/\" subdir\n\n \"./4_Finance/<executable_name>/data/\", // \"/4_Finance/<executable_name>/data/\" subdir\n\n \"./5_Simulations/<executable_name>/data/\", // \"/5_Simulations/<executable_name>/data/\" subdir\n\n \"./6_Advanced/<executable_name>/data/\", // \"/6_Advanced/<executable_name>/data/\" subdir\n\n \"./7_CUDALibraries/<executable_name>/\", // \"/7_CUDALibraries/<executable_name>/\" subdir\n\n \"./7_CUDALibraries/<executable_name>/data/\", // \"/7_CUDALibraries/<executable_name>/data/\" subdir\n\n\n\n \"../\", // up 1 in tree\n\n \"../common/\", // up 1 in tree, \"/common/\" subdir\n\n \"../common/data/\", // up 1 in tree, \"/common/data/\" subdir\n\n \"../data/\", // up 1 in tree, \"/data/\" subdir\n\n \"../src/\", // up 1 in tree, \"/src/\" subdir\n\n \"../inc/\", // up 1 in tree, \"/inc/\" subdir\n\n\n\n \"../0_Simple/<executable_name>/data/\", // up 1 in tree, \"/0_Simple/<executable_name>/\" subdir\n\n \"../1_Utilities/<executable_name>/data/\", // up 1 in tree, \"/1_Utilities/<executable_name>/\" subdir\n\n \"../2_Graphics/<executable_name>/data/\", // up 1 in tree, \"/2_Graphics/<executable_name>/\" subdir\n\n \"../3_Imaging/<executable_name>/data/\", // up 1 in tree, \"/3_Imaging/<executable_name>/\" subdir\n\n \"../4_Finance/<executable_name>/data/\", // up 1 in tree, \"/4_Finance/<executable_name>/\" subdir\n\n \"../5_Simulations/<executable_name>/data/\", // up 1 in tree, \"/5_Simulations/<executable_name>/\" subdir\n\n \"../6_Advanced/<executable_name>/data/\", // up 1 in tree, \"/6_Advanced/<executable_name>/\" subdir\n\n \"../7_CUDALibraries/<executable_name>/data/\",// up 1 in tree, \"/7_CUDALibraries/<executable_name>/\" subdir\n\n \"../8_Android/<executable_name>/data/\", // up 1 in tree, \"/8_Android/<executable_name>/\" subdir\n\n \"../samples/<executable_name>/data/\", // up 1 in tree, \"/samples/<executable_name>/\" subdir\n\n \"../../\", // up 2 in tree\n\n \"../../common/\", // up 2 in tree, \"/common/\" subdir\n\n \"../../common/data/\", // up 2 in tree, \"/common/data/\" subdir\n\n \"../../data/\", // up 2 in tree, \"/data/\" subdir\n\n \"../../src/\", // up 2 in tree, \"/src/\" subdir\n\n \"../../inc/\", // up 2 in tree, \"/inc/\" subdir\n\n \"../../sandbox/<executable_name>/data/\", // up 2 in tree, \"/sandbox/<executable_name>/\" subdir\n\n \"../../0_Simple/<executable_name>/data/\", // up 2 in tree, \"/0_Simple/<executable_name>/\" subdir\n\n \"../../1_Utilities/<executable_name>/data/\", // up 2 in tree, \"/1_Utilities/<executable_name>/\" subdir\n\n \"../../2_Graphics/<executable_name>/data/\", // up 2 in tree, \"/2_Graphics/<executable_name>/\" subdir\n\n \"../../3_Imaging/<executable_name>/data/\", // up 2 in tree, \"/3_Imaging/<executable_name>/\" subdir\n\n \"../../4_Finance/<executable_name>/data/\", // up 2 in tree, \"/4_Finance/<executable_name>/\" subdir\n\n \"../../5_Simulations/<executable_name>/data/\", // up 2 in tree, \"/5_Simulations/<executable_name>/\" subdir\n\n \"../../6_Advanced/<executable_name>/data/\", // up 2 in tree, \"/6_Advanced/<executable_name>/\" subdir\n\n \"../../7_CUDALibraries/<executable_name>/data/\", // up 2 in tree, \"/7_CUDALibraries/<executable_name>/\" subdir\n\n \"../../8_Android/<executable_name>/data/\", // up 2 in tree, \"/8_Android/<executable_name>/\" subdir\n\n \"../../samples/<executable_name>/data/\", // up 2 in tree, \"/samples/<executable_name>/\" subdir\n\n \"../../../\", // up 3 in tree\n\n \"../../../src/<executable_name>/\", // up 3 in tree, \"/src/<executable_name>/\" subdir\n\n \"../../../src/<executable_name>/data/\", // up 3 in tree, \"/src/<executable_name>/data/\" subdir\n\n \"../../../src/<executable_name>/src/\", // up 3 in tree, \"/src/<executable_name>/src/\" subdir\n\n \"../../../src/<executable_name>/inc/\", // up 3 in tree, \"/src/<executable_name>/inc/\" subdir\n\n \"../../../sandbox/<executable_name>/\", // up 3 in tree, \"/sandbox/<executable_name>/\" subdir\n\n \"../../../sandbox/<executable_name>/data/\", // up 3 in tree, \"/sandbox/<executable_name>/data/\" subdir\n\n \"../../../sandbox/<executable_name>/src/\", // up 3 in tree, \"/sandbox/<executable_name>/src/\" subdir\n\n \"../../../sandbox/<executable_name>/inc/\", // up 3 in tree, \"/sandbox/<executable_name>/inc/\" subdir\n\n \"../../../0_Simple/<executable_name>/data/\", // up 3 in tree, \"/0_Simple/<executable_name>/\" subdir\n\n \"../../../1_Utilities/<executable_name>/data/\", // up 3 in tree, \"/1_Utilities/<executable_name>/\" subdir\n\n \"../../../2_Graphics/<executable_name>/data/\", // up 3 in tree, \"/2_Graphics/<executable_name>/\" subdir\n\n \"../../../3_Imaging/<executable_name>/data/\", // up 3 in tree, \"/3_Imaging/<executable_name>/\" subdir\n\n \"../../../4_Finance/<executable_name>/data/\", // up 3 in tree, \"/4_Finance/<executable_name>/\" subdir\n\n \"../../../5_Simulations/<executable_name>/data/\", // up 3 in tree, \"/5_Simulations/<executable_name>/\" subdir\n\n \"../../../6_Advanced/<executable_name>/data/\", // up 3 in tree, \"/6_Advanced/<executable_name>/\" subdir\n\n \"../../../7_CUDALibraries/<executable_name>/data/\", // up 3 in tree, \"/7_CUDALibraries/<executable_name>/\" subdir\n\n \"../../../8_Android/<executable_name>/data/\", // up 3 in tree, \"/8_Android/<executable_name>/\" subdir\n\n \"../../../0_Simple/<executable_name>/\", // up 3 in tree, \"/0_Simple/<executable_name>/\" subdir\n\n \"../../../1_Utilities/<executable_name>/\", // up 3 in tree, \"/1_Utilities/<executable_name>/\" subdir\n\n \"../../../2_Graphics/<executable_name>/\", // up 3 in tree, \"/2_Graphics/<executable_name>/\" subdir\n\n \"../../../3_Imaging/<executable_name>/\", // up 3 in tree, \"/3_Imaging/<executable_name>/\" subdir\n\n \"../../../4_Finance/<executable_name>/\", // up 3 in tree, \"/4_Finance/<executable_name>/\" subdir\n\n \"../../../5_Simulations/<executable_name>/\", // up 3 in tree, \"/5_Simulations/<executable_name>/\" subdir\n\n \"../../../6_Advanced/<executable_name>/\", // up 3 in tree, \"/6_Advanced/<executable_name>/\" subdir\n\n \"../../../7_CUDALibraries/<executable_name>/\", // up 3 in tree, \"/7_CUDALibraries/<executable_name>/\" subdir\n\n \"../../../8_Android/<executable_name>/\", // up 3 in tree, \"/8_Android/<executable_name>/\" subdir\n\n \"../../../samples/<executable_name>/data/\", // up 3 in tree, \"/samples/<executable_name>/\" subdir\n\n \"../../../common/\", // up 3 in tree, \"../../../common/\" subdir\n\n \"../../../common/data/\", // up 3 in tree, \"../../../common/data/\" subdir\n\n \"../../../data/\", // up 3 in tree, \"../../../data/\" subdir\n\n \"../../../../\", // up 4 in tree\n\n \"../../../../src/<executable_name>/\", // up 4 in tree, \"/src/<executable_name>/\" subdir\n\n \"../../../../src/<executable_name>/data/\", // up 4 in tree, \"/src/<executable_name>/data/\" subdir\n\n \"../../../../src/<executable_name>/src/\", // up 4 in tree, \"/src/<executable_name>/src/\" subdir\n\n \"../../../../src/<executable_name>/inc/\", // up 4 in tree, \"/src/<executable_name>/inc/\" subdir\n\n \"../../../../sandbox/<executable_name>/\", // up 4 in tree, \"/sandbox/<executable_name>/\" subdir\n\n \"../../../../sandbox/<executable_name>/data/\", // up 4 in tree, \"/sandbox/<executable_name>/data/\" subdir\n\n \"../../../../sandbox/<executable_name>/src/\", // up 4 in tree, \"/sandbox/<executable_name>/src/\" subdir\n\n \"../../../../sandbox/<executable_name>/inc/\", // up 4 in tree, \"/sandbox/<executable_name>/inc/\" subdir\n\n \"../../../../0_Simple/<executable_name>/data/\", // up 4 in tree, \"/0_Simple/<executable_name>/\" subdir\n\n \"../../../../1_Utilities/<executable_name>/data/\", // up 4 in tree, \"/1_Utilities/<executable_name>/\" subdir\n\n \"../../../../2_Graphics/<executable_name>/data/\", // up 4 in tree, \"/2_Graphics/<executable_name>/\" subdir\n\n \"../../../../3_Imaging/<executable_name>/data/\", // up 4 in tree, \"/3_Imaging/<executable_name>/\" subdir\n\n \"../../../../4_Finance/<executable_name>/data/\", // up 4 in tree, \"/4_Finance/<executable_name>/\" subdir\n\n \"../../../../5_Simulations/<executable_name>/data/\",// up 4 in tree, \"/5_Simulations/<executable_name>/\" subdir\n\n \"../../../../6_Advanced/<executable_name>/data/\", // up 4 in tree, \"/6_Advanced/<executable_name>/\" subdir\n\n \"../../../../7_CUDALibraries/<executable_name>/data/\", // up 4 in tree, \"/7_CUDALibraries/<executable_name>/\" subdir\n\n \"../../../../8_Android/<executable_name>/data/\", // up 4 in tree, \"/8_Android/<executable_name>/\" subdir\n\n \"../../../../0_Simple/<executable_name>/\", // up 4 in tree, \"/0_Simple/<executable_name>/\" subdir\n\n \"../../../../1_Utilities/<executable_name>/\", // up 4 in tree, \"/1_Utilities/<executable_name>/\" subdir\n\n \"../../../../2_Graphics/<executable_name>/\", // up 4 in tree, \"/2_Graphics/<executable_name>/\" subdir\n\n \"../../../../3_Imaging/<executable_name>/\", // up 4 in tree, \"/3_Imaging/<executable_name>/\" subdir\n\n \"../../../../4_Finance/<executable_name>/\", // up 4 in tree, \"/4_Finance/<executable_name>/\" subdir\n\n \"../../../../5_Simulations/<executable_name>/\",// up 4 in tree, \"/5_Simulations/<executable_name>/\" subdir\n\n \"../../../../6_Advanced/<executable_name>/\", // up 4 in tree, \"/6_Advanced/<executable_name>/\" subdir\n\n \"../../../../7_CUDALibraries/<executable_name>/\", // up 4 in tree, \"/7_CUDALibraries/<executable_name>/\" subdir\n\n \"../../../../8_Android/<executable_name>/\", // up 4 in tree, \"/8_Android/<executable_name>/\" subdir\n\n \"../../../../samples/<executable_name>/data/\", // up 4 in tree, \"/samples/<executable_name>/\" subdir\n\n \"../../../../common/\", // up 4 in tree, \"../../../common/\" subdir\n\n \"../../../../common/data/\", // up 4 in tree, \"../../../common/data/\" subdir\n\n \"../../../../data/\", // up 4 in tree, \"../../../data/\" subdir\n\n \"../../../../../\", // up 5 in tree\n\n \"../../../../../src/<executable_name>/\", // up 5 in tree, \"/src/<executable_name>/\" subdir\n\n \"../../../../../src/<executable_name>/data/\", // up 5 in tree, \"/src/<executable_name>/data/\" subdir\n\n \"../../../../../src/<executable_name>/src/\", // up 5 in tree, \"/src/<executable_name>/src/\" subdir\n\n \"../../../../../src/<executable_name>/inc/\", // up 5 in tree, \"/src/<executable_name>/inc/\" subdir\n\n \"../../../../../sandbox/<executable_name>/\", // up 5 in tree, \"/sandbox/<executable_name>/\" subdir\n\n \"../../../../../sandbox/<executable_name>/data/\", // up 5 in tree, \"/sandbox/<executable_name>/data/\" subdir\n\n \"../../../../../sandbox/<executable_name>/src/\", // up 5 in tree, \"/sandbox/<executable_name>/src/\" subdir\n\n \"../../../../../sandbox/<executable_name>/inc/\", // up 5 in tree, \"/sandbox/<executable_name>/inc/\" subdir\n\n \"../../../../../0_Simple/<executable_name>/data/\", // up 5 in tree, \"/0_Simple/<executable_name>/\" subdir\n\n \"../../../../../1_Utilities/<executable_name>/data/\", // up 5 in tree, \"/1_Utilities/<executable_name>/\" subdir\n\n \"../../../../../2_Graphics/<executable_name>/data/\", // up 5 in tree, \"/2_Graphics/<executable_name>/\" subdir\n\n \"../../../../../3_Imaging/<executable_name>/data/\", // up 5 in tree, \"/3_Imaging/<executable_name>/\" subdir\n\n \"../../../../../4_Finance/<executable_name>/data/\", // up 5 in tree, \"/4_Finance/<executable_name>/\" subdir\n\n \"../../../../../5_Simulations/<executable_name>/data/\",// up 5 in tree, \"/5_Simulations/<executable_name>/\" subdir\n\n \"../../../../../6_Advanced/<executable_name>/data/\", // up 5 in tree, \"/6_Advanced/<executable_name>/\" subdir\n\n \"../../../../../7_CUDALibraries/<executable_name>/data/\", // up 5 in tree, \"/7_CUDALibraries/<executable_name>/\" subdir\n\n \"../../../../../8_Android/<executable_name>/data/\", // up 5 in tree, \"/8_Android/<executable_name>/\" subdir\n\n \"../../../../../samples/<executable_name>/data/\", // up 5 in tree, \"/samples/<executable_name>/\" subdir\n\n \"../../../../../common/\", // up 5 in tree, \"../../../common/\" subdir\n\n \"../../../../../common/data/\", // up 5 in tree, \"../../../common/data/\" subdir\n\n };\n\n\n\n // Extract the executable name\n\n std::string executable_name;\n\n\n\n if (executable_path != 0)\n\n {\n\n executable_name = std::string(executable_path);\n\n\n\n#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)\n\n // Windows path delimiter\n\n size_t delimiter_pos = executable_name.find_last_of('\\\\');\n\n executable_name.erase(0, delimiter_pos + 1);\n\n\n\n if (executable_name.rfind(\".exe\") != std::string::npos)\n\n {\n\n // we strip .exe, only if the .exe is found\n\n executable_name.resize(executable_name.size() - 4);\n\n }\n\n\n\n#else\n\n // Linux & OSX path delimiter\n\n size_t delimiter_pos = executable_name.find_last_of('/');\n\n executable_name.erase(0,delimiter_pos+1);\n\n#endif\n\n }\n\n\n\n // Loop over all search paths and return the first hit\n\n for (unsigned int i = 0; i < sizeof(searchPath)/sizeof(char *); ++i)\n\n {\n\n std::string path(searchPath[i]);\n\n size_t executable_name_pos = path.find(\"<executable_name>\");\n\n\n\n // If there is executable_name variable in the searchPath\n\n // replace it with the value\n\n if (executable_name_pos != std::string::npos)\n\n {\n\n if (executable_path != 0)\n\n {\n\n path.replace(executable_name_pos, strlen(\"<executable_name>\"), executable_name);\n\n }\n\n else\n\n {\n\n // Skip this path entry if no executable argument is given\n\n continue;\n\n }\n\n }\n\n\n\n#ifdef _DEBUG\n\n printf(\"sdkFindFilePath <%s> in %s\\n\", filename, path.c_str());\n\n#endif\n\n\n\n // Test if the file exists\n\n path.append(filename);\n\n FILE *fp;\n\n FOPEN(fp, path.c_str(), \"rb\");\n\n\n\n if (fp != NULL)\n\n {\n\n fclose(fp);\n\n // File found\n\n // returning an allocated array here for backwards compatibility reasons\n\n char *file_path = (char *) malloc(path.length() + 1);\n\n STRCPY(file_path, path.length() + 1, path.c_str());\n\n return file_path;\n\n }\n\n\n\n if (fp)\n\n {\n\n fclose(fp);\n\n }\n\n }\n\n\n\n // File not found\n\n return 0;\n", "file_path": "cmake/Modules/include/helper_cuda_fallback/9.1/helper_string.h", "rank": 29, "score": 145681.80956612973 }, { "content": "inline char *sdkFindFilePath(const char *filename,\n\n const char *executable_path) {\n\n // <executable_name> defines a variable that is replaced with the name of the\n\n // executable\n\n\n\n // Typical relative search paths to locate needed companion files (e.g. sample\n\n // input data, or JIT source files) The origin for the relative search may be\n\n // the .exe file, a .bat file launching an .exe, a browser .exe launching the\n\n // .exe or .bat, etc\n\n const char *searchPath[] = {\n\n \"./\", // same dir\n\n \"./<executable_name>_data_files/\",\n\n \"./common/\", // \"/common/\" subdir\n\n \"./common/data/\", // \"/common/data/\" subdir\n\n \"./data/\", // \"/data/\" subdir\n\n \"./src/\", // \"/src/\" subdir\n\n \"./src/<executable_name>/data/\", // \"/src/<executable_name>/data/\" subdir\n\n \"./inc/\", // \"/inc/\" subdir\n\n \"./0_Simple/\", // \"/0_Simple/\" subdir\n\n \"./1_Utilities/\", // \"/1_Utilities/\" subdir\n\n \"./2_Graphics/\", // \"/2_Graphics/\" subdir\n\n \"./3_Imaging/\", // \"/3_Imaging/\" subdir\n\n \"./4_Finance/\", // \"/4_Finance/\" subdir\n\n \"./5_Simulations/\", // \"/5_Simulations/\" subdir\n\n \"./6_Advanced/\", // \"/6_Advanced/\" subdir\n\n \"./7_CUDALibraries/\", // \"/7_CUDALibraries/\" subdir\n\n \"./8_Android/\", // \"/8_Android/\" subdir\n\n \"./samples/\", // \"/samples/\" subdir\n\n\n\n \"./0_Simple/<executable_name>/data/\", // \"/0_Simple/<executable_name>/data/\"\n\n // subdir\n\n \"./1_Utilities/<executable_name>/data/\", // \"/1_Utilities/<executable_name>/data/\"\n\n // subdir\n\n \"./2_Graphics/<executable_name>/data/\", // \"/2_Graphics/<executable_name>/data/\"\n\n // subdir\n\n \"./3_Imaging/<executable_name>/data/\", // \"/3_Imaging/<executable_name>/data/\"\n\n // subdir\n\n \"./4_Finance/<executable_name>/data/\", // \"/4_Finance/<executable_name>/data/\"\n\n // subdir\n\n \"./5_Simulations/<executable_name>/data/\", // \"/5_Simulations/<executable_name>/data/\"\n\n // subdir\n\n \"./6_Advanced/<executable_name>/data/\", // \"/6_Advanced/<executable_name>/data/\"\n\n // subdir\n\n \"./7_CUDALibraries/<executable_name>/\", // \"/7_CUDALibraries/<executable_name>/\"\n\n // subdir\n\n \"./7_CUDALibraries/<executable_name>/data/\", // \"/7_CUDALibraries/<executable_name>/data/\"\n\n // subdir\n\n\n\n \"../\", // up 1 in tree\n\n \"../common/\", // up 1 in tree, \"/common/\" subdir\n\n \"../common/data/\", // up 1 in tree, \"/common/data/\" subdir\n\n \"../data/\", // up 1 in tree, \"/data/\" subdir\n\n \"../src/\", // up 1 in tree, \"/src/\" subdir\n\n \"../inc/\", // up 1 in tree, \"/inc/\" subdir\n\n\n\n \"../0_Simple/<executable_name>/data/\", // up 1 in tree,\n\n // \"/0_Simple/<executable_name>/\"\n\n // subdir\n\n \"../1_Utilities/<executable_name>/data/\", // up 1 in tree,\n\n // \"/1_Utilities/<executable_name>/\"\n\n // subdir\n\n \"../2_Graphics/<executable_name>/data/\", // up 1 in tree,\n\n // \"/2_Graphics/<executable_name>/\"\n\n // subdir\n\n \"../3_Imaging/<executable_name>/data/\", // up 1 in tree,\n\n // \"/3_Imaging/<executable_name>/\"\n\n // subdir\n\n \"../4_Finance/<executable_name>/data/\", // up 1 in tree,\n\n // \"/4_Finance/<executable_name>/\"\n\n // subdir\n\n \"../5_Simulations/<executable_name>/data/\", // up 1 in tree,\n\n // \"/5_Simulations/<executable_name>/\"\n\n // subdir\n\n \"../6_Advanced/<executable_name>/data/\", // up 1 in tree,\n\n // \"/6_Advanced/<executable_name>/\"\n\n // subdir\n\n \"../7_CUDALibraries/<executable_name>/data/\", // up 1 in tree,\n\n // \"/7_CUDALibraries/<executable_name>/\"\n\n // subdir\n\n \"../8_Android/<executable_name>/data/\", // up 1 in tree,\n\n // \"/8_Android/<executable_name>/\"\n\n // subdir\n\n \"../samples/<executable_name>/data/\", // up 1 in tree,\n\n // \"/samples/<executable_name>/\"\n\n // subdir\n\n \"../../\", // up 2 in tree\n\n \"../../common/\", // up 2 in tree, \"/common/\" subdir\n\n \"../../common/data/\", // up 2 in tree, \"/common/data/\" subdir\n\n \"../../data/\", // up 2 in tree, \"/data/\" subdir\n\n \"../../src/\", // up 2 in tree, \"/src/\" subdir\n\n \"../../inc/\", // up 2 in tree, \"/inc/\" subdir\n\n \"../../sandbox/<executable_name>/data/\", // up 2 in tree,\n\n // \"/sandbox/<executable_name>/\"\n\n // subdir\n\n \"../../0_Simple/<executable_name>/data/\", // up 2 in tree,\n\n // \"/0_Simple/<executable_name>/\"\n\n // subdir\n\n \"../../1_Utilities/<executable_name>/data/\", // up 2 in tree,\n\n // \"/1_Utilities/<executable_name>/\"\n\n // subdir\n\n \"../../2_Graphics/<executable_name>/data/\", // up 2 in tree,\n\n // \"/2_Graphics/<executable_name>/\"\n\n // subdir\n\n \"../../3_Imaging/<executable_name>/data/\", // up 2 in tree,\n\n // \"/3_Imaging/<executable_name>/\"\n\n // subdir\n\n \"../../4_Finance/<executable_name>/data/\", // up 2 in tree,\n\n // \"/4_Finance/<executable_name>/\"\n\n // subdir\n\n \"../../5_Simulations/<executable_name>/data/\", // up 2 in tree,\n\n // \"/5_Simulations/<executable_name>/\"\n\n // subdir\n\n \"../../6_Advanced/<executable_name>/data/\", // up 2 in tree,\n\n // \"/6_Advanced/<executable_name>/\"\n\n // subdir\n\n \"../../7_CUDALibraries/<executable_name>/data/\", // up 2 in tree,\n\n // \"/7_CUDALibraries/<executable_name>/\"\n\n // subdir\n\n \"../../8_Android/<executable_name>/data/\", // up 2 in tree,\n\n // \"/8_Android/<executable_name>/\"\n\n // subdir\n\n \"../../samples/<executable_name>/data/\", // up 2 in tree,\n\n // \"/samples/<executable_name>/\"\n\n // subdir\n\n \"../../../\", // up 3 in tree\n\n \"../../../src/<executable_name>/\", // up 3 in tree,\n\n // \"/src/<executable_name>/\" subdir\n\n \"../../../src/<executable_name>/data/\", // up 3 in tree,\n\n // \"/src/<executable_name>/data/\"\n\n // subdir\n\n \"../../../src/<executable_name>/src/\", // up 3 in tree,\n\n // \"/src/<executable_name>/src/\"\n\n // subdir\n\n \"../../../src/<executable_name>/inc/\", // up 3 in tree,\n\n // \"/src/<executable_name>/inc/\"\n\n // subdir\n\n \"../../../sandbox/<executable_name>/\", // up 3 in tree,\n\n // \"/sandbox/<executable_name>/\"\n\n // subdir\n\n \"../../../sandbox/<executable_name>/data/\", // up 3 in tree,\n\n // \"/sandbox/<executable_name>/data/\"\n\n // subdir\n\n \"../../../sandbox/<executable_name>/src/\", // up 3 in tree,\n\n // \"/sandbox/<executable_name>/src/\"\n\n // subdir\n\n \"../../../sandbox/<executable_name>/inc/\", // up 3 in tree,\n\n // \"/sandbox/<executable_name>/inc/\"\n\n // subdir\n\n \"../../../0_Simple/<executable_name>/data/\", // up 3 in tree,\n\n // \"/0_Simple/<executable_name>/\"\n\n // subdir\n\n \"../../../1_Utilities/<executable_name>/data/\", // up 3 in tree,\n\n // \"/1_Utilities/<executable_name>/\"\n\n // subdir\n\n \"../../../2_Graphics/<executable_name>/data/\", // up 3 in tree,\n\n // \"/2_Graphics/<executable_name>/\"\n\n // subdir\n\n \"../../../3_Imaging/<executable_name>/data/\", // up 3 in tree,\n\n // \"/3_Imaging/<executable_name>/\"\n\n // subdir\n\n \"../../../4_Finance/<executable_name>/data/\", // up 3 in tree,\n\n // \"/4_Finance/<executable_name>/\"\n\n // subdir\n\n \"../../../5_Simulations/<executable_name>/data/\", // up 3 in tree,\n\n // \"/5_Simulations/<executable_name>/\"\n\n // subdir\n\n \"../../../6_Advanced/<executable_name>/data/\", // up 3 in tree,\n\n // \"/6_Advanced/<executable_name>/\"\n\n // subdir\n\n \"../../../7_CUDALibraries/<executable_name>/data/\", // up 3 in tree,\n\n // \"/7_CUDALibraries/<executable_name>/\"\n\n // subdir\n\n \"../../../8_Android/<executable_name>/data/\", // up 3 in tree,\n\n // \"/8_Android/<executable_name>/\"\n\n // subdir\n\n \"../../../0_Simple/<executable_name>/\", // up 3 in tree,\n\n // \"/0_Simple/<executable_name>/\"\n\n // subdir\n\n \"../../../1_Utilities/<executable_name>/\", // up 3 in tree,\n\n // \"/1_Utilities/<executable_name>/\"\n\n // subdir\n\n \"../../../2_Graphics/<executable_name>/\", // up 3 in tree,\n\n // \"/2_Graphics/<executable_name>/\"\n\n // subdir\n\n \"../../../3_Imaging/<executable_name>/\", // up 3 in tree,\n\n // \"/3_Imaging/<executable_name>/\"\n\n // subdir\n\n \"../../../4_Finance/<executable_name>/\", // up 3 in tree,\n\n // \"/4_Finance/<executable_name>/\"\n\n // subdir\n\n \"../../../5_Simulations/<executable_name>/\", // up 3 in tree,\n\n // \"/5_Simulations/<executable_name>/\"\n\n // subdir\n\n \"../../../6_Advanced/<executable_name>/\", // up 3 in tree,\n\n // \"/6_Advanced/<executable_name>/\"\n\n // subdir\n\n \"../../../7_CUDALibraries/<executable_name>/\", // up 3 in tree,\n\n // \"/7_CUDALibraries/<executable_name>/\"\n\n // subdir\n\n \"../../../8_Android/<executable_name>/\", // up 3 in tree,\n\n // \"/8_Android/<executable_name>/\"\n\n // subdir\n\n \"../../../samples/<executable_name>/data/\", // up 3 in tree,\n\n // \"/samples/<executable_name>/\"\n\n // subdir\n\n \"../../../common/\", // up 3 in tree, \"../../../common/\" subdir\n\n \"../../../common/data/\", // up 3 in tree, \"../../../common/data/\" subdir\n\n \"../../../data/\", // up 3 in tree, \"../../../data/\" subdir\n\n \"../../../../\", // up 4 in tree\n\n \"../../../../src/<executable_name>/\", // up 4 in tree,\n\n // \"/src/<executable_name>/\" subdir\n\n \"../../../../src/<executable_name>/data/\", // up 4 in tree,\n\n // \"/src/<executable_name>/data/\"\n\n // subdir\n\n \"../../../../src/<executable_name>/src/\", // up 4 in tree,\n\n // \"/src/<executable_name>/src/\"\n\n // subdir\n\n \"../../../../src/<executable_name>/inc/\", // up 4 in tree,\n\n // \"/src/<executable_name>/inc/\"\n\n // subdir\n\n \"../../../../sandbox/<executable_name>/\", // up 4 in tree,\n\n // \"/sandbox/<executable_name>/\"\n\n // subdir\n\n \"../../../../sandbox/<executable_name>/data/\", // up 4 in tree,\n\n // \"/sandbox/<executable_name>/data/\"\n\n // subdir\n\n \"../../../../sandbox/<executable_name>/src/\", // up 4 in tree,\n\n // \"/sandbox/<executable_name>/src/\"\n\n // subdir\n\n \"../../../../sandbox/<executable_name>/inc/\", // up 4 in tree,\n\n // \"/sandbox/<executable_name>/inc/\"\n\n // subdir\n\n \"../../../../0_Simple/<executable_name>/data/\", // up 4 in tree,\n\n // \"/0_Simple/<executable_name>/\"\n\n // subdir\n\n \"../../../../1_Utilities/<executable_name>/data/\", // up 4 in tree,\n\n // \"/1_Utilities/<executable_name>/\"\n\n // subdir\n\n \"../../../../2_Graphics/<executable_name>/data/\", // up 4 in tree,\n\n // \"/2_Graphics/<executable_name>/\"\n\n // subdir\n\n \"../../../../3_Imaging/<executable_name>/data/\", // up 4 in tree,\n\n // \"/3_Imaging/<executable_name>/\"\n\n // subdir\n\n \"../../../../4_Finance/<executable_name>/data/\", // up 4 in tree,\n\n // \"/4_Finance/<executable_name>/\"\n\n // subdir\n\n \"../../../../5_Simulations/<executable_name>/data/\", // up 4 in tree,\n\n // \"/5_Simulations/<executable_name>/\"\n\n // subdir\n\n \"../../../../6_Advanced/<executable_name>/data/\", // up 4 in tree,\n\n // \"/6_Advanced/<executable_name>/\"\n\n // subdir\n\n \"../../../../7_CUDALibraries/<executable_name>/data/\", // up 4 in tree,\n\n // \"/7_CUDALibraries/<executable_name>/\"\n\n // subdir\n\n \"../../../../8_Android/<executable_name>/data/\", // up 4 in tree,\n\n // \"/8_Android/<executable_name>/\"\n\n // subdir\n\n \"../../../../0_Simple/<executable_name>/\", // up 4 in tree,\n\n // \"/0_Simple/<executable_name>/\"\n\n // subdir\n\n \"../../../../1_Utilities/<executable_name>/\", // up 4 in tree,\n\n // \"/1_Utilities/<executable_name>/\"\n\n // subdir\n\n \"../../../../2_Graphics/<executable_name>/\", // up 4 in tree,\n\n // \"/2_Graphics/<executable_name>/\"\n\n // subdir\n\n \"../../../../3_Imaging/<executable_name>/\", // up 4 in tree,\n\n // \"/3_Imaging/<executable_name>/\"\n\n // subdir\n\n \"../../../../4_Finance/<executable_name>/\", // up 4 in tree,\n\n // \"/4_Finance/<executable_name>/\"\n\n // subdir\n\n \"../../../../5_Simulations/<executable_name>/\", // up 4 in tree,\n\n // \"/5_Simulations/<executable_name>/\"\n\n // subdir\n\n \"../../../../6_Advanced/<executable_name>/\", // up 4 in tree,\n\n // \"/6_Advanced/<executable_name>/\"\n\n // subdir\n\n \"../../../../7_CUDALibraries/<executable_name>/\", // up 4 in tree,\n\n // \"/7_CUDALibraries/<executable_name>/\"\n\n // subdir\n\n \"../../../../8_Android/<executable_name>/\", // up 4 in tree,\n\n // \"/8_Android/<executable_name>/\"\n\n // subdir\n\n \"../../../../samples/<executable_name>/data/\", // up 4 in tree,\n\n // \"/samples/<executable_name>/\"\n\n // subdir\n\n \"../../../../common/\", // up 4 in tree, \"../../../common/\" subdir\n\n \"../../../../common/data/\", // up 4 in tree, \"../../../common/data/\"\n\n // subdir\n\n \"../../../../data/\", // up 4 in tree, \"../../../data/\" subdir\n\n \"../../../../../\", // up 5 in tree\n\n \"../../../../../src/<executable_name>/\", // up 5 in tree,\n\n // \"/src/<executable_name>/\"\n\n // subdir\n\n \"../../../../../src/<executable_name>/data/\", // up 5 in tree,\n\n // \"/src/<executable_name>/data/\"\n\n // subdir\n\n \"../../../../../src/<executable_name>/src/\", // up 5 in tree,\n\n // \"/src/<executable_name>/src/\"\n\n // subdir\n\n \"../../../../../src/<executable_name>/inc/\", // up 5 in tree,\n\n // \"/src/<executable_name>/inc/\"\n\n // subdir\n\n \"../../../../../sandbox/<executable_name>/\", // up 5 in tree,\n\n // \"/sandbox/<executable_name>/\"\n\n // subdir\n\n \"../../../../../sandbox/<executable_name>/data/\", // up 5 in tree,\n\n // \"/sandbox/<executable_name>/data/\"\n\n // subdir\n\n \"../../../../../sandbox/<executable_name>/src/\", // up 5 in tree,\n\n // \"/sandbox/<executable_name>/src/\"\n\n // subdir\n\n \"../../../../../sandbox/<executable_name>/inc/\", // up 5 in tree,\n\n // \"/sandbox/<executable_name>/inc/\"\n\n // subdir\n\n \"../../../../../0_Simple/<executable_name>/data/\", // up 5 in tree,\n\n // \"/0_Simple/<executable_name>/\"\n\n // subdir\n\n \"../../../../../1_Utilities/<executable_name>/data/\", // up 5 in tree,\n\n // \"/1_Utilities/<executable_name>/\"\n\n // subdir\n\n \"../../../../../2_Graphics/<executable_name>/data/\", // up 5 in tree,\n\n // \"/2_Graphics/<executable_name>/\"\n\n // subdir\n\n \"../../../../../3_Imaging/<executable_name>/data/\", // up 5 in tree,\n\n // \"/3_Imaging/<executable_name>/\"\n\n // subdir\n\n \"../../../../../4_Finance/<executable_name>/data/\", // up 5 in tree,\n\n // \"/4_Finance/<executable_name>/\"\n\n // subdir\n\n \"../../../../../5_Simulations/<executable_name>/data/\", // up 5 in tree,\n\n // \"/5_Simulations/<executable_name>/\"\n\n // subdir\n\n \"../../../../../6_Advanced/<executable_name>/data/\", // up 5 in tree,\n\n // \"/6_Advanced/<executable_name>/\"\n\n // subdir\n\n \"../../../../../7_CUDALibraries/<executable_name>/data/\", // up 5 in\n\n // tree,\n\n // \"/7_CUDALibraries/<executable_name>/\"\n\n // subdir\n\n \"../../../../../8_Android/<executable_name>/data/\", // up 5 in tree,\n\n // \"/8_Android/<executable_name>/\"\n\n // subdir\n\n \"../../../../../samples/<executable_name>/data/\", // up 5 in tree,\n\n // \"/samples/<executable_name>/\"\n\n // subdir\n\n \"../../../../../common/\", // up 5 in tree, \"../../../common/\" subdir\n\n \"../../../../../common/data/\", // up 5 in tree, \"../../../common/data/\"\n\n // subdir\n\n };\n\n\n\n // Extract the executable name\n\n std::string executable_name;\n\n\n\n if (executable_path != 0) {\n\n executable_name = std::string(executable_path);\n\n\n\n#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)\n\n // Windows path delimiter\n\n size_t delimiter_pos = executable_name.find_last_of('\\\\');\n\n executable_name.erase(0, delimiter_pos + 1);\n\n\n\n if (executable_name.rfind(\".exe\") != std::string::npos) {\n\n // we strip .exe, only if the .exe is found\n\n executable_name.resize(executable_name.size() - 4);\n\n }\n\n\n\n#else\n\n // Linux & OSX path delimiter\n\n size_t delimiter_pos = executable_name.find_last_of('/');\n\n executable_name.erase(0, delimiter_pos + 1);\n\n#endif\n\n }\n\n\n\n // Loop over all search paths and return the first hit\n\n for (unsigned int i = 0; i < sizeof(searchPath) / sizeof(char *); ++i) {\n\n std::string path(searchPath[i]);\n\n size_t executable_name_pos = path.find(\"<executable_name>\");\n\n\n\n // If there is executable_name variable in the searchPath\n\n // replace it with the value\n\n if (executable_name_pos != std::string::npos) {\n\n if (executable_path != 0) {\n\n path.replace(executable_name_pos, strlen(\"<executable_name>\"),\n\n executable_name);\n\n } else {\n\n // Skip this path entry if no executable argument is given\n\n continue;\n\n }\n\n }\n\n\n\n#ifdef _DEBUG\n\n printf(\"sdkFindFilePath <%s> in %s\\n\", filename, path.c_str());\n\n#endif\n\n\n\n // Test if the file exists\n\n path.append(filename);\n\n FILE *fp;\n\n FOPEN(fp, path.c_str(), \"rb\");\n\n\n\n if (fp != NULL) {\n\n fclose(fp);\n\n // File found\n\n // returning an allocated array here for backwards compatibility reasons\n\n char *file_path = reinterpret_cast<char *>(malloc(path.length() + 1));\n\n STRCPY(file_path, path.length() + 1, path.c_str());\n\n return file_path;\n\n }\n\n\n\n if (fp) {\n\n fclose(fp);\n\n }\n\n }\n\n\n\n // File not found\n\n return 0;\n", "file_path": "cmake/Modules/include/helper_cuda_fallback/9.2/helper_string.h", "rank": 30, "score": 145681.80956612973 }, { "content": "Accomodating new versions of OptiX\n\n------------------------------------\n\n\n\nCompiling with an unhandled version of OptiX gives::\n\n\n\n [ 64%] Linking CXX shared library libOpticksCore.dylib\n\n Undefined symbols for architecture x86_64:\n\n \"OpticksBufferSpec::photon_compute_\", referenced from:\n\n OpticksBufferSpec::Get(char const*, bool) in OpticksBufferSpec.cc.o\n\n \"OpticksBufferSpec::photon_interop_\", referenced from:\n\n\n\nTo find the version to handle see sysrap-/OpticksCMakeConfigTest \n\n\n\n\n", "file_path": "optickscore/OpticksBufferSpec.cc", "rank": 31, "score": 142910.85843584407 }, { "content": "CSGOptiX::snap : Download frame pixels and write to file as jpg.\n\n------------------------------------------------------------------\n\n**/\n\n\n\nvoid CSGOptiX::snap(const char* path, const char* bottom_line, const char* top_line, unsigned line_height)\n\n{\n\n#if OPTIX_VERSION < 70000\n\n six->snap(path, bottom_line, top_line, line_height); \n\n#else\n\n frame->download(); \n\n frame->annotate( bottom_line, top_line, line_height ); \n\n frame->writeJPG(path, jpg_quality); \n\n#endif\n\n if(!flight || SStr::Contains(path,\"00000\"))\n\n {\n\n saveMeta(path); \n\n }\n\n}\n\n\n\nvoid CSGOptiX::writeFramePhoton(const char* dir, const char* name)\n", "file_path": "CSGOptiX/CSGOptiX.cc", "rank": 32, "score": 138452.76813683237 }, { "content": "ImageNPY::LoadPPM\n\n-------------------\n\n\n\n1. readHeader of the PPM for dimensions\n\n2. create NPY array sized appropriately\n\n3. read the PPM image into the array \n\n\n\n**/\n\n\n\nNPY<unsigned char>* ImageNPY::LoadPPM(const char* path, const bool yflip, const unsigned ncomp, const char* config, bool concat_dimension) // static\n\n{\n\n unsigned width(0) ; \n\n unsigned height(0) ; \n\n unsigned mode(0) ; \n\n unsigned bits(0) ; \n\n\n\n int rc0 = SPPM::readHeader(path, width, height, mode, bits ); \n\n\n\n assert( rc0 == 0 && mode == 6 && bits == 255 ); \n\n\n", "file_path": "npy/ImageNPY.cpp", "rank": 33, "score": 137402.8419883064 }, { "content": "BFile::UserTmpPath\n\n--------------------\n\n\n\nReturns a string suitable for temporary paths including \n\nrandom hex higits to avoid clashes.\n\n\n\n**/\n\n\n\nstd::string BFile::UserTmpPath_(const char* pfx_)\n\n{\n\n fs::path tmpl = boost::filesystem::path(UserTmpDir()) ; \n\n\n\n std::stringstream ss ; \n\n ss << pfx_ << \"_%%%%-%%%%-%%%%-%%%%\" ; \n\n std::string pfx = ss.str(); \n\n tmpl /= pfx ; \n\n\n\n fs::path p = boost::filesystem::unique_path(tmpl);\n\n const std::string tmp = p.native();\n\n return tmp ; \n", "file_path": "boostrap/BFile.cc", "rank": 34, "score": 134112.8161340099 }, { "content": "ImageNPY::SavePPMConcat\n\n-------------------------\n\n\n\nRequires a 4d array representing layered images, eg with shape::\n\n\n\n (3, 512, 1024, 3) \n\n (layers, height, width, payload-rgb )\n\n\n\nThe path argument is expected to end with \".ppm\".\n\nEach layer of the array is saved to separate files\n\nwith path argument ending modified to \"_0.ppm\" \"_1.ppm\" \"_2.ppm\"\n\n\n\n**/\n\n\n\nvoid ImageNPY::SavePPMConcat(const NPY<unsigned char>* imgs, const char* path, const bool yflip)\n\n{\n\n assert( imgs->getDimensions() == 4 ); \n\n assert( SStr::EndsWith(path, \".ppm\")); \n\n\n\n unsigned ni = imgs->getShape(0); \n", "file_path": "npy/ImageNPY.cpp", "rank": 35, "score": 134098.4134344471 }, { "content": "class Sc(object):\n\n def __init__(self, maxcsgheight=4):\n\n self.ulv = set()\n\n self.uso = set()\n\n self.nodes = collections.OrderedDict()\n\n self.meshes = collections.OrderedDict()\n\n self.extras = {}\n\n self.maxcsgheight = maxcsgheight\n\n self.translate_node_count = 0 \n\n self.add_node_count = 0 \n\n self.selected = []\n\n\n\n\n\n def _get_gltf(self):\n\n root = 0 \n\n d = {} \n\n d[\"scene\"] = 0 \n\n d[\"scenes\"] = [{ \"nodes\":[root] }]\n\n d[\"asset\"] = { \"version\":\"2.0\", \"extras\":self.extras }\n\n d[\"nodes\"] = [node.gltf for node in self.nodes.values()]\n\n d[\"meshes\"] = [mesh.gltf for mesh in self.meshes.values()]\n\n return d\n\n gltf = property(_get_gltf)\n\n\n\n brief = property(lambda self:\"Sc nodes:%d meshes:%d len(ulv):%d len(uso):%d \" % (len(self.nodes), len(self.meshes), len(self.ulv), len(self.uso)))\n\n\n\n def __repr__(self):\n\n return \"\\n\".join([self.brief])\n\n\n\n def __str__(self): \n\n return \"\\n\".join([self.brief] + map(repr, self.meshes.items()))\n\n\n\n\n\n def lv2so(self, lvIdx): \n\n \"\"\"\n\n Convert from an external \"mesh\" index lvIdx into \n\n local mesh index, using lvIdx identity\n\n \"\"\" \n\n soIdx = list(self.meshes.iterkeys()).index(lvIdx) \n\n return soIdx\n\n\n\n def add_mesh(self, lvIdx, lvName, soName):\n\n if not lvIdx in self.meshes:\n\n self.meshes[lvIdx] = Mh(lvIdx, lvName, soName)\n\n self.meshes[lvIdx].soIdx = self.lv2so(lvIdx)\n\n pass\n\n return self.meshes[lvIdx]\n\n\n\n def get_mesh(self, lvIdx):\n\n return self.meshes[lvIdx]\n\n\n\n def find_meshes_so(self, pfx):\n\n return filter(lambda mesh:mesh.soName.startswith(pfx),self.meshes.values())\n\n\n\n def find_meshes_lv(self, pfx):\n\n return filter(lambda mesh:mesh.lvName.startswith(pfx),self.meshes.values())\n\n\n\n\n\n def add_node(self, lvIdx, lvName, pvName, soName, transform, boundary, depth, selected):\n\n\n\n mesh = self.add_mesh(lvIdx, lvName, soName)\n\n soIdx = mesh.soIdx\n\n\n\n ndIdx = len(self.nodes)\n\n name = \"ndIdx:%3d,soIdx:%3d,lvName:%s\" % (ndIdx, soIdx, lvName)\n\n\n\n #log.info(\"add_node %s \" % name)\n\n assert transform is not None\n\n\n\n nd = Nd(ndIdx, soIdx, transform, boundary, pvName, depth, self, selected )\n\n nd.mesh = mesh \n\n\n\n\n\n assert not ndIdx in self.nodes\n\n self.nodes[ndIdx] = nd \n\n return nd \n\n\n\n def get_node(self, ndIdx):\n\n return self.nodes[ndIdx]\n\n\n\n def get_transform(self, ndIdx):\n\n nd = self.get_node(ndIdx)\n\n return nd.gtr_mdot_r \n\n\n\n def add_node_gdml(self, node, depth, debug=False):\n\n \"\"\"\n\n :param node: treeified ie (PV,LV) collapsed GDML node\n\n :param depth: integer\n\n :return nd: GLTF translation of the input node\n\n \"\"\"\n\n lvIdx = node.lv.idx\n\n lvName = node.lv.name\n\n pvName = node.pv.name\n\n soName = node.lv.solid.name\n\n transform = node.pv.transform \n\n boundary = node.boundary\n\n nodeIdx = node.index\n\n selected = node.selected\n\n\n\n msg = \"sc.py:add_node_gdml nodeIdx:%4d lvIdx:%2d soName:%30s lvName:%s \" % (nodeIdx, lvIdx, soName, lvName )\n\n #print msg\n\n\n\n if debug:\n\n solidIdx = node.lv.solid.idx\n\n self.ulv.add(lvIdx)\n\n self.uso.add(solidIdx)\n\n assert len(self.ulv) == len(self.uso)\n\n sys.stderr.write(msg+\"\\n\" + repr(transform)+\"\\n\")\n\n pass\n\n\n\n nd = self.add_node( lvIdx, lvName, pvName, soName, transform, boundary, depth, selected )\n\n\n\n ## hmm: why handle csg translation at node level, its more logical to do at mesh level ?\n\n ## Presumably done here as it is then easy to access the lv ?\n\n ##\n\n\n\n if getattr(nd.mesh,'csg',None) is None:\n\n #print msg \n\n csg = self.translate_lv( node.lv, self.maxcsgheight )\n\n nd.mesh.csg = csg \n\n self.translate_node_count += 1\n\n\n\n if csg.meta.get('skip',0) == 1:\n\n log.warning(\"tlv(%3d): csg.skip as height %2d > %d lvn %s lvidx %s \" % (self.translate_node_count, csg.height, self.maxcsgheight, node.lv.name, node.lv.idx )) \n\n pass\n\n pass\n\n\n\n\n\n if selected:\n\n #log.info(\"\\n\\nselected nd %s \\n\\n%s\\n\\n\" % (nd, str(nd.mesh.csg.txt) ))\n\n self.selected.append(nd)\n\n pass\n\n\n\n return nd\n\n\n\n\n\n @classmethod\n\n def translate_lv(cls, lv, maxcsgheight, maxcsgheight2=0 ):\n\n \"\"\"\n\n NB dont be tempted to convert to node here as CSG is a mesh level thing, not node level\n\n\n\n :param lv:\n\n :param maxcsgheight: CSG trees greater than this are balanced\n\n :param maxcsgheight2: required post-balanced height to avoid skipping \n\n\n\n There are many `solid.as_ncsg` implementations, one for each the supported GDML solids, \n\n some of them return single primitives others return boolean composites, some\n\n such as the Polycone invokes treebuilder to provide uniontree composites.\n\n\n\n \"\"\" \n\n\n\n if maxcsgheight2 == 0 and maxcsgheight != 0:\n\n maxcsgheight2 = maxcsgheight + 1\n\n pass \n\n\n\n solid = lv.solid\n\n log.debug(\"translate_lv START %-15s %s \" % (solid.__class__.__name__, lv.name ))\n\n\n\n rawcsg = solid.as_ncsg()\n\n\n\n if rawcsg is None:\n\n err = \"translate_lv solid.as_ncsg failed for solid %r lv %r \" % ( solid, lv )\n\n log.fatal(err)\n\n rawcsg = CSG.MakeUndefined(err=err,lv=lv) \n\n pass \n\n rawcsg.analyse()\n\n\n\n log.debug(\"translate_lv DONE %-15s height %3d csg:%s \" % (solid.__class__.__name__, rawcsg.height, rawcsg.name))\n\n\n\n csg = cls.optimize_csg(rawcsg, maxcsgheight, maxcsgheight2 )\n\n\n\n polyconfig = PolyConfig(lv.shortname)\n\n csg.meta.update(polyconfig.meta )\n\n\n\n # lv.solid.idx gives an incorrect (too high) soIdx ??\n\n csg.meta.update(lvname=lv.name, soname=lv.solid.name, lvIdx=lv.idx, height=csg.height) \n\n\n\n ### Nope pvname is not appropriate in the CSG, CSG is a mesh level tink not a node/volume level thing \n\n\n\n return csg \n\n\n\n\n\n @classmethod\n\n def optimize_csg(self, rawcsg, maxcsgheight, maxcsgheight2):\n\n \"\"\"\n\n :param rawcsg:\n\n :param maxcsgheight: tree balancing is for height > maxcsgheight\n\n :param maxcsgheight2: error is raised if balanced tree height reamains > maxcsgheight2 \n\n :return csg: balanced csg tree\n\n \"\"\"\n\n overheight_ = lambda csg,maxheight:csg.height > maxheight and maxheight != 0\n\n\n\n is_balance_disabled = rawcsg.is_balance_disabled() \n\n\n\n #log.info(\" %s %s \" % ( is_balance_disabled, rawcsg.name ))\n\n\n\n is_overheight = overheight_(rawcsg, maxcsgheight)\n\n if is_overheight:\n\n if is_balance_disabled:\n\n log.warning(\"tree is_overheight but marked balance_disabled leaving raw : %s \" % rawcsg.name ) \n\n return rawcsg \n\n else:\n\n log.debug(\"proceed to balance\")\n\n else:\n\n return rawcsg \n\n pass\n\n log.debug(\"optimize_csg OVERHEIGHT h:%2d maxcsgheight:%d maxcsgheight2:%d %s \" % (rawcsg.height,maxcsgheight, maxcsgheight2, rawcsg.name))\n\n\n\n rawcsg.positivize() \n\n\n\n csg = TreeBuilder.balance(rawcsg)\n\n\n\n log.debug(\"optimize_csg compressed tree from height %3d to %3d \" % (rawcsg.height, csg.height ))\n\n\n\n #assert not overheight_(csg, maxcsgheight2)\n\n if overheight_(csg, maxcsgheight2):\n\n csg.meta.update(err=\"optimize_csg.overheight csg.height %s maxcsgheight:%s maxcsgheight2:%s \" % (csg.height,maxcsgheight,maxcsgheight2) ) \n\n pass\n\n\n\n return csg \n\n\n\n\n\n\n\n def add_tree_gdml(self, target, maxdepth=0):\n\n \"\"\"\n\n :param target: treebase.Node instance, typically the root node\n\n \n\n invoked from gdml2gltf_main, notice the two different types of node:\n\n\n\n node\n\n input treebase.Node instances, derived from the GDML parse and treeification\n\n to de-stripe from PV-LV-PV-LV-.. to (PV,LV)-(PV,LV)-.. \n\n node.children is used to traverse the tree\n\n\n\n nd\n\n output sc.Nd instances, which correspond to the GLTF output \n\n\n\n \"\"\"\n\n self.add_node_count = 0 \n\n def build_r(node, depth=0):\n\n self.add_node_count += 1 \n\n if self.add_node_count % 1000 == 0:\n\n log.info(\"add_tree_gdml count %s depth %s maxdepth %s \" % (self.add_node_count,depth,maxdepth ))\n\n pass \n\n if maxdepth == 0 or depth < maxdepth:\n\n nd = self.add_node_gdml(node, depth)\n\n assert nd is not None\n\n for child in node.children: \n\n ch = build_r(child, depth+1)\n\n if ch is not None:\n\n ch.parent = nd.ndIdx\n\n nd.children.append(ch.ndIdx)\n\n pass\n\n pass\n\n else:\n\n nd = None \n\n pass\n\n return nd\n\n pass \n\n log.info(\"add_tree_gdml START maxdepth:%d maxcsgheight:%d nodesCount:%5d\" % (maxdepth, self.maxcsgheight, len(self.nodes)))\n\n #log.info(\"add_tree_gdml targetNode: %r \" % (target))\n\n tg = build_r(target)\n\n log.info(\"add_tree_gdml DONE maxdepth:%d maxcsgheight:%d nodesCount:%5d tlvCount:%d addNodeCount:%d tgNd:%r \" % \n\n (maxdepth, self.maxcsgheight, len(self.nodes),self.translate_node_count, self.add_node_count, tg))\n\n return tg\n\n\n\n def save_extras(self, gdir):\n\n gdir = expand_(gdir)\n\n self.dump_extras()\n\n extras_dir = os.path.join( gdir, \"extras\" )\n\n log.debug(\"save_extras %s \" % extras_dir )\n\n if not os.path.exists(extras_dir):\n\n os.makedirs(extras_dir)\n\n pass\n\n btxt = []\n\n count = 0 \n\n for lvIdx, mesh in self.meshes.items():\n\n soIdx = mesh.soIdx\n\n lvdir = os.path.join( extras_dir, \"%d\" % lvIdx )\n\n uri = os.path.relpath(lvdir, gdir)\n\n mesh.extras[\"uri\"] = uri\n\n mesh.csg.save(lvdir, soIdx, lvIdx)\n\n btxt.append(uri)\n\n count += 1 \n\n pass\n\n\n\n log.info(\"save_extras %s : saved %d \" % (extras_dir, count) )\n\n\n\n csgtxt_path = os.path.join(extras_dir, \"csg.txt\")\n\n log.info(\"write %d lines to %s \" % (len(btxt), csgtxt_path))\n\n file(csgtxt_path,\"w\").write(\"\\n\".join(btxt))\n\n\n\n def dump_extras(self):\n\n log.info(\"dump_extras %d \" % len(self.meshes)) \n\n for lvIdx, mesh in self.meshes.items():\n\n soIdx = mesh.soIdx\n\n log.debug( \"lv %5d so %5d \" % (lvIdx, soIdx) )\n\n pass\n\n\n\n def save(self, path, load_check=True, pretty_also=False):\n\n gdir = os.path.dirname(path)\n\n log.info(\"saving extras in %s \" % gdir )\n\n self.save_extras(gdir) # sets uri for extra external files, so must come before the json gltf save\n\n\n\n log.info(\"saving gltf into %s \" % path )\n\n gltf = self.gltf\n\n json_save_(path, gltf) \n\n\n\n if pretty_also:\n\n pretty_path = path.replace(\".gltf\",\".pretty.gltf\")\n\n log.info(\"also saving to %s \" % pretty_path )\n\n json_save_pretty_(pretty_path, gltf) \n\n pass\n\n\n\n if load_check:\n\n gltf2 = json_load_(path)\n\n pass\n\n return gltf\n\n\n\n\n\n\n\n\n\n\n\n def dump_all(self, lvns):\n\n log.info(\"dump_all lvns %d \" % len(lvns))\n\n for lvn in lvns:\n\n self.dump(lvn)\n\n pass\n\n\n\n def dump(self, lvn):\n\n mss = self.find_meshes_lv(lvn)\n\n assert len(mss) == 1\n\n ms = mss[0]\n\n\n\n tree = ms.csg \n\n #tree.analyse()\n\n\n\n tree.dump(lvn)\n\n\n\n if not tree.is_positive_form():\n\n tree.positivize()\n\n tree.dump(lvn + \" (converted to positive form)\")\n\n pass\n\n\n\n if TreeBuilder.can_balance(tree):\n\n balanced = TreeBuilder.balance(tree)\n\n balanced.dump(lvn + \" (TreeBuilder balanced form)\")\n\n else:\n\n log.warning(\"cannot balance\")\n", "file_path": "analytic/sc.py", "rank": 36, "score": 134046.96026953022 }, { "content": "SBT : RG,MS,HG program data preparation \n\n===========================================\n\n\n\nAim to minimize geometry specifics in here ...\n\n\n\n\n\n**/\n\n\n", "file_path": "CSGOptiX/SBT.h", "rank": 37, "score": 133921.32951567462 }, { "content": "CSGOptiX::setCE\n\n------------------\n\n\n\nSetting center_extent establishes the coordinate system. \n\n\n\n**/\n\n\n\nvoid CSGOptiX::setCE(const float4& v )\n\n{\n\n glm::vec4 ce(v.x, v.y, v.z, v.w); \n\n setCE(ce); \n\n}\n\nvoid CSGOptiX::setCEGS(const uint4& cegs_)\n\n{\n\n params->setCEGS(cegs_); \n\n}\n\n\n\nvoid CSGOptiX::setCE(const glm::vec4& ce )\n\n{\n\n bool aim = true ; \n", "file_path": "CSGOptiX/CSGOptiX.cc", "rank": 38, "score": 133532.45935872264 }, { "content": "\n\nint main(int argc, char** argv)\n\n{\n\n Surf* r = new Surf(\"red\", 100); \n\n Surf* g = new Surf(\"green\", 200); \n\n Surf* b = new Surf(\"blue\", 300); \n\n\n\n Turf* c = new Turf(\"cyan\", 1000); \n\n Turf* m = new Turf(\"magenta\", 2000); \n\n Turf* y = new Turf(\"yellow\", 3000); \n\n Turf* k = new Turf(\"black\", 4000); \n\n\n\n std::vector<const void*> oo = {r,g,b,c,m,y,k} ; \n\n\n\n // hmm after mixing up the types need to have external info on which is which \n\n for(unsigned i=0 ; i < 3 ; i++) std::cout << *(Surf*)oo[i] << std::endl ; \n\n for(unsigned i=3 ; i < oo.size() ; i++) std::cout << *(Turf*)oo[i] << std::endl ; \n\n\n\n Cache cache ; \n\n\n", "file_path": "sysrap/tests/map_void_int.cc", "rank": 39, "score": 125163.15891051803 }, { "content": "// name=map_void_int ; gcc $name.cc -std=c++11 -lstdc++ -o /tmp/$name && /tmp/$name \n\n\n\n#include <cassert>\n\n#include <iostream>\n\n#include <vector>\n\n\n\n#include <unordered_map>\n\n#include <cstring>\n\n\n\n/**\n\nThis tests a void* index cache for use with Geant4 objects that lack an index\n\n**/\n\n\n", "file_path": "sysrap/tests/map_void_int.cc", "rank": 40, "score": 125161.15043259152 }, { "content": " for(unsigned i=0 ; i < oo.size() ; i++)\n\n {\n\n const void* o = oo[i] ; \n\n\n\n cache.add(o, i); \n\n int idx = cache.find(o); \n\n assert( idx == int(i) ); \n\n }\n\n\n\n const void* anon = (const void*)m ; \n\n int idx_m = cache.find(anon) ; \n\n assert( idx_m == 4 ); \n\n\n\n return 0 ; \n\n}\n\n\n\n\n\n\n\n\n", "file_path": "sysrap/tests/map_void_int.cc", "rank": 41, "score": 125156.73609783014 }, { "content": " static float unsigned_as_float( unsigned u ) ;\n", "file_path": "CSG/Sys.h", "rank": 42, "score": 121252.37554211797 }, { "content": " static unsigned float_as_unsigned( float f ) ;\n", "file_path": "CSG/Sys.h", "rank": 43, "score": 121252.37554211797 }, { "content": "test_unsigned_float\n\n--------------------\n\n\n\nGoing through float corrupts unsigned beyond 0x1 << 24, 16.777216M::\n\n\n\n In [10]: np.uint32(np.float32(np.uint32(0+(0x1 << 24)))) == 0+(0x1 << 24)\n\n Out[10]: True\n\n\n\n In [11]: np.uint32(np.float32(np.uint32(1+(0x1 << 24)))) == 1+(0x1 << 24)\n\n Out[11]: False\n\n\n\n In [14]: \"{0:x} {0}\".format(0x1 << 24)\n\n Out[14]: '1000000 16777216'\n\n\n\n\n\n\n\n**/\n\n\n\nvoid test_unsigned_float()\n\n{\n", "file_path": "npy/tests/numpyTest.cc", "rank": 44, "score": 121252.37554211797 }, { "content": " static float int_as_float( int i ) ;\n", "file_path": "CSG/Sys.h", "rank": 45, "score": 121250.4313625219 }, { "content": " static int float_as_int( float f ) ;\n", "file_path": "CSG/Sys.h", "rank": 46, "score": 121250.4313625219 }, { "content": "SPack::unsigned_as_int\n\n-----------------------\n\n\n\nThe bits of unsigned integers can hold the bits of a signed int without problem \n\n(within the signed range), thus can reinterpret those bits as a signed integer \n\nusing twos-complement. Notice how the number of bits is relevant to the bit field \n\nrepresentation of negative integers in a way that is not the case for positive ones.\n\n\n\n**/\n\n\n\ntemplate <int NUM_BITS>\n\nint SPack::unsigned_as_int(unsigned value) // static\n\n{ \n\n unsigned twos_complement_sum = 0x1 << NUM_BITS ; \n\n unsigned signed_max = (0x1 << (NUM_BITS-1)) - 1 ; \n\n int ivalue = value <= signed_max ? value : value - twos_complement_sum ; \n\n return ivalue ; \n\n}\n\n\n\n\n", "file_path": "sysrap/SPack.cc", "rank": 47, "score": 121249.4593265411 }, { "content": "struct Turf \n\n{\n\n const char* name ; \n\n int index ; \n\n Turf(const char* name_, int index_) : name(strdup(name_)), index(index_) {}\n\n}; \n\n\n\n\n\ninline std::ostream& operator<<(std::ostream& os, const Surf& s){ os << \"Surf \" << s.index << \" \" << s.name ; return os; }\n\ninline std::ostream& operator<<(std::ostream& os, const Turf& s){ os << \"Turf \" << s.index << \" \" << s.name ; return os; }\n\n\n", "file_path": "sysrap/tests/map_void_int.cc", "rank": 48, "score": 121246.86700580055 }, { "content": "struct Cache\n\n{\n\n typedef std::unordered_map<const void*, int> MVI ; \n\n MVI cache ; \n\n\n\n void add(const void* obj, int index); \n\n int find(const void* obj) ; \n\n}; \n\n\n\nvoid Cache::add(const void* obj, int index)\n\n{\n\n cache[obj] = index ; \n\n}\n\nint Cache::find(const void* obj)\n\n{\n\n MVI::const_iterator e = cache.end(); \n\n MVI::const_iterator i = cache.find( obj );\n\n return i == e ? -1 : i->second ; \n\n}\n\n\n", "file_path": "sysrap/tests/map_void_int.cc", "rank": 49, "score": 121246.86700580055 }, { "content": "struct Surf \n\n{\n\n const char* name ; \n\n int index ; \n\n Surf(const char* name_, int index_) : name(strdup(name_)), index(index_) {}\n\n}; \n\n\n", "file_path": "sysrap/tests/map_void_int.cc", "rank": 50, "score": 121246.86700580055 }, { "content": "nglmext::HandleDegenerateGaze\n\n--------------------------------\n\n\n\nGaze directions parallel to the up vector yield\n\na degenerate basis. In these cases the up vector \n\nis changed to the first other axis that is not degenerate.\n\n\n\ncf OpticksCore/View::handleDegenerates\n\n\n\n**/\n\nint nglmext::HandleDegenerateGaze( glm::vec3& up, const glm::vec3& gaze, const float epsilon, const bool dump ) \n\n{\n\n glm::vec3 forward_ax = glm::normalize(gaze);\n\n float eul = glm::length(glm::cross(forward_ax, up));\n\n if(eul > epsilon) return 0 ; \n\n\n\n std::vector<glm::vec3> axes = { \n\n {1.f,0.f,0.f}, \n\n {0.f,1.f,0.f}, \n\n {0.f,0.f,1.f}, \n", "file_path": "npy/NGLMExt.cpp", "rank": 51, "score": 121243.47972573947 }, { "content": "nglmext::GetEyeUVW\n\n--------------------\n\n\n\nUsed for example from examples/UseOptiXGeometry \n\n\n\nWhen the gaze direction and the up direction coincide this \n\nyields \n\n\n\n\n\n\n\nAdapted from Composition::getEyeUVW and examples/UseGeometryShader:getMVP\n\n\n\n**/\n\n\n\nconst plog::Severity nglmext::LEVEL = PLOG::EnvLevel(\"nglmext\", \"DEBUG\"); \n\n\n\n\n\nvoid nglmext::GetEyeUVW(\n\n const glm::vec4& ce, \n\n const glm::vec3& _eye_m, \n", "file_path": "npy/NGLMExt.cpp", "rank": 52, "score": 121242.16058976742 }, { "content": " float height;\n", "file_path": "qudarap/qpoly.h", "rank": 53, "score": 119795.77561449385 }, { "content": " int height;\n", "file_path": "oglrap/gleq.h", "rank": 54, "score": 119795.77561449385 }, { "content": " int width;\n", "file_path": "oglrap/gleq.h", "rank": 55, "score": 119795.16906381608 }, { "content": " float width ; \n", "file_path": "qudarap/qpoly.h", "rank": 56, "score": 119795.16906381608 }, { "content": " float3 x0 ;\n", "file_path": "qudarap/qgs.h", "rank": 57, "score": 119794.7640271041 }, { "content": " float3 X0 ; \n", "file_path": "qudarap/qscint.h", "rank": 58, "score": 119794.7640271041 }, { "content": "SVIEW_INLINE SVIEW_HOSTDEVICE float sview::int_as<float>( int i )\n\n{\n\n UIF32 u32 ; \n\n u32.i = i ; \n\n return u32.f ; \n", "file_path": "sysrap/sview.h", "rank": 59, "score": 119793.90555600004 }, { "content": " QAT4_METHOD void left_multiply_inplace( float4& v, const float w ) const \n", "file_path": "CSG/qat4.h", "rank": 60, "score": 119778.75300002411 }, { "content": " const float* data() const ; \n", "file_path": "CSG/AABB.h", "rank": 61, "score": 119773.67632674873 }, { "content": "AABB_METHOD bool AABB::empty() const \n\n{ \n\n return mn.x == 0.f && mn.y == 0.f && mn.z == 0.f && mx.x == 0.f && mx.y == 0.f && mx.z == 0.f ; \n", "file_path": "CSG/AABB.h", "rank": 62, "score": 119770.44239656274 }, { "content": " QAT4_METHOD void copy_columns_3x4( float* dst ) const \n\n {\n\n dst[0] = q0.f.x ; \n\n dst[1] = q1.f.x ; \n\n dst[2] = q2.f.x ; \n\n dst[3] = q3.f.x ; \n\n\n\n dst[4] = q0.f.y ; \n\n dst[5] = q1.f.y ; \n\n dst[6] = q2.f.y ; \n\n dst[7] = q3.f.y ; \n\n\n\n dst[8] = q0.f.z ; \n\n dst[9] = q1.f.z ; \n\n dst[10] = q2.f.z ; \n\n dst[11] = q3.f.z ; \n", "file_path": "CSG/qat4.h", "rank": 63, "score": 119770.44239656274 }, { "content": " int h,v;\n", "file_path": "sysrap/stb_image.h", "rank": 64, "score": 119753.05568797243 }, { "content": " int w,h;\n", "file_path": "sysrap/stb_image.h", "rank": 65, "score": 119746.37432175994 }, { "content": " int x,y,w2,h2;\n", "file_path": "sysrap/stb_image.h", "rank": 66, "score": 119744.5643517274 }, { "content": "__device__ int\n", "file_path": "optixrap/cu/propagate.h", "rank": 67, "score": 117859.49035622358 }, { "content": " def new(*args):\n\n levelno = args[1].levelno\n\n args[1].msg = enum2func[levelno](args[1].msg)\n", "file_path": "ana/log.py", "rank": 68, "score": 117856.93588716286 }, { "content": "struct IntersectionState\n\n{\n\n static const char* Name( IntersectionState_t type )\n\n {\n\n const char* s = NULL ; \n\n switch(type)\n\n {\n\n case State_Enter: s = State_Enter_ ; break ; \n\n case State_Exit: s = State_Exit_ ; break ; \n\n case State_Miss: s = State_Miss_ ; break ; \n\n }\n", "file_path": "CSG/csg_classify.h", "rank": 69, "score": 117856.76620409924 }, { "content": " int height;\n", "file_path": "oglrap/old_gleq.h", "rank": 70, "score": 117854.57134249972 }, { "content": " int height;\n", "file_path": "sysrap/stb_truetype.h", "rank": 71, "score": 117854.57134249972 }, { "content": " int width,height;\n", "file_path": "sysrap/stb_truetype.h", "rank": 72, "score": 117853.96479182196 }, { "content": " int width;\n", "file_path": "oglrap/old_gleq.h", "rank": 73, "score": 117853.96479182196 }, { "content": " def Int(cls, s):\n\n \"\"\"\n\n :param s: string representation of integer eg \"1\",\"10\",\"100\",\"1k\",\"10k\",\"100k\",\"1M\",...\n\n :return i: the integer\n\n \"\"\"\n\n if s.find(\",\") > -1:\n\n ret = tuple(map(cls.Int, s.split(\",\")))\n\n else: \n\n m = cls.Ptn.match(s)\n\n if m is None:\n\n return int(s)\n\n pass\n\n d = m.groupdict() \n\n n = int(d[\"num\"]) \n\n u = cls.Units[d[\"unit\"]] \n\n i = n*u \n\n ret = i\n\n pass\n", "file_path": "ana/num.py", "rank": 74, "score": 117853.84991569273 }, { "content": " float3 x0 ;\n", "file_path": "optixrap/cu/scintillationstep.h", "rank": 75, "score": 117853.5441692675 }, { "content": " float3 x0 ;\n", "file_path": "optixrap/cu/gs.h", "rank": 76, "score": 117853.5441692675 }, { "content": " float3 x0 ;\n", "file_path": "optixrap/cu/cerenkovstep.h", "rank": 77, "score": 117853.5441692675 }, { "content": " float3 x0 ;\n", "file_path": "optixrap/cu/torchstep.h", "rank": 78, "score": 117853.5441692675 }, { "content": " float x0,y0,s0,t0; // top-left\n", "file_path": "sysrap/stb_truetype.h", "rank": 79, "score": 117853.5441692675 }, { "content": " std::stringstream ss ; \n\n ss << install_prefix\n\n << \"/ppm/\"\n\n << stem\n\n << ext\n\n ;\n\n std::string path = ss.str();\n\n return strdup(path.c_str()); \n\n}\n\n\n\nvoid SPPM_write( const char* filename, const unsigned char* image, int width, int height, int ncomp, bool yflip )\n\n{\n\n FILE * fp; \n\n fp = fopen(filename, \"wb\");\n\n\n\n fprintf(fp, \"P6\\n%d %d\\n%d\\n\", width, height, 255);\n\n\n\n unsigned size = height*width*3 ; \n\n unsigned char* data = new unsigned char[size] ; \n\n\n", "file_path": "examples/UseOptiXGeometryStandalone/UseOptiXGeometryStandalone.cc", "rank": 81, "score": 120.37960938615828 }, { "content": " fwrite(data, sizeof(unsigned char)*size, 1, fp);\n\n fclose(fp); \n\n std::cout << \"Wrote file (unsigned char*) \" << filename << std::endl ;\n\n delete[] data;\n\n}\n\n\n\n\n\n\n\nvoid SPPM_write( const char* filename, const uchar4* image, int width, int height, bool yflip )\n\n{\n\n FILE * fp; \n\n fp = fopen(filename, \"wb\");\n\n\n\n fprintf(fp, \"P6\\n%d %d\\n%d\\n\", width, height, 255);\n\n\n\n unsigned size = height*width*3 ; \n\n unsigned char* data = new unsigned char[size] ; \n\n\n\n for( int h=0; h < height ; h++ ) // flip vertically\n\n { \n", "file_path": "examples/UseOptiX7GeometryStandalone/UseOptiX7GeometryStandalone.cc", "rank": 82, "score": 101.44438340527896 }, { "content": "\n\n\n\nstatic void SPPM_write( const char* filename, const uchar4* image, int width, int height, bool yflip )\n\n{\n\n FILE * fp; \n\n fp = fopen(filename, \"wb\");\n\n\n\n fprintf(fp, \"P6\\n%d %d\\n%d\\n\", width, height, 255);\n\n\n\n unsigned size = height*width*3 ; \n\n unsigned char* data = new unsigned char[size] ; \n\n\n\n for( int h=0; h < height ; h++ ) // flip vertically\n\n { \n\n int y = yflip ? height - 1 - h : h ; \n\n\n\n for( int x=0; x < width ; ++x ) \n\n {\n\n *(data + (y*width+x)*3+0) = image[(h*width+x)].x ; \n\n *(data + (y*width+x)*3+1) = image[(h*width+x)].y ; \n", "file_path": "examples/UseOptiX7GeometryInstanced/Engine.cc", "rank": 84, "score": 97.73424872446107 }, { "content": "static void SPPM_write( const char* filename, const uchar4* image, int width, int height, bool yflip )\n\n{\n\n FILE * fp; \n\n fp = fopen(filename, \"wb\");\n\n\n\n fprintf(fp, \"P6\\n%d %d\\n%d\\n\", width, height, 255);\n\n\n\n unsigned size = height*width*3 ; \n\n unsigned char* data = new unsigned char[size] ; \n\n\n\n for( int h=0; h < height ; h++ ) // flip vertically\n\n { \n\n int y = yflip ? height - 1 - h : h ; \n\n\n\n for( int x=0; x < width ; ++x ) \n\n {\n\n *(data + (y*width+x)*3+0) = image[(h*width+x)].x ; \n\n *(data + (y*width+x)*3+1) = image[(h*width+x)].y ; \n\n *(data + (y*width+x)*3+2) = image[(h*width+x)].z ; \n\n }\n", "file_path": "examples/UseOptiX7GeometryModular/Engine.cc", "rank": 85, "score": 97.39801485764002 }, { "content": "{\n\n FILE * fp; \n\n fp = fopen(filename, \"wb\");\n\n\n\n fprintf(fp, \"P6\\n%d %d\\n%d\\n\", width, height, 255);\n\n\n\n unsigned size = height*width*3 ; \n\n unsigned char* data = new unsigned char[size] ; \n\n\n\n for( int h=0; h < height ; h++ ) // flip vertically\n\n { \n\n int y = yflip ? height - 1 - h : h ; \n\n\n\n for( int x=0; x < width ; ++x ) \n\n {\n\n *(data + (y*width+x)*3+0) = image[(h*width+x)*ncomp+0] ; \n\n *(data + (y*width+x)*3+1) = image[(h*width+x)*ncomp+1] ; \n\n *(data + (y*width+x)*3+2) = image[(h*width+x)*ncomp+2] ; \n\n }\n\n } \n", "file_path": "examples/UseOptiX7GeometryStandalone/UseOptiX7GeometryStandalone.cc", "rank": 86, "score": 95.39297521559057 }, { "content": "void Pix::saveppm(const char* filename, int width, int height, unsigned char* image) {\n\n // save into ppm\n\n FILE * fp;\n\n fp = fopen(filename, \"wb\");\n\n\n\n int ncomp = 4;\n\n fprintf(fp, \"P6\\n%d %d\\n%d\\n\", width, height, 255);\n\n\n\n unsigned char* data = new unsigned char[height*width*3] ;\n\n\n\n for( int y=height-1; y >= 0; --y ) // flip vertically\n\n {\n\n for( int x=0; x < width ; ++x )\n\n {\n\n *(data + (y*width+x)*3+0) = image[(y*width+x)*ncomp+0] ;\n\n *(data + (y*width+x)*3+1) = image[(y*width+x)*ncomp+1] ;\n\n *(data + (y*width+x)*3+2) = image[(y*width+x)*ncomp+2] ;\n\n }\n\n }\n\n fwrite(data, sizeof(unsigned char)*height*width*3, 1, fp);\n", "file_path": "examples/UseOpticksGLFWSnap/UseOpticksGLFWSnap.cc", "rank": 87, "score": 92.6714304132021 }, { "content": " } \n\n return false;\n\n}\n\n\n\n\n\n\n\n\n\nconst char* PPMPath( const char* install_prefix, const char* stem, const char* ext=\".ppm\" )\n\n{\n\n std::stringstream ss ; \n\n ss << install_prefix\n\n << \"/ppm/\"\n\n << stem\n\n << ext\n\n ;\n\n std::string path = ss.str();\n\n return strdup(path.c_str()); \n\n}\n\n\n\nvoid SPPM_write( const char* filename, const unsigned char* image, int width, int height, int ncomp, bool yflip )\n", "file_path": "examples/UseOptiX7GeometryStandalone/UseOptiX7GeometryStandalone.cc", "rank": 88, "score": 91.96084989950135 }, { "content": "\n\n float aspect = float(width)/float(height) ;\n\n float tanYfov = 1.f ; // reciprocal of camera zoom\n\n float gazelength = glm::length( gaze ) ;\n\n float v_half_height = gazelength * tanYfov ;\n\n float u_half_width = v_half_height * aspect ;\n\n\n\n U = right_ax * u_half_width ;\n\n V = top_ax * v_half_height ;\n\n W = forward_ax * gazelength ; \n\n eye = eye_ ; \n\n}\n\n\n\n\n\nconst char* PTXPath( const char* install_prefix, const char* cmake_target, const char* cu_stem, const char* cu_ext=\".cu\" )\n\n{\n\n std::stringstream ss ; \n\n ss << install_prefix\n\n << \"/ptx/\"\n\n << cmake_target\n", "file_path": "examples/UseOptiX7GeometryModular/UseOptiX7GeometryModular.cc", "rank": 89, "score": 90.89419516012616 }, { "content": " //LOG(info) << \"saving to \" << path ; \n\n std::cout << \"SPPM::save \" << path << std::endl ; \n\n\n\n FILE * fp;\n\n fp = fopen(path, \"wb\");\n\n if(!fp) LOG(fatal) << \"FAILED to open for writing \" << path ; \n\n assert(fp); \n\n\n\n int ncomp = 4;\n\n fprintf(fp, \"P6\\n%d %d\\n%d\\n\", width, height, 255);\n\n\n\n unsigned size = height*width*3 ; \n\n unsigned char* data = new unsigned char[size] ;\n\n \n\n for( int h=0 ; h < height ; h++ ) \n\n {\n\n int y = yflip ? height - 1 - h : h ; \n\n\n\n for( int x=0; x < width ; ++x )\n\n {\n", "file_path": "sysrap/SPPM.cc", "rank": 90, "score": 88.50235105648963 }, { "content": "\n\n for( int h=0; h < height ; h++ ) \n\n { \n\n int y = yflip ? height - 1 - h : h ; // flip vertically\n\n\n\n for( int x=0; x < width ; ++x ) \n\n { \n\n *(data + (y*width+x)*3+0) = image[(h*width+x)*ncomp+0] ; \n\n *(data + (y*width+x)*3+1) = image[(h*width+x)*ncomp+1] ; \n\n *(data + (y*width+x)*3+2) = image[(h*width+x)*ncomp+2] ; \n\n }\n\n } \n\n\n\n fwrite(data, sizeof(unsigned char)*size, 1, fp);\n\n fclose(fp); \n\n LOG(LEVEL) << \"Wrote file (unsigned char*) \" << filename ;\n\n delete[] data;\n\n}\n\n\n\n\n\n\n\n/**\n", "file_path": "sysrap/SPPM.cc", "rank": 91, "score": 87.54122244140106 }, { "content": " for( int h=0; h < height ; h++ ) // flip vertically\n\n { \n\n int y = yflip ? height - 1 - h : h ; \n\n\n\n for( int x=0; x < width ; ++x ) \n\n {\n\n *(data + (y*width+x)*3+0) = image[(h*width+x)*ncomp+0] ; \n\n *(data + (y*width+x)*3+1) = image[(h*width+x)*ncomp+1] ; \n\n *(data + (y*width+x)*3+2) = image[(h*width+x)*ncomp+2] ; \n\n }\n\n } \n\n fwrite(data, sizeof(unsigned char)*size, 1, fp);\n\n fclose(fp); \n\n std::cout << \"Wrote file (unsigned char*) \" << filename << std::endl ;\n\n delete[] data;\n\n}\n\n\n\n\n\n\n\n\n", "file_path": "examples/UseOptiXGeometryStandalone/UseOptiXGeometryStandalone.cc", "rank": 92, "score": 87.12375885064304 }, { "content": " glm::vec3 top_ax = glm::normalize(glm::cross(right_ax,forward_ax));\n\n\n\n float aspect = float(width)/float(height) ;\n\n float tanYfov = 1.f ; // reciprocal of camera zoom\n\n float gazelength = glm::length( gaze ) ;\n\n float v_half_height = gazelength * tanYfov ;\n\n float u_half_width = v_half_height * aspect ;\n\n\n\n U = right_ax * u_half_width ;\n\n V = top_ax * v_half_height ;\n\n W = forward_ax * gazelength ; \n\n eye = eye_ ; \n\n}\n\n\n\n\n\nconst char* PTXPath( const char* install_prefix, const char* cmake_target, const char* cu_stem, const char* cu_ext=\".cu\" )\n\n{\n\n std::stringstream ss ; \n\n ss << install_prefix\n\n << \"/ptx/\"\n", "file_path": "examples/UseOptiX7GeometryStandalone/UseOptiX7GeometryStandalone.cc", "rank": 93, "score": 87.1218773753383 }, { "content": " static void save( const char* path, int width, int height, const unsigned char* image, bool yflip ) ;\n\n\n\n static void write( const char* filename, const unsigned char* image, int width, int height, int ncomp, bool yflip) ;\n\n static void write( const char* filename, const float* image, int width, int height, int ncomp, bool yflip) ;\n\n\n\n\n\n static int read( const char* path, std::vector<unsigned char>& data, unsigned& width, unsigned& height, const unsigned ncomp, const bool yflip );\n\n static void dumpHeader( const char* path ) ; \n\n static int readHeader( const char* path, unsigned& width, unsigned& height, unsigned& mode, unsigned& bits ) ; \n\n\n\n static unsigned char* MakeTestImage(const int width, const int height, const int ncomp, const bool yflip, const char* config); \n\n static unsigned ImageCompare(const int width, const int height, const int ncomp, const unsigned char* imgdata, const unsigned char* imgdata2 ); \n\n\n\n static void AddBorder( std::vector<unsigned char>& img, const int width, const int height, const int ncomp, const bool yflip );\n\n static void AddBorder(unsigned char* imgdata, const int width, const int height, const int ncomp, const bool yflip );\n\n static void AddMidline( std::vector<unsigned char>& img, const int width, const int height, const int ncomp, const bool yflip );\n\n static void AddMidline(unsigned char* imgdata, const int width, const int height, const int ncomp, const bool yflip );\n\n static void AddQuadline( std::vector<unsigned char>& img, const int width, const int height, const int ncomp, const bool yflip );\n\n static void AddQuadline(unsigned char* imgdata, const int width, const int height, const int ncomp, const bool yflip );\n\n\n", "file_path": "sysrap/SPPM.hh", "rank": 94, "score": 86.83345913481246 }, { "content": "\n\n\n\n\n\n\n\nunsigned char* SPPM::MakeTestImage(const int width, const int height, const int ncomp, const bool yflip, const char* config)\n\n{\n\n assert( ncomp == 3 ); \n\n\n\n int size = width*height*ncomp ; \n\n unsigned char* imgdata = new unsigned char[size] ; \n\n \n\n for(int i=0 ; i < height ; i++){\n\n for(int j=0 ; j < width ; j++){\n\n\n\n unsigned idx = i*width + j ;\n\n unsigned mi = i % 32 ; \n\n unsigned mj = j % 32 ; \n\n\n\n float fi = float(i)/float(height) ; \n\n float fj = float(j)/float(width) ; \n", "file_path": "sysrap/SPPM.cc", "rank": 95, "score": 82.20369550386755 }, { "content": " glm::vec3 forward_ax = glm::normalize(gaze);\n\n glm::vec3 right_ax = glm::normalize(glm::cross(forward_ax,up)); \n\n glm::vec3 top_ax = glm::normalize(glm::cross(right_ax,forward_ax));\n\n\n\n float aspect = float(width)/float(height) ;\n\n float tanYfov = 1.f ; // reciprocal of camera zoom\n\n float gazelength = glm::length( gaze ) ;\n\n float v_half_height = gazelength * tanYfov ;\n\n float u_half_width = v_half_height * aspect ;\n\n\n\n U = right_ax * u_half_width ;\n\n V = top_ax * v_half_height ;\n\n W = forward_ax * gazelength ; \n\n eye = eye_ ; \n\n}\n\n\n\n\n\nconst char* PTXPath( const char* install_prefix, const char* cmake_target, const char* cu_stem, const char* cu_ext=\".cu\" )\n\n{\n\n std::stringstream ss ; \n", "file_path": "examples/UseOptiX7GeometryInstanced/UseOptiX7GeometryInstanced.cc", "rank": 96, "score": 81.02160882144221 }, { "content": "#include \"SPath.hh\"\n\n#include \"SStr.hh\"\n\n#include \"SPPM.hh\"\n\n#include \"OPTICKS_LOG.hh\"\n\n\n\n\n\nvoid test_MakeTestImage()\n\n{\n\n const char* path = SPath::Resolve(\"$TMP/SPPMTest_MakeTestImage.ppm\") ;\n\n const char* config = \"vertical_gradient\" ; \n\n\n\n const int width = 1024 ; \n\n const int height = 512 ; \n\n const int ncomp = 3 ; \n\n const bool yflip = true ; \n\n const int size = height*width*ncomp ; \n\n\n\n LOG(info) \n\n << \" path \" << path \n\n << \" width \" << width\n", "file_path": "sysrap/tests/SPPMTest.cc", "rank": 97, "score": 79.60542770080295 }, { "content": " OPTIX_CHECK( optixDeviceContextCreate( cuCtx, &options, &context ) );\n\n\n\n return 0 ; \n\n}\n\n\n\nEngine::Engine(const char* ptx_path_, const char* spec)\n\n :\n\n rc(preinit()),\n\n geo(new Geo(spec)),\n\n pip(strdup(ptx_path_))\n\n{\n\n}\n\n\n\n\n\nvoid Engine::setView(const glm::vec3& eye_, const glm::vec3& U_, const glm::vec3& V_, const glm::vec3& W_, float tmin_, float tmax_)\n\n{\n\n pip.setView(eye_, U_, V_, W_, tmin_, tmax_); \n\n}\n\n\n\nvoid Engine::setSize(unsigned width_, unsigned height_, unsigned depth_)\n", "file_path": "examples/UseOptiX7GeometryInstancedGASComp/Engine.cc", "rank": 98, "score": 78.55209848735797 }, { "content": " { \n\n imgdata[ (h*width+x)*ncomp + k] = k < 3 ? tmp[(y*width+x)*3+k] : 0xff ; \n\n }\n\n }\n\n } \n\n delete [] tmp ; \n\n }\n\n f.close();\n\n return 0 ; \n\n}\n\n\n\n\n\nvoid SPPM::AddBorder( std::vector<unsigned char>& img, const int width, const int height, const int ncomp, const bool yflip )\n\n{\n\n int size = width*height*ncomp ; \n\n assert( int(img.size()) == size ); \n\n unsigned char* imgdata = img.data(); \n\n AddBorder( imgdata, width, height, ncomp, yflip ); \n\n}\n\n\n", "file_path": "sysrap/SPPM.cc", "rank": 99, "score": 78.3472483423033 } ]
C++
CompareContacts/main.cpp
Sioniras/MD-Tools
df408c122dfb57100bdc976dba66b47ee03622fe
#include <iostream> #include <vector> #include <memory> #include <cstdlib> #include <algorithm> #include <sstream> #include <iomanip> #include "ContactList.h" int main(int argc,char** argv) { if(argc < 4) { std::cout << "Please specify the minimum score and at least two contacts files." << std::endl; std::cout << "compcontacts [minimum score] [file1] [file2] [optional: add more files]" << std::endl; return 0; } std::vector<std::shared_ptr<ContactList> > list; const int minscore = std::atoi(argv[1]); const int columnpadding = 8; std::cout << "Loading contact files for analysis with a minimum score of " << minscore << "." << std::endl; for(int i = 2;i < argc;i++) { std::string strargv(argv[i]); std::shared_ptr<ContactList> new_ptr(new ContactList(strargv)); if(new_ptr->IsValid()) { list.push_back(std::shared_ptr<ContactList>(new_ptr)); } else { std::cerr << "Failed to parse file \"" << strargv << "\"! Exitting program." << std::endl; std::exit(1); } } std::cout << "Finished reading the contact files." << std::endl; std::vector<Contact> FullContactList; for(auto i = list.cbegin(); i != list.cend(); i++) { std::vector<Contact> tmp(FullContactList); FullContactList.clear(); std::set_union( (*i)->List().cbegin(), (*i)->List().cend(), tmp.cbegin(), tmp.cend(), std::back_inserter(FullContactList)); } std::cout << "Found a total of " << FullContactList.size() << " unique contacts." << std::endl; std::cout << "The table contains the mean score for the trajectories containing the contact. Note that only contacts with a score of at least " << minscore << " are shown.\n" << std::endl; std::sort(FullContactList.begin(),FullContactList.end()); std::stringstream str; str << std::setw(2*columnpadding+2) << "Contacts |"; for(unsigned int i = 0;i < list.size();i++) str << " " << std::setw(columnpadding-1) << "file " << (i+1) << " |"; str << "\n" << std::string(str.str().size(),'-'); std::cout << str.str() << std::endl; std::string s[list.size()]; int cs[list.size()] = {0}; int k = 0; int k2 = 0; double m = 0.0; for(auto i = FullContactList.cbegin(); i != FullContactList.cend(); i++) { str.str(""); str << std::setw(columnpadding) << (*i).Left << " -" << std::setw(columnpadding) << (*i).Right + " |"; k = 0; k2 = 0; m = 0.0; for(auto j = list.cbegin(); j != list.cend(); j++) { auto it = std::find( (*j)->List().cbegin(), (*j)->List().cend(), (*i)); if(it != (*j)->List().cend() && (*it).Mean >= minscore) { k++; cs[k2]++; m = (m < (*it).Mean)?(*it).Mean:m; str << " " << std::setw(columnpadding) << (*it).Mean << " |"; } else { str << " " << std::setw(columnpadding) << "" << " |"; } k2++; } if(m >= minscore) s[k-1] += str.str() + "\n"; } for(unsigned int i = 0;i < list.size(); i++) std::cout << s[i]; std::cout << std::string(str.str().size(),'-') << std::endl; std::cout << std::setw(2*columnpadding+2) << "Total contacts |"; for(unsigned int i = 0;i < list.size(); i++) std::cout << " " << std::setw(columnpadding) << cs[i] << " |"; std::cout << std::endl; }
#include <iostream> #include <vector> #include <memory> #include <cstdlib> #include <algorithm> #include <sstream> #include <iomanip> #include "ContactList.h" int main(int argc,char** argv) { if(argc < 4) { std::cout << "Please specify the minimum score and at least two contacts files." << std::endl; std::cout << "compcontacts [minimum score] [file1] [file2] [optional: add more files]" << std::endl; return 0; } std::vector<std::shared_ptr<ContactList> > list; const int minscore = std::atoi(argv[1]); const int columnpadding = 8; std::cout << "Loading contact files for analysis with a minimum score of " << minscore << "." << std::endl; for(int i = 2;i < argc;i++) { std::string strargv(argv[i]); std::shared_ptr<ContactList> new_ptr(new ContactList(strargv)); if(new_ptr->IsValid()) { list.push_back(std::shared_ptr<ContactList>(new_ptr)); } else { std::cerr << "Failed to parse file \"" << strargv << "\"! Exitting program." << std::endl; std::exit(1); } } std::cout << "Finished reading the contact files." << std::endl; std::vector<Contact> FullContactList; for(auto i = list.cbegin(); i != list.cend(); i++) { std::vector<Contact> tmp(FullContactList); FullContactList.clear(); std::set_union( (*i)->List().cbegin(), (*i)->List().cend(), tmp.cbegin(), tmp.cend(), std::back_inserter(FullContactList)); } std::cout << "Found a total of " << FullContactList.size() << " unique contacts." << std::endl; std::cout << "The table contains the mean score for the trajectories containing the contact. Note that only contacts with a score of at least " << minscore << " are shown.\n" << std::endl; std::sort(FullContactList.begin(),FullContactList.end()); std::stringstream str; str << std::setw(2*columnpadding+2) << "Contacts |"; for(unsigned int i = 0;i < list.size();i++) str << " " << std::setw(columnpadding-1) << "file " << (i+1) << " |"; str << "\n" << std::string(str.str().size(),'-'); std::cout << str.str() << std::endl; std::string s[list.size()]; int cs[list.size()] = {0}; int k = 0; int k2 = 0; double m = 0.0; for(auto i = FullContactList.cbegin(); i != FullContactList.cend(); i++) { str.str(""); str << std::setw(columnpadding)
str << " " << std::setw(columnpadding) << "" << " |"; } k2++; } if(m >= minscore) s[k-1] += str.str() + "\n"; } for(unsigned int i = 0;i < list.size(); i++) std::cout << s[i]; std::cout << std::string(str.str().size(),'-') << std::endl; std::cout << std::setw(2*columnpadding+2) << "Total contacts |"; for(unsigned int i = 0;i < list.size(); i++) std::cout << " " << std::setw(columnpadding) << cs[i] << " |"; std::cout << std::endl; }
<< (*i).Left << " -" << std::setw(columnpadding) << (*i).Right + " |"; k = 0; k2 = 0; m = 0.0; for(auto j = list.cbegin(); j != list.cend(); j++) { auto it = std::find( (*j)->List().cbegin(), (*j)->List().cend(), (*i)); if(it != (*j)->List().cend() && (*it).Mean >= minscore) { k++; cs[k2]++; m = (m < (*it).Mean)?(*it).Mean:m; str << " " << std::setw(columnpadding) << (*it).Mean << " |"; } else {
random
[ { "content": "// Contact helper struct\n\nstruct Contact\n\n{\n\n\tpublic:\n\n\t\t// Data members\n\n\t\tstd::string Left;\n\n\t\tstd::string Right;\n\n\t\tstd::string Type;\n\n\t\tfloat Mean;\n\n\t\tfloat Median;\n\n\t\tfloat HBondPercentage;\n\n\t\n\n\t\t// Constructors / destructor\n\n\t\tContact() {};\n\n\t\tContact(const std::string& _l,const std::string& _r,const std::string& _t,float _mea,float _med,float _h)\n\n\t\t\t: Left(_l), Right(_r), Type(_t), Mean(_mea), Median(_med), HBondPercentage(_h) {};\n\n\t\t~Contact() {};\n\n};\n\n\n\n// Comparison operator for Contact structs\n\nbool operator==(const Contact&,const Contact&);\n\nbool operator<(const Contact&,const Contact&);\n\n\n", "file_path": "CompareContacts/ContactList.h", "rank": 0, "score": 23942.22645922368 }, { "content": "// ContactList class (list of Contact structs)\n\nclass ContactList\n\n{\t\n\n\tprivate:\n\n\t\t// Data members\n\n\t\tbool isValid;\n\n\t\tstd::string filename;\n\n\t\tstd::vector<Contact> contacts;\n\n\t\t\n\n\t\t// Private methods\n\n\t\tbool loadFile();\n\n\t\tContact createContact(const std::string&);\n\n\t\tstd::string getNext(std::string::const_iterator&,const std::string::const_iterator&,const std::string&);\n\n\t\n\n\tpublic:\n\n\t\t// Constructors / destructor\n\n\t\tContactList(const std::string&);\n\n\t\tContactList(const ContactList&);\t// Copy-constructor\n\n\t\t~ContactList();\n\n\t\t\n\n\t\t// Operators\n\n\t\tconst ContactList& operator=(const ContactList&);\t// Copy-assignment\n\n\t\t\n\n\t\t// Public members\n\n\t\tbool IsValid() const {return this->isValid;};\n\n\t\tbool GetContact(unsigned int,Contact&);\n\n\t\tconst std::vector<Contact>& List() {return contacts;}\n\n};\n\n//////////////////////////////////////////////////////////////////////////////\n", "file_path": "CompareContacts/ContactList.h", "rank": 1, "score": 21911.103042579954 }, { "content": "//////////////////////////////////////////////////////////////////////////////\n\n// ContactList class to load an output file from pycontacts.\n\n// \n\n// (c) 2017 by Claus N.\n\n//////////////////////////////////////////////////////////////////////////////\n\n#include <vector>\n\n#include <string>\n\n\n\n// Contact helper struct\n", "file_path": "CompareContacts/ContactList.h", "rank": 2, "score": 19001.807650260736 }, { "content": "//////////////////////////////////////////////////////////////////////////////\n\n// ContactList class to load an output file from pycontacts.\n\n// \n\n// (c) 2017 by Claus N.\n\n//////////////////////////////////////////////////////////////////////////////\n\n#include <iostream>\n\n#include <fstream>\n\n#include <cstdlib>\n\n#include <algorithm>\n\n#include \"ContactList.h\"\n\n//////////////////////////////////////////////////////////////////////////////\n\n// Constructor\n\nContactList::ContactList(const std::string& _filename) : isValid(false), filename(_filename)\n\n{\n\n\tthis->loadFile();\n\n}\n\n\n\n// Destructor\n\nContactList::~ContactList()\n\n{\n", "file_path": "CompareContacts/ContactList.cpp", "rank": 3, "score": 17923.976533312656 }, { "content": "\twhile(_i != _end && _delims.find(*_i) == std::string::npos)\n\n\t{\n\n\t\ttmp += (*_i);\n\n\t\t_i++;\n\n\t}\n\n\t\n\n\treturn tmp;\n\n}\n\n//////////////////////////////////////////////////////////////////////////////\n\n// Public methods\n\n//////////////////////////////////////////////////////////////////////////////\n\nbool ContactList::loadFile()\n\n{\n\n\t// Open file for reading\n\n\tstd::filebuf fb;\n\n\tif(fb.open(this->filename,std::ios::in))\n\n\t{\n\n\t\tstd::istream is(&fb);\n\n\t\tstd::string str;\n\n\t\tint i = 0;\n", "file_path": "CompareContacts/ContactList.cpp", "rank": 4, "score": 17919.5173455873 }, { "content": "\t\t\n\n\t\t// Skip first line with the headers\n\n\t\t// TODO: Read header line\n\n\t\tstd::getline(is,str);\n\n\t\t\n\n\t\t// Loop through all lines\n\n\t\twhile(std::getline(is,str))\n\n\t\t{\n\n\t\t\ti++;\n\n\t\t\tthis->contacts.push_back(this->createContact(str));\n\n\t\t}\n\n\t\t\n\n\t\t// Sort the list\n\n\t\tstd::sort(this->contacts.begin(),this->contacts.end());\n\n\t\t\n\n\t\t// When the file is read, we are done\n\n\t\tstd::cout << \"Read \" << i << \" lines from file \\\"\" << this->filename << \"\\\".\" << std::endl;\n\n\t\tthis->isValid = true;\n\n\t\t\n\n\t\tfb.close();\n", "file_path": "CompareContacts/ContactList.cpp", "rank": 5, "score": 17917.779533792982 }, { "content": "{\n\n\tauto i = _contact.cbegin();\n\n\tstd::string left(this->getNext(i,_contact.cend(),\" -\"));\n\n\tstd::string right(this->getNext(i,_contact.cend(),\" -\"));\n\n\tstd::string type(this->getNext(i,_contact.cend(),\" \"));\n\n\tstd::string mean(this->getNext(i,_contact.cend(),\" \"));\n\n\tstd::string median(this->getNext(i,_contact.cend(),\" \"));\n\n\tstd::string hbond(this->getNext(i,_contact.cend(),\" \"));\n\n\t\n\n\treturn Contact(left,right,type,std::atof(mean.c_str()),std::atof(median.c_str()),std::atof(hbond.c_str()));\n\n}\n\n\n\n// Get the next value in a string\n\nstd::string ContactList::getNext(std::string::const_iterator& _i,const std::string::const_iterator& _end,const std::string& _delims)\n\n{\n\n\t// Skip all delimiters\n\n\twhile(_i != _end && _delims.find(*_i) != std::string::npos) {_i++;}\n\n\t\n\n\t// Get the string between the delimiters\n\n\tstd::string tmp(\"\");\n", "file_path": "CompareContacts/ContactList.cpp", "rank": 6, "score": 17916.505617548875 }, { "content": "\t}\n\n\t\n\n\treturn this->isValid;\n\n}\n\n\n\nbool ContactList::GetContact(unsigned int _i,Contact& _out)\n\n{\n\n\tif(_i < this->contacts.size())\n\n\t{\n\n\t\t_out = this->contacts[_i];\n\n\t\treturn true;\n\n\t}\n\n\t\n\n\treturn false;\n\n}\n\n//////////////////////////////////////////////////////////////////////////////\n\n// Non-member non-friend functions and operators\n\n//////////////////////////////////////////////////////////////////////////////\n\nbool operator==(const Contact& _l,const Contact& _r)\n\n{\n\n\treturn ((_l.Left.compare(_r.Left) == 0) && (_l.Right.compare(_r.Right) == 0));\n\n}\n\n\n\nbool operator<(const Contact& _l,const Contact& _r)\n\n{\n\n\treturn ((_l.Left + _l.Right) < (_r.Left + _r.Right));\n\n}\n\n//////////////////////////////////////////////////////////////////////////////\n", "file_path": "CompareContacts/ContactList.cpp", "rank": 7, "score": 17915.721617713396 }, { "content": "\t\n\n}\n\n\n\n// Copy constructor defined in terms of copy-assignment operator\n\nContactList::ContactList(const ContactList& _obj)\n\n{\n\n\t(*this) = _obj;\n\n}\n\n\n\n// Copy-assignment\n\nconst ContactList& ContactList::operator=(const ContactList& _obj)\n\n{\n\n\tstd::cerr << \"Copy-assignment of ContactList objects is not implemented yet.\" << std::endl;\n\n\t\n\n\treturn (*this);\n\n}\n\n//////////////////////////////////////////////////////////////////////////////\n\n// Private methods\n\n//////////////////////////////////////////////////////////////////////////////\n\nContact ContactList::createContact(const std::string& _contact)\n", "file_path": "CompareContacts/ContactList.cpp", "rank": 8, "score": 17915.423256642727 }, { "content": "# MD-Tools\n\nTools for aiding in the analysis of molecular dynamics trajectories.\n", "file_path": "README.md", "rank": 16, "score": 3.5225513430725526 } ]
C++
Builds/JuceLibraryCode/modules/juce_core/native/juce_android_Network.cpp
eriser/CSL
6f4646369f0c90ea90e2c113374044818ab37ded
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD) \ METHOD (constructor, "<init>", "()V") \ METHOD (toString, "toString", "()Ljava/lang/String;") \ DECLARE_JNI_CLASS (StringBuffer, "java/lang/StringBuffer"); #undef JNI_CLASS_MEMBERS #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD) \ METHOD (release, "release", "()V") \ METHOD (read, "read", "([BI)I") \ METHOD (getPosition, "getPosition", "()J") \ METHOD (getTotalLength, "getTotalLength", "()J") \ METHOD (isExhausted, "isExhausted", "()Z") \ METHOD (setPosition, "setPosition", "(J)Z") \ DECLARE_JNI_CLASS (HTTPStream, JUCE_ANDROID_ACTIVITY_CLASSPATH "$HTTPStream"); #undef JNI_CLASS_MEMBERS void MACAddress::findAllAddresses (Array<MACAddress>& result) { } bool Process::openEmailWithAttachments (const String& targetEmailAddress, const String& emailSubject, const String& bodyText, const StringArray& filesToAttach) { return false; } class WebInputStream : public InputStream { public: WebInputStream (String address, bool isPost, const MemoryBlock& postData, URL::OpenStreamProgressCallback* progressCallback, void* progressCallbackContext, const String& headers, int timeOutMs, StringPairArray* responseHeaders) { if (! address.contains ("://")) address = "http://" + address; JNIEnv* env = getEnv(); jbyteArray postDataArray = 0; if (postData.getSize() > 0) { postDataArray = env->NewByteArray (postData.getSize()); env->SetByteArrayRegion (postDataArray, 0, postData.getSize(), (const jbyte*) postData.getData()); } LocalRef<jobject> responseHeaderBuffer (env->NewObject (StringBuffer, StringBuffer.constructor)); stream = GlobalRef (env->CallStaticObjectMethod (JuceAppActivity, JuceAppActivity.createHTTPStream, javaString (address).get(), (jboolean) isPost, postDataArray, javaString (headers).get(), (jint) timeOutMs, responseHeaderBuffer.get())); if (postDataArray != 0) env->DeleteLocalRef (postDataArray); if (stream != 0) { StringArray headerLines; { LocalRef<jstring> headersString ((jstring) env->CallObjectMethod (responseHeaderBuffer.get(), StringBuffer.toString)); headerLines.addLines (juceString (env, headersString)); } if (responseHeaders != 0) { for (int i = 0; i < headerLines.size(); ++i) { const String& header = headerLines[i]; const String key (header.upToFirstOccurrenceOf (": ", false, false)); const String value (header.fromFirstOccurrenceOf (": ", false, false)); const String previousValue ((*responseHeaders) [key]); responseHeaders->set (key, previousValue.isEmpty() ? value : (previousValue + "," + value)); } } } } ~WebInputStream() { if (stream != 0) stream.callVoidMethod (HTTPStream.release); } bool isExhausted() { return stream != nullptr && stream.callBooleanMethod (HTTPStream.isExhausted); } int64 getTotalLength() { return stream != nullptr ? stream.callLongMethod (HTTPStream.getTotalLength) : 0; } int64 getPosition() { return stream != nullptr ? stream.callLongMethod (HTTPStream.getPosition) : 0; } bool setPosition (int64 wantedPos) { return stream != nullptr && stream.callBooleanMethod (HTTPStream.setPosition, (jlong) wantedPos); } int read (void* buffer, int bytesToRead) { jassert (buffer != nullptr && bytesToRead >= 0); if (stream == nullptr) return 0; JNIEnv* env = getEnv(); jbyteArray javaArray = env->NewByteArray (bytesToRead); int numBytes = stream.callIntMethod (HTTPStream.read, javaArray, (jint) bytesToRead); if (numBytes > 0) env->GetByteArrayRegion (javaArray, 0, numBytes, static_cast <jbyte*> (buffer)); env->DeleteLocalRef (javaArray); return numBytes; } GlobalRef stream; private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WebInputStream); }; InputStream* URL::createNativeStream (const String& address, bool isPost, const MemoryBlock& postData, OpenStreamProgressCallback* progressCallback, void* progressCallbackContext, const String& headers, const int timeOutMs, StringPairArray* responseHeaders) { ScopedPointer <WebInputStream> wi (new WebInputStream (address, isPost, postData, progressCallback, progressCallbackContext, headers, timeOutMs, responseHeaders)); return wi->stream != 0 ? wi.release() : nullptr; }
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD) \ METHOD (constructor, "<init>", "()V") \ METHOD (toString, "toString", "()Ljava/lang/String;") \ DECLARE_JNI_CLASS (StringBuffer, "java/lang/StringBuffer"); #undef JNI_CLASS_MEMBERS #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD) \ METHOD (release, "release", "()V") \ METHOD (read, "read", "([BI)I") \ METHOD (getPosition, "getPosition", "()J") \ METHOD (getTotalLength, "getTotalLength", "()J") \ METHOD (isExhausted, "isExhausted", "()Z") \ METHOD (setPosition, "setPosition", "(J)Z") \ DECLARE_JNI_CLASS (HTTPStream, JUCE_ANDROID_ACTIVITY_CLASSPATH "$HTTPStream"); #undef JNI_CLASS_MEMBERS void MACAddress::findAllAddresses (Array<MACAddress>& result) { } bool Process::openEmailWithAttachments (const String& targetEmailAddress, const String& emailSubject, const String& bodyText, const StringArray& filesToAttach) { return false; } class WebInputStream : public InputStream { public: WebInputStream (String address, bool isPost, const MemoryBlock& postData, URL::OpenStreamProgressCallback* progressCallback, void* progressCallbackContext, const String& headers, int timeOutMs, StringPairArray* responseHeaders) { if (! address.contains ("://")) address = "http://" + address; JNIEnv* env = getEnv(); jbyteArray postDataArray = 0;
LocalRef<jobject> responseHeaderBuffer (env->NewObject (StringBuffer, StringBuffer.constructor)); stream = GlobalRef (env->CallStaticObjectMethod (JuceAppActivity, JuceAppActivity.createHTTPStream, javaString (address).get(), (jboolean) isPost, postDataArray, javaString (headers).get(), (jint) timeOutMs, responseHeaderBuffer.get())); if (postDataArray != 0) env->DeleteLocalRef (postDataArray); if (stream != 0) { StringArray headerLines; { LocalRef<jstring> headersString ((jstring) env->CallObjectMethod (responseHeaderBuffer.get(), StringBuffer.toString)); headerLines.addLines (juceString (env, headersString)); } if (responseHeaders != 0) { for (int i = 0; i < headerLines.size(); ++i) { const String& header = headerLines[i]; const String key (header.upToFirstOccurrenceOf (": ", false, false)); const String value (header.fromFirstOccurrenceOf (": ", false, false)); const String previousValue ((*responseHeaders) [key]); responseHeaders->set (key, previousValue.isEmpty() ? value : (previousValue + "," + value)); } } } } ~WebInputStream() { if (stream != 0) stream.callVoidMethod (HTTPStream.release); } bool isExhausted() { return stream != nullptr && stream.callBooleanMethod (HTTPStream.isExhausted); } int64 getTotalLength() { return stream != nullptr ? stream.callLongMethod (HTTPStream.getTotalLength) : 0; } int64 getPosition() { return stream != nullptr ? stream.callLongMethod (HTTPStream.getPosition) : 0; } bool setPosition (int64 wantedPos) { return stream != nullptr && stream.callBooleanMethod (HTTPStream.setPosition, (jlong) wantedPos); } int read (void* buffer, int bytesToRead) { jassert (buffer != nullptr && bytesToRead >= 0); if (stream == nullptr) return 0; JNIEnv* env = getEnv(); jbyteArray javaArray = env->NewByteArray (bytesToRead); int numBytes = stream.callIntMethod (HTTPStream.read, javaArray, (jint) bytesToRead); if (numBytes > 0) env->GetByteArrayRegion (javaArray, 0, numBytes, static_cast <jbyte*> (buffer)); env->DeleteLocalRef (javaArray); return numBytes; } GlobalRef stream; private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WebInputStream); }; InputStream* URL::createNativeStream (const String& address, bool isPost, const MemoryBlock& postData, OpenStreamProgressCallback* progressCallback, void* progressCallbackContext, const String& headers, const int timeOutMs, StringPairArray* responseHeaders) { ScopedPointer <WebInputStream> wi (new WebInputStream (address, isPost, postData, progressCallback, progressCallbackContext, headers, timeOutMs, responseHeaders)); return wi->stream != 0 ? wi.release() : nullptr; }
if (postData.getSize() > 0) { postDataArray = env->NewByteArray (postData.getSize()); env->SetByteArrayRegion (postDataArray, 0, postData.getSize(), (const jbyte*) postData.getData()); }
if_condition
[ { "content": "class KarplusString : public UnitGenerator, public Scalable, public Phased {\n\n\n\npublic:\n\n\tKarplusString();\n\n\tKarplusString(float frequency);\n\n\tvoid setFrequency(float frequency);\n\n\tvoid trigger();\t\t\t\t\t///< reset internal buffers to re-pluck the string.\n\n\tvoid dump();\t\t\t\t\t///< print debugging info.\n\n\t\t\n\n\tvoid nextBuffer(Buffer &outputBuffer, unsigned outBufNum) throw (CException);\n\n\tvirtual bool isActive() { return (mEnergy > 0); };\n\n\n\n\tBuffer mDelayLine; \t\t\t\t///< the delay line (just a buffer, not a RingBuffer)\n\n\n\nprotected:\t\n\n\tvoid initDelayLine();\t\t\t///< function to initialize the delay line\n\n\tunsigned mIndex;\t\t\t\t///< current index in the delay line\n\n\tunsigned mDelayLength;\t\t\t///< allocated size of the delay line\n\n\tunsigned mEnergy;\t\t\t\t///< energy left in buffer\n\n\tfloat mFrequency;\n\n\t\n\n};\t\t// end of class\n\n\n\n}\t\t// end of namespace\n\n\n\n#endif\n\n\n", "file_path": "CSL/Sources/KarplusString.h", "rank": 0, "score": 272387.613651361 }, { "content": "class JSoundFile : public Abst_SoundFile {\n\npublic:\n\n\tJSoundFile(string path, int start = -1, int stop = -1);\n\n\tJSoundFile(JSoundFile & otherSndFile);\t\t\t///< Copy constructor -- shares sample buffer\n\n\t~JSoundFile();\n\n\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t/// Factory methods\n\n\tstatic JSoundFile * openSndfile(string path, int start = -1, int stop = -1, bool doRead = true);\n\n//\tstatic JSoundFile * openSndfile(float maxDurInSecs, string path);\n\n\n\n\tunsigned duration() const;\t\t\t\t\t\t///< number of frames in the sound file\n\n\tSoundFileFormat format();\t\t\t\t\t\t///< get format\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t/// open file and get stats\n\n\tvoid openForRead(bool load = true) throw (CException);\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t/// Open a file for write. Default values are some common format.\n\n\tvoid openForWrite(SoundFileFormat format = kSoundFileFormatAIFF, \n\n\t\t\t\t\tunsigned channels = 1, \n\n\t\t\t\t\tunsigned rate = 44100,\n\n\t\t\t\t\tunsigned bitDepth = 16) throw (CException);\n\n\tvoid openForReadWrite() throw (CException);\t\t///< open r/w\n", "file_path": "CSL/IO/SoundFileJ.h", "rank": 1, "score": 253941.40201565795 }, { "content": "class CSLComponent : public Component,\n\n public AudioIODeviceCallback,\n\n public ButtonListener,\n\n public SliderListener\n\n{\n\npublic:\n\n //==============================================================================\n\n CSLComponent ();\n\n ~CSLComponent();\n\n\n\n //==============================================================================\n\n //[UserMethods] -- You can add your own custom methods in this section.\n\n\n\n\tvoid audioDeviceIOCallback (const float** inputChannelData,\n\n\t\t\t\t\t\t\tint totalNumInputChannels,\n\n\t\t\t\t\t\t\tfloat** outputChannelData,\n\n\t\t\t\t\t\t\tint totalNumOutputChannels,\n\n\t\t\t\t\t\t\tint numSamples);\n\n\tvoid audioDeviceAboutToStart (AudioIODevice* device);\n\n\tvoid audioDeviceStopped();\n", "file_path": "Applications/Granulator/JGranulator.h", "rank": 2, "score": 251556.6326807275 }, { "content": "//==============================================================================\n\nclass TableListBox::Header : public TableHeaderComponent\n\n{\n\npublic:\n\n Header (TableListBox& tlb) : owner (tlb) {}\n\n\n\n void addMenuItems (PopupMenu& menu, int columnIdClicked)\n\n {\n\n if (owner.isAutoSizeMenuOptionShown())\n\n {\n\n menu.addItem (autoSizeColumnId, TRANS(\"Auto-size this column\"), columnIdClicked != 0);\n\n menu.addItem (autoSizeAllId, TRANS(\"Auto-size all columns\"), owner.getHeader().getNumColumns (true) > 0);\n\n menu.addSeparator();\n\n }\n\n\n\n TableHeaderComponent::addMenuItems (menu, columnIdClicked);\n\n }\n\n\n\n void reactToMenuItem (int menuReturnId, int columnIdClicked)\n\n {\n\n switch (menuReturnId)\n", "file_path": "Builds/JuceLibraryCode/modules/juce_gui_basics/widgets/juce_TableListBox.cpp", "rank": 3, "score": 248884.9401057589 }, { "content": "class VAdditiveInstrument : public Instrument {\n\npublic:\n\n\tVAdditiveInstrument();\t\t\t///< Constructor\n\n\tVAdditiveInstrument(SumOfSines & sos1, SumOfSines & sos2);\n\n\tVAdditiveInstrument(VAdditiveInstrument&);\t\t///< copy constructor\n\n\t~VAdditiveInstrument();\n\n\t\t\t\t\t\t\t\t/// Plug functions\n\n\tvoid setParameter(unsigned selector, int argc, void **argv, const char *types);\n\n\t\t\t\t\t\t\t\t/// Play functions\n\n\tvoid playOSC(int argc, void **argv, const char *types);\t\n\n\t\n\n\tvoid playNote(float dur = 1, float ampl = 1, \n\n\t\t\t\tfloat c_fr = 110, float pos = 0,\n\n\t\t\t\tfloat att = 0.05, float dec = 0.05, float sus = 0.5, float rel = 0.5);\n\n\tvoid playMIDI(float dur, int chan, int key, int vel);\t\n\n\n\n\tADSR mAEnv;\t\t\t\t\t///< amplitude envelope\n\n\tAR mXEnv;\t\t\t\t\t///< cross-fade envelope, AR with init delay\n\n \tSumOfSines mSOS1, mSOS2;\t///< 2 sum-of-sine oscillators\n\n\tPanner mPanner;\t\t\t\t///< stereo panner\n\n};\n\n\n\n}\n\n\n\n#endif\n", "file_path": "CSL/Instruments/AdditiveInstrument.h", "rank": 4, "score": 248363.84051870983 }, { "content": "class CSLComponent : public Component,\n\n public AudioIODeviceCallback,\n\n public SliderListener,\n\n public ButtonListener\n\n{\n\npublic:\n\n //==============================================================================\n\n CSLComponent ();\n\n ~CSLComponent();\n\n\n\n //==============================================================================\n\n //[UserMethods] -- You can add your own custom methods in this section.\n\n\n\n\tvoid audioDeviceIOCallback (const float** inputChannelData,\n\n\t\t\t\t\t\t\tint totalNumInputChannels,\n\n\t\t\t\t\t\t\tfloat** outputChannelData,\n\n\t\t\t\t\t\t\tint totalNumOutputChannels,\n\n\t\t\t\t\t\t\tint numSamples);\n\n\tvoid audioDeviceAboutToStart (double sampleRate, int numSamplesPerBlock);\n\n\tvoid audioDeviceStopped();\n", "file_path": "Applications/Old/Player/JPlayer.h", "rank": 5, "score": 248329.7207405867 }, { "content": "class SndfileTableComponent : public Component,\n\n public TableListBoxModel\n\n{\n\npublic:\n\n TableListBox* table; // the table component itself\n\n int numRows; // The number of rows of data we've got\n\n\n\nSndfileTableComponent () {\n\n addAndMakeVisible (table = new TableListBox (T(\"demo table\"), this));\n\n table->setColour (ListBox::outlineColourId, Colours::grey);\n\n table->setOutlineThickness (1);\n\n\t\ttable->getHeader()->addColumn(T(\"File name\"), 1, 100);\n\n\t\ttable->getHeader()->addColumn(T(\"S Rate\"), 2, 100);\n\n\t\ttable->getHeader()->addColumn(T(\"n Chans\"), 3, 100);\n\n\t\ttable->getHeader()->addColumn(T(\"Dur\"), 4, 100);\n\n\t\t\t\t\t\t\t\t\t\t \n\n table->getHeader()->setSortColumnId (1, true);\n\n\n\n}\n\n\n", "file_path": "Applications/Old/Player/JPlayer.h", "rank": 6, "score": 245208.4177703148 }, { "content": "class StringTests : public UnitTest\n\n{\n\npublic:\n\n StringTests() : UnitTest (\"String class\") {}\n\n\n\n template <class CharPointerType>\n\n struct TestUTFConversion\n\n {\n\n static void test (UnitTest& test)\n\n {\n\n String s (createRandomWideCharString());\n\n\n\n typename CharPointerType::CharType buffer [300];\n\n\n\n memset (buffer, 0xff, sizeof (buffer));\n\n CharPointerType (buffer).writeAll (s.toUTF32());\n\n test.expectEquals (String (CharPointerType (buffer)), s);\n\n\n\n memset (buffer, 0xff, sizeof (buffer));\n\n CharPointerType (buffer).writeAll (s.toUTF16());\n", "file_path": "Builds/JuceLibraryCode/modules/juce_core/text/juce_String.cpp", "rank": 7, "score": 243794.3982659313 }, { "content": "class JUCE_API TableHeaderComponent : public Component,\n\n private AsyncUpdater\n\n{\n\npublic:\n\n //==============================================================================\n\n /** Creates an empty table header.\n\n */\n\n TableHeaderComponent();\n\n\n\n /** Destructor. */\n\n ~TableHeaderComponent();\n\n\n\n //==============================================================================\n\n /** A combination of these flags are passed into the addColumn() method to specify\n\n the properties of a column.\n\n */\n\n enum ColumnPropertyFlags\n\n {\n\n visible = 1, /**< If this is set, the column will be shown; if not, it will be hidden until the user enables it with the pop-up menu. */\n\n resizable = 2, /**< If this is set, the column can be resized by dragging it. */\n", "file_path": "Builds/JuceLibraryCode/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.h", "rank": 8, "score": 227546.36897137327 }, { "content": "//==============================================================================\n\nclass WebInputStream : public InputStream\n\n{\n\npublic:\n\n WebInputStream (const String& address_, bool isPost_, const MemoryBlock& postData_,\n\n URL::OpenStreamProgressCallback* progressCallback, void* progressCallbackContext,\n\n const String& headers_, int timeOutMs_, StringPairArray* responseHeaders)\n\n : connection (0), request (0),\n\n address (address_), headers (headers_), postData (postData_), position (0),\n\n finished (false), isPost (isPost_), timeOutMs (timeOutMs_)\n\n {\n\n createConnection (progressCallback, progressCallbackContext);\n\n\n\n if (responseHeaders != nullptr && ! isError())\n\n {\n\n DWORD bufferSizeBytes = 4096;\n\n\n\n for (;;)\n\n {\n\n HeapBlock<char> buffer ((size_t) bufferSizeBytes);\n\n\n", "file_path": "Builds/JuceLibraryCode/modules/juce_core/native/juce_win32_Network.cpp", "rank": 10, "score": 226464.45131440568 }, { "content": "//==============================================================================\n\nclass WebInputStream : public InputStream\n\n{\n\npublic:\n\n WebInputStream (const String& address_, bool isPost_, const MemoryBlock& postData_,\n\n URL::OpenStreamProgressCallback* progressCallback, void* progressCallbackContext,\n\n const String& headers_, int timeOutMs_, StringPairArray* responseHeaders)\n\n : socketHandle (-1), levelsOfRedirection (0),\n\n address (address_), headers (headers_), postData (postData_), position (0),\n\n finished (false), isPost (isPost_), timeOutMs (timeOutMs_)\n\n {\n\n createConnection (progressCallback, progressCallbackContext);\n\n\n\n if (responseHeaders != nullptr && ! isError())\n\n {\n\n for (int i = 0; i < headerLines.size(); ++i)\n\n {\n\n const String& headersEntry = headerLines[i];\n\n const String key (headersEntry.upToFirstOccurrenceOf (\": \", false, false));\n\n const String value (headersEntry.fromFirstOccurrenceOf (\": \", false, false));\n\n const String previousValue ((*responseHeaders) [key]);\n", "file_path": "Builds/JuceLibraryCode/modules/juce_core/native/juce_linux_Network.cpp", "rank": 11, "score": 226464.45131440568 }, { "content": "class TableHeaderComponent::DragOverlayComp : public Component\n\n{\n\npublic:\n\n DragOverlayComp (const Image& image_)\n\n : image (image_)\n\n {\n\n image.duplicateIfShared();\n\n image.multiplyAllAlphas (0.8f);\n\n setAlwaysOnTop (true);\n\n }\n\n\n\n void paint (Graphics& g)\n\n {\n\n g.drawImageAt (image, 0, 0);\n\n }\n\n\n\nprivate:\n\n Image image;\n\n\n\n JUCE_DECLARE_NON_COPYABLE (DragOverlayComp);\n", "file_path": "Builds/JuceLibraryCode/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.cpp", "rank": 12, "score": 223357.93168924886 }, { "content": "//==============================================================================\n\nclass var::VariantType_Bool : public var::VariantType\n\n{\n\npublic:\n\n VariantType_Bool() noexcept {}\n\n static const VariantType_Bool instance;\n\n\n\n int toInt (const ValueUnion& data) const noexcept { return data.boolValue ? 1 : 0; };\n\n int64 toInt64 (const ValueUnion& data) const noexcept { return data.boolValue ? 1 : 0; };\n\n double toDouble (const ValueUnion& data) const noexcept { return data.boolValue ? 1.0 : 0.0; }\n\n String toString (const ValueUnion& data) const { return String::charToString (data.boolValue ? (juce_wchar) '1' : (juce_wchar) '0'); }\n\n bool toBool (const ValueUnion& data) const noexcept { return data.boolValue; }\n\n bool isBool() const noexcept { return true; }\n\n\n\n bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept\n\n {\n\n return otherType.toBool (otherData) == data.boolValue;\n\n }\n\n\n\n void writeToStream (const ValueUnion& data, OutputStream& output) const\n\n {\n\n output.writeCompressedInt (1);\n\n output.writeByte (data.boolValue ? (char) varMarker_BoolTrue : (char) varMarker_BoolFalse);\n\n }\n\n};\n\n\n", "file_path": "Builds/JuceLibraryCode/modules/juce_core/containers/juce_Variant.cpp", "rank": 13, "score": 208214.5170704415 }, { "content": "//==============================================================================\n\nclass var::VariantType_Void : public var::VariantType\n\n{\n\npublic:\n\n VariantType_Void() noexcept {}\n\n static const VariantType_Void instance;\n\n\n\n bool isVoid() const noexcept { return true; }\n\n bool equals (const ValueUnion&, const ValueUnion&, const VariantType& otherType) const noexcept { return otherType.isVoid(); }\n\n void writeToStream (const ValueUnion&, OutputStream& output) const { output.writeCompressedInt (0); }\n\n};\n\n\n", "file_path": "Builds/JuceLibraryCode/modules/juce_core/containers/juce_Variant.cpp", "rank": 14, "score": 208207.6508806652 }, { "content": "//==============================================================================\n\nclass var::VariantType_Method : public var::VariantType\n\n{\n\npublic:\n\n VariantType_Method() noexcept {}\n\n static const VariantType_Method instance;\n\n\n\n String toString (const ValueUnion&) const { return \"Method\"; }\n\n bool toBool (const ValueUnion& data) const noexcept { return data.methodValue != 0; }\n\n bool isMethod() const noexcept { return true; }\n\n\n\n bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept\n\n {\n\n return otherType.isMethod() && otherData.methodValue == data.methodValue;\n\n }\n\n\n\n void writeToStream (const ValueUnion&, OutputStream& output) const\n\n {\n\n jassertfalse; // Can't write a method to a stream!\n\n output.writeCompressedInt (0);\n\n }\n", "file_path": "Builds/JuceLibraryCode/modules/juce_core/containers/juce_Variant.cpp", "rank": 15, "score": 208205.8128115441 }, { "content": "//==============================================================================\n\nclass var::VariantType_Int : public var::VariantType\n\n{\n\npublic:\n\n VariantType_Int() noexcept {}\n\n static const VariantType_Int instance;\n\n\n\n int toInt (const ValueUnion& data) const noexcept { return data.intValue; };\n\n int64 toInt64 (const ValueUnion& data) const noexcept { return (int64) data.intValue; };\n\n double toDouble (const ValueUnion& data) const noexcept { return (double) data.intValue; }\n\n String toString (const ValueUnion& data) const { return String (data.intValue); }\n\n bool toBool (const ValueUnion& data) const noexcept { return data.intValue != 0; }\n\n bool isInt() const noexcept { return true; }\n\n\n\n bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept\n\n {\n\n return otherType.toInt (otherData) == data.intValue;\n\n }\n\n\n\n void writeToStream (const ValueUnion& data, OutputStream& output) const\n\n {\n\n output.writeCompressedInt (5);\n\n output.writeByte (varMarker_Int);\n\n output.writeInt (data.intValue);\n\n }\n\n};\n\n\n", "file_path": "Builds/JuceLibraryCode/modules/juce_core/containers/juce_Variant.cpp", "rank": 16, "score": 208201.08461654867 }, { "content": "//==============================================================================\n\nclass var::VariantType_String : public var::VariantType\n\n{\n\npublic:\n\n VariantType_String() noexcept {}\n\n static const VariantType_String instance;\n\n\n\n void cleanUp (ValueUnion& data) const noexcept { getString (data)-> ~String(); }\n\n void createCopy (ValueUnion& dest, const ValueUnion& source) const { new (dest.stringValue) String (*getString (source)); }\n\n\n\n bool isString() const noexcept { return true; }\n\n int toInt (const ValueUnion& data) const noexcept { return getString (data)->getIntValue(); };\n\n int64 toInt64 (const ValueUnion& data) const noexcept { return getString (data)->getLargeIntValue(); };\n\n double toDouble (const ValueUnion& data) const noexcept { return getString (data)->getDoubleValue(); }\n\n String toString (const ValueUnion& data) const { return *getString (data); }\n\n bool toBool (const ValueUnion& data) const noexcept { return getString (data)->getIntValue() != 0\n\n || getString (data)->trim().equalsIgnoreCase (\"true\")\n\n || getString (data)->trim().equalsIgnoreCase (\"yes\"); }\n\n\n\n bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept\n\n {\n", "file_path": "Builds/JuceLibraryCode/modules/juce_core/containers/juce_Variant.cpp", "rank": 17, "score": 208122.4952839939 }, { "content": "class JUCE_API Result\n\n{\n\npublic:\n\n //==============================================================================\n\n /** Creates and returns a 'successful' result. */\n\n static Result ok() noexcept;\n\n\n\n /** Creates a 'failure' result.\n\n If you pass a blank error message in here, a default \"Unknown Error\" message\n\n will be used instead.\n\n */\n\n static Result fail (const String& errorMessage) noexcept;\n\n\n\n //==============================================================================\n\n /** Returns true if this result indicates a success. */\n\n bool wasOk() const noexcept;\n\n\n\n /** Returns true if this result indicates a failure.\n\n You can use getErrorMessage() to retrieve the error message associated\n\n with the failure.\n", "file_path": "Builds/JuceLibraryCode/modules/juce_core/misc/juce_Result.h", "rank": 18, "score": 201788.77585350044 }, { "content": "class JUCE_API String\n\n{\n\npublic:\n\n //==============================================================================\n\n /** Creates an empty string.\n\n @see empty\n\n */\n\n String() noexcept;\n\n\n\n /** Creates a copy of another string. */\n\n String (const String& other) noexcept;\n\n\n\n #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS\n\n String (String&& other) noexcept;\n\n #endif\n\n\n\n /** Creates a string from a zero-terminated ascii text string.\n\n\n\n The string passed-in must not contain any characters with a value above 127, because\n\n these can't be converted to unicode without knowing the original encoding that was\n", "file_path": "Builds/JuceLibraryCode/modules/juce_core/text/juce_String.h", "rank": 19, "score": 201667.79701559513 }, { "content": "class Filter : public Effect, public Scalable, public FrequencyAmount {\n\n\t\n\npublic:\n\n\tFilter();\n\n\tFilter(unsigned num_b, unsigned num_a = 1);\n\n\tFilter(UnitGenerator & in, unsigned num_b = 1, unsigned num_a = 1);\n\n\tFilter(UnitGenerator & in, SampleBuffer bCoeffs, SampleBuffer aCoeffs, unsigned num_b, unsigned num_a);\n\n\t~Filter();\n\n\n\n\tvoid clear(void);\t\t\t\t\t\t\t\t///< clears the input/output buffers\n\n\tvirtual void setupCoeffs() { };\t\t\t\t\t///< to be overloaded by subclasses\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t/// supply the coefficients directly\n\n\tvoid setupCoeffs(SampleBuffer bCoeffs, SampleBuffer aCoeffs, unsigned num_b, unsigned num_a );\n\n\t\n\n\tvirtual void nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);\n\n\t\n\n\tvoid dump();\t\t\t\t\t\t\t\t\t///< log information about myself\n\n\t\n\nprotected:\n\n\tvoid init(unsigned a, unsigned b);\t\t\t\t///< shared initialization function\n", "file_path": "CSL/Processors/Filters.h", "rank": 20, "score": 200861.7682769438 }, { "content": "class Oscillator : public UnitGenerator, public Phased, public Scalable {\n\npublic:\t\t\t\t\t\t\t\t/// Constructor: parameters are optional.\n\n\tOscillator(float frequency = 220.0, float ampl = 1.0, float offset = 0.0, float phase = 0.0);\n\n\tOscillator(UnitGenerator & frequency, float ampl = 1.0, float offset = 0.0, float phase = 0.0);\n\n\tOscillator(UnitGenerator & frequency, UnitGenerator & ampl, float offset = 0.0, float phase = 0.0);\n\n\tvirtual ~Oscillator();\t\t\t\t///< Destructor\n\n\t\n\n\tvoid dump();\t\t\t\t\t\t///< print the receiver for debugging\n\n};\n\n\n\n///\n\n/// Enumeration for interpolation policies\n\n///\n\n\n\n#ifdef CSL_ENUMS\n\ntypedef enum {\n\n\tkTruncate,\n\n\tkLinear,\n\n\tkCubic,\n\n\tkAllPass\n", "file_path": "CSL/Sources/Oscillator.h", "rank": 21, "score": 200861.7682769438 }, { "content": "class Freeverb : public Effect, public Scalable {\n\n\n\npublic:\n\n\tFreeverb(UnitGenerator &input);\n\n\t~Freeverb();\n\n\n\n\tfloat roomSize();\n\n\tvoid setRoomSize(float size);\t///< Setting the room size makes longer tails. The value has a range from 0 to 1.\n\n\tfloat dampening();\t\n\n\tvoid setDampening(float damp);\t///< Specified in percentage (from 0 to 100%).\n\n\tfloat wetLevel();\n\n\tvoid setWetLevel(float level);\t///< Amount of wet (reverberation) in the mixed output.\n\n\tfloat dryLevel();\n\n\tvoid setDryLevel(float level);\t///< Amount of the original \"dry\" signal in the output.\n\n\tfloat width();\n\n\tvoid setWidth(float width);\t\t///< Currently not used, as this reverb became mono in/out.\n\n\t\n\n\tvoid nextBuffer(Buffer &outputBuffer, unsigned outBufNum) throw (CException);\n\n\n\nprotected:\t\t\t// accessable parameters\n", "file_path": "CSL/Processors/Freeverb.h", "rank": 22, "score": 200830.54554208627 }, { "content": "class Panner : public Effect, public Scalable {\n\npublic:\n\n\t\t\t\t\t\t/// Constructors / destructor\n\n\tPanner();\t\t\t\t\t\t\t\t\t\t\t\t///< empty constructor\n\n\tPanner(UnitGenerator &input);\t\t\t\t\t\t\t///< given an input stream\n\n\tPanner(UnitGenerator &input, UnitGenerator &position);\t///< given input and position stream\n\n\tPanner(UnitGenerator &input, float position);\t\t\t///< given an input and an amplitude const\n\n\tPanner(UnitGenerator &input, UnitGenerator &position, UnitGenerator &amplitude);///< given an amplitude stream\n\n\tPanner(UnitGenerator &input, UnitGenerator &position, float amplitude);\t\t\t///< given an amplitude value\n\n\tPanner(UnitGenerator &input, float position, float amplitude);\t\t\t\t\t///< given an amplitude value and pan value\n\n\t~Panner();\n\n\t\t\t\t\t\t/// Operations\n\n\tvoid setPosition(UnitGenerator &pan);\t\t\t\t\t\t///< set the position to a UGen\n\n\tvoid setPosition(float pan);\t\t\t\t\t\t\t\t///< set the position to a float\n\n\n\n\tvirtual unsigned numChannels() const { return 2; };\t\t\t///< I'm stereo!\n\n\n\n\tvirtual void nextBuffer(Buffer &outputBuffer) throw (CException);\n\n};\n\n\n\n///\n\n/// N-channel (max 2 at present) input to M-channel output azimuth panner\n\n///\n\n\n\n#define MAX_OUTPUTS 16\n\n\n", "file_path": "CSL/Processors/Mixer.h", "rank": 23, "score": 200830.54554208627 }, { "content": "//==============================================================================\n\nclass PopupMenu::HeaderItemComponent : public PopupMenu::CustomComponent\n\n{\n\npublic:\n\n HeaderItemComponent (const String& name)\n\n : PopupMenu::CustomComponent (false)\n\n {\n\n setName (name);\n\n }\n\n\n\n void paint (Graphics& g)\n\n {\n\n g.setFont (getLookAndFeel().getPopupMenuFont().boldened());\n\n g.setColour (findColour (PopupMenu::headerTextColourId));\n\n\n\n g.drawFittedText (getName(),\n\n 12, 0, getWidth() - 16, proportionOfHeight (0.8f),\n\n Justification::bottomLeft, 1);\n\n }\n\n\n\n void getIdealSize (int& idealWidth, int& idealHeight)\n", "file_path": "Builds/JuceLibraryCode/modules/juce_gui_basics/menus/juce_PopupMenu.cpp", "rank": 24, "score": 199358.8391271657 }, { "content": "class RingBuffer : public Effect, public Scalable, public Writeable {\n\n\n\npublic:\n\n\tfriend class RingBufferTap;\t///< Allow the RingBufferTap to access private members of this class.\n\n\n\n\tRingBuffer();\t\t\t\t///< Constructors\n\n\tRingBuffer(unsigned int nmChannels, unsigned int nmFrames);\n\n\tRingBuffer(UnitGenerator & input, unsigned int nmChannels, unsigned int nmFrames);\n\n\n\n\tunsigned mCurrentWriteFrame; ///< state -- users can manipulate my internal tap and buffer\n\n\tBuffer mBuffer;\n\n\tRingBufferTap mTap;\t\t\t///< internal tap so a RingBuffer can also be a a UnitGenerator\n\n\n\n\tunsigned seekTo(int position) throw(CException);\n\n\t\n\n\t/// These loop setters allow for variable buffer lengths by varying the points where the buffer\n\n\t/// writes. \n\n\tvoid setLoopStart(unsigned frame) { mTap.setLoopStart(frame); };\t///< Calls the setLoopStart of it's tap.\n\n\tvoid setLoopEnd(unsigned frame) { mTap.setLoopEnd(frame); };\t\t///< Calls the setLoopEnd of it's tap.\n\n\n", "file_path": "CSL/Utilities/RingBuffer.h", "rank": 25, "score": 199302.45462593623 }, { "content": "class Mixer : public UnitGenerator, public Scalable {\n\npublic:\n\n\tMixer();\t\t\t\t\t///< Constructors\n\n\tMixer(unsigned chans);\n\n\tMixer(UnitGenerator & mScale);\n\n\tMixer(unsigned chans, UnitGenerator & mScale);\n\n\tvirtual ~Mixer();\n\n\t\t\t\t\t// Accessing\n\n\tUGenVector * getInputs(void) { return(&mSources); };\t///< list of inputs, arbitrary # of channels\n\n\tunsigned getNumInputs(void);\t\t\t\t///< number of active inputs\n\n\t\t\t\t\t/// add/remove inputs\n\n\tvoid addInput(UnitGenerator & inp);\n\n\tvoid addInput(UnitGenerator * inp);\n\n\tvoid addInput(UnitGenerator & inp, float ampl);\n\n\tvoid addInput(UnitGenerator * inp, float ampl);\n\n\tvoid removeInput(UnitGenerator & inp);\n\n\tvoid removeInput(UnitGenerator * inp);\n\n\tvoid deleteInputs();\n\n\t\t\t\t\t/// set the scale of an input\n\n\tvoid scaleInput(UnitGenerator & inp, float val);\t\n", "file_path": "CSL/Processors/Mixer.h", "rank": 26, "score": 198964.99251942433 }, { "content": "class Envelope : public UnitGenerator, public Scalable {\n\npublic:\n\n\tEnvelope() : UnitGenerator(), Scalable(1, 0), mDuration(0), mSegments(0), mValues(0) { };\n\n\tEnvelope(LineMode mode, float t, float x1, float y1, float x2 = 0, float y2 = 1.0, float x3 = 0, float y3 = 1.0,\n\n\t\t\t\tfloat x4 = 0, float y4 = 1.0, float x5 = 0, float y5 = 1.0, float x6 = 0, float y6 = 1.0);\n\n\tEnvelope(LineMode mode, float t, unsigned int size, float x[], float y[]);\n\n\tEnvelope(float t, float x1, float y1, float x2 = 0, float y2 = 1.0, float x3 = 0, float y3 = 1.0,\n\n\t\t\t\tfloat x4 = 0, float y4 = 1.0, float x5 = 0, float y5 = 1.0, float x6 = 0, float y6 = 1.0);\n\n\tEnvelope(float t, unsigned int size, float x[], float y[]);\n\n\n\n\tvirtual ~Envelope();\n\n\t\t\t\t\t\t\t\t\t\t/// This answers whether I'm active (ptr < end)\n\n\tvirtual bool isActive();\n\n\n\n\tvoid addBreakpoint(float startTime, float value);\n\n\t\n\n\tvoid setMode(LineMode mode);\n\n//\tvoid setInterpolationAtSegment(LineMode mode, unsigned idx); ///< allows to specify interpolation other than linear for a segment.\n\n\tvirtual void setDuration(float d);\t///< set/scale durations\n\n\tvirtual void scaleTimes(float s);\t///< scale durations\n", "file_path": "CSL/Sources/Envelope.h", "rank": 27, "score": 198964.99251942433 }, { "content": "class Noise : public UnitGenerator, public Scalable {\n\n\n\npublic:\n\n\tinline int generateRandomNumber();\t\t\t\t\t///< returns the next pseudo-random number\n\n\tinline float generateNormalizedRandomNumber();\t\t///< returns next pseudo-random normalised to +/- 1.0\n\n\n\n\tvoid setSeed(int seed) { mSeed = seed; }\t\t\t///< set the seed integer for the pseudo-random number generators\n\n\n\n\tvoid dump();\t\t\t\t\t\t\t\t\t\t///< Tell me more about what is happening\n\n\n\n\tNoise();\t\t\t\t\t\t\t\t\t\t\t///< Constructors\n\n\tNoise(double ampl, double offset = 0.0);\t\t\n\n\tNoise(int seed, double ampl = 1.0, double offset = 0.0);\n\n\t~Noise() { };\t\t\t\t\t\t\t\t\t\t///< Destructor\n\n\t\n\nprotected:\n\n\tint mSeed;\t\t\t\t\t\t\t\t\t\t\t///< seed integer for the pseudo-random number generators\n\n\tfloat mDivisor;\t\t\t\t\t\t\t\t\t\t///< factor to scale ints to +/- 1.0\n\n};\n\n\n\n///\n\n/// White noise -- equal power per frequency\n\n///\n\n\n", "file_path": "CSL/Sources/Noise.h", "rank": 28, "score": 198964.99251942433 }, { "content": " class Const\n\n {\n\n public:\n\n typedef const void VoidType;\n\n static inline void* toVoidPtr (VoidType* v) noexcept { return const_cast <void*> (v); }\n\n enum { isConst = 1 };\n\n };\n\n #endif\n\n\n\n //==============================================================================\n\n /**\n\n A pointer to a block of audio data with a particular encoding.\n\n\n\n This object can be used to read and write from blocks of encoded audio samples. To create one, you specify\n\n the audio format as a series of template parameters, e.g.\n\n @code\n\n // this creates a pointer for reading from a const array of 16-bit little-endian packed samples.\n\n AudioData::Pointer <AudioData::Int16,\n\n AudioData::LittleEndian,\n\n AudioData::NonInterleaved,\n", "file_path": "Builds/JuceLibraryCode/modules/juce_audio_basics/buffers/juce_AudioDataConverters.h", "rank": 29, "score": 198863.23670952255 }, { "content": " //==============================================================================\n\n class Header;\n", "file_path": "Builds/JuceLibraryCode/modules/juce_gui_basics/widgets/juce_TableListBox.h", "rank": 30, "score": 198830.98565725016 }, { "content": "class JUCE_API StringArray\n\n{\n\npublic:\n\n //==============================================================================\n\n /** Creates an empty string array */\n\n StringArray() noexcept;\n\n\n\n /** Creates a copy of another string array */\n\n StringArray (const StringArray& other);\n\n\n\n #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS\n\n StringArray (StringArray&& other) noexcept;\n\n #endif\n\n\n\n /** Creates an array containing a single string. */\n\n explicit StringArray (const String& firstValue);\n\n\n\n /** Creates a copy of an array of string literals.\n\n @param strings an array of strings to add. Null pointers in the array will be\n\n treated as empty strings\n", "file_path": "Builds/JuceLibraryCode/modules/juce_core/text/juce_StringArray.h", "rank": 31, "score": 198444.90974266222 }, { "content": "class BufferStream : public UnitGenerator, public Seekable, public Writeable {\n\npublic:\n\n\tBufferStream(Buffer &buffer) : UnitGenerator(), Seekable(), Writeable(), mBuffer(&buffer), \n\n\t\t\t\t\tmCurrentWriteFrame(0), mTempCurrentFrame(0), mTempCurrentWriteFrame(0) { };\n\n\n\n\tvoid nextBuffer(Buffer &outputBuffer) throw(CException); ///< Read a buffer from the buffer stream\n\n\tvoid writeBuffer(Buffer &inputBuffer) throw(CException); ///< Write a buffer of data into the ring buffer\n\n\tvoid nextBuffer(Buffer &outputBuffer, unsigned outBufNum) throw(CException);\n\n\tvoid writeBuffer(Buffer &inputBuffer, unsigned bufNum) throw(CException);\n\n\tvoid setBuffer(Buffer &buffer) { mBuffer = &buffer; }\n\n\tunsigned seekTo(int position, SeekPosition whence) throw(CException);\n\n\tunsigned duration() const;\n\n\n\nprotected:\n\n\tBuffer *mBuffer;\n\n\tunsigned mCurrentWriteFrame;\n\n\tunsigned mTempCurrentFrame; \t\t///< a little hack necessary to track info\n\n\tunsigned mTempCurrentWriteFrame;\t///< a little hack necessary to track info\n\n};\n\n\n\n}\n\n\n\n#endif\n\n\n", "file_path": "CSL/Utilities/RingBuffer.h", "rank": 32, "score": 197781.77560707487 }, { "content": "class SineAsScaled : public UnitGenerator, public Phased, public Scalable {\n\n\n\npublic:\n\n\tSineAsScaled();\t\t\t///< Constructors\n\n\tSineAsScaled(float frequency);\n\n\tSineAsScaled(float frequency, float phase);\n\n\tSineAsScaled(float frequency, float phase, float ampl, float offset);\n\n\t~SineAsScaled();\t\t\t///< Destructor\n\n\t\n\n\t\t\t\t\t\t\t\t/// the monoNextBuffer method is where the DSP takes place\n\n\tvoid nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);\n\n\tvoid dump();\t\t\t\t///< pretty-print the receiver\n\n};\n\n\n\n}\n\n\n\n#endif\n", "file_path": "CSL/Sources/SimpleSines.h", "rank": 33, "score": 197781.77560707487 }, { "content": "class Spatializer : public UnitGenerator, public Observer {\n\npublic:\n\n\tSpatializer(PannerType panMode = kAutomatic, SpeakerLayout *speakerLayout = SpeakerLayout::defaultSpeakerLayout());\n\n\t~Spatializer();\n\n\n\n\tvoid addSource(SpatialSource &s);\t\t///< Add a sound souce to the list of inputs to be processed.\n\n\tvoid removeSource(SpatialSource &s);\t///< Remove a Sound Source. \n\n\n\n\tunsigned numSources() { return mPanner->numSources(); }; \t///< number of active inputs.\n\n\n\n\tvoid setPanningMode(PannerType panType);\n\n\n\n\tvirtual void update(void *arg);\t///< called when the speaker layout changes, so panners update precalculated data.\n\n\n\n\tvirtual void nextBuffer(Buffer &outputBuffer /*, unsigned outBufNum */) throw (CException); ///< fill the buffer with data :-)\n\n\n\nprivate:\n\n\tSpatialPanner *mPanner;\n\n\t\t\t\t\t\t\t\t\t/// a map between a source passed/key and a the corresponding distance \n\n\t\t\t\t\t\t\t\t\t/// simulator (used for removing sources)\n\n\tmap <SpatialSource *, DistanceSimulator *> mInputsHashMap;\n\n\t\t\t\t\t\t\t\t\t/// If null, it will use the default layout by calling \n\n\t\t\t\t\t\t\t\t\t/// SpeakerLayout::defaultSpeakerLayout();\n\n\tSpeakerLayout *mSpeakerLayout; \n\n\tPannerType mType;\n\n};\n\n\n\n\n", "file_path": "CSL/Spatializers/SpatialAudio.h", "rank": 34, "score": 197150.44749976957 }, { "content": "class DynamicVariable : public CVariable, public Effect {\n\n\n\nprotected:\n\n\tVOperator mMode;\t\t///< the operation I perform '+', '*', etc.\n\n\t\n\npublic:\t\t\t\t/// Constructors\n\n\tDynamicVariable(UnitGenerator & vox, float val) : CVariable(val), Effect(vox), mMode(kOpTimes) { };\n\n\tDynamicVariable(UnitGenerator & vox, double val) : CVariable((float) val), Effect(vox), mMode(kOpTimes) { };\n\n\tDynamicVariable(float val, UnitGenerator & vox) : CVariable(val), Effect(vox), mMode(kOpTimes) { };\n\n\tDynamicVariable(float val, UnitGenerator & vox, VOperator m) : CVariable(val), Effect(vox), mMode(m) { };\n\n\tDynamicVariable(UnitGenerator & vox, float val, VOperator m) : CVariable(val), Effect(vox), mMode(m) { };\n\n\n\n\tDynamicVariable(int val, UnitGenerator & vox) : CVariable((float) val), Effect(vox), mMode(kOpTimes) { };\n\n\tDynamicVariable(UnitGenerator & vox, int val) : CVariable((float) val), Effect(vox), mMode(kOpTimes) { };\n\n\tDynamicVariable(int val, UnitGenerator & vox, VOperator m) : CVariable((float) val), Effect(vox), mMode(m) { };\n\n\tDynamicVariable(UnitGenerator & vox, int val, VOperator m) : CVariable((float) val), Effect(vox), mMode(m) { };\n\n\n\n\t\t\t\t\t/// my main operations\n\n//\tvoid nextBuffer(Buffer & outputBuffer) throw (CException);\n\n\tvoid nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);\n", "file_path": "CSL/Utilities/Variable.h", "rank": 35, "score": 197150.44749976957 }, { "content": "class VSTIO : public IO, public AudioEffectX {\n\npublic:\t\t\t\t\n\n\tVSTIO ();\t\t\t\t\t\t///< Constructor\n\n\tVSTIO (audioMasterCallback audioMaster, \n\n\t\t\t\t\tunsigned s_rate = 44100, unsigned b_size = 512, \n\n\t\t\t\t\tunsigned in_chans = 2, unsigned out_chans = 2);\n\n\tvirtual ~VSTIO();\n\n\n\n\tvoid open() throw(CException);\t\t\t///< open/close start/stop methods\n\n\tvoid close() throw(CException);\n\n\tvoid start() throw(CException);\t\t\t///< start my timer thread\n\n\tvoid stop() throw(CException);\t\t\t///< stop the timer thread\n\n\n\n\t\t\t\t\t// Processing\n\n\tvirtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames);\n\n\tvirtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames) { };\n\n\n\n\t\t\t\t\t// Program\n\n\tvirtual void setProgramName (char* name);\n\n\tvirtual void getProgramName (char* name);\n", "file_path": "CSL/IO/VSTIO.h", "rank": 36, "score": 197150.44749976957 }, { "content": "class LPCFilter : public Effect, public Scalable {\n\npublic:\n\n\tLPCFilter(UnitGenerator & in, char * lpcFile);\n\n\tLPCFilter(UnitGenerator & in, Buffer & lpcData, unsigned size, unsigned hopSize, unsigned order);\n\n\t~LPCFilter();\n\n\n\n\tunsigned windowSize() { return mWindowSize; }\n\n\tunsigned hopSize() { return mHopSize; }\n\n\tunsigned LPCOrder() { return mLPCOrder; }\n\n\tdouble deEmphasis() { return mDeEmphasis; }\n\n\t\n\n\tEnvelope * timeEnvelope() { return mTimeEnvelope; }\n\n\tvoid setTimeEnvelope(Envelope * env) { mTimeEnvelope = env; }\n\n\t\n\n\tvoid nextBuffer(Buffer& outputBuffer, unsigned outBufNum) throw (CException);\t///< read some input and apply a filter to it\n\n\n\nprotected:\t\n\n\tunsigned mWindowSize;\t\t\t///< input window size\n\n\tunsigned mHopSize;\t\t\t\t///< input hop size\n\n\tunsigned mLPCOrder;\t\t\t\t///< LPC order\n", "file_path": "CSL/Processors/OLD/LPC.h", "rank": 37, "score": 197150.44749976957 }, { "content": "class MIDIIn : public MIDIIO, public MidiInputCallback {\n\npublic:\n\n\tMIDIIn();\t\n\n\t\n\n\tunsigned bufferSize();\n\n\tvoid setBufferSize(unsigned bufferSize );\n\n\tvirtual void open(int deviceID);\t///< open a device\n\n\tbool poll();\t\t\t\t\t\t///< poll returns a bool (really quickly)\n\n\tvoid nextEvent();\t\t\t\t\t///< step to next event or reset flag\n\n\tvoid dumpMessage();\t\t\t\t\t///< print current msg\n\n\tvirtual void start();\t\t\t\t///< start MIDI stream\n\n\tvirtual void stop();\t\t\t\t///< stop MIDI stream\n\n\tint evaluate(void * arg);\t\t\t///< evaluate answers the message command\n\n\n\n\t\t\t\t\t\t\t\t\t\t/// implement inherited MidiInputCallback\n\n\tvoid handleIncomingMidiMessage(MidiInput * source, const MidiMessage & message);\n\n\t\n\n\tMidiInput * mDevice;\t\t\t///< my device ptr\n\n\tdouble mStartTime;\t\t\t\t\t///< the time I was started\n\n};\n\n\n\n\n\n///\n\n///\tMIDIOut class write msgs out to a device (or file)\n\n///\n\n\n", "file_path": "CSL/IO/MIDIIOJ.h", "rank": 38, "score": 197150.44749976957 }, { "content": "class RingBufferTap: public UnitGenerator, public Scalable, public Seekable {\n\n\n\npublic:\n\n\tfriend class RingBuffer;\t\t\t\t///< Allow RingBuffer to access private members of RingBufferTap\n\n\n\n\t\t\t\t\t\t\t\t\t\t\t/// Create a tap on a ring buffer, optionally offset relative \n\n\t\t\t\t\t\t\t\t\t\t\t/// to the current write position.\n\n\tRingBufferTap(RingBuffer *parent = 0, int offset = 0);\t\n\n\n\n\tunsigned mLoopStartFrame;\t\t\t\t///< Number of frames from the beginning to start a loop at\n\n\tunsigned mLoopEndFrame;\t\t\t\t\t///< Number of frames away from buffer end.\n\n\n\n\tvoid setOffset(int offset);\n\n\tunsigned duration();\n\n\tunsigned seekTo(int position, SeekPosition whence) throw(CException);\n\n\tvoid setLoopStart(unsigned frame) { mLoopStartFrame = frame; }\n\n\tvoid setLoopEnd(unsigned frame) { mLoopEndFrame = frame; }\n\n\tvoid setBuffer(RingBuffer *parent) { mParentBuffer = parent; }\n\n\t\n\n\tvoid nextBuffer(Buffer &outputBuffer) throw(CException);\t\t\t///< nextBuffer method\n", "file_path": "CSL/Utilities/RingBuffer.h", "rank": 39, "score": 196298.1590415503 }, { "content": "class Abst_SoundFile : public WavetableOscillator, public Writeable, public Seekable {\n\npublic:\t\t\t\t\t\t\t\t\t/// Constructor. Values not passed default to null.\n\n\tAbst_SoundFile(string path, int start = -1, int stop = -1);\n\n\tAbst_SoundFile(Abst_SoundFile & otherSndFile);\t///< Copy constructor -- shares sample buffer\n\n\t~Abst_SoundFile();\n\n\t\n\n\n\n\tstatic bool isSndfileName(const char * path);\t\t\t///< Answer whether the given name looks like a snd file\n\n\tstatic SoundFileFormat sndfileNameType(const char * path);\t///< Answer the snd file type\n\n\tstatic const char * mimeType(const char * path);\t\t\t\t///< Answer the MIME type based on the file name\n\n\n\n\t///< open file and get stats; read it if \"load\"\n\n\tvirtual void openForRead(bool load = true) throw (CException) = 0;\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t/// Open a file for writing. \n\n\t\t\t\t\t\t\t\t\t\t\t\t\t/// Default values are some common format.\n\n\tvirtual void openForWrite(SoundFileFormat format = kSoundFileFormatAIFF, \n\n\t\t\t\t\tunsigned channels = 1, \n\n\t\t\t\t\tunsigned rate = 44100,\n\n\t\t\t\t\tunsigned bitDepth = 16) throw (CException) = 0;\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t/// seek to some position relative to \"whence\"\n", "file_path": "CSL/IO/SoundFile.h", "rank": 40, "score": 196298.1590415503 }, { "content": "class InOut : public Effect {\n\npublic:\n\n\t\t\t\t\t\t/// Constructor with IO, number of channels in & out, and processing\n\n\tInOut(IO * anIO, unsigned inChans, unsigned outChans, InOutFlags f = kNoProc);\n\n\tInOut(IO * anIO, unsigned inChans, unsigned outChans, InOutFlags f, ...);\n\n\tInOut(UnitGenerator & myInput, unsigned inChans, unsigned outChans, InOutFlags f = kNoProc);\n\n\tInOut(UnitGenerator & myInput, unsigned inChans, unsigned outChans, InOutFlags, ...);\n\n\t~InOut();\n\n\n\n\tvoid setInChan(unsigned chan) { mInChans = chan; };\t\t\t///< set # in/out chans\n\n\tvoid setOutChan(unsigned chan) { mOutChans = chan; };\n\n\tunsigned getInChan(void) { return mInChans; };\t\t\t\t\t///< get # in/out chans\n\n\tunsigned getOutChan(void) { return mOutChans; };\t\n\n\n\n\tvoid setChanMap(unsigned * chans);\t\t\t\t///< set channel map\n\n\tvoid setChanGains(float * values);\t\t\t\t///< set gain array\n\n\tvoid setGain(unsigned index, float value);\t\t///< set gain value at index\n\n\n\n\tvirtual void nextBuffer(Buffer & outputBuffer) throw (CException);\n\n\n", "file_path": "CSL/Processors/InOut.h", "rank": 41, "score": 196069.14047661648 }, { "content": "class JUCEIO : public IO, public AudioIODeviceCallback {\n\npublic:\t\t\t\t\n\n\t\t\t\t\t\t\t\t\t\t\t///< Constructor (stereo by default)\n\n\tJUCEIO(unsigned s_rate = CSL_mFrameRate, unsigned b_size = CSL_mBlockSize, \n\n\t\t\tint in_device = 0, int out_device = 0, \n\n\t\t\tunsigned in_chans = 0, unsigned out_chans = 2);\n\n\tvirtual ~JUCEIO();\n\n\n\n\tvoid open() throw(CException);\t\t\t///< open/close start/stop methods\n\n\tvoid close() throw(CException);\n\n\tvoid start() throw(CException);\t\t\t///< start my timer thread\n\n\tvoid stop() throw(CException);\t\t\t///< stop the timer thread\n\n\n\n\t\t\t\t\t\t\t\t\t\t\t///< Audio playback callback & utilities\n\n\tvoid audioDeviceIOCallback (const float** inputChannelData, int totalNumInputChannels,\n\n\t\t\t\t\t\t\t\t\t float** outputChannelData, int totalNumOutputChannels,\n\n\t\t\t\t\t\t\t\t\t int numSamples);\n\n\t\t\t\t\t\t\t\t\t\t\t/// JUCE methods\n\n\tvoid audioDeviceAboutToStart (AudioIODevice*) { };\n\n\tvoid audioDeviceStopped() { };\n\n\n\nprotected:\n\n AudioDeviceManager audioDeviceManager;\t///< JUCE AudioDeviceManager\n\n\n\n};\n\n\n\n}\t// end of namespace\n\n\n\n#endif CSL_JACKIO_H\n", "file_path": "CSL/IO/JUCEIO.h", "rank": 42, "score": 195384.74136878402 }, { "content": "class SpatialPanner : public UnitGenerator, public Observer {\n\npublic:\n\n\t\t\t\t\t\t\t\t\t\t/// Constructor - a SpeakerLayout can be specified\n\n\tSpatialPanner(SpeakerLayout *layout = SpeakerLayout::defaultSpeakerLayout());\n\n\tvirtual ~SpatialPanner();\n\n\n\n\t\t\t\t\t\t\t\t\t\t/// Set the speaker layout to be used by this panner.\n\n\t\t\t\t\t\t\t\t\t\t/// The panner will request the default layout if not set.\n\n\tvoid setSpeakerLayout(SpeakerLayout *aLayout);\n\n\n\n\tunsigned numSources() { return mSources.size(); }; \t///< number of active inputs.\n\n\t\n\n\tvirtual void addSource(SpatialSource &s);\t\t\t///< Add a souce to the list of inputs to be\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// processed and create a cache object\n\n\n\n\tvirtual void removeSource(SpatialSource &s);\t\t///< Remove a Sound Source. \n\n\n\n\tvirtual void update(void *arg);\t\t///< Called when the speaker layout changes\n\n\n\n\tvirtual void nextBuffer(Buffer & outputBuffer) throw (CException) = 0;\n", "file_path": "CSL/Spatializers/SpatialPanner.h", "rank": 43, "score": 195384.74136878402 }, { "content": "class VSTInst : public IO, public AudioEffectX {\n\npublic:\t\t\t\t\n\n\tVSTInst ();\t\t\t\t\t\t///< Constructor\n\n\tVSTInst (audioMasterCallback audioMaster, Instrument * theInstrument, \n\n\t\t\t\t\tunsigned s_rate = 44100, unsigned b_size = 512, \n\n\t\t\t\t\tunsigned in_chans = 0, unsigned out_chans = 2);\n\n\tvirtual ~VSTInst();\n\n\t\n\n\tvoid open() throw(CException);\t\t\t///< open/close start/stop methods\n\n\tvoid close() throw(CException);\n\n\tvoid start() throw(CException);\t\t\t///< start my timer thread\n\n\tvoid stop() throw(CException);\t\t\t///< stop the timer thread\n\n\n\n\t\t\t\t\t// Processing\n\n\tvirtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames);\n\n\tvirtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames) { };\n\n\n\n\t\t\t\t\t// Program\n\n\tvirtual void setProgramName (char* name);\n\n\tvirtual void getProgramName (char* name);\n", "file_path": "CSL/IO/VSTIO.h", "rank": 44, "score": 195384.74136878402 }, { "content": "class NullIO : public IO, public ThreadPthread {\n\npublic:\t\t\t\t\n\n\tNullIO();\t\t\t\t\t\t///< Constructor\n\n\tNullIO(unsigned s_rate, unsigned b_size, \n\n\t\tint in_device = 0, int out_device = 0, \n\n\t\tunsigned in_chans = 0, unsigned out_chans = 2);\n\n\tvirtual ~NullIO();\n\n\t\n\n\tvirtual void start() throw(CException);\t\t\t///< start my timer thread\n\n\tvirtual void stop() throw(CException);\t\t\t///< stop the timer thread\n\n\tvirtual Buffer & getInput() throw(CException) { return mInputBuffer; };\n\n\tvirtual Buffer & getInput(unsigned numFrames, unsigned numChannels) throw(CException) { return mInputBuffer; };\n\n\n\nprotected:\n\n\tbool mRunning;\t\t\t\t\t\t\t\t/// whether or not I'm running\n\n\tjuce::Thread * mThread;\t\t\t\t\t\t\t\t///< my timer thread\n\n\tSynch * mSynch;\t\t\t\t\t\t\t\t///< the sync I wait on\n\n\tstatic void * FeederFunction(void * arg);\t\t///< shared init function\n\n//\tBuffer mEmptyBuffer;\n\n};\n\n\n\n\n\n///\n\n/// StdIO reads/write the UNIX Standard IO pipes \n\n///\n\n\n", "file_path": "CSL/IO/NullIO.h", "rank": 45, "score": 195384.74136878402 }, { "content": "class StaticVariable : public CVariable, public UnitGenerator {\n\n\n\npublic:\t\t\t\t\t\t/// Constructors\n\n\tStaticVariable(float x) : CVariable(x), UnitGenerator() { }; \n\n\tStaticVariable(int x) : CVariable((float) x), UnitGenerator() { }; \n\n\tStaticVariable(double x) : CVariable((float) x), UnitGenerator() { }; \n\n\t\n\n\t\t\t\t\t\t\t/// this what being a static variable means!\n\n\tbool isFixed() { return true; };\n\n\t\t\t\t\t\t\t/// versions of nextBuffer\n\n\tvoid nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);\n\n\t\n\n\tfloat value() { return(CVariable::value()); };\n\n\tvoid setValue(float x) { CVariable::setValue(x); };\n\n\tvoid setValue(int x) { CVariable::setValue(x); };\n\n\tvoid setValue(double x) { CVariable::setValue(x); };\n\n};\n\n\n\n// An enumeration for the possible arithmetic operations\n\n\n", "file_path": "CSL/Utilities/Variable.h", "rank": 46, "score": 195384.74136878402 }, { "content": "class CompOrCacheOscillator : public WavetableOscillator, public Cacheable {\n\npublic:\n\n\tCompOrCacheOscillator(bool whether = false, float frequency = 220, float phase = 0.0);\n\n\tvoid createCache();\n\n\n\nprotected:\n\n\tvirtual void nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);\n\n\tvirtual void nextWaveInto(SampleBuffer dest, unsigned count, bool oneHz) = 0;\n\n};\n\n\n\n///\n\n/// Sine -- oscillator class (this computes the sine fcn on the fly)\n\n///\n\n\n", "file_path": "CSL/Sources/Oscillator.h", "rank": 47, "score": 195384.74136878402 }, { "content": "class SineAsPhased : public UnitGenerator, public Phased {\n\n\n\npublic:\n\n\tSineAsPhased();\t\t\t///< Constructors\n\n\tSineAsPhased(float frequency);\n\n\tSineAsPhased(float frequency, float phase);\n\n\t~SineAsPhased();\t\t\t///< Destructor\n\n\t\n\n\t\t\t\t\t\t\t\t/// the monoNextBuffer method is where the DSP takes place\n\n\tvoid nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);\n\n\tvoid dump();\t\t\t\t///< pretty-print the receiver\n\n};\n\n\n\n///\n\n/// SineAsScaled -- A sine oscillator that also has scale and offset as dynamic controls (from Scalable)\n\n/// (Note the tripple inheritance)\n\n///\n\n\n", "file_path": "CSL/Sources/SimpleSines.h", "rank": 48, "score": 195384.74136878402 }, { "content": "class RandomVariable : public CVariable, public UnitGenerator {\n\n\t\n\nprivate:\t\t\t\t// Newran stuff\n\n\tconst static bool copySeedFromDisk = false;\t///< set to true to get seed from disk file\n\n\tMotherOfAll urng;\t\t\t\t\t\t\t///< declare uniform random number generator\n\n\t\t\t\t\t\t// Local stuff\n\n\tRandom * mVar;\t\t\t\t///< my random generator \n\n\tDistribution mDist;\t\t\t///< my probability distribution type\n\n\tfloat mMean;\t\t\t\t///< my statistical mean \n\n\tfloat mVariance;\t\t\t///< my statistical variance \n\n\t\n\npublic:\t\t\t\t\t/// Constructors\n\n\tRandomVariable(Distribution d, float mean, float variance, float v1, float v2);\n\n\t~RandomVariable();\n\n\t\t\t\t\t\t/// my main operations\n\n\tvoid nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);\n\n};\n\n\n\n#endif // USE_RANDOMS\n\n\n\n}\n\n\n\n#endif\n", "file_path": "CSL/Utilities/Variable.h", "rank": 49, "score": 195384.74136878402 }, { "content": "class JUCE_API StringPairArray\n\n{\n\npublic:\n\n //==============================================================================\n\n /** Creates an empty array */\n\n StringPairArray (bool ignoreCaseWhenComparingKeys = true);\n\n\n\n /** Creates a copy of another array */\n\n StringPairArray (const StringPairArray& other);\n\n\n\n /** Destructor. */\n\n ~StringPairArray();\n\n\n\n /** Copies the contents of another string array into this one */\n\n StringPairArray& operator= (const StringPairArray& other);\n\n\n\n //==============================================================================\n\n /** Compares two arrays.\n\n Comparisons are case-sensitive.\n\n @returns true only if the other array contains exactly the same strings with the same keys\n", "file_path": "Builds/JuceLibraryCode/modules/juce_core/text/juce_StringPairArray.h", "rank": 50, "score": 195381.0358736707 }, { "content": "#if JUCE_MODAL_LOOPS_PERMITTED\n\nclass ModalComponentManager::ReturnValueRetriever : public ModalComponentManager::Callback\n\n{\n\npublic:\n\n ReturnValueRetriever (int& value_, bool& finished_) : value (value_), finished (finished_) {}\n\n\n\n void modalStateFinished (int returnValue)\n\n {\n\n finished = true;\n\n value = returnValue;\n\n }\n\n\n\nprivate:\n\n int& value;\n\n bool& finished;\n\n\n\n JUCE_DECLARE_NON_COPYABLE (ReturnValueRetriever);\n\n};\n\n\n\nint ModalComponentManager::runEventLoopForCurrentComponent()\n\n{\n", "file_path": "Builds/JuceLibraryCode/modules/juce_gui_basics/components/juce_ModalComponentManager.cpp", "rank": 51, "score": 195319.0733365645 }, { "content": "// The delay line takes its input and write a delayed output\n\nclass DelayLine : public UnitGenerator, public Effect {\n\npublic:\n\n\tDelayLine(unsigned maxDelayInSamples);\n\n\n\n\tfloat delayTime();\n\n\tunsigned delayLength();\n\n\t\n\n\tfloat setDelayTime(float delayInMiliseconds);\t\n\n\tunsigned setDelayLength(unsigned delayInSamples);\n\n//\tvoid setInterpolationKind();\n\n\t\n\n\tvoid nextBuffer(Buffer &output) throw(CException);\n\n\n\nprotected:\n\n\tRingBuffer mRingBuffer;\n\n\tunsigned mMaxDelayInSamples;\n\n\tunsigned mTotalDelayInSamples;\n\n\n\n};\n\n\n", "file_path": "CSL/Spatializers/VBAP/DelayLine.h", "rank": 52, "score": 193665.8310833459 }, { "content": "class DLine : public FrameStream, public Processor {\n\n\n\nprivate:\t\n\n\tBuffer ring_buffer;\n\n\n\n\tfloat max_delay_time;\n\n\tfloat delay_time;\n\n\tfloat target_delay_time;\n\n\tunsigned max_delay_in_frames;\n\n\tInterpType interp_type;\n\n\tunsigned start_frame;\n\n//\tunsigned end_frame;\n\n\tunsigned write_frame;\n\n\n\npublic:\n\n\tDLine( FrameStream &input, float max_delay );\n\n\t~DLine();\n\n\n\n\tbool set_target_delay_time( float tdt );\n\n\tbool init_delay_time( float dt );\n", "file_path": "CSL/Spatializers/VBAP/DLine.h", "rank": 53, "score": 193665.8310833459 }, { "content": "class RtpSender : public Effect, public CslRtpSession {\n\n\n\npublic:\t\t\t\t\t\t// These data members are public so that they can be used from the thread call\n\n\tRtpSender(unsigned chans = 1);\n\n\t~RtpSender();\n\n\t\n\n\t\t\t\t\t// The work method...\n\n\tvoid nextBuffer(Buffer &outputBuffer, unsigned outBufNum) throw (Exception);\n\n\n\n\tbool createRtpSession();\n\n\n\n\tbool addRtpDestination(char * remoteIP, unsigned short remotePort);\n\n\tbool removeRtpDestination();\n\n\tvoid printError(int rtperr);\n\n\n\nprotected:\n\n\tunsigned mNumChans;\t\t// The default # of channels sent over RTP\n\n\tSynchPthread mRtpMutex;\n\n\n\n\tunsigned mBufferFrames;\n", "file_path": "CSL/RTP/RtpSender.h", "rank": 54, "score": 193665.8310833459 }, { "content": "class BinaryOp : public FrameStream, public Processor {\n\n\n\n\n\n\n\nprotected:\n\n\n\n\tFrameStream * _operand;\t\t\t// my other input (I inherit one from Processor)\n\n\n\n\tfloat _operandValue;\t\t\t// the operand in case it's just a float (and _operand is NULL)\n\n\n\n\tBuffer _operandBuffer; \t\t\t// buffer used for operations, if it needs to be allocated\n\n\n\n\tbool _haveOperandBuffer;\t\t\t// whether I have a temp buffer\n\n\n\n\tbool need_internal_buffer();\t\t// return true if I need a buffer to compute next_buffer\n\n\n\n\tvoid allocate_op_buffer();\n\n\n\n\t\n\n\n", "file_path": "Applications/Old/Ventriloquist/BinaryOp.h", "rank": 55, "score": 193665.8310833459 }, { "content": "class ThreadedWriter : public Writeable, public ThreadUtil {\n\npublic:\n\n\t\t\t\t// ctor / dtor\n\n\tThreadedWriter();\n\n\tThreadedWriter(unsigned numChannels);\n\n\tThreadedWriter(unsigned numChannels, unsigned numBufferFrames);\n\n\tvirtual ~ThreadedWriter();\n\n\n\n\tWriteable * mOutput;\n\n\t\n\n\t\t\t\t// methods\n\n\tvoid init(unsigned numChannels, unsigned numBufferFrames);\n\n\tvoid setOutput(Writeable& output) { mOutput = &output; }\n\n\tvoid writeBuffer(Buffer & inputBuffer) throw(CException);\n\n\tvoid start();\n\n\tvoid stop();\t\n\n\n\nprotected:\t\n\n\tstatic void * FeederFunction(void* arg);\t\t// thread function\n\n\tvoid writeToOutput();\n\n};\n\n\n\n}\n\n\n\n#endif\n", "file_path": "CSL/Utilities/OLD/ThreadedFrameStream.h", "rank": 56, "score": 191991.79038624157 }, { "content": "class ThreadedReader : public Effect, public ThreadUtil {\n\npublic:\t\n\n\t\t\t\t\t\t/// ctor / dtor\n\n\tThreadedReader();\n\n\tThreadedReader(UnitGenerator inp);\n\n\tThreadedReader(unsigned numChannels);\n\n\tThreadedReader(unsigned numChannels, unsigned numFrames);\n\n\t~ThreadedReader();\n\n\t\n\n\tvoid init(unsigned numChannels, unsigned numBufferFrames);\n\n\t\t\t\t\t\t\t\t\t\t/// nextBuffer uses cache and triggers writer thread\n\n\tvoid nextBuffer(Buffer & outputBuffer, unsigned chan) throw(CException);\n\n\tvoid start();\n\n\n\nprotected:\n\n\tstatic void * FeederFunction(void * arg);\t\t///< shared init function\n\n\tvoid readIntoBuffer();\n\n\t\n\n};\n\n\n", "file_path": "CSL/Utilities/OLD/ThreadedFrameStream.h", "rank": 57, "score": 191991.79038624157 }, { "content": "class AUIO : public IO {\n\npublic:\t\n\n\tAUIO();\n\n\tAUIO(unsigned s_rate, unsigned b_size, int in_device, int out_device, unsigned in_chans, unsigned out_chans);\n\n\t~AUIO();\n\n\n\n\tvirtual void open() throw(CException);\t\t\t\t///< open/close start/stop methods\n\n\tvirtual void close() throw(CException);\n\n\tvirtual void start() throw(CException);\n\n\tvirtual void stop() throw(CException);\n\n\n\n\tvoid setAudioUnit(AudioUnit au) { mAudioUnit = au; };\n\n\tvirtual Buffer & getInput() throw(CException);\t\t///< get the current input buffer\n\n\tvirtual Buffer & getInput(unsigned numFrames, unsigned numChannels) throw(CException);\t\t///< get the current input buffer\n\n\n\nprotected:\n\n\tAudioUnit mAudioUnit;\t\t\t\t\t\t\t// The AudioUnit we play out\n\n\tvoid handleError(OSStatus result) throw(CException);\n\n};\n\n\n\n///\n\n/// CoreAudio IO class\n\n///\n\n\n", "file_path": "CSL/IO/CAIO.h", "rank": 58, "score": 191219.45957439244 }, { "content": "class Sine : public Oscillator {\t\n\npublic:\n\n\tSine(float frequency = 220, float ampl = 1.0, float offset = 0.0, float phase = 0.0);\n\n\tvoid nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);\n\n};\n\n\n\n/// \tFSine -- (uses a ringing filter for the sine calc)\n\n\n", "file_path": "CSL/Sources/Oscillator.h", "rank": 59, "score": 191219.45957439244 }, { "content": "class Triangle : public Envelope {\n\n\n\npublic:\t\t\t/// Various Constructors\n\n\tTriangle() : Envelope() { };\n\n\t\t\t\t/// Simple constructor\n\n\tTriangle(LineMode mode, float duration, float amplitude);\n\n\t\t\t\t/// Versions with initial delay segments\n\n\tTriangle(LineMode mode, float duration, float initialDelay, float amplitude);\n\n\t\t\t\t/// Simple constructor\n\n\tTriangle(float duration, float amplitude = 1.0f);\n\n\t\t\t\t/// Versions with initial delay segments\n\n\tTriangle(float duration, float initialDelay, float amplitude);\n\n\t\t\t\t/// Minimal version - AR\n\n\t~Triangle() { };\n\n};\n\n\n\n///\n\n/// RandEnvelope envelope class -- makes random control signals using a single line segment\n\n///\n\n\n", "file_path": "CSL/Sources/Envelope.h", "rank": 60, "score": 191219.45957439244 }, { "content": "class AR : public Envelope {\n\n\n\npublic:\t\t\t/// Various Constructors\n\n\tAR() : Envelope() { };\n\n\t\t\t\t/// Minimal version - AR\n\n\tAR(LineMode mode, float t, float a, float r);\n\n\t\t\t\t/// with initial delay - IAR\n\n\tAR(LineMode mode, float t, float i, float a, float r);\n\n\t\t\t\t/// Minimal version - AR\n\n\tAR(float t, float a, float r);\n\n\t\t\t\t/// with initial delay - IAR\n\n\tAR(float t, float i, float a, float r);\n\n\n\n\t~AR() { };\n\n\t\t\t\t/// Special accessors\n\n\tvoid setDuration(float d);\t\t///< set duration = scale steady-state part of env\n\n\tvoid setDelay(float del);\n\n\tvoid setAttack(float attack);\n\n\tvoid setRelease(float release);\n\n\tvoid setAll(float d, float a, float r);\n\n\t\t\t\t/// Operations\n\n\tvoid release(void);\t\t\t///< trigger the release segment\n\n};\n\n\n\n///\n\n/// Triangle envelope class -- equal attack/release times\n\n///\n\n\n", "file_path": "CSL/Sources/Envelope.h", "rank": 61, "score": 191219.45957439244 }, { "content": "class FFT : public Effect {\n\n\n\npublic:\n\n\t\t\t\t\t\t\t\t\t\t/// Default size to the buffer size and flags to measure\n\n\tFFT(UnitGenerator & in, int size = CGestalt::blockSize(), CSL_FFTType type = CSL_FFT_COMPLEX);\n\n\t~FFT();\n\n\t\t\t\t\t\t\t\t\t\t/// we override the general-case version because this needs a mono input\n\n\tvoid nextBuffer(Buffer & outputBuffer) throw (CException);\t\n\n\n\n\tint fftSize() { return mFFTSize; }\t/// no setter -- create a new FFT to change size\n\n\n\n\tbool mOverwriteOutput;\t\t\t\t///< whether to replace the output with the input (or the spectrum) after signalling observers\n\n\n\nprotected:\t\n\n\tint mFFTSize;\t\t\t\t\t\t///< This should be unsigned, but is signed for compatability with FFTW\n\n\tFFTWrapper mWrapper;\t\t\t\t///< actual FFT wrapper object\n\n\tBuffer mInBuf;\t\t\t\t\t\t///< input buffer\n\n\tSampleBuffer mWindowBuffer;\t\t\t\t///< Buffer to store window\n\n};\n\n\n\n///\n\n/// Inverse FFT\n\n///\n\n\n", "file_path": "CSL/Sources/Spectral.h", "rank": 62, "score": 191219.45957439244 }, { "content": "class Clipper : public Effect {\n\n\n\npublic:\n\n\t\t\t\t/// Constructor takes the input UGen and optionally the flags, min and max. \n\n\tClipper(UnitGenerator & input, float min = -1, float max = 1, ClipperFlags flags = kBoth);\n\n\t~Clipper();\t\n\n\n\n\tvoid dump();\t\t\t\t\t\t///< print the receiver for debugging\n\n\n\n\tvoid nextBuffer(Buffer &outputBuffer, unsigned outBufNum) throw (CException);\n\n\n\nprivate:\n\n\tClipperFlags mFlags;\n\n\tfloat mMin, mMax;\n\n};\n\n\n\n}\n\n\n\n#endif\n", "file_path": "CSL/Processors/Clipper.h", "rank": 63, "score": 191219.45957439244 }, { "content": "class Sawtooth : public Oscillator {\n\npublic:\n\n\tSawtooth(float frequency = 220, float ampl = 1.0, float offset = 0.0, float phase = 0.0);\n\n\tvoid nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);\n\n};\n\n\n\n///\n\n/// Square oscillator class (non-band-limited)\n\n///\n\n\n", "file_path": "CSL/Sources/Oscillator.h", "rank": 64, "score": 191219.45957439244 }, { "content": "class FIR : public Effect {\n\n\n\npublic:\t\t\t\t\t\t/// Various constructors\n\n\t\t\t\t\t\t\t/// Takes a UGen, and optionally the number of taps and the tap IR array.\n\n\tFIR (UnitGenerator & in, unsigned numTaps = 2, float * tapDelay = NULL);\n\n//\tFIR (char * file_name);\t\t\t\t\t\t\t\t\t///< read data from a file\n\n\tFIR (FilterSpecification & fs);\t\t\t\t\t\t\t///< give it a filter specification object\n\n\tFIR (UnitGenerator & in, char * fileName);\n\n\tFIR (UnitGenerator & in, FilterSpecification & fs);\n\n\t~FIR ();\n\n\t\n\n\tvoid setTaps(unsigned numTaps, float *tapDelays);\n\n\tvoid readTaps(char *fileName);\n\n\t\t\t\t\t/// The work method...\n\n\tvoid nextBuffer(Buffer &outputBuffer, unsigned outBufNum) throw (CException);\n\n\n\nprotected:\n\n\tFilterSpecification *mFilterSpec;\n\n\tunsigned mOffset;\t\t///< offset \"pointer\" for loop counting\n\n\t\t\t\t\t\t\t/// Here are the sample buffers (dynamically allocated)\n", "file_path": "CSL/Processors/FIR.h", "rank": 65, "score": 191219.45957439244 }, { "content": "class Butter : public Filter {\n\n\t\n\npublic:\n\n\t\t\t\t// constructors / destructor\n\n\tButter ();\n\n\tButter (ButterworthType type, float cutoff);\n\n\tButter (ButterworthType type, float center, float bandwidth);\n\n\tButter (UnitGenerator & in, ButterworthType type, float cutoff);\n\n\tButter (UnitGenerator & in, ButterworthType type, UnitGenerator & cutoff);\n\n\tButter (UnitGenerator & in, ButterworthType type, float center, float bandwidth);\n\n\tButter (UnitGenerator & in, ButterworthType type, UnitGenerator & center, UnitGenerator & bandwidth);\n\n\t\t\t\t// Filtering\n\n\tvoid setupCoeffs();\n\n\n\nprotected:\n\n\tint mFilterType;\t\t\t\t// flag as to what kind of filter I am\n\n\n\n};\n\n\n\n/// Formant Filter with zeros at +-z and complex conjugate poles at +-omega.\n\n/// setupCoeffs() looks at the member var called normalize;\n\n/// if normalize is true, the filter zeros are placed at z = 1, z = -1, and the coefficients \n\n/// are then normalized to produce a constant unity peak gain. The resulting filter \n\n/// frequency response has a resonance at the given frequency. The closer the poles \n\n/// are to the unit-circle (radius close to one), the narrower the resulting resonance width.\n\n\n", "file_path": "CSL/Processors/Filters.h", "rank": 66, "score": 191219.45957439244 }, { "content": "class Square : public Oscillator {\n\npublic:\n\n\tSquare(float frequency = 220, float ampl = 1.0, float offset = 0.0, float phase = 0.0);\n\n\tvoid nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);\n\n};\n\n\n\n///\n\n/// Impulse -- oscillator class (this create a single impulse delayed by 'delay' samples)\n\n///\n\n\n", "file_path": "CSL/Sources/Oscillator.h", "rank": 67, "score": 191219.45957439244 }, { "content": "class Allpass : public Filter {\n\n\n\npublic:\n\n\t\t\t\t// constructors / destructor\n\n\tAllpass (UnitGenerator & in, float coeff);\n\n\tAllpass (UnitGenerator & in, UnitGenerator & coeff);\n\n\t~Allpass(void) { };\n\n\t\t\t\t// Filtering\n\n\tvoid setupCoeffs();\n\n\t\n\nprotected:\n\n\tUnitGenerator *\t\tmCoeffUGen;\n\n\tfloat\t\t\t\tmCoeff;\n\n\tBuffer\t\t\t\tmCoeffBuffer;\n\n};\n\n\n\n/// Moog-style resonant VCF class\n\n\n", "file_path": "CSL/Processors/Filters.h", "rank": 68, "score": 191219.45957439244 }, { "content": "class MIDIOut : public MIDIIO {\n\npublic:\n\n\tMIDIOut();\n\n\t~MIDIOut();\n\n\n\n\tunsigned buffer_size();\t\t\t\t\t\t\t\n\n\tvoid set_buffer_size(unsigned bufferSize ); // TODO: should not be called after opening.\n\n\tlong latency();\n\n\tvoid set_latency(long latency );\t\t\t// TODO: should not be called after opening.\n\n\t\n\n\tvoid open();\n\n\tvoid open(int deviceID );\n\n\tvoid set_message(CSL_MIDIMessage msg, long when ); \n\n\tvoid write();\n\n\tvoid write(CSL_MIDIMessage* msg, long length ); ///< thin wrapper for Pm_Write\n\n\tvoid write_short(CSL_MIDIMessage msg );\n\n\tvoid write_SysEX(long when, unsigned char *msg );\n\n\t\n\n\t\t\t\t/// convenience method for each MIDI messages\n\n\t\t\t\t/// writes directly and doesn't use member mMsg for temporal storage.\n", "file_path": "CSL/IO/MIDIIOP.h", "rank": 69, "score": 191219.45957439244 }, { "content": "class ADSR : public Envelope {\n\n\n\npublic:\t\n\n\tADSR() : Envelope() { };\n\n\t\t\t\t/// Minimal version - ADSR\n\n\tADSR(LineMode mode, float t, float a, float d, float s, float r);\n\n\t\t\t\t/// with initial delay - IADSR\n\n\tADSR(LineMode mode, float t, float i, float a, float d, float s, float r);\n\n\t\t\t\t/// Minimal version - ADSR\n\n\tADSR(float t, float a, float d, float s, float r);\n\n\t\t\t\t/// with initial delay - IADSR\n\n\tADSR(float t, float i, float a, float d, float s, float r);\n\n\t~ADSR() { };\n\n\t\t\t\t/// Special accessors\n\n\tvoid setDuration(float d);\t\t///< set duration = scale steady-state part of env\n\n\tvoid setDelay(float del);\n\n\tvoid setAttack(float attack);\n\n\tvoid setDecay(float decay);\n\n\tvoid setSustain(float sustain);\n\n\tvoid setRelease(float release);\n", "file_path": "CSL/Sources/Envelope.h", "rank": 70, "score": 191219.45957439244 }, { "content": "class Formant : public Filter {\n\n\t\n\npublic:\n\n\t\t\t\t/// constructors & destructor\n\n\tFormant (UnitGenerator & in, float center_freq, float radius);\n\n\tFormant (UnitGenerator & in, UnitGenerator & center_freq, float radius);\n\n\t~Formant(void) { };\n\n\t\n\n\t\t\t\t/// Filtering methods\n\n\tvoid setupCoeffs();\n\n\tvoid setNormalize(bool normalize);\n\n\n\nprotected:\n\n\tbool\t\t\t\tmNormalize;\n\n};\n\n\n\n/// Notch Filter with poles at +-z and complex conjugate zeros at +-omega.\n\n\n", "file_path": "CSL/Processors/Filters.h", "rank": 71, "score": 191219.45957439244 }, { "content": "class MIDIIn : public MIDIIO {\n\npublic:\n\n\tMIDIIn();\t\n\n\t\n\n\tunsigned buffer_size();\n\n\tvoid set_buffer_size(unsigned bufferSize );\n\n\tvoid open();\t\t\t\t///< method for opening the default stream.\n\n\tvoid open(int deviceID);\n\n\tbool poll();\n\n\tvoid read();\t\t\t\t///< generic read method. gets MIDI message and store it in mBuffer\n\n\tvoid read_interpret();\t\t///< read method and sets internal flag for which message was received\n\n\t\n\n\tPmEvent buffer() { return mBuffer[0]; }\n\n\tvoid dump_buffer();\n\n\n\n\tCSL_MIDIMessage message() {\treturn mMsg; }\n\n\tvoid dump_CSL_MIDIMessage();\n\n\t\n\n\tbool is_NoteOn_received();\n\n\tbool is_NoteOff_received();\n", "file_path": "CSL/IO/MIDIIOP.h", "rank": 72, "score": 191219.45957439244 }, { "content": "class MIDIOut : public MIDIIO {\n\npublic:\n\n\tMIDIOut();\n\n\t~MIDIOut();\n\n\n\n\tMidiOutput * mOut;\t\t\t\t\t\t\t\t///< the juce midi output is public\n\n\t\n\n\tvirtual void open(int deviceID );\n\n\tvoid write(CMIDIMessage & msg);\n\n\tvoid writeNoteOn(unsigned channel, unsigned pitch, unsigned velocity );\t\t///< MIDINote#, [0, 127]\n\n\tvoid writeNoteOn(unsigned channel, float frequency, float amplitude );\t\t///< [Hz], [0.0 1.0];\n\n\tvoid writeNoteOff(unsigned channel, unsigned pitch, unsigned velocity );\t\t///< MIDINote#, [0, 127]\n\n\tvoid writeNoteOff(unsigned channel, float frequency, float amplitude );\t\t///< [Hz], [0.0 1.0];\n\n\tvoid writePolyTouch(unsigned channel, unsigned pitch, unsigned amount );\n\n\tvoid writeControlChange(unsigned channel, unsigned function, unsigned value );\n\n\tvoid writeProgramChange(unsigned channel, unsigned programNum );\n\n\tvoid writeAftertouch(unsigned channel, unsigned amount );\t\t\t\t\t\t///< [0, 127]\n\n\tvoid writePitchWheel(unsigned channel, unsigned amount );\t\t\t\t\t\t///< [0, 16384] \n\n\tvoid writeSysEX(long when, unsigned char *msg );\n\n\n", "file_path": "CSL/IO/MIDIIOJ.h", "rank": 73, "score": 191219.45957439244 }, { "content": "class Stereoverb : public Effect {\n\n\n\npublic:\n\n\tStereoverb(UnitGenerator & input);\n\n\t~Stereoverb();\n\n\n\n\tvoid setRoomSize(float size);\n\n\tvoid setDampening(float damp);\n\n\tvoid setWetLevel(float level);\n\n\tvoid setDryLevel(float level);\n\n\tvoid setWidth(float width);\n\n\tbool isActive();\n\n\tunsigned numChannels() { return 2; };\t\t///< I'm stereo\n\n\n\n\tvoid nextBuffer(Buffer &outputBuffer) throw (CException);\n\n\n\nprotected:\n\n\tFreeverb * leftRev, * rightRev; // 2 mono reverberators\n\n\tSplitter * split;\t\t\t\t// stereo-to-mono splitter\n\n\tJoiner * join;\t\t\t\t\t// mono-to-stereo joiner\n\n};\n\n\n\n}\n\n\n\n#endif\n", "file_path": "CSL/Processors/Freeverb.h", "rank": 74, "score": 191219.45957439244 }, { "content": "class Notch : public Filter {\n\n\t\n\npublic:\n\n\t\t\t\t/// constructors & destructor\n\n\tNotch (UnitGenerator & in, float center_freq, float radius);\n\n\tNotch (UnitGenerator & in, UnitGenerator & center_freq, float radius);\n\n\t~Notch(void) { };\n\n\t\t\t\t// Filtering\n\n\tvoid setupCoeffs ();\n\n\n\n};\n\n\n\n/// Allpass Filter with a pole and a zero at equal frequency and straddling the unit circle.\n\n/// Allows all freqs to pass through but messes with phases.\n\n///\n\n/// Note that the Amount parameter of FrequencyAmount is ignored.\n\n\n", "file_path": "CSL/Processors/Filters.h", "rank": 75, "score": 191219.45957439244 }, { "content": "class Moog : public Filter {\n\n\n\npublic:\n\n\t\t\t\t// constructors / destructor\n\n\tMoog (UnitGenerator & in);\n\n\tMoog (UnitGenerator & in, UnitGenerator & cutoff);\n\n\tMoog (UnitGenerator & in, UnitGenerator & cutoff, UnitGenerator & resonance);\n\n\tMoog (UnitGenerator & in, float cutoff);\n\n\tMoog (UnitGenerator & in, float cutoff, float resonance);\n\n\t~Moog (void) { };\n\n\t\t\t\t// Filtering\n\n\tvoid setupCoeffs ();\n\n\t\n\n\tvoid nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);\t\n\n\n\nprotected:\n\n\tfloat k, p, r; \t// coefficients\n\n\tfloat x, oldx;\n\n\tfloat y1, y2, y3, y4, oldy1, oldy2, oldy3;\n\n\tbool debugging;\n\n};\n\n\n\n}\n\n\n\n#endif\n", "file_path": "CSL/Processors/Filters.h", "rank": 76, "score": 191219.45957439244 }, { "content": "class Impulse : public Oscillator {\n\npublic:\n\n\tImpulse();\n\n\tImpulse(float delay);\n\n\tImpulse(float frequency, float ampl);\n\n\tImpulse(float frequency, float ampl, float offset);\n\n\tImpulse(float frequency, float ampl, float offset, float phase);\n\n\t\n\n\tvoid nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);\n\n\n\nprotected:\n\n\tint mCounter;\n\n};\n\n\n\n///\n\n/// Struct for partial overtones\n\n///\n\n\n\ntypedef struct {\t\t\t\t// Harmonic partial data structure used here and by the SHARC classes\n\n\tfloat number;\t\t\t// partial number (need not be an integer)\n", "file_path": "CSL/Sources/Oscillator.h", "rank": 77, "score": 191219.45957439244 }, { "content": "class CAIO : public AUIO {\n\npublic:\n\n\tCAIO();\t\t\t\t\t\t\t\t\t\t\t/// Most verbose constructor -- specify everything\n\n\tCAIO(unsigned s_rate, unsigned b_size, int in_device, int out_device, unsigned in_chans, unsigned out_chans);\n\n\t~CAIO();\n\n\n\n\tvoid open() throw(CException);\t\t\t\t///< open/close start/stop methods\n\n\tvoid close() throw(CException);\n\n\tvoid start() throw(CException);\n\n\tvoid stop() throw(CException);\n\n\n\nprotected:\n\n\tvoid handleError(OSStatus result) throw(CException);\n\n\t\n\n};\n\n\n\n}\n\n\n\n#endif\n", "file_path": "CSL/IO/CAIO.h", "rank": 78, "score": 191219.45957439244 }, { "content": "class PAIO : public IO {\n\n\n\npublic:\n\n\tPAIO(unsigned s_rate = CSL_mFrameRate, unsigned b_size = CSL_mBlockSize, \n\n\t\t\tint in_device = -1, int out_device = -1, \n\n\t\t\tunsigned in_chans = 0, unsigned out_chans = 2);\n\n\t~PAIO();\t\t\t\t\t///< Destructor\n\n\n\n\tvoid open() throw(CException);\t\t\t///< open the IO\n\n\tvoid start() throw(CException);\t\t\t///< start the callbacks\n\n\tvoid stop() throw(CException);\t\t\t///< stop the callbacks\n\n\tvoid close() throw(CException);\t\t\t///< close the IO\n\n\tvoid test() throw(CException);\t\t\t///< test the IO's graph\n\n\n\n\tPaStream * mStream;\t\t\t\t\t///< the PortAudio stream we play out/get data from\n\n\n\nprotected:\n\n\tPaStreamParameters * mInputParameters;\t///< PA IO stream parameters\n\n\tPaStreamParameters * mOutputParameters;\n\n\t\n", "file_path": "CSL/IO/PAIO.h", "rank": 79, "score": 191219.45957439244 }, { "content": "class Effect : public UnitGenerator, public virtual Controllable {\n\npublic:\n\n\tEffect();\t\t\t\t\t\t\t\t\t///< Constructors\n\n\tEffect(UnitGenerator & input);\t\t\t\t///< use the given input\n\n\n\n\tvirtual bool isActive();\t\t\t\t\t///< am I active?\n\n\n\n\tvoid setInput(UnitGenerator & inp);\t\t\t///< set the receiver's input generator\n\n//\tUnitGenerator *input() { return mInputs[CSL_INPUT]->mUGen; }\t// no getter for now\n\n\tbool isInline;\t\t\t\t\t\t\t\t///< whether to use input or buffer as source\n\n\tvoid setInline() { isInline = true; }\t\t///< set the Effect to be inline\n\n\t\n\nprotected:\n\n\tSampleBuffer mInputPtr;\t\t\t\t\t\t///< A pointer to my input's data.\n\n\t\t\t\t\t\t\t\t\t\t\t\t/// method to read the input value\n\n\tvoid pullInput(Buffer & outputBuffer) throw (CException);\n\n\tvoid pullInput(unsigned numFrames) throw (CException);\n\n\tvirtual void trigger();\t\t\t\t\t\t///< trigger passed on here\n\n\t\t\t\t\t\t\t\t\t\t\t\t/// get the input port\n\n\tinline Port * inPort() { return mInputs[CSL_INPUT]; };\n", "file_path": "CSL/Kernel/CSL_Core.h", "rank": 80, "score": 190184.38342460588 }, { "content": "///\n\n/// Instrument class (abstract)\n\n///\n\nclass Instrument : public UnitGenerator {\n\npublic:\n\n\t\t\t\t\t/// Constructors\n\n\tInstrument();\n\n\tInstrument(Instrument&);\t\t\t\t\t\t\t///< copy constructor\n\n\t~Instrument();\n\n\t\t\t\t\t/// Accessors\n\n\tUnitGenerator * graph() { return mGraph; };\t\t\t///< my UGen graph\n\n\tUGenMap * genMap() { return & mUGens; };\t\t\t///< the map of ugens in the graph by name\n\n\tUGenVector * envelopes() { return & mEnvelopes; };\t///< the vector of envelopes to query or trigger\n\n\n\n\tconst string name() { return mName; };\t\t\t\t///< answer my name\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// answer the number of channels\n\n\tUnitGenerator * genNamed(string name);\t\t\t\t///< get a UGen from the graph\n\n\n\n\t\t\t\t\t/// Accessor management\n\n\tAccessorVector getAccessors() { return mAccessors; };\t\t\t\t///< answer the accessor vector\n\n\tunsigned numAccessors() { return mAccessors.size(); };\t\t\t\t///< answer the number of accessors\n\n\tvirtual void setParameter(unsigned selector, int argc, void **argv, const char *types) { };\t///< set a named parameter\n\n//\tvirtual float getParameter(unsigned selector);\n", "file_path": "CSL/Instruments/Instrument.h", "rank": 81, "score": 188926.89993078893 }, { "content": "class RectangularWindow : public Window {\n\npublic:\n\n\tRectangularWindow() : Window() { }\n\n\tRectangularWindow(unsigned windowSize) : Window(windowSize) { }\n\n\tRectangularWindow(unsigned windowSize, float gain) : Window(windowSize, gain) { }\n\n\t~RectangularWindow() { }\n\n\t\n\nprotected:\n\n\tvoid fillWindow();\n\n};\n\n\n\n/// TriangularWindow:A triangularWindow window.\n\n\n", "file_path": "CSL/Sources/Window.h", "rank": 82, "score": 188919.8032662882 }, { "content": "class Joiner : public Effect {\n\npublic:\t\t\t\t\t\t\t\t\t\t///< loop through my vector of inputs\n\n\tJoiner() : Effect() { mNumChannels = 0; };\t///< Constructors\n\n\tJoiner(UnitGenerator & in1, UnitGenerator & in2);\n\n\t~Joiner() { };\n\n\t\t\t\t\t\t\t\t\t\t\t\t/// nextBuffer processes joiner channels\n\n\tvirtual void nextBuffer(Buffer & outputBuffer) throw(CException);\n\n\tvirtual void nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw(CException);\n\n\tvoid addInput(UnitGenerator & in);\t\t\t///< add the argument to vector of inputs\n\n\tbool isActive();\n\n\tvirtual void trigger();\t\t\t\t\t\t///< trigger passed on here\n\n//\tunsigned numChannels() { return mNumChannels; };\n\n//\tinline Port * inPort() { return mInputs[CSL_INPUT]; };\n\n//\tvirtual unsigned numOutputs() { return mNumOutputs; };\n\n\n\nprotected:\n\n//\tUGenVector mInputs;\t\t\t\t\t\t///< my vector of inputs\n\n};\n\n\n\n///\n\n/// Interleaver handles copying interleaved sample buffers (like sound files and inter-process sockets)\n\n/// to/from non-interleaved CSL-style Buffer objects.\n\n///\n\n\n", "file_path": "CSL/Kernel/CSL_Core.h", "rank": 83, "score": 188919.8032662882 }, { "content": "class FSine : public Oscillator {\t\n\npublic:\n\n\tFSine(float frequency = 220, float ampl = 1.0, float offset = 0.0, float phase = 0.0);\n\n\tvoid nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);\n\n};\n\n\n\n///\n\n/// Sawtooth oscillator class (non-band-limited)\n\n///\n\n\n", "file_path": "CSL/Sources/Oscillator.h", "rank": 84, "score": 188919.8032662882 }, { "content": "class IFFT : public UnitGenerator {\n\n\n\npublic:\n\n\t\t\t\t\t\t\t\t\t\t/// Default size to the buffer size and flags to measure\n\n\tIFFT(int size = CGestalt::blockSize(), CSL_FFTType type = CSL_FFT_COMPLEX);\n\n\t~IFFT();\n\n\t\t\t\t\t\t\t\t\t\t/// no setter -- create a new IFFT to change size\n\n\tint fftSize() { return mFFTSize; }\n\n\t\t\t\t\t\t\t\t\t\t/// getter methods\n\n\tvoid binValue(int binNumber, float * outRealPart, float * outComplexPart);\n\n\tvoid binValueMagPhase(int binNumber, float * outMag, float * outPhase);\n\n\t\t\n\n\t\t\t\t\t\t\t\t\t\t// set the values in the specified bin\n\n\tvoid setBin(int binNumber, float realPart, float imagPart);\n\n\tvoid setBins(float * real, float * imag);\n\n\tvoid setBins(SampleComplexVector cmplxSpectrum);\n\n\tvoid setBins(SampleBuffer cmplxSpectrum);\n\n\tvoid setBins(int lower, int upper, float* real, float* imag);\n\n\tvoid setBinMagPhase(int binNumber, float mag, float phase);\n\n\tvoid setBinsMagPhase(float* mags, float* phases);\n", "file_path": "CSL/Sources/Spectral.h", "rank": 85, "score": 188919.8032662882 }, { "content": "class MIDIPlayer: public MIDIIO {\n\npublic:\n\n\tMIDIPlayer(string nam, InstrumentLibrary * lib);\n\n\tMIDIPlayer(string folder, string nam, InstrumentLibrary * lib);\n\n\t~MIDIPlayer() { }\n\n\t\n\n\tvoid open(int devID) { };\t\t///< open a device (empty method)\n\n\tvoid start(int index);\t\t\t///< play a track; merges tracks if index< 0\n\n\tvoid stop();\t\t\t\t\t///< stop playing\n\n\t\n\n\tMidiFile mFile;\t\t\t\t\t///< JUCE MIDI file\n\n\tint mNumTrax;\t\t\t\t\t///< num tracks\n\n\tMidiMessageSequence * mTrak;\t///< track ptr\n\n\tbool mIsOn;\t\t\t\t\t\t///< Active flag\n\n\t\n\n\tInstrumentLibrary * mLibrary;\t///< instrument library\n\n\tfloat mTempoScale;\t\t\t\t///< tempo scale (secs/beat / ticks/beat)\n\n\t\n\nprotected:\n\n\tvoid init(String namS);\n\n\tMidiMessageSequence * mergeTrax();\n\n\n\n};\n\n\n\n} // csl namespace\n\n\n\n#endif\n", "file_path": "CSL/IO/MIDIIOJ.h", "rank": 86, "score": 188919.8032662882 }, { "content": "class RandEnvelope : public Envelope {\n\npublic:\t\t\t\t\t\t\t\t\t\t/// defaults are 1 Hz, +- 1.0 range\n\n\tRandEnvelope(float frequency = 1, float amplitude = 1, float offset = 0, float step = 0);\n\n\t~RandEnvelope() { };\n\n\t\t\t\t\t\t/// Accessors\n\n\tvoid setWalk(bool walk) { mWalk = walk; };\n\n\tvoid setAmplitude(float amplitude) { mAmplitude = amplitude; };\n\n\tvoid setFrequency(float frequency) { mFrequency = frequency; };\n\n\tvoid setStep(float step) { mStep = step; };\n\n\tvoid setOffset(float offset) { mOffset = offset; };\n\n\n\n\tvirtual bool isActive() { return false; };\n\n\t\t\t\t\t/// These are no-ops in Random envelopes\n\n\tvoid reset() { };\t\t\t\t///< reset internal time to restart envelope\n\n\tvoid trigger() { };\t\t\t\t///< reset internal time to restart envelope\n\n\tvoid dump() { };\t\t\t\t///< print the receiver\n\n\tvoid setDuration(float d) { };\t///< set/scale durations\n\n\tvoid scaleTimes(float s) { };\t///< scale durations\n\n\n\n\t\t\t\t\t\t\t\t/// The main UGen work method\n", "file_path": "CSL/Sources/Envelope.h", "rank": 87, "score": 188919.8032662882 }, { "content": "class Lorenz : public UnitGenerator {\n\n\n\npublic:\n\n\t\t\t\t/// Constructor\n\n\tLorenz(float x = 0.02, float y = 20., float z = 20.);\n\n\t~Lorenz();\n\n\n\n\t\t\t\t/// Accessors\n\n\tfloat x() const { return mX; }\n\n\tfloat y() const { return mY; }\n\n\tfloat z() const { return mZ; }\n\n\n\n\tvoid setX(float tx) { mX = tx; }\n\n\tvoid setY(float ty) { mY = ty; }\n\n\tvoid setZ(float tz) { mZ = tz; }\n\n\n\n\tvoid dump();\n\n\tvoid nextBuffer(Buffer& outputBuffer, unsigned outBufNum) throw (CException);\n\n\n\nprotected:\n\n\tfloat mX, mY, mZ;\t\n\n};\n\n\n\n}\n\n\n\n#endif\n", "file_path": "CSL/Sources/Lorenz.h", "rank": 88, "score": 188919.8032662882 }, { "content": "class Window : public UnitGenerator {\n\npublic:\t\t\t\t// Constructors:\n\n\tWindow();\t\t///< Creates a window using the default Gestalt size and a gain of 1;\n\n\t\t\t\t\t///< Creates a window (hann) with the specified size and gain (gain is optional).\n\n\tWindow(unsigned windowSize, float gain = 1); \n\n\t~Window();\t\t///< clean-up . . . free the allocated buffer that held the window data.\n\n\n\n\tvoid setSize(unsigned windowSize);\t///< Set the number of samples the window spans.\n\n\tvoid setGain(float gain);\t\t\t\t///< Set the gain to which the window should be normalized.\n\n\tSampleBuffer window() { return mWindowBuffer.buffer(0); }; ///< Returns a pointer to the window data.\n\n\n\n\tvoid nextBuffer(Buffer &outputBuffer, unsigned outBufNum) throw (CException);\n\n\tvoid dump();\t\t///< Print some info about the window.\n\n\t\n\nprotected:\n\n\tBuffer mWindowBuffer;\t\t///< used to store the window\n\n\tunsigned mWindowBufferPos; \t///< where am I in the window buffer\n\n\tunsigned mWindowSize;\t\t///< length in samples of the window\n\n\tfloat mGain;\t\t\t\t\t///< gain for the window\n\n\n\n\tvirtual void fillWindow();\t\t///< subclasses override this to fill the buffer with corresponding function.\n\n};\n\n\n\n/// RectangularWindow:A rectangular window has all values set to the Gain value, or by default to 1.\n\n\n", "file_path": "CSL/Sources/Window.h", "rank": 89, "score": 188919.8032662882 }, { "content": "class FDN : public Effect {\n\npublic:\n\n\tFDN(UnitGenerator &op, unsigned int delayLineLengths[], unsigned int numDelayLines,\n\n\t\t\tsample inputGains[], sample outputGains[], sample feedbackMatrix[], sample feedbackGains[] ); \n\n\t~FDN();\n\n\n\n\tBuffer *mDelayLine; \t///< the delay line (just a buffer, not a RingBuffer)\n\n\n\n\n\n\tvoid nextBuffer(Buffer &outputBuffer, unsigned outBufNum) throw (CException);\n\n\n\n//\tvoid dump();\t\t\t\t///< print the receiver for debugging\n\n\n\nprotected:\t\n\n\tvoid initDelayLines();\t\t///< function to initialize the delay line\n\n\tunsigned mNumDelLines;\t\t///< # of delay lines in FDN\n\n\tunsigned *mIndex;\t\t\t///< current index in the delay lines\n\n\tunsigned *mDelLength;\t\t///< allocated size of the delay lines\n\n\t\n\n\tsample *mInputGains;\t\t///< Input gains to various delay lines\n", "file_path": "CSL/Processors/OLD/FDN.h", "rank": 90, "score": 188919.8032662882 }, { "content": "class FanOut : public Effect {\n\npublic:\n\n\tFanOut(UnitGenerator & in, unsigned taps);\t///< Constructors\n\n\t~FanOut() { };\n\n\n\n\tvirtual void nextBuffer(Buffer & outputBuffer) throw(CException);\n\n\tvirtual void nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw(CException);\n\n\n\nprotected:\n\n\tBuffer mBuffer;\t\t\t///< my temp buffer\n\n\tunsigned mNumFanOuts;\t///< the number of outputs\n\n\tunsigned mCurrent;\t\t///< the current output\n\n};\n\n\n\n///\n\n/// Splitter class -- a de-multiplexer for multi-channel signals\n\n///\n\n\n", "file_path": "CSL/Kernel/CSL_Core.h", "rank": 91, "score": 188919.8032662882 }, { "content": "class PinkNoise : public Noise {\n\n\n\npublic:\n\n\tPinkNoise();\t\t\t\t\t\t\t\t\t\t///< Constructors\n\n\tPinkNoise(double ampl, double offset = 0.f); \n\n\tPinkNoise(int seed, double ampl = 1.f, double offset = 0.f);\n\n\t~PinkNoise() { };\t\t\t\t\t\t\t\t\t///< Destructor\n\n\t\n\n\t\t\t\t\t\t\t\t\t/// the monoNextBuffer method is where the DSP takes place\n\n\tvoid nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);\n\n\t\n\n\tsample nextPink();\t\t\t\t\t///< returns the next pink noise sample\n\n\t\n\nprotected:\n\n\tint mPinkRows[PINK_MAX_RANDOM_ROWS];///< Pink noise generator rows\n\n\tint mPinkRunningSum;\t\t\t\t///< Used to optimize summing of generators.\n\n\tint mPinkIndex;\t\t\t\t\t\t///< Incremented each sample. \n\n\tint mPinkIndexMask;\t\t\t\t\t///< Index wrapped by ANDing with this mask. \n\n\tfloat mPinkScalar;\t\t\t\t\t///< Used to scale within range of -1.0 to +1.0 \n\n\n", "file_path": "CSL/Sources/Noise.h", "rank": 92, "score": 188919.8032662882 }, { "content": "class WhiteNoise : public Noise {\n\n\n\npublic:\t\t\t\t\t\t\t\t\t\t/// Constructors\n\n\tWhiteNoise() : Noise() { };\n\n\tWhiteNoise(double ampl, double offset = 0.0) : Noise(ampl, offset) { }; \n\n\tWhiteNoise(int seed, double ampl = 1.0, double offset = 0.0) : Noise(seed, ampl, offset) { };\n\n\t~WhiteNoise() { };\t\t\t\t\t\t\t\t\t\t///< Destructor\n\n\t\n\n/********* THIS FUNCTION WAS PROTECTED, BUT IT'S NEEDED TO BE PUBLIC BECAUSE \n\n\t\t\tOTHER UGENS MIGHT CALL IT DURING A NEXT BUFFER CALL . . . *********/\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// the noise generator DSP function\n\n\tvoid nextBuffer(Buffer& outputBuffer, unsigned outBufNum) throw (CException);\n\n\t\n\nprotected:\n\n\n\n};\n\n\n\n///\n\n/// Pink noise -- equal power per octave\n\n///\n\n\n", "file_path": "CSL/Sources/Noise.h", "rank": 93, "score": 188919.8032662882 }, { "content": "class Microphone : public UnitGenerator {\n\npublic:\n\n\tMicrophone(IO & anIO) : mIO(anIO) {};\n\n\t~Microphone() {};\n\n\n\n\tvoid nextBuffer(Buffer &outputBuffer) throw (CException);\t\t///< copy next buffer from cache\n\n\n\nprotected:\n\n\tIO & mIO;\t\t\t\t\t// my IO object\n\n};\n\n\n\n}\n\n\n\n#endif\n", "file_path": "CSL/IO/Microphone.h", "rank": 94, "score": 188919.8032662882 }, { "content": "class Splitter : public FanOut {\n\npublic:\n\n\tSplitter(UnitGenerator & in);\t\t\t\t///< Constructor\n\n\t~Splitter() { };\n\n\n\n\tunsigned numChannels() { return 1; };\t\t///< I'm mono\n\n\t\t\t\t\t\t\t\t\t\t\t\t/// nextBuffer processes splitter channels\n\n\tvirtual void nextBuffer(Buffer & outputBuffer) throw(CException);\n\n\tvirtual void nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw(CException);\n\n};\n\n\n\n///\n\n/// Joiner class -- a multiplexer for multi-channel signals\n\n///\n\n\n", "file_path": "CSL/Kernel/CSL_Core.h", "rank": 95, "score": 188919.8032662882 }, { "content": "class StereoWidth : public Effect {\n\n\n\npublic:\t\t\t\t\t\t// Constructors / destructor\n\n\tStereoWidth ();\n\n\t~StereoWidth();\n\n\t\t\t\t\t\t\t// Operations\n\n\tvoid setWidth(float width) { mWidth = width; }\n\n\tvoid setPan(float pan) { mPan = pan; }\n\n\tvoid setGain(float gain) { mGain = gain; }\n\n\n\n\tvoid nextBuffer(Buffer & inputBuffer) throw (CException);\n\n\n\nprotected:\n\n\tfloat mWidth;\t\t\t// stereo width range: -1->1. -1 = mix to mono, 0 = no change 1 = widen\n\n\tfloat mGain;\t\t\t// amplitude scaler 0->10, 1 -- no scaling\n\n\tfloat mPan;\t\t\t\t// pan position 0->1 0.5 -- no panning\n\n};\n\n\n\n}\n\n\n\n#endif\n", "file_path": "CSL/Processors/Mixer.h", "rank": 96, "score": 188919.8032662882 }, { "content": "class WavetableOscillator : public Oscillator {\n\npublic:\n\n\tWavetableOscillator(Buffer & wave);\n\n#ifndef SWIG_ONLY\t\t\t\t\t\t// SWIG can't handle the initializers\n\n\tWavetableOscillator(float frequency = 1, float ampl = 1.0, float offset = 0.0, float phase = 0.0);\n\n#else\n\n\tWavetableOscillator(Buffer & wave, float frequency = 220.0f);\n\n\tWavetableOscillator(Buffer & wave, float frequency = 220.0f, float phase = 0.0f);\n\n\tWavetableOscillator(float frequency = 1, float ampl = 1.0f, float offset = 0.0f, float phase = 0.0f);\n\n#endif\n\n\t~WavetableOscillator();\t\t\t\t///< Destructor\n\n\tvoid setWaveform(Buffer & wave, bool freeBufs = true);\t///< plug in waveforms\n\n\t\t\t\t\t\t\t\t\t\t/// set the interpolation flag\n\n\tvoid setInterpolate(InterpolationPolicy whether) { mInterpolate = whether; };\n\n\t\t\t\t\t\t\t\t\t\t// get the next buffer of samples\n\n\tvirtual void nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);\n\n\n\n\tInterpolationPolicy mInterpolate;\t///< whether/how I should interpolate between samples\n\n\tBuffer mWavetable;\t\t\t\t\t///< the stored wave form\n\n\n\nprotected:\n\n\tvoid fillSine();\t\t\t\t\t///< fill the shared wavetable with 1 cycle of a sine wave\n\n};\n\n\n\n///\n\n/// CompOrCacheOscillator -- Abstract oscillator class for those who can compute of cache their wavetables\n\n///\n\n\n", "file_path": "CSL/Sources/Oscillator.h", "rank": 97, "score": 188919.8032662882 }, { "content": "class AUIO : public IO {\n\npublic:\t\n\n\tAUIO();\n\n\tAUIO(unsigned s_rate, unsigned b_size, int in_device, int out_device, \n\n\t\t\tunsigned in_chans, unsigned out_chans);\n\n\t~AUIO();\n\n\t\n\n\tvirtual void open() throw(CException);\t\t///< open/close start/stop methods\n\n\tvirtual void close() throw(CException);\n\n\tvirtual void start() throw(CException);\n\n\tvirtual void stop() throw(CException);\n\n\t\n\n\tvoid setAudioUnit(AudioUnit au) { mAudioUnit = au; };\n\n\tvirtual Buffer & getInput() throw(CException);\t\t///< get the current input buffer\n\n\t\t\t\t\t\t\t\t\t\t\t\t/// get the current input buffer\n\n\tvirtual Buffer & getInput(unsigned numFrames, unsigned numChannels) throw(CException);\n\n\t\n\nprotected:\n\n\tAudioComponentInstance mAudioUnit;\t\t\t///< The AudioUnit we play out\n\n\tvoid handleError(OSStatus result) throw(CException);\n\n};\n\n\n\n///\n\n/// CoreAudio IO class for the iPhone\n\n///\n\n\n", "file_path": "CSL/IO/iphoneIO.h", "rank": 98, "score": 188919.8032662882 }, { "content": "class Convolver : public Effect {\n\n\n\npublic:\t\t\t\t\t\t\t\t\t\t/// Constructors\n\n\tConvolver() : Effect() { };\n\n\tConvolver(char *IRfilename);\t\t\t///< give an IR file name or buffer and/or FFT len\n\n\tConvolver(unsigned len, Buffer & impulseResp);\n\n\tConvolver(unsigned len, char * IRfilename);\n\n\tConvolver(Buffer & inbuf);\n\n\t~Convolver();\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// init/setup functions\n\n\tvoid initialize(Buffer & buf) throw (CException);\t\t///< this takes the fft of the IR buffer\n\n\tvoid setFilters(fftwf_complex ** filterFFTs);\t\t\t///< set the IR spectrum array\n\n\tvoid setInputf(fftwf_complex * inFFT);\t\t\t\t\t///< pass in the input buffer\n\n\tCSL_FFTW_sample * mSampleBuffer;\t\t\t\t\t\t///< public I/O buffer ptr\n\n\n\n\t\t\t\t\t\t\t\t\t\t/// main nextBuffer call sums past FFT'ed IRs and inputs\n\n\tvoid nextBuffer(Buffer &outputBuffer, unsigned outBufNum) throw (CException);\n\n\n\nprotected:\t\n\n\tCSL_FFTW_cmplx ** mFilterFFTs;\t\t\t\t\t\t\t///< A ring buffer of IR fft buffers\n", "file_path": "CSL/Processors/OLD/Convolver.h", "rank": 99, "score": 188919.8032662882 } ]
C++
curves/include/curves/PolynomialSpline.hpp
leggedrobotics/curves
696db3e9ecf67c143e7b48a8dd53d2c5ea1ba2fe
#pragma once #include <Eigen/Core> #include "curves/polynomial_splines_traits.hpp" #include <numeric> namespace curves { template <int splineOrder_> class PolynomialSpline { public: static constexpr unsigned int splineOrder = splineOrder_; static constexpr unsigned int coefficientCount = splineOrder + 1; using SplineImplementation = spline_traits::spline_rep<double, splineOrder>; using SplineCoefficients = typename SplineImplementation::SplineCoefficients; using EigenTimeVectorType = Eigen::Matrix<double, 1, coefficientCount>; using EigenCoefficientVectorType = Eigen::Matrix<double, coefficientCount, 1>; PolynomialSpline() : duration_(0.0), didEvaluateCoeffs_(false), coefficients_() { } template<typename SplineCoeff_> PolynomialSpline(SplineCoeff_&& coefficients, double duration) : duration_(duration), didEvaluateCoeffs_(true), coefficients_(std::forward<SplineCoeff_>(coefficients)) { } explicit PolynomialSpline(const SplineOptions& options) : duration_(options.tf_) { computeCoefficients(options); } explicit PolynomialSpline(SplineOptions&& options) : duration_(options.tf_) { computeCoefficients(std::move(options)); } virtual ~PolynomialSpline() = default; PolynomialSpline(PolynomialSpline &&) = default; PolynomialSpline& operator=(PolynomialSpline &&) = default; PolynomialSpline(const PolynomialSpline&) = default; PolynomialSpline& operator=(const PolynomialSpline&) = default; const SplineCoefficients& getCoefficients() const { return coefficients_; } SplineCoefficients* getCoefficientsPtr() { return &coefficients_; } template<typename SplineOptionsType_> bool computeCoefficients(SplineOptionsType_&& options) { duration_ = options.tf_; return SplineImplementation::compute(std::forward<SplineOptionsType_>(options), coefficients_); } void setCoefficientsAndDuration(const SplineCoefficients& coefficients, double duration) { coefficients_ = coefficients; duration_ = duration; } constexpr double getPositionAtTime(double tk) const { return std::inner_product(coefficients_.begin(), coefficients_.end(), SplineImplementation::tau(tk).begin(), 0.0); } constexpr double getVelocityAtTime(double tk) const { return std::inner_product(coefficients_.begin(), coefficients_.end(), SplineImplementation::dtau(tk).begin(), 0.0); } constexpr double getAccelerationAtTime(double tk) const { return std::inner_product(coefficients_.begin(), coefficients_.end(), SplineImplementation::ddtau(tk).begin(), 0.0); } static inline void getTimeVector(Eigen::Ref<EigenTimeVectorType> timeVec, const double tk) { timeVec = Eigen::Map<EigenTimeVectorType>(SplineImplementation::tau(tk).data()); } template<typename Derived> static inline void getTimeVector(Eigen::MatrixBase<Derived> const & timeVec, const double tk) { assert(timeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && timeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(timeVec) = Eigen::Map<const EigenTimeVectorType>((SplineImplementation::tau(tk)).data()); } template<typename Derived> static inline void addTimeVector(Eigen::MatrixBase<Derived> const & timeVec, const double tk) { assert(timeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && timeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(timeVec) += Eigen::Map<const EigenTimeVectorType>((SplineImplementation::tau(tk)).data()); } static inline void getDTimeVector(Eigen::Ref<EigenTimeVectorType> dtimeVec, const double tk) { dtimeVec = Eigen::Map<EigenTimeVectorType>(SplineImplementation::dtau(tk).data()); } template<typename Derived> static inline void getDiffTimeVector(Eigen::MatrixBase<Derived> const & dtimeVec, const double tk) { assert(dtimeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && dtimeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(dtimeVec) = Eigen::Map<const EigenTimeVectorType>((SplineImplementation::dtau(tk)).data()); } template<typename Derived> static inline void addDiffTimeVector(Eigen::MatrixBase<Derived> const & dtimeVec, const double tk) { assert(dtimeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && dtimeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(dtimeVec) += Eigen::Map<const EigenTimeVectorType>((SplineImplementation::dtau(tk)).data()); } static inline void getDDTimeVector(Eigen::Ref<EigenTimeVectorType> ddtimeVec, const double tk) { ddtimeVec = Eigen::Map<EigenTimeVectorType>(SplineImplementation::ddtau(tk).data()); } template<typename Derived> static inline void getDDiffTimeVector(Eigen::MatrixBase<Derived> const & ddtimeVec, const double tk) { assert(ddtimeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && ddtimeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(ddtimeVec) = Eigen::Map<const EigenTimeVectorType>((SplineImplementation::dtau(tk)).data()); } template<typename Derived> static inline void addDDiffTimeVector(Eigen::MatrixBase<Derived> const & ddtimeVec, const double tk) { assert(ddtimeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && ddtimeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(ddtimeVec) += Eigen::Map<const EigenTimeVectorType>((SplineImplementation::ddtau(tk)).data()); } static inline void getTimeVectorAtZero(Eigen::Ref<EigenTimeVectorType> timeVec) { timeVec = Eigen::Map<const EigenTimeVectorType>((SplineImplementation::tauZero).data()); } template<typename Derived> static inline void getTimeVectorAtZero( Eigen::MatrixBase<Derived> const & timeVec) { assert(timeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && timeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(timeVec) = Eigen::Map<const EigenTimeVectorType>((SplineImplementation::tauZero).data()); } template<typename Derived> static inline void addTimeVectorAtZero( Eigen::MatrixBase<Derived> const & timeVec) { assert(timeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && timeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(timeVec) += Eigen::Map<const EigenTimeVectorType>((SplineImplementation::tauZero).data()); } static inline void getDTimeVectorAtZero(Eigen::Ref<EigenTimeVectorType> dtimeVec) { dtimeVec = Eigen::Map<const EigenTimeVectorType>((SplineImplementation::dtauZero).data()); } template<typename Derived> static inline void getDiffTimeVectorAtZero( Eigen::MatrixBase<Derived> const & dtimeVec) { assert(dtimeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && dtimeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(dtimeVec) = Eigen::Map<const EigenTimeVectorType>((SplineImplementation::dtauZero).data()); } template<typename Derived> static inline void addDiffTimeVectorAtZero( Eigen::MatrixBase<Derived> const & dtimeVec) { assert(dtimeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && dtimeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(dtimeVec) += Eigen::Map<const EigenTimeVectorType>((SplineImplementation::dtauZero).data()); } static inline void getDDTimeVectorAtZero(Eigen::Ref<EigenTimeVectorType> ddtimeVec) { ddtimeVec = Eigen::Map<const EigenTimeVectorType>((SplineImplementation::ddtauZero).data()); } template<typename Derived> static inline void getDDiffTimeVectorAtZero( Eigen::MatrixBase<Derived> const & ddtimeVec) { assert(ddtimeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && ddtimeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(ddtimeVec) = Eigen::Map<const EigenTimeVectorType>((SplineImplementation::ddtauZero).data()); } template<typename Derived> static inline void addDDiffTimeVectorAtZero( Eigen::MatrixBase<Derived> const & ddtimeVec) { assert(ddtimeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && ddtimeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(ddtimeVec) += Eigen::Map<const EigenTimeVectorType>((SplineImplementation::ddtauZero).data()); } double getSplineDuration() const { return duration_; } protected: double duration_; bool didEvaluateCoeffs_; SplineCoefficients coefficients_; }; }
#pragma once #include <Eigen/Core> #include "curves/polynomial_splines_traits.hpp" #include <numeric> namespace curves { template <int splineOrder_> class PolynomialSpline { public: static constexpr unsigned int splineOrder = splineOrder_; static constexpr unsigned int coefficientCount = splineOrder + 1; using SplineImplementation = spline_traits::spline_rep<double, splineOrder>; using SplineCoefficients = typename SplineImplementation::SplineCoefficients; using EigenTimeVectorType = Eigen::Matrix<double, 1, coefficientCount>; using EigenCoefficientVectorType = Eigen::Matrix<double, coefficientCount, 1>; PolynomialSpline() : duration_(0.0), didEvaluateCoeffs_(false), coefficients_() { } template<typename SplineCoeff_> PolynomialSpline(SplineCoeff_&& coefficients, double duration) : duration_(duration), didEvaluateCoeffs_(true), coefficients_(std::forward<SplineCoeff_>(coefficients)) { } explicit PolynomialSpline(const SplineOptions& options) : duration_(options.tf_) { computeCoefficients(options); } explicit PolynomialSpline(SplineOptions&& options) : duration_(options.tf_) { computeCoefficients(std::move(options)); } virtual ~PolynomialSpline() = default; PolynomialSpline(PolynomialSpline &&) = default; PolynomialSpline& operator=(PolynomialSpline &&) = default; PolynomialSpline(const PolynomialSpline&) = default; PolynomialSpline& operator=(const PolynomialSpline&) = default; const SplineCoefficients& getCoefficients() const { return coefficients_; } SplineCoefficients* getCoefficientsPtr() { return &coefficients_; } template<typename SplineOptionsType_> bool computeCoefficients(SplineOptionsType_&& options) { duration_ = options.tf_; return SplineImplementation::compute(std::forward<SplineOptionsType_>(options), coefficients_); } void setCoefficientsAndDuration(const SplineCoefficients& coefficients, double duration) { coefficients_ = coefficients; duration_ = duration; } constexpr double getPositionAtTime(double tk) const { return std::inner_product(coefficients_.begin(), coefficients_.end(), SplineImplementation::tau(tk).begin(), 0.0); } constexpr double getVelocityAtTime(double tk) const { return std::inner_product(coefficients_.begin(), coefficients_.end(), SplineImplementation::dtau(tk).begin(), 0.0); } constexpr double getAccelerationAtTime(double tk) const { return std::inner_product(coefficients_.begin(), coefficients_.end(), SplineImplementation::ddtau(tk).begin(), 0.0); } static inline void getTimeVector(Eigen::Ref<EigenTimeVectorType> timeVec, const double tk) { timeVec = Eigen::Map<EigenTimeVectorType>(SplineImplementation::tau(tk).data()); } template<typename
static inline void getDDTimeVectorAtZero(Eigen::Ref<EigenTimeVectorType> ddtimeVec) { ddtimeVec = Eigen::Map<const EigenTimeVectorType>((SplineImplementation::ddtauZero).data()); } template<typename Derived> static inline void getDDiffTimeVectorAtZero( Eigen::MatrixBase<Derived> const & ddtimeVec) { assert(ddtimeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && ddtimeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(ddtimeVec) = Eigen::Map<const EigenTimeVectorType>((SplineImplementation::ddtauZero).data()); } template<typename Derived> static inline void addDDiffTimeVectorAtZero( Eigen::MatrixBase<Derived> const & ddtimeVec) { assert(ddtimeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && ddtimeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(ddtimeVec) += Eigen::Map<const EigenTimeVectorType>((SplineImplementation::ddtauZero).data()); } double getSplineDuration() const { return duration_; } protected: double duration_; bool didEvaluateCoeffs_; SplineCoefficients coefficients_; }; }
Derived> static inline void getTimeVector(Eigen::MatrixBase<Derived> const & timeVec, const double tk) { assert(timeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && timeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(timeVec) = Eigen::Map<const EigenTimeVectorType>((SplineImplementation::tau(tk)).data()); } template<typename Derived> static inline void addTimeVector(Eigen::MatrixBase<Derived> const & timeVec, const double tk) { assert(timeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && timeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(timeVec) += Eigen::Map<const EigenTimeVectorType>((SplineImplementation::tau(tk)).data()); } static inline void getDTimeVector(Eigen::Ref<EigenTimeVectorType> dtimeVec, const double tk) { dtimeVec = Eigen::Map<EigenTimeVectorType>(SplineImplementation::dtau(tk).data()); } template<typename Derived> static inline void getDiffTimeVector(Eigen::MatrixBase<Derived> const & dtimeVec, const double tk) { assert(dtimeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && dtimeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(dtimeVec) = Eigen::Map<const EigenTimeVectorType>((SplineImplementation::dtau(tk)).data()); } template<typename Derived> static inline void addDiffTimeVector(Eigen::MatrixBase<Derived> const & dtimeVec, const double tk) { assert(dtimeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && dtimeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(dtimeVec) += Eigen::Map<const EigenTimeVectorType>((SplineImplementation::dtau(tk)).data()); } static inline void getDDTimeVector(Eigen::Ref<EigenTimeVectorType> ddtimeVec, const double tk) { ddtimeVec = Eigen::Map<EigenTimeVectorType>(SplineImplementation::ddtau(tk).data()); } template<typename Derived> static inline void getDDiffTimeVector(Eigen::MatrixBase<Derived> const & ddtimeVec, const double tk) { assert(ddtimeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && ddtimeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(ddtimeVec) = Eigen::Map<const EigenTimeVectorType>((SplineImplementation::dtau(tk)).data()); } template<typename Derived> static inline void addDDiffTimeVector(Eigen::MatrixBase<Derived> const & ddtimeVec, const double tk) { assert(ddtimeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && ddtimeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(ddtimeVec) += Eigen::Map<const EigenTimeVectorType>((SplineImplementation::ddtau(tk)).data()); } static inline void getTimeVectorAtZero(Eigen::Ref<EigenTimeVectorType> timeVec) { timeVec = Eigen::Map<const EigenTimeVectorType>((SplineImplementation::tauZero).data()); } template<typename Derived> static inline void getTimeVectorAtZero( Eigen::MatrixBase<Derived> const & timeVec) { assert(timeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && timeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(timeVec) = Eigen::Map<const EigenTimeVectorType>((SplineImplementation::tauZero).data()); } template<typename Derived> static inline void addTimeVectorAtZero( Eigen::MatrixBase<Derived> const & timeVec) { assert(timeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && timeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(timeVec) += Eigen::Map<const EigenTimeVectorType>((SplineImplementation::tauZero).data()); } static inline void getDTimeVectorAtZero(Eigen::Ref<EigenTimeVectorType> dtimeVec) { dtimeVec = Eigen::Map<const EigenTimeVectorType>((SplineImplementation::dtauZero).data()); } template<typename Derived> static inline void getDiffTimeVectorAtZero( Eigen::MatrixBase<Derived> const & dtimeVec) { assert(dtimeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && dtimeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(dtimeVec) = Eigen::Map<const EigenTimeVectorType>((SplineImplementation::dtauZero).data()); } template<typename Derived> static inline void addDiffTimeVectorAtZero( Eigen::MatrixBase<Derived> const & dtimeVec) { assert(dtimeVec.rows() == EigenTimeVectorType::RowsAtCompileTime && dtimeVec.cols() == EigenTimeVectorType::ColsAtCompileTime); const_cast<Eigen::MatrixBase<Derived>&>(dtimeVec) += Eigen::Map<const EigenTimeVectorType>((SplineImplementation::dtauZero).data()); }
random
[ { "content": "class LocalSupport2CoefficientManagerTest : public ::testing::Test {\n\n protected:\n\n\n\n typedef Eigen::Matrix<double,3,1> Coefficient;\n\n typedef LocalSupport2CoefficientManager<Coefficient>::CoefficientIter CoefficientIter;\n\n\n\n virtual void SetUp() {\n\n N = 50;\n\n for(size_t i = 0; i < N; ++i) {\n\n coefficients.push_back(Coefficient::Random(3));\n\n // Make sure there are some negative times in there\n\n times.push_back(i * 1000 - 3250);\n\n keys1.push_back( manager1.insertCoefficient(times[i], coefficients[i]) );\n\n }\n\n manager2.insertCoefficients(times, coefficients, &keys2);\n\n\n\n ASSERT_EQ(N, manager1.size());\n\n ASSERT_EQ(N, manager2.size());\n\n\n\n ASSERT_EQ(N, keys1.size());\n", "file_path": "curves/test/test_LocalSupport2CoefficientManager.cpp", "rank": 0, "score": 120112.28323791607 }, { "content": "// Curves over SE3 inherit the interface from Curve and CurveBase and define specific\n\n// methods to support physical interpretations of temporal derivatives.\n\n//\n\n// For the purposes of these uses, the curve is defined between Frame a and Frame b\n\n// such that evaluate() returns \\f$ \\mathbf{T}_{a,b} \\f$, the transformation that takes\n\n// points from Frame b to Frame a.\n\n//\n\nclass SE3Curve : public Curve<SE3Config> {\n\n public:\n\n SE3Curve();\n\n virtual ~SE3Curve();\n\n\n\n typedef Curve<SE3Config> Parent;\n\n typedef Parent::ValueType ValueType;\n\n typedef Parent::DerivativeType DerivativeType;\n\n\n\n /// \\brief Evaluate the angular velocity of Frame b as seen from Frame a, expressed in Frame a.\n\n virtual Eigen::Vector3d evaluateAngularVelocityA(Time time) = 0;\n\n\n\n /// \\brief Evaluate the angular velocity of Frame a as seen from Frame b, expressed in Frame b.\n\n virtual Eigen::Vector3d evaluateAngularVelocityB(Time time) = 0;\n\n\n\n /// \\brief Evaluate the velocity of Frame b as seen from Frame a, expressed in Frame a.\n\n virtual Eigen::Vector3d evaluateLinearVelocityA(Time time) = 0;\n\n\n\n /// \\brief Evaluate the velocity of Frame a as seen from Frame b, expressed in Frame b.\n\n virtual Eigen::Vector3d evaluateLinearVelocityB(Time time) = 0;\n", "file_path": "curves/include/curves/SE3Curve.hpp", "rank": 1, "score": 118031.74705320486 }, { "content": "// Curves over SE2 inherit the interface from Curve and CurveBase and define specific\n\n// methods to support physical interpretations of temporal derivatives.\n\n//\n\n// For the purposes of these uses, the curve is defined between Frame a and Frame b\n\n// such that evaluate() returns \\f$ \\mathbf{T}_{a,b} \\f$, the transformation that takes\n\n// points from Frame b to Frame a.\n\n//\n\nclass SE2Curve : public Curve<SE2Config> {\n\n public:\n\n SE2Curve();\n\n virtual ~SE2Curve();\n\n\n\n typedef Curve<SE2Config> Parent;\n\n typedef Parent::ValueType ValueType;\n\n typedef Parent::DerivativeType DerivativeType;\n\n\n\n};\n\n\n\n} // namespace curves\n\n\n\n#endif // SE2_CURVE_H_\n", "file_path": "curves/include/curves/SE2Curve.hpp", "rank": 2, "score": 118031.74705320486 }, { "content": "/// Implements a discrete SE3 curve class.\n\nclass DiscreteSE3Curve : public SE3Curve {\n\n friend class SE3CompositionCurve<DiscreteSE3Curve, DiscreteSE3Curve>;\n\n friend class SamplingPolicy;\n\n public:\n\n typedef ValueType Coefficient;\n\n typedef LocalSupport2CoefficientManager<Coefficient>::TimeToKeyCoefficientMap TimeToKeyCoefficientMap;\n\n typedef LocalSupport2CoefficientManager<Coefficient>::CoefficientIter CoefficientIter;\n\n\n\n DiscreteSE3Curve();\n\n virtual ~DiscreteSE3Curve();\n\n\n\n /// Print the value of the coefficient, for debugging and unit tests\n\n virtual void print(const std::string& str = \"\") const;\n\n\n\n /// The first valid time for the curve.\n\n virtual Time getMinTime() const;\n\n\n\n /// The one past the last valid time for the curve.\n\n virtual Time getMaxTime() const;\n\n\n", "file_path": "curves/include/curves/DiscreteSE3Curve.hpp", "rank": 3, "score": 118006.23389412736 }, { "content": "/// Implements the Slerp (Spherical linear interpolation) curve class.\n\n/// The Slerp interpolation function is defined as, with the respective Jacobians regarding A and B:\n\n/// \\f[ T = A(A^{-1}B)^{\\alpha} \\f]\n\nclass SlerpSE2Curve : public SE2Curve {\n\n //friend class SE2CompositionCurve<SlerpSE2Curve, SlerpSE2Curve>;\n\n //friend class SE2CompositionCurve<SlerpSE2Curve, CubicHermiteSE2Curve>;\n\n friend class SamplingPolicy;\n\n public:\n\n typedef SE2Curve::ValueType ValueType;\n\n typedef SE2Curve::DerivativeType DerivativeType;\n\n typedef ValueType Coefficient;\n\n typedef LocalSupport2CoefficientManager<Coefficient>::TimeToKeyCoefficientMap TimeToKeyCoefficientMap;\n\n typedef LocalSupport2CoefficientManager<Coefficient>::CoefficientIter CoefficientIter;\n\n\n\n SlerpSE2Curve();\n\n virtual ~SlerpSE2Curve();\n\n\n\n /// Print the value of the coefficient, for debugging and unit tests\n\n virtual void print(const std::string& str = \"\") const;\n\n\n\n /// The first valid time for the curve.\n\n virtual Time getMinTime() const;\n\n\n", "file_path": "curves/include/curves/SlerpSE2Curve.hpp", "rank": 4, "score": 118005.26895314848 }, { "content": "/// Implements the Slerp (Spherical linear interpolation) curve class.\n\n/// The Slerp interpolation function is defined as, with the respective Jacobians regarding A and B:\n\n/// \\f[ T = A(A^{-1}B)^{\\alpha} \\f]\n\nclass SlerpSE3Curve : public SE3Curve {\n\n friend class SE3CompositionCurve<SlerpSE3Curve, SlerpSE3Curve>;\n\n friend class SE3CompositionCurve<SlerpSE3Curve, CubicHermiteSE3Curve>;\n\n friend class SamplingPolicy;\n\n public:\n\n typedef SE3Curve::ValueType ValueType;\n\n typedef SE3Curve::DerivativeType DerivativeType;\n\n typedef ValueType Coefficient;\n\n typedef LocalSupport2CoefficientManager<Coefficient>::TimeToKeyCoefficientMap TimeToKeyCoefficientMap;\n\n typedef LocalSupport2CoefficientManager<Coefficient>::CoefficientIter CoefficientIter;\n\n\n\n SlerpSE3Curve();\n\n virtual ~SlerpSE3Curve();\n\n\n\n /// Print the value of the coefficient, for debugging and unit tests\n\n virtual void print(const std::string& str = \"\") const;\n\n\n\n /// The first valid time for the curve.\n\n virtual Time getMinTime() const;\n\n\n", "file_path": "curves/include/curves/SlerpSE3Curve.hpp", "rank": 5, "score": 118005.26895314846 }, { "content": "class SE3CompositionCurve : public SE3Curve {\n\n\n\n private:\n\n C1 baseCurve_;\n\n C2 correctionCurve_;\n\n\n\n public:\n\n typedef SE3Curve::ValueType ValueType;\n\n typedef SE3Curve::DerivativeType DerivativeType;\n\n\n\n SE3CompositionCurve();\n\n ~SE3CompositionCurve();\n\n\n\n /// \\brief Print the value of the base and corrections curves coefficients\n\n virtual void print(const std::string& str = \"\") const;\n\n\n\n /// \\brief Save curves data as .csv file\n\n void saveCurves(const std::string& filename) const;\n\n\n\n /// \\brief Returns the first valid time for the curve.\n", "file_path": "curves/include/curves/SE3CompositionCurve.hpp", "rank": 6, "score": 117998.30782699796 }, { "content": "class LocalSupport2CoefficientManager {\n\n public:\n\n typedef Coefficient CoefficientType;\n\n\n\n struct KeyCoefficient {\n\n Key key;\n\n CoefficientType coefficient;\n\n\n\n KeyCoefficient(const Key key, const Coefficient& coefficient) :\n\n key(key), coefficient(coefficient) {}\n\n\n\n KeyCoefficient() {}\n\n\n\n bool equals(const KeyCoefficient& other) const {\n\n //todo Note: here we assume that == operator is implemented by the coefficient.\n\n //Could not use gtsam traits as the gtsam namespace is not visible to this class.\n\n //Is this correct?\n\n return key == other.key && coefficient == other.coefficient;\n\n }\n\n\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager.hpp", "rank": 7, "score": 116171.17315995273 }, { "content": "/// Implements a discrete SE3 curve class.\n\nclass SemiDiscreteSE3Curve : public SE3Curve {\n\n friend class SE3CompositionCurve<SemiDiscreteSE3Curve, SemiDiscreteSE3Curve>;\n\n friend class SamplingPolicy;\n\n public:\n\n typedef ValueType Coefficient;\n\n typedef LocalSupport2CoefficientManager<Coefficient>::TimeToKeyCoefficientMap TimeToKeyCoefficientMap;\n\n typedef LocalSupport2CoefficientManager<Coefficient>::CoefficientIter CoefficientIter;\n\n\n\n SemiDiscreteSE3Curve();\n\n virtual ~SemiDiscreteSE3Curve();\n\n\n\n /// Print the value of the coefficient, for debugging and unit tests\n\n virtual void print(const std::string& str = \"\") const;\n\n\n\n /// The first valid time for the curve.\n\n virtual Time getMinTime() const;\n\n\n\n /// The one past the last valid time for the curve.\n\n virtual Time getMaxTime() const;\n\n\n", "file_path": "curves/include/curves/SemiDiscreteSE3Curve.hpp", "rank": 8, "score": 113549.51650919586 }, { "content": "class CubicHermiteSE3Curve : public SE3Curve {\n\n\n\n friend class SamplingPolicy;\n\n public:\n\n typedef kindr::HermiteTransformation<double> Coefficient;\n\n\n\n CubicHermiteSE3Curve();\n\n virtual ~CubicHermiteSE3Curve();\n\n\n\n /// Print the value of the coefficient, for debugging and unit tests\n\n virtual void print(const std::string& str = \"\") const;\n\n\n\n virtual bool writeEvalToFile(const std::string& filename, int nSamples) const;\n\n\n\n /// The first valid time for the curve.\n\n virtual Time getMinTime() const;\n\n\n\n /// The one past the last valid time for the curve.\n\n virtual Time getMaxTime() const;\n\n\n", "file_path": "curves/include/curves/CubicHermiteSE3Curve.hpp", "rank": 9, "score": 113541.59044206644 }, { "content": "class PolynomialSplineScalarCurve : public Curve<ScalarCurveConfig>\n\n{\n\n public:\n\n typedef Curve<ScalarCurveConfig> Parent;\n\n typedef typename Parent::ValueType ValueType;\n\n typedef typename Parent::DerivativeType DerivativeType;\n\n\n\n using SplineContainerType = SplineContainerType_;\n\n\n\n PolynomialSplineScalarCurve()\n\n : Parent(),\n\n container_(),\n\n minTime_(0.0)\n\n {\n\n }\n\n\n\n virtual ~PolynomialSplineScalarCurve() {\n\n\n\n }\n\n\n", "file_path": "curves/include/curves/PolynomialSplineScalarCurve.hpp", "rank": 10, "score": 107332.15275302087 }, { "content": "class VectorSpaceCurve : public Curve<VectorSpaceConfig<N> >\n\n{\n\n public:\n\n typedef Curve<VectorSpaceConfig<N> > Parent;\n\n typedef typename Parent::ValueType ValueType;\n\n typedef typename Parent::DerivativeType DerivativeType;\n\n\n\n VectorSpaceCurve() : dimension_(N) { }\n\n virtual ~VectorSpaceCurve() {}\n\n\n\n /// \\brief Get the dimension of this curve\n\n size_t dim() const {\n\n return N;\n\n }\n\n\n\n private:\n\n /// The dimension of the vector space.\n\n size_t dimension_;\n\n};\n\n\n\n} // namespace\n", "file_path": "curves/include/curves/VectorSpaceCurve.hpp", "rank": 11, "score": 107050.31292066893 }, { "content": "class LinearInterpolationVectorSpaceCurve : public VectorSpaceCurve<N> {\n\n public:\n\n typedef VectorSpaceCurve<N> Parent;\n\n typedef typename Parent::ValueType ValueType;\n\n typedef typename Parent::DerivativeType DerivativeType;\n\n\n\n /// \\brief Initialize with the dimension of the vector space\n\n LinearInterpolationVectorSpaceCurve();\n\n virtual ~LinearInterpolationVectorSpaceCurve();\n\n\n\n /// Print the value of the coefficient, for debugging and unit tests\n\n virtual void print(const std::string& str = \"\") const;\n\n\n\n /// The first valid time for the curve.\n\n virtual Time getMinTime() const;\n\n\n\n /// The one past the last valid time for the curve.\n\n virtual Time getMaxTime() const;\n\n\n\n /// Extend the curve so that it can be evaluated at these times.\n", "file_path": "curves/include/curves/LinearInterpolationVectorSpaceCurve.hpp", "rank": 12, "score": 103489.6263051943 }, { "content": "class PolynomialSplineVectorSpaceCurve : public VectorSpaceCurve<N>\n\n{\n\n public:\n\n typedef VectorSpaceCurve<N> Parent;\n\n typedef typename Parent::ValueType ValueType;\n\n typedef typename Parent::DerivativeType DerivativeType;\n\n\n\n PolynomialSplineVectorSpaceCurve()\n\n : VectorSpaceCurve<N>(),\n\n minTime_(0)\n\n {\n\n containers_.resize(N);\n\n }\n\n\n\n virtual ~PolynomialSplineVectorSpaceCurve()\n\n {\n\n }\n\n\n\n virtual void print(const std::string& /*str*/) const\n\n {\n", "file_path": "curves/include/curves/PolynomialSplineVectorSpaceCurve.hpp", "rank": 13, "score": 103489.6263051943 }, { "content": "class RosJointTrajectoryInterface : public PolynomialSplineQuinticScalarCurve\n\n{\n\n public:\n\n RosJointTrajectoryInterface();\n\n virtual ~RosJointTrajectoryInterface();\n\n\n\n /*!\n\n * Populate spline from a ROS joint trajectory message.\n\n * @param message the ROS trajectory message.\n\n * @param jointName the name of the joint to be copied.\n\n */\n\n bool fromMessage(const trajectory_msgs::JointTrajectory& message, const std::string& jointName);\n\n};\n\n\n\n} // namespace\n", "file_path": "curves_ros/include/curves_ros/RosJointTrajectoryInterface.hpp", "rank": 14, "score": 103468.2710886048 }, { "content": "class RosMultiDOFJointTrajectoryInterface : public CubicHermiteSE3Curve\n\n{\n\n public:\n\n RosMultiDOFJointTrajectoryInterface();\n\n virtual ~RosMultiDOFJointTrajectoryInterface();\n\n\n\n /*!\n\n * Populate spline from a ROS multi DOF joint trajectory message.\n\n * @param message the ROS multi DOF trajectory message.\n\n * @param jointName the name of the joint to be copied.\n\n */\n\n virtual bool fromMessage(const trajectory_msgs::MultiDOFJointTrajectory& message,\n\n const std::string& jointName);\n\n};\n\n\n\n} // namespace\n", "file_path": "curves_ros/include/curves_ros/RosMultiDOFJointTrajectoryInterface.hpp", "rank": 15, "score": 98785.289546568 }, { "content": "class RosMultiDOFJointTrajectoryTranslationInterface : public PolynomialSplineQuinticVector3Curve\n\n{\n\n public:\n\n RosMultiDOFJointTrajectoryTranslationInterface();\n\n virtual ~RosMultiDOFJointTrajectoryTranslationInterface();\n\n\n\n /*!\n\n * Populate spline from a ROS multi DOF joint trajectory message.\n\n * Considers only the translation.\n\n * @param message the ROS multi DOF trajectory message.\n\n * @param jointName the name of the joint to be copied.\n\n */\n\n virtual bool fromMessage(const trajectory_msgs::MultiDOFJointTrajectory& message,\n\n const std::string& jointName);\n\n};\n\n\n\n} // namespace\n", "file_path": "curves_ros/include/curves_ros/RosMultiDOFJointTrajectoryTranslationInterface.hpp", "rank": 16, "score": 94667.5472128216 }, { "content": "class TestCurvesRos : public ::testing::Test {\n\n void SetUp() override {\n\n const std::map<std::string, std::string> remappings{};\n\n ros::init(remappings, \"curves_ros_test\");\n\n ros::start();\n\n }\n\n\n\n void TearDown() override { ros::shutdown(); }\n\n};\n\n\n\nTEST_F(TestCurvesRos, DummyTest) { // NOLINT\n\n ASSERT_TRUE(true);\n\n}\n", "file_path": "curves_ros/test/TestCurvesRos.cpp", "rank": 17, "score": 89888.29943817931 }, { "content": "class Curve\n\n{\n\n public:\n\n\n\n /// The value type of the curve.\n\n typedef typename CurveConfig::ValueType ValueType;\n\n\n\n /// The curve's derivative type.\n\n typedef typename CurveConfig::DerivativeType DerivativeType;\n\n\n\n Curve() { }\n\n virtual ~Curve() { }\n\n\n\n ///\\defgroup Info\n\n ///\\name Methods to get information about the curve.\n\n ///@{\n\n\n\n /// Print the value of the coefficient, for debugging and unit tests\n\n virtual void print(const std::string& str = \"\") const = 0;\n\n\n", "file_path": "curves/include/curves/Curve.hpp", "rank": 18, "score": 89487.90228046996 }, { "content": "class SamplingPolicy {\n\n\n\n protected:\n\n int measurementsSinceLastExtend_;\n\n int minimumMeasurements_;\n\n Time minSamplingPeriod_;\n\n Time lastExtend_;\n\n\n\n public:\n\n\n\n SamplingPolicy() :\n\n measurementsSinceLastExtend_(0),\n\n minimumMeasurements_(1),\n\n minSamplingPeriod_(0),\n\n lastExtend_(0) {}\n\n\n\n SamplingPolicy(int minimumMeasurements, Time minSamplingPeriod) :\n\n measurementsSinceLastExtend_(0),\n\n minimumMeasurements_(minimumMeasurements),\n\n minSamplingPeriod_(minSamplingPeriod),\n", "file_path": "curves/include/curves/SamplingPolicy.hpp", "rank": 20, "score": 84185.87249412855 }, { "content": "class KeyGenerator\n\n{\n\n public:\n\n\n\n static size_t getNextKey();\n\n\n\n};\n\n\n\n} // namespace curves\n", "file_path": "curves/include/curves/KeyGenerator.hpp", "rank": 21, "score": 84185.87249412856 }, { "content": "struct spline_rep<double, 1> {\n\n\n\n static constexpr unsigned int splineOrder = 1;\n\n static constexpr unsigned int numCoefficients = splineOrder+1;\n\n\n\n using TimeVectorType = std::array<double, numCoefficients>;\n\n using SplineCoefficients = std::array<double, numCoefficients>;\n\n\n\n static inline TimeVectorType tau(double tk) noexcept {\n\n return { tk, 1.0 };\n\n }\n\n\n\n static inline TimeVectorType dtau(double /*tk*/) noexcept {\n\n return { 1.0, 0.0 };\n\n }\n\n\n\n static inline TimeVectorType ddtau(double /*tk*/) noexcept {\n\n return { 0.0, 0.0 };\n\n }\n\n\n", "file_path": "curves/include/curves/polynomial_splines_traits.hpp", "rank": 22, "score": 82102.0047122996 }, { "content": "class SE3CurveFactory {\n\n\n\n public:\n\n\n\n SE3CurveFactory() {}\n\n ~SE3CurveFactory() {}\n\n\n\n static std::shared_ptr<SE3Curve> create_curve(const std::string& curveType);\n\n\n\n}; // class SE3CurveFactory\n\n} // namespace ctsm\n\n\n\n#endif // SE3_CURVE_FACTORY_HPP_\n", "file_path": "curves/include/curves/SE3CurveFactory.hpp", "rank": 23, "score": 81102.02457021605 }, { "content": "class PolynomialSplineContainer {\n\n public:\n\n using SplineType = PolynomialSpline<splineOrder_>;\n\n using SplineList = std::vector<SplineType>;\n\n\n\n EIGEN_MAKE_ALIGNED_OPERATOR_NEW\n\n\n\n PolynomialSplineContainer();\n\n virtual ~PolynomialSplineContainer() = default;\n\n\n\n //! Get a pointer to the spline with a given index.\n\n SplineType* getSpline(int splineIndex);\n\n\n\n //! Get a reference to the spline with a given index.\n\n const SplineList& getSplines() const;\n\n\n\n //! Update the spline internal time by dt [seconds].\n\n bool advance(double dt);\n\n\n\n //! Jump to a specific point in time domain.\n", "file_path": "curves/include/curves/PolynomialSplineContainer.hpp", "rank": 24, "score": 80198.94302978227 }, { "content": "class CubicHermiteE3Curve {\n\n public:\n\n typedef HermiteE3Knot Coefficient;\n\n typedef LocalSupport2CoefficientManager<Coefficient>::CoefficientIter CoefficientIter;\n\n typedef HermiteE3Knot::Position ValueType;\n\n typedef HermiteE3Knot::Velocity DerivativeType;\n\n typedef HermiteE3Knot::Acceleration Acceleration;\n\n public:\n\n CubicHermiteE3Curve();\n\n virtual ~CubicHermiteE3Curve();\n\n\n\n /// Print the value of the coefficient, for debugging and unit tests\n\n virtual void print(const std::string& str = \"\") const;\n\n\n\n virtual bool writeEvalToFile(const std::string& filename, int nSamples) const;\n\n\n\n /// The first valid time for the curve.\n\n virtual Time getMinTime() const;\n\n\n\n /// The one past the last valid time for the curve.\n", "file_path": "curves/include/curves/CubicHermiteE3Curve.hpp", "rank": 25, "score": 77614.34668527989 }, { "content": "/*\n\n * LocalSupport2CoefficientManager.hpp\n\n *\n\n * Created on: Oct 10, 2014\n\n * Author: Paul Furgale, Abel Gawel, Renaud Dube, Péter Fankhauser\n\n * Institute: ETH Zurich, Autonomous Systems Lab\n\n */\n\n\n\n#pragma once\n\n\n\n#include \"curves/Curve.hpp\"\n\n#include <Eigen/Core>\n\n#include <boost/unordered_map.hpp>\n\n#include <vector>\n\n#include <map>\n\n\n\nnamespace curves {\n\n\n\ntypedef size_t Key;\n\n\n\ntemplate <class Coefficient>\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager.hpp", "rank": 26, "score": 67155.17231821007 }, { "content": " }\n\n\n\n /// Check the internal consistency of the data structure\n\n /// If doExit is true, the function will call exit(0) at\n\n /// the end. This is useful for gtest death tests\n\n void checkInternalConsistency(bool doExit = false) const;\n\n\n\n private:\n\n /// Key to coefficient mapping\n\n boost::unordered_map<Key, CoefficientIter> keyToCoefficient_;\n\n\n\n /// Time to coefficient mapping\n\n TimeToKeyCoefficientMap timeToCoefficient_;\n\n\n\n bool hasCoefficientAtTime(Time time, CoefficientIter *it, double tol = 0);\n\n\n\n};\n\n\n\n} // namespace\n\n\n\n#include \"LocalSupport2CoefficientManager-inl.hpp\"\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager.hpp", "rank": 27, "score": 67153.27754619645 }, { "content": " Time endTime,\n\n CoefficientMap* outCoefficients) const;\n\n\n\n /// \\brief Get all of the curve's coefficients.\n\n void getCoefficients(CoefficientMap* outCoefficients) const;\n\n\n\n /// \\brief Set coefficients.\n\n ///\n\n /// If any of these coefficients doen't exist, there is an error\n\n void updateCoefficients(const CoefficientMap& coefficients);\n\n\n\n /// \\brief return the number of coefficients\n\n size_t size() const;\n\n\n\n /// \\brief Check if the manager is empty.\n\n bool empty() const;\n\n\n\n /// \\brief clear the coefficients\n\n void clear();\n\n\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager.hpp", "rank": 28, "score": 67148.75761135033 }, { "content": " bool operator==(const KeyCoefficient& other) const {\n\n return this->equals(other);\n\n }\n\n };\n\n\n\n typedef std::map<Time, KeyCoefficient> TimeToKeyCoefficientMap;\n\n typedef typename TimeToKeyCoefficientMap::const_iterator CoefficientIter;\n\n /// Key/Coefficient pairs\n\n typedef boost::unordered_map<size_t, Coefficient> CoefficientMap;\n\n\n\n LocalSupport2CoefficientManager();\n\n virtual ~LocalSupport2CoefficientManager();\n\n\n\n /// Compare this Coefficient manager with another for equality.\n\n bool equals(const LocalSupport2CoefficientManager& other, double tol = 1e-9) const;\n\n\n\n /// Print the value of the coefficient, for debugging and unit tests\n\n void print(const std::string& str = \"\") const;\n\n\n\n /// Get all of the keys in this manager. This method clears the\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager.hpp", "rank": 29, "score": 67147.21613158275 }, { "content": " /// It is an error if the key does not exist.\n\n void removeCoefficientWithKey(Key key);\n\n\n\n /// \\brief Remove the coefficient at this time\n\n ///\n\n /// It is an error if there is no coefficient at this time.\n\n void removeCoefficientAtTime(Time time);\n\n\n\n /// \\brief return true if there is a coefficient at this time\n\n bool hasCoefficientAtTime(Time time) const;\n\n\n\n /// \\brief return true if there is a coefficient with this key\n\n bool hasCoefficientWithKey(Key key) const;\n\n\n\n /// \\brief set the coefficient associated with this key\n\n ///\n\n /// This function fails if there is no coefficient associated\n\n /// with this key.\n\n void updateCoefficientByKey(Key key, const Coefficient& coefficient);\n\n\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager.hpp", "rank": 30, "score": 67146.678067568 }, { "content": " ///\n\n /// If a coefficient with this time already exists, it is overwritten\n\n Key insertCoefficient(Time time, const Coefficient& coefficient);\n\n\n\n /// \\brief Insert coefficients. Optionally returns the keys for these coefficients.\n\n ///\n\n /// If outKeys is not NULL, this function will not check if\n\n /// it is empty; new keys will be appended to this vector.\n\n void insertCoefficients(const std::vector<Time>& times,\n\n const std::vector<Coefficient>& values,\n\n std::vector<Key>* outKeys = NULL);\n\n\n\n /// \\brief Efficient function for adding a coefficient at the end of the map\n\n void addCoefficientAtEnd(Time time, const Coefficient& coefficient, std::vector<Key>* outKeys = NULL);\n\n\n\n /// \\brief Modify a coefficient by specifying a new time and value\n\n void modifyCoefficient(typename TimeToKeyCoefficientMap::iterator it, Time time, const Coefficient& coefficient);\n\n\n\n /// \\brief Remove the coefficient with this key.\n\n ///\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager.hpp", "rank": 31, "score": 67144.9154526709 }, { "content": " /// \\brief set the coefficient associated with this key\n\n\n\n /// \\brief get the coefficient associated with this key\n\n Coefficient getCoefficientByKey(Key key) const;\n\n\n\n /// \\brief get the coefficient time associated with this key\n\n Time getCoefficientTimeByKey(Key key) const;\n\n\n\n /// \\brief Get the coefficients that are active at a certain time.\n\n ///\n\n /// This method can fail if the time is out of bounds. If it\n\n /// Succeeds, the elements of the pair are guaranteed to be filled\n\n /// nonnull.\n\n ///\n\n /// @returns true if it was successful\n\n bool getCoefficientsAt(Time time, CoefficientIter* outCoefficient0,\n\n CoefficientIter* outCoefficient1) const;\n\n\n\n /// \\brief Get the coefficients that are active within a range \\f$[t_s,t_e) \\f$.\n\n void getCoefficientsInRange(Time startTime,\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager.hpp", "rank": 32, "score": 67143.69486762956 }, { "content": " /// list of keys before filling it.\n\n void getKeys(std::vector<Key>* outKeys) const;\n\n\n\n /// Get all of the keys in this manager. The list is not cleared\n\n /// before pushing it to the container.\n\n void appendKeys(std::vector<Key>* outKeys) const;\n\n\n\n /// Get a sorted list of coefficient times\n\n void getTimes(std::vector<Time>* outTimes) const;\n\n\n\n /// Get a sorted list of coefficient times in a given time window\n\n void getTimesInWindow(std::vector<Time>* outTimes, Time begTime, Time endTime) const;\n\n\n\n /// Modify multiple coefficient values. Time is assumed to be ordered.\n\n void modifyCoefficientsValuesInBatch(const std::vector<Time>& times,\n\n const std::vector<Coefficient>& values);\n\n\n\n\n\n /// \\brief insert a coefficient at a time and return\n\n /// the key for the coefficient\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager.hpp", "rank": 33, "score": 67142.69142124265 }, { "content": " /// The first valid time for the curve.\n\n Time getMinTime() const;\n\n\n\n /// The one past the last valid time for the curve.\n\n Time getMaxTime() const;\n\n\n\n CoefficientIter coefficientBegin() const {\n\n return timeToCoefficient_.begin();\n\n }\n\n\n\n CoefficientIter coefficientEnd() const {\n\n return timeToCoefficient_.end();\n\n }\n\n\n\n typename TimeToKeyCoefficientMap::iterator coefficientBegin() {\n\n return timeToCoefficient_.begin();\n\n }\n\n\n\n typename TimeToKeyCoefficientMap::iterator coefficientEnd() {\n\n return timeToCoefficient_.end();\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager.hpp", "rank": 34, "score": 67142.06015669748 }, { "content": "struct SplineOptions {\n\n\n\n SplineOptions()\n\n : tf_(0.0),\n\n pos0_(0.0), posT_(0.0),\n\n vel0_(0.0), velT_(0.0),\n\n acc0_(0.0), accT_(0.0)\n\n {\n\n\n\n }\n\n\n\n constexpr SplineOptions(double tf, double pos0, double posT, double vel0,\n\n double velT, double acc0, double accT)\n\n : tf_(tf),\n\n pos0_(pos0), posT_(posT),\n\n vel0_(vel0), velT_(velT),\n\n acc0_(acc0), accT_(accT)\n\n {\n\n\n\n }\n", "file_path": "curves/include/curves/polynomial_splines_traits.hpp", "rank": 35, "score": 65593.8952424104 }, { "content": "/*\n\n * LocalSupport2CoefficientManager-inl.hpp\n\n *\n\n * Created on: Aug 17, 2014\n\n * Author: Paul Furgale, Abel Gawel, Renaud Dube, Péter Fankhauser\n\n * Institute: ETH Zurich, Autonomous Systems Lab\n\n */\n\n\n\n#include <curves/LocalSupport2CoefficientManager.hpp>\n\n\n\n#include <iostream>\n\n#include <curves/LocalSupport2CoefficientManager.hpp>\n\n#include <curves/KeyGenerator.hpp>\n\n#include <glog/logging.h>\n\n\n\nnamespace curves {\n\n\n\ntemplate <class Coefficient>\n\nLocalSupport2CoefficientManager<Coefficient>::LocalSupport2CoefficientManager() {\n\n}\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 36, "score": 65105.085640604906 }, { "content": "template <class Coefficient>\n\nKey LocalSupport2CoefficientManager<Coefficient>::size() const {\n\n return timeToCoefficient_.size();\n\n}\n\n\n\ntemplate <class Coefficient>\n\nbool LocalSupport2CoefficientManager<Coefficient>::empty() const {\n\n return timeToCoefficient_.empty();\n\n}\n\n\n\n/// \\brief clear the coefficients\n\ntemplate <class Coefficient>\n\nvoid LocalSupport2CoefficientManager<Coefficient>::clear() {\n\n keyToCoefficient_.clear();\n\n timeToCoefficient_.clear();\n\n}\n\n\n\ntemplate <class Coefficient>\n\nTime LocalSupport2CoefficientManager<Coefficient>::getMinTime() const {\n\n if (timeToCoefficient_.empty()) {\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 37, "score": 65101.65830517767 }, { "content": " } else {\n\n key = KeyGenerator::getNextKey();\n\n std::pair<Time, KeyCoefficient> iterator(time, KeyCoefficient(key, coefficient));\n\n std::pair<CoefficientIter, bool> success =\n\n timeToCoefficient_.insert(iterator);\n\n keyToCoefficient_[key] = success.first;\n\n }\n\n return key;\n\n}\n\n\n\n/// \\brief insert coefficients. Optionally returns the keys for these coefficients\n\ntemplate <class Coefficient>\n\nvoid LocalSupport2CoefficientManager<Coefficient>::insertCoefficients(const std::vector<Time>& times,\n\n const std::vector<Coefficient>& values,\n\n std::vector<Key>* outKeys) {\n\n CHECK_EQ(times.size(), values.size());\n\n for(Key i = 0; i < times.size(); ++i) {\n\n if (outKeys != NULL) {\n\n outKeys->push_back(insertCoefficient(times[i], values[i]));\n\n } else {\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 38, "score": 65100.98624635688 }, { "content": " return 0;\n\n }\n\n return timeToCoefficient_.begin()->first;\n\n}\n\n\n\ntemplate <class Coefficient>\n\nTime LocalSupport2CoefficientManager<Coefficient>::getMaxTime() const {\n\n if (timeToCoefficient_.empty()) {\n\n return 0;\n\n }\n\n return timeToCoefficient_.rbegin()->first;\n\n}\n\n\n\ntemplate <class Coefficient>\n\nvoid LocalSupport2CoefficientManager<Coefficient>::checkInternalConsistency(bool doExit) const {\n\n CHECK_EQ(keyToCoefficient_.size(), timeToCoefficient_.size());\n\n CoefficientIter it;\n\n typename boost::unordered_map<Key, CoefficientIter>::const_iterator itc;\n\n for(it = timeToCoefficient_.begin() ; it != timeToCoefficient_.end(); ++it) {\n\n Key key = it->second.key;\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 39, "score": 65100.37596667527 }, { "content": "/// \\brief return true if there is a coefficient with this key\n\ntemplate <class Coefficient>\n\nbool LocalSupport2CoefficientManager<Coefficient>::hasCoefficientWithKey(Key key) const {\n\n CoefficientIter it = keyToCoefficient_.find(key);\n\n return it != keyToCoefficient_.end();\n\n}\n\n\n\n/// \\brief set the coefficient associated with this key\n\n///\n\n/// This function fails if there is no coefficient associated\n\n/// with this key.\n\ntemplate <class Coefficient>\n\nvoid LocalSupport2CoefficientManager<Coefficient>::updateCoefficientByKey(Key key, const Coefficient& coefficient) {\n\n typename boost::unordered_map<Key, CoefficientIter>::iterator it = keyToCoefficient_.find(key);\n\n CHECK(it != keyToCoefficient_.end()) << \"Key \" << key << \" is not in the container.\";\n\n *const_cast<CoefficientType*>(&(it)->second->second.coefficient) = coefficient;\n\n}\n\n\n\n/// \\brief get the coefficient associated with this key\n\ntemplate <class Coefficient>\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 40, "score": 65100.202227579146 }, { "content": "}\n\n\n\ntemplate <class Coefficient>\n\nvoid LocalSupport2CoefficientManager<Coefficient>::removeCoefficientAtTime(Time time) {\n\n CHECK(this->hasCoefficientAtTime(time)) << \"No coefficient at that time.\";\n\n typename TimeToKeyCoefficientMap::iterator it1;\n\n typename boost::unordered_map<Key, CoefficientIter>::iterator it2;\n\n it1 = timeToCoefficient_.find(time);\n\n it2 = keyToCoefficient_.find(it1->second.key);\n\n timeToCoefficient_.erase(it1);\n\n keyToCoefficient_.erase(it2);\n\n}\n\n\n\n/// \\brief return true if there is a coefficient at this time\n\ntemplate <class Coefficient>\n\nbool LocalSupport2CoefficientManager<Coefficient>::hasCoefficientAtTime(Time time) const {\n\n CoefficientIter it = timeToCoefficient_.find(time);\n\n return it != timeToCoefficient_.end();\n\n}\n\n\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 41, "score": 65099.67696603297 }, { "content": " }\n\n CoefficientIter it;\n\n // set iterator to coefficient left or equal of start time\n\n it = timeToCoefficient_.upper_bound(startTime);\n\n it--;\n\n // iterate through coefficients\n\n for (; it != timeToCoefficient_.end() && it->first < endTime; ++it) {\n\n (*outCoefficients)[it->second->key] = it->second->coefficient;\n\n }\n\n if (it != timeToCoefficient_.end()) {\n\n (*outCoefficients)[it->second->key] = it->second->coefficient;\n\n }\n\n }\n\n}\n\n\n\n/// \\brief Get all of the curve's coefficients.\n\ntemplate <class Coefficient>\n\nvoid LocalSupport2CoefficientManager<Coefficient>::getCoefficients(CoefficientMap* outCoefficients) const {\n\n CHECK_NOTNULL(outCoefficients);\n\n CoefficientIter it;\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 42, "score": 65099.402286813216 }, { "content": " }\n\n}\n\n\n\ntemplate <class Coefficient>\n\nvoid LocalSupport2CoefficientManager<Coefficient>::addCoefficientAtEnd(Time time, const Coefficient& coefficient, std::vector<Key>* outKeys) {\n\n CHECK(time > getMaxTime()) << \"Time to add is not greater than curve max time\";\n\n\n\n Key key = KeyGenerator::getNextKey();\n\n\n\n // Insert the coefficient with a hint that it goes at the end\n\n CoefficientIter it = timeToCoefficient_.insert(--(timeToCoefficient_.end()),\n\n std::pair<Time, KeyCoefficient>(time, KeyCoefficient(key, coefficient)));\n\n\n\n keyToCoefficient_.insert(keyToCoefficient_.end(), std::pair<Key, CoefficientIter>(key,it));\n\n if (outKeys != NULL) {\n\n outKeys->push_back(key);\n\n }\n\n}\n\n\n\ntemplate <class Coefficient>\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 43, "score": 65099.259920778844 }, { "content": " *outCoefficient1 = it--;\n\n *outCoefficient0 = it;\n\n\n\n return true;\n\n}\n\n\n\n/// \\brief Get the coefficients that are active within a range \\f$[t_s,t_e) \\f$.\n\ntemplate <class Coefficient>\n\nvoid LocalSupport2CoefficientManager<Coefficient>::getCoefficientsInRange(\n\n Time startTime, Time endTime, CoefficientMap* outCoefficients) const {\n\n\n\n if (startTime <= endTime && startTime <= this->getMaxTime()\n\n && endTime >= this->getMinTime()) {\n\n // be forgiving if start time is lower than definition of curve\n\n if (startTime < this->getMinTime()) {\n\n startTime = this->getMinTime();\n\n }\n\n // be forgiving if end time is greater than definition of curve\n\n if (endTime > this->getMaxTime()) {\n\n endTime = this->getMaxTime();\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 44, "score": 65098.98069958636 }, { "content": " outKeys->clear();\n\n appendKeys(outKeys);\n\n}\n\n\n\ntemplate <class Coefficient>\n\nvoid LocalSupport2CoefficientManager<Coefficient>::appendKeys(std::vector<Key>* outKeys) const {\n\n CHECK_NOTNULL(outKeys);\n\n outKeys->reserve(outKeys->size() + keyToCoefficient_.size());\n\n CoefficientIter it;\n\n it = timeToCoefficient_.begin();\n\n for( ; it != timeToCoefficient_.end(); ++it) {\n\n outKeys->push_back(it->second.key);\n\n }\n\n}\n\n\n\ntemplate <class Coefficient>\n\nvoid LocalSupport2CoefficientManager<Coefficient>::getTimes(std::vector<Time>* outTimes) const {\n\n CHECK_NOTNULL(outTimes);\n\n outTimes->clear();\n\n outTimes->reserve(timeToCoefficient_.size());\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 45, "score": 65098.46807602826 }, { "content": " CoefficientIter it;\n\n it = timeToCoefficient_.begin();\n\n for( ; it != timeToCoefficient_.end(); ++it) {\n\n outTimes->push_back(it->first);\n\n }\n\n}\n\n\n\ntemplate <class Coefficient>\n\nvoid LocalSupport2CoefficientManager<Coefficient>::getTimesInWindow(std::vector<Time>* outTimes,\n\n Time begTime, Time endTime) const {\n\n CHECK_EQ(endTime, getMaxTime()) << \"Not implemented for window not at the end.\";\n\n CHECK(begTime >= getMinTime()) << \"Asked for times outside the curve.\";\n\n CHECK_NOTNULL(outTimes);\n\n\n\n outTimes->clear();\n\n CoefficientIter it = --(timeToCoefficient_.end());\n\n\n\n do {\n\n if (it->first >= begTime) {\n\n outTimes->push_back(it->first);\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 46, "score": 65098.46255973582 }, { "content": "\n\ntemplate <class Coefficient>\n\nLocalSupport2CoefficientManager<Coefficient>::~LocalSupport2CoefficientManager() {\n\n}\n\n\n\n/// Compare this Coefficient manager with another for equality.\n\ntemplate <class Coefficient>\n\nbool LocalSupport2CoefficientManager<Coefficient>::equals(const LocalSupport2CoefficientManager& other,\n\n double tol) const {\n\n bool equal = true;\n\n equal &= keyToCoefficient_.size() == other.keyToCoefficient_.size();\n\n equal &= timeToCoefficient_.size() == other.timeToCoefficient_.size();\n\n if (equal) {\n\n CoefficientIter it1, it2;\n\n it1 = keyToCoefficient_.begin();\n\n it2 = other.keyToCoefficient_.begin();\n\n for( ; it1 != keyToCoefficient_.end(); ++it1, ++it2) {\n\n equal &= it1->first == it2->first;\n\n equal &= it1->second.equals(it2->second);\n\n }\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 47, "score": 65098.41573354235 }, { "content": "void LocalSupport2CoefficientManager<Coefficient>::modifyCoefficient(typename TimeToKeyCoefficientMap::iterator it,\n\n Time time, const Coefficient& coefficient) {\n\n // This is used by slerp sampling policy.\n\n // In this case a new coefficient should be placed slightly later than the initial one.\n\n CoefficientIter newIt = timeToCoefficient_.insert(it,std::pair<Time, KeyCoefficient>(time, KeyCoefficient(it->second.key, coefficient)));\n\n // Update keyToCoefficient_\n\n keyToCoefficient_[it->second.key] = newIt;\n\n // Remove the old coefficient\n\n timeToCoefficient_.erase(it);\n\n}\n\n\n\ntemplate <class Coefficient>\n\nvoid LocalSupport2CoefficientManager<Coefficient>::removeCoefficientWithKey(Key key) {\n\n CHECK(hasCoefficientWithKey(key)) << \"No coefficient with that key.\";\n\n typename TimeToKeyCoefficientMap::iterator it1;\n\n typename boost::unordered_map<Key, CoefficientIter>::iterator it2;\n\n it2 = keyToCoefficient_.find(key);\n\n it1 = timeToCoefficient_.find(it1->second->first);\n\n timeToCoefficient_.erase(it1);\n\n keyToCoefficient_.erase(it2);\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 48, "score": 65098.369930517314 }, { "content": " }\n\n --it;\n\n } while (it->first >= begTime && it != timeToCoefficient_.begin());\n\n\n\n std::reverse(outTimes->begin(),outTimes->end());\n\n}\n\n\n\ntemplate <class Coefficient>\n\nvoid LocalSupport2CoefficientManager<Coefficient>::print(const std::string& str) const {\n\n // \\todo (Abel or Renaud)\n\n}\n\n\n\ntemplate <class Coefficient>\n\nKey LocalSupport2CoefficientManager<Coefficient>::insertCoefficient(Time time, const Coefficient& coefficient) {\n\n CoefficientIter it;\n\n Key key;\n\n\n\n if (this->hasCoefficientAtTime(time, &it)) {\n\n this->updateCoefficientByKey(it->second.key, coefficient);\n\n key = it->second.key;\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 49, "score": 65097.970769067055 }, { "content": " it = timeToCoefficient_.begin();\n\n for( ; it != timeToCoefficient_.end(); ++it) {\n\n (*outCoefficients)[it->second->key] = it->second->coefficient;\n\n }\n\n}\n\n\n\n/// \\brief Set coefficients.\n\n///\n\n/// If any of these coefficients doen't exist, there is an error\n\ntemplate <class Coefficient>\n\nvoid LocalSupport2CoefficientManager<Coefficient>::updateCoefficients(\n\n const CoefficientMap& coefficients) {\n\n typename CoefficientMap::const_iterator it;\n\n it = coefficients.cbegin();\n\n for (; it != coefficients.end(); ++it) {\n\n this->updateCoefficientByKey(it->first, it->second);\n\n }\n\n}\n\n\n\n/// \\brief return the number of coefficients\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 50, "score": 65097.5358203698 }, { "content": "Coefficient LocalSupport2CoefficientManager<Coefficient>::getCoefficientByKey(Key key) const {\n\n typename boost::unordered_map<Key, CoefficientIter>::const_iterator it = keyToCoefficient_.find(key);\n\n CHECK(it != keyToCoefficient_.end() ) << \"Key \" << key << \" is not in the container.\";\n\n return it->second->second.coefficient;\n\n}\n\ntemplate <class Coefficient>\n\nTime LocalSupport2CoefficientManager<Coefficient>::getCoefficientTimeByKey(Key key) const {\n\n typename boost::unordered_map<Key, CoefficientIter>::const_iterator it = keyToCoefficient_.find(key);\n\n CHECK(it != keyToCoefficient_.end()) << \"Key \" << key << \" is not in the container.\";\n\n return it->second->first;\n\n}\n\n\n\n\n\n/// \\brief Get the coefficients that are active at a certain time.\n\ntemplate <class Coefficient>\n\nbool LocalSupport2CoefficientManager<Coefficient>::getCoefficientsAt(Time time,\n\n CoefficientIter* outCoefficient0,\n\n CoefficientIter* outCoefficient1) const {\n\n CHECK_NOTNULL(outCoefficient0);\n\n CHECK_NOTNULL(outCoefficient1);\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 51, "score": 65096.927561644654 }, { "content": " insertCoefficient(times[i], values[i]);\n\n }\n\n }\n\n}\n\n\n\ntemplate <class Coefficient>\n\nvoid LocalSupport2CoefficientManager<Coefficient>::modifyCoefficientsValuesInBatch(const std::vector<Time>& times,\n\n const std::vector<Coefficient>& values) {\n\n CHECK_EQ(times.size(), values.size());\n\n // Get an iterator to the first coefficient\n\n typename TimeToKeyCoefficientMap::iterator it = timeToCoefficient_.end();\n\n\n\n do {\n\n --it;\n\n } while (it->first != times[0]);\n\n\n\n for (size_t i = 0; i < times.size(); ++i) {\n\n CHECK_EQ(it->first,times[i]);\n\n it->second.coefficient = values[i];\n\n ++it;\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 52, "score": 65096.92235974975 }, { "content": "\n\n CoefficientIter it3, it4;\n\n it3 = timeToCoefficient_.begin();\n\n it4 = other.timeToCoefficient_.begin();\n\n for( ; it3 != timeToCoefficient_.end(); ++it3, ++it4) {\n\n equal &= it3->first == it4->first;\n\n if (it3->second && it4->second) {\n\n equal &= it3->second->equals(*(it4->second));\n\n } else {\n\n equal &= it3->second == it4->second;\n\n }\n\n }\n\n\n\n }\n\n return equal;\n\n}\n\n\n\ntemplate <class Coefficient>\n\nvoid LocalSupport2CoefficientManager<Coefficient>::getKeys(std::vector<Key>* outKeys) const {\n\n CHECK_NOTNULL(outKeys);\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 53, "score": 65096.677118039865 }, { "content": " itc = keyToCoefficient_.find(key);\n\n CHECK_EQ(itc->first, itc->second->second.key);\n\n CHECK( itc != keyToCoefficient_.end() ) << \"Key \" << key << \" is not in the map\";\n\n // This is probably the important one.\n\n // Check that the itc->second iterator\n\n // points to the same object as it->second.\n\n // It is supposedly guaranteed by the\n\n // unordered map interface that these\n\n // pointers never get reallocated.\n\n //todo the implementation differs from the comment above. Here only the\n\n //equality between coefficients is checked\n\n CHECK_EQ(itc->second->second.coefficient, it->second.coefficient);\n\n }\n\n if (doExit) {\n\n exit(0);\n\n }\n\n}\n\n\n\ntemplate <class Coefficient>\n\nbool LocalSupport2CoefficientManager<Coefficient>::hasCoefficientAtTime(Time time, CoefficientIter *it, double tol) {\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 54, "score": 65096.39708353493 }, { "content": " for ((*it) = timeToCoefficient_.begin();\n\n (*it) != timeToCoefficient_.end(); ++(*it)) {\n\n if ((*it)->first >= time-tol) {\n\n if ((*it)->first <= time+tol) {\n\n return true;\n\n } else {\n\n return false;\n\n }\n\n }\n\n }\n\n return false;\n\n}\n\n\n\n} // namespace\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 55, "score": 65094.70795198142 }, { "content": " if( timeToCoefficient_.empty() ) {\n\n LOG(INFO) << \"No coefficients\";\n\n return false;\n\n }\n\n\n\n if(time < getMinTime() || time > getMaxTime()) {\n\n LOG(INFO) << \"time, \" << time << \", is out of bounds: [\" << getMinTime() << \", \" << getMaxTime() << \"]\";\n\n return false;\n\n }\n\n\n\n CoefficientIter it;\n\n it = timeToCoefficient_.upper_bound(time);\n\n\n\n // Check for edge cases\n\n if (it == timeToCoefficient_.end()) {\n\n --it;\n\n } else if (it == timeToCoefficient_.begin()) {\n\n ++it;\n\n }\n\n\n", "file_path": "curves/include/curves/LocalSupport2CoefficientManager-inl.hpp", "rank": 56, "score": 65091.25760359266 }, { "content": "struct spline_rep<double, 4> {\n\n\n\n static constexpr unsigned int splineOrder = 4;\n\n static constexpr unsigned int numCoefficients = splineOrder+1;\n\n\n\n using TimeVectorType = std::array<double, numCoefficients>;\n\n using SplineCoefficients = std::array<double, numCoefficients>;\n\n\n\n static inline TimeVectorType tau(double tk) noexcept {\n\n return { boost::math::pow<4>(tk), boost::math::pow<3>(tk), boost::math::pow<2>(tk), tk, 1.0};\n\n }\n\n\n\n static inline TimeVectorType dtau(double tk) noexcept {\n\n return { 4.0*boost::math::pow<3>(tk), 3.0*boost::math::pow<2>(tk), 2.0*tk, 1.0, 0.0};\n\n }\n\n\n\n static inline TimeVectorType ddtau(double tk) noexcept {\n\n return { 12.0*boost::math::pow<2>(tk), 6.0*tk, 2.0, 0.0, 0.0};\n\n }\n\n\n", "file_path": "curves/include/curves/polynomial_splines_traits.hpp", "rank": 57, "score": 63607.13533572607 }, { "content": "struct spline_rep<double, 2> {\n\n\n\n static constexpr unsigned int splineOrder = 2;\n\n static constexpr unsigned int numCoefficients = splineOrder+1;\n\n\n\n using TimeVectorType = std::array<double, numCoefficients>;\n\n using SplineCoefficients = std::array<double, numCoefficients>;\n\n\n\n static inline TimeVectorType tau(double tk) noexcept {\n\n return { boost::math::pow<2>(tk), tk, 1.0 };\n\n }\n\n\n\n static inline TimeVectorType dtau(double tk) noexcept {\n\n return { 2.0*tk, 1.0, 0.0 };\n\n }\n\n\n\n static inline TimeVectorType ddtau(double /*tk*/) noexcept {\n\n return { 2.0, 0.0, 0.0 };\n\n }\n\n\n", "file_path": "curves/include/curves/polynomial_splines_traits.hpp", "rank": 58, "score": 63607.13533572607 }, { "content": "struct spline_rep<double, 3> {\n\n\n\n static constexpr unsigned int splineOrder = 3;\n\n static constexpr unsigned int numCoefficients = splineOrder+1;\n\n\n\n using TimeVectorType = std::array<double, numCoefficients>;\n\n using SplineCoefficients = std::array<double, numCoefficients>;\n\n\n\n static inline TimeVectorType tau(double tk) noexcept {\n\n return { boost::math::pow<3>(tk), boost::math::pow<2>(tk), tk, 1.0 };\n\n }\n\n\n\n static inline TimeVectorType dtau(double tk) noexcept {\n\n return { 3.0*boost::math::pow<2>(tk), 2.0*tk, 1.0, 0.0 };\n\n }\n\n\n\n static inline TimeVectorType ddtau(double tk) noexcept {\n\n return { 6.0*tk, 2.0, 0.0, 0.0 };\n\n }\n\n\n", "file_path": "curves/include/curves/polynomial_splines_traits.hpp", "rank": 59, "score": 63607.13533572607 }, { "content": "struct spline_rep<double, 5> {\n\n\n\n static constexpr unsigned int splineOrder = 5;\n\n static constexpr unsigned int numCoefficients = splineOrder+1;\n\n\n\n using TimeVectorType = std::array<double, numCoefficients>;\n\n using SplineCoefficients = std::array<double, numCoefficients>;\n\n\n\n static inline TimeVectorType tau(double tk) noexcept {\n\n return { boost::math::pow<5>(tk), boost::math::pow<4>(tk), boost::math::pow<3>(tk),\n\n boost::math::pow<2>(tk), tk, 1.0};\n\n }\n\n\n\n static inline TimeVectorType dtau(double tk) noexcept {\n\n return { 5.0*boost::math::pow<4>(tk), 4.0*boost::math::pow<3>(tk), 3.0*boost::math::pow<2>(tk),\n\n 2.0*tk, 1.0, 0.0};\n\n }\n\n\n\n static inline TimeVectorType ddtau(double tk) noexcept {\n\n return { 20.0*boost::math::pow<3>(tk), 12.0*boost::math::pow<2>(tk), 6.0*tk,\n", "file_path": "curves/include/curves/polynomial_splines_traits.hpp", "rank": 60, "score": 63607.13533572607 }, { "content": "/*\n\n * @file test_SE3Coefficient.cpp\n\n * @date Oct 10, 2014\n\n * @author Mike Bosse\n\n */\n\n\n\n#include <gtest/gtest.h>\n\n#include <curves/Coefficient.hpp>\n\n#include <curves/SE3CoefficientImplementation.hpp>\n\n#include \"kindr/minimal/quat-transformation.h\"\n\n\n\ntypedef kindr::minimal::QuatTransformationTemplate<double> SE3;\n\ntypedef SE3::Rotation SO3;\n\ntypedef Eigen::Matrix4d Matrix4d;\n\n\n\n\n\nTEST(CurvesTestSuite, testSE3CoefficientDefaultConstructor) {\n\n using namespace curves;\n\n CoefficientImplementation::Ptr impl(new SE3CoefficientImplementation);\n\n Coefficient c1(impl);\n", "file_path": "curves/test/test_SE3Coefficient.cpp", "rank": 61, "score": 39440.70984009931 }, { "content": " ASSERT_EQ(val[i], c1[i]) << \"Difference at index \" << i;\n\n ASSERT_EQ(val[i], c2[i]) << \"Difference at index \" << i;\n\n ASSERT_EQ(val[i], c3[i]) << \"Difference at index \" << i;\n\n }\n\n\n\n}\n\n\n\n\n\nTEST(CurvesTestSuite, testSE3CoefficientRetractAndLocalCoord) {\n\n using namespace curves;\n\n for (int iter = 0; iter < 10000; ++iter) {\n\n SE3 poseA(SO3(SO3::Vector3::Random().eval()),SE3::Position::Random().eval());\n\n SE3 poseB(SO3(SO3::Vector3::Random().eval()),SE3::Position::Random().eval());\n\n\n\n SE3CoefficientImplementation::Ptr impl(new SE3CoefficientImplementation);\n\n Eigen::VectorXd val(7);\n\n\n\n boost::dynamic_pointer_cast<SE3CoefficientImplementation>(impl)->makeValue(poseA.getTransformationMatrix(),&val);\n\n Coefficient Ca(impl,val);\n\n\n", "file_path": "curves/test/test_SE3Coefficient.cpp", "rank": 62, "score": 39431.14189132739 }, { "content": " ASSERT_EQ(6u, c1.dim()); \n\n ASSERT_EQ(7u, c1.ambientDim());\n\n\n\n Coefficient c2;\n\n c2 = c1;\n\n ASSERT_EQ(6u, c2.dim()); \n\n ASSERT_EQ(7u, c2.ambientDim());\n\n\n\n Coefficient c3(c1);\n\n ASSERT_EQ(6u, c3.dim()); \n\n ASSERT_EQ(7u, c3.ambientDim());\n\n\n\n}\n\n\n\nTEST(CurvesTestSuite, testSE3CoefficientCopyConstructor) {\n\n using namespace curves;\n\n SE3 pose(SO3(SO3::Vector3::Random().eval()),SE3::Position::Random().eval());\n\n \n\n Matrix4d mat = pose.getTransformationMatrix();\n\n\n", "file_path": "curves/test/test_SE3Coefficient.cpp", "rank": 63, "score": 39429.72025186378 }, { "content": " CoefficientImplementation::Ptr impl(new SE3CoefficientImplementation);\n\n\n\n Eigen::VectorXd val(7);\n\n boost::dynamic_pointer_cast<SE3CoefficientImplementation>(impl)->makeValue(mat,&val);\n\n Coefficient c1(impl,val);\n\n\n\n ASSERT_EQ(6u, c1.dim()); \n\n ASSERT_EQ(7u, c1.ambientDim());\n\n\n\n Coefficient c2;\n\n c2 = c1;\n\n ASSERT_EQ(6u, c2.dim()); \n\n ASSERT_EQ(7u, c2.ambientDim());\n\n\n\n Coefficient c3(c1);\n\n ASSERT_EQ(6u, c3.dim()); \n\n ASSERT_EQ(7u, c3.ambientDim());\n\n\n\n // \\todo PTF Replace with Eigen assert macros from https://github.com/ethz-asl/eigen_checks\n\n for(unsigned i = 0; i < 7u; ++i) {\n", "file_path": "curves/test/test_SE3Coefficient.cpp", "rank": 64, "score": 39424.43164407783 }, { "content": " boost::dynamic_pointer_cast<SE3CoefficientImplementation>(impl)->makeValue(poseB.getTransformationMatrix(),&val);\n\n Coefficient Cb(impl,val);\n\n\n\n Eigen::VectorXd delta;\n\n delta = Ca.localCoordinates(Cb);\n\n\n\n EXPECT_EQ(6u,delta.size()) << \"local coordinates should be 6 dof.\";\n\n\n\n Coefficient Cc = Ca.retract(delta);\n\n ASSERT_EQ(6u, Cc.dim()) << \"dim should be 6\"; \n\n ASSERT_EQ(7u, Cc.ambientDim()) << \"ambient dim should be 7\";\n\n\n\n EXPECT_TRUE(Cc.equals(Cb)) << \"local coordinates and retract are not compatible at iter \" << iter;\n\n }\n\n}\n", "file_path": "curves/test/test_SE3Coefficient.cpp", "rank": 65, "score": 39421.41843117888 }, { "content": "\n\n /// \\brief Clear all the curve coefficients\n\n virtual void clear() = 0;\n\n\n\n /// \\brief Perform a rigid transformation on the left side of the curve\n\n virtual void transformCurve(const ValueType T) = 0;\n\n};\n\n\n\n} // namespace\n", "file_path": "curves/include/curves/Curve.hpp", "rank": 66, "score": 37990.367550377734 }, { "content": "/*\n\n * Curve.hpp\n\n *\n\n * Created on: Mar 5, 2015\n\n * Author: Paul Furgale, Abel Gawel, Renaud Dube, Péter Fankhauser\n\n * Institute: ETH Zurich, Autonomous Systems Lab\n\n */\n\n\n\n#pragma once\n\n\n\n#include <string>\n\n#include <vector>\n\n\n\nnamespace curves {\n\n\n\ntypedef double Time;\n\ntypedef size_t Key;\n\n\n\ntemplate<typename CurveConfig>\n", "file_path": "curves/include/curves/Curve.hpp", "rank": 67, "score": 37988.30386328787 }, { "content": " /// \\brief The dimension of the underlying manifold\n\n //size_t dim() const; // get this form the curve's value type\n\n\n\n /// The first valid time of the curve.\n\n virtual Time getMinTime() const = 0;\n\n\n\n /// The one past the last valid time for the curve.\n\n virtual Time getMaxTime() const = 0;\n\n ///@}\n\n\n\n /// \\name Methods to evaluate the curve\n\n ///@{\n\n\n\n /// Evaluate the ambient space of the curve.\n\n virtual bool evaluate(ValueType& value, Time time) const = 0;\n\n\n\n// /// Evaluate the curve derivatives.\n\n virtual bool evaluateDerivative(DerivativeType& derivative, Time time, unsigned derivativeOrder) const = 0;\n\n\n\n ///@}\n", "file_path": "curves/include/curves/Curve.hpp", "rank": 68, "score": 37985.66374577091 }, { "content": "\n\n /// \\name Methods to fit the curve based on data.\n\n ///@{\n\n\n\n /// Extend the curve so that it can be evaluated at these times.\n\n /// Try to make the curve fit to the values.\n\n /// Underneath the curve should have some default policy for fitting.\n\n virtual void extend(const std::vector<Time>& times,\n\n const std::vector<ValueType>& values,\n\n std::vector<Key>* outKeys = NULL) = 0;\n\n\n\n /// \\brief Fit a new curve to these data points.\n\n ///\n\n /// The existing curve will be cleared.\n\n /// Underneath the curve should have some default policy for fitting.\n\n virtual void fitCurve(const std::vector<Time>& times,\n\n const std::vector<ValueType>& values,\n\n std::vector<Key>* outKeys = NULL) = 0;\n\n\n\n ///@}\n", "file_path": "curves/include/curves/Curve.hpp", "rank": 69, "score": 37981.79530123913 }, { "content": "/*\n\n * @file helpers.hpp\n\n * @date Oct 17, 2014\n\n * @author Sean Andersson, Peter Fankhauser\n\n */\n\n\n\n#pragma once\n\n\n\n#include <stdlib.h>\n\n#include <vector>\n\n#include <iostream>\n\n\n\n#include <Eigen/Core>\n\n\n\n#include \"curves/Curve.hpp\"\n\n\n\nnamespace curves {\n\n\n\ntemplate <typename T>\n\nstd::string toString(const T& t);\n", "file_path": "curves/include/curves/helpers.hpp", "rank": 70, "score": 37521.24472299959 }, { "content": "\n\n/// \\brief Helper function to read CSV files into 'matrix' of strings\n\nstd::vector<std::vector<std::string> > loadCSV(std::string fileName);\n\n\n\n/// \\brief Helper function to write 'matrix' of strings into CSV file\n\nvoid writeCSV(std::string fileName, const std::vector<std::vector<std::string> >& strMatrix);\n\n\n\n/// \\brief Helper function to read CSV files formatted in: time, vectorEntry0, vectorEntry1, ...\n\nvoid loadTimeVectorCSV(std::string fileName, std::vector<curves::Time>* outTimes, std::vector<Eigen::VectorXd>* outValues);\n\n\n\n/// \\brief Helper function to write CSV file formatted in: time, vectorEntry0, vectorEntry1, ...\n\nvoid writeTimeVectorCSV(std::string fileName, const std::vector<curves::Time>& times, const std::vector<Eigen::VectorXd>& values);\n\n\n\n/// \\brief Helper function to read CSV files formatted in: time0, time1, vectorEntry0, vectorEntry1, ...\n\nvoid loadTimeTimeVectorCSV(std::string fileName, std::vector<curves::Time>* outTimes0, std::vector<curves::Time>* outTimes1, std::vector<Eigen::VectorXd>* outValues);\n\n\n\n}\n", "file_path": "curves/include/curves/helpers.hpp", "rank": 71, "score": 37508.81060000937 }, { "content": "/*\n\n * @file test_LocalSupport2CoefficientManager.cpp\n\n * @date Aug 17, 2014\n\n * @author Paul Furgale\n\n */\n\n\n\n#include <gtest/gtest.h>\n\n#include <curves/LocalSupport2CoefficientManager.hpp>\n\n\n\nusing namespace curves;\n\n\n", "file_path": "curves/test/test_LocalSupport2CoefficientManager.cpp", "rank": 72, "score": 36890.678988325235 }, { "content": " ASSERT_EQ(N, keys2.size());\n\n\n\n manager1.getTimes(&times1);\n\n manager2.getTimes(&times2);\n\n }\n\n\n\n // virtual void TearDown() {}\n\n\n\n size_t N;\n\n std::vector<Coefficient> coefficients;\n\n std::vector<curves::Time> times;\n\n std::vector<curves::Time> times1;\n\n std::vector<curves::Time> times2;\n\n std::vector<curves::Key> keys1;\n\n std::vector<curves::Key> keys2;\n\n LocalSupport2CoefficientManager<Coefficient> manager1;\n\n LocalSupport2CoefficientManager<Coefficient> manager2;\n\n\n\n};\n\n\n", "file_path": "curves/test/test_LocalSupport2CoefficientManager.cpp", "rank": 73, "score": 36885.20979292128 }, { "content": "\n\nTEST_F(LocalSupport2CoefficientManagerTest, testTimes) {\n\n CoefficientIter bracket0;\n\n CoefficientIter bracket1;\n\n bool success = false;\n\n curves::Time etime;\n\n\n\n etime = times[0] - 1;\n\n success = manager1.getCoefficientsAt(etime, &bracket0, &bracket1);\n\n ASSERT_FALSE(success) << \"Eval at time \" << etime;\n\n\n\n etime = times[0] - 100;\n\n success = manager1.getCoefficientsAt(etime, &bracket0, &bracket1);\n\n ASSERT_FALSE(success) << \"Eval at time \" << etime;\n\n\n\n etime = times[N-1];\n\n success = manager1.getCoefficientsAt(etime, &bracket0, &bracket1);\n\n ASSERT_TRUE(success) << \"Eval at time \" << etime;\n\n ASSERT_EQ(times[N-2],bracket0->first) << \"index \" << N-2 << \", time: \" << etime;\n\n ASSERT_EQ(times[N-1],bracket1->first) << \"index \" << N-1 << \", time: \" << etime;\n", "file_path": "curves/test/test_LocalSupport2CoefficientManager.cpp", "rank": 74, "score": 36879.892442733326 }, { "content": " CoefficientMap allCoeffs;\n\n for (size_t i = 0; i < keys2.size(); ++i) {\n\n std::pair<curves::Key, Coefficient> pair = std::make_pair(keys2[i], Coefficient::Zero());\n\n allCoeffs.insert(pair);\n\n }\n\n\n\n manager2.updateCoefficients(allCoeffs);\n\n for (size_t i = 0; i < keys2.size(); ++i) {\n\n ASSERT_EQ(manager2.getCoefficientByKey(keys2[i]), Coefficient::Zero());\n\n }\n\n\n\n}\n\n\n\nTEST_F(LocalSupport2CoefficientManagerTest, testRemoveCoefficients) {\n\n // \\todo Abel and Renaud\n\n}\n", "file_path": "curves/test/test_LocalSupport2CoefficientManager.cpp", "rank": 75, "score": 36878.63334197905 }, { "content": " ASSERT_EQ(times[i-1],bracket0->first) << \"index \" << i << \", time: \" << etime;\n\n ASSERT_EQ(times[i],bracket1->first) << \"index \" << i << \", time: \" << etime;\n\n\n\n\n\n }\n\n\n\n}\n\n\n\nTEST_F(LocalSupport2CoefficientManagerTest, testGetCoefficientsInRange) {\n\n // \\todo Abel and Renaud\n\n}\n\n\n\nTEST_F(LocalSupport2CoefficientManagerTest, testUpdateCoefficients) {\n\n\n\n for (size_t i = 0; i < keys1.size(); ++i) {\n\n manager1.updateCoefficientByKey(keys1[i], Coefficient::Zero());\n\n ASSERT_EQ(manager1.getCoefficientByKey(keys1[i]), Coefficient::Zero());\n\n }\n\n\n\n typedef boost::unordered_map<curves::Key, Coefficient> CoefficientMap;\n", "file_path": "curves/test/test_LocalSupport2CoefficientManager.cpp", "rank": 76, "score": 36878.3345742755 }, { "content": "\n\n etime = times[N-1] + 1;\n\n success = manager1.getCoefficientsAt(etime, &bracket0, &bracket1);\n\n ASSERT_FALSE(success) << \"Eval at time \" << etime;\n\n\n\n etime = times[N-1] + 100;\n\n success = manager1.getCoefficientsAt(etime, &bracket0, &bracket1);\n\n ASSERT_FALSE(success) << \"Eval at time \" << etime;\n\n\n\n for(size_t i = 1; i < times.size(); ++i) {\n\n\n\n etime = times[i-1];\n\n success = manager1.getCoefficientsAt(etime, &bracket0, &bracket1);\n\n ASSERT_TRUE(success) << \"Eval at time \" << etime;\n\n ASSERT_EQ(times[i-1],bracket0->first) << \"index \" << i << \", time: \" << etime;\n\n ASSERT_EQ(times[i],bracket1->first) << \"index \" << i << \", time: \" << etime;\n\n\n\n etime = (times[i-1] + times[i]) / 2;\n\n success = manager1.getCoefficientsAt(etime, &bracket0, &bracket1);\n\n ASSERT_TRUE(success) << \"Eval at time \" << etime;\n", "file_path": "curves/test/test_LocalSupport2CoefficientManager.cpp", "rank": 77, "score": 36875.38075085746 }, { "content": "TEST_F(LocalSupport2CoefficientManagerTest, testInsert) {\n\n\n\n ASSERT_EQ(N, manager1.size());\n\n ASSERT_EQ(N, manager2.size());\n\n\n\n ASSERT_EQ(N, keys1.size());\n\n ASSERT_EQ(N, keys2.size());\n\n\n\n ASSERT_EQ(N, times1.size());\n\n ASSERT_EQ(N, times2.size());\n\n\n\n for(size_t i = 0; i < N; ++i) {\n\n ASSERT_EQ(times1[i], times[i]);\n\n ASSERT_EQ(times2[i], times[i]);\n\n }\n\n\n\n ASSERT_EXIT(manager1.checkInternalConsistency(true), ::testing::ExitedWithCode(0), \"^\");\n\n ASSERT_EXIT(manager2.checkInternalConsistency(true), ::testing::ExitedWithCode(0), \"^\");\n\n}\n\n\n", "file_path": "curves/test/test_LocalSupport2CoefficientManager.cpp", "rank": 78, "score": 36873.77753305211 }, { "content": "\n\n /// \\brief Add / replace the given coefficients without resetting the curve.\n\n virtual void setBaseCurvePart(const std::vector<Time>& times, const std::vector<ValueType>& values) = 0;\n\n\n\n /// \\brief Modifies values of the base coefficient in batch, starting at times[0] and assuming that\n\n /// a coefficient exists at all the specified times.\n\n virtual void modifyBaseCoefficientsValuesInBatch(const std::vector<Time>& times, const std::vector<ValueType>& values) = 0;\n\n\n\n virtual void getBaseCurveTimes(std::vector<Time>* outTimes) const = 0;\n\n\n\n virtual void getBaseCurveTimesInWindow(std::vector<Time>* outTimes, Time begTime, Time endTime) const = 0;\n\n\n\n virtual bool isEmpty() const = 0;\n\n\n\n virtual int size() const = 0;\n\n\n\n virtual int baseSize() const = 0;\n\n\n\n virtual void saveCorrectionCurveTimesAndValues(const std::string& filename) const = 0;\n\n\n\n /// \\brief Get the dimension of this curve\n\n //virtual size_t dim() const;\n\n ///@}\n\n private:\n\n\n\n};\n\n\n\n} // namespace\n", "file_path": "curves/include/curves/SE3Curve.hpp", "rank": 79, "score": 36789.04151926546 }, { "content": " virtual void setSamplingRatio(const int ratio) = 0;\n\n\n\n virtual void clear() = 0;\n\n\n\n /// \\brief Perform a rigid transformation on the left side of the curve\n\n virtual void transformCurve(const ValueType T) = 0;\n\n\n\n virtual void saveCurveTimesAndValues(const std::string& filename) const = 0;\n\n\n\n virtual void saveCurveAtTimes(const std::string& filename, std::vector<Time> times) const = 0;\n\n\n\n virtual void saveCorrectionCurveAtTimes(const std::string& filename, std::vector<Time> times) const = 0;\n\n\n\n virtual void getCurveTimes(std::vector<Time>* outTimes) const = 0;\n\n\n\n // Fake functions to comply with the current interfaces of trajectories_optimizer\n\n // todo : tidy up\n\n\n\n /// \\brief Returns the number of coefficients in the correction curve\n\n virtual int correctionSize() const = 0;\n", "file_path": "curves/include/curves/SE3Curve.hpp", "rank": 80, "score": 36786.80611053331 }, { "content": "\n\n /// \\brief Fold in the correction curve into the base curve and reinitialize\n\n /// correction curve coefficients to identity transformations.\n\n virtual void foldInCorrections() = 0;\n\n\n\n /// \\brief Add coefficients to the correction curve at given times.\n\n virtual void setCorrectionTimes(const std::vector<Time>& times) = 0;\n\n\n\n /// \\brief Remove a correction coefficient at the specified time.\n\n virtual void removeCorrectionCoefficientAtTime(Time time) = 0;\n\n\n\n /// \\brief Set the correction coefficient value at the specified time.\n\n virtual void setCorrectionCoefficientAtTime(Time time, ValueType value) = 0;\n\n\n\n /// \\brief Reset the correction curve to identity values with knots at desired times\n\n virtual void resetCorrectionCurve(const std::vector<Time>& times) = 0;\n\n\n\n /// \\brief Set the base curve to given values with knots at desired times\n\n /// Resets the curve beforehand.\n\n virtual void setBaseCurve(const std::vector<Time>& times, const std::vector<ValueType>& values) = 0;\n", "file_path": "curves/include/curves/SE3Curve.hpp", "rank": 81, "score": 36782.362407506436 }, { "content": "/*\n\n * ScalarCurveConfig.hpp\n\n *\n\n * Created on: Mar 5, 2015\n\n * Author: Paul Furgale, Renaud Dube, Péter Fankhauser\n\n * Institute: ETH Zurich, Autonomous Systems Lab\n\n */\n\n\n\n#pragma once\n\n\n\n#include \"curves/SE3Config.hpp\"\n\n#include \"curves/Curve.hpp\"\n\n#include <Eigen/Core>\n\n\n\nnamespace curves {\n\n\n\n// Curves over SE3 inherit the interface from Curve and CurveBase and define specific\n\n// methods to support physical interpretations of temporal derivatives.\n\n//\n\n// For the purposes of these uses, the curve is defined between Frame a and Frame b\n\n// such that evaluate() returns \\f$ \\mathbf{T}_{a,b} \\f$, the transformation that takes\n\n// points from Frame b to Frame a.\n\n//\n", "file_path": "curves/include/curves/SE3Curve.hpp", "rank": 82, "score": 36782.03292201795 }, { "content": "/*\n\n * @file SE2Curve.hpp\n\n * @date Nov 24, 2015\n\n * @author Renaud Dubé\n\n */\n\n\n\n#ifndef SE2_CURVE_H_\n\n#define SE2_CURVE_H_\n\n\n\n#include \"SE2Config.hpp\"\n\n#include \"Curve.hpp\"\n\n\n\nnamespace curves {\n\n\n\n// Curves over SE2 inherit the interface from Curve and CurveBase and define specific\n\n// methods to support physical interpretations of temporal derivatives.\n\n//\n\n// For the purposes of these uses, the curve is defined between Frame a and Frame b\n\n// such that evaluate() returns \\f$ \\mathbf{T}_{a,b} \\f$, the transformation that takes\n\n// points from Frame b to Frame a.\n\n//\n", "file_path": "curves/include/curves/SE2Curve.hpp", "rank": 83, "score": 36779.257147943696 }, { "content": " /// \\brief Evaluate the derivative of Frame a as seen from Frame b, expressed in Frame b.\n\n virtual Eigen::Vector3d evaluateLinearDerivativeB(unsigned derivativeOrder, Time time) = 0;\n\n\n\n /// \\brief evaluate the velocity/angular derivative of Frame b as seen from Frame a,\n\n /// expressed in Frame a. The return value has the linear velocity (0,1,2),\n\n /// and the angular velocity (3,4,5).\n\n virtual Vector6d evaluateDerivativeA(unsigned derivativeOrder, Time time) = 0;\n\n\n\n /// \\brief evaluate the velocity/angular velocity of Frame a as seen from Frame b,\n\n /// expressed in Frame b. The return value has the linear velocity (0,1,2),\n\n /// and the angular velocity (3,4,5).\n\n virtual Vector6d evaluateDerivativeB(unsigned derivativeOrder, Time time) = 0;\n\n\n\n // Following functions added from SlerpSE3 curve .. todo clean\n\n\n\n /// \\brief set the minimum sampling period\n\n virtual void setMinSamplingPeriod(Time time) = 0;\n\n\n\n /// \\brief Set the sampling ratio.\n\n /// eg. 4 will add a coefficient every 4 extend\n", "file_path": "curves/include/curves/SE3Curve.hpp", "rank": 84, "score": 36779.05793842997 }, { "content": "\n\n /// \\brief evaluate the velocity/angular velocity of Frame b as seen from Frame a,\n\n /// expressed in Frame a. The return value has the linear velocity (0,1,2),\n\n /// and the angular velocity (3,4,5).\n\n virtual Vector6d evaluateTwistA(Time time) = 0;\n\n\n\n /// \\brief evaluate the velocity/angular velocity of Frame a as seen from Frame b,\n\n /// expressed in Frame b. The return value has the linear velocity (0,1,2),\n\n /// and the angular velocity (3,4,5).\n\n virtual Vector6d evaluateTwistB(Time time) = 0;\n\n\n\n /// \\brief Evaluate the angular derivative of Frame b as seen from Frame a, expressed in Frame a.\n\n virtual Eigen::Vector3d evaluateAngularDerivativeA(unsigned derivativeOrder, Time time) = 0;\n\n\n\n /// \\brief Evaluate the angular derivative of Frame a as seen from Frame b, expressed in Frame b.\n\n virtual Eigen::Vector3d evaluateAngularDerivativeB(unsigned derivativeOrder, Time time) = 0;\n\n\n\n /// \\brief Evaluate the derivative of Frame b as seen from Frame a, expressed in Frame a.\n\n virtual Eigen::Vector3d evaluateLinearDerivativeA(unsigned derivativeOrder, Time time) = 0;\n\n\n", "file_path": "curves/include/curves/SE3Curve.hpp", "rank": 85, "score": 36773.530441830946 }, { "content": "/*\n\n * polynomial_splines.hpp\n\n *\n\n * Created on: Mar 7, 2017\n\n * Author: Dario Bellicoso\n\n */\n\n\n\n#pragma once\n\n\n\n// curves\n\n#include \"curves/PolynomialSpline.hpp\"\n\n\n\nnamespace curves {\n\n\n\nusing PolynomialSplineQLinear = PolynomialSpline<1>;\n\nusing PolynomialSplineQuadratic = PolynomialSpline<2>;\n\nusing PolynomialSplineCubic = PolynomialSpline<3>;\n\nusing PolynomialSplineQuartic = PolynomialSpline<4>;\n\nusing PolynomialSplineQuintic = PolynomialSpline<5>;\n\n\n\n}\n", "file_path": "curves/include/curves/polynomial_splines.hpp", "rank": 90, "score": 36291.47058125729 }, { "content": " template<typename CurveType, typename ValueType>\n\n void extend(const std::vector<Time>& times,\n\n const std::vector<ValueType>& values,\n\n CurveType* curve,\n\n std::vector<Key>* outKeys = NULL) {\n\n CHECK(false) << \"no extend policy implemented for \" << typeid(CurveType).name();\n\n }\n\n\n\n /// Print the value of the coefficient, for debugging and unit tests\n\n int getMeasurementsSinceLastExtend() {\n\n return measurementsSinceLastExtend_;\n\n }\n\n\n\n int getMinimumMeasurements() {\n\n return minimumMeasurements_;\n\n }\n\n\n\n Time getMinSamplingPeriod() {\n\n return minSamplingPeriod_;\n\n }\n", "file_path": "curves/include/curves/SamplingPolicy.hpp", "rank": 96, "score": 36288.75827617563 }, { "content": "/*\n\n * ScalarCurveConfig.hpp\n\n *\n\n * Created on: Mar 5, 2015\n\n * Author: Paul Furgale, Péter Fankhauser\n\n * Institute: ETH Zurich, Autonomous Systems Lab\n\n */\n\n\n\n#pragma once\n\n\n\n#include <Eigen/Core>\n\n#include <kindr/Core>\n\n\n\nnamespace curves {\n\n\n\ntypedef Eigen::Matrix<double, 6, 1> Vector6d;\n\n\n", "file_path": "curves/include/curves/SE3Config.hpp", "rank": 98, "score": 36288.55247644391 }, { "content": "\n\n void setMeasurementsSinceLastExtend_(int num) {\n\n measurementsSinceLastExtend_ = num;\n\n }\n\n};\n\n\n\n} // namespace curves\n\n\n\n#endif /* SAMPLING_POLICY_HPP */\n", "file_path": "curves/include/curves/SamplingPolicy.hpp", "rank": 99, "score": 36288.134771064375 } ]
C++
DigitalHaze-Libraries/cpp/DH_BitParser.cpp
Phytress/DigitalHaze-Libraries
a94a292da302da23851cc780cfec9d4736dcf9c4
#include "DH_BitParser.hpp" namespace DigitalHaze { BitParser::BitParser(void* buffer, size_t lenInBits) noexcept : dataPtr((unsigned char*) buffer), lengthInBits(lenInBits), startBitPos(0) { } BitParser::BitParser(const BitParser& other) noexcept : dataPtr(other.dataPtr), lengthInBits(other.lengthInBits), startBitPos(other.startBitPos) { } BitParser::BitParser(BitParser&& other) noexcept : dataPtr(other.dataPtr), lengthInBits(other.lengthInBits), startBitPos(other.startBitPos) { } BitParser::~BitParser() noexcept { } BitParser& BitParser::operator=(const BitParser& other) noexcept { dataPtr = other.dataPtr; lengthInBits = other.lengthInBits; startBitPos = other.startBitPos; return *this; } BitParser& BitParser::operator=(BitParser&& other) noexcept { dataPtr = other.dataPtr; lengthInBits = other.lengthInBits; startBitPos = other.startBitPos; return *this; } void BitParser::offsetBuffer(ptrdiff_t offsetInBits) { startBitPos = (ptrdiff_t) startBitPos + offsetInBits; if (startBitPos < 0) { dataPtr -= 1 + ((startBitPos - 1) / -8); startBitPos &= 7; } else if (startBitPos > 7) { dataPtr += startBitPos / 8; startBitPos &= 7; } lengthInBits = (ptrdiff_t) lengthInBits - offsetInBits; } SingleBitDescriptor BitParser::operator[](ptrdiff_t index) const { ptrdiff_t bytePos; int bitPos; if (index > 0) { bytePos = index / 8; bitPos = (int) ((index % 8) + startBitPos); } else if (index < 0) { bytePos = -1 + ((index + 1) / 8); bitPos = (int) ((index & 7) + startBitPos); } else { bytePos = 0; bitPos = (int) startBitPos; } if (bitPos > 7) { bitPos -= 8; bytePos++; } return SingleBitDescriptor(dataPtr + bytePos, bitPos); } SingleBitDescriptor BitParser::operator*() const { return SingleBitDescriptor(dataPtr, (unsigned char) startBitPos); } BitParser& BitParser::operator++() { offsetBuffer(1); return *this; } SingleBitDescriptor::SingleBitDescriptor(unsigned char* bptr, unsigned char bit) noexcept : bytePtr(bptr), bitPos(bit) { } SingleBitDescriptor& SingleBitDescriptor::operator=(bool rhs) { if (rhs) *bytePtr |= 1 << bitPos; else *bytePtr &= ~(1 << bitPos); return *this; } SingleBitDescriptor& SingleBitDescriptor::operator=(int rhs) { *this = (bool)!!rhs; return *this; } SingleBitDescriptor& SingleBitDescriptor::operator=(SingleBitDescriptor& rhs) noexcept { *this = (bool)rhs; } bool SingleBitDescriptor::operator==(bool rhs) const { return (bool) * this == rhs; } bool SingleBitDescriptor::operator!=(bool rhs) const { return !(*this == rhs); } SingleBitDescriptor::operator int() const { return !!(*bytePtr & (1 << bitPos)); } SingleBitDescriptor::operator bool() const { return !!(*bytePtr & (1 << bitPos)); } BitBufferIterator BitParser::begin() const { return BitBufferIterator(this, 0); } BitBufferIterator BitParser::end() const { return BitBufferIterator(this, lengthInBits); } BitBufferIterator::BitBufferIterator(const BitParser* bptr, size_t bpos) noexcept : bbPtr(bptr), pos(bpos) { } bool BitBufferIterator::operator!=(BitBufferIterator& rhs) const { return pos != rhs.pos; } SingleBitDescriptor BitBufferIterator::operator*() const { return (*bbPtr)[pos]; } BitBufferIterator& BitBufferIterator::operator++() { pos++; return *this; } }
#include "DH_BitParser.hpp" namespace DigitalHaze { BitParser::BitParser(void* buffer, size_t lenInBits) noexcept : dataPtr((unsigned char*) buffer), lengthInBits(lenInBits), startBitPos(0) { } BitParser::BitParser(const BitParser& other) noexcept : dataPtr(other.dataPtr), lengthInBits(other.lengthInBits), startBitPos(other.startBitPos) { } BitParser::BitParser(BitParser&& other) noexcept : dataPtr(other.dataPtr), lengthInBits(other.lengthInBits), startBitPos(other.startBitPos) { } BitParser::~BitParser() noexcept { } BitParser& BitParser::operator=(const BitParser& other) noexcept { dataPtr = other.dataPtr; lengthInBits = other.lengthInBits; startBitPos = other.startBitPos; return *this; } BitParser& BitParser::operator=(BitParser&& other) noexcept { dataPtr = other.dataPtr; lengthInBits = other.lengthInBits; startBitPos = other.startBitPos; return *this; } void BitParser::offsetBuffer(ptrdiff_t offsetInBits) { startBitPos = (ptrdiff_t) startBitPos + offsetInBits; if (startBitPos < 0) { dataPtr -= 1 + ((startBitPos - 1) / -8); startBitPos &= 7; } else if (startBitPos > 7) { dataPtr += startBitPos / 8; startBitPos &= 7; } lengthInBits = (ptrdiff_t) lengthInBits - offsetInBits; } SingleBitDescriptor BitParser::operator[](ptrdiff_t index) const { ptrdiff_t bytePos; int bitPos; if (index > 0) { bytePos = index / 8; bitPos = (int) ((index % 8) + startBitPos); } else if (index < 0) { bytePos = -1 + ((index + 1) / 8); bitPos = (int) ((index & 7) + startBitPos); } else { bytePos = 0; bitPos = (int) startBitPos; } if (bitPos > 7) { bitPos -= 8; bytePos++; } return SingleBitDescriptor(dataPtr + bytePos, bitPos); } SingleBitDescriptor BitParser::operator*() const { return SingleBitDescriptor(dataPtr, (unsigned char) startBitPos); } BitParser& BitParser::operator++() { offsetBuffer(1); return *this; } SingleBitDescriptor::SingleBitDescriptor(unsigned char* bptr, unsigned char bit) noexcept : bytePtr(bptr), bitPos(bit) { } SingleBitDescriptor& SingleBitDescriptor::operator=(bool rhs) { if (rhs) *bytePtr |= 1 << bitPos; else *bytePtr &= ~(1 << bitPos); return *this; } SingleBitDescriptor& SingleBitDescriptor::operator=(int rhs) { *this = (bool)!!rhs; return *this; } SingleBitDescriptor& SingleBitDescriptor::operator=(SingleBitDescriptor& rhs) noexcept { *this = (bool)rhs; } bool SingleBitDescriptor::operator==(bool rhs) const { return (bool) * thi
or::operator!=(BitBufferIterator& rhs) const { return pos != rhs.pos; } SingleBitDescriptor BitBufferIterator::operator*() const { return (*bbPtr)[pos]; } BitBufferIterator& BitBufferIterator::operator++() { pos++; return *this; } }
s == rhs; } bool SingleBitDescriptor::operator!=(bool rhs) const { return !(*this == rhs); } SingleBitDescriptor::operator int() const { return !!(*bytePtr & (1 << bitPos)); } SingleBitDescriptor::operator bool() const { return !!(*bytePtr & (1 << bitPos)); } BitBufferIterator BitParser::begin() const { return BitBufferIterator(this, 0); } BitBufferIterator BitParser::end() const { return BitBufferIterator(this, lengthInBits); } BitBufferIterator::BitBufferIterator(const BitParser* bptr, size_t bpos) noexcept : bbPtr(bptr), pos(bpos) { } bool BitBufferIterat
random
[ { "content": "\tclass BitBufferIterator {\n\n\tpublic:\n\n\t\tBitBufferIterator(const BitParser* bptr, size_t bpos) noexcept;\n\n\n\n\t\tbool operator!=(BitBufferIterator& other) const;\n\n\t\tSingleBitDescriptor operator*() const;\n\n\t\tBitBufferIterator& operator++();\n\n\tprivate:\n\n\t\tsize_t pos;\n\n\t\tconst BitParser* bbPtr;\n\n\t};\n\n\n\n\ttemplate<class vType>\n\n\tvType BitParser::ReadBits(size_t nBits) {\n\n\t\tif (!nBits || nBits > (sizeof (vType) * 8)) nBits = sizeof (vType) * 8;\n\n\n\n\t\tvType retVal;\n\n\t\tretVal = PeekBits<vType>(nBits);\n\n\t\toffsetBuffer(nBits);\n\n\t\treturn retVal;\n", "file_path": "DigitalHaze-Libraries/include/DH_BitParser.hpp", "rank": 0, "score": 77528.98976257577 }, { "content": "\tclass BitBufferIterator;\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_BitParser.hpp", "rank": 1, "score": 77528.98976257577 }, { "content": "\tclass Buffer {\n\n\tpublic:\n\n\t\t// sizeInBytes: The length of the buffer in bytes.\n\n\t\t// reallocSize:\n\n\t\t// If the buffer overflows, we reallocate a larger\n\n\t\t// buffer by allocating this many more bytes. If reallocSize\n\n\t\t// is zero, std::overflow_error is thrown on overflow.\n\n\t\t// maxSize:\n\n\t\t// If the buffer is given additional bytes, how big is it allowed\n\n\t\t// to get? If this value is non-zero and is exceeded, then\n\n\t\t// std::overflow_error is thrown when trying to make the buffer\n\n\t\t// too large.\n\n\t\t// throws:\n\n\t\t// bad_array_new_length on zero sizeInBytes.\n\n\t\t// bad_alloc on allocation errors.\n\n\t\t// invalid_argument on non-zero maxSize less than sizeInBytes\n\n\t\texplicit Buffer(size_t sizeInBytes, size_t reallocSize = 0, size_t maxSize = 0);\n\n\t\t~Buffer();\n\n\n\n\t\t// Read data into specified buffer.\n", "file_path": "DigitalHaze-Libraries/include/DH_Buffer.hpp", "rank": 2, "score": 73089.4778826279 }, { "content": "\tclass BitParser {\n\n\tpublic:\n\n\t\t// Default Constructor\n\n\t\tBitParser(void* buffer, size_t lenInBits) noexcept;\n\n\t\t// Copy Constructor\n\n\t\tBitParser(const BitParser& other) noexcept;\n\n\t\t// Move Constructor\n\n\t\tBitParser(BitParser&& other) noexcept;\n\n\t\t// Destructor\n\n\t\t~BitParser() noexcept;\n\n\t\t// Copy assignment\n\n\t\tBitParser& operator=(const BitParser& other) noexcept;\n\n\t\t// Move assignment\n\n\t\tBitParser& operator=(BitParser&& other) noexcept;\n\n\n\n\t\tsize_t getLengthInBits() const {\n\n\t\t\treturn lengthInBits;\n\n\t\t}\n\n\n\n\t\tvoid setLengthInBits(size_t len) {\n", "file_path": "DigitalHaze-Libraries/include/DH_BitParser.hpp", "rank": 3, "score": 55709.8719329386 }, { "content": "\t\tBuffer(const Buffer& rhs); // copy constructor\n\n\t\tBuffer(Buffer&& rhs) noexcept; // move constructor\n\n\t\tBuffer& operator=(const Buffer& rhs); // assignment\n\n\t\tBuffer& operator=(Buffer&& rhs) noexcept; // move\n\n\t};\n\n\n\n\ttemplate<class vType>\n\n\tinline bool Buffer::ReadVar(vType& var, size_t offset) {\n\n\t\treturn Read(&var, sizeof (var), offset);\n\n\t}\n\n\n\n\ttemplate<class vType>\n\n\tinline bool Buffer::PeekVar(vType& var, size_t offset) const {\n\n\t\treturn Peek(&var, sizeof (var), offset);\n\n\t}\n\n\n\n\ttemplate<class vType>\n\n\tinline void Buffer::WriteVar(vType var, ssize_t offset) {\n\n\t\tWrite(&var, sizeof (var), offset);\n\n\t}\n\n}\n\n\n\n#endif /* DH_BUFFER_HPP */\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_Buffer.hpp", "rank": 4, "score": 52004.77674819747 }, { "content": "\t\t// outBuffer: Data is output to this buffer.\n\n\t\t// len: The length of the data to read into the output buffer.\n\n\t\t// offset: An offset from the beginning of the buffer to read from.\n\n\t\t// return: On success, returns true. Returns false if not enough data.\n\n\t\t// throws:\n\n\t\t// out_of_range if specified offset is invalid.\n\n\t\tbool Read(void* outBuffer, size_t len, size_t offset = 0);\n\n\n\n\t\t// Peek data into specified buffer.\n\n\t\t// See Read parameters.\n\n\t\tbool Peek(void* outBuffer, size_t len, size_t offset = 0) const;\n\n\n\n\t\t// Write data to the end of the buffer.\n\n\t\t// inBuffer: data from this buffer will be stored.\n\n\t\t// len: the length of data to grab from the input buffer.\n\n\t\t// insertOffset: if not -1, then data is inserted at a specified\n\n\t\t// position. Otherwise, data is inserted to the end of the buffer.\n\n\t\t// throws:\n\n\t\t// overflow_error if insertOffset is invalid.\n\n\t\t// overflow_error if this would result in an overflow and reallocating\n", "file_path": "DigitalHaze-Libraries/include/DH_Buffer.hpp", "rank": 5, "score": 52003.895959059766 }, { "content": " * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n */\n\n\n\n/* \n\n * File: DH_Buffer.hpp\n\n * Author: phytress\n\n *\n\n * Created on July 7, 2017, 7:05 PM\n\n */\n\n\n\n#ifndef DH_BUFFER_HPP\n\n#define DH_BUFFER_HPP\n\n\n\n#include <stdlib.h>\n\n#include <stddef.h>\n\n#include <sys/types.h>\n\n\n\nnamespace DigitalHaze {\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_Buffer.hpp", "rank": 6, "score": 52003.17169965334 }, { "content": "\t\tinline void WriteVar(vType var, ssize_t offset = -1);\n\n\n\n\t\t// Reads a string from the internal buffer. A string, for this function,\n\n\t\t// is terminated by either a \\0 or a \\n.\n\n\t\t// outString: where the string will be stored.\n\n\t\t// maxLen: the maximum number of bytes to read, including null terminator.\n\n\t\t// offset: specifies where to begin reading data from.\n\n\t\t// returns:\n\n\t\t// The length in bytes of the string, OR\n\n\t\t// 0: if there is no string (delimiter not found)\n\n\t\t// maxLen+1 or larger: if the string is too large, no read occurs.\n\n\t\tsize_t ReadString(char* outString, size_t maxLen, size_t offset = 0);\n\n\n\n\t\t// Peeks a string from the internal buffer. A string, for this function,\n\n\t\t// is terminated by either a \\0 or a \\n.\n\n\t\t// See: ReadString\n\n\t\tsize_t PeekString(char* outString, size_t maxLen, size_t offset = 0) const;\n\n\n\n\t\t// Writes a formatted string into the buffer. Does not write any\n\n\t\t// string terminators (such as \\0 or \\n) UNLESS specified in fmtStr.\n", "file_path": "DigitalHaze-Libraries/include/DH_Buffer.hpp", "rank": 7, "score": 52001.61889502384 }, { "content": "\t\t\n\n\t\tinline void ClearData() {\n\n\t\t\tbufferLen = 0;\n\n\t\t}\n\n\t\t\n\n\t\tvoid* ExportBuffer(size_t& bufLen, size_t& bufSize);\n\n\tprivate:\n\n\t\t// Length of data active in buffer\n\n\t\tsize_t bufferLen;\n\n\t\t// Our maximum size for our buffer\n\n\t\tsize_t bufferSize;\n\n\t\t// How many bytes to allocate on overflows (can be zero)\n\n\t\tsize_t bufferReallocSize;\n\n\t\t// How large is a buffer allowed to get? (can be zero)\n\n\t\tsize_t bufferMaxSize;\n\n\t\t// A malloc'd buffer.\n\n\t\tvoid* buffer;\n\n\tpublic:\n\n\t\t// Rule of 5\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_Buffer.hpp", "rank": 8, "score": 52000.605107748976 }, { "content": "\t\t// That number of bytes is rounded up to a multiple of the realloc size.\n\n\t\t// If no realloc size was provided, this function is identical to\n\n\t\t// ExpandBuffer.\n\n\t\t// additionalBytes: if zero, we use the realloc size provided in initialization.\n\n\t\t// throws:\n\n\t\t// bad_alloc if there is an allocation failure.\n\n\t\t// invalid_argument if additionalBytes AND realloc size are zero.\n\n\t\t// overflow_error if the buffer's maximum allowed size is reached.\n\n\t\tvoid ExpandBufferAligned(size_t additionalBytes = 0);\n\n\n\n\t\t// See: Read\n\n\t\ttemplate<class vType>\n\n\t\tinline bool ReadVar(vType& var, size_t offset = 0);\n\n\n\n\t\t// See: Peek\n\n\t\ttemplate<class vType>\n\n\t\tinline bool PeekVar(vType& var, size_t offset = 0) const;\n\n\n\n\t\t// See: Write\n\n\t\ttemplate<class vType>\n", "file_path": "DigitalHaze-Libraries/include/DH_Buffer.hpp", "rank": 9, "score": 52000.59668369935 }, { "content": "\n\n\t\t// Get a pointer to the start of the buffer where new reads happen.\n\n\n\n\t\tinline void* GetBufferStart() const {\n\n\t\t\treturn buffer;\n\n\t\t}\n\n\n\n\t\t// Removes bytes from the front of the buffer as if it had been read.\n\n\t\t// bytesToShift: number of bytes to remove.\n\n\n\n\t\tinline void ShiftBufferFromFront(size_t bytesToShift) {\n\n\t\t\tShiftBufferAtOffset(bytesToShift, 0);\n\n\t\t}\n\n\n\n\t\t// Removes bytes from a specified position in the buffer as if it\n\n\t\t// had been read.\n\n\t\t// bytesToShift: number of bytes to remove.\n\n\t\t// offset: position in our buffer.\n\n\t\t// throws: out_of_range on bad offset.\n\n\t\tvoid ShiftBufferAtOffset(size_t bytesToShift, size_t offset);\n", "file_path": "DigitalHaze-Libraries/include/DH_Buffer.hpp", "rank": 10, "score": 52000.319947710566 }, { "content": "\t\t\treturn bufferLen;\n\n\t\t}\n\n\n\n\t\t// Get the amount of bytes we will reallocate to prevent overflows.\n\n\n\n\t\tinline size_t GetBufferReallocSize() const {\n\n\t\t\treturn bufferReallocSize;\n\n\t\t}\n\n\n\n\t\t// Get the amount of space, in bytes, left in the buffer.\n\n\n\n\t\tinline size_t GetRemainingBufferLength() const {\n\n\t\t\treturn bufferSize - bufferLen;\n\n\t\t}\n\n\n\n\t\t// Get a pointer to the end of the buffer where new writes happen.\n\n\n\n\t\tinline void* GetBufferEnd() const {\n\n\t\t\treturn (void*) ((size_t) buffer + bufferLen);\n\n\t\t}\n", "file_path": "DigitalHaze-Libraries/include/DH_Buffer.hpp", "rank": 11, "score": 52000.250459050214 }, { "content": "\t\t// more data is not allowed.\n\n\t\t// bad_alloc on reallocation errors\n\n\t\tvoid Write(void* inBuffer, size_t len, ssize_t insertOffset = -1);\n\n\n\n\t\t// Notify that we wrote to the buffer provided by GetBufferEnd.\n\n\t\t// This will increase the size of the buffer.\n\n\t\t// len: number of bytes written to the buffer.\n\n\t\t// throws: overflow_error if the number of bytes exceeded the length\n\n\t\t// of the buffer. Ensure space is available. And if not, then expand.\n\n\t\tvoid NotifyWrite(size_t len);\n\n\n\n\t\t// Notify that we want to expand the buffer by this many bytes.\n\n\t\t// additionalBytes: if zero, we use the realloc size provided in initialization.\n\n\t\t// throws:\n\n\t\t// bad_alloc if there is an allocation failure.\n\n\t\t// invalid_argument if additionalBytes AND realloc size are zero.\n\n\t\t// overflow_error if the buffer's maximum allowed size is reached.\n\n\t\tvoid ExpandBuffer(size_t additionalBytes = 0);\n\n\n\n\t\t// Notify that we want to expand the buffer by this many bytes.\n", "file_path": "DigitalHaze-Libraries/include/DH_Buffer.hpp", "rank": 12, "score": 52000.16055935157 }, { "content": "\t\t// fmtStr: Formatted string\n\n\t\t// returns:\n\n\t\t// number of bytes written\n\n\t\t// 0: allocation or some other error.\n\n\t\tsize_t WriteString(const char* fmtStr, ...);\n\n\n\n\t\t// Writes a formatted string and inserts it at the specified offset\n\n\t\t// position in our buffer.\n\n\t\t// See: WriteString\n\n\t\tsize_t WriteStringAtOffset(size_t offset, const char* fmtStr, ...);\n\n\n\n\t\t// Get the maximum capacity of our buffer.\n\n\n\n\t\tinline size_t GetBufferSize() const {\n\n\t\t\treturn bufferSize;\n\n\t\t}\n\n\n\n\t\t// Get the amount of data we're holding.\n\n\n\n\t\tinline size_t GetBufferDataLen() const {\n", "file_path": "DigitalHaze-Libraries/include/DH_Buffer.hpp", "rank": 13, "score": 51999.74858445534 }, { "content": "\n\n\t\t// Recreates AND RESETS the buffer.\n\n\t\t// If a resize is not necessary, then it won't happen, but the length\n\n\t\t// of the buffer is reset to zero (as if the data is no longer there).\n\n\t\t// newBufferSize: Size of the new buffer.\n\n\t\t// newBufferReallocSize:\n\n\t\t// If the buffer overflows, we reallocate a larger\n\n\t\t// buffer by allocating this many more bytes. If reallocSize\n\n\t\t// is zero, std::overflow_error is thrown on overflow.\n\n\t\t// maxSize:\n\n\t\t// If the buffer is given additional bytes, how big is it allowed\n\n\t\t// to get? If this value is non-zero and is exceeded, then\n\n\t\t// std::overflow_error is thrown when trying to make the buffer\n\n\t\t// too large.\n\n\t\t// throws:\n\n\t\t// bad_alloc on allocation errors.\n\n\t\t// bad_array_new_length if the specified size is invalid (0).\n\n\t\t// invalid_argument if non-zero maxSize is less than newBufferSize\n\n\t\tvoid Recreate(size_t newBufferSize, size_t newBufferReallocSize = 0,\n\n\t\t\tsize_t maxSize = 0);\n", "file_path": "DigitalHaze-Libraries/include/DH_Buffer.hpp", "rank": 14, "score": 51998.72590530732 }, { "content": "/*\n\n * The MIT License\n\n *\n\n * Copyright 2017 Syed Ali <[email protected]>.\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n *\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n", "file_path": "DigitalHaze-Libraries/include/DH_Buffer.hpp", "rank": 15, "score": 51996.17354425738 }, { "content": "\n\n\t\tSingleBitDescriptor operator[](ptrdiff_t index) const;\n\n\t\tSingleBitDescriptor operator*() const;\n\n\t\tBitParser& operator++();\n\n\n\n\t\tBitBufferIterator begin() const;\n\n\t\tBitBufferIterator end() const;\n\n\tprivate:\n\n\t\tunsigned char* dataPtr;\n\n\t\tsize_t lengthInBits;\n\n\t\tsize_t startBitPos;\n\n\t};\n\n\n\n\tstruct SingleBitDescriptor {\n\n\tpublic:\n\n\t\tbool operator==(bool rhs) const;\n\n\t\tbool operator!=(bool rhs) const;\n\n\n\n\t\toperator bool() const;\n\n\t\toperator int() const;\n", "file_path": "DigitalHaze-Libraries/include/DH_BitParser.hpp", "rank": 16, "score": 50611.28304035563 }, { "content": "\n\n\t\tSingleBitDescriptor& operator=(bool rhs);\n\n\t\tSingleBitDescriptor& operator=(int rhs);\n\n\t\tSingleBitDescriptor& operator=(SingleBitDescriptor& rhs) noexcept;\n\n\n\n\t\tSingleBitDescriptor(unsigned char* bPtr, unsigned char bit) noexcept;\n\n\tprivate:\n\n\t\tunsigned char* bytePtr;\n\n\t\tunsigned char bitPos;\n\n\t};\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_BitParser.hpp", "rank": 17, "score": 50611.24230113079 }, { "content": "\t}\n\n\n\n\ttemplate<class vType>\n\n\tvType BitParser::PeekBits(size_t nBits) const {\n\n\t\tif (!nBits || nBits > (sizeof (vType) * 8)) nBits = sizeof (vType) * 8;\n\n\n\n\t\tvType retVal;\n\n\t\tunsigned char* destPtr = (unsigned char*) (void*) &retVal;\n\n\n\n\t\tfor (std::size_t i = 0; i < sizeof (vType) && nBits; i++) {\n\n\t\t\tunsigned char byte = 0;\n\n\t\t\tint readMax = nBits > 7 ? 8 : (int) nBits;\n\n\t\t\tfor (int bit = readMax - 1; bit >= 0; bit--) {\n\n\t\t\t\tbyte <<= 1;\n\n\t\t\t\tbyte |= (int) ((*this)[(i * 8) + bit]);\n\n\t\t\t}\n\n\t\t\t*destPtr = byte;\n\n\t\t\tdestPtr++;\n\n\n\n\t\t\tnBits -= readMax;\n", "file_path": "DigitalHaze-Libraries/include/DH_BitParser.hpp", "rank": 18, "score": 50607.6709129804 }, { "content": "\t\t\tlengthInBits = len;\n\n\t\t}\n\n\n\n\t\tvoid* getDataPtr() const {\n\n\t\t\treturn (void*) dataPtr;\n\n\t\t}\n\n\n\n\t\tvoid setDataPtr(void* ptr, size_t lenInBits) {\n\n\t\t\tdataPtr = (unsigned char*) ptr;\n\n\t\t\tlengthInBits = lenInBits;\n\n\t\t\tstartBitPos = 0;\n\n\t\t}\n\n\t\tvoid offsetBuffer(ptrdiff_t offsetInBits);\n\n\n\n\t\ttemplate<class vType>\n\n\t\tvType ReadBits(size_t nBits = 0);\n\n\t\ttemplate<class vType>\n\n\t\tvType PeekBits(size_t nBits = 0) const;\n\n\t\ttemplate<class vType>\n\n\t\tvoid WriteBits(vType var, size_t nBits = 0);\n", "file_path": "DigitalHaze-Libraries/include/DH_BitParser.hpp", "rank": 19, "score": 50605.234283591344 }, { "content": "\t\t}\n\n\n\n\t\treturn retVal;\n\n\t}\n\n\n\n\ttemplate<class vType>\n\n\tvoid BitParser::WriteBits(vType var, size_t nBits) {\n\n\t\tif (!nBits || nBits > (sizeof (vType) * 8)) nBits = sizeof (vType) * 8;\n\n\t\tBitParser srcBuf(&var, 0);\n\n\n\n\t\tfor (size_t i = 0; i < nBits; i++) {\n\n\t\t\t(*this)[i] = (bool)srcBuf[i];\n\n\t\t}\n\n\n\n\t\toffsetBuffer(nBits);\n\n\t}\n\n\n\n}\n\n\n\n#endif /* DH_BITPARSER_HPP */\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_BitParser.hpp", "rank": 20, "score": 50602.85905209983 }, { "content": " * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n */\n\n\n\n/* \n\n * File: DH_BitParser.hpp\n\n * Author: Syed Ali <[email protected]>\n\n *\n\n * Created on September 15, 2017, 1:09 PM\n\n */\n\n\n\n#ifndef DH_BITPARSER_HPP\n\n#define DH_BITPARSER_HPP\n\n\n\n#include <cstdlib>\n\n#include <cstddef>\n\n\n\nnamespace DigitalHaze {\n\n\n\n\tstruct SingleBitDescriptor;\n", "file_path": "DigitalHaze-Libraries/include/DH_BitParser.hpp", "rank": 21, "score": 50600.01181047449 }, { "content": "/*\n\n * The MIT License\n\n *\n\n * Copyright 2017 Syed Ali <[email protected]>.\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n *\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n", "file_path": "DigitalHaze-Libraries/include/DH_BitParser.hpp", "rank": 22, "score": 50594.05094541604 }, { "content": "\t\tShiftBufferAtOffset(readLen + 1, offset); //Remove terminating character\n\n\n\n\treturn readLen;\n\n}\n\n\n\nsize_t DigitalHaze::Buffer::PeekString(char* outString, size_t maxLen, size_t offset) const {\n\n\tsize_t tokenPos;\n\n\n\n\t// Find a line break or null terminator\n\n\tfor (tokenPos = offset; tokenPos < bufferLen; ++tokenPos) {\n\n\t\tunsigned char byte =\n\n\t\t\t\t*(unsigned char*) ((size_t) buffer + tokenPos);\n\n\t\tif (byte == 0x00 || byte == 0x0A)\n\n\t\t\tbreak;\n\n\t}\n\n\n\n\t// Did we find it in time?\n\n\tif (tokenPos > offset && tokenPos < bufferLen) {\n\n\t\tsize_t stringLength = tokenPos - offset;\n\n\t\tif (stringLength + 1 > maxLen) // include null terminator\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Buffer.cpp", "rank": 23, "score": 26800.43185984383 }, { "content": "\t\t\treturn stringLength + 1;\n\n\n\n\t\t// Copy the string\n\n\t\tmemcpy(outString, (void*) ((size_t) buffer + offset), stringLength + 1);\n\n\n\n\t\t// Write a null terminator in case the string's provided terminator\n\n\t\t// wasn't a \\0.\n\n\t\toutString[stringLength + 1] = 0x00;\n\n\t\treturn stringLength;\n\n\t}\n\n\n\n\t// Did not find a string\n\n\treturn 0;\n\n}\n\n\n\nsize_t DigitalHaze::Buffer::WriteString(const char* fmtStr, ...) {\n\n\tchar* message = nullptr;\n\n\tint msgLen;\n\n\n\n\tva_list list;\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Buffer.cpp", "rank": 24, "score": 26799.88591309189 }, { "content": "\tRecreate(sizeInBytes, reallocSize);\n\n}\n\n\n\nDigitalHaze::Buffer::~Buffer() {\n\n\t// Free any data\n\n\tif (buffer != nullptr)\n\n\t\tfree(buffer);\n\n}\n\n\n\nbool DigitalHaze::Buffer::Read(void* outBuffer, size_t len, size_t offset) {\n\n\t// Peek the data, if available.\n\n\tif (!Peek(outBuffer, len, offset))\n\n\t\treturn false;\n\n\n\n\t// Discard it\n\n\tShiftBufferAtOffset(len, offset);\n\n\treturn true;\n\n}\n\n\n\nbool DigitalHaze::Buffer::Peek(void* outBuffer, size_t len, size_t offset) const {\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Buffer.cpp", "rank": 25, "score": 26799.46240939564 }, { "content": " * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n */\n\n\n\n#define _GNU_SOURCE\n\n\n\n#include \"DH_Buffer.hpp\"\n\n#include \"DH_Common.hpp\"\n\n\n\n#include <exception>\n\n#include <stdexcept>\n\n#include <cstring>\n\n#include <string>\n\n\n\n#include <stdarg.h>\n\n#include <stdio.h>\n\n\n\nDigitalHaze::Buffer::Buffer(size_t sizeInBytes, size_t reallocSize, size_t maxSize)\n\n\t: bufferSize(0), bufferMaxSize(maxSize), buffer(nullptr) {\n\n\t// Our recreate function will allocate us.\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Buffer.cpp", "rank": 26, "score": 26797.500154898968 }, { "content": "\n\nvoid DigitalHaze::Buffer::ExpandBufferAligned(size_t additionalBytes) {\n\n\tif (!bufferReallocSize) {\n\n\t\tExpandBuffer(additionalBytes);\n\n\t\treturn;\n\n\t}\n\n\n\n\t// We always expand at least by one multiple of the reallocSize.\n\n\tsize_t numBytesExpand = (bufferReallocSize *\n\n\t\t\t(((bufferSize + additionalBytes) / bufferReallocSize) + 1))\n\n\t\t\t- bufferSize;\n\n\tExpandBuffer(numBytesExpand);\n\n}\n\n\n\nsize_t DigitalHaze::Buffer::ReadString(char* outString, size_t maxLen, size_t offset) {\n\n\t// Peek the string\n\n\tsize_t readLen = PeekString(outString, maxLen, offset);\n\n\n\n\t// Remove from the buffer\n\n\tif (readLen && readLen <= maxLen)\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Buffer.cpp", "rank": 27, "score": 26797.01154663859 }, { "content": "\t// Invalid offset / not enough data available?\n\n\tif (len + offset > bufferLen || !buffer) return false;\n\n\t// Copy\n\n\tmemcpy(outBuffer, (void*) ((size_t) buffer + offset), len);\n\n\treturn true;\n\n}\n\n\n\nvoid DigitalHaze::Buffer::Write(void* inBuffer, size_t len, ssize_t insertOffset) {\n\n\tif (!buffer) return;\n\n\n\n\t// If -1, then we insert data to the back of the buffer\n\n\tif (insertOffset == -1) insertOffset = (ssize_t) bufferLen;\n\n\n\n\t// Is this offset valid?\n\n\tif ((size_t) insertOffset > bufferLen) {\n\n\t\t// Can't write past our end point\n\n\t\tthrow\n\n\t\tstd::overflow_error(\n\n\t\t\t\tstringprintf(\"DigitalHaze::Buffer::Write cannot write %zu bytes at offset %zd in a buffer of length %zu\",\n\n\t\t\t\tlen, insertOffset, bufferLen)\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Buffer.cpp", "rank": 28, "score": 26796.609171226744 }, { "content": "\t// The address at which we're inserting data\n\n\tsize_t insertionPoint = (size_t) buffer + insertOffset;\n\n\t// The ending address after data has been written\n\n\tsize_t destinationPoint = insertionPoint + len;\n\n\t// The number of bytes to shift forward if inserting data.\n\n\tsize_t bytesToForwardShift = bufferLen - insertOffset;\n\n\t// Shift bytes forward\n\n\tmemmove((void*) destinationPoint, (void*) insertionPoint, bytesToForwardShift);\n\n\n\n\t// Copy the new bytes in\n\n\tmemcpy((void*) insertionPoint, inBuffer, len);\n\n\tbufferLen += len;\n\n}\n\n\n\nvoid DigitalHaze::Buffer::NotifyWrite(size_t len) {\n\n\tif (bufferLen + len > bufferSize || !buffer) {\n\n\t\tthrow\n\n\t\tstd::overflow_error(\n\n\t\t\t\tstringprintf(\"DigitalHaze::Buffer::NotifyWrite notified of a write of %zu bytes which resulted in an overflow in a %zu sized buffer\",\n\n\t\t\t\tlen, bufferSize)\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Buffer.cpp", "rank": 29, "score": 26796.51706142143 }, { "content": "\t}\n\n\n\n\tbufferLen -= bytesToShift;\n\n\n\n\t// Data will be copied to this position/pointer\n\n\tsize_t shiftDestPos = (size_t) buffer + offset;\n\n\t// The source is specified by this pointer\n\n\tsize_t shiftStartPos = shiftDestPos + bytesToShift;\n\n\t// The number of bytes to shift\n\n\tsize_t remainingBytes = bufferLen - offset;\n\n\n\n\tmemmove((void*) shiftDestPos, (void*) shiftStartPos, remainingBytes);\n\n}\n\n\n\nvoid DigitalHaze::Buffer::Recreate(size_t newBufferSize, size_t newBufferReallocSize,\n\n\t\tsize_t maxSize) {\n\n\tif (!newBufferSize)\n\n\t\tthrow std::bad_array_new_length();\n\n\tif (maxSize && newBufferSize < maxSize)\n\n\t\tthrow std::invalid_argument(\"DigitalHaze::Buffer::Recreate newBufferSize is larger than maxSize\");\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Buffer.cpp", "rank": 30, "score": 26796.176619921855 }, { "content": "\tva_start(list, fmtStr);\n\n\tmsgLen = vasprintf(&message, fmtStr, list); // God bless GNU\n\n\tva_end(list);\n\n\n\n\tif (msgLen == -1) return 0; // allocation error\n\n\tif (!message) return 0; // I think only *BSD does this\n\n\n\n\tWrite(message, (size_t) msgLen);\n\n\n\n\tfree(message); // vasprintf requires free\n\n\n\n\treturn (size_t) msgLen;\n\n}\n\n\n\nsize_t DigitalHaze::Buffer::WriteStringAtOffset(size_t offset, const char* fmtStr, ...) {\n\n\tchar* message = nullptr;\n\n\tint msgLen;\n\n\n\n\tva_list list;\n\n\tva_start(list, fmtStr);\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Buffer.cpp", "rank": 31, "score": 26796.069856327205 }, { "content": "\t\n\n\tvoid* retVal = buffer;\n\n\t\n\n\tbuffer = nullptr;\n\n\tbufferSize = 0;\n\n\tbufferLen = 0;\n\n\tbufferReallocSize = 0;\n\n\tbufferMaxSize = 0;\n\n\t\n\n\treturn retVal;\n\n}\n\n\n\n// Begin rule of 5\n\n\n\nDigitalHaze::Buffer::Buffer(const Buffer& rhs)\n\n\t: Buffer(rhs.bufferSize, rhs.bufferReallocSize, rhs.bufferMaxSize) {\n\n\t// Not too many things other than memory corruption can cause this\n\n\tif (!rhs.buffer)\n\n\t\tthrow std::invalid_argument(\"DigitalHaze::Buffer::operator= rhs.buffer is nullptr\");\n\n\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Buffer.cpp", "rank": 32, "score": 26795.832191833248 }, { "content": "\n\n\t// Reallocate only if we have to. If the size is the same, then don't bother.\n\n\tif (newBufferSize != bufferSize) {\n\n\t\tbuffer = realloc(buffer, newBufferSize);\n\n\n\n\t\tif (!buffer)\n\n\t\t\tthrow std::bad_alloc();\n\n\n\n\t\tbufferSize = newBufferSize;\n\n\t}\n\n\n\n\t// Reset variables.\n\n\tbufferLen = 0;\n\n\tbufferReallocSize = newBufferReallocSize;\n\n\tbufferMaxSize = maxSize;\n\n}\n\n\n\nvoid* DigitalHaze::Buffer::ExportBuffer(size_t& bufLen, size_t& bufSize) {\n\n\tbufLen = bufferLen;\n\n\tbufSize = bufferSize;\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Buffer.cpp", "rank": 33, "score": 26795.772315075337 }, { "content": "\n\n\tRecreate(rhs.bufferSize, rhs.bufferReallocSize, rhs.bufferMaxSize);\n\n\tbufferLen = rhs.bufferLen;\n\n\tmemcpy(buffer, rhs.buffer, bufferLen);\n\n\n\n\treturn *this;\n\n}\n\n\n\nDigitalHaze::Buffer& DigitalHaze::Buffer::operator=(Buffer&& rhs) noexcept {\n\n\tif (buffer)\n\n\t\tfree(buffer);\n\n\n\n\t// Copy\n\n\tbuffer = rhs.buffer;\n\n\tbufferLen = rhs.bufferLen;\n\n\tbufferSize = rhs.bufferSize;\n\n\tbufferReallocSize = rhs.bufferReallocSize;\n\n\tbufferMaxSize = rhs.bufferMaxSize;\n\n\n\n\t// Remove rhs from existance\n\n\trhs.buffer = nullptr;\n\n\trhs.bufferSize = 0;\n\n\trhs.bufferLen = 0;\n\n\trhs.bufferReallocSize = 0;\n\n\trhs.bufferMaxSize = 0;\n\n\n\n\treturn *this;\n\n}", "file_path": "DigitalHaze-Libraries/cpp/DH_Buffer.cpp", "rank": 34, "score": 26795.680735099395 }, { "content": "\t\t\t\t);\n\n\t}\n\n\n\n\tbufferLen += len;\n\n}\n\n\n\nvoid DigitalHaze::Buffer::ExpandBuffer(size_t additionalBytes) {\n\n\tif (!additionalBytes) additionalBytes = bufferReallocSize;\n\n\tif (!additionalBytes)\n\n\t\tthrow std::invalid_argument(\"DigitalHaze::Buffer::ExpandBuffer cannot expand by 0\");\n\n\tif (bufferMaxSize && bufferSize + additionalBytes > bufferMaxSize)\n\n\t\tthrow std::overflow_error(\"DigitalHaze::Buffer::ExpandBuffer cannot expand buffer past max size.\");\n\n\n\n\tbufferSize += additionalBytes;\n\n\tbuffer = realloc(buffer, bufferSize);\n\n\n\n\tif (!buffer) {\n\n\t\tthrow std::bad_alloc();\n\n\t}\n\n}\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Buffer.cpp", "rank": 35, "score": 26795.663155361748 }, { "content": "\t// Copy the contents of the other buffer\n\n\tmemcpy(buffer, rhs.buffer, rhs.bufferLen);\n\n\tbufferLen = rhs.bufferLen;\n\n}\n\n\n\nDigitalHaze::Buffer::Buffer(Buffer&& rhs) noexcept\n\n: bufferLen(rhs.bufferLen), bufferSize(rhs.bufferSize),\n\nbufferReallocSize(rhs.bufferReallocSize),\n\nbufferMaxSize(rhs.bufferMaxSize), buffer(rhs.buffer) {\n\n\trhs.buffer = nullptr;\n\n\trhs.bufferSize = 0;\n\n\trhs.bufferLen = 0;\n\n\trhs.bufferReallocSize = 0;\n\n\trhs.bufferMaxSize = 0;\n\n}\n\n\n\nDigitalHaze::Buffer& DigitalHaze::Buffer::operator=(const Buffer& rhs) {\n\n\t// Not too many things other than memory corruption can cause this\n\n\tif (!rhs.buffer)\n\n\t\tthrow std::invalid_argument(\"DigitalHaze::Buffer::operator= rhs.buffer is nullptr\");\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Buffer.cpp", "rank": 36, "score": 26795.57994473537 }, { "content": "\tmsgLen = vasprintf(&message, fmtStr, list);\n\n\tva_end(list);\n\n\n\n\tif (msgLen == -1) return 0;\n\n\tif (!message) return 0;\n\n\n\n\tWrite(message, (size_t) msgLen, offset);\n\n\n\n\tfree(message); // vasprintf requires free\n\n\n\n\treturn (size_t) msgLen;\n\n}\n\n\n\nvoid DigitalHaze::Buffer::ShiftBufferAtOffset(size_t bytesToShift, size_t offset) {\n\n\tif (bytesToShift + offset > bufferLen) {\n\n\t\tthrow\n\n\t\tstd::out_of_range(\n\n\t\t\t\tstringprintf(\"DigitalHaze::Buffer cannot shift %zu bytes at %zu offset, only %zu bytes in buffer.\",\n\n\t\t\t\tbytesToShift, offset, bufferLen)\n\n\t\t\t\t);\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Buffer.cpp", "rank": 37, "score": 26795.16606785177 }, { "content": "\t\t\t\t);\n\n\t}\n\n\n\n\t// Do we have enough space?\n\n\tif (bufferLen + len > bufferSize) {\n\n\t\t// We need more space\n\n\t\tif (!bufferReallocSize) {\n\n\t\t\t// If we're not allowed to realloc more data, then this would\n\n\t\t\t// cause a buffer overflow\n\n\t\t\tthrow\n\n\t\t\tstd::overflow_error(\n\n\t\t\t\t\tstringprintf(\"DigitalHaze::Buffer::Write ran out of space to store %zu bytes in a %zu length buffer\",\n\n\t\t\t\t\tlen, bufferSize)\n\n\t\t\t\t\t);\n\n\t\t}\n\n\n\n\t\t// expand in chunks of bufferReallocSize\n\n\t\tExpandBufferAligned(bufferLen + len - bufferSize);\n\n\t}\n\n\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Buffer.cpp", "rank": 38, "score": 26793.78526439395 }, { "content": "/*\n\n * The MIT License\n\n *\n\n * Copyright 2017 Syed Ali <[email protected]>.\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n *\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Buffer.cpp", "rank": 39, "score": 26792.53089694923 }, { "content": " * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n */\n\n\n\n/* \n\n * File: DH_Base64.hpp\n\n * Author: Syed Ali <[email protected]>\n\n *\n\n * Created on September 16, 2017, 4:22 PM\n\n */\n\n\n\n#ifndef DH_BASE64_HPP\n\n#define DH_BASE64_HPP\n\n\n\n#include <cstdlib>\n\n\n\nnamespace DigitalHaze {\n\n\t// Converts an int (first 6 bits only) to a base64 char.\n\n\t// If the int is less than 0 or above 63, then 0x00 is returned\n\n\tchar IntToBase64Char(int num);\n", "file_path": "DigitalHaze-Libraries/include/DH_Base64.hpp", "rank": 48, "score": 25217.30204793836 }, { "content": "#define COLOR_RESET\t\t\"\\x1b[0m\"\n\n\n\n#include <string>\n\n\n\nnamespace DigitalHaze {\n\n\t// Converts a formatted string and parameters into a std::string\n\n\tstd::string stringprintf(const char* fmtStr, ...);\n\n\t\n\n\t// Formats raw data for output in hex and makes it easier to read.\n\n\tvoid displayformatted(void* buf, size_t len);\n\n\t\n\n\t// Compares to strings case insensitive\n\n\tint stringcasecmp(std::string str1, std::string str2);\n\n\t\n\n\t// Returns a text representation of a zlib error code\n\n\tstd::string zliberr(int errCode);\n\n}\n\n\n\n#endif /* DH_COMMON_HPP */\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_Common.hpp", "rank": 49, "score": 25216.98404046269 }, { "content": "\t\tvirtual bool PerformSocketWrite(bool flush = false) = 0;\n\n\n\n\t\t// Read data into caller provided buffer.\n\n\t\t// Data is discarded from internal buffer.\n\n\t\t// If there is not enough data in our buffer,\n\n\t\t// this becomes a blocking operation until there\n\n\t\t// is enough data or an error occurs.\n\n\t\t// Returns false on error, true on success.\n\n\t\t// If len is zero, then the size of the entire internal\n\n\t\tvirtual bool Read(void* outBuffer, size_t len);\n\n\n\n\t\t// Read data into caller provided buffer.\n\n\t\t// Data is not discarded from internal buffer\n\n\t\t// as if it were never read.\n\n\t\t// Returns false on error, true on success.\n\n\t\tvirtual bool Peek(void* outBuffer, size_t len);\n\n\n\n\t\t// Write data from caller provided buffer\n\n\t\t// into internal outgoing buffer.\n\n\t\tvirtual void Write(void* inBuffer, size_t len);\n", "file_path": "DigitalHaze-Libraries/include/DH_Socket.hpp", "rank": 50, "score": 25216.53016834674 }, { "content": "\n\n\t// Converts a single base64 char to an int\n\n\t// If the char is invalid OR a '=' (which is valid), it returns zero\n\n\tint Base64CharToInt(char c);\n\n\n\n\t// Converts the src binary data (of length len) to a Base64 string stored in dest.\n\n\t// A null terminator is stored in dest as well. Returns the length of the string\n\n\tsize_t Base64Encode(void* src, void* dest, size_t srclen);\n\n\n\n\t// Converts the src base64 data (of length len) to the decoded values, stored in dest.\n\n\t// A null terminator is stored in dest as well. Returns the length of the data\n\n\tsize_t Base64Decode(void* src, void* dest, size_t srclen);\n\n}\n\n\n\n#endif /* DH_BASE64_HPP */\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_Base64.hpp", "rank": 51, "score": 25216.114070340518 }, { "content": "\n\n\t\t// Compare sockfd. Useful if we moved the fd to another object.\n\n\n\n\t\tinline bool operator==(const Socket& rhs) const {\n\n\t\t\treturn sockfd == rhs.sockfd;\n\n\t\t}\n\n\tprivate:\n\n\t\tint sockfd;\n\n\t\tint lasterrno;\n\n\n\n\t\t// Record errno in our local variable\n\n\t\tvoid RecordErrno();\n\n\t\tvoid RecordErrno(int specificerrno);\n\n\tpublic:\n\n\t\t// Rule of 5\n\n\n\n\t\tSocket(const Socket& rhs); // copy constructor\n\n\t\tSocket(Socket&& rhs) noexcept; // move constructor\n\n\t\tSocket& operator=(const Socket& rhs); // assignment\n\n\t\tSocket& operator=(Socket&& rhs) noexcept; // move\n\n\t};\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_Socket.hpp", "rank": 52, "score": 25214.84356469274 }, { "content": "\t\t// breaks count towards the length returned.\n\n\t\tsize_t WriteString(const char* fmtStr, ...);\n\n\n\n\t\t// Returns how many bytes we have pending in our write buffer.\n\n\n\n\t\tinline size_t GetEgressDataLen() const {\n\n\t\t\treturn writeBuffer.GetBufferDataLen();\n\n\t\t}\n\n\n\n\t\t// Returns how many bytes we have pending in our read buffer.\n\n\n\n\t\tinline size_t GetIngressDataLen() const {\n\n\t\t\treturn readBuffer.GetBufferDataLen();\n\n\t\t}\n\n\n\n\t\t// When we close our connection, we can reset our buffers too.\n\n\t\tvirtual void CloseSocket() override;\n\n\t\t\n\n\t\tinline void ClearIngressData() {\n\n\t\t\treadBuffer.ClearData();\n", "file_path": "DigitalHaze-Libraries/include/DH_Socket.hpp", "rank": 53, "score": 25214.74705280769 }, { "content": "\n\n\t\t// Read a variable and remove it from internal buffer.\n\n\t\t// Blocking operation if not enough data in buffer.\n\n\t\ttemplate<class vType>\n\n\t\tinline bool ReadVar(vType& var);\n\n\n\n\t\t// Read a variable but do not discard it from internal buffer\n\n\t\t// as if it were never read. Blocking operation if not enough\n\n\t\t// data in buffer.\n\n\t\ttemplate<class vType>\n\n\t\tinline bool PeekVar(vType& var);\n\n\n\n\t\t// Write variable into internal outgoing buffer.\n\n\t\ttemplate<class vType>\n\n\t\tinline void WriteVar(vType var);\n\n\n\n\t\t// Reads a string from the read buffer and stores it into\n\n\t\t// the passed buffer up to specified number of bytes.\n\n\t\t// If a string terminating character (only \\n and \\0) is not\n\n\t\t// found within the read bytes, then 0 is returned.\n", "file_path": "DigitalHaze-Libraries/include/DH_Socket.hpp", "rank": 54, "score": 25211.911293799178 }, { "content": "\t\t// Returns the length of the string. If there is not enough\n\n\t\t// space to store the string, the length of the string is returned\n\n\t\t// (check if return is greater than maxLen for errors), and\n\n\t\t// no read takes place.\n\n\t\tinline size_t ReadString(char* outString, size_t maxLen);\n\n\n\n\t\t// Reads a string from the internal buffer and stores it into\n\n\t\t// the passed buffer up to specified number of bytes. Does not\n\n\t\t// remove it from the internal buffer, as if it had never been read.\n\n\t\t// If a string terminating character (only \\n and \\0) is not\n\n\t\t// found within the read bytes, then 0 is returned.\n\n\t\t// Returns the length of the string. If there is not enough\n\n\t\t// space to store the string, the length of the string in the buffer\n\n\t\t// is returned (check if return is greater than maxLen for errors),\n\n\t\t// and no peek takes place.\n\n\t\tinline size_t PeekString(char* outString, size_t maxLen) const;\n\n\n\n\t\t// Writes a formatted string into the buffer.\n\n\t\t// Does not write a null terminator. That must be specified\n\n\t\t// as a \\0 at the end of the string. null terminators and line\n", "file_path": "DigitalHaze-Libraries/include/DH_Socket.hpp", "rank": 55, "score": 25211.762219399337 }, { "content": " * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n */\n\n\n\n/* \n\n * File: DH_Socket.hpp\n\n * Author: phytress\n\n *\n\n * Created on July 6, 2017, 11:26 PM\n\n */\n\n\n\n#ifndef DH_SOCKET_HPP\n\n#define DH_SOCKET_HPP\n\n\n\n#include <stdlib.h>\n\n\n\n#include \"DH_Buffer.hpp\"\n\n\n\n#ifndef DHSOCKETBUFSIZE\n\n#define DHSOCKETBUFSIZE 4096\n\n#endif\n\n#ifndef DHSOCKETBUFRESIZE\n\n#define DHSOCKETBUFRESIZE 4096\n\n#endif\n\n\n\nnamespace DigitalHaze {\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_Socket.hpp", "rank": 56, "score": 25211.465395156203 }, { "content": "\t\tIOSocket(const IOSocket& rhs); // copy constructor\n\n\t\tIOSocket(IOSocket&& rhs) noexcept; // move constructor\n\n\t\tIOSocket& operator=(const IOSocket& rhs); // assignment\n\n\t\tIOSocket& operator=(IOSocket&& rhs) noexcept; // move\n\n\t};\n\n\n\n\ttemplate<class vType>\n\n\tinline bool IOSocket::ReadVar(vType& var) {\n\n\t\treturn Read(&var, sizeof (vType));\n\n\t}\n\n\n\n\ttemplate<class vType>\n\n\tinline bool IOSocket::PeekVar(vType& var) {\n\n\t\treturn Peek(&var, sizeof (vType));\n\n\t}\n\n\n\n\ttemplate<class vType>\n\n\tinline void IOSocket::WriteVar(vType var) {\n\n\t\tWrite(&var, sizeof (vType));\n\n\t}\n", "file_path": "DigitalHaze-Libraries/include/DH_Socket.hpp", "rank": 57, "score": 25210.944943322742 }, { "content": "\t\t}\n\n\t\t\n\n\t\tinline void ClearEgressData() {\n\n\t\t\twriteBuffer.ClearData();\n\n\t\t}\n\n\t\t\n\n\t\tinline void* GetEgressDataPointer() const {\n\n\t\t\treturn writeBuffer.GetBufferStart();\n\n\t\t}\n\n\tprivate:\n\n\t\t// We use our own buffers and we do not increase the size\n\n\t\t// of the send and recv buffer because of several reasons.\n\n\t\t// The system already optimizes stuff like this for performance,\n\n\t\t// so we don't want to use defaults. If the system wants us to not\n\n\t\t// write data, we should be okay with that and just buffer ourselves.\n\n\t\tBuffer readBuffer;\n\n\t\tBuffer writeBuffer;\n\n\tpublic:\n\n\t\t// Rule of 5\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_Socket.hpp", "rank": 58, "score": 25210.477444786375 }, { "content": "\n\n\tinline size_t IOSocket::ReadString(char* outString, size_t maxLen) {\n\n\t\treturn readBuffer.ReadString(outString, maxLen);\n\n\t}\n\n\n\n\tinline size_t IOSocket::PeekString(char* outString, size_t maxLen) const {\n\n\t\treturn readBuffer.PeekString(outString, maxLen);\n\n\t}\n\n}\n\n\n\n#endif /* SOCKET_HPP */", "file_path": "DigitalHaze-Libraries/include/DH_Socket.hpp", "rank": 59, "score": 25209.8700164807 }, { "content": "/*\n\n * The MIT License\n\n *\n\n * Copyright 2017 phytress.\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n *\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n", "file_path": "DigitalHaze-Libraries/include/DH_Socket.hpp", "rank": 60, "score": 25206.580549918013 }, { "content": "/*\n\n * The MIT License\n\n *\n\n * Copyright 2017 Syed Ali <[email protected]>.\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n *\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n", "file_path": "DigitalHaze-Libraries/include/DH_Common.hpp", "rank": 61, "score": 25206.512553449887 }, { "content": "/*\n\n * The MIT License\n\n *\n\n * Copyright 2017 Syed Ali <[email protected]>.\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n *\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n", "file_path": "DigitalHaze-Libraries/include/DH_Base64.hpp", "rank": 62, "score": 25206.512553449887 }, { "content": " * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n */\n\n\n\n/* \n\n * File: DH_Common.hpp\n\n * Author: Syed Ali <[email protected]>\n\n *\n\n * Created on August 15, 2017, 10:52 AM\n\n */\n\n\n\n#ifndef DH_COMMON_HPP\n\n#define DH_COMMON_HPP\n\n\n\n#define COLOR_RED\t\t\"\\x1b[31m\"\n\n#define COLOR_GREEN\t\t\"\\x1b[32m\"\n\n#define COLOR_YELLOW\t\"\\x1b[33m\"\n\n#define COLOR_BLUE\t\t\"\\x1b[34m\"\n\n#define COLOR_MAGENTA\t\"\\x1b[35m\"\n\n#define COLOR_CYAN\t\t\"\\x1b[36m\"\n", "file_path": "DigitalHaze-Libraries/include/DH_Common.hpp", "rank": 63, "score": 25203.64264730815 }, { "content": "\n\n\t\t// Add a socket to the poll list\n\n\t\tvoid AddSocketToPollList(int sockfd);\n\n\n\n\t\t// Remove a socket from the poll list.\n\n\t\t// Returns false if the socket file descriptor is not found\n\n\t\tbool RemoveSocketFromPollList(int sockfd);\n\n\n\n\t\t// Remove a socket from the specified list.\n\n\t\tstatic bool RemoveSocketFromVector(Socket* pSock,\n\n\t\t\t\t\t\t\t\t\t\tstd::vector<socketEntry>& list,\n\n\t\t\t\t\t\t\t\t\t\tsize_t& vectorIndex);\n\n\n\n\t\t// Gets the next socketEntry from the specified list\n\n\t\tstatic Socket* GetNextEntryFromList(std::vector<socketEntry>& list,\n\n\t\t\t\t\t\t\t\t\t\t\tsize_t& index,\n\n\t\t\t\t\t\t\t\t\t\t\tvoid** pParam = nullptr);\n\n\n\n\t\t// Returns the index inside sockList where sockfd occurs.\n\n\t\t// If it is not found, -1 is returned.\n\n\t\tssize_t GetListIndexFromFD(int sockfd) const;\n\n\t};\n\n}\n\n\n\n#endif /* DH_SOCKETPOOL_HPP */\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_SocketPool.hpp", "rank": 64, "score": 24305.448777052097 }, { "content": "#include <vector>\n\n\n\n#define DH_SOCKETPOOL_DEFAULTSIZE 50\n\n\n\nnamespace DigitalHaze {\n\n\n\n\tstruct socketEntry {\n\n\t\tSocket* pSocket;\n\n\t\tvoid* pParam;\n\n\t\tbool passiveSocket;\n\n\t};\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_SocketPool.hpp", "rank": 65, "score": 24303.691861028485 }, { "content": "\t\t// Removes a socket from the list.\n\n\t\tbool RemoveSocket(Socket* pSocket);\n\n\n\n\t\t// Returns false on error. Returns true if sockets are ready\n\n\t\t// to be worked with. Blocks for the specified number of milliseconds.\n\n\t\t// If the milliseconds is negative, then the function will block\n\n\t\t// until interrupted or until something in our list is ready for IO.\n\n\t\t// A value of zero will not block.\n\n\t\tbool PollSockets(int milliSeconds = 0);\n\n\n\n\t\t// Returns the next readable socket after polling.\n\n\t\t// Returns null if there are no more readable sockets.\n\n\t\t// If pParam is not null, then the socket's associated pointer is filled.\n\n\n\n\t\tinline Socket* GetNextReadableSocket(void** pParam = nullptr) {\n\n\t\t\treturn GetNextEntryFromList(readList, readListIndex, pParam);\n\n\t\t}\n\n\n\n\t\t// Returns the next writable socket after polling.\n\n\t\t// Returns null if there are no more writable sockets.\n", "file_path": "DigitalHaze-Libraries/include/DH_SocketPool.hpp", "rank": 66, "score": 24303.255957854948 }, { "content": "\t\t// Let's you know if you're connected or not.\n\n\t\tbool isConnected() const;\n\n\n\n\t\t// Converts a TCPAddressStorage structure to a text address.\n\n\t\t// Returns false if the address cannot be parsed.\n\n\t\tstatic bool ConvertAddrToText(TCPAddressStorage& addr,\n\n\t\t\t\t\t\t\t\t\tsocklen_t len,\n\n\t\t\t\t\t\t\t\t\tchar* outText);\n\n\tprivate:\n\n\t};\n\n}\n\n\n\n#endif /* DH_TCPSOCKET_HPP */\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_TCPSocket.hpp", "rank": 67, "score": 24300.395654179687 }, { "content": "\t\t// If pParam is not null, then the socket's associated pointer is filled.\n\n\t\t// Writable sockets are only IOSockets and not passive.\n\n\n\n\t\tinline IOSocket* GetNextWritableSocket(void** pParam = nullptr) {\n\n\t\t\treturn static_cast<IOSocket*> (GetNextEntryFromList(writeList, writeListIndex, pParam));\n\n\t\t}\n\n\n\n\t\t// Returns the next socket that had an error on it after polling.\n\n\t\t// Returns null if there are no more error'd sockets.\n\n\t\t// If pParam is not null, then the socket's associated pointer is filled.\n\n\n\n\t\tinline Socket* GetNextErroredSocket(void** pParam = nullptr) {\n\n\t\t\treturn GetNextEntryFromList(errorList, errorListIndex, pParam);\n\n\t\t}\n\n\n\n\t\t// Returns the number of sockets in this pool\n\n\n\n\t\tinline size_t GetListSize() const {\n\n\t\t\treturn sockList.size();\n\n\t\t}\n", "file_path": "DigitalHaze-Libraries/include/DH_SocketPool.hpp", "rank": 68, "score": 24300.05231156583 }, { "content": " * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n */\n\n\n\n/* \n\n * File: DH_SocketPool.hpp\n\n * Author: phytress\n\n *\n\n * Created on July 14, 2017, 4:15 PM\n\n */\n\n\n\n#ifndef DH_SOCKETPOOL_HPP\n\n#define DH_SOCKETPOOL_HPP\n\n\n\n#include \"DH_ThreadLockedObject.hpp\"\n\n\n\n#include \"DH_Socket.hpp\"\n\n#include \"DH_Buffer.hpp\"\n\n\n\n#include <sys/poll.h>\n", "file_path": "DigitalHaze-Libraries/include/DH_SocketPool.hpp", "rank": 69, "score": 24297.995744012296 }, { "content": "\tprivate:\n\n\t\t// Our list of sockets\n\n\t\tstd::vector<socketEntry> sockList;\n\n\n\n\t\t// Our array that we poll with.\n\n\t\t// We keep this allocated and updated so we can poll without\n\n\t\t// having to allocate every time.\n\n\t\tBuffer pollfdsBuffer;\n\n\n\n\t\t// List that contains what sockets can be read from\n\n\t\tstd::vector<socketEntry> readList;\n\n\t\tsize_t readListIndex;\n\n\n\n\t\t// List that contains what sockets we can write to\n\n\t\tstd::vector<socketEntry> writeList;\n\n\t\tsize_t writeListIndex;\n\n\n\n\t\t// List that contains what sockets have errored.\n\n\t\tstd::vector<socketEntry> errorList;\n\n\t\tsize_t errorListIndex;\n", "file_path": "DigitalHaze-Libraries/include/DH_SocketPool.hpp", "rank": 70, "score": 24297.850831336873 }, { "content": " * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n */\n\n\n\n/* \n\n * File: DH_TCPSocket.hpp\n\n * Author: phytress\n\n *\n\n * Created on July 7, 2017, 5:42 PM\n\n */\n\n\n\n#ifndef DH_TCPSOCKET_HPP\n\n#define DH_TCPSOCKET_HPP\n\n\n\n#include <stdlib.h>\n\n#include <netdb.h>\n\n\n\n#include \"DH_Socket.hpp\"\n\n\n\nnamespace DigitalHaze {\n\n\n\n\tunion TCPAddressStorage {\n\n\t\tsockaddr sa;\n\n\t\tsockaddr_in sa_ip4;\n\n\t\tsockaddr_in6 sa_ip6;\n\n\t\tsockaddr_storage sa_storage;\n\n\t};\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_TCPSocket.hpp", "rank": 71, "score": 24297.547603950614 }, { "content": "/*\n\n * The MIT License\n\n *\n\n * Copyright 2017 phytress.\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n *\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n", "file_path": "DigitalHaze-Libraries/include/DH_TCPSocket.hpp", "rank": 72, "score": 24294.93984035152 }, { "content": "/*\n\n * The MIT License\n\n *\n\n * Copyright 2017 phytress.\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n *\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n", "file_path": "DigitalHaze-Libraries/include/DH_SocketPool.hpp", "rank": 73, "score": 24294.93984035152 }, { "content": "\tclass Socket {\n\n\t\t// We friend these classes so they can either:\n\n\t\t// * Use our file descriptor directly\n\n\t\t// * Access or set errors\n\n\t\t// No one else needs this access since others may mess with our sockfd.\n\n\t\tfriend class TCPSocket;\n\n\t\tfriend class TCPClientSocket;\n\n\t\tfriend class TCPServerSocket;\n\n\t\tfriend class SocketPool;\n\n\tpublic:\n\n\t\tSocket();\n\n\t\tvirtual ~Socket();\n\n\n\n\t\t// Retrieve the last errno caused by a socket operation.\n\n\n\n\t\tinline int GetLastError() const {\n\n\t\t\treturn lasterrno;\n\n\t\t}\n\n\n\n\t\tvirtual void CloseSocket();\n", "file_path": "DigitalHaze-Libraries/include/DH_Socket.hpp", "rank": 74, "score": 24292.001937741654 }, { "content": "\t\t/*virtual bool PerformSocketRead(size_t len = 0, bool flush = false) override;\n\n\t\tvirtual bool PerformSocketWrite(bool flush = false) override;\n\n\t\tvirtual bool Read(void* outBuffer, size_t len) override;\n\n\t\tvirtual bool Peek(void* outBuffer, size_t len) override;\n\n\t\tvirtual void Write(void* inBuffer, size_t len) override;*/\n\n\n\n\t\t// Our thread needs access to our internals\n\n\t\tfriend void* ListenerThread(void*);\n\n\tprivate:\n\n\t\t// Thread status\n\n\t\tvolatile sig_atomic_t listenerThreadStatus;\n\n\t\t// Thread\n\n\t\tpthread_t listenerThread;\n\n\t\t// Condition variable for new connections\n\n\t\tpthread_cond_t waitNewConnectionCond;\n\n\n\n\t\t// When our thread gets a new socket, we store it until another\n\n\t\t// thread retrieves it\n\n\t\tint newsockfd;\n\n\t\tTCPAddressStorage remoteAddr;\n", "file_path": "DigitalHaze-Libraries/include/DH_TCPServerSocket.hpp", "rank": 75, "score": 23455.397383018717 }, { "content": "\t\t// Being successfully connected (or not) will return false.\n\n\t\t// To check if connected successfully, see isConnected()\n\n\t\tbool isConnecting() const;\n\n\n\n\t\t// Returns what address is currently being used, whether the\n\n\t\t// connection is still connecting or already connected.\n\n\t\tvoid GetConnectedAddress(sockaddr* addrOut) const;\n\n\t\tvoid GetConnectedAddressLen(socklen_t& addrLen) const;\n\n\n\n\t\t// Override of closing a TCP socket. Zero more data from this class.\n\n\t\tvirtual void CloseSocket() override;\n\n\n\n\t\t// Our thread needs access to our internals\n\n\t\tfriend void* ConnectThread(void*);\n\n\tprivate:\n\n\t\t// Thread status\n\n\t\tvolatile sig_atomic_t connectThreadStatus;\n\n\t\t// Thread pointer\n\n\t\tpthread_t connectThread;\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_TCPClientSocket.hpp", "rank": 76, "score": 23451.26335598452 }, { "content": "\t\tsocklen_t remoteAddrLen;\n\n\n\n\t\t// Notify object for when a new connection was retrieved\n\n\t\tvoid Thread_NotifyNewClient(int newfd, TCPAddressStorage* addr, socklen_t addrLen);\n\n\n\n\t\t// Closes the listening thread\n\n\t\tvoid CloseCurrentThreads();\n\n\n\n\t\t// Give our thread access to private parent functions\n\n\n\n\t\tinline void Thread_RecordErrno() {\n\n\t\t\tSocket::RecordErrno();\n\n\t\t}\n\n\n\n\t\tinline void Thread_RecordErrno(int setErrno) {\n\n\t\t\tSocket::RecordErrno(setErrno);\n\n\t\t}\n\n\n\n\t\tinline int Thread_GetSockFD() {\n\n\t\t\treturn Socket::sockfd;\n\n\t\t}\n\n\t};\n\n\t\n\n\tvoid* ListenerThread(void*);\n\n}\n\n\n\n#endif /* DH_TCPSERVERSOCKET_HPP */\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_TCPServerSocket.hpp", "rank": 77, "score": 23450.71359163011 }, { "content": "\t\tinline void Thread_SetSockFD(int newfd) {\n\n\t\t\tSocket::sockfd = newfd;\n\n\t\t}\n\n\t};\n\n\n\n\tvoid* ConnectThread(void*);\n\n}\n\n\n\n#endif /* DH_TCPCLIENTSOCKET_HPP */\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_TCPClientSocket.hpp", "rank": 78, "score": 23450.706131452298 }, { "content": " * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n */\n\n\n\n/* \n\n * File: DH_TCPClientSocket.hpp\n\n * Author: phytress\n\n *\n\n * Created on July 9, 2017, 12:59 AM\n\n */\n\n\n\n#ifndef DH_TCPCLIENTSOCKET_HPP\n\n#define DH_TCPCLIENTSOCKET_HPP\n\n\n\n#include \"DH_TCPSocket.hpp\"\n\n#include \"DH_ThreadLockedObject.hpp\"\n\n\n\n#include <signal.h>\n\n#include <pthread.h>\n\n\n\n#include <sys/socket.h>\n\n#include <sys/types.h>\n\n\n\n#include <netdb.h>\n\n\n\nnamespace DigitalHaze {\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_TCPClientSocket.hpp", "rank": 79, "score": 23450.331405178436 }, { "content": " * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n */\n\n\n\n/* \n\n * File: DH_TCPServerSocket.hpp\n\n * Author: phytress\n\n *\n\n * Created on July 11, 2017, 4:01 PM\n\n */\n\n\n\n#ifndef DH_TCPSERVERSOCKET_HPP\n\n#define DH_TCPSERVERSOCKET_HPP\n\n\n\n#include <pthread.h>\n\n#include <signal.h>\n\n\n\n#include \"DH_Socket.hpp\"\n\n#include \"DH_TCPSocket.hpp\"\n\n#include \"DH_ThreadLockedObject.hpp\"\n\n\n\nnamespace DigitalHaze {\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_TCPServerSocket.hpp", "rank": 80, "score": 23450.16637994454 }, { "content": " * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n */\n\n\n\n/* \n\n * File: DH_ThreadedObject.hpp\n\n * Author: phytress\n\n *\n\n * Created on July 9, 2017, 1:22 PM\n\n */\n\n\n\n#ifndef DH_THREADLOCKEDOBJECT_HPP\n\n#define DH_THREADLOCKEDOBJECT_HPP\n\n\n\n#include <pthread.h>\n\n\n\nnamespace DigitalHaze {\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_ThreadLockedObject.hpp", "rank": 81, "score": 23449.334441377418 }, { "content": "\t\t// Resolved connected address\n\n\t\tTCPAddressStorage connectedAddress;\n\n\t\tsocklen_t connectedAddressLen;\n\n\n\n\t\tvoid CloseCurrentThreads();\n\n\t\tvoid SetConnectedAddress(sockaddr* cAddress, socklen_t cAddressLen);\n\n\n\n\t\t// Give our thread access to private parent functions\n\n\n\n\t\tinline void Thread_RecordErrno() {\n\n\t\t\tSocket::RecordErrno();\n\n\t\t}\n\n\n\n\t\t// When there's a lot of system calls going on, thread might\n\n\t\t// need to cache errors and set them in our object later.\n\n\n\n\t\tinline void Thread_RecordErrno(int setErrno) {\n\n\t\t\tSocket::RecordErrno(setErrno);\n\n\t\t}\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_TCPClientSocket.hpp", "rank": 82, "score": 23449.27968424886 }, { "content": "\t\t// If there is a thread running, the function will check the thread.\n\n\t\t// If there is no thread running, the function will block until\n\n\t\t// there is a new connection present. If an error occurs during blocking,\n\n\t\t// null is returned.\n\n\t\tTCPSocket* GetNewConnection(TCPAddressStorage* newAddr = nullptr,\n\n\t\t\t\t\t\t\t\t\tsocklen_t* newAddrLen = nullptr);\n\n\n\n\t\t// Override of closing a TCP socket. Need to make sure\n\n\t\t// all threads are closed too.\n\n\t\tvirtual void CloseSocket() override;\n\n\n\n\t\t// We could use a macro, but this works better with code parsing\n\n\n\n\t\tinline bool isListening() {\n\n\t\t\treturn Socket::sockfd != -1;\n\n\t\t}\n\n\n\n\t\t// For TCPServerSocket, a socket that only listens for new connections:\n\n\t\t// We override our read and write functions to always return false\n\n\t\t// and not do anything. There is no buffer that can be used.\n", "file_path": "DigitalHaze-Libraries/include/DH_TCPServerSocket.hpp", "rank": 83, "score": 23449.09476781622 }, { "content": "/*\n\n * The MIT License\n\n *\n\n * Copyright 2017 phytress.\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n *\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n", "file_path": "DigitalHaze-Libraries/include/DH_ThreadLockedObject.hpp", "rank": 84, "score": 23446.94682489439 }, { "content": "/*\n\n * The MIT License\n\n *\n\n * Copyright 2017 phytress.\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n *\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n", "file_path": "DigitalHaze-Libraries/include/DH_TCPClientSocket.hpp", "rank": 85, "score": 23446.94682489439 }, { "content": "/*\n\n * The MIT License\n\n *\n\n * Copyright 2017 phytress.\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n *\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n", "file_path": "DigitalHaze-Libraries/include/DH_TCPServerSocket.hpp", "rank": 86, "score": 23446.94682489439 }, { "content": "\n\n\t\tinline static void BroadcastCondition(pthread_cond_t& cond) {\n\n\t\t\tpthread_cond_broadcast(&cond);\n\n\t\t}\n\n\tprivate:\n\n\t\tpthread_mutex_t cs_mutex;\n\n\t};\n\n}\n\n\n\n#endif /* DH_THREADEDOBJECT_HPP */\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_ThreadLockedObject.hpp", "rank": 87, "score": 23446.76689289045 }, { "content": "\tclass IOSocket : public Socket {\n\n\t\t// Derived types work with our buffers.\n\n\t\tfriend class TCPSocket;\n\n\tpublic:\n\n\t\tIOSocket();\n\n\t\tvirtual ~IOSocket();\n\n\n\n\t\t// Perform a read into our internal read buffer.\n\n\t\t// If len is zero, any amount of data is read in.\n\n\t\t// If flush is true, then this function will block until\n\n\t\t// the specified amount of bytes is read.\n\n\t\t// If len is zero and flush is true, then the call will block\n\n\t\t// until the read buffer is full.\n\n\t\t// Returns false on error, true for success.\n\n\t\tvirtual bool PerformSocketRead(size_t len = 0, bool flush = false) = 0;\n\n\n\n\t\t// Perform a write from our outgoing buffer.\n\n\t\t// If flush is set to true, then the function will\n\n\t\t// block until all data in our outgoing buffer is sent.\n\n\t\t// Returns false on error, true on success.\n", "file_path": "DigitalHaze-Libraries/include/DH_Socket.hpp", "rank": 88, "score": 21914.043936585007 }, { "content": "\tclass ThreadLockedObject {\n\n\tpublic:\n\n\t\tThreadLockedObject() noexcept;\n\n\t\t~ThreadLockedObject();\n\n\n\n\t\tinline void LockObject() {\n\n\t\t\tpthread_mutex_lock(&cs_mutex);\n\n\t\t}\n\n\t\t\n\n\t\tinline void UnlockObject() {\n\n\t\t\tpthread_mutex_unlock(&cs_mutex);\n\n\t\t}\n\n\n\n\t\tinline void WaitOnCondition(pthread_cond_t& cond) {\n\n\t\t\tpthread_cond_wait(&cond, &cs_mutex);\n\n\t\t}\n\n\n\n\t\tinline static void SignalCondition(pthread_cond_t& cond) {\n\n\t\t\tpthread_cond_signal(&cond);\n\n\t\t}\n", "file_path": "DigitalHaze-Libraries/include/DH_ThreadLockedObject.hpp", "rank": 89, "score": 21221.579733035083 }, { "content": "\tclass TCPSocket : public IOSocket {\n\n\tpublic:\n\n\t\tTCPSocket();\n\n\t\texplicit TCPSocket(int connectedfd);\n\n\t\tvirtual ~TCPSocket();\n\n\n\n\t\t// Perform a read into our internal read buffer.\n\n\t\t// If len is zero, any amount of data is read in.\n\n\t\t// If flush is true, then this function will block until\n\n\t\t// the specified amount of bytes is read.\n\n\t\t// If len is zero and flush is true, then the call will block\n\n\t\t// until the read buffer is full.\n\n\t\tvirtual bool PerformSocketRead(size_t len = 0, bool flush = false) override;\n\n\n\n\t\t// Perform a write from our outgoing buffer.\n\n\t\t// If flush is set to true, then the function will\n\n\t\t// block until all data in our outgoing buffer is sent.\n\n\t\t// Returns false on error, true on success.\n\n\t\tvirtual bool PerformSocketWrite(bool flush = false) override;\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_TCPSocket.hpp", "rank": 90, "score": 20571.537532054117 }, { "content": "\tclass SocketPool : public ThreadLockedObject {\n\n\tpublic:\n\n\t\t// The default pool size is how many clients we're anticipating.\n\n\t\t// If that maximum is reached, we allocate more space for\n\n\t\t// a number of clients specified by expandSlotsSize.\n\n\t\t// If expandSlotsSize is zero, then no additional space is allocated\n\n\t\t// and an overflow error is thrown.\n\n\t\t// If the pool size is 0, then a default size of 50 is used.\n\n\t\t// This is defined by DH_SOCKETPOOL_DEFAULTSIZE.\n\n\t\texplicit SocketPool(size_t defaultPoolSize = DH_SOCKETPOOL_DEFAULTSIZE,\n\n\t\t\t\t\t\t\tsize_t expandSlotsSize = DH_SOCKETPOOL_DEFAULTSIZE);\n\n\t\t~SocketPool();\n\n\n\n\t\t// Adds a socket to the list. pParam is an optional parameter.\n\n\t\t// This pointer is given along with the socket when any activity\n\n\t\t// is detected.\n\n\t\tvoid AddSocket(IOSocket* pSocket, void* pParam = nullptr);\n\n\t\t// Adds a passive socket to the list.\n\n\t\tvoid AddPassiveSocket(Socket* pSocket, void* pParam = nullptr);\n\n\n", "file_path": "DigitalHaze-Libraries/include/DH_SocketPool.hpp", "rank": 91, "score": 19960.134885499527 }, { "content": "\tclass TCPServerSocket : public Socket, public ThreadLockedObject {\n\n\tpublic:\n\n\t\tTCPServerSocket();\n\n\t\t~TCPServerSocket();\n\n\n\n\t\t// Creates our listener\n\n\t\tbool CreateListener(unsigned short port);\n\n\t\t// Creates our listener on a separate thread\n\n\t\tbool CreateThreadedListener(unsigned short port);\n\n\t\t// Retrieves a new client connection from the seperated thread.\n\n\t\t// Optionally, pass a sockaddr structure or socklen_t* to retrieve\n\n\t\t// the new connection's address info. Either or both can be null\n\n\t\t// to be disregarded. Returns null if there is no waiting connection.\n\n\t\t// Also returns null if there is no thread running.\n\n\t\tTCPSocket* GetNewConnectionFromThread(TCPAddressStorage* newAddr = nullptr,\n\n\t\t\t\t\t\t\t\t\t\t\tsocklen_t* newAddrLen = nullptr);\n\n\t\t// Retrieves a new client connection.\n\n\t\t// Optionally, pass a sockaddr structure or socklen_t* to retrieve\n\n\t\t// the new connection's address info. Either or both can be null\n\n\t\t// to be disregarded. Returns null if there is no waiting connection.\n", "file_path": "DigitalHaze-Libraries/include/DH_TCPServerSocket.hpp", "rank": 92, "score": 17839.337081727637 }, { "content": "\tclass TCPClientSocket : public TCPSocket, public ThreadLockedObject {\n\n\tpublic:\n\n\t\tTCPClientSocket();\n\n\t\tvirtual ~TCPClientSocket();\n\n\n\n\t\t// A blocking connect attempt. Will return true if successful.\n\n\t\t// False if connection did not go through.\n\n\t\tbool AttemptConnect(const char* hostname, unsigned short port);\n\n\n\n\t\t// A non-blocking connect attempt.\n\n\t\t// The return is true if everything is going fine (not if you're\n\n\t\t// connected). If it is false, the thread or some other part\n\n\t\t// failed.\n\n\t\t// To check if you're connected, isConnecting() will return false,\n\n\t\t// and isConnected() will return true.\n\n\t\tbool AttemptThreadedConnect(const char* hostname, unsigned short port);\n\n\n\n\t\t// If a threaded attempt to connect was attempted\n\n\t\t// this function will let you know if the thread\n\n\t\t// is still in process of connecting.\n", "file_path": "DigitalHaze-Libraries/include/DH_TCPClientSocket.hpp", "rank": 93, "score": 17377.733743752982 }, { "content": " * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n */\n\n\n\n#include \"DH_Base64.hpp\"\n\n#include \"DH_BitParser.hpp\"\n\n\n\n#include <cstring>\n\n\n\nunsigned char reverse8(unsigned char b);\n\n\n\nsize_t DigitalHaze::Base64Encode(void* src, void* dest, size_t srclen) {\n\n\tif (!src) return 0;\n\n\tif (!dest) return 0;\n\n\tif (!srclen) return 0;\n\n\n\n\tchar* destBuf = (char*) dest;\n\n\tsize_t destPos = 0;\n\n\tsize_t i;\n\n\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Base64.cpp", "rank": 94, "score": 15.602248153225489 }, { "content": "\n\nsize_t DigitalHaze::Base64Decode(void* src, void* dest, size_t srclen) {\n\n\tif (!src) return 0;\n\n\tif (!dest) return 0;\n\n\tif (!srclen) return 0;\n\n\n\n\tDigitalHaze::BitParser destBBuf(dest, 0);\n\n\n\n\tfor (size_t i = 0; i < srclen; ++i) {\n\n\t\tunsigned char curLetter = *((unsigned char*) src + i);\n\n\t\t//if (curLetter != '=') {\n\n\t\t\tunsigned char curValue = Base64CharToInt(curLetter);\n\n\n\n\t\t\tcurValue = reverse8(curValue) >> 2;\n\n\n\n\t\t\tdestBBuf.WriteBits(curValue, 6);\n\n\t\t//}\n\n\t}\n\n\n\n\tsize_t len = (unsigned char*) destBBuf.getDataPtr() - (unsigned char*) dest;\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Base64.cpp", "rank": 95, "score": 14.770060442654174 }, { "content": "\n\n\t// All of the bits are in reverse because of how Base64 decodes\n\n\tfor (size_t i = 0; i < len; ++i)\n\n\t\t*((unsigned char*) dest + i) = reverse8(*((unsigned char*) dest + i));\n\n\n\n\treturn len;\n\n}\n\n\n\nchar DigitalHaze::IntToBase64Char(int num) {\n\n\tif (num < 0 || num > 63) return '\\0';\n\n\tchar retChar;\n\n\n\n\tif (num < 26) retChar = 'A' + num;\n\n\telse if (num < 52) retChar = 'a' + (num - 26);\n\n\telse if (num < 62) retChar = '0' + (num - 52);\n\n\telse if (num == 62) retChar = '+';\n\n\telse retChar = '/';\n\n\n\n\treturn retChar;\n\n}\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Base64.cpp", "rank": 96, "score": 12.805861226053743 }, { "content": "\t\tfor (int x = 0; x < readLen; ++x)\n\n\t\t\tthreebytes[x] = reverse8(*((unsigned char*) src + i + x));\n\n\n\n\t\t// Read up to 4 sets of 6 bits = 24 bits\n\n\t\tfor (int x = 0; x < readLen + 1; ++x) {\n\n\t\t\t// These 6 bits have to be re-reversed because we had put them\n\n\t\t\t// out of order when reading it sequentially\n\n\t\t\tint readVal = reverse8(bytebuf.ReadBits<int>(6)) >> 2;\n\n\t\t\tdestBuf[destPos++] = IntToBase64Char(readVal);\n\n\t\t}\n\n\n\n\t\ti += readLen;\n\n\t}\n\n\n\n\t// If we're not divisble by a length of 3, add a padding of = signs\n\n\tfor (; i % 3; ++i) destBuf[destPos++] = '=';\n\n\tdestBuf[destPos] = '\\0';\n\n\n\n\treturn destPos;\n\n}\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Base64.cpp", "rank": 97, "score": 12.349882974360415 }, { "content": "\n\nint DigitalHaze::Base64CharToInt(char c) {\n\n\tif (c == '+') return 62;\n\n\telse if (c == '/') return 63;\n\n\telse if (c == '=') return 0;\n\n\telse if (c >= 'A' && c <= 'Z')\n\n\t\treturn (c - 'A');\n\n\telse if (c >= 'a' && c <= 'z')\n\n\t\treturn (c - 'a') + 26;\n\n\telse if (c >= '0' && c <= '9')\n\n\t\treturn (c - '0') + 52;\n\n\treturn 0;\n\n}\n\n\n\nunsigned char reverse8(unsigned char b) {\n\n\tb = (b & 0xF0) >> 4 | (b & 0x0F) << 4;\n\n\tb = (b & 0xCC) >> 2 | (b & 0x33) << 2;\n\n\tb = (b & 0xAA) >> 1 | (b & 0x55) << 1;\n\n\treturn b;\n\n}", "file_path": "DigitalHaze-Libraries/cpp/DH_Base64.cpp", "rank": 98, "score": 11.408272567498061 }, { "content": "\tif (!PerformSocketRead(len - readBuffer.GetBufferDataLen(), true)) {\n\n\t\t// Error!\n\n\t\treturn false;\n\n\t}\n\n\n\n\t// There is no reason for this to return false now, but pass\n\n\t// any errors anyway\n\n\treturn readBuffer.Peek(outBuffer, len);\n\n}\n\n\n\nvoid DigitalHaze::IOSocket::Write(void* inBuffer, size_t len) {\n\n\twriteBuffer.Write(inBuffer, len);\n\n}\n\n\n\nsize_t DigitalHaze::IOSocket::WriteString(const char* fmtStr, ...) {\n\n\tchar* message = nullptr;\n\n\tint msgLen;\n\n\n\n\tva_list list;\n\n\tva_start(list, fmtStr);\n", "file_path": "DigitalHaze-Libraries/cpp/DH_Socket.cpp", "rank": 99, "score": 11.065047841151374 } ]
C++
qt-creator-opensource-src-4.6.1/src/plugins/qmldesigner/designercore/metainfo/itemlibraryinfo.cpp
kevinlq/Qt-Creator-Opensource-Study
b8cadff1f33f25a5d4ef33ed93f661b788b1ba0f
#include "itemlibraryinfo.h" #include "nodemetainfo.h" #include <QSharedData> #include <utils/fileutils.h> namespace QmlDesigner { namespace Internal { class ItemLibraryEntryData : public QSharedData { public: ItemLibraryEntryData() : majorVersion(-1), minorVersion(-1) { } QString name; TypeName typeName; QString category; int majorVersion; int minorVersion; QString libraryEntryIconPath; QIcon typeIcon; QList<PropertyContainer> properties; QString qml; QString qmlSource; QString requiredImport; QHash<QString, QString> hints; }; } ItemLibraryEntry::ItemLibraryEntry(const ItemLibraryEntry &other) : m_data(other.m_data) { } ItemLibraryEntry& ItemLibraryEntry::operator=(const ItemLibraryEntry &other) { if (this !=&other) m_data = other.m_data; return *this; } void ItemLibraryEntry::setTypeIcon(const QIcon &icon) { m_data->typeIcon = icon; } void ItemLibraryEntry::addProperty(const Property &property) { m_data->properties.append(property); } QList<ItemLibraryEntry::Property> ItemLibraryEntry::properties() const { return m_data->properties; } QHash<QString, QString> ItemLibraryEntry::hints() const { return m_data->hints; } ItemLibraryEntry::ItemLibraryEntry() : m_data(new Internal::ItemLibraryEntryData) { m_data->name.clear(); } ItemLibraryEntry::~ItemLibraryEntry() { } QString ItemLibraryEntry::name() const { return m_data->name; } TypeName ItemLibraryEntry::typeName() const { return m_data->typeName; } QString ItemLibraryEntry::qmlPath() const { return m_data->qml; } QString ItemLibraryEntry::qmlSource() const { return m_data->qmlSource; } QString ItemLibraryEntry::requiredImport() const { return m_data->requiredImport; } int ItemLibraryEntry::majorVersion() const { return m_data->majorVersion; } int ItemLibraryEntry::minorVersion() const { return m_data->minorVersion; } QString ItemLibraryEntry::category() const { return m_data->category; } void ItemLibraryEntry::setCategory(const QString &category) { m_data->category = category; } QIcon ItemLibraryEntry::typeIcon() const { return m_data->typeIcon; } QString ItemLibraryEntry::libraryEntryIconPath() const { return m_data->libraryEntryIconPath; } void ItemLibraryEntry::setName(const QString &name) { m_data->name = name; } void ItemLibraryEntry::setType(const TypeName &typeName, int majorVersion, int minorVersion) { m_data->typeName = typeName; m_data->majorVersion = majorVersion; m_data->minorVersion = minorVersion; } void ItemLibraryEntry::setLibraryEntryIconPath(const QString &iconPath) { m_data->libraryEntryIconPath = iconPath; } static QByteArray getSourceForUrl(const QString &fileURl) { Utils::FileReader fileReader; if (fileReader.fetch(fileURl)) return fileReader.data(); else return Utils::FileReader::fetchQrc(fileURl); } void ItemLibraryEntry::setQmlPath(const QString &qml) { m_data->qml = qml; m_data->qmlSource = QString::fromUtf8(getSourceForUrl(qml)); } void ItemLibraryEntry::setRequiredImport(const QString &requiredImport) { m_data->requiredImport = requiredImport; } void ItemLibraryEntry::addHints(const QHash<QString, QString> &hints) { m_data->hints.unite(hints); } void ItemLibraryEntry::addProperty(PropertyName &name, QString &type, QVariant &value) { Property property; property.set(name, type, value); addProperty(property); } QDataStream& operator<<(QDataStream& stream, const ItemLibraryEntry &itemLibraryEntry) { stream << itemLibraryEntry.name(); stream << itemLibraryEntry.typeName(); stream << itemLibraryEntry.majorVersion(); stream << itemLibraryEntry.minorVersion(); stream << itemLibraryEntry.typeIcon(); stream << itemLibraryEntry.libraryEntryIconPath(); stream << itemLibraryEntry.category(); stream << itemLibraryEntry.requiredImport(); stream << itemLibraryEntry.hints(); stream << itemLibraryEntry.m_data->properties; stream << itemLibraryEntry.m_data->qml; stream << itemLibraryEntry.m_data->qmlSource; return stream; } QDataStream& operator>>(QDataStream& stream, ItemLibraryEntry &itemLibraryEntry) { stream >> itemLibraryEntry.m_data->name; stream >> itemLibraryEntry.m_data->typeName; stream >> itemLibraryEntry.m_data->majorVersion; stream >> itemLibraryEntry.m_data->minorVersion; stream >> itemLibraryEntry.m_data->typeIcon; stream >> itemLibraryEntry.m_data->libraryEntryIconPath; stream >> itemLibraryEntry.m_data->category; stream >> itemLibraryEntry.m_data->requiredImport; stream >> itemLibraryEntry.m_data->hints; stream >> itemLibraryEntry.m_data->properties; stream >> itemLibraryEntry.m_data->qml; stream >> itemLibraryEntry.m_data->qmlSource; return stream; } QDebug operator<<(QDebug debug, const ItemLibraryEntry &itemLibraryEntry) { debug << itemLibraryEntry.m_data->name; debug << itemLibraryEntry.m_data->typeName; debug << itemLibraryEntry.m_data->majorVersion; debug << itemLibraryEntry.m_data->minorVersion; debug << itemLibraryEntry.m_data->typeIcon; debug << itemLibraryEntry.m_data->libraryEntryIconPath; debug << itemLibraryEntry.m_data->category; debug << itemLibraryEntry.m_data->requiredImport; debug << itemLibraryEntry.m_data->hints; debug << itemLibraryEntry.m_data->properties; debug << itemLibraryEntry.m_data->qml; debug << itemLibraryEntry.m_data->qmlSource; return debug.space(); } ItemLibraryInfo::ItemLibraryInfo(QObject *parent) : QObject(parent) { } QList<ItemLibraryEntry> ItemLibraryInfo::entriesForType(const QByteArray &typeName, int majorVersion, int minorVersion) const { QList<ItemLibraryEntry> entries; foreach (const ItemLibraryEntry &entry, m_nameToEntryHash) { if (entry.typeName() == typeName) entries += entry; } if (m_baseInfo) entries += m_baseInfo->entriesForType(typeName, majorVersion, minorVersion); return entries; } ItemLibraryEntry ItemLibraryInfo::entry(const QString &name) const { if (m_nameToEntryHash.contains(name)) return m_nameToEntryHash.value(name); if (m_baseInfo) return m_baseInfo->entry(name); return ItemLibraryEntry(); } QList<ItemLibraryEntry> ItemLibraryInfo::entries() const { QList<ItemLibraryEntry> list = m_nameToEntryHash.values(); if (m_baseInfo) list += m_baseInfo->entries(); return list; } static inline QString keyForEntry(const ItemLibraryEntry &entry) { return entry.name() + entry.category() + QString::number(entry.majorVersion()); } void ItemLibraryInfo::addEntries(const QList<ItemLibraryEntry> &entries, bool overwriteDuplicate) { foreach (const ItemLibraryEntry &entry, entries) { const QString key = keyForEntry(entry); if (!overwriteDuplicate && m_nameToEntryHash.contains(key)) throw InvalidMetaInfoException(__LINE__, __FUNCTION__, __FILE__); m_nameToEntryHash.insert(key, entry); } emit entriesChanged(); } bool ItemLibraryInfo::containsEntry(const ItemLibraryEntry &entry) { const QString key = keyForEntry(entry); return m_nameToEntryHash.contains(key); } void ItemLibraryInfo::clearEntries() { m_nameToEntryHash.clear(); emit entriesChanged(); } QStringList ItemLibraryInfo::blacklistImports() const { auto list = m_blacklistImports; if (m_baseInfo) list.append(m_baseInfo->m_blacklistImports); return list; } QStringList ItemLibraryInfo::showTagsForImports() const { auto list = m_showTagsForImports; if (m_baseInfo) list.append(m_baseInfo->m_showTagsForImports); list.removeDuplicates(); return list; } void ItemLibraryInfo::addBlacklistImports(const QStringList &list) { m_blacklistImports.append(list); } void ItemLibraryInfo::addShowTagsForImports(const QStringList &list) { m_showTagsForImports.append(list); } void ItemLibraryInfo::setBaseInfo(ItemLibraryInfo *baseInfo) { m_baseInfo = baseInfo; } }
#include "itemlibraryinfo.h" #include "nodemetainfo.h" #include <QSharedData> #include <utils/fileutils.h> namespace QmlDesigner { namespace Internal { class ItemLibraryEntryData : public QSharedData { public: ItemLibraryEntryData() : majorVersion(-1), minorVersion(-1) { } QString name; TypeName typeName; QString category; int majorVersion; int minorVersion; QString libraryEntryIconPath; QIcon typeIcon; QList<PropertyContainer> properties; QString qml; QString qmlSource; QString requiredImport; QHash<QString, QString> hints; }; } ItemLibraryEntry::ItemLibraryEntry(const ItemLibraryEntry &other) : m_data(other.m_data) { } ItemLibraryEntry& ItemLibraryEntry::operator=(const ItemLibraryEntry &other) { if (this !=&other) m_data = other.m_data; return *this; } void ItemLibraryEntry::setTypeIcon(const QIcon &icon) { m_data->typeIcon = icon; } void ItemLibraryEntry::addProperty(const Property &property) { m_data->properties.append(property); } QList<ItemLibraryEntry::Property> ItemLibraryEntry::properties() const { return m_data->properties; } QHash<QString, QString> ItemLibraryEntry::hints() const { return m_data->hints; } ItemLibraryEntry::ItemLibraryEntry() : m_data(new Internal::ItemLibraryEntryData) { m_data->name.clear(); } ItemLibraryEntry::~ItemLibraryEntry() { } QString ItemLibraryEntry::name() const { return m_data->name; } TypeName ItemLibraryEntry::typeName() const { return m_data->typeName; } QString ItemLibraryEntry::qmlPath() const { return m_data->qml; } QString ItemLibraryEntry::qmlSource() const { return m_data->qmlSource; } QString ItemLibraryEntry::requiredImport() const { return m_data->requiredImport; } int ItemLibraryEntry::majorVersion() const { return m_data->majorVersion; } int ItemLibraryEntry::minorVersion() const { return m_data->minorVersion; } QString ItemLibraryEntry::category() const { return m_data->category; } void ItemLibraryEntry::setCategory(const QString &category) { m_data->category = category; } QIcon ItemLibraryEntry::typeIcon() const { return m_data->typeIcon; } QString ItemLibraryEntry::libraryEntryIconPath() const { return m_data->libraryEntryIconPath; } void ItemLibraryEntry::setName(const QString &name) { m_data->name = name; } void ItemLibraryEntry::setType(const TypeName &typeName, int majorVersion, int minorVersion) { m_data->typeName = typeName; m_data->majorVersion = majorVersion; m_data->minorVersion = minorVersion; } void ItemLibraryEntry::setLibraryEntryIconPath(const QString &iconPath) { m_data->libraryEntryIconPath = iconPath; } static QByteArray getSourceForUrl(const QString &fileURl) { Utils::FileReader fileReader; if (fileReader.fetch(fileURl)) return fileReader.data(); else return Utils::FileReader::fetchQrc(fileURl); } void ItemLibraryEntry::setQmlPath(const QString &qml) { m_data->qml = qml; m_data->qmlSource = QString::fromUtf8(getSourceForUrl(qml)); } void ItemLibraryEntry::setRequiredImport(const QString &requiredImport) { m_data->requiredImport = requiredImport; } void ItemLibraryEntry::addHints(const QHash<QString, QString> &hints) { m_data->hints.unite(hints); } void ItemLibraryEntry::addProperty(PropertyName &name, QString &type, QVariant &value) { Property property; property.set(name, type, value); addProperty(property); }
QDataStream& operator>>(QDataStream& stream, ItemLibraryEntry &itemLibraryEntry) { stream >> itemLibraryEntry.m_data->name; stream >> itemLibraryEntry.m_data->typeName; stream >> itemLibraryEntry.m_data->majorVersion; stream >> itemLibraryEntry.m_data->minorVersion; stream >> itemLibraryEntry.m_data->typeIcon; stream >> itemLibraryEntry.m_data->libraryEntryIconPath; stream >> itemLibraryEntry.m_data->category; stream >> itemLibraryEntry.m_data->requiredImport; stream >> itemLibraryEntry.m_data->hints; stream >> itemLibraryEntry.m_data->properties; stream >> itemLibraryEntry.m_data->qml; stream >> itemLibraryEntry.m_data->qmlSource; return stream; } QDebug operator<<(QDebug debug, const ItemLibraryEntry &itemLibraryEntry) { debug << itemLibraryEntry.m_data->name; debug << itemLibraryEntry.m_data->typeName; debug << itemLibraryEntry.m_data->majorVersion; debug << itemLibraryEntry.m_data->minorVersion; debug << itemLibraryEntry.m_data->typeIcon; debug << itemLibraryEntry.m_data->libraryEntryIconPath; debug << itemLibraryEntry.m_data->category; debug << itemLibraryEntry.m_data->requiredImport; debug << itemLibraryEntry.m_data->hints; debug << itemLibraryEntry.m_data->properties; debug << itemLibraryEntry.m_data->qml; debug << itemLibraryEntry.m_data->qmlSource; return debug.space(); } ItemLibraryInfo::ItemLibraryInfo(QObject *parent) : QObject(parent) { } QList<ItemLibraryEntry> ItemLibraryInfo::entriesForType(const QByteArray &typeName, int majorVersion, int minorVersion) const { QList<ItemLibraryEntry> entries; foreach (const ItemLibraryEntry &entry, m_nameToEntryHash) { if (entry.typeName() == typeName) entries += entry; } if (m_baseInfo) entries += m_baseInfo->entriesForType(typeName, majorVersion, minorVersion); return entries; } ItemLibraryEntry ItemLibraryInfo::entry(const QString &name) const { if (m_nameToEntryHash.contains(name)) return m_nameToEntryHash.value(name); if (m_baseInfo) return m_baseInfo->entry(name); return ItemLibraryEntry(); } QList<ItemLibraryEntry> ItemLibraryInfo::entries() const { QList<ItemLibraryEntry> list = m_nameToEntryHash.values(); if (m_baseInfo) list += m_baseInfo->entries(); return list; } static inline QString keyForEntry(const ItemLibraryEntry &entry) { return entry.name() + entry.category() + QString::number(entry.majorVersion()); } void ItemLibraryInfo::addEntries(const QList<ItemLibraryEntry> &entries, bool overwriteDuplicate) { foreach (const ItemLibraryEntry &entry, entries) { const QString key = keyForEntry(entry); if (!overwriteDuplicate && m_nameToEntryHash.contains(key)) throw InvalidMetaInfoException(__LINE__, __FUNCTION__, __FILE__); m_nameToEntryHash.insert(key, entry); } emit entriesChanged(); } bool ItemLibraryInfo::containsEntry(const ItemLibraryEntry &entry) { const QString key = keyForEntry(entry); return m_nameToEntryHash.contains(key); } void ItemLibraryInfo::clearEntries() { m_nameToEntryHash.clear(); emit entriesChanged(); } QStringList ItemLibraryInfo::blacklistImports() const { auto list = m_blacklistImports; if (m_baseInfo) list.append(m_baseInfo->m_blacklistImports); return list; } QStringList ItemLibraryInfo::showTagsForImports() const { auto list = m_showTagsForImports; if (m_baseInfo) list.append(m_baseInfo->m_showTagsForImports); list.removeDuplicates(); return list; } void ItemLibraryInfo::addBlacklistImports(const QStringList &list) { m_blacklistImports.append(list); } void ItemLibraryInfo::addShowTagsForImports(const QStringList &list) { m_showTagsForImports.append(list); } void ItemLibraryInfo::setBaseInfo(ItemLibraryInfo *baseInfo) { m_baseInfo = baseInfo; } }
QDataStream& operator<<(QDataStream& stream, const ItemLibraryEntry &itemLibraryEntry) { stream << itemLibraryEntry.name(); stream << itemLibraryEntry.typeName(); stream << itemLibraryEntry.majorVersion(); stream << itemLibraryEntry.minorVersion(); stream << itemLibraryEntry.typeIcon(); stream << itemLibraryEntry.libraryEntryIconPath(); stream << itemLibraryEntry.category(); stream << itemLibraryEntry.requiredImport(); stream << itemLibraryEntry.hints(); stream << itemLibraryEntry.m_data->properties; stream << itemLibraryEntry.m_data->qml; stream << itemLibraryEntry.m_data->qmlSource; return stream; }
function_block-full_function
[]
C++
code_reading/oceanbase-master/src/sql/optimizer/ob_log_table_lookup.cpp
wangcy6/weekly_read
3a8837ee9cd957787ee1785e4066dd623e02e13a
#define USING_LOG_PREFIX SQL_OPT #include "sql/optimizer/ob_log_table_lookup.h" #include "sql/optimizer/ob_log_table_scan.h" #include "sql/optimizer/ob_log_plan.h" using namespace oceanbase::share; namespace oceanbase { namespace sql { int ObLogTableLookup::copy_without_child(ObLogicalOperator*& out) { int ret = OB_SUCCESS; out = NULL; ObLogicalOperator* op = NULL; ObLogTableLookup* table_lookup = NULL; if (OB_FAIL(clone(op))) { LOG_WARN("failed to clone ObLogTableScan", K(ret)); } else if (OB_ISNULL(table_lookup = static_cast<ObLogTableLookup*>(op))) { ret = OB_ERR_UNEXPECTED; LOG_WARN("failed to cast ObLogicalOpertor* to ObLogTableScan*", K(ret)); } else { table_lookup->table_id_ = table_id_; table_lookup->ref_table_id_ = ref_table_id_; table_lookup->index_id_ = index_id_; table_lookup->set_index_name(index_name_); table_lookup->set_table_name(table_name_); table_lookup->set_index_back_scan(index_back_scan_); table_lookup->calc_part_id_expr_ = calc_part_id_expr_; out = table_lookup; } return ret; } int ObLogTableLookup::transmit_op_ordering() { int ret = OB_SUCCESS; reset_op_ordering(); reset_local_ordering(); return ret; } int ObLogTableLookup::allocate_expr_post(ObAllocExprContext& ctx) { int ret = OB_SUCCESS; if (OB_ISNULL(index_back_scan_)) { ret = OB_INVALID_ARGUMENT; LOG_WARN("null point", K(index_back_scan_), K(ret)); } else { index_back_scan_->set_branch_id(branch_id_); index_back_scan_->set_id(id_); if (OB_FAIL(index_back_scan_->allocate_expr_post(ctx))) { LOG_WARN("failed to allocate expr for children operator", K(ret)); } else if (!is_plan_root() && OB_FAIL(append(output_exprs_, index_back_scan_->get_output_exprs()))) { LOG_WARN("failed to append output exprs", K(ret)); } else if (OB_FAIL(append_not_produced_exprs(ctx.not_produced_exprs_))) { LOG_WARN("fail to append not produced exprs", K(ret)); } } return ret; } int ObLogTableLookup::allocate_exchange_post(AllocExchContext* ctx) { int ret = OB_SUCCESS; bool is_basic = false; ObLogicalOperator* child = NULL; ObExchangeInfo exch_info; if (OB_ISNULL(ctx) || OB_ISNULL(child = get_child(first_child))) { ret = OB_ERR_UNEXPECTED; LOG_WARN("get unexpected null", K(ctx), K(child), K(ret)); } else if (OB_FAIL(compute_basic_sharding_info(ctx, is_basic))) { LOG_WARN("failed to check is basic sharing info", K(ret)); } else if (is_basic) { } else if (!get_pushdown_filter_exprs().empty() || child->get_card() > 1000) { if (OB_FAIL(get_sharding_info().copy_with_part_keys(child->get_sharding_info()))) { LOG_WARN("failed to deep copy sharding info from first child", K(ret)); } else { } } else if (OB_FAIL(child->allocate_exchange(ctx, exch_info))) { LOG_WARN("failed to allocate exchange", K(ret)); } else { sharding_info_.set_location_type(OB_TBL_LOCATION_LOCAL); } if (OB_SUCC(ret)) { get_plan()->set_location_type(ObPhyPlanType::OB_PHY_PLAN_UNCERTAIN); } return ret; } int ObLogTableLookup::compute_property(Path* path) { int ret = OB_SUCCESS; if (OB_ISNULL(path) || OB_ISNULL(path->parent_) || OB_UNLIKELY(path->path_type_ != ACCESS)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("path or join order is null", K(ret), K(path)); } else if (OB_FAIL(ObLogicalOperator::compute_property(path))) { LOG_WARN("failed to compute property", K(ret)); } else { set_card(path->parent_->get_output_rows()); set_op_cost(static_cast<const AccessPath*>(path)->index_back_cost_); set_cost(path->cost_); } return ret; } int ObLogTableLookup::re_est_cost(const ObLogicalOperator* parent, double need_row_count, bool& re_est) { int ret = OB_SUCCESS; ObLogicalOperator* child = NULL; ObLogTableScan* scan_child = NULL; double query_range_row_count = 0.0; double index_back_row_count = 0.0; UNUSED(parent); if (need_row_count >= get_card()) { } else if (OB_ISNULL(child = get_child(first_child))) { ret = OB_ERR_UNEXPECTED; LOG_WARN("null children node", K(ret)); } else if (OB_UNLIKELY(log_op_def::LOG_TABLE_SCAN != child->get_type())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("unexpceted child type", K(child->get_type()), K(ret)); } else if (FALSE_IT(scan_child = static_cast<ObLogTableScan*>(child))) { } else if (OB_ISNULL(scan_child->get_est_cost_info())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("est cost info is not set", K(ret)); } else if (OB_UNLIKELY(scan_child->get_est_cost_info()->table_filter_sel_ <= 0.0 || scan_child->get_est_cost_info()->postfix_filter_sel_ <= 0.0)) { } else { index_back_row_count = need_row_count / scan_child->get_est_cost_info()->table_filter_sel_; query_range_row_count = index_back_row_count / scan_child->get_est_cost_info()->postfix_filter_sel_; if (query_range_row_count < 0.0 || index_back_row_count < 0.0 || scan_child->query_range_row_count_ < OB_DOUBLE_EPSINON) { } else { re_est = true; double cost = 0; double index_back_cost = 0; double physical_query_range_row_count = query_range_row_count * scan_child->phy_query_range_row_count_ / scan_child->query_range_row_count_; LOG_TRACE("start to re-estimate for table look up operator", K(index_back_row_count), K(query_range_row_count), K(physical_query_range_row_count)); if (OB_FAIL(ObOptEstCost::cost_table_one_batch(*scan_child->est_cost_info_, scan_child->est_cost_info_->batch_type_, true, scan_child->est_cost_info_->table_scan_param_.column_ids_.count(), query_range_row_count, physical_query_range_row_count, cost, index_back_cost))) { LOG_WARN("failed to estimate cost", K(ret)); } else { LOG_TRACE("succeed to re-estimate for table lookup operator", K(cost), K(index_back_cost)); scan_child->set_card(index_back_row_count); scan_child->set_cost(cost - index_back_cost); scan_child->set_op_cost(cost - index_back_cost); card_ = need_row_count; op_cost_ = index_back_cost; cost_ = cost; } } } return ret; } uint64_t ObLogTableLookup::hash(uint64_t seed) const { uint64_t hash_value = seed; hash_value = do_hash(table_id_, hash_value); hash_value = do_hash(ref_table_id_, hash_value); hash_value = do_hash(index_id_, hash_value); hash_value = do_hash(table_name_, hash_value); hash_value = do_hash(index_name_, hash_value); hash_value = ObLogicalOperator::hash(hash_value); return hash_value; } int ObLogTableLookup::check_output_dep_specific(ObRawExprCheckDep& checker) { int ret = OB_SUCCESS; UNUSED(checker); return ret; } int ObLogTableLookup::print_my_plan_annotation(char* buf, int64_t& buf_len, int64_t& pos, ExplainType type) { int ret = OB_SUCCESS; UNUSED(type); if (OB_ISNULL(index_back_scan_) || OB_ISNULL(index_back_scan_->get_table_partition_info())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("get unexpected null", K(index_back_scan_), K(ret)); } else if (OB_FAIL(BUF_PRINTF(", "))) { LOG_WARN("BUF_PRINTF fails", K(ret)); } else if (OB_FAIL(BUF_PRINTF("\n "))) { LOG_WARN("BUF_PRINTF fails", K(ret)); } else { const ObPhyPartitionLocationInfoIArray& partitions = index_back_scan_->table_partition_info_->get_phy_tbl_location_info().get_phy_part_loc_info_list(); const bool two_level = (schema::PARTITION_LEVEL_TWO == index_back_scan_->table_partition_info_->get_part_level()); ObSEArray<int64_t, 128> pids; int64_t N = partitions.count(); for (int64_t i = 0; OB_SUCC(ret) && i < N; ++i) { const ObOptPartLoc& part_loc = partitions.at(i).get_partition_location(); int64_t pid = part_loc.get_partition_id(); if (OB_FAIL(pids.push_back(pid))) { LOG_WARN("failed to add partition id", K(pid), K(i), K(ret)); } else { std::sort(pids.begin(), pids.end(), compare_partition_id); } } if (OB_SUCC(ret)) { if (OB_FAIL(ObLogicalOperator::explain_print_partitions(pids, two_level, buf, buf_len, pos))) { LOG_WARN("Failed to print partitions"); } } } return ret; } int ObLogTableLookup::inner_append_not_produced_exprs(ObRawExprUniqueSet& raw_exprs) const { int ret = OB_SUCCESS; OZ(raw_exprs.append(calc_part_id_expr_)); return ret; } int ObLogTableLookup::init_calc_part_id_expr() { int ret = OB_SUCCESS; calc_part_id_expr_ = NULL; share::schema::ObPartitionLevel part_level = share::schema::PARTITION_LEVEL_MAX; ObSQLSessionInfo* session = NULL; ObRawExpr* part_expr = NULL; ObRawExpr* subpart_expr = NULL; ObRawExpr* new_part_expr = NULL; ObRawExpr* new_subpart_expr = NULL; if (OB_ISNULL(get_plan()) || OB_INVALID_ID == ref_table_id_) { ret = OB_ERR_UNEXPECTED; } else if (OB_ISNULL(session = get_plan()->get_optimizer_context().get_session_info())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("session info is null"); } else if (!session->use_static_typing_engine()) { } else { share::schema::ObSchemaGetterGuard* schema_guard = NULL; const share::schema::ObTableSchema* table_schema = NULL; if (OB_ISNULL(schema_guard = get_plan()->get_optimizer_context().get_schema_guard())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("NULL ptr", K(ret)); } else if (OB_FAIL(schema_guard->get_table_schema(ref_table_id_, table_schema))) { LOG_WARN("get table schema failed", K(ref_table_id_), K(ret)); } else if (OB_ISNULL(table_schema)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("table schema is null", K(ret), K(table_schema)); } else { bool no_primary_key = table_schema->is_no_pk_table(); ObRawExprFactory& expr_factory = get_plan()->get_optimizer_context().get_expr_factory(); if (OB_FAIL(get_part_exprs(table_id_, ref_table_id_, part_level, part_expr, subpart_expr))) { LOG_WARN("fail to get part exprs", K(ret)); } new_part_expr = part_expr; new_subpart_expr = subpart_expr; if (OB_SUCC(ret) && !no_primary_key && NULL != part_expr) { if (OB_FAIL(replace_gen_column(part_expr, new_part_expr))) { LOG_WARN("fail to replace generate column", K(ret), K(part_expr)); } } if (OB_SUCC(ret) && !no_primary_key && NULL != subpart_expr) { if (OB_FAIL(replace_gen_column(subpart_expr, new_subpart_expr))) { LOG_WARN("fail to replace generate column", K(ret), K(subpart_expr)); } } if (OB_SUCC(ret)) { if (OB_FAIL(ObRawExprUtils::build_calc_part_id_expr(expr_factory, *session, ref_table_id_, part_level, new_part_expr, new_subpart_expr, calc_part_id_expr_))) { LOG_WARN("fail to build table location expr", K(ret)); } } } } return ret; } int ObLogTableLookup::replace_gen_column(ObRawExpr* part_expr, ObRawExpr*& new_part_expr) { int ret = OB_SUCCESS; ObSEArray<ObRawExpr*, 8> column_exprs; new_part_expr = part_expr; if (OB_ISNULL(part_expr)) { } else if (OB_ISNULL(get_plan())) { ret = OB_ERR_UNEXPECTED; } else if (OB_FAIL(ObRawExprUtils::extract_column_exprs(part_expr, column_exprs))) { LOG_WARN("fail to extract column exprs", K(part_expr), K(ret)); } else { bool cnt_gen_columns = false; for (int64_t i = 0; !cnt_gen_columns && OB_SUCC(ret) && i < column_exprs.count(); i++) { if (OB_ISNULL(column_exprs.at(i))) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid argument", K(ret)); } else if (static_cast<ObColumnRefRawExpr*>(column_exprs.at(i))->is_generated_column()) { cnt_gen_columns = true; } } if (OB_SUCC(ret) && cnt_gen_columns) { ObRawExprFactory& expr_factory = get_plan()->get_optimizer_context().get_expr_factory(); new_part_expr = NULL; if (OB_FAIL(ObRawExprUtils::copy_expr(expr_factory, part_expr, new_part_expr, COPY_REF_DEFAULT))) { LOG_WARN("fail to copy part expr", K(ret)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < column_exprs.count(); i++) { ObColumnRefRawExpr* col_expr = static_cast<ObColumnRefRawExpr*>(column_exprs.at(i)); if (!col_expr->is_generated_column()) { } else if (OB_ISNULL(col_expr->get_dependant_expr())) { ret = OB_INVALID_ARGUMENT; LOG_WARN("generate column's dependant expr is null", K(ret)); } else if (OB_FAIL( ObRawExprUtils::replace_ref_column(new_part_expr, col_expr, col_expr->get_dependant_expr()))) { LOG_WARN("fail to replace ref column", K(ret)); } } } } } return ret; } } }
#define USING_LOG_PREFIX SQL_OPT #include "sql/optimizer/ob_log_table_lookup.h" #include "sql/optimizer/ob_log_table_scan.h" #include "sql/optimizer/ob_log_plan.h" using namespace oceanbase::share; namespace oceanbase { namespace sql { int ObLogTableLookup::copy_without_child(ObLogicalOperator*& out) { int ret = OB_SUCCESS; out = NULL; ObLogicalOperator* op = NULL; ObLogTableLookup* table_lookup = NULL; if (OB_FAIL(clone(op))) { LOG_WARN("failed to clone ObLogTableScan", K(ret)); } else if (OB_ISNULL(table_lookup = static_cast<ObLogTableLookup*>(op))) { ret = OB_ERR_UNEXPECTED; LOG_WARN("failed to cast ObLogicalOpertor* to ObLogTableScan*", K(ret)); } else { table_lookup->table_id_ = table_id_; table_lookup->ref_table_id_ = ref_table_id_; table_lookup->index_id_ = index_id_; table_lookup->set_index_name(index_name_); table_lookup->set_table_name(table_name_); table_lookup->set_index_back_scan(index_back_scan_); table_lookup->calc_part_id_expr_ = calc_part_id_expr_; out = table_lookup; } retu
bool is_basic = false; ObLogicalOperator* child = NULL; ObExchangeInfo exch_info; if (OB_ISNULL(ctx) || OB_ISNULL(child = get_child(first_child))) { ret = OB_ERR_UNEXPECTED; LOG_WARN("get unexpected null", K(ctx), K(child), K(ret)); } else if (OB_FAIL(compute_basic_sharding_info(ctx, is_basic))) { LOG_WARN("failed to check is basic sharing info", K(ret)); } else if (is_basic) { } else if (!get_pushdown_filter_exprs().empty() || child->get_card() > 1000) { if (OB_FAIL(get_sharding_info().copy_with_part_keys(child->get_sharding_info()))) { LOG_WARN("failed to deep copy sharding info from first child", K(ret)); } else { } } else if (OB_FAIL(child->allocate_exchange(ctx, exch_info))) { LOG_WARN("failed to allocate exchange", K(ret)); } else { sharding_info_.set_location_type(OB_TBL_LOCATION_LOCAL); } if (OB_SUCC(ret)) { get_plan()->set_location_type(ObPhyPlanType::OB_PHY_PLAN_UNCERTAIN); } return ret; } int ObLogTableLookup::compute_property(Path* path) { int ret = OB_SUCCESS; if (OB_ISNULL(path) || OB_ISNULL(path->parent_) || OB_UNLIKELY(path->path_type_ != ACCESS)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("path or join order is null", K(ret), K(path)); } else if (OB_FAIL(ObLogicalOperator::compute_property(path))) { LOG_WARN("failed to compute property", K(ret)); } else { set_card(path->parent_->get_output_rows()); set_op_cost(static_cast<const AccessPath*>(path)->index_back_cost_); set_cost(path->cost_); } return ret; } int ObLogTableLookup::re_est_cost(const ObLogicalOperator* parent, double need_row_count, bool& re_est) { int ret = OB_SUCCESS; ObLogicalOperator* child = NULL; ObLogTableScan* scan_child = NULL; double query_range_row_count = 0.0; double index_back_row_count = 0.0; UNUSED(parent); if (need_row_count >= get_card()) { } else if (OB_ISNULL(child = get_child(first_child))) { ret = OB_ERR_UNEXPECTED; LOG_WARN("null children node", K(ret)); } else if (OB_UNLIKELY(log_op_def::LOG_TABLE_SCAN != child->get_type())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("unexpceted child type", K(child->get_type()), K(ret)); } else if (FALSE_IT(scan_child = static_cast<ObLogTableScan*>(child))) { } else if (OB_ISNULL(scan_child->get_est_cost_info())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("est cost info is not set", K(ret)); } else if (OB_UNLIKELY(scan_child->get_est_cost_info()->table_filter_sel_ <= 0.0 || scan_child->get_est_cost_info()->postfix_filter_sel_ <= 0.0)) { } else { index_back_row_count = need_row_count / scan_child->get_est_cost_info()->table_filter_sel_; query_range_row_count = index_back_row_count / scan_child->get_est_cost_info()->postfix_filter_sel_; if (query_range_row_count < 0.0 || index_back_row_count < 0.0 || scan_child->query_range_row_count_ < OB_DOUBLE_EPSINON) { } else { re_est = true; double cost = 0; double index_back_cost = 0; double physical_query_range_row_count = query_range_row_count * scan_child->phy_query_range_row_count_ / scan_child->query_range_row_count_; LOG_TRACE("start to re-estimate for table look up operator", K(index_back_row_count), K(query_range_row_count), K(physical_query_range_row_count)); if (OB_FAIL(ObOptEstCost::cost_table_one_batch(*scan_child->est_cost_info_, scan_child->est_cost_info_->batch_type_, true, scan_child->est_cost_info_->table_scan_param_.column_ids_.count(), query_range_row_count, physical_query_range_row_count, cost, index_back_cost))) { LOG_WARN("failed to estimate cost", K(ret)); } else { LOG_TRACE("succeed to re-estimate for table lookup operator", K(cost), K(index_back_cost)); scan_child->set_card(index_back_row_count); scan_child->set_cost(cost - index_back_cost); scan_child->set_op_cost(cost - index_back_cost); card_ = need_row_count; op_cost_ = index_back_cost; cost_ = cost; } } } return ret; } uint64_t ObLogTableLookup::hash(uint64_t seed) const { uint64_t hash_value = seed; hash_value = do_hash(table_id_, hash_value); hash_value = do_hash(ref_table_id_, hash_value); hash_value = do_hash(index_id_, hash_value); hash_value = do_hash(table_name_, hash_value); hash_value = do_hash(index_name_, hash_value); hash_value = ObLogicalOperator::hash(hash_value); return hash_value; } int ObLogTableLookup::check_output_dep_specific(ObRawExprCheckDep& checker) { int ret = OB_SUCCESS; UNUSED(checker); return ret; } int ObLogTableLookup::print_my_plan_annotation(char* buf, int64_t& buf_len, int64_t& pos, ExplainType type) { int ret = OB_SUCCESS; UNUSED(type); if (OB_ISNULL(index_back_scan_) || OB_ISNULL(index_back_scan_->get_table_partition_info())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("get unexpected null", K(index_back_scan_), K(ret)); } else if (OB_FAIL(BUF_PRINTF(", "))) { LOG_WARN("BUF_PRINTF fails", K(ret)); } else if (OB_FAIL(BUF_PRINTF("\n "))) { LOG_WARN("BUF_PRINTF fails", K(ret)); } else { const ObPhyPartitionLocationInfoIArray& partitions = index_back_scan_->table_partition_info_->get_phy_tbl_location_info().get_phy_part_loc_info_list(); const bool two_level = (schema::PARTITION_LEVEL_TWO == index_back_scan_->table_partition_info_->get_part_level()); ObSEArray<int64_t, 128> pids; int64_t N = partitions.count(); for (int64_t i = 0; OB_SUCC(ret) && i < N; ++i) { const ObOptPartLoc& part_loc = partitions.at(i).get_partition_location(); int64_t pid = part_loc.get_partition_id(); if (OB_FAIL(pids.push_back(pid))) { LOG_WARN("failed to add partition id", K(pid), K(i), K(ret)); } else { std::sort(pids.begin(), pids.end(), compare_partition_id); } } if (OB_SUCC(ret)) { if (OB_FAIL(ObLogicalOperator::explain_print_partitions(pids, two_level, buf, buf_len, pos))) { LOG_WARN("Failed to print partitions"); } } } return ret; } int ObLogTableLookup::inner_append_not_produced_exprs(ObRawExprUniqueSet& raw_exprs) const { int ret = OB_SUCCESS; OZ(raw_exprs.append(calc_part_id_expr_)); return ret; } int ObLogTableLookup::init_calc_part_id_expr() { int ret = OB_SUCCESS; calc_part_id_expr_ = NULL; share::schema::ObPartitionLevel part_level = share::schema::PARTITION_LEVEL_MAX; ObSQLSessionInfo* session = NULL; ObRawExpr* part_expr = NULL; ObRawExpr* subpart_expr = NULL; ObRawExpr* new_part_expr = NULL; ObRawExpr* new_subpart_expr = NULL; if (OB_ISNULL(get_plan()) || OB_INVALID_ID == ref_table_id_) { ret = OB_ERR_UNEXPECTED; } else if (OB_ISNULL(session = get_plan()->get_optimizer_context().get_session_info())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("session info is null"); } else if (!session->use_static_typing_engine()) { } else { share::schema::ObSchemaGetterGuard* schema_guard = NULL; const share::schema::ObTableSchema* table_schema = NULL; if (OB_ISNULL(schema_guard = get_plan()->get_optimizer_context().get_schema_guard())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("NULL ptr", K(ret)); } else if (OB_FAIL(schema_guard->get_table_schema(ref_table_id_, table_schema))) { LOG_WARN("get table schema failed", K(ref_table_id_), K(ret)); } else if (OB_ISNULL(table_schema)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("table schema is null", K(ret), K(table_schema)); } else { bool no_primary_key = table_schema->is_no_pk_table(); ObRawExprFactory& expr_factory = get_plan()->get_optimizer_context().get_expr_factory(); if (OB_FAIL(get_part_exprs(table_id_, ref_table_id_, part_level, part_expr, subpart_expr))) { LOG_WARN("fail to get part exprs", K(ret)); } new_part_expr = part_expr; new_subpart_expr = subpart_expr; if (OB_SUCC(ret) && !no_primary_key && NULL != part_expr) { if (OB_FAIL(replace_gen_column(part_expr, new_part_expr))) { LOG_WARN("fail to replace generate column", K(ret), K(part_expr)); } } if (OB_SUCC(ret) && !no_primary_key && NULL != subpart_expr) { if (OB_FAIL(replace_gen_column(subpart_expr, new_subpart_expr))) { LOG_WARN("fail to replace generate column", K(ret), K(subpart_expr)); } } if (OB_SUCC(ret)) { if (OB_FAIL(ObRawExprUtils::build_calc_part_id_expr(expr_factory, *session, ref_table_id_, part_level, new_part_expr, new_subpart_expr, calc_part_id_expr_))) { LOG_WARN("fail to build table location expr", K(ret)); } } } } return ret; } int ObLogTableLookup::replace_gen_column(ObRawExpr* part_expr, ObRawExpr*& new_part_expr) { int ret = OB_SUCCESS; ObSEArray<ObRawExpr*, 8> column_exprs; new_part_expr = part_expr; if (OB_ISNULL(part_expr)) { } else if (OB_ISNULL(get_plan())) { ret = OB_ERR_UNEXPECTED; } else if (OB_FAIL(ObRawExprUtils::extract_column_exprs(part_expr, column_exprs))) { LOG_WARN("fail to extract column exprs", K(part_expr), K(ret)); } else { bool cnt_gen_columns = false; for (int64_t i = 0; !cnt_gen_columns && OB_SUCC(ret) && i < column_exprs.count(); i++) { if (OB_ISNULL(column_exprs.at(i))) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid argument", K(ret)); } else if (static_cast<ObColumnRefRawExpr*>(column_exprs.at(i))->is_generated_column()) { cnt_gen_columns = true; } } if (OB_SUCC(ret) && cnt_gen_columns) { ObRawExprFactory& expr_factory = get_plan()->get_optimizer_context().get_expr_factory(); new_part_expr = NULL; if (OB_FAIL(ObRawExprUtils::copy_expr(expr_factory, part_expr, new_part_expr, COPY_REF_DEFAULT))) { LOG_WARN("fail to copy part expr", K(ret)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < column_exprs.count(); i++) { ObColumnRefRawExpr* col_expr = static_cast<ObColumnRefRawExpr*>(column_exprs.at(i)); if (!col_expr->is_generated_column()) { } else if (OB_ISNULL(col_expr->get_dependant_expr())) { ret = OB_INVALID_ARGUMENT; LOG_WARN("generate column's dependant expr is null", K(ret)); } else if (OB_FAIL( ObRawExprUtils::replace_ref_column(new_part_expr, col_expr, col_expr->get_dependant_expr()))) { LOG_WARN("fail to replace ref column", K(ret)); } } } } } return ret; } } }
rn ret; } int ObLogTableLookup::transmit_op_ordering() { int ret = OB_SUCCESS; reset_op_ordering(); reset_local_ordering(); return ret; } int ObLogTableLookup::allocate_expr_post(ObAllocExprContext& ctx) { int ret = OB_SUCCESS; if (OB_ISNULL(index_back_scan_)) { ret = OB_INVALID_ARGUMENT; LOG_WARN("null point", K(index_back_scan_), K(ret)); } else { index_back_scan_->set_branch_id(branch_id_); index_back_scan_->set_id(id_); if (OB_FAIL(index_back_scan_->allocate_expr_post(ctx))) { LOG_WARN("failed to allocate expr for children operator", K(ret)); } else if (!is_plan_root() && OB_FAIL(append(output_exprs_, index_back_scan_->get_output_exprs()))) { LOG_WARN("failed to append output exprs", K(ret)); } else if (OB_FAIL(append_not_produced_exprs(ctx.not_produced_exprs_))) { LOG_WARN("fail to append not produced exprs", K(ret)); } } return ret; } int ObLogTableLookup::allocate_exchange_post(AllocExchContext* ctx) { int ret = OB_SUCCESS;
random
[]
C++
Servable/DlibServable/test/TestDlibServable.cpp
bzcheeseman/BatchingRPCServer
d1130720fef6e15e129fa59cc37235537f609e36
#include <dlib/data_io.h> #include <sstream> #include "BatchingRPC.pb.h" #include "DlibServable.hpp" #include "gtest/gtest.h" namespace { using namespace dlib; using net_type = loss_multiclass_log<fc< 10, relu<fc< 84, relu<fc< 120, max_pool<2, 2, 2, 2, relu<con<16, 5, 5, 1, 1, max_pool<2, 2, 2, 2, relu<con<6, 5, 5, 1, 1, input<matrix< unsigned char>>>>>>>>>>>>>>; Serving::TensorMessage ToMessage(std::vector<matrix<unsigned char>> &&arr) { Serving::TensorMessage message; std::ostringstream buffer_stream(std::ios::binary); serialize(arr, buffer_stream); message.set_serialized_buffer(buffer_stream.str()); message.set_n(arr.size()); return message; } void TrainNetwork(const std::string &dirname) { std::vector<matrix<unsigned char>> training_images; std::vector<unsigned long> training_labels; std::vector<matrix<unsigned char>> testing_images; std::vector<unsigned long> testing_labels; load_mnist_dataset(dirname, training_images, training_labels, testing_images, testing_labels); std::ifstream f( "../../../Servable/DlibServable/test/assets/mnist_network.dat"); if (f.is_open()) { f.close(); return; } net_type net; dnn_trainer<net_type> trainer(net); trainer.set_learning_rate(0.01); trainer.set_min_learning_rate(0.0001); trainer.set_mini_batch_size(128); trainer.be_verbose(); trainer.set_synchronization_file("mnist_sync", std::chrono::seconds(20)); trainer.train(training_images, training_labels); net.clean(); serialize("../../../Servable/DlibServable/test/assets/mnist_network.dat") << net; } class TestDlibServable : public ::testing::Test { protected: void SetUp() override { TrainNetwork("../../../Servable/DlibServable/test/assets"); deserialize( "../../../Servable/DlibServable/test/assets/mnist_network.dat") >> raw_args.net; file_args.filename = "../../../Servable/DlibServable/test/assets/mnist_network.dat"; std::vector<matrix<unsigned char>> training_images; std::vector<unsigned long> training_labels; load_mnist_dataset("../../../Servable/DlibServable/test/assets", training_images, training_labels, input_, output_); } Serving::DlibRawBindArgs<net_type> raw_args; Serving::DlibFileBindArgs file_args; std::vector<matrix<unsigned char>> input_; std::vector<unsigned long> output_; }; TEST_F(TestDlibServable, Bind) { Serving::DlibServable<net_type, matrix<unsigned char>, unsigned long> servable(4); EXPECT_NO_THROW(servable.Bind(raw_args)); } TEST_F(TestDlibServable, BindFile) { Serving::DlibServable<net_type, matrix<unsigned char>, unsigned long> servable(4); EXPECT_NO_THROW(servable.Bind(file_args)); } TEST_F(TestDlibServable, Single) { Serving::DlibServable<net_type, matrix<unsigned char>, unsigned long> servable(1); servable.Bind(raw_args); Serving::TensorMessage msg = ToMessage({input_[0]}); msg.set_client_id("test"); Serving::ReturnCodes r = servable.AddToBatch(msg); EXPECT_EQ(r, Serving::ReturnCodes::OK); Serving::TensorMessage output; r = servable.GetResult("test", &output); EXPECT_EQ(r, Serving::ReturnCodes::OK); std::istringstream output_buffer(output.serialized_buffer(), std::ios::binary); std::vector<unsigned long> results; deserialize(results, output_buffer); EXPECT_EQ(results[0], 7); } TEST_F(TestDlibServable, NoBind) { Serving::DlibServable<net_type, matrix<unsigned char>, unsigned long> servable(1); Serving::TensorMessage msg = ToMessage({input_[0]}); msg.set_client_id("no_bind"); Serving::ReturnCodes r = servable.AddToBatch(msg); EXPECT_EQ(r, Serving::ReturnCodes::NEED_BIND_CALL); } TEST_F(TestDlibServable, WrongSize) { Serving::DlibServable<net_type, matrix<unsigned char>, unsigned long> servable(2); servable.Bind(raw_args); Serving::TensorMessage msg; std::ostringstream buffer_stream(std::ios::binary); std::vector<matrix<unsigned char>> arr; arr.push_back(input_[0]); serialize(arr, buffer_stream); msg.set_serialized_buffer(buffer_stream.str()); msg.set_n(2); msg.set_client_id("wrong_size"); Serving::ReturnCodes r = servable.AddToBatch(msg); EXPECT_EQ(r, Serving::ReturnCodes::SHAPE_INCORRECT); } TEST_F(TestDlibServable, TooBig) { Serving::DlibServable<net_type, matrix<unsigned char>, unsigned long> servable(1); servable.Bind(raw_args); Serving::TensorMessage msg = ToMessage({input_[0], input_[1]}); msg.set_client_id("too_big"); Serving::ReturnCodes r = servable.AddToBatch(msg); EXPECT_EQ(r, Serving::ReturnCodes::BATCH_TOO_LARGE); } TEST_F(TestDlibServable, NextBatch) { Serving::DlibServable<net_type, matrix<unsigned char>, unsigned long> servable(3); servable.Bind(raw_args); Serving::TensorMessage msg = ToMessage({input_[0], input_[1]}); msg.set_client_id("too_big"); Serving::ReturnCodes r = servable.AddToBatch(msg); EXPECT_EQ(r, Serving::ReturnCodes::OK); msg = ToMessage({input_[0], input_[1]}); msg.set_client_id("too_big"); r = servable.AddToBatch(msg); EXPECT_EQ(r, Serving::ReturnCodes::NEXT_BATCH); } }
#include <dlib/data_io.h> #include <sstream> #include "BatchingRPC.pb.h" #include "DlibServable.hpp" #include "gtest/gtest.h" namespace { using namespace dlib; using net_type = loss_multiclass_log<fc< 10, relu<fc< 84, relu<fc< 120, max_pool<2, 2, 2, 2, relu<con<16, 5, 5, 1, 1, max_pool<2, 2, 2, 2, relu<con<6, 5, 5, 1, 1, input<matrix< unsigned char>>>>>>>>>>>>>>; Serving::TensorMessage ToMessage(std::vector<matrix<unsigned char>> &&arr) { Serving::TensorMessage message; std::ostringstream buffer_stream(std::ios::binary); serialize(arr, buffer_stream); message.set_serialized_buffer(buffer_stream.str()); message.set_n(arr.size()); return message; } void TrainNetwork(const std::string &dirname) { std::vector<matrix<unsigned char>> training_images; std::vector<unsigned long> training_labels; std::vector<matrix<unsigned char>> testing_images; std::vector<unsigned long> testing_labels; load_mnist_dataset(dirname, training_images, training_labels, testing_images, testing_labels); std::ifstream f( "../../../Servable/DlibServable/test/assets/mnist_network.dat"); if (f.is_open()) { f.close(); return; } net_type net; dnn_trainer<net_type> trainer(net); trainer.set_learning_rate(0.01); trainer.set_min_learning_rate(0.0001); trainer.set_mini_batch_size(128); trainer.be_verbose(); trainer.set_synchronization_file("mnist_sync", std::chrono::seconds(20)); trainer.train(training_images, training_labels); net.clean(); serialize("../../../Servable/DlibServable/test/assets/mnist_network.dat") << net; } class TestDlibServable : public ::testing::Test { protected: void SetUp() override { TrainNetwork("../../../Servable/DlibServable/test/assets"); deserialize( "../../../Servable/DlibServable/test/assets/mnist_network.dat") >> raw_args.net; file_args.filename = "../../../Servable/DlibServable/test/assets/mnist_network.dat"; std::vector<matrix<unsigned char>> training_images; std::vector<unsigned long> training_labels; load_mnist_dataset("../../../Servable/DlibServable/test/assets", training_images, training_labels, input_, output_); } Serving::DlibRawBindArgs<net_type> raw_args; Serving::DlibFileBindArgs file_args; std::vector<matrix<unsigned char>> input_; std::vector<unsigned long> output_; }; TEST_F(TestDlibServable, Bind) { Serving::DlibServable<net_type, matrix<unsigned char>, unsigned long> servable(4); EXPECT_NO_THROW(servable.Bind(raw_args)); } TEST_F(TestDlibServable, BindFile) { Serving::DlibServable<net_type, matrix<unsigned char>, unsigned long> servable(4); EXPECT_NO_THROW(servable.Bind(file_args)); } TEST_F(TestDlibServable, Single) { Serving::DlibServable<net_type, matrix<unsigned char>, unsigned long> servable(1); servable.Bind(raw_args); Serving::TensorMessage msg = ToMessage({input_[0]}); msg.set_client_id("test"); Serving::ReturnCodes r = servable.AddToBatch(msg); EXPECT_EQ(r, Serving::ReturnCodes::OK); Serving::TensorMessage output; r = servable.GetResult("test", &output); EXPECT_EQ(r, Serving::ReturnCodes::OK); std::istringstream output_buffer(output.serialized_buffer(), std::ios::binary); std::vector<unsigned long> results; deserialize(results, output_buffer); EXPECT_EQ(results[0], 7); } TEST_F(TestDlibServable, NoBind) { Serving::DlibServable<net_type, matrix<unsigned char>, unsigned long> servable(1); Serving::TensorMessage msg = ToMessage({input_[0]}); msg.set_client_id("no_bind"); Serving::ReturnCodes r = servable.AddToBatch(msg); EXPECT_EQ(r, Serving::ReturnCodes::NEED_BIND_CALL); } TEST_F(TestDlibServable, WrongSize) { Serving::DlibServable<net_type, matrix<unsigned char>, unsigned long> servable(2); servable.Bind(raw_args); Serving::TensorMessage msg; std::ostringstream buffer_stream(std::ios::binary); std::vector<matrix<unsigned char>> arr; arr.push_back(input_[0]); serialize(arr, buffer_stream); msg.set_serialized_buffer(buffer_stream.str()); msg.set_n(2); msg.set_client_id("wrong_size"); Serving::ReturnCodes r = servable.AddToBatch(msg); EXPECT_EQ(r, Serving::ReturnCodes::SHAPE_INCORRECT); } TEST_F(TestDlibServable, TooBig) { Serving::DlibServable<net_type, matrix<unsigned char>, unsigned long> servable(1); servable.Bind(raw_args); Serving::TensorMessage msg = ToMessage({input_[0], input_[1]}); msg.set_client_id("too_big"); Serving::ReturnCodes r = servable.AddToBatch(msg); EXPECT_EQ(r, Serving::ReturnCodes::BATCH_TOO_LARGE); }
}
TEST_F(TestDlibServable, NextBatch) { Serving::DlibServable<net_type, matrix<unsigned char>, unsigned long> servable(3); servable.Bind(raw_args); Serving::TensorMessage msg = ToMessage({input_[0], input_[1]}); msg.set_client_id("too_big"); Serving::ReturnCodes r = servable.AddToBatch(msg); EXPECT_EQ(r, Serving::ReturnCodes::OK); msg = ToMessage({input_[0], input_[1]}); msg.set_client_id("too_big"); r = servable.AddToBatch(msg); EXPECT_EQ(r, Serving::ReturnCodes::NEXT_BATCH); }
function_block-full_function
[ { "content": "class DlibServable : public Servable {\n\npublic:\n\n DlibServable(const int &batch_size);\n\n ~DlibServable() override;\n\n\n\n ReturnCodes SetBatchSize(const int &new_size) override;\n\n\n\n ReturnCodes AddToBatch(const TensorMessage &message) override;\n\n\n\n ReturnCodes GetResult(const std::string &client_id,\n\n TensorMessage *message) override;\n\n\n\n ReturnCodes Bind(BindArgs &args) override;\n\n\n\nprivate:\n\n void SetBatchSize_(const int &new_size);\n\n void ProcessCurrentBatch_();\n\n\n\nprivate:\n\n NetType servable_;\n", "file_path": "Servable/DlibServable/include/DlibServable.hpp", "rank": 0, "score": 157571.34428698418 }, { "content": "class MXNetServable : public Servable {\n\npublic:\n\n MXNetServable(const mx::Shape &input_shape, const mx::Shape &output_shape,\n\n const mx::DeviceType &type, const int &device_id);\n\n\n\n ~MXNetServable() override;\n\n\n\n ReturnCodes SetBatchSize(const int &new_size) override;\n\n\n\n ReturnCodes AddToBatch(const TensorMessage &message) override;\n\n\n\n ReturnCodes GetResult(const std::string &client_id,\n\n TensorMessage *message) override;\n\n\n\n ReturnCodes Bind(BindArgs &args) override;\n\n\n\nprivate:\n\n void SetBatchSize_(const int &new_size);\n\n\n\n void BindExecutor_();\n", "file_path": "Servable/MXNetServable/include/MXNetServable.hpp", "rank": 1, "score": 149321.97313922178 }, { "content": " class NetType,\n", "file_path": "Servable/DlibServable/include/DlibServable.hpp", "rank": 2, "score": 145785.21307179343 }, { "content": "struct DlibFileBindArgs : public BindArgs {\n\n std::string filename;\n\n};\n\n\n\ntemplate <class NetType> struct DlibRawBindArgs : public BindArgs {\n\n NetType net;\n\n};\n\n\n\ntemplate <\n", "file_path": "Servable/DlibServable/include/DlibServable.hpp", "rank": 3, "score": 141547.050578617 }, { "content": "struct FileBindArgs : public BindArgs {\n\n std::string symbol_filename;\n\n std::string parameters_filename;\n\n};\n\n\n", "file_path": "Servable/MXNetServable/include/MXNetServable.hpp", "rank": 4, "score": 134228.83392782207 }, { "content": "struct RawBindArgs : public BindArgs {\n\n mx::Symbol net;\n\n std::map<std::string, mx::NDArray> parameters;\n\n};\n\n\n", "file_path": "Servable/MXNetServable/include/MXNetServable.hpp", "rank": 5, "score": 134228.83392782204 }, { "content": "class TestIntegrationDlib : public ::testing::Test {\n\nprotected:\n\n void SetUp() override {\n\n TrainNetwork(\"../Servable/DlibServable/test/assets\");\n\n deserialize(\n\n \"../Servable/DlibServable/test/assets/mnist_network.dat\") >>\n\n raw_args.net;\n\n file_args.filename =\n\n \"../Servable/DlibServable/test/assets/mnist_network.dat\";\n\n\n\n std::vector<matrix<unsigned char>> training_images;\n\n std::vector<unsigned long> training_labels;\n\n load_mnist_dataset(\"../Servable/DlibServable/test/assets\",\n\n training_images, training_labels, input_, output_);\n\n\n\n Serving::DlibServable<net_type, matrix<unsigned char>, unsigned long> *servable =\n\n new Serving::DlibServable<net_type, matrix<unsigned char>, unsigned long>(1);\n\n servable->Bind(raw_args);\n\n srv = new TBServer(servable);\n\n\n", "file_path": "test/TestIntegrationDlib.cpp", "rank": 6, "score": 122427.45659293426 }, { "content": "class TestIntegrationMXNet : public ::testing::Test {\n\nprotected:\n\n void SetUp() override {\n\n\n\n ctx = new mx::Context(mx::kCPU, 0);\n\n\n\n raw_args.net = SimpleSymbolFactory(n_hidden);\n\n\n\n mx::NDArray m(mx::Shape(n_hidden, n_hidden), *ctx);\n\n m = 2.f;\n\n raw_args.parameters[\"arg:m\"] = m;\n\n mx::NDArray b(mx::Shape(n_hidden), *ctx);\n\n b = 1.f;\n\n raw_args.parameters[\"arg:b\"] = b;\n\n\n\n input = mx::NDArray(mx::Shape(1, 1, 1, n_hidden), *ctx);\n\n input = 1.f;\n\n\n\n MXNetServable *servable = new MXNetServable(\n\n mx::Shape(1, 1, 1, n_hidden), mx::Shape(1, n_hidden), mx::kCPU, 1);\n", "file_path": "test/TestIntegrationMXNet.cpp", "rank": 8, "score": 117859.3668716025 }, { "content": "class TestMXNetServable : public ::testing::Test {\n\n\n\nprotected:\n\n void SetUp() override {\n\n\n\n ctx = new mx::Context(mx::kCPU, 0);\n\n\n\n fc = SimpleSymbolFactory(n_hidden);\n\n\n\n mx::NDArray m(mx::Shape(n_hidden, n_hidden), *ctx);\n\n m = 2.f;\n\n parms[\"arg:m\"] = m;\n\n mx::NDArray b(mx::Shape(n_hidden), *ctx);\n\n b = 1.f;\n\n parms[\"arg:b\"] = b;\n\n\n\n input = mx::NDArray(mx::Shape(1, 1, 1, n_hidden), *ctx);\n\n input = 1.f;\n\n\n\n zeros = mx::NDArray(mx::Shape(1, 1, 1, n_hidden), *ctx);\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 9, "score": 115444.13894738595 }, { "content": " class InputType, // input type is dlib::matrix of dlib::rgb_pixel, float,\n\n // unsigned char, etc.\n\n typename OutputType // output type is anything serializable by dlib\n\n >\n", "file_path": "Servable/DlibServable/include/DlibServable.hpp", "rank": 10, "score": 112692.52335586576 }, { "content": "class TBServer final : public BatchingServer::Service {\n\npublic:\n\n /**\n\n * @brief Constructs a new TBServer object around an already-created\n\n * Servable.\n\n *\n\n * @param servable A pointer to an initialized Servable object. Takes\n\n * ownership of the pointer upon construction.\n\n */\n\n explicit TBServer(Servable *servable);\n\n\n\n /**\n\n * @brief Destroys a TBServer object and cleans up all resources.\n\n */\n\n ~TBServer() override;\n\n\n\n /**\n\n * @brief Defines the gRPC backend for setting the batch size of the\n\n * Servable object. The client API for this function can be found in\n\n * BatchingRPC.proto\n", "file_path": "Server/include/TBServer.hpp", "rank": 11, "score": 109029.77734513477 }, { "content": "class EchoServable : public Servable {\n\npublic:\n\n EchoServable() = default;\n\n ~EchoServable() override = default;\n\n\n\n ReturnCodes SetBatchSize(const int &new_size) override { return OK; }\n\n\n\n ReturnCodes AddToBatch(const TensorMessage &message) override {\n\n msg = message;\n\n return OK;\n\n }\n\n\n\n ReturnCodes GetResult(const std::string &client_id,\n\n TensorMessage *message) override {\n\n *message = msg;\n\n return OK;\n\n }\n\n\n\n ReturnCodes Bind(BindArgs &args) override { return OK; }\n\n\n\nprivate:\n\n TensorMessage msg;\n\n};\n\n\n", "file_path": "Server/test/TestTBServer.cpp", "rank": 12, "score": 92393.19074267204 }, { "content": "class TestTBServer : public ::testing::Test {\n\nprotected:\n\n void SetUp() override {\n\n\n\n EchoServable *servable = new EchoServable();\n\n srv = new TBServer(servable);\n\n srv->StartSSL(\"localhost:50051\", \"server-key.pem\", \"server-cert.pem\");\n\n\n\n std::ifstream in_file;\n\n std::string cert, tmp;\n\n in_file.open(\"server-cert.pem\");\n\n while (in_file.good()) {\n\n std::getline(in_file, tmp);\n\n cert += tmp + \"\\n\";\n\n }\n\n in_file.close();\n\n\n\n client_creds = {cert, \"\"};\n\n\n\n lim = 100000;\n", "file_path": "Server/test/TestTBServer.cpp", "rank": 13, "score": 85624.06174717234 }, { "content": "\n\n auto result = result_by_client_.find(client_id);\n\n std::vector<OutputType> &result_array = result->second;\n\n\n\n std::stringstream out_stream;\n\n dlib::serialize(result_array, out_stream);\n\n message->set_serialized_buffer(out_stream.str());\n\n message->set_client_id(client_id);\n\n\n\n result = result_by_client_.erase(result);\n\n\n\n return ReturnCodes::OK;\n\n}\n\n\n\ntemplate <class NetType, class InputType, class OutputType>\n\nReturnCodes DlibServable<NetType, InputType, OutputType>::Bind(BindArgs &args) {\n\n try {\n\n DlibFileBindArgs &file_args = dynamic_cast<DlibFileBindArgs &>(args);\n\n dlib::deserialize(file_args.filename) >> servable_;\n\n bind_called_ = true;\n", "file_path": "Servable/DlibServable/include/DlibServable.hpp", "rank": 14, "score": 68531.40907488052 }, { "content": " return ReturnCodes::OK;\n\n } catch (std::bad_cast &e) {\n\n ;\n\n }\n\n try {\n\n DlibRawBindArgs<NetType> &raw_args =\n\n dynamic_cast<DlibRawBindArgs<NetType> &>(args);\n\n servable_ = std::move(raw_args.net);\n\n bind_called_ = true;\n\n return ReturnCodes::OK;\n\n } catch (std::bad_cast &e) {\n\n ;\n\n }\n\n\n\n return ReturnCodes::NO_SUITABLE_BIND_ARGS;\n\n}\n\n\n\ntemplate <class NetType, class InputType, class OutputType>\n\nvoid DlibServable<NetType, InputType, OutputType>::SetBatchSize_(\n\n const int &new_size) {\n", "file_path": "Servable/DlibServable/include/DlibServable.hpp", "rank": 15, "score": 68527.77938696435 }, { "content": " }\n\n\n\n this->SetBatchSize_(new_size);\n\n\n\n return ReturnCodes::OK;\n\n}\n\n\n\ntemplate <class NetType, class InputType, class OutputType>\n\nReturnCodes DlibServable<NetType, InputType, OutputType>::AddToBatch(\n\n const TensorMessage &message) {\n\n const std::string &client_id = message.client_id();\n\n std::vector<InputType> message_input(message.n());\n\n std::istringstream message_stream(message.serialized_buffer(),\n\n std::ios::binary);\n\n\n\n if (!bind_called_) {\n\n return ReturnCodes::NEED_BIND_CALL;\n\n }\n\n\n\n if (message.n() > batch_size_) {\n", "file_path": "Servable/DlibServable/include/DlibServable.hpp", "rank": 16, "score": 68526.81739391021 }, { "content": " }\n\n\n\n return ReturnCodes::OK;\n\n}\n\n\n\ntemplate <class NetType, class InputType, class OutputType>\n\nReturnCodes DlibServable<NetType, InputType, OutputType>::GetResult(\n\n const std::string &client_id, TensorMessage *message) {\n\n std::unique_lock<std::mutex> lk(result_mutex_);\n\n result_cv_.wait(\n\n lk, [&, this]() { // This will block forever if the client only calls\n\n // GetResult and never AddToBatch\n\n auto done = done_processing_by_client_.find(client_id);\n\n if (done != done_processing_by_client_.end()) {\n\n done = done_processing_by_client_.erase(done);\n\n return true;\n\n } else {\n\n return false;\n\n }\n\n });\n", "file_path": "Servable/DlibServable/include/DlibServable.hpp", "rank": 17, "score": 68525.2718221694 }, { "content": " const int &batch_size) {\n\n servable_ = NetType();\n\n current_n_ = 0;\n\n batch_size_ = batch_size;\n\n bind_called_ = false;\n\n current_batch_.reserve(batch_size_);\n\n}\n\n\n\ntemplate <class NetType, class InputType, class OutputType>\n\nDlibServable<NetType, InputType, OutputType>::~DlibServable() {\n\n ;\n\n}\n\n\n\ntemplate <class NetType, class InputType, class OutputType>\n\nReturnCodes DlibServable<NetType, InputType, OutputType>::SetBatchSize(\n\n const int &new_size) {\n\n std::lock_guard<std::mutex> guard_input(input_mutex_);\n\n\n\n if (new_size <= current_n_) {\n\n return ReturnCodes::NEXT_BATCH;\n", "file_path": "Servable/DlibServable/include/DlibServable.hpp", "rank": 18, "score": 68524.40109533901 }, { "content": " batch_size_ = new_size;\n\n current_batch_.reserve(batch_size_);\n\n}\n\n\n\ntemplate <class NetType, class InputType, typename OutputType>\n\nvoid DlibServable<NetType, InputType, OutputType>::ProcessCurrentBatch_() {\n\n std::vector<OutputType> outputs = servable_(current_batch_);\n\n\n\n for (auto &client_idx : idx_by_client_) {\n\n result_by_client_[client_idx.first] =\n\n std::vector<OutputType>(outputs.begin() + client_idx.second.first,\n\n outputs.begin() + client_idx.second.second);\n\n done_processing_by_client_.emplace(client_idx.first);\n\n }\n\n\n\n idx_by_client_.clear();\n\n\n\n // Reset everyone\n\n current_batch_.clear();\n\n result_cv_.notify_all();\n\n current_n_ = 0;\n\n}\n\n\n\n} // namespace Serving\n\n\n\n#endif // BATCHINGRPCSERVER_DLIBSERVABLE_HPP\n", "file_path": "Servable/DlibServable/include/DlibServable.hpp", "rank": 19, "score": 68523.50199990749 }, { "content": "\n\n std::mutex input_mutex_;\n\n std::map<std::string, std::pair<int, int>> idx_by_client_;\n\n std::vector<InputType> current_batch_;\n\n\n\n int current_n_;\n\n int batch_size_;\n\n\n\n std::atomic<bool> bind_called_;\n\n\n\n std::mutex result_mutex_;\n\n std::condition_variable result_cv_;\n\n std::set<std::string> done_processing_by_client_;\n\n std::map<std::string, std::vector<OutputType>> result_by_client_;\n\n};\n\n\n\n// Implementation\n\n\n\ntemplate <class NetType, class InputType, class OutputType>\n\nDlibServable<NetType, InputType, OutputType>::DlibServable(\n", "file_path": "Servable/DlibServable/include/DlibServable.hpp", "rank": 20, "score": 68523.2049907985 }, { "content": " return ReturnCodes::BATCH_TOO_LARGE;\n\n }\n\n\n\n dlib::deserialize(message_input, message_stream);\n\n\n\n if (message_input.size() !=\n\n message.n()) { // message was constructed incorrectly...\n\n return ReturnCodes::SHAPE_INCORRECT;\n\n }\n\n\n\n {\n\n\n\n std::lock_guard<std::mutex> guard_input(input_mutex_);\n\n\n\n if (message.n() + current_n_ > batch_size_) {\n\n this->SetBatchSize_(current_n_);\n\n ProcessCurrentBatch_();\n\n return ReturnCodes::NEXT_BATCH;\n\n }\n\n\n", "file_path": "Servable/DlibServable/include/DlibServable.hpp", "rank": 21, "score": 68522.62191332933 }, { "content": " */\n\n\n\n#ifndef BATCHINGRPCSERVER_DLIBSERVABLE_HPP\n\n#define BATCHINGRPCSERVER_DLIBSERVABLE_HPP\n\n\n\n// STL\n\n#include <atomic>\n\n#include <condition_variable>\n\n#include <map>\n\n#include <mutex>\n\n#include <thread>\n\n\n\n// Dlib\n\n#include \"dlib/dnn.h\"\n\n\n\n// Project\n\n#include \"Servable.hpp\"\n\n\n\n// Generated\n\n#include \"BatchingRPC.pb.h\"\n\n\n\nnamespace Serving {\n\n\n", "file_path": "Servable/DlibServable/include/DlibServable.hpp", "rank": 22, "score": 68521.43920162931 }, { "content": " result_by_client_.erase(client_id); // clears room for the new result\n\n\n\n if (idx_by_client_.find(client_id) == idx_by_client_.end()) {\n\n idx_by_client_[client_id] =\n\n std::make_pair(current_n_, current_n_ + message.n());\n\n } else {\n\n idx_by_client_[client_id].second += message.n();\n\n }\n\n\n\n // Clients could send us multiple inputs, we need to deal with that\n\n // properly.\n\n current_batch_.insert(current_batch_.end(), message_input.begin(),\n\n message_input.end());\n\n\n\n current_n_ += message.n();\n\n if (current_n_ <= batch_size_) {\n\n if (current_n_ == batch_size_) {\n\n ProcessCurrentBatch_();\n\n }\n\n }\n", "file_path": "Servable/DlibServable/include/DlibServable.hpp", "rank": 23, "score": 68517.8116111436 }, { "content": "//\n\n// Created by Aman LaChapelle on 1/7/18.\n\n//\n\n// BatchingRPCServer\n\n// Copyright (c) 2018 Aman LaChapelle\n\n// Full license at BatchingRPCServer/LICENSE.txt\n\n//\n\n\n\n/*\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n\n you may not use this file except in compliance with the License.\n\n You may obtain a copy of the License at\n\n\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n Unless required by applicable law or agreed to in writing, software\n\n distributed under the License is distributed on an \"AS IS\" BASIS,\n\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n See the License for the specific language governing permissions and\n\n limitations under the License.\n", "file_path": "Servable/DlibServable/include/DlibServable.hpp", "rank": 24, "score": 68513.9770637407 }, { "content": " */\n\n\n\n#ifndef BATCHING_RPC_SERVER_MXNETSERVABLE_HPP\n\n#define BATCHING_RPC_SERVER_MXNETSERVABLE_HPP\n\n\n\n// STL\n\n#include <atomic>\n\n#include <condition_variable>\n\n#include <map>\n\n#include <mutex>\n\n#include <thread>\n\n\n\n// MXNet\n\n#include \"mxnet-cpp/MxNetCpp.h\"\n\n\n\n// Project\n\n#include \"Servable.hpp\"\n\n\n\n// Generated\n\n#include \"BatchingRPC.pb.h\"\n\n\n\nnamespace Serving {\n\n\n\nnamespace mx = mxnet::cpp;\n\n\n", "file_path": "Servable/MXNetServable/include/MXNetServable.hpp", "rank": 25, "score": 64805.08090636489 }, { "content": "\n\n void LoadParameters_(std::map<std::string, mx::NDArray> &parameters);\n\n\n\n void ProcessCurrentBatch_();\n\n\n\n // Basic I/O requirements\n\n std::atomic<bool> bind_called_;\n\n mx::Shape input_shape_;\n\n mx::Shape output_shape_;\n\n\n\n // Information for processing\n\n std::mutex input_mutex_;\n\n std::map<std::string, std::pair<mx_uint, mx_uint>> idx_by_client_;\n\n std::vector<mx::NDArray> current_batch_; // TODO: 2 current_batches so we can\n\n // have a daemon thread running\n\n // processing?\n\n\n\n mx_uint current_n_;\n\n\n\n std::mutex result_mutex_;\n", "file_path": "Servable/MXNetServable/include/MXNetServable.hpp", "rank": 26, "score": 64802.672071972855 }, { "content": " std::condition_variable result_cv_;\n\n std::set<std::string> done_processing_by_client_;\n\n std::map<std::string, mx::NDArray> result_by_client_;\n\n\n\n // MXNet requirements for running\n\n mx::Context ctx_;\n\n mx::Symbol servable_;\n\n mx::Executor *executor_;\n\n std::map<std::string, mx::NDArray>\n\n args_map_; // inputs (data and model parameters) are args\n\n std::map<std::string, mx::NDArray> aux_map_; // everyone else is aux\n\n};\n\n\n\n} // namespace Serving\n\n\n\n#endif // BATCHING_RPC_SERVER_MXNETSERVABLE_HPP\n", "file_path": "Servable/MXNetServable/include/MXNetServable.hpp", "rank": 27, "score": 64801.275918663036 }, { "content": "//\n\n// Created by Aman LaChapelle on 11/5/17.\n\n//\n\n// BatchingRPCServer\n\n// Copyright (c) 2017 Aman LaChapelle\n\n// Full license at BatchingRPCServer/LICENSE.txt\n\n//\n\n\n\n/*\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n\n you may not use this file except in compliance with the License.\n\n You may obtain a copy of the License at\n\n\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n Unless required by applicable law or agreed to in writing, software\n\n distributed under the License is distributed on an \"AS IS\" BASIS,\n\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n See the License for the specific language governing permissions and\n\n limitations under the License.\n", "file_path": "Servable/MXNetServable/include/MXNetServable.hpp", "rank": 28, "score": 64797.659007084396 }, { "content": "class Servable {\n\npublic:\n\n virtual ~Servable() = default;\n\n\n\n /**\n\n * @brief Sets the batch size of the Servable.\n\n *\n\n * The Servable may have a need to have the size of its batches changed\n\n * during runtime - this function allows this.\n\n *\n\n * @param new_size The new batch size of the servable.\n\n * @return Returns ReturnCodes::OK if successful or ReturnCodes::NEXT_BATCH\n\n * if the batch is already larger than new_size.\n\n */\n\n virtual ReturnCodes SetBatchSize(const int &new_size) = 0;\n\n\n\n /**\n\n * @brief Adds the TensorMessage to the batch\n\n *\n\n * Deserializes the TensorMessage and adds it to the batch. Internally\n", "file_path": "Servable/Servable.hpp", "rank": 29, "score": 57211.378522377374 }, { "content": " auto result = result_by_client_.find(client_id);\n\n mx::NDArray &result_array = result->second;\n\n\n\n std::vector<mx_uint> result_shape = result_array.GetShape();\n\n\n\n google::protobuf::RepeatedField<float> data(\n\n result_array.GetData(), result_array.GetData() + result_array.Size());\n\n message->mutable_buffer()->Swap(&data);\n\n result = result_by_client_.erase(result);\n\n\n\n message->set_n(result_shape[0]);\n\n message->set_k(result_shape[1]);\n\n message->set_nr(result_shape[2]);\n\n message->set_nc(result_shape[3]);\n\n message->set_client_id(client_id);\n\n\n\n return ReturnCodes::OK;\n\n}\n\n\n\nReturnCodes MXNetServable::Bind(BindArgs &args) {\n", "file_path": "Servable/MXNetServable/src/MXNetServable.cpp", "rank": 39, "score": 36072.54350813757 }, { "content": " */\n\n\n\n#include \"MXNetServable.hpp\"\n\n\n\nnamespace Serving {\n\n\n\nMXNetServable::MXNetServable(const mx::Shape &input_shape,\n\n const mx::Shape &output_shape,\n\n const mx::DeviceType &type, const int &device_id)\n\n : input_shape_(input_shape), output_shape_(output_shape),\n\n ctx_(type, device_id), bind_called_(false), current_n_(0) {\n\n\n\n args_map_[\"data\"] = mx::NDArray(input_shape_, ctx_);\n\n}\n\n\n\nMXNetServable::~MXNetServable() {\n\n if (bind_called_)\n\n delete executor_;\n\n}\n\n\n", "file_path": "Servable/MXNetServable/src/MXNetServable.cpp", "rank": 40, "score": 36072.0433018326 }, { "content": "ReturnCodes MXNetServable::SetBatchSize(const int &new_size) {\n\n std::lock_guard<std::mutex> guard_input(input_mutex_);\n\n\n\n if (new_size <= current_n_) {\n\n return ReturnCodes::NEXT_BATCH;\n\n }\n\n\n\n this->SetBatchSize_(new_size);\n\n\n\n return ReturnCodes::OK;\n\n}\n\n\n\nReturnCodes MXNetServable::AddToBatch(const TensorMessage &message) {\n\n\n\n const std::string &client_id = message.client_id();\n\n\n\n if (!bind_called_) {\n\n return ReturnCodes::NEED_BIND_CALL;\n\n }\n\n\n", "file_path": "Servable/MXNetServable/src/MXNetServable.cpp", "rank": 41, "score": 36071.07578783964 }, { "content": " } catch (std::bad_cast &e) {\n\n ;\n\n }\n\n\n\n return ReturnCodes::NO_SUITABLE_BIND_ARGS;\n\n}\n\n\n\n// Private methods //\n\n\n\nvoid MXNetServable::SetBatchSize_(const int &new_size) {\n\n // Reshape the input\n\n input_shape_ =\n\n mx::Shape(new_size, input_shape_[1], input_shape_[2], input_shape_[3]);\n\n\n\n // Re-bind the executor with the new batch size\n\n args_map_[\"data\"] = mx::NDArray(input_shape_, ctx_);\n\n BindExecutor_();\n\n}\n\n\n\nvoid MXNetServable::BindExecutor_() {\n", "file_path": "Servable/MXNetServable/src/MXNetServable.cpp", "rank": 42, "score": 36070.04775584154 }, { "content": "\n\n return ReturnCodes::OK;\n\n}\n\n\n\nReturnCodes MXNetServable::GetResult(const std::string &client_id,\n\n TensorMessage *message) {\n\n\n\n std::unique_lock<std::mutex> lk(result_mutex_);\n\n result_cv_.wait(\n\n lk, [&, this]() { // This will block forever if the client only calls\n\n // GetResult and never AddToBatch\n\n auto done = done_processing_by_client_.find(client_id);\n\n if (done != done_processing_by_client_.end()) {\n\n done = done_processing_by_client_.erase(done);\n\n return true;\n\n } else {\n\n return false;\n\n }\n\n });\n\n\n", "file_path": "Servable/MXNetServable/src/MXNetServable.cpp", "rank": 43, "score": 36069.71180847091 }, { "content": " if (message.n() > input_shape_[0]) {\n\n return ReturnCodes::BATCH_TOO_LARGE;\n\n }\n\n\n\n if (message.k() != input_shape_[1] || message.nr() != input_shape_[2] ||\n\n message.nc() != input_shape_[3]) {\n\n return ReturnCodes::SHAPE_INCORRECT;\n\n }\n\n\n\n {\n\n\n\n std::lock_guard<std::mutex> guard_input(input_mutex_);\n\n\n\n if (message.n() + current_n_ > input_shape_[0]) {\n\n this->SetBatchSize_(current_n_);\n\n ProcessCurrentBatch_();\n\n return ReturnCodes::NEXT_BATCH;\n\n }\n\n\n\n result_by_client_.erase(client_id); // clears room for the new result\n", "file_path": "Servable/MXNetServable/src/MXNetServable.cpp", "rank": 44, "score": 36068.965227912064 }, { "content": "\n\n mx::NDArray::WaitAll();\n\n}\n\n\n\nvoid MXNetServable::ProcessCurrentBatch_() {\n\n\n\n // mx::Operator(\"_contrib_MultiProposal\")(current_batch_).Invoke(args_map_[\"data\"]);\n\n // // c++ just has to use the names\n\n\n\n mx::Operator(\"concat\")(current_batch_)\n\n .SetParam(\"dim\", 0)\n\n .SetParam(\"num_args\", current_batch_.size())\n\n .Invoke(args_map_[\"data\"]);\n\n\n\n executor_->Forward(false);\n\n\n\n mx::NDArray &result = executor_->outputs[0];\n\n mx::NDArray::WaitAll();\n\n\n\n for (auto &client_idx : idx_by_client_) {\n", "file_path": "Servable/MXNetServable/src/MXNetServable.cpp", "rank": 45, "score": 36068.396089015805 }, { "content": " bind_called_ = true;\n\n\n\n try {\n\n RawBindArgs &raw_args = dynamic_cast<RawBindArgs &>(args);\n\n servable_ = raw_args.net;\n\n LoadParameters_(raw_args.parameters);\n\n BindExecutor_();\n\n return ReturnCodes::OK;\n\n } catch (std::bad_cast &e) {\n\n ;\n\n }\n\n\n\n try {\n\n FileBindArgs &file_args = dynamic_cast<FileBindArgs &>(args);\n\n servable_ = mx::Symbol::Load(file_args.symbol_filename);\n\n std::map<std::string, mx::NDArray> parameters =\n\n mx::NDArray::LoadToMap(file_args.parameters_filename);\n\n LoadParameters_(parameters);\n\n BindExecutor_();\n\n return ReturnCodes::OK;\n", "file_path": "Servable/MXNetServable/src/MXNetServable.cpp", "rank": 46, "score": 36067.41722306339 }, { "content": " int client_batch_size = client_idx.second.second - client_idx.second.first;\n\n result_by_client_[client_idx.first] =\n\n mx::NDArray(mx::Shape(client_batch_size, output_shape_[1]), ctx_);\n\n result.Slice(client_idx.second.first, client_idx.second.second)\n\n .CopyTo(&result_by_client_[client_idx.first]);\n\n done_processing_by_client_.emplace(client_idx.first);\n\n }\n\n\n\n idx_by_client_.clear();\n\n\n\n // Reset everyone\n\n current_batch_.clear();\n\n result_cv_.notify_all();\n\n current_n_ = 0;\n\n}\n\n\n\n} // namespace Serving\n", "file_path": "Servable/MXNetServable/src/MXNetServable.cpp", "rank": 47, "score": 36066.63623081525 }, { "content": "\n\n executor_ = servable_.SimpleBind(\n\n ctx_, args_map_, std::map<std::string, mx::NDArray>(),\n\n std::map<std::string, mx::OpReqType>(), aux_map_);\n\n\n\n bind_called_ = true;\n\n}\n\n\n\nvoid MXNetServable::LoadParameters_(\n\n std::map<std::string, mx::NDArray> &parameters) {\n\n for (const auto &k : parameters) {\n\n if (k.first.substr(0, 4) == \"aux:\") {\n\n auto name = k.first.substr(4, k.first.size() - 4);\n\n aux_map_[name] = k.second.Copy(ctx_);\n\n }\n\n if (k.first.substr(0, 4) == \"arg:\") {\n\n auto name = k.first.substr(4, k.first.size() - 4);\n\n args_map_[name] = k.second.Copy(ctx_);\n\n }\n\n }\n", "file_path": "Servable/MXNetServable/src/MXNetServable.cpp", "rank": 48, "score": 36065.54926672682 }, { "content": "\n\n if (idx_by_client_.find(client_id) == idx_by_client_.end()) {\n\n idx_by_client_[client_id] =\n\n std::make_pair(current_n_, current_n_ + message.n());\n\n } else {\n\n idx_by_client_[client_id].second += message.n();\n\n }\n\n\n\n current_batch_.emplace_back(mx::NDArray(\n\n message.buffer().data(), mx::Shape(message.n(), input_shape_[1],\n\n input_shape_[2], input_shape_[3]),\n\n ctx_));\n\n\n\n current_n_ += message.n();\n\n if (current_n_ <= input_shape_[0]) {\n\n if (current_n_ == input_shape_[0]) {\n\n ProcessCurrentBatch_();\n\n }\n\n }\n\n }\n", "file_path": "Servable/MXNetServable/src/MXNetServable.cpp", "rank": 49, "score": 36063.755685749114 }, { "content": "//\n\n// Created by Aman LaChapelle on 11/5/17.\n\n//\n\n// BatchingRPCServer\n\n// Copyright (c) 2017 Aman LaChapelle\n\n// Full license at BatchingRPCServer/LICENSE.txt\n\n//\n\n\n\n/*\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n\n you may not use this file except in compliance with the License.\n\n You may obtain a copy of the License at\n\n\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n Unless required by applicable law or agreed to in writing, software\n\n distributed under the License is distributed on an \"AS IS\" BASIS,\n\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n See the License for the specific language governing permissions and\n\n limitations under the License.\n", "file_path": "Servable/MXNetServable/src/MXNetServable.cpp", "rank": 50, "score": 36062.1525809974 }, { "content": " Serving::MXNetServable servable(mx::Shape(16, 3, 256, 256),\n\n mx::Shape(1, n_hidden), mx::kCPU, 0);\n\n\n\n EXPECT_NO_THROW(servable.Bind(file_args));\n\n}\n\n\n\nTEST_F(TestMXNetServable, Single) {\n\n Serving::MXNetServable servable(mx::Shape(1, 1, 1, n_hidden),\n\n mx::Shape(1, n_hidden), mx::kCPU, 0);\n\n\n\n servable.Bind(raw_args);\n\n\n\n Serving::TensorMessage msg = ToMessage(input);\n\n msg.set_client_id(\"test\");\n\n\n\n Serving::ReturnCodes r = servable.AddToBatch(msg);\n\n EXPECT_EQ(r, Serving::ReturnCodes::OK);\n\n\n\n Serving::TensorMessage output;\n\n r = servable.GetResult(\"test\", &output);\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 51, "score": 35430.98977499058 }, { "content": " EXPECT_EQ(r, Serving::ReturnCodes::OK);\n\n\n\n int buflen = msg.buffer().size();\n\n for (int i = 0; i < buflen; i++) {\n\n EXPECT_EQ(output.buffer(i), 2.f * n_hidden + 1);\n\n }\n\n}\n\n\n\nTEST_F(TestMXNetServable, NoBind) {\n\n Serving::MXNetServable servable(mx::Shape(1, 1, 1, n_hidden),\n\n mx::Shape(1, n_hidden), mx::kCPU, 0);\n\n\n\n Serving::TensorMessage msg = ToMessage(input);\n\n msg.set_client_id(\"no_bind\");\n\n\n\n Serving::ReturnCodes r = servable.AddToBatch(msg);\n\n EXPECT_EQ(r, Serving::ReturnCodes::NEED_BIND_CALL);\n\n}\n\n\n\nTEST_F(TestMXNetServable, BadShape) {\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 52, "score": 35429.16041889583 }, { "content": "\n\n r = servable.GetResult(\"zeros\", &output);\n\n EXPECT_EQ(r, Serving::ReturnCodes::OK);\n\n EXPECT_EQ(output.n(), 1);\n\n buflen = msg.buffer().size();\n\n for (int i = 0; i < buflen; i++) {\n\n EXPECT_EQ(output.buffer(i), 1.f);\n\n }\n\n}\n\n\n\nTEST_F(TestMXNetServable, UpdateBatchSuccess) {\n\n Serving::MXNetServable servable(mx::Shape(2, 1, 1, n_hidden),\n\n mx::Shape(1, n_hidden), mx::kCPU, 1);\n\n\n\n servable.Bind(raw_args);\n\n\n\n Serving::TensorMessage msg = ToMessage(input);\n\n msg.set_client_id(\"test\");\n\n Serving::TensorMessage z = ToMessage(zeros);\n\n z.set_client_id(\"zeros\");\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 53, "score": 35428.84214389864 }, { "content": " EXPECT_EQ(r, Serving::ReturnCodes::NEXT_BATCH);\n\n}\n\n\n\nTEST_F(TestMXNetServable, Multiple) {\n\n Serving::MXNetServable servable(mx::Shape(2, 1, 1, n_hidden),\n\n mx::Shape(1, n_hidden), mx::kCPU, 0);\n\n\n\n servable.Bind(raw_args);\n\n\n\n Serving::TensorMessage msg = ToMessage(input);\n\n msg.set_client_id(\"test\");\n\n\n\n std::thread t1(ThreadedAdd, &servable, msg);\n\n t1.detach();\n\n std::thread t2(ThreadedAdd, &servable, msg);\n\n t2.detach();\n\n\n\n Serving::TensorMessage output;\n\n Serving::ReturnCodes r = servable.GetResult(\n\n \"test\", &output); // this isn't blocking so everything gets destroyed?\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 54, "score": 35428.46581935458 }, { "content": " mx::Symbol result = mx::FullyConnected(\"fc1\", data, m, b, n_hidden);\n\n\n\n return result;\n\n}\n\n\n\nServing::TensorMessage ToMessage(mx::NDArray &arr) {\n\n std::vector<mx_uint> result_shape = arr.GetShape();\n\n\n\n Serving::TensorMessage message;\n\n google::protobuf::RepeatedField<float> data(arr.GetData(),\n\n arr.GetData() + arr.Size());\n\n message.mutable_buffer()->Swap(&data);\n\n\n\n message.set_n(result_shape[0]);\n\n message.set_k(result_shape[1]);\n\n message.set_nr(result_shape[2]);\n\n message.set_nc(result_shape[3]);\n\n message.set_client_id(\"data\");\n\n\n\n return message;\n\n}\n\n\n\nvoid ThreadedAdd(Serving::Servable *servable, Serving::TensorMessage msg) {\n\n Serving::ReturnCodes r1 = servable->AddToBatch(msg);\n\n EXPECT_EQ(r1, Serving::ReturnCodes::OK);\n\n}\n\n\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 55, "score": 35427.40771686042 }, { "content": " EXPECT_EQ(r, Serving::ReturnCodes::OK);\n\n\n\n EXPECT_EQ(output.n(), 2);\n\n\n\n int buflen = msg.buffer().size();\n\n for (int i = 0; i < buflen; i++) {\n\n EXPECT_EQ(output.buffer(i), 2.f * n_hidden + 1);\n\n }\n\n}\n\n\n\nTEST_F(TestMXNetServable, MultipleClients) {\n\n Serving::MXNetServable servable(mx::Shape(3, 1, 1, n_hidden),\n\n mx::Shape(1, n_hidden), mx::kCPU, 0);\n\n\n\n servable.Bind(raw_args);\n\n\n\n Serving::TensorMessage msg = ToMessage(input);\n\n msg.set_client_id(\"test\");\n\n Serving::TensorMessage z = ToMessage(zeros);\n\n z.set_client_id(\"zeros\");\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 56, "score": 35427.310616262555 }, { "content": " Serving::MXNetServable servable(mx::Shape(1, 1, 1, n_hidden),\n\n mx::Shape(1, n_hidden), mx::kCPU, 0);\n\n\n\n servable.Bind(raw_args);\n\n\n\n Serving::TensorMessage msg = ToMessage(wrong_size);\n\n msg.set_client_id(\"incorrect_shape\");\n\n\n\n Serving::ReturnCodes r = servable.AddToBatch(msg);\n\n EXPECT_EQ(r, Serving::ReturnCodes::SHAPE_INCORRECT);\n\n}\n\n\n\nTEST_F(TestMXNetServable, TooBig) {\n\n Serving::MXNetServable servable(mx::Shape(1, 1, 1, n_hidden),\n\n mx::Shape(1, n_hidden), mx::kCPU, 0);\n\n\n\n servable.Bind(raw_args);\n\n\n\n Serving::TensorMessage msg = ToMessage(too_big);\n\n msg.set_client_id(\"too_big\");\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 57, "score": 35426.511335715644 }, { "content": "\n\n Serving::ReturnCodes r = servable.AddToBatch(msg);\n\n EXPECT_EQ(r, Serving::ReturnCodes::BATCH_TOO_LARGE);\n\n}\n\n\n\nTEST_F(TestMXNetServable, NextBatch) {\n\n Serving::MXNetServable servable(mx::Shape(3, 1, 1, n_hidden),\n\n mx::Shape(1, n_hidden), mx::kCPU, 0);\n\n\n\n servable.Bind(raw_args);\n\n\n\n Serving::TensorMessage msg = ToMessage(too_big);\n\n msg.set_client_id(\"too_big\");\n\n Serving::ReturnCodes r = servable.AddToBatch(msg);\n\n EXPECT_EQ(r, Serving::ReturnCodes::OK);\n\n\n\n msg = ToMessage(too_big);\n\n msg.set_client_id(\"too_big\");\n\n\n\n r = servable.AddToBatch(msg);\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 58, "score": 35426.38890010566 }, { "content": " }\n\n output.clear_buffer();\n\n\n\n t1.join();\n\n t2.join();\n\n r = servable.GetResult(\"test\", &output);\n\n EXPECT_EQ(r, Serving::ReturnCodes::OK);\n\n EXPECT_EQ(output.n(), 2);\n\n buflen = msg.buffer().size();\n\n for (int i = 0; i < buflen; i++) {\n\n EXPECT_EQ(output.buffer(i), 2.f * n_hidden + 1);\n\n }\n\n}\n\n\n\nTEST_F(TestMXNetServable, UpdateBatchFail) {\n\n Serving::MXNetServable servable(mx::Shape(3, 1, 1, n_hidden),\n\n mx::Shape(1, n_hidden), mx::kCPU, 1);\n\n\n\n servable.Bind(raw_args);\n\n\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 59, "score": 35426.30197802374 }, { "content": "\n\n std::thread t1(ThreadedAdd, &servable, msg);\n\n\n\n Serving::ReturnCodes r2 = servable.SetBatchSize(3);\n\n EXPECT_EQ(r2, Serving::ReturnCodes::OK);\n\n\n\n std::thread t2(ThreadedAdd, &servable, msg);\n\n std::thread tz(ThreadedAdd, &servable, z);\n\n\n\n Serving::TensorMessage output;\n\n int buflen;\n\n Serving::ReturnCodes r;\n\n\n\n tz.join();\n\n r = servable.GetResult(\"zeros\", &output);\n\n EXPECT_EQ(r, Serving::ReturnCodes::OK);\n\n EXPECT_EQ(output.n(), 1);\n\n buflen = msg.buffer().size();\n\n for (int i = 0; i < buflen; i++) {\n\n EXPECT_EQ(output.buffer(i), 1.f);\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 60, "score": 35424.218934256394 }, { "content": "\n\n std::thread t1(ThreadedAdd, &servable, msg);\n\n t1.detach();\n\n std::thread t2(ThreadedAdd, &servable, msg);\n\n t2.detach();\n\n std::thread tz(ThreadedAdd, &servable, z);\n\n tz.detach();\n\n\n\n Serving::TensorMessage output;\n\n int buflen;\n\n Serving::ReturnCodes r;\n\n\n\n r = servable.GetResult(\"test\", &output);\n\n EXPECT_EQ(r, Serving::ReturnCodes::OK);\n\n EXPECT_EQ(output.n(), 2);\n\n buflen = msg.buffer().size();\n\n for (int i = 0; i < buflen; i++) {\n\n EXPECT_EQ(output.buffer(i), 2.f * n_hidden + 1);\n\n }\n\n output.clear_buffer();\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 61, "score": 35424.14075358025 }, { "content": " int buflen;\n\n Serving::ReturnCodes r;\n\n\n\n r = servable.GetResult(\"test\", &output);\n\n EXPECT_EQ(r, Serving::ReturnCodes::OK);\n\n EXPECT_EQ(output.n(), 2);\n\n buflen = msg.buffer().size();\n\n for (int i = 0; i < buflen; i++) {\n\n EXPECT_EQ(output.buffer(i), 2.f * n_hidden + 1);\n\n }\n\n output.clear_buffer();\n\n\n\n r = servable.GetResult(\"zeros\", &output);\n\n EXPECT_EQ(r, Serving::ReturnCodes::OK);\n\n EXPECT_EQ(output.n(), 1);\n\n buflen = msg.buffer().size();\n\n for (int i = 0; i < buflen; i++) {\n\n EXPECT_EQ(output.buffer(i), 1.f);\n\n }\n\n}\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 62, "score": 35424.037404476476 }, { "content": " }\n\n output.clear_buffer();\n\n\n\n r = servable.GetResult(\"zeros\", &output);\n\n EXPECT_EQ(r, Serving::ReturnCodes::OK);\n\n EXPECT_EQ(output.n(), 1);\n\n buflen = z.buffer().size();\n\n for (int i = 0; i < buflen; i++) {\n\n EXPECT_EQ(output.buffer(i), 1.f);\n\n }\n\n}\n\n} // namespace\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 63, "score": 35423.269208204 }, { "content": "\n\n Serving::TensorMessage output;\n\n int buflen;\n\n Serving::ReturnCodes r;\n\n\n\n r = servable.GetResult(\"test1\", &output);\n\n EXPECT_EQ(r, Serving::ReturnCodes::OK);\n\n EXPECT_EQ(output.n(), 1);\n\n buflen = msg1.buffer().size();\n\n for (int i = 0; i < buflen; i++) {\n\n EXPECT_EQ(output.buffer(i), 2.f * n_hidden + 1);\n\n }\n\n output.clear_buffer();\n\n\n\n r = servable.GetResult(\"test2\", &output);\n\n EXPECT_EQ(r, Serving::ReturnCodes::OK);\n\n EXPECT_EQ(output.n(), 1);\n\n buflen = msg2.buffer().size();\n\n for (int i = 0; i < buflen; i++) {\n\n EXPECT_EQ(output.buffer(i), 2.f * n_hidden + 1);\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 64, "score": 35423.02223492075 }, { "content": " Serving::TensorMessage msg = ToMessage(input);\n\n msg.set_client_id(\"test\");\n\n Serving::TensorMessage z = ToMessage(zeros);\n\n z.set_client_id(\"zeros\");\n\n\n\n std::thread t1(ThreadedAdd, &servable, msg);\n\n t1.detach();\n\n std::thread t2(ThreadedAdd, &servable, msg);\n\n t2.detach();\n\n // Add must have occurred for the batch size modification to fail\n\n\n\n std::this_thread::sleep_for(std::chrono::milliseconds(10));\n\n\n\n Serving::ReturnCodes r3 = servable.SetBatchSize(1);\n\n EXPECT_EQ(r3, Serving::ReturnCodes::NEXT_BATCH);\n\n\n\n std::thread tz(ThreadedAdd, &servable, z);\n\n tz.detach();\n\n\n\n Serving::TensorMessage output;\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 65, "score": 35422.02604142504 }, { "content": " */\n\n\n\n#include <map>\n\n\n\n#include \"mxnet-cpp/MxNetCpp.h\"\n\n\n\n#include \"BatchingRPC.pb.h\"\n\n#include \"MXNetServable.hpp\"\n\n#include \"Servable.hpp\"\n\n\n\n#include \"gtest/gtest.h\"\n\n\n\nnamespace {\n\nnamespace mx = mxnet::cpp;\n\n\n\nmx::Symbol SimpleSymbolFactory(int n_hidden) {\n\n mx::Symbol data = mx::Symbol::Variable(\"data\");\n\n mx::Symbol m = mx::Symbol::Variable(\"m\");\n\n mx::Symbol b = mx::Symbol::Variable(\"b\");\n\n\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 66, "score": 35421.43487243231 }, { "content": " int n_hidden = 2000;\n\n mx::Symbol fc;\n\n std::map<std::string, mx::NDArray> parms;\n\n mx::NDArray input;\n\n mx::NDArray zeros;\n\n mx::NDArray wrong_size;\n\n mx::NDArray too_big;\n\n\n\n Serving::RawBindArgs raw_args;\n\n Serving::FileBindArgs file_args;\n\n};\n\n\n\nTEST_F(TestMXNetServable, Bind) {\n\n Serving::MXNetServable servable(mx::Shape(1, 1, 1, n_hidden),\n\n mx::Shape(1, n_hidden), mx::kCPU, 0);\n\n\n\n EXPECT_NO_THROW(servable.Bind(raw_args));\n\n}\n\n\n\nTEST_F(TestMXNetServable, BindFile) {\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 67, "score": 35420.53297669038 }, { "content": "\n\nTEST_F(TestMXNetServable, MultipleBatches) {\n\n Serving::MXNetServable servable(mx::Shape(1, 1, 1, n_hidden),\n\n mx::Shape(1, n_hidden), mx::kCPU, 0);\n\n\n\n servable.Bind(raw_args);\n\n\n\n Serving::TensorMessage msg1 = ToMessage(input);\n\n msg1.set_client_id(\"test1\");\n\n Serving::TensorMessage msg2 = ToMessage(input);\n\n msg2.set_client_id(\"test2\");\n\n Serving::TensorMessage z = ToMessage(zeros);\n\n z.set_client_id(\"zeros\");\n\n\n\n std::thread t1(ThreadedAdd, &servable, msg1);\n\n t1.detach();\n\n std::thread t2(ThreadedAdd, &servable, msg2);\n\n t2.detach();\n\n std::thread tz(ThreadedAdd, &servable, z);\n\n tz.detach();\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 68, "score": 35420.49130706724 }, { "content": " zeros = 0.f;\n\n\n\n wrong_size = mx::NDArray(mx::Shape(1, 1, 1, n_hidden + 1), *ctx);\n\n wrong_size = 1.f;\n\n\n\n too_big = mx::NDArray(mx::Shape(2, 1, 1, n_hidden), *ctx);\n\n too_big = 1.f;\n\n\n\n raw_args.net = fc;\n\n raw_args.parameters = parms;\n\n\n\n file_args.symbol_filename = \"../../../Servable/MXNetServable/test/assets/\"\n\n \"squeezenet_v1.1-symbol.json\";\n\n file_args.parameters_filename = \"../../../Servable/MXNetServable/test/\"\n\n \"assets/squeezenet_v1.1-0000.params\";\n\n }\n\n\n\n void TearDown() override { delete ctx; }\n\n\n\n mx::Context *ctx;\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 69, "score": 35418.668381630094 }, { "content": "//\n\n// Created by Aman LaChapelle on 12/9/17.\n\n//\n\n// BatchingRPCServer\n\n// Copyright (c) 2017 Aman LaChapelle\n\n// Full license at BatchingRPCServer/LICENSE.txt\n\n//\n\n\n\n/*\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n\n you may not use this file except in compliance with the License.\n\n You may obtain a copy of the License at\n\n\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n Unless required by applicable law or agreed to in writing, software\n\n distributed under the License is distributed on an \"AS IS\" BASIS,\n\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n See the License for the specific language governing permissions and\n\n limitations under the License.\n", "file_path": "Servable/MXNetServable/test/TestMXNetServable.cpp", "rank": 70, "score": 35414.44836276369 }, { "content": "enum ReturnCodes {\n\n //! Function exited normally.\n\n OK = 1,\n\n //! Bind was not called on the Servable, typically done before construction\n\n //! of TBServer. See Servable::Bind(BindArgs&).\n\n NEED_BIND_CALL = 2,\n\n //! The shape of the input was incorrect, check the shape and retry.\n\n SHAPE_INCORRECT = 3,\n\n //! The current batch is too full to process the request, retry.\n\n NEXT_BATCH = 4,\n\n //! The request's size is too large for the Servable's set batch size,\n\n //! caller should subdivide and try again\n\n //! or increase the batch size.\n\n BATCH_TOO_LARGE = 5,\n\n //! Bind has failed because the Servable was unable to cast the BindArgs\n\n //! instance to a usable type.\n\n NO_SUITABLE_BIND_ARGS = 6,\n\n};\n\n\n\n/**\n\n * @brief A virtual wrapper for arguments used to bind a Servable.\n\n *\n\n * All servables will require different arguments to bind, but they must\n\n * create a subclass of this object and then use a dynamic cast to cast it to\n\n * the appropriate object. See an example in MXNetServable.hpp -\n\n * Serving::RawBindArgs and Serving::FileBindArgs.\n\n */\n", "file_path": "Servable/Servable.hpp", "rank": 71, "score": 33361.47608610467 }, { "content": "struct BindArgs {\n\n virtual ~BindArgs() = default;\n\n};\n\n\n\n/**\n\n * @class Servable\n\n * @brief Delimits the public API for a Servable object.\n\n *\n\n * In order to be used with a TBServer gRPC wrapper, a Servable must implement\n\n * this API.\n\n */\n", "file_path": "Servable/Servable.hpp", "rank": 72, "score": 33267.32582868682 }, { "content": " *\n\n * This function enqueues a request to the Servable for both data processing\n\n * and retreival of results. This function will block until the current\n\n * batch is finished processing. The client is free to call Process in\n\n * another thread and simply wait for the result, or use an std::async call\n\n * to wait for the result as the client wishes. An example of calling this\n\n * function in a somewhat asynchronous manner can be found in\n\n * TestIntegration.cpp\n\n *\n\n * @param ctx\n\n * @param req\n\n * @param rep\n\n * @return gRPC status to the client.\n\n */\n\n grpc::Status Process(grpc::ServerContext *ctx, const TensorMessage *req,\n\n TensorMessage *rep) override;\n\n\n\n /**\n\n * @brief Starts the server at the specified address.\n\n *\n", "file_path": "Server/include/TBServer.hpp", "rank": 73, "score": 32421.247551904104 }, { "content": "#include <BatchingRPC.grpc.pb.h>\n\n#include <BatchingRPC.pb.h>\n\n\n\n/**\n\n * @namespace Serving\n\n * @brief Top level namespace for this project\n\n *\n\n * Defines the namespace within which all the code in this project resides.\n\n * Protobuf generates code under this namespace so for uniformity everything\n\n * lives under this namespace. No subdivisions exist as of 26/12/2017.\n\n */\n\nnamespace Serving {\n\n/**\n\n * @class TBServer\n\n * @brief Implements the BatchingServer::Service, providing the transport/RPC\n\n * layer\n\n *\n\n * This class provides the transport/RPC layer to the project. This means that\n\n * if we implement a Servable object, we can use this class to serve requests\n\n * to it. The API for the Servable object can be found in Servable.hpp and the\n\n * API for this object can be found in BatchingRPC.proto. Requests to the\n\n * system as a whole must follow the API in BatchingRPC.proto and internal\n\n * requests from TBServer to an implementation of a Servable must follow the\n\n * API in Servable.hpp.\n\n */\n", "file_path": "Server/include/TBServer.hpp", "rank": 74, "score": 32420.129504678313 }, { "content": " * @param cert Either a filename or the actual certificate in a string. The\n\n * function checks for the first five dashes\n\n * in the key to determine if it's a filename or not.\n\n */\n\n void StartSSL(const std::string &server_address, const std::string &key,\n\n const std::string &cert);\n\n\n\n /**\n\n * @brief Shuts down the server and cleans up used resources.\n\n */\n\n void Stop();\n\n\n\nprivate:\n\n std::set<std::string> users_;\n\n std::thread serve_thread_;\n\n std::unique_ptr<grpc::Server> server_;\n\n\n\n std::unique_ptr<Servable> servable_;\n\n};\n\n} // namespace Serving\n\n\n\n#endif // BATCHING_RPC_SERVER_TENSORBATCHINGSERVER_HPP\n", "file_path": "Server/include/TBServer.hpp", "rank": 75, "score": 32419.07738944824 }, { "content": " */\n\n\n\n#ifndef BATCHING_RPC_SERVER_TENSORBATCHINGSERVER_HPP\n\n#define BATCHING_RPC_SERVER_TENSORBATCHINGSERVER_HPP\n\n\n\n// STL\n\n#include <fstream>\n\n#include <thread>\n\n\n\n// UUID\n\n#include <uuid/uuid.h>\n\n\n\n// gRPC\n\n#include <grpc++/grpc++.h>\n\n#include <grpc/support/log.h>\n\n\n\n// Project\n\n#include \"Servable.hpp\"\n\n\n\n// Generated\n", "file_path": "Server/include/TBServer.hpp", "rank": 76, "score": 32417.48291797771 }, { "content": " *\n\n * This function calls Serving::Servable::SetBatchSize, which can return two\n\n * states. If an attempt is made to set the batch size to be smaller than\n\n * the current size of the batch, then Serving::ReturnCodes::NEXT_BATCH is\n\n * returned, indicating that the request should be retried. If the request\n\n * is successful, Serving::ReturnCodes::OK will be returned and the call can\n\n * proceed as normal. This call blocks on input aggregation and processing\n\n * of the current batch.\n\n *\n\n * @param ctx\n\n * @param req\n\n * @param rep\n\n * @return gRPC status to the client.\n\n */\n\n grpc::Status SetBatchSize(grpc::ServerContext *ctx, const AdminRequest *req,\n\n AdminReply *rep) override;\n\n\n\n /**\n\n * @brief Defines the gRPC backend for creating a new connection to the\n\n * Servable. The client API for this function can be found in\n", "file_path": "Server/include/TBServer.hpp", "rank": 77, "score": 32416.929854496757 }, { "content": "//\n\n// Created by Aman LaChapelle on 11/4/17.\n\n//\n\n// BatchingRPCServer\n\n// Copyright (c) 2017 Aman LaChapelle\n\n// Full license at BatchingRPCServer/LICENSE.txt\n\n//\n\n\n\n/*\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n\n you may not use this file except in compliance with the License.\n\n You may obtain a copy of the License at\n\n\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n Unless required by applicable law or agreed to in writing, software\n\n distributed under the License is distributed on an \"AS IS\" BASIS,\n\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n See the License for the specific language governing permissions and\n\n limitations under the License.\n", "file_path": "Server/include/TBServer.hpp", "rank": 78, "score": 32415.13292436172 }, { "content": " * BatchingRPC.proto\n\n *\n\n * This function creates a uuid for each client to avoid client id\n\n * collisions in the servable's processing space. The client should call\n\n * this function once, receive their unique ID, and tag all future requests\n\n * to Process with this unique ID. This function can be called as often as\n\n * desired.\n\n *\n\n * @param ctx\n\n * @param req\n\n * @param rep\n\n * @return gRPC status to the client.\n\n */\n\n grpc::Status Connect(grpc::ServerContext *ctx, const ConnectionRequest *req,\n\n ConnectionReply *rep) override;\n\n\n\n /**\n\n * @brief Defines the gRPC backend for requesting the Servable process some\n\n * piece of data. The client API for this function can be found in\n\n * BatchingRPC.proto\n", "file_path": "Server/include/TBServer.hpp", "rank": 79, "score": 32415.09146548439 }, { "content": " * Hides the gRPC server starting code behind a convenient function that can\n\n * be called to start the server with the credentials specified in the\n\n * function name.\n\n *\n\n * @param server_address Specifies the server's address - for example: @code\n\n * \"127.0.0.1:8080\" @endcode\n\n */\n\n void StartInsecure(const std::string &server_address);\n\n\n\n /**\n\n * @brief Starts the server at the specified address, with the specified\n\n * credentials. Note that if\n\n * the client does not have the correct certificate they will be unable to\n\n * connect.\n\n *\n\n * @param server_address Specifies the server's address - for example: @code\n\n * \"127.0.0.1:8080\" @endcode\n\n * @param key Either a filename or the actual key in a string. The function\n\n * checks for the first five dashes\n\n * in the key to determine if it's a filename or not.\n", "file_path": "Server/include/TBServer.hpp", "rank": 80, "score": 32415.055760712414 }, { "content": "using namespace dlib;\n\n\n\nusing net_type = loss_multiclass_log<fc<\n\n 10,\n\n relu<fc<\n\n 84,\n\n relu<fc<\n\n 120,\n\n max_pool<2, 2, 2, 2,\n\n relu<con<16, 5, 5, 1, 1,\n\n max_pool<2, 2, 2, 2,\n\n relu<con<6, 5, 5, 1, 1,\n\n input<matrix<\n\n unsigned char>>>>>>>>>>>>>>;\n\n\n\nServing::TensorMessage ToMessage(std::vector<matrix<unsigned char>> &&arr) {\n\n\n\n Serving::TensorMessage message;\n\n std::ostringstream buffer_stream(std::ios::binary);\n\n serialize(arr, buffer_stream);\n", "file_path": "test/TestIntegrationDlib.cpp", "rank": 81, "score": 32084.761672047112 }, { "content": " srv->StartInsecure(\"localhost:50051\");\n\n\n\n msg = ToMessage({input_[0]});\n\n }\n\n\n\n Serving::TBServer *srv;\n\n Serving::DlibRawBindArgs<net_type> raw_args;\n\n Serving::DlibFileBindArgs file_args;\n\n\n\n std::vector<matrix<unsigned char>> input_;\n\n std::vector<unsigned long> output_;\n\n Serving::TensorMessage msg;\n\n};\n\n\n\nTEST_F(TestIntegrationDlib, Connect) {\n\n std::shared_ptr<grpc::Channel> channel = grpc::CreateChannel(\n\n \"localhost:50051\", grpc::InsecureChannelCredentials());\n\n std::unique_ptr<BatchingServer::Stub> stub = BatchingServer::NewStub(channel);\n\n\n\n grpc::ClientContext context;\n", "file_path": "test/TestIntegrationDlib.cpp", "rank": 82, "score": 32083.98068819813 }, { "content": " message.set_serialized_buffer(buffer_stream.str());\n\n message.set_n(arr.size());\n\n\n\n return message;\n\n}\n\n\n\nvoid TrainNetwork(const std::string &dirname) {\n\n std::vector<matrix<unsigned char>> training_images;\n\n std::vector<unsigned long> training_labels;\n\n std::vector<matrix<unsigned char>> testing_images;\n\n std::vector<unsigned long> testing_labels;\n\n load_mnist_dataset(dirname, training_images, training_labels, testing_images,\n\n testing_labels);\n\n\n\n std::ifstream f(\n\n \"../Servable/DlibServable/test/assets/mnist_network.dat\");\n\n if (f.is_open()) {\n\n f.close();\n\n return;\n\n }\n", "file_path": "test/TestIntegrationDlib.cpp", "rank": 83, "score": 32083.420825689245 }, { "content": "TEST_F(TestIntegrationDlib, ThreadedProcessSingle) {\n\n std::shared_ptr<grpc::Channel> channel = grpc::CreateChannel(\n\n \"localhost:50051\", grpc::InsecureChannelCredentials());\n\n std::unique_ptr<BatchingServer::Stub> stub = BatchingServer::NewStub(channel);\n\n\n\n TensorMessage tensor_reply;\n\n\n\n std::thread processing_thread(ThreadProcess, std::ref(stub), msg,\n\n std::ref(tensor_reply));\n\n\n\n processing_thread.join();\n\n\n\n std::istringstream output_buffer(tensor_reply.serialized_buffer(),\n\n std::ios::binary);\n\n std::vector<unsigned long> results;\n\n deserialize(results, output_buffer);\n\n // this particular image is a seven, since the net is trained we might as well\n\n // run a prediction\n\n EXPECT_EQ(results[0], 7);\n\n}\n", "file_path": "test/TestIntegrationDlib.cpp", "rank": 84, "score": 32082.09578754744 }, { "content": "\n\n for (int i = 0; i < batch_size; i++) {\n\n request_threads.emplace_back(\n\n std::thread(ThreadProcess, std::ref(stub), msg, std::ref(results[i])));\n\n }\n\n\n\n for (int i = 0; i < batch_size; i++) {\n\n request_threads[i].join();\n\n TensorMessage &tensor_reply = results[i];\n\n\n\n std::istringstream output_buffer(tensor_reply.serialized_buffer(),\n\n std::ios::binary);\n\n std::vector<unsigned long> results;\n\n deserialize(results, output_buffer);\n\n // this particular image is a seven, since the net is trained we might as well\n\n // run a prediction\n\n EXPECT_EQ(results[0], 7);\n\n tensor_reply.clear_buffer();\n\n }\n\n}\n\n}\n\n} // namespace Serving::\n", "file_path": "test/TestIntegrationDlib.cpp", "rank": 85, "score": 32081.97492616342 }, { "content": " msg.set_client_id(rep.client_id());\n\n\n\n TensorMessage tensor_reply;\n\n\n\n {\n\n grpc::ClientContext context;\n\n status = stub->Process(&context, msg, &tensor_reply);\n\n EXPECT_TRUE(status.ok());\n\n\n\n std::istringstream output_buffer(tensor_reply.serialized_buffer(),\n\n std::ios::binary);\n\n\n\n std::vector<unsigned long> results;\n\n deserialize(results, output_buffer);\n\n // this particular image is a seven, since the net is trained we might as well\n\n // run a prediction\n\n EXPECT_EQ(results[0], 7);\n\n }\n\n}\n\n\n", "file_path": "test/TestIntegrationDlib.cpp", "rank": 86, "score": 32081.697435155897 }, { "content": "\n\n for (int i = 0; i < batch_size; i++) {\n\n request_threads.emplace_back(\n\n std::thread(ThreadProcess, std::ref(stub), msg, std::ref(results[i])));\n\n }\n\n\n\n for (int i = 0; i < batch_size; i++) {\n\n request_threads[i].join();\n\n TensorMessage &tensor_reply = results[i];\n\n\n\n std::istringstream output_buffer(tensor_reply.serialized_buffer(),\n\n std::ios::binary);\n\n std::vector<unsigned long> results;\n\n deserialize(results, output_buffer);\n\n // this particular image is a seven, since the net is trained we might as well\n\n // run a prediction\n\n EXPECT_EQ(results[0], 7);\n\n tensor_reply.clear_buffer();\n\n }\n\n}\n", "file_path": "test/TestIntegrationDlib.cpp", "rank": 87, "score": 32080.664828680885 }, { "content": " */\n\n\n\n#include <dlib/data_io.h>\n\n#include <sstream>\n\n\n\n#include \"DlibServable.hpp\"\n\n#include \"Servable.hpp\"\n\n\n\n#include \"TBServer.hpp\"\n\n\n\n#include \"gtest/gtest.h\"\n\n\n\n#include \"BatchingRPC.grpc.pb.h\"\n\n#include \"BatchingRPC.pb.h\"\n\n\n\n#include <future>\n\n\n\nnamespace Serving {\n\nnamespace {\n\n\n", "file_path": "test/TestIntegrationDlib.cpp", "rank": 88, "score": 32078.27571942156 }, { "content": "\n\n net_type net;\n\n dnn_trainer<net_type> trainer(net);\n\n trainer.set_learning_rate(0.01);\n\n trainer.set_min_learning_rate(0.0001);\n\n trainer.set_mini_batch_size(128);\n\n trainer.be_verbose();\n\n trainer.set_synchronization_file(\"mnist_sync\", std::chrono::seconds(20));\n\n trainer.train(training_images, training_labels);\n\n net.clean();\n\n serialize(\"../Servable/DlibServable/test/assets/mnist_network.dat\")\n\n << net;\n\n}\n\n\n\nvoid ThreadProcess(std::unique_ptr<BatchingServer::Stub> &stub,\n\n TensorMessage msg, TensorMessage &reply) {\n\n grpc::Status status;\n\n ConnectionReply rep;\n\n\n\n {\n", "file_path": "test/TestIntegrationDlib.cpp", "rank": 89, "score": 32075.565298947207 }, { "content": "\n\nTEST_F(TestIntegrationDlib, ThreadedProcessMultiple_SingleBatch) {\n\n std::shared_ptr<grpc::Channel> channel = grpc::CreateChannel(\n\n \"localhost:50051\", grpc::InsecureChannelCredentials());\n\n std::unique_ptr<BatchingServer::Stub> stub = BatchingServer::NewStub(channel);\n\n\n\n int batch_size = 50;\n\n\n\n {\n\n grpc::ClientContext context;\n\n AdminRequest req;\n\n req.set_new_batch_size(batch_size);\n\n AdminReply rep;\n\n\n\n grpc::Status status = stub->SetBatchSize(&context, req, &rep);\n\n EXPECT_TRUE(status.ok());\n\n }\n\n\n\n std::vector<std::thread> request_threads;\n\n std::vector<TensorMessage> results(batch_size);\n", "file_path": "test/TestIntegrationDlib.cpp", "rank": 90, "score": 32072.73560206905 }, { "content": "\n\nTEST_F(TestIntegrationDlib, ThreadedProcessMultiple_MultiBatch) {\n\n std::shared_ptr<grpc::Channel> channel = grpc::CreateChannel(\n\n \"localhost:50051\", grpc::InsecureChannelCredentials());\n\n std::unique_ptr<BatchingServer::Stub> stub = BatchingServer::NewStub(channel);\n\n\n\n int batch_size = 50;\n\n\n\n {\n\n grpc::ClientContext context;\n\n AdminRequest req;\n\n req.set_new_batch_size(10);\n\n AdminReply rep;\n\n\n\n grpc::Status status = stub->SetBatchSize(&context, req, &rep);\n\n EXPECT_TRUE(status.ok());\n\n }\n\n\n\n std::vector<std::thread> request_threads;\n\n std::vector<TensorMessage> results(batch_size);\n", "file_path": "test/TestIntegrationDlib.cpp", "rank": 91, "score": 32071.419256789653 }, { "content": " grpc::ClientContext context;\n\n stub->Connect(&context, ConnectionRequest(), &rep);\n\n }\n\n\n\n msg.set_client_id(rep.client_id());\n\n\n\n {\n\n grpc::ClientContext context;\n\n stub->Process(&context, msg, &reply);\n\n }\n\n}\n\n\n", "file_path": "test/TestIntegrationDlib.cpp", "rank": 92, "score": 32069.1446337455 }, { "content": "\n\n ConnectionReply rep;\n\n\n\n grpc::Status status = stub->Connect(&context, ConnectionRequest(), &rep);\n\n\n\n EXPECT_TRUE(status.ok());\n\n EXPECT_FALSE(rep.client_id().empty());\n\n}\n\n\n\nTEST_F(TestIntegrationDlib, SetBatchSize) {\n\n std::shared_ptr<grpc::Channel> channel = grpc::CreateChannel(\n\n \"localhost:50051\", grpc::InsecureChannelCredentials());\n\n std::unique_ptr<BatchingServer::Stub> stub = BatchingServer::NewStub(channel);\n\n\n\n grpc::ClientContext context;\n\n\n\n AdminRequest req;\n\n req.set_new_batch_size(5);\n\n AdminReply rep;\n\n\n", "file_path": "test/TestIntegrationDlib.cpp", "rank": 93, "score": 32069.062787587885 }, { "content": " grpc::Status status = stub->SetBatchSize(&context, req, &rep);\n\n\n\n EXPECT_TRUE(status.ok());\n\n}\n\n\n\nTEST_F(TestIntegrationDlib, Process) {\n\n std::shared_ptr<grpc::Channel> channel = grpc::CreateChannel(\n\n \"localhost:50051\", grpc::InsecureChannelCredentials());\n\n std::unique_ptr<BatchingServer::Stub> stub = BatchingServer::NewStub(channel);\n\n\n\n ConnectionReply rep;\n\n grpc::Status status;\n\n\n\n {\n\n grpc::ClientContext context;\n\n status = stub->Connect(&context, ConnectionRequest(), &rep);\n\n EXPECT_TRUE(status.ok());\n\n EXPECT_FALSE(rep.client_id().empty());\n\n }\n\n\n", "file_path": "test/TestIntegrationDlib.cpp", "rank": 94, "score": 32069.015664336377 }, { "content": "//\n\n// Created by Aman LaChapelle on 12/22/17.\n\n//\n\n// BatchingRPCServer\n\n// Copyright (c) 2017 Aman LaChapelle\n\n// Full license at BatchingRPCServer/LICENSE.txt\n\n//\n\n\n\n/*\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n\n you may not use this file except in compliance with the License.\n\n You may obtain a copy of the License at\n\n\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n Unless required by applicable law or agreed to in writing, software\n\n distributed under the License is distributed on an \"AS IS\" BASIS,\n\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n See the License for the specific language governing permissions and\n\n limitations under the License.\n", "file_path": "test/TestIntegrationDlib.cpp", "rank": 95, "score": 32067.70652364921 }, { "content": " servable->Bind(raw_args);\n\n srv = new TBServer(servable); // takes control of the servable\n\n srv->StartInsecure(\"localhost:50051\");\n\n\n\n msg = ToMessage(input);\n\n }\n\n\n\n void TearDown() override {\n\n srv->Stop();\n\n delete srv;\n\n }\n\n\n\n Serving::TBServer *srv;\n\n\n\n Serving::TensorMessage msg;\n\n\n\n mx::Context *ctx;\n\n int n_hidden = 2000;\n\n mx::NDArray input;\n\n\n", "file_path": "test/TestIntegrationMXNet.cpp", "rank": 96, "score": 30577.503141382473 }, { "content": " mx::Symbol data = mx::Symbol::Variable(\"data\");\n\n mx::Symbol m = mx::Symbol::Variable(\"m\");\n\n mx::Symbol b = mx::Symbol::Variable(\"b\");\n\n\n\n mx::Symbol result = mx::FullyConnected(\"fc1\", data, m, b, n_hidden);\n\n\n\n return result;\n\n}\n\n\n\nTensorMessage ToMessage(mx::NDArray &arr) {\n\n std::vector<mx_uint> result_shape = arr.GetShape();\n\n\n\n TensorMessage message;\n\n google::protobuf::RepeatedField<float> data(arr.GetData(),\n\n arr.GetData() + arr.Size());\n\n message.mutable_buffer()->Swap(&data);\n\n\n\n message.set_n(result_shape[0]);\n\n message.set_k(result_shape[1]);\n\n message.set_nr(result_shape[2]);\n", "file_path": "test/TestIntegrationMXNet.cpp", "rank": 97, "score": 30576.33847265099 }, { "content": " message.set_nc(result_shape[3]);\n\n message.set_client_id(\"data\");\n\n\n\n return message;\n\n}\n\n\n\nvoid ThreadProcess(std::unique_ptr<BatchingServer::Stub> &stub,\n\n TensorMessage msg, TensorMessage &reply) {\n\n grpc::Status status;\n\n ConnectionReply rep;\n\n\n\n {\n\n grpc::ClientContext context;\n\n stub->Connect(&context, ConnectionRequest(), &rep);\n\n }\n\n\n\n msg.set_client_id(rep.client_id());\n\n\n\n {\n\n grpc::ClientContext context;\n\n stub->Process(&context, msg, &reply);\n\n }\n\n}\n\n\n", "file_path": "test/TestIntegrationMXNet.cpp", "rank": 98, "score": 30575.72102455934 }, { "content": " */\n\n\n\n#include \"MXNetServable.hpp\"\n\n#include \"Servable.hpp\"\n\n\n\n#include \"TBServer.hpp\"\n\n\n\n#include \"gtest/gtest.h\"\n\n\n\n#include \"BatchingRPC.grpc.pb.h\"\n\n#include \"BatchingRPC.pb.h\"\n\n\n\n#include <future>\n\n\n\nnamespace Serving {\n\nnamespace {\n\n\n\nnamespace mx = mxnet::cpp;\n\n\n\nmx::Symbol SimpleSymbolFactory(int n_hidden) {\n", "file_path": "test/TestIntegrationMXNet.cpp", "rank": 99, "score": 30575.543507383714 } ]
C++
src/plugins/algorithms/lda.cpp
kmoham6/phylanx
252fa5fbb84acaf6f999410e6823b9f8d6693213
#include <phylanx/config.hpp> #include <phylanx/plugins/algorithms/lda.hpp> #include <hpx/iostream.hpp> #include <hpx/include/lcos.hpp> #include <hpx/include/util.hpp> #include <hpx/errors/throw_exception.hpp> #include <cstddef> #include <cstdint> #include <iostream> #include <memory> #include <numeric> #include <string> #include <utility> #include <vector> #include <blaze/Math.h> namespace phylanx { namespace execution_tree { namespace primitives { match_pattern_type const lda_trainer::match_data = {hpx::make_tuple("lda_trainer", std::vector<std::string>{ "lda_trainer(_1, _2, _3, _4, _5)"}, &create_lda_trainer, &create_primitive<lda_trainer>, "n_topics, alpha, beta, iters, word_doc_matrix\n" "Args:\n" "\n" " n_topics (integer): number of topics to compute\n" " alpha (float): alpha parameter\n" " beta (float): beta parameter\n" " iters (integer): the number of iterations\n" " word_doc_matrix (2x2 matrix float): word-document histogram,\n" " words are columns, documents are rows\n" "\n" "Returns:\n" "\n" "The algorithm returns a list of two matrices:\n" " [word_topic, document_topic] :\n" "\n" "word_topic: document-topic assignment matrix\n" "document_topic: document-topic assignment matrix\n" "\n" )}; lda_trainer::lda_trainer(primitive_arguments_type && operands, std::string const& name, std::string const& codename) : primitive_component_base(std::move(operands), name, codename) { } primitive_argument_type lda_trainer::calculate_lda_trainer( primitive_arguments_type && args) const { auto arg1 = extract_numeric_value(args[0], name_, codename_); if (arg1.num_dimensions() != 2) { HPX_THROW_EXCEPTION(hpx::bad_parameter, "lda_trainer::eval", generate_error_message( "the lda_trainer algorithm primitive requires for the first " "argument ('n_topics') to represent a matrix")); } auto topics = arg1.scalar(); auto arg2 = extract_numeric_value(args[1], name_, codename_); if (arg2.num_dimensions() != 0) { HPX_THROW_EXCEPTION(hpx::bad_parameter, "lda_trainer::eval", generate_error_message( "the lda_trainer algorithm primitive requires for the second " "argument ('alpha') to represent a scalar")); } auto alpha = arg2.scalar(); auto arg3 = extract_numeric_value(args[2], name_, codename_); if (arg3.num_dimensions() != 0) { HPX_THROW_EXCEPTION(hpx::bad_parameter, "lda_trainer::eval", generate_error_message( "the lda_trainer algorithm primitive requires for the second " "argument ('beta') to represent a scalar")); } auto beta = arg3.scalar(); auto iterations = extract_scalar_integer_value(args[3], name_, codename_); using namespace execution_tree; auto arg5 = extract_numeric_value(args[4], name_, codename_); if (arg5.num_dimensions() > 0) { HPX_THROW_EXCEPTION(hpx::bad_parameter, "lda_trainer::eval", generate_error_message( "the lda_trainer algorithm primitive requires for the second " "argument ('word_doc_mat') to represent a matrix")); } auto word_doc_mat = arg5.matrix(); using lda_trainer_t = phylanx::execution_tree::primitives::lda_trainer_impl; lda_trainer_t trainer(alpha, beta); auto result = trainer(word_doc_mat, topics, iterations); return primitive_argument_type { primitive_arguments_type{ ir::node_data<double>{std::move(std::get<0>(result))}, ir::node_data<double>{std::move(std::get<1>(result))} } }; } hpx::future<primitive_argument_type> lda_trainer::eval( primitive_arguments_type const& operands, primitive_arguments_type const& args) const { if (operands.size() != 5) { HPX_THROW_EXCEPTION(hpx::bad_parameter, "lda_trainer::eval", generate_error_message("the lda_trainer algorithm primitive " "requires exactly " "five operands")); } bool arguments_valid = true; for (std::size_t i = 0; i != operands.size(); ++i) { if (!valid(operands[i])) { arguments_valid = false; } } if (!arguments_valid) { HPX_THROW_EXCEPTION(hpx::bad_parameter, "lda_trainer::eval", generate_error_message( "the lda_trainer algorithm primitive requires that the " "arguments given by the operands array are valid")); } auto this_ = this->shared_from_this(); return hpx::dataflow(hpx::launch::sync, hpx::util::unwrapping( [this_ = std::move(this_)](primitive_arguments_type&& args) -> primitive_argument_type { return this_->calculate_lda_trainer(std::move(args)); }), detail::map_operands( operands, functional::value_operand{}, args, name_, codename_)); } }}}
#include <phylanx/config.hpp> #include <phylanx/plugins/algorithms/lda.hpp> #include <hpx/iostream.hpp> #include <hpx/include/lcos.hpp> #include <hpx/include/util.hpp> #include <hpx/errors/throw_exception.hpp> #include <cstddef> #include <cstdint> #include <iostream> #include <memory> #include <numeric> #include <string> #include <utility> #include <vector> #include <blaze/Math.h> namespace phylanx { namespace execution_tree { namespace primitives { match_pattern_type const lda_trainer::match_data = {hpx::make_tuple("lda_trainer", std::vector<std::string>{ "lda_trainer(_1, _2, _3, _4, _5)"}, &create_lda_trainer, &create_primitive<lda_trainer>, "n_topics, alpha, beta, iters, word_doc_matrix\n" "Args:\n" "\n" " n_topics (integer): number of topics to compute\n" " alpha (float): alpha parameter\n" " beta (float): beta parameter\n" " iters (integer): the number of iterations\n" " word_doc_matrix (2x2 matrix float): word-document histogram,\n" " words are columns, documents are rows\n" "\n" "Returns:\n" "\n" "The algorithm returns a li
d_doc_mat') to represent a matrix")); } auto word_doc_mat = arg5.matrix(); using lda_trainer_t = phylanx::execution_tree::primitives::lda_trainer_impl; lda_trainer_t trainer(alpha, beta); auto result = trainer(word_doc_mat, topics, iterations); return primitive_argument_type { primitive_arguments_type{ ir::node_data<double>{std::move(std::get<0>(result))}, ir::node_data<double>{std::move(std::get<1>(result))} } }; } hpx::future<primitive_argument_type> lda_trainer::eval( primitive_arguments_type const& operands, primitive_arguments_type const& args) const { if (operands.size() != 5) { HPX_THROW_EXCEPTION(hpx::bad_parameter, "lda_trainer::eval", generate_error_message("the lda_trainer algorithm primitive " "requires exactly " "five operands")); } bool arguments_valid = true; for (std::size_t i = 0; i != operands.size(); ++i) { if (!valid(operands[i])) { arguments_valid = false; } } if (!arguments_valid) { HPX_THROW_EXCEPTION(hpx::bad_parameter, "lda_trainer::eval", generate_error_message( "the lda_trainer algorithm primitive requires that the " "arguments given by the operands array are valid")); } auto this_ = this->shared_from_this(); return hpx::dataflow(hpx::launch::sync, hpx::util::unwrapping( [this_ = std::move(this_)](primitive_arguments_type&& args) -> primitive_argument_type { return this_->calculate_lda_trainer(std::move(args)); }), detail::map_operands( operands, functional::value_operand{}, args, name_, codename_)); } }}}
st of two matrices:\n" " [word_topic, document_topic] :\n" "\n" "word_topic: document-topic assignment matrix\n" "document_topic: document-topic assignment matrix\n" "\n" )}; lda_trainer::lda_trainer(primitive_arguments_type && operands, std::string const& name, std::string const& codename) : primitive_component_base(std::move(operands), name, codename) { } primitive_argument_type lda_trainer::calculate_lda_trainer( primitive_arguments_type && args) const { auto arg1 = extract_numeric_value(args[0], name_, codename_); if (arg1.num_dimensions() != 2) { HPX_THROW_EXCEPTION(hpx::bad_parameter, "lda_trainer::eval", generate_error_message( "the lda_trainer algorithm primitive requires for the first " "argument ('n_topics') to represent a matrix")); } auto topics = arg1.scalar(); auto arg2 = extract_numeric_value(args[1], name_, codename_); if (arg2.num_dimensions() != 0) { HPX_THROW_EXCEPTION(hpx::bad_parameter, "lda_trainer::eval", generate_error_message( "the lda_trainer algorithm primitive requires for the second " "argument ('alpha') to represent a scalar")); } auto alpha = arg2.scalar(); auto arg3 = extract_numeric_value(args[2], name_, codename_); if (arg3.num_dimensions() != 0) { HPX_THROW_EXCEPTION(hpx::bad_parameter, "lda_trainer::eval", generate_error_message( "the lda_trainer algorithm primitive requires for the second " "argument ('beta') to represent a scalar")); } auto beta = arg3.scalar(); auto iterations = extract_scalar_integer_value(args[3], name_, codename_); using namespace execution_tree; auto arg5 = extract_numeric_value(args[4], name_, codename_); if (arg5.num_dimensions() > 0) { HPX_THROW_EXCEPTION(hpx::bad_parameter, "lda_trainer::eval", generate_error_message( "the lda_trainer algorithm primitive requires for the second " "argument ('wor
random
[ { "content": " class matrix_column_iterator\n\n : public hpx::util::iterator_facade<matrix_column_iterator<T>,\n\n blaze::Column<T>, std::random_access_iterator_tag, blaze::Column<T>>\n\n {\n\n public:\n\n explicit matrix_column_iterator(T& t, const std::size_t index = 0)\n\n : data_(&t)\n\n , index_(index)\n\n {\n\n }\n\n\n\n private:\n\n friend class hpx::util::iterator_core_access;\n\n\n\n void increment()\n\n {\n\n ++index_;\n\n }\n\n\n\n void decrement()\n", "file_path": "phylanx/util/matrix_iterators.hpp", "rank": 0, "score": 302246.34747905284 }, { "content": " class matrix_iterator\n\n : public hpx::util::iterator_facade<matrix_iterator<Matrix>,\n\n typename Matrix::ElementType, std::bidirectional_iterator_tag>\n\n {\n\n using base_type = hpx::util::iterator_facade<matrix_iterator<Matrix>,\n\n typename Matrix::ElementType, std::bidirectional_iterator_tag>;\n\n\n\n using base_iterator = typename Matrix::Iterator;\n\n\n\n public:\n\n explicit matrix_iterator(Matrix& m, std::size_t row = 0)\n\n : matrix_(&m)\n\n , row_(row)\n\n , pos_()\n\n {\n\n if (row_ != m.rows())\n\n pos_ = m.begin(row_);\n\n }\n\n\n\n private:\n", "file_path": "phylanx/util/matrix_iterators.hpp", "rank": 1, "score": 251996.90023268003 }, { "content": " class matrix_row_iterator\n\n : public hpx::util::iterator_facade<matrix_row_iterator<T>, blaze::Row<T>,\n\n std::random_access_iterator_tag, blaze::Row<T>>\n\n {\n\n public:\n\n explicit matrix_row_iterator(T& t, const std::size_t index = 0)\n\n : data_(&t)\n\n , index_(index)\n\n {\n\n }\n\n\n\n private:\n\n friend class hpx::util::iterator_core_access;\n\n\n\n void increment()\n\n {\n\n ++index_;\n\n }\n\n\n\n void decrement()\n", "file_path": "phylanx/util/matrix_iterators.hpp", "rank": 2, "score": 246935.46288869556 }, { "content": "// Copyright (c) 2018 Parsa Amini\n\n// Copyright (c) 2018 Hartmut Kaiser\n\n//\n\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n\n// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\n\n\n#if !defined(PHYLANX_MATRIX_ITERATORS)\n\n#define PHYLANX_MATRIX_ITERATORS\n\n\n\n#include <cstddef>\n\n#include <utility>\n\n\n\n#include <hpx/iterator_support/iterator_facade.hpp>\n\n\n\n#include <blaze/Math.h>\n\n\n\nnamespace phylanx { namespace util\n\n{\n\n ///////////////////////////////////////////////////////////////////////////\n\n // Iterate over the rows (as a whole) of a matrix\n\n template <typename T>\n", "file_path": "phylanx/util/matrix_iterators.hpp", "rank": 3, "score": 236798.98799328864 }, { "content": " {\n\n --index_;\n\n }\n\n\n\n void advance(std::size_t n)\n\n {\n\n index_ += n;\n\n }\n\n\n\n bool equal(matrix_column_iterator const& other) const\n\n {\n\n return index_ == other.index_;\n\n }\n\n\n\n blaze::Column<T> dereference() const\n\n {\n\n return blaze::column(*data_, index_);\n\n }\n\n\n\n std::ptrdiff_t distance_to(matrix_column_iterator const& other) const\n", "file_path": "phylanx/util/matrix_iterators.hpp", "rank": 4, "score": 236774.3700049418 }, { "content": "\n\n typename base_type::reference dereference() const\n\n {\n\n return *pos_;\n\n }\n\n\n\n std::ptrdiff_t distance_to(matrix_iterator const& other) const\n\n {\n\n return ((other.row_ - row_) * matrix_->columns()) +\n\n (other.pos_ - other->matrix_->begin(other->row_)) -\n\n (pos_ - matrix_->begin(row_));\n\n }\n\n\n\n private:\n\n Matrix* matrix_;\n\n std::size_t row_;\n\n typename Matrix::Iterator pos_;\n\n };\n\n\n\n}}\n\n\n\n#endif\n", "file_path": "phylanx/util/matrix_iterators.hpp", "rank": 5, "score": 236773.17798201146 }, { "content": " friend class hpx::util::iterator_core_access;\n\n\n\n void increment()\n\n {\n\n if (++pos_ == matrix_->end(row_))\n\n {\n\n if (++row_ == matrix_->rows())\n\n {\n\n pos_ = base_iterator();\n\n }\n\n else\n\n {\n\n pos_ = matrix_->begin(row_);\n\n }\n\n }\n\n }\n\n\n\n void decrement()\n\n {\n\n if (pos_ == matrix_->begin(row_))\n", "file_path": "phylanx/util/matrix_iterators.hpp", "rank": 6, "score": 236773.0246598265 }, { "content": " {\n\n return other.index_ - index_;\n\n }\n\n\n\n private:\n\n T* data_;\n\n std::size_t index_;\n\n };\n\n\n\n ///////////////////////////////////////////////////////////////////////////\n\n // Iterate over the columns (as a whole) of a matrix\n\n template <typename T>\n", "file_path": "phylanx/util/matrix_iterators.hpp", "rank": 7, "score": 236771.20667178198 }, { "content": " {\n\n if (row_ == 0)\n\n {\n\n pos_ = base_iterator();\n\n }\n\n else\n\n {\n\n pos_ = matrix_->end(--row_) - 1;\n\n }\n\n }\n\n else\n\n {\n\n --pos_;\n\n }\n\n }\n\n\n\n bool equal(matrix_iterator const& other) const\n\n {\n\n return pos_ == other.pos_;\n\n }\n", "file_path": "phylanx/util/matrix_iterators.hpp", "rank": 8, "score": 236767.186923799 }, { "content": " {\n\n --index_;\n\n }\n\n\n\n void advance(std::size_t n)\n\n {\n\n index_ += n;\n\n }\n\n\n\n bool equal(matrix_row_iterator const& other) const\n\n {\n\n return index_ == other.index_;\n\n }\n\n\n\n blaze::Row<T> dereference() const\n\n {\n\n return blaze::row(*data_, index_);\n\n }\n\n\n\n std::ptrdiff_t distance_to(matrix_row_iterator const& other) const\n", "file_path": "phylanx/util/matrix_iterators.hpp", "rank": 9, "score": 236766.44474322765 }, { "content": " {\n\n return other.index_ - index_;\n\n }\n\n\n\n private:\n\n T* data_;\n\n std::size_t index_;\n\n };\n\n\n\n ///////////////////////////////////////////////////////////////////////////\n\n // Iterate over the elements of the whole matrix row-wise.\n\n template <typename Matrix>\n", "file_path": "phylanx/util/matrix_iterators.hpp", "rank": 10, "score": 236765.89771485055 }, { "content": "# Copyright (c) 2020 Steven R. Brandt\n\n#\n\n# Distributed under the Boost Software License, Version 1.0. (See accompanying\n\n# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\n\n\n# 1312: Iteration on arrays doesn't work\n\n\n\nfrom phylanx import Phylanx\n\nimport numpy as np\n\n\n\n\n\n# silence flake\n\ndef append(lst, x):\n\n return lst\n\n\n\n\n\ndef constant(val, sh, dtype):\n\n return val\n\n\n\n\n\n@Phylanx\n\ndef foo():\n\n sh = [2, 2]\n\n z = constant(0, sh, dtype=\"float\")\n\n result = []\n\n for a in z:\n\n result = append(result, a)\n\n return result\n\n\n\n\n\nresult = foo()\n\nassert (result == np.array([[0, 0], [0, 0]])).all(), result\n", "file_path": "tests/regressions/python/1312_matrix_iteration.py", "rank": 11, "score": 184190.5619990644 }, { "content": "# Copyright (c) 2018 Christopher Taylor\n\n#\n\n# Distributed under the Boost Software License, Version 1.0. (See accompanying\n\n# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\n'''\n\nprange primitive taken from numba and reflected into hpat\n\nallows users to explicitly define a parallel range to process\n\nover - might be a nice place to add in hpx-smart-executor logic\n\n\n\nhttps://github.com/numba/numba/blob/master/numba/special.py\n\n'''\n\n\n\n\n\nclass prange(object):\n\n def __init__(self, *args):\n\n # remember range(0, n) iteration space\n\n # remember range(0, n, k) iteration broken into chunks\n\n #\n\n self.iterspace = range(*args)\n\n\n\n def __iter__(self):\n\n for i in self.iterspace:\n\n yield i\n\n\n\n def __next__(self):\n\n for i in self.iterspace:\n\n yield i\n", "file_path": "python/phylanx/util/prange.py", "rank": 12, "score": 183130.90133076505 }, { "content": "// Copyright (c) 2017-2019 Hartmut Kaiser\n\n//\n\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n\n// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\n\n\n#if !defined(PHYLANX_UTIL_HPP)\n\n#define PHYLANX_UTIL_HPP\n\n\n\n#include <phylanx/config.hpp>\n\n#include <phylanx/util/distributed_object.hpp>\n\n#include <phylanx/util/hashed_string.hpp>\n\n#include <phylanx/util/none_manip.hpp>\n\n#include <phylanx/util/performance_data.hpp>\n\n#include <phylanx/util/random.hpp>\n\n#include <phylanx/util/repr_manip.hpp>\n\n#include <phylanx/util/serialization/ast.hpp>\n\n#include <phylanx/util/serialization/blaze.hpp>\n\n#include <phylanx/util/serialization/variant.hpp>\n\n#include <phylanx/util/truncated_normal_distribution.hpp>\n\n#include <phylanx/util/variant.hpp>\n\n\n\n#endif\n", "file_path": "phylanx/include/util.hpp", "rank": 13, "score": 181931.93269371486 }, { "content": " class distributed_vector\n\n {\n\n private:\n\n using data_type =\n\n typename server::distributed_vector_part<T>::data_type;\n\n using reference_type =\n\n typename server::distributed_vector_part<T>::reference_type;\n\n\n\n public:\n\n /// Creates a distributed_vector in every locality\n\n ///\n\n /// A distributed_vector \\a base_name is created through default\n\n /// constructor.\n\n distributed_vector() = default;\n\n\n\n /// Creates a distributed_vector in every locality with a given\n\n /// base_name string, data, and a type and construction_type in the\n\n /// template parameters.\n\n ///\n\n /// \\param construction_type The construction_type in the template\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 14, "score": 181486.7264890411 }, { "content": " class distributed_matrix\n\n {\n\n private:\n\n using data_type =\n\n typename server::distributed_matrix_part<T>::data_type;\n\n using reference_type =\n\n typename server::distributed_matrix_part<T>::reference_type;\n\n\n\n public:\n\n /// Creates a distributed_matrix in every locality\n\n ///\n\n /// A distributed_matrix \\a base_name is created through default\n\n /// constructor.\n\n distributed_matrix() = default;\n\n\n\n /// Creates a distributed_matrix in every locality with a given\n\n /// base_name string, data, and a type and construction_type in the\n\n /// template parameters.\n\n ///\n\n /// \\param construction_type The construction_type in the template\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 15, "score": 181479.23704629956 }, { "content": " class tensor_iterator\n\n : public hpx::util::iterator_facade<tensor_iterator<Tensor>,\n\n typename Tensor::ElementType, std::bidirectional_iterator_tag>\n\n {\n\n using base_type = hpx::util::iterator_facade<tensor_iterator<Tensor>,\n\n typename Tensor::ElementType, std::bidirectional_iterator_tag>;\n\n\n\n using base_iterator = typename Tensor::Iterator;\n\n\n\n public:\n\n explicit tensor_iterator(\n\n Tensor& t, std::size_t row = 0, std::size_t page = 0)\n\n : tensor_(&t)\n\n , page_(page)\n\n , row_(row)\n\n , pos_()\n\n {\n\n if (page_ != t.pages() && row_ != t.rows())\n\n pos_ = t.begin(row_, page_);\n\n }\n", "file_path": "phylanx/util/tensor_iterators.hpp", "rank": 16, "score": 181473.7860592836 }, { "content": "// Copyright (c) 2017 Hartmut Kaiser\n\n//\n\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n\n// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\n\n\n#if !defined(PHYLANX_PRIMITIVES_HPP)\n\n#define PHYLANX_PRIMITIVES_HPP\n\n\n\n#include <phylanx/config.hpp>\n\n#include <phylanx/execution_tree/primitives.hpp>\n\n\n\n#endif\n", "file_path": "phylanx/include/primitives.hpp", "rank": 17, "score": 181402.05053687358 }, { "content": "# Copyright (c) 2017 Hartmut Kaiser\n\n# Copyright (c) 2018 Steven R. Brandt\n\n#\n\n# Distributed under the Boost Software License, Version 1.0. (See accompanying\n\n# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\n\n\ntry:\n\n from phylanx._phylanx.util import *\n\n\n\nexcept Exception:\n\n from phylanx._phylanxd.util import *\n\n\n\n\n\ndef phyhelp(fname):\n\n \"\"\"Python help function. When called it with the name of\n\na Phylanx primitive or plugin it prints the associated\n\nhelp message.\n\n\n\nArgs:\n\n fname (string) : the name of the Phylanx primitive or plugin\n\n \"\"\"\n\n # Retrieve the docstring from the Phylanx API\n\n ds = phyhelpex(fname)\n\n n = ds.find('\\n')\n\n # The first line of the Phylanx doc string is the arglist\n\n args = ds[0:n]\n\n # We're going to use the builtin help function to display\n\n # the message. To make that work, however, we're going to\n\n # create a dummy function with a matching arg list and\n\n # assign the docstring and function name.\n\n dummy = eval(\"lambda %s : 1\" % args)\n\n dummy.__doc__ = ds[n:]\n\n dummy.__name__ = fname\n\n help(dummy)\n", "file_path": "python/phylanx/util/__init__.py", "rank": 18, "score": 179306.63016982493 }, { "content": " class distributed_vector_part\n\n : public hpx::components::component_base<distributed_vector_part<T>>\n\n {\n\n public:\n\n using data_type = blaze::DynamicVector<T>;\n\n using reference_type =\n\n blaze::CustomVector<T, blaze::aligned, blaze::padded>;\n\n\n\n distributed_vector_part() = default;\n\n\n\n explicit distributed_vector_part(reference_type const& data)\n\n : data_(data)\n\n {\n\n }\n\n\n\n explicit distributed_vector_part(reference_type&& data)\n\n : data_(std::move(data))\n\n {\n\n }\n\n\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 19, "score": 177548.07229398953 }, { "content": " class distributed_matrix_part\n\n : public hpx::components::component_base<distributed_matrix_part<T>>\n\n {\n\n public:\n\n using data_type = blaze::DynamicMatrix<T>;\n\n using reference_type =\n\n blaze::CustomMatrix<T, blaze::aligned, blaze::padded>;\n\n\n\n distributed_matrix_part() = default;\n\n\n\n explicit distributed_matrix_part(reference_type const& data)\n\n : data_(data)\n\n {\n\n }\n\n\n\n explicit distributed_matrix_part(reference_type&& data)\n\n : data_(std::move(data))\n\n {\n\n }\n\n\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 20, "score": 177540.7021109188 }, { "content": " class tensor_pageslice_iterator\n\n : public hpx::util::iterator_facade<tensor_pageslice_iterator<T>,\n\n blaze::PageSlice<T>, std::random_access_iterator_tag,\n\n blaze::PageSlice<T>>\n\n {\n\n public:\n\n explicit tensor_pageslice_iterator(T& t, const std::size_t index = 0)\n\n : data_(&t)\n\n , index_(index)\n\n {\n\n }\n\n\n\n private:\n\n friend class hpx::util::iterator_core_access;\n\n\n\n void increment()\n\n {\n\n ++index_;\n\n }\n\n\n", "file_path": "phylanx/util/tensor_iterators.hpp", "rank": 21, "score": 177535.3379238076 }, { "content": " class tensor_columnslice_iterator\n\n : public hpx::util::iterator_facade<tensor_columnslice_iterator<T>,\n\n blaze::ColumnSlice<T>, std::random_access_iterator_tag,\n\n blaze::ColumnSlice<T>>\n\n {\n\n public:\n\n explicit tensor_columnslice_iterator(T& t, const std::size_t index = 0)\n\n : data_(&t)\n\n , index_(index)\n\n {\n\n }\n\n\n\n private:\n\n friend class hpx::util::iterator_core_access;\n\n\n\n void increment()\n\n {\n\n ++index_;\n\n }\n\n\n", "file_path": "phylanx/util/tensor_iterators.hpp", "rank": 22, "score": 177535.33792380762 }, { "content": " class tensor_rowslice_iterator\n\n : public hpx::util::iterator_facade<tensor_rowslice_iterator<T>,\n\n blaze::RowSlice<T>, std::random_access_iterator_tag,\n\n blaze::RowSlice<T>>\n\n {\n\n public:\n\n explicit tensor_rowslice_iterator(T& t, const std::size_t index = 0)\n\n : data_(&t)\n\n , index_(index)\n\n {\n\n }\n\n\n\n private:\n\n friend class hpx::util::iterator_core_access;\n\n\n\n void increment()\n\n {\n\n ++index_;\n\n }\n\n\n", "file_path": "phylanx/util/tensor_iterators.hpp", "rank": 23, "score": 177535.3379238076 }, { "content": "#include <hpx/runtime.hpp>\n\n#include <hpx/runtime_local/get_locality_id.hpp>\n\n#include <hpx/synchronization/spinlock.hpp>\n\n#include <hpx/thread_support/unlock_guard.hpp>\n\n\n\n#include <cstddef>\n\n#include <cstdint>\n\n#include <map>\n\n#include <memory>\n\n#include <mutex>\n\n#include <string>\n\n#include <utility>\n\n\n\n#include <blaze/Math.h>\n\n\n\n/// \\cond NOINTERNAL\n\nnamespace phylanx { namespace util { namespace server {\n\n ////////////////////////////////////////////////////////////////////////////\n\n template <typename T>\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 24, "score": 176957.30886230056 }, { "content": "#include <hpx/runtime.hpp>\n\n#include <hpx/runtime_local/get_locality_id.hpp>\n\n#include <hpx/synchronization/spinlock.hpp>\n\n#include <hpx/thread_support/unlock_guard.hpp>\n\n\n\n#include <cstddef>\n\n#include <cstdint>\n\n#include <map>\n\n#include <memory>\n\n#include <mutex>\n\n#include <string>\n\n#include <utility>\n\n\n\n#include <blaze/Math.h>\n\n\n\n/// \\cond NOINTERNAL\n\nnamespace phylanx { namespace util { namespace server {\n\n\n\n ////////////////////////////////////////////////////////////////////////////\n\n template <typename T>\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 25, "score": 176950.9525868495 }, { "content": "// Copyright (c) 2018 Hartmut Kaiser\n\n//\n\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n\n// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\n\n\n#if !defined(PHYLANX_UTIL_SMALL_VECTOR_JUL_18_2018_0744PM)\n\n#define PHYLANX_UTIL_SMALL_VECTOR_JUL_18_2018_0744PM\n\n\n\n#include <phylanx/config.hpp>\n\n\n\n#include <vector>\n\n\n\n// before Boost V1.59 small_vector appears to be broken\n\n#if BOOST_VERSION >= 105900\n\n#include <boost/container/small_vector.hpp>\n\n#endif\n\n\n\nnamespace phylanx { namespace util\n\n{\n\n#if BOOST_VERSION < 105900\n", "file_path": "phylanx/util/small_vector.hpp", "rank": 26, "score": 176945.2663350325 }, { "content": "// Copyright (c) 2018 Parsa Amini\n\n// Copyright (c) 2018-2019 Hartmut Kaiser\n\n//\n\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n\n// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\n\n\n#if !defined(PHYLANX_TENSOR_ITERATORS)\n\n#define PHYLANX_TENSOR_ITERATORS\n\n\n\n#include <phylanx/config.hpp>\n\n\n\n#include <cstddef>\n\n#include <utility>\n\n\n\n#include <hpx/iterator_support/iterator_facade.hpp>\n\n\n\n#include <blaze/Math.h>\n\n#include <blaze_tensor/Math.h>\n\n\n\nnamespace phylanx { namespace util\n\n{\n\n ///////////////////////////////////////////////////////////////////////////\n\n // Iterate over the rowslices (as a whole) of a tensor\n\n template <typename T>\n", "file_path": "phylanx/util/tensor_iterators.hpp", "rank": 27, "score": 176939.11686103253 }, { "content": "#define REGISTER_DISTRIBUTED_VECTOR_DECLARATION(type) \\\n\n HPX_REGISTER_ACTION_DECLARATION( \\\n\n phylanx::util::server::distributed_vector_part<type>::fetch_action, \\\n\n HPX_PP_CAT(__distributed_vector_part_fetch_action_, type)); \\\n\n HPX_REGISTER_ACTION_DECLARATION( \\\n\n phylanx::util::server::distributed_vector_part< \\\n\n type>::fetch_part_action, \\\n\n HPX_PP_CAT(__distributed_vector_part_fetch_part_action_, type)) \\\n\n /**/\n\n\n\n#define REGISTER_DISTRIBUTED_VECTOR(type) \\\n\n HPX_REGISTER_ACTION( \\\n\n phylanx::util::server::distributed_vector_part<type>::fetch_action, \\\n\n HPX_PP_CAT(__distributed_vector_part_fetch_action_, type)); \\\n\n HPX_REGISTER_ACTION(phylanx::util::server::distributed_vector_part< \\\n\n type>::fetch_part_action, \\\n\n HPX_PP_CAT(__distributed_vector_part_fetch_part_action_, type)); \\\n\n typedef ::hpx::components::component< \\\n\n phylanx::util::server::distributed_vector_part<type>> \\\n\n HPX_PP_CAT(__distributed_vector_part_, type); \\\n\n HPX_REGISTER_COMPONENT(HPX_PP_CAT(__distributed_vector_part_, type)) \\\n\n /**/\n\n\n\nnamespace phylanx { namespace util {\n\n\n\n template <typename T>\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 28, "score": 176937.6496289635 }, { "content": "// Copyright (c) 2019 Hartmut Kaiser\n\n//\n\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n\n// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\n\n\n#if !defined(PHYLANX_UTIL_HASHED_STRING_JAN_05_2019_0555PM)\n\n#define PHYLANX_UTIL_HASHED_STRING_JAN_05_2019_0555PM\n\n\n\n#include <phylanx/config.hpp>\n\n\n\n#include <hpx/hashing/jenkins_hash.hpp>\n\n#include <hpx/serialization/serialization_fwd.hpp>\n\n\n\n#include <iosfwd>\n\n#include <string>\n\n#include <utility>\n\n\n\nnamespace phylanx { namespace util\n\n{\n\n struct hashed_string\n", "file_path": "phylanx/util/hashed_string.hpp", "rank": 29, "score": 176937.39737072962 }, { "content": "// Copyright (c) 2019-2021 Hartmut Kaiser\n\n// Copyright (c) 2019 Maxwell Reeser\n\n//\n\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n\n// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\n\n\n#if !defined(PHYLANX_UTIL_DISTRIBUTED_VECTOR_HPP)\n\n#define PHYLANX_UTIL_DISTRIBUTED_VECTOR_HPP\n\n\n\n#include <phylanx/config.hpp>\n\n#include <phylanx/util/serialization/blaze.hpp>\n\n\n\n#include <hpx/actions_base/component_action.hpp>\n\n#include <hpx/assert.hpp>\n\n#include <hpx/async_base/launch_policy.hpp>\n\n#include <hpx/errors/throw_exception.hpp>\n\n#include <hpx/modules/components.hpp>\n\n#include <hpx/modules/components_base.hpp>\n\n#include <hpx/modules/runtime_components.hpp>\n\n#include <hpx/preprocessor/cat.hpp>\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 30, "score": 176937.37042466362 }, { "content": " {\n\n it = part_ids_.emplace(idx, std::move(id)).first;\n\n }\n\n }\n\n return it->second;\n\n }\n\n\n\n private:\n\n std::size_t const num_sites_;\n\n std::size_t const this_site_;\n\n std::string const basename_;\n\n std::shared_ptr<server::distributed_vector_part<T>> ptr_;\n\n\n\n mutable hpx::lcos::local::spinlock part_ids_mtx_;\n\n mutable std::map<std::size_t, hpx::id_type> part_ids_;\n\n\n\n std::int64_t* transferred_bytes_;\n\n /// \\endcond\n\n };\n\n}} // namespace phylanx::util\n\n\n\n#endif\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 31, "score": 176934.69579438202 }, { "content": " data_type fetch() const\n\n {\n\n return data_;\n\n }\n\n\n\n HPX_DEFINE_COMPONENT_ACTION(distributed_vector_part, fetch);\n\n\n\n data_type fetch_part(std::size_t start, std::size_t stop) const\n\n {\n\n return data_type{blaze::subvector(data_, start, stop - start)};\n\n }\n\n\n\n HPX_DEFINE_COMPONENT_ACTION(distributed_vector_part, fetch_part);\n\n\n\n private:\n\n reference_type data_;\n\n };\n\n}}} // namespace phylanx::util::server\n\n/// \\endcond\n\n\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 32, "score": 176932.02587561356 }, { "content": " data_type fetch() const\n\n {\n\n return data_;\n\n }\n\n\n\n HPX_DEFINE_COMPONENT_ACTION(distributed_matrix_part, fetch);\n\n\n\n data_type fetch_part(std::size_t start_row, std::size_t start_column,\n\n std::size_t stop_row, std::size_t stop_column) const\n\n {\n\n return data_type{blaze::submatrix(data_, start_row, start_column,\n\n stop_row - start_row, stop_column - start_column)};\n\n }\n\n\n\n HPX_DEFINE_COMPONENT_ACTION(distributed_matrix_part, fetch_part);\n\n\n\n private:\n\n reference_type data_;\n\n };\n\n}}} // namespace phylanx::util::server\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 33, "score": 176931.5856163708 }, { "content": "/// \\endcond\n\n\n\n#define REGISTER_DISTRIBUTED_MATRIX_DECLARATION(type) \\\n\n HPX_REGISTER_ACTION_DECLARATION( \\\n\n phylanx::util::server::distributed_matrix_part<type>::fetch_action, \\\n\n HPX_PP_CAT(__distributed_matrix_part_fetch_action_, type)); \\\n\n HPX_REGISTER_ACTION_DECLARATION( \\\n\n phylanx::util::server::distributed_matrix_part< \\\n\n type>::fetch_part_action, \\\n\n HPX_PP_CAT(__distributed_matrix_part_fetch_part_action_, type)) \\\n\n /**/\n\n\n\n#define REGISTER_DISTRIBUTED_MATRIX(type) \\\n\n HPX_REGISTER_ACTION( \\\n\n phylanx::util::server::distributed_matrix_part<type>::fetch_action, \\\n\n HPX_PP_CAT(__distributed_matrix_part_fetch_action_, type)); \\\n\n HPX_REGISTER_ACTION(phylanx::util::server::distributed_matrix_part< \\\n\n type>::fetch_part_action, \\\n\n HPX_PP_CAT(__distributed_matrix_part_fetch_part_action_, type)); \\\n\n typedef ::hpx::components::component< \\\n\n phylanx::util::server::distributed_matrix_part<type>> \\\n\n HPX_PP_CAT(__distributed_matrix_part_, type); \\\n\n HPX_REGISTER_COMPONENT(HPX_PP_CAT(__distributed_matrix_part_, type)) \\\n\n /**/\n\n\n\nnamespace phylanx { namespace util {\n\n\n\n template <typename T>\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 34, "score": 176931.34431827697 }, { "content": "// Copyright (c) 2019-2021 Hartmut Kaiser\n\n// Copyright (c) 2019 Maxwell Reeser\n\n//\n\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n\n// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\n\n\n#if !defined(PHYLANX_UTIL_DISTRIBUTED_MATRIX_HPP)\n\n#define PHYLANX_UTIL_DISTRIBUTED_MATRIX_HPP\n\n\n\n#include <phylanx/config.hpp>\n\n#include <phylanx/util/serialization/blaze.hpp>\n\n\n\n#include <hpx/actions_base/component_action.hpp>\n\n#include <hpx/assert.hpp>\n\n#include <hpx/async_base/launch_policy.hpp>\n\n#include <hpx/errors/throw_exception.hpp>\n\n#include <hpx/modules/components.hpp>\n\n#include <hpx/modules/components_base.hpp>\n\n#include <hpx/modules/runtime_components.hpp>\n\n#include <hpx/preprocessor/cat.hpp>\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 35, "score": 176931.07731410922 }, { "content": " it = part_ids_.find(idx);\n\n if (it == part_ids_.end())\n\n {\n\n it = part_ids_.emplace(idx, std::move(id)).first;\n\n }\n\n }\n\n return it->second;\n\n }\n\n\n\n private:\n\n std::size_t const num_sites_;\n\n std::size_t const this_site_;\n\n std::string const basename_;\n\n std::shared_ptr<server::distributed_matrix_part<T>> ptr_;\n\n\n\n mutable hpx::lcos::local::spinlock part_ids_mtx_;\n\n mutable std::map<std::size_t, hpx::id_type> part_ids_;\n\n\n\n std::int64_t* transferred_bytes_;\n\n /// \\endcond\n\n };\n\n}} // namespace phylanx::util\n\n\n\n#endif\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 36, "score": 176927.6356183471 }, { "content": " {\n\n /// \\cond NOINTERNAL\n\n using action_type =\n\n typename server::distributed_vector_part<T>::fetch_action;\n\n\n\n auto f = hpx::async<action_type>(get_part_id(idx));\n\n\n\n // keep track of number of transferred bytes, if needed\n\n if (transferred_bytes_ != nullptr)\n\n {\n\n auto shared_state = hpx::traits::detail::get_shared_state(f);\n\n shared_state->set_on_completed([this, shared_state]() -> void {\n\n data_type* r = shared_state->get_result();\n\n if (r != nullptr)\n\n {\n\n using spinlock_pool =\n\n hpx::util::spinlock_pool<std::uint64_t>;\n\n\n\n std::lock_guard<hpx::util::detail::spinlock> l(\n\n spinlock_pool::spinlock_for(transferred_bytes_));\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 37, "score": 176925.18056708793 }, { "content": " \"vector\");\n\n }\n\n\n\n std::lock_guard<hpx::lcos::local::spinlock> l(part_ids_mtx_);\n\n auto it = part_ids_.find(idx);\n\n if (it == part_ids_.end())\n\n {\n\n hpx::id_type id;\n\n\n\n {\n\n hpx::util::unlock_guard<hpx::lcos::local::spinlock> ul(\n\n part_ids_mtx_);\n\n\n\n id = hpx::agas::on_symbol_namespace_event(\n\n hpx::detail::name_from_basename(basename_, idx), true)\n\n .get();\n\n }\n\n\n\n it = part_ids_.find(idx);\n\n if (it == part_ids_.end())\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 38, "score": 176925.14805177427 }, { "content": " /// \\cond NOINTERNAL\n\n using action_type =\n\n typename server::distributed_vector_part<T>::fetch_part_action;\n\n\n\n auto f = hpx::async<action_type>(get_part_id(idx), start, stop);\n\n\n\n // keep track of number of transferred bytes, if needed\n\n if (transferred_bytes_ != nullptr)\n\n {\n\n auto shared_state = hpx::traits::detail::get_shared_state(f);\n\n shared_state->set_on_completed([this, shared_state]() -> void {\n\n data_type* r = shared_state->get_result();\n\n if (r != nullptr)\n\n {\n\n using spinlock_pool =\n\n hpx::util::spinlock_pool<std::uint64_t>;\n\n\n\n std::lock_guard<hpx::util::detail::spinlock> l(\n\n spinlock_pool::spinlock_for(transferred_bytes_));\n\n\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 39, "score": 176924.99738650423 }, { "content": " {\n\n /// \\cond NOINTERNAL\n\n using action_type =\n\n typename server::distributed_matrix_part<T>::fetch_part_action;\n\n\n\n auto f = hpx::async<action_type>(get_part_id(idx), start_row,\n\n start_column, stop_row, stop_column);\n\n\n\n // keep track of number of transferred bytes, if needed\n\n if (transferred_bytes_ != nullptr)\n\n {\n\n auto shared_state = hpx::traits::detail::get_shared_state(f);\n\n shared_state->set_on_completed([this, shared_state]() -> void {\n\n data_type* r = shared_state->get_result();\n\n if (r != nullptr)\n\n {\n\n using spinlock_pool =\n\n hpx::util::spinlock_pool<std::uint64_t>;\n\n\n\n std::lock_guard<hpx::util::detail::spinlock> l(\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 40, "score": 176924.5133159899 }, { "content": " /// \\param construction_type The construction_type in the template\n\n /// parameters accepts either meta_object or all_to_all,\n\n /// and it is set to all_to_all by default. The meta_object\n\n /// option provides meta object registration in the root\n\n /// locality and meta object is essentially a table that\n\n /// can find the instances of distributed_vector in all\n\n /// localities. The all_to_all option only locally holds\n\n /// the client and server of the distributed_vector.\n\n /// \\param base_name The name of the distributed_vector, which should\n\n /// be a unique string across the localities\n\n /// \\param data The data of the type T of the distributed_vector\n\n /// \\param sub_localities The sub_localities accepts a list of locality\n\n /// index. By default, it is initialized to a list of all\n\n /// provided locality index.\n\n ///\n\n distributed_vector(std::string basename, reference_type&& data,\n\n std::size_t num_sites = std::size_t(-1),\n\n std::size_t this_site = std::size_t(-1),\n\n std::int64_t* transferred_bytes = nullptr)\n\n : num_sites_(num_sites == std::size_t(-1) ?\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 41, "score": 176922.95641357495 }, { "content": " /// parameters accepts either meta_object or all_to_all,\n\n /// and it is set to all_to_all by default. The meta_object\n\n /// option provides meta object registration in the root\n\n /// locality and meta object is essentially a table that\n\n /// can find the instances of distributed_vector in all\n\n /// localities. The all_to_all option only locally holds\n\n /// the client and server of the distributed_vector.\n\n /// \\param base_name The name of the distributed_vector, which should\n\n /// be a unique string across the localities\n\n /// \\param data The data of the type T of the distributed_vector\n\n /// \\param sub_localities The sub_localities accepts a list of locality\n\n /// index. By default, it is initialized to a list of all\n\n /// provided locality index.\n\n ///\n\n distributed_vector(std::string basename, reference_type const& data,\n\n std::size_t num_sites = std::size_t(-1),\n\n std::size_t this_site = std::size_t(-1),\n\n std::int64_t* transferred_bytes = nullptr)\n\n : num_sites_(num_sites == std::size_t(-1) ?\n\n hpx::get_num_localities(hpx::launch::sync) :\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 42, "score": 176922.92902014038 }, { "content": " num_sites)\n\n , this_site_(this_site == std::size_t(-1) ? hpx::get_locality_id() :\n\n this_site)\n\n , basename_(\"dist_vector_\" + std::move(basename))\n\n , transferred_bytes_(transferred_bytes)\n\n {\n\n if (this_site_ >= num_sites_)\n\n {\n\n HPX_THROW_EXCEPTION(hpx::no_success,\n\n \"distributed_vector::distributed_vector\",\n\n \"attempting to construct invalid part of the \"\n\n \"distributed object\");\n\n }\n\n create_and_register_server(data);\n\n }\n\n\n\n /// Creates a distributed_vector in every locality with a given\n\n /// base_name string, data, and a type and construction_type in the\n\n /// template parameters\n\n ///\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 43, "score": 176922.55077809363 }, { "content": " \"distributed_matrix::get_part_id\",\n\n \"attempting to access invalid part of the distributed \"\n\n \"matrix\");\n\n }\n\n\n\n std::lock_guard<hpx::lcos::local::spinlock> l(part_ids_mtx_);\n\n auto it = part_ids_.find(idx);\n\n if (it == part_ids_.end())\n\n {\n\n hpx::id_type id;\n\n\n\n {\n\n hpx::util::unlock_guard<hpx::lcos::local::spinlock> ul(\n\n part_ids_mtx_);\n\n\n\n id = hpx::agas::on_symbol_namespace_event(\n\n hpx::detail::name_from_basename(basename_, idx), true)\n\n .get();\n\n }\n\n\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 44, "score": 176920.0010901072 }, { "content": " {\n\n /// \\cond NOINTERNAL\n\n using action_type =\n\n typename server::distributed_matrix_part<T>::fetch_action;\n\n\n\n auto f = hpx::async<action_type>(get_part_id(idx));\n\n\n\n // keep track of number of transferred bytes, if needed\n\n if (transferred_bytes_ != nullptr)\n\n {\n\n auto shared_state = hpx::traits::detail::get_shared_state(f);\n\n shared_state->set_on_completed([this, shared_state]() -> void {\n\n data_type* r = shared_state->get_result();\n\n if (r != nullptr)\n\n {\n\n using spinlock_pool =\n\n hpx::util::spinlock_pool<std::uint64_t>;\n\n\n\n std::lock_guard<hpx::util::detail::spinlock> l(\n\n spinlock_pool::spinlock_for(transferred_bytes_));\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 45, "score": 176918.87322066288 }, { "content": " template <typename T>\n\n using small_vector = std::vector<T>;\n\n#else\n\n template <typename T>\n\n using small_vector = boost::container::small_vector<T, 3>;\n\n#endif\n\n}}\n\n\n\n#endif\n\n\n", "file_path": "phylanx/util/small_vector.hpp", "rank": 46, "score": 176918.35259779493 }, { "content": " hpx::get_num_localities(hpx::launch::sync) :\n\n num_sites)\n\n , this_site_(this_site == std::size_t(-1) ? hpx::get_locality_id() :\n\n this_site)\n\n , basename_(\"dist_vector_\" + std::move(basename))\n\n , transferred_bytes_(transferred_bytes)\n\n {\n\n if (this_site_ >= num_sites_)\n\n {\n\n HPX_THROW_EXCEPTION(hpx::no_success,\n\n \"distributed_vector::distributed_vector\",\n\n \"attempting to construct invalid part of the \"\n\n \"distributed object\");\n\n }\n\n create_and_register_server(std::move(data));\n\n }\n\n\n\n /// Destroy the local reference to the distributed object, unregister\n\n /// the symbolic name\n\n ~distributed_vector()\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 47, "score": 176917.71458654685 }, { "content": " {\n\n hpx::unregister_with_basename(basename_, this_site_).get();\n\n }\n\n\n\n /// Access the calling locality's value instance for this distributed_vector\n\n reference_type& operator*()\n\n {\n\n HPX_ASSERT(!!ptr_);\n\n return **ptr_;\n\n }\n\n\n\n /// Access the calling locality's value instance for this distributed_vector\n\n reference_type const& operator*() const\n\n {\n\n HPX_ASSERT(!!ptr_);\n\n return **ptr_;\n\n }\n\n\n\n /// Access the calling locality's value instance for this distributed_vector\n\n reference_type* operator->()\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 48, "score": 176917.58665210762 }, { "content": " *transferred_bytes_ += r->size() * sizeof(T);\n\n }\n\n });\n\n }\n\n return f;\n\n /// \\endcond\n\n }\n\n\n\n private:\n\n /// \\cond NOINTERNAL\n\n template <typename Arg>\n\n hpx::id_type create_and_register_server(Arg&& value)\n\n {\n\n // create new distributed_vector component and register it with AGAS\n\n hpx::id_type part_id =\n\n hpx::local_new<server::distributed_vector_part<T>>(\n\n hpx::launch::sync, std::forward<Arg>(value));\n\n\n\n hpx::register_with_basename(basename_, part_id, this_site_).get();\n\n\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 49, "score": 176916.7180641907 }, { "content": " /// \\param construction_type The construction_type in the template\n\n /// parameters accepts either meta_object or all_to_all,\n\n /// and it is set to all_to_all by default. The meta_object\n\n /// option provides meta object registration in the root\n\n /// locality and meta object is essentially a table that\n\n /// can find the instances of distributed_matrix in all\n\n /// localities. The all_to_all option only locally holds\n\n /// the client and server of the distributed_matrix.\n\n /// \\param base_name The name of the distributed_matrix, which should\n\n /// be a unique string across the localities\n\n /// \\param data The data of the type T of the distributed_matrix\n\n /// \\param sub_localities The sub_localities accepts a list of locality\n\n /// index. By default, it is initialized to a list of all\n\n /// provided locality index.\n\n ///\n\n distributed_matrix(std::string basename, reference_type&& data,\n\n std::size_t num_sites = std::size_t(-1),\n\n std::size_t this_site = std::size_t(-1),\n\n std::int64_t* transferred_bytes = nullptr)\n\n : num_sites_(num_sites == std::size_t(-1) ?\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 50, "score": 176916.6796554082 }, { "content": " /// parameters accepts either meta_object or all_to_all,\n\n /// and it is set to all_to_all by default. The meta_object\n\n /// option provides meta object registration in the root\n\n /// locality and meta object is essentially a table that\n\n /// can find the instances of distributed_matrix in all\n\n /// localities. The all_to_all option only locally holds\n\n /// the client and server of the distributed_matrix.\n\n /// \\param base_name The name of the distributed_matrix, which should\n\n /// be a unique string across the localities\n\n /// \\param data The data of the type T of the distributed_matrix\n\n /// \\param sub_localities The sub_localities accepts a list of locality\n\n /// index. By default, it is initialized to a list of all\n\n /// provided locality index.\n\n ///\n\n distributed_matrix(std::string basename, reference_type const& data,\n\n std::size_t num_sites = std::size_t(-1),\n\n std::size_t this_site = std::size_t(-1),\n\n std::int64_t* transferred_bytes = nullptr)\n\n : num_sites_(num_sites == std::size_t(-1) ?\n\n hpx::get_num_localities(hpx::launch::sync) :\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 51, "score": 176916.6521377357 }, { "content": " part_ids_[this_site_] = part_id;\n\n ptr_ = hpx::get_ptr<server::distributed_vector_part<T>>(\n\n hpx::launch::sync, part_id);\n\n\n\n return part_id;\n\n }\n\n\n\n hpx::id_type const& get_part_id(std::size_t idx) const\n\n {\n\n if (idx == this_site_)\n\n {\n\n std::lock_guard<hpx::lcos::local::spinlock> l(part_ids_mtx_);\n\n return part_ids_[idx];\n\n }\n\n\n\n if (idx >= num_sites_)\n\n {\n\n HPX_THROW_EXCEPTION(hpx::no_success,\n\n \"distributed_vector::get_part_id\",\n\n \"attempting to access invalid part of the distributed \"\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 52, "score": 176916.5269376707 }, { "content": " {\n\n HPX_ASSERT(!!ptr_);\n\n return &**ptr_;\n\n }\n\n\n\n /// Access the calling locality's value instance for this distributed_vector\n\n reference_type const* operator->() const\n\n {\n\n HPX_ASSERT(!!ptr_);\n\n return &**ptr_;\n\n }\n\n\n\n /// fetch() function is an asynchronous function. This returns a future\n\n /// of a copy of the instance of this distributed_vector associated with\n\n /// the given locality index. The provided locality index must be valid\n\n /// within the sub localities where this distributed object is\n\n /// constructed. Also, if the provided locality index is same as current\n\n /// locality, fetch function still returns a future of it local data copy.\n\n /// It is suggested to use star operator to access local data.\n\n hpx::future<data_type> fetch(std::size_t idx) const\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 53, "score": 176916.4058113706 }, { "content": " num_sites)\n\n , this_site_(this_site == std::size_t(-1) ? hpx::get_locality_id() :\n\n this_site)\n\n , basename_(\"dist_matrix_\" + std::move(basename))\n\n , transferred_bytes_(transferred_bytes)\n\n {\n\n if (this_site_ >= num_sites_)\n\n {\n\n HPX_THROW_EXCEPTION(hpx::no_success,\n\n \"distributed_matrix::distributed_matrix\",\n\n \"attempting to construct invalid part of the \"\n\n \"distributed object\");\n\n }\n\n create_and_register_server(data);\n\n }\n\n\n\n /// Creates a distributed_matrix in every locality with a given\n\n /// base_name string, data, and a type and construction_type in the\n\n /// template parameters\n\n ///\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 54, "score": 176916.27663458695 }, { "content": "\n\n *transferred_bytes_ += r->size() * sizeof(T);\n\n }\n\n });\n\n }\n\n return f;\n\n /// \\endcond\n\n }\n\n\n\n /// fetch() function is an asynchronous function. This returns a future\n\n /// of (part of) a copy of the instance of this distributed_vector\n\n /// associated with the given locality index. The provided locality\n\n /// index must be valid within the sub localities where this distributed\n\n /// object is constructed. Also, if the provided locality index is same\n\n /// as current locality, fetch function still returns a future of it\n\n /// local data copy.\n\n /// It is suggested to use star operator to access local data.\n\n hpx::future<data_type> fetch(\n\n std::size_t idx, std::size_t start, std::size_t stop) const\n\n {\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 55, "score": 176915.03626836493 }, { "content": " {\n\n using hasher = hpx::util::jenkins_hash;\n\n using size_type = hasher::size_type;\n\n\n\n hashed_string() = default;\n\n\n\n hashed_string(std::string const& key)\n\n : key_(key)\n\n , hash_(hasher{}(key_))\n\n {\n\n }\n\n\n\n hashed_string(std::string&& key)\n\n : key_(std::move(key))\n\n , hash_(hasher{}(key_))\n\n {\n\n }\n\n\n\n hashed_string(char const* key)\n\n : key_(key)\n", "file_path": "phylanx/util/hashed_string.hpp", "rank": 56, "score": 176914.7960170704 }, { "content": "\n\n *transferred_bytes_ += r->capacity() * sizeof(T);\n\n }\n\n });\n\n }\n\n return f;\n\n /// \\endcond\n\n }\n\n\n\n /// fetch() function is an asynchronous function. This returns a future\n\n /// of (part of) a copy of the instance of this distributed_matrix\n\n /// associated with the given locality index. The provided locality\n\n /// index must be valid within the sub localities where this distributed\n\n /// object is constructed. Also, if the provided locality index is same\n\n /// as current locality, fetch function still returns a future of it\n\n /// local data copy.\n\n /// It is suggested to use star operator to access local data.\n\n hpx::future<data_type> fetch(std::size_t idx, std::size_t start_row,\n\n std::size_t start_column, std::size_t stop_row,\n\n std::size_t stop_column) const\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 57, "score": 176914.48408291012 }, { "content": " , hash_(hasher{}(key_))\n\n {\n\n }\n\n\n\n friend bool operator<(hashed_string const& lhs,\n\n hashed_string const& rhs)\n\n {\n\n return (lhs.hash_ < rhs.hash_) ||\n\n (lhs.hash_ == rhs.hash_ && lhs.key_ < rhs.key_);\n\n }\n\n\n\n PHYLANX_EXPORT friend std::ostream& operator<<(std::ostream& os,\n\n hashed_string const& s);\n\n\n\n std::string const& key() const\n\n {\n\n return key_;\n\n }\n\n\n\n size_type hash() const\n", "file_path": "phylanx/util/hashed_string.hpp", "rank": 58, "score": 176914.2660302503 }, { "content": " {\n\n return hash_;\n\n }\n\n\n\n private:\n\n friend class hpx::serialization::access;\n\n PHYLANX_EXPORT void serialize(hpx::serialization::output_archive& ar,\n\n unsigned);\n\n PHYLANX_EXPORT void serialize(hpx::serialization::input_archive& ar,\n\n unsigned);\n\n\n\n std::string key_;\n\n size_type hash_;\n\n };\n\n}}\n\n\n\n#endif\n", "file_path": "phylanx/util/hashed_string.hpp", "rank": 59, "score": 176913.86220168343 }, { "content": "\n\n private:\n\n friend class hpx::util::iterator_core_access;\n\n\n\n void increment()\n\n {\n\n if (++pos_ == tensor_->end(row_, page_))\n\n {\n\n if (++row_ == tensor_->rows())\n\n {\n\n if (++page_ == tensor_->pages())\n\n {\n\n pos_ = base_iterator();\n\n }\n\n else\n\n {\n\n row_ = 0;\n\n pos_ = tensor_->begin(row_, page_);\n\n }\n\n }\n", "file_path": "phylanx/util/tensor_iterators.hpp", "rank": 60, "score": 176912.26898120999 }, { "content": " {\n\n return *pos_;\n\n }\n\n\n\n std::ptrdiff_t distance_to(tensor_iterator const& other) const\n\n {\n\n return\n\n ((other.page_ - page_) * tensor_->rows() + (other.row_ - row_)) *\n\n tensor_->columns() +\n\n (other.pos_ - other->tensor_->begin(other->row_, other->page_)) -\n\n (pos_ - tensor_->begin(row_, page_));\n\n }\n\n\n\n private:\n\n Tensor* tensor_;\n\n std::size_t page_;\n\n std::size_t row_;\n\n typename Tensor::Iterator pos_;\n\n };\n\n\n\n}}\n\n\n\n#endif\n", "file_path": "phylanx/util/tensor_iterators.hpp", "rank": 61, "score": 176911.79600732218 }, { "content": " hpx::get_num_localities(hpx::launch::sync) :\n\n num_sites)\n\n , this_site_(this_site == std::size_t(-1) ? hpx::get_locality_id() :\n\n this_site)\n\n , basename_(\"dist_matrix_\" + std::move(basename))\n\n , transferred_bytes_(transferred_bytes)\n\n {\n\n if (this_site_ >= num_sites_)\n\n {\n\n HPX_THROW_EXCEPTION(hpx::no_success,\n\n \"distributed_matrix::distributed_matrix\",\n\n \"attempting to construct invalid part of the \"\n\n \"distributed object\");\n\n }\n\n create_and_register_server(std::move(data));\n\n }\n\n\n\n /// Destroy the local reference to the distributed object, unregister\n\n /// the symbolic name\n\n ~distributed_matrix()\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 62, "score": 176911.43978461146 }, { "content": " {\n\n hpx::unregister_with_basename(basename_, this_site_).get();\n\n }\n\n\n\n /// Access the calling locality's value instance for this distributed_matrix\n\n reference_type& operator*()\n\n {\n\n HPX_ASSERT(!!ptr_);\n\n return **ptr_;\n\n }\n\n\n\n /// Access the calling locality's value instance for this distributed_matrix\n\n reference_type const& operator*() const\n\n {\n\n HPX_ASSERT(!!ptr_);\n\n return **ptr_;\n\n }\n\n\n\n /// Access the calling locality's value instance for this distributed_matrix\n\n reference_type* operator->()\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 63, "score": 176911.3104263252 }, { "content": " void decrement()\n\n {\n\n --index_;\n\n }\n\n\n\n void advance(std::size_t n)\n\n {\n\n index_ += n;\n\n }\n\n\n\n bool equal(tensor_columnslice_iterator const& other) const\n\n {\n\n return index_ == other.index_;\n\n }\n\n\n\n blaze::ColumnSlice<T> dereference() const\n\n {\n\n return blaze::columnslice(*data_, index_);\n\n }\n\n\n", "file_path": "phylanx/util/tensor_iterators.hpp", "rank": 64, "score": 176911.2749777454 }, { "content": " spinlock_pool::spinlock_for(transferred_bytes_));\n\n\n\n *transferred_bytes_ += r->capacity() * sizeof(T);\n\n }\n\n });\n\n }\n\n return f;\n\n /// \\endcond\n\n }\n\n\n\n private:\n\n /// \\cond NOINTERNAL\n\n template <typename Arg>\n\n hpx::id_type create_and_register_server(Arg&& value)\n\n {\n\n // create new distributed_matrix component and register it with AGAS\n\n hpx::id_type part_id =\n\n hpx::local_new<server::distributed_matrix_part<T>>(\n\n hpx::launch::sync, std::forward<Arg>(value));\n\n\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 65, "score": 176910.49929416642 }, { "content": " reference_type& operator*()\n\n {\n\n return data_;\n\n }\n\n\n\n reference_type const& operator*() const\n\n {\n\n return data_;\n\n }\n\n\n\n reference_type* operator->()\n\n {\n\n return &data_;\n\n }\n\n\n\n reference_type const* operator->() const\n\n {\n\n return &data_;\n\n }\n\n\n", "file_path": "phylanx/util/distributed_vector.hpp", "rank": 66, "score": 176910.39408911078 }, { "content": " {\n\n HPX_ASSERT(!!ptr_);\n\n return &**ptr_;\n\n }\n\n\n\n /// Access the calling locality's value instance for this distributed_matrix\n\n reference_type const* operator->() const\n\n {\n\n HPX_ASSERT(!!ptr_);\n\n return &**ptr_;\n\n }\n\n\n\n /// fetch() function is an asynchronous function. This returns a future\n\n /// of a copy of the instance of this distributed_matrix associated with\n\n /// the given locality index. The provided locality index must be valid\n\n /// within the sub localities where this distributed object is\n\n /// constructed. Also, if the provided locality index is same as current\n\n /// locality, fetch function still returns a future of it local data copy.\n\n /// It is suggested to use star operator to access local data.\n\n hpx::future<data_type> fetch(std::size_t idx) const\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 67, "score": 176910.11644341485 }, { "content": " hpx::register_with_basename(basename_, part_id, this_site_).get();\n\n\n\n part_ids_[this_site_] = part_id;\n\n ptr_ = hpx::get_ptr<server::distributed_matrix_part<T>>(\n\n hpx::launch::sync, part_id);\n\n\n\n return part_id;\n\n }\n\n\n\n hpx::id_type const& get_part_id(std::size_t idx) const\n\n {\n\n if (idx == this_site_)\n\n {\n\n std::lock_guard<hpx::lcos::local::spinlock> l(part_ids_mtx_);\n\n return part_ids_[idx];\n\n }\n\n\n\n if (idx >= num_sites_)\n\n {\n\n HPX_THROW_EXCEPTION(hpx::no_success,\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 68, "score": 176908.80435270857 }, { "content": " std::ptrdiff_t distance_to(tensor_columnslice_iterator const& other) const\n\n {\n\n return other.index_ - index_;\n\n }\n\n\n\n private:\n\n T* data_;\n\n std::size_t index_;\n\n };\n\n\n\n ///////////////////////////////////////////////////////////////////////////\n\n // Iterate over the pageslices (as a whole) of a tensor\n\n template <typename T>\n", "file_path": "phylanx/util/tensor_iterators.hpp", "rank": 69, "score": 176906.75784446517 }, { "content": " std::ptrdiff_t distance_to(tensor_rowslice_iterator const& other) const\n\n {\n\n return other.index_ - index_;\n\n }\n\n\n\n private:\n\n T* data_;\n\n std::size_t index_;\n\n };\n\n\n\n ///////////////////////////////////////////////////////////////////////////\n\n // Iterate over the columnslices (as a whole) of a tensor\n\n template <typename T>\n", "file_path": "phylanx/util/tensor_iterators.hpp", "rank": 70, "score": 176906.75784446517 }, { "content": " std::ptrdiff_t distance_to(tensor_pageslice_iterator const& other) const\n\n {\n\n return other.index_ - index_;\n\n }\n\n\n\n private:\n\n T* data_;\n\n std::size_t index_;\n\n };\n\n\n\n ///////////////////////////////////////////////////////////////////////////\n\n // Iterate over the elements of the whole tensor page/row-wise.\n\n template <typename Tensor>\n", "file_path": "phylanx/util/tensor_iterators.hpp", "rank": 71, "score": 176906.67235346496 }, { "content": " else\n\n {\n\n pos_ = tensor_->begin(row_, page_);\n\n }\n\n }\n\n }\n\n\n\n void decrement()\n\n {\n\n if (pos_ == tensor_->begin(row_))\n\n {\n\n if (row_ == 0)\n\n {\n\n if (page_ == 0)\n\n {\n\n pos_ = base_iterator();\n\n }\n\n else\n\n {\n\n row_ = tensor_->rows() - 1;\n", "file_path": "phylanx/util/tensor_iterators.hpp", "rank": 72, "score": 176905.58054351283 }, { "content": " pos_ = tensor_->end(row_, --page_) - 1;\n\n }\n\n }\n\n else\n\n {\n\n pos_ = tensor_->end(--row_, page_) - 1;\n\n }\n\n }\n\n else\n\n {\n\n --pos_;\n\n }\n\n }\n\n\n\n bool equal(tensor_iterator const& other) const\n\n {\n\n return pos_ == other.pos_;\n\n }\n\n\n\n typename base_type::reference dereference() const\n", "file_path": "phylanx/util/tensor_iterators.hpp", "rank": 73, "score": 176905.54014633986 }, { "content": " void decrement()\n\n {\n\n --index_;\n\n }\n\n\n\n void advance(std::size_t n)\n\n {\n\n index_ += n;\n\n }\n\n\n\n bool equal(tensor_pageslice_iterator const& other) const\n\n {\n\n return index_ == other.index_;\n\n }\n\n\n\n blaze::PageSlice<T> dereference() const\n\n {\n\n return blaze::pageslice(*data_, index_);\n\n }\n\n\n", "file_path": "phylanx/util/tensor_iterators.hpp", "rank": 74, "score": 176905.3837133734 }, { "content": " void decrement()\n\n {\n\n --index_;\n\n }\n\n\n\n void advance(std::size_t n)\n\n {\n\n index_ += n;\n\n }\n\n\n\n bool equal(tensor_rowslice_iterator const& other) const\n\n {\n\n return index_ == other.index_;\n\n }\n\n\n\n blaze::RowSlice<T> dereference() const\n\n {\n\n return blaze::rowslice(*data_, index_);\n\n }\n\n\n", "file_path": "phylanx/util/tensor_iterators.hpp", "rank": 75, "score": 176905.3837133734 }, { "content": " reference_type& operator*()\n\n {\n\n return data_;\n\n }\n\n\n\n reference_type const& operator*() const\n\n {\n\n return data_;\n\n }\n\n\n\n reference_type* operator->()\n\n {\n\n return &data_;\n\n }\n\n\n\n reference_type const* operator->() const\n\n {\n\n return &data_;\n\n }\n\n\n", "file_path": "phylanx/util/distributed_matrix.hpp", "rank": 76, "score": 176904.03781365973 }, { "content": "// Copyright (c) 2018 Parsa Amini\n\n// Copyright (c) 2018 Hartmut Kaiser\n\n//\n\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n\n// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\n\n\n#include <phylanx/phylanx.hpp>\n\n#include <phylanx/util/matrix_iterators.hpp>\n\n\n\n#include <hpx/hpx_main.hpp>\n\n#include <hpx/modules/testing.hpp>\n\n\n\n#include <cstddef>\n\n\n\n#include <blaze/Math.h>\n\n\n\nvoid test_row_iterator_empty()\n\n{\n\n blaze::DynamicMatrix<double> m1;\n\n\n", "file_path": "tests/unit/util/matrix_iterators.cpp", "rank": 77, "score": 174505.16786918667 }, { "content": " const phylanx::util::matrix_column_iterator<decltype(m1)> m1_begin(m1);\n\n const phylanx::util::matrix_column_iterator<decltype(m1)> m1_end(\n\n m1, m1.columns());\n\n\n\n HPX_TEST(m1_begin == m1_end);\n\n}\n\n\n\nvoid test_column_iterator_iteration()\n\n{\n\n blaze::DynamicMatrix<double> m1{{1, 2}, {3, 4}};\n\n\n\n const phylanx::util::matrix_column_iterator<decltype(m1)> m1_begin(m1);\n\n const phylanx::util::matrix_column_iterator<decltype(m1)> m1_end(\n\n m1, m1.columns());\n\n\n\n HPX_TEST(m1_begin != m1_end);\n\n\n\n std::size_t count = 0ul;\n\n\n\n for (auto it = m1_begin; it != m1_end; ++it)\n", "file_path": "tests/unit/util/matrix_iterators.cpp", "rank": 78, "score": 174505.1613367338 }, { "content": " {\n\n ++count;\n\n }\n\n\n\n HPX_TEST_EQ(m1.columns(), count);\n\n}\n\n\n\nvoid test_column_iterator_dereference()\n\n{\n\n blaze::DynamicMatrix<double> m1{{1, 2}, {3, 4}};\n\n\n\n const phylanx::util::matrix_column_iterator<decltype(m1)> it(m1, 1);\n\n\n\n HPX_TEST(blaze::column(m1, 1) == *it);\n\n}\n\n\n\nint main()\n\n{\n\n test_row_iterator_empty();\n\n test_row_iterator_iteration();\n\n test_row_iterator_dereference();\n\n\n\n test_column_iterator_empty();\n\n test_column_iterator_iteration();\n\n test_column_iterator_dereference();\n\n\n\n return hpx::util::report_errors();\n\n}\n", "file_path": "tests/unit/util/matrix_iterators.cpp", "rank": 79, "score": 174501.48393743075 }, { "content": " {\n\n ++count;\n\n }\n\n\n\n HPX_TEST_EQ(m1.rows(), count);\n\n}\n\n\n\nvoid test_row_iterator_dereference()\n\n{\n\n blaze::DynamicMatrix<double> m1{{1, 2}, {3, 4}};\n\n\n\n phylanx::util::matrix_row_iterator<decltype(m1)> it(m1, 1);\n\n\n\n HPX_TEST(blaze::row(m1, 1) == *it);\n\n}\n\n\n\nvoid test_column_iterator_empty()\n\n{\n\n blaze::DynamicMatrix<double> m1;\n\n\n", "file_path": "tests/unit/util/matrix_iterators.cpp", "rank": 80, "score": 174498.54179873108 }, { "content": " const phylanx::util::matrix_row_iterator<decltype(m1)> m1_begin(m1);\n\n const phylanx::util::matrix_row_iterator<decltype(m1)> m1_end(\n\n m1, m1.rows());\n\n\n\n HPX_TEST(m1_begin == m1_end);\n\n}\n\n\n\nvoid test_row_iterator_iteration()\n\n{\n\n blaze::DynamicMatrix<double> m1{{1, 2}, {3, 4}};\n\n\n\n const phylanx::util::matrix_row_iterator<decltype(m1)> m1_begin(m1);\n\n const phylanx::util::matrix_row_iterator<decltype(m1)> m1_end(\n\n m1, m1.rows());\n\n\n\n HPX_TEST(m1_begin != m1_end);\n\n\n\n std::size_t count = 0ul;\n\n\n\n for (auto it = m1_begin; it != m1_end; ++it)\n", "file_path": "tests/unit/util/matrix_iterators.cpp", "rank": 81, "score": 174497.2822744825 }, { "content": " class format_string\n\n : public primitive_component_base\n\n , public:: std::enable_shared_from_this<format_string>\n\n {\n\n public:\n\n static match_pattern_type const match_data;\n\n\n\n format_string() = default;\n\n\n\n format_string(primitive_arguments_type&& operands,\n\n std::string const& name, std::string const& codename);\n\n\n\n private:\n\n hpx::future<primitive_argument_type> eval(\n\n primitive_arguments_type const& operands,\n\n primitive_arguments_type const& args,\n\n eval_context ctx) const override;\n\n };\n\n\n\n PHYLANX_EXPORT primitive create_format_string(hpx::id_type const& locality,\n\n primitive_arguments_type&& operands,\n\n std::string const& name = \"\", std::string const& codename = \"\");\n\n}}}\n\n\n\n#endif\n\n\n\n\n", "file_path": "phylanx/execution_tree/primitives/format_string.hpp", "rank": 82, "score": 173315.96671853398 }, { "content": " class string_output\n\n : public primitive_component_base\n\n , public std::enable_shared_from_this<string_output>\n\n {\n\n protected:\n\n using args_type = primitive_arguments_type;\n\n\n\n hpx::future<primitive_argument_type> eval(\n\n primitive_arguments_type const& operands,\n\n primitive_arguments_type const& args,\n\n eval_context ctx) const override;\n\n\n\n public:\n\n static match_pattern_type const match_data;\n\n\n\n string_output() = default;\n\n\n\n string_output(primitive_arguments_type&& operands,\n\n std::string const& name, std::string const& codename);\n\n\n", "file_path": "phylanx/execution_tree/primitives/string_output.hpp", "rank": 83, "score": 173315.96671853398 }, { "content": " def __iter__(self):\n\n for i in self.iterspace:\n", "file_path": "python/phylanx/util/prange.py", "rank": 84, "score": 173205.24447079602 }, { "content": "class assign_vector\n\n{\n\n T& data;\n\npublic:\n\n assign_vector(T& data_) : data(data_) {}\n\n ~assign_vector() {}\n\n\n\n template<typename V>\n\n void operator=(const V& value) {\n\n if(data.is_ref())\n\n data = value;\n\n else\n\n data.vector() = value;\n\n }\n\n};\n\n\n\ntemplate<typename T>\n", "file_path": "phylanx/util/assign.hpp", "rank": 85, "score": 172181.23049518195 }, { "content": "class assign_matrix\n\n{\n\n T& data;\n\npublic:\n\n assign_matrix(T& data_) : data(data_) {}\n\n ~assign_matrix() {}\n\n\n\n template<typename V>\n\n void operator=(const V& value) {\n\n if(data.is_ref())\n\n data = value;\n\n else\n\n data.matrix() = value;\n\n }\n\n};\n\n\n\ntemplate<typename T>\n", "file_path": "phylanx/util/assign.hpp", "rank": 86, "score": 172175.04413550443 }, { "content": "# Copyright (c) 2018 Hartmut Kaiser\n\n#\n\n# Distributed under the Boost Software License, Version 1.0. (See accompanying\n\n# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\n\n\nimport phylanx\n\nfrom phylanx import Phylanx\n\nimport numpy as np\n\n\n\n\n\n@Phylanx\n\ndef test_make_vector_one():\n\n return hstack((42)) # noqa: F821\n\n\n\n\n\n@Phylanx\n\ndef test_make_vector_literals():\n\n return hstack((1, 2, 3, 4)) # noqa: F821\n\n\n\n\n\n@Phylanx\n\ndef test_make_vector():\n\n a = 1\n\n b = 2\n\n c = 3\n\n return hstack((a, b, c)) # noqa: F821\n\n\n\n\n\n@Phylanx\n\ndef test_make_vector2():\n\n a = 1\n\n b = 2\n\n c = 3\n\n return hstack((a, hstack((a, b, c)), c)) # noqa: F821\n\n\n\n\n\na = test_make_vector_one()\n\nassert (isinstance(a, np.ndarray))\n\nassert (a == np.array(42)).all()\n\n\n\na = test_make_vector_literals()\n\nassert (isinstance(a, np.ndarray))\n\nassert (a == np.array([1, 2, 3, 4])).all()\n\n\n\na = test_make_vector()\n\nassert (isinstance(a, np.ndarray))\n\nassert (a == np.array([1, 2, 3])).all()\n\n\n\na = test_make_vector2()\n\nassert (isinstance(a, np.ndarray))\n\nassert (a == np.array([1, 1, 2, 3, 3])).all()\n", "file_path": "tests/unit/python/execution_tree/primitives/make_vector.py", "rank": 87, "score": 169169.03048976 }, { "content": "// Copyright (c) 2018 Hartmut Kaiser\n\n//\n\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n\n// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\n\n\n#ifndef PHYLANX_UTIL_DETAIL_NUMERIC_LIMITS_MIN_JAN_09_2019_1000\n\n#define PHYLANX_UTIL_DETAIL_NUMERIC_LIMITS_MIN_JAN_09_2019_1000\n\n\n\n#include <cstdint>\n\n#include <limits>\n\n\n\nnamespace phylanx { namespace util { namespace detail\n\n{\n\n template <typename T>\n\n constexpr T numeric_limits_min()\n\n {\n\n return -(std::numeric_limits<T>::max)();\n\n }\n\n\n\n template <>\n\n inline constexpr std::uint8_t numeric_limits_min<std::uint8_t>()\n\n {\n\n return 0;\n\n }\n\n}}}\n\n\n\n#endif\n", "file_path": "phylanx/util/detail/numeric_limits_min.hpp", "rank": 88, "score": 167734.58761811026 }, { "content": "// Copyright (c) 2017-2018 Hartmut Kaiser\n\n//\n\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n\n// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\n\n\n#if !defined(PHYLANX_PRIMITIVES_FORMAT_STRING_JUL_08_2018_1139AM)\n\n#define PHYLANX_PRIMITIVES_FORMAT_STRING_JUL_08_2018_1139AM\n\n\n\n#include <phylanx/config.hpp>\n\n#include <phylanx/execution_tree/primitives/base_primitive.hpp>\n\n#include <phylanx/execution_tree/primitives/primitive_component_base.hpp>\n\n\n\n#include <hpx/futures/future.hpp>\n\n\n\n#include <iosfwd>\n\n#include <memory>\n\n#include <string>\n\n#include <vector>\n\n\n\nnamespace phylanx { namespace execution_tree { namespace primitives\n\n{\n", "file_path": "phylanx/execution_tree/primitives/format_string.hpp", "rank": 89, "score": 167253.42103694467 }, { "content": "// Copyright (c) 2018 Hartmut Kaiser\n\n//\n\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n\n// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\n\n\n#if !defined(PHYLANX_PRIMITIVES_STRING_OUTPUT_JAN_18_2018_0105PM)\n\n#define PHYLANX_PRIMITIVES_STRING_OUTPUT_JAN_18_2018_0105PM\n\n\n\n#include <phylanx/config.hpp>\n\n#include <phylanx/execution_tree/primitives/base_primitive.hpp>\n\n#include <phylanx/execution_tree/primitives/primitive_component_base.hpp>\n\n#include <phylanx/ir/node_data.hpp>\n\n\n\n#include <hpx/futures/future.hpp>\n\n\n\n#include <memory>\n\n#include <string>\n\n#include <vector>\n\n\n\nnamespace phylanx { namespace execution_tree { namespace primitives\n\n{\n", "file_path": "phylanx/execution_tree/primitives/string_output.hpp", "rank": 90, "score": 167252.96723337838 }, { "content": " };\n\n\n\n PHYLANX_EXPORT primitive create_string_output(hpx::id_type const& locality,\n\n primitive_arguments_type&& operands,\n\n std::string const& name = \"\", std::string const& codename = \"\");\n\n}}}\n\n\n\n#endif\n\n\n\n\n", "file_path": "phylanx/execution_tree/primitives/string_output.hpp", "rank": 91, "score": 167228.30797709923 }, { "content": " ///////////////////////////////////////////////////////////////////////////\n\n function compile(std::string const& codename, ast::expression const& expr,\n\n function_list& snippets, environment& env,\n\n expression_pattern_list const& patterns,\n\n hpx::id_type const& default_locality)\n\n {\n\n compiler_helper comp{\n\n codename, snippets, env, patterns, default_locality};\n\n return comp(expr);\n\n }\n\n\n", "file_path": "src/execution_tree/compiler/compiler.cpp", "rank": 92, "score": 161268.83503907223 }, { "content": "# Copyright (c) 2017 Hartmut Kaiser\n\n# Copyright (c) 2018 Steven R. Brandt\n\n# Copyright (c) 2018 R. Tohid\n\n#\n\n# Distributed under the Boost Software License, Version 1.0. (See accompanying\n\n# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\n\n\nimport ast\n\nimport re\n\nimport os\n\n\n\n\n\ndef dump_info(a, depth=0):\n\n \"Print detailed information about an AST\"\n\n nm = a.__class__.__name__\n\n print(\" \" * depth, end=\"\")\n\n iter_children = True\n\n if nm == \"Num\":\n\n if type(a.n) == int:\n\n print(\"%s=%d\" % (nm, a.n))\n\n else:\n\n print(\"%s=%f\" % (nm, a.n))\n\n elif nm == \"Global\":\n\n print(\"Global:\", dir(a))\n\n elif nm == \"Str\":\n\n print(\"%s='%s'\" % (nm, a.s))\n\n elif nm == \"Name\":\n\n print(\"%s='%s'\" % (nm, a.id))\n\n elif nm == \"arg\":\n\n print(\"%s='%s'\" % (nm, a.arg))\n\n elif nm == \"Slice\":\n\n print(\"Slice:\")\n\n print(\" \" * depth, end=\"\")\n\n print(\" Upper:\")\n\n if a.upper is not None:\n\n dump_info(a.upper, depth + 4)\n\n print(\" \" * depth, end=\"\")\n\n print(\" Lower:\")\n\n if a.lower is not None:\n\n dump_info(a.lower, depth + 4)\n\n print(\" \" * depth, end=\"\")\n\n print(\" Step:\")\n\n if a.step is not None:\n\n dump_info(a.step, depth + 4)\n\n elif nm == \"If\":\n\n iter_children = False\n\n print(nm)\n\n dump_info(a.test, depth)\n\n for n in a.body:\n\n dump_info(n, depth + 1)\n\n if len(a.orelse) > 0:\n\n print(\" \" * depth, end=\"\")\n\n print(\"Else\")\n\n for n in a.orelse:\n\n dump_info(n, depth + 1)\n\n else:\n\n print(nm)\n\n for (f, v) in ast.iter_fields(a):\n\n if type(f) == str and type(v) == str:\n\n print(\"%s:attr[%s]=%s\" % (\" \" * (depth + 1), f, v))\n\n if iter_children:\n\n for n in ast.iter_child_nodes(a):\n\n dump_info(n, depth + 1)\n\n\n\n\n\n# source http://bit.ly/2C58jl8\n\ndef dump_ast(node, annotate_fields=True, include_attributes=False,\n\n indent=' '):\n\n def _format(node, level=0):\n\n if isinstance(node, ast.AST):\n\n fields = [(a, _format(b, level)) for a, b in ast.iter_fields(node)]\n\n if include_attributes and node._attributes:\n\n fields.extend([(a, _format(getattr(node, a), level))\n\n for a in node._attributes])\n\n return ''.join([\n\n node.__class__.__name__, '(',\n\n ', '.join(('%s=%s' % field\n\n for field in fields) if annotate_fields else (\n\n b for a, b in fields)), ')'\n\n ])\n\n elif isinstance(node, list):\n\n lines = ['[']\n\n lines.extend((indent * (level + 2) + _format(x, level + 2) + ','\n\n for x in node))\n\n if len(lines) > 1:\n\n lines.append(indent * (level + 1) + ']')\n\n else:\n\n lines[-1] += ']'\n\n return '\\n'.join(lines)\n\n return repr(node)\n\n\n\n if not isinstance(node, ast.AST):\n\n raise TypeError('expected AST, got %r' % node.__class__.__name__)\n\n return _format(node)\n\n\n\n\n\ndef save_to_file(data, ofn, verbose=False):\n\n d = os.path.dirname(ofn)\n\n if d != \"\":\n\n os.makedirs(d, exist_ok=True)\n\n\n\n with open(ofn, \"w\") as f:\n\n print(data, file=f)\n\n if verbose is True:\n\n print(ofn, \"saved\")\n\n\n\n\n\ndef dump_to_file(data, key, kwargs):\n\n if kwargs[key] is True:\n\n ofn = key + \"_\" + kwargs[\"python_src_tag\"] + \".txt\"\n\n save_to_file(data, ofn, kwargs[\"verbose\"])\n\n\n\n\n\ndef print_type(s, o):\n\n indent = \" \"\n\n print(\"%-16s type() \\n%s%s\" % (s, indent, type(o)))\n\n print(\"\")\n\n print(\"%-16s dir() \\n%s%s\" % (s, indent, dir(o)))\n\n print(\"\")\n\n print(\"%-16s __class__ \\n%s%s\" % (s, indent, o.__class__))\n\n print(\"\")\n\n\n\n\n\ndef print_python_ast_node(s, node, depth=0):\n\n # two ways to check the nodes type:\n\n # 1. if node.__class__.__name__ == \"Num\"\n\n # 2. if isinstance(node, ast.Num):\n\n\n\n # nodes._fields gives a list of all child nodes\n\n\n\n # print(\"###################################\")\n\n # print_type(\"node\", node)\n\n\n\n if not isinstance(node, ast.AST):\n\n raise TypeError('Expected AST, got %r' % node.__class__.__name__)\n\n\n\n indent = \" \"\n\n\n\n print(indent * depth, end=\"\")\n\n print(\"%-12s\" % s, node)\n\n # print(\"%-12s\" % s, node.__class__)\n\n # print(\"%-12s %s\" % (s, node.__class__.__name__), node._fields)\n\n # print(\"%-12s\" % s, node.__class__, node._fields)\n\n\n\n # print(indent * depth, end=\"\")\n\n # print(\"# for (fieldname, value) in ast.iter_fields(node):\")\n\n for (fieldname, value) in ast.iter_fields(node):\n\n print(indent * (depth + 1), end=\"\")\n\n print(\"%-12s\" % fieldname, value)\n\n print(\"\")\n\n\n\n # depth += 1\n", "file_path": "python/phylanx/ast/utils.py", "rank": 93, "score": 158110.96685766007 }, { "content": "def append(lst, x):\n", "file_path": "tests/regressions/python/1312_matrix_iteration.py", "rank": 94, "score": 155797.46494526105 }, { "content": "def constant(val, sh, dtype):\n", "file_path": "tests/regressions/python/1312_matrix_iteration.py", "rank": 95, "score": 155797.46494526105 }, { "content": "def foo():\n\n sh = [2, 2]\n\n z = constant(0, sh, dtype=\"float\")\n\n result = []\n\n for a in z:\n\n result = append(result, a)\n", "file_path": "tests/regressions/python/1312_matrix_iteration.py", "rank": 96, "score": 155797.46494526105 }, { "content": " ///////////////////////////////////////////////////////////////////////////\n\n function define_variable(std::string const& codename,\n\n primitive_name_parts name_parts, function_list& snippets,\n\n environment& env, primitive_argument_type body,\n\n hpx::id_type const& default_locality, bool define_globally)\n\n {\n\n function& f = snippets.program_.add_empty(codename);\n\n\n\n if (name_parts.instance.empty())\n\n {\n\n name_parts.instance = std::move(name_parts.primitive);\n\n }\n\n name_parts.primitive = \"variable\";\n\n name_parts.sequence_number =\n\n snippets.sequence_numbers_[name_parts.primitive]++;\n\n\n\n // create variable in the given environment\n\n env.define_variable(name_parts.instance,\n\n access_target(f, \"access-variable\", default_locality), codename,\n\n name_parts.tag1, name_parts.tag2, define_globally);\n\n\n", "file_path": "src/execution_tree/compiler/compiler.cpp", "rank": 97, "score": 154685.88336138288 }, { "content": " ///////////////////////////////////////////////////////////////////////////\n\n function bind_arguments(std::string const& codename,\n\n std::string const& func_name, function_list& snippets,\n\n primitive_argument_type&& func, primitive_arguments_type&& args,\n\n hpx::id_type const& default_locality)\n\n {\n\n function& f = snippets.program_.add_empty(codename);\n\n\n\n // now create the target-reference object\n\n primitive_arguments_type params;\n\n params.reserve(args.size() + 1);\n\n\n\n params.emplace_back(std::move(func));\n\n for (auto&& arg : std::move(args))\n\n {\n\n params.push_back(std::move(arg));\n\n }\n\n\n\n f = function{\n\n primitive_argument_type{create_primitive_component(default_locality,\n\n \"target-reference\", std::move(params), func_name, codename)},\n\n func_name};\n\n\n\n return f;\n\n }\n\n\n", "file_path": "src/execution_tree/compiler/compiler.cpp", "rank": 98, "score": 154685.88336138288 }, { "content": "def test_make_vector():\n\n a = 1\n\n b = 2\n\n c = 3\n", "file_path": "tests/unit/python/execution_tree/primitives/make_vector.py", "rank": 99, "score": 153877.12904140493 } ]
C++
src/backend/gporca/libgpopt/src/search/CJobGroupOptimization.cpp
Viocalpan/gpdb
3cf72f6cbed32cc5e5aeea645beeb4c82db9ac1a
#include "gpopt/engine/CEngine.h" #include "gpopt/search/CGroup.h" #include "gpopt/search/CGroupExpression.h" #include "gpopt/search/CGroupProxy.h" #include "gpopt/search/CJobFactory.h" #include "gpopt/search/CJobGroupImplementation.h" #include "gpopt/search/CJobGroupOptimization.h" #include "gpopt/search/CJobGroupExpressionOptimization.h" #include "gpopt/search/CJobQueue.h" #include "gpopt/search/CSchedulerContext.h" #include "gpopt/search/CScheduler.h" #include "naucrates/traceflags/traceflags.h" using namespace gpopt; const CJobGroupOptimization::EEvent rgeev[CJobGroupOptimization::estSentinel] [CJobGroupOptimization::estSentinel] = { { CJobGroupOptimization::eevImplementing, CJobGroupOptimization::eevImplemented, CJobGroupOptimization::eevSentinel, CJobGroupOptimization::eevOptimized}, { CJobGroupOptimization::eevSentinel, CJobGroupOptimization::eevOptimizing, CJobGroupOptimization::eevOptimizedCurrentLevel, CJobGroupOptimization::eevSentinel}, { CJobGroupOptimization::eevSentinel, CJobGroupOptimization::eevOptimizing, CJobGroupOptimization::eevSentinel, CJobGroupOptimization::eevOptimized}, { CJobGroupOptimization::eevSentinel, CJobGroupOptimization::eevSentinel, CJobGroupOptimization::eevSentinel, CJobGroupOptimization::eevSentinel}, }; #ifdef GPOS_DEBUG const WCHAR rgwszStates[CJobGroupOptimization::estSentinel][GPOPT_FSM_NAME_LENGTH] = { GPOS_WSZ_LIT("initialized"), GPOS_WSZ_LIT("optimizing children"), GPOS_WSZ_LIT("damping optimization level"), GPOS_WSZ_LIT("completed")}; const WCHAR rgwszEvents[CJobGroupOptimization::eevSentinel] [GPOPT_FSM_NAME_LENGTH] = { GPOS_WSZ_LIT("ongoing implementation"), GPOS_WSZ_LIT("done implementation"), GPOS_WSZ_LIT("ongoing optimization"), GPOS_WSZ_LIT("optimization level complete"), GPOS_WSZ_LIT("finalizing")}; #endif CJobGroupOptimization::CJobGroupOptimization() = default; CJobGroupOptimization::~CJobGroupOptimization() = default; void CJobGroupOptimization::Init( CGroup *pgroup, CGroupExpression *pgexprOrigin, COptimizationContext *poc) { GPOS_ASSERT(NULL != poc); GPOS_ASSERT(pgroup == poc->Pgroup()); CJobGroup::Init(pgroup); m_jsm.Init(rgeev #ifdef GPOS_DEBUG , rgwszStates, rgwszEvents #endif ); m_jsm.SetAction(estInitialized, EevtStartOptimization); m_jsm.SetAction(estOptimizingChildren, EevtOptimizeChildren); m_jsm.SetAction(estDampingOptimizationLevel, EevtCompleteOptimization); m_pgexprOrigin = pgexprOrigin; m_poc = m_pgroup->PocInsert(poc); if (poc == m_poc) { m_poc->AddRef(); } SetJobQueue(m_poc->PjqOptimization()); m_eolCurrent = EolLow; CJob::SetInit(); } BOOL CJobGroupOptimization::FScheduleGroupExpressions(CSchedulerContext *psc) { CGroupExpression *pgexprLast = m_pgexprLastScheduled; CGroupExpression *pgexpr = PgexprFirstUnsched(); while (NULL != pgexpr) { if (psc->Peng()->FOptimizeChild(m_pgexprOrigin, pgexpr, m_poc, EolCurrent())) { const ULONG ulOptRequests = CPhysical::PopConvert(pgexpr->Pop())->UlOptRequests(); for (ULONG ul = 0; ul < ulOptRequests; ul++) { CJobGroupExpressionOptimization::ScheduleJob(psc, pgexpr, m_poc, ul, this); } } pgexprLast = pgexpr; { CGroupProxy gp(m_pgroup); pgexpr = gp.PgexprSkipLogical(pgexpr); } } BOOL fNewJobs = (m_pgexprLastScheduled != pgexprLast); m_pgexprLastScheduled = pgexprLast; return fNewJobs; } CJobGroupOptimization::EEvent CJobGroupOptimization::EevtStartOptimization(CSchedulerContext *psc, CJob *pjOwner) { CJobGroupOptimization *pjgo = PjConvert(pjOwner); CGroup *pgroup = pjgo->m_pgroup; GPOS_ASSERT(COptimizationContext::estUnoptimized == pjgo->m_poc->Est() && "Group is already optimized under this context"); if (!pgroup->FImplemented()) { CJobGroupImplementation::ScheduleJob(psc, pgroup, pjgo); return eevImplementing; } pjgo->m_poc->SetState(COptimizationContext::estOptimizing); if (psc->Peng()->FRoot(pgroup)) { psc->Pjf()->Truncate(EjtGroupImplementation); psc->Pjf()->Truncate(EjtGroupExpressionImplementation); } pjgo->m_eolCurrent = pgroup->EolMax(); return eevImplemented; } CJobGroupOptimization::EEvent CJobGroupOptimization::EevtOptimizeChildren(CSchedulerContext *psc, CJob *pjOwner) { CJobGroupOptimization *pjgo = PjConvert(pjOwner); if (pjgo->FScheduleGroupExpressions(psc)) { return eevOptimizing; } return eevOptimizedCurrentLevel; } CJobGroupOptimization::EEvent CJobGroupOptimization::EevtCompleteOptimization(CSchedulerContext *, CJob *pjOwner) { CJobGroupOptimization *pjgo = PjConvert(pjOwner); pjgo->DampOptimizationLevel(); if (EolSentinel != pjgo->EolCurrent()) { pjgo->m_pgexprLastScheduled = NULL; return eevOptimizing; } pjgo->m_poc->SetState(COptimizationContext::estOptimized); return eevOptimized; } BOOL CJobGroupOptimization::FExecute(CSchedulerContext *psc) { GPOS_ASSERT(FInit()); return m_jsm.FRun(psc, this); } void CJobGroupOptimization::ScheduleJob(CSchedulerContext *psc, CGroup *pgroup, CGroupExpression *pgexprOrigin, COptimizationContext *poc, CJob *pjParent) { CJob *pj = psc->Pjf()->PjCreate(CJob::EjtGroupOptimization); CJobGroupOptimization *pjgo = PjConvert(pj); pjgo->Init(pgroup, pgexprOrigin, poc); psc->Psched()->Add(pjgo, pjParent); } #ifdef GPOS_DEBUG IOstream & CJobGroupOptimization::OsPrint(IOstream &os) { return m_jsm.OsHistory(os); } #endif
#include "gpopt/engine/CEngine.h" #include "gpopt/search/CGroup.h" #include "gpopt/search/CGroupExpression.h" #include "gpopt/search/CGroupProxy.h" #include "gpopt/search/CJobFactory.h" #include "gpopt/search/CJobGroupImplementation.h" #include "gpopt/search/CJobGroupOptimization.h" #include "gpopt/search/CJobGroupExpressionOptimization.h" #include "gpopt/search/CJobQueue.h" #include "gpopt/search/CSchedulerContext.h" #include "gpopt/search/CScheduler.h" #include "naucrates/traceflags/traceflags.h" using namespace gpopt; const CJobGroupOptimization::EEvent rgeev[CJobGroupOptimization::estSentinel] [CJobGroupOptimization::estSentinel] = { { CJobGroupOptimization::eevImplementing, CJobGroupOptimization::eevImplemented, CJobGroupOptimization::eevSentinel, CJobGroupOptimization::eevOptimized}, { CJobGroupOptimization::eevSentinel, CJobGroupOptimization::eevOptimizing, CJobGroupOptimization::eevOptimizedCurrentLevel, CJobGroupOptimization::eevSentinel}, { CJobGroupOptimization::eevSentinel, CJobGroupOptimization::eevOptimizing, CJobGroupOptimization::eevSentinel, CJobGroupOptimization::eevOptimized}, { CJobGroupOptimization::eevSentinel, CJobGroupOptimization::eevSentinel, CJobGroupOptimization::eevSentinel, CJobGroupOptimization::eevSentinel}, }; #ifdef GPOS_DEBUG const WCHAR rgwszStates[CJobGroupOptimization::estSentinel][GPOPT_FSM_NAME_LENGTH] = { GPOS_WSZ_LIT("initialized"), GPOS_WSZ_LIT("optimizing children"), GPOS_WSZ_LIT("damping optimization level"), GPOS_WSZ_LIT("completed")}; const WCHAR rgwszEvents[CJobGroupOptimization::eevSentinel] [GPOPT_FSM_NAME_LENGTH] = { GPOS_WSZ_LIT("ongoing implementation"), GPOS_WSZ_LIT("done implementation"), GPOS_WSZ_LIT("ongoing optimization"), GPOS_WSZ_LIT("optimization level complete"), GPOS_WSZ_LIT("finalizing")}; #endif CJobGroupOptimization::CJobGroupOptimization() = default; CJobGroupOptimization::~CJobGroupOptimization() = default; void CJobGroupOptimization::Init( CGroup *pgroup, CGroupExpression *pgexprOrigin, COptimizationContext *poc) { GPOS_ASSERT(NULL != poc); GPOS_ASSERT(pgroup == poc->Pgroup()); CJobGroup::Init(pgroup); m_jsm.Init(rgeev #ifdef GPOS_DEBUG , rgwszStates, rgwszEvents #endif ); m_jsm.SetAction(estInitialized, EevtStartOptimization); m_jsm.SetAction(estOptimizingChildren, EevtOptimizeChildren); m_jsm.SetAction(estDampingOptimizationLevel, EevtCompleteOptimization); m_pgex
ed; CGroupExpression *pgexpr = PgexprFirstUnsched(); while (NULL != pgexpr) { if (psc->Peng()->FOptimizeChild(m_pgexprOrigin, pgexpr, m_poc, EolCurrent())) { const ULONG ulOptRequests = CPhysical::PopConvert(pgexpr->Pop())->UlOptRequests(); for (ULONG ul = 0; ul < ulOptRequests; ul++) { CJobGroupExpressionOptimization::ScheduleJob(psc, pgexpr, m_poc, ul, this); } } pgexprLast = pgexpr; { CGroupProxy gp(m_pgroup); pgexpr = gp.PgexprSkipLogical(pgexpr); } } BOOL fNewJobs = (m_pgexprLastScheduled != pgexprLast); m_pgexprLastScheduled = pgexprLast; return fNewJobs; } CJobGroupOptimization::EEvent CJobGroupOptimization::EevtStartOptimization(CSchedulerContext *psc, CJob *pjOwner) { CJobGroupOptimization *pjgo = PjConvert(pjOwner); CGroup *pgroup = pjgo->m_pgroup; GPOS_ASSERT(COptimizationContext::estUnoptimized == pjgo->m_poc->Est() && "Group is already optimized under this context"); if (!pgroup->FImplemented()) { CJobGroupImplementation::ScheduleJob(psc, pgroup, pjgo); return eevImplementing; } pjgo->m_poc->SetState(COptimizationContext::estOptimizing); if (psc->Peng()->FRoot(pgroup)) { psc->Pjf()->Truncate(EjtGroupImplementation); psc->Pjf()->Truncate(EjtGroupExpressionImplementation); } pjgo->m_eolCurrent = pgroup->EolMax(); return eevImplemented; } CJobGroupOptimization::EEvent CJobGroupOptimization::EevtOptimizeChildren(CSchedulerContext *psc, CJob *pjOwner) { CJobGroupOptimization *pjgo = PjConvert(pjOwner); if (pjgo->FScheduleGroupExpressions(psc)) { return eevOptimizing; } return eevOptimizedCurrentLevel; } CJobGroupOptimization::EEvent CJobGroupOptimization::EevtCompleteOptimization(CSchedulerContext *, CJob *pjOwner) { CJobGroupOptimization *pjgo = PjConvert(pjOwner); pjgo->DampOptimizationLevel(); if (EolSentinel != pjgo->EolCurrent()) { pjgo->m_pgexprLastScheduled = NULL; return eevOptimizing; } pjgo->m_poc->SetState(COptimizationContext::estOptimized); return eevOptimized; } BOOL CJobGroupOptimization::FExecute(CSchedulerContext *psc) { GPOS_ASSERT(FInit()); return m_jsm.FRun(psc, this); } void CJobGroupOptimization::ScheduleJob(CSchedulerContext *psc, CGroup *pgroup, CGroupExpression *pgexprOrigin, COptimizationContext *poc, CJob *pjParent) { CJob *pj = psc->Pjf()->PjCreate(CJob::EjtGroupOptimization); CJobGroupOptimization *pjgo = PjConvert(pj); pjgo->Init(pgroup, pgexprOrigin, poc); psc->Psched()->Add(pjgo, pjParent); } #ifdef GPOS_DEBUG IOstream & CJobGroupOptimization::OsPrint(IOstream &os) { return m_jsm.OsHistory(os); } #endif
prOrigin = pgexprOrigin; m_poc = m_pgroup->PocInsert(poc); if (poc == m_poc) { m_poc->AddRef(); } SetJobQueue(m_poc->PjqOptimization()); m_eolCurrent = EolLow; CJob::SetInit(); } BOOL CJobGroupOptimization::FScheduleGroupExpressions(CSchedulerContext *psc) { CGroupExpression *pgexprLast = m_pgexprLastSchedul
random
[]
C++
modules/remote_bitrate_estimator/mimd_rate_control.cc
yuxw75/temp
ab2fd478821e6c98ff10f2976ce43f617250cff6
#include "webrtc/modules/remote_bitrate_estimator/mimd_rate_control.h" #include <algorithm> #include <cassert> #include <cmath> #include <cstring> namespace webrtc { const int64_t kDefaultRttMs = 200; const int64_t kLogIntervalMs = 1000; MimdRateControl::MimdRateControl(uint32_t min_bitrate_bps) : min_configured_bit_rate_(min_bitrate_bps), max_configured_bit_rate_(30000000), current_bit_rate_(max_configured_bit_rate_), max_hold_rate_(0), avg_max_bit_rate_(-1.0f), var_max_bit_rate_(0.4f), rate_control_state_(kRcHold), came_from_state_(kRcDecrease), rate_control_region_(kRcMaxUnknown), last_bit_rate_change_(-1), current_input_(kBwNormal, 0, 1.0), updated_(false), time_first_incoming_estimate_(-1), initialized_bit_rate_(false), avg_change_period_(1000.0f), last_change_ms_(-1), beta_(0.9f), rtt_(kDefaultRttMs), time_of_last_log_(-1) { } RateControlType MimdRateControl::GetControlType() const { return kMimdControl; } uint32_t MimdRateControl::GetMinBitrate() const { return min_configured_bit_rate_; } bool MimdRateControl::ValidEstimate() const { return initialized_bit_rate_; } int64_t MimdRateControl::GetFeedbackInterval() const { return kMaxFeedbackIntervalMs; } bool MimdRateControl::TimeToReduceFurther(int64_t time_now, uint32_t incoming_bitrate_bps) const { const int64_t bitrate_reduction_interval = std::max<int64_t>(std::min<int64_t>(rtt_, 200), 10); if (time_now - last_bit_rate_change_ >= bitrate_reduction_interval) { return true; } if (ValidEstimate()) { const int threshold = static_cast<int>(1.05 * incoming_bitrate_bps); const int bitrate_difference = LatestEstimate() - incoming_bitrate_bps; return bitrate_difference > threshold; } return false; } uint32_t MimdRateControl::LatestEstimate() const { return current_bit_rate_; } uint32_t MimdRateControl::UpdateBandwidthEstimate(int64_t now_ms) { current_bit_rate_ = ChangeBitRate(current_bit_rate_, current_input_._incomingBitRate, current_input_._noiseVar, now_ms); if (now_ms - time_of_last_log_ > kLogIntervalMs) { time_of_last_log_ = now_ms; } return current_bit_rate_; } void MimdRateControl::SetRtt(int64_t rtt) { rtt_ = rtt; } RateControlRegion MimdRateControl::Update(const RateControlInput* input, int64_t now_ms) { assert(input); if (!initialized_bit_rate_) { if (time_first_incoming_estimate_ < 0) { if (input->_incomingBitRate > 0) { time_first_incoming_estimate_ = now_ms; } } else if (now_ms - time_first_incoming_estimate_ > 500 && input->_incomingBitRate > 0) { current_bit_rate_ = input->_incomingBitRate; initialized_bit_rate_ = true; } } if (updated_ && current_input_._bwState == kBwOverusing) { current_input_._noiseVar = input->_noiseVar; current_input_._incomingBitRate = input->_incomingBitRate; return rate_control_region_; } updated_ = true; current_input_ = *input; return rate_control_region_; } void MimdRateControl::SetEstimate(int bitrate_bps, int64_t now_ms) { } uint32_t MimdRateControl::ChangeBitRate(uint32_t current_bit_rate, uint32_t incoming_bit_rate, double noise_var, int64_t now_ms) { if (!updated_) { return current_bit_rate_; } updated_ = false; UpdateChangePeriod(now_ms); ChangeState(current_input_, now_ms); const float incoming_bit_rate_kbps = incoming_bit_rate / 1000.0f; const float std_max_bit_rate = sqrt(var_max_bit_rate_ * avg_max_bit_rate_); bool recovery = false; switch (rate_control_state_) { case kRcHold: { max_hold_rate_ = std::max(max_hold_rate_, incoming_bit_rate); break; } case kRcIncrease: { if (avg_max_bit_rate_ >= 0) { if (incoming_bit_rate_kbps > avg_max_bit_rate_ + 3 * std_max_bit_rate) { ChangeRegion(kRcMaxUnknown); avg_max_bit_rate_ = -1.0; } else if (incoming_bit_rate_kbps > avg_max_bit_rate_ + 2.5 * std_max_bit_rate) { ChangeRegion(kRcAboveMax); } } const int64_t response_time = static_cast<int64_t>(avg_change_period_ + 0.5f) + rtt_ + 300; double alpha = RateIncreaseFactor(now_ms, last_bit_rate_change_, response_time, noise_var); current_bit_rate = static_cast<uint32_t>(current_bit_rate * alpha) + 1000; if (max_hold_rate_ > 0 && beta_ * max_hold_rate_ > current_bit_rate) { current_bit_rate = static_cast<uint32_t>(beta_ * max_hold_rate_); avg_max_bit_rate_ = beta_ * max_hold_rate_ / 1000.0f; ChangeRegion(kRcNearMax); recovery = true; } max_hold_rate_ = 0; last_bit_rate_change_ = now_ms; break; } case kRcDecrease: { if (incoming_bit_rate < min_configured_bit_rate_) { current_bit_rate = min_configured_bit_rate_; } else { current_bit_rate = static_cast<uint32_t>(beta_ * incoming_bit_rate + 0.5); if (current_bit_rate > current_bit_rate_) { if (rate_control_region_ != kRcMaxUnknown) { current_bit_rate = static_cast<uint32_t>(beta_ * avg_max_bit_rate_ * 1000 + 0.5f); } current_bit_rate = std::min(current_bit_rate, current_bit_rate_); } ChangeRegion(kRcNearMax); if (incoming_bit_rate_kbps < avg_max_bit_rate_ - 3 * std_max_bit_rate) { avg_max_bit_rate_ = -1.0f; } UpdateMaxBitRateEstimate(incoming_bit_rate_kbps); } ChangeState(kRcHold); last_bit_rate_change_ = now_ms; break; } default: assert(false); } if (!recovery && (incoming_bit_rate > 100000 || current_bit_rate > 150000) && current_bit_rate > 1.5 * incoming_bit_rate) { current_bit_rate = current_bit_rate_; last_bit_rate_change_ = now_ms; } return current_bit_rate; } double MimdRateControl::RateIncreaseFactor(int64_t now_ms, int64_t last_ms, int64_t reaction_time_ms, double noise_var) const { const double B = 0.0407; const double b = 0.0025; const double c1 = -6700.0 / (33 * 33); const double c2 = 800.0; const double d = 0.85; double alpha = 1.005 + B / (1 + exp( b * (d * reaction_time_ms - (c1 * noise_var + c2)))); if (alpha < 1.005) { alpha = 1.005; } else if (alpha > 1.3) { alpha = 1.3; } if (last_ms > -1) { alpha = pow(alpha, (now_ms - last_ms) / 1000.0); } if (rate_control_region_ == kRcNearMax) { alpha = alpha - (alpha - 1.0) / 2.0; } else if (rate_control_region_ == kRcMaxUnknown) { alpha = alpha + (alpha - 1.0) * 2.0; } return alpha; } void MimdRateControl::UpdateChangePeriod(int64_t now_ms) { int64_t change_period = 0; if (last_change_ms_ > -1) { change_period = now_ms - last_change_ms_; } last_change_ms_ = now_ms; avg_change_period_ = 0.9f * avg_change_period_ + 0.1f * change_period; } void MimdRateControl::UpdateMaxBitRateEstimate(float incoming_bit_rate_kbps) { const float alpha = 0.05f; if (avg_max_bit_rate_ == -1.0f) { avg_max_bit_rate_ = incoming_bit_rate_kbps; } else { avg_max_bit_rate_ = (1 - alpha) * avg_max_bit_rate_ + alpha * incoming_bit_rate_kbps; } const float norm = std::max(avg_max_bit_rate_, 1.0f); var_max_bit_rate_ = (1 - alpha) * var_max_bit_rate_ + alpha * (avg_max_bit_rate_ - incoming_bit_rate_kbps) * (avg_max_bit_rate_ - incoming_bit_rate_kbps) / norm; if (var_max_bit_rate_ < 0.4f) { var_max_bit_rate_ = 0.4f; } if (var_max_bit_rate_ > 2.5f) { var_max_bit_rate_ = 2.5f; } } void MimdRateControl::ChangeState(const RateControlInput& input, int64_t now_ms) { switch (current_input_._bwState) { case kBwNormal: if (rate_control_state_ == kRcHold) { last_bit_rate_change_ = now_ms; ChangeState(kRcIncrease); } break; case kBwOverusing: if (rate_control_state_ != kRcDecrease) { ChangeState(kRcDecrease); } break; case kBwUnderusing: ChangeState(kRcHold); break; default: assert(false); } } void MimdRateControl::ChangeRegion(RateControlRegion region) { rate_control_region_ = region; switch (rate_control_region_) { case kRcAboveMax: case kRcMaxUnknown: beta_ = 0.9f; break; case kRcNearMax: beta_ = 0.95f; break; default: assert(false); } } void MimdRateControl::ChangeState(RateControlState new_state) { came_from_state_ = rate_control_state_; rate_control_state_ = new_state; } }
#include "webrtc/modules/remote_bitrate_estimator/mimd_rate_control.h" #include <algorithm> #include <cassert> #include <cmath> #include <cstring> namespace webrtc { const int64_t kDefaultRttMs = 200; const int64_t kLogIntervalMs = 1000; MimdRateControl::MimdRateControl(uint32_t min_bitrate_bps) : min_configured_bit_rate_(min_bitrate_bps), max_configured_bit_rate_(30000000), current_bit_rate_(max_configured_bit_rate_), max_hold_rate_(0), avg_max_bit_rate_(-1.0f), var_max_bit_rate_(0.4f), rate_control_state_(kRcHold), came_from_state_(kRcDecrease), rate_control_region_(kRcMaxUnknown), last_bit_rate_change_(-1), current_input_(kBwNormal, 0, 1.0), updated_(false), time_first_incoming_estimate_(-1), initialized_bit_rate_(false), avg_change_period_(1000.0f), last_change_ms_(-1), beta_(0.9f), rtt_(kDefaultRttMs), time_of_last_log_(-1) { } RateControlType MimdRateControl::GetControlType() const { return kMimdControl; } uint32_t MimdRateControl::GetMinBitrate() const { return min_configured_bit_rate_; } bool MimdRateControl::ValidEstimate() const { return initialized_bit_rate_; } int64_t MimdRateControl::GetFeedbackInterval() const { return kMaxFeedbackIntervalMs; } bool MimdRateControl::TimeToReduceFurther(int64_t time_now,
); const int bitrate_difference = LatestEstimate() - incoming_bitrate_bps; return bitrate_difference > threshold; } return false; } uint32_t MimdRateControl::LatestEstimate() const { return current_bit_rate_; } uint32_t MimdRateControl::UpdateBandwidthEstimate(int64_t now_ms) { current_bit_rate_ = ChangeBitRate(current_bit_rate_, current_input_._incomingBitRate, current_input_._noiseVar, now_ms); if (now_ms - time_of_last_log_ > kLogIntervalMs) { time_of_last_log_ = now_ms; } return current_bit_rate_; } void MimdRateControl::SetRtt(int64_t rtt) { rtt_ = rtt; } RateControlRegion MimdRateControl::Update(const RateControlInput* input, int64_t now_ms) { assert(input); if (!initialized_bit_rate_) { if (time_first_incoming_estimate_ < 0) { if (input->_incomingBitRate > 0) { time_first_incoming_estimate_ = now_ms; } } else if (now_ms - time_first_incoming_estimate_ > 500 && input->_incomingBitRate > 0) { current_bit_rate_ = input->_incomingBitRate; initialized_bit_rate_ = true; } } if (updated_ && current_input_._bwState == kBwOverusing) { current_input_._noiseVar = input->_noiseVar; current_input_._incomingBitRate = input->_incomingBitRate; return rate_control_region_; } updated_ = true; current_input_ = *input; return rate_control_region_; } void MimdRateControl::SetEstimate(int bitrate_bps, int64_t now_ms) { } uint32_t MimdRateControl::ChangeBitRate(uint32_t current_bit_rate, uint32_t incoming_bit_rate, double noise_var, int64_t now_ms) { if (!updated_) { return current_bit_rate_; } updated_ = false; UpdateChangePeriod(now_ms); ChangeState(current_input_, now_ms); const float incoming_bit_rate_kbps = incoming_bit_rate / 1000.0f; const float std_max_bit_rate = sqrt(var_max_bit_rate_ * avg_max_bit_rate_); bool recovery = false; switch (rate_control_state_) { case kRcHold: { max_hold_rate_ = std::max(max_hold_rate_, incoming_bit_rate); break; } case kRcIncrease: { if (avg_max_bit_rate_ >= 0) { if (incoming_bit_rate_kbps > avg_max_bit_rate_ + 3 * std_max_bit_rate) { ChangeRegion(kRcMaxUnknown); avg_max_bit_rate_ = -1.0; } else if (incoming_bit_rate_kbps > avg_max_bit_rate_ + 2.5 * std_max_bit_rate) { ChangeRegion(kRcAboveMax); } } const int64_t response_time = static_cast<int64_t>(avg_change_period_ + 0.5f) + rtt_ + 300; double alpha = RateIncreaseFactor(now_ms, last_bit_rate_change_, response_time, noise_var); current_bit_rate = static_cast<uint32_t>(current_bit_rate * alpha) + 1000; if (max_hold_rate_ > 0 && beta_ * max_hold_rate_ > current_bit_rate) { current_bit_rate = static_cast<uint32_t>(beta_ * max_hold_rate_); avg_max_bit_rate_ = beta_ * max_hold_rate_ / 1000.0f; ChangeRegion(kRcNearMax); recovery = true; } max_hold_rate_ = 0; last_bit_rate_change_ = now_ms; break; } case kRcDecrease: { if (incoming_bit_rate < min_configured_bit_rate_) { current_bit_rate = min_configured_bit_rate_; } else { current_bit_rate = static_cast<uint32_t>(beta_ * incoming_bit_rate + 0.5); if (current_bit_rate > current_bit_rate_) { if (rate_control_region_ != kRcMaxUnknown) { current_bit_rate = static_cast<uint32_t>(beta_ * avg_max_bit_rate_ * 1000 + 0.5f); } current_bit_rate = std::min(current_bit_rate, current_bit_rate_); } ChangeRegion(kRcNearMax); if (incoming_bit_rate_kbps < avg_max_bit_rate_ - 3 * std_max_bit_rate) { avg_max_bit_rate_ = -1.0f; } UpdateMaxBitRateEstimate(incoming_bit_rate_kbps); } ChangeState(kRcHold); last_bit_rate_change_ = now_ms; break; } default: assert(false); } if (!recovery && (incoming_bit_rate > 100000 || current_bit_rate > 150000) && current_bit_rate > 1.5 * incoming_bit_rate) { current_bit_rate = current_bit_rate_; last_bit_rate_change_ = now_ms; } return current_bit_rate; } double MimdRateControl::RateIncreaseFactor(int64_t now_ms, int64_t last_ms, int64_t reaction_time_ms, double noise_var) const { const double B = 0.0407; const double b = 0.0025; const double c1 = -6700.0 / (33 * 33); const double c2 = 800.0; const double d = 0.85; double alpha = 1.005 + B / (1 + exp( b * (d * reaction_time_ms - (c1 * noise_var + c2)))); if (alpha < 1.005) { alpha = 1.005; } else if (alpha > 1.3) { alpha = 1.3; } if (last_ms > -1) { alpha = pow(alpha, (now_ms - last_ms) / 1000.0); } if (rate_control_region_ == kRcNearMax) { alpha = alpha - (alpha - 1.0) / 2.0; } else if (rate_control_region_ == kRcMaxUnknown) { alpha = alpha + (alpha - 1.0) * 2.0; } return alpha; } void MimdRateControl::UpdateChangePeriod(int64_t now_ms) { int64_t change_period = 0; if (last_change_ms_ > -1) { change_period = now_ms - last_change_ms_; } last_change_ms_ = now_ms; avg_change_period_ = 0.9f * avg_change_period_ + 0.1f * change_period; } void MimdRateControl::UpdateMaxBitRateEstimate(float incoming_bit_rate_kbps) { const float alpha = 0.05f; if (avg_max_bit_rate_ == -1.0f) { avg_max_bit_rate_ = incoming_bit_rate_kbps; } else { avg_max_bit_rate_ = (1 - alpha) * avg_max_bit_rate_ + alpha * incoming_bit_rate_kbps; } const float norm = std::max(avg_max_bit_rate_, 1.0f); var_max_bit_rate_ = (1 - alpha) * var_max_bit_rate_ + alpha * (avg_max_bit_rate_ - incoming_bit_rate_kbps) * (avg_max_bit_rate_ - incoming_bit_rate_kbps) / norm; if (var_max_bit_rate_ < 0.4f) { var_max_bit_rate_ = 0.4f; } if (var_max_bit_rate_ > 2.5f) { var_max_bit_rate_ = 2.5f; } } void MimdRateControl::ChangeState(const RateControlInput& input, int64_t now_ms) { switch (current_input_._bwState) { case kBwNormal: if (rate_control_state_ == kRcHold) { last_bit_rate_change_ = now_ms; ChangeState(kRcIncrease); } break; case kBwOverusing: if (rate_control_state_ != kRcDecrease) { ChangeState(kRcDecrease); } break; case kBwUnderusing: ChangeState(kRcHold); break; default: assert(false); } } void MimdRateControl::ChangeRegion(RateControlRegion region) { rate_control_region_ = region; switch (rate_control_region_) { case kRcAboveMax: case kRcMaxUnknown: beta_ = 0.9f; break; case kRcNearMax: beta_ = 0.95f; break; default: assert(false); } } void MimdRateControl::ChangeState(RateControlState new_state) { came_from_state_ = rate_control_state_; rate_control_state_ = new_state; } }
uint32_t incoming_bitrate_bps) const { const int64_t bitrate_reduction_interval = std::max<int64_t>(std::min<int64_t>(rtt_, 200), 10); if (time_now - last_bit_rate_change_ >= bitrate_reduction_interval) { return true; } if (ValidEstimate()) { const int threshold = static_cast<int>(1.05 * incoming_bitrate_bps
function_block-random_span
[ { "content": "namespace webrtc {\n\n\n\n// Supported video types.\n\nenum VideoType {\n\n kUnknown,\n\n kI420,\n\n kIYUV,\n\n kRGB24,\n\n kABGR,\n\n kARGB,\n\n kARGB4444,\n\n kRGB565,\n\n kARGB1555,\n\n kYUY2,\n\n kYV12,\n\n kUYVY,\n\n kMJPG,\n\n kNV21,\n\n kNV12,\n\n kBGRA,\n\n};\n\n\n\n// This is the max PSNR value our algorithms can return.\n\nconst double kPerfectPSNR = 48.0f;\n\n\n\n// Conversion between the RawVideoType and the LibYuv videoType.\n\n// TODO(wu): Consolidate types into one type throughout WebRtc.\n\nVideoType RawVideoTypeToCommonVideoVideoType(RawVideoType type);\n\n\n\n// Supported rotation\n\n// Direction of rotation - clockwise.\n\nenum VideoRotationMode {\n\n kRotateNone = 0,\n\n kRotate90 = 90,\n\n kRotate180 = 180,\n\n kRotate270 = 270,\n\n};\n\n\n\n// Align integer values.\n\n// Input:\n\n// - value : Input value to be aligned.\n\n// - alignment : Alignment basis (power of 2).\n\n// Return value: An aligned form of the input value.\n\nint AlignInt(int value, int alignment);\n\n\n\n// Align stride values for I420 Video frames.\n\n// Input:\n\n// - width : Image width.\n\n// - stride_y : Pointer to the stride of the y plane.\n\n// - stride_uv: Pointer to the stride of the u and v planes (setting identical\n\n// values for both).\n\n// Setting 16 byte alignment.\n\nvoid Calc16ByteAlignedStride(int width, int* stride_y, int* stride_uv);\n\n\n\n// Calculate the required buffer size.\n\n// Input:\n\n// - type :The type of the designated video frame.\n\n// - width :frame width in pixels.\n\n// - height :frame height in pixels.\n\n// Return value: :The required size in bytes to accommodate the specified\n\n// video frame.\n\nsize_t CalcBufferSize(VideoType type, int width, int height);\n\n\n\n// TODO(mikhal): Add unit test for these two functions and determine location.\n\n// Print I420VideoFrame to file\n\n// Input:\n\n// - frame : Reference to video frame.\n\n// - file : pointer to file object. It is assumed that the file is\n\n// already open for writing.\n\n// Return value: 0 if OK, < 0 otherwise.\n\nint PrintI420VideoFrame(const I420VideoFrame& frame, FILE* file);\n\n\n\n// Extract buffer from I420VideoFrame (consecutive planes, no stride)\n\n// Input:\n\n// - frame : Reference to video frame.\n\n// - size : pointer to the size of the allocated buffer. If size is\n\n// insufficient, an error will be returned.\n\n// - buffer : Pointer to buffer\n\n// Return value: length of buffer if OK, < 0 otherwise.\n\nint ExtractBuffer(const I420VideoFrame& input_frame,\n\n size_t size, uint8_t* buffer);\n\n// Convert To I420\n\n// Input:\n\n// - src_video_type : Type of input video.\n\n// - src_frame : Pointer to a source frame.\n\n// - crop_x/crop_y : Starting positions for cropping (0 for no crop).\n\n// - src_width : src width in pixels.\n\n// - src_height : src height in pixels.\n\n// - sample_size : Required only for the parsing of MJPG (set to 0 else).\n\n// - rotate : Rotation mode of output image.\n\n// Output:\n\n// - dst_frame : Reference to a destination frame.\n\n// Return value: 0 if OK, < 0 otherwise.\n\n\n\nint ConvertToI420(VideoType src_video_type,\n\n const uint8_t* src_frame,\n\n int crop_x, int crop_y,\n\n int src_width, int src_height,\n\n size_t sample_size,\n\n VideoRotationMode rotation,\n\n I420VideoFrame* dst_frame);\n\n\n\n// Convert From I420\n\n// Input:\n\n// - src_frame : Reference to a source frame.\n\n// - dst_video_type : Type of output video.\n\n// - dst_sample_size : Required only for the parsing of MJPG.\n\n// - dst_frame : Pointer to a destination frame.\n\n// Return value: 0 if OK, < 0 otherwise.\n\n// It is assumed that source and destination have equal height.\n\nint ConvertFromI420(const I420VideoFrame& src_frame,\n\n VideoType dst_video_type, int dst_sample_size,\n\n uint8_t* dst_frame);\n\n// ConvertFrom YV12.\n\n// Interface - same as above.\n\nint ConvertFromYV12(const I420VideoFrame& src_frame,\n\n VideoType dst_video_type, int dst_sample_size,\n\n uint8_t* dst_frame);\n\n\n\n// The following list describes designated conversion functions which\n\n// are not covered by the previous general functions.\n\n// Input and output descriptions mostly match the above descriptions, and are\n\n// therefore omitted.\n\nint ConvertRGB24ToARGB(const uint8_t* src_frame,\n\n uint8_t* dst_frame,\n\n int width, int height,\n\n int dst_stride);\n\nint ConvertNV12ToRGB565(const uint8_t* src_frame,\n\n uint8_t* dst_frame,\n\n int width, int height);\n\n\n\n// Mirror functions\n\n// The following 2 functions perform mirroring on a given image\n\n// (LeftRight/UpDown).\n\n// Input:\n\n// - src_frame : Pointer to a source frame.\n\n// - dst_frame : Pointer to a destination frame.\n\n// Return value: 0 if OK, < 0 otherwise.\n\n// It is assumed that src and dst frames have equal dimensions.\n\nint MirrorI420LeftRight(const I420VideoFrame* src_frame,\n\n I420VideoFrame* dst_frame);\n\nint MirrorI420UpDown(const I420VideoFrame* src_frame,\n\n I420VideoFrame* dst_frame);\n\n\n\n// Compute PSNR for an I420 frame (all planes).\n\n// Returns the PSNR in decibel, to a maximum of kInfinitePSNR.\n\ndouble I420PSNR(const I420VideoFrame* ref_frame,\n\n const I420VideoFrame* test_frame);\n\n// Compute SSIM for an I420 frame (all planes).\n\ndouble I420SSIM(const I420VideoFrame* ref_frame,\n\n const I420VideoFrame* test_frame);\n", "file_path": "common_video/libyuv/include/webrtc_libyuv.h", "rank": 0, "score": 190567.4099094316 }, { "content": "namespace webrtc {\n\n\n\ntypedef std::numeric_limits<int16_t> limits_int16;\n\n\n\n// The conversion functions use the following naming convention:\n\n// S16: int16_t [-32768, 32767]\n\n// Float: float [-1.0, 1.0]\n\n// FloatS16: float [-32768.0, 32767.0]\n\nstatic inline int16_t FloatToS16(float v) {\n\n if (v > 0)\n\n return v >= 1 ? limits_int16::max() :\n\n static_cast<int16_t>(v * limits_int16::max() + 0.5f);\n\n return v <= -1 ? limits_int16::min() :\n\n static_cast<int16_t>(-v * limits_int16::min() - 0.5f);\n\n}\n\n\n\nstatic inline float S16ToFloat(int16_t v) {\n\n static const float kMaxInt16Inverse = 1.f / limits_int16::max();\n\n static const float kMinInt16Inverse = 1.f / limits_int16::min();\n\n return v * (v > 0 ? kMaxInt16Inverse : -kMinInt16Inverse);\n\n}\n\n\n\nstatic inline int16_t FloatS16ToS16(float v) {\n\n static const float kMaxRound = limits_int16::max() - 0.5f;\n\n static const float kMinRound = limits_int16::min() + 0.5f;\n\n if (v > 0)\n\n return v >= kMaxRound ? limits_int16::max() :\n\n static_cast<int16_t>(v + 0.5f);\n\n return v <= kMinRound ? limits_int16::min() :\n\n static_cast<int16_t>(v - 0.5f);\n\n}\n\n\n\nstatic inline float FloatToFloatS16(float v) {\n\n return v * (v > 0 ? limits_int16::max() : -limits_int16::min());\n\n}\n\n\n\nstatic inline float FloatS16ToFloat(float v) {\n\n static const float kMaxInt16Inverse = 1.f / limits_int16::max();\n\n static const float kMinInt16Inverse = 1.f / limits_int16::min();\n\n return v * (v > 0 ? kMaxInt16Inverse : -kMinInt16Inverse);\n\n}\n\n\n\nvoid FloatToS16(const float* src, size_t size, int16_t* dest);\n\nvoid S16ToFloat(const int16_t* src, size_t size, float* dest);\n\nvoid FloatS16ToS16(const float* src, size_t size, int16_t* dest);\n\nvoid FloatToFloatS16(const float* src, size_t size, float* dest);\n\nvoid FloatS16ToFloat(const float* src, size_t size, float* dest);\n\n\n\n// Deinterleave audio from |interleaved| to the channel buffers pointed to\n\n// by |deinterleaved|. There must be sufficient space allocated in the\n\n// |deinterleaved| buffers (|num_channel| buffers with |samples_per_channel|\n\n// per buffer).\n\ntemplate <typename T>\n\nvoid Deinterleave(const T* interleaved, int samples_per_channel,\n\n int num_channels, T* const* deinterleaved) {\n\n for (int i = 0; i < num_channels; ++i) {\n\n T* channel = deinterleaved[i];\n\n int interleaved_idx = i;\n\n for (int j = 0; j < samples_per_channel; ++j) {\n\n channel[j] = interleaved[interleaved_idx];\n\n interleaved_idx += num_channels;\n\n }\n\n }\n\n}\n\n\n\n// Interleave audio from the channel buffers pointed to by |deinterleaved| to\n\n// |interleaved|. There must be sufficient space allocated in |interleaved|\n\n// (|samples_per_channel| * |num_channels|).\n\ntemplate <typename T>\n\nvoid Interleave(const T* const* deinterleaved, int samples_per_channel,\n\n int num_channels, T* interleaved) {\n\n for (int i = 0; i < num_channels; ++i) {\n\n const T* channel = deinterleaved[i];\n\n int interleaved_idx = i;\n\n for (int j = 0; j < samples_per_channel; ++j) {\n\n interleaved[interleaved_idx] = channel[j];\n\n interleaved_idx += num_channels;\n\n }\n\n }\n\n}\n\n\n", "file_path": "common_audio/include/audio_util.h", "rank": 1, "score": 177111.838055188 }, { "content": "namespace webrtc {\n\n\n\n// Ratio allocation between temporal streams:\n\n// Values as required for the VP8 codec (accumulating).\n\nstatic const float\n\n kVp8LayerRateAlloction[kMaxTemporalStreams][kMaxTemporalStreams] = {\n\n {1.0f, 1.0f, 1.0f, 1.0f}, // 1 layer\n\n {0.6f, 1.0f, 1.0f, 1.0f}, // 2 layers {60%, 40%}\n\n {0.4f, 0.6f, 1.0f, 1.0f}, // 3 layers {40%, 20%, 40%}\n\n {0.25f, 0.4f, 0.6f, 1.0f} // 4 layers {25%, 15%, 20%, 40%}\n\n};\n\n\n", "file_path": "modules/video_coding/codecs/vp8/include/vp8_common_types.h", "rank": 2, "score": 166140.18151066202 }, { "content": "// External transport implementation for testing purposes.\n\n// A packet loss probability must be set in order to drop packets from the data\n\n// being sent to this class.\n\n// Will never drop packets from the first frame of a video sequence.\n\nclass TbExternalTransport : public webrtc::Transport\n\n{\n\npublic:\n\n typedef std::map<unsigned int, unsigned int> SsrcChannelMap;\n\n\n\n TbExternalTransport(webrtc::ViENetwork& vieNetwork,\n\n int sender_channel,\n\n TbExternalTransport::SsrcChannelMap* receive_channels);\n\n ~TbExternalTransport(void);\n\n\n\n virtual int SendPacket(int channel, const void *data, size_t len) OVERRIDE;\n\n virtual int SendRTCPPacket(int channel,\n\n const void *data,\n\n size_t len) OVERRIDE;\n\n\n\n // Should only be called before/after traffic is being processed.\n\n // Only one observer can be set (multiple calls will overwrite each other).\n\n virtual void RegisterSendFrameCallback(SendFrameCallback* callback);\n\n\n\n // Should only be called before/after traffic is being processed.\n", "file_path": "video_engine/test/libvietest/include/tb_external_transport.h", "rank": 3, "score": 139394.99916344974 }, { "content": "class TbI420Decoder: public webrtc::VideoDecoder\n\n{\n\npublic:\n\n TbI420Decoder();\n\n virtual ~TbI420Decoder();\n\n\n\n virtual int32_t InitDecode(const webrtc::VideoCodec* inst,\n\n int32_t numberOfCores) OVERRIDE;\n\n virtual int32_t Decode(\n\n const webrtc::EncodedImage& inputImage,\n\n bool missingFrames,\n\n const webrtc::RTPFragmentationHeader* fragmentation,\n\n const webrtc::CodecSpecificInfo* codecSpecificInfo = NULL,\n\n int64_t renderTimeMs = -1) OVERRIDE;\n\n\n\n virtual int32_t RegisterDecodeCompleteCallback(\n\n webrtc::DecodedImageCallback* callback) OVERRIDE;\n\n virtual int32_t Release() OVERRIDE;\n\n virtual int32_t Reset() OVERRIDE;\n\n\n", "file_path": "video_engine/test/libvietest/include/tb_I420_codec.h", "rank": 4, "score": 137066.18786720332 }, { "content": "class TbI420Encoder: public webrtc::VideoEncoder\n\n{\n\npublic:\n\n TbI420Encoder();\n\n virtual ~TbI420Encoder();\n\n\n\n virtual int32_t InitEncode(const webrtc::VideoCodec* codecSettings,\n\n int32_t numberOfCores,\n\n size_t maxPayloadSize) OVERRIDE;\n\n\n\n virtual int32_t Encode(\n\n const webrtc::I420VideoFrame& inputImage,\n\n const webrtc::CodecSpecificInfo* codecSpecificInfo,\n\n const std::vector<webrtc::VideoFrameType>* frameTypes) OVERRIDE;\n\n\n\n virtual int32_t RegisterEncodeCompleteCallback(\n\n webrtc::EncodedImageCallback* callback) OVERRIDE;\n\n\n\n virtual int32_t Release() OVERRIDE;\n\n\n", "file_path": "video_engine/test/libvietest/include/tb_I420_codec.h", "rank": 5, "score": 137066.18786720332 }, { "content": "class ViEToFileRenderer: public webrtc::ExternalRenderer {\n\n public:\n\n ViEToFileRenderer();\n\n virtual ~ViEToFileRenderer();\n\n\n\n // Returns false if we fail opening the output filename for writing.\n\n bool PrepareForRendering(const std::string& output_path,\n\n const std::string& output_filename);\n\n\n\n // Closes the output file.\n\n void StopRendering();\n\n\n\n // Deletes the closed output file from the file system. This is one option\n\n // after calling StopRendering, the other being KeepOutputFile. This file\n\n // renderer will forget about the file after this call and can be used again.\n\n bool DeleteOutputFile();\n\n\n\n // Renames the closed output file to its previous name with the provided\n\n // prefix prepended. This file renderer will forget about the file after this\n\n // call and can be used again.\n", "file_path": "video_engine/test/libvietest/include/vie_to_file_renderer.h", "rank": 6, "score": 134837.2739212349 }, { "content": "// A render filter which passes frames directly to an external renderer. This\n\n// is different from plugging the external renderer directly into the sending\n\n// side since this will only run on frames that actually get sent and not on\n\n// frames that only get captured.\n\nclass ExternalRendererEffectFilter : public webrtc::ViEEffectFilter {\n\n public:\n\n explicit ExternalRendererEffectFilter(webrtc::ExternalRenderer* renderer)\n\n : width_(0), height_(0), renderer_(renderer) {}\n\n virtual ~ExternalRendererEffectFilter() {}\n\n virtual int Transform(size_t size,\n\n unsigned char* frame_buffer,\n\n int64_t ntp_time_ms,\n\n unsigned int timestamp,\n\n unsigned int width,\n\n unsigned int height) {\n\n if (width != width_ || height_ != height) {\n\n renderer_->FrameSizeChange(width, height, 1);\n\n width_ = width;\n\n height_ = height;\n\n }\n\n return renderer_->DeliverFrame(frame_buffer,\n\n size,\n\n ntp_time_ms,\n\n timestamp,\n", "file_path": "video_engine/test/libvietest/include/vie_external_render_filter.h", "rank": 7, "score": 128689.52372671796 }, { "content": "namespace webrtc {\n\nstruct RemoteBitrateEstimatorMinRate {\n\n RemoteBitrateEstimatorMinRate() : min_rate(30000) {}\n\n RemoteBitrateEstimatorMinRate(uint32_t min_rate) : min_rate(min_rate) {}\n\n\n\n uint32_t min_rate;\n", "file_path": "experiments.h", "rank": 8, "score": 123947.7768592631 }, { "content": "namespace webrtc {\n\n\n\nstruct SsrcStats {\n\n SsrcStats()\n\n : sent_width(0),\n\n sent_height(0),\n\n total_bitrate_bps(0),\n\n retransmit_bitrate_bps(0),\n\n avg_delay_ms(0),\n\n max_delay_ms(0) {}\n\n FrameCounts frame_counts;\n\n int sent_width;\n\n int sent_height;\n\n // TODO(holmer): Move bitrate_bps out to the webrtc::Call layer.\n\n int total_bitrate_bps;\n\n int retransmit_bitrate_bps;\n\n int avg_delay_ms;\n\n int max_delay_ms;\n\n StreamDataCounters rtp_stats;\n\n RtcpStatistics rtcp_stats;\n\n};\n\n\n\n// Settings for NACK, see RFC 4585 for details.\n\nstruct NackConfig {\n\n NackConfig() : rtp_history_ms(0) {}\n\n // Send side: the time RTP packets are stored for retransmissions.\n\n // Receive side: the time the receiver is prepared to wait for\n\n // retransmissions.\n\n // Set to '0' to disable.\n\n int rtp_history_ms;\n", "file_path": "config.h", "rank": 9, "score": 123947.7768592631 }, { "content": "namespace webrtc {\n\nnamespace test {\n\n\n\n// Parses enabled field trials from a string config, such as the one passed\n\n// to chrome's argument --force-fieldtrials and initializes webrtc::field_trial\n\n// with such a config.\n\n// E.g.:\n\n// \"WebRTC-experimentFoo/Enabled/WebRTC-experimentBar/Enabled100kbps/\"\n\n// Assigns the process to group \"Enabled\" on WebRTCExperimentFoo trial\n\n// and to group \"Enabled100kbps\" on WebRTCExperimentBar.\n\n//\n\n// E.g. invalid config:\n\n// \"WebRTC-experiment1/Enabled\" (note missing / separator at the end).\n\n//\n\n// Note: This method crashes with an error message if an invalid config is\n\n// passed to it. That can be used to find out if a binary is parsing the flags.\n\nvoid InitFieldTrialsFromString(const std::string& config);\n\n\n\n} // namespace test\n", "file_path": "test/field_trial.h", "rank": 10, "score": 120413.17615680624 }, { "content": "namespace webrtc {\n\nnamespace test {\n\nstd::vector<VideoStream> CreateVideoStreams(size_t num_streams);\n\n\n\nVideoReceiveStream::Decoder CreateMatchingDecoder(\n\n const VideoSendStream::Config::EncoderSettings& encoder_settings);\n\n} // namespace test\n", "file_path": "test/encoder_settings.h", "rank": 11, "score": 120413.17615680624 }, { "content": "namespace webrtc {\n\nnamespace test {\n\n\n\n// Running a test function on a separate thread, if required by the OS.\n\nvoid RunTest(void(*test)());\n\n\n\n} // namespace test\n", "file_path": "test/run_test.h", "rank": 12, "score": 120413.17615680624 }, { "content": "namespace webrtc {\n\n\n\n// enum for clockwise rotation.\n\nenum VideoRotation {\n\n kVideoRotation_0 = 0,\n\n kVideoRotation_90 = 90,\n\n kVideoRotation_180 = 180,\n\n kVideoRotation_270 = 270\n\n};\n\n\n", "file_path": "common_video/rotation.h", "rank": 13, "score": 120413.17615680624 }, { "content": "namespace webrtc {\n\nnamespace test {\n\n\n\n// Blocks until the user presses enter.\n\nvoid PressEnterToContinue();\n\n\n\n} // namespace test\n", "file_path": "test/run_loop.h", "rank": 14, "score": 120413.17615680624 }, { "content": "namespace webrtc {\n\nnamespace test {\n\n\n\n// This is the \"directory\" returned if the ProjectPath() function fails\n\n// to find the project root.\n\nextern const char* kCannotFindProjectRootDir;\n\n\n\n// Finds the root dir of the project, to be able to set correct paths to\n\n// resource files used by tests.\n\n// The implementation is simple: it just looks for the file defined by\n\n// kProjectRootFileName, starting in the current directory (the working\n\n// directory) and then steps upward until it is found (or it is at the root of\n\n// the file system).\n\n// If the current working directory is above the project root dir, it will not\n\n// be found.\n\n//\n\n// If symbolic links occur in the path they will be resolved and the actual\n\n// directory will be returned.\n\n//\n\n// Returns the absolute path to the project root dir (usually the trunk dir)\n\n// WITH a trailing path delimiter.\n\n// If the project root is not found, the string specified by\n\n// kCannotFindProjectRootDir is returned.\n\nstd::string ProjectRootPath();\n\n\n\n// Creates and returns the absolute path to the output directory where log files\n\n// and other test artifacts should be put. The output directory is generally a\n\n// directory named \"out\" at the top-level of the project, i.e. a subfolder to\n\n// the path returned by ProjectRootPath(). The exception is Android where we use\n\n// /sdcard/ instead.\n\n//\n\n// Details described for ProjectRootPath() apply here too.\n\n//\n\n// Returns the path WITH a trailing path delimiter. If the project root is not\n\n// found, the current working directory (\"./\") is returned as a fallback.\n\nstd::string OutputPath();\n\n\n\n// Generates an empty file with a unique name in the specified directory and\n\n// returns the file name and path.\n\nstd::string TempFilename(const std::string &dir, const std::string &prefix);\n\n\n\n// Returns a path to a resource file for the currently executing platform.\n\n// Adapts to what filenames are currently present in the\n\n// [project-root]/resources/ dir.\n\n// Returns an absolute path according to this priority list (the directory\n\n// part of the path is left out for readability):\n\n// 1. [name]_[platform]_[architecture].[extension]\n\n// 2. [name]_[platform].[extension]\n\n// 3. [name]_[architecture].[extension]\n\n// 4. [name].[extension]\n\n// Where\n\n// * platform is either of \"win\", \"mac\" or \"linux\".\n\n// * architecture is either of \"32\" or \"64\".\n\n//\n\n// Arguments:\n\n// name - Name of the resource file. If a plain filename (no directory path)\n\n// is supplied, the file is assumed to be located in resources/\n\n// If a directory path is prepended to the filename, a subdirectory\n\n// hierarchy reflecting that path is assumed to be present.\n\n// extension - File extension, without the dot, i.e. \"bmp\" or \"yuv\".\n\nstd::string ResourcePath(std::string name, std::string extension);\n\n\n\n// Gets the current working directory for the executing program.\n\n// Returns \"./\" if for some reason it is not possible to find the working\n\n// directory.\n\nstd::string WorkingDir();\n\n\n\n// Creates a directory if it not already exists.\n\n// Returns true if successful. Will print an error message to stderr and return\n\n// false if a file with the same name already exists.\n\nbool CreateDir(std::string directory_name);\n\n\n\n// Checks if a file exists.\n\nbool FileExists(std::string& file_name);\n\n\n\n// File size of the supplied file in bytes. Will return 0 if the file is\n\n// empty or if the file does not exist/is readable.\n\nsize_t GetFileSize(std::string filename);\n\n\n\n// Sets the executable path, i.e. the path to the executable that is being used\n\n// when launching it. This is usually the path relative to the working directory\n\n// but can also be an absolute path. The intention with this function is to pass\n\n// the argv[0] being sent into the main function to make it possible for\n\n// fileutils.h to find the correct project paths even when the working directory\n\n// is outside the project tree (which happens in some cases).\n\nvoid SetExecutablePath(const std::string& path_to_executable);\n\n\n\n} // namespace test\n", "file_path": "test/testsupport/fileutils.h", "rank": 15, "score": 120413.17615680624 }, { "content": "// VoiceEngine\n\nclass WEBRTC_DLLEXPORT VoiceEngine\n\n{\n\npublic:\n\n // Creates a VoiceEngine object, which can then be used to acquire\n\n // sub-APIs. Returns NULL on failure.\n\n static VoiceEngine* Create();\n\n static VoiceEngine* Create(const Config& config);\n\n\n\n // Deletes a created VoiceEngine object and releases the utilized resources.\n\n // Note that if there are outstanding references held via other interfaces,\n\n // the voice engine instance will not actually be deleted until those\n\n // references have been released.\n\n static bool Delete(VoiceEngine*& voiceEngine);\n\n\n\n // Specifies the amount and type of trace information which will be\n\n // created by the VoiceEngine.\n\n static int SetTraceFilter(unsigned int filter);\n\n\n\n // Sets the name of the trace file and enables non-encrypted trace messages.\n\n static int SetTraceFile(const char* fileNameUTF8,\n", "file_path": "voice_engine/include/voe_base.h", "rank": 16, "score": 119657.12057155275 }, { "content": "class WEBRTC_DLLEXPORT VideoEngine {\n\n public:\n\n // Creates a VideoEngine object, which can then be used to acquire sub‐APIs.\n\n static VideoEngine* Create();\n\n static VideoEngine* Create(const Config& config);\n\n\n\n // Deletes a VideoEngine instance.\n\n static bool Delete(VideoEngine*& video_engine);\n\n\n\n // Specifies the amount and type of trace information, which will be created\n\n // by the VideoEngine.\n\n static int SetTraceFilter(const unsigned int filter);\n\n\n\n // Sets the name of the trace file and enables non‐encrypted trace messages.\n\n static int SetTraceFile(const char* file_nameUTF8,\n\n const bool add_file_counter = false);\n\n\n\n // Installs the TraceCallback implementation to ensure that the VideoEngine\n\n // user receives callbacks for generated trace messages.\n\n static int SetTraceCallback(TraceCallback* callback);\n\n\n\n protected:\n\n VideoEngine() {}\n\n virtual ~VideoEngine() {}\n\n};\n\n\n", "file_path": "video_engine/include/vie_base.h", "rank": 17, "score": 119657.12057155275 }, { "content": "namespace webrtc {\n\n\n\n// This function sleeps for the specified number of milliseconds.\n\n// It may return early if the thread is woken by some other event,\n\n// such as the delivery of a signal on Unix.\n\nvoid SleepMs(int msecs);\n\n\n", "file_path": "system_wrappers/interface/sleep.h", "rank": 18, "score": 118783.14510260249 }, { "content": "namespace webrtc {\n\nnamespace test {\n\n\n\n// Prints numerical information to stdout in a controlled format, for\n\n// post-processing. |measurement| is a description of the quantity being\n\n// measured, e.g. \"vm_peak\"; |modifier| is provided as a convenience and\n\n// will be appended directly to the name of the |measurement|, e.g.\n\n// \"_browser\"; |trace| is a description of the particular data point, e.g.\n\n// \"reference\"; |value| is the measured value; and |units| is a description\n\n// of the units of measure, e.g. \"bytes\". If |important| is true, the output\n\n// line will be specially marked, to notify the post-processor. The strings\n\n// may be empty. They should not contain any colons (:) or equals signs (=).\n\n// A typical post-processing step would be to produce graphs of the data\n\n// produced for various builds, using the combined |measurement| + |modifier|\n\n// string to specify a particular graph and the |trace| to identify a trace\n\n// (i.e., data series) on that graph.\n\nvoid PrintResult(const std::string& measurement,\n\n const std::string& modifier,\n\n const std::string& trace,\n\n size_t value,\n\n const std::string& units,\n\n bool important);\n\n\n\nvoid AppendResult(std::string& output,\n\n const std::string& measurement,\n\n const std::string& modifier,\n\n const std::string& trace,\n\n size_t value,\n\n const std::string& units,\n\n bool important);\n\n\n\n// Like the above version of PrintResult(), but takes a std::string value\n\n// instead of a size_t.\n\nvoid PrintResult(const std::string& measurement,\n\n const std::string& modifier,\n\n const std::string& trace,\n\n const std::string& value,\n\n const std::string& units,\n\n bool important);\n\n\n\nvoid AppendResult(std::string& output,\n\n const std::string& measurement,\n\n const std::string& modifier,\n\n const std::string& trace,\n\n const std::string& value,\n\n const std::string& units,\n\n bool important);\n\n\n\n// Like PrintResult(), but prints a (mean, standard deviation) result pair.\n\n// The |<values>| should be two comma-separated numbers, the mean and\n\n// standard deviation (or other error metric) of the measurement.\n\nvoid PrintResultMeanAndError(const std::string& measurement,\n\n const std::string& modifier,\n\n const std::string& trace,\n\n const std::string& mean_and_error,\n\n const std::string& units,\n\n bool important);\n\n\n\nvoid AppendResultMeanAndError(std::string& output,\n\n const std::string& measurement,\n\n const std::string& modifier,\n\n const std::string& trace,\n\n const std::string& mean_and_error,\n\n const std::string& units,\n\n bool important);\n\n\n\n// Like PrintResult(), but prints an entire list of results. The |values|\n\n// will generally be a list of comma-separated numbers. A typical\n\n// post-processing step might produce plots of their mean and standard\n\n// deviation.\n\nvoid PrintResultList(const std::string& measurement,\n\n const std::string& modifier,\n\n const std::string& trace,\n\n const std::string& values,\n\n const std::string& units,\n\n bool important);\n\n\n\nvoid AppendResultList(std::string& output,\n\n const std::string& measurement,\n\n const std::string& modifier,\n\n const std::string& trace,\n\n const std::string& values,\n\n const std::string& units,\n\n bool important);\n\n\n\n// Prints memory commit charge stats for use by perf graphs.\n\nvoid PrintSystemCommitCharge(const std::string& test_name,\n\n size_t charge,\n\n bool important);\n\n\n\nvoid PrintSystemCommitCharge(FILE* target,\n\n const std::string& test_name,\n\n size_t charge,\n\n bool important);\n\n\n\nstd::string SystemCommitChargeToString(const std::string& test_name,\n\n size_t charge,\n\n bool important);\n\n\n\n} // namespace test\n", "file_path": "test/testsupport/perf_test.h", "rank": 19, "score": 118783.14510260249 }, { "content": "namespace webrtc {\n\n\n\nenum Type {\n\n TYPE_Word8,\n\n TYPE_UWord8,\n\n TYPE_Word16,\n\n TYPE_UWord16,\n\n TYPE_Word32,\n\n TYPE_UWord32,\n\n TYPE_Word64,\n\n TYPE_UWord64,\n\n TYPE_Float32,\n\n TYPE_Float64\n\n};\n\n\n\n// Sorts intrinsic data types.\n\n//\n\n// data [in/out] A pointer to an array of intrinsic type.\n\n// Upon return it will be sorted in ascending order.\n\n// num_of_elements The number of elements in the array.\n\n// data_type Enum corresponding to the type of the array.\n\n//\n\n// returns 0 on success, -1 on failure.\n\nint32_t Sort(void* data, uint32_t num_of_elements, Type data_type);\n\n\n\n// Sorts arbitrary data types. This requires an array of intrinsically typed\n\n// key values which will be used to sort the data array. There must be a\n\n// one-to-one correspondence between data elements and key elements, with\n\n// corresponding elements sharing the same position in their respective\n\n// arrays.\n\n//\n\n// data [in/out] A pointer to an array of arbitrary type.\n\n// Upon return it will be sorted in ascending order.\n\n// key [in] A pointer to an array of keys used to sort the\n\n// data array.\n\n// num_of_elements The number of elements in the arrays.\n\n// size_of_element The size, in bytes, of the data array.\n\n// key_type Enum corresponding to the type of the key array.\n\n//\n\n// returns 0 on success, -1 on failure.\n\n//\n\nint32_t KeySort(void* data, void* key, uint32_t num_of_elements,\n\n uint32_t size_of_element, Type key_type);\n\n\n", "file_path": "system_wrappers/interface/sort.h", "rank": 20, "score": 118783.14510260249 }, { "content": "namespace webrtc {\n\n\n\n// General\n\nenum { kViEMinKeyRequestIntervalMs = 300 };\n\n\n\n// ViEBase\n\nenum { kViEMaxNumberOfChannels = 64 };\n\n\n\n// ViECapture\n\nenum { kViEMaxCaptureDevices = 256 };\n\nenum { kViECaptureDefaultWidth = 352 };\n\nenum { kViECaptureDefaultHeight = 288 };\n\nenum { kViECaptureDefaultFramerate = 30 };\n\nenum { kViECaptureMaxSnapshotWaitTimeMs = 500 };\n\n\n\n// ViECodec\n\nenum { kViEMaxCodecWidth = 4096 };\n\nenum { kViEMaxCodecHeight = 3072 };\n\nenum { kViEMaxCodecFramerate = 60 };\n\nenum { kViEMinCodecBitrate = 30 };\n\n\n\n// ViENetwork\n\nenum { kViEMaxMtu = 1500 };\n\nenum { kViESocketThreads = 1 };\n\nenum { kViENumReceiveSocketBuffers = 500 };\n\n\n\n// ViERender\n\n// Max valid time set in SetRenderTimeoutImage\n\nenum { kViEMaxRenderTimeoutTimeMs = 10000 };\n\n// Min valid time set in SetRenderTimeoutImage\n\nenum { kViEMinRenderTimeoutTimeMs = 33 };\n\nenum { kViEDefaultRenderDelayMs = 10 };\n\n\n\n// ViERTP_RTCP\n\nenum { kSendSidePacketHistorySize = 600 };\n\n\n\n// NACK\n\nenum { kMaxPacketAgeToNack = 450 }; // In sequence numbers.\n\nenum { kMaxNackListSize = 250 };\n\n\n\n// Id definitions\n\nenum {\n\n kViEChannelIdBase = 0x0,\n\n kViEChannelIdMax = 0xFF,\n\n kViECaptureIdBase = 0x1001,\n\n kViECaptureIdMax = 0x10FF,\n\n kViEDummyChannelId = 0xFFFF\n\n};\n\n\n\n// Module id\n\n// Create a unique id based on the ViE instance id and the\n\n// channel id. ViE id > 0 and 0 <= channel id <= 255\n\n\n\ninline int ViEId(const int vieId, const int channelId = -1) {\n\n if (channelId == -1) {\n\n return static_cast<int>((vieId << 16) + kViEDummyChannelId);\n\n }\n\n return static_cast<int>((vieId << 16) + channelId);\n", "file_path": "video_engine/vie_defines.h", "rank": 21, "score": 118783.14510260249 }, { "content": "namespace webrtc {\n\n\n\nstatic inline int ChannelsFromLayout(AudioProcessing::ChannelLayout layout) {\n\n switch (layout) {\n\n case AudioProcessing::kMono:\n\n case AudioProcessing::kMonoAndKeyboard:\n\n return 1;\n\n case AudioProcessing::kStereo:\n\n case AudioProcessing::kStereoAndKeyboard:\n\n return 2;\n\n }\n\n assert(false);\n\n return -1;\n\n}\n\n\n", "file_path": "modules/audio_processing/common.h", "rank": 22, "score": 118783.14510260249 }, { "content": "namespace webrtc {\n\nnamespace ts {\n\n\n\nstatic const float kPi = 3.14159265358979323846f;\n\nstatic const int kChunkSizeMs = 10;\n\nenum {\n\n kSampleRate8kHz = 8000,\n\n kSampleRate16kHz = 16000,\n\n kSampleRate32kHz = 32000,\n\n kSampleRate48kHz = 48000\n\n};\n\n\n\n} // namespace ts\n", "file_path": "modules/audio_processing/transient/common.h", "rank": 23, "score": 117235.38880815495 }, { "content": "namespace webrtc {\n\n\n\nstruct RtcpMeasurement {\n\n RtcpMeasurement();\n\n RtcpMeasurement(uint32_t ntp_secs, uint32_t ntp_frac, uint32_t timestamp);\n\n uint32_t ntp_secs;\n\n uint32_t ntp_frac;\n\n uint32_t rtp_timestamp;\n\n};\n\n\n\ntypedef std::list<RtcpMeasurement> RtcpList;\n\n\n\n// Updates |rtcp_list| with timestamps from the latest RTCP SR.\n\n// |new_rtcp_sr| will be set to true if these are the timestamps which have\n\n// never be added to |rtcp_list|.\n\nbool UpdateRtcpList(uint32_t ntp_secs,\n\n uint32_t ntp_frac,\n\n uint32_t rtp_timestamp,\n\n RtcpList* rtcp_list,\n\n bool* new_rtcp_sr);\n\n\n\n// Converts an RTP timestamp to the NTP domain in milliseconds using two\n\n// (RTP timestamp, NTP timestamp) pairs.\n\nbool RtpToNtpMs(int64_t rtp_timestamp, const RtcpList& rtcp,\n\n int64_t* timestamp_in_ms);\n\n\n\n// Returns 1 there has been a forward wrap around, 0 if there has been no wrap\n\n// around and -1 if there has been a backwards wrap around (i.e. reordering).\n\nint CheckForWrapArounds(uint32_t rtp_timestamp, uint32_t rtcp_rtp_timestamp);\n\n\n", "file_path": "system_wrappers/interface/rtp_to_ntp.h", "rank": 24, "score": 117235.38880815495 }, { "content": "namespace webrtc {\n\n\n\n// Returns a pointer to the first boundry of |alignment| bytes following the\n\n// address of |ptr|.\n\n// Note that there is no guarantee that the memory in question is available.\n\n// |ptr| has no requirements other than it can't be NULL.\n\nvoid* GetRightAlign(const void* ptr, size_t alignment);\n\n\n\n// Allocates memory of |size| bytes aligned on an |alignment| boundry.\n\n// The return value is a pointer to the memory. Note that the memory must\n\n// be de-allocated using AlignedFree.\n\nvoid* AlignedMalloc(size_t size, size_t alignment);\n\n// De-allocates memory created using the AlignedMalloc() API.\n\nvoid AlignedFree(void* mem_block);\n\n\n\n// Templated versions to facilitate usage of aligned malloc without casting\n\n// to and from void*.\n\ntemplate<typename T>\n\nT* GetRightAlign(const T* ptr, size_t alignment) {\n\n return reinterpret_cast<T*>(GetRightAlign(reinterpret_cast<const void*>(ptr),\n\n alignment));\n\n}\n\ntemplate<typename T>\n\nT* AlignedMalloc(size_t size, size_t alignment) {\n\n return reinterpret_cast<T*>(AlignedMalloc(size, alignment));\n\n}\n\n\n\n// Deleter for use with scoped_ptr. E.g., use as\n\n// scoped_ptr<Foo, AlignedFreeDeleter> foo;\n\nstruct AlignedFreeDeleter {\n\n inline void operator()(void* ptr) const {\n\n AlignedFree(ptr);\n\n }\n\n};\n\n\n", "file_path": "system_wrappers/interface/aligned_malloc.h", "rank": 25, "score": 117235.38880815495 }, { "content": "namespace webrtc {\n\n\n\n// A structure that specifies a GMM.\n\n// A GMM is formulated as\n\n// f(x) = w[0] * mixture[0] + w[1] * mixture[1] + ... +\n\n// w[num_mixtures - 1] * mixture[num_mixtures - 1];\n\n// Where a 'mixture' is a Gaussian density.\n\n\n\nstruct GmmParameters {\n\n // weight[n] = log(w[n]) - |dimension|/2 * log(2*pi) - 1/2 * log(det(cov[n]));\n\n // where cov[n] is the covariance matrix of mixture n;\n\n const double* weight;\n\n // pointer to the first element of a |num_mixtures|x|dimension| matrix\n\n // where kth row is the mean of the kth mixture.\n\n const double* mean;\n\n // pointer to the first element of a |num_mixtures|x|dimension|x|dimension|\n\n // 3D-matrix, where the kth 2D-matrix is the inverse of the covariance\n\n // matrix of the kth mixture.\n\n const double* covar_inverse;\n\n // Dimensionality of the mixtures.\n\n int dimension;\n\n // number of the mixtures.\n\n int num_mixtures;\n\n};\n\n\n\n// Evaluate the given GMM, according to |gmm_parameters|, at the given point\n\n// |x|. If the dimensionality of the given GMM is larger that the maximum\n\n// acceptable dimension by the following function -1 is returned.\n\ndouble EvaluateGmm(const double* x, const GmmParameters& gmm_parameters);\n\n\n", "file_path": "modules/audio_processing/agc/gmm.h", "rank": 26, "score": 117235.38880815495 }, { "content": "namespace webrtc {\n\nnamespace test {\n\n\n\n// The highest PSNR value our algorithms will return.\n\nextern double kMetricsPerfectPSNR;\n\n\n\n// Contains video quality metrics result for a single frame.\n\nstruct FrameResult {\n\n int frame_number;\n\n double value;\n\n};\n\n\n\n// Result from a PSNR/SSIM calculation operation.\n\n// The frames in this data structure are 0-indexed.\n\nstruct QualityMetricsResult {\n\n QualityMetricsResult() :\n\n average(0.0),\n\n min(std::numeric_limits<double>::max()),\n\n max(std::numeric_limits<double>::min()),\n\n min_frame_number(-1),\n\n max_frame_number(-1)\n\n {};\n\n double average;\n\n double min;\n\n double max;\n\n int min_frame_number;\n\n int max_frame_number;\n\n std::vector<FrameResult> frames;\n\n};\n\n\n\n// Calculates PSNR and SSIM values for the reference and test video files\n\n// (must be in I420 format). All calculated values are filled into the\n\n// QualityMetricsResult structs.\n\n//\n\n// PSNR values have the unit decibel (dB) where a high value means the test file\n\n// is similar to the reference file. The higher value, the more similar. The\n\n// maximum PSNR value is kMetricsInfinitePSNR. For more info about PSNR, see\n\n// http://en.wikipedia.org/wiki/PSNR.\n\n//\n\n// SSIM values range between -1.0 and 1.0, where 1.0 means the files are\n\n// identical. For more info about SSIM, see http://en.wikipedia.org/wiki/SSIM\n\n// This function only compares video frames up to the point when the shortest\n\n// video ends.\n\n// Return value:\n\n// 0 if successful, negative on errors:\n\n// -1 if the source file cannot be opened\n\n// -2 if the test file cannot be opened\n\n// -3 if any of the files are empty\n\n// -4 if any arguments are invalid.\n\nint I420MetricsFromFiles(const char* ref_filename,\n\n const char* test_filename,\n\n int width,\n\n int height,\n\n QualityMetricsResult* psnr_result,\n\n QualityMetricsResult* ssim_result);\n\n\n\n// Calculates PSNR values for the reference and test video files (must be in\n\n// I420 format). All calculated values are filled into the QualityMetricsResult\n\n// struct.\n\n//\n\n// PSNR values have the unit decibel (dB) where a high value means the test file\n\n// is similar to the reference file. The higher value, the more similar. The\n\n// maximum PSNR value is kMetricsInfinitePSNR. For more info about PSNR, see\n\n// http://en.wikipedia.org/wiki/PSNR.\n\n//\n\n// This function only compares video frames up to the point when the shortest\n\n// video ends.\n\n//\n\n// Return value:\n\n// 0 if successful, negative on errors:\n\n// -1 if the source file cannot be opened\n\n// -2 if the test file cannot be opened\n\n// -3 if any of the files are empty\n\n// -4 if any arguments are invalid.\n\nint I420PSNRFromFiles(const char* ref_filename,\n\n const char* test_filename,\n\n int width,\n\n int height,\n\n QualityMetricsResult* result);\n\n\n\n// Calculates SSIM values for the reference and test video files (must be in\n\n// I420 format). All calculated values are filled into the QualityMetricsResult\n\n// struct.\n\n// SSIM values range between -1.0 and 1.0, where 1.0 means the files are\n\n// identical.\n\n// This function only compares video frames up to the point when the shortest\n\n// video ends.\n\n// For more info about SSIM, see http://en.wikipedia.org/wiki/SSIM\n\n//\n\n// Return value:\n\n// 0 if successful, negative on errors:\n\n// -1 if the source file cannot be opened\n\n// -2 if the test file cannot be opened\n\n// -3 if any of the files are empty\n\n// -4 if any arguments are invalid.\n\nint I420SSIMFromFiles(const char* ref_filename,\n\n const char* test_filename,\n\n int width,\n\n int height,\n\n QualityMetricsResult* result);\n\n\n\n} // namespace test\n", "file_path": "test/testsupport/metrics/video_metrics.h", "rank": 27, "score": 117235.38880815495 }, { "content": "namespace webrtc {\n\n\n\nenum CountOperation {\n\n kRelease,\n\n kAddRef,\n\n kAddRefNoCreate\n\n};\n\nenum CreateOperation {\n\n kInstanceExists,\n\n kCreate,\n\n kDestroy\n\n};\n\n\n\ntemplate <class T>\n\n// Construct On First Use idiom. Avoids\n\n// \"static initialization order fiasco\".\n\nstatic T* GetStaticInstance(CountOperation count_operation) {\n\n // TODO (hellner): use atomic wrapper instead.\n\n static volatile long instance_count = 0;\n\n static T* volatile instance = NULL;\n\n CreateOperation state = kInstanceExists;\n\n#ifndef _WIN32\n\n // This memory is staticly allocated once. The application does not try to\n\n // free this memory. This approach is taken to avoid issues with\n\n // destruction order for statically allocated memory. The memory will be\n\n // reclaimed by the OS and memory leak tools will not recognize memory\n\n // reachable from statics leaked so no noise is added by doing this.\n\n static CriticalSectionWrapper* crit_sect(\n\n CriticalSectionWrapper::CreateCriticalSection());\n\n CriticalSectionScoped lock(crit_sect);\n\n\n\n if (count_operation ==\n\n kAddRefNoCreate && instance_count == 0) {\n\n return NULL;\n\n }\n\n if (count_operation ==\n\n kAddRef ||\n\n count_operation == kAddRefNoCreate) {\n\n instance_count++;\n\n if (instance_count == 1) {\n\n state = kCreate;\n\n }\n\n } else {\n\n instance_count--;\n\n if (instance_count == 0) {\n\n state = kDestroy;\n\n }\n\n }\n\n if (state == kCreate) {\n\n instance = T::CreateInstance();\n\n } else if (state == kDestroy) {\n\n T* old_instance = instance;\n\n instance = NULL;\n\n // The state will not change past this point. Release the critical\n\n // section while deleting the object in case it would be blocking on\n\n // access back to this object. (This is the case for the tracing class\n\n // since the thread owned by the tracing class also traces).\n\n // TODO(hellner): this is a bit out of place but here goes, de-couple\n\n // thread implementation with trace implementation.\n\n crit_sect->Leave();\n\n if (old_instance) {\n\n delete old_instance;\n\n }\n\n // Re-acquire the lock since the scoped critical section will release\n\n // it.\n\n crit_sect->Enter();\n\n return NULL;\n\n }\n\n#else // _WIN32\n\n if (count_operation ==\n\n kAddRefNoCreate && instance_count == 0) {\n\n return NULL;\n\n }\n\n if (count_operation == kAddRefNoCreate) {\n\n if (1 == InterlockedIncrement(&instance_count)) {\n\n // The instance has been destroyed by some other thread. Rollback.\n\n InterlockedDecrement(&instance_count);\n\n assert(false);\n\n return NULL;\n\n }\n\n // Sanity to catch corrupt state.\n\n if (instance == NULL) {\n\n assert(false);\n\n InterlockedDecrement(&instance_count);\n\n return NULL;\n\n }\n\n } else if (count_operation == kAddRef) {\n\n if (instance_count == 0) {\n\n state = kCreate;\n\n } else {\n\n if (1 == InterlockedIncrement(&instance_count)) {\n\n // InterlockedDecrement because reference count should not be\n\n // updated just yet (that's done when the instance is created).\n\n InterlockedDecrement(&instance_count);\n\n state = kCreate;\n\n }\n\n }\n\n } else {\n\n int new_value = InterlockedDecrement(&instance_count);\n\n if (new_value == 0) {\n\n state = kDestroy;\n\n }\n\n }\n\n\n\n if (state == kCreate) {\n\n // Create instance and let whichever thread finishes first assign its\n\n // local copy to the global instance. All other threads reclaim their\n\n // local copy.\n\n T* new_instance = T::CreateInstance();\n\n if (1 == InterlockedIncrement(&instance_count)) {\n\n InterlockedExchangePointer(reinterpret_cast<void * volatile*>(&instance),\n\n new_instance);\n\n } else {\n\n InterlockedDecrement(&instance_count);\n\n if (new_instance) {\n\n delete static_cast<T*>(new_instance);\n\n }\n\n }\n\n } else if (state == kDestroy) {\n\n T* old_value = static_cast<T*>(InterlockedExchangePointer(\n\n reinterpret_cast<void * volatile*>(&instance), NULL));\n\n if (old_value) {\n\n delete static_cast<T*>(old_value);\n\n }\n\n return NULL;\n\n }\n\n#endif // #ifndef _WIN32\n\n return instance;\n\n}\n\n\n", "file_path": "system_wrappers/interface/static_instance.h", "rank": 28, "score": 117235.38880815495 }, { "content": "namespace webrtc {\n\n\n\n// Size (in pixels) of each square block used for diffing. This must be a\n\n// multiple of sizeof(uint64)/8.\n\nconst int kBlockSize = 32;\n\n\n\n// Format: BGRA 32 bit.\n\nconst int kBytesPerPixel = 4;\n\n\n\n// Low level functions to compare 2 blocks of pixels. Zero means the blocks\n\n// are identical. One - the blocks are different.\n\nint BlockDifference(const uint8_t* image1, const uint8_t* image2, int stride);\n\n\n", "file_path": "modules/desktop_capture/differ_block.h", "rank": 29, "score": 117235.38880815495 }, { "content": "namespace webrtc {\n\n\n\nenum Operations {\n\n kNormal = 0,\n\n kMerge,\n\n kExpand,\n\n kAccelerate,\n\n kPreemptiveExpand,\n\n kRfc3389Cng,\n\n kRfc3389CngNoPacket,\n\n kCodecInternalCng,\n\n kDtmf,\n\n kAlternativePlc,\n\n kAlternativePlcIncreaseTimestamp,\n\n kAudioRepetition,\n\n kAudioRepetitionIncreaseTimestamp,\n\n kUndefined = -1\n\n};\n\n\n\nenum Modes {\n\n kModeNormal = 0,\n\n kModeExpand,\n\n kModeMerge,\n\n kModeAccelerateSuccess,\n\n kModeAccelerateLowEnergy,\n\n kModeAccelerateFail,\n\n kModePreemptiveExpandSuccess,\n\n kModePreemptiveExpandLowEnergy,\n\n kModePreemptiveExpandFail,\n\n kModeRfc3389Cng,\n\n kModeCodecInternalCng,\n\n kModeDtmf,\n\n kModeError,\n\n kModeUndefined = -1\n\n};\n\n\n", "file_path": "modules/audio_coding/neteq/defines.h", "rank": 30, "score": 117235.38880815495 }, { "content": "namespace webrtc {\n\n\n\n// Wrapper class for aligned arrays. Every row (and the first dimension) are\n\n// aligned to the given byte alignment.\n\ntemplate<typename T> class AlignedArray {\n\n public:\n\n AlignedArray(int rows, int cols, int alignment)\n\n : rows_(rows),\n\n cols_(cols),\n\n alignment_(alignment) {\n\n CHECK_GT(alignment_, 0);\n\n head_row_ = static_cast<T**>(AlignedMalloc(rows_ * sizeof(*head_row_),\n\n alignment_));\n\n for (int i = 0; i < rows_; ++i) {\n\n head_row_[i] = static_cast<T*>(AlignedMalloc(cols_ * sizeof(**head_row_),\n\n alignment_));\n\n }\n\n }\n\n\n\n ~AlignedArray() {\n\n for (int i = 0; i < rows_; ++i) {\n\n AlignedFree(head_row_[i]);\n\n }\n\n AlignedFree(head_row_);\n\n }\n\n\n\n T* const* Array() {\n\n return head_row_;\n\n }\n\n\n\n const T* const* Array() const {\n\n return head_row_;\n\n }\n\n\n\n T* Row(int row) {\n\n CHECK_LE(row, rows_);\n\n return head_row_[row];\n\n }\n\n\n\n const T* Row(int row) const {\n\n CHECK_LE(row, rows_);\n\n return head_row_[row];\n\n }\n\n\n\n T& At(int row, int col) {\n\n CHECK_LE(col, cols_);\n\n return Row(row)[col];\n\n }\n\n\n\n const T& At(int row, int col) const {\n\n CHECK_LE(col, cols_);\n\n return Row(row)[col];\n\n }\n\n\n\n int rows() const {\n\n return rows_;\n\n }\n\n\n\n int cols() const {\n\n return cols_;\n\n }\n\n\n\n private:\n\n int rows_;\n\n int cols_;\n\n int alignment_;\n\n T** head_row_;\n\n};\n\n\n", "file_path": "system_wrappers/interface/aligned_array.h", "rank": 31, "score": 117235.38880815495 }, { "content": "namespace webrtc\n\n{\n\n\n\ninline int VoEId(int veId, int chId)\n\n{\n\n if (chId == -1)\n\n {\n\n const int dummyChannel(99);\n\n return (int) ((veId << 16) + dummyChannel);\n\n }\n\n return (int) ((veId << 16) + chId);\n\n}\n\n\n\ninline int VoEModuleId(int veId, int chId)\n\n{\n\n return (int) ((veId << 16) + chId);\n\n}\n\n\n\n// Convert module ID to internal VoE channel ID\n\ninline int VoEChannelId(int moduleId)\n\n{\n\n return (int) (moduleId & 0xffff);\n\n}\n\n\n", "file_path": "voice_engine/voice_engine_defines.h", "rank": 32, "score": 117235.38880815495 }, { "content": "namespace webrtc {\n\nnamespace videocapturemodule {\n\n\n\n// Ensure any necessary initialization of webrtc::videocapturemodule has\n\n// completed.\n\nvoid EnsureInitialized();\n\n\n\n} // namespace videocapturemodule.\n", "file_path": "modules/video_capture/ensure_initialized.h", "rank": 33, "score": 117235.38880815495 }, { "content": "namespace webrtc {\n\nnamespace field_trial {\n\n\n\n// Returns the group name chosen for the named trial, or the empty string\n\n// if the trial does not exists.\n\n//\n\n// Note: To keep things tidy append all the trial names with WebRTC.\n\nstd::string FindFullName(const std::string& name);\n\n\n\n} // namespace field_trial\n", "file_path": "system_wrappers/interface/field_trial.h", "rank": 34, "score": 117235.38880815495 }, { "content": "namespace webrtc {\n\n\n\n// Struct for holding RTP packets.\n\nstruct Packet {\n\n RTPHeader header;\n\n uint8_t* payload; // Datagram excluding RTP header and header extension.\n\n size_t payload_length;\n\n bool primary; // Primary, i.e., not redundant payload.\n\n int waiting_time;\n\n bool sync_packet;\n\n\n\n // Constructor.\n\n Packet()\n\n : payload(NULL),\n\n payload_length(0),\n\n primary(true),\n\n waiting_time(0),\n\n sync_packet(false) {\n\n }\n\n\n\n // Comparison operators. Establish a packet ordering based on (1) timestamp,\n\n // (2) sequence number, (3) regular packet vs sync-packet and (4) redundancy.\n\n // Timestamp and sequence numbers are compared taking wrap-around into\n\n // account. If both timestamp and sequence numbers are identical and one of\n\n // the packets is sync-packet, the regular packet is considered earlier. For\n\n // two regular packets with the same sequence number and timestamp a primary\n\n // payload is considered \"smaller\" than a secondary.\n\n bool operator==(const Packet& rhs) const {\n\n return (this->header.timestamp == rhs.header.timestamp &&\n\n this->header.sequenceNumber == rhs.header.sequenceNumber &&\n\n this->primary == rhs.primary &&\n\n this->sync_packet == rhs.sync_packet);\n\n }\n\n bool operator!=(const Packet& rhs) const { return !operator==(rhs); }\n\n bool operator<(const Packet& rhs) const {\n\n if (this->header.timestamp == rhs.header.timestamp) {\n\n if (this->header.sequenceNumber == rhs.header.sequenceNumber) {\n\n // Timestamp and sequence numbers are identical. A sync packet should\n\n // be recognized \"larger\" (i.e. \"later\") compared to a \"network packet\"\n\n // (regular packet from network not sync-packet). If none of the packets\n\n // are sync-packets, then deem the left hand side to be \"smaller\"\n\n // (i.e., \"earlier\") if it is primary, and right hand side is not.\n\n //\n\n // The condition on sync packets to be larger than \"network packets,\"\n\n // given same RTP sequence number and timestamp, guarantees that a\n\n // \"network packet\" to be inserted in an earlier position into\n\n // |packet_buffer_| compared to a sync packet of same timestamp and\n\n // sequence number.\n\n if (rhs.sync_packet)\n\n return true;\n\n if (this->sync_packet)\n\n return false;\n\n return (this->primary && !rhs.primary);\n\n }\n\n return (static_cast<uint16_t>(rhs.header.sequenceNumber\n\n - this->header.sequenceNumber) < 0xFFFF / 2);\n\n }\n\n return (static_cast<uint32_t>(rhs.header.timestamp\n\n - this->header.timestamp) < 0xFFFFFFFF / 2);\n\n }\n\n bool operator>(const Packet& rhs) const { return rhs.operator<(*this); }\n\n bool operator<=(const Packet& rhs) const { return !operator>(rhs); }\n\n bool operator>=(const Packet& rhs) const { return !operator<(rhs); }\n", "file_path": "modules/audio_coding/neteq/packet.h", "rank": 35, "score": 117235.38880815495 }, { "content": "// VoEDtmf\n\nclass WEBRTC_DLLEXPORT VoEDtmf\n\n{\n\npublic:\n\n\n\n // Factory for the VoEDtmf sub-API. Increases an internal\n\n // reference counter if successful. Returns NULL if the API is not\n\n // supported or if construction fails.\n\n static VoEDtmf* GetInterface(VoiceEngine* voiceEngine);\n\n\n\n // Releases the VoEDtmf sub-API and decreases an internal\n\n // reference counter. Returns the new reference count. This value should\n\n // be zero for all sub-API:s before the VoiceEngine object can be safely\n\n // deleted.\n\n virtual int Release() = 0;\n\n\n\n // Sends telephone events either in-band or out-of-band.\n\n virtual int SendTelephoneEvent(int channel, int eventCode,\n\n bool outOfBand = true, int lengthMs = 160,\n\n int attenuationDb = 10) = 0;\n\n\n", "file_path": "voice_engine/include/voe_dtmf.h", "rank": 36, "score": 116711.6482159924 }, { "content": "class WEBRTC_DLLEXPORT ViECapture {\n\n public:\n\n // Factory for the ViECapture sub‐API and increases an internal reference\n\n // counter if successful. Returns NULL if the API is not supported or if\n\n // construction fails.\n\n static ViECapture* GetInterface(VideoEngine* video_engine);\n\n\n\n // Releases the ViECapture sub-API and decreases an internal reference\n\n // counter.\n\n // Returns the new reference count. This value should be zero\n\n // for all sub-API:s before the VideoEngine object can be safely deleted.\n\n virtual int Release() = 0;\n\n\n\n // Gets the number of available capture devices.\n\n virtual int NumberOfCaptureDevices() = 0;\n\n\n\n // Gets the name and unique id of a capture device.\n\n virtual int GetCaptureDevice(unsigned int list_number,\n\n char* device_nameUTF8,\n\n const unsigned int device_nameUTF8Length,\n", "file_path": "video_engine/include/vie_capture.h", "rank": 37, "score": 116711.6482159924 }, { "content": "// VoiceEngineObserver\n\nclass WEBRTC_DLLEXPORT VoiceEngineObserver\n\n{\n\npublic:\n\n // This method will be called after the occurrence of any runtime error\n\n // code, or warning notification, when the observer interface has been\n\n // installed using VoEBase::RegisterVoiceEngineObserver().\n\n virtual void CallbackOnError(int channel, int errCode) = 0;\n\n\n\nprotected:\n\n virtual ~VoiceEngineObserver() {}\n\n};\n\n\n", "file_path": "voice_engine/include/voe_base.h", "rank": 38, "score": 116711.6482159924 }, { "content": "class WEBRTC_DLLEXPORT ViENetwork {\n\n public:\n\n // Default values.\n\n enum { KDefaultSampleTimeSeconds = 2 };\n\n\n\n // Factory for the ViENetwork sub‐API and increases an internal reference\n\n // counter if successful. Returns NULL if the API is not supported or if\n\n // construction fails.\n\n static ViENetwork* GetInterface(VideoEngine* video_engine);\n\n\n\n // Releases the ViENetwork sub-API and decreases an internal reference\n\n // counter.Returns the new reference count. This value should be zero\n\n // for all sub-API:s before the VideoEngine object can be safely deleted.\n\n virtual int Release() = 0;\n\n\n\n // Inform the engine about if the network adapter is currently transmitting\n\n // packets or not.\n\n virtual void SetNetworkTransmissionState(const int video_channel,\n\n const bool is_transmitting) = 0;\n\n\n", "file_path": "video_engine/include/vie_network.h", "rank": 39, "score": 116711.6482159924 }, { "content": "// VoENetwork\n\nclass WEBRTC_DLLEXPORT VoENetwork\n\n{\n\npublic:\n\n // Factory for the VoENetwork sub-API. Increases an internal\n\n // reference counter if successful. Returns NULL if the API is not\n\n // supported or if construction fails.\n\n static VoENetwork* GetInterface(VoiceEngine* voiceEngine);\n\n\n\n // Releases the VoENetwork sub-API and decreases an internal\n\n // reference counter. Returns the new reference count. This value should\n\n // be zero for all sub-API:s before the VoiceEngine object can be safely\n\n // deleted.\n\n virtual int Release() = 0;\n\n\n\n // Installs and enables a user-defined external transport protocol for a\n\n // specified |channel|.\n\n virtual int RegisterExternalTransport(\n\n int channel, Transport& transport) = 0;\n\n\n\n // Removes and disables a user-defined external transport protocol for a\n", "file_path": "voice_engine/include/voe_network.h", "rank": 40, "score": 116711.6482159924 }, { "content": "class WEBRTC_DLLEXPORT VoECodec\n\n{\n\npublic:\n\n // Factory for the VoECodec sub-API. Increases an internal\n\n // reference counter if successful. Returns NULL if the API is not\n\n // supported or if construction fails.\n\n static VoECodec* GetInterface(VoiceEngine* voiceEngine);\n\n\n\n // Releases the VoECodec sub-API and decreases an internal\n\n // reference counter. Returns the new reference count. This value should\n\n // be zero for all sub-API:s before the VoiceEngine object can be safely\n\n // deleted.\n\n virtual int Release() = 0;\n\n\n\n // Gets the number of supported codecs.\n\n virtual int NumOfCodecs() = 0;\n\n\n\n // Get the |codec| information for a specified list |index|.\n\n virtual int GetCodec(int index, CodecInst& codec) = 0;\n\n\n", "file_path": "voice_engine/include/voe_codec.h", "rank": 41, "score": 116711.6482159924 }, { "content": "class WEBRTC_DLLEXPORT VoEHardware\n\n{\n\npublic:\n\n // Factory for the VoEHardware sub-API. Increases an internal\n\n // reference counter if successful. Returns NULL if the API is not\n\n // supported or if construction fails.\n\n static VoEHardware* GetInterface(VoiceEngine* voiceEngine);\n\n\n\n // Releases the VoEHardware sub-API and decreases an internal\n\n // reference counter. Returns the new reference count. This value should\n\n // be zero for all sub-API:s before the VoiceEngine object can be safely\n\n // deleted.\n\n virtual int Release() = 0;\n\n\n\n // Gets the number of audio devices available for recording.\n\n virtual int GetNumOfRecordingDevices(int& devices) = 0;\n\n\n\n // Gets the number of audio devices available for playout.\n\n virtual int GetNumOfPlayoutDevices(int& devices) = 0;\n\n\n", "file_path": "voice_engine/include/voe_hardware.h", "rank": 42, "score": 116711.6482159924 }, { "content": "// VoEBase\n\nclass WEBRTC_DLLEXPORT VoEBase\n\n{\n\npublic:\n\n // Factory for the VoEBase sub-API. Increases an internal reference\n\n // counter if successful. Returns NULL if the API is not supported or if\n\n // construction fails.\n\n static VoEBase* GetInterface(VoiceEngine* voiceEngine);\n\n\n\n // Releases the VoEBase sub-API and decreases an internal reference\n\n // counter. Returns the new reference count. This value should be zero\n\n // for all sub-APIs before the VoiceEngine object can be safely deleted.\n\n virtual int Release() = 0;\n\n\n\n // Installs the observer class to enable runtime error control and\n\n // warning notifications.\n\n virtual int RegisterVoiceEngineObserver(VoiceEngineObserver& observer) = 0;\n\n\n\n // Removes and disables the observer class for runtime error control\n\n // and warning notifications.\n\n virtual int DeRegisterVoiceEngineObserver() = 0;\n", "file_path": "voice_engine/include/voe_base.h", "rank": 43, "score": 116711.6482159924 }, { "content": "class WEBRTC_DLLEXPORT VoEFile\n\n{\n\npublic:\n\n // Factory for the VoEFile sub-API. Increases an internal\n\n // reference counter if successful. Returns NULL if the API is not\n\n // supported or if construction fails.\n\n static VoEFile* GetInterface(VoiceEngine* voiceEngine);\n\n\n\n // Releases the VoEFile sub-API and decreases an internal\n\n // reference counter. Returns the new reference count. This value should\n\n // be zero for all sub-API:s before the VoiceEngine object can be safely\n\n // deleted.\n\n virtual int Release() = 0;\n\n\n\n // Starts playing and mixing files with the local speaker signal for\n\n // playout.\n\n virtual int StartPlayingFileLocally(\n\n int channel,\n\n const char fileNameUTF8[1024],\n\n bool loop = false,\n", "file_path": "voice_engine/include/voe_file.h", "rank": 44, "score": 116711.6482159924 }, { "content": "class WEBRTC_DLLEXPORT ViEBase {\n\n public:\n\n // Factory for the ViEBase sub‐API and increases an internal reference\n\n // counter if successful. Returns NULL if the API is not supported or if\n\n // construction fails.\n\n static ViEBase* GetInterface(VideoEngine* video_engine);\n\n\n\n // Releases the ViEBase sub-API and decreases an internal reference counter.\n\n // Returns the new reference count. This value should be zero\n\n // for all sub-API:s before the VideoEngine object can be safely deleted.\n\n virtual int Release() = 0;\n\n\n\n // Initiates all common parts of the VideoEngine.\n\n virtual int Init() = 0;\n\n\n\n // Connects a VideoEngine instance to a VoiceEngine instance for audio video\n\n // synchronization.\n\n virtual int SetVoiceEngine(VoiceEngine* voice_engine) = 0;\n\n\n\n // Creates a new channel.\n", "file_path": "video_engine/include/vie_base.h", "rank": 45, "score": 116711.6482159924 }, { "content": "class WEBRTC_DLLEXPORT ViECodec {\n\n public:\n\n // Factory for the ViECodec sub‐API and increases an internal reference\n\n // counter if successful. Returns NULL if the API is not supported or if\n\n // construction fails.\n\n static ViECodec* GetInterface(VideoEngine* video_engine);\n\n\n\n // Releases the ViECodec sub-API and decreases an internal reference\n\n // counter.\n\n // Returns the new reference count. This value should be zero\n\n // for all sub-API:s before the VideoEngine object can be safely deleted.\n\n virtual int Release() = 0;\n\n\n\n // Gets the number of available codecs for the VideoEngine build.\n\n virtual int NumberOfCodecs() const = 0;\n\n\n\n // Gets a VideoCodec struct for a codec containing the default configuration\n\n // for that codec type.\n\n virtual int GetCodec(const unsigned char list_number,\n\n VideoCodec& video_codec) const = 0;\n", "file_path": "video_engine/include/vie_codec.h", "rank": 46, "score": 116711.6482159924 }, { "content": "namespace webrtc\n\n{\n\nnamespace videocapturemodule\n\n{\n\n\n\nstruct DelayValue\n\n{\n\n int32_t width;\n\n int32_t height;\n\n int32_t delay;\n\n};\n\n\n\nenum { NoOfDelayValues = 40 };\n\nstruct DelayValues\n\n{\n\n char * deviceName;\n\n char* productId;\n\n DelayValue delayValues[NoOfDelayValues];\n\n};\n\n\n\n} // namespace videocapturemodule\n", "file_path": "modules/video_capture/video_capture_delay.h", "rank": 47, "score": 115763.83146211371 }, { "content": "namespace webrtc {\n\n\n\n// Type used to identify windows on the desktop. Values are platform-specific:\n\n// - On Windows: HWND cast to intptr_t.\n\n// - On Linux (with X11): X11 Window (unsigned long) type cast to intptr_t.\n\n// - On OSX: integer window number.\n\ntypedef intptr_t WindowId;\n\n\n\nconst WindowId kNullWindowId = 0;\n\n\n\n// Type used to identify screens on the desktop. Values are platform-specific:\n\n// - On Windows: integer display device index.\n\n// - On OSX: CGDirectDisplayID cast to intptr_t.\n\n// - On Linux (with X11): TBD.\n\ntypedef intptr_t ScreenId;\n\n\n\n// The screen id corresponds to all screen combined together.\n\nconst ScreenId kFullDesktopScreenId = -1;\n\n\n\nconst ScreenId kInvalidScreenId = -2;\n\n\n", "file_path": "modules/desktop_capture/desktop_capture_types.h", "rank": 48, "score": 115763.83146211371 }, { "content": "namespace webrtc {\n\n\n\n// Frame numbering starts at 1. The set of frames to be processed includes the\n\n// frame with the number: first_frame_to_process and last_frame_to_process.\n\n// Interval specifies with what interval frames should be cut or kept.\n\n// Example 1:\n\n// If one clip has 10 frames (1 to 10), and you specify\n\n// first_frame_to_process = 4, last_frame_to_process = 7 and interval = -1,\n\n// then you will get a clip that contains frame 1, 2, 3, 8, 9 and 10.\n\n// Example 2:\n\n// I you specify first_frame_to_process = 1, last_frame_to_process = 10 and\n\n// interval = -4, then you will get a clip that contains frame 1, 5, 9.\n\n// Example 3:\n\n// If you specify first_frame_to_process = 4, last_frame_to_process = 7 and\n\n// interval = 2, then you will get a clip that contains frame\n\n// 1, 2, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9 and 10.\n\n// No interpolation is done when up-sampling.\n\n\n\nint EditFrames(const std::string& in_path, int width, int height,\n\n int first_frame_to_process, int interval,\n\n int last_frame_to_process, const std::string& out_path);\n", "file_path": "tools/frame_editing/frame_editing_lib.h", "rank": 49, "score": 115763.83146211371 }, { "content": "namespace webrtc {\n\n\n\n// Always takes ownership of |frame|. Returns NULL if |rect| is not contained\n\n// by the bounds of |frame|.\n\nDesktopFrame* CreateCroppedDesktopFrame(DesktopFrame* frame,\n\n const DesktopRect& rect);\n", "file_path": "modules/desktop_capture/cropped_desktop_frame.h", "rank": 50, "score": 115763.83146211371 }, { "content": "namespace webrtc {\n\n\n\n// Returns the proper length of the output buffer that you should use for the\n\n// given |in_length| and decimation |odd_sequence|.\n\n// Return -1 on error.\n\ninline size_t GetOutLengthToDyadicDecimate(size_t in_length,\n\n bool odd_sequence) {\n\n size_t out_length = in_length / 2;\n\n\n\n if (in_length % 2 == 1 && !odd_sequence) {\n\n ++out_length;\n\n }\n\n\n\n return out_length;\n\n}\n\n\n\n// Performs a dyadic decimation: removes every odd/even member of a sequence\n\n// halving its overall length.\n\n// Arguments:\n\n// in: array of |in_length|.\n\n// odd_sequence: If false, the odd members will be removed (1, 3, 5, ...);\n\n// if true, the even members will be removed (0, 2, 4, ...).\n\n// out: array of |out_length|. |out_length| must be large enough to\n\n// hold the decimated output. The necessary length can be provided by\n\n// GetOutLengthToDyadicDecimate().\n\n// Must be previously allocated.\n\n// Returns the number of output samples, -1 on error.\n\ntemplate<typename T>\n\nstatic size_t DyadicDecimate(const T* in,\n\n size_t in_length,\n\n bool odd_sequence,\n\n T* out,\n\n size_t out_length) {\n\n size_t half_length = GetOutLengthToDyadicDecimate(in_length, odd_sequence);\n\n\n\n if (!in || !out || in_length <= 0 || out_length < half_length) {\n\n return 0;\n\n }\n\n\n\n size_t output_samples = 0;\n\n size_t index_adjustment = odd_sequence ? 1 : 0;\n\n for (output_samples = 0; output_samples < half_length; ++output_samples) {\n\n out[output_samples] = in[output_samples * 2 + index_adjustment];\n\n }\n\n\n\n return output_samples;\n\n}\n\n\n", "file_path": "modules/audio_processing/transient/dyadic_decimator.h", "rank": 51, "score": 115763.83146211371 }, { "content": "namespace webrtc {\n\n\n\n// Reads audio from a pcm into a 2D array: buffer[channel_index][frame_index].\n\n// Returns the number of frames written. If this is less than |length|, it's\n\n// safe to assume the end-of-file was reached, as otherwise this will crash.\n\n// In PcmReadToFloat, the floats are within the range [-1, 1].\n\nsize_t PcmRead(FILE* file,\n\n size_t length,\n\n int num_channels,\n\n int16_t* const* buffer);\n\nsize_t PcmReadToFloat(FILE* file,\n\n size_t length,\n\n int num_channels,\n\n float* const* buffer);\n\n\n\n// Writes to a pcm file. The resulting file contains the channels interleaved.\n\n// Crashes if the correct number of frames aren't written to the file. For\n\n// PcmWriteFromFloat, floats must be within the range [-1, 1].\n\nvoid PcmWrite(FILE* file,\n\n size_t length,\n\n int num_channels,\n\n const int16_t* const* buffer);\n\nvoid PcmWriteFromFloat(FILE* file,\n\n size_t length,\n\n int num_channels,\n\n const float* const* buffer);\n\n\n", "file_path": "modules/audio_processing/beamformer/pcm_utils.h", "rank": 52, "score": 115763.83146211371 }, { "content": "namespace webrtc {\n\nnamespace test {\n\n\n\nstruct AnalysisResult {\n\n AnalysisResult() {}\n\n AnalysisResult(int frame_number, double psnr_value, double ssim_value)\n\n : frame_number(frame_number),\n\n psnr_value(psnr_value),\n\n ssim_value(ssim_value) {}\n\n int frame_number;\n\n double psnr_value;\n\n double ssim_value;\n\n};\n\n\n\nstruct ResultsContainer {\n\n std::vector<AnalysisResult> frames;\n\n};\n\n\n\nenum VideoAnalysisMetricsType {kPSNR, kSSIM};\n\n\n\n// A function to run the PSNR and SSIM analysis on the test file. The test file\n\n// comprises the frames that were captured during the quality measurement test.\n\n// There may be missing or duplicate frames. Also the frames start at a random\n\n// position in the original video. We should provide a statistics file along\n\n// with the test video. The stats file contains the connection between the\n\n// actual frames in the test file and their position in the reference video, so\n\n// that the analysis could run with the right frames from both videos. The stats\n\n// file should be in the form 'frame_xxxx yyyy', where xxxx is the consecutive\n\n// number of the frame in the test video, and yyyy is the equivalent frame in\n\n// the reference video. The stats file could be produced by\n\n// tools/barcode_tools/barcode_decoder.py. This script decodes the barcodes\n\n// integrated in every video and generates the stats file. If three was some\n\n// problem with the decoding there would be 'Barcode error' instead of yyyy.\n\nvoid RunAnalysis(const char* reference_file_name, const char* test_file_name,\n\n const char* stats_file_name, int width, int height,\n\n ResultsContainer* results);\n\n\n\n// Compute PSNR or SSIM for an I420 frame (all planes). When we are calculating\n\n// PSNR values, the max return value (in the case where the test and reference\n\n// frames are exactly the same) will be 48. In the case of SSIM the max return\n\n// value will be 1.\n\ndouble CalculateMetrics(VideoAnalysisMetricsType video_metrics_type,\n\n const uint8* ref_frame, const uint8* test_frame,\n\n int width, int height);\n\n\n\n// Prints the result from the analysis in Chromium performance\n\n// numbers compatible format to stdout. If the results object contains no frames\n\n// no output will be written.\n\nvoid PrintAnalysisResults(const std::string& label, ResultsContainer* results);\n\n\n\n// Similar to the above, but will print to the specified file handle.\n\nvoid PrintAnalysisResults(FILE* output, const std::string& label,\n\n ResultsContainer* results);\n\n\n\n// Calculates max repeated and skipped frames and prints them to stdout in a\n\n// format that is compatible with Chromium performance numbers.\n\nvoid PrintMaxRepeatedAndSkippedFrames(const std::string& label,\n\n const std::string& stats_file_name);\n\n\n\n// Similar to the above, but will print to the specified file handle.\n\nvoid PrintMaxRepeatedAndSkippedFrames(FILE* output, const std::string& label,\n\n const std::string& stats_file_name);\n\n\n\n// Gets the next line from an open stats file.\n\nbool GetNextStatsLine(FILE* stats_file, char* line);\n\n\n\n// Calculates the size of a I420 frame if given the width and height.\n\nint GetI420FrameSize(int width, int height);\n\n\n\n// Extract the sequence of the frame in the video. I.e. if line is\n\n// frame_0023 0284, we will get 23.\n\nint ExtractFrameSequenceNumber(std::string line);\n\n\n\n// Checks if there is 'Barcode error' for the given line.\n\nbool IsThereBarcodeError(std::string line);\n\n\n\n// Extract the frame number in the reference video. I.e. if line is\n\n// frame_0023 0284, we will get 284.\n\nint ExtractDecodedFrameNumber(std::string line);\n\n\n\n// Extracts an I420 frame at position frame_number from the raw YUV file.\n\nbool ExtractFrameFromYuvFile(const char* i420_file_name, int width, int height,\n\n int frame_number, uint8* result_frame);\n\n\n\n// Extracts an I420 frame at position frame_number from the Y4M file. The first\n\n// frame has corresponded |frame_number| 0.\n\nbool ExtractFrameFromY4mFile(const char* i420_file_name, int width, int height,\n\n int frame_number, uint8* result_frame);\n\n\n\n\n\n} // namespace test\n", "file_path": "tools/frame_analyzer/video_quality_analysis.h", "rank": 53, "score": 115763.83146211371 }, { "content": "namespace webrtc\n\n{\n\nnamespace videocapturemodule\n\n{\n\nenum {kDefaultWidth = 640}; // Start width\n\nenum {kDefaultHeight = 480}; // Start heigt\n\nenum {kDefaultFrameRate = 30}; // Start frame rate\n\n\n\nenum {kMaxFrameRate =60}; // Max allowed frame rate of the start image \n\n\n\nenum {kDefaultCaptureDelay = 120}; \n\nenum {kMaxCaptureDelay = 270}; // Max capture delay allowed in the precompiled capture delay values. \n\n\n\nenum {kFrameRateCallbackInterval = 1000}; \n\nenum {kFrameRateCountHistorySize = 90};\n\nenum {kFrameRateHistoryWindowMs = 2000};\n\n} // namespace videocapturemodule\n", "file_path": "modules/video_capture/video_capture_config.h", "rank": 54, "score": 115763.83146211371 }, { "content": "namespace webrtc {\n\n\n\n// Describes the configuration of a specific display.\n\nstruct MacDisplayConfiguration {\n\n MacDisplayConfiguration();\n\n\n\n // Cocoa identifier for this display.\n\n CGDirectDisplayID id;\n\n\n\n // Bounds of this display in Density-Independent Pixels (DIPs).\n\n DesktopRect bounds;\n\n\n\n // Bounds of this display in physical pixels.\n\n DesktopRect pixel_bounds;\n\n\n\n // Scale factor from DIPs to physical pixels.\n\n float dip_to_pixel_scale;\n\n};\n\n\n\ntypedef std::vector<MacDisplayConfiguration> MacDisplayConfigurations;\n\n\n\n// Describes the configuration of the whole desktop.\n\nstruct MacDesktopConfiguration {\n\n // Used to request bottom-up or top-down coordinates.\n\n enum Origin { BottomLeftOrigin, TopLeftOrigin };\n\n\n\n MacDesktopConfiguration();\n\n ~MacDesktopConfiguration();\n\n\n\n // Returns the desktop & display configurations in Cocoa-style \"bottom-up\"\n\n // (the origin is the bottom-left of the primary monitor, and coordinates\n\n // increase as you move up the screen) or Carbon-style \"top-down\" coordinates.\n\n static MacDesktopConfiguration GetCurrent(Origin origin);\n\n\n\n // Returns true if the given desktop configuration equals this one.\n\n bool Equals(const MacDesktopConfiguration& other);\n\n\n\n // Returns the pointer to the display configuration with the specified id.\n\n const MacDisplayConfiguration* FindDisplayConfigurationById(\n\n CGDirectDisplayID id);\n\n\n\n // Bounds of the desktop excluding monitors with DPI settings different from\n\n // the main monitor. In Density-Independent Pixels (DIPs).\n\n DesktopRect bounds;\n\n\n\n // Same as bounds, but expressed in physical pixels.\n\n DesktopRect pixel_bounds;\n\n\n\n // Scale factor from DIPs to physical pixels.\n\n float dip_to_pixel_scale;\n\n\n\n // Configurations of the displays making up the desktop area.\n\n MacDisplayConfigurations displays;\n\n};\n\n\n", "file_path": "modules/desktop_capture/mac/desktop_configuration.h", "rank": 55, "score": 115763.83146211371 }, { "content": "namespace webrtc {\n\n\n\n// This is a copy of the cast included in the Chromium codebase here:\n\n// http://cs.chromium.org/src/third_party/cld/base/casts.h\n\ntemplate <class Dest, class Source>\n\ninline Dest bit_cast(const Source& source) {\n\n // A compile error here means your Dest and Source have different sizes.\n\n static_assert(sizeof(Dest) == sizeof(Source),\n\n \"Dest and Source have different sizes\");\n\n\n\n Dest dest;\n\n memcpy(&dest, &source, sizeof(dest));\n\n return dest;\n\n}\n\n\n\n// Converts the byte array with binary float representation to float.\n\n// Bytes must be in little-endian order.\n\n// Returns 0 if correct, -1 on error.\n\nint ConvertByteArrayToFloat(const uint8_t bytes[4], float* out);\n\n\n\n// Converts the byte array with binary double representation to double.\n\n// Bytes must be in little-endian order.\n\n// Returns 0 if correct, -1 on error.\n\nint ConvertByteArrayToDouble(const uint8_t bytes[8], double* out);\n\n\n\n// Converts a float to a byte array with binary float representation.\n\n// Bytes will be in little-endian order.\n\n// Returns 0 if correct, -1 on error.\n\nint ConvertFloatToByteArray(float value, uint8_t out_bytes[4]);\n\n\n\n// Converts a double to a byte array with binary double representation.\n\n// Bytes will be in little-endian order.\n\n// Returns 0 if correct, -1 on error.\n\nint ConvertDoubleToByteArray(double value, uint8_t out_bytes[8]);\n\n\n\n// Reads |length| 16-bit integers from |file| to |buffer|.\n\n// |file| must be previously opened.\n\n// Returns the number of 16-bit integers read or -1 on error.\n\nsize_t ReadInt16BufferFromFile(FileWrapper* file,\n\n size_t length,\n\n int16_t* buffer);\n\n\n\n// Reads |length| 16-bit integers from |file| and stores those values\n\n// (converting them) in |buffer|.\n\n// |file| must be previously opened.\n\n// Returns the number of 16-bit integers read or -1 on error.\n\nsize_t ReadInt16FromFileToFloatBuffer(FileWrapper* file,\n\n size_t length,\n\n float* buffer);\n\n\n\n// Reads |length| 16-bit integers from |file| and stores those values\n\n// (converting them) in |buffer|.\n\n// |file| must be previously opened.\n\n// Returns the number of 16-bit integers read or -1 on error.\n\nsize_t ReadInt16FromFileToDoubleBuffer(FileWrapper* file,\n\n size_t length,\n\n double* buffer);\n\n\n\n// Reads |length| floats in binary representation (4 bytes) from |file| to\n\n// |buffer|.\n\n// |file| must be previously opened.\n\n// Returns the number of floats read or -1 on error.\n\nsize_t ReadFloatBufferFromFile(FileWrapper* file, size_t length, float* buffer);\n\n\n\n// Reads |length| doubles in binary representation (8 bytes) from |file| to\n\n// |buffer|.\n\n// |file| must be previously opened.\n\n// Returns the number of doubles read or -1 on error.\n\nsize_t ReadDoubleBufferFromFile(FileWrapper* file,\n\n size_t length,\n\n double* buffer);\n\n\n\n// Writes |length| 16-bit integers from |buffer| in binary representation (2\n\n// bytes) to |file|. It flushes |file|, so after this call there are no\n\n// writings pending.\n\n// |file| must be previously opened.\n\n// Returns the number of doubles written or -1 on error.\n\nsize_t WriteInt16BufferToFile(FileWrapper* file,\n\n size_t length,\n\n const int16_t* buffer);\n\n\n\n// Writes |length| floats from |buffer| in binary representation (4 bytes) to\n\n// |file|. It flushes |file|, so after this call there are no writtings pending.\n\n// |file| must be previously opened.\n\n// Returns the number of doubles written or -1 on error.\n\nsize_t WriteFloatBufferToFile(FileWrapper* file,\n\n size_t length,\n\n const float* buffer);\n\n\n\n// Writes |length| doubles from |buffer| in binary representation (8 bytes) to\n\n// |file|. It flushes |file|, so after this call there are no writings pending.\n\n// |file| must be previously opened.\n\n// Returns the number of doubles written or -1 on error.\n\nsize_t WriteDoubleBufferToFile(FileWrapper* file,\n\n size_t length,\n\n const double* buffer);\n\n\n", "file_path": "modules/audio_processing/transient/file_utils.h", "rank": 56, "score": 115763.83146211371 }, { "content": "namespace webrtc {\n\nnamespace VideoProcessing {\n\n\n\nint32_t Brighten(I420VideoFrame* frame, int delta);\n\n\n\n} // namespace VideoProcessing\n", "file_path": "modules/video_processing/main/source/brighten.h", "rank": 57, "score": 115763.83146211371 }, { "content": "namespace webrtc {\n\nnamespace field_trial {\n\n\n\n// Optionally initialize field trial from a string.\n\n// This method can be called at most once before any other call into webrtc.\n\n// E.g. before the peer connection factory is constructed.\n\n// Note: trials_string must never be destroyed.\n\nvoid InitFieldTrialsFromString(const char* trials_string);\n\n\n\n} // namespace field_trial\n", "file_path": "system_wrappers/interface/field_trial_default.h", "rank": 58, "score": 115763.83146211371 }, { "content": "namespace webrtc {\n\n\n\n// Find block difference of dimension 16x16.\n\nextern int BlockDifference_SSE2_W16(const uint8_t* image1,\n\n const uint8_t* image2,\n\n int stride);\n\n\n\n// Find block difference of dimension 32x32.\n\nextern int BlockDifference_SSE2_W32(const uint8_t* image1,\n\n const uint8_t* image2,\n\n int stride);\n\n\n", "file_path": "modules/desktop_capture/differ_block_sse2.h", "rank": 59, "score": 115763.83146211371 }, { "content": "namespace webrtc {\n\n\n\n// A helper function to get the on-screen windows.\n\nbool GetWindowList(WindowCapturer::WindowList* windows);\n\n\n", "file_path": "modules/desktop_capture/mac/window_list_utils.h", "rank": 60, "score": 114362.98112770906 }, { "content": "namespace webrtc {\n\nnamespace VideoProcessing {\n\n\n\nint32_t ColorEnhancement(I420VideoFrame* frame);\n\n\n\n} // namespace VideoProcessing\n", "file_path": "modules/video_processing/main/source/color_enhancement.h", "rank": 61, "score": 114362.98112770906 }, { "content": "namespace webrtc {\n\n\n\n// Output the window rect, with the left/right/bottom frame border cropped if\n\n// the window is maximized. |cropped_rect| is the cropped rect relative to the\n\n// desktop. |original_rect| is the original rect returned from GetWindowRect.\n\n// Returns true if all API calls succeeded.\n\nbool GetCroppedWindowRect(HWND window,\n\n DesktopRect* cropped_rect,\n\n DesktopRect* original_rect);\n\n\n", "file_path": "modules/desktop_capture/win/window_capture_utils.h", "rank": 62, "score": 114362.98112770906 }, { "content": "namespace webrtc {\n\nenum { NACK_BYTECOUNT_SIZE = 60}; // size of our NACK history\n\n// A sanity for the NACK list parsing at the send-side.\n\nenum { kSendSideNackListSizeSanity = 20000 };\n\nenum { kDefaultMaxReorderingThreshold = 50 }; // In sequence numbers.\n\nenum { kRtcpMaxNackFields = 253 };\n\n\n\nenum { RTCP_INTERVAL_VIDEO_MS = 1000 };\n\nenum { RTCP_INTERVAL_AUDIO_MS = 5000 };\n\nenum { RTCP_SEND_BEFORE_KEY_FRAME_MS= 100 };\n\nenum { RTCP_MAX_REPORT_BLOCKS = 31}; // RFC 3550 page 37\n\nenum { RTCP_MIN_FRAME_LENGTH_MS = 17};\n\nenum { kRtcpAppCode_DATA_SIZE = 32*4}; // multiple of 4, this is not a limitation of the size\n\nenum { RTCP_RPSI_DATA_SIZE = 30};\n\nenum { RTCP_NUMBER_OF_SR = 60 };\n\n\n\nenum { MAX_NUMBER_OF_TEMPORAL_ID = 8 }; // RFC\n\nenum { MAX_NUMBER_OF_DEPENDENCY_QUALITY_ID = 128 };// RFC\n\nenum { MAX_NUMBER_OF_REMB_FEEDBACK_SSRCS = 255 };\n\n\n\nenum { BW_HISTORY_SIZE = 35};\n\n\n\n#define MIN_AUDIO_BW_MANAGEMENT_BITRATE 6\n\n#define MIN_VIDEO_BW_MANAGEMENT_BITRATE 30\n\n\n\nenum { DTMF_OUTBAND_MAX = 20};\n\n\n\nenum { RTP_MAX_BURST_SLEEP_TIME = 500 };\n\nenum { RTP_AUDIO_LEVEL_UNIQUE_ID = 0xbede };\n\nenum { RTP_MAX_PACKETS_PER_FRAME= 512 }; // must be multiple of 32\n", "file_path": "modules/rtp_rtcp/source/rtp_rtcp_config.h", "rank": 63, "score": 114362.98112770906 }, { "content": "namespace webrtc {\n\n\n\nstruct THREADNAME_INFO\n\n{\n\n DWORD dwType; // must be 0x1000\n\n LPCSTR szName; // pointer to name (in user addr space)\n\n DWORD dwThreadID; // thread ID (-1 = caller thread)\n\n DWORD dwFlags; // reserved for future use, must be zero\n\n};\n\n\n\nvoid SetThreadName(DWORD dwThreadID, LPCSTR szThreadName)\n\n{\n\n THREADNAME_INFO info;\n\n info.dwType = 0x1000;\n\n info.szName = szThreadName;\n\n info.dwThreadID = dwThreadID;\n\n info.dwFlags = 0;\n\n\n\n __try\n\n {\n\n RaiseException(0x406D1388, 0, sizeof(info) / sizeof(DWORD),\n\n (ULONG_PTR*)&info);\n\n }\n\n __except (EXCEPTION_CONTINUE_EXECUTION)\n\n {\n\n }\n\n}\n", "file_path": "system_wrappers/source/set_thread_name_win.h", "rank": 64, "score": 114362.98112770906 }, { "content": "namespace webrtc\n\n{\n\n\n\n#define MASK_32_BITS(x) (0xFFFFFFFF & (x))\n\n\n\ninline uint32_t MaskWord64ToUWord32(int64_t w64)\n\n{\n\n return static_cast<uint32_t>(MASK_32_BITS(w64));\n\n}\n\n\n\n#define VCM_MAX(a, b) (((a) > (b)) ? (a) : (b))\n\n#define VCM_MIN(a, b) (((a) < (b)) ? (a) : (b))\n\n\n\n#define VCM_DEFAULT_CODEC_WIDTH 352\n\n#define VCM_DEFAULT_CODEC_HEIGHT 288\n\n#define VCM_DEFAULT_FRAME_RATE 30\n\n#define VCM_MIN_BITRATE 30\n\n#define VCM_FLUSH_INDICATOR 4\n\n\n\n// Helper macros for creating the static codec list\n\n#define VCM_NO_CODEC_IDX -1\n\n#ifdef VIDEOCODEC_VP8\n\n #define VCM_VP8_IDX (VCM_NO_CODEC_IDX + 1)\n\n#else\n\n #define VCM_VP8_IDX VCM_NO_CODEC_IDX\n\n#endif\n\n#ifdef VIDEOCODEC_VP9\n\n #define VCM_VP9_IDX (VCM_VP8_IDX + 1)\n\n#else\n\n #define VCM_VP9_IDX VCM_VP8_IDX\n\n#endif\n\n#ifdef VIDEOCODEC_H264\n\n #define VCM_H264_IDX (VCM_VP9_IDX + 1)\n\n#else\n\n #define VCM_H264_IDX VCM_VP9_IDX\n\n#endif\n\n#ifdef VIDEOCODEC_I420\n\n #define VCM_I420_IDX (VCM_H264_IDX + 1)\n\n#else\n\n #define VCM_I420_IDX VCM_H264_IDX\n\n#endif\n\n#define VCM_NUM_VIDEO_CODECS_AVAILABLE (VCM_I420_IDX + 1)\n\n\n\n#define VCM_NO_RECEIVER_ID 0\n\n\n\ninline int32_t VCMId(const int32_t vcmId, const int32_t receiverId = 0)\n\n{\n\n return static_cast<int32_t>((vcmId << 16) + receiverId);\n\n}\n\n\n", "file_path": "modules/video_coding/main/source/internal_defines.h", "rank": 65, "score": 114362.98112770906 }, { "content": "namespace webrtc\n\n{\n\nnamespace videocapturemodule\n\n{\n\nLONGLONG GetMaxOfFrameArray(LONGLONG *maxFps, long size);\n\n\n\nIPin* GetInputPin(IBaseFilter* filter);\n\nIPin* GetOutputPin(IBaseFilter* filter, REFGUID Category);\n\nBOOL PinMatchesCategory(IPin *pPin, REFGUID Category);\n\n\n\n} // namespace videocapturemodule\n", "file_path": "modules/video_capture/windows/help_functions_ds.h", "rank": 66, "score": 114362.98112770906 }, { "content": "namespace webrtc {\n\n\n\nconst int kDaubechies8CoefficientsLength = 16;\n\n\n\nconst float kDaubechies8HighPassCoefficients[kDaubechies8CoefficientsLength]\n\n = {\n\n -5.44158422430816093862e-02f,\n\n 3.12871590914465924627e-01f,\n\n -6.75630736298012846142e-01f,\n\n 5.85354683654869090148e-01f,\n\n 1.58291052560238926228e-02f,\n\n -2.84015542962428091389e-01f,\n\n -4.72484573997972536787e-04f,\n\n 1.28747426620186011803e-01f,\n\n 1.73693010020221083600e-02f,\n\n -4.40882539310647192377e-02f,\n\n -1.39810279170155156436e-02f,\n\n 8.74609404701565465445e-03f,\n\n 4.87035299301066034600e-03f,\n\n -3.91740372995977108837e-04f,\n\n -6.75449405998556772109e-04f,\n\n -1.17476784002281916305e-04f\n\n};\n\n\n\nconst float kDaubechies8LowPassCoefficients[kDaubechies8CoefficientsLength] = {\n\n -1.17476784002281916305e-04f,\n\n 6.75449405998556772109e-04f,\n\n -3.91740372995977108837e-04f,\n\n -4.87035299301066034600e-03f,\n\n 8.74609404701565465445e-03f,\n\n 1.39810279170155156436e-02f,\n\n -4.40882539310647192377e-02f,\n\n -1.73693010020221083600e-02f,\n\n 1.28747426620186011803e-01f,\n\n 4.72484573997972536787e-04f,\n\n -2.84015542962428091389e-01f,\n\n -1.58291052560238926228e-02f,\n\n 5.85354683654869090148e-01f,\n\n 6.75630736298012846142e-01f,\n\n 3.12871590914465924627e-01f,\n\n 5.44158422430816093862e-02f\n\n};\n\n\n", "file_path": "modules/audio_processing/transient/daubechies_8_wavelet_coeffs.h", "rank": 67, "score": 114362.98112770906 }, { "content": "namespace webrtc {\n\n\n\n// Output the list of active screens into |screens|. Returns true if succeeded,\n\n// or false if it fails to enumerate the display devices.\n\nbool GetScreenList(ScreenCapturer::ScreenList* screens);\n\n\n\n// Returns true if |screen| is a valid screen. The screen device key is\n\n// returned through |device_key| if the screen is valid. The device key can be\n\n// used in GetScreenRect to verify the screen matches the previously obtained\n\n// id.\n\nbool IsScreenValid(ScreenId screen, std::wstring* device_key);\n\n\n\n// Get the rect of the screen identified by |screen|, relative to the primary\n\n// display's top-left. If the screen device key does not match |device_key|, or\n\n// the screen does not exist, or any error happens, an empty rect is returned.\n\nDesktopRect GetScreenRect(ScreenId screen, const std::wstring& device_key);\n\n\n", "file_path": "modules/desktop_capture/win/screen_capture_utils.h", "rank": 68, "score": 114362.98112770906 }, { "content": "class WEBRTC_DLLEXPORT ViERTP_RTCP {\n\n public:\n\n enum { KDefaultDeltaTransmitTimeSeconds = 15 };\n\n enum { KMaxRTCPCNameLength = 256 };\n\n\n\n // Factory for the ViERTP_RTCP sub‐API and increases an internal reference\n\n // counter if successful. Returns NULL if the API is not supported or if\n\n // construction fails.\n\n static ViERTP_RTCP* GetInterface(VideoEngine* video_engine);\n\n\n\n // Releases the ViERTP_RTCP sub-API and decreases an internal reference\n\n // counter. Returns the new reference count. This value should be zero\n\n // for all sub-API:s before the VideoEngine object can be safely deleted.\n\n virtual int Release() = 0;\n\n\n\n // This function enables you to specify the RTP synchronization source\n\n // identifier (SSRC) explicitly.\n\n virtual int SetLocalSSRC(const int video_channel,\n\n const unsigned int SSRC,\n\n const StreamType usage = kViEStreamTypeNormal,\n", "file_path": "video_engine/include/vie_rtp_rtcp.h", "rank": 69, "score": 113907.7031673224 }, { "content": "// This class declares an abstract interface for a user defined observer. It is\n\n// up to the VideoEngine user to implement a derived class which implements the\n\n// observer class. The observer is registered using RegisterRTPObserver() and\n\n// deregistered using DeregisterRTPObserver().\n\nclass WEBRTC_DLLEXPORT ViERTPObserver {\n\n public:\n\n // This method is called if SSRC of the incoming stream is changed.\n\n virtual void IncomingSSRCChanged(const int video_channel,\n\n const unsigned int SSRC) = 0;\n\n\n\n // This method is called if a field in CSRC changes or if the number of\n\n // CSRCs changes.\n\n virtual void IncomingCSRCChanged(const int video_channel,\n\n const unsigned int CSRC,\n\n const bool added) = 0;\n\n protected:\n\n virtual ~ViERTPObserver() {}\n\n};\n\n\n", "file_path": "video_engine/include/vie_rtp_rtcp.h", "rank": 70, "score": 113907.7031673224 }, { "content": "// This class declares an abstract interface to be used when implementing\n\n// a user-defined capture device. This interface is not meant to be\n\n// implemented by the user. Instead, the user should call AllocateCaptureDevice\n\n// in the ViECapture interface, which will create a suitable implementation.\n\n// The user should then call IncomingFrame in this interface to deliver\n\n// captured frames to the system.\n\nclass WEBRTC_DLLEXPORT ViEExternalCapture {\n\n public:\n\n ViEExternalCapture() {}\n\n virtual ~ViEExternalCapture() {}\n\n\n\n // This method is called by the user to deliver a new captured frame to\n\n // VideoEngine.\n\n // |capture_time| must be specified in the NTP time format in milliseconds.\n\n virtual int IncomingFrame(unsigned char* video_frame,\n\n size_t video_frame_length,\n\n unsigned short width,\n\n unsigned short height,\n\n RawVideoType video_type,\n\n unsigned long long capture_time = 0) = 0;\n\n\n\n // This method is specifically for delivering a new captured I420 frame to\n\n // VideoEngine.\n\n // |capture_time| must be specified in the NTP time format in milliseconds.\n\n virtual int IncomingFrameI420(\n\n const ViEVideoFrameI420& video_frame,\n\n unsigned long long capture_time = 0) = 0;\n\n\n\n virtual void SwapFrame(I420VideoFrame* frame) {}\n\n};\n\n\n", "file_path": "video_engine/include/vie_capture.h", "rank": 71, "score": 113907.7031673224 }, { "content": "// VoERTP_RTCP\n\nclass WEBRTC_DLLEXPORT VoERTP_RTCP\n\n{\n\npublic:\n\n\n\n // Factory for the VoERTP_RTCP sub-API. Increases an internal\n\n // reference counter if successful. Returns NULL if the API is not\n\n // supported or if construction fails.\n\n static VoERTP_RTCP* GetInterface(VoiceEngine* voiceEngine);\n\n\n\n // Releases the VoERTP_RTCP sub-API and decreases an internal\n\n // reference counter. Returns the new reference count. This value should\n\n // be zero for all sub-API:s before the VoiceEngine object can be safely\n\n // deleted.\n\n virtual int Release() = 0;\n\n\n\n // Sets the local RTP synchronization source identifier (SSRC) explicitly.\n\n virtual int SetLocalSSRC(int channel, unsigned int ssrc) = 0;\n\n\n\n // Gets the local RTP SSRC of a specified |channel|.\n\n virtual int GetLocalSSRC(int channel, unsigned int& ssrc) = 0;\n", "file_path": "voice_engine/include/voe_rtp_rtcp.h", "rank": 72, "score": 113907.7031673224 }, { "content": "// This class declares an abstract interface for a user defined observer. It is\n\n// up to the VideoEngine user to implement a derived class which implements the\n\n// observer class. The observer is registered using RegisterObserver() and\n\n// deregistered using DeregisterObserver().\n\nclass WEBRTC_DLLEXPORT ViECaptureObserver {\n\n public:\n\n // This method is called if a bright or dark captured image is detected.\n\n virtual void BrightnessAlarm(const int capture_id,\n\n const Brightness brightness) = 0;\n\n\n\n // This method is called periodically telling the capture device frame rate.\n\n virtual void CapturedFrameRate(const int capture_id,\n\n const unsigned char frame_rate) = 0;\n\n\n\n // This method is called if the capture device stops delivering images to\n\n // VideoEngine.\n\n virtual void NoPictureAlarm(const int capture_id,\n\n const CaptureAlarm alarm) = 0;\n\n\n\n protected:\n\n virtual ~ViECaptureObserver() {}\n\n};\n\n\n", "file_path": "video_engine/include/vie_capture.h", "rank": 73, "score": 113907.7031673224 }, { "content": "// This class declares an abstract interface for a user defined observer. It is\n\n// up to the VideoEngine user to implement a derived class which implements the\n\n// observer class. The observer is registered using RegisterDecoderObserver()\n\n// and deregistered using DeregisterDecoderObserver().\n\nclass WEBRTC_DLLEXPORT ViEDecoderObserver {\n\n public:\n\n // This method is called when a new incoming stream is detected, normally\n\n // triggered by a new incoming SSRC or payload type.\n\n virtual void IncomingCodecChanged(const int video_channel,\n\n const VideoCodec& video_codec) = 0;\n\n\n\n // This method is called once per second containing the frame rate and bit\n\n // rate for the incoming stream\n\n virtual void IncomingRate(const int video_channel,\n\n const unsigned int framerate,\n\n const unsigned int bitrate) = 0;\n\n\n\n // Called periodically with decoder timing information. All values are\n\n // \"current\" snapshots unless decorated with a min_/max_ prefix.\n\n virtual void DecoderTiming(int decode_ms,\n\n int max_decode_ms,\n\n int current_delay_ms,\n\n int target_delay_ms,\n\n int jitter_buffer_ms,\n", "file_path": "video_engine/include/vie_codec.h", "rank": 74, "score": 113907.7031673224 }, { "content": "// This class declares an abstract interface for a user defined observer. It is\n\n// up to the VideoEngine user to implement a derived class which implements the\n\n// observer class. The observer is registered using RegisterEncoderObserver()\n\n// and deregistered using DeregisterEncoderObserver().\n\nclass WEBRTC_DLLEXPORT ViEEncoderObserver {\n\n public:\n\n // This method is called once per second with the current encoded frame rate\n\n // and bit rate.\n\n virtual void OutgoingRate(const int video_channel,\n\n const unsigned int framerate,\n\n const unsigned int bitrate) = 0;\n\n\n\n // This method is called whenever the state of the SuspendBelowMinBitrate\n\n // changes, i.e., when |is_suspended| toggles.\n\n virtual void SuspendChange(int video_channel, bool is_suspended) = 0;\n\n\n\n protected:\n\n virtual ~ViEEncoderObserver() {}\n\n};\n\n\n", "file_path": "video_engine/include/vie_codec.h", "rank": 75, "score": 113907.7031673224 }, { "content": "// VoERTPObserver\n\nclass WEBRTC_DLLEXPORT VoERTPObserver\n\n{\n\npublic:\n\n virtual void OnIncomingCSRCChanged(\n\n int channel, unsigned int CSRC, bool added) = 0;\n\n\n\n virtual void OnIncomingSSRCChanged(\n\n int channel, unsigned int SSRC) = 0;\n\n\n\nprotected:\n\n virtual ~VoERTPObserver() {}\n\n};\n\n\n", "file_path": "voice_engine/include/voe_rtp_rtcp.h", "rank": 76, "score": 113907.7031673224 }, { "content": "namespace webrtc {\n\n\n\n// Table for average FEC recovery from packet loss, for XOR code.\n\n// From RPL model of random loss.\n\n// Input is the received packet loss (up to 50%), and FEC code parameters\n\n// (up to 24x24):\n\n// i.e., kAvgFECRecoveryXOR[k] where k = code_i*129 + loss_j;\n\n// code_i=1x1,2x1,2x2,..24x24, loss_j = 0,1,..128.\n\n\n\n// Maximum number of source packets in off-line model\n\nstatic const int kMaxNumPackets = 24;\n\n// Max value of loss rates in off-line model\n\nstatic const int kPacketLossMax = 129;\n\n\n\n// Table size for model is: kPacketLossMax * numberOfFecCodes = 38700\n\n// numberOfFecCodes is determined as:\n\n// {(1,1), (2,1), (2,2),...(n,1),..(n,n-1), (n,n)} = n*(n+1)/2\n\n// for n = kMaxNumPackets.\n\nstatic const int kSizeAvgFECRecoveryXOR = 38700;\n\nstatic const unsigned char kAvgFECRecoveryXOR[kSizeAvgFECRecoveryXOR] = {\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n46,\n\n46,\n\n47,\n\n47,\n\n48,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n51,\n\n51,\n\n52,\n\n52,\n\n52,\n\n53,\n\n53,\n\n54,\n\n54,\n\n54,\n\n55,\n\n55,\n\n55,\n\n56,\n\n56,\n\n56,\n\n57,\n\n57,\n\n57,\n\n58,\n\n58,\n\n58,\n\n59,\n\n59,\n\n59,\n\n59,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n31,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n45,\n\n45,\n\n46,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n51,\n\n51,\n\n52,\n\n52,\n\n53,\n\n53,\n\n54,\n\n54,\n\n55,\n\n55,\n\n56,\n\n56,\n\n56,\n\n57,\n\n57,\n\n58,\n\n58,\n\n58,\n\n59,\n\n59,\n\n59,\n\n60,\n\n60,\n\n60,\n\n60,\n\n61,\n\n61,\n\n61,\n\n61,\n\n62,\n\n62,\n\n62,\n\n62,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n63,\n\n63,\n\n63,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n21,\n\n22,\n\n22,\n\n22,\n\n23,\n\n23,\n\n23,\n\n23,\n\n24,\n\n24,\n\n24,\n\n24,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n24,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n41,\n\n42,\n\n42,\n\n43,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n45,\n\n46,\n\n46,\n\n46,\n\n46,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n45,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n43,\n\n42,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n51,\n\n51,\n\n52,\n\n53,\n\n53,\n\n54,\n\n54,\n\n55,\n\n55,\n\n56,\n\n56,\n\n57,\n\n57,\n\n58,\n\n58,\n\n59,\n\n59,\n\n60,\n\n60,\n\n61,\n\n61,\n\n61,\n\n62,\n\n62,\n\n62,\n\n63,\n\n63,\n\n63,\n\n63,\n\n64,\n\n64,\n\n64,\n\n64,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n66,\n\n66,\n\n66,\n\n66,\n\n66,\n\n66,\n\n66,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n64,\n\n64,\n\n64,\n\n64,\n\n63,\n\n63,\n\n63,\n\n63,\n\n62,\n\n62,\n\n62,\n\n61,\n\n61,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n7,\n\n8,\n\n9,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n18,\n\n18,\n\n18,\n\n18,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n35,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n46,\n\n46,\n\n47,\n\n47,\n\n48,\n\n48,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n51,\n\n51,\n\n51,\n\n51,\n\n52,\n\n52,\n\n52,\n\n52,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n51,\n\n51,\n\n51,\n\n51,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n49,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n47,\n\n46,\n\n46,\n\n45,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n54,\n\n54,\n\n55,\n\n55,\n\n56,\n\n57,\n\n57,\n\n58,\n\n58,\n\n59,\n\n59,\n\n60,\n\n60,\n\n61,\n\n61,\n\n62,\n\n62,\n\n62,\n\n63,\n\n63,\n\n64,\n\n64,\n\n64,\n\n65,\n\n65,\n\n65,\n\n65,\n\n66,\n\n66,\n\n66,\n\n66,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n68,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n66,\n\n66,\n\n66,\n\n66,\n\n65,\n\n65,\n\n65,\n\n65,\n\n64,\n\n64,\n\n64,\n\n63,\n\n63,\n\n63,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n8,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n28,\n\n28,\n\n29,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n43,\n\n43,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n46,\n\n46,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n41,\n\n40,\n\n40,\n\n40,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n51,\n\n51,\n\n51,\n\n52,\n\n52,\n\n53,\n\n53,\n\n53,\n\n54,\n\n54,\n\n54,\n\n55,\n\n55,\n\n55,\n\n55,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n54,\n\n54,\n\n54,\n\n53,\n\n53,\n\n53,\n\n52,\n\n52,\n\n52,\n\n51,\n\n51,\n\n50,\n\n50,\n\n49,\n\n49,\n\n49,\n\n48,\n\n48,\n\n47,\n\n47,\n\n46,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n49,\n\n50,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n54,\n\n54,\n\n55,\n\n56,\n\n56,\n\n57,\n\n57,\n\n58,\n\n58,\n\n59,\n\n60,\n\n60,\n\n61,\n\n61,\n\n61,\n\n62,\n\n62,\n\n63,\n\n63,\n\n64,\n\n64,\n\n64,\n\n65,\n\n65,\n\n65,\n\n66,\n\n66,\n\n66,\n\n66,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n66,\n\n66,\n\n66,\n\n66,\n\n65,\n\n65,\n\n65,\n\n64,\n\n64,\n\n64,\n\n63,\n\n63,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n5,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n9,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n11,\n\n12,\n\n12,\n\n12,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n22,\n\n22,\n\n22,\n\n23,\n\n23,\n\n24,\n\n24,\n\n24,\n\n25,\n\n25,\n\n25,\n\n25,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n38,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n46,\n\n46,\n\n46,\n\n47,\n\n47,\n\n47,\n\n48,\n\n48,\n\n48,\n\n49,\n\n49,\n\n49,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n49,\n\n49,\n\n49,\n\n48,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n47,\n\n47,\n\n46,\n\n46,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n50,\n\n50,\n\n51,\n\n51,\n\n52,\n\n52,\n\n53,\n\n53,\n\n54,\n\n54,\n\n55,\n\n55,\n\n56,\n\n56,\n\n56,\n\n57,\n\n57,\n\n57,\n\n58,\n\n58,\n\n58,\n\n58,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n58,\n\n58,\n\n58,\n\n58,\n\n57,\n\n57,\n\n57,\n\n56,\n\n56,\n\n56,\n\n55,\n\n55,\n\n55,\n\n54,\n\n54,\n\n53,\n\n53,\n\n52,\n\n52,\n\n51,\n\n51,\n\n50,\n\n50,\n\n49,\n\n49,\n\n48,\n\n48,\n\n47,\n\n46,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n48,\n\n49,\n\n50,\n\n50,\n\n51,\n\n52,\n\n53,\n\n53,\n\n54,\n\n55,\n\n55,\n\n56,\n\n57,\n\n57,\n\n58,\n\n58,\n\n59,\n\n60,\n\n60,\n\n61,\n\n61,\n\n62,\n\n62,\n\n63,\n\n63,\n\n63,\n\n64,\n\n64,\n\n64,\n\n65,\n\n65,\n\n65,\n\n66,\n\n66,\n\n66,\n\n66,\n\n66,\n\n66,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n66,\n\n66,\n\n66,\n\n66,\n\n66,\n\n66,\n\n65,\n\n65,\n\n65,\n\n64,\n\n64,\n\n64,\n\n63,\n\n63,\n\n63,\n\n62,\n\n62,\n\n61,\n\n61,\n\n60,\n\n60,\n\n59,\n\n59,\n\n58,\n\n57,\n\n57,\n\n56,\n\n55,\n\n55,\n\n54,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n5,\n\n6,\n\n6,\n\n7,\n\n8,\n\n8,\n\n9,\n\n9,\n\n9,\n\n10,\n\n10,\n\n10,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n19,\n\n20,\n\n20,\n\n20,\n\n21,\n\n21,\n\n21,\n\n22,\n\n22,\n\n22,\n\n22,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n24,\n\n24,\n\n24,\n\n24,\n\n24,\n\n24,\n\n24,\n\n24,\n\n24,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n36,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n43,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n41,\n\n40,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n46,\n\n46,\n\n47,\n\n47,\n\n48,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n51,\n\n51,\n\n51,\n\n52,\n\n52,\n\n52,\n\n52,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n51,\n\n51,\n\n51,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n49,\n\n48,\n\n48,\n\n47,\n\n47,\n\n46,\n\n46,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n45,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n50,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n54,\n\n54,\n\n55,\n\n55,\n\n56,\n\n56,\n\n57,\n\n57,\n\n58,\n\n58,\n\n59,\n\n59,\n\n59,\n\n60,\n\n60,\n\n60,\n\n61,\n\n61,\n\n61,\n\n61,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n63,\n\n63,\n\n63,\n\n63,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n61,\n\n61,\n\n61,\n\n61,\n\n60,\n\n60,\n\n60,\n\n59,\n\n59,\n\n58,\n\n58,\n\n58,\n\n57,\n\n57,\n\n56,\n\n56,\n\n55,\n\n55,\n\n54,\n\n54,\n\n53,\n\n52,\n\n52,\n\n51,\n\n51,\n\n50,\n\n49,\n\n49,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n54,\n\n55,\n\n55,\n\n56,\n\n57,\n\n57,\n\n58,\n\n59,\n\n59,\n\n60,\n\n61,\n\n61,\n\n62,\n\n62,\n\n63,\n\n63,\n\n64,\n\n64,\n\n65,\n\n65,\n\n65,\n\n66,\n\n66,\n\n66,\n\n67,\n\n67,\n\n67,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n67,\n\n67,\n\n67,\n\n67,\n\n66,\n\n66,\n\n65,\n\n65,\n\n65,\n\n64,\n\n64,\n\n63,\n\n63,\n\n62,\n\n62,\n\n61,\n\n61,\n\n60,\n\n59,\n\n59,\n\n58,\n\n57,\n\n57,\n\n56,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n9,\n\n9,\n\n9,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n18,\n\n19,\n\n19,\n\n19,\n\n19,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n27,\n\n28,\n\n28,\n\n28,\n\n29,\n\n29,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n38,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n43,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n46,\n\n46,\n\n46,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n46,\n\n46,\n\n46,\n\n46,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n44,\n\n45,\n\n45,\n\n46,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n51,\n\n51,\n\n52,\n\n52,\n\n53,\n\n53,\n\n53,\n\n54,\n\n54,\n\n54,\n\n55,\n\n55,\n\n55,\n\n55,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n55,\n\n55,\n\n55,\n\n55,\n\n54,\n\n54,\n\n54,\n\n54,\n\n53,\n\n53,\n\n53,\n\n52,\n\n52,\n\n51,\n\n51,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n48,\n\n48,\n\n47,\n\n46,\n\n46,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n43,\n\n42,\n\n41,\n\n41,\n\n40,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n51,\n\n51,\n\n52,\n\n53,\n\n53,\n\n54,\n\n55,\n\n55,\n\n56,\n\n56,\n\n57,\n\n57,\n\n58,\n\n58,\n\n59,\n\n59,\n\n60,\n\n60,\n\n60,\n\n61,\n\n61,\n\n61,\n\n62,\n\n62,\n\n62,\n\n62,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n62,\n\n62,\n\n62,\n\n62,\n\n61,\n\n61,\n\n61,\n\n60,\n\n60,\n\n60,\n\n59,\n\n59,\n\n58,\n\n58,\n\n57,\n\n57,\n\n56,\n\n56,\n\n55,\n\n55,\n\n54,\n\n54,\n\n53,\n\n52,\n\n52,\n\n51,\n\n50,\n\n50,\n\n49,\n\n48,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n48,\n\n49,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n54,\n\n55,\n\n56,\n\n56,\n\n57,\n\n58,\n\n59,\n\n59,\n\n60,\n\n61,\n\n61,\n\n62,\n\n63,\n\n63,\n\n64,\n\n65,\n\n65,\n\n66,\n\n66,\n\n67,\n\n67,\n\n68,\n\n68,\n\n68,\n\n69,\n\n69,\n\n69,\n\n70,\n\n70,\n\n70,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n70,\n\n70,\n\n70,\n\n69,\n\n69,\n\n69,\n\n68,\n\n68,\n\n67,\n\n67,\n\n66,\n\n66,\n\n65,\n\n65,\n\n64,\n\n64,\n\n63,\n\n62,\n\n62,\n\n61,\n\n60,\n\n59,\n\n59,\n\n58,\n\n57,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n4,\n\n5,\n\n6,\n\n6,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n7,\n\n8,\n\n9,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n17,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n22,\n\n22,\n\n23,\n\n23,\n\n24,\n\n24,\n\n24,\n\n25,\n\n25,\n\n25,\n\n26,\n\n26,\n\n26,\n\n26,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n35,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n15,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n40,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n42,\n\n43,\n\n43,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n41,\n\n40,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n48,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n51,\n\n51,\n\n51,\n\n51,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n51,\n\n51,\n\n51,\n\n51,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n49,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n46,\n\n46,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n53,\n\n54,\n\n54,\n\n55,\n\n55,\n\n56,\n\n56,\n\n56,\n\n57,\n\n57,\n\n57,\n\n58,\n\n58,\n\n58,\n\n58,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n58,\n\n58,\n\n58,\n\n58,\n\n57,\n\n57,\n\n57,\n\n56,\n\n56,\n\n56,\n\n55,\n\n55,\n\n54,\n\n54,\n\n53,\n\n53,\n\n52,\n\n52,\n\n51,\n\n51,\n\n50,\n\n49,\n\n49,\n\n48,\n\n48,\n\n47,\n\n46,\n\n46,\n\n45,\n\n44,\n\n44,\n\n43,\n\n42,\n\n42,\n\n41,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n54,\n\n54,\n\n55,\n\n56,\n\n56,\n\n57,\n\n58,\n\n58,\n\n59,\n\n59,\n\n60,\n\n60,\n\n61,\n\n61,\n\n62,\n\n62,\n\n63,\n\n63,\n\n63,\n\n64,\n\n64,\n\n64,\n\n64,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n66,\n\n66,\n\n66,\n\n66,\n\n66,\n\n66,\n\n66,\n\n66,\n\n66,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n64,\n\n64,\n\n64,\n\n63,\n\n63,\n\n63,\n\n62,\n\n62,\n\n61,\n\n61,\n\n60,\n\n60,\n\n59,\n\n59,\n\n58,\n\n58,\n\n57,\n\n56,\n\n56,\n\n55,\n\n54,\n\n54,\n\n53,\n\n52,\n\n52,\n\n51,\n\n50,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n50,\n\n51,\n\n51,\n\n52,\n\n53,\n\n54,\n\n55,\n\n55,\n\n56,\n\n57,\n\n58,\n\n58,\n\n59,\n\n60,\n\n61,\n\n61,\n\n62,\n\n62,\n\n63,\n\n64,\n\n64,\n\n65,\n\n65,\n\n66,\n\n66,\n\n67,\n\n67,\n\n68,\n\n68,\n\n68,\n\n69,\n\n69,\n\n69,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n69,\n\n69,\n\n69,\n\n68,\n\n68,\n\n67,\n\n67,\n\n66,\n\n66,\n\n65,\n\n65,\n\n64,\n\n64,\n\n63,\n\n63,\n\n62,\n\n61,\n\n61,\n\n60,\n\n59,\n\n58,\n\n58,\n\n57,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n4,\n\n5,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n7,\n\n8,\n\n9,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n22,\n\n22,\n\n22,\n\n23,\n\n23,\n\n23,\n\n24,\n\n24,\n\n24,\n\n24,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n31,\n\n31,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n39,\n\n39,\n\n40,\n\n40,\n\n40,\n\n40,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n42,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n46,\n\n46,\n\n46,\n\n46,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n46,\n\n46,\n\n46,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n45,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n51,\n\n51,\n\n52,\n\n52,\n\n52,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n53,\n\n53,\n\n53,\n\n53,\n\n52,\n\n52,\n\n52,\n\n51,\n\n51,\n\n51,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n48,\n\n48,\n\n47,\n\n47,\n\n46,\n\n46,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n45,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n50,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n53,\n\n54,\n\n55,\n\n55,\n\n56,\n\n56,\n\n57,\n\n57,\n\n57,\n\n58,\n\n58,\n\n59,\n\n59,\n\n59,\n\n60,\n\n60,\n\n60,\n\n60,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n60,\n\n60,\n\n60,\n\n60,\n\n59,\n\n59,\n\n59,\n\n58,\n\n58,\n\n57,\n\n57,\n\n57,\n\n56,\n\n56,\n\n55,\n\n55,\n\n54,\n\n53,\n\n53,\n\n52,\n\n52,\n\n51,\n\n51,\n\n50,\n\n49,\n\n49,\n\n48,\n\n47,\n\n47,\n\n46,\n\n45,\n\n44,\n\n44,\n\n0,\n\n1,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n54,\n\n54,\n\n55,\n\n56,\n\n56,\n\n57,\n\n58,\n\n58,\n\n59,\n\n59,\n\n60,\n\n60,\n\n60,\n\n61,\n\n61,\n\n62,\n\n62,\n\n62,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n64,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n62,\n\n62,\n\n62,\n\n62,\n\n61,\n\n61,\n\n60,\n\n60,\n\n59,\n\n59,\n\n58,\n\n58,\n\n57,\n\n57,\n\n56,\n\n55,\n\n55,\n\n54,\n\n53,\n\n53,\n\n52,\n\n51,\n\n50,\n\n50,\n\n49,\n\n48,\n\n47,\n\n46,\n\n45,\n\n44,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n49,\n\n50,\n\n51,\n\n52,\n\n53,\n\n54,\n\n54,\n\n55,\n\n56,\n\n57,\n\n58,\n\n59,\n\n59,\n\n60,\n\n61,\n\n62,\n\n62,\n\n63,\n\n64,\n\n64,\n\n65,\n\n65,\n\n66,\n\n67,\n\n67,\n\n68,\n\n68,\n\n69,\n\n69,\n\n70,\n\n70,\n\n71,\n\n71,\n\n71,\n\n72,\n\n72,\n\n72,\n\n72,\n\n73,\n\n73,\n\n73,\n\n73,\n\n73,\n\n73,\n\n73,\n\n73,\n\n73,\n\n73,\n\n73,\n\n73,\n\n73,\n\n73,\n\n72,\n\n72,\n\n72,\n\n72,\n\n71,\n\n71,\n\n70,\n\n70,\n\n70,\n\n69,\n\n69,\n\n68,\n\n68,\n\n67,\n\n66,\n\n66,\n\n65,\n\n64,\n\n64,\n\n63,\n\n62,\n\n61,\n\n61,\n\n60,\n\n59,\n\n58,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n4,\n\n5,\n\n5,\n\n6,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n7,\n\n8,\n\n9,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n20,\n\n21,\n\n21,\n\n21,\n\n22,\n\n22,\n\n22,\n\n22,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n28,\n\n29,\n\n29,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n35,\n\n35,\n\n36,\n\n36,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n43,\n\n43,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n46,\n\n46,\n\n47,\n\n47,\n\n47,\n\n48,\n\n48,\n\n48,\n\n49,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n49,\n\n49,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n47,\n\n46,\n\n46,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n51,\n\n51,\n\n52,\n\n52,\n\n53,\n\n53,\n\n54,\n\n54,\n\n54,\n\n55,\n\n55,\n\n55,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n55,\n\n55,\n\n55,\n\n54,\n\n54,\n\n54,\n\n53,\n\n53,\n\n53,\n\n52,\n\n52,\n\n51,\n\n51,\n\n50,\n\n50,\n\n49,\n\n49,\n\n48,\n\n48,\n\n47,\n\n47,\n\n46,\n\n45,\n\n45,\n\n44,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n54,\n\n54,\n\n55,\n\n55,\n\n56,\n\n56,\n\n57,\n\n57,\n\n58,\n\n58,\n\n59,\n\n59,\n\n59,\n\n60,\n\n60,\n\n60,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n60,\n\n60,\n\n60,\n\n60,\n\n59,\n\n59,\n\n58,\n\n58,\n\n57,\n\n57,\n\n57,\n\n56,\n\n55,\n\n55,\n\n54,\n\n54,\n\n53,\n\n52,\n\n52,\n\n51,\n\n50,\n\n50,\n\n49,\n\n48,\n\n47,\n\n47,\n\n46,\n\n45,\n\n44,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n39,\n\n38,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n50,\n\n50,\n\n51,\n\n52,\n\n53,\n\n54,\n\n54,\n\n55,\n\n56,\n\n57,\n\n57,\n\n58,\n\n59,\n\n59,\n\n60,\n\n61,\n\n61,\n\n62,\n\n62,\n\n63,\n\n63,\n\n64,\n\n64,\n\n65,\n\n65,\n\n65,\n\n66,\n\n66,\n\n66,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n66,\n\n66,\n\n66,\n\n65,\n\n65,\n\n64,\n\n64,\n\n64,\n\n63,\n\n63,\n\n62,\n\n61,\n\n61,\n\n60,\n\n60,\n\n59,\n\n58,\n\n57,\n\n57,\n\n56,\n\n55,\n\n54,\n\n54,\n\n53,\n\n52,\n\n51,\n\n50,\n\n49,\n\n49,\n\n48,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n50,\n\n51,\n\n52,\n\n53,\n\n54,\n\n55,\n\n55,\n\n56,\n\n57,\n\n58,\n\n59,\n\n59,\n\n60,\n\n61,\n\n62,\n\n62,\n\n63,\n\n64,\n\n64,\n\n65,\n\n66,\n\n66,\n\n67,\n\n67,\n\n68,\n\n68,\n\n69,\n\n69,\n\n70,\n\n70,\n\n70,\n\n71,\n\n71,\n\n71,\n\n72,\n\n72,\n\n72,\n\n72,\n\n72,\n\n72,\n\n73,\n\n73,\n\n73,\n\n73,\n\n73,\n\n72,\n\n72,\n\n72,\n\n72,\n\n72,\n\n72,\n\n71,\n\n71,\n\n71,\n\n70,\n\n70,\n\n70,\n\n69,\n\n69,\n\n68,\n\n68,\n\n67,\n\n66,\n\n66,\n\n65,\n\n65,\n\n64,\n\n63,\n\n62,\n\n62,\n\n61,\n\n60,\n\n59,\n\n58,\n\n58,\n\n57,\n\n56,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n3,\n\n4,\n\n5,\n\n5,\n\n5,\n\n6,\n\n6,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n8,\n\n8,\n\n9,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n12,\n\n13,\n\n13,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n9,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n20,\n\n20,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n22,\n\n23,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n26,\n\n27,\n\n27,\n\n27,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n40,\n\n40,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n40,\n\n40,\n\n40,\n\n40,\n\n39,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n46,\n\n46,\n\n46,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n46,\n\n46,\n\n46,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n47,\n\n48,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n51,\n\n51,\n\n51,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n51,\n\n51,\n\n51,\n\n51,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n46,\n\n46,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n44,\n\n45,\n\n45,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n50,\n\n50,\n\n51,\n\n51,\n\n52,\n\n52,\n\n53,\n\n53,\n\n54,\n\n54,\n\n55,\n\n55,\n\n56,\n\n56,\n\n56,\n\n56,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n56,\n\n56,\n\n56,\n\n55,\n\n55,\n\n55,\n\n54,\n\n54,\n\n53,\n\n53,\n\n52,\n\n52,\n\n51,\n\n51,\n\n50,\n\n50,\n\n49,\n\n48,\n\n48,\n\n47,\n\n46,\n\n46,\n\n45,\n\n44,\n\n43,\n\n43,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n49,\n\n50,\n\n51,\n\n51,\n\n52,\n\n53,\n\n53,\n\n54,\n\n55,\n\n55,\n\n56,\n\n57,\n\n57,\n\n58,\n\n58,\n\n59,\n\n59,\n\n60,\n\n60,\n\n60,\n\n61,\n\n61,\n\n62,\n\n62,\n\n62,\n\n62,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n62,\n\n62,\n\n62,\n\n61,\n\n61,\n\n61,\n\n60,\n\n60,\n\n60,\n\n59,\n\n59,\n\n58,\n\n58,\n\n57,\n\n56,\n\n56,\n\n55,\n\n54,\n\n54,\n\n53,\n\n52,\n\n52,\n\n51,\n\n50,\n\n49,\n\n49,\n\n48,\n\n47,\n\n46,\n\n45,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n54,\n\n55,\n\n56,\n\n56,\n\n57,\n\n58,\n\n58,\n\n59,\n\n60,\n\n60,\n\n61,\n\n62,\n\n62,\n\n63,\n\n63,\n\n64,\n\n64,\n\n65,\n\n65,\n\n66,\n\n66,\n\n67,\n\n67,\n\n67,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n68,\n\n68,\n\n68,\n\n68,\n\n67,\n\n67,\n\n67,\n\n66,\n\n66,\n\n65,\n\n65,\n\n64,\n\n64,\n\n63,\n\n63,\n\n62,\n\n61,\n\n61,\n\n60,\n\n59,\n\n59,\n\n58,\n\n57,\n\n56,\n\n56,\n\n55,\n\n54,\n\n53,\n\n52,\n\n51,\n\n50,\n\n50,\n\n49,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n49,\n\n50,\n\n51,\n\n52,\n\n53,\n\n54,\n\n54,\n\n55,\n\n56,\n\n57,\n\n58,\n\n58,\n\n59,\n\n60,\n\n61,\n\n62,\n\n62,\n\n63,\n\n64,\n\n64,\n\n65,\n\n66,\n\n66,\n\n67,\n\n67,\n\n68,\n\n68,\n\n69,\n\n69,\n\n70,\n\n70,\n\n71,\n\n71,\n\n72,\n\n72,\n\n72,\n\n73,\n\n73,\n\n73,\n\n73,\n\n73,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n73,\n\n73,\n\n73,\n\n73,\n\n73,\n\n72,\n\n72,\n\n72,\n\n71,\n\n71,\n\n70,\n\n70,\n\n69,\n\n69,\n\n68,\n\n67,\n\n67,\n\n66,\n\n66,\n\n65,\n\n64,\n\n63,\n\n63,\n\n62,\n\n61,\n\n60,\n\n59,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n3,\n\n4,\n\n4,\n\n5,\n\n5,\n\n5,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n5,\n\n6,\n\n7,\n\n7,\n\n8,\n\n9,\n\n9,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n11,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n9,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n18,\n\n18,\n\n18,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n23,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n25,\n\n25,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n31,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n36,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n39,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n42,\n\n43,\n\n43,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n45,\n\n45,\n\n46,\n\n46,\n\n47,\n\n47,\n\n48,\n\n48,\n\n48,\n\n49,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n49,\n\n49,\n\n48,\n\n48,\n\n47,\n\n47,\n\n47,\n\n46,\n\n46,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n39,\n\n39,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n45,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n51,\n\n51,\n\n52,\n\n52,\n\n52,\n\n53,\n\n53,\n\n53,\n\n54,\n\n54,\n\n54,\n\n54,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n54,\n\n54,\n\n54,\n\n54,\n\n53,\n\n53,\n\n53,\n\n52,\n\n52,\n\n52,\n\n51,\n\n51,\n\n50,\n\n50,\n\n49,\n\n49,\n\n48,\n\n48,\n\n47,\n\n46,\n\n46,\n\n45,\n\n44,\n\n44,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n28,\n\n28,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n51,\n\n51,\n\n52,\n\n53,\n\n53,\n\n54,\n\n54,\n\n55,\n\n55,\n\n56,\n\n56,\n\n57,\n\n57,\n\n58,\n\n58,\n\n58,\n\n59,\n\n59,\n\n59,\n\n59,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n59,\n\n59,\n\n59,\n\n59,\n\n58,\n\n58,\n\n58,\n\n57,\n\n57,\n\n56,\n\n56,\n\n55,\n\n55,\n\n54,\n\n54,\n\n53,\n\n53,\n\n52,\n\n51,\n\n51,\n\n50,\n\n49,\n\n49,\n\n48,\n\n47,\n\n47,\n\n46,\n\n45,\n\n44,\n\n43,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n54,\n\n54,\n\n55,\n\n56,\n\n57,\n\n57,\n\n58,\n\n58,\n\n59,\n\n60,\n\n60,\n\n61,\n\n61,\n\n62,\n\n62,\n\n62,\n\n63,\n\n63,\n\n63,\n\n64,\n\n64,\n\n64,\n\n64,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n64,\n\n64,\n\n64,\n\n64,\n\n63,\n\n63,\n\n63,\n\n62,\n\n62,\n\n61,\n\n61,\n\n60,\n\n60,\n\n59,\n\n59,\n\n58,\n\n57,\n\n57,\n\n56,\n\n55,\n\n55,\n\n54,\n\n53,\n\n52,\n\n52,\n\n51,\n\n50,\n\n49,\n\n48,\n\n47,\n\n47,\n\n46,\n\n45,\n\n44,\n\n43,\n\n42,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n50,\n\n51,\n\n52,\n\n53,\n\n54,\n\n54,\n\n55,\n\n56,\n\n57,\n\n58,\n\n58,\n\n59,\n\n60,\n\n61,\n\n61,\n\n62,\n\n63,\n\n63,\n\n64,\n\n64,\n\n65,\n\n65,\n\n66,\n\n66,\n\n67,\n\n67,\n\n68,\n\n68,\n\n69,\n\n69,\n\n69,\n\n69,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n69,\n\n69,\n\n69,\n\n68,\n\n68,\n\n68,\n\n67,\n\n67,\n\n66,\n\n66,\n\n65,\n\n65,\n\n64,\n\n63,\n\n63,\n\n62,\n\n61,\n\n60,\n\n60,\n\n59,\n\n58,\n\n57,\n\n56,\n\n55,\n\n55,\n\n54,\n\n53,\n\n52,\n\n51,\n\n50,\n\n49,\n\n0,\n\n1,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n50,\n\n51,\n\n51,\n\n52,\n\n53,\n\n54,\n\n55,\n\n56,\n\n57,\n\n58,\n\n58,\n\n59,\n\n60,\n\n61,\n\n62,\n\n62,\n\n63,\n\n64,\n\n64,\n\n65,\n\n66,\n\n66,\n\n67,\n\n68,\n\n68,\n\n69,\n\n69,\n\n70,\n\n70,\n\n71,\n\n71,\n\n72,\n\n72,\n\n72,\n\n73,\n\n73,\n\n73,\n\n73,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n73,\n\n73,\n\n73,\n\n73,\n\n72,\n\n72,\n\n72,\n\n71,\n\n71,\n\n70,\n\n70,\n\n69,\n\n69,\n\n68,\n\n67,\n\n67,\n\n66,\n\n65,\n\n64,\n\n64,\n\n63,\n\n62,\n\n61,\n\n60,\n\n59,\n\n58,\n\n57,\n\n56,\n\n55,\n\n54,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n3,\n\n4,\n\n4,\n\n5,\n\n5,\n\n5,\n\n5,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n8,\n\n8,\n\n9,\n\n9,\n\n10,\n\n10,\n\n10,\n\n11,\n\n11,\n\n11,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n17,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n21,\n\n22,\n\n22,\n\n22,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n24,\n\n24,\n\n24,\n\n24,\n\n24,\n\n24,\n\n24,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n35,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n36,\n\n36,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n38,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n46,\n\n46,\n\n46,\n\n47,\n\n47,\n\n47,\n\n47,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n47,\n\n47,\n\n46,\n\n46,\n\n46,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n46,\n\n46,\n\n47,\n\n47,\n\n48,\n\n48,\n\n49,\n\n49,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n49,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n46,\n\n46,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n50,\n\n50,\n\n51,\n\n51,\n\n52,\n\n52,\n\n53,\n\n53,\n\n53,\n\n54,\n\n54,\n\n55,\n\n55,\n\n55,\n\n55,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n55,\n\n55,\n\n55,\n\n55,\n\n54,\n\n54,\n\n54,\n\n53,\n\n53,\n\n53,\n\n52,\n\n52,\n\n51,\n\n51,\n\n50,\n\n50,\n\n49,\n\n48,\n\n48,\n\n47,\n\n47,\n\n46,\n\n45,\n\n45,\n\n44,\n\n43,\n\n43,\n\n42,\n\n41,\n\n41,\n\n40,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n49,\n\n50,\n\n50,\n\n51,\n\n51,\n\n52,\n\n53,\n\n53,\n\n54,\n\n54,\n\n55,\n\n55,\n\n55,\n\n56,\n\n56,\n\n56,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n56,\n\n56,\n\n56,\n\n55,\n\n55,\n\n55,\n\n54,\n\n54,\n\n53,\n\n53,\n\n52,\n\n52,\n\n51,\n\n50,\n\n50,\n\n49,\n\n48,\n\n48,\n\n47,\n\n46,\n\n45,\n\n44,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n50,\n\n51,\n\n51,\n\n52,\n\n53,\n\n54,\n\n54,\n\n55,\n\n56,\n\n57,\n\n57,\n\n58,\n\n59,\n\n59,\n\n60,\n\n60,\n\n61,\n\n61,\n\n62,\n\n62,\n\n63,\n\n63,\n\n64,\n\n64,\n\n64,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n66,\n\n66,\n\n66,\n\n66,\n\n66,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n64,\n\n64,\n\n64,\n\n63,\n\n63,\n\n62,\n\n62,\n\n61,\n\n61,\n\n60,\n\n59,\n\n59,\n\n58,\n\n57,\n\n57,\n\n56,\n\n55,\n\n54,\n\n54,\n\n53,\n\n52,\n\n51,\n\n50,\n\n49,\n\n48,\n\n47,\n\n46,\n\n45,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n48,\n\n49,\n\n50,\n\n51,\n\n52,\n\n53,\n\n53,\n\n54,\n\n55,\n\n56,\n\n57,\n\n58,\n\n58,\n\n59,\n\n60,\n\n60,\n\n61,\n\n62,\n\n63,\n\n63,\n\n64,\n\n64,\n\n65,\n\n66,\n\n66,\n\n67,\n\n67,\n\n67,\n\n68,\n\n68,\n\n69,\n\n69,\n\n69,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n71,\n\n71,\n\n71,\n\n71,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n69,\n\n69,\n\n69,\n\n68,\n\n68,\n\n67,\n\n67,\n\n66,\n\n66,\n\n65,\n\n65,\n\n64,\n\n63,\n\n63,\n\n62,\n\n61,\n\n60,\n\n60,\n\n59,\n\n58,\n\n57,\n\n56,\n\n55,\n\n54,\n\n53,\n\n52,\n\n51,\n\n50,\n\n49,\n\n48,\n\n0,\n\n1,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n50,\n\n51,\n\n51,\n\n52,\n\n53,\n\n54,\n\n55,\n\n56,\n\n57,\n\n58,\n\n58,\n\n59,\n\n60,\n\n61,\n\n62,\n\n62,\n\n63,\n\n64,\n\n65,\n\n65,\n\n66,\n\n67,\n\n67,\n\n68,\n\n68,\n\n69,\n\n70,\n\n70,\n\n71,\n\n71,\n\n72,\n\n72,\n\n72,\n\n73,\n\n73,\n\n73,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n73,\n\n73,\n\n73,\n\n72,\n\n72,\n\n72,\n\n71,\n\n71,\n\n70,\n\n69,\n\n69,\n\n68,\n\n67,\n\n67,\n\n66,\n\n65,\n\n64,\n\n63,\n\n63,\n\n62,\n\n61,\n\n60,\n\n59,\n\n58,\n\n57,\n\n56,\n\n55,\n\n54,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n3,\n\n4,\n\n4,\n\n4,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n5,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n9,\n\n9,\n\n10,\n\n10,\n\n10,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n21,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n27,\n\n28,\n\n28,\n\n28,\n\n28,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n42,\n\n42,\n\n43,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n46,\n\n46,\n\n47,\n\n47,\n\n48,\n\n48,\n\n48,\n\n49,\n\n49,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n49,\n\n49,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n46,\n\n46,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n22,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n51,\n\n51,\n\n52,\n\n52,\n\n52,\n\n52,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n52,\n\n52,\n\n52,\n\n52,\n\n51,\n\n51,\n\n51,\n\n50,\n\n50,\n\n49,\n\n49,\n\n48,\n\n48,\n\n47,\n\n47,\n\n46,\n\n45,\n\n45,\n\n44,\n\n43,\n\n43,\n\n42,\n\n41,\n\n41,\n\n40,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n49,\n\n50,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n53,\n\n54,\n\n54,\n\n55,\n\n55,\n\n56,\n\n56,\n\n57,\n\n57,\n\n57,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n58,\n\n58,\n\n58,\n\n58,\n\n57,\n\n57,\n\n57,\n\n56,\n\n56,\n\n56,\n\n55,\n\n55,\n\n54,\n\n54,\n\n53,\n\n52,\n\n52,\n\n51,\n\n51,\n\n50,\n\n49,\n\n48,\n\n48,\n\n47,\n\n46,\n\n45,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n30,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n49,\n\n50,\n\n50,\n\n51,\n\n52,\n\n53,\n\n53,\n\n54,\n\n54,\n\n55,\n\n55,\n\n56,\n\n56,\n\n57,\n\n57,\n\n58,\n\n58,\n\n58,\n\n59,\n\n59,\n\n59,\n\n59,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n59,\n\n59,\n\n59,\n\n59,\n\n58,\n\n58,\n\n58,\n\n57,\n\n57,\n\n56,\n\n56,\n\n55,\n\n55,\n\n54,\n\n54,\n\n53,\n\n52,\n\n52,\n\n51,\n\n50,\n\n49,\n\n49,\n\n48,\n\n47,\n\n46,\n\n45,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n0,\n\n1,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n48,\n\n49,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n54,\n\n55,\n\n55,\n\n56,\n\n57,\n\n57,\n\n58,\n\n59,\n\n59,\n\n60,\n\n61,\n\n61,\n\n62,\n\n62,\n\n63,\n\n63,\n\n63,\n\n64,\n\n64,\n\n64,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n64,\n\n64,\n\n64,\n\n63,\n\n63,\n\n63,\n\n62,\n\n62,\n\n61,\n\n60,\n\n60,\n\n59,\n\n58,\n\n58,\n\n57,\n\n56,\n\n55,\n\n55,\n\n54,\n\n53,\n\n52,\n\n51,\n\n50,\n\n49,\n\n48,\n\n47,\n\n47,\n\n46,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n0,\n\n1,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n51,\n\n52,\n\n53,\n\n54,\n\n55,\n\n55,\n\n56,\n\n57,\n\n58,\n\n59,\n\n59,\n\n60,\n\n61,\n\n62,\n\n62,\n\n63,\n\n64,\n\n64,\n\n65,\n\n65,\n\n66,\n\n66,\n\n67,\n\n67,\n\n68,\n\n68,\n\n69,\n\n69,\n\n69,\n\n69,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n71,\n\n71,\n\n71,\n\n71,\n\n71,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n69,\n\n69,\n\n69,\n\n68,\n\n68,\n\n68,\n\n67,\n\n67,\n\n66,\n\n65,\n\n65,\n\n64,\n\n63,\n\n63,\n\n62,\n\n61,\n\n61,\n\n60,\n\n59,\n\n58,\n\n57,\n\n56,\n\n55,\n\n54,\n\n53,\n\n52,\n\n52,\n\n51,\n\n50,\n\n49,\n\n48,\n\n0,\n\n1,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n50,\n\n51,\n\n52,\n\n53,\n\n54,\n\n54,\n\n55,\n\n56,\n\n57,\n\n58,\n\n59,\n\n60,\n\n60,\n\n61,\n\n62,\n\n63,\n\n64,\n\n64,\n\n65,\n\n66,\n\n66,\n\n67,\n\n68,\n\n68,\n\n69,\n\n69,\n\n70,\n\n70,\n\n71,\n\n71,\n\n72,\n\n72,\n\n73,\n\n73,\n\n73,\n\n73,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n73,\n\n73,\n\n73,\n\n72,\n\n72,\n\n71,\n\n71,\n\n70,\n\n70,\n\n69,\n\n69,\n\n68,\n\n67,\n\n67,\n\n66,\n\n65,\n\n64,\n\n63,\n\n62,\n\n61,\n\n61,\n\n60,\n\n59,\n\n58,\n\n57,\n\n56,\n\n54,\n\n53,\n\n52,\n\n51,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n3,\n\n4,\n\n4,\n\n4,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n5,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n9,\n\n9,\n\n9,\n\n10,\n\n10,\n\n10,\n\n10,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n17,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n22,\n\n23,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n25,\n\n26,\n\n26,\n\n26,\n\n26,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n31,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n40,\n\n40,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n40,\n\n40,\n\n40,\n\n40,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n45,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n47,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n45,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n47,\n\n48,\n\n48,\n\n49,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n50,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n50,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n49,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n46,\n\n46,\n\n45,\n\n44,\n\n44,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n44,\n\n45,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n51,\n\n51,\n\n51,\n\n52,\n\n52,\n\n52,\n\n52,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n51,\n\n51,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n48,\n\n47,\n\n47,\n\n46,\n\n46,\n\n45,\n\n44,\n\n43,\n\n43,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n51,\n\n51,\n\n52,\n\n52,\n\n53,\n\n53,\n\n54,\n\n54,\n\n55,\n\n55,\n\n56,\n\n56,\n\n56,\n\n56,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n56,\n\n56,\n\n56,\n\n56,\n\n55,\n\n55,\n\n54,\n\n54,\n\n53,\n\n53,\n\n52,\n\n52,\n\n51,\n\n50,\n\n50,\n\n49,\n\n48,\n\n48,\n\n47,\n\n46,\n\n45,\n\n44,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n0,\n\n1,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n48,\n\n49,\n\n50,\n\n51,\n\n51,\n\n52,\n\n53,\n\n54,\n\n54,\n\n55,\n\n56,\n\n56,\n\n57,\n\n57,\n\n58,\n\n58,\n\n59,\n\n59,\n\n60,\n\n60,\n\n60,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n61,\n\n61,\n\n61,\n\n61,\n\n61,\n\n60,\n\n60,\n\n60,\n\n59,\n\n59,\n\n58,\n\n58,\n\n57,\n\n56,\n\n56,\n\n55,\n\n54,\n\n54,\n\n53,\n\n52,\n\n51,\n\n51,\n\n50,\n\n49,\n\n48,\n\n47,\n\n46,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n0,\n\n1,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n51,\n\n52,\n\n53,\n\n54,\n\n55,\n\n55,\n\n56,\n\n57,\n\n58,\n\n58,\n\n59,\n\n60,\n\n60,\n\n61,\n\n62,\n\n62,\n\n63,\n\n63,\n\n64,\n\n64,\n\n65,\n\n65,\n\n65,\n\n66,\n\n66,\n\n66,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n67,\n\n66,\n\n66,\n\n66,\n\n65,\n\n65,\n\n65,\n\n64,\n\n64,\n\n63,\n\n62,\n\n62,\n\n61,\n\n61,\n\n60,\n\n59,\n\n58,\n\n58,\n\n57,\n\n56,\n\n55,\n\n54,\n\n53,\n\n52,\n\n51,\n\n50,\n\n49,\n\n48,\n\n47,\n\n46,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n0,\n\n1,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n54,\n\n55,\n\n56,\n\n57,\n\n57,\n\n58,\n\n59,\n\n60,\n\n61,\n\n61,\n\n62,\n\n63,\n\n63,\n\n64,\n\n65,\n\n65,\n\n66,\n\n66,\n\n67,\n\n67,\n\n68,\n\n68,\n\n68,\n\n69,\n\n69,\n\n69,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n69,\n\n69,\n\n69,\n\n68,\n\n68,\n\n68,\n\n67,\n\n67,\n\n66,\n\n66,\n\n65,\n\n64,\n\n64,\n\n63,\n\n62,\n\n61,\n\n60,\n\n60,\n\n59,\n\n58,\n\n57,\n\n56,\n\n55,\n\n54,\n\n53,\n\n52,\n\n51,\n\n50,\n\n49,\n\n48,\n\n47,\n\n45,\n\n44,\n\n43,\n\n42,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n50,\n\n51,\n\n52,\n\n53,\n\n54,\n\n55,\n\n56,\n\n56,\n\n57,\n\n58,\n\n59,\n\n60,\n\n61,\n\n62,\n\n62,\n\n63,\n\n64,\n\n65,\n\n65,\n\n66,\n\n67,\n\n67,\n\n68,\n\n69,\n\n69,\n\n70,\n\n70,\n\n71,\n\n71,\n\n72,\n\n72,\n\n73,\n\n73,\n\n73,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n74,\n\n73,\n\n73,\n\n73,\n\n72,\n\n72,\n\n71,\n\n71,\n\n70,\n\n69,\n\n69,\n\n68,\n\n67,\n\n66,\n\n66,\n\n65,\n\n64,\n\n63,\n\n62,\n\n61,\n\n60,\n\n59,\n\n58,\n\n57,\n\n56,\n\n54,\n\n53,\n\n52,\n\n51,\n\n50,\n\n49,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n3,\n\n4,\n\n4,\n\n4,\n\n4,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n9,\n\n9,\n\n9,\n\n9,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n18,\n\n18,\n\n18,\n\n18,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n22,\n\n23,\n\n23,\n\n23,\n\n24,\n\n24,\n\n24,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n27,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n38,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n35,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n51,\n\n51,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n52,\n\n52,\n\n52,\n\n52,\n\n51,\n\n51,\n\n51,\n\n50,\n\n50,\n\n49,\n\n49,\n\n48,\n\n48,\n\n47,\n\n46,\n\n46,\n\n45,\n\n44,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n51,\n\n51,\n\n51,\n\n51,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n50,\n\n50,\n\n49,\n\n49,\n\n48,\n\n48,\n\n47,\n\n47,\n\n46,\n\n45,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n0,\n\n0,\n\n2,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n51,\n\n51,\n\n52,\n\n53,\n\n53,\n\n54,\n\n55,\n\n55,\n\n56,\n\n56,\n\n56,\n\n57,\n\n57,\n\n57,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n57,\n\n57,\n\n57,\n\n56,\n\n56,\n\n55,\n\n55,\n\n54,\n\n53,\n\n53,\n\n52,\n\n51,\n\n51,\n\n50,\n\n49,\n\n48,\n\n47,\n\n46,\n\n46,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n0,\n\n0,\n\n2,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n54,\n\n54,\n\n55,\n\n55,\n\n56,\n\n57,\n\n57,\n\n57,\n\n58,\n\n58,\n\n59,\n\n59,\n\n59,\n\n59,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n59,\n\n59,\n\n59,\n\n59,\n\n58,\n\n58,\n\n57,\n\n57,\n\n56,\n\n56,\n\n55,\n\n55,\n\n54,\n\n53,\n\n53,\n\n52,\n\n51,\n\n50,\n\n49,\n\n48,\n\n47,\n\n47,\n\n46,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n0,\n\n1,\n\n2,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n54,\n\n54,\n\n55,\n\n56,\n\n56,\n\n57,\n\n57,\n\n58,\n\n58,\n\n58,\n\n59,\n\n59,\n\n59,\n\n59,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n60,\n\n59,\n\n59,\n\n59,\n\n59,\n\n58,\n\n58,\n\n57,\n\n57,\n\n56,\n\n56,\n\n55,\n\n55,\n\n54,\n\n53,\n\n52,\n\n52,\n\n51,\n\n50,\n\n49,\n\n48,\n\n47,\n\n46,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n3,\n\n3,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n7,\n\n8,\n\n9,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n9,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n21,\n\n22,\n\n22,\n\n22,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n40,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n40,\n\n40,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n38,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n40,\n\n41,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n46,\n\n46,\n\n46,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n46,\n\n46,\n\n46,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n39,\n\n39,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n46,\n\n46,\n\n46,\n\n46,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n46,\n\n46,\n\n46,\n\n46,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n46,\n\n46,\n\n46,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n46,\n\n46,\n\n46,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n51,\n\n51,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n51,\n\n51,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n48,\n\n47,\n\n47,\n\n46,\n\n46,\n\n45,\n\n44,\n\n43,\n\n43,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n18,\n\n0,\n\n0,\n\n1,\n\n2,\n\n2,\n\n3,\n\n3,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n7,\n\n8,\n\n9,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n12,\n\n13,\n\n13,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n9,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n21,\n\n21,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n26,\n\n26,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n31,\n\n31,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n36,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n36,\n\n36,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n40,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n42,\n\n43,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n46,\n\n46,\n\n47,\n\n47,\n\n47,\n\n48,\n\n48,\n\n48,\n\n49,\n\n49,\n\n49,\n\n49,\n\n49,\n\n49,\n\n49,\n\n49,\n\n49,\n\n49,\n\n49,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n47,\n\n46,\n\n46,\n\n45,\n\n45,\n\n44,\n\n43,\n\n43,\n\n42,\n\n41,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n46,\n\n46,\n\n47,\n\n47,\n\n48,\n\n48,\n\n48,\n\n49,\n\n49,\n\n49,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n49,\n\n49,\n\n49,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n46,\n\n46,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n49,\n\n50,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n53,\n\n54,\n\n54,\n\n54,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n54,\n\n54,\n\n54,\n\n54,\n\n53,\n\n53,\n\n52,\n\n52,\n\n51,\n\n50,\n\n50,\n\n49,\n\n48,\n\n48,\n\n47,\n\n46,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n13,\n\n0,\n\n1,\n\n2,\n\n3,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n51,\n\n51,\n\n52,\n\n53,\n\n53,\n\n54,\n\n54,\n\n55,\n\n55,\n\n56,\n\n56,\n\n56,\n\n56,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n57,\n\n56,\n\n56,\n\n56,\n\n55,\n\n55,\n\n54,\n\n54,\n\n53,\n\n53,\n\n52,\n\n51,\n\n50,\n\n50,\n\n49,\n\n48,\n\n47,\n\n46,\n\n45,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n49,\n\n50,\n\n50,\n\n51,\n\n52,\n\n52,\n\n52,\n\n53,\n\n53,\n\n53,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n54,\n\n53,\n\n53,\n\n53,\n\n53,\n\n52,\n\n52,\n\n51,\n\n51,\n\n50,\n\n50,\n\n49,\n\n48,\n\n48,\n\n47,\n\n46,\n\n45,\n\n44,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n14,\n\n14,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n53,\n\n54,\n\n54,\n\n54,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n54,\n\n54,\n\n53,\n\n53,\n\n53,\n\n52,\n\n51,\n\n51,\n\n50,\n\n49,\n\n49,\n\n48,\n\n47,\n\n46,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n15,\n\n14,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n35,\n\n36,\n\n37,\n\n38,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n46,\n\n47,\n\n48,\n\n49,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n54,\n\n54,\n\n55,\n\n56,\n\n56,\n\n57,\n\n57,\n\n57,\n\n57,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n57,\n\n57,\n\n57,\n\n56,\n\n56,\n\n56,\n\n55,\n\n55,\n\n54,\n\n53,\n\n53,\n\n52,\n\n51,\n\n50,\n\n49,\n\n49,\n\n48,\n\n47,\n\n46,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n0,\n\n0,\n\n1,\n\n2,\n\n2,\n\n3,\n\n3,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n7,\n\n8,\n\n9,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n12,\n\n12,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n25,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n27,\n\n28,\n\n28,\n\n28,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n31,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n36,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n36,\n\n36,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n22,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n39,\n\n39,\n\n39,\n\n39,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n39,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n46,\n\n46,\n\n46,\n\n47,\n\n47,\n\n47,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n47,\n\n47,\n\n46,\n\n46,\n\n45,\n\n45,\n\n45,\n\n44,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n46,\n\n46,\n\n46,\n\n47,\n\n47,\n\n47,\n\n47,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n46,\n\n46,\n\n46,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n43,\n\n42,\n\n41,\n\n41,\n\n40,\n\n39,\n\n39,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n9,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n45,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n9,\n\n10,\n\n11,\n\n11,\n\n11,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n21,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n0,\n\n0,\n\n1,\n\n2,\n\n2,\n\n3,\n\n3,\n\n3,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n4,\n\n5,\n\n6,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n8,\n\n8,\n\n9,\n\n10,\n\n10,\n\n10,\n\n11,\n\n11,\n\n11,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n18,\n\n18,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n22,\n\n23,\n\n23,\n\n24,\n\n24,\n\n24,\n\n24,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n28,\n\n28,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n36,\n\n36,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n40,\n\n41,\n\n41,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n41,\n\n41,\n\n40,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n40,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n40,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n42,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n39,\n\n39,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n18,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n48,\n\n47,\n\n47,\n\n46,\n\n45,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n48,\n\n49,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n49,\n\n48,\n\n48,\n\n47,\n\n47,\n\n46,\n\n46,\n\n45,\n\n44,\n\n44,\n\n43,\n\n42,\n\n41,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n10,\n\n10,\n\n9,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n50,\n\n50,\n\n51,\n\n51,\n\n51,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n51,\n\n51,\n\n51,\n\n50,\n\n50,\n\n49,\n\n49,\n\n48,\n\n47,\n\n47,\n\n46,\n\n45,\n\n44,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n11,\n\n11,\n\n10,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n17,\n\n17,\n\n18,\n\n18,\n\n18,\n\n19,\n\n19,\n\n19,\n\n20,\n\n20,\n\n20,\n\n21,\n\n21,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n51,\n\n51,\n\n51,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n52,\n\n51,\n\n51,\n\n51,\n\n50,\n\n50,\n\n49,\n\n48,\n\n48,\n\n47,\n\n46,\n\n46,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n11,\n\n11,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n29,\n\n30,\n\n31,\n\n32,\n\n34,\n\n35,\n\n36,\n\n37,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n51,\n\n52,\n\n53,\n\n53,\n\n54,\n\n54,\n\n55,\n\n55,\n\n55,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n55,\n\n55,\n\n55,\n\n54,\n\n54,\n\n54,\n\n53,\n\n52,\n\n52,\n\n51,\n\n50,\n\n50,\n\n49,\n\n48,\n\n47,\n\n46,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n9,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n20,\n\n21,\n\n23,\n\n24,\n\n26,\n\n27,\n\n29,\n\n30,\n\n32,\n\n33,\n\n35,\n\n36,\n\n38,\n\n39,\n\n40,\n\n42,\n\n43,\n\n44,\n\n46,\n\n47,\n\n48,\n\n49,\n\n50,\n\n51,\n\n52,\n\n52,\n\n53,\n\n54,\n\n54,\n\n55,\n\n55,\n\n55,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n55,\n\n55,\n\n54,\n\n54,\n\n54,\n\n53,\n\n52,\n\n52,\n\n51,\n\n50,\n\n49,\n\n49,\n\n48,\n\n47,\n\n46,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n16,\n\n15,\n\n14,\n\n13,\n\n13,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n9,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n17,\n\n18,\n\n19,\n\n21,\n\n22,\n\n24,\n\n25,\n\n27,\n\n28,\n\n30,\n\n31,\n\n33,\n\n35,\n\n36,\n\n38,\n\n39,\n\n41,\n\n42,\n\n43,\n\n45,\n\n46,\n\n47,\n\n48,\n\n49,\n\n51,\n\n52,\n\n52,\n\n53,\n\n54,\n\n55,\n\n56,\n\n56,\n\n57,\n\n57,\n\n58,\n\n58,\n\n58,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n58,\n\n58,\n\n58,\n\n58,\n\n57,\n\n57,\n\n56,\n\n55,\n\n55,\n\n54,\n\n53,\n\n53,\n\n52,\n\n51,\n\n50,\n\n49,\n\n48,\n\n47,\n\n46,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n0,\n\n0,\n\n1,\n\n2,\n\n2,\n\n3,\n\n3,\n\n3,\n\n3,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n4,\n\n5,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n8,\n\n8,\n\n9,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n11,\n\n11,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n22,\n\n22,\n\n22,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n24,\n\n24,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n26,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n22,\n\n23,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n26,\n\n26,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n31,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n33,\n\n34,\n\n35,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n39,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n9,\n\n9,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n42,\n\n42,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n44,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n9,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n21,\n\n22,\n\n23,\n\n24,\n\n26,\n\n27,\n\n28,\n\n30,\n\n31,\n\n32,\n\n33,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n45,\n\n45,\n\n45,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n46,\n\n45,\n\n45,\n\n44,\n\n44,\n\n44,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n10,\n\n10,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n18,\n\n19,\n\n20,\n\n22,\n\n23,\n\n25,\n\n26,\n\n28,\n\n29,\n\n30,\n\n32,\n\n33,\n\n35,\n\n36,\n\n37,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n52,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n48,\n\n48,\n\n47,\n\n47,\n\n46,\n\n45,\n\n45,\n\n44,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n0,\n\n0,\n\n1,\n\n2,\n\n2,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n4,\n\n5,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n8,\n\n8,\n\n9,\n\n9,\n\n10,\n\n10,\n\n10,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n12,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n16,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n20,\n\n21,\n\n21,\n\n21,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n27,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n29,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n22,\n\n22,\n\n23,\n\n23,\n\n24,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n28,\n\n29,\n\n29,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n36,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n18,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n35,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n45,\n\n45,\n\n46,\n\n46,\n\n46,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n46,\n\n46,\n\n46,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n6,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n42,\n\n42,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n6,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n12,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n30,\n\n31,\n\n32,\n\n34,\n\n35,\n\n36,\n\n37,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n45,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n49,\n\n48,\n\n48,\n\n47,\n\n47,\n\n46,\n\n45,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n35,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n11,\n\n11,\n\n10,\n\n9,\n\n9,\n\n8,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n9,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n21,\n\n22,\n\n24,\n\n25,\n\n26,\n\n28,\n\n29,\n\n31,\n\n32,\n\n34,\n\n35,\n\n36,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n44,\n\n44,\n\n45,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n49,\n\n50,\n\n50,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n49,\n\n48,\n\n47,\n\n47,\n\n46,\n\n45,\n\n44,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n18,\n\n19,\n\n21,\n\n22,\n\n23,\n\n25,\n\n26,\n\n28,\n\n29,\n\n31,\n\n32,\n\n34,\n\n35,\n\n37,\n\n38,\n\n39,\n\n40,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n46,\n\n47,\n\n48,\n\n48,\n\n49,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n49,\n\n48,\n\n48,\n\n47,\n\n46,\n\n46,\n\n45,\n\n44,\n\n43,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n11,\n\n11,\n\n10,\n\n9,\n\n9,\n\n8,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n11,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n26,\n\n27,\n\n28,\n\n29,\n\n31,\n\n32,\n\n33,\n\n34,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n44,\n\n45,\n\n46,\n\n47,\n\n47,\n\n48,\n\n49,\n\n49,\n\n49,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n49,\n\n49,\n\n49,\n\n48,\n\n48,\n\n47,\n\n46,\n\n46,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n37,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n9,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n14,\n\n16,\n\n17,\n\n18,\n\n20,\n\n21,\n\n23,\n\n24,\n\n26,\n\n27,\n\n29,\n\n31,\n\n32,\n\n34,\n\n35,\n\n37,\n\n39,\n\n40,\n\n42,\n\n43,\n\n44,\n\n46,\n\n47,\n\n48,\n\n49,\n\n50,\n\n51,\n\n52,\n\n53,\n\n54,\n\n55,\n\n56,\n\n56,\n\n57,\n\n57,\n\n58,\n\n58,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n59,\n\n58,\n\n58,\n\n57,\n\n57,\n\n56,\n\n56,\n\n55,\n\n55,\n\n54,\n\n53,\n\n52,\n\n51,\n\n50,\n\n49,\n\n48,\n\n47,\n\n46,\n\n45,\n\n44,\n\n43,\n\n42,\n\n41,\n\n40,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n16,\n\n17,\n\n18,\n\n20,\n\n21,\n\n23,\n\n25,\n\n26,\n\n28,\n\n30,\n\n31,\n\n33,\n\n35,\n\n36,\n\n38,\n\n39,\n\n41,\n\n42,\n\n44,\n\n45,\n\n46,\n\n48,\n\n49,\n\n50,\n\n51,\n\n52,\n\n53,\n\n54,\n\n55,\n\n55,\n\n56,\n\n56,\n\n57,\n\n57,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n57,\n\n57,\n\n57,\n\n56,\n\n56,\n\n55,\n\n54,\n\n54,\n\n53,\n\n52,\n\n51,\n\n51,\n\n50,\n\n49,\n\n48,\n\n47,\n\n46,\n\n45,\n\n43,\n\n42,\n\n41,\n\n40,\n\n39,\n\n38,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n16,\n\n15,\n\n14,\n\n13,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n9,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n19,\n\n20,\n\n21,\n\n23,\n\n24,\n\n26,\n\n27,\n\n29,\n\n30,\n\n32,\n\n34,\n\n35,\n\n37,\n\n38,\n\n40,\n\n41,\n\n43,\n\n44,\n\n46,\n\n47,\n\n48,\n\n50,\n\n51,\n\n52,\n\n53,\n\n54,\n\n55,\n\n56,\n\n57,\n\n58,\n\n59,\n\n59,\n\n60,\n\n61,\n\n61,\n\n61,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n62,\n\n61,\n\n61,\n\n60,\n\n60,\n\n59,\n\n58,\n\n58,\n\n57,\n\n56,\n\n55,\n\n54,\n\n53,\n\n52,\n\n51,\n\n50,\n\n49,\n\n48,\n\n47,\n\n46,\n\n44,\n\n43,\n\n42,\n\n41,\n\n39,\n\n38,\n\n37,\n\n36,\n\n34,\n\n33,\n\n32,\n\n31,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n0,\n\n0,\n\n1,\n\n2,\n\n2,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n4,\n\n5,\n\n5,\n\n6,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n8,\n\n8,\n\n9,\n\n9,\n\n9,\n\n10,\n\n10,\n\n10,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n19,\n\n20,\n\n20,\n\n20,\n\n20,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n22,\n\n22,\n\n22,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n18,\n\n18,\n\n19,\n\n19,\n\n19,\n\n19,\n\n20,\n\n20,\n\n20,\n\n20,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n22,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n21,\n\n20,\n\n20,\n\n20,\n\n20,\n\n19,\n\n19,\n\n19,\n\n18,\n\n18,\n\n18,\n\n17,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n30,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n2,\n\n2,\n\n2,\n\n2,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n34,\n\n33,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n31,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n33,\n\n32,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n14,\n\n15,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n35,\n\n36,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n32,\n\n31,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n23,\n\n24,\n\n25,\n\n25,\n\n26,\n\n26,\n\n27,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n3,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n17,\n\n17,\n\n17,\n\n18,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n22,\n\n23,\n\n24,\n\n24,\n\n25,\n\n26,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n29,\n\n30,\n\n30,\n\n30,\n\n31,\n\n31,\n\n31,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n32,\n\n31,\n\n31,\n\n31,\n\n30,\n\n30,\n\n30,\n\n29,\n\n29,\n\n28,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n3,\n\n3,\n\n3,\n\n3,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n9,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n12,\n\n13,\n\n13,\n\n13,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n15,\n\n16,\n\n16,\n\n17,\n\n17,\n\n18,\n\n19,\n\n19,\n\n20,\n\n21,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n13,\n\n13,\n\n14,\n\n14,\n\n14,\n\n14,\n\n15,\n\n15,\n\n16,\n\n16,\n\n16,\n\n17,\n\n18,\n\n18,\n\n19,\n\n20,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n38,\n\n39,\n\n39,\n\n40,\n\n40,\n\n41,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n36,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n15,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n21,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n27,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n35,\n\n36,\n\n36,\n\n37,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n37,\n\n36,\n\n36,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n13,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n9,\n\n10,\n\n10,\n\n11,\n\n11,\n\n12,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n22,\n\n23,\n\n24,\n\n25,\n\n27,\n\n28,\n\n29,\n\n30,\n\n31,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n42,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n35,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n29,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n23,\n\n22,\n\n21,\n\n20,\n\n19,\n\n19,\n\n18,\n\n17,\n\n16,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n9,\n\n10,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n16,\n\n17,\n\n18,\n\n19,\n\n20,\n\n22,\n\n23,\n\n24,\n\n25,\n\n26,\n\n28,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n34,\n\n35,\n\n36,\n\n37,\n\n37,\n\n38,\n\n38,\n\n38,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n38,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n6,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n8,\n\n8,\n\n8,\n\n9,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n19,\n\n21,\n\n22,\n\n23,\n\n25,\n\n26,\n\n27,\n\n29,\n\n30,\n\n31,\n\n32,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n39,\n\n39,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n10,\n\n9,\n\n9,\n\n8,\n\n8,\n\n7,\n\n7,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n6,\n\n6,\n\n6,\n\n7,\n\n7,\n\n8,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n19,\n\n20,\n\n21,\n\n22,\n\n24,\n\n25,\n\n26,\n\n27,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n42,\n\n42,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n43,\n\n42,\n\n42,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n38,\n\n37,\n\n37,\n\n36,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n31,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n26,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n15,\n\n15,\n\n14,\n\n13,\n\n13,\n\n12,\n\n12,\n\n11,\n\n10,\n\n10,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n5,\n\n5,\n\n5,\n\n6,\n\n7,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n16,\n\n17,\n\n18,\n\n20,\n\n21,\n\n22,\n\n24,\n\n25,\n\n26,\n\n28,\n\n29,\n\n30,\n\n32,\n\n33,\n\n34,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n45,\n\n45,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n43,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n40,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n14,\n\n14,\n\n13,\n\n12,\n\n12,\n\n11,\n\n11,\n\n10,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n5,\n\n5,\n\n6,\n\n6,\n\n7,\n\n8,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n15,\n\n16,\n\n17,\n\n18,\n\n20,\n\n21,\n\n23,\n\n24,\n\n25,\n\n27,\n\n28,\n\n29,\n\n31,\n\n32,\n\n33,\n\n34,\n\n35,\n\n37,\n\n38,\n\n39,\n\n40,\n\n40,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n45,\n\n45,\n\n45,\n\n46,\n\n46,\n\n46,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n46,\n\n46,\n\n46,\n\n46,\n\n45,\n\n45,\n\n44,\n\n44,\n\n44,\n\n43,\n\n42,\n\n42,\n\n41,\n\n41,\n\n40,\n\n39,\n\n38,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n28,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n21,\n\n20,\n\n19,\n\n18,\n\n17,\n\n17,\n\n16,\n\n15,\n\n0,\n\n0,\n\n1,\n\n2,\n\n3,\n\n4,\n\n5,\n\n6,\n\n6,\n\n6,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n7,\n\n6,\n\n6,\n\n6,\n\n5,\n\n5,\n\n5,\n\n5,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n4,\n\n5,\n\n5,\n\n6,\n\n6,\n\n7,\n\n7,\n\n8,\n\n9,\n\n10,\n\n11,\n\n12,\n\n13,\n\n14,\n\n15,\n\n16,\n\n17,\n\n18,\n\n20,\n\n21,\n\n22,\n\n23,\n\n25,\n\n26,\n\n27,\n\n29,\n\n30,\n\n31,\n\n32,\n\n33,\n\n35,\n\n36,\n\n37,\n\n38,\n\n39,\n\n40,\n\n41,\n\n42,\n\n43,\n\n43,\n\n44,\n\n45,\n\n45,\n\n46,\n\n46,\n\n47,\n\n47,\n\n47,\n\n47,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n47,\n\n47,\n\n47,\n\n47,\n\n46,\n\n46,\n\n45,\n\n45,\n\n44,\n\n44,\n\n43,\n\n42,\n\n42,\n\n41,\n\n40,\n\n39,\n\n39,\n\n38,\n\n37,\n\n36,\n\n35,\n\n34,\n\n33,\n\n32,\n\n31,\n\n30,\n\n29,\n\n28,\n\n27,\n\n27,\n\n26,\n\n25,\n\n24,\n\n23,\n\n22,\n\n21,\n\n20,\n\n19,\n\n18,\n\n18,\n\n17,\n\n16,\n\n\n\n};\n\n\n", "file_path": "modules/video_coding/main/source/er_tables_xor.h", "rank": 77, "score": 113035.49916311991 }, { "content": "namespace webrtc {\n\n\n\n// Table for Protection factor (code rate) of delta frames, for the XOR FEC.\n\n// Input is the packet loss and an effective rate (bits/frame).\n\n// Output is array kCodeRateXORTable[k], where k = rate_i*129 + loss_j;\n\n// loss_j = 0,1,..128, and rate_i varies over some range.\n\nstatic const int kSizeCodeRateXORTable = 6450;\n\nstatic const unsigned char kCodeRateXORTable[kSizeCodeRateXORTable] = {\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n11,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n39,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n51,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n8,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n30,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n56,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n65,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n87,\n\n78,\n\n78,\n\n78,\n\n78,\n\n78,\n\n78,\n\n78,\n\n78,\n\n78,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n6,\n\n6,\n\n6,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n23,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n44,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n50,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n68,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n88,\n\n88,\n\n88,\n\n88,\n\n88,\n\n88,\n\n88,\n\n88,\n\n88,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n5,\n\n19,\n\n19,\n\n19,\n\n36,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n41,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n75,\n\n75,\n\n80,\n\n80,\n\n80,\n\n80,\n\n80,\n\n97,\n\n97,\n\n97,\n\n97,\n\n97,\n\n97,\n\n97,\n\n97,\n\n97,\n\n97,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n4,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n16,\n\n30,\n\n35,\n\n35,\n\n47,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n63,\n\n77,\n\n77,\n\n77,\n\n77,\n\n77,\n\n77,\n\n77,\n\n82,\n\n82,\n\n82,\n\n82,\n\n94,\n\n94,\n\n94,\n\n94,\n\n94,\n\n105,\n\n105,\n\n105,\n\n105,\n\n110,\n\n110,\n\n110,\n\n110,\n\n110,\n\n110,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n115,\n\n115,\n\n115,\n\n115,\n\n115,\n\n115,\n\n115,\n\n115,\n\n115,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n4,\n\n14,\n\n27,\n\n27,\n\n27,\n\n27,\n\n27,\n\n31,\n\n41,\n\n52,\n\n52,\n\n56,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n69,\n\n79,\n\n79,\n\n79,\n\n79,\n\n83,\n\n83,\n\n83,\n\n94,\n\n94,\n\n94,\n\n94,\n\n106,\n\n106,\n\n106,\n\n106,\n\n106,\n\n115,\n\n115,\n\n115,\n\n115,\n\n125,\n\n125,\n\n125,\n\n125,\n\n125,\n\n125,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n0,\n\n0,\n\n0,\n\n3,\n\n3,\n\n3,\n\n17,\n\n28,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n47,\n\n51,\n\n63,\n\n63,\n\n63,\n\n72,\n\n72,\n\n72,\n\n72,\n\n72,\n\n72,\n\n72,\n\n76,\n\n76,\n\n76,\n\n76,\n\n80,\n\n80,\n\n80,\n\n80,\n\n80,\n\n80,\n\n80,\n\n80,\n\n80,\n\n84,\n\n84,\n\n84,\n\n84,\n\n93,\n\n93,\n\n93,\n\n105,\n\n105,\n\n105,\n\n105,\n\n114,\n\n114,\n\n114,\n\n114,\n\n114,\n\n124,\n\n124,\n\n124,\n\n124,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n0,\n\n0,\n\n0,\n\n12,\n\n12,\n\n12,\n\n35,\n\n43,\n\n47,\n\n47,\n\n47,\n\n47,\n\n47,\n\n58,\n\n58,\n\n66,\n\n66,\n\n66,\n\n70,\n\n70,\n\n70,\n\n70,\n\n70,\n\n73,\n\n73,\n\n82,\n\n82,\n\n82,\n\n86,\n\n94,\n\n94,\n\n94,\n\n94,\n\n94,\n\n94,\n\n94,\n\n94,\n\n94,\n\n94,\n\n94,\n\n94,\n\n94,\n\n105,\n\n105,\n\n105,\n\n114,\n\n114,\n\n114,\n\n114,\n\n117,\n\n117,\n\n117,\n\n117,\n\n117,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n0,\n\n0,\n\n0,\n\n24,\n\n24,\n\n24,\n\n49,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n61,\n\n61,\n\n64,\n\n64,\n\n64,\n\n64,\n\n70,\n\n70,\n\n70,\n\n70,\n\n78,\n\n78,\n\n88,\n\n88,\n\n88,\n\n96,\n\n106,\n\n106,\n\n106,\n\n106,\n\n106,\n\n106,\n\n106,\n\n106,\n\n106,\n\n106,\n\n112,\n\n112,\n\n112,\n\n120,\n\n120,\n\n120,\n\n124,\n\n124,\n\n124,\n\n124,\n\n124,\n\n124,\n\n124,\n\n124,\n\n124,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n0,\n\n0,\n\n5,\n\n36,\n\n36,\n\n36,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n55,\n\n58,\n\n58,\n\n58,\n\n58,\n\n58,\n\n64,\n\n78,\n\n78,\n\n78,\n\n78,\n\n87,\n\n87,\n\n94,\n\n94,\n\n94,\n\n103,\n\n110,\n\n110,\n\n110,\n\n110,\n\n110,\n\n110,\n\n110,\n\n110,\n\n116,\n\n116,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n0,\n\n0,\n\n18,\n\n43,\n\n43,\n\n43,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n53,\n\n58,\n\n58,\n\n58,\n\n58,\n\n71,\n\n87,\n\n87,\n\n87,\n\n87,\n\n94,\n\n94,\n\n97,\n\n97,\n\n97,\n\n109,\n\n111,\n\n111,\n\n111,\n\n111,\n\n111,\n\n111,\n\n111,\n\n111,\n\n125,\n\n125,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n0,\n\n0,\n\n31,\n\n46,\n\n46,\n\n46,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n48,\n\n66,\n\n66,\n\n66,\n\n66,\n\n80,\n\n93,\n\n93,\n\n93,\n\n93,\n\n95,\n\n95,\n\n95,\n\n95,\n\n100,\n\n115,\n\n115,\n\n115,\n\n115,\n\n115,\n\n115,\n\n115,\n\n115,\n\n115,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n0,\n\n4,\n\n40,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n45,\n\n49,\n\n49,\n\n49,\n\n74,\n\n74,\n\n74,\n\n74,\n\n86,\n\n90,\n\n90,\n\n90,\n\n90,\n\n95,\n\n95,\n\n95,\n\n95,\n\n106,\n\n120,\n\n120,\n\n120,\n\n120,\n\n120,\n\n120,\n\n120,\n\n120,\n\n120,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n0,\n\n14,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n42,\n\n46,\n\n56,\n\n56,\n\n56,\n\n80,\n\n80,\n\n80,\n\n80,\n\n84,\n\n84,\n\n84,\n\n84,\n\n88,\n\n99,\n\n99,\n\n99,\n\n99,\n\n111,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n0,\n\n26,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n40,\n\n54,\n\n66,\n\n66,\n\n66,\n\n80,\n\n80,\n\n80,\n\n80,\n\n80,\n\n80,\n\n80,\n\n84,\n\n94,\n\n106,\n\n106,\n\n106,\n\n106,\n\n116,\n\n120,\n\n120,\n\n120,\n\n120,\n\n120,\n\n120,\n\n120,\n\n120,\n\n124,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n3,\n\n34,\n\n38,\n\n38,\n\n38,\n\n38,\n\n38,\n\n42,\n\n42,\n\n42,\n\n63,\n\n72,\n\n72,\n\n76,\n\n80,\n\n80,\n\n80,\n\n80,\n\n80,\n\n80,\n\n80,\n\n89,\n\n101,\n\n114,\n\n114,\n\n114,\n\n114,\n\n118,\n\n118,\n\n118,\n\n118,\n\n118,\n\n118,\n\n118,\n\n118,\n\n118,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n12,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n36,\n\n49,\n\n49,\n\n49,\n\n69,\n\n73,\n\n76,\n\n86,\n\n86,\n\n86,\n\n86,\n\n86,\n\n86,\n\n86,\n\n86,\n\n97,\n\n109,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n22,\n\n34,\n\n34,\n\n34,\n\n34,\n\n38,\n\n38,\n\n57,\n\n57,\n\n57,\n\n69,\n\n73,\n\n82,\n\n92,\n\n92,\n\n92,\n\n92,\n\n92,\n\n92,\n\n96,\n\n96,\n\n104,\n\n117,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n29,\n\n33,\n\n33,\n\n33,\n\n33,\n\n44,\n\n44,\n\n62,\n\n62,\n\n62,\n\n69,\n\n77,\n\n87,\n\n95,\n\n95,\n\n95,\n\n95,\n\n95,\n\n95,\n\n107,\n\n107,\n\n110,\n\n120,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n31,\n\n31,\n\n31,\n\n31,\n\n31,\n\n51,\n\n51,\n\n62,\n\n65,\n\n65,\n\n73,\n\n83,\n\n91,\n\n94,\n\n94,\n\n94,\n\n94,\n\n97,\n\n97,\n\n114,\n\n114,\n\n114,\n\n122,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n29,\n\n29,\n\n29,\n\n29,\n\n29,\n\n56,\n\n56,\n\n59,\n\n70,\n\n70,\n\n79,\n\n86,\n\n89,\n\n89,\n\n89,\n\n89,\n\n89,\n\n100,\n\n100,\n\n116,\n\n116,\n\n116,\n\n122,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n28,\n\n28,\n\n28,\n\n28,\n\n28,\n\n57,\n\n57,\n\n57,\n\n76,\n\n76,\n\n83,\n\n86,\n\n86,\n\n86,\n\n86,\n\n86,\n\n89,\n\n104,\n\n104,\n\n114,\n\n114,\n\n114,\n\n124,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n27,\n\n27,\n\n27,\n\n27,\n\n30,\n\n55,\n\n55,\n\n55,\n\n80,\n\n80,\n\n83,\n\n86,\n\n86,\n\n86,\n\n86,\n\n86,\n\n93,\n\n108,\n\n108,\n\n111,\n\n111,\n\n111,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n26,\n\n26,\n\n26,\n\n26,\n\n36,\n\n53,\n\n53,\n\n53,\n\n80,\n\n80,\n\n80,\n\n90,\n\n90,\n\n90,\n\n90,\n\n90,\n\n98,\n\n107,\n\n107,\n\n107,\n\n107,\n\n107,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n26,\n\n26,\n\n26,\n\n28,\n\n42,\n\n52,\n\n54,\n\n54,\n\n78,\n\n78,\n\n78,\n\n95,\n\n95,\n\n95,\n\n97,\n\n97,\n\n104,\n\n106,\n\n106,\n\n106,\n\n106,\n\n106,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n24,\n\n24,\n\n24,\n\n33,\n\n47,\n\n49,\n\n58,\n\n58,\n\n74,\n\n74,\n\n74,\n\n97,\n\n97,\n\n97,\n\n106,\n\n106,\n\n108,\n\n108,\n\n108,\n\n108,\n\n108,\n\n108,\n\n124,\n\n124,\n\n124,\n\n124,\n\n124,\n\n124,\n\n124,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n24,\n\n24,\n\n24,\n\n39,\n\n48,\n\n50,\n\n63,\n\n63,\n\n72,\n\n74,\n\n74,\n\n96,\n\n96,\n\n96,\n\n109,\n\n111,\n\n111,\n\n111,\n\n111,\n\n111,\n\n111,\n\n111,\n\n119,\n\n119,\n\n122,\n\n122,\n\n122,\n\n122,\n\n122,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n23,\n\n23,\n\n23,\n\n43,\n\n46,\n\n54,\n\n66,\n\n66,\n\n69,\n\n77,\n\n77,\n\n92,\n\n92,\n\n92,\n\n105,\n\n113,\n\n113,\n\n113,\n\n113,\n\n113,\n\n113,\n\n113,\n\n115,\n\n117,\n\n123,\n\n123,\n\n123,\n\n123,\n\n123,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n22,\n\n22,\n\n22,\n\n44,\n\n44,\n\n59,\n\n67,\n\n67,\n\n67,\n\n81,\n\n81,\n\n89,\n\n89,\n\n89,\n\n97,\n\n112,\n\n112,\n\n112,\n\n112,\n\n112,\n\n112,\n\n112,\n\n112,\n\n119,\n\n126,\n\n126,\n\n126,\n\n126,\n\n126,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n21,\n\n21,\n\n24,\n\n43,\n\n45,\n\n63,\n\n65,\n\n65,\n\n67,\n\n85,\n\n85,\n\n87,\n\n87,\n\n87,\n\n91,\n\n109,\n\n109,\n\n109,\n\n111,\n\n111,\n\n111,\n\n111,\n\n111,\n\n123,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n21,\n\n21,\n\n28,\n\n42,\n\n50,\n\n63,\n\n63,\n\n66,\n\n71,\n\n85,\n\n85,\n\n85,\n\n85,\n\n87,\n\n92,\n\n106,\n\n106,\n\n108,\n\n114,\n\n114,\n\n114,\n\n114,\n\n114,\n\n125,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n20,\n\n20,\n\n34,\n\n41,\n\n54,\n\n62,\n\n62,\n\n69,\n\n75,\n\n82,\n\n82,\n\n82,\n\n82,\n\n92,\n\n98,\n\n105,\n\n105,\n\n110,\n\n117,\n\n117,\n\n117,\n\n117,\n\n117,\n\n124,\n\n124,\n\n126,\n\n126,\n\n126,\n\n126,\n\n126,\n\n126,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n20,\n\n20,\n\n38,\n\n40,\n\n58,\n\n60,\n\n60,\n\n73,\n\n78,\n\n80,\n\n80,\n\n80,\n\n80,\n\n100,\n\n105,\n\n107,\n\n107,\n\n113,\n\n118,\n\n118,\n\n118,\n\n118,\n\n118,\n\n120,\n\n120,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n19,\n\n21,\n\n38,\n\n40,\n\n58,\n\n58,\n\n60,\n\n75,\n\n77,\n\n77,\n\n77,\n\n81,\n\n81,\n\n107,\n\n109,\n\n109,\n\n109,\n\n114,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n116,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n18,\n\n25,\n\n37,\n\n44,\n\n56,\n\n56,\n\n63,\n\n75,\n\n75,\n\n75,\n\n75,\n\n88,\n\n88,\n\n111,\n\n111,\n\n111,\n\n111,\n\n112,\n\n112,\n\n112,\n\n112,\n\n112,\n\n112,\n\n112,\n\n114,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n18,\n\n30,\n\n36,\n\n48,\n\n55,\n\n55,\n\n67,\n\n73,\n\n73,\n\n73,\n\n73,\n\n97,\n\n97,\n\n110,\n\n110,\n\n110,\n\n110,\n\n110,\n\n110,\n\n110,\n\n110,\n\n110,\n\n110,\n\n110,\n\n116,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n18,\n\n34,\n\n36,\n\n52,\n\n55,\n\n55,\n\n70,\n\n72,\n\n73,\n\n73,\n\n73,\n\n102,\n\n104,\n\n108,\n\n108,\n\n108,\n\n108,\n\n109,\n\n109,\n\n109,\n\n109,\n\n109,\n\n109,\n\n109,\n\n119,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n17,\n\n35,\n\n35,\n\n52,\n\n59,\n\n59,\n\n70,\n\n70,\n\n76,\n\n76,\n\n76,\n\n99,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n111,\n\n111,\n\n111,\n\n111,\n\n111,\n\n111,\n\n111,\n\n121,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n17,\n\n34,\n\n36,\n\n51,\n\n61,\n\n62,\n\n70,\n\n70,\n\n80,\n\n80,\n\n80,\n\n93,\n\n103,\n\n103,\n\n103,\n\n103,\n\n103,\n\n112,\n\n112,\n\n112,\n\n112,\n\n112,\n\n116,\n\n118,\n\n124,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n16,\n\n33,\n\n39,\n\n50,\n\n59,\n\n65,\n\n72,\n\n72,\n\n82,\n\n82,\n\n82,\n\n91,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n109,\n\n109,\n\n109,\n\n109,\n\n109,\n\n121,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n16,\n\n32,\n\n43,\n\n48,\n\n54,\n\n66,\n\n75,\n\n75,\n\n81,\n\n83,\n\n83,\n\n92,\n\n97,\n\n97,\n\n97,\n\n99,\n\n99,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n123,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n15,\n\n31,\n\n46,\n\n47,\n\n49,\n\n69,\n\n77,\n\n77,\n\n81,\n\n85,\n\n85,\n\n93,\n\n95,\n\n95,\n\n95,\n\n100,\n\n100,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n120,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n15,\n\n30,\n\n46,\n\n48,\n\n48,\n\n70,\n\n75,\n\n79,\n\n82,\n\n87,\n\n87,\n\n92,\n\n94,\n\n94,\n\n94,\n\n103,\n\n103,\n\n103,\n\n103,\n\n103,\n\n104,\n\n104,\n\n115,\n\n120,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n15,\n\n30,\n\n45,\n\n50,\n\n50,\n\n68,\n\n70,\n\n80,\n\n85,\n\n89,\n\n89,\n\n90,\n\n95,\n\n95,\n\n95,\n\n104,\n\n104,\n\n104,\n\n104,\n\n104,\n\n109,\n\n109,\n\n112,\n\n114,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n14,\n\n29,\n\n44,\n\n54,\n\n54,\n\n64,\n\n64,\n\n83,\n\n87,\n\n88,\n\n88,\n\n88,\n\n98,\n\n98,\n\n98,\n\n103,\n\n103,\n\n103,\n\n103,\n\n103,\n\n113,\n\n113,\n\n113,\n\n113,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n14,\n\n29,\n\n43,\n\n56,\n\n56,\n\n61,\n\n61,\n\n84,\n\n85,\n\n88,\n\n88,\n\n88,\n\n100,\n\n100,\n\n100,\n\n102,\n\n102,\n\n102,\n\n102,\n\n102,\n\n113,\n\n116,\n\n116,\n\n116,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n14,\n\n28,\n\n42,\n\n57,\n\n57,\n\n62,\n\n62,\n\n80,\n\n80,\n\n91,\n\n91,\n\n91,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n109,\n\n119,\n\n119,\n\n119,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n14,\n\n28,\n\n42,\n\n56,\n\n56,\n\n65,\n\n66,\n\n76,\n\n76,\n\n92,\n\n92,\n\n92,\n\n97,\n\n97,\n\n97,\n\n101,\n\n101,\n\n101,\n\n101,\n\n101,\n\n106,\n\n121,\n\n121,\n\n121,\n\n126,\n\n126,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n13,\n\n27,\n\n41,\n\n55,\n\n55,\n\n67,\n\n72,\n\n74,\n\n74,\n\n90,\n\n90,\n\n90,\n\n91,\n\n91,\n\n91,\n\n105,\n\n105,\n\n105,\n\n105,\n\n105,\n\n107,\n\n122,\n\n122,\n\n122,\n\n123,\n\n123,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n0,\n\n13,\n\n27,\n\n40,\n\n54,\n\n54,\n\n67,\n\n76,\n\n76,\n\n76,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n85,\n\n112,\n\n112,\n\n112,\n\n112,\n\n112,\n\n112,\n\n121,\n\n121,\n\n121,\n\n121,\n\n121,\n\n126,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n127,\n\n\n\n\n\n};\n\n\n", "file_path": "modules/video_coding/main/source/fec_tables_xor.h", "rank": 78, "score": 113035.49916311991 }, { "content": "namespace webrtc {\n\n\n\n// These values should match MATLAB counterparts for unit-tests to pass.\n\nstatic const double kCorrWeight[] = {\n\n 1.000000, 0.985000, 0.970225, 0.955672, 0.941337, 0.927217, 0.913308,\n\n 0.899609, 0.886115, 0.872823, 0.859730, 0.846834, 0.834132, 0.821620,\n\n 0.809296, 0.797156, 0.785199\n\n};\n\n\n\nstatic const double kLpcAnalWin[] = {\n\n 0.00000000, 0.01314436, 0.02628645, 0.03942400, 0.05255473, 0.06567639,\n\n 0.07878670, 0.09188339, 0.10496421, 0.11802689, 0.13106918, 0.14408883,\n\n 0.15708358, 0.17005118, 0.18298941, 0.19589602, 0.20876878, 0.22160547,\n\n 0.23440387, 0.24716177, 0.25987696, 0.27254725, 0.28517045, 0.29774438,\n\n 0.31026687, 0.32273574, 0.33514885, 0.34750406, 0.35979922, 0.37203222,\n\n 0.38420093, 0.39630327, 0.40833713, 0.42030043, 0.43219112, 0.44400713,\n\n 0.45574642, 0.46740697, 0.47898676, 0.49048379, 0.50189608, 0.51322164,\n\n 0.52445853, 0.53560481, 0.54665854, 0.55761782, 0.56848075, 0.57924546,\n\n 0.58991008, 0.60047278, 0.61093173, 0.62128512, 0.63153117, 0.64166810,\n\n 0.65169416, 0.66160761, 0.67140676, 0.68108990, 0.69065536, 0.70010148,\n\n 0.70942664, 0.71862923, 0.72770765, 0.73666033, 0.74548573, 0.75418233,\n\n 0.76274862, 0.77118312, 0.77948437, 0.78765094, 0.79568142, 0.80357442,\n\n 0.81132858, 0.81894256, 0.82641504, 0.83374472, 0.84093036, 0.84797069,\n\n 0.85486451, 0.86161063, 0.86820787, 0.87465511, 0.88095122, 0.88709512,\n\n 0.89308574, 0.89892206, 0.90460306, 0.91012776, 0.91549520, 0.92070447,\n\n 0.92575465, 0.93064488, 0.93537432, 0.93994213, 0.94434755, 0.94858979,\n\n 0.95266814, 0.95658189, 0.96033035, 0.96391289, 0.96732888, 0.97057773,\n\n 0.97365889, 0.97657181, 0.97931600, 0.98189099, 0.98429632, 0.98653158,\n\n 0.98859639, 0.99049038, 0.99221324, 0.99376466, 0.99514438, 0.99635215,\n\n 0.99738778, 0.99825107, 0.99894188, 0.99946010, 0.99980562, 0.99997840,\n\n 0.99997840, 0.99980562, 0.99946010, 0.99894188, 0.99825107, 0.99738778,\n\n 0.99635215, 0.99514438, 0.99376466, 0.99221324, 0.99049038, 0.98859639,\n\n 0.98653158, 0.98429632, 0.98189099, 0.97931600, 0.97657181, 0.97365889,\n\n 0.97057773, 0.96732888, 0.96391289, 0.96033035, 0.95658189, 0.95266814,\n\n 0.94858979, 0.94434755, 0.93994213, 0.93537432, 0.93064488, 0.92575465,\n\n 0.92070447, 0.91549520, 0.91012776, 0.90460306, 0.89892206, 0.89308574,\n\n 0.88709512, 0.88095122, 0.87465511, 0.86820787, 0.86161063, 0.85486451,\n\n 0.84797069, 0.84093036, 0.83374472, 0.82641504, 0.81894256, 0.81132858,\n\n 0.80357442, 0.79568142, 0.78765094, 0.77948437, 0.77118312, 0.76274862,\n\n 0.75418233, 0.74548573, 0.73666033, 0.72770765, 0.71862923, 0.70942664,\n\n 0.70010148, 0.69065536, 0.68108990, 0.67140676, 0.66160761, 0.65169416,\n\n 0.64166810, 0.63153117, 0.62128512, 0.61093173, 0.60047278, 0.58991008,\n\n 0.57924546, 0.56848075, 0.55761782, 0.54665854, 0.53560481, 0.52445853,\n\n 0.51322164, 0.50189608, 0.49048379, 0.47898676, 0.46740697, 0.45574642,\n\n 0.44400713, 0.43219112, 0.42030043, 0.40833713, 0.39630327, 0.38420093,\n\n 0.37203222, 0.35979922, 0.34750406, 0.33514885, 0.32273574, 0.31026687,\n\n 0.29774438, 0.28517045, 0.27254725, 0.25987696, 0.24716177, 0.23440387,\n\n 0.22160547, 0.20876878, 0.19589602, 0.18298941, 0.17005118, 0.15708358,\n\n 0.14408883, 0.13106918, 0.11802689, 0.10496421, 0.09188339, 0.07878670,\n\n 0.06567639, 0.05255473, 0.03942400, 0.02628645, 0.01314436, 0.00000000\n\n};\n\n\n\nstatic const int kFilterOrder = 2;\n\nstatic const float kCoeffNumerator[kFilterOrder + 1] = {0.974827f, -1.949650f,\n\n 0.974827f};\n\nstatic const float kCoeffDenominator[kFilterOrder + 1] = {1.0f, -1.971999f,\n\n 0.972457f};\n\n\n\nstatic_assert(kFilterOrder + 1 ==\n\n sizeof(kCoeffNumerator) / sizeof(kCoeffNumerator[0]),\n\n \"numerator coefficients incorrect size\");\n\nstatic_assert(kFilterOrder + 1 ==\n\n sizeof(kCoeffDenominator) / sizeof(kCoeffDenominator[0]),\n\n \"denominator coefficients incorrect size\");\n\n\n", "file_path": "modules/audio_processing/agc/agc_audio_proc_internal.h", "rank": 79, "score": 113027.86125159505 }, { "content": "namespace webrtc {\n\n//\n\n// PARAMETERS FOR RESOLUTION ADAPTATION\n\n//\n\n\n\n// Initial level of buffer in secs.\n\nconst float kInitBufferLevel = 0.5f;\n\n\n\n// Threshold of (max) buffer size below which we consider too low (underflow).\n\nconst float kPercBufferThr = 0.10f;\n\n\n\n// Threshold on the occurrences of low buffer levels.\n\nconst float kMaxBufferLow = 0.30f;\n\n\n\n// Threshold on rate mismatch.\n\nconst float kMaxRateMisMatch = 0.5f;\n\n\n\n// Threshold on amount of under/over encoder shooting.\n\nconst float kRateOverShoot = 0.75f;\n\nconst float kRateUnderShoot = 0.75f;\n\n\n\n// Factor to favor weighting the average rates with the current/last data.\n\nconst float kWeightRate = 0.70f;\n\n\n\n// Factor for transitional rate for going back up in resolution.\n\nconst float kTransRateScaleUpSpatial = 1.25f;\n\nconst float kTransRateScaleUpTemp = 1.25f;\n\nconst float kTransRateScaleUpSpatialTemp = 1.25f;\n\n\n\n// Threshold on packet loss rate, above which favor resolution reduction.\n\nconst float kPacketLossThr = 0.1f;\n\n\n\n// Factor for reducing transitional bitrate under packet loss.\n\nconst float kPacketLossRateFac = 1.0f;\n\n\n\n// Maximum possible transitional rate for down-sampling:\n\n// (units in kbps), for 30fps.\n\nconst uint16_t kMaxRateQm[9] = {\n\n 0, // QCIF\n\n 50, // kHCIF\n\n 125, // kQVGA\n\n 200, // CIF\n\n 280, // HVGA\n\n 400, // VGA\n\n 700, // QFULLHD\n\n 1000, // WHD\n\n 1500 // FULLHD\n\n};\n\n\n\n// Frame rate scale for maximum transition rate.\n\nconst float kFrameRateFac[4] = {\n\n 0.5f, // Low\n\n 0.7f, // Middle level 1\n\n 0.85f, // Middle level 2\n\n 1.0f, // High\n\n};\n\n\n\n// Scale for transitional rate: based on content class\n\n// motion=L/H/D,spatial==L/H/D: for low, high, middle levels\n\nconst float kScaleTransRateQm[18] = {\n\n // VGA and lower\n\n 0.40f, // L, L\n\n 0.50f, // L, H\n\n 0.40f, // L, D\n\n 0.60f, // H ,L\n\n 0.60f, // H, H\n\n 0.60f, // H, D\n\n 0.50f, // D, L\n\n 0.50f, // D, D\n\n 0.50f, // D, H\n\n\n\n // over VGA\n\n 0.40f, // L, L\n\n 0.50f, // L, H\n\n 0.40f, // L, D\n\n 0.60f, // H ,L\n\n 0.60f, // H, H\n\n 0.60f, // H, D\n\n 0.50f, // D, L\n\n 0.50f, // D, D\n\n 0.50f, // D, H\n\n};\n\n\n\n// Threshold on the target rate relative to transitional rate.\n\nconst float kFacLowRate = 0.5f;\n\n\n\n// Action for down-sampling:\n\n// motion=L/H/D,spatial==L/H/D, for low, high, middle levels;\n\n// rate = 0/1/2, for target rate state relative to transition rate.\n\nconst uint8_t kSpatialAction[27] = {\n\n// rateClass = 0:\n\n 1, // L, L\n\n 1, // L, H\n\n 1, // L, D\n\n 4, // H ,L\n\n 1, // H, H\n\n 4, // H, D\n\n 4, // D, L\n\n 1, // D, H\n\n 2, // D, D\n\n\n\n// rateClass = 1:\n\n 1, // L, L\n\n 1, // L, H\n\n 1, // L, D\n\n 2, // H ,L\n\n 1, // H, H\n\n 2, // H, D\n\n 2, // D, L\n\n 1, // D, H\n\n 2, // D, D\n\n\n\n// rateClass = 2:\n\n 1, // L, L\n\n 1, // L, H\n\n 1, // L, D\n\n 2, // H ,L\n\n 1, // H, H\n\n 2, // H, D\n\n 2, // D, L\n\n 1, // D, H\n\n 2, // D, D\n\n};\n\n\n\nconst uint8_t kTemporalAction[27] = {\n\n// rateClass = 0:\n\n 3, // L, L\n\n 2, // L, H\n\n 2, // L, D\n\n 1, // H ,L\n\n 3, // H, H\n\n 1, // H, D\n\n 1, // D, L\n\n 2, // D, H\n\n 1, // D, D\n\n\n\n// rateClass = 1:\n\n 3, // L, L\n\n 3, // L, H\n\n 3, // L, D\n\n 1, // H ,L\n\n 3, // H, H\n\n 1, // H, D\n\n 1, // D, L\n\n 3, // D, H\n\n 1, // D, D\n\n\n\n// rateClass = 2:\n\n 1, // L, L\n\n 3, // L, H\n\n 3, // L, D\n\n 1, // H ,L\n\n 3, // H, H\n\n 1, // H, D\n\n 1, // D, L\n\n 3, // D, H\n\n 1, // D, D\n\n};\n\n\n\n// Control the total amount of down-sampling allowed.\n\nconst float kMaxSpatialDown = 8.0f;\n\nconst float kMaxTempDown = 3.0f;\n\nconst float kMaxTotalDown = 9.0f;\n\n\n\n// Minimum image size for a spatial down-sampling.\n\nconst int kMinImageSize = 176 * 144;\n\n\n\n// Minimum frame rate for temporal down-sampling:\n\n// no frame rate reduction if incomingFrameRate <= MIN_FRAME_RATE.\n\nconst int kMinFrameRate = 8;\n\n\n\n//\n\n// PARAMETERS FOR FEC ADJUSTMENT: TODO (marpan)\n\n//\n\n\n\n//\n\n// PARAMETETS FOR SETTING LOW/HIGH STATES OF CONTENT METRICS:\n\n//\n\n\n\n// Thresholds for frame rate:\n\nconst int kLowFrameRate = 10;\n\nconst int kMiddleFrameRate = 15;\n\nconst int kHighFrameRate = 25;\n\n\n\n// Thresholds for motion: motion level is from NFD.\n\nconst float kHighMotionNfd = 0.075f;\n\nconst float kLowMotionNfd = 0.03f;\n\n\n\n// Thresholds for spatial prediction error:\n\n// this is applied on the average of (2x2,1x2,2x1).\n\nconst float kHighTexture = 0.035f;\n\nconst float kLowTexture = 0.020f;\n\n\n\n// Used to reduce thresholds for larger/HD scenes: correction factor since\n\n// higher correlation in HD scenes means lower spatial prediction error.\n\nconst float kScaleTexture = 0.9f;\n\n\n\n// Percentage reduction in transitional bitrate for 2x2 selected over 1x2/2x1.\n\nconst float kRateRedSpatial2X2 = 0.6f;\n\n\n\nconst float kSpatialErr2x2VsHoriz = 0.1f; // percentage to favor 2x2 over H\n\nconst float kSpatialErr2X2VsVert = 0.1f; // percentage to favor 2x2 over V\n\nconst float kSpatialErrVertVsHoriz = 0.1f; // percentage to favor H over V\n\n\n", "file_path": "modules/video_coding/main/source/qm_select_data.h", "rank": 80, "score": 113027.86125159505 }, { "content": "namespace webrtc {\n\n\n\n// Error codes\n\n#define VPM_OK 0\n\n#define VPM_GENERAL_ERROR -1\n\n#define VPM_MEMORY -2\n\n#define VPM_PARAMETER_ERROR -3\n\n#define VPM_SCALE_ERROR -4\n\n#define VPM_UNINITIALIZED -5\n\n#define VPM_UNIMPLEMENTED -6\n\n\n\nenum VideoFrameResampling {\n\n kNoRescaling, // Disables rescaling.\n\n kFastRescaling, // Point filter.\n\n kBiLinear, // Bi-linear interpolation.\n\n kBox, // Box inteprolation.\n\n};\n\n\n", "file_path": "modules/video_processing/main/interface/video_processing_defines.h", "rank": 81, "score": 113027.86125159505 }, { "content": "namespace webrtc {\n\n\n\nnamespace acm2 {\n\n\n\n#ifdef WEBRTC_CODEC_ISAC\n\n#define ACM_ISAC_CREATE WebRtcIsac_Create\n\n#define ACM_ISAC_FREE WebRtcIsac_Free\n\n#define ACM_ISAC_ENCODERINIT WebRtcIsac_EncoderInit\n\n#define ACM_ISAC_ENCODE WebRtcIsac_Encode\n\n#define ACM_ISAC_DECODERINIT WebRtcIsac_DecoderInit\n\n#define ACM_ISAC_DECODE_BWE WebRtcIsac_UpdateBwEstimate\n\n#define ACM_ISAC_DECODE_B WebRtcIsac_Decode\n\n#define ACM_ISAC_DECODEPLC WebRtcIsac_DecodePlc\n\n#define ACM_ISAC_CONTROL WebRtcIsac_Control\n\n#define ACM_ISAC_CONTROL_BWE WebRtcIsac_ControlBwe\n\n#define ACM_ISAC_GETFRAMELEN WebRtcIsac_ReadFrameLen\n\n#define ACM_ISAC_GETERRORCODE WebRtcIsac_GetErrorCode\n\n#define ACM_ISAC_GETSENDBITRATE WebRtcIsac_GetUplinkBw\n\n#define ACM_ISAC_SETMAXPAYLOADSIZE WebRtcIsac_SetMaxPayloadSize\n\n#define ACM_ISAC_SETMAXRATE WebRtcIsac_SetMaxRate\n\n#define ACM_ISAC_GETNEWBITSTREAM WebRtcIsac_GetNewBitStream\n\n#define ACM_ISAC_GETSENDBWE WebRtcIsac_GetDownLinkBwIndex\n\n#define ACM_ISAC_SETBWE WebRtcIsac_UpdateUplinkBw\n\n#define ACM_ISAC_GETBWE WebRtcIsac_ReadBwIndex\n\n#define ACM_ISAC_GETNEWFRAMELEN WebRtcIsac_GetNewFrameLen\n\n#define ACM_ISAC_STRUCT ISACStruct\n\n#define ACM_ISAC_GETENCSAMPRATE WebRtcIsac_EncSampRate\n\n#define ACM_ISAC_GETDECSAMPRATE WebRtcIsac_DecSampRate\n\n#define ACM_ISAC_DECODERCU WebRtcIsac_DecodeRcu\n\n#endif\n\n\n\n#ifdef WEBRTC_CODEC_ISACFX\n\n#define ACM_ISAC_CREATE WebRtcIsacfix_Create\n\n#define ACM_ISAC_FREE WebRtcIsacfix_Free\n\n#define ACM_ISAC_ENCODERINIT WebRtcIsacfix_EncoderInit\n\n#define ACM_ISAC_ENCODE WebRtcIsacfix_Encode\n\n#define ACM_ISAC_DECODERINIT WebRtcIsacfix_DecoderInit\n\n#define ACM_ISAC_DECODE_BWE WebRtcIsacfix_UpdateBwEstimate\n\n#define ACM_ISAC_DECODE_B WebRtcIsacfix_Decode\n\n#define ACM_ISAC_DECODEPLC WebRtcIsacfix_DecodePlc\n\n#define ACM_ISAC_CONTROL ACMISACFixControl // Local Impl\n\n#define ACM_ISAC_CONTROL_BWE ACMISACFixControlBWE // Local Impl\n\n#define ACM_ISAC_GETFRAMELEN WebRtcIsacfix_ReadFrameLen\n\n#define ACM_ISAC_GETERRORCODE WebRtcIsacfix_GetErrorCode\n\n#define ACM_ISAC_GETSENDBITRATE ACMISACFixGetSendBitrate // Local Impl\n\n#define ACM_ISAC_SETMAXPAYLOADSIZE WebRtcIsacfix_SetMaxPayloadSize\n\n#define ACM_ISAC_SETMAXRATE WebRtcIsacfix_SetMaxRate\n\n#define ACM_ISAC_GETNEWBITSTREAM ACMISACFixGetNewBitstream // Local Impl\n\n#define ACM_ISAC_GETSENDBWE ACMISACFixGetSendBWE // Local Impl\n\n#define ACM_ISAC_SETBWE WebRtcIsacfix_UpdateUplinkBw\n\n#define ACM_ISAC_GETBWE WebRtcIsacfix_ReadBwIndex\n\n#define ACM_ISAC_GETNEWFRAMELEN WebRtcIsacfix_GetNewFrameLen\n\n#define ACM_ISAC_STRUCT ISACFIX_MainStruct\n\n#define ACM_ISAC_GETENCSAMPRATE ACMISACFixGetEncSampRate // Local Impl\n\n#define ACM_ISAC_GETDECSAMPRATE ACMISACFixGetDecSampRate // Local Impl\n\n#define ACM_ISAC_DECODERCU WebRtcIsacfix_Decode // No special RCU\n\n // decoder\n\n#endif\n\n\n\n} // namespace acm2\n\n\n", "file_path": "modules/audio_coding/main/acm2/acm_isac_macros.h", "rank": 82, "score": 113027.86125159505 }, { "content": "namespace webrtc {\n\n\n\n// Creates a fake stdin-like FILE* for unit test usage.\n\nFILE* FakeStdin(const std::string& input);\n\n\n", "file_path": "video_engine/test/auto_test/primitives/fake_stdin.h", "rank": 83, "score": 113027.86125159505 }, { "content": "namespace webrtc {\n\n\n\n// Used to estimate rolling average of packets per frame.\n\nstatic const float kFastConvergeMultiplier = 0.4f;\n\nstatic const float kNormalConvergeMultiplier = 0.2f;\n\n\n\nenum { kMaxNumberOfFrames = 300 };\n\nenum { kStartNumberOfFrames = 6 };\n\nenum { kMaxVideoDelayMs = 10000 };\n\nenum { kPacketsPerFrameMultiplier = 5 };\n\nenum { kFastConvergeThreshold = 5};\n\n\n\nenum VCMJitterBufferEnum {\n\n kMaxConsecutiveOldFrames = 60,\n\n kMaxConsecutiveOldPackets = 300,\n\n kMaxPacketsInSession = 800,\n\n kBufferIncStepSizeBytes = 30000, // >20 packets.\n\n kMaxJBFrameSizeBytes = 4000000 // sanity don't go above 4Mbyte.\n\n};\n\n\n\nenum VCMFrameBufferEnum {\n\n kOutOfBoundsPacket = -7,\n\n kNotInitialized = -6,\n\n kOldPacket = -5,\n\n kGeneralError = -4,\n\n kFlushIndicator = -3, // Indicator that a flush has occurred.\n\n kTimeStampError = -2,\n\n kSizeError = -1,\n\n kNoError = 0,\n\n kIncomplete = 1, // Frame incomplete.\n\n kCompleteSession = 3, // at least one layer in the frame complete.\n\n kDecodableSession = 4, // Frame incomplete, but ready to be decoded\n\n kDuplicatePacket = 5 // We're receiving a duplicate packet.\n\n};\n\n\n\nenum VCMFrameBufferStateEnum {\n\n kStateEmpty, // frame popped by the RTP receiver\n\n kStateIncomplete, // frame that have one or more packet(s) stored\n\n kStateComplete, // frame that have all packets\n\n kStateDecodable // Hybrid mode - frame can be decoded\n\n};\n\n\n\nenum { kH264StartCodeLengthBytes = 4};\n\n\n\n// Used to indicate if a received packet contain a complete NALU (or equivalent)\n\nenum VCMNaluCompleteness {\n\n kNaluUnset = 0, // Packet has not been filled.\n\n kNaluComplete = 1, // Packet can be decoded as is.\n\n kNaluStart, // Packet contain beginning of NALU\n\n kNaluIncomplete, // Packet is not beginning or end of NALU\n\n kNaluEnd, // Packet is the end of a NALU\n\n};\n", "file_path": "modules/video_coding/main/source/jitter_buffer_common.h", "rank": 84, "score": 113027.86125159505 }, { "content": "namespace webrtc {\n\n\n\n// 60 ms is the maximum block size we support. An extra 20 ms is considered\n\n// for safety if process() method is not called when it should be, i.e. we\n\n// accept 20 ms of jitter. 80 ms @ 48 kHz (full-band) stereo is 7680 samples.\n\n#define AUDIO_BUFFER_SIZE_W16 7680\n\n\n\n// There is one timestamp per each 10 ms of audio\n\n// the audio buffer, at max, may contain 32 blocks of 10ms\n\n// audio if the sampling frequency is 8000 Hz (80 samples per block).\n\n// Therefore, The size of the buffer where we keep timestamps\n\n// is defined as follows\n\n#define TIMESTAMP_BUFFER_SIZE_W32 (AUDIO_BUFFER_SIZE_W16/80)\n\n\n\n// The maximum size of a payload, that is 60 ms of PCM-16 @ 32 kHz stereo\n\n#define MAX_PAYLOAD_SIZE_BYTE 7680\n\n\n\n// General codec specific defines\n\nconst int kIsacWbDefaultRate = 32000;\n\nconst int kIsacSwbDefaultRate = 56000;\n\nconst int kIsacPacSize480 = 480;\n\nconst int kIsacPacSize960 = 960;\n\nconst int kIsacPacSize1440 = 1440;\n\n\n\n// An encoded bit-stream is labeled by one of the following enumerators.\n\n//\n\n// kNoEncoding : There has been no encoding.\n\n// kActiveNormalEncoded : Active audio frame coded by the codec.\n\n// kPassiveNormalEncoded : Passive audio frame coded by the codec.\n\n// kPassiveDTXNB : Passive audio frame coded by narrow-band CN.\n\n// kPassiveDTXWB : Passive audio frame coded by wide-band CN.\n\n// kPassiveDTXSWB : Passive audio frame coded by super-wide-band CN.\n\n// kPassiveDTXFB : Passive audio frame coded by full-band CN.\n\nenum WebRtcACMEncodingType {\n\n kNoEncoding,\n\n kActiveNormalEncoded,\n\n kPassiveNormalEncoded,\n\n kPassiveDTXNB,\n\n kPassiveDTXWB,\n\n kPassiveDTXSWB,\n\n kPassiveDTXFB\n\n};\n\n\n\n// A structure which contains codec parameters. For instance, used when\n\n// initializing encoder and decoder.\n\n//\n\n// codec_inst: c.f. common_types.h\n\n// enable_dtx: set true to enable DTX. If codec does not have\n\n// internal DTX, this will enable VAD.\n\n// enable_vad: set true to enable VAD.\n\n// vad_mode: VAD mode, c.f. audio_coding_module_typedefs.h\n\n// for possible values.\n\nstruct WebRtcACMCodecParams {\n\n CodecInst codec_inst;\n\n bool enable_dtx;\n\n bool enable_vad;\n\n ACMVADMode vad_mode;\n\n};\n\n\n\n// TODO(turajs): Remove when ACM1 is removed.\n\nstruct WebRtcACMAudioBuff {\n\n int16_t in_audio[AUDIO_BUFFER_SIZE_W16];\n\n int16_t in_audio_ix_read;\n\n int16_t in_audio_ix_write;\n\n uint32_t in_timestamp[TIMESTAMP_BUFFER_SIZE_W32];\n\n int16_t in_timestamp_ix_write;\n\n uint32_t last_timestamp;\n\n uint32_t last_in_timestamp;\n\n};\n\n\n", "file_path": "modules/audio_coding/main/acm2/acm_common_defs.h", "rank": 85, "score": 113027.86125159505 }, { "content": "namespace webrtc\n\n{\n\n\n\n// Table for adjusting FEC rate for NACK/FEC protection method\n\n// Table values are built as a sigmoid function, ranging from 0 to 100, based on\n\n// the HybridNackTH values defined in media_opt_util.h.\n\nconst uint16_t VCMNackFecTable[100] = {\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n0,\n\n1,\n\n1,\n\n1,\n\n1,\n\n1,\n\n2,\n\n2,\n\n2,\n\n3,\n\n3,\n\n4,\n\n5,\n\n6,\n\n7,\n\n9,\n\n10,\n\n12,\n\n15,\n\n18,\n\n21,\n\n24,\n\n28,\n\n32,\n\n37,\n\n41,\n\n46,\n\n51,\n\n56,\n\n61,\n\n66,\n\n70,\n\n74,\n\n78,\n\n81,\n\n84,\n\n86,\n\n89,\n\n90,\n\n92,\n\n93,\n\n95,\n\n95,\n\n96,\n\n97,\n\n97,\n\n98,\n\n98,\n\n99,\n\n99,\n\n99,\n\n99,\n\n99,\n\n99,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n100,\n\n\n\n};\n\n\n", "file_path": "modules/video_coding/main/source/nack_fec_tables.h", "rank": 86, "score": 113027.86125159505 }, { "content": "namespace webrtc {\n\nnamespace VideoProcessing {\n\n\n\n// Table created with Matlab script createTable.m\n\n// Usage:\n\n// Umod=colorTable[U][V]\n\n// Vmod=colorTable[V][U]\n\nstatic const uint8_t colorTable[256][256] = {\n\n {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},\n\n {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},\n\n {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2},\n\n {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},\n\n {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},\n\n {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},\n\n {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6},\n\n {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7},\n\n {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},\n\n {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9},\n\n {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},\n\n {11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11},\n\n {12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12},\n\n {13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13},\n\n {14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14},\n\n {15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},\n\n {16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16},\n\n {17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17},\n\n {18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18},\n\n {19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19},\n\n {20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20},\n\n {21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21},\n\n {22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22},\n\n {23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23},\n\n {24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24},\n\n {25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25},\n\n {26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26},\n\n {27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27},\n\n {28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28},\n\n {29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29},\n\n {30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30},\n\n {31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31},\n\n {32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32},\n\n {33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33},\n\n {34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34},\n\n {35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35},\n\n {36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36},\n\n {37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37},\n\n {38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38},\n\n {39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39},\n\n {40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40},\n\n {41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41},\n\n {42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42},\n\n {43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43},\n\n {44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44},\n\n {45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45},\n\n {46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46},\n\n {47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47},\n\n {48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48},\n\n {49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49},\n\n {50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50},\n\n {51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51},\n\n {52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52},\n\n {53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53},\n\n {54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54},\n\n {55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55},\n\n {56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56},\n\n {57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57},\n\n {58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58},\n\n {59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59},\n\n {60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60},\n\n {61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61},\n\n {62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62},\n\n {63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63},\n\n {64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64},\n\n {65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65},\n\n {66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66},\n\n {67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67},\n\n {68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68},\n\n {69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69},\n\n {70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70},\n\n {71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71},\n\n {72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72},\n\n {73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 71, 71, 71, 71, 71, 71, 71, 71, 71, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 71, 71, 71, 71, 71, 71, 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73},\n\n {74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 72, 72, 72, 72, 72, 72, 72, 72, 72, 71, 71, 71, 71, 71, 71, 71, 71, 71, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 71, 71, 71, 71, 71, 71, 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74},\n\n {75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 73, 73, 73, 73, 73, 73, 73, 73, 72, 72, 72, 72, 72, 72, 72, 72, 72, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75},\n\n {76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 74, 74, 74, 74, 74, 74, 74, 74, 73, 73, 73, 73, 73, 73, 73, 73, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76},\n\n {77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 75, 75, 75, 75, 75, 75, 75, 74, 74, 74, 74, 74, 74, 74, 74, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77},\n\n {78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 76, 76, 76, 76, 76, 76, 76, 75, 75, 75, 75, 75, 75, 75, 74, 74, 74, 74, 74, 74, 74, 74, 74, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76, 76, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78},\n\n {79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 77, 77, 77, 77, 77, 77, 77, 76, 76, 76, 76, 76, 76, 76, 75, 75, 75, 75, 75, 75, 75, 75, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76, 76, 77, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79},\n\n {80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 79, 79, 79, 79, 79, 79, 79, 79, 79, 78, 78, 78, 78, 78, 78, 78, 77, 77, 77, 77, 77, 77, 76, 76, 76, 76, 76, 76, 76, 76, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76, 76, 76, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 78, 78, 79, 79, 79, 79, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80},\n\n {81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 80, 80, 80, 80, 80, 80, 80, 80, 80, 79, 79, 79, 79, 79, 79, 79, 78, 78, 78, 78, 78, 78, 77, 77, 77, 77, 77, 77, 77, 76, 76, 76, 76, 76, 76, 76, 76, 76, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76, 76, 76, 76, 77, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 78, 79, 79, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, 80, 80, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81},\n\n {82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 81, 81, 81, 81, 81, 81, 81, 81, 81, 80, 80, 80, 80, 80, 80, 80, 79, 79, 79, 79, 79, 79, 78, 78, 78, 78, 78, 78, 78, 77, 77, 77, 77, 77, 77, 77, 77, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 77, 77, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 78, 78, 79, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, 81, 81, 81, 81, 81, 81, 81, 81, 81, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82},\n\n {83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 82, 82, 82, 82, 82, 82, 82, 82, 82, 81, 81, 81, 81, 81, 81, 81, 80, 80, 80, 80, 80, 80, 79, 79, 79, 79, 79, 79, 79, 78, 78, 78, 78, 78, 78, 78, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 78, 78, 79, 79, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 81, 81, 81, 81, 81, 81, 81, 82, 82, 82, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83},\n\n {84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 83, 83, 83, 83, 83, 83, 83, 83, 83, 82, 82, 82, 82, 82, 82, 82, 81, 81, 81, 81, 81, 81, 80, 80, 80, 80, 80, 80, 79, 79, 79, 79, 79, 79, 79, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 79, 79, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 81, 81, 81, 81, 81, 81, 82, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84},\n\n {85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 84, 84, 84, 84, 84, 84, 84, 84, 84, 83, 83, 83, 83, 83, 83, 82, 82, 82, 82, 82, 82, 81, 81, 81, 81, 81, 81, 80, 80, 80, 80, 80, 80, 80, 79, 79, 79, 79, 79, 79, 79, 79, 79, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 79, 79, 79, 79, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, 81, 81, 81, 81, 81, 81, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85},\n\n {86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 85, 85, 85, 85, 85, 85, 85, 85, 85, 84, 84, 84, 84, 84, 84, 83, 83, 83, 83, 83, 83, 82, 82, 82, 82, 82, 82, 81, 81, 81, 81, 81, 81, 81, 80, 80, 80, 80, 80, 80, 80, 80, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, 80, 81, 81, 81, 81, 81, 81, 81, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86},\n\n {87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 86, 86, 86, 86, 86, 86, 86, 86, 85, 85, 85, 85, 85, 85, 85, 84, 84, 84, 84, 84, 84, 83, 83, 83, 83, 83, 83, 82, 82, 82, 82, 82, 82, 81, 81, 81, 81, 81, 81, 81, 81, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 81, 81, 81, 81, 81, 81, 81, 81, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87},\n\n {88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 87, 87, 87, 87, 87, 87, 87, 87, 87, 86, 86, 86, 86, 86, 86, 85, 85, 85, 85, 85, 85, 84, 84, 84, 84, 84, 84, 83, 83, 83, 83, 83, 83, 82, 82, 82, 82, 82, 82, 82, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 82, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, 87, 87, 87, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88},\n\n {89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 88, 88, 88, 88, 88, 88, 88, 88, 88, 87, 87, 87, 87, 87, 87, 87, 86, 86, 86, 86, 86, 85, 85, 85, 85, 85, 85, 84, 84, 84, 84, 84, 84, 83, 83, 83, 83, 83, 83, 83, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 81, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, 87, 88, 88, 88, 88, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89},\n\n {90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 89, 89, 89, 89, 89, 89, 89, 89, 89, 88, 88, 88, 88, 88, 88, 87, 87, 87, 87, 87, 87, 86, 86, 86, 86, 86, 85, 85, 85, 85, 85, 85, 84, 84, 84, 84, 84, 84, 84, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, 88, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90},\n\n {91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 90, 90, 90, 90, 90, 90, 90, 90, 90, 89, 89, 89, 89, 89, 89, 89, 88, 88, 88, 88, 88, 87, 87, 87, 87, 87, 87, 86, 86, 86, 86, 86, 86, 85, 85, 85, 85, 85, 85, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 90, 90, 90, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91},\n\n {92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 91, 91, 91, 91, 91, 91, 91, 91, 91, 90, 90, 90, 90, 90, 90, 89, 89, 89, 89, 89, 89, 88, 88, 88, 88, 88, 87, 87, 87, 87, 87, 87, 86, 86, 86, 86, 86, 86, 86, 85, 85, 85, 85, 85, 85, 85, 85, 85, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 91, 91, 91, 91, 91, 91, 91, 91, 91, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92},\n\n {93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 92, 92, 92, 92, 92, 92, 92, 92, 92, 91, 91, 91, 91, 91, 91, 91, 90, 90, 90, 90, 90, 89, 89, 89, 89, 89, 89, 88, 88, 88, 88, 88, 88, 87, 87, 87, 87, 87, 87, 86, 86, 86, 86, 86, 86, 86, 86, 86, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, 88, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 91, 91, 91, 91, 91, 91, 91, 92, 92, 92, 92, 92, 92, 92, 92, 92, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93},\n\n {94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 93, 93, 93, 93, 93, 93, 93, 93, 93, 92, 92, 92, 92, 92, 92, 91, 91, 91, 91, 91, 91, 90, 90, 90, 90, 90, 90, 89, 89, 89, 89, 89, 88, 88, 88, 88, 88, 88, 88, 87, 87, 87, 87, 87, 87, 87, 87, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, 87, 87, 88, 88, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 91, 91, 91, 91, 91, 91, 92, 92, 92, 92, 92, 92, 93, 93, 93, 93, 93, 93, 93, 93, 93, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94},\n\n {95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 94, 94, 94, 94, 94, 94, 94, 94, 94, 93, 93, 93, 93, 93, 93, 92, 92, 92, 92, 92, 92, 91, 91, 91, 91, 91, 90, 90, 90, 90, 90, 90, 89, 89, 89, 89, 89, 89, 88, 88, 88, 88, 88, 88, 88, 88, 88, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 88, 88, 88, 88, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 91, 91, 91, 91, 91, 92, 92, 92, 92, 92, 92, 93, 93, 93, 93, 93, 93, 94, 94, 94, 94, 94, 94, 94, 94, 94, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95},\n\n {96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 95, 95, 95, 95, 95, 95, 95, 95, 95, 94, 94, 94, 94, 94, 94, 94, 93, 93, 93, 93, 93, 93, 92, 92, 92, 92, 92, 91, 91, 91, 91, 91, 91, 90, 90, 90, 90, 90, 90, 89, 89, 89, 89, 89, 89, 89, 89, 89, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 91, 91, 91, 91, 91, 91, 92, 92, 92, 92, 92, 93, 93, 93, 93, 93, 93, 94, 94, 94, 94, 94, 94, 94, 95, 95, 95, 95, 95, 95, 95, 95, 95, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96},\n\n {97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 96, 96, 96, 96, 96, 96, 96, 96, 96, 95, 95, 95, 95, 95, 95, 95, 94, 94, 94, 94, 94, 93, 93, 93, 93, 93, 93, 92, 92, 92, 92, 92, 92, 91, 91, 91, 91, 91, 91, 90, 90, 90, 90, 90, 90, 90, 90, 90, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 90, 90, 90, 91, 91, 91, 91, 91, 91, 92, 92, 92, 92, 92, 92, 93, 93, 93, 93, 93, 93, 94, 94, 94, 94, 94, 95, 95, 95, 95, 95, 95, 95, 96, 96, 96, 96, 96, 96, 96, 96, 96, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97},\n\n {98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 97, 97, 97, 97, 97, 97, 97, 97, 97, 96, 96, 96, 96, 96, 96, 95, 95, 95, 95, 95, 95, 94, 94, 94, 94, 94, 94, 93, 93, 93, 93, 93, 93, 92, 92, 92, 92, 92, 92, 91, 91, 91, 91, 91, 91, 91, 91, 91, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 91, 91, 91, 91, 91, 91, 91, 91, 91, 92, 92, 92, 92, 92, 92, 93, 93, 93, 93, 93, 93, 94, 94, 94, 94, 94, 94, 95, 95, 95, 95, 95, 95, 96, 96, 96, 96, 96, 96, 97, 97, 97, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98},\n\n {99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 97, 97, 97, 97, 97, 97, 96, 96, 96, 96, 96, 96, 95, 95, 95, 95, 95, 95, 94, 94, 94, 94, 94, 94, 93, 93, 93, 93, 93, 93, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 93, 93, 93, 93, 93, 93, 94, 94, 94, 94, 94, 94, 95, 95, 95, 95, 95, 95, 96, 96, 96, 96, 96, 96, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99},\n\n {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 99, 99, 99, 99, 99, 99, 99, 99, 99, 98, 98, 98, 98, 98, 98, 98, 97, 97, 97, 97, 97, 97, 96, 96, 96, 96, 96, 96, 95, 95, 95, 95, 95, 95, 94, 94, 94, 94, 94, 94, 94, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 94, 94, 94, 94, 94, 94, 94, 95, 95, 95, 95, 95, 95, 96, 96, 96, 96, 96, 96, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100},\n\n {101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 100, 100, 100, 100, 100, 100, 100, 100, 100, 99, 99, 99, 99, 99, 99, 99, 98, 98, 98, 98, 98, 98, 97, 97, 97, 97, 97, 97, 96, 96, 96, 96, 96, 96, 95, 95, 95, 95, 95, 95, 95, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 95, 95, 95, 95, 95, 95, 95, 96, 96, 96, 96, 96, 96, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101},\n\n {102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 101, 101, 101, 101, 101, 101, 101, 101, 101, 100, 100, 100, 100, 100, 100, 100, 99, 99, 99, 99, 99, 99, 98, 98, 98, 98, 98, 98, 97, 97, 97, 97, 97, 97, 96, 96, 96, 96, 96, 96, 96, 96, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 96, 96, 96, 96, 96, 96, 96, 96, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102},\n\n {103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 102, 102, 102, 102, 102, 102, 102, 102, 102, 101, 101, 101, 101, 101, 101, 101, 100, 100, 100, 100, 100, 100, 100, 99, 99, 99, 99, 99, 99, 98, 98, 98, 98, 98, 98, 97, 97, 97, 97, 97, 97, 97, 97, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 97, 97, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, 102, 102, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103},\n\n {104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 103, 103, 103, 103, 103, 103, 102, 102, 102, 102, 102, 102, 102, 102, 101, 101, 101, 101, 101, 101, 100, 100, 100, 100, 100, 100, 99, 99, 99, 99, 99, 99, 99, 98, 98, 98, 98, 98, 98, 98, 98, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, 102, 103, 103, 103, 103, 103, 103, 103, 103, 103, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104},\n\n {105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 103, 103, 103, 103, 103, 102, 102, 102, 102, 102, 102, 101, 101, 101, 101, 101, 101, 101, 100, 100, 100, 100, 100, 100, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 103, 103, 103, 103, 103, 103, 103, 103, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105},\n\n {106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 103, 103, 103, 103, 102, 102, 102, 102, 102, 102, 101, 101, 101, 101, 101, 101, 101, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 103, 103, 103, 103, 103, 103, 103, 104, 104, 104, 104, 104, 104, 104, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106},\n\n {107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 105, 105, 105, 105, 105, 105, 105, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 103, 103, 103, 103, 102, 102, 102, 102, 102, 102, 102, 102, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, 102, 103, 103, 103, 103, 103, 103, 103, 104, 104, 104, 104, 104, 104, 104, 105, 105, 105, 105, 105, 105, 105, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107},\n\n {108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 106, 106, 106, 106, 106, 106, 106, 106, 105, 105, 105, 105, 105, 105, 105, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 103, 103, 103, 103, 103, 103, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 103, 103, 103, 103, 103, 103, 103, 103, 103, 104, 104, 104, 104, 104, 104, 104, 105, 105, 105, 105, 105, 105, 105, 106, 106, 106, 106, 106, 106, 106, 106, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108},\n\n {109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 107, 107, 107, 107, 107, 107, 107, 107, 106, 106, 106, 106, 106, 106, 106, 106, 105, 105, 105, 105, 105, 105, 105, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 104, 104, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 105, 105, 105, 105, 105, 105, 105, 106, 106, 106, 106, 106, 106, 106, 106, 107, 107, 107, 107, 107, 107, 107, 107, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109},\n\n {110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 108, 108, 108, 108, 108, 108, 108, 108, 107, 107, 107, 107, 107, 107, 107, 107, 106, 106, 106, 106, 106, 106, 106, 106, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 106, 106, 106, 106, 106, 106, 106, 106, 107, 107, 107, 107, 107, 107, 107, 107, 108, 108, 108, 108, 108, 108, 108, 108, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110},\n\n {111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 109, 109, 109, 109, 109, 109, 109, 109, 109, 108, 108, 108, 108, 108, 108, 108, 108, 107, 107, 107, 107, 107, 107, 107, 107, 107, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 107, 107, 107, 107, 107, 107, 107, 107, 107, 108, 108, 108, 108, 108, 108, 108, 108, 109, 109, 109, 109, 109, 109, 109, 109, 109, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111},\n\n {112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 110, 110, 110, 110, 110, 110, 110, 110, 110, 109, 109, 109, 109, 109, 109, 109, 109, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 109, 109, 109, 109, 109, 109, 109, 109, 110, 110, 110, 110, 110, 110, 110, 110, 110, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112},\n\n {113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 111, 111, 111, 111, 111, 111, 111, 111, 111, 110, 110, 110, 110, 110, 110, 110, 110, 110, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 110, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 110, 110, 110, 110, 110, 110, 110, 110, 110, 111, 111, 111, 111, 111, 111, 111, 111, 111, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113},\n\n {114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114},\n\n {115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 112, 112, 112, 112, 112, 112, 112, 112, 113, 113, 113, 113, 113, 113, 113, 112, 112, 112, 112, 112, 112, 112, 112, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115},\n\n {116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116},\n\n {117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 115, 115, 115, 115, 115, 116, 116, 116, 116, 116, 116, 116, 116, 116, 115, 115, 115, 115, 115, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117},\n\n {118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 116, 116, 116, 116, 117, 117, 117, 117, 118, 118, 118, 118, 118, 118, 118, 117, 117, 117, 117, 116, 116, 116, 116, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118},\n\n {119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 118, 118, 118, 119, 119, 119, 119, 120, 120, 120, 119, 119, 119, 119, 118, 118, 118, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119},\n\n {120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 119, 119, 119, 119, 120, 120, 121, 121, 121, 121, 121, 121, 121, 121, 121, 120, 120, 119, 119, 119, 119, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120},\n\n {121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 120, 120, 120, 120, 120, 121, 121, 122, 122, 122, 122, 123, 123, 123, 122, 122, 122, 122, 121, 121, 120, 120, 120, 120, 120, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121},\n\n {122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 120, 120, 120, 120, 120, 120, 120, 120, 121, 121, 121, 121, 121, 121, 121, 121, 122, 122, 122, 123, 123, 123, 124, 124, 124, 124, 124, 123, 123, 123, 122, 122, 122, 121, 121, 121, 121, 121, 121, 121, 121, 120, 120, 120, 120, 120, 120, 120, 120, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122},\n\n {123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 123, 123, 123, 124, 124, 124, 124, 125, 125, 125, 125, 125, 124, 124, 124, 124, 123, 123, 123, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123},\n\n {124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 124, 124, 124, 124, 124, 125, 125, 125, 125, 125, 126, 126, 126, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124},\n\n {125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 125, 125, 125, 125, 125, 125, 125, 125, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 125, 125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125},\n\n {126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},\n\n {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127},\n\n {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 127, 127, 127, 127, 127, 127, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},\n\n {129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129},\n\n {130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 130, 130, 130, 130, 130, 129, 129, 129, 129, 129, 128, 128, 128, 129, 129, 129, 129, 129, 130, 130, 130, 130, 130, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130},\n\n {131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 131, 131, 131, 130, 130, 130, 130, 129, 129, 129, 129, 129, 130, 130, 130, 130, 131, 131, 131, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131},\n\n {132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 134, 134, 134, 134, 134, 134, 134, 134, 133, 133, 133, 133, 133, 133, 133, 133, 132, 132, 132, 131, 131, 131, 130, 130, 130, 130, 130, 131, 131, 131, 132, 132, 132, 133, 133, 133, 133, 133, 133, 133, 133, 134, 134, 134, 134, 134, 134, 134, 134, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132},\n\n {133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 134, 134, 134, 134, 134, 133, 133, 132, 132, 132, 132, 131, 131, 131, 132, 132, 132, 132, 133, 133, 134, 134, 134, 134, 134, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133},\n\n {134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 135, 135, 135, 135, 134, 134, 133, 133, 133, 133, 133, 133, 133, 133, 133, 134, 134, 135, 135, 135, 135, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134},\n\n {135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 136, 136, 136, 135, 135, 135, 135, 134, 134, 134, 135, 135, 135, 135, 136, 136, 136, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135},\n\n {136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 138, 138, 138, 138, 138, 137, 137, 137, 137, 136, 136, 136, 136, 136, 136, 136, 137, 137, 137, 137, 138, 138, 138, 138, 138, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136},\n\n {137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 138, 138, 138, 138, 138, 138, 138, 138, 138, 139, 139, 139, 139, 139, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137},\n\n {138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138},\n\n {139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 141, 142, 142, 142, 142, 142, 142, 142, 142, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139},\n\n {140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140},\n\n {141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 143, 143, 143, 143, 143, 143, 143, 143, 143, 144, 144, 144, 144, 144, 144, 144, 144, 144, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 144, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141},\n\n {142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 144, 144, 144, 144, 144, 144, 144, 144, 144, 145, 145, 145, 145, 145, 145, 145, 145, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142},\n\n {143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 145, 145, 145, 145, 145, 145, 145, 145, 145, 146, 146, 146, 146, 146, 146, 146, 146, 147, 147, 147, 147, 147, 147, 147, 147, 147, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143},\n\n {144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 146, 146, 146, 146, 146, 146, 146, 146, 147, 147, 147, 147, 147, 147, 147, 147, 148, 148, 148, 148, 148, 148, 148, 148, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144},\n\n {145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 147, 147, 147, 147, 147, 147, 147, 147, 148, 148, 148, 148, 148, 148, 148, 148, 149, 149, 149, 149, 149, 149, 149, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 150, 150, 150, 150, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145},\n\n {146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 148, 148, 148, 148, 148, 148, 148, 148, 149, 149, 149, 149, 149, 149, 149, 150, 150, 150, 150, 150, 150, 150, 151, 151, 151, 151, 151, 151, 151, 151, 151, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146},\n\n {147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 149, 149, 149, 149, 149, 149, 149, 150, 150, 150, 150, 150, 150, 150, 151, 151, 151, 151, 151, 151, 151, 152, 152, 152, 152, 152, 152, 152, 152, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 152, 152, 152, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147},\n\n {148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 150, 150, 150, 150, 150, 150, 150, 151, 151, 151, 151, 151, 151, 151, 152, 152, 152, 152, 152, 152, 153, 153, 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 153, 153, 153, 153, 153, 153, 153, 152, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148},\n\n {149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 151, 151, 151, 151, 151, 151, 151, 151, 152, 152, 152, 152, 152, 152, 153, 153, 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, 154, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 154, 153, 153, 153, 153, 153, 153, 153, 152, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149},\n\n {150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 151, 151, 151, 151, 151, 151, 151, 151, 151, 152, 152, 152, 152, 152, 152, 152, 152, 153, 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, 154, 155, 155, 155, 155, 155, 155, 155, 156, 156, 156, 156, 156, 156, 156, 156, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 156, 156, 156, 156, 156, 156, 156, 156, 155, 155, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 154, 153, 153, 153, 153, 153, 153, 152, 152, 152, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150},\n\n {151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 152, 152, 152, 152, 152, 152, 152, 152, 152, 153, 153, 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, 154, 154, 155, 155, 155, 155, 155, 155, 156, 156, 156, 156, 156, 156, 157, 157, 157, 157, 157, 157, 157, 157, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 157, 157, 157, 156, 156, 156, 156, 156, 156, 155, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 154, 154, 153, 153, 153, 153, 153, 153, 153, 152, 152, 152, 152, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151},\n\n {152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 153, 153, 153, 153, 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, 154, 154, 155, 155, 155, 155, 155, 155, 156, 156, 156, 156, 156, 156, 157, 157, 157, 157, 157, 157, 158, 158, 158, 158, 158, 158, 158, 158, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 157, 156, 156, 156, 156, 156, 156, 155, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 154, 154, 153, 153, 153, 153, 153, 153, 153, 153, 153, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152},\n\n {153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, 154, 154, 154, 154, 155, 155, 155, 155, 155, 155, 155, 156, 156, 156, 156, 156, 156, 157, 157, 157, 157, 157, 157, 158, 158, 158, 158, 158, 158, 159, 159, 159, 159, 159, 159, 159, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 159, 159, 159, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 157, 156, 156, 156, 156, 156, 156, 155, 155, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 154, 154, 154, 154, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153},\n\n {154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 155, 155, 155, 155, 155, 155, 155, 155, 155, 156, 156, 156, 156, 156, 156, 156, 157, 157, 157, 157, 157, 157, 158, 158, 158, 158, 158, 158, 159, 159, 159, 159, 159, 159, 160, 160, 160, 160, 160, 160, 160, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 160, 160, 160, 160, 160, 160, 160, 159, 159, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 157, 156, 156, 156, 156, 156, 156, 156, 155, 155, 155, 155, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154},\n\n {155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 157, 157, 157, 157, 157, 157, 158, 158, 158, 158, 158, 158, 159, 159, 159, 159, 159, 159, 160, 160, 160, 160, 160, 160, 161, 161, 161, 161, 161, 161, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 161, 161, 161, 161, 161, 161, 160, 160, 160, 160, 160, 160, 159, 159, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 157, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155},\n\n {156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 157, 157, 157, 157, 157, 157, 157, 157, 157, 158, 158, 158, 158, 158, 158, 159, 159, 159, 159, 159, 159, 160, 160, 160, 160, 160, 160, 161, 161, 161, 161, 161, 161, 162, 162, 162, 162, 162, 162, 163, 163, 163, 163, 163, 163, 163, 163, 163, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 163, 163, 163, 163, 163, 163, 163, 163, 163, 162, 162, 162, 162, 162, 162, 161, 161, 161, 161, 161, 161, 160, 160, 160, 160, 160, 160, 159, 159, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 157, 157, 157, 157, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156},\n\n {157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 158, 158, 158, 158, 158, 158, 158, 158, 158, 159, 159, 159, 159, 159, 159, 159, 160, 160, 160, 160, 160, 161, 161, 161, 161, 161, 161, 162, 162, 162, 162, 162, 162, 163, 163, 163, 163, 163, 163, 164, 164, 164, 164, 164, 164, 164, 164, 164, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 164, 164, 164, 164, 164, 164, 164, 164, 164, 163, 163, 163, 163, 163, 163, 162, 162, 162, 162, 162, 162, 161, 161, 161, 161, 161, 161, 160, 160, 160, 160, 160, 159, 159, 159, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157},\n\n {158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 159, 159, 159, 159, 159, 159, 159, 159, 159, 160, 160, 160, 160, 160, 160, 160, 161, 161, 161, 161, 161, 161, 162, 162, 162, 162, 162, 163, 163, 163, 163, 163, 163, 164, 164, 164, 164, 164, 164, 165, 165, 165, 165, 165, 165, 165, 165, 165, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 165, 165, 165, 165, 165, 165, 165, 165, 165, 164, 164, 164, 164, 164, 164, 163, 163, 163, 163, 163, 163, 162, 162, 162, 162, 162, 161, 161, 161, 161, 161, 161, 160, 160, 160, 160, 160, 160, 160, 159, 159, 159, 159, 159, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158},\n\n {159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 160, 160, 160, 160, 160, 160, 160, 160, 160, 161, 161, 161, 161, 161, 161, 162, 162, 162, 162, 162, 162, 163, 163, 163, 163, 163, 164, 164, 164, 164, 164, 164, 165, 165, 165, 165, 165, 165, 166, 166, 166, 166, 166, 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 166, 166, 166, 166, 166, 165, 165, 165, 165, 165, 165, 164, 164, 164, 164, 164, 164, 163, 163, 163, 163, 163, 162, 162, 162, 162, 162, 162, 161, 161, 161, 161, 161, 161, 160, 160, 160, 160, 160, 160, 160, 160, 160, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159},\n\n {160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 161, 161, 161, 161, 161, 161, 161, 161, 161, 162, 162, 162, 162, 162, 162, 163, 163, 163, 163, 163, 163, 164, 164, 164, 164, 164, 164, 165, 165, 165, 165, 165, 166, 166, 166, 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, 167, 167, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 166, 166, 166, 165, 165, 165, 165, 165, 164, 164, 164, 164, 164, 164, 163, 163, 163, 163, 163, 163, 162, 162, 162, 162, 162, 162, 161, 161, 161, 161, 161, 161, 161, 161, 161, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160},\n\n {161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 162, 162, 162, 162, 162, 162, 162, 162, 162, 163, 163, 163, 163, 163, 163, 163, 164, 164, 164, 164, 164, 165, 165, 165, 165, 165, 165, 166, 166, 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, 168, 168, 168, 168, 168, 168, 168, 168, 168, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 168, 168, 168, 168, 168, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 166, 166, 165, 165, 165, 165, 165, 165, 164, 164, 164, 164, 164, 163, 163, 163, 163, 163, 163, 163, 162, 162, 162, 162, 162, 162, 162, 162, 162, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161},\n\n {162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 163, 163, 163, 163, 163, 163, 163, 163, 163, 164, 164, 164, 164, 164, 164, 165, 165, 165, 165, 165, 165, 166, 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, 168, 168, 168, 168, 168, 168, 168, 169, 169, 169, 169, 169, 169, 169, 169, 169, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 169, 169, 169, 169, 169, 169, 169, 169, 169, 168, 168, 168, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 166, 165, 165, 165, 165, 165, 165, 164, 164, 164, 164, 164, 164, 163, 163, 163, 163, 163, 163, 163, 163, 163, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162},\n\n {163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 164, 164, 164, 164, 164, 164, 164, 164, 164, 165, 165, 165, 165, 165, 165, 165, 166, 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, 168, 168, 168, 168, 168, 168, 169, 169, 169, 169, 169, 169, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 169, 169, 169, 169, 169, 169, 168, 168, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 166, 165, 165, 165, 165, 165, 165, 165, 164, 164, 164, 164, 164, 164, 164, 164, 164, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163},\n\n {164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 165, 165, 165, 165, 165, 165, 165, 165, 165, 166, 166, 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, 168, 168, 168, 168, 168, 169, 169, 169, 169, 169, 169, 170, 170, 170, 170, 170, 170, 170, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 170, 170, 170, 170, 170, 170, 170, 169, 169, 169, 169, 169, 169, 168, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 166, 166, 165, 165, 165, 165, 165, 165, 165, 165, 165, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164},\n\n {165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 166, 166, 166, 166, 166, 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, 167, 168, 168, 168, 168, 168, 169, 169, 169, 169, 169, 169, 170, 170, 170, 170, 170, 170, 171, 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 173, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 171, 171, 171, 171, 171, 171, 171, 170, 170, 170, 170, 170, 170, 169, 169, 169, 169, 169, 169, 168, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 166, 166, 166, 166, 166, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165},\n\n {166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, 167, 167, 167, 168, 168, 168, 168, 168, 168, 169, 169, 169, 169, 169, 169, 170, 170, 170, 170, 170, 170, 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, 172, 172, 172, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 172, 172, 171, 171, 171, 171, 171, 171, 170, 170, 170, 170, 170, 170, 169, 169, 169, 169, 169, 169, 168, 168, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166},\n\n {167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 168, 168, 168, 168, 168, 168, 168, 168, 169, 169, 169, 169, 169, 169, 169, 170, 170, 170, 170, 170, 170, 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, 172, 172, 173, 173, 173, 173, 173, 173, 173, 173, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 172, 171, 171, 171, 171, 171, 171, 170, 170, 170, 170, 170, 170, 169, 169, 169, 169, 169, 169, 169, 168, 168, 168, 168, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167},\n\n {168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 169, 169, 169, 169, 169, 169, 169, 169, 169, 170, 170, 170, 170, 170, 170, 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, 172, 172, 173, 173, 173, 173, 173, 173, 173, 174, 174, 174, 174, 174, 174, 174, 174, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 172, 171, 171, 171, 171, 171, 171, 170, 170, 170, 170, 170, 170, 169, 169, 169, 169, 169, 169, 169, 169, 169, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168},\n\n {169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 170, 170, 170, 170, 170, 170, 170, 170, 170, 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, 172, 172, 173, 173, 173, 173, 173, 173, 174, 174, 174, 174, 174, 174, 174, 175, 175, 175, 175, 175, 175, 175, 175, 175, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 175, 175, 175, 175, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 172, 171, 171, 171, 171, 171, 171, 170, 170, 170, 170, 170, 170, 170, 170, 170, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169},\n\n {170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 171, 171, 171, 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, 172, 172, 172, 173, 173, 173, 173, 173, 173, 174, 174, 174, 174, 174, 174, 175, 175, 175, 175, 175, 175, 175, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 175, 175, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 172, 172, 171, 171, 171, 171, 171, 171, 171, 171, 171, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170},\n\n {171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, 172, 172, 172, 172, 172, 173, 173, 173, 173, 173, 173, 173, 174, 174, 174, 174, 174, 174, 175, 175, 175, 175, 175, 175, 175, 176, 176, 176, 176, 176, 176, 176, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 176, 176, 176, 176, 176, 176, 176, 175, 175, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 172, 172, 172, 172, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171},\n\n {172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 173, 173, 173, 173, 173, 173, 173, 173, 173, 174, 174, 174, 174, 174, 174, 174, 175, 175, 175, 175, 175, 175, 176, 176, 176, 176, 176, 176, 176, 177, 177, 177, 177, 177, 177, 177, 177, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 177, 177, 177, 176, 176, 176, 176, 176, 176, 176, 175, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172},\n\n {173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 174, 174, 174, 174, 174, 174, 174, 174, 174, 175, 175, 175, 175, 175, 175, 175, 176, 176, 176, 176, 176, 176, 177, 177, 177, 177, 177, 177, 177, 178, 178, 178, 178, 178, 178, 178, 178, 178, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 178, 178, 178, 178, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173},\n\n {174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 175, 175, 175, 175, 175, 175, 175, 175, 175, 176, 176, 176, 176, 176, 176, 176, 177, 177, 177, 177, 177, 177, 178, 178, 178, 178, 178, 178, 178, 178, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 178, 178, 178, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 177, 176, 176, 176, 176, 176, 176, 176, 175, 175, 175, 175, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174},\n\n {175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 177, 177, 177, 177, 177, 177, 177, 178, 178, 178, 178, 178, 178, 178, 179, 179, 179, 179, 179, 179, 179, 179, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 179, 179, 179, 179, 179, 179, 179, 179, 178, 178, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 177, 177, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175},\n\n {176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 178, 178, 178, 178, 178, 178, 178, 179, 179, 179, 179, 179, 179, 179, 180, 180, 180, 180, 180, 180, 180, 180, 180, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 180, 180, 180, 180, 180, 180, 180, 180, 180, 179, 179, 179, 179, 179, 179, 179, 178, 178, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176},\n\n {177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 179, 179, 179, 179, 179, 179, 179, 180, 180, 180, 180, 180, 180, 180, 180, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 180, 180, 180, 180, 180, 180, 180, 180, 179, 179, 179, 179, 179, 179, 179, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177},\n\n {178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 180, 180, 180, 180, 180, 180, 180, 180, 181, 181, 181, 181, 181, 181, 181, 181, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 181, 181, 181, 181, 181, 181, 181, 181, 180, 180, 180, 180, 180, 180, 180, 180, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178},\n\n {179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 181, 181, 181, 181, 181, 181, 181, 181, 182, 182, 182, 182, 182, 182, 182, 182, 182, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 182, 182, 182, 182, 182, 182, 182, 182, 182, 181, 181, 181, 181, 181, 181, 181, 181, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179},\n\n {180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 182, 182, 182, 182, 182, 182, 182, 182, 182, 183, 183, 183, 183, 183, 183, 183, 183, 183, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 183, 183, 183, 183, 183, 183, 183, 183, 183, 182, 182, 182, 182, 182, 182, 182, 182, 182, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180},\n\n {181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 183, 183, 183, 183, 183, 183, 183, 183, 183, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 183, 183, 183, 183, 183, 183, 183, 183, 183, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181},\n\n {182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182},\n\n {183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183},\n\n {184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184},\n\n {185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185},\n\n {186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186},\n\n {187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187},\n\n {188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188},\n\n {189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189},\n\n {190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190},\n\n {191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191},\n\n {192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192},\n\n {193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193},\n\n {194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194},\n\n {195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195},\n\n {196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196},\n\n {197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197},\n\n {198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198},\n\n {199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199},\n\n {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200},\n\n {201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201},\n\n {202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202},\n\n {203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203},\n\n {204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204},\n\n {205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205},\n\n {206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206},\n\n {207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207},\n\n {208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208},\n\n {209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209},\n\n {210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210},\n\n {211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211},\n\n {212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212},\n\n {213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213},\n\n {214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214},\n\n {215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215},\n\n {216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216},\n\n {217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217},\n\n {218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218},\n\n {219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219},\n\n {220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220},\n\n {221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221},\n\n {222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222},\n\n {223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223},\n\n {224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224},\n\n {225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225},\n\n {226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226},\n\n {227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227},\n\n {228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228},\n\n {229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229},\n\n {230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230},\n\n {231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231},\n\n {232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232},\n\n {233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233},\n\n {234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234},\n\n {235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235},\n\n {236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236},\n\n {237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237},\n\n {238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238},\n\n {239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239},\n\n {240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240},\n\n {241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241},\n\n {242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242},\n\n {243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243},\n\n {244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244},\n\n {245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245},\n\n {246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246},\n\n {247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247},\n\n {248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248},\n\n {249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249},\n\n {250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250},\n\n {251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251},\n\n {252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252},\n\n {253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253},\n\n {254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254},\n\n {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}\n\n};\n\n\n\n\n\n} // namespace VideoProcessing\n", "file_path": "modules/video_processing/main/source/color_enhancement_private.h", "rank": 87, "score": 113027.86125159505 }, { "content": "namespace webrtc {\n\n\n\nconst int kIsacPayloadType = 103;\n\nconst int kInvalidPayloadType = -1;\n\n\n\ntemplate <typename T>\n\nAudioEncoderDecoderIsacT<T>::Config::Config()\n\n : payload_type(kIsacPayloadType),\n\n red_payload_type(kInvalidPayloadType),\n\n sample_rate_hz(16000),\n\n frame_size_ms(30),\n\n bit_rate(32000),\n\n max_bit_rate(-1),\n\n max_payload_size_bytes(-1) {\n\n}\n\n\n\ntemplate <typename T>\n\nbool AudioEncoderDecoderIsacT<T>::Config::IsOk() const {\n\n if (max_bit_rate < 32000 && max_bit_rate != -1)\n\n return false;\n\n if (max_payload_size_bytes < 120 && max_payload_size_bytes != -1)\n\n return false;\n\n switch (sample_rate_hz) {\n\n case 16000:\n\n if (max_bit_rate > 53400)\n\n return false;\n\n if (max_payload_size_bytes > 400)\n\n return false;\n\n return (frame_size_ms == 30 || frame_size_ms == 60) &&\n\n bit_rate >= 10000 && bit_rate <= 32000;\n\n case 32000:\n\n case 48000:\n\n if (max_bit_rate > 160000)\n\n return false;\n\n if (max_payload_size_bytes > 600)\n\n return false;\n\n return T::has_swb &&\n\n (frame_size_ms == 30 && bit_rate >= 10000 && bit_rate <= 56000);\n\n default:\n\n return false;\n\n }\n", "file_path": "modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h", "rank": 88, "score": 111753.95159287774 }, { "content": "namespace webrtc {\n\n\n\n///////////////////////////////////////////////////////////////////////////\n\n// enum AudioPlayoutMode\n\n// An enumerator for different playout modes.\n\n//\n\n// -voice : This is the standard mode for VoIP calls. The trade-off\n\n// between low delay and jitter robustness is optimized\n\n// for high-quality two-way communication.\n\n// NetEQs packet loss concealment and signal processing\n\n// capabilities are fully employed.\n\n// -fax : The fax mode is optimized for decodability of fax signals\n\n// rather than for perceived audio quality. When this mode\n\n// is selected, NetEQ will do as few delay changes as possible,\n\n// trying to maintain a high and constant delay. Meanwhile,\n\n// the packet loss concealment efforts are reduced.\n\n//\n\n// -streaming : In the case of one-way communication such as passive\n\n// conference participant, a webinar, or a streaming application,\n\n// this mode can be used to improve the jitter robustness at\n\n// the cost of increased delay.\n\n// -off : Turns off most of NetEQ's features. Stuffs zeros for lost\n\n// packets and during buffer increases.\n\n//\n\nenum AudioPlayoutMode {\n\n voice = 0,\n\n fax = 1,\n\n streaming = 2,\n\n off = 3,\n\n};\n\n\n\n///////////////////////////////////////////////////////////////////////////\n\n// enum ACMSpeechType\n\n// An enumerator for possible labels of a decoded frame.\n\n//\n\n// -normal : a normal speech frame. If VAD is enabled on the\n\n// incoming stream this label indicate that the\n\n// frame is active.\n\n// -PLC : a PLC frame. The corresponding packet was lost\n\n// and this frame generated by PLC techniques.\n\n// -CNG : the frame is comfort noise. This happens if VAD\n\n// is enabled at the sender and we have received\n\n// SID.\n\n// -PLCCNG : PLC will fade to comfort noise if the duration\n\n// of PLC is long. This labels such a case.\n\n// -VADPassive : the VAD at the receiver recognizes this frame as\n\n// passive.\n\n//\n\nenum ACMSpeechType {\n\n normal = 0,\n\n PLC = 1,\n\n CNG = 2,\n\n PLCCNG = 3,\n\n VADPassive = 4\n\n};\n\n\n\n///////////////////////////////////////////////////////////////////////////\n\n// enum ACMVADMode\n\n// An enumerator for aggressiveness of VAD\n\n// -VADNormal : least aggressive mode.\n\n// -VADLowBitrate : more aggressive than \"VADNormal\" to save on\n\n// bit-rate.\n\n// -VADAggr : an aggressive mode.\n\n// -VADVeryAggr : the most agressive mode.\n\n//\n\nenum ACMVADMode {\n\n VADNormal = 0,\n\n VADLowBitrate = 1,\n\n VADAggr = 2,\n\n VADVeryAggr = 3\n\n};\n\n\n\n///////////////////////////////////////////////////////////////////////////\n\n// enum ACMCountries\n\n// An enumerator for countries, used when enabling CPT for a specific country.\n\n//\n\nenum ACMCountries {\n\n ACMDisableCountryDetection = -1, // disable CPT detection\n\n ACMUSA = 0,\n\n ACMJapan,\n\n ACMCanada,\n\n ACMFrance,\n\n ACMGermany,\n\n ACMAustria,\n\n ACMBelgium,\n\n ACMUK,\n\n ACMCzech,\n\n ACMDenmark,\n\n ACMFinland,\n\n ACMGreece,\n\n ACMHungary,\n\n ACMIceland,\n\n ACMIreland,\n\n ACMItaly,\n\n ACMLuxembourg,\n\n ACMMexico,\n\n ACMNorway,\n\n ACMPoland,\n\n ACMPortugal,\n\n ACMSpain,\n\n ACMSweden,\n\n ACMTurkey,\n\n ACMChina,\n\n ACMHongkong,\n\n ACMTaiwan,\n\n ACMKorea,\n\n ACMSingapore,\n\n ACMNonStandard1\n\n// non-standard countries\n\n};\n\n\n\n///////////////////////////////////////////////////////////////////////////\n\n// enum ACMAMRPackingFormat\n\n// An enumerator for different bit-packing format of AMR codec according to\n\n// RFC 3267.\n\n//\n\n// -AMRUndefined : undefined.\n\n// -AMRBandwidthEfficient : bandwidth-efficient mode.\n\n// -AMROctetAlligned : Octet-alligned mode.\n\n// -AMRFileStorage : file-storage mode.\n\n//\n\nenum ACMAMRPackingFormat {\n\n AMRUndefined = -1,\n\n AMRBandwidthEfficient = 0,\n\n AMROctetAlligned = 1,\n\n AMRFileStorage = 2\n\n};\n\n\n\n\n\n///////////////////////////////////////////////////////////////////////////\n\n//\n\n// Struct containing network statistics\n\n//\n\n// -currentBufferSize : current jitter buffer size in ms\n\n// -preferredBufferSize : preferred (optimal) buffer size in ms\n\n// -jitterPeaksFound : indicate if peaky-jitter mode is engaged, that is,\n\n// if severe but sparse network delays have occurred.\n\n// -currentPacketLossRate : loss rate (network + late) (in Q14)\n\n// -currentDiscardRate : late loss rate (in Q14)\n\n// -currentExpandRate : fraction (of original stream) of synthesized\n\n// speech inserted through expansion (in Q14)\n\n// -currentPreemptiveRate : fraction of synthesized speech inserted through\n\n// pre-emptive expansion (in Q14)\n\n// -currentAccelerateRate : fraction of data removed through acceleration\n\n// (in Q14)\n\n// -clockDriftPPM : clock-drift between sender and receiver in parts-\n\n// per-million. Positive means that receiver sample\n\n// rate is higher than sender sample rate.\n\n// -meanWaitingTimeMs : average packet waiting time in the buffer\n\n// -medianWaitingTimeMs : median packet waiting time in the buffer\n\n// -minWaitingTimeMs : min packet waiting time in the buffer\n\n// -maxWaitingTimeMs : max packet waiting time in the buffer\n\n// -addedSamples : samples inserted because of packet loss in off mode\n\ntypedef struct {\n\n uint16_t currentBufferSize;\n\n uint16_t preferredBufferSize;\n\n bool jitterPeaksFound;\n\n uint16_t currentPacketLossRate;\n\n uint16_t currentDiscardRate;\n\n uint16_t currentExpandRate;\n\n uint16_t currentPreemptiveRate;\n\n uint16_t currentAccelerateRate;\n\n int32_t clockDriftPPM;\n\n int meanWaitingTimeMs;\n\n int medianWaitingTimeMs;\n\n int minWaitingTimeMs;\n\n int maxWaitingTimeMs;\n\n int addedSamples;\n\n} ACMNetworkStatistics;\n\n\n\n///////////////////////////////////////////////////////////////////////////\n\n//\n\n// Enumeration of background noise mode a mapping from NetEQ interface.\n\n//\n\n// -On : default \"normal\" behavior with eternal noise\n\n// -Fade : noise fades to zero after some time\n\n// -Off : background noise is always zero\n\n//\n\nenum ACMBackgroundNoiseMode {\n\n On,\n\n Fade,\n\n Off\n\n};\n\n\n\n///////////////////////////////////////////////////////////////////////////\n\n//\n\n// Enumeration of Opus mode for intended application.\n\n//\n\n// kVoip : optimized for voice signals.\n\n// kAudio : optimized for non-voice signals like music.\n\n//\n\nenum OpusApplicationMode {\n\n kVoip = 0,\n\n kAudio = 1,\n\n};\n\n\n", "file_path": "modules/audio_coding/main/interface/audio_coding_module_typedefs.h", "rank": 89, "score": 111753.95159287774 }, { "content": "class WEBRTC_DLLEXPORT ViEImageProcess {\n\n public:\n\n // Factory for the ViEImageProcess sub‐API and increases an internal\n\n // reference counter if successful. Returns NULL if the API is not supported\n\n // or if construction fails.\n\n static ViEImageProcess* GetInterface(VideoEngine* video_engine);\n\n\n\n // Releases the ViEImageProcess sub-API and decreases an internal reference\n\n // counter. Returns the new reference count. This value should be zero\n\n // for all sub-API:s before the VideoEngine object can be safely deleted.\n\n virtual int Release() = 0;\n\n\n\n // This function registers a EffectFilter to use for a specified capture\n\n // device.\n\n virtual int RegisterCaptureEffectFilter(const int capture_id,\n\n ViEEffectFilter& capture_filter) = 0;\n\n\n\n // This function deregisters a EffectFilter for a specified capture device.\n\n virtual int DeregisterCaptureEffectFilter(const int capture_id) = 0;\n\n\n", "file_path": "video_engine/include/vie_image_process.h", "rank": 90, "score": 111235.32434563918 }, { "content": "class WEBRTC_DLLEXPORT VoEVolumeControl\n\n{\n\npublic:\n\n // Factory for the VoEVolumeControl sub-API. Increases an internal\n\n // reference counter if successful. Returns NULL if the API is not\n\n // supported or if construction fails.\n\n static VoEVolumeControl* GetInterface(VoiceEngine* voiceEngine);\n\n\n\n // Releases the VoEVolumeControl sub-API and decreases an internal\n\n // reference counter. Returns the new reference count. This value should\n\n // be zero for all sub-API:s before the VoiceEngine object can be safely\n\n // deleted.\n\n virtual int Release() = 0;\n\n\n\n // Sets the speaker |volume| level. Valid range is [0,255].\n\n virtual int SetSpeakerVolume(unsigned int volume) = 0;\n\n\n\n // Gets the speaker |volume| level.\n\n virtual int GetSpeakerVolume(unsigned int& volume) = 0;\n\n\n", "file_path": "voice_engine/include/voe_volume_control.h", "rank": 91, "score": 111235.32434563918 }, { "content": "// VoEAudioProcessing\n\nclass WEBRTC_DLLEXPORT VoEAudioProcessing\n\n{\n\npublic:\n\n // Factory for the VoEAudioProcessing sub-API. Increases an internal\n\n // reference counter if successful. Returns NULL if the API is not\n\n // supported or if construction fails.\n\n static VoEAudioProcessing* GetInterface(VoiceEngine* voiceEngine);\n\n\n\n // Releases the VoEAudioProcessing sub-API and decreases an internal\n\n // reference counter. Returns the new reference count. This value should\n\n // be zero for all sub-API:s before the VoiceEngine object can be safely\n\n // deleted.\n\n virtual int Release() = 0;\n\n\n\n // Sets Noise Suppression (NS) status and mode.\n\n // The NS reduces noise in the microphone signal.\n\n virtual int SetNsStatus(bool enable, NsModes mode = kNsUnchanged) = 0;\n\n\n\n // Gets the NS status and mode.\n\n virtual int GetNsStatus(bool& enabled, NsModes& mode) = 0;\n", "file_path": "voice_engine/include/voe_audio_processing.h", "rank": 92, "score": 111235.32434563918 }, { "content": "class WEBRTC_DLLEXPORT VoEExternalMedia\n\n{\n\npublic:\n\n // Factory for the VoEExternalMedia sub-API. Increases an internal\n\n // reference counter if successful. Returns NULL if the API is not\n\n // supported or if construction fails.\n\n static VoEExternalMedia* GetInterface(VoiceEngine* voiceEngine);\n\n\n\n // Releases the VoEExternalMedia sub-API and decreases an internal\n\n // reference counter. Returns the new reference count. This value should\n\n // be zero for all sub-API:s before the VoiceEngine object can be safely\n\n // deleted.\n\n virtual int Release() = 0;\n\n\n\n // Installs a VoEMediaProcess derived instance and activates external\n\n // media for the specified |channel| and |type|.\n\n virtual int RegisterExternalMediaProcessing(\n\n int channel, ProcessingTypes type, VoEMediaProcess& processObject) = 0;\n\n\n\n // Removes the VoEMediaProcess derived instance and deactivates external\n", "file_path": "voice_engine/include/voe_external_media.h", "rank": 93, "score": 111235.32434563918 }, { "content": "// This class declares an abstract interface for a user defined effect filter.\n\n// The effect filter is registered using RegisterCaptureEffectFilter(),\n\n// RegisterSendEffectFilter() or RegisterRenderEffectFilter() and deregistered\n\n// with the corresponding deregister function.\n\nclass WEBRTC_DLLEXPORT ViEEffectFilter {\n\n public:\n\n // This method is called with an I420 video frame allowing the user to\n\n // modify the video frame.\n\n virtual int Transform(size_t size,\n\n unsigned char* frame_buffer,\n\n int64_t ntp_time_ms,\n\n unsigned int timestamp,\n\n unsigned int width,\n\n unsigned int height) = 0;\n\n protected:\n\n ViEEffectFilter() {}\n\n virtual ~ViEEffectFilter() {}\n\n};\n\n\n", "file_path": "video_engine/include/vie_image_process.h", "rank": 94, "score": 111235.32434563918 }, { "content": "class WEBRTC_DLLEXPORT VoEVideoSync\n\n{\n\npublic:\n\n // Factory for the VoEVideoSync sub-API. Increases an internal\n\n // reference counter if successful. Returns NULL if the API is not\n\n // supported or if construction fails.\n\n static VoEVideoSync* GetInterface(VoiceEngine* voiceEngine);\n\n\n\n // Releases the VoEVideoSync sub-API and decreases an internal\n\n // reference counter. Returns the new reference count. This value should\n\n // be zero for all sub-API:s before the VoiceEngine object can be safely\n\n // deleted.\n\n virtual int Release() = 0;\n\n\n\n // Gets the current sound card buffer size (playout delay).\n\n virtual int GetPlayoutBufferSize(int& buffer_ms) = 0;\n\n\n\n // Sets a minimum target delay for the jitter buffer. This delay is\n\n // maintained by the jitter buffer, unless channel condition (jitter in\n\n // inter-arrival times) dictates a higher required delay. The overall\n", "file_path": "voice_engine/include/voe_video_sync.h", "rank": 95, "score": 111235.32434563918 }, { "content": "class WEBRTC_DLLEXPORT ViEExternalCodec {\n\n public:\n\n static ViEExternalCodec* GetInterface(VideoEngine* video_engine);\n\n\n\n virtual int Release() = 0;\n\n\n\n virtual int RegisterExternalSendCodec(const int video_channel,\n\n const unsigned char pl_type,\n\n VideoEncoder* encoder,\n\n bool internal_source) = 0;\n\n\n\n virtual int DeRegisterExternalSendCodec(const int video_channel,\n\n const unsigned char pl_type) = 0;\n\n\n\n virtual int RegisterExternalReceiveCodec(const int video_channel,\n\n const unsigned char pl_type,\n\n VideoDecoder* decoder,\n\n bool decoder_render = false,\n\n int render_delay = 0) = 0;\n\n\n", "file_path": "video_engine/include/vie_external_codec.h", "rank": 96, "score": 111235.32434563918 }, { "content": "class WEBRTC_DLLEXPORT VoEMediaProcess\n\n{\n\npublic:\n\n // The VoiceEngine user should override the Process() method in a\n\n // derived class. Process() will be called when audio is ready to\n\n // be processed. The audio can be accessed in several different modes\n\n // given by the |type| parameter. The function should modify the\n\n // original data and ensure that it is copied back to the |audio10ms|\n\n // array. The number of samples in the frame cannot be changed.\n\n // The sampling frequency will depend upon the codec used.\n\n // If |isStereo| is true, audio10ms will contain 16-bit PCM data\n\n // samples in interleaved stereo format (L0,R0,L1,R1,...).\n\n virtual void Process(int channel, ProcessingTypes type,\n\n int16_t audio10ms[], int length,\n\n int samplingFreq, bool isStereo) = 0;\n\n\n\nprotected:\n\n virtual ~VoEMediaProcess() {}\n\n};\n\n\n", "file_path": "voice_engine/include/voe_external_media.h", "rank": 97, "score": 111235.32434563918 }, { "content": "namespace webrtc {\n\n\n\nstruct IsacFix {\n\n typedef ISACFIX_MainStruct instance_type;\n\n static const bool has_swb = false;\n\n static const bool has_redundant_encoder = false;\n\n static const uint16_t kFixSampleRate = 16000;\n\n static inline int16_t Control(instance_type* inst,\n\n int32_t rate,\n\n int16_t framesize) {\n\n return WebRtcIsacfix_Control(inst, rate, framesize);\n\n }\n\n static inline int16_t ControlBwe(instance_type* inst,\n\n int32_t rate_bps,\n\n int16_t frame_size_ms,\n\n int16_t enforce_frame_size) {\n\n return WebRtcIsacfix_ControlBwe(inst, rate_bps, frame_size_ms,\n\n enforce_frame_size);\n\n }\n\n static inline int16_t Create(instance_type** inst) {\n\n return WebRtcIsacfix_Create(inst);\n\n }\n\n static inline int16_t Decode(instance_type* inst,\n\n const uint8_t* encoded,\n\n int16_t len,\n\n int16_t* decoded,\n\n int16_t* speech_type) {\n\n return WebRtcIsacfix_Decode(inst, encoded, len, decoded, speech_type);\n\n }\n\n static inline int16_t DecodePlc(instance_type* inst,\n\n int16_t* decoded,\n\n int16_t num_lost_frames) {\n\n return WebRtcIsacfix_DecodePlc(inst, decoded, num_lost_frames);\n\n }\n\n static inline int16_t DecodeRcu(instance_type* inst,\n\n const uint8_t* encoded,\n\n int16_t len,\n\n int16_t* decoded,\n\n int16_t* speech_type) {\n\n // iSACfix has no DecodeRcu; just call the normal Decode.\n\n return WebRtcIsacfix_Decode(inst, encoded, len, decoded, speech_type);\n\n }\n\n static inline int16_t DecoderInit(instance_type* inst) {\n\n return WebRtcIsacfix_DecoderInit(inst);\n\n }\n\n static inline int16_t Encode(instance_type* inst,\n\n const int16_t* speech_in,\n\n uint8_t* encoded) {\n\n return WebRtcIsacfix_Encode(inst, speech_in, encoded);\n\n }\n\n static inline int16_t EncoderInit(instance_type* inst, int16_t coding_mode) {\n\n return WebRtcIsacfix_EncoderInit(inst, coding_mode);\n\n }\n\n static inline uint16_t EncSampRate(instance_type* inst) {\n\n return kFixSampleRate;\n\n }\n\n\n\n static inline int16_t Free(instance_type* inst) {\n\n return WebRtcIsacfix_Free(inst);\n\n }\n\n static inline int16_t GetErrorCode(instance_type* inst) {\n\n return WebRtcIsacfix_GetErrorCode(inst);\n\n }\n\n\n\n static inline int16_t GetNewFrameLen(instance_type* inst) {\n\n return WebRtcIsacfix_GetNewFrameLen(inst);\n\n }\n\n\n\n static inline int16_t SetDecSampRate(instance_type* inst,\n\n uint16_t sample_rate_hz) {\n\n DCHECK_EQ(sample_rate_hz, kFixSampleRate);\n\n return 0;\n\n }\n\n static inline int16_t SetEncSampRate(instance_type* inst,\n\n uint16_t sample_rate_hz) {\n\n DCHECK_EQ(sample_rate_hz, kFixSampleRate);\n\n return 0;\n\n }\n\n static inline int16_t UpdateBwEstimate(instance_type* inst,\n\n const uint8_t* encoded,\n\n int32_t packet_size,\n\n uint16_t rtp_seq_number,\n\n uint32_t send_ts,\n\n uint32_t arr_ts) {\n\n return WebRtcIsacfix_UpdateBwEstimate(inst, encoded, packet_size,\n\n rtp_seq_number, send_ts, arr_ts);\n\n }\n\n static inline int16_t GetRedPayload(instance_type* inst, uint8_t* encoded) {\n\n FATAL() << \"Should never be called.\";\n\n return -1;\n\n }\n\n static inline int16_t SetMaxPayloadSize(instance_type* inst,\n\n int16_t max_payload_size_bytes) {\n\n return WebRtcIsacfix_SetMaxPayloadSize(inst, max_payload_size_bytes);\n\n }\n\n static inline int16_t SetMaxRate(instance_type* inst, int32_t max_bit_rate) {\n\n return WebRtcIsacfix_SetMaxRate(inst, max_bit_rate);\n\n }\n", "file_path": "modules/audio_coding/codecs/isac/fix/interface/audio_encoder_isacfix.h", "rank": 98, "score": 110537.13709462168 } ]
C++
src/hir/path.cpp
nabijaczleweli/mrustc
c3565612a003fbc2f87aa55250fe3f5218cb99aa
#include <hir/path.hpp> #include <hir/type.hpp> ::HIR::SimplePath HIR::SimplePath::operator+(const RcString& s) const { ::HIR::SimplePath ret(m_crate_name); ret.m_components = m_components; ret.m_components.push_back( s ); return ret; } namespace HIR { ::std::ostream& operator<<(::std::ostream& os, const ::HIR::SimplePath& x) { if( x.m_crate_name != "" ) { os << "::\"" << x.m_crate_name << "\""; } else if( x.m_components.size() == 0 ) { os << "::"; } else { } for(const auto& n : x.m_components) { os << "::" << n; } return os; } ::std::ostream& operator<<(::std::ostream& os, const PathParams& x) { bool has_args = ( x.m_types.size() > 0 || x.m_values.size() > 0 ); if(has_args) { os << "<"; } for(const auto& ty : x.m_types) { os << ty << ","; } for(const auto& v : x.m_values) { os << "{" << v << "},"; } if(has_args) { os << ">"; } return os; } ::std::ostream& operator<<(::std::ostream& os, const GenericPath& x) { os << x.m_path << x.m_params; return os; } ::std::ostream& operator<<(::std::ostream& os, const TraitPath& x) { if( x.m_hrls.size() > 0 ) { os << "for<"; for(const auto& lft : x.m_hrls) os << "'" << lft << ","; os << "> "; } os << x.m_path.m_path; bool has_args = ( x.m_path.m_params.m_types.size() > 0 || x.m_type_bounds.size() > 0 ); if(has_args) { os << "<"; } for(const auto& ty : x.m_path.m_params.m_types) { os << ty << ","; } for(const auto& assoc : x.m_type_bounds) { os << assoc.first << "=" << assoc.second << ","; } if(has_args) { os << ">"; } return os; } ::std::ostream& operator<<(::std::ostream& os, const Path& x) { TU_MATCH(::HIR::Path::Data, (x.m_data), (e), (Generic, return os << e; ), (UfcsInherent, return os << "<" << e.type << " /*- " << e.impl_params << "*/>::" << e.item << e.params; ), (UfcsKnown, return os << "<" << e.type << " as " << e.trait << ">::" << e.item << e.params; ), (UfcsUnknown, return os << "<" << e.type << " as _>::" << e.item << e.params; ) ) return os; } } ::HIR::SimplePath HIR::SimplePath::clone() const { return SimplePath( m_crate_name, m_components ); } ::HIR::PathParams::PathParams() { } ::HIR::PathParams::PathParams(::HIR::TypeRef ty0) { m_types.push_back( mv$(ty0) ); } ::HIR::PathParams HIR::PathParams::clone() const { PathParams rv; for( const auto& t : m_types ) rv.m_types.push_back( t.clone() ); for( const auto& t : m_values ) rv.m_values.push_back( t.clone() ); return rv; } bool ::HIR::PathParams::operator==(const ::HIR::PathParams& x) const { if( m_types.size() != x.m_types.size() ) return false; for( unsigned int i = 0; i < m_types.size(); i ++ ) if( !(m_types[i] == x.m_types[i]) ) return false; if( m_values.size() != x.m_values.size() ) return false; for( unsigned int i = 0; i < m_values.size(); i ++ ) if( !(m_values[i] == x.m_values[i]) ) return false; return true; } ::HIR::GenericPath::GenericPath() { } ::HIR::GenericPath::GenericPath(::HIR::SimplePath sp): m_path( mv$(sp) ) { } ::HIR::GenericPath::GenericPath(::HIR::SimplePath sp, ::HIR::PathParams params): m_path( mv$(sp) ), m_params( mv$(params) ) { } ::HIR::GenericPath HIR::GenericPath::clone() const { return GenericPath(m_path.clone(), m_params.clone()); } bool ::HIR::GenericPath::operator==(const GenericPath& x) const { if( m_path != x.m_path ) return false; return m_params == x.m_params; } ::HIR::TraitPath HIR::TraitPath::clone() const { ::HIR::TraitPath rv { m_path.clone(), m_hrls, {}, m_trait_ptr }; for( const auto& assoc : m_type_bounds ) rv.m_type_bounds.insert(::std::make_pair( assoc.first, assoc.second.clone() )); return rv; } bool ::HIR::TraitPath::operator==(const ::HIR::TraitPath& x) const { if( m_path != x.m_path ) return false; if( m_hrls != x.m_hrls ) return false; if( m_type_bounds.size() != x.m_type_bounds.size() ) return false; for(auto it_l = m_type_bounds.begin(), it_r = x.m_type_bounds.begin(); it_l != m_type_bounds.end(); it_l++, it_r++ ) { if( it_l->first != it_r->first ) return false; if( it_l->second != it_r->second ) return false; } return true; } ::HIR::Path::Path(::HIR::GenericPath gp): m_data( ::HIR::Path::Data::make_Generic( mv$(gp) ) ) { } ::HIR::Path::Path(::HIR::SimplePath sp): m_data( ::HIR::Path::Data::make_Generic(::HIR::GenericPath(mv$(sp))) ) { } ::HIR::Path::Path(TypeRef ty, RcString item, PathParams item_params): m_data(Data::make_UfcsInherent({ mv$(ty), mv$(item), mv$(item_params) })) { } ::HIR::Path::Path(TypeRef ty, GenericPath trait, RcString item, PathParams item_params): m_data( Data::make_UfcsKnown({ mv$(ty), mv$(trait), mv$(item), mv$(item_params) }) ) { } ::HIR::Path HIR::Path::clone() const { TU_MATCH_HDRA((m_data), {) TU_ARMA(Generic, e) { return Path( Data::make_Generic(e.clone()) ); } TU_ARMA(UfcsInherent, e) { return Path(Data::make_UfcsInherent({ e.type.clone(), e.item, e.params.clone(), e.impl_params.clone() })); } TU_ARMA(UfcsKnown, e) { return Path(Data::make_UfcsKnown({ e.type.clone(), e.trait.clone(), e.item, e.params.clone() })); } TU_ARMA(UfcsUnknown, e) { return Path(Data::make_UfcsUnknown({ e.type.clone(), e.item, e.params.clone() })); } } throw ""; } ::HIR::Compare HIR::PathParams::compare_with_placeholders(const Span& sp, const ::HIR::PathParams& x, ::HIR::t_cb_resolve_type resolve_placeholder) const { using ::HIR::Compare; auto rv = Compare::Equal; if( this->m_types.size() > 0 || x.m_types.size() > 0 ) { if( this->m_types.size() != x.m_types.size() ) { return Compare::Unequal; } for( unsigned int i = 0; i < x.m_types.size(); i ++ ) { auto rv2 = this->m_types[i].compare_with_placeholders( sp, x.m_types[i], resolve_placeholder ); if( rv2 == Compare::Unequal ) return Compare::Unequal; if( rv2 == Compare::Fuzzy ) rv = Compare::Fuzzy; } } return rv; } ::HIR::Compare HIR::PathParams::match_test_generics_fuzz(const Span& sp, const PathParams& x, t_cb_resolve_type resolve_placeholder, ::HIR::MatchGenerics& match) const { using ::HIR::Compare; auto rv = Compare::Equal; TRACE_FUNCTION_F(*this << " with " << x); if( this->m_types.size() != x.m_types.size() ) { return Compare::Unequal; } for( unsigned int i = 0; i < x.m_types.size(); i ++ ) { rv &= this->m_types[i].match_test_generics_fuzz( sp, x.m_types[i], resolve_placeholder, match ); if( rv == Compare::Unequal ) return Compare::Unequal; } if( this->m_values.size() != x.m_values.size() ) { return Compare::Unequal; } for( unsigned int i = 0; i < x.m_values.size(); i ++ ) { if( const auto* ge = this->m_values[i].opt_Generic() ) { auto rv = match.match_val(*ge, x.m_values[i]); if(rv == Compare::Unequal) return Compare::Unequal; } else { if( this->m_values[i] != x.m_values[i] ) { return Compare::Unequal; } } } return rv; } ::HIR::Compare HIR::GenericPath::compare_with_placeholders(const Span& sp, const ::HIR::GenericPath& x, ::HIR::t_cb_resolve_type resolve_placeholder) const { using ::HIR::Compare; if( this->m_path.m_crate_name != x.m_path.m_crate_name ) return Compare::Unequal; if( this->m_path.m_components.size() != x.m_path.m_components.size() ) return Compare::Unequal; for(unsigned int i = 0; i < this->m_path.m_components.size(); i ++ ) { if( this->m_path.m_components[i] != x.m_path.m_components[i] ) return Compare::Unequal; } return this->m_params. compare_with_placeholders(sp, x.m_params, resolve_placeholder); } namespace { ::HIR::Compare compare_with_placeholders( const Span& sp, const ::HIR::PathParams& l, const ::HIR::PathParams& r, ::HIR::t_cb_resolve_type resolve_placeholder ) { return l.compare_with_placeholders(sp, r, resolve_placeholder); } ::HIR::Compare compare_with_placeholders( const Span& sp, const ::HIR::GenericPath& l, const ::HIR::GenericPath& r, ::HIR::t_cb_resolve_type resolve_placeholder ) { return l.compare_with_placeholders(sp, r, resolve_placeholder); } } #define CMP(rv, cmp) do { \ switch(cmp) {\ case ::HIR::Compare::Unequal: return ::HIR::Compare::Unequal; \ case ::HIR::Compare::Fuzzy: rv = ::HIR::Compare::Fuzzy; break; \ case ::HIR::Compare::Equal: break; \ }\ } while(0) ::HIR::Compare HIR::TraitPath::compare_with_placeholders(const Span& sp, const TraitPath& x, t_cb_resolve_type resolve_placeholder) const { auto rv = m_path .compare_with_placeholders(sp, x.m_path, resolve_placeholder); if( rv == Compare::Unequal ) return rv; auto it_l = m_type_bounds.begin(); auto it_r = x.m_type_bounds.begin(); while( it_l != m_type_bounds.end() && it_r != x.m_type_bounds.end() ) { if( it_l->first != it_r->first ) { return Compare::Unequal; } CMP( rv, it_l->second .compare_with_placeholders( sp, it_r->second, resolve_placeholder ) ); ++ it_l; ++ it_r; } if( it_l != m_type_bounds.end() || it_r != x.m_type_bounds.end() ) { return Compare::Unequal; } return rv; } ::HIR::Compare HIR::Path::compare_with_placeholders(const Span& sp, const Path& x, t_cb_resolve_type resolve_placeholder) const { if( this->m_data.tag() != x.m_data.tag() ) return Compare::Unequal; TU_MATCH_HDRA( (this->m_data, x.m_data), {) TU_ARMA(Generic, ple, pre) { return ::compare_with_placeholders(sp, ple, pre, resolve_placeholder); } TU_ARMA(UfcsUnknown, ple, pre) { if( ple.item != pre.item) return Compare::Unequal; TODO(sp, "Path::compare_with_placeholders - UfcsUnknown"); } TU_ARMA(UfcsInherent, ple, pre) { if( ple.item != pre.item) return Compare::Unequal; ::HIR::Compare rv = ::HIR::Compare::Equal; CMP(rv, ple.type.compare_with_placeholders(sp, pre.type, resolve_placeholder)); CMP(rv, ::compare_with_placeholders(sp, ple.params, pre.params, resolve_placeholder)); return rv; } TU_ARMA(UfcsKnown, ple, pre) { if( ple.item != pre.item) return Compare::Unequal; ::HIR::Compare rv = ::HIR::Compare::Equal; CMP(rv, ple.type.compare_with_placeholders(sp, pre.type, resolve_placeholder)); CMP(rv, ::compare_with_placeholders(sp, ple.trait, pre.trait, resolve_placeholder)); CMP(rv, ::compare_with_placeholders(sp, ple.params, pre.params, resolve_placeholder)); return rv; } } throw ""; } Ordering HIR::Path::ord(const ::HIR::Path& x) const { ORD( (unsigned)m_data.tag(), (unsigned)x.m_data.tag() ); TU_MATCH(::HIR::Path::Data, (this->m_data, x.m_data), (tpe, xpe), (Generic, return ::ord(tpe, xpe); ), (UfcsInherent, ORD(tpe.type, xpe.type); ORD(tpe.item, xpe.item); return ::ord(tpe.params, xpe.params); ), (UfcsKnown, ORD(tpe.type, xpe.type); ORD(tpe.trait, xpe.trait); ORD(tpe.item, xpe.item); return ::ord(tpe.params, xpe.params); ), (UfcsUnknown, ORD(tpe.type, xpe.type); ORD(tpe.item, xpe.item); return ::ord(tpe.params, xpe.params); ) ) throw ""; } bool ::HIR::Path::operator==(const Path& x) const { return this->ord(x) == ::OrdEqual; }
#include <hir/path.hpp> #include <hir/type.hpp> ::HIR::SimplePath HIR::SimplePath::operator+(const RcString& s) const { ::HIR::SimplePath ret(m_crate_name); ret.m_components = m_components; ret.m_components.push_back( s ); return ret; } namespace HIR { ::std::ostream& operator<<(::std::ostream& os, const ::HIR::SimplePath& x) { if( x.m_crate_name != "" ) { os << "::\"" << x.m_crate_name << "\""; } else if( x.m_components.size() == 0 ) { os << "::"; } else { } for(const auto& n : x.m_components) { os << "::" << n; } return os; } ::std::ostream& operator<<(::std::ostream& os, const PathParams& x) { bool has_args = ( x.m_types.size() > 0 || x.m_values.size() > 0 ); if(has_args) { os << "<"; } for(const auto& ty : x.m_types) { os << ty << ","; } for(const auto& v : x.m_values) { os << "{" << v << "},"; } if(has_args) { os << ">"; } return os; } ::std::ostream& operator<<(::std::ostream& os, const GenericPath& x) { os << x.m_path << x.m_params; return os; } ::std::ostream& operator<<(::std::ostream& os, const TraitPath& x) { if( x.m_hrls.size() > 0 ) { os << "for<"; for(const auto& lft : x.m_hrls) os << "'" << lft << ","; os << "> "; } os << x.m_path.m_path; bool has_args = ( x.m_path.m_params.m_types.size() > 0 || x.m_type_bounds.size() > 0 ); if(has_args) { os << "<"; } for(const auto& ty : x.m_path.m_params.m_types) { os << ty << ","; } for(const auto& assoc : x.m_type_bounds) { os << assoc.first << "=" << assoc.second << ","; } if(has_args) { os << ">"; } return os; } ::std::ostream& operator<<(::std::ostream& os, const Path& x) { TU_MATCH(::HIR::Path::Data, (x.m_data), (e), (Generic, return os << e; ), (UfcsInherent, return os << "<" << e.type << " /*- " << e.impl_params << "*/>::" << e.item << e.params; ), (UfcsKnown, return os << "<" << e.type << " as " << e.trait << ">::" << e.item << e.params; ), (UfcsUnknown, return os << "<" << e.type << " as _>::" << e.item << e.params; ) ) return os; } } ::HIR::SimplePath HIR::SimplePath::clone() const { return SimplePath( m_crate_name, m_components ); } ::HIR::PathParams::PathParams() { } ::HIR::PathParams::PathParams(::HIR::TypeRef ty0) { m_types.push_back( mv$(ty0) ); } ::HIR::PathParams HIR::PathParams::clone() const { PathParams rv; for( const auto& t : m_types ) rv.m_types.push_back( t.clone() ); for( const auto& t : m_values ) rv.m_values.push_back( t.clone() ); return rv; } bool ::HIR::PathParams::operator==(const ::HIR::PathParams& x) const { if( m_types.size() != x.m_types.size() ) return false; for( unsigned int i = 0; i < m_types.size(); i ++ ) if( !(m_types[i] == x.m_types[i]) ) return false; if( m_values.size() != x.m_values.size() ) return false; for( unsigned int i = 0; i < m_values.size(); i ++ ) if( !(m_values[i] == x.m_values[i]) ) return false; return true; } ::HIR::GenericPath::GenericPath() { } ::HIR::GenericPath::GenericPath(::HIR::SimplePath sp): m_path( mv$(sp) ) { } ::HIR::GenericPath::GenericPath(::HIR::SimplePath sp, ::HIR::PathParams params): m_path( mv$(sp) ), m_params( mv$(params) ) { } ::HIR::GenericPath HIR::GenericPath::clone() const { return GenericPath(m_path.clone(), m_params.clone()); } bool ::HIR::GenericPath::operator==(const GenericPath& x) const { if( m_path != x.m_path ) return false; return m_params == x.m_params; } ::HIR::TraitPath HIR::TraitPath::clone() const { ::HIR::TraitPath rv { m_path.clone(), m_hrls, {}, m_trait_ptr }; for( const auto& assoc : m_type_bounds ) rv.m_type_bounds.insert(::std::make_pair( assoc.first, assoc.second.clone() )); return rv; } bool ::HIR::TraitPath::operator==(const ::HIR::TraitPath& x) const { if( m_path != x.m_path ) return false; if( m_hrls != x.m_hrls ) return false; if( m_type_bounds.size() != x.m_type_bounds.size() ) return false; for(auto it_l = m_type_bounds.begin(), it_r = x.m_type_bounds.begin(); it_l != m_type_bounds.end(); it_l++, it_r++ ) { if( it_l->first != it_r->first ) return false; if( it_l->second != it_r->second ) return false; } return true; } ::HIR::Path::Path(::HIR::GenericPath gp): m_data( ::HIR::Path::Data::make_Generic( mv$(gp) ) ) { } ::HIR::Path::Path(::HIR::SimplePath sp): m_data( ::HIR::Path::Data::make_Generic(::HIR::GenericPath(mv$(sp))) ) { } ::HIR::Path::Path(TypeRef ty, RcString item, PathParams item_params): m_data(Data::make_UfcsInherent({ mv$(ty), mv$(item), mv$(item_params) })) { } ::HIR::Path::Path(TypeRef ty, GenericPath trait, RcString item, PathParams item_params): m_data( Data::make_UfcsKnown({ mv$(ty), mv$(trait), mv$(item), mv$(item_params) }) ) { } ::HIR::Path HIR::Path::clone() const { TU_MATCH_HDRA((m_data), {) TU_ARMA(Generic, e) { return Path( Data::make_Generic(e.clone()) ); } TU_ARMA(UfcsInherent, e) { return Path(Data::make_UfcsInherent({ e.type.clone(), e.item, e.params.clone(), e.impl_params.clone() })); } TU_ARMA(UfcsKnown, e) { return Path(Data::make_UfcsKnown({ e.type.clone(), e.trait.clone(), e.item, e.params.clone() })); } TU_ARMA(UfcsUnknown, e) { return Path(Data::make_UfcsUnknown({ e.type.clone(), e.item, e.params.clone() })); } } throw ""; } ::HIR::Compare HIR::PathParams::compare_with_placeholders(const Span& sp, const ::HIR::PathParams& x, ::HIR::t_cb_resolve_type resolve_placeholder) const { using ::HIR::Compare; auto rv = Compare::Equal; if( this->m_types.size() > 0 || x.m_types.size() > 0 ) { if( this->m_types.size() != x.m_types.size() ) { return Compare::Unequal; } for( unsigned int i = 0; i < x.m_types.size(); i ++ ) { auto rv2 = this->m_types[i].compare_with_placeholders( sp, x.m_types[i], resolve_placeholder ); if( rv2 == Compare::Unequal ) return Compare::Unequal; if( rv2 == Compare::Fuzzy ) rv = Compare::Fuzzy; } } return rv; } ::HIR::Compare HIR::PathParams::match_test_generics_fuzz(const Span& sp, const PathParams& x, t_cb_resolve_type resolve_placeholder, ::HIR::MatchGenerics& match) const { using ::HIR::Compare; auto rv = Compare::Equal; TRACE_FUNCTION_F(*this << " with " << x); if( this->m_types.size() != x.m_types.size() ) { return Compare::Unequal; } for( unsigned int i = 0; i < x.m_types.size(); i ++ ) { rv &= this->m_types[i].match_test_generics_fuzz( sp, x.m_types[i], resolve_placeholder, match ); if( rv == Compare::Unequal ) return Compare::Unequal; } if( this->m_values.size() != x.m_values.size() ) { return Compare::Unequal; } for( unsigned int i = 0; i < x.m_values.size(); i ++ ) { if( const auto* ge = this->m_values[i].opt_Generic() ) { auto rv = match.match_val(*ge, x.m_values[i]); if(rv == Compare::Unequal) return Compare::Unequal; } else { if( this->m_values[i] != x.m_values[i] ) { return Compare::Unequal; } } } return rv; } ::HIR::Compare HIR::GenericPath::compare_with_placeholders(const Span& sp, const ::HIR::GenericPath& x, ::HIR::t_cb_resolve_type resolve_placeholder) const { using ::HIR::Compare; if( this->m_path.m_crate_name != x.m_path.m_crate_name ) return Compare::Unequal; if( this->m_path.m_components.size() != x.m_path.m_components.size() ) return Compare::Unequal; for(unsigned int i = 0; i < this->m_path.m_components.size(); i ++ ) { if( this->m_path.m_components[i] != x.m_path.m_components[i] ) return Compare::Unequal; } return this->m_params. compare_with_placeholders(sp, x.m_params, resolve_placeholder); } namespace { ::HIR::Compare compare_with_placeholders( const Span& sp, const ::HIR::PathParams& l, const ::HIR::PathParams& r, ::HIR::t_cb_resolve_type resolve_placeholder ) { return l.compare_with_placeholders(sp, r, resolve_placeholder); } ::HIR::Compare compare_with_placeholders( const Span& sp, const ::HIR::GenericPath& l, const ::HIR::GenericPath& r, ::HIR::t_cb_resolve_type resolve_placeholder ) { return l.compare_with_placeholders(sp, r, resolve_placeholder); } } #define CMP(rv, cmp) do { \ switch(cmp) {\ case ::HIR::Compare::Unequal: return ::HIR::Compare::Unequal; \ case ::HIR::Compare::Fuzzy: rv = ::HIR::Compare::Fuzzy; break; \ case ::HIR::Compare::Equal: break; \ }\ } while(0) ::HIR::Compare HIR::TraitPath::compare_with_placeholders(const Span& sp, const TraitPath& x, t_cb_resolve_type resolve_placeholder) const { auto rv = m_path .compare_with_placeholders(sp, x.m_path, resolve_placeholder); if( rv == Compare::Unequal ) return rv; auto it_l = m_type_bounds.begin(); auto it_r = x.m_type_bounds.begin(); while( it_l != m_type_bounds.end() && it_r != x.m_type_bounds.end() ) { if( it_l->first != it_r->first ) { return Compare::Unequal; } CMP( rv, it_l->second .compare_with_placeholders( sp, it_r->second, resolve_placeholder ) ); ++ it_l; ++ it_r; } if( it_l != m_type_bounds.end() || it_r != x.m_type_bounds.end() ) { return Compare::Unequal; } return rv; } ::HIR::Compare HIR::Path::compare_with_placeholders(const Span& sp, const Path& x, t_cb_resolve_type resolve_placeholder) const { if( this->m_data.tag() != x.m_data.tag() ) return Compare::Unequal; TU_MATCH_HDRA( (this->m_data, x.m_data), {) TU_ARMA(Generic, ple, pre) { return ::compare_with_placeholders(sp, ple, pre, resolve_placeholder); } TU_ARMA(UfcsUnknown, ple, pre) { if( ple.item != pre.item) return Compare::Unequal; TODO(sp, "Path::compare_with_placeholders - UfcsUnknown"); } TU_ARMA(UfcsInherent, ple, pre) { if( ple.item != pre.item) return Compare::Unequal; ::HIR::Compare rv = ::HIR::Compare::Equal; CMP(rv, ple.type.compare_with_placeholders(sp, pre.type, resolve_placeholder)); CMP(rv, ::compare_with_placeholders(sp, ple.params, pre.params, resolve_placeholder)); return rv; } TU_ARMA(UfcsKnown, ple, pre) { if( ple.item != pre.item) retur
} throw ""; } Ordering HIR::Path::ord(const ::HIR::Path& x) const { ORD( (unsigned)m_data.tag(), (unsigned)x.m_data.tag() ); TU_MATCH(::HIR::Path::Data, (this->m_data, x.m_data), (tpe, xpe), (Generic, return ::ord(tpe, xpe); ), (UfcsInherent, ORD(tpe.type, xpe.type); ORD(tpe.item, xpe.item); return ::ord(tpe.params, xpe.params); ), (UfcsKnown, ORD(tpe.type, xpe.type); ORD(tpe.trait, xpe.trait); ORD(tpe.item, xpe.item); return ::ord(tpe.params, xpe.params); ), (UfcsUnknown, ORD(tpe.type, xpe.type); ORD(tpe.item, xpe.item); return ::ord(tpe.params, xpe.params); ) ) throw ""; } bool ::HIR::Path::operator==(const Path& x) const { return this->ord(x) == ::OrdEqual; }
n Compare::Unequal; ::HIR::Compare rv = ::HIR::Compare::Equal; CMP(rv, ple.type.compare_with_placeholders(sp, pre.type, resolve_placeholder)); CMP(rv, ::compare_with_placeholders(sp, ple.trait, pre.trait, resolve_placeholder)); CMP(rv, ::compare_with_placeholders(sp, ple.params, pre.params, resolve_placeholder)); return rv; }
function_block-function_prefixed
[]
C++
analysis/EnergyDepVSIntialEnergy.cpp
suerfu/TesseractSim
406a469f864726386afc2df7133f07df625cd4b9
#include <iostream> #include <string> #include <vector> #include <sstream> #include <fstream> #include <functional> #include <map> #include <stdlib.h> #include "TSystem.h" #include "TCanvas.h" #include "TH1.h" #include "TRint.h" #include "TStyle.h" #include "THStack.h" #include "TTreeReader.h" #include "TTreeReaderValue.h" #include "TFile.h" #include "TTree.h" using namespace std; template<typename T> T strTo(const char* str) { T t; std::stringstream converter(str); converter >> t; return t; } template<typename T> T strTo(const std::string& str) { return strTo<T>(str.c_str()); } bool CmdOptionExists(int argc, char** argv, const std::string& option) { char** begin = argv; char** end = argv + argc; return std::find(begin, end, option) != end; } template<typename T = std::string> T GetCmdOption(int argc, char** argv, const std::string& option, int optionNum = 1) { if(!CmdOptionExists(argc, argv, option)) { abort(); } char** begin = argv; char** end = argv + argc; char ** itr = std::find(begin, end, option); for(int iOpt = 0; iOpt < optionNum; ++iOpt) { if(itr != end && ++itr != end && ((*itr)[0] != '-' || std::isdigit((*itr)[1]))) { if(iOpt + 1 == optionNum) return strTo<T>(*itr); } else { std::string pos = "nth"; if(iOpt == 0) pos = "1st"; else if(iOpt == 1) pos = "2nd"; else if(iOpt == 2) pos = "3rd"; else pos = std::to_string(iOpt + 1) + "th"; exit(EXIT_FAILURE); return 0; } } return 0; } template<typename T = std::string> std::vector<T> GetCmdOptionArray(int argc, char** argv, const std::string& option) { if(!CmdOptionExists(argc, argv, option)) { printf("Missing option %s \n",option.c_str()); abort(); } std::vector<std::string> options; char** begin = argv; char** end = argv + argc; char ** itr = std::find(begin, end, option); while(itr++, itr != end && ((*itr)[0] != '-' || std::isdigit((*itr)[1]))) { if(itr != end) { options.push_back(strTo<T>(*itr)); } } if(options.size() == 0) { printf("Missing parameter for option %s \n",option.c_str()); exit(EXIT_FAILURE); } return options; } void Usage() { cout << endl; cout << "Usage: EnergyDepVSIntialEnergy -p <ProcessedFile name> -o <ouput_filename>" << endl; cout << endl; } int main(int argc, char* argv[]) { if(CmdOptionExists(argc, argv, "-h") || argc==1 ) { Usage(); return EXIT_SUCCESS; } string outputFilename = "output.root"; if(CmdOptionExists(argc, argv, "-o")) { outputFilename = GetCmdOption<string>(argc, argv, "-o"); } else { cout<<"Output Filename not specified, default option is set to output.root "<<endl; } string ProcessedFiles; if(CmdOptionExists(argc, argv, "-p")) { ProcessedFiles = GetCmdOption<string>(argc, argv, "-p"); } else { return EXIT_FAILURE; } Double_t Edep,IntialE,rx,ry,rz,px,py,pz; TFile *outputfile = new TFile(outputFilename.c_str(),"RECREATE"); TTree *events= new TTree("events","simple tree"); events->Branch("Edep",&Edep,"Edep/D"); events->Branch("IntialE",&IntialE,"IntialE/D"); events->Branch("rx",&rx,"rx/D"); events->Branch("ry",&ry,"ry/D"); events->Branch("rz",&rz,"rz/D"); events->Branch("px",&px,"px/D"); events->Branch("py",&py,"py/D"); events->Branch("pz",&pz,"pz/D"); TFile* f = new TFile(ProcessedFiles.c_str()); if( !f->IsOpen() ){ cout<< "Error opening " << ProcessedFiles.c_str() <<endl; } else { if(f->IsZombie()) { cout<<"The file "<<ProcessedFiles.c_str()<<"is corrupted"<<endl; } else{ TTree *t = (TTree*)f->Get("events"); Int_t nentries = (Int_t)t->GetEntries(); Double_t E_dep; Int_t Event_ID; char name_file[200]; t->SetBranchAddress("edep_virtualDetector",&E_dep); t->SetBranchAddress("file",name_file); t->SetBranchAddress("eventID",&Event_ID); for (Int_t i=0;i<nentries;i++){ t->GetEntry(i); std::string filename(name_file); if (E_dep<1000.0) { cout<<filename<<" "<<Event_ID<<endl; TFile* f1 = new TFile(filename.c_str()); TTree *t1 = (TTree*)f1->Get("events"); Int_t nentries = (Int_t)t1->GetEntries(); Double_t X_pos,Y_pos,Z_pos,X_mom,Y_mom,Z_mom, Intial_E; Int_t event_ID, step_ID, parent_ID; char Process_ID[16]; t1->SetBranchAddress("eventID",&event_ID); t1->SetBranchAddress("parentID",&parent_ID); t1->SetBranchAddress("stepID",&step_ID); t1->SetBranchAddress("rx",&X_pos); t1->SetBranchAddress("ry",&Y_pos); t1->SetBranchAddress("rz",&Z_pos); t1->SetBranchAddress("px",&X_mom); t1->SetBranchAddress("py",&Y_mom); t1->SetBranchAddress("pz",&Z_mom); t1->SetBranchAddress("Eki",&Intial_E); t1->SetBranchAddress("process",Process_ID); for(Int_t q=0;q<nentries;q++){ t1->GetEntry(q); std::string Process(Process_ID); if ( (event_ID==Event_ID && parent_ID==0 && step_ID==0 && Process=="initStep") ) { rx=X_pos; ry=Y_pos; rz=Z_pos; px=X_mom; py=Y_mom; pz=Z_mom; IntialE=Intial_E; Edep=E_dep; cout<<event_ID<<" "<<step_ID<<" "<<Process<<" "<<Edep<<" "<<IntialE<<endl; events->Fill(); } } f1->Close(); } } f->Close(); } } outputfile->Write(); outputfile->Close(); }
#include <iostream> #include <string> #include <vector> #include <sstream> #include <fstream> #include <functional> #include <map> #include <stdlib.h> #include "TSystem.h" #include "TCanvas.h" #include "TH1.h" #include "TRint.h" #include "TStyle.h" #include "THStack.h" #include "TTreeReader.h" #include "TTreeReaderValue.h" #include "TFile.h" #include "TTree.h" using namespace std; template<typename T> T strTo(const char* str) { T t; std::stringstream converter(str); converter >> t; return t; } template<typename T> T strTo(const std::string& str) { return strTo<T>(str.c_str()); } bool CmdOptionExists(int argc, char** argv, const std::string& option) { char** begin = argv; char** end = argv + argc; return std::find(begin, end, option) != end; } template<typename T = std::string> T GetCmdOption(int argc, char** argv, const std::string& op
pt + 1 == optionNum) return strTo<T>(*itr); } else { std::string pos = "nth"; if(iOpt == 0) pos = "1st"; else if(iOpt == 1) pos = "2nd"; else if(iOpt == 2) pos = "3rd"; else pos = std::to_string(iOpt + 1) + "th"; exit(EXIT_FAILURE); return 0; } } return 0; } template<typename T = std::string> std::vector<T> GetCmdOptionArray(int argc, char** argv, const std::string& option) { if(!CmdOptionExists(argc, argv, option)) { printf("Missing option %s \n",option.c_str()); abort(); } std::vector<std::string> options; char** begin = argv; char** end = argv + argc; char ** itr = std::find(begin, end, option); while(itr++, itr != end && ((*itr)[0] != '-' || std::isdigit((*itr)[1]))) { if(itr != end) { options.push_back(strTo<T>(*itr)); } } if(options.size() == 0) { printf("Missing parameter for option %s \n",option.c_str()); exit(EXIT_FAILURE); } return options; } void Usage() { cout << endl; cout << "Usage: EnergyDepVSIntialEnergy -p <ProcessedFile name> -o <ouput_filename>" << endl; cout << endl; } int main(int argc, char* argv[]) { if(CmdOptionExists(argc, argv, "-h") || argc==1 ) { Usage(); return EXIT_SUCCESS; } string outputFilename = "output.root"; if(CmdOptionExists(argc, argv, "-o")) { outputFilename = GetCmdOption<string>(argc, argv, "-o"); } else { cout<<"Output Filename not specified, default option is set to output.root "<<endl; } string ProcessedFiles; if(CmdOptionExists(argc, argv, "-p")) { ProcessedFiles = GetCmdOption<string>(argc, argv, "-p"); } else { return EXIT_FAILURE; } Double_t Edep,IntialE,rx,ry,rz,px,py,pz; TFile *outputfile = new TFile(outputFilename.c_str(),"RECREATE"); TTree *events= new TTree("events","simple tree"); events->Branch("Edep",&Edep,"Edep/D"); events->Branch("IntialE",&IntialE,"IntialE/D"); events->Branch("rx",&rx,"rx/D"); events->Branch("ry",&ry,"ry/D"); events->Branch("rz",&rz,"rz/D"); events->Branch("px",&px,"px/D"); events->Branch("py",&py,"py/D"); events->Branch("pz",&pz,"pz/D"); TFile* f = new TFile(ProcessedFiles.c_str()); if( !f->IsOpen() ){ cout<< "Error opening " << ProcessedFiles.c_str() <<endl; } else { if(f->IsZombie()) { cout<<"The file "<<ProcessedFiles.c_str()<<"is corrupted"<<endl; } else{ TTree *t = (TTree*)f->Get("events"); Int_t nentries = (Int_t)t->GetEntries(); Double_t E_dep; Int_t Event_ID; char name_file[200]; t->SetBranchAddress("edep_virtualDetector",&E_dep); t->SetBranchAddress("file",name_file); t->SetBranchAddress("eventID",&Event_ID); for (Int_t i=0;i<nentries;i++){ t->GetEntry(i); std::string filename(name_file); if (E_dep<1000.0) { cout<<filename<<" "<<Event_ID<<endl; TFile* f1 = new TFile(filename.c_str()); TTree *t1 = (TTree*)f1->Get("events"); Int_t nentries = (Int_t)t1->GetEntries(); Double_t X_pos,Y_pos,Z_pos,X_mom,Y_mom,Z_mom, Intial_E; Int_t event_ID, step_ID, parent_ID; char Process_ID[16]; t1->SetBranchAddress("eventID",&event_ID); t1->SetBranchAddress("parentID",&parent_ID); t1->SetBranchAddress("stepID",&step_ID); t1->SetBranchAddress("rx",&X_pos); t1->SetBranchAddress("ry",&Y_pos); t1->SetBranchAddress("rz",&Z_pos); t1->SetBranchAddress("px",&X_mom); t1->SetBranchAddress("py",&Y_mom); t1->SetBranchAddress("pz",&Z_mom); t1->SetBranchAddress("Eki",&Intial_E); t1->SetBranchAddress("process",Process_ID); for(Int_t q=0;q<nentries;q++){ t1->GetEntry(q); std::string Process(Process_ID); if ( (event_ID==Event_ID && parent_ID==0 && step_ID==0 && Process=="initStep") ) { rx=X_pos; ry=Y_pos; rz=Z_pos; px=X_mom; py=Y_mom; pz=Z_mom; IntialE=Intial_E; Edep=E_dep; cout<<event_ID<<" "<<step_ID<<" "<<Process<<" "<<Edep<<" "<<IntialE<<endl; events->Fill(); } } f1->Close(); } } f->Close(); } } outputfile->Write(); outputfile->Close(); }
tion, int optionNum = 1) { if(!CmdOptionExists(argc, argv, option)) { abort(); } char** begin = argv; char** end = argv + argc; char ** itr = std::find(begin, end, option); for(int iOpt = 0; iOpt < optionNum; ++iOpt) { if(itr != end && ++itr != end && ((*itr)[0] != '-' || std::isdigit((*itr)[1]))) { if(iO
function_block-random_span
[]
C++
include/lsFromMesh.hpp
YourKarma42/ViennaLS
aae39a860e1fb6edc2d3568ab09110f7e81572b1
#ifndef LS_FROM_MESH_HPP #define LS_FROM_MESH_HPP #include <lsPreCompileMacros.hpp> #include <lsDomain.hpp> #include <lsMesh.hpp> template <class T, int D> class lsFromMesh { typedef typename lsDomain<T, D>::DomainType hrleDomainType; lsSmartPointer<lsDomain<T, D>> levelSet = nullptr; lsSmartPointer<lsMesh<T>> mesh = nullptr; bool sortPointList = true; public: lsFromMesh(){}; lsFromMesh(lsSmartPointer<lsDomain<T, D>> passedLevelSet, const lsSmartPointer<lsMesh<T>> passedMesh) : levelSet(passedLevelSet), mesh(passedMesh) {} void setLevelSet(lsSmartPointer<lsDomain<T, D>> passedlsDomain) { levelSet = passedlsDomain; } void setMesh(const lsSmartPointer<lsMesh<T>> passedMesh) { mesh = passedMesh; } void setSortPointList(bool passedSortPointList) { sortPointList = passedSortPointList; } void apply() { if (levelSet == nullptr) { lsMessage::getInstance() .addWarning("No level set was passed to lsFromMesh.") .print(); return; } if (mesh == nullptr) { lsMessage::getInstance() .addWarning("No lsMesh<> was supplied to lsFromMesh.") .print(); return; } auto &domain = levelSet->getDomain(); auto &nodes = mesh->getNodes(); auto values = mesh->cellData.getScalarData("LSValues"); if (values == nullptr) { lsMessage::getInstance() .addWarning("Mesh does not contain level set values (\"LSValues\").") .print(); return; } domain.initialize(); if (nodes.empty()) { return; } const hrleGrid<D> &grid = domain.getGrid(); const T gridDelta = grid.getGridDelta(); if (hrleVectorType<T, D>(nodes.front()) != grid.getMinGridPoint()) { domain.insertNextUndefinedPoint(0, grid.getMinGridPoint(), (values->front() < 0) ? lsDomain<T, D>::NEG_VALUE : lsDomain<T, D>::POS_VALUE); } hrleVectorType<hrleIndexType, D> lastIndex(nodes.front()); for (unsigned i = 0; i < D; ++i) { lastIndex[i] = nodes.front()[i] / gridDelta; } auto pointDataIt = nodes.begin(); auto pointDataEnd = nodes.end(); auto valueIt = values->begin(); auto valueEnd = values->end(); hrleVectorType<bool, D> signs(values->front() <= -std::numeric_limits<T>::epsilon()); while (pointDataIt != pointDataEnd && valueIt != valueEnd) { if (std::abs(*valueIt) > 2.5) { ++pointDataIt; ++valueIt; continue; } bool setPoint = true; hrleVectorType<hrleIndexType, D> currentIndex; for (unsigned i = 0; i < D; ++i) { currentIndex[i] = std::round(pointDataIt->at(i) / gridDelta); } for (unsigned i = 0; i < D; ++i) { if (grid.getBoundaryConditions(i) != hrleGrid<D>::INFINITE_BOUNDARY) { if (currentIndex[i] > grid.getMaxBounds(i) || currentIndex[i] < grid.getMinBounds(i)) { setPoint = false; } } } if (setPoint) { domain.insertNextDefinedPoint(0, currentIndex, *valueIt); { bool changeSign = false; for (int i = D - 1; i >= 0; --i) { changeSign = changeSign || (currentIndex[i] > lastIndex[i]); if (changeSign) { signs[i] = *valueIt <= -std::numeric_limits<T>::epsilon(); lastIndex[i] = currentIndex[i]; } } } } hrleVectorType<hrleIndexType, D> nextIndex; ++pointDataIt; ++valueIt; if (pointDataIt == pointDataEnd) { nextIndex = grid.getMaxGridPoint(); nextIndex[D - 1]++; } else { for (unsigned i = 0; i < D; ++i) { nextIndex[i] = std::round(pointDataIt->at(i) / gridDelta); } } for (int q = 0; q < D; q++) { hrleVectorType<hrleIndexType, D> tmp = currentIndex; tmp[q]++; if (tmp[q] > grid.getMaxGridPoint(q)) continue; for (int r = 0; r < q; ++r) tmp[r] = grid.getMinGridPoint(r); if (tmp >= nextIndex) break; domain.insertNextUndefinedPoint(0, tmp, signs[q] ? lsDomain<T, D>::NEG_VALUE : lsDomain<T, D>::POS_VALUE); } } domain.finalize(); } }; PRECOMPILE_PRECISION_DIMENSION(lsFromMesh) #endif
#ifndef LS_FROM_MESH_HPP #define LS_FROM_MESH_HPP #include <lsPreCompileMacros.hpp> #include <lsDomain.hpp> #include <lsMesh.hpp> template <class T, int D> class lsFromMesh { typedef typename lsDomain<T, D>::DomainType hrleDomainType; lsSmartPointer<lsDomain<T, D>> levelSet = nullptr; lsSmartPointer<lsMesh<T>> mesh = nullptr; bool sortPointList = true; public: lsFromMesh(){}; lsFromMesh(lsSmartPointer<lsDomain<T, D>> passedLevelSet, const lsSmartPointer<lsMesh<T>> passedMesh) : levelSet(passedLevelSet), mesh(passedMesh) {} void setLevelSet(lsSmartPointer<lsDomain<T, D>> passedlsDomain) { levelSet = passedlsDomain; } void setMesh(const lsSmartPointer<lsMesh<T>> passedMesh) { mesh = passedMesh; } void setSortPointList(bool passedSortPointList) { sortPointList = passedSortPointList; } void apply() { if (levelSet == nullptr) { lsMessage::getInstance() .addWarning("No level set was passed to lsFromMesh.") .print(); return; } if (mesh == nullptr) { lsMessage::getInstance() .addWarning("No lsMesh<> was supplied to lsFromMesh.") .print(); return; } auto &domain = levelSet->getDomain(); auto &nodes = mesh->getNodes(); auto values = mesh->cellData.getScalarData("LSValues"); if (values == nullptr) { lsMessage::getInstance() .addWarning("Mesh does not contain level set values (\"LSValues\").") .print(); return; } domain.initialize(); if (nodes.empty()) { return; } const hrleGrid<D> &grid = domain.getGrid(); const T gridDelta = grid.getGridDelta(); if (hrleVectorType<T, D>(nodes.front()) != grid.getMinGridPoint()) { domain.insertNextUndefinedPoint(0, grid.getMinGridPoint(), (values->front() < 0) ? lsDomain<T, D>::NEG_VALUE : lsDomain<T, D>::POS_VALUE); } hrleVectorType<hrleIndexType, D> lastIndex(nodes.front()); for (unsigned i = 0; i < D; ++i) { lastIndex[i] = nodes.front()[i] / gridDelta; } auto pointDataIt = nodes.begin(); auto pointDataEnd = nodes.end(); auto valueIt = values->begin(); auto valueEnd = values->end(); hrleVectorType<bool, D> signs(values->front() <= -std::numeric_limits<T>::epsilon()); while (pointDataIt != pointDataEnd && valueIt != valueEnd) { if (std::abs(*valueIt) > 2.5) { ++pointDataIt; ++valueIt; continue; } bool setPoint = true; hrleVectorType<hrleIndexType, D> currentIndex; for (unsigned i = 0; i < D; ++i) { currentIndex[i] = std::round(pointDataIt->at(i) / gridDelta); } for (unsigned i = 0; i < D; ++i) { if (grid.getBoundaryConditions(i) != hrleGrid<D>::INFINITE_BOUNDARY) { if (currentIndex[i] > grid.getMaxBounds(i) || currentIndex[i] < grid.getMinBounds(i)) { setPoint = false; } } } if (setPoint) { domain.insertNextDefinedPoint(0, currentIndex, *valueIt); { bool changeSign = false; for (int i = D - 1; i >= 0; --i) { changeSign = changeSign || (currentIndex[i] > lastIndex[i]);
for (unsigned i = 0; i < D; ++i) { nextIndex[i] = std::round(pointDataIt->at(i) / gridDelta); } } for (int q = 0; q < D; q++) { hrleVectorType<hrleIndexType, D> tmp = currentIndex; tmp[q]++; if (tmp[q] > grid.getMaxGridPoint(q)) continue; for (int r = 0; r < q; ++r) tmp[r] = grid.getMinGridPoint(r); if (tmp >= nextIndex) break; domain.insertNextUndefinedPoint(0, tmp, signs[q] ? lsDomain<T, D>::NEG_VALUE : lsDomain<T, D>::POS_VALUE); } } domain.finalize(); } }; PRECOMPILE_PRECISION_DIMENSION(lsFromMesh) #endif
if (changeSign) { signs[i] = *valueIt <= -std::numeric_limits<T>::epsilon(); lastIndex[i] = currentIndex[i]; } } } } hrleVectorType<hrleIndexType, D> nextIndex; ++pointDataIt; ++valueIt; if (pointDataIt == pointDataEnd) { nextIndex = grid.getMaxGridPoint(); nextIndex[D - 1]++; } else {
random
[ { "content": "// implement own velocity field\n\nclass velocityField : public lsVelocityField<double> {\n\npublic:\n\n double getScalarVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n // isotropic etch rate\n\n return -1;\n\n }\n\n\n\n std::array<double, 3>\n\n getVectorVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n return std::array<double, 3>({});\n\n }\n\n};\n\n\n\nint main() {\n", "file_path": "Examples/VoidEtching/VoidEtching.cpp", "rank": 0, "score": 160931.1584806382 }, { "content": "// implement own velocity field\n\nclass velocityField : public lsVelocityField<double> {\n\npublic:\n\n double getScalarVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n // Some arbitrary velocity function of your liking\n\n // (try changing it and see what happens :)\n\n double velocity = 1.;\n\n return velocity;\n\n }\n\n\n\n std::array<double, 3>\n\n getVectorVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n return std::array<double, 3>({});\n\n }\n\n};\n", "file_path": "Tests/VoidDetection/VoidDetection.cpp", "rank": 1, "score": 160931.1584806382 }, { "content": " class IntegrationSchemeType, class T, int D,\n\n lsConcepts::IsSame<IntegrationSchemeType,\n\n lsInternal::lsStencilLocalLaxFriedrichsScalar<T, D, 1>> =\n\n lsConcepts::assignable>\n\nvoid reduceTimeStepHamiltonJacobi(IntegrationSchemeType &scheme,\n\n double &MaxTimeStep,\n\n hrleCoordType gridDelta) {\n\n const double alpha_maxCFL = 1.0;\n\n // second time step test, based on alphas\n\n hrleVectorType<T, 3> alphas = scheme.getFinalAlphas();\n\n\n\n double timeStep = 0;\n\n for (int i = 0; i < D; ++i) {\n\n timeStep += alphas[i] / gridDelta;\n\n }\n\n\n\n timeStep = alpha_maxCFL / timeStep;\n\n MaxTimeStep = std::min(timeStep, MaxTimeStep);\n\n}\n\n} // namespace advect\n", "file_path": "include/lsStencilLocalLaxFriedrichsScalar.hpp", "rank": 2, "score": 158829.47319415084 }, { "content": " /// Class defining a box used in ray tracing optimisation\n\n class box {\n\n hrleVectorType<hrleIndexType, D - 1> xMin, xMax;\n\n\n\n public:\n\n /// Sets xMin, xMax to the lowest and highest value of the two vectors for\n\n /// each dimension respectively.\n\n box(const hrleVectorType<hrleIndexType, D - 1> &idx0,\n\n const hrleVectorType<hrleIndexType, D - 1> &idx1) {\n\n xMin = Min(idx0, idx1);\n\n xMax = Max(idx0, idx1);\n\n }\n\n\n\n /// Creates a copy of the passed box.\n\n box(const box &box) {\n\n xMin = box.xMin;\n\n xMax = box.xMax;\n\n }\n\n\n\n /// Sets both xMin and Xmax to the passed vector.\n\n box(const hrleVectorType<hrleIndexType, D - 1> &idx) {\n", "file_path": "include/lsFromSurfaceMesh.hpp", "rank": 3, "score": 158193.5481380247 }, { "content": " /// Iterator over all grid points, contained by a box.\n\n class iterator {\n\n hrleVectorType<hrleIndexType, D - 1> pos;\n\n const box &b;\n\n\n\n public:\n\n iterator(const box &bx) : pos(bx.min()), b(bx) {}\n\n\n\n iterator &operator++() {\n\n int i;\n\n for (i = 0; i < D - 2; i++) {\n\n pos[i]++;\n\n if (pos[i] <= b.xMax[i]) {\n\n break;\n\n } else {\n\n pos[i] = b.xMin[i];\n\n }\n\n }\n\n if (i == D - 2)\n\n pos[i]++;\n\n return *this;\n", "file_path": "include/lsFromSurfaceMesh.hpp", "rank": 4, "score": 158193.49605801312 }, { "content": "// Numerical scheme definitions, central is default\n\nenum class DifferentiationSchemeEnum : unsigned {\n\n FIRST_ORDER = 0,\n\n SECOND_ORDER = 1,\n\n WENO3 = 2,\n\n WENO5 = 3\n\n};\n\n\n\ntemplate <class T, DifferentiationSchemeEnum scheme =\n\n DifferentiationSchemeEnum::FIRST_ORDER>\n", "file_path": "include/lsFiniteDifferences.hpp", "rank": 5, "score": 137940.0427661455 }, { "content": "class lsBoxDistribution : public lsGeometricAdvectDistribution<T, D> {\n\npublic:\n\n const hrleVectorType<T, 3> posExtent;\n\n const T gridDelta;\n\n\n\n lsBoxDistribution(const std::array<T, 3> &halfAxes, const T delta)\n\n : posExtent(halfAxes), gridDelta(delta) {\n\n for (unsigned i = 0; i < D; ++i) {\n\n if (std::abs(posExtent[i]) < gridDelta) {\n\n lsMessage::getInstance()\n\n .addWarning(\"One half-axis of lsBoxDistribution is smaller than \"\n\n \"the grid Delta! This can lead to numerical errors \"\n\n \"breaking the distribution!\")\n\n .print();\n\n }\n\n }\n\n }\n\n\n\n bool isInside(const std::array<hrleCoordType, 3> &initial,\n\n const std::array<hrleCoordType, 3> &candidate,\n", "file_path": "include/lsGeometricAdvectDistributions.hpp", "rank": 6, "score": 134794.07959225943 }, { "content": "class lsSphereDistribution : public lsGeometricAdvectDistribution<T, D> {\n\npublic:\n\n const T radius = 0.;\n\n const T radius2;\n\n const T gridDelta;\n\n\n\n lsSphereDistribution(const T passedRadius, const T delta)\n\n : radius(passedRadius), radius2(radius * radius), gridDelta(delta) {}\n\n\n\n bool isInside(const std::array<hrleCoordType, 3> &initial,\n\n const std::array<hrleCoordType, 3> &candidate,\n\n double eps = 0.) const {\n\n hrleCoordType dot = 0.;\n\n for (unsigned i = 0; i < D; ++i) {\n\n double tmp = candidate[i] - initial[i];\n\n dot += tmp * tmp;\n\n }\n\n\n\n if (std::sqrt(dot) <= std::abs(radius) + eps)\n\n return true;\n", "file_path": "include/lsGeometricAdvectDistributions.hpp", "rank": 7, "score": 134794.07959225943 }, { "content": "/// Enumeration describing which connected component to use\n\n/// as top surface during void point detection.\n\n/// All others points will be set as void poitns.\n\n/// LEX_* means the top surface is chosen according to the\n\n/// lexicographic first or last LS point, while LARGEST\n\n/// means that the connected component containing the\n\n/// largest number of points will be chosen.\n\nenum struct lsVoidTopSurfaceEnum : unsigned {\n\n LEX_LOWEST = 0,\n\n LEX_HIGHEST = 1,\n\n LARGEST = 2,\n\n SMALLEST = 3\n\n};\n\n\n\n/// This class is used to mark points of the level set\n\n/// which are enclosed in a void.\n\ntemplate <class T, int D> class lsMarkVoidPoints {\n\n using IndexType = std::size_t;\n\n\n\n lsSmartPointer<lsDomain<T, D>> domain = nullptr;\n\n bool reverseVoidDetection = false;\n\n bool saveComponents = false;\n\n bool detectLargestSurface = false;\n\n\n\n // two points are connected if they have the same sign\n\n bool areConnected(const T &value1, const T &value2) {\n\n return (value1 >= 0) == (value2 >= 0);\n", "file_path": "include/lsMarkVoidPoints.hpp", "rank": 8, "score": 120271.25876684276 }, { "content": "/// Enumeration for the different types of\n\n/// transformation operations\n\nenum struct lsTransformEnum : unsigned {\n\n TRANSLATION = 0,\n\n ROTATION = 1,\n\n SCALE = 2\n\n};\n\n\n\ntemplate <class T> class lsTransformMesh {\n\n lsSmartPointer<lsMesh<T>> mesh = nullptr;\n\n lsTransformEnum transform = lsTransformEnum::TRANSLATION;\n\n hrleVectorType<double, 3> transformVector{};\n\n double angle = 0.0;\n\n double numericEps = 1e-6;\n\n\n\n // check vector for all zeros\n\n bool isValidVector() {\n\n if (DotProduct(transformVector, transformVector) < numericEps) {\n\n return false;\n\n } else {\n\n return true;\n\n }\n", "file_path": "include/lsTransformMesh.hpp", "rank": 9, "score": 115973.16420848995 }, { "content": "// implement own velocity field\n\nclass velocityField : public lsVelocityField<double> {\n\npublic:\n\n double getScalarVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> &normalVector,\n\n unsigned long /*pointId*/) final {\n\n // Some arbitrary velocity function of your liking\n\n // (try changing it and see what happens :)\n\n double velocity = 1. + ((normalVector[0] > 0) ? 2.3 : 0.5) *\n\n std::abs(normalVector[0] * normalVector[0]);\n\n return velocity;\n\n }\n\n\n\n std::array<double, 3>\n\n getVectorVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) final {\n\n return std::array<double, 3>({});\n\n }\n", "file_path": "Tests/Advection/Advection.cpp", "rank": 10, "score": 115604.21311174004 }, { "content": "/// Singleton class for thread-safe logging.\n\nclass lsMessage {\n\n std::string message;\n\n\n\n bool error = false;\n\n const unsigned tabWidth = 4;\n\n\n\n lsMessage() {}\n\n\n\npublic:\n\n // delete constructors to result in better error messages by compilers\n\n lsMessage(const lsMessage &) = delete;\n\n void operator=(const lsMessage &) = delete;\n\n\n\n static lsMessage &getInstance() {\n\n static lsMessage instance;\n\n return instance;\n\n }\n\n\n\n lsMessage &add(std::string s) {\n\n#pragma omp critical\n", "file_path": "include/lsMessage.hpp", "rank": 11, "score": 114466.98062580981 }, { "content": "class lsGraph {\n\n // type for indexing components\n\n using IndexType = std::size_t;\n\n // edges must be unique\n\n typedef typename std::unordered_set<IndexType> edgeListType;\n\n // points must be unique and adressable\n\n typedef typename std::unordered_map<IndexType, edgeListType>\n\n adjacencyListType;\n\n\n\n adjacencyListType adjacencyList;\n\n std::vector<IndexType> componentIds;\n\n\n\n void depthFirstComponentSearch(const std::size_t &currentVertex,\n\n int &currentComponent) {\n\n // set component for this vertex\n\n componentIds[currentVertex] = currentComponent;\n\n\n\n // cylce through all connected vertices and set their component\n\n auto vertexListIt = adjacencyList.find(currentVertex);\n\n if (vertexListIt == adjacencyList.end()) {\n", "file_path": "include/lsGraph.hpp", "rank": 12, "score": 114461.99149085835 }, { "content": "// implement own velocity field\n\nclass velocityField : public lsVelocityField<NumericType> {\n\npublic:\n\n NumericType\n\n getScalarVelocity(const std::array<NumericType, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<NumericType, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n // Some arbitrary velocity function of your liking\n\n // (try changing it and see what happens :)\n\n NumericType velocity = 1.;\n\n return velocity;\n\n }\n\n\n\n std::array<NumericType, 3>\n\n getVectorVelocity(const std::array<NumericType, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<NumericType, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n return std::array<NumericType, 3>({}); // initialise to zero\n\n }\n", "file_path": "Examples/Deposition/Deposition.cpp", "rank": 13, "score": 113728.15086558198 }, { "content": "// BASE CLASS WRAPPERS\n\n// lsVelocityField only defines interface and has no functionality\n\nclass PylsVelocityField : public lsVelocityField<T> {\n\n typedef std::array<T, 3> vectorType;\n\n using lsVelocityField<T>::lsVelocityField;\n\n\n\npublic:\n\n T getScalarVelocity(const vectorType &coordinate, int material,\n\n const vectorType &normalVector,\n\n unsigned long pointId) override {\n\n PYBIND11_OVERLOAD(T, lsVelocityField<T>, getScalarVelocity, coordinate,\n\n material, normalVector, pointId);\n\n }\n\n\n\n vectorType getVectorVelocity(const vectorType &coordinate, int material,\n\n const vectorType &normalVector,\n\n unsigned long pointId) override {\n\n PYBIND11_OVERLOAD(vectorType, lsVelocityField<T>, getVectorVelocity,\n\n coordinate, material, normalVector, pointId);\n\n }\n\n};\n\n\n", "file_path": "Wrapping/Python/pyWrap.cpp", "rank": 14, "score": 111949.80108266605 }, { "content": "// implement velocity field describing a directional etch\n\nclass directionalEtch : public lsVelocityField<double> {\n\npublic:\n\n double getScalarVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int material,\n\n const std::array<double, 3> &normalVector,\n\n unsigned long /*pointId*/) {\n\n // etch directionally\n\n if (material > 0) {\n\n return (normalVector[2] > 0.) ? -normalVector[2] : 0;\n\n } else {\n\n return 0;\n\n }\n\n }\n\n\n\n std::array<double, 3>\n\n getVectorVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n return std::array<double, 3>({});\n\n }\n\n};\n\n\n", "file_path": "Examples/PatternedSubstrate/PatternedSubstrate.cpp", "rank": 15, "score": 111940.20201365303 }, { "content": "// implement own velocity field\n\nclass velocityField : public lsVelocityField<double> {\n\n std::vector<double> &data_;\n\n\n\npublic:\n\n velocityField(std::vector<double> &data) : data_(data) {}\n\n\n\n double getScalarVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long pointId) {\n\n // Some arbitrary velocity function of your liking\n\n // (try changing it and see what happens :)\n\n // double velocity = 1. + ((normalVector[0] > 0) ? 2.3 : 0.5) *\n\n // std::abs(normalVector[0] * normalVector[0]);\n\n // return velocity;\n\n return data_[pointId];\n\n }\n\n\n\n std::array<double, 3>\n\n getVectorVelocity(const std::array<double, 3> & /*coordinate*/,\n", "file_path": "Tests/AdvectionBenchmark/AdvectionBenchmark.cpp", "rank": 16, "score": 111940.20201365303 }, { "content": "// implement own velocity field\n\nclass velocityField : public lsVelocityField<double> {\n\npublic:\n\n double getScalarVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n return 1.;\n\n }\n\n\n\n std::array<double, 3>\n\n getVectorVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n return std::array<double, 3>({});\n\n }\n\n};\n\n\n\nint main() {\n\n constexpr int D = 2;\n", "file_path": "Tests/AdvectionPlane/AdvectionPlane.cpp", "rank": 17, "score": 111940.20201365303 }, { "content": "// implement velocity field describing an isotropic deposition\n\nclass isotropicDepo : public lsVelocityField<double> {\n\npublic:\n\n double getScalarVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n // deposit isotropically everywhere\n\n return 1;\n\n }\n\n\n\n std::array<double, 3>\n\n getVectorVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n return std::array<double, 3>({});\n\n }\n\n};\n\n\n\n// create a rounded cone as the primitive pattern.\n", "file_path": "Examples/PatternedSubstrate/PatternedSubstrate.cpp", "rank": 18, "score": 111940.20201365303 }, { "content": "// implement own velocity field\n\nclass velocityField : public lsVelocityField<double> {\n\npublic:\n\n double getScalarVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n return 1.;\n\n }\n\n\n\n std::array<double, 3>\n\n getVectorVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n return std::array<double, 3>({});\n\n }\n\n};\n\n\n\nint main() {\n\n\n", "file_path": "Tests/Advection2D/Advection2D.cpp", "rank": 19, "score": 111940.20201365303 }, { "content": "// implement own velocity field\n\nclass velocityField : public lsVelocityField<double> {\n\npublic:\n\n double getScalarVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n // isotropic etch rate\n\n return 1;\n\n }\n\n\n\n std::array<double, 3>\n\n getVectorVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n return std::array<double, 3>({});\n\n }\n\n};\n\n\n\nint main() {\n", "file_path": "Examples/PeriodicBoundary/PeriodicBoundary.cpp", "rank": 20, "score": 111940.20201365303 }, { "content": "// Numerical velocity field.\n\n// Advection scheme will take care of numerical\n\n// artefacts itself.\n\nclass velocityField : public lsVelocityField<double> {\n\npublic:\n\n double getScalarVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int material,\n\n const std::array<double, 3> &normalVector,\n\n unsigned long /*pointId*/) {\n\n // if the surface of material 1 is facing upwards, etch it anisotropically\n\n if (material == 1 && normalVector[1] > 0.) {\n\n return -std::abs(normalVector[1]);\n\n } else\n\n return 0.;\n\n }\n\n};\n\n\n", "file_path": "Examples/SquareEtch/SquareEtch.cpp", "rank": 21, "score": 111940.20201365303 }, { "content": "// Same velocity field, but analytical\n\n// If the dissipation alphas can be derived,\n\n// this will produce better results than numerical\n\n// approximations. lsLocalLaxFriedrichsAnalytical has\n\n// to be used for advection.\n\nclass analyticalField : public lsVelocityField<double> {\n\n const double velocity = -1;\n\n\n\npublic:\n\n double getScalarVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int material,\n\n const std::array<double, 3> &normalVector,\n\n unsigned long /*pointId*/) {\n\n if (material != 1)\n\n return 0.;\n\n\n\n return velocity * std::abs(normalVector[1]);\n\n }\n\n\n\n double getDissipationAlpha(int direction, int material,\n\n const std::array<double, 3> &centralDifferences) {\n\n if (material != 1)\n\n return 0;\n\n\n\n double gradient = 0.;\n", "file_path": "Examples/SquareEtch/SquareEtch.cpp", "rank": 22, "score": 111940.20201365303 }, { "content": "/// Helper class for lsToSurfaceMesh. Should not be used directly.\n\nclass lsMarchingCubes {\n\n\n\n // const unsigned int edgeTable2[16] = {0x0, 0x9, 0x3, 0xa, 0x6, 0xf,\n\n // 0x5, 0xc, 0xc, 0x5, 0xf, 0x6,\n\n // 0xa, 0x3, 0x9, 0x0};\n\n\n\n const int triTable2[16][5] = {\n\n {-1, -1, -1, -1, -1}, {0, 3, -1, -1, -1}, {1, 0, -1, -1, -1},\n\n {1, 3, -1, -1, -1}, {2, 1, -1, -1, -1}, {0, 3, 2, 1, -1},\n\n {2, 0, -1, -1, -1}, {2, 3, -1, -1, -1},\n\n\n\n {3, 2, -1, -1, -1}, {0, 2, -1, -1, -1}, {3, 2, 1, 0, -1},\n\n {1, 2, -1, -1, -1}, {3, 1, -1, -1, -1}, {0, 1, -1, -1, -1},\n\n {3, 0, -1, -1, -1}, {-1, -1, -1, -1, -1}};\n\n\n\n // const unsigned int edgeTable3[256] = {\n\n // 0x000, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, 0x80c, 0x905,\n\n // 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, 0x190, 0x099, 0x393, 0x29a,\n\n // 0x596, 0x49f, 0x795, 0x69c, 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93,\n\n // 0xf99, 0xe90, 0x230, 0x339, 0x033, 0x13a, 0x636, 0x73f, 0x435, 0x53c,\n", "file_path": "include/lsMarchingCubes.hpp", "rank": 23, "score": 109940.38834089317 }, { "content": "class lsFiniteDifferences {\n\n template <class V> static V square(V x) { return x * x; }\n\n\n\npublic:\n\n lsFiniteDifferences(){};\n\n\n\n static unsigned getNumberOfValues(DifferentiationSchemeEnum s) {\n\n switch (s) {\n\n case DifferentiationSchemeEnum::FIRST_ORDER:\n\n return 3;\n\n case DifferentiationSchemeEnum::SECOND_ORDER:\n\n case DifferentiationSchemeEnum::WENO3:\n\n return 5;\n\n case DifferentiationSchemeEnum::WENO5:\n\n return 7;\n\n default:\n\n lsMessage::getInstance().addError(\"Invalid finite differences scheme!\");\n\n return 0;\n\n }\n\n }\n", "file_path": "include/lsFiniteDifferences.hpp", "rank": 24, "score": 109930.90517325886 }, { "content": "class lsPointData {\n\npublic:\n\n typedef std::vector<T> ScalarDataType;\n\n typedef std::vector<std::array<T, 3>> VectorDataType;\n\n\n\nprivate:\n\n std::vector<ScalarDataType> scalarData;\n\n std::vector<std::string> scalarDataLabels;\n\n std::vector<VectorDataType> vectorData;\n\n std::vector<std::string> vectorDataLabels;\n\n\n\n template <class VectorType, class ReturnType = std::conditional_t<\n\n std::is_const<VectorType>::value,\n\n const typename VectorType::value_type *,\n\n typename VectorType::value_type *>>\n\n ReturnType indexPointerOrNull(VectorType &v, int index) const {\n\n if (index >= 0 && index < v.size())\n\n return &(v[index]);\n\n else\n\n lsMessage::getInstance()\n", "file_path": "include/lsPointData.hpp", "rank": 25, "score": 109930.90517325886 }, { "content": "// implement own velocity field for advection\n\n// in this case just grow one of the materials\n\nclass velocityField : public lsVelocityField<double> {\n\npublic:\n\n double getScalarVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int material,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n // Note that only the top material grows, so having two different,\n\n // positive velocities will only apply in the first advection step.\n\n // In the next step, the levelSets of the materials will not overlap\n\n // anymore, so the velocity of the top layer will be used.\n\n // For some applications, this problem can be solved by advecting\n\n // the levelsets individually.\n\n // Grow the wrapped top material and etch the lower material.\n\n return ((material == 1) ? 0.5 : -0.2);\n\n }\n\n\n\n std::array<double, 3>\n\n getVectorVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n", "file_path": "Tests/MultiMaterialAdvection/MultiMaterialAdvection.cpp", "rank": 26, "score": 108604.92776343977 }, { "content": "class etchingVel : public lsVelocityField<double> {\n\npublic:\n\n double getScalarVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int material,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n return (material == 1) ? -0.3 : 0;\n\n }\n\n\n\n // std::array<double, 3>\n\n // getVectorVelocity(const std::array<double, 3> & /*coordinate*/,\n\n // int /*material*/,\n\n // const std::array<double, 3> & /*normalVector*/, unsigned\n\n // long /*pointId*/) {\n\n // return std::array<double, 3>({});\n\n // }\n\n};\n\n\n\nint main() {\n\n omp_set_num_threads(1);\n", "file_path": "Tests/MultiMaterialEtch/MultiMaterialEtch.cpp", "rank": 27, "score": 108604.92776343977 }, { "content": "// implement own velocity field for advection\n\n// in this case just grow one of the materials\n\nclass depositionVel : public lsVelocityField<double> {\n\npublic:\n\n double getScalarVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n return 0.1;\n\n }\n\n};\n\n\n", "file_path": "Tests/MultiMaterialEtch/MultiMaterialEtch.cpp", "rank": 28, "score": 108604.92776343977 }, { "content": "// implement own velocity field\n\nclass velocityField : public lsVelocityField<double> {\n\npublic:\n\n double getScalarVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n // isotropic etch rate\n\n return 0;\n\n }\n\n\n\n std::array<double, 3>\n\n getVectorVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n return std::array<double, 3>({1., 0.});\n\n }\n\n};\n\n\n\nint main() {\n", "file_path": "Tests/PeriodicBoundary2D/PeriodicBoundary2D.cpp", "rank": 29, "score": 108604.92776343977 }, { "content": "class velocityField : public lsVelocityField<double> {\n\n double getScalarVelocity(const std::array<double, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<double, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n return 1;\n\n }\n\n};\n\n\n\nint main() {\n\n constexpr int D = 3;\n\n typedef double NumericType;\n\n\n\n double extent = 10;\n\n double gridDelta = 0.25;\n\n double bounds[2 * D] = {-extent, extent, -extent, extent};\n\n if (D == 3) {\n\n bounds[4] = -10;\n\n bounds[5] = 10;\n\n }\n", "file_path": "Tests/GeometricAdvectPerformance/GeometricAdvectPerformance.cpp", "rank": 30, "score": 108604.92776343977 }, { "content": "// implement own velocity field\n\nclass velocityField : public lsVelocityField<NumericType> {\n\npublic:\n\n NumericType\n\n getScalarVelocity(const std::array<NumericType, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<NumericType, 3> &normalVector,\n\n unsigned long /*pointId*/) {\n\n // velocity is proportional to the normal vector\n\n NumericType velocity =\n\n std::abs(normalVector[0]) + std::abs(normalVector[1]);\n\n return velocity;\n\n }\n\n\n\n std::array<NumericType, 3>\n\n getVectorVelocity(const std::array<NumericType, 3> & /*coordinate*/,\n\n int /*material*/,\n\n const std::array<NumericType, 3> & /*normalVector*/,\n\n unsigned long /*pointId*/) {\n\n return std::array<NumericType, 3>({});\n\n }\n", "file_path": "Examples/AirGapDeposition/AirGapDeposition.cpp", "rank": 31, "score": 107047.04474747552 }, { "content": " mesh->print();\n\n\n\n lsVTKWriter(mesh, lsFileFormatEnum::VTU, \"ReadVolumeMesh.vtu\").apply();\n\n\n\n double bounds[2 * D] = {-6, 6, 1e-10, 0.078, -0.034, 0.034};\n\n lsBoundaryConditionEnum<D> boundaryCons[D];\n\n for (unsigned i = 0; i < D; ++i) {\n\n boundaryCons[i] = lsBoundaryConditionEnum<D>::REFLECTIVE_BOUNDARY;\n\n }\n\n boundaryCons[0] = lsBoundaryConditionEnum<D>::INFINITE_BOUNDARY;\n\n\n\n auto domain = lsSmartPointer<lsDomain<NumericType, D>>::New(\n\n bounds, boundaryCons, gridDelta);\n\n\n\n // read in as LS\n\n lsFromVolumeMesh<double, D> reader(domain->getGrid(), mesh);\n\n reader.apply();\n\n auto levelSets = reader.getLevelSets();\n\n\n\n for (unsigned i = 0; i < levelSets.size(); ++i) {\n\n auto mesh = lsSmartPointer<lsMesh<>>::New();\n\n lsToSurfaceMesh<double, D>(levelSets[i], mesh).apply();\n\n lsVTKWriter<double>(mesh, \"LSsurface-\" + std::to_string(i) + \".vtp\")\n\n .apply();\n\n }\n\n\n\n return 0;\n\n}", "file_path": "Examples/VolumeToLevelSets/VolumeToLevelSets.cpp", "rank": 32, "score": 106635.67090491262 }, { "content": "#include <iostream>\n\n\n\n#include <lsDomain.hpp>\n\n#include <lsFromVolumeMesh.hpp>\n\n#include <lsSmartPointer.hpp>\n\n#include <lsToSurfaceMesh.hpp>\n\n#include <lsVTKReader.hpp>\n\n#include <lsVTKWriter.hpp>\n\n\n\nint main(int argc, char *argv[]) {\n\n\n\n using NumericType = double;\n\n constexpr int D = 3;\n\n double gridDelta = 0.00023;\n\n\n\n std::string fileName;\n\n if (argc > 1) {\n\n fileName = std::string(argv[1]);\n\n } else {\n\n fileName = \"volumeInitial.vtu\";\n", "file_path": "Examples/VolumeToLevelSets/VolumeToLevelSets.cpp", "rank": 33, "score": 106622.269972881 }, { "content": " }\n\n\n\n auto mesh = lsSmartPointer<lsMesh<NumericType>>::New();\n\n lsVTKReader(mesh, lsFileFormatEnum::VTU, fileName).apply();\n\n\n\n // reorder numbering\n\n {\n\n typename lsPointData<NumericType>::ScalarDataType *materialData =\n\n mesh->getCellData().getScalarData(\"Material\");\n\n\n\n std::vector<int> translator = {3, 2, 4, 7, 7, 6, 5, 7, 1, 0};\n\n if (materialData == nullptr) {\n\n std::cout << \"Could not get material data\" << std::endl;\n\n } else {\n\n for (auto &cell : *materialData) {\n\n cell = translator[std::round(cell)];\n\n }\n\n }\n\n }\n\n\n", "file_path": "Examples/VolumeToLevelSets/VolumeToLevelSets.cpp", "rank": 34, "score": 106619.80178214966 }, { "content": "/// Class containing all information about the level set, including\n\n/// the dimensions of the domain, boundary conditions and all data.\n\ntemplate <class T, int D> class lsDomain {\n\npublic:\n\n // TYPEDEFS\n\n typedef T ValueType;\n\n typedef hrleGrid<D> GridType;\n\n typedef hrleDomain<T, D> DomainType;\n\n typedef lsBoundaryConditionEnum<D> BoundaryType;\n\n typedef typename std::vector<std::pair<hrleVectorType<hrleIndexType, D>, T>>\n\n PointValueVectorType;\n\n typedef typename std::vector<std::array<T, D>> NormalVectorType;\n\n typedef lsPointData<T> PointDataType;\n\n typedef typename std::vector<bool> VoidPointMarkersType;\n\n\n\nprivate:\n\n // PRIVATE MEMBER VARIABLES\n\n GridType grid;\n\n DomainType domain;\n\n int levelSetWidth = 1;\n", "file_path": "include/lsDomain.hpp", "rank": 35, "score": 90375.26249941261 }, { "content": " lsDomain(GridType passedGrid) : grid(passedGrid) {\n\n domain.deepCopy(grid, DomainType(grid, T(POS_VALUE)));\n\n }\n\n\n\n lsDomain(lsSmartPointer<lsDomain> passedDomain) { deepCopy(passedDomain); }\n\n\n\n /// this function sets a new levelset width and finalizes the levelset, so it\n\n /// is ready for use by other algorithms\n\n void finalize(int newWidth) { levelSetWidth = newWidth; }\n\n\n\n /// this function finalizes the levelset, so it is ready for use by other\n\n /// algorithms\n\n void finalize() {}\n\n\n\n /// copy all values of \"passedlsDomain\" to this lsDomain\n\n void deepCopy(const lsSmartPointer<lsDomain<T, D>> passedlsDomain) {\n\n grid = passedlsDomain->grid;\n\n domain.deepCopy(grid, passedlsDomain->domain);\n\n levelSetWidth = passedlsDomain->levelSetWidth;\n\n pointData = passedlsDomain->pointData;\n", "file_path": "include/lsDomain.hpp", "rank": 36, "score": 90373.07494635589 }, { "content": " }\n\n\n\n /// re-initalise lsDomain with the point/value pairs in pointData\n\n /// This is similar to lsFromMesh with the difference that pointData\n\n /// contains (INDEX, Value) pairs, while lsFromMesh expects coordinates\n\n /// rather than indices\n\n void insertPoints(PointValueVectorType pointData, bool sort = true) {\n\n hrleFillDomainWithSignedDistance(domain, pointData, T(NEG_VALUE),\n\n T(POS_VALUE), sort);\n\n }\n\n\n\n /// get reference to the grid on which the levelset is defined\n\n const GridType &getGrid() const { return grid; }\n\n\n\n /// get mutable reference to the grid on which the level set is defined\n\n GridType &getGrid() { return grid; }\n\n\n\n /// get const reference to the underlying hrleDomain data structure\n\n DomainType &getDomain() { return domain; }\n\n\n", "file_path": "include/lsDomain.hpp", "rank": 37, "score": 90372.36210384434 }, { "content": " const DomainType &getDomain() const { return domain; }\n\n\n\n /// returns the number of segments, the levelset is split into.\n\n /// This is useful for algorithm parallelisation\n\n unsigned getNumberOfSegments() const { return domain.getNumberOfSegments(); }\n\n\n\n /// returns the number of defined points\n\n unsigned getNumberOfPoints() const { return domain.getNumberOfPoints(); }\n\n\n\n int getLevelSetWidth() const { return levelSetWidth; }\n\n\n\n void setLevelSetWidth(int width) { levelSetWidth = width; }\n\n\n\n // clear all additional data\n\n void clearMetaData() { pointData.clear(); }\n\n\n\n /// get reference to point data saved in the level set\n\n PointDataType &getPointData() { return pointData; }\n\n\n\n const PointDataType &getPointData() const { return pointData; }\n", "file_path": "include/lsDomain.hpp", "rank": 38, "score": 90362.12819035689 }, { "content": "\n\n /// get reference to the voidPoints markers for all points\n\n VoidPointMarkersType &getVoidPointMarkers() { return voidPointMarkers; }\n\n\n\n const VoidPointMarkersType &getVoidPointMarkers() const {\n\n return voidPointMarkers;\n\n }\n\n\n\n /// prints basic information and all memebers of the levelset structure\n\n void print(std::ostream &out = std::cout) {\n\n out << \"Grid pointer: \" << &grid << std::endl;\n\n out << \"Domain: \" << &domain << std::endl;\n\n out << \"DomainSegments: \" << std::endl;\n\n for (unsigned i = 0; i < getNumberOfSegments(); ++i) {\n\n out << &(domain.getDomainSegment(i)) << std::endl;\n\n }\n\n domain.print(out);\n\n }\n\n\n\n /// Serializes the lsDomain into a binary stream\n", "file_path": "include/lsDomain.hpp", "rank": 39, "score": 90359.62380694832 }, { "content": " PointDataType pointData;\n\n VoidPointMarkersType voidPointMarkers;\n\n\n\npublic:\n\n // STATIC CONSTANTS\n\n static constexpr int dimensions = D;\n\n\n\n // PUBLIC MEMBER VARIABLES\n\n static constexpr T POS_VALUE = std::numeric_limits<T>::max();\n\n static constexpr T NEG_VALUE = std::numeric_limits<T>::lowest();\n\n\n\n /// initalise an empty infinite lsDomain\n\n lsDomain(hrleCoordType gridDelta = 1.0) {\n\n hrleIndexType gridMin[D], gridMax[D];\n\n BoundaryType boundaryCons[D];\n\n for (unsigned i = 0; i < D; ++i) {\n\n gridMin[i] = 0;\n\n gridMax[i] = 0;\n\n boundaryCons[i] = BoundaryType::INFINITE_BOUNDARY;\n\n }\n", "file_path": "include/lsDomain.hpp", "rank": 40, "score": 90359.14241709933 }, { "content": " // grid pointer in hrleDomain is implicitly set\n\n // to the correct grid already since they were\n\n // initialized together\n\n domain.deserialize(stream);\n\n\n\n // read in the level set width\n\n uint32_t width;\n\n stream.read(reinterpret_cast<char *>(&width), sizeof(uint32_t));\n\n levelSetWidth = width;\n\n\n\n // check wether there is point data to read\n\n char hasPointData;\n\n stream.read(&hasPointData, 1);\n\n if (hasPointData == 1) {\n\n pointData.clear();\n\n pointData.deserialize(stream);\n\n }\n\n\n\n return stream;\n\n }\n\n};\n\n\n\n// add all template specialisations for this class\n\nPRECOMPILE_PRECISION_DIMENSION(lsDomain)\n\n\n\n#endif // LS_DOMAIN_HPP\n", "file_path": "include/lsDomain.hpp", "rank": 41, "score": 90354.13551103884 }, { "content": " BoundaryType boundaryCons[D];\n\n for (unsigned i = 0; i < D; ++i) {\n\n boundaryCons[i] = static_cast<BoundaryType>(boundaryConditions[i]);\n\n }\n\n auto newDomain = lsSmartPointer<lsDomain<T, D>>::New(\n\n bounds.data(), boundaryCons, gridDelta);\n\n this->deepCopy(newDomain);\n\n }\n\n\n\n /// initialise lsDomain with domain size \"bounds\", filled with point/value\n\n /// pairs in pointData\n\n lsDomain(PointValueVectorType pointData, hrleCoordType *bounds,\n\n BoundaryType *boundaryConditions, hrleCoordType gridDelta = 1.0) {\n\n auto newDomain = lsSmartPointer<lsDomain<T, D>>::New(\n\n bounds, boundaryConditions, gridDelta);\n\n this->deepCopy(newDomain);\n\n hrleFillDomainWithSignedDistance(domain, pointData, T(NEG_VALUE),\n\n T(POS_VALUE));\n\n }\n\n\n", "file_path": "include/lsDomain.hpp", "rank": 42, "score": 90354.00820115517 }, { "content": "#ifndef LS_DOMAIN_HPP\n\n#define LS_DOMAIN_HPP\n\n\n\n#include <lsPreCompileMacros.hpp>\n\n\n\n#include <limits>\n\n\n\n#include <hrleDomain.hpp>\n\n#include <hrleFillDomainWithSignedDistance.hpp>\n\n#include <hrleVectorType.hpp>\n\n\n\n#include <lsPointData.hpp>\n\n#include <lsSmartPointer.hpp>\n\n\n\n#define LS_DOMAIN_SERIALIZATION_VERSION 0\n\n\n\n// Boundary condition alias for easier access\n\ntemplate <int D>\n\nusing lsBoundaryConditionEnum = typename hrleGrid<D>::boundaryType;\n\n\n", "file_path": "include/lsDomain.hpp", "rank": 43, "score": 90353.83467722179 }, { "content": " std::ostream &serialize(std::ostream &stream) {\n\n // Save header to identify lsDomain\n\n stream << \"lsDomain\";\n\n\n\n // now write format version number\n\n char formatVersion = LS_DOMAIN_SERIALIZATION_VERSION;\n\n stream.write(&formatVersion, 1);\n\n\n\n // serialize grid\n\n grid.serialize(stream);\n\n\n\n // serialize hrleDomain which saves LS values\n\n domain.serialize(stream);\n\n\n\n // serialize lsDomain members\n\n // level set width as 32bit uint\n\n const uint32_t width = levelSetWidth;\n\n stream.write(reinterpret_cast<const char *>(&width), sizeof(uint32_t));\n\n\n\n // serialize pointData if there is any point data associated with this\n", "file_path": "include/lsDomain.hpp", "rank": 44, "score": 90353.64074200236 }, { "content": "\n\n grid = GridType(gridMin, gridMax, gridDelta, boundaryCons);\n\n domain.deepCopy(grid, DomainType(grid, T(POS_VALUE)));\n\n }\n\n\n\n lsDomain(hrleCoordType *bounds, BoundaryType *boundaryConditions,\n\n hrleCoordType gridDelta = 1.0) {\n\n hrleIndexType gridMin[D], gridMax[D];\n\n for (unsigned i = 0; i < D; ++i) {\n\n gridMin[i] = std::floor(bounds[2 * i] / gridDelta);\n\n gridMax[i] = std::ceil(bounds[2 * i + 1] / gridDelta);\n\n }\n\n\n\n grid = GridType(gridMin, gridMax, gridDelta, boundaryConditions);\n\n domain.deepCopy(grid, DomainType(grid, T(POS_VALUE)));\n\n }\n\n\n\n lsDomain(std::vector<hrleCoordType> bounds,\n\n std::vector<unsigned> boundaryConditions,\n\n hrleCoordType gridDelta = 1.0) {\n", "file_path": "include/lsDomain.hpp", "rank": 45, "score": 90351.60876235418 }, { "content": " return stream;\n\n }\n\n\n\n // check format version for compatibility\n\n char formatVersion;\n\n stream.read(&formatVersion, 1);\n\n if (formatVersion > LS_DOMAIN_SERIALIZATION_VERSION) {\n\n lsMessage::getInstance()\n\n .addWarning(\n\n \"Reading lsDomain of version \" + std::to_string(formatVersion) +\n\n \" with reader of version \" +\n\n std::to_string(LS_DOMAIN_SERIALIZATION_VERSION) + \" failed.\")\n\n .print();\n\n return stream;\n\n }\n\n\n\n // read in the grid\n\n grid.deserialize(stream);\n\n\n\n // read in the hrleDoamin\n", "file_path": "include/lsDomain.hpp", "rank": 46, "score": 90346.37168962593 }, { "content": " // lsDomain mark whether there is point data or not (1/0)\n\n char hasPointData = (pointData.empty()) ? 0 : 1;\n\n stream.write(&hasPointData, 1);\n\n if (hasPointData == 1) {\n\n pointData.serialize(stream);\n\n }\n\n\n\n return stream;\n\n }\n\n\n\n /// Deserialize lsDomain from binary stream\n\n std::istream &deserialize(std::istream &stream) {\n\n // Check identifier\n\n char identifier[8];\n\n stream.read(identifier, 8);\n\n if (std::string(identifier).compare(0, 8, \"lsDomain\")) {\n\n lsMessage::getInstance()\n\n .addWarning(\n\n \"Reading lsDomain from stream failed. Header could not be found.\")\n\n .print();\n", "file_path": "include/lsDomain.hpp", "rank": 47, "score": 90341.9548369183 }, { "content": "var include_2lsDomain_8hpp =\n\n[\n\n [ \"lsDomain\", \"classlsDomain.html\", \"classlsDomain\" ],\n\n [ \"LS_DOMAIN_SERIALIZATION_VERSION\", \"include_2lsDomain_8hpp.html#af575d8dc440f4bc1845b492194cd5dd2\", null ],\n\n [ \"lsBoundaryConditionEnum\", \"include_2lsDomain_8hpp.html#a5f744444bbee7265e693abfcce25bf9f\", null ]\n", "file_path": "docs/doxygen/html/include_2lsDomain_8hpp.js", "rank": 48, "score": 89793.69750959172 }, { "content": " onlyDefined = passedOnlyDefined;\n\n }\n\n\n\n void setOnlyActive(bool passedOnlyActive) { onlyActive = passedOnlyActive; }\n\n\n\n void apply() {\n\n if (levelSet == nullptr) {\n\n lsMessage::getInstance()\n\n .addWarning(\"No level set was passed to lsToMesh.\")\n\n .print();\n\n return;\n\n }\n\n if (mesh == nullptr) {\n\n lsMessage::getInstance()\n\n .addWarning(\"No mesh was passed to lsToMesh.\")\n\n .print();\n\n return;\n\n }\n\n\n\n mesh->clear();\n", "file_path": "include/lsToMesh.hpp", "rank": 50, "score": 89500.81380785201 }, { "content": " bool onlyDefined = true;\n\n bool onlyActive = false;\n\n static constexpr long long maxDomainExtent = 1e6;\n\n\n\npublic:\n\n lsToMesh(){};\n\n\n\n lsToMesh(const lsSmartPointer<lsDomain<T, D>> passedLevelSet,\n\n lsSmartPointer<lsMesh<T>> passedMesh, bool passedOnlyDefined = true,\n\n bool passedOnlyActive = false)\n\n : levelSet(passedLevelSet), mesh(passedMesh),\n\n onlyDefined(passedOnlyDefined), onlyActive(passedOnlyActive) {}\n\n\n\n void setLevelSet(lsSmartPointer<lsDomain<T, D>> passedlsDomain) {\n\n levelSet = passedlsDomain;\n\n }\n\n\n\n void setMesh(lsSmartPointer<lsMesh<T>> passedMesh) { mesh = passedMesh; }\n\n\n\n void setOnlyDefined(bool passedOnlyDefined) {\n", "file_path": "include/lsToMesh.hpp", "rank": 51, "score": 89499.7836019413 }, { "content": "\n\n const T gridDelta = levelSet->getGrid().getGridDelta();\n\n\n\n for (hrleConstSparseIterator<hrleDomainType> it(levelSet->getDomain());\n\n !it.isFinished(); ++it) {\n\n if ((onlyDefined && !it.isDefined()) ||\n\n (onlyActive && std::abs(it.getValue()) > 0.5))\n\n continue;\n\n\n\n if (!onlyDefined && !it.isDefined()) {\n\n bool skipPoint = false;\n\n for (unsigned i = 0; i < D; ++i) {\n\n if (std::abs(it.getStartIndices(i)) > maxDomainExtent) {\n\n skipPoint = true;\n\n }\n\n }\n\n if (skipPoint) {\n\n continue;\n\n }\n\n }\n", "file_path": "include/lsToMesh.hpp", "rank": 52, "score": 89499.70219245851 }, { "content": "#ifndef LS_TO_MESH_HPP\n\n#define LS_TO_MESH_HPP\n\n\n\n#include <lsPreCompileMacros.hpp>\n\n\n\n#include <vector>\n\n\n\n#include <hrleSparseIterator.hpp>\n\n#include <lsDomain.hpp>\n\n#include <lsMesh.hpp>\n\n\n\n/// Extract the regular grid, on which the level set values are\n\n/// defined, to an explicit lsMesh<>. The Vertices will contain\n\n/// the level set value stored at its location. (This is very useful\n\n/// for debugging)\n\ntemplate <class T, int D> class lsToMesh {\n\n typedef typename lsDomain<T, D>::DomainType hrleDomainType;\n\n\n\n lsSmartPointer<lsDomain<T, D>> levelSet = nullptr;\n\n lsSmartPointer<lsMesh<T>> mesh = nullptr;\n", "file_path": "include/lsToMesh.hpp", "rank": 54, "score": 89497.78313756846 }, { "content": "\n\n // insert vertex\n\n std::array<unsigned, 1> vertex;\n\n vertex[0] = mesh->nodes.size();\n\n mesh->insertNextVertex(vertex);\n\n\n\n // insert corresponding node\n\n std::array<T, 3> node;\n\n if (D == 2)\n\n node[2] = 0.;\n\n for (unsigned i = 0; i < D; ++i) {\n\n node[i] = T(it.getStartIndices(i)) * gridDelta;\n\n }\n\n mesh->insertNextNode(node);\n\n\n\n // insert LS value\n\n if (it.isDefined()) {\n\n LSValues.push_back(it.getDefinedValue());\n\n } else {\n\n LSValues.push_back((it.getValue() < 0) ? -1000 : 1000);\n", "file_path": "include/lsToMesh.hpp", "rank": 57, "score": 89482.72359064745 }, { "content": "#ifndef LS_MESH_HPP\n\n#define LS_MESH_HPP\n\n\n\n#include <array>\n\n#include <iostream>\n\n#include <vector>\n\n\n\n#include <lsPointData.hpp>\n\n\n\n/// This class holds an explicit mesh, which is always given in 3 dimensions.\n\n/// If it describes a 2D mesh, the third dimension is set to 0.\n\n/// Vertices, Lines, Triangles, Tetras & Hexas are supported as geometric\n\n/// elements.\n\ntemplate <class T = double> class lsMesh {\n\npublic:\n\n std::vector<std::array<T, 3>> nodes;\n\n std::vector<std::array<unsigned, 1>> vertices;\n\n std::vector<std::array<unsigned, 2>> lines;\n\n std::vector<std::array<unsigned, 3>> triangles;\n\n std::vector<std::array<unsigned, 4>> tetras;\n", "file_path": "include/lsMesh.hpp", "rank": 60, "score": 89478.4159510585 }, { "content": " template <class ElementType>\n\n void replaceNode(ElementType &elements, std::pair<unsigned, unsigned> node) {\n\n for (unsigned i = 0; i < elements.size(); ++i) {\n\n for (unsigned j = 0; j < elements[i].size(); ++j) {\n\n if (elements[i][j] == node.first) {\n\n elements[i][j] = node.second;\n\n }\n\n }\n\n }\n\n };\n\n\n\npublic:\n\n const std::vector<std::array<T, 3>> &getNodes() const { return nodes; }\n\n\n\n std::vector<std::array<T, 3>> &getNodes() { return nodes; }\n\n\n\n template <int D, typename std::enable_if<D == 1, int>::type = 0>\n\n std::vector<std::array<unsigned, D>> &getElements() {\n\n return vertices;\n\n }\n", "file_path": "include/lsMesh.hpp", "rank": 61, "score": 89477.69750874299 }, { "content": " hexas.push_back(hexa);\n\n return hexas.size() - 1;\n\n }\n\n\n\n void removeDuplicateNodes() {\n\n std::vector<std::array<T, 3>> newNodes;\n\n // can just push first point since it cannot be duplicate\n\n newNodes.push_back(nodes[0]);\n\n // now check for duplicates\n\n // pair of oldId <-> newId\n\n std::vector<std::pair<unsigned, unsigned>> duplicates;\n\n bool adjusted = false;\n\n for (unsigned i = 1; i < nodes.size(); ++i) {\n\n auto it = find(newNodes.begin(), newNodes.end(), nodes[i]);\n\n if (it != newNodes.end()) {\n\n adjusted = true;\n\n // if duplicate point, save it to be replaced\n\n unsigned nodeId = std::distance(newNodes.begin(), it);\n\n duplicates.push_back(std::make_pair(i, nodeId));\n\n } else {\n", "file_path": "include/lsMesh.hpp", "rank": 62, "score": 89476.77083759659 }, { "content": "\n\n // append new nodes\n\n nodes.insert(nodes.end(), passedMesh.nodes.begin(), passedMesh.nodes.end());\n\n\n\n // go through all elements and increase node IDs to match new IDS\n\n const unsigned numberOfVertices = vertices.size();\n\n vertices.insert(vertices.end(), passedMesh.vertices.begin(),\n\n passedMesh.vertices.end());\n\n for (unsigned i = numberOfVertices;\n\n i < passedMesh.vertices.size() + numberOfVertices; ++i) {\n\n vertices[i][0] += numberOfOldNodes;\n\n }\n\n\n\n const unsigned numberOfLines = lines.size();\n\n lines.insert(lines.end(), passedMesh.lines.begin(), passedMesh.lines.end());\n\n for (unsigned i = numberOfLines;\n\n i < passedMesh.lines.size() + numberOfLines; ++i) {\n\n for (unsigned d = 0; d < 2; ++d) {\n\n lines[i][d] += numberOfOldNodes;\n\n }\n", "file_path": "include/lsMesh.hpp", "rank": 63, "score": 89476.69257365515 }, { "content": " }\n\n\n\n const unsigned numberOfTriangles = triangles.size();\n\n triangles.insert(triangles.end(), passedMesh.triangles.begin(),\n\n passedMesh.triangles.end());\n\n for (unsigned i = numberOfTriangles;\n\n i < passedMesh.triangles.size() + numberOfTriangles; ++i) {\n\n for (unsigned d = 0; d < 3; ++d) {\n\n triangles[i][d] += numberOfOldNodes;\n\n }\n\n }\n\n\n\n const unsigned numberOfTetras = tetras.size();\n\n tetras.insert(tetras.end(), passedMesh.tetras.begin(),\n\n passedMesh.tetras.end());\n\n for (unsigned i = numberOfTetras;\n\n i < passedMesh.tetras.size() + numberOfTetras; ++i) {\n\n for (unsigned d = 0; d < 4; ++d) {\n\n tetras[i][d] += numberOfOldNodes;\n\n }\n", "file_path": "include/lsMesh.hpp", "rank": 64, "score": 89475.59301599633 }, { "content": " if (adjusted)\n\n duplicates.push_back(std::make_pair(i, newNodes.size()));\n\n newNodes.push_back(nodes[i]);\n\n }\n\n }\n\n nodes = newNodes;\n\n\n\n // now replace in vertices\n\n // TODO also need to shift down all other nodes\n\n for (unsigned i = 0; i < duplicates.size(); ++i) {\n\n replaceNode(vertices, duplicates[i]);\n\n replaceNode(lines, duplicates[i]);\n\n replaceNode(triangles, duplicates[i]);\n\n replaceNode(tetras, duplicates[i]);\n\n replaceNode(hexas, duplicates[i]);\n\n }\n\n }\n\n\n\n void append(const lsMesh<T> &passedMesh) {\n\n const unsigned numberOfOldNodes = nodes.size();\n", "file_path": "include/lsMesh.hpp", "rank": 65, "score": 89475.41802564151 }, { "content": " dataPointer != nullptr) {\n\n const auto &currentData = *dataPointer;\n\n vectorData[i].push_back(currentData[it.getPointId()]);\n\n } else {\n\n lsMessage::getInstance()\n\n .addWarning(\"lsToMesh: Tried to access out of bounds vectorData! \"\n\n \"Ignoring.\")\n\n .print();\n\n break;\n\n }\n\n }\n\n }\n\n\n\n mesh->cellData.insertNextScalarData(LSValues, \"LSValues\");\n\n mesh->cellData.insertNextScalarData(subLS, \"SegmentID\");\n\n\n\n // append all scalar and vector data\n\n // just move it into the new structure, since we do not need it anymore\n\n for (unsigned i = 0; i < scalarData.size(); ++i) {\n\n mesh->cellData.insertNextScalarData(std::move(scalarData[i]),\n", "file_path": "include/lsToMesh.hpp", "rank": 66, "score": 89474.51893923675 }, { "content": " }\n\n\n\n const unsigned numberOfHexas = hexas.size();\n\n hexas.insert(hexas.end(), passedMesh.hexas.begin(), passedMesh.hexas.end());\n\n for (unsigned i = numberOfHexas;\n\n i < passedMesh.hexas.size() + numberOfHexas; ++i) {\n\n for (unsigned d = 0; d < 8; ++d) {\n\n hexas[i][d] += numberOfOldNodes;\n\n }\n\n }\n\n\n\n // Append data\n\n // TODO need to adjust lsVTKWriter to deal with different data correctly\n\n // currently this only works for vertex only meshes\n\n pointData.append(passedMesh.pointData);\n\n cellData.append(passedMesh.cellData);\n\n\n\n // if(lsPointData<T>::scalarData.size() < nodes.size())\n\n for (unsigned i = 0; i < pointData.getScalarDataSize(); ++i) {\n\n pointData.getScalarData(i)->resize(vertices.size());\n", "file_path": "include/lsMesh.hpp", "rank": 68, "score": 89473.81433019221 }, { "content": "\n\n // check if level set is empty\n\n if (levelSet->getNumberOfPoints() == 0) {\n\n return;\n\n }\n\n\n\n // LS data\n\n std::vector<T> LSValues;\n\n std::vector<T> subLS;\n\n // point data\n\n const auto &pointData = levelSet->getPointData();\n\n using DomainType = lsDomain<T, D>;\n\n using ScalarDataType = typename DomainType::PointDataType::ScalarDataType;\n\n using VectorDataType = typename DomainType::PointDataType::VectorDataType;\n\n\n\n // get all the data of the LS\n\n std::vector<ScalarDataType> scalarData;\n\n std::vector<VectorDataType> vectorData;\n\n scalarData.resize(pointData.getScalarDataSize());\n\n vectorData.resize(pointData.getVectorDataSize());\n", "file_path": "include/lsToMesh.hpp", "rank": 69, "score": 89472.43309873981 }, { "content": " }\n\n subLS.push_back(it.getSegmentId());\n\n\n\n // add all saved LS data\n\n for (unsigned i = 0; i < pointData.getScalarDataSize(); ++i) {\n\n if (const auto dataPointer = pointData.getScalarData(i);\n\n dataPointer != nullptr) {\n\n const auto &currentData = *dataPointer;\n\n scalarData[i].push_back(currentData[it.getPointId()]);\n\n } else {\n\n lsMessage::getInstance()\n\n .addWarning(\"lsToMesh: Tried to access out of bounds scalarData! \"\n\n \"Ignoring.\")\n\n .print();\n\n break;\n\n }\n\n }\n\n\n\n for (unsigned i = 0; i < pointData.getVectorDataSize(); ++i) {\n\n if (const auto dataPointer = pointData.getVectorData(i);\n", "file_path": "include/lsToMesh.hpp", "rank": 71, "score": 89471.86170408386 }, { "content": "\n\n template <int D, typename std::enable_if<D == 2, int>::type = 0>\n\n std::vector<std::array<unsigned, D>> &getElements() {\n\n return lines;\n\n }\n\n\n\n template <int D, typename std::enable_if<D == 3, int>::type = 0>\n\n std::vector<std::array<unsigned, D>> &getElements() {\n\n return triangles;\n\n }\n\n\n\n template <int D, typename std::enable_if<D == 4, int>::type = 0>\n\n std::vector<std::array<unsigned, D>> &getElements() {\n\n return tetras;\n\n }\n\n\n\n template <int D, typename std::enable_if<D == 8, int>::type = 0>\n\n std::vector<std::array<unsigned, D>> &getElements() {\n\n return hexas;\n\n }\n", "file_path": "include/lsMesh.hpp", "rank": 72, "score": 89470.38545181188 }, { "content": " pointData.clear();\n\n cellData.clear();\n\n }\n\n\n\n void print() {\n\n std::cout << \"lsMesh:\" << std::endl;\n\n std::cout << \"Number of Nodes: \" << nodes.size() << std::endl;\n\n if (vertices.size() > 0)\n\n std::cout << \"Number of Vertices: \" << vertices.size() << std::endl;\n\n if (lines.size() > 0)\n\n std::cout << \"Number of Lines: \" << lines.size() << std::endl;\n\n if (triangles.size() > 0)\n\n std::cout << \"Number of Triangles: \" << triangles.size() << std::endl;\n\n if (tetras.size() > 0)\n\n std::cout << \"Number of Tetrahedrons: \" << tetras.size() << std::endl;\n\n if (hexas.size() > 0)\n\n std::cout << \"Number of Hexas: \" << hexas.size() << std::endl;\n\n // pointData\n\n if (pointData.getScalarDataSize() > 0) {\n\n std::cout << \"Scalar data:\" << std::endl;\n", "file_path": "include/lsMesh.hpp", "rank": 74, "score": 89467.20915087993 }, { "content": " pointData.getScalarDataLabel(i));\n\n }\n\n\n\n for (unsigned i = 0; i < vectorData.size(); ++i) {\n\n mesh->cellData.insertNextVectorData(std::move(vectorData[i]),\n\n pointData.getVectorDataLabel(i));\n\n }\n\n }\n\n};\n\n\n\n// add all template specialisations for this class\n\nPRECOMPILE_PRECISION_DIMENSION(lsToMesh)\n\n\n\n#endif // LS_TO_MESH_HPP\n", "file_path": "include/lsToMesh.hpp", "rank": 75, "score": 89466.95873010477 }, { "content": " }\n\n if (cellData.getVectorDataSize() > 0) {\n\n std::cout << \"Vector data:\" << std::endl;\n\n for (unsigned i = 0; i < cellData.getVectorDataSize(); ++i) {\n\n std::cout << \" \\\"\" << cellData.getVectorDataLabel(i) << \"\\\" of size \"\n\n << cellData.getVectorData(i)->size() << std::endl;\n\n }\n\n }\n\n }\n\n};\n\n\n\n#endif // LS_MESH_HPP\n\n\n\n// add all template specialisations for this class\n\nPRECOMPILE_PRECISION(lsMesh);", "file_path": "include/lsMesh.hpp", "rank": 76, "score": 89466.05942617338 }, { "content": " }\n\n for (unsigned i = 0; i < pointData.getVectorDataSize(); ++i) {\n\n pointData.getVectorData(i)->resize(vertices.size());\n\n }\n\n\n\n for (unsigned i = 0; i < cellData.getScalarDataSize(); ++i) {\n\n cellData.getScalarData(i)->resize(vertices.size());\n\n }\n\n for (unsigned i = 0; i < cellData.getVectorDataSize(); ++i) {\n\n cellData.getVectorData(i)->resize(vertices.size());\n\n }\n\n }\n\n\n\n void clear() {\n\n nodes.clear();\n\n vertices.clear();\n\n lines.clear();\n\n triangles.clear();\n\n tetras.clear();\n\n hexas.clear();\n", "file_path": "include/lsMesh.hpp", "rank": 77, "score": 89465.8290843448 }, { "content": "\n\n lsPointData<T> &getPointData() { return pointData; }\n\n\n\n const lsPointData<T> &getPointData() const { return pointData; }\n\n\n\n lsPointData<T> &getCellData() { return cellData; }\n\n\n\n const lsPointData<T> &getCellData() const { return cellData; }\n\n\n\n unsigned insertNextNode(const std::array<T, 3> &node) {\n\n nodes.push_back(node);\n\n return nodes.size() - 1;\n\n }\n\n\n\n unsigned insertNextVertex(const std::array<unsigned, 1> &vertex) {\n\n vertices.push_back(vertex);\n\n return vertices.size() - 1;\n\n }\n\n\n\n unsigned insertNextLine(const std::array<unsigned, 2> &line) {\n", "file_path": "include/lsMesh.hpp", "rank": 78, "score": 89465.14229781451 }, { "content": " std::vector<std::array<unsigned, 8>> hexas;\n\n lsPointData<T> pointData;\n\n lsPointData<T> cellData;\n\n std::array<T, 3> minimumExtent;\n\n std::array<T, 3> maximumExtent;\n\n\n\nprivate:\n\n // iterator typedef\n\n using VectorIt = typename lsPointData<T>::VectorDataType::iterator;\n\n // find function to avoid including the whole algorithm header\n\n VectorIt find(VectorIt first, VectorIt last, const std::array<T, 3> &value) {\n\n for (; first != last; ++first) {\n\n if (*first == value) {\n\n return first;\n\n }\n\n }\n\n return last;\n\n }\n\n\n\n // helper function for duplicate removal\n", "file_path": "include/lsMesh.hpp", "rank": 79, "score": 89464.69664647446 }, { "content": " lines.push_back(line);\n\n return lines.size() - 1;\n\n }\n\n\n\n unsigned insertNextTriangle(const std::array<unsigned, 3> &triangle) {\n\n triangles.push_back(triangle);\n\n return triangles.size() - 1;\n\n }\n\n\n\n unsigned insertNextTetra(const std::array<unsigned, 4> &tetra) {\n\n tetras.push_back(tetra);\n\n return tetras.size() - 1;\n\n }\n\n\n\n unsigned insertNextHexa(const std::array<unsigned, 8> &hexa) {\n\n hexas.push_back(hexa);\n\n return hexas.size() - 1;\n\n }\n\n\n\n unsigned insertNextElement(const std::array<unsigned, 1> &vertex) {\n", "file_path": "include/lsMesh.hpp", "rank": 80, "score": 89460.265300533 }, { "content": " vertices.push_back(vertex);\n\n return vertices.size() - 1;\n\n }\n\n\n\n unsigned insertNextElement(const std::array<unsigned, 2> &line) {\n\n lines.push_back(line);\n\n return lines.size() - 1;\n\n }\n\n\n\n unsigned insertNextElement(const std::array<unsigned, 3> &triangle) {\n\n triangles.push_back(triangle);\n\n return triangles.size() - 1;\n\n }\n\n\n\n unsigned insertNextElement(const std::array<unsigned, 4> &tetra) {\n\n tetras.push_back(tetra);\n\n return tetras.size() - 1;\n\n }\n\n\n\n unsigned insertNextElement(const std::array<unsigned, 8> &hexa) {\n", "file_path": "include/lsMesh.hpp", "rank": 81, "score": 89460.265300533 }, { "content": " for (unsigned i = 0; i < pointData.getScalarDataSize(); ++i) {\n\n std::cout << \" \\\"\" << pointData.getScalarDataLabel(i) << \"\\\" of size \"\n\n << pointData.getScalarData(i)->size() << std::endl;\n\n }\n\n }\n\n if (pointData.getVectorDataSize() > 0) {\n\n std::cout << \"Vector data:\" << std::endl;\n\n for (unsigned i = 0; i < pointData.getVectorDataSize(); ++i) {\n\n std::cout << \" \\\"\" << pointData.getVectorDataLabel(i) << \"\\\" of size \"\n\n << pointData.getVectorData(i)->size() << std::endl;\n\n }\n\n }\n\n\n\n // cellData\n\n if (cellData.getScalarDataSize() > 0) {\n\n std::cout << \"Scalar data:\" << std::endl;\n\n for (unsigned i = 0; i < cellData.getScalarDataSize(); ++i) {\n\n std::cout << \" \\\"\" << cellData.getScalarDataLabel(i) << \"\\\" of size \"\n\n << cellData.getScalarData(i)->size() << std::endl;\n\n }\n", "file_path": "include/lsMesh.hpp", "rank": 82, "score": 89458.85287533753 }, { "content": "var include_2lsMesh_8hpp =\n\n[\n\n [ \"lsMesh\", \"classlsMesh.html\", \"classlsMesh\" ],\n\n [ \"PRECOMPILE_PRECISION\", \"include_2lsMesh_8hpp.html#a8d1dc953994a70ec3336eb78e1012b79\", null ]\n", "file_path": "docs/doxygen/html/include_2lsMesh_8hpp.js", "rank": 83, "score": 88919.75444396227 }, { "content": " /// triangles(=false), for each direction. Defaults to true for all\n\n /// directions.\n\n template <std::size_t N>\n\n void setRemoveBoundaryTriangles(\n\n std::array<bool, N> passedRemoveBoundaryTriangles) {\n\n for (unsigned i = 0; i < D && i < N; ++i) {\n\n removeBoundaryTriangles[i] = passedRemoveBoundaryTriangles[i];\n\n }\n\n }\n\n\n\n void apply() {\n\n if (levelSet == nullptr) {\n\n lsMessage::getInstance()\n\n .addWarning(\"No level set was passed to lsFromSurfaceMesh.\")\n\n .print();\n\n return;\n\n }\n\n if (mesh == nullptr) {\n\n lsMessage::getInstance()\n\n .addWarning(\"No mesh was passed to lsFromSurfaceMesh.\")\n", "file_path": "include/lsFromSurfaceMesh.hpp", "rank": 84, "score": 86914.08012797483 }, { "content": " gridSet = true;\n\n }\n\n\n\n void setMesh(lsSmartPointer<lsMesh<T>> passedMesh) { mesh = passedMesh; }\n\n\n\n void setRemoveBoundaryTriangles(bool passedRemoveBoundaryTriangles) {\n\n removeBoundaryTriangles = passedRemoveBoundaryTriangles;\n\n }\n\n\n\n std::vector<LevelSetType> getLevelSets() const { return levelSets; }\n\n\n\n void apply() {\n\n if (!gridSet) {\n\n lsMessage::getInstance()\n\n .addWarning(\"No grid has been set in lsFromVolumeMesh.\")\n\n .print();\n\n return;\n\n }\n\n if (mesh == nullptr) {\n\n lsMessage::getInstance()\n", "file_path": "include/lsFromVolumeMesh.hpp", "rank": 85, "score": 86913.6663136778 }, { "content": " using GridType = typename lsDomain<T, D>::GridType;\n\n\n\nprivate:\n\n LevelSetsType levelSets;\n\n lsSmartPointer<lsMesh<T>> mesh = nullptr;\n\n GridType grid;\n\n bool removeBoundaryTriangles = true;\n\n bool gridSet = false;\n\n\n\npublic:\n\n lsFromVolumeMesh() {}\n\n\n\n lsFromVolumeMesh(const GridType &passedGrid,\n\n lsSmartPointer<lsMesh<T>> passedMesh,\n\n bool passedRemoveBoundaryTriangles = true)\n\n : grid(passedGrid), mesh(passedMesh),\n\n removeBoundaryTriangles(passedRemoveBoundaryTriangles), gridSet(true) {}\n\n\n\n void setGrid(const GridType &passedGrid) {\n\n grid = passedGrid;\n", "file_path": "include/lsFromVolumeMesh.hpp", "rank": 86, "score": 86910.98374822082 }, { "content": "\n\n void setMesh(lsSmartPointer<lsMesh<N>> passedMesh) { mesh = passedMesh; }\n\n\n\n void setTranslator(lsSmartPointer<translatorType> passedTranslator) {\n\n translator = passedTranslator;\n\n buildTranslator = true;\n\n }\n\n\n\n void setMaxValue(const T passedMaxValue) { maxValue = passedMaxValue; }\n\n\n\n void apply() {\n\n if (levelSets.size() < 1) {\n\n lsMessage::getInstance()\n\n .addWarning(\"No level sets passed to lsToDiskMesh.\")\n\n .print();\n\n return;\n\n }\n\n if (mesh == nullptr) {\n\n lsMessage::getInstance()\n\n .addWarning(\"No mesh was passed to lsToDiskMesh.\")\n", "file_path": "include/lsToDiskMesh.hpp", "rank": 87, "score": 86910.10926145049 }, { "content": " .print();\n\n return;\n\n }\n\n if (buildTranslator && translator == nullptr) {\n\n lsMessage::getInstance()\n\n .addWarning(\"No translator was passed to lsToDiskMesh.\")\n\n .print();\n\n }\n\n\n\n mesh->clear();\n\n\n\n // expand top levelset\n\n lsExpand<T, D>(levelSets.back(), (maxValue * 4) + 1).apply();\n\n lsCalculateNormalVectors<T, D>(levelSets.back(), maxValue).apply();\n\n\n\n const T gridDelta = levelSets.back()->getGrid().getGridDelta();\n\n const auto &normalVectors =\n\n *(levelSets.back()->getPointData().getVectorData(\n\n lsCalculateNormalVectors<T, D>::normalVectorsLabel));\n\n\n", "file_path": "include/lsToDiskMesh.hpp", "rank": 88, "score": 86909.69731168122 }, { "content": " lsSmartPointer<lsDomain<T, D>> levelSet = nullptr;\n\n lsSmartPointer<lsMesh<T>> mesh = nullptr;\n\n // std::vector<hrleIndexType> meshNodeToPointIdMapping;\n\n const T epsilon;\n\n bool updatePointData = true;\n\n\n\npublic:\n\n lsToSurfaceMesh(double eps = 1e-12) : epsilon(eps) {}\n\n\n\n lsToSurfaceMesh(const lsSmartPointer<lsDomain<T, D>> passedLevelSet,\n\n lsSmartPointer<lsMesh<T>> passedMesh, double eps = 1e-12)\n\n : levelSet(passedLevelSet), mesh(passedMesh), epsilon(eps) {}\n\n\n\n void setLevelSet(lsSmartPointer<lsDomain<T, D>> passedlsDomain) {\n\n levelSet = passedlsDomain;\n\n }\n\n\n\n void setMesh(lsSmartPointer<lsMesh<T>> passedMesh) { mesh = passedMesh; }\n\n\n\n void setUpdatePointData(bool update) { updatePointData = update; }\n", "file_path": "include/lsToSurfaceMesh.hpp", "rank": 89, "score": 86909.46658469716 }, { "content": "\n\n /// Push level set to the list of level sets used for output.\n\n /// If more than one are specified, the voxels will be marked\n\n /// using a material number for each level set and output into\n\n /// a single mesh.\n\n void insertNextLevelSet(lsSmartPointer<lsDomain<T, D>> passedLevelSet) {\n\n levelSets.push_back(passedLevelSet);\n\n }\n\n\n\n void setMesh(lsSmartPointer<lsMesh<T>> passedMesh) { mesh = passedMesh; }\n\n\n\n void apply() {\n\n if (levelSets.size() < 1) {\n\n lsMessage::getInstance()\n\n .addWarning(\n\n \"No Level Sets supplied to lsToVoxelMesh! Not converting.\")\n\n .print();\n\n }\n\n if (mesh == nullptr) {\n\n lsMessage::getInstance()\n", "file_path": "include/lsToVoxelMesh.hpp", "rank": 90, "score": 86908.04484413279 }, { "content": " translator->clear();\n\n translator->reserve(normalVectors.size());\n\n }\n\n\n\n // an iterator for each levelset\n\n std::vector<hrleConstSparseIterator<hrleDomainType>> iterators;\n\n for (const auto levelSet : levelSets) {\n\n iterators.push_back(\n\n hrleConstSparseIterator<hrleDomainType>(levelSet->getDomain()));\n\n }\n\n\n\n // iterate over top levelset\n\n for (auto &topIt = iterators.back(); !topIt.isFinished(); ++topIt) {\n\n if (!topIt.isDefined() || std::abs(topIt.getValue()) > maxValue) {\n\n continue;\n\n }\n\n\n\n unsigned pointId = topIt.getPointId();\n\n\n\n // insert pointId-counter pair in translator\n", "file_path": "include/lsToDiskMesh.hpp", "rank": 91, "score": 86907.00614860152 }, { "content": " mesh(passedMesh), removeBoundaryTriangles{\n\n passedRemoveBoundaryTriangles,\n\n passedRemoveBoundaryTriangles,\n\n passedRemoveBoundaryTriangles} {}\n\n\n\n void setLevelSet(lsSmartPointer<lsDomain<T, D>> passedLevelSet) {\n\n levelSet = passedLevelSet;\n\n }\n\n\n\n void setMesh(lsSmartPointer<lsMesh<T>> passedMesh) { mesh = passedMesh; }\n\n\n\n /// Set whether all triangles outside of the domain should be ignored (=true)\n\n /// or whether boundary conditions should be applied correctly to such\n\n /// triangles(=false). Defaults to true.\n\n void setRemoveBoundaryTriangles(bool passedRemoveBoundaryTriangles) {\n\n removeBoundaryTriangles.fill(passedRemoveBoundaryTriangles);\n\n }\n\n\n\n /// Set whether all triangles outside of the domain should be ignored (=true)\n\n /// or whether boundary conditions should be applied correctly to such\n", "file_path": "include/lsFromSurfaceMesh.hpp", "rank": 92, "score": 86906.45478740432 }, { "content": " typedef typename lsDomain<T, D>::DomainType hrleDomainType;\n\n typedef std::unordered_map<unsigned long, unsigned long> translatorType;\n\n\n\n std::vector<lsSmartPointer<lsDomain<T, D>>> levelSets;\n\n lsSmartPointer<lsMesh<N>> mesh = nullptr;\n\n lsSmartPointer<translatorType> translator = nullptr;\n\n T maxValue = 0.5;\n\n bool buildTranslator = false;\n\n static constexpr double wrappingLayerEpsilon = 1e-4;\n\n\n\npublic:\n\n lsToDiskMesh() {}\n\n\n\n lsToDiskMesh(lsSmartPointer<lsMesh<N>> passedMesh, T passedMaxValue = 0.5)\n\n : mesh(passedMesh), maxValue(passedMaxValue) {}\n\n\n\n lsToDiskMesh(lsSmartPointer<lsDomain<T, D>> passedLevelSet,\n\n lsSmartPointer<lsMesh<N>> passedMesh, T passedMaxValue = 0.5)\n\n : mesh(passedMesh), maxValue(passedMaxValue) {\n\n levelSets.push_back(passedLevelSet);\n", "file_path": "include/lsToDiskMesh.hpp", "rank": 93, "score": 86906.36464593475 }, { "content": " const unsigned int corner0[12] = {0, 1, 2, 0, 4, 5, 6, 4, 0, 1, 3, 2};\n\n const unsigned int corner1[12] = {1, 3, 3, 2, 5, 7, 7, 6, 4, 5, 7, 6};\n\n const unsigned int direction[12] = {0, 1, 0, 1, 0, 1, 0, 1, 2, 2, 2, 2};\n\n\n\n // test if level set function consists of at least 2 layers of\n\n // defined grid points\n\n if (levelSet->getLevelSetWidth() < 2) {\n\n lsMessage::getInstance()\n\n .addWarning(\"Levelset is less than 2 layers wide. Export might fail!\")\n\n .print();\n\n }\n\n\n\n typedef typename std::map<hrleVectorType<hrleIndexType, D>, unsigned>\n\n nodeContainerType;\n\n\n\n nodeContainerType nodes[D];\n\n\n\n typename nodeContainerType::iterator nodeIt;\n\n\n\n lsInternal::lsMarchingCubes marchingCubes;\n", "file_path": "include/lsToSurfaceMesh.hpp", "rank": 94, "score": 86905.62821944096 }, { "content": " }\n\n }\n\n }\n\n\n\n // for all materials/for each surface\n\n // resize to empty levelsets, but they need grid information\n\n {\n\n levelSets.clear();\n\n for (unsigned i = 0; i < materialInts.size(); ++i) {\n\n auto ls = LevelSetType::New(grid);\n\n levelSets.push_back(ls);\n\n }\n\n }\n\n\n\n auto levelSetIterator = levelSets.begin();\n\n for (auto matIt = materialInts.begin(); matIt != materialInts.end();\n\n ++matIt) {\n\n auto currentSurface = lsSmartPointer<lsMesh<T>>::New();\n\n auto &meshElements = currentSurface->template getElements<D>();\n\n for (auto it = surfaceElements.begin(); it != surfaceElements.end();\n", "file_path": "include/lsFromVolumeMesh.hpp", "rank": 95, "score": 86905.40390199838 }, { "content": "\n\n void apply() {\n\n if (levelSet == nullptr) {\n\n lsMessage::getInstance()\n\n .addWarning(\"No level set was passed to lsToSurfaceMesh.\")\n\n .print();\n\n return;\n\n }\n\n if (mesh == nullptr) {\n\n lsMessage::getInstance()\n\n .addWarning(\"No mesh was passed to lsToSurfaceMesh.\")\n\n .print();\n\n return;\n\n }\n\n\n\n if (levelSet->getNumberOfPoints() == 0) {\n\n return;\n\n }\n\n\n\n mesh->clear();\n", "file_path": "include/lsToSurfaceMesh.hpp", "rank": 96, "score": 86905.01000994418 }, { "content": " }\n\n\n\n lsToDiskMesh(lsSmartPointer<lsDomain<T, D>> passedLevelSet,\n\n lsSmartPointer<lsMesh<N>> passedMesh,\n\n lsSmartPointer<translatorType> passedTranslator,\n\n T passedMaxValue = 0.5)\n\n : mesh(passedMesh), translator(passedTranslator),\n\n maxValue(passedMaxValue) {\n\n levelSets.push_back(passedLevelSet);\n\n buildTranslator = true;\n\n }\n\n\n\n void setLevelSet(lsSmartPointer<lsDomain<T, D>> passedLevelSet) {\n\n levelSets.push_back(passedLevelSet);\n\n }\n\n\n\n /// Pushes the passed level set to the back of the list of level sets\n\n void insertNextLevelSet(lsSmartPointer<lsDomain<T, D>> passedLevelSet) {\n\n levelSets.push_back(passedLevelSet);\n\n }\n", "file_path": "include/lsToDiskMesh.hpp", "rank": 97, "score": 86904.43337739239 }, { "content": "#ifndef LS_FROM_VOLUME_MESH_HPP\n\n#define LS_FROM_VOLUME_MESH_HPP\n\n\n\n#include <lsPreCompileMacros.hpp>\n\n\n\n#include <map>\n\n\n\n#include <lsDomain.hpp>\n\n#include <lsFromSurfaceMesh.hpp>\n\n#include <lsMesh.hpp>\n\n#include <lsMessage.hpp>\n\n\n\n/// This class creates a level set from a tetrahedral mesh.\n\n/// If the mesh contains a scalar data array called \"Material\",\n\n/// one level set for each material will be created and stored\n\n/// in the supplied std::vector<lsDomain<T,D>> object.\n\ntemplate <class T, int D> class lsFromVolumeMesh {\n\npublic:\n\n using LevelSetType = lsSmartPointer<lsDomain<T, D>>;\n\n using LevelSetsType = std::vector<LevelSetType>;\n", "file_path": "include/lsFromVolumeMesh.hpp", "rank": 98, "score": 86903.74602747093 }, { "content": " undefined_node);\n\n unsigned int NodeCounter = 0;\n\n\n\n for (unsigned int k = 0; k < meshElements.size(); ++k) {\n\n for (int h = 0; h < D; h++) {\n\n unsigned int origin_node = meshElements[k][h];\n\n if (nodeReplacements[origin_node] == undefined_node) {\n\n nodeReplacements[origin_node] = NodeCounter++;\n\n currentSurface->nodes.push_back(mesh->nodes[origin_node]);\n\n }\n\n meshElements[k][h] = nodeReplacements[origin_node];\n\n }\n\n }\n\n\n\n // create level set from surface\n\n lsFromSurfaceMesh<T, D>(*levelSetIterator, currentSurface,\n\n removeBoundaryTriangles)\n\n .apply();\n\n\n\n ++levelSetIterator;\n\n }\n\n }\n\n};\n\n\n\n// add all template specialisations for this class\n\nPRECOMPILE_PRECISION_DIMENSION(lsFromVolumeMesh)\n\n\n\n#endif // LS_FROM_VOLUME_MESH_HPP\n", "file_path": "include/lsFromVolumeMesh.hpp", "rank": 99, "score": 86903.19856377838 } ]
C++
qt/QtXdagWallet/pwddialog.cpp
sgaragagghu/QtXdagWallet
850fac4c6714edde4d91e58a8ca5a2d4602b9937
#include "PwdDialog.h" #include "ui_pwddialog.h" #include <QKeyEvent> PwdDialog::PwdDialog(QWidget *parent, PWD_DLG_TYPE type) : QDialog(parent), mDlgType(type), ui(new Ui::PwdDialog) { ui->setupUi(this); m_pLable = new QLabel; m_pLEPwd = new PwdLineEdit; m_pPBOK = new QPushButton(tr("OK")); m_pLable->setFixedSize(100,25); m_pLEPwd->setFixedSize(200,25); m_pPBOK->setFixedSize(60,25); m_pLable->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); m_pHBLInputPwd = new QHBoxLayout; m_pHBLInputPwd->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); m_pHBLInputPwd->addWidget(m_pLable); m_pHBLInputPwd->addWidget(m_pLEPwd); m_pHBLButton = new QHBoxLayout; m_pHBLButton->addWidget(m_pPBOK,Qt::AlignHCenter); m_pVBLGlobal = new QVBoxLayout; m_pVBLGlobal->setAlignment(Qt::AlignHCenter); m_pVBLGlobal->addLayout(m_pHBLInputPwd); m_pVBLGlobal->addLayout(m_pHBLButton); this->setLayout(m_pVBLGlobal); m_pLEPwd->installEventFilter(this); m_pPBOK->installEventFilter(this); setWindowIcon(QIcon(":/icon/xdagwallet.ico")); setWindowTitle(tr("Dagger Wallet(XDAG)")); setFixedSize(320,70); switch(type){ case DLG_TYPE_PWD: m_pLable->setText(tr("input password")); break; case DLG_SET_PWD: m_pLable->setText(tr("set password")); break; case DLG_RETYPE_PWD: m_pLable->setText(tr("confirm password")); break; case DLG_TYPE_RDM: m_pLable->setText(tr("set random keys")); break; } if(type == DLG_SET_PWD || type == DLG_RETYPE_PWD){ mPwdRegExp.setPatternSyntax(QRegExp::RegExp); mPwdRegExp.setCaseSensitivity(Qt::CaseSensitive); mPwdRegExp.setPattern(QString("^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$")); } connect(m_pPBOK,SIGNAL(clicked(bool)),this,SLOT(onBtnOKClicked())); } PwdDialog::~PwdDialog() { delete ui; } void PwdDialog::closeDialog() { this->close(); } void PwdDialog::onBtnOKClicked() { QString str = m_pLEPwd->text(); switch(mDlgType){ case DLG_TYPE_PWD: emit sendTypePwd(str); break; case DLG_SET_PWD: if(!mPwdRegExp.exactMatch(str)){ m_pErrDlg = new ErrorDialog(0,en_event_pwd_format_error); m_pErrDlg->exec(); return; } emit sendSetPwd(str); break; case DLG_RETYPE_PWD: if(!mPwdRegExp.exactMatch(str)){ m_pErrDlg = new ErrorDialog(0,en_event_pwd_format_error); m_pErrDlg->exec(); return; } emit sendRetypePwd(str); break; case DLG_TYPE_RDM: emit sendRdm(str); break; } this->accept(); } bool PwdDialog::eventFilter(QObject *obj, QEvent *event) { if(obj == m_pLEPwd || obj == m_pPBOK){ switch (event->type()) { case QEvent::MouseMove: case QEvent::MouseButtonDblClick: break; case QEvent::KeyPress: { QKeyEvent *pKeyEvent = static_cast<QKeyEvent*>(event); if(pKeyEvent->matches(QKeySequence::SelectAll) || pKeyEvent->matches(QKeySequence::Copy) || pKeyEvent->matches(QKeySequence::Paste)) { return true; } if(pKeyEvent->key() == Qt::Key_Tab || pKeyEvent->key() == Qt::Key_Left || pKeyEvent->key() == Qt::Key_Right || pKeyEvent->key() == Qt::Key_Up || pKeyEvent->key() == Qt::Key_Down){ return true; } } default: break; } } return QDialog::eventFilter(obj, event); } void PwdDialog::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Tab: case Qt::Key_Left: case Qt::Key_Right: case Qt::Key_Up: case Qt::Key_Down: break; default: QDialog::keyPressEvent(event); } }
#include "PwdDialog.h" #include "ui_pwddialog.h" #include <QKeyEvent> PwdDialog::PwdDialog(QWidget *parent, PWD_DLG_TYPE type) : QDialog(parent), mDlgType(type), ui(new Ui::PwdDialog) { ui->setupUi(this); m_pLable = new QLabel; m_pLEPwd = new PwdLineEdit; m_pPBOK = new QPushButton(tr("OK")); m_pLable->setFixedSize(100,25); m_pLEPwd->setFixedSize(200,25); m_pPBOK->setFixedSize(60,25); m_pLable->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); m_pHBLInputPwd = new QHBoxLayout; m_pHBLInputPwd->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); m_pHBLInputPwd->addWidget(m_pLable); m_pHBLInputPwd->addWidget(m_pLEPwd); m_pHBLButton = new QHBoxLayout; m_pHBLButton->addWidget(m_pPBOK,Qt::AlignHCenter); m_pVBLGlobal = new QVBoxLayout; m_pVBLGlobal->setAlignment(Qt::AlignHCenter); m_pVBLGlobal->addLayout(m_pHBLInputPwd); m_pVBLGlobal->addLayout(m_pHBLButton); this->setLayout(m_pVBLGlobal); m_pLEPwd->installEventFilter(this); m_pPBOK->installEventFilter(this); setWindowIcon(QIcon(":/icon/xdagwallet.ico")); setWindowTitle(tr("Dagger Wallet(XDAG)")); setFixedSize(320,70); switch(type){ case DLG_TYPE_PWD: m_pLable->setText(tr("input password")); break; case DLG_SET_PWD: m_pLable->setText(tr("set password")); break; case DLG_RETYPE_PWD: m_pLable->setText(tr("confirm password")); break; case DLG_TYPE_RDM: m_pLable->setText(tr("set random keys")); break; } if(type == DLG_SET_PWD || type == DLG_RETYPE_PWD){ mPwdRegExp.setPatternSyntax(QRegExp::RegExp); mPwdRegExp.setCaseSensitivity(Qt::CaseSensitive); mPwdRegExp.setPattern(QString("^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$")); } connect(m_pPBOK,SIGNAL(clicked(bool)),this,SLOT(onBtnOKClicked())); } PwdDialog::~PwdDialog() { delete ui; } void PwdDialog::closeDialog() { this->close(); } void PwdDialog::onBtnOKClicked() { QString str = m_pLEPwd->text(); switch(mDlgType){ case DLG_TYPE_PWD: emit sendTypePwd(str); break; case DLG_SET_PWD: if(!mPwdRegExp.exactMatch(str)){ m_pErrDlg = new ErrorDialog(0,en_event_pwd_format_error); m_pErrDlg->exec(); return; } emit sendSetPwd(str); break; case DLG_RETYPE_PWD: if(!mPwdRegExp.exactMatch(str)){ m_pErrDlg = new ErrorDialog(0,en_event_pwd_format_error); m_pErrDlg->exec(); return; } emit sendRetypePwd(str); break; case DLG_TYPE_RDM: emit sendRdm(str); break; } this->accept(); } bool PwdDialog::eventFilter(QObject *obj, QEvent *event) { if(obj == m_pLEPwd || obj == m_pPBOK){ switch (event->type()) { case QEvent::MouseMove: case QEvent::MouseButtonDblClick: break; case QEvent::KeyPress: { QKeyEvent *pKeyEvent = static_cast<QKeyEvent*>(event);
void PwdDialog::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Tab: case Qt::Key_Left: case Qt::Key_Right: case Qt::Key_Up: case Qt::Key_Down: break; default: QDialog::keyPressEvent(event); } }
if(pKeyEvent->matches(QKeySequence::SelectAll) || pKeyEvent->matches(QKeySequence::Copy) || pKeyEvent->matches(QKeySequence::Paste)) { return true; } if(pKeyEvent->key() == Qt::Key_Tab || pKeyEvent->key() == Qt::Key_Left || pKeyEvent->key() == Qt::Key_Right || pKeyEvent->key() == Qt::Key_Up || pKeyEvent->key() == Qt::Key_Down){ return true; } } default: break; } } return QDialog::eventFilter(obj, event); }
function_block-function_prefix_line
[ { "content": "#define OBJ_id_it_encKeyPairTypes OBJ_id_it,3L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 0, "score": 156120.08268075265 }, { "content": "#define OBJ_id_it_signKeyPairTypes OBJ_id_it,2L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 1, "score": 156120.08268075265 }, { "content": "#define OBJ_X9_62_id_publicKeyType OBJ_ansi_X9_62,2L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 2, "score": 156120.08268075265 }, { "content": "#define SN_id_it_encKeyPairTypes \"id-it-encKeyPairTypes\"\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 3, "score": 142844.86299714865 }, { "content": "#define NID_id_it_encKeyPairTypes 300\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 4, "score": 142844.86299714865 }, { "content": "#define NID_id_it_signKeyPairTypes 299\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 5, "score": 142844.86299714865 }, { "content": "#define SN_id_it_signKeyPairTypes \"id-it-signKeyPairTypes\"\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 6, "score": 142844.86299714865 }, { "content": "#define OBJ_userPassword OBJ_X509,35L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 7, "score": 123535.83803320653 }, { "content": "#define OBJ_crlTypes OBJ_pkcs9,23L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 8, "score": 123446.87422028801 }, { "content": "#define OBJ_certTypes OBJ_pkcs9,22L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 9, "score": 123446.87422028801 }, { "content": "#define OBJ_key_usage OBJ_id_ce,15L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 10, "score": 123424.82070638395 }, { "content": "#define OBJ_keyBag OBJ_pkcs12_BagIds,1L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 11, "score": 123424.82070638395 }, { "content": "#define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 12, "score": 121435.10522424076 }, { "content": "#define OBJ_netscape_cert_type OBJ_netscape_cert_extension,1L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 13, "score": 121347.88017497299 }, { "content": "#define OBJ_pilotAttributeType OBJ_pilot,1L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 14, "score": 121347.88017497299 }, { "content": "#define OBJ_selected_attribute_types OBJ_joint_iso_itu_t,5L,1L,5L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 15, "score": 121347.88017497299 }, { "content": "#define OBJ_netscape_data_type OBJ_netscape,2L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 16, "score": 121347.88017497299 }, { "content": "#define OBJ_pkcs9_contentType OBJ_pkcs9,3L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 17, "score": 121347.88017497299 }, { "content": "#define OBJ_localKeyID OBJ_pkcs9,21L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 18, "score": 121326.2576885518 }, { "content": "#define OBJ_anyExtendedKeyUsage OBJ_ext_key_usage,0L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 19, "score": 121326.2576885518 }, { "content": "#define OBJ_LocalKeySet 1L,3L,6L,1L,4L,1L,311L,17L,2L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 20, "score": 121326.2576885518 }, { "content": "#define OBJ_subject_key_identifier OBJ_id_ce,14L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 21, "score": 121326.2576885518 }, { "content": "#define OBJ_dhKeyAgreement OBJ_pkcs3,1L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 22, "score": 121326.2576885518 }, { "content": "#define OBJ_authority_key_identifier OBJ_id_ce,35L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 23, "score": 121326.2576885518 }, { "content": "#define OBJ_ext_key_usage OBJ_id_ce,37L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 24, "score": 121326.2576885518 }, { "content": "#define OBJ_id_cmc_dataReturn OBJ_id_cmc,4L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 25, "score": 119415.21878455742 }, { "content": "#define OBJ_id_PasswordBasedMAC OBJ_ISO_US,113533L,7L,66L,13L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 26, "score": 119406.83124506702 }, { "content": "#define OBJ_X9_62_id_fieldType OBJ_ansi_X9_62,1L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 27, "score": 119321.27829543344 }, { "content": "#define OBJ_setCext_certType OBJ_set_certExt,1L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 28, "score": 119321.27829543344 }, { "content": "#define OBJ_setAttr_TokenType OBJ_set_attr,2L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 29, "score": 119321.27829543344 }, { "content": "#define OBJ_setCext_TokenType OBJ_set_certExt,10L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 30, "score": 119321.27829543344 }, { "content": "#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds,2L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 31, "score": 119300.0703109465 }, { "content": "#define OBJ_set_rootKeyThumb OBJ_setAttr_Cert,0L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 32, "score": 119300.0703109465 }, { "content": "#define OBJ_private_key_usage_period OBJ_id_ce,16L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 33, "score": 119300.0703109465 }, { "content": "#define OBJ_caseIgnoreIA5StringSyntax OBJ_pilotAttributeSyntax,5L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 34, "score": 117455.46560271799 }, { "content": "#define OBJ_id_cmc_popLinkRandom OBJ_id_cmc,22L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 35, "score": 117450.50776557937 }, { "content": "#define OBJ_X9_62_id_ecSigType OBJ_ansi_X9_62,4L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 36, "score": 117363.2920752957 }, { "content": "#define OBJ_id_smime_aa_signatureType OBJ_id_smime_aa,28L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 37, "score": 117363.2920752957 }, { "content": "#define OBJ_id_it_keyPairParamRep OBJ_id_it,11L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 38, "score": 117342.48299969999 }, { "content": "#define OBJ_X9_62_id_ecPublicKey OBJ_X9_62_id_publicKeyType,1L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 39, "score": 117342.48299969999 }, { "content": "#define OBJ_id_it_caKeyUpdateInfo OBJ_id_it,5L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 40, "score": 117342.48299969999 }, { "content": "#define OBJ_id_it_keyPairParamReq OBJ_id_it,10L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 41, "score": 117342.48299969999 }, { "content": "#define OBJ_id_Gost28147_89_None_KeyMeshing OBJ_cryptopro,14L,0L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 42, "score": 117342.48299969999 }, { "content": " int type; /* NID for compression library */\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/comp.h", "rank": 43, "score": 117015.46721018734 }, { "content": " unsigned char type;\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/dtls1.h", "rank": 44, "score": 117015.46721018734 }, { "content": " */ int type;\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/ssl3.h", "rank": 45, "score": 117015.46721018734 }, { "content": " ASN1_OBJECT *type;\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/pkcs7.h", "rank": 46, "score": 117015.46721018734 }, { "content": " int type;\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/evp.h", "rank": 47, "score": 117015.46721018734 }, { "content": " int type;\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/objects.h", "rank": 48, "score": 117015.46721018734 }, { "content": " int type;\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/x509v3.h", "rank": 49, "score": 117015.46721018734 }, { "content": " int type; /* what type of object */\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/pem.h", "rank": 50, "score": 117015.46721018734 }, { "content": " int type;\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/bio.h", "rank": 51, "score": 117015.46721018734 }, { "content": " int type;\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/ssl.h", "rank": 52, "score": 117015.46721018734 }, { "content": " ASN1_OBJECT *type;\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/x509.h", "rank": 53, "score": 117015.46721018734 }, { "content": " int type;\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/ocsp.h", "rank": 54, "score": 117015.46721018734 }, { "content": " ASN1_OBJECT *type;\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/pkcs12.h", "rank": 55, "score": 117015.46721018734 }, { "content": " int type;\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/asn1.h", "rank": 56, "score": 117015.46721018734 }, { "content": " unsigned char *key; /* key */\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/pem.h", "rank": 57, "score": 117013.29572782942 }, { "content": " X509_PUBKEY *key;\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/x509.h", "rank": 58, "score": 117009.73258375973 }, { "content": " krb5_octet FAR *key;\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/kssl.h", "rank": 59, "score": 117009.73258375973 }, { "content": " unsigned char key[HMAC_MAX_MD_CBLOCK];\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/hmac.h", "rank": 60, "score": 117009.73258375973 }, { "content": " X509_STORE_CTX *parent;\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/x509_vfy.h", "rank": 61, "score": 115531.32160029403 }, { "content": "#define OBJ_id_smime_aa_ets_commitmentType OBJ_id_smime_aa,16L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 62, "score": 115470.40839897038 }, { "content": "#define OBJ_id_smime_aa_encapContentType OBJ_id_smime_aa,6L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 63, "score": 115470.40839897038 }, { "content": "#define OBJ_id_regCtrl_protocolEncrKey OBJ_id_regCtrl,6L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 64, "score": 115449.98350286444 }, { "content": "#define OBJ_id_smime_aa_encrypKeyPref OBJ_id_smime_aa,11L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 65, "score": 115449.98350286444 }, { "content": "#define OBJ_id_Gost28147_89_CryptoPro_KeyMeshing OBJ_cryptopro,14L,1L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 66, "score": 115449.98350286444 }, { "content": " int type;\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/x509_vfy.h", "rank": 67, "score": 115403.99829671938 }, { "content": " int new_mac_pkey_type;\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/ssl3.h", "rank": 68, "score": 114318.05970047697 }, { "content": "#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids,3L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 69, "score": 113619.29998509565 }, { "content": "#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids,4L\n\n\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 70, "score": 113619.29998509565 }, { "content": "#define NID_userPassword 879\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 71, "score": 110401.78098620613 }, { "content": "#define LN_userPassword \"userPassword\"\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 72, "score": 110401.78098620613 }, { "content": "#define LN_keyBag \"keyBag\"\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 73, "score": 110290.76365938358 }, { "content": "#define LN_key_usage \"X509v3 Key Usage\"\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 74, "score": 110290.76365938358 }, { "content": "#define SN_key_usage \"keyUsage\"\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 75, "score": 110290.76365938358 }, { "content": "#define NID_keyBag 150\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 76, "score": 110290.76365938358 }, { "content": "#define NID_key_usage 83\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 77, "score": 110290.76365938358 }, { "content": "#define NID_pkcs9_challengePassword 54\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 78, "score": 108244.02046021883 }, { "content": "#define LN_pkcs9_challengePassword \"challengePassword\"\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 79, "score": 108244.02046021883 }, { "content": "#define LN_netscape_data_type \"Netscape Data Type\"\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 80, "score": 108156.79541095105 }, { "content": "#define SN_selected_attribute_types \"selected-attribute-types\"\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 81, "score": 108156.79541095105 }, { "content": "#define NID_netscape_data_type 59\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 82, "score": 108156.79541095105 }, { "content": "#define LN_selected_attribute_types \"Selected Attribute Types\"\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 83, "score": 108156.79541095105 }, { "content": "#define SN_netscape_cert_type \"nsCertType\"\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 84, "score": 108156.79541095105 }, { "content": "#define NID_pkcs9_contentType 50\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 85, "score": 108156.79541095105 }, { "content": "#define SN_netscape_data_type \"nsDataType\"\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 86, "score": 108156.79541095105 }, { "content": "#define NID_selected_attribute_types 394\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 87, "score": 108156.79541095105 }, { "content": "#define LN_pkcs9_contentType \"contentType\"\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 88, "score": 108156.79541095105 }, { "content": "#define LN_netscape_cert_type \"Netscape Cert Type\"\n", "file_path": "qt/QtXdagWallet/win64_dependency/include/openssl/obj_mac.h", "rank": 89, "score": 108156.79541095105 }, { "content": "struct xdag_public_key *xdag_wallet_our_keys(int *pnkeys)\n\n{\n\n\t*pnkeys = nkeys;\n\n\n\n\treturn keys_arr;\n", "file_path": "xdaglib/client/wallet.c", "rank": 93, "score": 5.842558182461529 }, { "content": "int xdag_wallet_new_key(void)\n\n{\n\n\tint res = add_key(0);\n\n\n\n\tif (!res)\n\n\t\tres = nkeys - 1;\n\n\n\n\treturn res;\n", "file_path": "xdaglib/client/wallet.c", "rank": 94, "score": 5.093489151398496 }, { "content": " m_pDLPwdType->exec();\n\n break;\n\n\n\n //notify error\n\n case en_event_pwd_error:\n\n case en_event_pwd_not_same:\n\n case en_event_pwd_format_error:\n\n case en_event_nothing_transfer:\n\n case en_event_balance_too_small:\n\n case en_event_invalid_recv_address:\n\n {\n\n m_pErrDlg = new ErrorDialog(0,info.event_type);\n\n m_pErrDlg->exec();\n\n }\n\n break;\n\n\n\n //update ui info\n\n case en_event_update_state:\n\n procUpdateUiInfo(info);\n\n break;\n", "file_path": "qt/QtXdagWallet/qtwalletmain.cpp", "rank": 95, "score": 4.9458990167872185 }, { "content": "struct xdag_public_key *xdag_wallet_default_key(int *n_key)\n\n{\n\n\tif (nkeys) {\n\n\t\tif (n_key) {\n\n\t\t\t*n_key = nkeys - 1;\n\n\t\t\treturn keys_arr + nkeys - 1;\n\n\t\t}\n\n\t}\n\n\n\n\treturn 0;\n", "file_path": "xdaglib/client/wallet.c", "rank": 96, "score": 4.8976429661163055 }, { "content": "#include \"PwdLineEdit.h\"\n\n#include <QKeyEvent>\n\n\n\nPwdLineEdit::PwdLineEdit(QWidget *parent)\n\n{\n\n this->setEchoMode(QLineEdit::Password);\n\n}\n\n\n\nvoid PwdLineEdit::keyPressEvent(QKeyEvent *event)\n\n{\n\n if(event->matches(QKeySequence::SelectAll)\n\n || event->matches(QKeySequence::Copy)\n\n || event->matches(QKeySequence::Paste))\n\n {\n\n return;\n\n }\n\n\n\n QLineEdit::keyPressEvent(event);\n\n}\n\n\n", "file_path": "qt/QtXdagWallet/PwdLineEdit.cpp", "rank": 97, "score": 4.673361363613678 }, { "content": " st_xdag_app_msg *msg = NULL;\n\n UpdateUiInfo updateUiInfo;\n\n switch(event->event_type){\n\n\n\n case en_event_type_pwd:\n\n {\n\n qDebug() << \" event type need type password current threadid \" << QThread::currentThreadId();\n\n\n\n mutex->lock();\n\n qDebug() << \" en_event_type_pwd lock \" << QThread::currentThreadId();\n\n updateUiInfo.event_type = event->event_type;\n\n updateUiInfo.procedure_type = event->procedure_type;\n\n thread->emitUISignal(updateUiInfo);\n\n\n\n //wait ui type password\n\n thread->waitAuthTyped();\n\n\n\n QMap<QString, QString>::iterator it;\n\n it = thread->getMsgMap()->find(\"type-passwd\");\n\n\n", "file_path": "qt/QtXdagWallet/XdagWalletProcessThread.cpp", "rank": 98, "score": 4.614001153177996 }, { "content": "void *xdag_private_to_key(const xdag_hash_t privkey, xdag_hash_t pubkey, uint8_t *pubkey_bit)\n\n{\n\n\tuint8_t buf[sizeof(xdag_hash_t) + 1];\n\n\tEC_KEY *eckey = 0;\n\n\tBIGNUM *priv = 0;\n\n\tEC_POINT *pub = 0;\n\n\tBN_CTX *ctx = 0;\n\n\tint res = -1;\n\n\n\n\tif (!group) {\n\n\t\tgoto fail;\n\n\t}\n\n\n\n\teckey = EC_KEY_new();\n\n\tif (!eckey) {\n\n\t\tgoto fail;\n\n\t}\n\n\n\n\tif (!EC_KEY_set_group(eckey, group)) {\n\n\t\tgoto fail;\n\n\t}\n\n\n\n\tpriv = BN_new();\n\n\tif (!priv) {\n\n\t\tgoto fail;\n\n\t}\n\n\n\n\t//\tBN_init(priv);\n\n\tBN_bin2bn((uint8_t*)privkey, sizeof(xdag_hash_t), priv);\n\n\tEC_KEY_set_private_key(eckey, priv);\n\n\t\n\n\tctx = BN_CTX_new();\n\n\tif (!ctx) {\n\n\t\tgoto fail;\n\n\t}\n\n\n\n\tBN_CTX_start(ctx);\n\n\n\n\tpub = EC_POINT_new(group);\n\n\tif (!pub) {\n\n\t\tgoto fail;\n\n\t}\n\n\n\n\tEC_POINT_mul(group, pub, priv, NULL, NULL, ctx);\n\n\tEC_KEY_set_public_key(eckey, pub);\n\n\tif (EC_POINT_point2oct(group, pub, POINT_CONVERSION_COMPRESSED, buf, sizeof(xdag_hash_t) + 1, ctx) != sizeof(xdag_hash_t) + 1) {\n\n\t\tgoto fail;\n\n\t}\n\n\n\n\tmemcpy(pubkey, buf + 1, sizeof(xdag_hash_t));\n\n\t*pubkey_bit = *buf & 1;\n\n\tres = 0;\n\n\n\n fail:\n\n\tif (ctx) {\n\n\t\tBN_CTX_free(ctx);\n\n\t}\n\n\n\n\tif (priv) {\n\n\t\tBN_free(priv);\n\n\t}\n\n\n\n\tif (pub) {\n\n\t\tEC_POINT_free(pub);\n\n\t}\n\n\n\n\tif (res && eckey) {\n\n\t\tEC_KEY_free(eckey);\n\n\t}\n\n\n\n\treturn res ? 0 : eckey;\n", "file_path": "xdaglib/client/crypt.c", "rank": 99, "score": 4.5474358411570694 } ]
C++
extlib/include/xyginext/ecs/systems/DynamicTreeSystem.hpp
fallahn/speljongen
57cb5e09eec7db8c21ee7b3e7943fa0a76738c51
#pragma once #include "xyginext/ecs/System.hpp" #include <SFML/Graphics/Rect.hpp> #include <vector> #include <limits> #include <cstdint> #include <array> namespace xy { struct TreeNode final { static constexpr std::int32_t Null = -1; bool isLeaf() const { return childA == Null; } sf::FloatRect fatBounds; xy::Entity entity; union { std::int32_t parent; std::int32_t next; }; std::int32_t childA = Null; std::int32_t childB = Null; std::int32_t height = Null; }; class XY_EXPORT_API DynamicTreeSystem final : public xy::System { public: explicit DynamicTreeSystem(xy::MessageBus&); void process(float) override; void onEntityAdded(xy::Entity) override; void onEntityRemoved(xy::Entity) override; std::vector<xy::Entity> query(sf::FloatRect area, std::uint64_t filter = std::numeric_limits<std::uint64_t>::max()) const; private: std::int32_t addToTree(xy::Entity); void removeFromTree(std::int32_t); bool moveNode(std::int32_t, sf::FloatRect, sf::Vector2f); sf::FloatRect getFatAABB(std::int32_t) const; std::int32_t getMaxBalance() const; float getAreaRatio() const; std::int32_t allocateNode(); void freeNode(std::int32_t); void insertLeaf(std::int32_t); void removeLeaf(std::int32_t); std::int32_t balance(std::int32_t); std::int32_t computeHeight() const; std::int32_t computeHeight(std::int32_t) const; void validateStructure(std::int32_t) const; void validateMetrics(std::int32_t) const; std::int32_t m_root; std::size_t m_nodeCount; std::size_t m_nodeCapacity; std::vector<TreeNode> m_nodes; std::int32_t m_freeList; std::size_t m_path; std::size_t m_insertionCount; }; namespace Detail { template <typename T, std::size_t SIZE> class FixedStack final { public: T pop() { XY_ASSERT(m_size != 0, "Stack is empty!"); m_size--; return m_data[m_size]; } void push(T data) { XY_ASSERT(m_size < m_data.size(), "Stack is full!"); m_data[m_size++] = data; } std::size_t size() const { return m_size; } private: std::array<T, SIZE> m_data; std::size_t m_size = 0; }; } }
#pragma once #include "xyginext/ecs/System.hpp" #include <SFML/Graphics/Rect.hpp> #include <vector> #include <limits> #include <cstdint> #include <array> namespace xy { struct TreeNode final { static constexpr std::int32_t Null = -1; bool isLeaf() const { return childA == Null; } sf::FloatRect fatBounds; xy::Entity entity; union { std::int32_t parent;
: public xy::System { public: explicit DynamicTreeSystem(xy::MessageBus&); void process(float) override; void onEntityAdded(xy::Entity) override; void onEntityRemoved(xy::Entity) override; std::vector<xy::Entity> query(sf::FloatRect area, std::uint64_t filter = std::numeric_limits<std::uint64_t>::max()) const; private: std::int32_t addToTree(xy::Entity); void removeFromTree(std::int32_t); bool moveNode(std::int32_t, sf::FloatRect, sf::Vector2f); sf::FloatRect getFatAABB(std::int32_t) const; std::int32_t getMaxBalance() const; float getAreaRatio() const; std::int32_t allocateNode(); void freeNode(std::int32_t); void insertLeaf(std::int32_t); void removeLeaf(std::int32_t); std::int32_t balance(std::int32_t); std::int32_t computeHeight() const; std::int32_t computeHeight(std::int32_t) const; void validateStructure(std::int32_t) const; void validateMetrics(std::int32_t) const; std::int32_t m_root; std::size_t m_nodeCount; std::size_t m_nodeCapacity; std::vector<TreeNode> m_nodes; std::int32_t m_freeList; std::size_t m_path; std::size_t m_insertionCount; }; namespace Detail { template <typename T, std::size_t SIZE> class FixedStack final { public: T pop() { XY_ASSERT(m_size != 0, "Stack is empty!"); m_size--; return m_data[m_size]; } void push(T data) { XY_ASSERT(m_size < m_data.size(), "Stack is full!"); m_data[m_size++] = data; } std::size_t size() const { return m_size; } private: std::array<T, SIZE> m_data; std::size_t m_size = 0; }; } }
std::int32_t next; }; std::int32_t childA = Null; std::int32_t childB = Null; std::int32_t height = Null; }; class XY_EXPORT_API DynamicTreeSystem final
random
[]
C++
src/platform/shm_win.cpp
nickhuangxinyu/cpp-ipc
64f4104b741b6f283906d01177d4e70bcdb8d6a0
#include "shm.h" #include <Windows.h> #include <string> #include <utility> #include "def.h" #include "log.h" #include "pool_alloc.h" #include "platform/to_tchar.h" #include "platform/get_sa.h" #include "memory/resource.h" namespace { struct id_info_t { HANDLE h_ = NULL; void* mem_ = nullptr; std::size_t size_ = 0; }; } namespace ipc { namespace shm { id_t acquire(char const * name, std::size_t size, unsigned mode) { if (name == nullptr || name[0] == '\0') { ipc::error("fail acquire: name is empty\n"); return nullptr; } HANDLE h; auto fmt_name = ipc::detail::to_tchar(ipc::string{"__IPC_SHM__"} + name); if (mode == open) { h = ::OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, fmt_name.c_str()); } else { h = ::CreateFileMapping(INVALID_HANDLE_VALUE, detail::get_sa(), PAGE_READWRITE | SEC_COMMIT, 0, static_cast<DWORD>(size), fmt_name.c_str()); if ((mode == create) && (::GetLastError() == ERROR_ALREADY_EXISTS)) { ::CloseHandle(h); h = NULL; } } if (h == NULL) { ipc::error("fail CreateFileMapping/OpenFileMapping[%d]: %s\n", static_cast<int>(::GetLastError()), name); return nullptr; } auto ii = mem::alloc<id_info_t>(); ii->h_ = h; ii->size_ = size; return ii; } void * get_mem(id_t id, std::size_t * size) { if (id == nullptr) { ipc::error("fail get_mem: invalid id (null)\n"); return nullptr; } auto ii = static_cast<id_info_t*>(id); if (ii->mem_ != nullptr) { if (size != nullptr) *size = ii->size_; return ii->mem_; } if (ii->h_ == NULL) { ipc::error("fail to_mem: invalid id (h = null)\n"); return nullptr; } LPVOID mem = ::MapViewOfFile(ii->h_, FILE_MAP_ALL_ACCESS, 0, 0, 0); if (mem == NULL) { ipc::error("fail MapViewOfFile[%d]\n", static_cast<int>(::GetLastError())); return nullptr; } MEMORY_BASIC_INFORMATION mem_info; if (::VirtualQuery(mem, &mem_info, sizeof(mem_info)) == 0) { ipc::error("fail VirtualQuery[%d]\n", static_cast<int>(::GetLastError())); return nullptr; } ii->mem_ = mem; ii->size_ = static_cast<std::size_t>(mem_info.RegionSize); if (size != nullptr) *size = ii->size_; return static_cast<void *>(mem); } void release(id_t id) { if (id == nullptr) { ipc::error("fail release: invalid id (null)\n"); return; } auto ii = static_cast<id_info_t*>(id); if (ii->mem_ == nullptr || ii->size_ == 0) { ipc::error("fail release: invalid id (mem = %p, size = %zd)\n", ii->mem_, ii->size_); } else ::UnmapViewOfFile(static_cast<LPCVOID>(ii->mem_)); if (ii->h_ == NULL) { ipc::error("fail release: invalid id (h = null)\n"); } else ::CloseHandle(ii->h_); mem::free(ii); } void remove(id_t id) { if (id == nullptr) { ipc::error("fail release: invalid id (null)\n"); return; } release(id); } void remove(char const * name) { if (name == nullptr || name[0] == '\0') { ipc::error("fail remove: name is empty\n"); return; } } } }
#include "shm.h" #include <Windows.h> #include <string> #include <utility> #include "def.h" #include "log.h" #include "pool_alloc.h" #include "platform/to_tchar.h" #include "platform/get_sa.h" #include "memory/resource.h" namespace { struct id_info_t { HANDLE h_ = NULL; void* mem_ = nullptr; std::size_t size_ = 0; }; } namespace ipc { namespace shm { id_t acquire(char const * name, std::size_t size, unsigned mode) { if (name == nullptr || name[0] == '\0') { ipc::error("fail acquire: name is empty\n"); return nullptr; } HANDLE h; auto fmt_name = ipc::detail::to_tchar(ipc::string{"__IPC_SHM__"} + name); if (mode == open) { h = ::OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, fmt_name.c_str()); } else { h = ::CreateFileMapping(INVALID_HANDLE_VALUE, detail::get_sa(), PAGE_READWRITE | SEC_COMMIT, 0, static_cast<DWORD>(size), fmt_name.c_str()); if ((mode == create) && (::GetLastError() == ERROR_ALREADY_EXISTS)) { ::CloseHandle(h); h = NULL; } } if (h == NULL) { ipc::error("fail CreateFileMapping/OpenFileMapping[%d]: %s\n", static_cast<int>(::GetLastError()), name); return nullptr; } auto ii = mem::alloc<id_info_t>(); ii->h_ = h; ii->size_ = size; return ii; } void * get_mem(id_t id, std::size_t * size) { if (id == nullptr) { ipc::error("fail get_mem: invalid id (null)\n"); return nullptr; } auto ii = static_cast<id_info_t*>(id); if (ii->mem_ != nullptr) { if (size != nullptr) *size = ii->size_; return ii->mem_; } if (ii->h_ == NULL) { ipc::error("fail to_mem: invalid id (h = null)\n"); return nullptr; } LPVOID mem = ::MapViewOfFile(ii->h_, FILE_MAP_ALL_ACCESS, 0, 0, 0); if (mem == NULL) { ipc::error("fail MapViewOfFile[%d]\n", static_cast<int>(::GetLastError())); return nullptr; } MEMORY_BASIC_INFORMATION mem_info; if (::VirtualQuery(mem, &mem_info, sizeof(mem_info)) == 0) { ipc::error("fail VirtualQuery[%d]\n", static_cast<int>(::GetLastError())); return nullptr; }
void release(id_t id) { if (id == nullptr) { ipc::error("fail release: invalid id (null)\n"); return; } auto ii = static_cast<id_info_t*>(id); if (ii->mem_ == nullptr || ii->size_ == 0) { ipc::error("fail release: invalid id (mem = %p, size = %zd)\n", ii->mem_, ii->size_); } else ::UnmapViewOfFile(static_cast<LPCVOID>(ii->mem_)); if (ii->h_ == NULL) { ipc::error("fail release: invalid id (h = null)\n"); } else ::CloseHandle(ii->h_); mem::free(ii); } void remove(id_t id) { if (id == nullptr) { ipc::error("fail release: invalid id (null)\n"); return; } release(id); } void remove(char const * name) { if (name == nullptr || name[0] == '\0') { ipc::error("fail remove: name is empty\n"); return; } } } }
ii->mem_ = mem; ii->size_ = static_cast<std::size_t>(mem_info.RegionSize); if (size != nullptr) *size = ii->size_; return static_cast<void *>(mem); }
function_block-function_prefix_line
[ { "content": "// A builtin parameterized test name generator which returns the result of\n\n// testing::PrintToString.\n\nstruct PrintToStringParamName {\n\n template <class ParamType>\n\n std::string operator()(const TestParamInfo<ParamType>& info) const {\n\n return PrintToString(info.param);\n\n }\n\n};\n\n\n\nnamespace internal {\n\n\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n\n// Utility Functions\n\n\n\n// Outputs a message explaining invalid registration of different\n\n// fixture class for the same test suite. This may happen when\n\n// TEST_P macro is used to define two tests with the same name\n\n// but in different namespaces.\n\nGTEST_API_ void ReportInvalidTestSuiteType(const char* test_suite_name,\n\n CodeLocation code_location);\n\n\n\ntemplate <typename> class ParamGeneratorInterface;\n\ntemplate <typename> class ParamGenerator;\n\n\n\n// Interface for iterating over elements provided by an implementation\n\n// of ParamGeneratorInterface<T>.\n\ntemplate <typename T>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-param-util.h", "rank": 0, "score": 265692.2967658801 }, { "content": "struct id_info_t {\n\n int fd_ = -1;\n\n void* mem_ = nullptr;\n\n std::size_t size_ = 0;\n\n ipc::string name_;\n\n};\n\n\n\nconstexpr std::size_t calc_size(std::size_t size) {\n\n return ((((size - 1) / alignof(info_t)) + 1) * alignof(info_t)) + sizeof(info_t);\n\n}\n\n\n\ninline auto& acc_of(void* mem, std::size_t size) {\n\n return reinterpret_cast<info_t*>(static_cast<ipc::byte_t*>(mem) + size - sizeof(info_t))->acc_;\n\n}\n\n\n\n} // internal-linkage\n\n\n\nnamespace ipc {\n\nnamespace shm {\n\n\n", "file_path": "src/platform/shm_linux.cpp", "rank": 1, "score": 236591.80079161006 }, { "content": "struct id_type<0, AlignSize> {\n\n uint_t<8> id_;\n\n\n\n id_type& operator=(std::size_t val) {\n\n id_ = static_cast<uint_t<8>>(val);\n\n return (*this);\n\n }\n\n\n\n operator uint_t<8>() const {\n\n return id_;\n\n }\n\n};\n\n\n\ntemplate <std::size_t DataSize, std::size_t AlignSize>\n", "file_path": "src/id_pool.h", "rank": 3, "score": 234060.77789978555 }, { "content": "struct id_type : id_type<0, AlignSize> {\n\n std::aligned_storage_t<DataSize, AlignSize> data_;\n\n};\n\n\n\ntemplate <std::size_t DataSize = 0,\n\n std::size_t AlignSize = (ipc::detail::min)(DataSize, alignof(std::max_align_t))>\n", "file_path": "src/id_pool.h", "rank": 4, "score": 227746.51541785366 }, { "content": "struct msg_t<0, AlignSize> {\n\n msg_id_t conn_;\n\n msg_id_t id_;\n\n std::int32_t remain_;\n\n bool storage_;\n\n};\n\n\n\ntemplate <std::size_t DataSize, std::size_t AlignSize>\n", "file_path": "src/ipc.cpp", "rank": 5, "score": 224621.81594767736 }, { "content": "struct msg_t : msg_t<0, AlignSize> {\n\n std::aligned_storage_t<DataSize, AlignSize> data_ {};\n\n\n\n msg_t() = default;\n\n msg_t(msg_id_t c, msg_id_t i, std::int32_t r, void const * d, std::size_t s)\n\n : msg_t<0, AlignSize> { c, i, r, (d == nullptr) || (s == 0) } {\n\n if (this->storage_) {\n\n if (d != nullptr) {\n\n // copy storage-id\n\n *reinterpret_cast<std::size_t*>(&data_) = *static_cast<std::size_t const *>(d);\n\n }\n\n }\n\n else std::memcpy(&data_, d, s);\n\n }\n\n};\n\n\n\ntemplate <typename T>\n\nbuff_t make_cache(T& data, std::size_t size) {\n\n auto ptr = mem::alloc(size);\n\n std::memcpy(ptr, &data, (ipc::detail::min)(sizeof(data), size));\n\n return { ptr, size, mem::free };\n\n}\n\n\n", "file_path": "src/ipc.cpp", "rank": 6, "score": 215396.063182542 }, { "content": "class IPC_EXPORT handle {\n\npublic:\n\n handle();\n\n handle(char const * name, std::size_t size, unsigned mode = create | open);\n\n handle(handle&& rhs);\n\n\n\n ~handle();\n\n\n\n void swap(handle& rhs);\n\n handle& operator=(handle rhs);\n\n\n\n bool valid() const;\n\n std::size_t size () const;\n\n char const * name () const;\n\n\n\n bool acquire(char const * name, std::size_t size, unsigned mode = create | open);\n\n void release();\n\n\n\n void* get() const;\n\n\n\n void attach(id_t);\n\n id_t detach();\n\n\n\nprivate:\n", "file_path": "include/shm.h", "rank": 7, "score": 208992.6507126802 }, { "content": "struct ConstRef { typedef const T& type; };\n\ntemplate <typename T>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-port.h", "rank": 8, "score": 204751.5458858528 }, { "content": "struct IPC_EXPORT chan_impl {\n\n static handle_t connect (char const * name, unsigned mode);\n\n static void disconnect(handle_t h);\n\n\n\n static char const * name(handle_t h);\n\n\n\n static std::size_t recv_count(handle_t h);\n\n static bool wait_for_recv(handle_t h, std::size_t r_count, std::size_t tm);\n\n\n\n static bool send(handle_t h, void const * data, std::size_t size);\n\n static buff_t recv(handle_t h, std::size_t tm);\n\n\n\n static bool try_send(handle_t h, void const * data, std::size_t size);\n\n static buff_t try_recv(handle_t h);\n\n};\n\n\n\ntemplate <typename Flag>\n", "file_path": "include/ipc.h", "rank": 9, "score": 201747.99079296525 }, { "content": "class GTEST_API_ Matcher<const std::string&>\n\n : public internal::MatcherBase<const std::string&> {\n\n public:\n\n Matcher() {}\n\n\n\n explicit Matcher(const MatcherInterface<const std::string&>* impl)\n\n : internal::MatcherBase<const std::string&>(impl) {}\n\n\n\n // Allows the user to write str instead of Eq(str) sometimes, where\n\n // str is a std::string object.\n\n Matcher(const std::string& s); // NOLINT\n\n\n\n // Allows the user to write \"foo\" instead of Eq(\"foo\") sometimes.\n\n Matcher(const char* s); // NOLINT\n\n};\n\n\n\ntemplate <>\n", "file_path": "3rdparty/gtest/include/gtest/gtest-matchers.h", "rank": 10, "score": 195148.28386541773 }, { "content": "struct quit_mode<pc_t<Rp, Rc, ipc::trans::broadcast>> {\n\n struct type {\n\n constexpr type(bool) {}\n\n constexpr operator bool() const { return false; }\n\n };\n\n};\n\n\n\ntemplate <std::size_t D, typename P>\n", "file_path": "test/test_circ.cpp", "rank": 11, "score": 186708.27797693125 }, { "content": "struct quit_mode<pc_t<Rp, Rc, ipc::trans::unicast>> {\n\n using type = volatile bool;\n\n};\n\n\n\ntemplate <ipc::relat Rp, ipc::relat Rc>\n", "file_path": "test/test_circ.cpp", "rank": 12, "score": 186708.27797693125 }, { "content": "// The default argument to the template below for the case when the user does\n\n// not provide a name generator.\n\nstruct DefaultNameGenerator {\n\n template <typename T>\n\n static std::string GetName(int i) {\n\n return StreamableToString(i);\n\n }\n\n};\n\n\n\ntemplate <typename Provided = DefaultNameGenerator>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 13, "score": 181925.84904181483 }, { "content": "struct NameGeneratorSelector {\n\n typedef Provided type;\n\n};\n\n\n\ntemplate <typename NameGenerator>\n\nvoid GenerateNamesRecursively(Types0, std::vector<std::string>*, int) {}\n\n\n\ntemplate <typename NameGenerator, typename Types>\n\nvoid GenerateNamesRecursively(Types, std::vector<std::string>* result, int i) {\n\n result->push_back(NameGenerator::template GetName<typename Types::Head>(i));\n\n GenerateNamesRecursively<NameGenerator>(typename Types::Tail(), result,\n\n i + 1);\n\n}\n\n\n\ntemplate <typename NameGenerator, typename Types>\n\nstd::vector<std::string> GenerateNames() {\n\n std::vector<std::string> result;\n\n GenerateNamesRecursively<NameGenerator>(Types(), &result, 0);\n\n return result;\n\n}\n\n\n\n// TypeParameterizedTest<Fixture, TestSel, Types>::Register()\n\n// registers a list of type-parameterized tests with Google Test. The\n\n// return value is insignificant - we just need to return something\n\n// such that we can call this function in a namespace scope.\n\n//\n\n// Implementation note: The GTEST_TEMPLATE_ macro declares a template\n\n// template parameter. It's defined in gtest-type-util.h.\n\ntemplate <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 14, "score": 181920.3477645047 }, { "content": "struct ea_t : public ipc::circ::elem_array<Policy, DataSize, 1> {\n\n ea_t() { std::memset(this, 0, sizeof(ipc::circ::elem_array<Policy, DataSize, 1>)); }\n\n};\n\n\n\nusing cq_t = ea_t<\n\n sizeof(msg_t),\n\n pc_t<ipc::relat::single, ipc::relat::multi, ipc::trans::broadcast>\n\n>;\n\n\n\nbool operator==(msg_t const & m1, msg_t const & m2) {\n\n return (m1.pid_ == m2.pid_) && (m1.dat_ == m2.dat_);\n\n}\n\n\n\n} // internal-linkage\n\n\n\ntemplate <std::size_t D, typename P>\n", "file_path": "test/test_circ.cpp", "rank": 15, "score": 180736.0134253455 }, { "content": "struct test_cq<ipc::channel> {\n\n using cn_t = ipc::channel;\n\n\n\n std::string conn_name_;\n\n int m_ = 0;\n\n\n\n test_cq(void*)\n\n : conn_name_(\"test-ipc-channel\") {\n\n }\n\n\n\n cn_t connect() {\n\n return cn_t { conn_name_.c_str() };\n\n }\n\n\n\n void disconnect(cn_t& cn) {\n\n cn.disconnect();\n\n }\n\n\n\n void wait_start(int M) { m_ = M; }\n\n\n", "file_path": "test/test_ipc.cpp", "rank": 16, "score": 179727.54864245554 }, { "content": "struct test_cq<ipc::route> {\n\n using cn_t = ipc::route;\n\n\n\n std::string conn_name_;\n\n\n\n test_cq(void*)\n\n : conn_name_(\"test-ipc-route\") {\n\n }\n\n\n\n cn_t connect() {\n\n return cn_t { conn_name_.c_str() };\n\n }\n\n\n\n void disconnect(cn_t& cn) {\n\n cn.disconnect();\n\n }\n\n\n\n void wait_start(int M) {\n\n cn_t::wait_for_recv(conn_name_.c_str(), static_cast<std::size_t>(M));\n\n }\n", "file_path": "test/test_ipc.cpp", "rank": 17, "score": 179727.54864245554 }, { "content": "struct TestParamInfo {\n\n TestParamInfo(const ParamType& a_param, size_t an_index) :\n\n param(a_param),\n\n index(an_index) {}\n\n ParamType param;\n\n size_t index;\n\n};\n\n\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-param-util.h", "rank": 18, "score": 178790.29663957696 }, { "content": "struct test_performance<AllocT, ModeT, 1> {\n\n static void start() {\n\n benchmark_alloc<AllocT, ModeT, 1>();\n\n }\n\n};\n\n\n\ntemplate <std::size_t> struct dummy;\n\n\n\ntemplate <typename AllocT, int ThreadsN>\n", "file_path": "test/test_mem.cpp", "rank": 19, "score": 173362.4627915696 }, { "content": "// Helper for suppressing false warning from Clang on a const char*\n\n// variable declared in a conditional expression always being NULL in\n\n// the else branch.\n\nstruct GTEST_API_ ConstCharPtr {\n\n ConstCharPtr(const char* str) : value(str) {}\n\n operator bool() const { return true; }\n\n const char* value;\n\n};\n\n\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 20, "score": 172060.2314086663 }, { "content": " class handle_;\n\n handle_* p_;\n\n};\n\n\n\n} // namespace shm\n\n} // namespace ipc\n", "file_path": "include/shm.h", "rank": 21, "score": 165885.1650004277 }, { "content": "class GTEST_API_ Matcher<const absl::string_view&>\n\n : public internal::MatcherBase<const absl::string_view&> {\n\n public:\n\n Matcher() {}\n\n\n\n explicit Matcher(const MatcherInterface<const absl::string_view&>* impl)\n\n : internal::MatcherBase<const absl::string_view&>(impl) {}\n\n\n\n // Allows the user to write str instead of Eq(str) sometimes, where\n\n // str is a std::string object.\n\n Matcher(const std::string& s); // NOLINT\n\n\n\n // Allows the user to write \"foo\" instead of Eq(\"foo\") sometimes.\n\n Matcher(const char* s); // NOLINT\n\n\n\n // Allows the user to pass absl::string_views directly.\n\n Matcher(absl::string_view s); // NOLINT\n\n};\n\n\n\ntemplate <>\n", "file_path": "3rdparty/gtest/include/gtest/gtest-matchers.h", "rank": 22, "score": 161558.24384207194 }, { "content": "struct ConstRef<T&> { typedef T& type; };\n\n\n\n// The argument T must depend on some template parameters.\n\n#define GTEST_REFERENCE_TO_CONST_(T) \\\n\n typename ::testing::internal::ConstRef<T>::type\n\n\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n\n//\n\n// Use ImplicitCast_ as a safe version of static_cast for upcasting in\n\n// the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a\n\n// const Foo*). When you use ImplicitCast_, the compiler checks that\n\n// the cast is safe. Such explicit ImplicitCast_s are necessary in\n\n// surprisingly many situations where C++ demands an exact type match\n\n// instead of an argument type convertable to a target type.\n\n//\n\n// The syntax for using ImplicitCast_ is the same as for static_cast:\n\n//\n\n// ImplicitCast_<ToType>(expr)\n\n//\n\n// ImplicitCast_ would have been part of the C++ standard library,\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-port.h", "rank": 23, "score": 160916.97906665073 }, { "content": "struct test_cq<ipc::queue<T...>> {\n\n using cn_t = ipc::queue<T...>;\n\n\n\n test_cq(void*) {}\n\n\n\n cn_t* connect() {\n\n cn_t* queue = new cn_t { \"test-ipc-queue\" };\n\n [&] { EXPECT_TRUE(queue->connect()); } ();\n\n return queue;\n\n }\n\n\n\n void disconnect(cn_t* queue) {\n\n queue->disconnect();\n\n delete queue;\n\n }\n\n\n\n void wait_start(int M) {\n\n cn_t que(\"test-ipc-queue\");\n\n while (que.conn_count() != static_cast<std::size_t>(M)) {\n\n std::this_thread::yield();\n", "file_path": "test/test_circ.cpp", "rank": 24, "score": 160228.64839853274 }, { "content": "struct MakeIndexSequence<0> : IndexSequence<> {};\n\n\n\n// FIXME: This implementation of ElemFromList is O(1) in instantiation depth,\n\n// but it is O(N^2) in total instantiations. Not sure if this is the best\n\n// tradeoff, as it will make it somewhat slow to compile.\n\ntemplate <typename T, size_t, size_t>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 25, "score": 159806.1586308556 }, { "content": "struct id_type;\n\n\n\ntemplate <std::size_t AlignSize>\n", "file_path": "src/id_pool.h", "rank": 26, "score": 159320.0879736534 }, { "content": "struct impl {\n\n template <typename... P>\n\n static T* construct(T* p, P&&... params) {\n\n ::new (p) T(std::forward<P>(params)...);\n\n return p;\n\n }\n\n\n\n static void destruct(T* p) {\n\n reinterpret_cast<T*>(p)->~T();\n\n }\n\n};\n\n\n\ntemplate <typename T, size_t N>\n", "file_path": "include/pool_alloc.h", "rank": 27, "score": 149478.29514642563 }, { "content": "struct msg_t;\n\n\n\ntemplate <std::size_t AlignSize>\n", "file_path": "src/ipc.cpp", "rank": 28, "score": 149470.91955861275 }, { "content": "struct cache_t {\n\n std::size_t fill_;\n\n buff_t buff_;\n\n\n\n cache_t(std::size_t f, buff_t&& b)\n\n : fill_(f), buff_(std::move(b))\n\n {}\n\n\n\n void append(void const * data, std::size_t size) {\n\n if (fill_ >= buff_.size() || data == nullptr || size == 0) return;\n\n auto new_fill = (ipc::detail::min)(fill_ + size, buff_.size());\n\n std::memcpy(static_cast<byte_t*>(buff_.data()) + fill_, data, new_fill - fill_);\n\n fill_ = new_fill;\n\n }\n\n};\n\n\n\nauto cc_acc() {\n\n static shm::handle acc_h(\"__CA_CONN__\", sizeof(acc_t));\n\n return static_cast<acc_t*>(acc_h.get());\n\n}\n", "file_path": "src/ipc.cpp", "rank": 29, "score": 149470.91955861275 }, { "content": "struct Init {\n\n Init() {\n\n capo::random<> rdm{ DataMin, DataMax };\n\n for (int i = 0; i < LoopCount; ++i) {\n\n sizes__.emplace_back(static_cast<std::size_t>(rdm()));\n\n }\n\n }\n\n} init__;\n\n\n\ntemplate <typename AllocT, int ThreadsN>\n\nvoid benchmark_alloc() {\n\n std::cout << std::endl\n\n << \"[Threads: \" << ThreadsN << \"] \"\n\n << type_name<AllocT>() << std::endl;\n\n\n\n constexpr static int CacheSize = LoopCount / ThreadsN;\n\n\n\n std::atomic_int fini { 0 };\n\n test_stopwatch sw;\n\n\n", "file_path": "test/test_mem.cpp", "rank": 30, "score": 148150.3892561126 }, { "content": "struct test_verify<pc_t<Rp, ipc::relat::multi, ipc::trans::unicast>> : test_verify<cq_t> {\n\n using test_verify<cq_t>::test_verify;\n\n\n\n void verify(int N, int Loops) {\n\n std::cout << \"verifying...\" << std::endl;\n\n for (int n = 0; n < N; ++n) {\n\n std::vector<int> datas;\n\n std::uint64_t sum = 0;\n\n for (auto& c_dats : list_) {\n\n for (int d : c_dats[n]) {\n\n datas.push_back(d);\n\n sum += d;\n\n }\n\n }\n\n EXPECT_EQ(datas.size(), static_cast<std::size_t>(Loops));\n\n EXPECT_EQ(sum, (Loops * std::uint64_t(Loops - 1)) / 2);\n\n }\n\n }\n\n};\n\n\n\ntemplate <typename P>\n", "file_path": "test/test_circ.cpp", "rank": 31, "score": 146984.59624346968 }, { "content": "struct cls_info_t {\n\n id_pool<> pool_;\n\n spin_lock lock_;\n\n};\n\n\n\nconstexpr std::size_t calc_cls_size(std::size_t size) noexcept {\n\n return (((size - 1) / large_msg_limit) + 1) * large_msg_limit;\n\n}\n\n\n\nauto& cls_storage(std::size_t cls_size) {\n\n IPC_UNUSED_ auto guard = ipc::detail::unique_lock(cls_lock());\n\n return cls_storages()[cls_size];\n\n}\n\n\n\ntemplate <typename T>\n\ncls_info_t* cls_storage_info(const char* func, T& cls_shm, std::size_t cls_size) {\n\n if (!cls_shm.id_info_.valid() &&\n\n !cls_shm.id_info_.acquire((\"__CLS_INFO__\" + ipc::to_string(cls_size)).c_str(), sizeof(cls_info_t))) {\n\n ipc::error(\"[%s] cls_shm.id_info_.acquire failed: cls_size = %zd\\n\", func, cls_size);\n\n return nullptr;\n", "file_path": "src/ipc.cpp", "rank": 32, "score": 146749.25337750377 }, { "content": "struct Init {\n\n Init() {\n\n capo::random<> rdm { DataMin, DataMax };\n\n capo::random<> bit { 0, (std::numeric_limits<ipc::byte_t>::max)() };\n\n\n\n for (int i = 0; i < LoopCount; ++i) {\n\n std::size_t n = static_cast<std::size_t>(rdm());\n\n ipc::buff_t buff {\n\n new ipc::byte_t[n], n,\n\n [](void* p, std::size_t) {\n\n delete [] static_cast<ipc::byte_t*>(p);\n\n }\n\n };\n\n for (std::size_t k = 0; k < buff.size(); ++k) {\n\n static_cast<ipc::byte_t*>(buff.data())[k] = static_cast<ipc::byte_t>(bit());\n\n }\n\n datas__.emplace_back(std::move(buff));\n\n }\n\n }\n\n} init__;\n\n\n\ntemplate <typename T>\n\nconstexpr T acc(T b, T e) noexcept {\n\n return (e + b) * (e - b + 1) / 2;\n\n}\n\n\n\ntemplate <typename Mutex>\n", "file_path": "test/test_ipc.cpp", "rank": 33, "score": 146749.25337750377 }, { "content": "struct queue_generator {\n\n\n\n using queue_t = ipc::queue<msg_t<DataSize, AlignSize>, Policy>;\n\n\n\n struct conn_info_t : conn_info_head {\n\n queue_t que_;\n\n\n\n conn_info_t(char const * name)\n\n : conn_info_head(name)\n\n , que_((\"__QU_CONN__\" +\n\n ipc::to_string(DataSize) + \"__\" +\n\n ipc::to_string(AlignSize) + \"__\" + name).c_str()) {\n\n }\n\n };\n\n};\n\n\n\ntemplate <typename Policy>\n", "file_path": "src/ipc.cpp", "rank": 34, "score": 146749.25337750377 }, { "content": "struct detail_impl {\n\n\n\nusing queue_t = typename queue_generator<Policy>::queue_t;\n\nusing conn_info_t = typename queue_generator<Policy>::conn_info_t;\n\n\n\nconstexpr static conn_info_t* info_of(ipc::handle_t h) {\n\n return static_cast<conn_info_t*>(h);\n\n}\n\n\n\nconstexpr static queue_t* queue_of(ipc::handle_t h) {\n\n return (info_of(h) == nullptr) ? nullptr : &(info_of(h)->que_);\n\n}\n\n\n\n/* API implementations */\n\n\n\nstatic ipc::handle_t connect(char const * name, bool start) {\n\n auto h = mem::alloc<conn_info_t>(name);\n\n auto que = queue_of(h);\n\n if (que == nullptr) {\n\n return nullptr;\n", "file_path": "src/ipc.cpp", "rank": 35, "score": 146749.25337750377 }, { "content": "struct quit_mode;\n\n\n\ntemplate <ipc::relat Rp, ipc::relat Rc>\n", "file_path": "test/test_circ.cpp", "rank": 36, "score": 145549.85076427902 }, { "content": "struct test_performance {\n\n static void start() {\n\n test_performance<AllocT, ModeT, ThreadsN / 2>::start();\n\n benchmark_alloc<AllocT, ModeT, ThreadsN>();\n\n }\n\n};\n\n\n\ntemplate <typename AllocT, template <std::size_t> class ModeT>\n", "file_path": "test/test_mem.cpp", "rank": 37, "score": 145528.99415132077 }, { "content": "struct alloc_ix_t {\n\n static std::vector<int> ix_;\n\n static bool inited_;\n\n\n\n alloc_ix_t() {\n\n if (inited_) return;\n\n inited_ = true;\n\n M::init(ix_);\n\n }\n\n\n\n int index(std::size_t /*pid*/, std::size_t /*k*/, std::size_t n) {\n\n return ix_[n];\n\n }\n\n};\n\n\n\ntemplate <typename M>\n\nstd::vector<int> alloc_ix_t<M>::ix_(LoopCount);\n\ntemplate <typename M>\n\nbool alloc_ix_t<M>::inited_ = false;\n\n\n\ntemplate <std::size_t N>\n", "file_path": "test/test_mem.cpp", "rank": 38, "score": 145528.99415132077 }, { "content": "struct info_t {\n\n std::atomic_size_t acc_;\n\n};\n\n\n", "file_path": "src/platform/shm_linux.cpp", "rank": 39, "score": 145504.40542715666 }, { "content": "// String - an abstract class holding static string utilities.\n\nclass GTEST_API_ String {\n\n public:\n\n // Static utility methods\n\n\n\n // Clones a 0-terminated C string, allocating memory using new. The\n\n // caller is responsible for deleting the return value using\n\n // delete[]. Returns the cloned string, or NULL if the input is\n\n // NULL.\n\n //\n\n // This is different from strdup() in string.h, which allocates\n\n // memory using malloc().\n\n static const char* CloneCString(const char* c_str);\n\n\n\n#if GTEST_OS_WINDOWS_MOBILE\n\n // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be\n\n // able to pass strings to Win32 APIs on CE we need to convert them\n\n // to 'Unicode', UTF-16.\n\n\n\n // Creates a UTF-16 wide string from the given ANSI string, allocating\n\n // memory using new. The caller is responsible for deleting the return\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-string.h", "rank": 40, "score": 144459.54180274945 }, { "content": "// This block of code defines operator==/!=\n\n// to block lexical scope lookup.\n\n// It prevents using invalid operator==/!= defined at namespace scope.\n\nstruct faketype {};\n\ninline bool operator==(faketype, faketype) { return true; }\n\ninline bool operator!=(faketype, faketype) { return false; }\n\n\n\n// The helper function for {ASSERT|EXPECT}_EQ.\n\ntemplate <typename T1, typename T2>\n\nAssertionResult CmpHelperEQ(const char* lhs_expression,\n\n const char* rhs_expression,\n\n const T1& lhs,\n\n const T2& rhs) {\n\n if (lhs == rhs) {\n\n return AssertionSuccess();\n\n }\n\n\n\n return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs);\n\n}\n\n\n\n// With this overloaded version, we allow anonymous enums to be used\n\n// in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums\n\n// can be implicitly cast to BiggestInt.\n\nGTEST_API_ AssertionResult CmpHelperEQ(const char* lhs_expression,\n\n const char* rhs_expression,\n\n BiggestInt lhs,\n\n BiggestInt rhs);\n\n\n", "file_path": "3rdparty/gtest/include/gtest/gtest.h", "rank": 41, "score": 144180.2822453716 }, { "content": "struct test_verify {\n\n std::vector<std::vector<ipc::buff_t>> list_;\n\n\n\n test_verify(int M)\n\n : list_(static_cast<std::size_t>(M))\n\n {}\n\n\n\n void prepare(void* /*pt*/) {}\n\n\n\n void push_data(int cid, ipc::buff_t && msg) {\n\n list_[cid].emplace_back(std::move(msg));\n\n }\n\n\n\n void verify(int /*N*/, int /*Loops*/) {\n\n std::cout << \"verifying...\" << std::endl;\n\n for (auto& c_dats : list_) {\n\n EXPECT_EQ(datas__.size(), c_dats.size());\n\n std::size_t i = 0;\n\n for (auto& d : c_dats) {\n\n EXPECT_EQ(datas__[i++], d);\n\n }\n\n }\n\n }\n\n};\n\n\n\ntemplate <>\n", "file_path": "test/test_ipc.cpp", "rank": 42, "score": 144162.61497075582 }, { "content": "struct conn_info_head {\n\n\n\n ipc::string name_;\n\n msg_id_t cc_id_; // connection-info id\n\n waiter cc_waiter_, wt_waiter_, rd_waiter_;\n\n shm::handle acc_h_;\n\n\n\n /*\n\n * <Remarks> thread_local may have some bugs.\n\n *\n\n * <Reference>\n\n * - https://sourceforge.net/p/mingw-w64/bugs/727/\n\n * - https://sourceforge.net/p/mingw-w64/bugs/527/\n\n * - https://github.com/Alexpux/MINGW-packages/issues/2519\n\n * - https://github.com/ChaiScript/ChaiScript/issues/402\n\n * - https://developercommunity.visualstudio.com/content/problem/124121/thread-local-variables-fail-to-be-initialized-when.html\n\n * - https://software.intel.com/en-us/forums/intel-c-compiler/topic/684827\n\n */\n\n tls::pointer<ipc::unordered_map<msg_id_t, cache_t>> recv_cache_;\n\n\n", "file_path": "src/ipc.cpp", "rank": 43, "score": 144162.61497075582 }, { "content": "struct AnyGt {\n\n template <typename A, typename B>\n\n bool operator()(const A& a, const B& b) const { return a > b; }\n\n};\n", "file_path": "3rdparty/gtest/include/gtest/gtest-matchers.h", "rank": 44, "score": 141708.03903284483 }, { "content": "struct AnyGe {\n\n template <typename A, typename B>\n\n bool operator()(const A& a, const B& b) const { return a >= b; }\n\n};\n\n\n", "file_path": "3rdparty/gtest/include/gtest/gtest-matchers.h", "rank": 45, "score": 141708.03903284483 }, { "content": "struct AnyEq {\n\n template <typename A, typename B>\n\n bool operator()(const A& a, const B& b) const { return a == b; }\n\n};\n", "file_path": "3rdparty/gtest/include/gtest/gtest-matchers.h", "rank": 46, "score": 141708.03903284483 }, { "content": "struct AnyNe {\n\n template <typename A, typename B>\n\n bool operator()(const A& a, const B& b) const { return a != b; }\n\n};\n", "file_path": "3rdparty/gtest/include/gtest/gtest-matchers.h", "rank": 47, "score": 141708.03903284483 }, { "content": "struct AnyLe {\n\n template <typename A, typename B>\n\n bool operator()(const A& a, const B& b) const { return a <= b; }\n\n};\n", "file_path": "3rdparty/gtest/include/gtest/gtest-matchers.h", "rank": 48, "score": 141708.03903284483 }, { "content": "struct AnyLt {\n\n template <typename A, typename B>\n\n bool operator()(const A& a, const B& b) const { return a < b; }\n\n};\n", "file_path": "3rdparty/gtest/include/gtest/gtest-matchers.h", "rank": 49, "score": 141708.03903284483 }, { "content": "struct const_iterator {\n\n char x;\n\n};\n\n\n\nTEST(PrintStlContainerTest, ConstIterator) {\n\n const_iterator it = {};\n\n EXPECT_EQ(\"1-byte object <00>\", Print(it));\n\n}\n\n\n\n// Tests printing ::std::tuples.\n\n\n\n// Tuples of various arities.\n\nTEST(PrintStdTupleTest, VariousSizes) {\n\n ::std::tuple<> t0;\n\n EXPECT_EQ(\"()\", Print(t0));\n\n\n\n ::std::tuple<int> t1(5);\n\n EXPECT_EQ(\"(5)\", Print(t1));\n\n\n\n ::std::tuple<char, bool> t2('a', true);\n", "file_path": "3rdparty/gtest/test/googletest-printers-test.cc", "rank": 50, "score": 138387.56206905603 }, { "content": "struct lc_wrapper : Mutex {\n\n void lock_shared () { Mutex::lock (); }\n\n void unlock_shared() { Mutex::unlock(); }\n\n};\n\n\n\ntemplate <typename Lc, int W, int R, int Loops = LoopCount>\n\nvoid benchmark_lc() {\n\n std::thread w_trd[W];\n\n std::thread r_trd[R];\n\n std::atomic_int fini { 0 };\n\n// std::atomic_bool wf { false };\n\n\n\n std::vector<int> datas;\n\n Lc lc;\n\n\n\n test_stopwatch sw;\n\n std::cout << std::endl << type_name<Lc>() << std::endl;\n\n\n\n for (auto& t : r_trd) {\n\n t = std::thread([&] {\n", "file_path": "test/test_ipc.cpp", "rank": 51, "score": 137814.35165087896 }, { "content": "struct CodeLocation {\n\n CodeLocation(const std::string& a_file, int a_line)\n\n : file(a_file), line(a_line) {}\n\n\n\n std::string file;\n\n int line;\n\n};\n\n\n\n// Helper to identify which setup function for TestCase / TestSuite to call.\n\n// Only one function is allowed, either TestCase or TestSute but not both.\n\n\n\n// Utility functions to help SuiteApiResolver\n\nusing SetUpTearDownSuiteFuncType = void (*)();\n\n\n\ninline SetUpTearDownSuiteFuncType GetNotDefaultOrNull(\n\n SetUpTearDownSuiteFuncType a, SetUpTearDownSuiteFuncType def) {\n\n return a == def ? nullptr : a;\n\n}\n\n\n\ntemplate <typename T>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 52, "score": 137125.8652214153 }, { "content": "struct IsAProtocolMessage\n\n : public bool_constant<\n\n std::is_convertible<const T*, const ::proto2::Message*>::value> {};\n\n\n\n// When the compiler sees expression IsContainerTest<C>(0), if C is an\n\n// STL-style container class, the first overload of IsContainerTest\n\n// will be viable (since both C::iterator* and C::const_iterator* are\n\n// valid types and NULL can be implicitly converted to them). It will\n\n// be picked over the second overload as 'int' is a perfect match for\n\n// the type of argument 0. If C::iterator or C::const_iterator is not\n\n// a valid type, the first overload is not viable, and the second\n\n// overload will be picked. Therefore, we can determine whether C is\n\n// a container class by checking the type of IsContainerTest<C>(0).\n\n// The value of the expression is insignificant.\n\n//\n\n// In C++11 mode we check the existence of a const_iterator and that an\n\n// iterator is properly implemented for the container.\n\n//\n\n// For pre-C++11 that we look for both C::iterator and C::const_iterator.\n\n// The reason is that C++ injects the name of a class as a member of the\n\n// class itself (e.g. you can refer to class iterator as either\n\n// 'iterator' or 'iterator::iterator'). If we look for C::iterator\n\n// only, for example, we would mistakenly think that a class named\n\n// iterator is an STL container.\n\n//\n\n// Also note that the simpler approach of overloading\n\n// IsContainerTest(typename C::const_iterator*) and\n\n// IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.\n\ntypedef int IsContainer;\n\ntemplate <class C,\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 53, "score": 137125.8652214153 }, { "content": "struct ElemFromList;\n\n\n\ntemplate <size_t N, size_t... I, typename... T>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 54, "score": 137125.8652214153 }, { "content": "struct IsHashTable {\n\n private:\n\n template <typename U>\n\n static char test(typename U::hasher*, typename U::reverse_iterator*);\n\n template <typename U>\n\n static int test(typename U::hasher*, ...);\n\n template <typename U>\n\n static char test(...);\n\n\n\n public:\n\n static const bool value = sizeof(test<T>(nullptr, nullptr)) == sizeof(int);\n\n};\n\n\n\ntemplate <typename T>\n\nconst bool IsHashTable<T>::value;\n\n\n\ntemplate <typename C,\n\n bool = sizeof(IsContainerTest<C>(0)) == sizeof(IsContainer)>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 55, "score": 137125.8652214153 }, { "content": "struct IndexSequence {\n\n using type = IndexSequence;\n\n};\n\n\n\n// Double the IndexSequence, and one if plus_one is true.\n\ntemplate <bool plus_one, typename T, size_t sizeofT>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 56, "score": 137125.8652214153 }, { "content": "struct DoubleSequence;\n\ntemplate <size_t... I, size_t sizeofT>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 57, "score": 137125.8652214153 }, { "content": "struct impl<T[N]> {\n\n using type = T[N];\n\n\n\n template <typename... P>\n\n static type* construct(type* p, P&&... params) {\n\n for (size_t i = 0; i < N; ++i) {\n\n impl<T>::construct(&((*p)[i]), std::forward<P>(params)...);\n\n }\n\n return p;\n\n }\n\n\n\n static void destruct(type* p) {\n\n for (size_t i = 0; i < N; ++i) {\n\n impl<T>::destruct(&((*p)[i]));\n\n }\n\n }\n\n};\n\n\n\n} // namespace detail\n\n\n", "file_path": "include/pool_alloc.h", "rank": 58, "score": 137047.65592485992 }, { "content": "// Provides leak-safe Windows kernel handle ownership.\n\n// Used in death tests and in threading support.\n\nclass GTEST_API_ AutoHandle {\n\n public:\n\n // Assume that Win32 HANDLE type is equivalent to void*. Doing so allows us to\n\n // avoid including <windows.h> in this header file. Including <windows.h> is\n\n // undesirable because it defines a lot of symbols and macros that tend to\n\n // conflict with client code. This assumption is verified by\n\n // WindowsTypesTest.HANDLEIsVoidStar.\n\n typedef void* Handle;\n\n AutoHandle();\n\n explicit AutoHandle(Handle handle);\n\n\n\n ~AutoHandle();\n\n\n\n Handle Get() const;\n\n void Reset();\n\n void Reset(Handle handle);\n\n\n\n private:\n\n // Returns true if and only if the handle is a valid handle object that can be\n\n // closed.\n\n bool IsCloseable() const;\n\n\n\n Handle handle_;\n\n\n\n GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);\n\n};\n\n\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-port.h", "rank": 59, "score": 136649.27057259824 }, { "content": "struct ConstOnlyContainerWithClassIterator {\n\n struct const_iterator {\n\n const int& operator*() const;\n\n const_iterator& operator++(/* pre-increment */);\n\n };\n\n const_iterator begin() const;\n\n const_iterator end() const;\n\n};\n\n\n\nTEST(IsContainerTestTest, ConstOnlyContainer) {\n\n EXPECT_EQ(sizeof(IsContainer),\n\n sizeof(IsContainerTest<ConstOnlyContainerWithPointerIterator>(0)));\n\n EXPECT_EQ(sizeof(IsContainer),\n\n sizeof(IsContainerTest<ConstOnlyContainerWithClassIterator>(0)));\n\n}\n\n\n", "file_path": "3rdparty/gtest/test/gtest_unittest.cc", "rank": 60, "score": 136223.1107679212 }, { "content": "struct ConstOnlyContainerWithPointerIterator {\n\n using const_iterator = int*;\n\n const_iterator begin() const;\n\n const_iterator end() const;\n\n};\n\n\n", "file_path": "3rdparty/gtest/test/gtest_unittest.cc", "rank": 61, "score": 136223.1107679212 }, { "content": "struct LessByName {\n\n bool operator()(const T* a, const T* b) {\n\n return strcmp(a->name(), b->name()) < 0;\n\n }\n\n};\n\n\n", "file_path": "3rdparty/gtest/test/gtest-unittest-api_test.cc", "rank": 62, "score": 136183.46878524797 }, { "content": "// The relation between an NativeArray object (see below) and the\n\n// native array it represents.\n\n// We use 2 different structs to allow non-copyable types to be used, as long\n\n// as RelationToSourceReference() is passed.\n\nstruct RelationToSourceReference {};\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 63, "score": 134995.0292718385 }, { "content": "struct RelationToSourceCopy {};\n\n\n\n// Adapts a native array to a read-only STL-style container. Instead\n\n// of the complete STL container concept, this adaptor only implements\n\n// members useful for Google Mock's container matchers. New members\n\n// should be added as needed. To simplify the implementation, we only\n\n// support Element being a raw type (i.e. having no top-level const or\n\n// reference modifier). It's the client's responsibility to satisfy\n\n// this requirement. Element can be an array type itself (hence\n\n// multi-dimensional arrays are supported).\n\ntemplate <typename Element>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 64, "score": 134989.8865077468 }, { "content": "struct IsRecursiveContainerImpl;\n\n\n\ntemplate <typename C>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 65, "score": 134989.8865077468 }, { "content": "struct MakeIndexSequence\n\n : DoubleSequence<N % 2 == 1, typename MakeIndexSequence<N / 2>::type,\n\n N / 2>::type {};\n\n\n\ntemplate <>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 66, "score": 134989.8865077468 }, { "content": "struct ElemFromListImpl {};\n\n\n\ntemplate <typename T, size_t I>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 67, "score": 134989.8865077468 }, { "content": "struct FlatTupleBase;\n\n\n\ntemplate <size_t... Idx, typename... T>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 68, "score": 134989.8865077468 }, { "content": "struct StatefulNamingFunctor {\n\n StatefulNamingFunctor() : sum(0) {}\n\n std::string operator()(const ::testing::TestParamInfo<int>& info) {\n\n int value = info.param + sum;\n\n sum += info.param;\n\n return ::testing::PrintToString(value);\n\n }\n\n int sum;\n\n};\n\n\n", "file_path": "3rdparty/gtest/test/googletest-param-test-test.cc", "rank": 69, "score": 134115.42634670966 }, { "content": "struct FlatTupleElemBase;\n\n\n\ntemplate <typename... T, size_t I>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 70, "score": 132948.18508680642 }, { "content": "struct CustomParamNameFunctor {\n\n std::string operator()(const ::testing::TestParamInfo<std::string>& inf) {\n\n return inf.param;\n\n }\n\n};\n\n\n\nINSTANTIATE_TEST_SUITE_P(CustomParamNameFunctor, CustomFunctorNamingTest,\n\n Values(std::string(\"FunctorName\")),\n\n CustomParamNameFunctor());\n\n\n\nINSTANTIATE_TEST_SUITE_P(AllAllowedCharacters, CustomFunctorNamingTest,\n\n Values(\"abcdefghijklmnopqrstuvwxyz\",\n\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\", \"01234567890_\"),\n\n CustomParamNameFunctor());\n\n\n\ninline std::string CustomParamNameFunction(\n\n const ::testing::TestParamInfo<std::string>& inf) {\n\n return inf.param;\n\n}\n\n\n", "file_path": "3rdparty/gtest/test/googletest-param-test-test.cc", "rank": 71, "score": 132136.69172364735 }, { "content": "namespace testing {\n\nnamespace internal {\n\n\n\n// Canonicalizes a given name with respect to the Standard C++ Library.\n\n// This handles removing the inline namespace within `std` that is\n\n// used by various standard libraries (e.g., `std::__1`). Names outside\n\n// of namespace std are returned unmodified.\n\ninline std::string CanonicalizeForStdLibVersioning(std::string s) {\n\n static const char prefix[] = \"std::__\";\n\n if (s.compare(0, strlen(prefix), prefix) == 0) {\n\n std::string::size_type end = s.find(\"::\", strlen(prefix));\n\n if (end != s.npos) {\n\n // Erase everything between the initial `std` and the second `::`.\n\n s.erase(strlen(\"std\"), end - strlen(\"std\"));\n\n }\n\n }\n\n return s;\n\n}\n\n\n\n// GetTypeName<T>() returns a human-readable name of type T.\n\n// NB: This function is also used in Google Mock, so don't move it inside of\n\n// the typed-test-only section below.\n\ntemplate <typename T>\n\nstd::string GetTypeName() {\n\n# if GTEST_HAS_RTTI\n\n\n\n const char* const name = typeid(T).name();\n\n# if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)\n\n int status = 0;\n\n // gcc's implementation of typeid(T).name() mangles the type name,\n\n // so we have to demangle it.\n\n# if GTEST_HAS_CXXABI_H_\n\n using abi::__cxa_demangle;\n\n# endif // GTEST_HAS_CXXABI_H_\n\n char* const readable_name = __cxa_demangle(name, nullptr, nullptr, &status);\n\n const std::string name_str(status == 0 ? readable_name : name);\n\n free(readable_name);\n\n return CanonicalizeForStdLibVersioning(name_str);\n\n# else\n\n return name;\n\n# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC\n\n\n\n# else\n\n\n\n return \"<type>\";\n\n\n\n# endif // GTEST_HAS_RTTI\n\n}\n\n\n\n#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P\n\n\n\n// A unique type used as the default value for the arguments of class\n\n// template Types. This allows us to simulate variadic templates\n\n// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't\n\n// support directly.\n\nstruct None {};\n\n\n\n// The following family of struct and struct templates are used to\n\n// represent type lists. In particular, TypesN<T1, T2, ..., TN>\n\n// represents a type list with N types (T1, T2, ..., and TN) in it.\n\n// Except for Types0, every struct in the family has two member types:\n\n// Head for the first type in the list, and Tail for the rest of the\n\n// list.\n\n\n\n// The empty type list.\n\nstruct Types0 {};\n\n\n\n// Type lists of length 1, 2, 3, and so on.\n\n\n\ntemplate <typename T1>\n\nstruct Types1 {\n\n typedef T1 Head;\n\n typedef Types0 Tail;\n\n};\n\ntemplate <typename T1, typename T2>\n\nstruct Types2 {\n\n typedef T1 Head;\n\n typedef Types1<T2> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3>\n\nstruct Types3 {\n\n typedef T1 Head;\n\n typedef Types2<T2, T3> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4>\n\nstruct Types4 {\n\n typedef T1 Head;\n\n typedef Types3<T2, T3, T4> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\n\nstruct Types5 {\n\n typedef T1 Head;\n\n typedef Types4<T2, T3, T4, T5> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6>\n\nstruct Types6 {\n\n typedef T1 Head;\n\n typedef Types5<T2, T3, T4, T5, T6> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7>\n\nstruct Types7 {\n\n typedef T1 Head;\n\n typedef Types6<T2, T3, T4, T5, T6, T7> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8>\n\nstruct Types8 {\n\n typedef T1 Head;\n\n typedef Types7<T2, T3, T4, T5, T6, T7, T8> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9>\n\nstruct Types9 {\n\n typedef T1 Head;\n\n typedef Types8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10>\n\nstruct Types10 {\n\n typedef T1 Head;\n\n typedef Types9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11>\n\nstruct Types11 {\n\n typedef T1 Head;\n\n typedef Types10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12>\n\nstruct Types12 {\n\n typedef T1 Head;\n\n typedef Types11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13>\n\nstruct Types13 {\n\n typedef T1 Head;\n\n typedef Types12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14>\n\nstruct Types14 {\n\n typedef T1 Head;\n\n typedef Types13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15>\n\nstruct Types15 {\n\n typedef T1 Head;\n\n typedef Types14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n\n T15> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16>\n\nstruct Types16 {\n\n typedef T1 Head;\n\n typedef Types15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17>\n\nstruct Types17 {\n\n typedef T1 Head;\n\n typedef Types16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18>\n\nstruct Types18 {\n\n typedef T1 Head;\n\n typedef Types17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19>\n\nstruct Types19 {\n\n typedef T1 Head;\n\n typedef Types18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20>\n\nstruct Types20 {\n\n typedef T1 Head;\n\n typedef Types19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21>\n\nstruct Types21 {\n\n typedef T1 Head;\n\n typedef Types20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22>\n\nstruct Types22 {\n\n typedef T1 Head;\n\n typedef Types21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23>\n\nstruct Types23 {\n\n typedef T1 Head;\n\n typedef Types22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24>\n\nstruct Types24 {\n\n typedef T1 Head;\n\n typedef Types23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25>\n\nstruct Types25 {\n\n typedef T1 Head;\n\n typedef Types24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26>\n\nstruct Types26 {\n\n typedef T1 Head;\n\n typedef Types25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27>\n\nstruct Types27 {\n\n typedef T1 Head;\n\n typedef Types26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28>\n\nstruct Types28 {\n\n typedef T1 Head;\n\n typedef Types27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29>\n\nstruct Types29 {\n\n typedef T1 Head;\n\n typedef Types28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n\n T29> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30>\n\nstruct Types30 {\n\n typedef T1 Head;\n\n typedef Types29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31>\n\nstruct Types31 {\n\n typedef T1 Head;\n\n typedef Types30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32>\n\nstruct Types32 {\n\n typedef T1 Head;\n\n typedef Types31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32, typename T33>\n\nstruct Types33 {\n\n typedef T1 Head;\n\n typedef Types32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32, T33> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32, typename T33, typename T34>\n\nstruct Types34 {\n\n typedef T1 Head;\n\n typedef Types33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32, T33, T34> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32, typename T33, typename T34, typename T35>\n\nstruct Types35 {\n\n typedef T1 Head;\n\n typedef Types34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32, T33, T34, T35> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32, typename T33, typename T34, typename T35,\n\n typename T36>\n\nstruct Types36 {\n\n typedef T1 Head;\n\n typedef Types35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32, T33, T34, T35, T36> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32, typename T33, typename T34, typename T35,\n\n typename T36, typename T37>\n\nstruct Types37 {\n\n typedef T1 Head;\n\n typedef Types36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32, T33, T34, T35, T36, T37> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32, typename T33, typename T34, typename T35,\n\n typename T36, typename T37, typename T38>\n\nstruct Types38 {\n\n typedef T1 Head;\n\n typedef Types37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32, typename T33, typename T34, typename T35,\n\n typename T36, typename T37, typename T38, typename T39>\n\nstruct Types39 {\n\n typedef T1 Head;\n\n typedef Types38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32, typename T33, typename T34, typename T35,\n\n typename T36, typename T37, typename T38, typename T39, typename T40>\n\nstruct Types40 {\n\n typedef T1 Head;\n\n typedef Types39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32, typename T33, typename T34, typename T35,\n\n typename T36, typename T37, typename T38, typename T39, typename T40,\n\n typename T41>\n\nstruct Types41 {\n\n typedef T1 Head;\n\n typedef Types40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32, typename T33, typename T34, typename T35,\n\n typename T36, typename T37, typename T38, typename T39, typename T40,\n\n typename T41, typename T42>\n\nstruct Types42 {\n\n typedef T1 Head;\n\n typedef Types41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32, typename T33, typename T34, typename T35,\n\n typename T36, typename T37, typename T38, typename T39, typename T40,\n\n typename T41, typename T42, typename T43>\n\nstruct Types43 {\n\n typedef T1 Head;\n\n typedef Types42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n\n T43> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32, typename T33, typename T34, typename T35,\n\n typename T36, typename T37, typename T38, typename T39, typename T40,\n\n typename T41, typename T42, typename T43, typename T44>\n\nstruct Types44 {\n\n typedef T1 Head;\n\n typedef Types43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n\n T44> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32, typename T33, typename T34, typename T35,\n\n typename T36, typename T37, typename T38, typename T39, typename T40,\n\n typename T41, typename T42, typename T43, typename T44, typename T45>\n\nstruct Types45 {\n\n typedef T1 Head;\n\n typedef Types44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n\n T44, T45> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32, typename T33, typename T34, typename T35,\n\n typename T36, typename T37, typename T38, typename T39, typename T40,\n\n typename T41, typename T42, typename T43, typename T44, typename T45,\n\n typename T46>\n\nstruct Types46 {\n\n typedef T1 Head;\n\n typedef Types45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n\n T44, T45, T46> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32, typename T33, typename T34, typename T35,\n\n typename T36, typename T37, typename T38, typename T39, typename T40,\n\n typename T41, typename T42, typename T43, typename T44, typename T45,\n\n typename T46, typename T47>\n\nstruct Types47 {\n\n typedef T1 Head;\n\n typedef Types46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n\n T44, T45, T46, T47> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32, typename T33, typename T34, typename T35,\n\n typename T36, typename T37, typename T38, typename T39, typename T40,\n\n typename T41, typename T42, typename T43, typename T44, typename T45,\n\n typename T46, typename T47, typename T48>\n\nstruct Types48 {\n\n typedef T1 Head;\n\n typedef Types47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n\n T44, T45, T46, T47, T48> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32, typename T33, typename T34, typename T35,\n\n typename T36, typename T37, typename T38, typename T39, typename T40,\n\n typename T41, typename T42, typename T43, typename T44, typename T45,\n\n typename T46, typename T47, typename T48, typename T49>\n\nstruct Types49 {\n\n typedef T1 Head;\n\n typedef Types48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n\n T44, T45, T46, T47, T48, T49> Tail;\n\n};\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n\n typename T6, typename T7, typename T8, typename T9, typename T10,\n\n typename T11, typename T12, typename T13, typename T14, typename T15,\n\n typename T16, typename T17, typename T18, typename T19, typename T20,\n\n typename T21, typename T22, typename T23, typename T24, typename T25,\n\n typename T26, typename T27, typename T28, typename T29, typename T30,\n\n typename T31, typename T32, typename T33, typename T34, typename T35,\n\n typename T36, typename T37, typename T38, typename T39, typename T40,\n\n typename T41, typename T42, typename T43, typename T44, typename T45,\n\n typename T46, typename T47, typename T48, typename T49, typename T50>\n\nstruct Types50 {\n\n typedef T1 Head;\n\n typedef Types49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n\n T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n\n T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n\n T44, T45, T46, T47, T48, T49, T50> Tail;\n\n};\n\n\n\n\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-type-util.h", "rank": 72, "score": 129577.76633267001 }, { "content": "namespace internal {\n\n\n\n# define GTEST_TEMPLATE_ template <typename T> class\n\n\n\n// The template \"selector\" struct TemplateSel<Tmpl> is used to\n\n// represent Tmpl, which must be a class template with one type\n\n// parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined\n\n// as the type Tmpl<T>. This allows us to actually instantiate the\n\n// template \"selected\" by TemplateSel<Tmpl>.\n\n//\n\n// This trick is necessary for simulating typedef for class templates,\n\n// which C++ doesn't support directly.\n\ntemplate <GTEST_TEMPLATE_ Tmpl>\n\nstruct TemplateSel {\n\n template <typename T>\n\n struct Bind {\n\n typedef Tmpl<T> type;\n\n };\n\n};\n\n\n\n# define GTEST_BIND_(TmplSel, T) \\\n\n TmplSel::template Bind<T>::type\n\n\n\n// A unique struct template used as the default value for the\n\n// arguments of class template Templates. This allows us to simulate\n\n// variadic templates (e.g. Templates<int>, Templates<int, double>,\n\n// and etc), which C++ doesn't support directly.\n\ntemplate <typename T>\n\nstruct NoneT {};\n\n\n\n// The following family of struct and struct templates are used to\n\n// represent template lists. In particular, TemplatesN<T1, T2, ...,\n\n// TN> represents a list of N templates (T1, T2, ..., and TN). Except\n\n// for Templates0, every struct in the family has two member types:\n\n// Head for the selector of the first template in the list, and Tail\n\n// for the rest of the list.\n\n\n\n// The empty template list.\n\nstruct Templates0 {};\n\n\n\n// Template lists of length 1, 2, 3, and so on.\n\n\n\ntemplate <GTEST_TEMPLATE_ T1>\n\nstruct Templates1 {\n\n typedef TemplateSel<T1> Head;\n\n typedef Templates0 Tail;\n\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>\n\nstruct Templates2 {\n\n typedef TemplateSel<T1> Head;\n\n typedef Templates1<T2> Tail;\n\n};\n\n\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>\n\nstruct Templates3 {\n\n typedef TemplateSel<T1> Head;\n\n typedef Templates2<T2, T3> Tail;\n\n};\n\n\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n\n GTEST_TEMPLATE_ T4>\n\nstruct Templates4 {\n\n typedef TemplateSel<T1> Head;\n\n typedef Templates3<T2, T3, T4> Tail;\n\n};\n\n\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n\n GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>\n\nstruct Templates5 {\n\n typedef TemplateSel<T1> Head;\n\n typedef Templates4<T2, T3, T4, T5> Tail;\n\n};\n\n\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n\n GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>\n\nstruct Templates6 {\n\n typedef TemplateSel<T1> Head;\n\n typedef Templates5<T2, T3, T4, T5, T6> Tail;\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-type-util.h", "rank": 73, "score": 129571.8984709266 }, { "content": "struct Types<internal::None, internal::None, internal::None, internal::None,\n\n internal::None, internal::None, internal::None, internal::None,\n\n internal::None, internal::None, internal::None, internal::None,\n\n internal::None, internal::None, internal::None, internal::None,\n\n internal::None, internal::None, internal::None, internal::None,\n\n internal::None, internal::None, internal::None, internal::None,\n\n internal::None, internal::None, internal::None, internal::None,\n\n internal::None, internal::None, internal::None, internal::None,\n\n internal::None, internal::None, internal::None, internal::None,\n\n internal::None, internal::None, internal::None, internal::None,\n\n internal::None, internal::None, internal::None, internal::None,\n\n internal::None, internal::None, internal::None, internal::None,\n\n internal::None, internal::None> {\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-type-util.h", "rank": 74, "score": 129571.8984709266 }, { "content": "// Note that SuiteApiResolver inherits from T because\n\n// SetUpTestSuite()/TearDownTestSuite() could be protected. Ths way\n\n// SuiteApiResolver can access them.\n\nstruct SuiteApiResolver : T {\n\n // testing::Test is only forward declared at this point. So we make it a\n\n // dependend class for the compiler to be OK with it.\n\n using Test =\n\n typename std::conditional<sizeof(T) != 0, ::testing::Test, void>::type;\n\n\n\n static SetUpTearDownSuiteFuncType GetSetUpCaseOrSuite(const char* filename,\n\n int line_num) {\n\n SetUpTearDownSuiteFuncType test_case_fp =\n\n GetNotDefaultOrNull(&T::SetUpTestCase, &Test::SetUpTestCase);\n\n SetUpTearDownSuiteFuncType test_suite_fp =\n\n GetNotDefaultOrNull(&T::SetUpTestSuite, &Test::SetUpTestSuite);\n\n\n\n GTEST_CHECK_(!test_case_fp || !test_suite_fp)\n\n << \"Test can not provide both SetUpTestSuite and SetUpTestCase, please \"\n\n \"make sure there is only one present at \"\n\n << filename << \":\" << line_num;\n\n\n\n return test_case_fp != nullptr ? test_case_fp : test_suite_fp;\n\n }\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 75, "score": 129061.33770019471 }, { "content": "struct test_performance<AllocT, dummy, 1> {\n\n static void start() {\n\n benchmark_alloc<AllocT, 1>();\n\n }\n\n};\n\n\n\n// class tc_alloc {\n\n// public:\n\n// static void clear() {}\n\n\n\n// static void* alloc(std::size_t size) {\n\n// return size ? tc_malloc(size) : nullptr;\n\n// }\n\n\n\n// static void free(void* p, std::size_t size) {\n\n// tc_free_sized(p, size);\n\n// }\n\n// };\n\n\n\nTEST(Memory, static_alloc) {\n", "file_path": "test/test_mem.cpp", "rank": 76, "score": 128534.47807381868 }, { "content": "struct Templates<NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n\n NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n\n NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n\n NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n\n NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n\n NoneT> {\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-type-util.h", "rank": 77, "score": 126889.95492050299 }, { "content": "class UniversalTersePrinter<const char*> {\n\n public:\n\n static void Print(const char* str, ::std::ostream* os) {\n\n if (str == nullptr) {\n\n *os << \"NULL\";\n\n } else {\n\n UniversalPrint(std::string(str), os);\n\n }\n\n }\n\n};\n\ntemplate <>\n", "file_path": "3rdparty/gtest/include/gtest/gtest-printers.h", "rank": 78, "score": 126571.60856867823 }, { "content": "class UniversalTersePrinter<const wchar_t*> {\n\n public:\n\n static void Print(const wchar_t* str, ::std::ostream* os) {\n\n if (str == nullptr) {\n\n *os << \"NULL\";\n\n } else {\n\n UniversalPrint(::std::wstring(str), os);\n\n }\n\n }\n\n};\n\n#endif\n\n\n\ntemplate <>\n", "file_path": "3rdparty/gtest/include/gtest/gtest-printers.h", "rank": 79, "score": 126571.60856867823 }, { "content": "#!/usr/bin/env python\n\n#\n\n# Copyright 2015 Google Inc. All rights reserved.\n\n#\n\n# Redistribution and use in source and binary forms, with or without\n\n# modification, are permitted provided that the following conditions are\n\n# met:\n\n#\n\n# * Redistributions of source code must retain the above copyright\n\n# notice, this list of conditions and the following disclaimer.\n\n# * Redistributions in binary form must reproduce the above\n\n# copyright notice, this list of conditions and the following disclaimer\n\n# in the documentation and/or other materials provided with the\n\n# distribution.\n\n# * Neither the name of Google Inc. nor the names of its\n\n# contributors may be used to endorse or promote products derived from\n\n# this software without specific prior written permission.\n\n#\n\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n\n\"\"\"Verifies that Google Test warns the user when not initialized properly.\"\"\"\n\n\n\nimport gtest_test_utils\n\n\n\nbinary_name = 'googletest-param-test-invalid-name2-test_'\n\nCOMMAND = gtest_test_utils.GetTestExecutablePath(binary_name)\n\n\n\n\n\ndef Assert(condition):\n\n if not condition:\n\n raise AssertionError\n\n\n\n\n\ndef TestExitCodeAndOutput(command):\n\n \"\"\"Runs the given command and verifies its exit code and output.\"\"\"\n\n\n\n err = ('Duplicate parameterized test name \\'a\\'')\n\n\n\n p = gtest_test_utils.Subprocess(command)\n\n Assert(p.terminated_by_signal)\n\n\n\n # Check for appropriate output\n\n Assert(err in p.output)\n\n\n\n\n\nclass GTestParamTestInvalidName2Test(gtest_test_utils.TestCase):\n\n\n\n def testExitCodeAndOutput(self):\n\n TestExitCodeAndOutput(COMMAND)\n\n\n\nif __name__ == '__main__':\n\n gtest_test_utils.Main()\n", "file_path": "3rdparty/gtest/test/googletest-param-test-invalid-name2-test.py", "rank": 80, "score": 125879.65008724503 }, { "content": "#!/usr/bin/env python\n\n#\n\n# Copyright 2015 Google Inc. All rights reserved.\n\n#\n\n# Redistribution and use in source and binary forms, with or without\n\n# modification, are permitted provided that the following conditions are\n\n# met:\n\n#\n\n# * Redistributions of source code must retain the above copyright\n\n# notice, this list of conditions and the following disclaimer.\n\n# * Redistributions in binary form must reproduce the above\n\n# copyright notice, this list of conditions and the following disclaimer\n\n# in the documentation and/or other materials provided with the\n\n# distribution.\n\n# * Neither the name of Google Inc. nor the names of its\n\n# contributors may be used to endorse or promote products derived from\n\n# this software without specific prior written permission.\n\n#\n\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n\n\"\"\"Verifies that Google Test warns the user when not initialized properly.\"\"\"\n\n\n\nimport gtest_test_utils\n\n\n\nbinary_name = 'googletest-param-test-invalid-name1-test_'\n\nCOMMAND = gtest_test_utils.GetTestExecutablePath(binary_name)\n\n\n\n\n\ndef Assert(condition):\n\n if not condition:\n\n raise AssertionError\n\n\n\n\n\ndef TestExitCodeAndOutput(command):\n\n \"\"\"Runs the given command and verifies its exit code and output.\"\"\"\n\n\n\n err = ('Parameterized test name \\'\"InvalidWithQuotes\"\\' is invalid')\n\n\n\n p = gtest_test_utils.Subprocess(command)\n\n Assert(p.terminated_by_signal)\n\n\n\n # Verify the output message contains appropriate output\n\n Assert(err in p.output)\n\n\n\n\n\nclass GTestParamTestInvalidName1Test(gtest_test_utils.TestCase):\n\n\n\n def testExitCodeAndOutput(self):\n\n TestExitCodeAndOutput(COMMAND)\n\n\n\n\n\nif __name__ == '__main__':\n\n gtest_test_utils.Main()\n", "file_path": "3rdparty/gtest/test/googletest-param-test-invalid-name1-test.py", "rank": 81, "score": 125879.65008724503 }, { "content": "struct alloc_random : alloc_ix_t<alloc_random<N>> {\n\n static void init(std::vector<int>& ix) {\n\n capo::random<> rdm_index(0, LoopCount - 1);\n\n for (int i = 0; i < LoopCount; ++i) {\n\n ix[static_cast<std::size_t>(i)] = rdm_index();\n\n }\n\n }\n\n};\n\n\n", "file_path": "test/test_mem.cpp", "rank": 82, "score": 124300.95422099547 }, { "content": "struct alloc_LIFO : alloc_ix_t<alloc_LIFO<N>> {\n\n static void init(std::vector<int>& ix) {\n\n for (int i = 0; i < LoopCount; ++i) {\n\n ix[static_cast<std::size_t>(i)] = i;\n\n }\n\n }\n\n\n\n int index(std::size_t pid, std::size_t k, std::size_t n) {\n\n constexpr static int CacheSize = LoopCount / N;\n\n if (k) {\n\n return this->ix_[(CacheSize * (2 * pid + 1)) - 1 - n];\n\n }\n\n else return this->ix_[n];\n\n }\n\n};\n\n\n\ntemplate <std::size_t N>\n", "file_path": "test/test_mem.cpp", "rank": 83, "score": 124300.95422099547 }, { "content": "struct alloc_FIFO : alloc_ix_t<alloc_FIFO<N>> {\n\n static void init(std::vector<int>& ix) {\n\n for (int i = 0; i < LoopCount; ++i) {\n\n ix[static_cast<std::size_t>(i)] = i;\n\n }\n\n }\n\n};\n\n\n\ntemplate <std::size_t N>\n", "file_path": "test/test_mem.cpp", "rank": 84, "score": 124300.95422099547 }, { "content": "struct test_performance<AllocT, dummy, ThreadsN> {\n\n static void start() {\n\n test_performance<AllocT, dummy, ThreadsN / 2>::start();\n\n benchmark_alloc<AllocT, ThreadsN>();\n\n }\n\n};\n\n\n\ntemplate <typename AllocT>\n", "file_path": "test/test_mem.cpp", "rank": 85, "score": 124300.95422099547 }, { "content": "struct IsRecursiveContainerImpl<C, true> {\n\n using value_type = decltype(*std::declval<typename C::const_iterator>());\n\n using type =\n\n std::is_same<typename std::remove_const<\n\n typename std::remove_reference<value_type>::type>::type,\n\n C>;\n\n};\n\n\n\n// IsRecursiveContainer<Type> is a unary compile-time predicate that\n\n// evaluates whether C is a recursive container type. A recursive container\n\n// type is a container type whose value_type is equal to the container type\n\n// itself. An example for a recursive container type is\n\n// boost::filesystem::path, whose iterator has a value_type that is equal to\n\n// boost::filesystem::path.\n\ntemplate <typename C>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 86, "score": 123872.68523733645 }, { "content": "class GTEST_API_ Matcher<std::string>\n\n : public internal::MatcherBase<std::string> {\n\n public:\n\n Matcher() {}\n\n\n\n explicit Matcher(const MatcherInterface<const std::string&>* impl)\n\n : internal::MatcherBase<std::string>(impl) {}\n\n explicit Matcher(const MatcherInterface<std::string>* impl)\n\n : internal::MatcherBase<std::string>(impl) {}\n\n\n\n // Allows the user to write str instead of Eq(str) sometimes, where\n\n // str is a string object.\n\n Matcher(const std::string& s); // NOLINT\n\n\n\n // Allows the user to write \"foo\" instead of Eq(\"foo\") sometimes.\n\n Matcher(const char* s); // NOLINT\n\n};\n\n\n\n#if GTEST_HAS_ABSL\n\n// The following two specializations allow the user to write str\n\n// instead of Eq(str) and \"foo\" instead of Eq(\"foo\") when a absl::string_view\n\n// matcher is expected.\n\ntemplate <>\n", "file_path": "3rdparty/gtest/include/gtest/gtest-matchers.h", "rank": 87, "score": 123789.67801298859 }, { "content": "struct ElemFromListImpl<T, I, I> {\n\n using type = T;\n\n};\n\n\n\n// Get the Nth element from T...\n\n// It uses O(1) instantiation depth.\n\ntemplate <size_t N, typename I, typename... T>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 88, "score": 123091.58348569395 }, { "content": "struct FlatTupleElemBase<FlatTuple<T...>, I> {\n\n using value_type =\n\n typename ElemFromList<I, typename MakeIndexSequence<sizeof...(T)>::type,\n\n T...>::type;\n\n FlatTupleElemBase() = default;\n\n explicit FlatTupleElemBase(value_type t) : value(std::move(t)) {}\n\n value_type value;\n\n};\n\n\n\ntemplate <typename Derived, typename Idx>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 89, "score": 117473.6010314502 }, { "content": "# Copyright 2006, Google Inc.\n\n# All rights reserved.\n\n#\n\n# Redistribution and use in source and binary forms, with or without\n\n# modification, are permitted provided that the following conditions are\n\n# met:\n\n#\n\n# * Redistributions of source code must retain the above copyright\n\n# notice, this list of conditions and the following disclaimer.\n\n# * Redistributions in binary form must reproduce the above\n\n# copyright notice, this list of conditions and the following disclaimer\n\n# in the documentation and/or other materials provided with the\n\n# distribution.\n\n# * Neither the name of Google Inc. nor the names of its\n\n# contributors may be used to endorse or promote products derived from\n\n# this software without specific prior written permission.\n\n#\n\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n\n\"\"\"Unit test utilities for Google C++ Testing and Mocking Framework.\"\"\"\n\n# Suppresses the 'Import not at the top of the file' lint complaint.\n\n# pylint: disable-msg=C6204\n\n\n\nimport os\n\nimport sys\n\n\n\nIS_WINDOWS = os.name == 'nt'\n\nIS_CYGWIN = os.name == 'posix' and 'CYGWIN' in os.uname()[0]\n\nIS_OS2 = os.name == 'os2'\n\n\n\nimport atexit\n\nimport shutil\n\nimport tempfile\n\nimport unittest as _test_module\n\n\n\ntry:\n\n import subprocess\n\n _SUBPROCESS_MODULE_AVAILABLE = True\n\nexcept:\n\n import popen2\n\n _SUBPROCESS_MODULE_AVAILABLE = False\n\n# pylint: enable-msg=C6204\n\n\n\nGTEST_OUTPUT_VAR_NAME = 'GTEST_OUTPUT'\n\n\n\n# The environment variable for specifying the path to the premature-exit file.\n\nPREMATURE_EXIT_FILE_ENV_VAR = 'TEST_PREMATURE_EXIT_FILE'\n\n\n\nenviron = os.environ.copy()\n\n\n\n\n\ndef SetEnvVar(env_var, value):\n\n \"\"\"Sets/unsets an environment variable to a given value.\"\"\"\n\n\n\n if value is not None:\n\n environ[env_var] = value\n\n elif env_var in environ:\n\n del environ[env_var]\n\n\n\n\n\n# Here we expose a class from a particular module, depending on the\n\n# environment. The comment suppresses the 'Invalid variable name' lint\n\n# complaint.\n\nTestCase = _test_module.TestCase # pylint: disable=C6409\n\n\n\n# Initially maps a flag to its default value. After\n\n# _ParseAndStripGTestFlags() is called, maps a flag to its actual value.\n\n_flag_map = {'source_dir': os.path.dirname(sys.argv[0]),\n\n 'build_dir': os.path.dirname(sys.argv[0])}\n\n_gtest_flags_are_parsed = False\n\n\n\n\n\ndef _ParseAndStripGTestFlags(argv):\n\n \"\"\"Parses and strips Google Test flags from argv. This is idempotent.\"\"\"\n\n\n\n # Suppresses the lint complaint about a global variable since we need it\n\n # here to maintain module-wide state.\n\n global _gtest_flags_are_parsed # pylint: disable=W0603\n\n if _gtest_flags_are_parsed:\n\n return\n\n\n\n _gtest_flags_are_parsed = True\n\n for flag in _flag_map:\n\n # The environment variable overrides the default value.\n\n if flag.upper() in os.environ:\n\n _flag_map[flag] = os.environ[flag.upper()]\n\n\n\n # The command line flag overrides the environment variable.\n\n i = 1 # Skips the program name.\n\n while i < len(argv):\n\n prefix = '--' + flag + '='\n\n if argv[i].startswith(prefix):\n\n _flag_map[flag] = argv[i][len(prefix):]\n\n del argv[i]\n\n break\n\n else:\n\n # We don't increment i in case we just found a --gtest_* flag\n\n # and removed it from argv.\n\n i += 1\n\n\n\n\n\ndef GetFlag(flag):\n\n \"\"\"Returns the value of the given flag.\"\"\"\n\n\n\n # In case GetFlag() is called before Main(), we always call\n\n # _ParseAndStripGTestFlags() here to make sure the --gtest_* flags\n\n # are parsed.\n\n _ParseAndStripGTestFlags(sys.argv)\n\n\n\n return _flag_map[flag]\n\n\n\n\n\ndef GetSourceDir():\n\n \"\"\"Returns the absolute path of the directory where the .py files are.\"\"\"\n\n\n\n return os.path.abspath(GetFlag('source_dir'))\n\n\n\n\n\ndef GetBuildDir():\n\n \"\"\"Returns the absolute path of the directory where the test binaries are.\"\"\"\n\n\n\n return os.path.abspath(GetFlag('build_dir'))\n\n\n\n\n\n_temp_dir = None\n\n\n\ndef _RemoveTempDir():\n\n if _temp_dir:\n\n shutil.rmtree(_temp_dir, ignore_errors=True)\n\n\n\natexit.register(_RemoveTempDir)\n\n\n\n\n\ndef GetTempDir():\n\n global _temp_dir\n\n if not _temp_dir:\n\n _temp_dir = tempfile.mkdtemp()\n\n return _temp_dir\n\n\n\n\n\ndef GetTestExecutablePath(executable_name, build_dir=None):\n\n \"\"\"Returns the absolute path of the test binary given its name.\n\n\n\n The function will print a message and abort the program if the resulting file\n\n doesn't exist.\n\n\n\n Args:\n\n executable_name: name of the test binary that the test script runs.\n\n build_dir: directory where to look for executables, by default\n\n the result of GetBuildDir().\n\n\n\n Returns:\n\n The absolute path of the test binary.\n\n \"\"\"\n\n\n\n path = os.path.abspath(os.path.join(build_dir or GetBuildDir(),\n\n executable_name))\n\n if (IS_WINDOWS or IS_CYGWIN or IS_OS2) and not path.endswith('.exe'):\n\n path += '.exe'\n\n\n\n if not os.path.exists(path):\n\n message = (\n\n 'Unable to find the test binary \"%s\". Please make sure to provide\\n'\n\n 'a path to the binary via the --build_dir flag or the BUILD_DIR\\n'\n\n 'environment variable.' % path)\n\n print >> sys.stderr, message\n\n sys.exit(1)\n\n\n\n return path\n\n\n\n\n\ndef GetExitStatus(exit_code):\n\n \"\"\"Returns the argument to exit(), or -1 if exit() wasn't called.\n\n\n\n Args:\n\n exit_code: the result value of os.system(command).\n\n \"\"\"\n\n\n\n if os.name == 'nt':\n\n # On Windows, os.WEXITSTATUS() doesn't work and os.system() returns\n\n # the argument to exit() directly.\n\n return exit_code\n\n else:\n\n # On Unix, os.WEXITSTATUS() must be used to extract the exit status\n\n # from the result of os.system().\n\n if os.WIFEXITED(exit_code):\n\n return os.WEXITSTATUS(exit_code)\n\n else:\n\n return -1\n\n\n\n\n\nclass Subprocess:\n\n def __init__(self, command, working_dir=None, capture_stderr=True, env=None):\n\n \"\"\"Changes into a specified directory, if provided, and executes a command.\n\n\n\n Restores the old directory afterwards.\n\n\n\n Args:\n\n command: The command to run, in the form of sys.argv.\n\n working_dir: The directory to change into.\n\n capture_stderr: Determines whether to capture stderr in the output member\n\n or to discard it.\n\n env: Dictionary with environment to pass to the subprocess.\n\n\n\n Returns:\n\n An object that represents outcome of the executed process. It has the\n\n following attributes:\n\n terminated_by_signal True if and only if the child process has been\n\n terminated by a signal.\n\n signal Sygnal that terminated the child process.\n\n exited True if and only if the child process exited\n\n normally.\n\n exit_code The code with which the child process exited.\n\n output Child process's stdout and stderr output\n\n combined in a string.\n\n \"\"\"\n\n\n\n # The subprocess module is the preferrable way of running programs\n\n # since it is available and behaves consistently on all platforms,\n\n # including Windows. But it is only available starting in python 2.4.\n\n # In earlier python versions, we revert to the popen2 module, which is\n\n # available in python 2.0 and later but doesn't provide required\n\n # functionality (Popen4) under Windows. This allows us to support Mac\n\n # OS X 10.4 Tiger, which has python 2.3 installed.\n\n if _SUBPROCESS_MODULE_AVAILABLE:\n\n if capture_stderr:\n\n stderr = subprocess.STDOUT\n\n else:\n\n stderr = subprocess.PIPE\n\n\n\n p = subprocess.Popen(command,\n\n stdout=subprocess.PIPE, stderr=stderr,\n\n cwd=working_dir, universal_newlines=True, env=env)\n\n # communicate returns a tuple with the file object for the child's\n\n # output.\n\n self.output = p.communicate()[0]\n\n self._return_code = p.returncode\n\n else:\n\n old_dir = os.getcwd()\n\n\n\n def _ReplaceEnvDict(dest, src):\n\n # Changes made by os.environ.clear are not inheritable by child\n\n # processes until Python 2.6. To produce inheritable changes we have\n\n # to delete environment items with the del statement.\n\n for key in dest.keys():\n\n del dest[key]\n\n dest.update(src)\n\n\n\n # When 'env' is not None, backup the environment variables and replace\n\n # them with the passed 'env'. When 'env' is None, we simply use the\n\n # current 'os.environ' for compatibility with the subprocess.Popen\n\n # semantics used above.\n\n if env is not None:\n\n old_environ = os.environ.copy()\n\n _ReplaceEnvDict(os.environ, env)\n\n\n\n try:\n\n if working_dir is not None:\n\n os.chdir(working_dir)\n\n if capture_stderr:\n\n p = popen2.Popen4(command)\n\n else:\n\n p = popen2.Popen3(command)\n\n p.tochild.close()\n\n self.output = p.fromchild.read()\n\n ret_code = p.wait()\n\n finally:\n\n os.chdir(old_dir)\n\n\n\n # Restore the old environment variables\n\n # if they were replaced.\n\n if env is not None:\n\n _ReplaceEnvDict(os.environ, old_environ)\n\n\n\n # Converts ret_code to match the semantics of\n\n # subprocess.Popen.returncode.\n\n if os.WIFSIGNALED(ret_code):\n\n self._return_code = -os.WTERMSIG(ret_code)\n\n else: # os.WIFEXITED(ret_code) should return True here.\n\n self._return_code = os.WEXITSTATUS(ret_code)\n\n\n\n if self._return_code < 0:\n\n self.terminated_by_signal = True\n\n self.exited = False\n\n self.signal = -self._return_code\n\n else:\n\n self.terminated_by_signal = False\n\n self.exited = True\n\n self.exit_code = self._return_code\n\n\n\n\n\ndef Main():\n\n \"\"\"Runs the unit test.\"\"\"\n\n\n\n # We must call _ParseAndStripGTestFlags() before calling\n\n # unittest.main(). Otherwise the latter will be confused by the\n\n # --gtest_* flags.\n\n _ParseAndStripGTestFlags(sys.argv)\n\n # The tested binaries should not be writing XML output files unless the\n\n # script explicitly instructs them to.\n\n if GTEST_OUTPUT_VAR_NAME in os.environ:\n\n del os.environ[GTEST_OUTPUT_VAR_NAME]\n\n\n\n _test_module.main()\n", "file_path": "3rdparty/gtest/test/gtest_test_utils.py", "rank": 90, "score": 117325.86879596018 }, { "content": "struct ElemFromList<N, IndexSequence<I...>, T...>\n\n : ElemFromListImpl<T, N, I>... {};\n\n\n\ntemplate <typename... T>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 91, "score": 116925.15331635525 }, { "content": "struct TraceInfo; // Information about a trace point.\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 92, "score": 116767.92613234409 }, { "content": "class handle::handle_ : public pimpl<handle_> {\n\npublic:\n\n shm::id_t id_ = nullptr;\n\n void* m_ = nullptr;\n\n\n\n ipc::string n_;\n\n std::size_t s_ = 0;\n\n};\n\n\n\nhandle::handle()\n\n : p_(p_->make()) {\n\n}\n\n\n\nhandle::handle(char const * name, std::size_t size, unsigned mode)\n\n : handle() {\n\n acquire(name, size, mode);\n\n}\n\n\n\nhandle::handle(handle&& rhs)\n\n : handle() {\n", "file_path": "src/shm.cpp", "rank": 93, "score": 115939.28808272771 }, { "content": "class MatcherInterfaceAdapter : public MatcherInterface<const T&> {\n\n public:\n\n explicit MatcherInterfaceAdapter(const MatcherInterface<T>* impl)\n\n : impl_(impl) {}\n\n ~MatcherInterfaceAdapter() override { delete impl_; }\n\n\n\n void DescribeTo(::std::ostream* os) const override { impl_->DescribeTo(os); }\n\n\n\n void DescribeNegationTo(::std::ostream* os) const override {\n\n impl_->DescribeNegationTo(os);\n\n }\n\n\n\n bool MatchAndExplain(const T& x,\n\n MatchResultListener* listener) const override {\n\n return impl_->MatchAndExplain(x, listener);\n\n }\n\n\n\n private:\n\n const MatcherInterface<T>* const impl_;\n\n\n\n GTEST_DISALLOW_COPY_AND_ASSIGN_(MatcherInterfaceAdapter);\n\n};\n\n\n", "file_path": "3rdparty/gtest/include/gtest/gtest-matchers.h", "rank": 94, "score": 115785.3129714781 }, { "content": "# Copyright 2018, Google Inc.\n\n# All rights reserved.\n\n#\n\n# Redistribution and use in source and binary forms, with or without\n\n# modification, are permitted provided that the following conditions are\n\n# met:\n\n#\n\n# * Redistributions of source code must retain the above copyright\n\n# notice, this list of conditions and the following disclaimer.\n\n# * Redistributions in binary form must reproduce the above\n\n# copyright notice, this list of conditions and the following disclaimer\n\n# in the documentation and/or other materials provided with the\n\n# distribution.\n\n# * Neither the name of Google Inc. nor the names of its\n\n# contributors may be used to endorse or promote products derived from\n\n# this software without specific prior written permission.\n\n#\n\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n\n\"\"\"Unit test utilities for gtest_json_output.\"\"\"\n\n\n\nimport re\n\n\n\n\n\ndef normalize(obj):\n\n \"\"\"Normalize output object.\n\n\n\n Args:\n\n obj: Google Test's JSON output object to normalize.\n\n\n\n Returns:\n\n Normalized output without any references to transient information that may\n\n change from run to run.\n\n \"\"\"\n\n def _normalize(key, value):\n\n if key == 'time':\n\n return re.sub(r'^\\d+(\\.\\d+)?s$', '*', value)\n\n elif key == 'timestamp':\n\n return re.sub(r'^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\dZ$', '*', value)\n\n elif key == 'failure':\n\n value = re.sub(r'^.*[/\\\\](.*:)\\d+\\n', '\\\\1*\\n', value)\n\n return re.sub(r'Stack trace:\\n(.|\\n)*', 'Stack trace:\\n*', value)\n\n else:\n\n return normalize(value)\n\n if isinstance(obj, dict):\n\n return {k: _normalize(k, v) for k, v in obj.items()}\n\n if isinstance(obj, list):\n\n return [normalize(x) for x in obj]\n\n else:\n\n return obj\n", "file_path": "3rdparty/gtest/test/gtest_json_test_utils.py", "rank": 95, "score": 115370.485566656 }, { "content": "# Copyright 2006, Google Inc.\n\n# All rights reserved.\n\n#\n\n# Redistribution and use in source and binary forms, with or without\n\n# modification, are permitted provided that the following conditions are\n\n# met:\n\n#\n\n# * Redistributions of source code must retain the above copyright\n\n# notice, this list of conditions and the following disclaimer.\n\n# * Redistributions in binary form must reproduce the above\n\n# copyright notice, this list of conditions and the following disclaimer\n\n# in the documentation and/or other materials provided with the\n\n# distribution.\n\n# * Neither the name of Google Inc. nor the names of its\n\n# contributors may be used to endorse or promote products derived from\n\n# this software without specific prior written permission.\n\n#\n\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n\n\"\"\"Unit test utilities for gtest_xml_output\"\"\"\n\n\n\nimport re\n\nfrom xml.dom import minidom, Node\n\nimport gtest_test_utils\n\n\n\nGTEST_DEFAULT_OUTPUT_FILE = 'test_detail.xml'\n\n\n\nclass GTestXMLTestCase(gtest_test_utils.TestCase):\n\n \"\"\"\n\n Base class for tests of Google Test's XML output functionality.\n\n \"\"\"\n\n\n\n\n\n def AssertEquivalentNodes(self, expected_node, actual_node):\n\n \"\"\"\n\n Asserts that actual_node (a DOM node object) is equivalent to\n\n expected_node (another DOM node object), in that either both of\n\n them are CDATA nodes and have the same value, or both are DOM\n\n elements and actual_node meets all of the following conditions:\n\n\n\n * It has the same tag name as expected_node.\n\n * It has the same set of attributes as expected_node, each with\n\n the same value as the corresponding attribute of expected_node.\n\n Exceptions are any attribute named \"time\", which needs only be\n\n convertible to a floating-point number and any attribute named\n\n \"type_param\" which only has to be non-empty.\n\n * It has an equivalent set of child nodes (including elements and\n\n CDATA sections) as expected_node. Note that we ignore the\n\n order of the children as they are not guaranteed to be in any\n\n particular order.\n\n \"\"\"\n\n\n\n if expected_node.nodeType == Node.CDATA_SECTION_NODE:\n\n self.assertEquals(Node.CDATA_SECTION_NODE, actual_node.nodeType)\n\n self.assertEquals(expected_node.nodeValue, actual_node.nodeValue)\n\n return\n\n\n\n self.assertEquals(Node.ELEMENT_NODE, actual_node.nodeType)\n\n self.assertEquals(Node.ELEMENT_NODE, expected_node.nodeType)\n\n self.assertEquals(expected_node.tagName, actual_node.tagName)\n\n\n\n expected_attributes = expected_node.attributes\n\n actual_attributes = actual_node .attributes\n\n self.assertEquals(\n\n expected_attributes.length, actual_attributes.length,\n\n 'attribute numbers differ in element %s:\\nExpected: %r\\nActual: %r' % (\n\n actual_node.tagName, expected_attributes.keys(),\n\n actual_attributes.keys()))\n\n for i in range(expected_attributes.length):\n\n expected_attr = expected_attributes.item(i)\n\n actual_attr = actual_attributes.get(expected_attr.name)\n\n self.assert_(\n\n actual_attr is not None,\n\n 'expected attribute %s not found in element %s' %\n\n (expected_attr.name, actual_node.tagName))\n\n self.assertEquals(\n\n expected_attr.value, actual_attr.value,\n\n ' values of attribute %s in element %s differ: %s vs %s' %\n\n (expected_attr.name, actual_node.tagName,\n\n expected_attr.value, actual_attr.value))\n\n\n\n expected_children = self._GetChildren(expected_node)\n\n actual_children = self._GetChildren(actual_node)\n\n self.assertEquals(\n\n len(expected_children), len(actual_children),\n\n 'number of child elements differ in element ' + actual_node.tagName)\n\n for child_id, child in expected_children.items():\n\n self.assert_(child_id in actual_children,\n\n '<%s> is not in <%s> (in element %s)' %\n\n (child_id, actual_children, actual_node.tagName))\n\n self.AssertEquivalentNodes(child, actual_children[child_id])\n\n\n\n identifying_attribute = {\n\n 'testsuites': 'name',\n\n 'testsuite': 'name',\n\n 'testcase': 'name',\n\n 'failure': 'message',\n\n 'property': 'name',\n\n }\n\n\n\n def _GetChildren(self, element):\n\n \"\"\"\n\n Fetches all of the child nodes of element, a DOM Element object.\n\n Returns them as the values of a dictionary keyed by the IDs of the\n\n children. For <testsuites>, <testsuite>, <testcase>, and <property>\n\n elements, the ID is the value of their \"name\" attribute; for <failure>\n\n elements, it is the value of the \"message\" attribute; for <properties>\n\n elements, it is the value of their parent's \"name\" attribute plus the\n\n literal string \"properties\"; CDATA sections and non-whitespace\n\n text nodes are concatenated into a single CDATA section with ID\n\n \"detail\". An exception is raised if any element other than the above\n\n four is encountered, if two child elements with the same identifying\n\n attributes are encountered, or if any other type of node is encountered.\n\n \"\"\"\n\n\n\n children = {}\n\n for child in element.childNodes:\n\n if child.nodeType == Node.ELEMENT_NODE:\n\n if child.tagName == 'properties':\n\n self.assert_(child.parentNode is not None,\n\n 'Encountered <properties> element without a parent')\n\n child_id = child.parentNode.getAttribute('name') + '-properties'\n\n else:\n\n self.assert_(child.tagName in self.identifying_attribute,\n\n 'Encountered unknown element <%s>' % child.tagName)\n\n child_id = child.getAttribute(\n\n self.identifying_attribute[child.tagName])\n\n self.assert_(child_id not in children)\n\n children[child_id] = child\n\n elif child.nodeType in [Node.TEXT_NODE, Node.CDATA_SECTION_NODE]:\n\n if 'detail' not in children:\n\n if (child.nodeType == Node.CDATA_SECTION_NODE or\n\n not child.nodeValue.isspace()):\n\n children['detail'] = child.ownerDocument.createCDATASection(\n\n child.nodeValue)\n\n else:\n\n children['detail'].nodeValue += child.nodeValue\n\n else:\n\n self.fail('Encountered unexpected node type %d' % child.nodeType)\n\n return children\n\n\n\n def NormalizeXml(self, element):\n\n \"\"\"\n\n Normalizes Google Test's XML output to eliminate references to transient\n\n information that may change from run to run.\n\n\n\n * The \"time\" attribute of <testsuites>, <testsuite> and <testcase>\n\n elements is replaced with a single asterisk, if it contains\n\n only digit characters.\n\n * The \"timestamp\" attribute of <testsuites> elements is replaced with a\n\n single asterisk, if it contains a valid ISO8601 datetime value.\n\n * The \"type_param\" attribute of <testcase> elements is replaced with a\n\n single asterisk (if it sn non-empty) as it is the type name returned\n\n by the compiler and is platform dependent.\n\n * The line info reported in the first line of the \"message\"\n\n attribute and CDATA section of <failure> elements is replaced with the\n\n file's basename and a single asterisk for the line number.\n\n * The directory names in file paths are removed.\n\n * The stack traces are removed.\n\n \"\"\"\n\n\n\n if element.tagName in ('testsuites', 'testsuite', 'testcase'):\n\n timestamp = element.getAttributeNode('timestamp')\n\n timestamp.value = re.sub(r'^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d$',\n\n '*', timestamp.value)\n\n if element.tagName in ('testsuites', 'testsuite', 'testcase'):\n\n time = element.getAttributeNode('time')\n\n time.value = re.sub(r'^\\d+(\\.\\d+)?$', '*', time.value)\n\n type_param = element.getAttributeNode('type_param')\n\n if type_param and type_param.value:\n\n type_param.value = '*'\n\n elif element.tagName == 'failure':\n\n source_line_pat = r'^.*[/\\\\](.*:)\\d+\\n'\n\n # Replaces the source line information with a normalized form.\n\n message = element.getAttributeNode('message')\n\n message.value = re.sub(source_line_pat, '\\\\1*\\n', message.value)\n\n for child in element.childNodes:\n\n if child.nodeType == Node.CDATA_SECTION_NODE:\n\n # Replaces the source line information with a normalized form.\n\n cdata = re.sub(source_line_pat, '\\\\1*\\n', child.nodeValue)\n\n # Removes the actual stack trace.\n\n child.nodeValue = re.sub(r'Stack trace:\\n(.|\\n)*',\n\n 'Stack trace:\\n*', cdata)\n\n for child in element.childNodes:\n\n if child.nodeType == Node.ELEMENT_NODE:\n\n self.NormalizeXml(child)\n", "file_path": "3rdparty/gtest/test/gtest_xml_test_utils.py", "rank": 96, "score": 115370.485566656 }, { "content": "struct DoubleSequence<true, IndexSequence<I...>, sizeofT> {\n\n using type = IndexSequence<I..., (sizeofT + I)..., 2 * sizeofT>;\n\n};\n\ntemplate <size_t... I, size_t sizeofT>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 97, "score": 115131.65354149969 }, { "content": "struct DoubleSequence<false, IndexSequence<I...>, sizeofT> {\n\n using type = IndexSequence<I..., (sizeofT + I)...>;\n\n};\n\n\n\n// Backport of std::make_index_sequence.\n\n// It uses O(ln(N)) instantiation depth.\n\ntemplate <size_t N>\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 98, "score": 115131.65354149969 }, { "content": "struct IsRecursiveContainer : public IsRecursiveContainerImpl<C>::type {};\n\n\n\n// Utilities for native arrays.\n\n\n\n// ArrayEq() compares two k-dimensional native arrays using the\n\n// elements' operator==, where k can be any integer >= 0. When k is\n\n// 0, ArrayEq() degenerates into comparing a single pair of values.\n\n\n\ntemplate <typename T, typename U>\n\nbool ArrayEq(const T* lhs, size_t size, const U* rhs);\n\n\n\n// This generic version is used when k is 0.\n\ntemplate <typename T, typename U>\n\ninline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; }\n\n\n\n// This overload is used when k >= 1.\n\ntemplate <typename T, typename U, size_t N>\n\ninline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) {\n\n return internal::ArrayEq(lhs, N, rhs);\n\n}\n", "file_path": "3rdparty/gtest/include/gtest/internal/gtest-internal.h", "rank": 99, "score": 113410.89365957041 } ]
C++
test/api/union/hyperloglog_test.cpp
Felix-Droop/Chopper
5cc214103b2d088ae400bec0fde8973e03dd3095
#include <gtest/gtest.h> #include <gmock/gmock.h> #include <unordered_set> #include <vector> #include <fstream> #include <iostream> #include <chopper/union/hyperloglog.hpp> #include <seqan3/io/sequence_file/input.hpp> #include <seqan3/test/tmp_filename.hpp> struct input_traits : public seqan3::sequence_file_input_default_traits_dna { using sequence_alphabet = char; using sequence_legal_alphabet = char; using sequence_contianer = std::vector<sequence_alphabet>; }; using sequence_file_type = seqan3::sequence_file_input<input_traits, seqan3::fields<seqan3::field::seq>>; TEST(hyperloglog_test, initialization) { size_t const b = 4; size_t const m = 1 << b; hyperloglog sketch(b); EXPECT_EQ(sketch.registerSize(), m); EXPECT_EQ(sketch.estimate(), 0.0); } TEST(hyperloglog_test, add_and_estimate_small) { size_t const b = 4; size_t const m = 1 << b; hyperloglog sketch(b); sketch.add("bla", 3); sketch.add("bli", 3); sketch.add("blub", 4); sketch.add("bloink", 6); sketch.add("blubba", 6); sketch.add("blumpf", 6); sketch.add("blarkse", 7); sketch.add("bladuzel", 8); EXPECT_NEAR(sketch.estimate(), 9.205826318, 0.0000001); } TEST(hyperloglog_test, add_and_estimate_large) { std::string input_file = DATADIR"small.fa"; size_t const k = 16; size_t const b = 4; size_t const m = 1 << b; hyperloglog sketch(b); std::unordered_set<std::string> control; sequence_file_type seq_file{input_file}; for (auto && [seq] : seq_file) { char* c_seq_it = &*seq.begin(); char* end = c_seq_it + seq.size(); while(c_seq_it + k <= end) { control.insert(std::string(c_seq_it, k)); sketch.add(c_seq_it, k); ++c_seq_it; } } EXPECT_NEAR(sketch.estimate(), control.size(), control.size() * 1.04 / 4); } TEST(hyperloglog_test, merge_and_merge_SIMD) { std::string input_file = DATADIR"small.fa"; size_t const k = 16; size_t const b = 5; size_t const m = 1 << b; hyperloglog full_sketch(b); hyperloglog merge_sketch(b); hyperloglog merge_SIMD_sketch(b); std::vector<hyperloglog> partial_sketches; sequence_file_type seq_file{input_file}; for (auto && [seq] : seq_file) { partial_sketches.emplace_back(b); char* c_seq_it = &*seq.begin(); char* end = c_seq_it + seq.size(); while(c_seq_it + k <= end) { partial_sketches.back().add(c_seq_it, k); full_sketch.add(c_seq_it, k); ++c_seq_it; } } double merge_SIMD_estimate; for (auto & partial_sketch : partial_sketches) { merge_sketch.merge(partial_sketch); merge_SIMD_estimate = merge_SIMD_sketch.merge_and_estimate_SIMD(partial_sketch); } EXPECT_EQ(full_sketch.estimate(), merge_sketch.estimate()); EXPECT_EQ(full_sketch.estimate(), merge_SIMD_sketch.estimate()); } TEST(hyperloglog_test, dump_and_restore) { std::string input_file = DATADIR"small.fa"; size_t const k = 16; size_t const b = 4; size_t const m = 1 << b; hyperloglog dump_sketch(b); hyperloglog restore_sketch(b); sequence_file_type seq_file{input_file}; for (auto && [seq] : seq_file) { char* c_seq_it = &*seq.begin(); char* end = c_seq_it + seq.size(); while(c_seq_it + k <= end) { dump_sketch.add(c_seq_it, k); ++c_seq_it; } } seqan3::test::tmp_filename dump_filename{"dump.hll"}; std::ofstream ostrm(dump_filename.get_path(), std::ios::binary); dump_sketch.dump(ostrm); std::ifstream istrm(dump_filename.get_path(), std::ios::binary); restore_sketch.restore(istrm); EXPECT_EQ(dump_sketch.estimate(), restore_sketch.estimate()); }
#include <gtest/gtest.h> #include <gmock/gmock.h> #include <unordered_set> #include <vector> #include <fstream> #include <iostream> #include <chopper/union/hyperloglog.hpp> #include <seqan3/io/sequence_file/input.hpp> #include <seqan3/test/tmp_filename.hpp> struct input_traits : public seqan3::sequence_file_input_default_traits_dna { using sequence_alphabet = char; using sequence_legal_alphabet = char; using sequence_contianer = std::vector<sequence_alphabet>; }; using sequence_file_type = seqan3::sequence_file_input<input_traits, seqan3::fields<seqan3::field::seq>>; TEST(hyperloglog_test, initialization) { size_t const b = 4; size_t const m = 1 << b; hyperloglog sketch(b); EXPECT_EQ(sketch.registerSize(), m); EXPECT_EQ(sketch.estimate(), 0.0); } TEST(hyperloglog_test, add_and_estimate_small) { size_t const b = 4; size_t const m = 1 << b; hyperloglog sketch(b); sketch.add("bla", 3); sketch.add("bli", 3); sketch.add("blub", 4); sketch.add("bloink", 6); sketch.add("blubba", 6); sketch.add("blumpf", 6); sketch.add("blarkse", 7); sketch.add("bladuzel", 8); EXPECT_NEAR(sketch.estimate(), 9.205826318, 0.0000001); }
TEST(hyperloglog_test, merge_and_merge_SIMD) { std::string input_file = DATADIR"small.fa"; size_t const k = 16; size_t const b = 5; size_t const m = 1 << b; hyperloglog full_sketch(b); hyperloglog merge_sketch(b); hyperloglog merge_SIMD_sketch(b); std::vector<hyperloglog> partial_sketches; sequence_file_type seq_file{input_file}; for (auto && [seq] : seq_file) { partial_sketches.emplace_back(b); char* c_seq_it = &*seq.begin(); char* end = c_seq_it + seq.size(); while(c_seq_it + k <= end) { partial_sketches.back().add(c_seq_it, k); full_sketch.add(c_seq_it, k); ++c_seq_it; } } double merge_SIMD_estimate; for (auto & partial_sketch : partial_sketches) { merge_sketch.merge(partial_sketch); merge_SIMD_estimate = merge_SIMD_sketch.merge_and_estimate_SIMD(partial_sketch); } EXPECT_EQ(full_sketch.estimate(), merge_sketch.estimate()); EXPECT_EQ(full_sketch.estimate(), merge_SIMD_sketch.estimate()); } TEST(hyperloglog_test, dump_and_restore) { std::string input_file = DATADIR"small.fa"; size_t const k = 16; size_t const b = 4; size_t const m = 1 << b; hyperloglog dump_sketch(b); hyperloglog restore_sketch(b); sequence_file_type seq_file{input_file}; for (auto && [seq] : seq_file) { char* c_seq_it = &*seq.begin(); char* end = c_seq_it + seq.size(); while(c_seq_it + k <= end) { dump_sketch.add(c_seq_it, k); ++c_seq_it; } } seqan3::test::tmp_filename dump_filename{"dump.hll"}; std::ofstream ostrm(dump_filename.get_path(), std::ios::binary); dump_sketch.dump(ostrm); std::ifstream istrm(dump_filename.get_path(), std::ios::binary); restore_sketch.restore(istrm); EXPECT_EQ(dump_sketch.estimate(), restore_sketch.estimate()); }
TEST(hyperloglog_test, add_and_estimate_large) { std::string input_file = DATADIR"small.fa"; size_t const k = 16; size_t const b = 4; size_t const m = 1 << b; hyperloglog sketch(b); std::unordered_set<std::string> control; sequence_file_type seq_file{input_file}; for (auto && [seq] : seq_file) { char* c_seq_it = &*seq.begin(); char* end = c_seq_it + seq.size(); while(c_seq_it + k <= end) { control.insert(std::string(c_seq_it, k)); sketch.add(c_seq_it, k); ++c_seq_it; } } EXPECT_NEAR(sketch.estimate(), control.size(), control.size() * 1.04 / 4); }
function_block-full_function
[ { "content": "struct input_traits : public seqan3::sequence_file_input_default_traits_dna\n\n{\n\n using sequence_alphabet = seqan3::dna4;\n\n};\n\n\n\nint main(int argc, const char *argv [])\n\n{\n\n seqan3::argument_parser parser{\"measure_hyperloglog\", argc, argv,\n\n seqan3::update_notifications::off};\n\n \n\n cli_args args{}; \n\n\n\n parser.add_option(args.input_path, 'i', \"input-file\", \"Fasta formatted file with sequences.\",\n\n seqan3::option_spec::required);\n\n parser.add_option(args.output_path, 'o', \"output-file\", \"File where the output is written to in tsv format.\",\n\n seqan3::option_spec::required);\n\n parser.add_option(args.hll_bits, 'b', \"hll-bits\", \n\n \"Adds an integer value which is tested as HyperLogLog bits parameter.\");\n\n parser.add_option(args.k, 'k', \"kmer-size\", \n\n \"The size of the k-mers of which the hash values are computed.\");\n", "file_path": "src/measure_hyperloglog.cpp", "rank": 0, "score": 105783.76571771521 }, { "content": "struct mytraits : public seqan3::sequence_file_input_default_traits_dna\n\n{\n\n using sequence_alphabet = seqan3::dna4;\n\n};\n\n\n\nusing sequence_file_type = seqan3::sequence_file_input<mytraits,\n\n seqan3::fields<seqan3::field::seq>,\n\n seqan3::type_list<seqan3::format_fasta, seqan3::format_fastq>>;\n\n\n\ntemplate <typename seq_type, typename compute_view_type>\n\nvoid compute_hashes(seq_type && seq, compute_view_type && compute_fn, count_config const & config,\n\n robin_hood::unordered_node_set<uint64_t> & result, hyperloglog & sketch)\n\n{\n\n for (auto hash : seq | compute_fn)\n\n {\n\n if (!config.exclusively_hlls)\n\n {\n\n result.insert(hash);\n\n }\n\n if (config.exclusively_hlls || !config.hll_dir.empty())\n", "file_path": "include/chopper/count/count_kmers.hpp", "rank": 2, "score": 99008.3369881193 }, { "content": "class hyperloglog \n\n{\n\npublic:\n\n\n\n /**\n\n * Constructor\n\n *\n\n * @param[in] b bit width (register size will be 2 to the b power).\n\n * This value must be in the range[4,30].Default value is 4.\n\n *\n\n * @exception std::invalid_argument the argument is out of range.\n\n */\n\n hyperloglog(uint8_t b = 5) :\n\n m_(1 << b), b_(b), M_(m_, 0) {\n\n\n\n if (b < 4 || 32 < b) \n\n {\n\n std::stringstream ss;\n\n ss << \"bit width must be in the range [4,32] and it is \" << (int)b;\n\n throw std::invalid_argument(ss.str().c_str());\n", "file_path": "include/chopper/union/hyperloglog.hpp", "rank": 3, "score": 91778.16502128843 }, { "content": "struct cli_args \n\n{\n\n std::filesystem::path input_path{};\n\n std::filesystem::path output_path{};\n\n std::vector<uint8_t> hll_bits;\n\n uint8_t k{20};\n\n};\n\n\n\n\n", "file_path": "src/measure_hyperloglog.cpp", "rank": 4, "score": 86756.90677670624 }, { "content": "// Provides functions for CLI test implementation.\n\nstruct cli_test : public ::testing::Test\n\n{\n\nprivate:\n\n\n\n // Holds the original work directory where Gtest has been started.\n\n std::filesystem::path original_workdir{};\n\n\n\nprotected:\n\n\n\n // Result struct for captured streams and exit code.\n\n struct cli_test_result\n\n {\n\n std::string out{};\n\n std::string err{};\n\n int exit_code{};\n\n };\n\n\n\n // Invoke the app execution. The command line call should be given as separate parameters.\n\n template <typename... CommandItemTypes>\n\n cli_test_result execute_app(CommandItemTypes &&... command_items)\n", "file_path": "test/cli/cli_test.hpp", "rank": 5, "score": 84384.71286114262 }, { "content": "struct Minimizer\n\n{\n\npublic:\n\n\n\n // Random, but static value for xor for hashes. Counteracts consecutive minimizers.\n\n // E.g., without it, the next minimizer after a poly-A region AAAAA would be most likely something like AAAAC.\n\n uint64_t const seed{0x8F3F73B5CF1C9ADE};\n\n // Shape for forward hashes\n\n seqan::Shape<seqan::Dna, seqan::SimpleShape> kmerShape;\n\n // Shape for hashes on reverse complement\n\n seqan::Shape<seqan::Dna, seqan::SimpleShape> revCompShape;\n\n // k-mer size\n\n uint16_t k{20};\n\n // window size\n\n uint32_t w{20};\n\n // start positions of minimizers\n\n std::vector<uint64_t> minBegin;\n\n // end positions of minimizers\n\n std::vector<uint64_t> minEnd;\n\n\n", "file_path": "include/chopper/split/minimizer.hpp", "rank": 6, "score": 80713.56962443264 }, { "content": "struct minimizer\n\n{\n\n /*!\\name Constructors, destructor and assignment\n\n * \\{\n\n */\n\n //!\\brief Default constructor. Attention: all operations on a solely default constructed decorator,\n\n //! except assigning a new range, are UB.\n\n constexpr minimizer() = default;\n\n //!\\brief Copy constructor.\n\n constexpr minimizer(minimizer const &) = default;\n\n //!\\brief Copy construction via assignment.\n\n constexpr minimizer & operator=(minimizer const &) = default;\n\n //!\\brief Move constructor.\n\n constexpr minimizer(minimizer && rhs) = default;\n\n //!\\brief Move assignment.\n\n constexpr minimizer & operator=(minimizer && rhs) = default;\n\n //!\\brief Use default deconstructor.\n\n ~minimizer() = default;\n\n\n\n //!\\brief Copy constructor from uint64_t.\n", "file_path": "include/chopper/split/minimizer.hpp", "rank": 7, "score": 80713.56962443264 }, { "content": "struct count_config\n\n{\n\n std::filesystem::path data_file{};\n\n std::filesystem::path output_filename{};\n\n std::filesystem::path hll_dir{};\n\n size_t column_index_to_cluster{1};\n\n size_t num_threads{std::thread::hardware_concurrency()};\n\n uint8_t k{25};\n\n unsigned int w{500};\n\n uint8_t sketch_bits{12};\n\n bool disable_minimizers{false};\n\n bool exclusively_hlls{false};\n\n};\n", "file_path": "include/chopper/count/count_config.hpp", "rank": 8, "score": 76854.23560723073 }, { "content": "struct batch_config\n\n{\n\n // Construct from split config\n\n batch_config(split_config const & c) :\n\n output_graph_file{c.output_graph_file},\n\n verbose{c.verbose},\n\n kmer_size{c.kmer_size},\n\n window_size{c.window_size}\n\n {}\n\n\n\n std::vector<std::string> seqfiles;\n\n std::string output_graph_file{\"graph.dot\"}; // default\n\n bool verbose{false}; // whether to output logging information\n\n\n\n uint8_t kmer_size{25};\n\n uint16_t window_size{100};\n\n\n\n // traverse config\n\n std::string bin_name{};\n\n bool merged_bin{false};\n\n int16_t bins{64};\n\n bool write_out_graph{false};\n\n bool write_out_weights{false};\n\n\n\n // For a merged low level IBF several splittings will come into the same file.\n\n // So the chopper_split output needs to be appended and the bin_index adjusted.\n\n int64_t hibf_bin_idx_offset{0};\n\n int64_t libf_bin_idx_offset{0};\n\n};\n", "file_path": "include/chopper/split/split_config.hpp", "rank": 9, "score": 76854.23560723073 }, { "content": "struct simple_binning\n\n{\n\nprivate:\n\n //!\\brief The filenames of the respective user bins.\n\n std::vector<std::string> const & user_bin_names;\n\n //!\\brief The kmer counts of the respective user bins.\n\n std::vector<size_t> const & user_bin_kmer_counts;\n\n //!\\brief The identifier of the (colorful) bin that is written into the file.\n\n std::string const & bin_name;\n\n //!\\brief The output stream to write to.\n\n std::ostream & output_file;\n\n\n\n /*!\\brief The number of User bins.\n\n *\n\n * The user may impose a structure on his sequence data in the form of *logical groups* (e.g. species).\n\n * When querying the IBF, the user is interested in an answer that differentiates between these groups.\n\n */\n\n size_t const num_user_bins;\n\n /*!\\brief The number of Technical bins.\n\n *\n", "file_path": "include/chopper/pack/simple_binning.hpp", "rank": 10, "score": 76854.23560723073 }, { "content": "struct split_data\n\n{\n\n typedef seqan::String<minimizer> TSequence;\n\n seqan::StringSet<TSequence, seqan::Owner<> > sequences;\n\n seqan::StringSet<seqan::String<char> > ids;\n\n seqan::String<size_t> lengths;\n\n std::vector<std::string> files_of_origin;\n\n\n\n std::ofstream * outstream{nullptr};\n\n};\n", "file_path": "include/chopper/split/split_data.hpp", "rank": 11, "score": 76854.23560723073 }, { "content": "struct split_config\n\n{\n\n std::string data_filename;\n\n std::vector<std::string> seqfiles;\n\n std::string output_graph_file{\"graph.dot\"}; // communication bw minimiser_msa and traverse_graph\n\n bool verbose{false}; // whether to output logging information\n\n\n\n uint8_t kmer_size{25};\n\n uint16_t window_size{100};\n\n\n\n // traverse config\n\n std::filesystem::path out_path{\"/tmp/traverse_graph.out\"};\n\n int16_t bins{64};\n\n};\n\n\n", "file_path": "include/chopper/split/split_config.hpp", "rank": 12, "score": 76854.23560723073 }, { "content": "struct pack_config\n\n{\n\n std::filesystem::path data_file;\n\n std::filesystem::path output_filename{\"binning.out\"};\n\n uint16_t bins{64};\n\n std::filesystem::path hll_dir{};\n\n double alpha{10};\n\n double max_ratio{0.5};\n\n size_t num_threads{std::thread::hardware_concurrency()};\n\n int aggregate_by_column{-1};\n\n bool union_estimate{false};\n\n bool rearrange_bins{false};\n\n};\n", "file_path": "include/chopper/pack/pack_config.hpp", "rank": 13, "score": 76854.23560723073 }, { "content": "struct pack_data\n\n{\n\n std::vector<std::string> filenames;\n\n std::vector<size_t> kmer_counts;\n\n std::vector<std::vector<std::string>> extra_information;\n\n\n\n //!\\brief A reference to the output stream to cache the results to.\n\n std::stringstream * output_buffer{nullptr};\n\n //!\\brief A reference to the stream to cache the header to.\n\n std::stringstream * header_buffer{nullptr};\n\n};\n", "file_path": "include/chopper/pack/pack_data.hpp", "rank": 14, "score": 76854.23560723073 }, { "content": "struct hierarchical_binning\n\n{\n\nprivate:\n\n //!\\brief The file names of the user input. Since the input might be sorted, we need to keep track of the names.\n\n std::vector<std::string> & names;\n\n //!\\brief The kmer counts associated with the above files used to pack user bin into technical bins.\n\n std::vector<size_t> & user_bin_kmer_counts;\n\n\n\n /*\\brief A scaling factor to influence the amount of merged bins produced by the algorithm.\n\n *\n\n * The higher alpha, the more weight is added artificially to the low level IBFs and thus the optimal\n\n * solution will contain less merged bins in the end because it costs more to merge bins.\n\n */\n\n double const alpha;\n\n //!\\brief The number of user bins, initialised with the length of user_bin_kmer_counts.\n\n size_t const num_user_bins;\n\n //!\\brief The number of technical bins requested by the user.\n\n size_t const num_technical_bins;\n\n //!\\brief The total sum of all values in user_bin_kmer_counts.\n\n size_t const kmer_count_sum;\n", "file_path": "include/chopper/pack/hierarchical_binning.hpp", "rank": 15, "score": 76854.23560723073 }, { "content": "struct similarity_score\n\n{\n\n double score;\n\n};\n\n\n", "file_path": "include/chopper/split/map_distance_matrix.hpp", "rank": 16, "score": 75094.30622625088 }, { "content": "struct num_seq\n\n{\n\n size_t n;\n\n};\n\n\n", "file_path": "include/chopper/split/map_distance_matrix.hpp", "rank": 17, "score": 75094.30622625088 }, { "content": "struct dummy_value\n\n{\n\n double v;\n\n};\n\n\n", "file_path": "include/chopper/split/map_distance_matrix.hpp", "rank": 18, "score": 75094.30622625088 }, { "content": "struct distance_score\n\n{\n\n double score;\n\n};\n\n\n\n\n", "file_path": "include/chopper/split/map_distance_matrix.hpp", "rank": 19, "score": 75094.30622625088 }, { "content": "struct file_type_traits : public seqan3::sequence_file_input_default_traits_dna\n\n{\n\n using sequence_alphabet = seqan3::dna4;\n\n};\n\n\n\nusing seq_file_type = seqan3::sequence_file_input<file_type_traits,\n\n seqan3::fields<seqan3::field::seq, seqan3::field::id>,\n\n seqan3::type_list<seqan3::format_fasta, seqan3::format_fastq>>;\n\n\n\nauto read_sequences(std::vector<std::string> const & filenames)\n\n{\n\n std::unordered_map<std::string, seqan3::dna4_vector> info;\n\n\n\n for (auto const & filename : filenames)\n\n for (auto && [seq, id] : seq_file_type{filename})\n\n info.emplace(filename + id, std::move(seq));\n\n\n\n return info;\n\n}\n\n\n", "file_path": "src/count_kmers_per_bin.cpp", "rank": 20, "score": 74018.78161123904 }, { "content": "struct user_bin_sequence\n\n{\n\nprivate:\n\n //!\\brief type for a node in the clustering tree when for the rearrangement\n\n struct clustering_node \n\n {\n\n // children in the tree\n\n size_t left;\n\n size_t right;\n\n // hll sketch of the union if the node is still a root\n\n hyperloglog hll;\n\n };\n\n\n\n //!\\brief element of the second priority queue layer of the distance matrix\n\n struct neighbor\n\n {\n\n size_t id;\n\n double dist;\n\n\n\n bool operator>(neighbor const & other) const\n", "file_path": "include/chopper/union/user_bin_sequence.hpp", "rank": 21, "score": 73434.64176886738 }, { "content": "struct upper_distance_threshold\n\n{\n\n double t;\n\n};\n\n\n", "file_path": "include/chopper/split/map_distance_matrix.hpp", "rank": 22, "score": 73434.64176886738 }, { "content": "struct distance_matrix_initialiser\n\n{\n\n static constexpr size_t sketch_size{100};\n\n\n\n size_t const number_of_sequences{};\n\n\n\n distance_matrix_initialiser(size_t const number_of_sequences_) :\n\n number_of_sequences{number_of_sequences_}\n\n {}\n\n\n\n template <typename time_point>\n\n static std::string secs(time_point start, time_point end)\n\n {\n\n return \"(\" + std::to_string(std::chrono::duration_cast<std::chrono::seconds>(end - start).count()) + \"s)\";\n\n }\n\n\n\n matrix_type initialise_matrix()\n\n {\n\n if constexpr (std::same_as<matrix_type, map_distance_matrix>)\n\n {\n", "file_path": "include/chopper/split/distance_matrix_initialiser.hpp", "rank": 23, "score": 73434.64176886738 }, { "content": "struct file_type_traits : public seqan3::sequence_file_input_default_traits_dna\n\n{\n\n using sequence_alphabet = seqan3::dna4;\n\n};\n\n\n\nstd::mutex mutex;\n\n\n\nauto print_kmer_content(chopper_pack_record const & record, size_t const num_bins, uint8_t const k, \n\n robin_hood::unordered_map<std::string, size_t> const & counts, std::ofstream & fout)\n\n{\n\n using seq_file_type = seqan3::sequence_file_input<file_type_traits,\n\n seqan3::fields<seqan3::field::seq>,\n\n seqan3::type_list<seqan3::format_fasta, seqan3::format_fastq>>;\n\n\n\n robin_hood::unordered_node_set<uint64_t> kmer_occurence{};\n\n\n\n size_t low_lvl_kmer_sum = 0;\n\n bool is_merged = starts_with(record.bin_name, merged_bin_prefix);\n\n\n\n for (auto const & filename : record.filenames)\n", "file_path": "src/count_HIBF_kmers_based_on_binning.cpp", "rank": 24, "score": 72812.76593100585 }, { "content": "struct chopper_pack_record\n\n{\n\n std::string bin_name{};\n\n int64_t hidx{};\n\n int64_t lidx{-1};\n\n std::vector<std::string> filenames{};\n\n size_t bins{};\n\n size_t max_size{};\n\n\n\n bool operator==(chopper_pack_record const & other) const\n\n {\n\n return std::tie(bin_name, hidx, lidx, filenames, bins, max_size) ==\n\n std::tie(other.bin_name, other.hidx, other.lidx, other.filenames, other.bins, other.max_size);\n\n }\n\n\n\n bool operator!=(chopper_pack_record const & other) const\n\n {\n\n return std::tie(bin_name, hidx, lidx, filenames, bins, max_size) !=\n\n std::tie(other.bin_name, other.hidx, other.lidx, other.filenames, other.bins, other.max_size);\n\n }\n", "file_path": "include/chopper/detail_parse_chopper_pack_line.hpp", "rank": 25, "score": 71866.91125875707 }, { "content": "struct map_distance_matrix : std::unordered_map<size_t, double>\n\n{\n\n using base_t = std::unordered_map<size_t, double>;\n\n using value_type = double;\n\n using size_type = size_t;\n\n\n\n struct proxy\n\n {\n\n /*!\\name Construction, destruction and assignment\n\n * \\{\n\n */\n\n proxy() = default; //!\\brief Default construction.\n\n proxy(proxy const & rhs) = default; //!\\brief Copy construction.\n\n proxy(proxy && rhs) = default; //!\\brief Move construction.\n\n proxy & operator=(proxy const & rhs) = default; //!\\brief Copy assignment.\n\n proxy & operator=(proxy && rhs) = default; //!\\brief Move assignment.\n\n ~proxy() = default; //!\\brief Destruction.\n\n\n\n //!\\brief Constructing from host and value\n\n proxy(map_distance_matrix & matrix, double val, size_t index_) :\n", "file_path": "include/chopper/split/map_distance_matrix.hpp", "rank": 26, "score": 69294.23330100182 }, { "content": "#pragma once\n\n\n\n/**\n\n * @file hyperloglog.hpp\n\n * @brief HyperLogLog cardinality estimator\n\n * @date Created 2013/3/20\n\n * @author Hideaki Ohno\n\n * \n\n * Copied to this location from github by Felix Droop - Jan 5 2021\n\n * Modified a lot for a bugfix, improvements and functional changes (64 bit hashes)\n\n */\n\n\n\n#include <vector>\n\n#include <array>\n\n#include <cmath>\n\n#include <sstream>\n\n#include <stdexcept>\n\n#include <algorithm>\n\n#include <iostream> \n\n#include <numeric>\n", "file_path": "include/chopper/union/hyperloglog.hpp", "rank": 27, "score": 65930.75122722687 }, { "content": "#include <cassert>\n\n\n\n#include <seqan3/utility/container/aligned_allocator.hpp>\n\n\n\n#include <xxh3.h>\n\n#include <x86/avx.h>\n\n#include <x86/avx2.h>\n\n\n\n// constexpr function to precompute values for the indicator function\n\nconstexpr std::array<float, 61> precompute_values()\n\n{\n\n std::array<float, 61> arr{};\n\n for (size_t i = 0; i < 61; ++i)\n\n {\n\n arr[i] = 1.0f / static_cast<float>(((uint64_t)1) << i);\n\n }\n\n return arr;\n\n}\n\n\n\n/** @class hyperloglog\n\n * @brief Implement of 'HyperLogLog' estimate cardinality algorithm\n\n */\n", "file_path": "include/chopper/union/hyperloglog.hpp", "rank": 28, "score": 65924.69262126915 }, { "content": " */ \n\n void merge(hyperloglog const & other)\n\n {\n\n assert(m_ == other.m_);\n\n\n\n for (size_t i = 0; i < m_; ++i)\n\n {\n\n if (M_[i] < other.M_[i])\n\n {\n\n M_[i] = other.M_[i];\n\n }\n\n }\n\n }\n\n\n\n /**\n\n * Merges the estimate from 'other' into this object\n\n * The number of registers in each must be the same.\n\n * This function is implemented using SIMD instructions.\n\n * WARNING: This function is undefined bevahior if this.b_ == 4\n\n * \n", "file_path": "include/chopper/union/hyperloglog.hpp", "rank": 29, "score": 65924.18424445216 }, { "content": " void restore(std::istream& is) \n\n {\n\n try\n\n {\n\n uint8_t b = 0;\n\n is.read((char*)&b, sizeof(b));\n\n hyperloglog tempHLL(b);\n\n is.read((char*)&(tempHLL.M_[0]), sizeof(M_[0]) * tempHLL.m_);\n\n if (is.fail())\n\n {\n\n throw std::runtime_error(\"Failed to restore a HyperLogLog sketch from a file.\");\n\n } \n\n swap(tempHLL);\n\n }\n\n catch (std::invalid_argument const & err)\n\n {\n\n // turn the invalid argument error to a runtime error, because it is dependent on the file contents here\n\n throw std::runtime_error(\"Failed to restore a HyperLogLog sketch from a file.\");\n\n }\n\n }\n", "file_path": "include/chopper/union/hyperloglog.hpp", "rank": 30, "score": 65923.43517228686 }, { "content": " alphaMM_float_ = static_cast<float>(alphaMM_);\n\n // 64 bits where the last b are ones and the rest zeroes\n\n mask_ = (1 << b) - 1;\n\n }\n\n\n\n /**\n\n * Adds element to the estimator\n\n *\n\n * @param[in] str string to add\n\n * @param[in] len length of string\n\n */\n\n void add(const char* str, uint64_t len) \n\n {\n\n uint64_t hash = XXH3_64bits(str, len);\n\n // the first b_ bits are used to distribute the leading zero counts along M_\n\n uint64_t index = hash >> (64 - b_);\n\n // WARNING: __builtin_clzl() only works with g++ and clang\n\n // the bitwise-or with mask_ assures that we get at most 64 - b_ as value. \n\n // Otherwise the count for hash = 0 would be 64\n\n uint8_t rank = __builtin_clzl((hash << b_) | mask_) + 1;\n", "file_path": "include/chopper/union/hyperloglog.hpp", "rank": 31, "score": 65922.05472813727 }, { "content": " * @exception std::runtime_error When failed to dump.\n\n */\n\n void dump(std::ostream& os) const \n\n {\n\n os.write((char*)&b_, sizeof(b_));\n\n os.write((char*)&M_[0], sizeof(M_[0]) * M_.size());\n\n os.flush();\n\n if (os.fail())\n\n {\n\n throw std::runtime_error(\"Failed to dump a HyperLogLog sketch to a file.\");\n\n }\n\n }\n\n\n\n /**\n\n * Restore the status from a stream\n\n * \n\n * @param[in] is The input stream where the status is saved\n\n *\n\n * @exception std::runtime_error When failed to restore.\n\n */\n", "file_path": "include/chopper/union/hyperloglog.hpp", "rank": 32, "score": 65920.9662753923 }, { "content": "\n\n // compute first estimate\n\n double estimate = alphaMM_float_ / sum; \n\n\n\n // use linear counting of zeros for small values\n\n if (estimate <= 2.5 * m_) \n\n {\n\n uint32_t zeros = 0u;\n\n\n\n for(size_t i = 0; i < m_; ++i) {\n\n if (!M_[i]) ++zeros;\n\n }\n\n\n\n if (zeros != 0u) \n\n {\n\n estimate = m_ * std::log(static_cast<double>(m_) / static_cast<double>(zeros));\n\n }\n\n }\n\n\n\n return estimate;\n", "file_path": "include/chopper/union/hyperloglog.hpp", "rank": 33, "score": 65920.42892659991 }, { "content": " M_[index] = std::max(rank, M_[index]);\n\n }\n\n\n\n /**\n\n * Estimates cardinality value.\n\n *\n\n * @return Estimated cardinality value.\n\n */\n\n double estimate() const \n\n {\n\n // compute indicator formula\n\n double sum = 0.0;\n\n for (uint8_t c : M_)\n\n {\n\n sum += exp2_rcp[c];\n\n }\n\n double estimate = alphaMM_ / sum; \n\n\n\n // use linear counting of zeros for small values\n\n if (estimate <= 2.5 * m_) \n", "file_path": "include/chopper/union/hyperloglog.hpp", "rank": 34, "score": 65920.32055332132 }, { "content": "\n\nprivate:\n\n static constexpr std::array<float, 61> exp2_rcp = precompute_values();\n\n\n\n uint64_t mask_; ///< mask for the rank bits\n\n double alphaMM_; ///< alpha * m^2\n\n float alphaMM_float_; ///< alpha * m^2\n\n uint64_t m_; ///< register size\n\n uint8_t b_; ///< register bit width\n\n std::vector<uint8_t, seqan3::aligned_allocator<uint8_t, 256u>> M_; ///< registers\n\n};\n", "file_path": "include/chopper/union/hyperloglog.hpp", "rank": 35, "score": 65920.17865724514 }, { "content": " /**\n\n * Exchanges the content of the instance\n\n *\n\n * @param[in,out] rhs Another HyperLogLog instance\n\n */\n\n void swap(hyperloglog& rhs) \n\n {\n\n std::swap(mask_, rhs.mask_);\n\n std::swap(alphaMM_, rhs.alphaMM_);\n\n std::swap(alphaMM_float_, rhs.alphaMM_float_);\n\n std::swap(m_, rhs.m_);\n\n std::swap(b_, rhs.b_);\n\n M_.swap(rhs.M_); \n\n }\n\n\n\n /**\n\n * Dump the current status to a stream\n\n *\n\n * @param[out] os The output stream where the data is saved\n\n *\n", "file_path": "include/chopper/union/hyperloglog.hpp", "rank": 36, "score": 65919.92304366887 }, { "content": " * @param[in] other HyperLogLog instance to be merged\n\n * \n\n * @return estimated cardinality of the new merged sketch\n\n */\n\n double merge_and_estimate_SIMD(hyperloglog const & other) \n\n {\n\n assert(m_ == other.m_);\n\n assert(b_ >= 5);\n\n\n\n // this is safe when b_ is at least 5. Then, M_'s size in bits is \n\n // 2^x * 2^5 * 8 = 2^x * 256 >= 256, where x is an integer >= 1\n\n // also, M_ is 256 bit aligned in memory\n\n simde__m256i* it = reinterpret_cast<simde__m256i*>(&*(M_.begin()));\n\n const simde__m256i* other_it = reinterpret_cast< const simde__m256i*>(&*(other.M_.begin()));\n\n simde__m256i* end = reinterpret_cast<simde__m256i*>(&*(M_.end()));\n\n\n\n simde__m256 packed_sum = simde_mm256_set1_ps(0.0f);\n\n\n\n for (; it != end; ++it, ++other_it)\n\n {\n", "file_path": "include/chopper/union/hyperloglog.hpp", "rank": 37, "score": 65919.82837384721 }, { "content": " // this merges the registers by computing the byte-wise maximum\n\n *it = simde_mm256_max_epu8(*it, *other_it);\n\n \n\n // get pointer to iterate over the single merged registers\n\n uint8_t* reg_it = reinterpret_cast<uint8_t*>(it);\n\n\n\n // get floats with two to the power of minus the value in the merged registers and sum up\n\n packed_sum = simde_mm256_add_ps(packed_sum, simde_mm256_set_ps(exp2_rcp[*reg_it], exp2_rcp[*(reg_it + 1)], \n\n exp2_rcp[*(reg_it + 2)], exp2_rcp[*(reg_it + 3)],\n\n exp2_rcp[*(reg_it + 4)], exp2_rcp[*(reg_it + 5)],\n\n exp2_rcp[*(reg_it + 6)], exp2_rcp[*(reg_it + 7)]));\n\n\n\n // repeat 3 times...\n\n packed_sum = simde_mm256_add_ps(packed_sum, simde_mm256_set_ps(exp2_rcp[*(reg_it + 8)], exp2_rcp[*(reg_it + 9)], \n\n exp2_rcp[*(reg_it + 10)], exp2_rcp[*(reg_it + 11)],\n\n exp2_rcp[*(reg_it + 12)], exp2_rcp[*(reg_it + 13)],\n\n exp2_rcp[*(reg_it + 14)], exp2_rcp[*(reg_it + 15)]));\n\n\n\n packed_sum = simde_mm256_add_ps(packed_sum, simde_mm256_set_ps(exp2_rcp[*(reg_it + 16)], exp2_rcp[*(reg_it + 17)], \n\n exp2_rcp[*(reg_it + 18)], exp2_rcp[*(reg_it + 19)],\n", "file_path": "include/chopper/union/hyperloglog.hpp", "rank": 38, "score": 65917.30310626733 }, { "content": " }\n\n\n\n M_.shrink_to_fit();\n\n double alpha;\n\n switch (m_) \n\n {\n\n case 16:\n\n alpha = 0.673;\n\n break;\n\n case 32:\n\n alpha = 0.697;\n\n break;\n\n case 64:\n\n alpha = 0.709;\n\n break;\n\n default:\n\n alpha = 0.7213 / (1.0 + 1.079 / m_);\n\n break;\n\n }\n\n alphaMM_ = alpha * m_ * m_;\n", "file_path": "include/chopper/union/hyperloglog.hpp", "rank": 39, "score": 65917.30310626733 }, { "content": " exp2_rcp[*(reg_it + 20)], exp2_rcp[*(reg_it + 21)],\n\n exp2_rcp[*(reg_it + 22)], exp2_rcp[*(reg_it + 23)]));\n\n\n\n packed_sum = simde_mm256_add_ps(packed_sum, simde_mm256_set_ps(exp2_rcp[*(reg_it + 24)], exp2_rcp[*(reg_it + 25)], \n\n exp2_rcp[*(reg_it + 26)], exp2_rcp[*(reg_it + 27)],\n\n exp2_rcp[*(reg_it + 28)], exp2_rcp[*(reg_it + 29)],\n\n exp2_rcp[*(reg_it + 30)], exp2_rcp[*(reg_it + 31)]));\n\n }\n\n\n\n // sum up the 4 values in the packed SSE variable\n\n float sum = 0.0;\n\n float* sum_it = reinterpret_cast<float*>(&packed_sum);\n\n sum += *sum_it;\n\n sum += *(sum_it + 1);\n\n sum += *(sum_it + 2);\n\n sum += *(sum_it + 3);\n\n sum += *(sum_it + 4);\n\n sum += *(sum_it + 5);\n\n sum += *(sum_it + 6);\n\n sum += *(sum_it + 7);\n", "file_path": "include/chopper/union/hyperloglog.hpp", "rank": 40, "score": 65917.30310626733 }, { "content": " }\n\n\n\n /**\n\n * Clears all internal registers.\n\n */\n\n void clear() \n\n {\n\n std::fill(M_.begin(), M_.end(), 0);\n\n }\n\n\n\n /**\n\n * Returns size of register.\n\n *\n\n * @return Register size\n\n */\n\n uint64_t registerSize() const \n\n {\n\n return m_;\n\n }\n\n\n", "file_path": "include/chopper/union/hyperloglog.hpp", "rank": 41, "score": 65917.30310626733 }, { "content": " {\n\n uint32_t zeros = 0;\n\n\n\n for(size_t i = 0; i < m_; ++i) {\n\n if (!M_[i]) ++zeros;\n\n }\n\n\n\n if (zeros != 0u) \n\n {\n\n estimate = m_ * std::log(static_cast<double>(m_) / static_cast<double>(zeros));\n\n }\n\n } \n\n return estimate;\n\n }\n\n\n\n /**\n\n * Merges the estimate from 'other' into this object\n\n * The number of registers in each must be the same.\n\n * \n\n * @param[in] other HyperLogLog instance to be merged\n", "file_path": "include/chopper/union/hyperloglog.hpp", "rank": 42, "score": 65917.30310626733 }, { "content": "struct cmd_arguments\n\n{\n\n std::filesystem::path chopper_split_filename{};\n\n uint8_t k{25};\n\n size_t overlap{250};\n\n bool verbose;\n\n};\n\n\n\nvoid initialize_argument_parser(seqan3::argument_parser & parser, cmd_arguments & args)\n\n{\n\n parser.info.author = \"Avenja\";\n\n parser.info.short_description = \"Count unique kmers in bins.\";\n\n parser.info.version = \"1.0.0\";\n\n\n\n parser.add_option(args.chopper_split_filename, 'f', \"files\", \"Give me a file produced by chopper split.\",\n\n seqan3::option_spec::required);\n\n parser.add_option(args.k, 'k', \"kmer-size\", \"The kmer to count with.\");\n\n parser.add_option(args.overlap, 'l', \"overlap\", \"The overlap between splitted bins.\");\n\n parser.add_flag(args.verbose, 'v', \"verbose\", \"Display more information.\");\n\n}\n\n\n", "file_path": "src/count_kmers_per_bin.cpp", "rank": 43, "score": 49721.39031607608 }, { "content": "struct cmd_arguments\n\n{\n\n std::filesystem::path binning_file{};\n\n std::filesystem::path count_file{};\n\n std::filesystem::path output_file{};\n\n uint8_t k{25};\n\n size_t threads{std::thread::hardware_concurrency()};\n\n bool verbose;\n\n};\n\n\n\nvoid initialize_argument_parser(seqan3::argument_parser & parser, cmd_arguments & args)\n\n{\n\n parser.info.author = \"Avenja\";\n\n parser.info.short_description = \"Count unique kmers in bins.\";\n\n parser.info.version = \"1.0.0\";\n\n\n\n parser.add_option(args.binning_file, 'b', \"binning\", \"Give me a binning file.\", seqan3::option_spec::required);\n\n parser.add_option(args.count_file, 'c', \"counts\", \"Give me a kmer counts file.\", seqan3::option_spec::required);\n\n parser.add_option(args.k, 'k', \"kmer-size\", \"The kmer size to count with.\");\n\n parser.add_option(args.threads, 't', \"threads\", \"The number of threads to use.\");\n\n parser.add_option(args.output_file, 'o', \"output\", \"Give me an output file.\", seqan3::option_spec::required);\n\n}\n\n\n", "file_path": "src/count_HIBF_kmers_based_on_binning.cpp", "rank": 44, "score": 48757.01525782011 }, { "content": "#include <unordered_set>\n\n#include <vector>\n\n#include <fstream>\n\n#include <string>\n\n#include <cmath>\n\n\n\n#include <seqan3/std/filesystem>\n\n#include <seqan3/argument_parser/all.hpp>\n\n#include <seqan3/io/sequence_file/input.hpp>\n\n#include <seqan3/search/kmer_index/shape.hpp>\n\n#include <seqan3/search/views/kmer_hash.hpp>\n\n#include <seqan3/alphabet/nucleotide/dna4.hpp>\n\n\n\n#include <chopper/union/hyperloglog.hpp>\n\n#include <chopper/print_peak_memory_usage.hpp>\n\n\n", "file_path": "src/measure_hyperloglog.cpp", "rank": 45, "score": 37333.05853401706 }, { "content": "\n\n try\n\n {\n\n parser.parse();\n\n }\n\n catch (seqan3::argument_parser_error const & ext)\n\n {\n\n std::cerr << \"[COMMAND LINE INPUT ERROR] \" << ext.what() << std::endl;\n\n return -1;\n\n }\n\n\n\n using fields = seqan3::fields<seqan3::field::seq, seqan3::field::id>;\n\n using sequence_file_type = seqan3::sequence_file_input<input_traits, fields>;\n\n\n\n sequence_file_type seq_file{args.input_path};\n\n std::ofstream fout{args.output_path};\n\n\n\n std::vector<hyperloglog> sketches;\n\n std::unordered_set<uint64_t> control;\n\n\n", "file_path": "src/measure_hyperloglog.cpp", "rank": 46, "score": 37328.8605751334 }, { "content": " sketch.add(reinterpret_cast<char*>(&hash), sizeof(hash));\n\n }\n\n }\n\n\n\n for (auto & sketch : sketches)\n\n {\n\n double const expected_error = 1.04 / std::sqrt(sketch.registerSize());\n\n double const actual_error = std::abs(1.0 - std::round(sketch.estimate()) / static_cast<double>(control.size()));\n\n\n\n fout << id << '\\t' << seq.size() << '\\t' << sketch.registerSize() << '\\t' << static_cast<uint64_t>(sketch.estimate())\n\n << '\\t' << control.size() << '\\t' << expected_error << '\\t' << actual_error << '\\n';\n\n }\n\n \t\n\n // clear for the next sequence\n\n for (auto & sketch : sketches)\n\n {\n\n sketch.clear();\n\n }\n\n control.clear();\n\n }\n\n\n\n print_peak_memory_usage();\n\n}", "file_path": "src/measure_hyperloglog.cpp", "rank": 47, "score": 37322.76038427561 }, { "content": " // write metadata\n\n fout << \"# input file: \" << args.input_path << '\\n';\n\n fout << \"# k: \" << (int)args.k << '\\n';\n\n\n\n // write header\n\n fout << \"sequence_id\\tsequence_length\\tsketch_register_size\\testimated_cardinality\\tactual_cardinality\\t\"\n\n << \"expected_relative_error\\tactual_relative_error\\n\";\n\n\n\n for (uint8_t bits : args.hll_bits)\n\n {\n\n sketches.emplace_back(bits);\n\n }\n\n\n\n for (auto && [seq, id] : seq_file)\n\n {\n\n for (uint64_t hash : seq | seqan3::views::kmer_hash(seqan3::ungapped{args.k}))\n\n {\n\n control.insert(hash);\n\n for (auto & sketch : sketches)\n\n {\n", "file_path": "src/measure_hyperloglog.cpp", "rank": 48, "score": 37320.33748967811 }, { "content": "#pragma once\n\n\n\n#include <seqan3/std/ranges>\n\n#include <vector>\n\n\n\n#include <seqan3/utility/views/to.hpp>\n\n\n\n#include <chopper/pack/pack_data.hpp>\n\n\n\nvoid sort_by(pack_data & data, size_t column_to_sort_by)\n\n{\n\n // Note: We may only sort by extra information\n\n\n\n // generate permutation of indices sorted in descinding order by the sequence lengths\n\n auto permutation = std::views::iota(0u, data.filenames.size()) | seqan3::views::to<std::vector>;\n\n assert(permutation.size() == data.filenames.size());\n\n\n\n auto const & info = data.extra_information;\n\n auto compare = [&info,column_to_sort_by] (auto const l, auto const r)\n\n { return info[l][column_to_sort_by] < info[r][column_to_sort_by]; };\n", "file_path": "include/chopper/pack/aggregate_by.hpp", "rank": 58, "score": 29843.87150067658 }, { "content": "#pragma once\n\n\n\n#include <seqan/index.h>\n\n\n", "file_path": "include/chopper/split/minimizer.hpp", "rank": 59, "score": 29840.771146423547 }, { "content": "#pragma once\n\n\n\n#include <string>\n\n#include <string_view>\n\n\n\nbool starts_with(std::string const & target, std::string_view const & query)\n\n{\n\n size_t index{};\n\n while (index < target.size() && index < query.size() && target[index] == query[index])\n\n ++index;\n\n return index == query.size();\n\n}\n", "file_path": "include/chopper/detail_starts_with.hpp", "rank": 60, "score": 29840.65073528515 }, { "content": " return lhs.value == rhs.value;\n\n }\n\n\n\n constexpr friend bool operator!=(minimizer const & lhs, minimizer const & rhs) noexcept\n\n {\n\n return lhs.value != rhs.value;\n\n }\n\n\n\n constexpr friend bool operator<(minimizer const & lhs, minimizer const & rhs) noexcept\n\n {\n\n return lhs.value < rhs.value;\n\n }\n\n constexpr friend bool operator<=(minimizer const & lhs, minimizer const & rhs) noexcept\n\n {\n\n return lhs.value <= rhs.value;\n\n }\n\n constexpr friend bool operator>(minimizer const & lhs, minimizer const & rhs) noexcept\n\n {\n\n return lhs.value > rhs.value;\n\n }\n\n constexpr friend bool operator>=(minimizer const & lhs, minimizer const & rhs) noexcept\n\n {\n\n return lhs.value >= rhs.value;\n\n }\n\n};\n\n\n", "file_path": "include/chopper/split/minimizer.hpp", "rank": 61, "score": 29836.61393875876 }, { "content": " return seqan::String<minimizer>{};\n\n\n\n uint64_t possible = seqan::length(text) > w ? seqan::length(text) - w + 1 : 1;\n\n uint32_t windowKmers = w - k + 1;\n\n\n\n seqan::String<minimizer> kmerHashes{};\n\n reserve(kmerHashes, possible); // maybe rather reserve to expected?\n\n\n\n // Stores hash, begin and end for all k-mers in the window\n\n std::deque<uint64_t> windowValues;\n\n\n\n auto it = begin(text);\n\n hashInit(it);\n\n\n\n // Initialisation. We need to compute all hashes for the first window.\n\n for (uint32_t i = 0; i < windowKmers; ++i)\n\n {\n\n // Get smallest canonical k-mer\n\n uint64_t kmerHash = hashNext(it) ^ seed;\n\n\n", "file_path": "include/chopper/split/minimizer.hpp", "rank": 62, "score": 29836.61393875876 }, { "content": " {\n\n return seqan::hashNext(revCompShape, it);\n\n }\n\n\n\n inline auto length()\n\n {\n\n return seqan::length(kmerShape);\n\n }\n\n\n\n inline void resize(uint16_t newKmerSize, uint32_t neww)\n\n {\n\n k = newKmerSize;\n\n w = neww;\n\n seqan::resize(kmerShape, k);\n\n seqan::resize(revCompShape, k);\n\n }\n\n\n\n seqan::String<minimizer> getMinimizer(seqan::String<seqan::Dna> const & text)\n\n {\n\n if (k > seqan::length(text))\n", "file_path": "include/chopper/split/minimizer.hpp", "rank": 63, "score": 29836.61393875876 }, { "content": " {\n\n data.filenames[index - 1] = data.filenames[index - 1] + \";\" + data.filenames[index];\n\n data.kmer_counts[index - 1] = data.kmer_counts[index - 1] + data.kmer_counts[index]; // todo sum is bad\n\n data.filenames.erase(data.filenames.begin() + index);\n\n data.kmer_counts.erase(data.kmer_counts.begin() + index);\n\n data.extra_information.erase(data.extra_information.begin() + index);\n\n }\n\n else\n\n {\n\n current_info = data.extra_information[index][column_to_aggregate_by];\n\n ++index;\n\n }\n\n }\n\n}\n", "file_path": "include/chopper/pack/aggregate_by.hpp", "rank": 64, "score": 29836.61393875876 }, { "content": "\n\n if (kmerHash < back(kmerHashes).value)\n\n {\n\n current_pos = pos + windowValues.size() - 1; // at end\n\n seqan::appendValue(kmerHashes, minimizer{kmerHash, current_pos});\n\n\n\n }\n\n else if (current_pos == pos - 1) // minimum was at the beginning and went out of scope\n\n {\n\n min = std::min_element(std::begin(windowValues), std::end(windowValues), less_or_equal_compare);\n\n\n\n if (current_pos != pos + std::distance(std::begin(windowValues), min))\n\n {\n\n current_pos = pos + std::distance(std::begin(windowValues), min);\n\n seqan::appendValue(kmerHashes, minimizer{*min, current_pos});\n\n }\n\n }\n\n }\n\n\n\n return kmerHashes;\n\n }\n\n};\n", "file_path": "include/chopper/split/minimizer.hpp", "rank": 65, "score": 29836.61393875876 }, { "content": " windowValues.push_back(kmerHash);\n\n\n\n ++it;\n\n }\n\n\n\n auto less_or_equal_compare = [] (auto const & a, auto const & b) { return a <= b; };\n\n auto min = std::min_element(std::begin(windowValues), std::end(windowValues), less_or_equal_compare);\n\n seqan::appendValue(kmerHashes, minimizer{*min, static_cast<uint64_t>(std::distance(std::begin(windowValues), min))});\n\n // appendValue(kmerHashPoss, );\n\n\n\n // For the following windows, we remove the first window k-mer (is now not in window) and add the new k-mer\n\n // that results from the window shifting\n\n uint64_t current_pos{kmerHashes[0].position};\n\n for (uint64_t pos = 1; pos < possible; ++pos)\n\n {\n\n windowValues.pop_front();\n\n\n\n uint64_t kmerHash = hashNext(it) ^ seed;\n\n windowValues.push_back(kmerHash);\n\n ++it;\n", "file_path": "include/chopper/split/minimizer.hpp", "rank": 66, "score": 29836.61393875876 }, { "content": " template<typename TIt>\n\n inline void hashInit(TIt it)\n\n {\n\n seqan::hashInit(kmerShape, it);\n\n }\n\n\n\n template<typename TIt>\n\n inline auto hashNext(TIt it)\n\n {\n\n return seqan::hashNext(kmerShape, it);\n\n }\n\n\n\n template<typename TIt>\n\n inline void revHashInit(TIt it)\n\n {\n\n seqan::hashInit(revCompShape, it);\n\n }\n\n\n\n template<typename TIt>\n\n inline auto revHashNext(TIt it)\n", "file_path": "include/chopper/split/minimizer.hpp", "rank": 67, "score": 29836.61393875876 }, { "content": " constexpr minimizer(uint64_t const v) : value{v} {};\n\n //!\\brief Copy construction via assignment from uint64_t.\n\n constexpr minimizer & operator=(uint64_t const v) { value = v; return *this; };\n\n //!\\brief Move constructor from uint64_t.\n\n constexpr minimizer(uint64_t && v) : value{v} {};\n\n //!\\brief Move assignment from uint64_t.\n\n constexpr minimizer & operator=(uint64_t && v) { value = v; return *this; };\n\n\n\n constexpr minimizer(uint64_t const v, uint64_t const p) : value{v}, position{p} {};\n\n\n\n operator uint64_t() const\n\n {\n\n return value;\n\n }\n\n\n\n uint64_t value{};\n\n uint64_t position{};\n\n\n\n constexpr friend bool operator==(minimizer const & lhs, minimizer const & rhs) noexcept\n\n {\n", "file_path": "include/chopper/split/minimizer.hpp", "rank": 68, "score": 29836.61393875876 }, { "content": " std::sort(permutation.begin(), permutation.end(), compare);\n\n\n\n // apply permutation\n\n for (size_t i = 0; i < permutation.size(); i++)\n\n {\n\n auto current = i;\n\n while (i != permutation[current])\n\n {\n\n auto next = permutation[current];\n\n std::swap(data.filenames[current], data.filenames[next]);\n\n std::swap(data.kmer_counts[current], data.kmer_counts[next]);\n\n std::swap(data.extra_information[current], data.extra_information[next]);\n\n permutation[current] = current;\n\n current = next;\n\n }\n\n permutation[current] = current;\n\n }\n\n}\n\n\n\nvoid aggregate_by(pack_data & data, size_t column_to_aggregate_by)\n", "file_path": "include/chopper/pack/aggregate_by.hpp", "rank": 69, "score": 29836.61393875876 }, { "content": "{\n\n // Note: We may only aggregate by extra information\n\n assert(data.filenames.size() == data.kmer_counts.size());\n\n assert(data.filenames.size() == data.extra_information.size());\n\n assert(column_to_aggregate_by < data.extra_information[0].size());\n\n\n\n if (data.filenames.size() == 0)\n\n return;\n\n\n\n sort_by(data, column_to_aggregate_by);\n\n\n\n assert(!data.extra_information.empty());\n\n assert(!data.extra_information[column_to_aggregate_by].empty());\n\n\n\n size_t index{};\n\n std::string current_info{data.extra_information[index][column_to_aggregate_by]};\n\n ++index;\n\n while (index < data.extra_information.size())\n\n {\n\n if (current_info == data.extra_information[index][column_to_aggregate_by])\n", "file_path": "include/chopper/pack/aggregate_by.hpp", "rank": 70, "score": 29836.61393875876 }, { "content": "#pragma once\n\n\n\n#include <algorithm>\n\n#include <fstream>\n\n#include <iostream>\n\n#include <limits>\n\n#include <numeric>\n\n#include <vector>\n\n\n\n#include <chopper/pack/pack_data.hpp>\n\n#include <chopper/pack/print_matrix.hpp>\n\n\n\n/*!\\brief Distributes x Technical Bins across y User Bins while minimizing the maximal Technical Bin size\n\n *\n\n * # Terminology\n\n *\n\n * ## Technical Bin\n\n * \\copydetails simple_binning::num_technical_bins\n\n *\n\n * ## User Bin\n", "file_path": "include/chopper/pack/simple_binning.hpp", "rank": 71, "score": 28890.63593693706 }, { "content": "#pragma once\n\n\n\n#include <algorithm>\n\n#include <cassert>\n\n#include <fstream>\n\n#include <iostream>\n\n#include <limits>\n\n#include <numeric>\n\n#include <vector>\n\n\n\n#include <seqan3/utility/views/to.hpp>\n\n#include <seqan3/core/debug_stream.hpp>\n\n#include <seqan3/std/filesystem>\n\n\n\n#include <chopper/detail_bin_prefixes.hpp>\n\n#include <chopper/pack/pack_config.hpp>\n\n#include <chopper/pack/pack_data.hpp>\n\n#include <chopper/pack/print_matrix.hpp>\n\n#include <chopper/pack/simple_binning.hpp>\n\n\n\n#include <chopper/union/user_bin_sequence.hpp>\n\n\n", "file_path": "include/chopper/pack/hierarchical_binning.hpp", "rank": 72, "score": 28889.78428417614 }, { "content": "#include <future>\n\n#include <fstream>\n\n#include <thread>\n\n\n\n#define SEQAN_HAS_ZLIB 1\n\n#define SEQAN3_HAS_ZLIB 1\n\n\n\n#include <seqan3/io/sequence_file/all.hpp>\n\n#include <seqan3/io/views/async_input_buffer.hpp>\n\n#include <seqan3/search/views/kmer_hash.hpp>\n\n#include <seqan3/search/views/minimiser_hash.hpp>\n\n#include <seqan3/utility/views/to.hpp>\n\n#include <seqan3/std/filesystem>\n\n\n\n#include <chopper/union/hyperloglog.hpp>\n\n\n\n#include <robin_hood.h>\n\n\n\nvoid write_cluster_data(std::pair<std::string, std::vector<std::string>> const & cluster,\n\n uint64_t size,\n", "file_path": "include/chopper/count/count_kmers.hpp", "rank": 73, "score": 28889.307225100576 }, { "content": "#include <iostream>\n\n#include <fstream>\n\n#include <set>\n\n#include <queue>\n\n\n\n#include <lemon/color.h>\n\n#include <lemon/concepts/digraph.h>\n\n#include <lemon/core.h>\n\n#include <lemon/dimacs.h>\n\n#include <lemon/list_graph.h>\n\n#include <lemon/static_graph.h>\n\n\n\n#define SEQAN3_HAS_ZLIB 1\n\n\n\n#include <seqan3/argument_parser/all.hpp>\n\n#include <seqan3/core/debug_stream.hpp>\n\n#include <seqan3/range/views/persist.hpp>\n\n#include <seqan3/utility/views/to.hpp>\n\n#include <seqan3/utility/views/zip.hpp>\n\n#include <seqan3/std/filesystem>\n", "file_path": "include/chopper/split/traverse_graph.hpp", "rank": 74, "score": 28887.579395578883 }, { "content": "#pragma once\n\n\n\n#include<string>\n\n#include<vector>\n\n\n", "file_path": "include/chopper/pack/pack_data.hpp", "rank": 75, "score": 28886.225149807342 }, { "content": " permutation[current] = current;\n\n }\n\n }\n\n\n\n /*!\\brief Initialize the matrices M (hig_level_ibf), L (low_level_ibfs) and T (trace)\n\n *\n\n * \\image html hierarchical_dp_init.png\n\n */\n\n void initialization(std::vector<std::vector<size_t>> & matrix,\n\n std::vector<std::vector<size_t>> & ll_matrix,\n\n std::vector<std::vector<std::pair<size_t, size_t>>> & trace,\n\n std::vector<std::vector<uint64_t>> const & union_estimates)\n\n {\n\n // initialize first column\n\n for (size_t i = 0; i < num_technical_bins; ++i)\n\n {\n\n matrix[i][0] = user_bin_kmer_counts[0] / (i + 1);\n\n trace[i][0] = {0u, 0u}; // unnecessary?\n\n }\n\n\n", "file_path": "include/chopper/pack/hierarchical_binning.hpp", "rank": 76, "score": 28886.122433428296 }, { "content": "#pragma once\n\n\n\n#include <seqan3/std/charconv>\n\n\n\n#include <lemon/color.h>\n\n#include <lemon/concepts/digraph.h>\n\n#include <lemon/core.h>\n\n#include <lemon/dimacs.h>\n\n#include <lemon/list_graph.h>\n\n#include <lemon/static_graph.h>\n\n\n\n#include <seqan3/utility/char_operations/predicate.hpp>\n\n#include <seqan3/core/range/detail/misc.hpp>\n\n#include <seqan3/range/views/take_until.hpp>\n\n#include <seqan3/range/views/take_line.hpp>\n\n\n\n/* [source] --> [target] [target]\n\n * (2,10) (10,15) => (2,15)\n\n *\n\n * [source] --> [target] [target]\n", "file_path": "include/chopper/split/transform_graphs.hpp", "rank": 77, "score": 28885.026930818534 }, { "content": " }\n\n\n\n //!\\brief Executes the simple binning algorithm and packs user bins into technical bins.\n\n size_t execute()\n\n {\n\n std::vector<std::vector<size_t>> matrix(num_technical_bins); // rows\n\n for (auto & v : matrix)\n\n v.resize(num_user_bins, std::numeric_limits<size_t>::max()); // columns\n\n\n\n std::vector<std::vector<size_t>> trace(num_technical_bins); // rows\n\n for (auto & v : trace)\n\n v.resize(num_user_bins, std::numeric_limits<size_t>::max()); // columns\n\n\n\n size_t const extra_bins = num_technical_bins - num_user_bins + 1;\n\n\n\n // initialize first column (first row is initialized with inf)\n\n for (size_t i = 0; i < extra_bins; ++i)\n\n {\n\n matrix[i][0] = user_bin_kmer_counts[0] / (i + 1);\n\n }\n", "file_path": "include/chopper/pack/simple_binning.hpp", "rank": 78, "score": 28884.5953023167 }, { "content": "#pragma once\n\n\n\n#include <seqan/seq_io.h>\n\n\n\n#include <chopper/split/split_config.hpp>\n\n#include <chopper/split/split_data.hpp>\n\n#include <chopper/split/minimizer.hpp>\n\n\n\nbool load_minimizer_sequences(split_data & data,\n\n batch_config const & config,\n\n const char *fileName)\n\n{\n\n seqan::SeqFileIn inFile;\n\n if (!open(inFile, fileName))\n\n {\n\n std::cerr << \"Could not open \" << fileName << \" for reading!\" << std::endl;\n\n return false;\n\n }\n\n\n\n if (config.verbose)\n", "file_path": "include/chopper/split/sequence_input.hpp", "rank": 79, "score": 28884.440726110923 }, { "content": " v.resize(num_user_bins, {std::numeric_limits<size_t>::max(), std::numeric_limits<size_t>::max()}); // columns\n\n\n\n initialization(matrix, ll_matrix, trace, union_estimates);\n\n\n\n recursion(matrix, ll_matrix, trace, union_estimates);\n\n\n\n // print_matrix(matrix, num_technical_bins, num_user_bins, std::numeric_limits<size_t>::max());\n\n // print_matrix(ll_matrix, num_technical_bins, num_user_bins, std::numeric_limits<size_t>::max());\n\n // print_matrix(trace, num_technical_bins, num_user_bins, std::make_pair(std::numeric_limits<size_t>::max(), std::numeric_limits<size_t>::max()));\n\n\n\n backtracking(matrix, ll_matrix, trace);\n\n }\n\n\n\nprivate:\n\n /*!\\brief Sorts both input vectors (names and distribution) only by looking at the values in `distribution`.\n\n * \\param[in, out] names The names to be sorted in parallel to the `distribution` vector.\n\n * \\param[in, out] distribution The vector to be used to sort both input vectors by.\n\n */\n\n template <typename names_type, typename distribution_type>\n\n void sort_by_distribution(names_type & names, distribution_type & distribution)\n", "file_path": "include/chopper/pack/hierarchical_binning.hpp", "rank": 80, "score": 28884.410958403903 }, { "content": " node_map.set(source_node, std::vector<std::pair<uint32_t, uint32_t>>(number_of_sequences));\n\n node_map.set(sink_node, std::vector<std::pair<uint32_t, uint32_t>>(number_of_sequences));\n\n\n\n for (TConstIter it(seqan2_graph); !seqan::atEnd(it); ++it) // iterate over seqan2 nodes\n\n {\n\n TIdType id = seqan::sequenceId(seqan2_graph, *it);\n\n\n\n // fragment start and end\n\n auto regStart = seqan::fragmentBegin(seqan2_graph, *it);\n\n auto regEnd = seqan::fragmentBegin(seqan2_graph, *it) + seqan::fragmentLength(seqan2_graph, *it);\n\n\n\n uint32_t range_start{};\n\n uint32_t range_end{};\n\n\n\n if (regStart == 0)\n\n range_start = 0; // if it is the very first minimizer, include beginning of the sequence\n\n else\n\n range_start = data.sequences[id][regStart].position;\n\n\n\n if (regEnd >= seqan::length(data.sequences[id]))\n", "file_path": "include/chopper/split/transform_graphs.hpp", "rank": 81, "score": 28884.205820331597 }, { "content": "#pragma once\n\n\n\n#define SEQAN_HAS_ZLIB 1\n\n#define SEQAN3_HAS_ZLIB 1\n\n\n\n#include <seqan3/argument_parser/all.hpp>\n\n#include <seqan3/core/debug_stream.hpp>\n\n\n\n#include <chopper/count/count_config.hpp>\n\n#include <chopper/count/count_kmers.hpp>\n\n#include <chopper/count/read_data_file.hpp>\n\n#include <chopper/print_peak_memory_usage.hpp>\n\n\n\nvoid initialize_argument_parser(seqan3::argument_parser & parser, count_config & config)\n\n{\n\n parser.info.author = \"Avenja\";\n\n parser.info.short_description = \"Count all kmers of each file in a directory.\";\n\n parser.info.version = \"1.0.0\";\n\n\n\n parser.add_option(config.data_file, 'f', \"data_file\", \"Give me a filename to a seqinfo file.\", seqan3::option_spec::required);\n", "file_path": "include/chopper/count/chopper_count.hpp", "rank": 82, "score": 28883.95292784898 }, { "content": " // and what exactly is supposed to happen.\n\n if (cluster_vector[i].second.size() > 1)\n\n {\n\n throw std::runtime_error(\"This mode sadly was not implemented yet for multiple files grouped together.\");\n\n }\n\n \n\n // For one file in the cluster, the file stem is used with the .hll ending\n\n std::filesystem::path path = config.hll_dir / std::filesystem::path(cluster_vector[i].first).stem();\n\n path += \".hll\";\n\n std::ofstream hll_fout(path, std::ios::binary);\n\n sketch.dump(hll_fout);\n\n }\n\n }\n\n}\n", "file_path": "include/chopper/count/count_kmers.hpp", "rank": 83, "score": 28883.543168550652 }, { "content": " // Depending on cli flags given, use HyperLogLog estimates and/or rearrangement algorithms\n\n if (union_estimate_wanted)\n\n {\n\n user_bin_sequence ub_seq(names, user_bin_kmer_counts, hll_dir);\n\n \n\n if (rearrange_bins_wanted) ub_seq.rearrange_bins(max_ratio, num_threads);\n\n\n\n ub_seq.estimate_interval_unions(union_estimates, num_threads);\n\n }\n\n\n\n std::vector<std::vector<size_t>> matrix(num_technical_bins); // rows\n\n for (auto & v : matrix)\n\n v.resize(num_user_bins, std::numeric_limits<size_t>::max()); // columns\n\n\n\n std::vector<std::vector<size_t>> ll_matrix(num_technical_bins); // rows\n\n for (auto & v : ll_matrix)\n\n v.resize(num_user_bins, 0u); // columns\n\n\n\n std::vector<std::vector<std::pair<size_t, size_t>>> trace(num_technical_bins); // rows\n\n for (auto & v : trace)\n", "file_path": "include/chopper/pack/hierarchical_binning.hpp", "rank": 84, "score": 28883.542668909544 }, { "content": " previousVertex = nextVertex;\n\n j += seqan::fragmentLength(seqan2_graph, nextVertex);\n\n }\n\n }\n\n}\n\n\n\ntemplate <typename graph_type>\n\nvoid transfer_undirected_edges(lemon::ListDigraph & lemon_graph,\n\n std::vector<lemon::ListDigraph::Node> & nodes,\n\n lemon::ListDigraph::NodeMap<std::vector<std::pair<uint32_t, uint32_t>>> & node_map,\n\n graph_type const & seqan2_graph)\n\n{\n\n typedef typename seqan::VertexDescriptor<graph_type>::Type TVertexDescriptor;\n\n typedef typename seqan::Iterator<graph_type, seqan::EdgeIterator>::Type TConstEdIter;\n\n\n\n for (TConstEdIter itEd(seqan2_graph); !seqan::atEnd(itEd); ++itEd)\n\n {\n\n TVertexDescriptor source = seqan::sourceVertex(itEd);\n\n TVertexDescriptor target = seqan::targetVertex(itEd);\n\n\n", "file_path": "include/chopper/split/transform_graphs.hpp", "rank": 85, "score": 28883.19756888715 }, { "content": "#pragma once\n\n\n\n#include <chopper/pack/aggregate_by.hpp>\n\n#include <chopper/pack/hierarchical_binning.hpp>\n\n#include <chopper/pack/filenames_data_input.hpp>\n\n#include <chopper/print_peak_memory_usage.hpp>\n\n\n\nint set_up_and_parse_subparser_split(seqan3::argument_parser & parser, pack_config & config)\n\n{\n\n parser.info.version = \"1.0.0\";\n\n parser.info.author = \"Svenja Mehringer\";\n\n parser.info.email = \"[email protected]\";\n\n\n\n parser.info.description.emplace_back(\"The `pack` submodule will create a hierarchical binning that minimizes the \"\n\n \"space consumption of the resulting Interleaved Bloom Filter that you may \"\n\n \"build with the `build` submodule using the results.\");\n\n\n\n parser.add_option(config.data_file, 'f', \"filenames\",\n\n \"A tab separated file that contains the filepaths of sequence data you want to analyse.\\n\"\n\n \"The first column must contain the paths to sequence files separated by ';'.\\n\"\n", "file_path": "include/chopper/pack/chopper_pack.hpp", "rank": 86, "score": 28883.131497253053 }, { "content": " robin_hood::unordered_node_set<uint64_t> result;\n\n hyperloglog sketch(config.sketch_bits);\n\n\n\n for (auto && seq : sequence_vector)\n\n {\n\n if (config.disable_minimizers)\n\n compute_hashes(seq, compute_kmers, config, result, sketch);\n\n else\n\n compute_hashes(seq, compute_minimiser, config, result, sketch);\n\n }\n\n\n\n // print either the exact or the approximate count, depending on exclusively_hlls\n\n uint64_t size = config.exclusively_hlls ? static_cast<uint64_t>(sketch.estimate()) : result.size();\n\n\n\n #pragma omp critical\n\n write_cluster_data(cluster_vector[i], size, fout);\n\n\n\n if (!config.hll_dir.empty())\n\n {\n\n // For more than one file in the cluster, Felix doesn't know how to name the file\n", "file_path": "include/chopper/count/count_kmers.hpp", "rank": 87, "score": 28882.78853503124 }, { "content": "\n\n // copy filename clusters to vector\n\n std::vector<std::pair<std::string, std::vector<std::string>>> cluster_vector;\n\n for (auto const & cluster : filename_clusters)\n\n {\n\n cluster_vector.push_back(cluster);\n\n }\n\n\n\n #pragma omp parallel for schedule(static) num_threads(config.num_threads)\n\n for (size_t i = 0; i < cluster_vector.size(); ++i)\n\n {\n\n // read files\n\n std::vector<std::vector<seqan3::dna4>> sequence_vector;\n\n for (auto const & filename : cluster_vector[i].second)\n\n {\n\n sequence_file_type fin{filename};\n\n for (auto & [seq] : fin)\n\n sequence_vector.push_back(seq);\n\n }\n\n\n", "file_path": "include/chopper/count/count_kmers.hpp", "rank": 88, "score": 28882.384643199843 }, { "content": "#pragma once\n\n\n\n#include <sstream>\n\n\n\n#include <seqan3/core/debug_stream.hpp>\n\n#include <seqan3/io/sequence_file/input.hpp>\n\n\n\n#include <chopper/split/distance_matrix_initialiser.hpp>\n\n#include <chopper/split/filename_batches_range.hpp>\n\n#include <chopper/split/minimizer.hpp>\n\n#include <chopper/split/seqan2_msa_alignment.hpp>\n\n#include <chopper/split/sequence_input.hpp>\n\n#include <chopper/split/split_config.hpp>\n\n#include <chopper/split/split_data.hpp>\n\n#include <chopper/split/transform_graphs.hpp>\n\n#include <chopper/split/traverse_graph.hpp>\n\n\n\nint set_up_and_parse_subparser_split(seqan3::argument_parser & parser, split_config & config)\n\n{\n\n parser.info.version = \"1.0.0\";\n", "file_path": "include/chopper/split/chopper_split.hpp", "rank": 89, "score": 28882.369280369698 }, { "content": "#pragma once\n\n\n\n#include <seqan3/std/filesystem>\n\n\n\n#include <thread>\n\n\n", "file_path": "include/chopper/pack/pack_config.hpp", "rank": 90, "score": 28882.111463529953 }, { "content": "#pragma once\n\n\n\n#include <seqan3/std/filesystem>\n\n#include <thread>\n\n\n", "file_path": "include/chopper/count/count_config.hpp", "rank": 91, "score": 28882.111463529953 }, { "content": "#pragma once\n\n\n\n#include <seqan/sequence.h>\n\n\n\n#include <chopper/split/minimizer.hpp>\n\n\n", "file_path": "include/chopper/split/split_data.hpp", "rank": 92, "score": 28882.047777057884 }, { "content": " ll_matrix[i][j] = ll_matrix[i - 1][j_prime] + weight;\n\n }\n\n }\n\n\n\n matrix[i][j] = minimum;\n\n }\n\n }\n\n }\n\n\n\n //!\\brief Backtracks the trace matrix and writes the resulting binning into the output file.\n\n void backtracking(std::vector<std::vector<size_t>> const & matrix,\n\n std::vector<std::vector<size_t>> const & ll_matrix,\n\n std::vector<std::vector<std::pair<size_t, size_t>>> const & trace)\n\n {\n\n // backtracking\n\n size_t trace_i = num_technical_bins - 1;\n\n int trace_j = num_user_bins - 1;\n\n std::cout << \"optimum: \" << matrix[trace_i][trace_j] << std::endl;\n\n std::cout << std::endl;\n\n\n", "file_path": "include/chopper/pack/hierarchical_binning.hpp", "rank": 93, "score": 28881.99314325294 }, { "content": " std::vector<lemon::ListDigraph::Node> & nodes,\n\n lemon::ListDigraph::NodeMap<std::vector<std::pair<uint32_t, uint32_t>>> & node_map,\n\n graph_type const & seqan2_graph,\n\n split_data const & data)\n\n{\n\n typedef typename seqan::Id<graph_type>::Type TIdType;\n\n typedef typename seqan::Iterator<graph_type, seqan::VertexIterator>::Type TConstIter;\n\n\n\n // temporary storage\n\n size_t const number_of_sequences = length(data.sequences);\n\n size_t const number_of_nodes = seqan::numVertices(seqan2_graph);\n\n\n\n nodes.reserve(number_of_nodes + 1);\n\n lemon_graph.reserveNode(number_of_nodes + 1);\n\n lemon_graph.reserveArc(number_of_nodes + 1);\n\n\n\n lemon::ListDigraph::Node source_node = lemon_graph.addNode();\n\n lemon::ListDigraph::Node sink_node = lemon_graph.addNode();\n\n nodes.push_back(source_node);\n\n nodes.push_back(sink_node);\n", "file_path": "include/chopper/split/transform_graphs.hpp", "rank": 94, "score": 28881.95768444663 }, { "content": " * new merged bin. Namely, we add the weight of the new merged bin (\\f$ \\sum_{g = j'}^{j} c_g \\f$) again to the\n\n * LIBFs memory footprint from where we would come from \\f$ L_{i-1,j'-1} \\f$ and scale this by alpha. Just adding\n\n * the combined merged bin weight neglects the fact, that the merged bin weight has to be distributed within the\n\n * new low level IBF, potentially causing the effective text ratio and thereby the IBF memory footprint to increase.\n\n * This we cannot know before hand how the data are, we need to accept this as a flaw in the \"optimumal result\" of\n\n * this algorithm. It would be too computational intensive to compute the splitting for every possibility.\n\n *\n\n */\n\n void recursion(std::vector<std::vector<size_t>> & matrix,\n\n std::vector<std::vector<size_t>> & ll_matrix,\n\n std::vector<std::vector<std::pair<size_t, size_t>>> & trace,\n\n std::vector<std::vector<uint64_t>> const & union_estimates)\n\n {\n\n // we must iterate column wise\n\n for (size_t j = 1; j < num_user_bins; ++j)\n\n {\n\n size_t const current_weight = user_bin_kmer_counts[j];\n\n\n\n for (size_t i = 1; i < num_technical_bins; ++i)\n\n {\n", "file_path": "include/chopper/pack/hierarchical_binning.hpp", "rank": 95, "score": 28881.83315622184 }, { "content": " * A *Technical Bin* represents an actual bin in the binning directory.\n\n * In the IBF, it stores its kmers in a **single Bloom Filter** (which is interleaved with all the other BFs).\n\n */\n\n size_t const num_technical_bins;\n\n //!\\brief The total sum of all values in user_bin_kmer_counts.\n\n size_t const kmer_count_sum;\n\n //!\\brief The average count calculated from kmer_count_sum / num_technical_bins.\n\n size_t const kmer_count_average_per_bin;\n\n\n\npublic:\n\n /*!\\brief The constructor from user bin names, their kmer counts and a configuration.\n\n * \\param[in] data The filenames and kmer counts associated with the user bin, as well as the ostream buffer.\n\n * \\param[in] bin_name_ The bin identifier to write into the output file.\n\n * \\param[in] num_bins (optional) The number of technical bins.\n\n *\n\n * If the `num_bins` parameter is omitted or set to 0, then number of technical bins used in this algorithm\n\n * is automatically set to the next multiple of 64 given the number of user bins (e.g. \\#UB = 88 -> \\#TB = 124).\n\n *\n\n * \\attention The number of technical bins must be greater or equal to the number of user bins!\n\n * If you want to use less technical bins than user bins, see the hierarchical_binning algorithm.\n", "file_path": "include/chopper/pack/simple_binning.hpp", "rank": 96, "score": 28881.827049249034 }, { "content": " {\n\n sketch.add(reinterpret_cast<char*>(&hash), sizeof(hash));\n\n }\n\n }\n\n}\n\n\n\nvoid count_kmers(std::unordered_map<std::string, std::vector<std::string>> const & filename_clusters,\n\n count_config const & config)\n\n{\n\n // output file\n\n std::ofstream fout{config.output_filename};\n\n\n\n // create the hll dir if it doesn't already exist\n\n if (!config.hll_dir.empty() && !std::filesystem::exists(config.hll_dir))\n\n {\n\n std::filesystem::create_directory(config.hll_dir);\n\n }\n\n\n\n auto compute_minimiser = seqan3::views::minimiser_hash(seqan3::ungapped{config.k}, seqan3::window_size{config.w});\n\n auto compute_kmers = seqan3::views::kmer_hash(seqan3::ungapped{config.k});\n", "file_path": "include/chopper/count/count_kmers.hpp", "rank": 97, "score": 28881.734061497027 }, { "content": " assert(mat[j*nseq+minj] == mat[minj*nseq+j]);\n\n sumOfBranches -= mat[j*nseq+minj];\n\n }\n\n\n\n mat[j*nseq+minj] = 0.0;\n\n mat[minj*nseq+j] = 0.0;\n\n }\n\n dToAllOthers[mini] = new_sum;\n\n }\n\n}\n\n\n\ntemplate<typename TMatrix>\n\nauto neighbour_joining(TMatrix mat)\n\n{\n\n using TSize = typename seqan::Size<TMatrix>::Type;\n\n using node_weight_type = double;\n\n using graph_type = seqan::Graph<seqan::Tree<node_weight_type>>;\n\n using TVertexDescriptor = typename seqan::VertexDescriptor<graph_type>::Type;\n\n\n\n graph_type g; // resulting guide tree\n", "file_path": "include/chopper/split/neighbour_joining.hpp", "rank": 98, "score": 28881.613596238592 }, { "content": "#pragma once\n\n\n\n#include <seqan3/std/filesystem>\n\n\n", "file_path": "include/chopper/split/split_config.hpp", "rank": 99, "score": 28881.516874112018 } ]
C++
02Segundo/Estructura_de_Datos_ED/PracticaFinal/src/prueba.cpp
elsudano/Facultad
8ff2c5904f0a38a3a0682e040da4439f2bc872f2
#include <fstream> #include <iostream> #include <cstdlib> #include <ctime> #include <sstream> #include "ArbolGeneral.h" #include "Personas.h" #include "QuitaComentarios.h" #include "Preguntas.h" using namespace std; void imprime_arbol_con_formato(string nom, ArbolGeneral<int> &ab){ ArbolGeneral<int>::iter_preorden it_tree = ab.begin(); cout << "Arbol " << nom << ": " << ab << endl; cout << "Etiquetas ordenadas de " << nom << ": "; for (; it_tree != ab.end(); ++it_tree) cout << (*it_tree) << " "; cout << (*it_tree) << endl; } int main(int argc, char *argv[]) { fstream f,fdp,resultado; f.open (argv[1], fstream::in | fstream::out); if (!f.is_open()) { cout << "No puedo abrir el fichero: " << argv[1]<< endl; exit(1); } fdp.open (argv[2], fstream::in | fstream::out); if (!fdp.is_open()) { cout << "No puedo abrir el fichero: " << argv[2]<< endl; exit(1); } ArbolGeneral<int> ab1, ab2, ab3; cout << "Voy a leer los dos arboles" << endl << endl; f>>ab1; fdp>>ab2; f.close(); fdp.close(); ArbolGeneral<int>::iter_preorden it_tree = ab1.begin(); cout << "He leido los dos arboles correctamente" << endl; imprime_arbol_con_formato("AB1",ab1); imprime_arbol_con_formato("AB2",ab2); cout << endl; cout << "Pruebo que se pueden copiar los arboles del AB2 al AB3" << endl; ab3 = ab2; imprime_arbol_con_formato("AB3",ab3); cout << endl; cout << "Voy a poner el AB2 como subarbol de AB1 en el nodo 5 (cuando tiene hijos)" << endl; it_tree = ab1.begin(); for (; (*it_tree) != 5; ++it_tree); cout << "Encuentro el nodo: " << (*it_tree) << endl; ab1.asignar_subarbol(ab2, it_tree.GetNodo()); cout << "Arbol AB1 despúes de asignar subarbol AB2: " << endl; imprime_arbol_con_formato("AB1",ab1); cout << endl; cout << "Voy a poner el AB3 como subarbol de AB1 en el nodo 10 (cuando NO tiene hijos)" << endl; it_tree = ab1.begin(); for (; (*it_tree) != 10; ++it_tree); cout << "Encuentro el nodo: " << (*it_tree) << endl; ab1.asignar_subarbol(ab3, it_tree.GetNodo()); cout << "Arbol AB1 despúes de asignar subarbol AB3: " << endl; imprime_arbol_con_formato("AB1",ab1); cout << endl; cout << "Voy a podar el subarbol izquierdo del nodo 6 del árbol AB1" << endl; it_tree = ab1.begin(); for (; (*it_tree) != 6; ++it_tree); ab1.podar_hijomasizquierda(it_tree.GetNodo(), ab2); imprime_arbol_con_formato("AB1",ab1); cout << "Este es el árbol que hemos podado" << endl; imprime_arbol_con_formato("AB2",ab2); cout << endl; cout << "Voy a podar el subarbol derecho del nodo 7 del árbol AB1" << endl; it_tree = ab1.begin(); for (; (*it_tree) != 7; ++it_tree); ab1.podar_hermanoderecha(it_tree.GetNodo(), ab3); imprime_arbol_con_formato("AB1",ab1); cout << "Este es el árbol que hemos podado" << endl; imprime_arbol_con_formato("AB3",ab3); cout << endl; cout << "Insertamos en el nodo 200 del árbol AB1 el árbol AB3 (cuando tiene hijos)" << endl; it_tree = ab1.begin(); for (; (*it_tree) != 200; ++it_tree); ab1.insertar_hijomasizquierda(it_tree.GetNodo(),ab3); imprime_arbol_con_formato("AB1",ab1); cout << endl; cout << "Insertamos en el nodo 9 del árbol AB1 el árbol AB2 (cuando NO tiene hijos)" << endl; it_tree = ab1.begin(); for (; (*it_tree) != 9; ++it_tree); ab1.insertar_hermanoderecha(it_tree.GetNodo(),ab2); imprime_arbol_con_formato("AB1",ab1); cout << endl; cout << "Por ultimo guardamos en el fichero: resultado.tree el árbol AB1" << endl; string contenido; resultado.open (argv[3], fstream::in | fstream::out); if (!resultado.is_open()) { cout << "No puedo abrir el fichero: " << argv[3]<< endl; exit(1); } resultado<<ab1; resultado.seekp(0); getline(resultado,contenido); cout << contenido << endl; resultado.close(); }
#include <fstream> #include <iostream> #include <cstdlib> #include <ctime> #include <sstream> #include "ArbolGeneral.h" #include "Personas.h" #include "QuitaComentarios.h" #include "Preguntas.h" using namespace std; void imprime_arbol_con_formato(string nom, ArbolGeneral<int> &ab){ ArbolGeneral<int>::iter_preorden it_tree = ab.begin(); cout << "Arbol " << nom << ": " << ab << endl; cout << "Etiquetas ordenadas de " << nom << ": "; for (; it_tree != ab.end(); ++it_tree) cout << (*it_tree) << " "; cout << (*it_tree) << endl; } int main(int argc, char *argv[]) { fstream f,fdp,resultado; f.open (argv[1], fstream::in | fstream::out); if (!f.is_open()) { cout << "No puedo abrir el fichero: " << argv[1]<< endl; exit(1); } fdp.open (argv[2], fstream::in | fstream::out); if (!fdp.is_open()) { cout << "No puedo abrir el fichero: " << argv[2]<< endl; exit(1); } ArbolGeneral<int> ab1, ab2, ab3; cout << "Voy a leer los dos arboles" << endl << endl; f>>ab1; fdp>>ab2; f.close(); fdp.close(); ArbolGeneral<int>::iter_preorden it_tree = ab1.begin(); cout << "He leido los dos arboles correctamente" << endl; imprime_arbol_con_formato("AB1",ab1); imprime_arbol_con_formato("AB2",ab2); cout << endl; cout << "Pruebo que se pueden copiar los arboles del AB2 al AB3" << endl; ab3 = ab2; imprime_arbol_con_formato("AB3",ab3); cout << endl; cout << "Voy a poner el AB2 como subarbol de AB1 en el nodo 5 (cuando tiene hijos)" << endl; it_tree = ab1.begin(); for (; (*it_tree) != 5; ++it_tree); cout << "Encuentro el nodo: " << (*it_tree) << endl; ab1.asignar_subarbol(ab2, it_tree.GetNodo()); cout << "Arbol AB1 despúes de asignar subarbol AB2: " << endl; imprime_arbol_con_formato("AB1",ab1); cout << endl; co
ut << "Voy a poner el AB3 como subarbol de AB1 en el nodo 10 (cuando NO tiene hijos)" << endl; it_tree = ab1.begin(); for (; (*it_tree) != 10; ++it_tree); cout << "Encuentro el nodo: " << (*it_tree) << endl; ab1.asignar_subarbol(ab3, it_tree.GetNodo()); cout << "Arbol AB1 despúes de asignar subarbol AB3: " << endl; imprime_arbol_con_formato("AB1",ab1); cout << endl; cout << "Voy a podar el subarbol izquierdo del nodo 6 del árbol AB1" << endl; it_tree = ab1.begin(); for (; (*it_tree) != 6; ++it_tree); ab1.podar_hijomasizquierda(it_tree.GetNodo(), ab2); imprime_arbol_con_formato("AB1",ab1); cout << "Este es el árbol que hemos podado" << endl; imprime_arbol_con_formato("AB2",ab2); cout << endl; cout << "Voy a podar el subarbol derecho del nodo 7 del árbol AB1" << endl; it_tree = ab1.begin(); for (; (*it_tree) != 7; ++it_tree); ab1.podar_hermanoderecha(it_tree.GetNodo(), ab3); imprime_arbol_con_formato("AB1",ab1); cout << "Este es el árbol que hemos podado" << endl; imprime_arbol_con_formato("AB3",ab3); cout << endl; cout << "Insertamos en el nodo 200 del árbol AB1 el árbol AB3 (cuando tiene hijos)" << endl; it_tree = ab1.begin(); for (; (*it_tree) != 200; ++it_tree); ab1.insertar_hijomasizquierda(it_tree.GetNodo(),ab3); imprime_arbol_con_formato("AB1",ab1); cout << endl; cout << "Insertamos en el nodo 9 del árbol AB1 el árbol AB2 (cuando NO tiene hijos)" << endl; it_tree = ab1.begin(); for (; (*it_tree) != 9; ++it_tree); ab1.insertar_hermanoderecha(it_tree.GetNodo(),ab2); imprime_arbol_con_formato("AB1",ab1); cout << endl; cout << "Por ultimo guardamos en el fichero: resultado.tree el árbol AB1" << endl; string contenido; resultado.open (argv[3], fstream::in | fstream::out); if (!resultado.is_open()) { cout << "No puedo abrir el fichero: " << argv[3]<< endl; exit(1); } resultado<<ab1; resultado.seekp(0); getline(resultado,contenido); cout << contenido << endl; resultado.close(); }
function_block-function_prefixed
[]
C++
HybridRenderer/HybridRenderer/Camera.cpp
lbondi7/HybridRenderer
592ff5c4ea9039bc79a99e20c848f11e2669f885
#include "Camera.h" #include "Initilizers.h" #include "ImGUI_.h" #include <algorithm> Camera::~Camera() { } void Camera::init(DeviceContext* deviceContext, const VkExtent2D& _extent) { viewport = { 0, 0, 1, 1 }; scissor = { 0, 0, 1, 1 }; vkViewport = Initialisers::viewport(viewport.x, viewport.y, static_cast<float>(_extent.width) * viewport.z, static_cast<float>(_extent.height) * viewport.w); vkScissor = Initialisers::scissor(_extent); vkScissor.offset.x = static_cast<int32_t>(scissor.x); vkScissor.offset.y = static_cast<int32_t>(scissor.y); vkScissor.extent.width = _extent.width * scissor.z; vkScissor.extent.height = _extent.height * scissor.w; auto imageCount = deviceContext->imageCount; buffers.resize(imageCount); for (size_t i = 0; i < imageCount; i++) { VkDeviceSize bufferSize = sizeof(CameraGPU); buffers[i].Allocate(deviceContext, bufferSize, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); } std::string sceneShader = (deviceContext->validGPU == 2 ? "sceneRQ" : "scene"); DescriptorSetRequest request({ { sceneShader, 0 } }); request.AddDescriptorBinding(0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_SHADER_STAGE_VERTEX_BIT); request.AddDescriptorBufferData(0, buffers.data()); deviceContext->GetDescriptors(descriptor, &request); gpuData.rayCullDistance = 0.0f; adaptiveDistance = true; transform.position.y = 4.0f; widget.enabled = true; lookAtPlace = true; lookAt = glm::vec3(0.0f, 1.0f, 0.0f); transform.position = glm::vec3(0.0f, 5.0f, 10.0f); update(_extent.width, _extent.height); float length = 60.0f; positions = {glm::vec3(50, 25, 80), glm::vec3(0, 1, 45), glm::vec3(-30, 1, 0), glm::vec3(-45, 15, 20)}; auto d1 = glm::distance(positions[0], positions[1]); auto d2 = glm::distance(positions[1], positions[2]); auto d3 = glm::distance(positions[2], positions[3]); auto total = d1 + d2 + d3; timings.emplace_back(length * (d1 / total)); timings.emplace_back(length * (d2 / total)); timings.emplace_back(length * (d3 / total)); } void Camera::update(float windowWidth, float windowHeight) { if (!valuesUpdated(windowWidth, windowHeight)) { transform.getMatrix(model); auto view = glm::lookAt(transform.position, lookAtPlace ? lookAt : transform.position + transform.forward, worldUp); auto projection = glm::perspective(glm::radians(FOV), windowWidth / windowHeight, nearPlane, farPlane); } } void Camera::update(const VkExtent2D& _extent) { if (!valuesUpdated(_extent)) { extent = _extent; vkViewport.x = viewport.x; vkViewport.y = viewport.y; vkViewport.width = _extent.width * viewport.z; vkViewport.height = _extent.height * viewport.w; vkScissor.offset.x = static_cast<int32_t>(scissor.x); vkScissor.offset.y = static_cast<int32_t>(scissor.y); vkScissor.extent.width = _extent.width * scissor.z; vkScissor.extent.height = _extent.height * scissor.w; transform.getMatrix(model); auto view = glm::lookAt(transform.position, lookAtPlace ? lookAt : transform.position + transform.forward, worldUp); auto projection = glm::perspective(glm::radians(FOV), vkViewport.width / vkViewport.height, nearPlane, farPlane); projection[1][1] *= -1; gpuData.viewProjection = projection * view; updateValues(extent); } } void Camera::update(float dt) { angle += speed * dt; transform.position = lookAt + glm::vec3(distance * std::sin(angle), distance * 0.65f, distance * std::cos(angle)); if (!valuesUpdated(extent)) { transform.getMatrix(model); auto view = glm::lookAt(transform.position, lookAtPlace ? lookAt : transform.position + transform.forward, worldUp); auto projection = glm::perspective(glm::radians(FOV), vkViewport.width / vkViewport.height, nearPlane, farPlane); projection[1][1] *= -1; gpuData.viewProjection = projection * view; gpuData.position = transform.position; updateValues(extent); } if (ImGUI::enabled) { widget.Text("Camera"); widget.Slider("Camera FOV", &FOV, 1.0f, 179.0f); widget.Slider("Distance", &distance, 1.0f, 100.0f); widget.Slider("Speed", &speed, 0.0f, 5.0f); } } bool Camera::valuesUpdated(const VkExtent2D& _extent) { return prevTransform == transform && prevLookAt == lookAt && prevUp == worldUp && lookAtPlace == prevLookAtPlace && prevFOV == FOV && prevNearPlane == nearPlane && prevFarPlane == farPlane && vkViewport.width == _extent.width && vkViewport.height == _extent.height; } void Camera::vkSetViewport(VkCommandBuffer cmdBuffer) { vkCmdSetViewport(cmdBuffer, 0, 1, &vkViewport); vkCmdSetScissor(cmdBuffer, 0, 1, &vkScissor); } void Camera::setViewport(glm::vec2 size, glm::vec2 offset) { viewport = {offset.x, offset.y, size.x, size.y}; vkViewport.x = viewport.x; vkViewport.y = viewport.y; vkViewport.width = windowWidth * viewport.z; vkViewport.height = windowHeight * viewport.w; } void Camera::setScissor(glm::vec2 size, glm::vec2 offset) { scissor = { offset.x, offset.y, size.x, size.y }; vkScissor.offset.x = static_cast<int32_t>(scissor.x); vkScissor.offset.y = static_cast<int32_t>(scissor.y); vkScissor.extent.width = extent.width * scissor.z; vkScissor.extent.height = extent.height * scissor.w; } void Camera::SetCullDistance(float cullDistance) { gpuData.rayCullDistance = std::clamp(cullDistance, 5.0f, 100.0f); } bool Camera::valuesUpdated(float windowWidth, float windowHeight) { return prevTransform == transform && prevLookAt == lookAt && prevUp == worldUp && lookAtPlace == prevLookAtPlace && prevFOV == FOV && prevNearPlane == nearPlane && prevFarPlane == farPlane && prevWindowWidth == windowWidth && prevWindowHeight == windowHeight; } void Camera::updateValues(const VkExtent2D& _extent) { prevTransform = transform; prevLookAt == lookAt; prevUp = worldUp; prevFOV = FOV; prevNearPlane = nearPlane; prevFarPlane = farPlane; extent = _extent; prevLookAtPlace = lookAtPlace; prevViewport = viewport; prevScissor = scissor; } void Camera::updateWindow(float _windowWidth, float _windowHeight) { } void Camera::ResetPan() { currentIndex = 0; pan = true; time = 0.0f; }
#include "Camera.h" #include "Initilizers.h" #include "ImGUI_.h" #include <algorithm> Camera::~Camera() { } void Camera::init(DeviceContext* deviceContext, const VkExtent2D& _extent) { viewport = { 0, 0, 1, 1 }; scissor = { 0, 0, 1, 1 }; vkViewport = Initialisers::viewport(viewport.x, viewport.y, static_cast<float>(_extent.width) * viewport.z, static_cast<float>(_extent.height) * viewport.w); vkScissor = Initialisers::scissor(_extent); vkScissor.offset.x = static_cast<int32_t>(scissor.x); vkScissor.offset.y = static_cast<int32_t>(scissor.y); vkScissor.extent.width = _extent.width * scissor.z; vkScissor.extent.height = _extent.height * scissor.w; auto imageCount = deviceContext->imageCount; buffers.resize(imageCount); for (size_t i = 0; i < imageCount; i++) { VkDeviceSize bufferSize = sizeof(CameraGPU); buffers[i].Allocate(deviceContext, bufferSize, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); } std::string sceneShader = (deviceContext->validGPU == 2 ? "sceneRQ" : "scene"); DescriptorSetRequest request({ { sceneShader, 0 } }); request.AddDescriptorBinding(0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_SHADER_STAGE_VERTEX_BIT); request.AddDescriptorBufferData(0, buffers.data()); deviceContext->GetDescriptors(descriptor, &request); gpuData.rayCullDistance = 0.0f; adaptiveDistance = true; transform.position.y = 4.0f; widget.enabled = true; lookAtPlace = true; lookAt = glm::vec3(0.0f, 1.0f, 0.0f); transform.position = glm::vec3(0.0f, 5.0f, 10.0f); update(_extent.width, _extent.height); float length = 60.0f; positions = {glm::vec3(50, 25, 80), glm::vec3(0, 1, 45), glm::vec3(-30, 1, 0), glm::vec3(-45, 15, 20)}; auto d1 = glm::distance(positions[0], positions[1]); auto d2 = glm::distance(positions[1], positions[2]); auto d3 = glm::distance(positions[2], positions[3]); auto total = d1 + d2 + d3; timings.emplace_back(length * (d1 / total)); timings.emplace_back(length * (d2 / total)); timings.emplace_back(length * (d3 / total)); } void Camera::update(float windowWidth, float windowHeight) { if (!valuesUpdated(windowWidth, windowHeight)) { transform.getMatrix(model); auto view = glm::lookAt(transform.position, lookAtPlace ? lookAt : transform.position + transform.forward, worldUp); auto projection = glm::perspective(glm::radians(FOV), windowWidth / windowHeight, nearPlane, farPlane); } } void Camera::update(const VkExtent2D& _extent) { if (!valuesUpdated(_extent)) { extent = _extent; vkViewport.x = viewport.x; vkViewport.y = viewport.y; vkViewport.width = _extent.width * viewport.z; vkViewport.height = _extent.height * viewport.w; vkScissor.offset.x = static_cast<int32_t>(scissor.x); vkScissor.offset.y = static_cast<int32_t>(scissor.y); vkScissor.extent.width = _extent.width * scissor.z; vkScissor.extent.height = _extent.height * scissor.w; transform.getMatrix(model); auto view = glm::lookAt(transform.position, lookAtPlace ? lookAt : transform.position + transform.forward, worldUp); auto projection = glm::perspective(glm::radians(FOV), vkViewport.width / vkViewport.height, nearPlane, farPlane); projection[1][1] *= -1; gpuData.viewProjection = projection * view; updateValues(extent); } } void Camera::update(float dt) { angle += speed * dt; transform.position = lookAt + glm::vec3(distance * std::sin(angle), distance * 0.65f, distance * std::cos(angle)); if (!valuesUpdated(extent)) { transform.getMatrix(model); auto view = glm::lookAt(transform.position, lookAtPlace ? lookAt : transform.position + transform.forward, worldUp); auto projection = glm::perspective(glm::radians(FOV), vkViewport.width / vkViewport.height, nearPlane, farPlane); projection[1][1] *= -1; gpuData.viewProjection = projection * view; gpuData.position = transform.position; updateValues(extent); } if (ImGUI::enabled) { widget.Text("Camera"); widget.Slider("Camera FOV", &FOV, 1.0f, 179.0f); widget.Slider("Distance", &distance, 1.0f, 100.0f); widget.Slider("Speed", &speed, 0.0f, 5.0f); } } bool Camera::valuesUpdated(const VkExtent2D& _extent) { return prevTransform == transform && prevLookAt == lookAt && prevUp == worldUp && lookAtPlace == prevLookAtPlace && prevFOV == FOV && prevNearPlane == nearPlane && prevFarPlane == farPlane && vkViewport.width == _extent.width && vkViewport.height == _extent.height; } void Camera::vkSetViewport(VkCommandBuffer cmdBuffer) { vkCmdSetViewport(cmdBuffer, 0, 1, &vkViewport); vkCmdSetScissor(cmdBuffer, 0, 1, &vkScissor); } void Camera::setViewport(glm::vec2 size, glm::vec2 offset) { viewport = {offset.x, offset.y, size.x, size.y}; vkViewport.x = viewport.x; vkViewport.y = viewport.y; vkViewport.width = windowWidth * viewport.z; vkViewport.height = windowHeight * viewport.w; } void Camera::setScissor(glm::vec2 size, glm::vec2 offset) { scissor = { offset.x, offset.y, size.x, size.y }; vkScissor.offset.x = static_cast<int32_t>(scissor.x); vkScissor.offset.y = static_cast<int32_t>(scissor.y); vkScissor.extent.width = extent.width * scissor.z; vkScissor.extent.height = extent.height * scissor.w; } void Camera::SetCullDistance(float cullDistance) { gpuData.rayCullDistance = std::clamp(cullDistance, 5.0f, 100.0f); } bool Camera::valuesUpdated(float windowWidth, float windowHeight) { return prevTransform == transform && prevLookAt == lookAt && prevUp == worldUp && lookAtPlace == prevLookAtPlace && prevFOV == FOV && prevNearPlane == nearPlane && prevFarPlane == farPlane && prevWindowWidth == windowWidth && prevWindowHeight == windowHeight; } void Camera::updateValues(const VkExtent2D& _
void Camera::updateWindow(float _windowWidth, float _windowHeight) { } void Camera::ResetPan() { currentIndex = 0; pan = true; time = 0.0f; }
extent) { prevTransform = transform; prevLookAt == lookAt; prevUp = worldUp; prevFOV = FOV; prevNearPlane = nearPlane; prevFarPlane = farPlane; extent = _extent; prevLookAtPlace = lookAtPlace; prevViewport = viewport; prevScissor = scissor; }
function_block-function_prefixed
[ { "content": "struct Transform {\n\n\n\n\tglm::vec3 position = glm::vec3(0);\n\n\tglm::vec3 rotation = glm::vec3(0);\n\n\tglm::vec3 scale = glm::vec3(1);\n\n\n\n\tglm::vec3 right = glm::vec3(1, 0, 0);\n\n\tglm::vec3 up = glm::vec3(0, 1, 0);\n\n\tglm::vec3 forward = glm::vec3(0, 0, 1);\n\n\n\n\n\n\tbool operator == (const Transform& other) {\n\n\t\treturn position == other.position && rotation == other.rotation && scale == other.scale;\n\n\t}\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Transform.h", "rank": 0, "score": 122867.4019213194 }, { "content": "struct DescriptorSetRequest {\n\n\n\n using LayoutSetOrder = std::pair<std::string, uint32_t>;\n\n\n\n DescriptorSetRequest(size_t i = 1);\n\n DescriptorSetRequest(const std::vector<std::pair<std::string, uint32_t>>& tags, size_t i = 1);\n\n ~DescriptorSetRequest() = default;\n\n void AddDescriptorBinding(uint32_t binding, VkDescriptorType type, VkShaderStageFlagBits shaderFlags, uint32_t count = 1U);\n\n void AddDescriptorBufferData(size_t binding, void* data);\n\n void AddDescriptorImageData(size_t binding, void* data);\n\n void AddDescriptorSetLayoutTags(const std::vector<std::string>& tags);\n\n void AddDescriptorSetLayoutTag(const std::string& tag);\n\n std::vector<DescriptorBinding> bindings;\n\n std::vector<LayoutSetOrder> layoutTags;\n\n uint32_t totalSets;\n", "file_path": "HybridRenderer/HybridRenderer/DescriptorSetRequest.h", "rank": 1, "score": 86792.75428535254 }, { "content": "class Scene\n\n{\n\npublic:\n\n\tScene() = default;\n\n\t~Scene();\n\n\n\n\tvoid Initialise(DeviceContext* deviceContext, Resources* resources);\n\n\tvoid Update(uint32_t imageIndex, float dt);\n\n\tvoid Destroy();\n\n\n\n\tvoid KeyCallback(int key, int scancode, int action, int mods);\n\n\n\n\tstd::vector<GameObject> gameObjects;\n\n\n\n\tuint32_t gameObjectCount = 2;\n\n\n\n\tstd::vector<VkDescriptorSet> lightDescSets;\n\n\tstd::vector<Buffer> lightBuffers;\n\n\n\n\tDescriptor lightDescriptor;\n", "file_path": "HybridRenderer/HybridRenderer/Scene.h", "rank": 2, "score": 85568.08121697836 }, { "content": " uint32_t totalSets;\n", "file_path": "HybridRenderer/HybridRenderer/DescriptorSetRequest.h", "rank": 3, "score": 84876.68435232421 }, { "content": " ImS16 ReorderRequestOffset;\n", "file_path": "HybridRenderer/HybridRenderer/imgui/imgui_internal.h", "rank": 4, "score": 82656.61150601375 }, { "content": " void AddBufferData(void* data);\n", "file_path": "HybridRenderer/HybridRenderer/DescriptorSetRequest.h", "rank": 5, "score": 82634.01118774476 }, { "content": " void AddDescriptorBufferData(size_t binding, void* data);\n", "file_path": "HybridRenderer/HybridRenderer/DescriptorSetRequest.h", "rank": 6, "score": 80542.03112352898 }, { "content": " operator bool() const { int current_frame = ImGui::GetFrameCount(); if (RefFrame == current_frame) return false; RefFrame = current_frame; return true; }\n", "file_path": "HybridRenderer/HybridRenderer/imgui/imgui.h", "rank": 7, "score": 75418.44530505687 }, { "content": " operator bool() const { int current_frame = ImGui::GetFrameCount(); if (RefFrame == current_frame) return false; RefFrame = current_frame; return true; }\n", "file_path": "HybridRenderer/HybridRenderer/imgui/imgui.h", "rank": 8, "score": 75418.44530505687 }, { "content": " operator bool() const { int current_frame = ImGui::GetFrameCount(); if (RefFrame == current_frame) return false; RefFrame = current_frame; return true; }\n", "file_path": "HybridRenderer/HybridRenderer/imgui2/imgui.h", "rank": 9, "score": 75418.44530505687 }, { "content": " operator bool() const { int current_frame = ImGui::GetFrameCount(); if (RefFrame == current_frame) return false; RefFrame = current_frame; return true; }\n", "file_path": "HybridRenderer/HybridRenderer/imgui2/imgui.h", "rank": 10, "score": 75418.44530505687 }, { "content": " ImVec2 Size; // Main Area: Size of the viewport.\n", "file_path": "HybridRenderer/HybridRenderer/imgui/imgui.h", "rank": 11, "score": 75372.96121434416 }, { "content": " IMGUI_API void DebugNodeWindowsList(ImVector<ImGuiWindow*>* windows, const char* label);\n", "file_path": "HybridRenderer/HybridRenderer/imgui/imgui_internal.h", "rank": 12, "score": 74191.33035072312 }, { "content": " inline const T& operator[](int i) const { const T* p = Data + i; IM_ASSERT(p >= Data && p < DataEnd); return *p; }\n", "file_path": "HybridRenderer/HybridRenderer/imgui/imgui_internal.h", "rank": 13, "score": 74190.49181561187 }, { "content": " ImVector<ImDrawCmd> CmdBuffer; // Draw commands. Typically 1 command = 1 GPU draw call, unless the command is a callback.\n", "file_path": "HybridRenderer/HybridRenderer/imgui2/imgui.h", "rank": 14, "score": 74145.5412654762 }, { "content": " ImVector<ImDrawCmd> CmdBuffer; // Draw commands. Typically 1 command = 1 GPU draw call, unless the command is a callback.\n", "file_path": "HybridRenderer/HybridRenderer/imgui/imgui.h", "rank": 15, "score": 74145.5412654762 }, { "content": " int size;\n", "file_path": "HybridRenderer/HybridRenderer/imgui2/imstb_truetype.h", "rank": 16, "score": 74133.73190869662 }, { "content": " int size;\n", "file_path": "HybridRenderer/HybridRenderer/imgui/imstb_truetype.h", "rank": 17, "score": 74133.73190869662 }, { "content": " size_t Size; // Size in byte\n", "file_path": "HybridRenderer/HybridRenderer/imgui2/imgui_internal.h", "rank": 18, "score": 74133.73190869662 }, { "content": " inline int size() const { return (int)(ptrdiff_t)(DataEnd - Data); }\n", "file_path": "HybridRenderer/HybridRenderer/imgui/imgui_internal.h", "rank": 19, "score": 74133.73190869662 }, { "content": " ImVec2ih Size;\n", "file_path": "HybridRenderer/HybridRenderer/imgui/imgui_internal.h", "rank": 20, "score": 74133.73190869662 }, { "content": "class Buffer\n\n{\n\npublic:\n\n\tBuffer() = default;\n\n\t~Buffer();\n\n\n\n\tvoid Create(DeviceContext* _devices, VkDeviceSize _size, VkBufferUsageFlags _usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VkMemoryPropertyFlags _properties = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, void* _data = nullptr);\n\n\n\n\tvoid Create(DeviceContext* _devices, VkDeviceSize _size, void* _data);\n\n\n\n\tvoid createBuffer(VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties);\n\n\n\n\tvoid Allocate(DeviceContext* _devices, VkDeviceSize _size, VkBufferUsageFlags _usage, VkMemoryPropertyFlags _properties, void* _data = nullptr);\n\n\n\n\tvoid Allocate(VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties);\n\n\n\n\tvoid CopyFrom(Buffer* other);\n\n\n\n\tvoid AllocatedCopyFrom(Buffer* other);\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Buffer.h", "rank": 21, "score": 65494.74222212466 }, { "content": "class FrameBuffer\n\n{\n\npublic:\n\n\tFrameBuffer() = default;\n\n\t~FrameBuffer();\n\n\n\n\tvoid Create(DeviceContext* _devices, SwapChain* _swapChain, VkRenderPass _vkRenderPass);\n\n\n\n\tvoid Create(DeviceContext* _devices, VkRenderPass _vkRenderPass);\n\n\n\n\tvoid Init(VkRenderPass _vkRenderPass);\n\n\n\n\tvoid createFramebuffer(const std::vector<VkImageView>& attachments, VkExtent2D extent);\n\n\n\n\tvoid Destroy();\n\n\n\n\tstd::vector<FrameData> frames;\n\n\n\nprivate:\n\n\tDeviceContext* devices;\n\n\tSwapChain* swapChain;\n\n\tVkRenderPass vkRenderPass;\n\n};\n\n\n", "file_path": "HybridRenderer/HybridRenderer/FrameBuffer.h", "rank": 22, "score": 62904.87065257611 }, { "content": "class float_mat : public std::vector<float_vect> {\n\nprivate:\n\n //! disable the default constructor\n\n explicit float_mat() {};\n\n //! disable assignment operator until it is implemented.\n\n float_mat &operator =(const float_mat &) { return *this; };\n\npublic:\n\n //! constructor with sizes\n\n float_mat(const size_t rows, const size_t cols, const double def=0.0);\n\n //! copy constructor for matrix\n\n float_mat(const float_mat &m);\n\n //! copy constructor for vector\n\n float_mat(const float_vect &v);\n\n\n\n //! use default destructor\n\n // ~float_mat() {};\n\n\n\n //! get size\n\n size_t nr_rows(void) const { return size(); };\n\n //! get size\n", "file_path": "HybridRenderer/HybridRenderer/SGSmooth.cpp", "rank": 23, "score": 56291.71543231557 }, { "content": "private:\n\n\n\n\tDeviceContext* deviceContext;\n\n\tGameObject* CreateGameObject(Model* model);\n\n\n\n\tvoid LoadScene(const std::string& scene);\n\n\n\n\tDescriptorPool descriptorPool;\n\n\n\n\tbool lookAtCentre = true;\n\n\tBuffer objectBuffer;\n\n\n\n\tResources* resources;\n\n\n\n};\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Scene.h", "rank": 24, "score": 53982.30759286324 }, { "content": "\tDescriptor asDescriptor;\n\n\tDescriptor rtASDescriptor;\n\n\n\n\tuint32_t imageIndex;\n\n\n\n\tglm::vec3 lightInvDir = glm::vec3(0.5f, 2, 2);\n\n\tglm::vec3 lightPos;\n\n\tglm::vec3 lightRot = glm::vec3(0, 0, 0);\n\n\n\n\tfloat lightFOV = 90.0f;\n\n\n\n\tstd::vector<AccelerationStructure> bottomLevelASs;\n\n\tAccelerationStructure topLevelAS;\n\n\n\n\tLightUBO lightUBO;\n\n\n\n\tImGUIWidget lightWidget;\n\n\n\n\tbool ortho = false;\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Scene.h", "rank": 25, "score": 53967.32052648365 }, { "content": "#pragma once\n\n\n\n#include \"GameObject.h\"\n\n#include \"Resources.h\"\n\n#include \"AccelerationStructure.h\"\n\n#include \"ImGUIWidgets.h\"\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Scene.h", "rank": 26, "score": 53962.50038609508 }, { "content": "\tVkDeviceSize size;\n\n\tVkBufferUsageFlags usage; \n\n\tVkMemoryPropertyFlags properties;\n\n\tVkDeviceSize offset;\n\n\tvoid* data = nullptr;\n\n\tbool mapped = false;\n\n\n\n\tVkDescriptorBufferInfo descriptorInfo;\n\n\n\n\tBufferInfo bufferInfo;\n\n\n\nprivate:\n\n\n\n\tDeviceContext* deviceContext;\n\n\tPFN_vkGetBufferDeviceAddressKHR vkGetBufferDeviceAddressKHR;\n\n\n\n\tvoid Stage(void* data);\n\n\tvoid AllocatedStage(void* data);\n\n};\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Buffer.h", "rank": 27, "score": 53952.30236065198 }, { "content": "\tvoid Destroy();\n\n\n\n\tvoid Map(void* _data);\n\n\n\n\tvoid Map();\n\n\n\n\tvoid Unmap();\n\n\n\n\tvoid AllocatedMap(const void* src_data);\n\n\n\n\tvoid Flush(VkDeviceSize size = VK_WHOLE_SIZE, VkDeviceSize offset = 0);\n\n\n\n\tuint64_t GetDeviceAddress();\n\n\n\n\tuint64_t GetAllocatedDeviceAddress();\n\n\n\n\t//uint64_t GetDeviceAddress2();\n\n\n\n\tVkBuffer vkBuffer;\n\n\tVkDeviceMemory memory;\n", "file_path": "HybridRenderer/HybridRenderer/Buffer.h", "rank": 28, "score": 53948.45516758227 }, { "content": "#pragma once\n\n\n\n#include \"Constants.h\"\n\n#include \"Device.h\"\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Buffer.h", "rank": 29, "score": 53931.668258679405 }, { "content": " lightRequest.AddDescriptorBinding(0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_SHADER_STAGE_VERTEX_BIT);\n\n lightRequest.AddDescriptorBufferData(0, lightBuffers.data());\n\n deviceContext->GetDescriptors(lightDescriptor, &lightRequest);\n\n\n\n lightWidget.enabled = true;\n\n}\n\n\n\nvoid Scene::Update(uint32_t imageIndex, float dt)\n\n{\n\n if (ImGUI::enabled && lightWidget.enabled) {\n\n\n\n //if (lightWidget.Button(\"Dragon\")) \n\n //{\n\n // LoadScene(\"Dragon\");\n\n //}\n\n //if (lightWidget.Button(\"Tree\")) \n\n //{\n\n // LoadScene(\"Tree\");\n\n //}\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 30, "score": 52219.45789152377 }, { "content": "\n\n auto imageCount = 3;\n\n lightUBO.position = glm::vec3(50.0f, 20.0f, -50.0f);\n\n lightUBO.colour.w = 2.0f;\n\n lightUBO.size_clippingPlanes.z = 1.0f;\n\n lightUBO.size_clippingPlanes.w = 250.0f;\n\n\n\n lightBuffers.resize(imageCount);\n\n for (size_t i = 0; i < imageCount; i++) {\n\n VkDeviceSize bufferSize = sizeof(LightUBO);\n\n lightBuffers[i].Allocate(deviceContext, bufferSize, \n\n VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, \n\n VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);\n\n }\n\n\n\n\n\n std::string offscreenShader = (deviceContext->validGPU == 2 ? \"offscreenRQ\" : \"offscreen\");\n\n std::string sceneShader = (deviceContext->validGPU == 2 ? \"sceneRQ\" : \"scene\");\n\n\n\n DescriptorSetRequest lightRequest({ {sceneShader, 2}, {offscreenShader, 0} }, 1);\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 31, "score": 52216.44462269269 }, { "content": "\n\n int treeCount = 100;\n\n auto sr = std::sqrtf(treeCount);\n\n float size = 8.0f;\n\n float x = -size * (sr / 2.0) , z = -size * (sr / 2.0);\n\n for(int i = 0; i < treeCount; ++i)\n\n {\n\n auto go = CreateGameObject(resources->GetModel(\"tree2\"));\n\n go->name = \"Tree Parent 0\";\n\n go->transform.position = glm::vec3(x, 0.0, z);\n\n go->transform.scale = glm::vec3(1);\n\n x += size;\n\n if (x > size * (sr / 2.0))\n\n {\n\n x = -size * (sr / 2.0);\n\n z += size;\n\n }\n\n }\n\n\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 32, "score": 52214.649419534726 }, { "content": " //lightUBO.fustrumSize = dt;\n\n lightBuffers[imageIndex].AllocatedMap(&lightUBO);\n\n\n\n //gameObjects[gameObjectCount - 1].transform.position = lightPos;\n\n\n\n for (auto& go : gameObjects)\n\n {\n\n if (!go.mesh)\n\n continue;\n\n\n\n go.Update();\n\n\n\n ModelUBO ubos;\n\n ubos.model = go.GetMatrix();\n\n ubos.colour = glm::vec3(1.0);\n\n go.uniformBuffers[imageIndex].AllocatedMap(&ubos);\n\n }\n\n\n\n}\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 33, "score": 52212.46208863121 }, { "content": " glm::mat4 depthProjectionMatrix = glm::mat4(1.0f);\n\n glm::mat4 depthViewMatrix = glm::mat4(1.0f);\n\n if(lightUBO.extra.x == 0)\n\n depthProjectionMatrix = glm::perspective(glm::radians(lightFOV), 1.0f, lightUBO.size_clippingPlanes.z, lightUBO.size_clippingPlanes.w);\n\n else\n\n depthProjectionMatrix = glm::ortho(-lightUBO.size_clippingPlanes.y, \n\n lightUBO.size_clippingPlanes.y, \n\n -lightUBO.size_clippingPlanes.y, lightUBO.size_clippingPlanes.y,\n\n lightUBO.size_clippingPlanes.z, lightUBO.size_clippingPlanes.w);\n\n\n\n depthViewMatrix = glm::lookAt(lightUBO.position, lightLookAt, glm::vec3(0, 1, 0));\n\n depthProjectionMatrix[1][1] *= -1;\n\n\n\n glm::mat4 depthModelMatrix = glm::yawPitchRoll(lightRot.y, lightRot.x, lightRot.z);\n\n\n\n //lightUBO.depthMVP = depthProjectionMatrix * depthViewMatrix *depthModelMatrix;\n\n\n\n lightUBO.view = depthViewMatrix;\n\n lightUBO.proj = depthProjectionMatrix;\n\n lightUBO.direction = glm::normalize(lightLookAt - lightUBO.position);\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 34, "score": 52211.21196865831 }, { "content": "void Scene::Destroy()\n\n{\n\n\n\n objectBuffer.Destroy();\n\n\n\n for (auto& blas : bottomLevelASs)\n\n {\n\n blas.Destroy();\n\n }\n\n\n\n topLevelAS.Destroy();\n\n\n\n for(auto& lightBuffer : lightBuffers)\n\n {\n\n lightBuffer.Destroy();\n\n }\n\n\n\n for (auto& go : gameObjects) {\n\n go.Destroy();\n\n }\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 35, "score": 52210.006243227865 }, { "content": " ObjDesc objDesc;\n\n objDesc.verticesAddress = go.mesh->vertexBuffer.GetDeviceAddress();\n\n objDesc.indicesAddress = go.mesh->indexBuffer.GetDeviceAddress();\n\n AccelerationStructure blas;\n\n blas.Initialise(deviceContext);\n\n blas.createBottomLevelAccelerationStructure(go);\n\n bottomLevelASs.emplace_back(blas);\n\n bool textureFound = false;\n\n for (size_t i = 0; i < textures.size(); ++i)\n\n {\n\n if (textures[i].imageLayout == go.texture->descriptorInfo.imageLayout &&\n\n textures[i].imageView == go.texture->descriptorInfo.imageView &&\n\n textures[i].sampler == go.texture->descriptorInfo.sampler)\n\n {\n\n objDesc.textureIndex = i;\n\n textureFound = true;\n\n break;\n\n }\n\n }\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 36, "score": 52206.86033364223 }, { "content": " }\n\n }\n\n\n\n topLevelAS.Initialise(deviceContext);\n\n topLevelAS.createTopLevelAccelerationStructure(bottomLevelASs);\n\n\n\n objectBuffer.Create(deviceContext, sizeof(ObjDesc) * objecDescs.size(),\n\n VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,\n\n VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, objecDescs.data());\n\n\n\n auto accelerationStructureInfo = Initialisers::descriptorSetAccelerationStructureInfo(&topLevelAS.handle);\n\n DescriptorSetRequest accelerationStructureRequest({ {\"sceneRQ\", 4} }, 3);\n\n accelerationStructureRequest.AddDescriptorBinding(0, VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR, VK_SHADER_STAGE_FRAGMENT_BIT);\n\n accelerationStructureRequest.AddDescriptorBinding(1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, VK_SHADER_STAGE_FRAGMENT_BIT);\n\n accelerationStructureRequest.AddDescriptorBinding(2, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_SHADER_STAGE_FRAGMENT_BIT, static_cast<uint32_t>(textures.size()));\n\n accelerationStructureRequest.AddDescriptorImageData(0, &accelerationStructureInfo);\n\n accelerationStructureRequest.AddDescriptorImageData(1, &objectBuffer.descriptorInfo);\n\n accelerationStructureRequest.AddDescriptorImageData(2, textures.data());\n\n deviceContext->GetDescriptors(asDescriptor, &accelerationStructureRequest);\n\n }\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 37, "score": 52206.80073708957 }, { "content": "\n\n auto accelerationStructureInfo = Initialisers::descriptorSetAccelerationStructureInfo(&topLevelAS.handle);\n\n DescriptorSetRequest accelerationStructureRequest({ {\"sceneRQ\", 4} }, 3);\n\n accelerationStructureRequest.AddDescriptorBinding(0, VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR, VK_SHADER_STAGE_FRAGMENT_BIT);\n\n accelerationStructureRequest.AddDescriptorBinding(1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, VK_SHADER_STAGE_FRAGMENT_BIT);\n\n accelerationStructureRequest.AddDescriptorBinding(2, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_SHADER_STAGE_FRAGMENT_BIT, static_cast<uint32_t>(textures.size()));\n\n accelerationStructureRequest.AddDescriptorImageData(0, &accelerationStructureInfo);\n\n accelerationStructureRequest.AddDescriptorImageData(1, &objectBuffer.descriptorInfo);\n\n accelerationStructureRequest.AddDescriptorImageData(2, textures.data());\n\n deviceContext->GetDescriptors(asDescriptor, &accelerationStructureRequest);\n\n }\n\n}", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 38, "score": 52205.92108304279 }, { "content": "\n\n //{\n\n // auto go = CreateGameObject(resources->GetModel(\"tree2\"));\n\n // go->name = \"Tree\";\n\n //}\n\n\n\n //{\n\n // auto go = CreateGameObject(resources->GetModel(\"Dragon3\"));\n\n // go->transform.position = glm::vec3(0, 1, 0);\n\n // go->name = \"Dragon\";\n\n // go->transform.scale = glm::vec3(0.01);\n\n //}\n\n\n\n //{\n\n // auto go = CreateGameObject(resources->GetModel(\"Cat0.05\"));\n\n // go->transform.position = glm::vec3(0, 0, 1);\n\n // go->name = \"Dragon\";\n\n // go->transform.scale = glm::vec3(0.01);\n\n // go->transform.position.y = 0.0;\n\n // go->render = false;\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 39, "score": 52205.125569225434 }, { "content": "#include \"Scene.h\"\n\n\n\n#include \"DebugLogger.h\"\n\n#include \"ImGUI_.h\"\n\n\n\nScene::~Scene()\n\n{\n\n}\n\n\n\nvoid Scene::Initialise(DeviceContext* deviceContext, Resources* resources)\n\n{\n\n this->deviceContext = deviceContext;\n\n this->resources = resources;\n\n gameObjectCount = 1;\n\n gameObjects.reserve(10000);\n\n\n\n resources->GetModel(\"tree2\");\n\n //resources->GetModel(\"Dragon3\");\n\n\n\n topLevelAS.Initialise(deviceContext);\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 40, "score": 52203.78058947201 }, { "content": " //gameObjects[0].SetTexture(resources->GetTexture(\"white.jpg\"));\n\n gameObjects[1].render = false;\n\n gameObjects[1].inBVH = false;\n\n gameObjects[0].transform.scale = glm::vec3(0.1);\n\n }\n\n else if (scene == \"Tree\")\n\n {\n\n gameObjects[0].mesh = resources->GetModel(\"tree2\")->meshes[0].get();\n\n gameObjects[1].mesh = resources->GetModel(\"tree2\")->meshes[1].get();\n\n gameObjects[0].transform.scale = glm::vec3(1.0);\n\n gameObjects[1].transform.scale = glm::vec3(1.0);\n\n gameObjects[1].render = true;\n\n gameObjects[1].inBVH = true;\n\n //go->shadowCaster = false;\n\n }\n\n\n\n\n\n gameObjectCount = gameObjects.size();\n\n\n\n if (deviceContext->validGPU == 2) {\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 41, "score": 52203.685642319564 }, { "content": " std::vector<uint32_t> textureIDs;\n\n std::vector<VkDescriptorImageInfo> textures;\n\n objecDescs.reserve(gameObjects.size());\n\n textures.reserve(gameObjects.size());\n\n bottomLevelASs.reserve(gameObjects.size());\n\n for (auto& go : gameObjects)\n\n {\n\n if (!go.inBVH)\n\n continue;\n\n\n\n if (go.mesh) {\n\n ObjDesc objDesc;\n\n objDesc.verticesAddress = go.mesh->vertexBuffer.GetDeviceAddress();\n\n objDesc.indicesAddress = go.mesh->indexBuffer.GetDeviceAddress();\n\n AccelerationStructure blas;\n\n blas.Initialise(deviceContext);\n\n blas.createBottomLevelAccelerationStructure(go);\n\n bottomLevelASs.emplace_back(blas);\n\n bool textureFound = false;\n\n for (size_t i = 0; i < textures.size(); ++i)\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 42, "score": 52203.26813048503 }, { "content": " lightUBO.size_clippingPlanes.y = 60.0f;\n\n lightUBO.size_clippingPlanes.x = 1.0f;\n\n lightUBO.size_clippingPlanes.z = 5.0f;\n\n lightUBO.size_clippingPlanes.w = 500.0f;\n\n }\n\n else {\n\n lightFOV = 90.0f;\n\n lightUBO.size_clippingPlanes.x = 1.0f;\n\n lightUBO.size_clippingPlanes.z = 1.0f;\n\n lightUBO.size_clippingPlanes.w = 500.0f;\n\n }\n\n\n\n\n\n }\n\n }\n\n\n\n //lightPos = glm::vec3(0.0f, 5.0f, -5.0f);\n\n // lightFOV = 90.0f; \n\n glm::vec3 lightLookAt = glm::vec3(0, 1, 0);\n\n // Matrix from light's point of views\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 43, "score": 52202.88403479687 }, { "content": " lightWidget.Text(\"Light\");\n\n\n\n lightWidget.Slider3(\"Position\", lightUBO.position, -50.0f, 50.0f);\n\n if(!ortho)\n\n lightWidget.Slider(\"Light FOV\", &lightFOV, 1.0f, 180.0f);\n\n else\n\n lightWidget.Slider(\"Fustrum Size\", lightUBO.size_clippingPlanes.y, 1.0f, 100.0f);\n\n lightWidget.Slider(\"Size\", &lightUBO.size_clippingPlanes.x, 0.0f, 5.0f);\n\n lightWidget.Slider(\"Near\", lightUBO.size_clippingPlanes.z, 0.0f, 5.0f);\n\n lightWidget.Slider(\"Far\", lightUBO.size_clippingPlanes.w, 5.0f, 500.0f);\n\n lightWidget.ColourEdit3(\"Light Colour\", lightUBO.colour);\n\n lightWidget.Slider(\"Light Intensisty\", lightUBO.colour.w, 0.0f, 10.0f);\n\n\n\n if (lightWidget.CheckBox(\"Orthographic\", &ortho)) \n\n {\n\n lightUBO.extra.x = ortho;\n\n\n\n\n\n if (ortho) {\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 44, "score": 52202.283224518214 }, { "content": " case GLFW_KEY_LEFT:\n\n break;\n\n case GLFW_KEY_RIGHT:\n\n break;\n\n }\n\n break;\n\n }\n\n }\n\n}\n\n\n\nGameObject* Scene::CreateGameObject(Model* model)\n\n{\n\n auto& parent = gameObjects.emplace_back();\n\n if (model->meshes.size() > 1) {\n\n parent.name = \"Parent\";\n\n for (auto& mesh : model->meshes)\n\n {\n\n auto& go = gameObjects.emplace_back();\n\n go.name = mesh->name;\n\n go.parent = &parent;\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 45, "score": 52200.771489464096 }, { "content": " //}\n\n\n\n {\n\n auto go = CreateGameObject(resources->GetModel(\"plane\"));\n\n go->transform.scale = glm::vec3(100.0f);\n\n go->name = \"Floor \";\n\n }\n\n\n\n\n\n gameObjectCount = gameObjects.size();\n\n\n\n if (deviceContext->validGPU == 2) {\n\n\n\n struct ObjDesc {\n\n int textureIndex;\n\n uint64_t verticesAddress;\n\n uint64_t indicesAddress;\n\n };\n\n\n\n std::vector<ObjDesc> objecDescs;\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 46, "score": 52198.99062897296 }, { "content": " {\n\n if (textures[i].imageLayout == go.texture->descriptorInfo.imageLayout &&\n\n textures[i].imageView == go.texture->descriptorInfo.imageView &&\n\n textures[i].sampler == go.texture->descriptorInfo.sampler)\n\n {\n\n objDesc.textureIndex = i;\n\n //Log(objDesc.textureIndex, \"Texture Index\");\n\n textureFound = true;\n\n break;\n\n }\n\n }\n\n\n\n if (!textureFound)\n\n {\n\n textures.emplace_back(go.texture->descriptorInfo);\n\n objDesc.textureIndex = textures.size() - 1;\n\n //Log(objDesc.textureIndex, \"Texture Index\");\n\n }\n\n\n\n objecDescs.emplace_back(objDesc);\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 47, "score": 52198.41454571032 }, { "content": " if (!textureFound)\n\n {\n\n if(go.texture)\n\n textures.emplace_back(go.texture->descriptorInfo);\n\n else\n\n textures.emplace_back(resources->GetTexture(\"white.png\")->descriptorInfo);\n\n objDesc.textureIndex = textures.size() - 1;\n\n }\n\n\n\n objecDescs.emplace_back(objDesc);\n\n }\n\n }\n\n\n\n topLevelAS.createTopLevelAccelerationStructure(bottomLevelASs);\n\n\n\n objectBuffer.Destroy();\n\n\n\n objectBuffer.Create(deviceContext, sizeof(ObjDesc) * objecDescs.size(),\n\n VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,\n\n VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, objecDescs.data());\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 48, "score": 52197.28336755275 }, { "content": " go.mesh = mesh.get();\n\n go.Init(deviceContext);\n\n parent.children.emplace_back(&go);\n\n }\n\n parent.Init(deviceContext);\n\n }\n\n else {\n\n parent.name = model->meshes[0]->name;\n\n parent.mesh = model->meshes[0].get();\n\n parent.Init(deviceContext);\n\n }\n\n return &parent;\n\n}\n\n\n\nvoid Scene::LoadScene(const std::string& scene) \n\n{\n\n\n\n if(scene == \"Dragon\")\n\n {\n\n gameObjects[0].mesh = resources->GetModel(\"Dragon3\")->meshes[0].get();\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 49, "score": 52196.86119180501 }, { "content": "\n\n bottomLevelASs.clear();\n\n struct ObjDesc {\n\n int textureIndex;\n\n uint64_t verticesAddress;\n\n uint64_t indicesAddress;\n\n };\n\n\n\n std::vector<ObjDesc> objecDescs;\n\n std::vector<uint32_t> textureIDs;\n\n std::vector<VkDescriptorImageInfo> textures;\n\n objecDescs.reserve(gameObjects.size());\n\n textures.reserve(gameObjects.size());\n\n bottomLevelASs.reserve(gameObjects.size());\n\n for (auto& go : gameObjects)\n\n {\n\n if (!go.inBVH)\n\n continue;\n\n\n\n if (go.mesh) {\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 50, "score": 52195.74870179463 }, { "content": "}\n\n\n\nvoid Scene::KeyCallback(int key, int scancode, int action, int mods)\n\n{\n\n switch (action)\n\n {\n\n case GLFW_PRESS:\n\n {\n\n switch (key)\n\n {\n\n case GLFW_KEY_KP_4:\n\n //lightPos.x -= 2.0;\n\n break;\n\n case GLFW_KEY_KP_6:\n\n // lightPos.x += 2.0;\n\n break;\n\n case GLFW_KEY_KP_5:\n\n // lightPos.z -= 2.0;\n\n break;\n\n case GLFW_KEY_KP_8:\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 51, "score": 52194.60076021641 }, { "content": " // lightPos.z += 2.0;\n\n break;\n\n case GLFW_KEY_KP_ADD:\n\n // lightPos.y -= 2.0;\n\n break;\n\n case GLFW_KEY_KP_SUBTRACT:\n\n // lightPos.y += 2.0;\n\n break;\n\n }\n\n\n\n break;\n\n }\n\n case GLFW_RELEASE:\n\n {\n\n switch (key)\n\n {\n\n case GLFW_KEY_UP:\n\n break;\n\n case GLFW_KEY_DOWN:\n\n break;\n", "file_path": "HybridRenderer/HybridRenderer/Scene.cpp", "rank": 52, "score": 52185.769729870546 }, { "content": "void Buffer::Map()\n\n{\n\n vkMapMemory(deviceContext->logicalDevice, memory, 0, size, 0, &data);\n\n mapped = true;\n\n}\n\n\n\nvoid Buffer::Unmap()\n\n{\n\n if (mapped)\n\n vkUnmapMemory(deviceContext->logicalDevice, memory);\n\n\n\n mapped = false;\n\n}\n\n\n\nvoid Buffer::AllocatedMap(const void* src_data) {\n\n\n\n auto& memoryData = deviceContext->allocator.getMemory(bufferInfo.memoryID);\n\n\n\n vkMapMemory(deviceContext->logicalDevice, memoryData.memory, bufferInfo.memOffset, descriptorInfo.range, 0, &data);\n\n memcpy(data, src_data, static_cast<size_t>(descriptorInfo.range));\n", "file_path": "HybridRenderer/HybridRenderer/Buffer.cpp", "rank": 53, "score": 52184.94295468335 }, { "content": "#include \"Buffer.h\"\n\n\n\n#include \"Utility.h\"\n\n#include \"Initilizers.h\"\n\n#include \"DebugLogger.h\"\n\n\n\nBuffer::~Buffer()\n\n{\n\n\tdeviceContext = nullptr;\n\n}\n\n\n\nvoid Buffer::Create(DeviceContext* _devices, VkDeviceSize _size, VkBufferUsageFlags _usage, VkMemoryPropertyFlags _properties, void* _data)\n\n{\n\n deviceContext = _devices;\n\n size = _size;\n\n usage = _usage;\n\n properties = _properties;\n\n\n\n vkGetBufferDeviceAddressKHR = reinterpret_cast<PFN_vkGetBufferDeviceAddressKHR>(vkGetDeviceProcAddr(deviceContext->logicalDevice, \"vkGetBufferDeviceAddressKHR\"));\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Buffer.cpp", "rank": 54, "score": 52181.32727915905 }, { "content": " VkCommandBuffer commandBuffer = deviceContext->generateCommandBuffer();\n\n\n\n VkBufferCopy copyRegion = Initialisers::bufferCopy(size);\n\n vkCmdCopyBuffer(commandBuffer, other->vkBuffer, vkBuffer, 1, &copyRegion);\n\n\n\n deviceContext->EndCommandBuffer(commandBuffer);\n\n}\n\n\n\nvoid Buffer::AllocatedCopyFrom(Buffer* other) {\n\n\n\n VkCommandBuffer commandBuffer = deviceContext->generateCommandBuffer();\n\n\n\n auto& bufferData = deviceContext->allocator.getBuffer(bufferInfo.id);\n\n\n\n VkBufferCopy copyRegion = Initialisers::bufferCopy(other->size, other->offset, bufferInfo.offset);\n\n vkCmdCopyBuffer(commandBuffer, other->vkBuffer, bufferData.buffer, 1, &copyRegion);\n\n\n\n deviceContext->EndCommandBuffer(commandBuffer);\n\n}\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Buffer.cpp", "rank": 55, "score": 52179.91578683202 }, { "content": " if (properties & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)\n\n {\n\n AllocatedStage(_data);\n\n }\n\n else if (properties & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)\n\n {\n\n bufferInfo.data = data;\n\n AllocatedMap(_data);\n\n }\n\n }\n\n}\n\n\n\nvoid Buffer::Allocate(VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties) {\n\n\n\n deviceContext->allocator.allocateBuffer(bufferInfo, size, usage, properties);\n\n\n\n descriptorInfo = Initialisers::descriptorBufferInfo(bufferInfo.buffer, bufferInfo.size, bufferInfo.offset);\n\n}\n\n\n\nvoid Buffer::Stage(void* data) {\n", "file_path": "HybridRenderer/HybridRenderer/Buffer.cpp", "rank": 56, "score": 52179.86921143961 }, { "content": "void Buffer::Create(DeviceContext* _devices, VkDeviceSize _size, void* _data)\n\n{\n\n deviceContext = _devices;\n\n size = _size;\n\n usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT;\n\n properties = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;\n\n offset = 0;\n\n vkGetBufferDeviceAddressKHR = reinterpret_cast<PFN_vkGetBufferDeviceAddressKHR>(vkGetDeviceProcAddr(deviceContext->logicalDevice, \"vkGetBufferDeviceAddressKHR\"));\n\n\n\n createBuffer(size, usage, properties);\n\n Map(_data);\n\n}\n\n\n\nvoid Buffer::createBuffer(VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties) {\n\n\n\n VkBufferCreateInfo bufferInfo = Initialisers::bufferCreateInfo(size, usage);\n\n\n\n if (vkCreateBuffer(deviceContext->logicalDevice, &bufferInfo, nullptr, &vkBuffer) != VK_SUCCESS) {\n\n throw std::runtime_error(\"failed to create buffer!\");\n\n }\n", "file_path": "HybridRenderer/HybridRenderer/Buffer.cpp", "rank": 57, "score": 52178.29043593908 }, { "content": " vkUnmapMemory(deviceContext->logicalDevice, memoryData.memory);\n\n}\n\n\n\nvoid Buffer::Flush(VkDeviceSize size, VkDeviceSize offset)\n\n{\n\n VkMappedMemoryRange mappedRange = {};\n\n mappedRange.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;\n\n mappedRange.memory = memory;\n\n mappedRange.offset = offset;\n\n mappedRange.size = size;\n\n vkFlushMappedMemoryRanges(deviceContext->logicalDevice, 1, &mappedRange);\n\n}\n\n\n\nuint64_t Buffer::GetDeviceAddress()\n\n{\n\n VkBufferDeviceAddressInfoKHR bufferDeviceAddressInfo{};\n\n bufferDeviceAddressInfo.sType = VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO;\n\n bufferDeviceAddressInfo.buffer = vkBuffer;\n\n \n\n return vkGetBufferDeviceAddressKHR(deviceContext->logicalDevice, &bufferDeviceAddressInfo);\n", "file_path": "HybridRenderer/HybridRenderer/Buffer.cpp", "rank": 58, "score": 52178.097184416474 }, { "content": "\n\n Buffer stagingBuffer;\n\n stagingBuffer.Create(deviceContext, size, data);\n\n\n\n CopyFrom(&stagingBuffer);\n\n stagingBuffer.Destroy();\n\n}\n\n\n\nvoid Buffer::AllocatedStage(void* data)\n\n{\n\n Buffer stagingBuffer;\n\n stagingBuffer.Create(deviceContext, size, data);\n\n\n\n AllocatedCopyFrom(&stagingBuffer);\n\n stagingBuffer.Destroy();\n\n\n\n}\n\n\n\nvoid Buffer::CopyFrom(Buffer* other) {\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Buffer.cpp", "rank": 59, "score": 52176.606859726824 }, { "content": "\n\n descriptorInfo = Initialisers::descriptorBufferInfo(vkBuffer, size);\n\n}\n\n\n\nvoid Buffer::Allocate(DeviceContext* _devices, VkDeviceSize _size, VkBufferUsageFlags _usage, VkMemoryPropertyFlags _properties, void* _data)\n\n{\n\n deviceContext = _devices;\n\n size = _size;\n\n usage = _usage;\n\n properties = _properties;\n\n\n\n if (properties & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)\n\n {\n\n usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT;\n\n }\n\n\n\n Allocate(size, usage, properties);\n\n\n\n if (_data)\n\n {\n", "file_path": "HybridRenderer/HybridRenderer/Buffer.cpp", "rank": 60, "score": 52175.73169494937 }, { "content": "void Buffer::Destroy() {\n\n\n\n Unmap();\n\n if (vkBuffer != VK_NULL_HANDLE)\n\n {\n\n vkDestroyBuffer(deviceContext->logicalDevice, vkBuffer, nullptr);\n\n }\n\n if (memory != VK_NULL_HANDLE)\n\n {\n\n vkFreeMemory(deviceContext->logicalDevice, memory, nullptr);\n\n }\n\n}\n\n\n\nvoid Buffer::Map(void* _data) {\n\n\n\n vkMapMemory(deviceContext->logicalDevice, memory, 0, size, 0, &data);\n\n memcpy(data, _data, (size_t)size);\n\n vkUnmapMemory(deviceContext->logicalDevice, memory);\n\n}\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Buffer.cpp", "rank": 61, "score": 52175.43855228361 }, { "content": "}\n\n\n\n//\n\nuint64_t Buffer::GetAllocatedDeviceAddress()\n\n{\n\n auto& bufferData = deviceContext->allocator.getBuffer(bufferInfo.id);\n\n VkBufferDeviceAddressInfoKHR bufferDeviceAddressInfo{};\n\n bufferDeviceAddressInfo.sType = VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO;\n\n bufferDeviceAddressInfo.buffer = bufferData.buffer;\n\n return vkGetBufferDeviceAddressKHR(deviceContext->logicalDevice, &bufferDeviceAddressInfo);\n\n}", "file_path": "HybridRenderer/HybridRenderer/Buffer.cpp", "rank": 62, "score": 52168.24103776036 }, { "content": " if (properties & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)\n\n {\n\n usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT;\n\n }\n\n\n\n createBuffer(size, usage, properties);\n\n\n\n if (_data)\n\n {\n\n if (properties & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)\n\n {\n\n Stage(_data);\n\n }\n\n else if (properties & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)\n\n {\n\n Map(_data);\n\n }\n\n }\n\n}\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Buffer.cpp", "rank": 63, "score": 52166.8998923396 }, { "content": "\n\n VkMemoryRequirements memRequirements;\n\n vkGetBufferMemoryRequirements(deviceContext->logicalDevice, vkBuffer, &memRequirements);\n\n\n\n\n\n VkMemoryAllocateInfo allocInfo = Initialisers::memoryAllocateInfo(memRequirements.size,\n\n Utility::findMemoryType(memRequirements.memoryTypeBits, deviceContext->physicalDevice, properties));\n\n\n\n VkMemoryAllocateFlagsInfoKHR allocFlagsInfo{};\n\n if (usage & VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT) {\n\n allocFlagsInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR;\n\n allocFlagsInfo.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR;\n\n allocInfo.pNext = &allocFlagsInfo;\n\n }\n\n\n\n if (vkAllocateMemory(deviceContext->logicalDevice, &allocInfo, nullptr, &memory) != VK_SUCCESS) {\n\n throw std::runtime_error(\"failed to allocate buffer memory!\");\n\n }\n\n\n\n vkBindBufferMemory(deviceContext->logicalDevice, vkBuffer, memory, 0);\n", "file_path": "HybridRenderer/HybridRenderer/Buffer.cpp", "rank": 64, "score": 52165.45541024785 }, { "content": "#pragma once\n\n\n\n#include \"Constants.h\"\n\n#include \"SwapChain.h\"\n\n\n", "file_path": "HybridRenderer/HybridRenderer/FrameBuffer.h", "rank": 65, "score": 52163.633936446924 }, { "content": "struct LightUBO {\n\n\tglm::mat4 proj;\n\n\tglm::mat4 view;\n\n\talignas(16) glm::vec4 size_clippingPlanes{1.0f, 3.0f, 0.25f, 100.0f};\n\n\talignas(16) glm::vec3 position{ 0.0f, 4.0f, -5.0f };\n\n\talignas(16) glm::vec3 direction{ 0.0f, 4.0f, -5.0f };\n\n\talignas(16) glm::vec4 colour{0.5f};\n\n\talignas(16) glm::ivec4 extra;\n\n};\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Scene.h", "rank": 66, "score": 50529.09870556111 }, { "content": "}\n\n\n\nvoid FrameBuffer::Create(DeviceContext* _devices, VkRenderPass _vkRenderPass)\n\n{\n\n\tdevices = _devices;\n\n\tInit(_vkRenderPass);\n\n}\n\n\n\nvoid FrameBuffer::Init(VkRenderPass _vkRenderPass)\n\n{\n\n\tvkRenderPass = _vkRenderPass;\n\n\tframes.reserve(devices->imageCount);\n\n}\n\n\n\n\n\nvoid FrameBuffer::createFramebuffer(const std::vector<VkImageView>& attachments, VkExtent2D extent) {\n\n\n\n\tframes.emplace_back(FrameData());\n\n\n\n\tsize_t idx = frames.size() - 1;\n", "file_path": "HybridRenderer/HybridRenderer/FrameBuffer.cpp", "rank": 67, "score": 50525.66067302691 }, { "content": "#include \"FrameBuffer.h\"\n\n\n\n#include \"Initilizers.h\"\n\n#include \"Utility.h\"\n\n\n\n#include <array>\n\n#include <stdexcept>\n\n\n\nFrameBuffer::~FrameBuffer()\n\n{\n\n devices = nullptr;\n\n swapChain = nullptr;\n\n vkRenderPass = VK_NULL_HANDLE;\n\n}\n\n\n\nvoid FrameBuffer::Create(DeviceContext* _devices, SwapChain* _swapChain, VkRenderPass _vkRenderPass)\n\n{\n\n devices = _devices;\n\n swapChain = _swapChain;\n\n Init(_vkRenderPass);\n", "file_path": "HybridRenderer/HybridRenderer/FrameBuffer.cpp", "rank": 68, "score": 50518.64105858176 }, { "content": "\n\n\treturn false;\n\n}\n\n\n\nvoid FrameBuffer::Destroy() {\n\n\tfor (auto frame: frames) {\n\n\t\tvkDestroyFramebuffer(devices->logicalDevice, frame.vkFrameBuffer, nullptr);\n\n\t}\n\n\tframes.clear();\n\n}", "file_path": "HybridRenderer/HybridRenderer/FrameBuffer.cpp", "rank": 69, "score": 50517.8883320848 }, { "content": "\n\n\tframes[idx].extent = extent;\n\n\n\n\tVkFramebufferCreateInfo framebufferInfo = Initialisers::framebufferCreateInfo(vkRenderPass, attachments.data(), static_cast<uint32_t>(attachments.size()), extent);\n\n\n\n\tif (vkCreateFramebuffer(devices->logicalDevice, &framebufferInfo, nullptr, &frames[idx].vkFrameBuffer) != VK_SUCCESS) {\n\n\t\tthrow std::runtime_error(\"failed to create framebuffer!\");\n\n\t}\n\n}\n\n\n\nVkBool32 formatIsFilterable(VkPhysicalDevice physicalDevice, VkFormat format, VkImageTiling tiling)\n\n{\n\n\tVkFormatProperties formatProps;\n\n\tvkGetPhysicalDeviceFormatProperties(physicalDevice, format, &formatProps);\n\n\n\n\tif (tiling == VK_IMAGE_TILING_OPTIMAL)\n\n\t\treturn formatProps.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT;\n\n\n\n\tif (tiling == VK_IMAGE_TILING_LINEAR)\n\n\t\treturn formatProps.linearTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT;\n", "file_path": "HybridRenderer/HybridRenderer/FrameBuffer.cpp", "rank": 70, "score": 50511.527313084494 }, { "content": "struct BufferInfo {\n\n VkBuffer buffer;\n\n VkDeviceSize offset = 0;\n\n VkDeviceSize memOffset = 0;\n\n VkDeviceSize size = 0;\n\n VkBufferUsageFlags usage;\n\n uint32_t id = 0;\n\n uint32_t memoryID = 0;\n\n bool mapped = false;\n\n void* data = nullptr;\n\n};\n\n\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Allocator.h", "rank": 71, "score": 50500.61481456239 }, { "content": "struct BufferData {\n\n VkBuffer buffer;\n\n VkDeviceSize offset;\n\n VkDeviceSize currentMemoryOffset = 0;\n\n VkDeviceSize memStartOffset = 0;\n\n VkDeviceSize size = 0;\n\n VkDeviceSize allocatedSize = 0;\n\n VkBufferUsageFlags usage;\n\n uint32_t id = 0;\n\n uint32_t memoryID = 0;\n\n void* data = nullptr;\n\n};\n\n\n\n\n", "file_path": "HybridRenderer/HybridRenderer/Allocator.h", "rank": 72, "score": 50500.61481456239 }, { "content": "#include \"DescriptorSetRequest.h\"\n\n\n\n#include \"Initilizers.h\"\n\n\n\n#include \"Buffer.h\"\n\n#include <vector>\n\n\n\n\n\nvoid DescriptorBinding::AddBufferData(void* data)\n\n{\n\n\tauto buffers = reinterpret_cast<Buffer*>(data);\n\n\tthis->data.reserve(3);\n\n\tfor(size_t i = 0; i< 3; ++i)\n\n\t{\n\n\t\tthis->data.push_back(&buffers[i].descriptorInfo);\n\n\t}\n\n}\n\n\n\nvoid DescriptorBinding::AddData(void* data)\n\n{\n", "file_path": "HybridRenderer/HybridRenderer/DescriptorSetRequest.cpp", "rank": 73, "score": 48977.57438606099 }, { "content": "\t_binding.binding = binding;\n\n\t_binding.type = type;\n\n\t_binding.descriptorCount = count;\n\n\t_binding.shaderFlags = shaderFlags;\n\n\ttotalSets += count;\n\n}\n\n\n\nvoid DescriptorSetRequest::AddDescriptorBufferData(size_t binding, void* data)\n\n{\n\n\tfor(auto& b : bindings)\n\n\t{\n\n\t\tif(b.binding == binding)\n\n\t\t\tb.AddBufferData(data);\n\n\t}\n\n}\n\n\n\nvoid DescriptorSetRequest::AddDescriptorImageData(size_t binding, void* data)\n\n{\n\n\tfor (auto& b : bindings)\n\n\t{\n", "file_path": "HybridRenderer/HybridRenderer/DescriptorSetRequest.cpp", "rank": 74, "score": 48976.213426631686 }, { "content": "\tthis->data.reserve(3);\n\n\tthis->data.push_back(data);\n\n\tthis->data.push_back(data);\n\n\tthis->data.push_back(data);\n\n}\n\n\n\nDescriptorSetRequest::DescriptorSetRequest(size_t i)\n\n{\n\n\tbindings.reserve(i);\n\n}\n\n\n\nDescriptorSetRequest::DescriptorSetRequest(const std::vector<LayoutSetOrder>& tags, size_t i)\n\n{\n\n\tbindings.reserve(i);\n\n\tlayoutTags.insert(layoutTags.cend(), tags.begin(), tags.cend());\n\n}\n\n\n\nvoid DescriptorSetRequest::AddDescriptorBinding(uint32_t binding, VkDescriptorType type, VkShaderStageFlagBits shaderFlags, uint32_t count)\n\n{\n\n\tauto& _binding = bindings.emplace_back();\n", "file_path": "HybridRenderer/HybridRenderer/DescriptorSetRequest.cpp", "rank": 75, "score": 48961.47629710438 }, { "content": "\t\tif (b.binding == binding)\n\n\t\t\tb.AddData(data);\n\n\t}\n\n}\n\n\n\nvoid DescriptorSetRequest::AddDescriptorSetLayoutTags(const std::vector<std::string>& tags)\n\n{\n\n\t//layoutTags.insert(layoutTags.end(), tags.begin(), tags.end());\n\n}\n\n\n\nvoid DescriptorSetRequest::AddDescriptorSetLayoutTag(const std::string& tag)\n\n{\n\n\t//layoutTags.emplace_back(tag);\n\n}\n", "file_path": "HybridRenderer/HybridRenderer/DescriptorSetRequest.cpp", "rank": 76, "score": 48954.2140327819 }, { "content": "struct ScratchBuffer\n\n{\n\n\tuint64_t deviceAddress = 0;\n\n\tVkBuffer handle = VK_NULL_HANDLE;\n\n\tVkDeviceMemory memory = VK_NULL_HANDLE;\n\n};\n\n\n", "file_path": "HybridRenderer/HybridRenderer/AccelerationStructure.h", "rank": 77, "score": 48946.76799593348 }, { "content": "struct FrameData {\n\n\tVkFramebuffer vkFrameBuffer;\n\n\tVkExtent2D extent;\n\n};\n\n\n", "file_path": "HybridRenderer/HybridRenderer/FrameBuffer.h", "rank": 78, "score": 48946.76799593348 }, { "content": "\tglm::vec3 forward = glm::vec3(0, 0, 1);\n", "file_path": "HybridRenderer/HybridRenderer/Transform.h", "rank": 79, "score": 47526.23328714487 }, { "content": "\tbool operator == (const Transform& other) {\n", "file_path": "HybridRenderer/HybridRenderer/Transform.h", "rank": 80, "score": 46148.676551494165 }, { "content": "\tconst glm::mat4 getMatrix() {\n\n\t\tglm::mat4 matrix = glm::mat4(1.0f);\n\n\t\tmatrix = glm::translate(glm::mat4(1.0f), position);\n\n\t\t//matrix *= glm::yawPitchRoll(glm::radians(rotation.y), glm::radians(rotation.x), glm::radians(rotation.z));\n\n\t\tmatrix = glm::rotate(matrix, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f));\n\n\t\tmatrix = glm::rotate(matrix, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f));\n\n\t\tmatrix = glm::rotate(matrix, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f));\n\n\t\tmatrix = glm::scale(matrix, scale);\n\n\t\treturn matrix;\n", "file_path": "HybridRenderer/HybridRenderer/Transform.h", "rank": 81, "score": 44848.72781142222 }, { "content": "struct RayTracingScratchBuffer\n\n{\n\n\tuint64_t deviceAddress = 0;\n\n\tVkBuffer handle = VK_NULL_HANDLE;\n\n\tVkDeviceMemory memory = VK_NULL_HANDLE;\n\n};\n\n\n", "file_path": "HybridRenderer/HybridRenderer/RayTracingRenderer.h", "rank": 82, "score": 44810.46588664704 }, { "content": " std::vector<LayoutSetOrder> layoutTags;\n", "file_path": "HybridRenderer/HybridRenderer/DescriptorSetRequest.h", "rank": 83, "score": 44806.62607985443 }, { "content": "\tDescriptorSetRequest requestData;\n", "file_path": "HybridRenderer/HybridRenderer/Descriptor.h", "rank": 84, "score": 44806.62607985443 }, { "content": " ImVector<ImGuiViewportP*> Viewports; // Active viewports (Size==1 in 'master' branch). Each viewports hold their copy of ImDrawData.\n", "file_path": "HybridRenderer/HybridRenderer/imgui/imgui_internal.h", "rank": 85, "score": 43631.10649902572 }, { "content": "struct PushConstBlock {\n\n glm::vec2 scale;\n\n glm::vec2 translate;\n", "file_path": "HybridRenderer/HybridRenderer/Constants.h", "rank": 86, "score": 43626.78836972776 }, { "content": "\tvoid vkSetViewport(VkCommandBuffer cmdBuffer);\n\n\n\n\tvoid setViewport(glm::vec2 size, glm::vec2 offset);\n\n\n\n\tvoid setScissor(glm::vec2 size, glm::vec2 offset);\n\n\n\n\tvoid SetCullDistance(float cullDistance);\n\n\n\n\n\n\tstd::vector<Buffer> buffers;\n\n\n\n\tDescriptor descriptor;\n\n\n\n\tvoid updateWindow(float windowWidth, float windowHeight);\n\n\n\n\tvoid ResetPan();\n\n\n\n\tFrustum frustum;\n\n\n\n\tImGUIWidget widget;\n", "file_path": "HybridRenderer/HybridRenderer/Camera.h", "rank": 92, "score": 45.858557376840665 }, { "content": "\n\n\tTransform prevTransform;\n\n\tglm::vec3 prevLookAt = glm::vec3(0, 0, 0);\n\n\tglm::vec3 prevUp = glm::vec3(0, 1, 0);\n\n\n\n\tglm::vec4 prevScissor = glm::vec4(0, 0, 1, 1);\n\n\tglm::vec4 prevViewport = glm::vec4(0, 0, 1, 1);\n\n\n\n\tfloat prevFOV;\n\n\tfloat prevNearPlane;\n\n\tfloat prevFarPlane;\n\n\n\n\tfloat prevWindowWidth;\n\n\tfloat prevWindowHeight;\n\n\n\n\tbool prevLookAtPlace;\n\n\tfloat distance = 10.0f;\n\n\tfloat angle = 0.0f;\n\n\tfloat speed = 0.2f;\n\n\n\n};", "file_path": "HybridRenderer/HybridRenderer/Camera.h", "rank": 95, "score": 41.89942629564484 }, { "content": "\n\n\tCameraGPU gpuData;\n\n\tbool adaptiveDistance = true;\n\n\tfloat multiplier = 5.0f;\n\n\tstd::vector<float> distances;\n\n\n\n\tbool pan = false;\n\n\tstd::vector<glm::vec3> positions;\n\n\tstd::vector<float> timings;\n\n\tfloat time = 0.0;\n\n\tsize_t currentIndex = 0;\n\n\tfloat zoom = 1.0f;\n\n\n\nprivate:\n\n\tbool valuesUpdated(float windowWidth, float windowHeight);\n\n\tvoid updateValues(const VkExtent2D& _extent);\n\n\n\n\n\n\tfloat windowWidth = 0;\n\n\tfloat windowHeight = 0;\n", "file_path": "HybridRenderer/HybridRenderer/Camera.h", "rank": 97, "score": 39.722625189537304 } ]
C++
samples/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/remarks.cpp
hamarb123/dotnet-api-docs
6aeb55784944a2f1f5e773b657791cbd73a92dd4
#using <System.dll> using namespace System; using namespace System::Collections; using namespace System::Collections::Specialized; public ref class ODEnum : IDictionaryEnumerator { private: int position; ArrayList^ itemlist; public: ODEnum(ArrayList^ list) { this->Reset(); itemlist = list; } virtual bool MoveNext() { position++; return (position < itemlist->Count); } virtual void Reset() { position = -1; } virtual property Object^ Current { Object^ get() { try { return itemlist[position]; } catch (IndexOutOfRangeException^) { throw gcnew InvalidOperationException(); } } } virtual property DictionaryEntry Entry { DictionaryEntry get() { return (DictionaryEntry)(Current); } } virtual property Object^ Key { Object^ get() { try { return ((DictionaryEntry^)itemlist[position])->Key; } catch (IndexOutOfRangeException^) { throw gcnew InvalidOperationException(); } } } virtual property Object^ Value { Object^ get() { try { return ((DictionaryEntry^)itemlist[position])->Value; } catch (IndexOutOfRangeException^) { throw gcnew InvalidOperationException(); } } } }; public ref class SimpleOD : IOrderedDictionary { private: ArrayList^ itemlist; public: SimpleOD(int numItems) { itemlist = gcnew ArrayList(numItems); } int IndexOfKey(Object^ key) { for (int i = 0; i < itemlist->Count; i++) { if (((DictionaryEntry^)itemlist[i])->Key == key) return i; } return -1; } virtual property Object^ default[Object^] { Object^ get(Object^ key) { return ((DictionaryEntry^)itemlist[IndexOfKey(key)])->Value; } void set(Object^ key, Object^ value) { itemlist[IndexOfKey(key)] = gcnew DictionaryEntry(key, value); } } virtual IDictionaryEnumerator^ GetEnumerator() { return gcnew ODEnum(itemlist); } virtual void Insert(int index, Object^ key, Object^ value) { if (IndexOfKey(key) != -1) { throw gcnew ArgumentException("An element with the same key already exists in the collection."); } itemlist->Insert(index, gcnew DictionaryEntry(key, value)); } virtual void RemoveAt(int index) { itemlist->RemoveAt(index); } virtual property Object^ default[int] { Object^ get(int index) { return ((DictionaryEntry^)itemlist[index])->Value; } void set(int index, Object^ value) { Object^ key = ((DictionaryEntry^)itemlist[index])->Key; itemlist[index] = gcnew DictionaryEntry(Keys, value); } } virtual void Add(Object^ key, Object^ value) { if (IndexOfKey(key) != -1) { throw gcnew ArgumentException("An element with the same key already exists in the collection."); } itemlist->Add(gcnew DictionaryEntry(key, value)); } virtual void Clear() { itemlist->Clear(); } virtual bool Contains(Object^ key) { if (IndexOfKey(key) == -1) { return false; } else { return true; } } virtual property bool IsFixedSize { bool get() { return false; } } virtual property bool IsReadOnly { bool get() { return false; } } virtual property ICollection^ Keys { ICollection^ get() { ArrayList^ KeyCollection = gcnew ArrayList(itemlist->Count); for (int i = 0; i < itemlist->Count; i++) { KeyCollection[i] = ((DictionaryEntry^)itemlist[i])->Key; } return KeyCollection; } } virtual void Remove(Object^ key) { itemlist->RemoveAt(IndexOfKey(key)); } virtual property ICollection^ Values { ICollection ^get() { ArrayList^ ValueCollection = gcnew ArrayList(itemlist->Count); for (int i = 0; i < itemlist->Count; i++) { ValueCollection[i] = ((DictionaryEntry^)itemlist[i])->Value; } return ValueCollection; } } virtual void CopyTo(Array^ array, int index) { itemlist->CopyTo(array, index); } virtual property int Count { int get() { return itemlist->Count; } } virtual property bool IsSynchronized { bool get() { return itemlist->IsSynchronized; } } virtual property Object^ SyncRoot { Object^ get() { return itemlist->SyncRoot; } } virtual IEnumerator^ IfcGetEnumerator() = IEnumerable::GetEnumerator { return (IEnumerator^) gcnew ODEnum(itemlist); } }; class App { public: static void Main() { int index = 1; SimpleOD^ myOrderedDictionary = gcnew SimpleOD(2); myOrderedDictionary->Add("Way", "ToGo"); myOrderedDictionary->Add("Far", "Out"); Object^ obj; obj = myOrderedDictionary[index]; for each (DictionaryEntry de in myOrderedDictionary) { } } }; int main() { App::Main(); }
#using <System.dll> using namespace System; using namespace System::Collections; using namespace System::Collections::Specialized; public ref class ODEnum : IDictionaryEnumerator { private: int position; ArrayList^ itemlist; public: ODEnum(ArrayList^ list) { this->Reset(); itemlist = list; } virtual bool MoveNext() { position++; return (position < itemlist->Count); } virtual void Reset() { position = -1; } virtual property Object^ Current { Object^ get() { try { return itemlist[position]; } catch (IndexOutOfRangeException^) { throw gcnew InvalidOperationException(); } } } virtual property DictionaryEntry Entry { DictionaryEntry get() { return (DictionaryEntry)(Current); } } virtual property Object^ Key { Object^ get() { try { return ((DictionaryEntry^)itemlist[position])->Key; } catch (IndexOutOfRangeException^) { throw gcnew InvalidOperationException(); } } } virtual property Object^ Value { Object^ get() { try { return ((DictionaryEntry^)itemlist[position])->Value; } catch (IndexOutOfRangeException^) { throw gcnew InvalidOperationException(); } } } }; public ref class SimpleOD : IOrderedDictionary { private: ArrayList^ itemlist; public: SimpleOD(int numItems) { itemlist = gcnew ArrayList(numItems); } int IndexOfKey(Object^ key) { for (int i = 0; i < itemlist->Count; i++) { if (((DictionaryEntry^)itemlist[i])->Key == key) return i; } return -1; } virtual property Object^ default[Object^] { Object^ get(Object^ key) { return ((DictionaryEntry^)itemlist[IndexOfKey(key)])->Value; } void set(Object^ key, Object^ value) { itemlist[IndexOfKey(key)] = gcnew DictionaryEntry(key, value); } } virtual IDictionaryEnumerator^ GetEnumerator() { return gcnew ODEnum(itemlist); } virtual void Insert(int index, Object^ key, Object^ value) { if (IndexOfKey(key) != -1) { throw gcnew ArgumentException("An element with the same key already exists in the collection."); } itemlist->Insert(index, gcnew DictionaryEntry(key, value)); } virtual void RemoveAt(int index) { itemlist->RemoveAt(index); } virtual property Object^ default[int] { Object^ get(int index) { return ((DictionaryEntry^)itemlist[index])->Value; } void set(int index, Object^ value) { Object^ key = ((DictionaryEntry^)itemlist[index])->Key; itemlist[index] = gcnew DictionaryEntry(Keys, value); } } virtual void Add(Object^ key, Object^ value) { if (IndexOfKey(key) != -1) { throw gcnew ArgumentException("An element with the same key already exists in the collection."); } itemlist->Add(gcnew DictionaryEntry(key, value)); } virtual void Clear() { itemlist->Clear(); } virtual bool Contains(Object^ key) { if (IndexOfKey(key) == -1) { return false; } else { return true; } } virtual property bool IsFixedSize { bool get() { return false; } } virtual property bool IsReadOnly { bool get() { return false; } } virtual property ICollection^ Keys { ICollection^ get() { ArrayList^ KeyCollection = gcnew ArrayList(itemlist->Count); for (int i = 0; i < itemlist->Count; i++) { KeyCollection[i] = ((DictionaryEntry^)itemlist[i])->Key; } return KeyCollection; } } virtual void Remove(Object^ key) { itemlist->RemoveAt(IndexOfKey(key)); } virtual property ICollection^ Values { ICollection ^get() { ArrayList^ ValueCollection = gcnew ArrayList(itemlist->Count); for (int i = 0; i < itemlist->Count; i++) { ValueCollection[i] = ((DictionaryEntry^)itemlist[i])->Value; } return ValueCollection; } } virtual void CopyTo(Array^ array, int index) { itemlist->CopyTo(array, index); } virtual property int Count { int get() { return itemlist->Count; } }
virtual property Object^ SyncRoot { Object^ get() { return itemlist->SyncRoot; } } virtual IEnumerator^ IfcGetEnumerator() = IEnumerable::GetEnumerator { return (IEnumerator^) gcnew ODEnum(itemlist); } }; class App { public: static void Main() { int index = 1; SimpleOD^ myOrderedDictionary = gcnew SimpleOD(2); myOrderedDictionary->Add("Way", "ToGo"); myOrderedDictionary->Add("Far", "Out"); Object^ obj; obj = myOrderedDictionary[index]; for each (DictionaryEntry de in myOrderedDictionary) { } } }; int main() { App::Main(); }
virtual property bool IsSynchronized { bool get() { return itemlist->IsSynchronized; } }
function_block-function_prefix_line
[]
C++
tutorial/lesson_15_generators.cpp
pelikan/Halide
5b4eac0f810dbd8dc8d224cb322d5b1215ea224d
#include "Halide.h" #include <stdio.h> using namespace Halide; class MyFirstGenerator : public Halide::Generator<MyFirstGenerator> { public: Input<uint8_t> offset{"offset"}; Input<Buffer<uint8_t>> input{"input", 2}; Output<Buffer<uint8_t>> brighter{"brighter", 2}; Var x, y; void generate() { brighter(x, y) = input(x, y) + offset; brighter.vectorize(x, 16).parallel(y); } }; HALIDE_REGISTER_GENERATOR(MyFirstGenerator, my_first_generator) class MySecondGenerator : public Halide::Generator<MySecondGenerator> { public: GeneratorParam<bool> parallel{"parallel", true}; GeneratorParam<float> scale{"scale", 1.0f , 0.0f , 100.0f }; enum class Rotation { None, Clockwise, CounterClockwise }; GeneratorParam<Rotation> rotation{"rotation", Rotation::None, {{"none", Rotation::None}, {"cw", Rotation::Clockwise}, {"ccw", Rotation::CounterClockwise}}}; Input<uint8_t> offset{"offset"}; Input<Buffer<uint8_t>> input{"input", 2}; Output<Buffer<>> output{"output", 2}; Var x, y; void generate() { Func brighter; brighter(x, y) = scale * (input(x, y) + offset); Func rotated; switch ((Rotation)rotation) { case Rotation::None: rotated(x, y) = brighter(x, y); break; case Rotation::Clockwise: rotated(x, y) = brighter(y, 100 - x); break; case Rotation::CounterClockwise: rotated(x, y) = brighter(100 - y, x); break; } output(x, y) = cast(output.type(), rotated(x, y)); output.vectorize(x, natural_vector_size(output.type())); if (parallel) { output.parallel(y); } if (rotation != Rotation::None) { rotated .compute_at(output, y) .vectorize(x, natural_vector_size(rotated.output_types()[0])); } } }; HALIDE_REGISTER_GENERATOR(MySecondGenerator, my_second_generator)
#include "Halide.h" #include <stdio.h> using namespace Halide; class MyFirstGenerator : public Halide::Generator<MyFirstGenerator> { public: Input<uint8_t> offset{"offset"}; Input<Buffer<uint8_t>> input{"input", 2}; Output<Buffer<uint8_t>> brighter{"brighter", 2}; Var x, y;
}; HALIDE_REGISTER_GENERATOR(MyFirstGenerator, my_first_generator) class MySecondGenerator : public Halide::Generator<MySecondGenerator> { public: GeneratorParam<bool> parallel{"parallel", true}; GeneratorParam<float> scale{"scale", 1.0f , 0.0f , 100.0f }; enum class Rotation { None, Clockwise, CounterClockwise }; GeneratorParam<Rotation> rotation{"rotation", Rotation::None, {{"none", Rotation::None}, {"cw", Rotation::Clockwise}, {"ccw", Rotation::CounterClockwise}}}; Input<uint8_t> offset{"offset"}; Input<Buffer<uint8_t>> input{"input", 2}; Output<Buffer<>> output{"output", 2}; Var x, y; void generate() { Func brighter; brighter(x, y) = scale * (input(x, y) + offset); Func rotated; switch ((Rotation)rotation) { case Rotation::None: rotated(x, y) = brighter(x, y); break; case Rotation::Clockwise: rotated(x, y) = brighter(y, 100 - x); break; case Rotation::CounterClockwise: rotated(x, y) = brighter(100 - y, x); break; } output(x, y) = cast(output.type(), rotated(x, y)); output.vectorize(x, natural_vector_size(output.type())); if (parallel) { output.parallel(y); } if (rotation != Rotation::None) { rotated .compute_at(output, y) .vectorize(x, natural_vector_size(rotated.output_types()[0])); } } }; HALIDE_REGISTER_GENERATOR(MySecondGenerator, my_second_generator)
void generate() { brighter(x, y) = input(x, y) + offset; brighter.vectorize(x, 16).parallel(y); }
function_block-full_function
[ { "content": "class ExprUsesVars : public IRGraphVisitor {\n\n using IRGraphVisitor::visit;\n\n\n\n const Scope<T> &vars;\n\n Scope<Expr> scope;\n\n\n\n void include(const Expr &e) override {\n\n if (result) return;\n\n IRGraphVisitor::include(e);\n\n }\n\n\n\n void include(const Stmt &s) override {\n\n if (result) return;\n\n IRGraphVisitor::include(s);\n\n }\n\n\n\n void visit_name(const std::string &name) {\n\n if (vars.contains(name)) {\n\n result = true;\n\n } else if (scope.contains(name)) {\n", "file_path": "src/ExprUsesVar.h", "rank": 0, "score": 282286.04128657485 }, { "content": "// Visitor to find all the variables the depend on a variable.\n\nclass FindVarsUsingVar : public IRVisitor {\n\n using IRVisitor::visit;\n\n\n\n void visit(const Let *let) override {\n\n if (expr_uses_vars(let->value, vars)) {\n\n vars.push(let->name);\n\n }\n\n let->value.accept(this);\n\n let->body.accept(this);\n\n }\n\n\n\npublic:\n\n Scope<> vars;\n\n\n\n FindVarsUsingVar(const string &var) {\n\n vars.push(var);\n\n }\n\n};\n\n\n\nvoid Partitioner::generate_group_cpu_schedule(\n", "file_path": "src/AutoSchedule.cpp", "rank": 1, "score": 265964.06665724824 }, { "content": "class CountVarUses : public IRVisitor {\n\n std::map<std::string, int> &var_uses;\n\n\n\n void visit(const Variable *var) override {\n\n var_uses[var->name]++;\n\n }\n\n\n\n void visit(const Load *op) override {\n\n var_uses[op->name]++;\n\n IRVisitor::visit(op);\n\n }\n\n\n\n void visit(const Store *op) override {\n\n var_uses[op->name]++;\n\n IRVisitor::visit(op);\n\n }\n\n\n\n using IRVisitor::visit;\n\n\n\npublic:\n", "file_path": "src/Simplify_Let.cpp", "rank": 2, "score": 255642.98513875031 }, { "content": "class UsesGPUVars : public IRVisitor {\n\nprivate:\n\n using IRVisitor::visit;\n\n void visit(const Variable *op) override {\n\n if (CodeGen_GPU_Dev::is_gpu_var(op->name)) {\n\n debug(3) << \"Found gpu loop var: \" << op->name << \"\\n\";\n\n uses_gpu = true;\n\n }\n\n }\n\n\n\npublic:\n\n bool uses_gpu = false;\n\n};\n\n\n\nbool uses_gpu_vars(const Expr &s) {\n\n UsesGPUVars uses;\n\n s.accept(&uses);\n\n return uses.uses_gpu;\n\n}\n\n\n", "file_path": "src/VectorizeLoops.cpp", "rank": 3, "score": 255642.9851387503 }, { "content": "class CanUseTarget : public Halide::Generator<CanUseTarget> {\n\npublic:\n\n Output<Buffer<uint32_t>> output{\"output\", 2};\n\n\n\n // Current really just a placeholder: can_use_target_aottest.cpp just\n\n // needs to test the runtime itself, not the generator function.\n\n void generate() {\n\n Var x, y;\n\n output(x, y) = cast<uint32_t>((int32_t)0xdeadbeef);\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(CanUseTarget, can_use_target)\n", "file_path": "test/generator/can_use_target_generator.cpp", "rank": 4, "score": 237040.4117698125 }, { "content": "class Var {\n\n /* The expression representing the Var. Guaranteed to be an\n\n * Internal::Variable of type Int(32). Created once on\n\n * construction of the Var to avoid making a fresh Expr every time\n\n * the Var is used in a context in which is will be converted to\n\n * one. */\n\n Expr e;\n\n\n\npublic:\n\n /** Construct a Var with the given name */\n\n Var(const std::string &n);\n\n\n\n /** Construct a Var with an automatically-generated unique name. */\n\n Var();\n\n\n\n /** Get the name of a Var */\n\n const std::string &name() const;\n\n\n\n /** Test if two Vars are the same. This simply compares the names. */\n\n bool same_as(const Var &other) const {\n", "file_path": "src/Var.h", "rank": 5, "score": 222427.6177883213 }, { "content": "class RenameFreeVars : public IRMutator {\n\n using IRMutator::visit;\n\n\n\n map<string, string> new_names;\n\n\n\n Expr visit(const Variable *op) override {\n\n if (!op->param.defined() && !op->image.defined()) {\n\n return Variable::make(op->type, get_new_name(op->name));\n\n } else {\n\n return op;\n\n }\n\n }\n\n\n\npublic:\n\n string get_new_name(const string &s) {\n\n map<string, string>::iterator iter = new_names.find(s);\n\n if (iter != new_names.end()) {\n\n return iter->second;\n\n } else {\n\n string new_name = s + \"$_\";\n\n new_names[s] = new_name;\n\n return new_name;\n\n }\n\n }\n\n};\n\n\n\n/** Substitute in boolean expressions. */\n", "file_path": "src/ParallelRVar.cpp", "rank": 6, "score": 219533.5613506494 }, { "content": "class CanonicalizeGPUVars : public IRMutator {\n\n map<string, string> gpu_vars;\n\n\n\n using IRMutator::visit;\n\n\n\n string gpu_name(vector<string> v, const string &new_var) {\n\n v.push_back(new_var);\n\n\n\n std::ostringstream stream;\n\n for (size_t i = 0; i < v.size(); ++i) {\n\n stream << v[i];\n\n if (i != v.size() - 1) {\n\n stream << \".\";\n\n }\n\n }\n\n return stream.str();\n\n }\n\n\n\n string find_replacement(const string &suffix, const string &name) {\n\n vector<string> v = split_string(name, suffix);\n", "file_path": "src/CanonicalizeGPUVars.cpp", "rank": 7, "score": 219533.56135064943 }, { "content": " // Track the set of variables used by the inner loop\n\n class CollectVars : public IRVisitor {\n\n using IRVisitor::visit;\n\n void visit(const Variable *op) override {\n\n vars.insert(op->name);\n\n }\n\n\n\n public:\n\n set<string> vars;\n\n } vars;\n\n new_stmt.accept(&vars);\n\n\n\n // Now consider substituting back in each use\n\n const Call *call = dummy_call.as<Call>();\n\n internal_assert(call);\n\n bool converged;\n\n do {\n\n converged = true;\n\n for (size_t i = 0; i < exprs.size(); i++) {\n\n if (!exprs[i].defined()) continue;\n\n Expr e = call->args[i];\n", "file_path": "src/LICM.cpp", "rank": 8, "score": 217642.82419723447 }, { "content": " class CountVars : public IRVisitor {\n\n using IRVisitor::visit;\n\n\n\n void visit(const Variable *var) override {\n\n count++;\n\n }\n\n\n\n public:\n\n int count;\n\n CountVars()\n\n : count(0) {\n\n }\n\n };\n\n\n\n // We get better simplification if we directly substitute mins\n\n // and maxes in, but this can also cause combinatorial code\n\n // explosion. Here we manage this by only substituting in\n\n // reasonably-sized expressions. We determine the size by\n\n // counting the number of var nodes.\n\n bool is_small_enough_to_substitute(const Expr &e) {\n", "file_path": "src/Bounds.cpp", "rank": 9, "score": 217636.17074628096 }, { "content": "// Collect all variables referenced in an expr or statement\n\n// (excluding 'skipped_var')\n\nclass CollectVars : public IRGraphVisitor {\n\npublic:\n\n string skipped_var;\n\n set<string> vars;\n\n\n\n CollectVars(const string &v)\n\n : skipped_var(v) {\n\n }\n\n\n\nprivate:\n\n using IRGraphVisitor::visit;\n\n\n\n void visit(const Variable *op) override {\n\n if (op->name != skipped_var) {\n\n vars.insert(op->name);\n\n }\n\n }\n\n};\n\n\n", "file_path": "src/Bounds.cpp", "rank": 10, "score": 212513.37537118103 }, { "content": "class IsUsedInStmt : public IRVisitor {\n\n const string &func;\n\n\n\n using IRVisitor::visit;\n\n\n\n void visit(const Call *op) override {\n\n IRVisitor::visit(op);\n\n if (op->name == func) result = true;\n\n }\n\n\n\n // A reference to the function's buffers counts as a use\n\n void visit(const Variable *op) override {\n\n if (op->type.is_handle() &&\n\n starts_with(op->name, func + \".\") &&\n\n ends_with(op->name, \".buffer\")) {\n\n result = true;\n\n }\n\n }\n\n\n\npublic:\n", "file_path": "src/ScheduleFunctions.cpp", "rank": 11, "score": 212511.3014991532 }, { "content": " class FindFreeVars : public IRVisitor {\n\n using IRVisitor::visit;\n\n void visit(const Variable *op) override {\n\n if (scope.contains(op->name)) {\n\n result.push_back(op);\n\n }\n\n }\n\n\n\n public:\n\n const Scope<Interval> &scope;\n\n vector<const Variable *> result;\n\n FindFreeVars(const Scope<Interval> &s)\n\n : scope(s) {\n\n }\n\n } finder(scope);\n\n e.accept(&finder);\n\n return finder.result;\n\n }\n\n\n\n void visit(const IfThenElse *op) override {\n", "file_path": "src/Bounds.cpp", "rank": 12, "score": 212506.80544210342 }, { "content": "class FindInnermostVar : public IRVisitor {\n\npublic:\n\n const Scope<int> &vars_depth;\n\n string innermost_var;\n\n\n\n FindInnermostVar(const Scope<int> &vars_depth)\n\n : vars_depth(vars_depth) {\n\n }\n\n\n\nprivate:\n\n using IRVisitor::visit;\n\n int innermost_depth = -1;\n\n\n\n void visit(const Variable *op) override {\n\n if (vars_depth.contains(op->name)) {\n\n int depth = vars_depth.get(op->name);\n\n if (depth > innermost_depth) {\n\n innermost_var = op->name;\n\n innermost_depth = depth;\n\n }\n\n }\n\n }\n\n};\n\n\n", "file_path": "src/Bounds.cpp", "rank": 13, "score": 212506.80544210342 }, { "content": "// Normalize all names in an expr so that expr compares can be done\n\n// without worrying about mere name differences.\n\nclass NormalizeVarNames : public IRMutator {\n\n int counter;\n\n\n\n map<string, string> new_names;\n\n\n\n using IRMutator::visit;\n\n\n\n Expr visit(const Variable *var) override {\n\n map<string, string>::iterator iter = new_names.find(var->name);\n\n if (iter == new_names.end()) {\n\n return var;\n\n } else {\n\n return Variable::make(var->type, iter->second);\n\n }\n\n }\n\n\n\n Expr visit(const Let *let) override {\n\n string new_name = \"t\" + std::to_string(counter++);\n\n new_names[let->name] = new_name;\n\n Expr value = mutate(let->value);\n", "file_path": "src/CSE.cpp", "rank": 14, "score": 212506.80544210342 }, { "content": "class HalideBlur : public Halide::Generator<HalideBlur> {\n\npublic:\n\n GeneratorParam<BlurGPUSchedule> schedule{\n\n \"schedule\",\n\n BlurGPUSchedule::SlideVectorize,\n\n blurGPUScheduleEnumMap()};\n\n GeneratorParam<int> tile_x{\"tile_x\", 32}; // X tile.\n\n GeneratorParam<int> tile_y{\"tile_y\", 8}; // Y tile.\n\n\n\n Input<Buffer<uint16_t>> input{\"input\", 2};\n\n Output<Buffer<uint16_t>> blur_y{\"blur_y\", 2};\n\n\n\n void generate() {\n\n Func blur_x(\"blur_x\");\n\n Var x(\"x\"), y(\"y\"), xi(\"xi\"), yi(\"yi\");\n\n\n\n // The algorithm\n\n blur_x(x, y) = (input(x, y) + input(x + 1, y) + input(x + 2, y)) / 3;\n\n blur_y(x, y) = (blur_x(x, y) + blur_x(x, y + 1) + blur_x(x, y + 2)) / 3;\n\n\n", "file_path": "apps/blur/halide_blur_generator.cpp", "rank": 15, "score": 211646.67451060135 }, { "content": "class FuncT : public Halide::Func {\n\npublic:\n\n typedef Halide::Var Var;\n\n typedef Halide::Expr Expr;\n\n typedef Halide::Func Func;\n\n\n\n explicit FuncT(const std::string &name)\n\n : Func(name) {\n\n }\n\n FuncT() {\n\n }\n\n explicit FuncT(Expr e)\n\n : Func(e) {\n\n }\n\n explicit FuncT(Func f)\n\n : Func(f) {\n\n }\n\n explicit FuncT(Halide::Internal::Function f)\n\n : Func(f) {\n\n }\n", "file_path": "apps/fft/funct.h", "rank": 16, "score": 209728.78720808486 }, { "content": "class Var;\n\n\n\n/** An enum to specify calling convention for extern stages. */\n", "file_path": "src/Function.h", "rank": 17, "score": 208844.8848442807 }, { "content": "// Visitor and helper function to test if a piece of IR uses an extern image.\n\nclass UsesExternImage : public IRVisitor {\n\n using IRVisitor::visit;\n\n\n\n void visit(const Call *c) override {\n\n if (c->call_type == Call::Image) {\n\n result = true;\n\n } else {\n\n IRVisitor::visit(c);\n\n }\n\n }\n\n\n\npublic:\n\n UsesExternImage()\n\n : result(false) {\n\n }\n\n bool result;\n\n};\n\n\n\ninline bool uses_extern_image(const Stmt &s) {\n\n UsesExternImage uses;\n\n s.accept(&uses);\n\n return uses.result;\n\n}\n\n\n", "file_path": "src/SplitTuples.cpp", "rank": 18, "score": 207720.31769134742 }, { "content": "class StmtUsesFunc : public IRVisitor {\n\n using IRVisitor::visit;\n\n const string &func;\n\n void visit(const Call *op) override {\n\n if (op->name == func) {\n\n result = true;\n\n }\n\n IRVisitor::visit(op);\n\n }\n\n void visit(const Variable *op) override {\n\n if (op->type.is_handle() &&\n\n starts_with(op->name, func + \".\") &&\n\n ends_with(op->name, \".buffer\")) {\n\n result = true;\n\n }\n\n IRVisitor::visit(op);\n\n }\n\n\n\npublic:\n\n bool result = false;\n\n explicit StmtUsesFunc(const string &f)\n\n : func(f) {\n\n }\n\n};\n\n\n", "file_path": "src/ScheduleFunctions.cpp", "rank": 19, "score": 207713.86741845825 }, { "content": "class SimplifyUsingFact : public IRMutator {\n\npublic:\n\n using IRMutator::mutate;\n\n\n\n Expr mutate(const Expr &e) override {\n\n if (e.type().is_bool()) {\n\n if (equal(fact, e) ||\n\n can_prove(!fact || e)) {\n\n // fact implies e\n\n return const_true();\n\n }\n\n if (equal(fact, !e) ||\n\n equal(!fact, e) ||\n\n can_prove(!fact || !e)) {\n\n // fact implies !e\n\n return const_false();\n\n }\n\n }\n\n return IRMutator::mutate(e);\n\n }\n", "file_path": "src/SimplifySpecializations.cpp", "rank": 20, "score": 207713.86741845825 }, { "content": "class ComputeUseCounts : public IRGraphVisitor {\n\n GVN &gvn;\n\n bool lift_all;\n\n\n\npublic:\n\n ComputeUseCounts(GVN &g, bool l)\n\n : gvn(g), lift_all(l) {\n\n }\n\n\n\n using IRGraphVisitor::include;\n\n using IRGraphVisitor::visit;\n\n\n\n void include(const Expr &e) override {\n\n // If it's not the sort of thing we want to extract as a let,\n\n // just use the generic visitor to increment use counts for\n\n // the children.\n\n debug(4) << \"Include: \" << e\n\n << \"; should extract: \" << should_extract(e, lift_all) << \"\\n\";\n\n if (!should_extract(e, lift_all)) {\n\n e.accept(this);\n", "file_path": "src/CSE.cpp", "rank": 21, "score": 207713.86741845825 }, { "content": "class FindLastUse : public IRVisitor {\n\npublic:\n\n string func;\n\n Stmt last_use;\n\n\n\n FindLastUse(string s)\n\n : func(std::move(s)) {\n\n }\n\n\n\nprivate:\n\n bool in_loop = false;\n\n Stmt containing_stmt;\n\n\n\n using IRVisitor::visit;\n\n\n\n void visit(const For *loop) override {\n\n loop->min.accept(this);\n\n loop->extent.accept(this);\n\n ScopedValue<bool> old_in_loop(in_loop, true);\n\n loop->body.accept(this);\n", "file_path": "src/EarlyFree.cpp", "rank": 22, "score": 207713.86741845825 }, { "content": "class SimplifyUsingBounds : public IRMutator {\n\n struct ContainingLoop {\n\n string var;\n\n Interval i;\n\n };\n\n vector<ContainingLoop> containing_loops;\n\n\n\n using IRMutator::visit;\n\n\n\n // Can we prove a condition over the non-rectangular domain of the for loops we're in?\n\n bool provably_true_over_domain(Expr test) {\n\n debug(3) << \"Attempting to prove: \" << test << \"\\n\";\n\n for (size_t i = containing_loops.size(); i > 0; i--) {\n\n // Because the domain is potentially non-rectangular, we\n\n // need to take each variable one-by-one, simplifying in\n\n // between to allow for cancellations of the bounds of\n\n // inner loops with outer loop variables.\n\n auto loop = containing_loops[i - 1];\n\n if (is_const(test)) {\n\n break;\n", "file_path": "src/TrimNoOps.cpp", "rank": 23, "score": 207713.86741845825 }, { "content": "class PrintUsesOfFunc : public IRVisitor {\n\n using IRVisitor::visit;\n\n\n\n int indent = 1;\n\n string func, caller;\n\n bool last_print_was_ellipsis = false;\n\n std::ostream &stream;\n\n\n\n Indentation get_indent() const {\n\n return Indentation{indent};\n\n }\n\n\n\n void visit(const For *op) override {\n\n if (ends_with(op->name, Var::outermost().name()) ||\n\n ends_with(op->name, LoopLevel::root().lock().to_string())) {\n\n IRVisitor::visit(op);\n\n } else {\n\n\n\n int old_indent = indent;\n\n\n", "file_path": "src/ScheduleFunctions.cpp", "rank": 24, "score": 207713.86741845825 }, { "content": "class CheckForFreeVars : public IRGraphVisitor {\n\npublic:\n\n string offending_var;\n\n\n\nprotected:\n\n using IRGraphVisitor::visit;\n\n void visit(const Variable *var) override {\n\n if (!var->param.defined() && !var->image.defined()) {\n\n offending_var = var->name;\n\n }\n\n }\n\n};\n\n} // namespace Internal\n\n\n\nStage Stage::specialize(const Expr &condition) {\n\n user_assert(condition.type().is_bool()) << \"Argument passed to specialize must be of type bool\\n\";\n\n\n\n // The condition may not depend on Vars or RVars\n\n Internal::CheckForFreeVars check;\n\n condition.accept(&check);\n", "file_path": "src/Func.cpp", "rank": 25, "score": 207709.51689949905 }, { "content": "class BoundsOfInnerVar : public IRVisitor {\n\npublic:\n\n Interval result;\n\n BoundsOfInnerVar(const string &v)\n\n : var(v) {\n\n }\n\n\n\nprivate:\n\n string var;\n\n Scope<Interval> scope;\n\n\n\n using IRVisitor::visit;\n\n\n\n void visit(const LetStmt *op) override {\n\n Interval in = bounds_of_expr_in_scope(op->value, scope);\n\n if (op->name == var) {\n\n result = in;\n\n } else {\n\n ScopedBinding<Interval> p(scope, op->name, in);\n\n op->body.accept(this);\n", "file_path": "src/BoundsInference.cpp", "rank": 26, "score": 207709.51689949908 }, { "content": "// Does an expression depend on a particular variable?\n\nclass ExprDependsOnVar : public IRVisitor {\n\n using IRVisitor::visit;\n\n\n\n void visit(const Variable *op) override {\n\n if (op->name == var) result = true;\n\n }\n\n\n\n void visit(const Let *op) override {\n\n op->value.accept(this);\n\n // The name might be hidden within the body of the let, in\n\n // which case there's no point descending.\n\n if (op->name != var) {\n\n op->body.accept(this);\n\n }\n\n }\n\n\n\npublic:\n\n bool result;\n\n string var;\n\n\n", "file_path": "src/SlidingWindow.cpp", "rank": 27, "score": 207709.51689949908 }, { "content": "class FindLoads : public IRVisitor {\n\n using IRVisitor::visit;\n\n\n\n const string &func;\n\n\n\n void visit(const Call *op) override {\n\n if (op->name == func && op->call_type == Call::Halide) {\n\n loads.push_back(op->args);\n\n }\n\n IRVisitor::visit(op);\n\n }\n\n\n\n void visit(const Let *op) override {\n\n IRVisitor::visit(op);\n\n for (size_t i = 0; i < loads.size(); i++) {\n\n for (size_t j = 0; j < loads[i].size(); j++) {\n\n loads[i][j] = graph_substitute(op->name, op->value, loads[i][j]);\n\n }\n\n }\n\n }\n\n\n\npublic:\n\n FindLoads(const string &f)\n\n : func(f) {\n\n }\n\n\n\n vector<vector<Expr>> loads;\n\n};\n\n\n\n/** Rename all free variables to unique new names. */\n", "file_path": "src/ParallelRVar.cpp", "rank": 28, "score": 207709.51689949908 }, { "content": "class FindFreeVars : public IRMutator {\n\npublic:\n\n vector<Var> free_vars;\n\n vector<Expr> call_args;\n\n RDom rdom;\n\n\n\n FindFreeVars(const RDom &r, const string &n)\n\n : rdom(r), explicit_rdom(r.defined()), name(n) {\n\n }\n\n\n\nprivate:\n\n bool explicit_rdom;\n\n const string &name;\n\n\n\n Scope<> internal;\n\n\n\n using IRMutator::visit;\n\n\n\n Expr visit(const Let *op) override {\n\n Expr value = mutate(op->value);\n", "file_path": "src/InlineReductions.cpp", "rank": 29, "score": 207709.51689949905 }, { "content": "class ExprUsesInvalidBuffers : public IRVisitor {\n\n using IRVisitor::visit;\n\n\n\n const Scope<> &invalid_buffers;\n\n\n\n void visit(const Load *op) override {\n\n if (invalid_buffers.contains(op->name)) {\n\n invalid = true;\n\n } else {\n\n IRVisitor::visit(op);\n\n }\n\n }\n\n\n\npublic:\n\n ExprUsesInvalidBuffers(const Scope<> &buffers)\n\n : invalid_buffers(buffers), invalid(false) {\n\n }\n\n bool invalid;\n\n};\n\n\n\n/** Check if any references to buffers in an expression is invalid. */\n\nbool expr_uses_invalid_buffers(const Expr &e, const Scope<> &invalid_buffers) {\n\n ExprUsesInvalidBuffers uses(invalid_buffers);\n\n e.accept(&uses);\n\n return uses.invalid;\n\n}\n\n\n", "file_path": "src/PartitionLoops.cpp", "rank": 30, "score": 203217.28223770682 }, { "content": "class FindFreeVars : public IRVisitor {\n\n\n\n using IRVisitor::visit;\n\n\n\n Scope<> scope;\n\n\n\n void visit(const Variable *op) override {\n\n if (!scope.contains(op->name)) {\n\n free_vars.push(op->name, op->name);\n\n }\n\n }\n\n\n\n void visit(const Let *op) override {\n\n op->value.accept(this);\n\n {\n\n ScopedBinding<> bind(scope, op->name);\n\n op->body.accept(this);\n\n }\n\n }\n\n\n", "file_path": "src/UniquifyVariableNames.cpp", "rank": 31, "score": 203213.0681300897 }, { "content": " class GatherRVars : public IRGraphVisitor {\n\n public:\n\n using IRGraphVisitor::visit;\n\n\n\n void visit(const Variable *op) override {\n\n if (op->reduction_domain.defined()) {\n\n const vector<ReductionVariable> &domain =\n\n op->reduction_domain.domain();\n\n for (int i = 0; i < (int)domain.size(); i++) {\n\n const ReductionVariable &rv = domain[i];\n\n if (rv.var == op->name) {\n\n rvar_map[op->name] = ReductionVariableInfo{\n\n rv.min, rv.extent, i, op->reduction_domain, op->name};\n\n return;\n\n }\n\n }\n\n internal_error << \"Unknown reduction variable encountered\";\n\n }\n\n }\n\n\n", "file_path": "src/DerivativeUtils.cpp", "rank": 32, "score": 203213.0681300897 }, { "content": "class SubstituteInBooleanLets : public IRMutator {\n\n using IRMutator::visit;\n\n\n\n Expr visit(const Let *op) override {\n\n if (op->value.type() == Bool()) {\n\n return substitute(op->name, mutate(op->value), mutate(op->body));\n\n } else {\n\n return IRMutator::visit(op);\n\n }\n\n }\n\n};\n\n} // namespace\n\n\n\nbool can_parallelize_rvar(const string &v,\n\n const string &f,\n\n const Definition &r) {\n\n const vector<Expr> &values = r.values();\n\n const vector<Expr> &args = r.args();\n\n const vector<ReductionVariable> &rvars = r.schedule().rvars();\n\n\n", "file_path": "src/ParallelRVar.cpp", "rank": 33, "score": 203213.0681300897 }, { "content": "// This visitor produces a set of variable names that are tagged with\n\n// \".varying\".\n\nclass FindVaryingAttributeVars : public IRVisitor {\n\npublic:\n\n using IRVisitor::visit;\n\n\n\n void visit(const Variable *op) override {\n\n if (ends_with(op->name, \".varying\")) {\n\n variables.insert(op->name);\n\n }\n\n }\n\n\n\n std::set<std::string> variables;\n\n};\n\n\n\n// Remove varying attributes from the varying's map if they do not appear in the\n\n// loop_stmt because they were simplified away.\n\nvoid prune_varying_attributes(const Stmt &loop_stmt, std::map<std::string, Expr> &varying) {\n\n FindVaryingAttributeVars find;\n\n loop_stmt.accept(&find);\n\n\n\n std::vector<std::string> remove_list;\n", "file_path": "src/VaryingAttributes.cpp", "rank": 34, "score": 203213.0681300897 }, { "content": "class SubstituteVarEstimates : public IRMutator {\n\n using IRMutator::visit;\n\n\n\n Expr visit(const Variable *var) override {\n\n if (var->param.defined() && var->param.is_buffer()) {\n\n // This is a var associated with an ImageParam object. This\n\n // should be something of the form XXX.min.[dim_index] or\n\n // XXX.extent.[dim_index]\n\n std::vector<std::string> v = split_string(var->name, \".\");\n\n user_assert(v.size() >= 3);\n\n int d = string_to_int(v[v.size() - 1]);\n\n if (v[v.size() - 2] == \"min\") {\n\n Expr est = var->param.min_constraint_estimate(d);\n\n return est.defined() ? est : var;\n\n } else {\n\n internal_assert(v[v.size() - 2] == \"extent\");\n\n Expr est = var->param.extent_constraint_estimate(d);\n\n return est.defined() ? est : var;\n\n }\n\n } else if (var->param.defined() && !var->param.is_buffer() &&\n", "file_path": "src/AutoScheduleUtils.cpp", "rank": 35, "score": 203213.0681300897 }, { "content": "// Substitute the gpu loop variables inwards to make future passes simpler\n\nclass SubstituteInLaneVar : public IRMutator {\n\n using IRMutator::visit;\n\n\n\n Scope<int> gpu_vars;\n\n string lane_var;\n\n\n\n template<typename LetStmtOrLet>\n\n auto visit_let(const LetStmtOrLet *op) -> decltype(op->body) {\n\n if (!lane_var.empty() && expr_uses_var(op->value, lane_var) && is_pure(op->value)) {\n\n auto solved = solve_expression(simplify(op->value), lane_var);\n\n if (solved.fully_solved) {\n\n return mutate(substitute(op->name, solved.result, op->body));\n\n } else {\n\n return IRMutator::visit(op);\n\n }\n\n } else {\n\n return IRMutator::visit(op);\n\n }\n\n }\n\n\n", "file_path": "src/LowerWarpShuffles.cpp", "rank": 36, "score": 203213.0681300897 }, { "content": "class HalideBlurGLSL : public Halide::Generator<HalideBlurGLSL> {\n\npublic:\n\n Input<Buffer<uint8_t>> input8{\"input8\", 3};\n\n Output<Buffer<uint8_t>> blur_filter{\"blur_filter\", 3};\n\n void generate() {\n\n assert(get_target().has_feature(Target::OpenGL));\n\n\n\n Func blur_x(\"blur_x\"), blur_y(\"blur_y\");\n\n Var x(\"x\"), y(\"y\"), c(\"c\");\n\n\n\n // The algorithm\n\n Func input;\n\n input(x, y, c) = cast<float>(input8(clamp(x, input8.dim(0).min(), input8.dim(0).max()),\n\n clamp(y, input8.dim(1).min(), input8.dim(1).max()), c)) /\n\n 255.f;\n\n blur_x(x, y, c) = (input(x, y, c) + input(x + 1, y, c) + input(x + 2, y, c)) / 3;\n\n blur_y(x, y, c) = (blur_x(x, y, c) + blur_x(x, y + 1, c) + blur_x(x, y + 2, c)) / 3;\n\n blur_filter(x, y, c) = cast<uint8_t>(blur_y(x, y, c) * 255.f);\n\n\n\n // Schedule for GLSL\n\n input8.dim(2).set_bounds(0, 3);\n\n blur_filter.bound(c, 0, 3);\n\n blur_filter.glsl(x, y, c);\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(HalideBlurGLSL, halide_blur_glsl)\n", "file_path": "apps/glsl/halide_blur_glsl_generator.cpp", "rank": 37, "score": 201939.35463274608 }, { "content": "class RemoveUnnecessaryMutexUse : public IRMutator {\n\npublic:\n\n set<string> remove_mutex_lock_names;\n\n\n\nprotected:\n\n using IRMutator::visit;\n\n\n\n Stmt visit(const Atomic *op) override {\n\n // Collect the names of all Store nodes inside.\n\n CollectProducerStoreNames collector(op->producer_name);\n\n op->body.accept(&collector);\n\n // Search for let bindings that access the producers.\n\n FindAtomicLetBindings finder(collector.store_names);\n\n op->body.accept(&finder);\n\n if (finder.found) {\n\n // Can't remove mutex lock. Leave the Stmt as is.\n\n return IRMutator::visit(op);\n\n } else {\n\n remove_mutex_lock_names.insert(op->mutex_name);\n\n Stmt body = mutate(op->body);\n\n return Atomic::make(op->producer_name,\n\n string(),\n\n std::move(body));\n\n }\n\n }\n\n};\n\n\n\n/** Find Store inside an Atomic that matches the provided store_names. */\n", "file_path": "src/AddAtomicMutex.cpp", "rank": 38, "score": 198994.10679507675 }, { "content": "class ReplaceStoreIndexWithVar : public IRMutator {\n\npublic:\n\n ReplaceStoreIndexWithVar(const std::string &producer_name, Expr var)\n\n : producer_name(producer_name), var(std::move(var)) {\n\n }\n\n\n\nprotected:\n\n using IRMutator::visit;\n\n\n\n Stmt visit(const Store *op) override {\n\n Expr predicate = mutate(op->predicate);\n\n Expr value = mutate(op->value);\n\n return Store::make(op->name,\n\n std::move(value),\n\n var,\n\n op->param,\n\n std::move(predicate),\n\n op->alignment);\n\n }\n\n\n\n const std::string &producer_name;\n\n Expr var;\n\n};\n\n\n\n/** Add mutex allocation & lock & unlock if required. */\n", "file_path": "src/AddAtomicMutex.cpp", "rank": 39, "score": 198990.02080446554 }, { "content": "class CountGPUBlocksThreads : public IRVisitor {\n\n string prefix; // Producer name + stage\n\n\n\n using IRVisitor::visit;\n\n\n\n void visit(const For *op) override {\n\n if (starts_with(op->name, prefix)) {\n\n if (op->for_type == ForType::GPUBlock) {\n\n nblocks++;\n\n } else if (op->for_type == ForType::GPUThread) {\n\n nthreads++;\n\n } else if (op->for_type == ForType::GPULane) {\n\n nlanes++;\n\n }\n\n }\n\n IRVisitor::visit(op);\n\n }\n\n\n\n void visit(const IfThenElse *op) override {\n\n op->condition.accept(this);\n", "file_path": "src/CanonicalizeGPUVars.cpp", "rank": 40, "score": 198990.02080446554 }, { "content": "// Expand LLVM's search for symbols to include code contained in a set of JITModule.\n\nclass HalideJITMemoryManager : public SectionMemoryManager {\n\n std::vector<JITModule> modules;\n\n std::vector<std::pair<uint8_t *, size_t>> code_pages;\n\n\n\npublic:\n\n HalideJITMemoryManager(const std::vector<JITModule> &modules)\n\n : modules(modules) {\n\n }\n\n\n\n uint64_t getSymbolAddress(const std::string &name) override {\n\n for (size_t i = 0; i < modules.size(); i++) {\n\n const JITModule &m = modules[i];\n\n std::map<std::string, JITModule::Symbol>::const_iterator iter = m.exports().find(name);\n\n if (iter == m.exports().end() && starts_with(name, \"_\")) {\n\n iter = m.exports().find(name.substr(1));\n\n }\n\n if (iter != m.exports().end()) {\n\n return (uint64_t)iter->second.address;\n\n }\n\n }\n", "file_path": "src/JITModule.cpp", "rank": 41, "score": 198019.96594657146 }, { "content": "class CountImplicitVars : public Internal::IRGraphVisitor {\n\npublic:\n\n int count;\n\n\n\n CountImplicitVars(const vector<Expr> &e)\n\n : count(0) {\n\n for (size_t i = 0; i < e.size(); i++) {\n\n e[i].accept(this);\n\n }\n\n }\n\n\n\n using IRGraphVisitor::visit;\n\n\n\n void visit(const Variable *v) override {\n\n int index = Var::implicit_index(v->name);\n\n if (index != -1) {\n\n if (index >= count) count = index + 1;\n\n }\n\n }\n\n};\n", "file_path": "src/Func.cpp", "rank": 42, "score": 196417.41031164397 }, { "content": "// Find the last use of a given buffer, which will used later for injecting\n\n// device free calls.\n\nclass FindLastUse : public IRVisitor {\n\npublic:\n\n Stmt last_use;\n\n\n\n FindLastUse(const string &b)\n\n : buffer(b) {\n\n }\n\n\n\nprivate:\n\n string buffer;\n\n\n\n using IRVisitor::visit;\n\n\n\n void check_and_record_last_use(const Stmt &s) {\n\n // Sniff what happens to the buffer inside the stmt\n\n FindBufferUsage finder(buffer, DeviceAPI::Host);\n\n s.accept(&finder);\n\n\n\n if (!finder.devices_touched.empty() ||\n\n !finder.devices_touched_by_extern.empty()) {\n", "file_path": "src/InjectHostDevBufferCopies.cpp", "rank": 43, "score": 195027.6002826165 }, { "content": " class FreeAfterLastUse : public IRMutator {\n\n Stmt last_use;\n\n Stmt free_stmt;\n\n\n\n public:\n\n bool success = false;\n\n using IRMutator::mutate;\n\n\n\n Stmt mutate(const Stmt &s) override {\n\n if (s.same_as(last_use)) {\n\n internal_assert(!success);\n\n success = true;\n\n return Block::make(last_use, free_stmt);\n\n } else {\n\n return IRMutator::mutate(s);\n\n }\n\n }\n\n\n\n FreeAfterLastUse(Stmt s, Stmt f)\n\n : last_use(std::move(s)), free_stmt(std::move(f)) {\n", "file_path": "src/InjectHostDevBufferCopies.cpp", "rank": 44, "score": 195020.1402902418 }, { "content": "// Note the inheritance using the Curiously Recurring Template Pattern\n\nclass Example : public Halide::Generator<Example> {\n\npublic:\n\n // GeneratorParamss, Inputs, and Outputs are (by convention)\n\n // always public and always declared at the top of the Generator,\n\n // in the order\n\n // GeneratorParam(s)\n\n // Input(s)\n\n // Output(s)\n\n //\n\n // Note that the Inputs will appear in the C function\n\n // call in the order they are declared. (GeneratorParams\n\n // are always referenced by name, not position, so their order is irrelevant.)\n\n //\n\n // All Input variants declared as Generator members must have explicit\n\n // names, and all such names must match the regex [A-Za-z_][A-Za-z_0-9]*\n\n // (i.e., essentially a C/C++ variable name). By convention, the name should\n\n // match the member-variable name.\n\n\n\n // GeneratorParams can be float or ints: {default} or {default, min, max}\n\n // (Note that if you want to specify min and max, you must specify both.)\n", "file_path": "test/generator/example_generator.cpp", "rank": 45, "score": 194384.04827495018 }, { "content": "// We will define a generator that brightens an RGB image.\n\nclass Brighten : public Halide::Generator<Brighten> {\n\npublic:\n\n // We declare a three-dimensional input image. The first two\n\n // dimensions will be x, and y, and the third dimension will be\n\n // the color channel.\n\n Input<Buffer<uint8_t>> input{\"input\", 3};\n\n\n", "file_path": "tutorial/lesson_16_rgb_generate.cpp", "rank": 46, "score": 194377.46395744823 }, { "content": "class haar_x : public Halide::Generator<haar_x> {\n\npublic:\n\n Input<Buffer<float>> in_{\"in\", 2};\n\n Output<Buffer<float>> out_{\"out\", 3};\n\n\n\n void generate() {\n\n Func in = Halide::BoundaryConditions::repeat_edge(in_);\n\n\n\n out_(x, y, c) = mux(c,\n\n {(in(2 * x, y) + in(2 * x + 1, y)),\n\n (in(2 * x, y) - in(2 * x + 1, y))}) /\n\n 2;\n\n out_.unroll(c, 2);\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(haar_x, haar_x)\n", "file_path": "apps/wavelet/haar_x_generator.cpp", "rank": 47, "score": 194377.46395744823 }, { "content": "// A trivial 2x2 blur.\n\nclass Blur2x2 : public Halide::Generator<Blur2x2> {\n\npublic:\n\n Input<Buffer<float>> input{\"input\", 3};\n\n Input<int32_t> width{\"width\"};\n\n Input<int32_t> height{\"height\"};\n\n\n\n Output<Buffer<float>> blur{\"blur\", 3};\n\n\n\n void generate() {\n\n // We pass in parameters to tell us where the boundary\n\n // condition kicks in; this allows us to decouple from the size of the\n\n // input tile (if any).\n\n\n\n // (In fact, if we are being used as an extern stage for tiled processing,\n\n // clamping accesses to lie within the input tile using input.min() and\n\n // input.extent() would tell the calling kernel we can cope with any size\n\n // input, so it would always pass us 1x1 tiles.)\n\n\n\n Func input_clamped = Halide::BoundaryConditions::repeat_edge(\n\n input, 0, width, 0, height);\n", "file_path": "test/generator/blur2x2_generator.cpp", "rank": 48, "score": 194377.46395744823 }, { "content": "class Harris : public Halide::Generator<Harris> {\n\npublic:\n\n Input<Buffer<float>> input{\"input\", 3};\n\n Output<Buffer<float>> output{\"output\", 2};\n\n\n\n void generate() {\n\n Var x(\"x\"), y(\"y\"), c(\"c\");\n\n\n\n // Algorithm\n\n Func gray(\"gray\");\n\n gray(x, y) = (0.299f * input(x, y, 0) +\n\n 0.587f * input(x, y, 1) +\n\n 0.114f * input(x, y, 2));\n\n\n\n Func Iy(\"Iy\");\n\n Iy(x, y) = gray(x - 1, y - 1) * (-1.0f / 12) + gray(x - 1, y + 1) * (1.0f / 12) +\n\n gray(x, y - 1) * (-2.0f / 12) + gray(x, y + 1) * (2.0f / 12) +\n\n gray(x + 1, y - 1) * (-1.0f / 12) + gray(x + 1, y + 1) * (1.0f / 12);\n\n\n\n Func Ix(\"Ix\");\n", "file_path": "apps/harris/harris_generator.cpp", "rank": 49, "score": 194377.46395744823 }, { "content": "class Configure : public Halide::Generator<Configure> {\n\npublic:\n\n GeneratorParam<int> num_extra_buffer_inputs{\"num_extra_buffer_inputs\", 3};\n\n\n\n Input<Buffer<int>> input{\"input\", 3};\n\n Input<int> bias{\"bias\"};\n\n\n\n Output<Buffer<int>> output{\"output\", 3};\n\n\n\n void configure() {\n\n configure_calls++;\n\n\n\n // It's fine to examine GeneratorParams in the configure() method.\n\n assert(num_extra_buffer_inputs == 3);\n\n\n\n // Pointers returned by add_input() are managed by the Generator;\n\n // user code must not free them. We can stash them in member variables\n\n // as-is or in containers, like so:\n\n for (int i = 0; i < num_extra_buffer_inputs; ++i) {\n\n auto *extra = add_input<Buffer<>>(\"extra_\" + std::to_string(i), UInt(8), 2);\n", "file_path": "test/generator/configure_generator.cpp", "rank": 50, "score": 194377.46395744823 }, { "content": "class Hist : public Halide::Generator<Hist> {\n\npublic:\n\n Input<Buffer<uint8_t>> input{\"input\", 3};\n\n Output<Buffer<uint8_t>> output{\"output\", 3};\n\n\n\n void generate() {\n\n Var x(\"x\"), y(\"y\"), c(\"c\");\n\n\n\n // Algorithm\n\n Func Y(\"Y\");\n\n Y(x, y) = (0.299f * input(x, y, 0) +\n\n 0.587f * input(x, y, 1) +\n\n 0.114f * input(x, y, 2));\n\n\n\n Func Cr(\"Cr\");\n\n Expr R = input(x, y, 0);\n\n Cr(x, y) = (R - Y(x, y)) * 0.713f + 128;\n\n\n\n Func Cb(\"Cb\");\n\n Expr B = input(x, y, 2);\n", "file_path": "apps/hist/hist_generator.cpp", "rank": 51, "score": 194377.46395744823 }, { "content": "class Interpolate : public Halide::Generator<Interpolate> {\n\npublic:\n\n GeneratorParam<int> levels{\"levels\", 10};\n\n\n\n Input<Buffer<float>> input{\"input\", 3};\n\n Output<Buffer<float>> output{\"output\", 3};\n\n\n\n void generate() {\n\n Var x(\"x\"), y(\"y\"), c(\"c\");\n\n\n\n // Input must have four color channels - rgba\n\n input.dim(2).set_bounds(0, 4);\n\n\n\n auto downsampled = func_vector(\"downsampled\", levels);\n\n auto downx = func_vector(\"downx\", levels);\n\n auto interpolated = func_vector(\"interpolated\", levels);\n\n auto upsampled = func_vector(\"upsampled\", levels);\n\n auto upsampledx = func_vector(\"upsampledx\", levels);\n\n\n\n Func clamped = Halide::BoundaryConditions::repeat_edge(input);\n", "file_path": "apps/interpolate/interpolate_generator.cpp", "rank": 52, "score": 194377.46395744823 }, { "content": "class daubechies_x : public Halide::Generator<daubechies_x> {\n\npublic:\n\n Input<Buffer<float>> in_{\"in\", 2};\n\n Output<Buffer<float>> out_{\"out\", 3};\n\n\n\n void generate() {\n\n Func in = Halide::BoundaryConditions::repeat_edge(in_);\n\n\n\n out_(x, y, c) = mux(c,\n\n {D0 * in(2 * x - 1, y) + D1 * in(2 * x, y) + D2 * in(2 * x + 1, y) + D3 * in(2 * x + 2, y),\n\n D3 * in(2 * x - 1, y) - D2 * in(2 * x, y) + D1 * in(2 * x + 1, y) - D0 * in(2 * x + 2, y)});\n\n out_.unroll(c, 2);\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(daubechies_x, daubechies_x)\n", "file_path": "apps/wavelet/daubechies_x_generator.cpp", "rank": 53, "score": 194377.46395744823 }, { "content": "class Matlab : public Halide::Generator<Matlab> {\n\npublic:\n\n Input<Buffer<float>> input{\"input\", 2};\n\n Input<float> scale{\"scale\"};\n\n Input<bool> negate{\"negate\"};\n\n\n\n Output<Buffer<float>> output{\"output\", 2};\n\n\n\n void generate() {\n\n Var x, y;\n\n output(x, y) = input(x, y) * scale * select(negate, -1.0f, 1.0f);\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(Matlab, matlab)\n", "file_path": "test/generator/matlab_generator.cpp", "rank": 54, "score": 194377.46395744823 }, { "content": "class MSAN : public Halide::Generator<MSAN> {\n\npublic:\n\n Input<Buffer<uint8_t>> input{\"input\", 3};\n\n Output<Buffer<uint8_t>> output{\"output\", 3};\n\n\n\n void generate() {\n\n // Currently the test just exercises Target::MSAN\n\n input_plus_1(x, y, c) = input(x, y, c) + 1;\n\n\n\n // This just makes an exact copy\n\n msan_extern_stage.define_extern(\"msan_extern_stage\", {input_plus_1}, UInt(8), 3, NameMangling::C);\n\n\n\n RDom r(0, 4);\n\n output(x, y, c) = sum(msan_extern_stage(r, y, c));\n\n\n\n // Add two update phases to be sure annotation happens post-update\n\n output(r, y, c) += cast<uint8_t>(1);\n\n output(x, r, c) += cast<uint8_t>(2);\n\n }\n\n\n", "file_path": "test/generator/msan_generator.cpp", "rank": 55, "score": 194377.46395744823 }, { "content": "class GpuOnly : public Halide::Generator<GpuOnly> {\n\npublic:\n\n Input<Buffer<int32_t>> input{\"input\", 2};\n\n\n\n Output<Buffer<int32_t>> output{\"output\", 2};\n\n\n\n void generate() {\n\n Var x(\"x\"), y(\"y\");\n\n\n\n // Create a simple pipeline that scales pixel values by 2.\n\n output(x, y) = input(x, y) * 2;\n\n\n\n Target target = get_target();\n\n if (target.has_gpu_feature()) {\n\n Var xo, yo, xi, yi;\n\n output.gpu_tile(x, y, xo, yo, xi, yi, 16, 16);\n\n }\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(GpuOnly, gpu_only)\n", "file_path": "test/generator/gpu_only_generator.cpp", "rank": 56, "score": 194377.46395744823 }, { "content": "class Alias : public Halide::Generator<Alias> {\n\npublic:\n\n GeneratorParam<int32_t> offset{\"offset\", 0};\n\n Input<Buffer<int32_t>> input{\"input\", 1};\n\n Output<Buffer<int32_t>> output{\"output\", 1};\n\n\n\n void generate() {\n\n Var x;\n\n output(x) = input(x) + offset;\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(Alias, alias)\n\nHALIDE_REGISTER_GENERATOR_ALIAS(alias_with_offset_42, alias, {{\"offset\", \"42\"}})\n", "file_path": "test/generator/alias_generator.cpp", "rank": 57, "score": 194377.46395744823 }, { "content": "class Unsharp : public Halide::Generator<Unsharp> {\n\npublic:\n\n GeneratorParam<float> sigma{\"sigma\", 1.5f};\n\n\n\n Input<Buffer<float>> input{\"input\", 3};\n\n Output<Buffer<float>> output{\"output\", 3};\n\n\n\n void generate() {\n\n Var x(\"x\"), y(\"y\"), c(\"c\");\n\n\n\n const float kPi = 3.14159265358979310000f;\n\n\n\n Func kernel(\"kernel\");\n\n kernel(x) = exp(-x * x / (2 * sigma * sigma)) / (sqrtf(2 * kPi) * sigma);\n\n\n\n Func input_bounded = Halide::BoundaryConditions::repeat_edge(input);\n\n\n\n Func gray(\"gray\");\n\n gray(x, y) = (0.299f * input_bounded(x, y, 0) +\n\n 0.587f * input_bounded(x, y, 1) +\n", "file_path": "apps/unsharp/unsharp_generator.cpp", "rank": 58, "score": 194377.46395744823 }, { "content": "class Pipeline : public Halide::Generator<Pipeline> {\n\npublic:\n\n Input<Buffer<uint16_t>> input{\"input\", 2};\n\n Output<Buffer<uint16_t>> output{\"output\", 2};\n\n\n\n void generate() {\n\n Var x, y;\n\n\n\n Func f, h;\n\n f(x, y) = (input(clamp(x + 2, 0, input.dim(0).extent() - 1), clamp(y - 2, 0, input.dim(1).extent() - 1)) * 17) / 13;\n\n h.define_extern(\"an_extern_stage\", {f}, Int(16), 0, NameMangling::C);\n\n output(x, y) = cast<uint16_t>(max(0, f(y, x) + f(x, y) + an_extern_func(x, y) + h()));\n\n\n\n f.compute_root().vectorize(x, 8);\n\n h.compute_root();\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(Pipeline, pipeline)\n", "file_path": "apps/c_backend/pipeline_generator.cpp", "rank": 59, "score": 194377.46395744823 }, { "content": "class Pyramid : public Halide::Generator<Pyramid> {\n\npublic:\n\n GeneratorParam<int> levels{\"levels\", 1}; // deliberately wrong value, must be overridden to 10\n\n\n\n Input<Func> input{\"input\", Float(32), 2};\n\n Output<Func[]> pyramid{\"pyramid\", Float(32), 2};\n\n\n\n void generate() {\n\n Var x{\"x\"}, y{\"y\"};\n\n\n\n pyramid.resize(levels);\n\n pyramid[0](x, y) = input(x, y);\n\n for (size_t i = 1; i < pyramid.size(); i++) {\n\n Func p = pyramid[i - 1];\n\n pyramid[i](x, y) = (p(2 * x, 2 * y) +\n\n p(2 * x + 1, 2 * y) +\n\n p(2 * x, 2 * y + 1) +\n\n p(2 * x + 1, 2 * y + 1)) /\n\n 4;\n\n }\n", "file_path": "test/generator/pyramid_generator.cpp", "rank": 60, "score": 194377.46395744823 }, { "content": "class Multitarget : public Halide::Generator<Multitarget> {\n\npublic:\n\n Output<Buffer<uint32_t>> output{\"output\", 2};\n\n\n\n void generate() {\n\n Var x, y;\n\n // Note that 'NoBoundsQuery' is essentially a somewhat-arbitrary placeholder\n\n // here; we really just want to use a feature flag that doesn't require\n\n // a custom runtime (as does, e.g., Target::Debug).\n\n if (get_target().has_feature(Target::NoBoundsQuery)) {\n\n output(x, y) = cast<uint32_t>((int32_t)0xdeadbeef);\n\n } else {\n\n output(x, y) = cast<uint32_t>((int32_t)0xf00dcafe);\n\n }\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(Multitarget, multitarget)\n", "file_path": "test/generator/multitarget_generator.cpp", "rank": 61, "score": 194377.46395744823 }, { "content": "class Autograd : public Halide::Generator<Autograd> {\n\npublic:\n\n Input<Buffer<float>> input_a{\"input_a\", 1};\n\n Input<Buffer<float>> input_b{\"input_b\", 1};\n\n Input<Buffer<float>> input_c{\"input_c\", 1};\n\n\n\n // Test a case for which won't be able to find a derivative\n\n Input<Buffer<uint8_t>> lut{\"lut\", 1};\n\n Input<Buffer<uint8_t>> lut_indices{\"lut_indices\", 1};\n\n\n\n Output<Buffer<float>> output{\"output\", 1};\n\n Output<Buffer<uint8_t>> output_lut{\"output_lut\", 1};\n\n\n\n void generate() {\n\n lut.dim(0).set_bounds(0, 256);\n\n\n\n Var x;\n\n output(x) = 33 * pow(input_a(x), 3) +\n\n 22 * pow(input_b(x), 2) +\n\n 11 * input_c(x) +\n", "file_path": "test/generator/autograd_generator.cpp", "rank": 62, "score": 194377.46395744823 }, { "content": "class Resize : public Halide::Generator<Resize> {\n\npublic:\n\n GeneratorParam<InterpolationType> interpolation_type{\"interpolation_type\", Cubic, {{\"box\", Box}, {\"linear\", Linear}, {\"cubic\", Cubic}, {\"lanczos\", Lanczos}}};\n\n\n\n // If we statically know whether we're upsampling or downsampling,\n\n // we can generate different pipelines (we want to reorder the\n\n // resample in x and in y).\n\n GeneratorParam<bool> upsample{\"upsample\", false};\n\n\n\n Input<Buffer<>> input{\"input\", 3};\n\n Input<float> scale_factor{\"scale_factor\"};\n\n Output<Buffer<>> output{\"output\", 3};\n\n\n\n // Common Vars\n\n Var x, y, c, k;\n\n\n\n // Intermediate Funcs\n\n Func as_float, clamped, resized_x, resized_y,\n\n unnormalized_kernel_x, unnormalized_kernel_y,\n\n kernel_x, kernel_y,\n", "file_path": "apps/resize/resize_generator.cpp", "rank": 63, "score": 194377.46395744823 }, { "content": "class RgbToYcc : public Halide::Generator<RgbToYcc> {\n\npublic:\n\n Input<Buffer<uint8_t>> input8{\"input8\", 3};\n\n Output<Buffer<uint8_t>> out{\"out\", 3};\n\n void generate() {\n\n assert(get_target().has_feature(Target::OpenGL));\n\n Var x(\"x\"), y(\"y\"), c(\"c\");\n\n\n\n // The algorithm\n\n Func input(\"input\");\n\n input(x, y, c) = cast<float>(input8(x, y, c)) / 255.0f;\n\n\n\n Func Y(\"Y\"), Cb(\"Cb\"), Cr(\"Cr\");\n\n Y(x, y) = 16.f / 255.f + (0.257f * input(x, y, 0) +\n\n 0.504f * input(x, y, 1) +\n\n 0.098f * input(x, y, 2));\n\n Cb(x, y) = 128.f / 255.f + (0.439f * input(x, y, 0) +\n\n -0.368f * input(x, y, 1) +\n\n -0.071f * input(x, y, 2));\n\n Cr(x, y) = 128.f / 255.f + (-0.148f * input(x, y, 0) +\n", "file_path": "apps/glsl/halide_ycc_glsl_generator.cpp", "rank": 64, "score": 194259.8869545305 }, { "content": "// This Generator exists solely to test old-style generators (using the\n\n// build() method, rather than generate()/schedule()).\n\n// Do not convert it to new-style until/unless we decide to entirely remove support\n\n// for those Generators.\n\nclass BuildMethod : public Halide::Generator<BuildMethod> {\n\npublic:\n\n GeneratorParam<float> compiletime_factor{\"compiletime_factor\", 1, 0, 100};\n\n\n\n Input<Buffer<float>> input{\"input\", 3};\n\n Input<float> runtime_factor{\"runtime_factor\", 1.0};\n\n\n\n Func build() {\n\n Var x, y, c;\n\n\n\n Func g;\n\n g(x, y, c) = cast<int32_t>(input(x, y, c) * compiletime_factor * runtime_factor);\n\n return g;\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(BuildMethod, buildmethod)\n", "file_path": "test/generator/buildmethod_generator.cpp", "rank": 67, "score": 185726.8852825443 }, { "content": "class FFTGenerator : public Halide::Generator<FFTGenerator> {\n\npublic:\n\n // Gain to apply to the FFT. This is folded into gains already\n\n // being applied to the FFT. A gain of 1.0f indicates an\n\n // unnormalized FFT. 1 / sqrt(N) gives a unitary transform such that\n\n // forward and inverse operations have the same gain without changing\n\n // signal magnitude.\n\n // A common convention is 1/N for the forward direction and 1 for the\n\n // inverse.\n\n // \"N\" above is the size of the input, which is the product of\n\n // the dimensions.\n\n GeneratorParam<float> gain{\"gain\", 1.0f};\n\n\n\n // The following option specifies that a particular vector width should be\n\n // used when the vector width can change the results of the FFT.\n\n // Some parts of the FFT algorithm use the vector width to change the way\n\n // floating point operations are ordered and grouped, which causes the results\n\n // to vary with respect to the target architecture. Setting this option forces\n\n // such stages to use the specified vector width (independent of the actual\n\n // architecture's vector width), which eliminates the architecture specific\n", "file_path": "apps/fft/fft_generator.cpp", "rank": 68, "score": 185721.18881250315 }, { "content": "// For each producer node, find all functions that it calls.\n\nclass CheckCalls : public Halide::Internal::IRVisitor {\n\npublic:\n\n CallGraphs calls; // Caller -> vector of callees\n\n std::string producer = \"\";\n\n\n\nprivate:\n\n using Halide::Internal::IRVisitor::visit;\n\n\n\n void visit(const Halide::Internal::ProducerConsumer *op) override {\n\n if (op->is_producer) {\n\n std::string old_producer = producer;\n\n producer = op->name;\n\n calls[producer]; // Make sure each producer is allocated a slot\n\n // Group the callees of the 'produce' and 'update' together\n\n op->body.accept(this);\n\n producer = old_producer;\n\n } else {\n\n Halide::Internal::IRVisitor::visit(op);\n\n }\n\n }\n", "file_path": "test/common/check_call_graphs.h", "rank": 69, "score": 185721.18881250313 }, { "content": "class ConvRelu : public Halide::Generator<ConvRelu> {\n\npublic:\n\n Input<Buffer<float>> input{\"input\", 4};\n\n Input<Buffer<float>> filter{\"filter\", 4};\n\n Input<Buffer<float>> bias{\"bias\", 1};\n\n Output<Buffer<float>> relu{\"relu\", 4};\n\n\n\n void generate() {\n\n const int N = 5, CI = 120, CO = 24, W = 100, H = 80;\n\n\n\n Var x(\"x\"), y(\"y\"), c(\"c\"), n(\"n\");\n\n\n\n Func conv(\"conv\");\n\n RDom r(0, CI, 0, 3, 0, 3);\n\n conv(c, x, y, n) = bias(c);\n\n conv(c, x, y, n) += filter(c, r.y, r.z, r.x) * input(r.x, x + r.y, y + r.z, n);\n\n relu(c, x, y, n) = max(0, conv(c, x, y, n));\n\n\n\n relu.bound(c, 0, CO)\n\n .bound(x, 0, W)\n", "file_path": "apps/autoscheduler/demo_generator.cpp", "rank": 70, "score": 185721.18881250315 }, { "content": "class Demosaic : public Halide::Generator<Demosaic> {\n\npublic:\n\n GeneratorParam<LoopLevel> intermed_compute_at{\"intermed_compute_at\", LoopLevel::inlined()};\n\n GeneratorParam<LoopLevel> intermed_store_at{\"intermed_store_at\", LoopLevel::inlined()};\n\n GeneratorParam<LoopLevel> output_compute_at{\"output_compute_at\", LoopLevel::inlined()};\n\n\n\n // Inputs and outputs\n\n Input<Func> deinterleaved{\"deinterleaved\", Int(16), 3};\n\n Output<Func> output{\"output\", Int(16), 3};\n\n\n\n // Defines outputs using inputs\n\n void generate() {\n\n // These are the values we already know from the input\n\n // x_y = the value of channel x at a site in the input of channel y\n\n // gb refers to green sites in the blue rows\n\n // gr refers to green sites in the red rows\n\n\n\n // Give more convenient names to the four channels we know\n\n Func r_r, g_gr, g_gb, b_b;\n\n\n", "file_path": "apps/camera_pipe/camera_pipe_generator.cpp", "rank": 71, "score": 185721.18881250315 }, { "content": "class Float16T : public Halide::Generator<Float16T> {\n\npublic:\n\n Output<Buffer<int32_t>> output{\"output\", 1};\n\n\n\n void generate() {\n\n // Currently the float16 aot test just exercises the\n\n // runtime. More interesting code may go here in the future.\n\n Var x;\n\n output(x) = x;\n\n }\n\n};\n\n\n\nHALIDE_REGISTER_GENERATOR(Float16T, float16_t)\n", "file_path": "test/generator/float16_t_generator.cpp", "rank": 72, "score": 185721.18881250315 }, { "content": "class Resnet50Generator : public Halide::Generator<Resnet50Generator> {\n\npublic:\n\n Input<Buffer<float>> input{\"input\", 3};\n\n /** parameter values for scaling layers **/\n\n Input<Buffer<float>> conv1_gamma{\"conv1_gamma\", 1};\n\n Input<Buffer<float>[4]> br1_gamma { \"br1_gamma\", 1 };\n\n Input<Buffer<float>[16]> br2a_gamma { \"br2a_gamma\", 1 };\n\n Input<Buffer<float>[16]> br2b_gamma { \"br2b_gamma\", 1 };\n\n Input<Buffer<float>[16]> br2c_gamma { \"br2c_gamma\", 1 };\n\n\n\n Input<Buffer<float>> conv1_beta{\"conv1_beta\", 1};\n\n Input<Buffer<float>[4]> br1_beta { \"br1_beta\", 1 };\n\n Input<Buffer<float>[16]> br2a_beta { \"br2a_beta\", 1 };\n\n Input<Buffer<float>[16]> br2b_beta { \"br2b_beta\", 1 };\n\n Input<Buffer<float>[16]> br2c_beta { \"br2c_beta\", 1 };\n\n\n\n Input<Buffer<float>> conv1_mu{\"conv1_mu\", 1};\n\n Input<Buffer<float>[4]> br1_mu { \"br1_mu\", 1 };\n\n Input<Buffer<float>[16]> br2a_mu { \"br2a_mu\", 1 };\n\n Input<Buffer<float>[16]> br2b_mu { \"br2b_mu\", 1 };\n", "file_path": "apps/resnet_50/Resnet50Generator.cpp", "rank": 73, "score": 185721.18881250315 }, { "content": "class ArgvCall : public Halide::Generator<ArgvCall> {\n\npublic:\n\n Input<float> f1{\"f1\", 1.0};\n\n Input<float> f2{\"f2\", 1.0};\n\n\n\n Output<Buffer<int32_t>> output{\"output\", 3};\n\n\n\n void generate() {\n\n Var x, y, c;\n\n Func f(\"f\");\n\n\n\n f(x, y) = max(x, y);\n\n output(x, y, c) = cast<int32_t>(f(x, y) * c * f1 / f2);\n\n\n\n output.bound(c, 0, 3).reorder(c, x, y).unroll(c);\n\n\n\n output.vectorize(x, natural_vector_size<float>());\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(ArgvCall, argvcall)\n", "file_path": "test/generator/argvcall_generator.cpp", "rank": 74, "score": 185721.18881250315 }, { "content": "class StubUser : public Halide::Generator<StubUser> {\n\npublic:\n\n GeneratorParam<int32_t> int_arg{\"int_arg\", 33};\n\n\n\n Input<Buffer<uint8_t>> input{\"input\", 3};\n\n Output<Buffer<uint8_t>> calculated_output{\"calculated_output\"};\n\n Output<Buffer<float>> float32_buffer_output{\"float32_buffer_output\"};\n\n Output<Buffer<int32_t>> int32_buffer_output{\"int32_buffer_output\"};\n\n Output<Buffer<uint8_t>> array_test_output{\"array_test_output\"};\n\n // We can infer the tupled-output-type from the Stub\n\n Output<Buffer<>> tupled_output{\"tupled_output\", 3};\n\n Output<Buffer<int>> int_output{\"int_output\", 3};\n\n\n\n void generate() {\n\n Var x{\"x\"}, y{\"y\"}, c{\"c\"};\n\n\n\n Buffer<uint8_t> constant_image = make_image<uint8_t>();\n\n\n\n // We'll explicitly fill in the struct fields by name, just to show\n\n // it as an option. (Alternately, we could fill it in by using\n", "file_path": "test/generator/stubuser_generator.cpp", "rank": 75, "score": 185721.18881250315 }, { "content": "class Max : public Halide::Generator<Max> {\n\npublic:\n\n GeneratorParam<int> radius_{\"radius\", 26};\n\n Input<Buffer<float>> input_{\"input\", 3};\n\n Output<Buffer<float>> output_{\"output\", 3};\n\n\n\n void generate() {\n\n Var x(\"x\"), y(\"y\"), c(\"c\"), t(\"t\");\n\n\n\n Func input = repeat_edge(input_,\n\n {{input_.dim(0).min(), input_.dim(0).extent()},\n\n {input_.dim(1).min(), input_.dim(1).extent()}});\n\n\n\n const int radius = radius_;\n\n const int slices = (int)(ceilf(logf(radius) / logf(2))) + 1;\n\n\n\n // A sequence of vertically-max-filtered versions of the input,\n\n // each filtered twice as tall as the previous slice. All filters\n\n // are downward-looking.\n\n Func vert_log(\"vert_log\");\n", "file_path": "apps/max_filter/max_filter_generator.cpp", "rank": 76, "score": 185721.18881250315 }, { "content": "class StubTest : public Halide::Generator<StubTest> {\n\npublic:\n\n GeneratorParam<Type> untyped_buffer_output_type{\"untyped_buffer_output_type\", Float(32)};\n\n GeneratorParam<float> float_param{\"float_param\", 3.1415926535f};\n\n GeneratorParam<std::string> str_param{\"str_param\", \"\"};\n\n GeneratorParam<BagType> bag_type{\"bag_type\",\n\n BagType::Paper,\n\n {{\"paper\", BagType::Paper},\n\n {\"plastic\", BagType::Plastic}}};\n\n GeneratorParam<bool> vectorize{\"vectorize\", true};\n\n GeneratorParam<LoopLevel> intermediate_level{\"intermediate_level\", LoopLevel::root()};\n\n\n\n Input<Buffer<uint8_t>> typed_buffer_input{\"typed_buffer_input\", 3};\n\n Input<Buffer<>> untyped_buffer_input{\"untyped_buffer_input\"};\n\n Input<Buffer<uint8_t>[2]> array_buffer_input { \"array_buffer_input\", 3 };\n\n Input<Func> simple_input{\"simple_input\", 3}; // require a 3-dimensional Func but leave Type unspecified\n\n Input<Func[]> array_input{\"array_input\", 3}; // require a 3-dimensional Func but leave Type and ArraySize unspecified\n\n // Note that Input<Func> does not (yet) support Tuples\n\n Input<float> float_arg{\"float_arg\", 1.0f, 0.0f, 100.0f};\n\n Input<int32_t[]> int_arg{\"int_arg\", 1}; // leave ArraySize unspecified\n", "file_path": "test/generator/stubtest_generator.cpp", "rank": 77, "score": 185721.18881250313 }, { "content": "class BitOperations : public Halide::Generator<BitOperations> {\n\npublic:\n\n Input<Buffer<uint8_t>> input8{\"input8\", 1};\n\n Input<Buffer<uint16_t>> input16{\"input16\", 1};\n\n Input<Buffer<uint32_t>> input32{\"input32\", 1};\n\n Input<Buffer<uint64_t>> input64{\"input64\", 1};\n\n\n\n Output<Buffer<uint8_t>> output8{\"output8\", 1};\n\n Output<Buffer<uint8_t>> output16{\"output16\", 1};\n\n Output<Buffer<uint8_t>> output32{\"output32\", 1};\n\n Output<Buffer<uint8_t>> output64{\"output64\", 1};\n\n\n\n void generate() {\n\n Var x;\n\n output8(x) = Halide::cast<uint8_t>(count_leading_zeros(input8(x)));\n\n output16(x) = Halide::cast<uint8_t>(count_leading_zeros(input16(x)));\n\n output32(x) = Halide::cast<uint8_t>(count_leading_zeros(input32(x)));\n\n output64(x) = Halide::cast<uint8_t>(count_leading_zeros(input64(x)));\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(BitOperations, bit_operations)\n", "file_path": "test/generator/bit_operations_generator.cpp", "rank": 78, "score": 181776.15534559736 }, { "content": "class UserContext : public Halide::Generator<UserContext> {\n\npublic:\n\n Input<Buffer<float>> input{\"input\", 2};\n\n Output<Buffer<float>> output{\"output\", 2};\n\n\n\n void generate() {\n\n Var x, y;\n\n\n\n Func g;\n\n g(x, y) = input(x, y) * 2;\n\n g.compute_root();\n\n\n\n output(x, y) = g(x, y);\n\n\n\n output.parallel(y);\n\n trace_pipeline();\n\n\n\n // This test won't work in the profiler, because the profiler\n\n // insists on calling malloc with nullptr user context.\n\n assert(!get_target().has_feature(Target::Profile));\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(UserContext, user_context)\n", "file_path": "test/generator/user_context_generator.cpp", "rank": 79, "score": 181776.15534559736 }, { "content": "class ConvRelu : public Halide::Generator<ConvRelu> {\n\npublic:\n\n Input<Buffer<float>> input{\"input\", 4};\n\n Input<Buffer<float>> filter{\"filter\", 4};\n\n Input<Buffer<float>> bias{\"bias\", 1};\n\n Output<Buffer<float>> relu{\"relu\", 4};\n\n\n\n void generate() {\n\n const int N = 5, CI = 120, CO = 24, W = 100, H = 80;\n\n\n\n Var x(\"x\"), y(\"y\"), c(\"c\"), n(\"n\");\n\n\n\n Func conv(\"conv\");\n\n RDom r(0, CI, 0, 3, 0, 3);\n\n conv(c, x, y, n) = bias(c);\n\n conv(c, x, y, n) += filter(c, r.y, r.z, r.x) * input(r.x, x + r.y, y + r.z, n);\n\n relu(c, x, y, n) = max(0, conv(c, x, y, n));\n\n\n\n relu.bound(c, 0, CO)\n\n .bound(x, 0, W)\n", "file_path": "apps/gradient_autoscheduler/demo_generator.cpp", "rank": 80, "score": 181776.15534559736 }, { "content": "class OutputAssign : public Halide::Generator<OutputAssign> {\n\npublic:\n\n Output<Func> output{\"output\", Int(32), 2};\n\n Output<Func[2]> output_array{\"output_array\", Int(32), 2};\n\n\n\n void generate() {\n\n output = build_simple_func(0);\n\n for (int i = 0; i < 2; ++i) {\n\n output_array[i] = build_simple_func(i + 1);\n\n }\n\n }\n\n\n\n void schedule() {\n\n // nothing\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(OutputAssign, output_assign)\n", "file_path": "test/generator/output_assign_generator.cpp", "rank": 81, "score": 181776.15534559736 }, { "content": "class CleanupOnError : public Halide::Generator<CleanupOnError> {\n\npublic:\n\n Output<Buffer<int32_t>> output{\"output\", 1};\n\n\n\n void generate() {\n\n Var x;\n\n\n\n // This allocation is going to succeed\n\n\n\n Func f;\n\n f(x) = x;\n\n f.compute_root();\n\n\n\n Target target = get_target();\n\n if (target.has_gpu_feature() && !target.has_feature(Target::Metal)) {\n\n // Skip Metal, because it uses zero-copy, which breaks the\n\n // assumptions of the test.\n\n Var xo, xi;\n\n f.gpu_tile(x, xo, xi, 16);\n\n }\n", "file_path": "test/generator/cleanup_on_error_generator.cpp", "rank": 82, "score": 181776.15534559736 }, { "content": "class Deinterleave : public Halide::Generator<Deinterleave> {\n\npublic:\n\n Input<Buffer<uint8_t>> uvInterleaved{\"uvInterleaved\", 2};\n\n // There is no way to declare a Buffer<Tuple>, so we must use Output<Func> instead\n\n Output<Func> result{\"result\", {UInt(8), UInt(8)}, 2};\n\n\n\n void generate() {\n\n Var x, y;\n\n\n\n result(x, y) = {uvInterleaved(2 * x, y), uvInterleaved(2 * x + 1, y)};\n\n\n\n // CPU schedule:\n\n // Parallelize over scan lines, 4 scanlines per task.\n\n // Independently, vectorize over x.\n\n result\n\n .parallel(y, 4)\n\n .vectorize(x, natural_vector_size(UInt(8)));\n\n\n\n // Cope with rotated inputs\n\n uvInterleaved.dim(0).set_stride(Expr());\n\n result.specialize(uvInterleaved.dim(0).stride() == 1);\n\n result.specialize(uvInterleaved.dim(0).stride() == -1);\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(Deinterleave, deinterleave)\n", "file_path": "apps/HelloAndroidCamera2/jni/deinterleave_generator.cpp", "rank": 83, "score": 181776.15534559736 }, { "content": "class EmbedImage : public Halide::Generator<EmbedImage> {\n\npublic:\n\n Input<Buffer<float>> input{\"input\", 3};\n\n Output<Buffer<float>> output{\"output\", 3};\n\n\n\n void generate() {\n\n Buffer<float> matrix(3, 3);\n\n\n\n for (int i = 0; i < 3; i++) {\n\n for (int j = 0; j < 3; j++) {\n\n matrix(i, j) = 0.0f;\n\n }\n\n }\n\n // Make the matrix a flip-channels-and-multiply-by-0.5 so that this is easy to test\n\n matrix(2, 0) = matrix(1, 1) = matrix(0, 2) = 0.5f;\n\n\n\n Var x, y, c;\n\n RDom j(0, 3);\n\n output(x, y, c) = sum(matrix(j, c) * input(x, y, j));\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(EmbedImage, embed_image)\n", "file_path": "test/generator/embed_image_generator.cpp", "rank": 84, "score": 181776.15534559736 }, { "content": "class BufferCopy : public Halide::Generator<BufferCopy> {\n\npublic:\n\n Input<Func> input{\"input\", Float(32), 2};\n\n\n\n Output<Func> output{\"output\", Float(32), 2};\n\n\n\n Func dev_1, host_1, dev_2;\n\n Var x, y;\n\n\n\n Expr check_eq(Expr a, Expr b, const char *name) {\n\n return require(a == b, a, \"!=\", b, \"@\", name, \"(\", x, \",\", y, \")\");\n\n }\n\n\n\n void generate() {\n\n // We're going to have a four stage pipeline where we do work\n\n // on-device, on the host, on the device again, and finally on\n\n // the host again. In between each stage we'll schedule an\n\n // explicit copy in one direction or the other.\n\n\n\n dev_1(x, y) = input(x, y) + 1;\n", "file_path": "test/generator/buffer_copy_generator.cpp", "rank": 85, "score": 181776.15534559736 }, { "content": "class TiledBlur : public Halide::Generator<TiledBlur> {\n\npublic:\n\n Input<Buffer<uint8_t>> input{\"input\", 3};\n\n Output<Buffer<uint8_t>> output{\"output\", 3};\n\n\n\n void generate() {\n\n Expr input_float = cast<float>(input(x, y, c)) / 255.f;\n\n\n\n // This is the outermost pipeline, so input width and height\n\n // are meaningful. If you want to be able to call this outer\n\n // pipeline in a tiled fashion itself, then you should pass in\n\n // width and height as params, as with the blur above.\n\n brightened(x, y, c) = input_float * 1.2f;\n\n\n\n tiled_blur.define_extern(\n\n \"blur2x2\",\n\n {brightened, input.dim(0).extent(), input.dim(1).extent()},\n\n Float(32), 3);\n\n\n\n Expr tiled_blur_brightened = tiled_blur(x, y, c) * 1.2f;\n", "file_path": "test/generator/tiled_blur_generator.cpp", "rank": 86, "score": 181776.15534559736 }, { "content": "class ErrorCodes : public Halide::Generator<ErrorCodes> {\n\npublic:\n\n Input<Buffer<int32_t>> input{\"input\", 2};\n\n Input<int> f_explicit_bound{\"f_explicit_bound\", 1, 0, 64};\n\n\n\n Output<Buffer<int32_t>> output{\"output\", 2};\n\n\n\n void generate() {\n\n assert(!get_target().has_feature(Target::LargeBuffers));\n\n Var x, y;\n\n\n\n output(x, y) = input(x, y);\n\n output.bound(x, 0, f_explicit_bound);\n\n\n\n add_requirement(input.dim(1).extent() == 123);\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(ErrorCodes, error_codes)\n", "file_path": "test/generator/error_codes_generator.cpp", "rank": 87, "score": 181776.15534559736 }, { "content": "class MetadataTester : public Halide::Generator<MetadataTester> {\n\npublic:\n\n Input<Func> input{\"input\"}; // must be overridden to {UInt(8), 3}\n\n Input<Buffer<uint8_t>> typed_input_buffer{\"typed_input_buffer\", 3};\n\n Input<Buffer<>> dim_only_input_buffer{\"dim_only_input_buffer\", 3}; // must be overridden to type=UInt(8)\n\n Input<Buffer<>> untyped_input_buffer{\"untyped_input_buffer\"}; // must be overridden to {UInt(8), 3}\n\n Input<int32_t> no_default_value{\"no_default_value\"};\n\n Input<bool> b{\"b\", true};\n\n Input<int8_t> i8{\"i8\", 8, -8, 127};\n\n Input<int16_t> i16{\"i16\", 16, -16, 127};\n\n Input<int32_t> i32{\"i32\", 32, -32, 127};\n\n Input<int64_t> i64{\"i64\", 64, -64, 127};\n\n Input<uint8_t> u8{\"u8\", 80, 8, 255};\n\n Input<uint16_t> u16{\"u16\", 160, 16, 2550};\n\n Input<uint32_t> u32{\"u32\", 320, 32, 2550};\n\n Input<uint64_t> u64{\"u64\", 640, 64, 2550};\n\n Input<float> f32{\"f32\", 32.1234f, -3200.1234f, 3200.1234f};\n\n Input<double> f64{\"f64\", 64.25f, -6400.25f, 6400.25f};\n\n Input<void *> h{\"h\", nullptr};\n\n\n", "file_path": "test/generator/metadata_tester_generator.cpp", "rank": 88, "score": 181776.15534559736 }, { "content": "class SimpleStub : public Halide::Generator<SimpleStub> {\n\npublic:\n\n GeneratorParam<int> offset{\"offset\", 0};\n\n GeneratorParam<LoopLevel> compute_level{\"compute_level\", LoopLevel::root()};\n\n\n\n Input<Buffer<uint8_t>> buffer_input{\"buffer_input\", 2};\n\n Input<Func> func_input{\"func_input\", 2}; // require a 2-dimensional Func but leave Type unspecified\n\n Input<float> float_arg{\"float_arg\", 1.0f, 0.0f, 100.0f};\n\n\n\n Output<Func> simple_output{\"simple_output\", Float(32), 2};\n\n\n\n void generate() {\n\n simple_output(x, y) = cast<float>(func_input(x, y) + offset + buffer_input(x, y)) + float_arg;\n\n }\n\n\n\n void schedule() {\n\n simple_output.compute_at(compute_level);\n\n }\n\n\n\nprivate:\n\n Var x{\"x\"}, y{\"y\"};\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(SimpleStub, simplestub)\n", "file_path": "python_bindings/correctness/simplestub_generator.cpp", "rank": 89, "score": 181776.15534559736 }, { "content": "class ImageFromArray : public Halide::Generator<ImageFromArray> {\n\npublic:\n\n Output<Buffer<int32_t>> output{\"output\", 1};\n\n\n\n void generate() {\n\n // Currently the test just exercises halide_image.h.\n\n Var x;\n\n output(x) = x;\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(ImageFromArray, image_from_array)\n", "file_path": "test/generator/image_from_array_generator.cpp", "rank": 90, "score": 181776.15534559736 }, { "content": "// This Generator exists solely to compare the output with BuildMethod and PartialBuildMethod.\n\nclass NoBuildMethod : public Halide::Generator<NoBuildMethod> {\n\npublic:\n\n GeneratorParam<float> compiletime_factor{\"compiletime_factor\", 1, 0, 100};\n\n\n\n Input<Buffer<float>> input{\"input\", 2};\n\n Input<float> runtime_factor{\"runtime_factor\", 1.0};\n\n\n\n Output<Buffer<int32_t>> output{\"output\", 2};\n\n\n\n void generate() {\n\n Var x, y;\n\n\n\n output(x, y) =\n\n cast<int32_t>(input(x, y) * compiletime_factor * runtime_factor);\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(NoBuildMethod, nobuildmethod)\n", "file_path": "python_bindings/correctness/nobuildmethod_generator.cpp", "rank": 91, "score": 181776.15534559736 }, { "content": "class StringParam : public Halide::Generator<StringParam> {\n\npublic:\n\n GeneratorParam<std::string> rpn{\"rpn_expr\", \"\"};\n\n\n\n Output<Buffer<int>> output{\"output\", 2};\n\n\n\n void generate() {\n\n // Remove cmake extra skip characters if any exist.\n\n const std::string value = Halide::Internal::replace_all(rpn.value(), \"\\\\ \", \" \");\n\n std::vector<std::string> tokens = Halide::Internal::split_string(value, \" \");\n\n std::stack<Halide::Expr> exprs;\n\n // Assume input is a valid RPN expression no checks for simplicity.\n\n for (const std::string &token : tokens) {\n\n bool is_op = (token == \"+\" || token == \"-\" || token == \"*\" || token == \"/\");\n\n bool is_var = (token == \"x\" || token == \"y\");\n\n if (is_var) {\n\n if (token == \"x\") {\n\n exprs.push(x);\n\n } else {\n\n exprs.push(y);\n", "file_path": "test/generator/string_param_generator.cpp", "rank": 92, "score": 181776.15534559736 }, { "content": "class ExternalCode : public Halide::Generator<ExternalCode> {\n\npublic:\n\n GeneratorParam<bool> external_code_is_bitcode{\"external_code_is_bitcode\", true};\n\n Input<Buffer<int32_t>> input{\"input\", 2};\n\n Output<Buffer<float>> output{\"output\", 2};\n\n HalidePureExtern_1(float, gen_extern_tester, float);\n\n\n\n void generate() {\n\n Var x(\"x\"), y(\"y\");\n\n Func f(\"f\");\n\n\n\n unsigned char *code;\n\n int code_length;\n\n const char *name = \"org.halide-lang.extern_code_extern\";\n\n if (external_code_is_bitcode) {\n\n Target target = get_target();\n\n if (target.bits == 64) {\n\n code = external_code_extern_bitcode_64;\n\n code_length = external_code_extern_bitcode_64_length;\n\n } else {\n", "file_path": "test/generator/external_code_generator.cpp", "rank": 93, "score": 181776.15534559736 }, { "content": "class inverse_haar_x : public Halide::Generator<inverse_haar_x> {\n\npublic:\n\n Input<Buffer<float>> in_{\"in\", 3};\n\n Output<Buffer<float>> out_{\"out\", 2};\n\n\n\n void generate() {\n\n Func in = Halide::BoundaryConditions::repeat_edge(in_);\n\n\n\n out_(x, y) = select(x % 2 == 0,\n\n in(x / 2, y, 0) + in(x / 2, y, 1),\n\n in(x / 2, y, 0) - in(x / 2, y, 1));\n\n out_.unroll(x, 2);\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(inverse_haar_x, inverse_haar_x)\n", "file_path": "apps/wavelet/inverse_haar_x_generator.cpp", "rank": 94, "score": 181776.15534559736 }, { "content": "class BitGenerator : public Halide::Generator<BitGenerator> {\n\npublic:\n\n Input<Buffer<bool>> bit_input{\"input_uint1\", 1};\n\n Input<bool> bit_constant{\"constant_uint1\"};\n\n\n\n Output<Buffer<bool>> bit_output{\"output_uint1\", 1};\n\n\n\n Var x, y, z;\n\n\n\n void generate() {\n\n bit_output(x) = bit_input(x) + bit_constant;\n\n }\n\n\n\n void schedule() {\n\n }\n\n};\n\n\n\nHALIDE_REGISTER_GENERATOR(BitGenerator, bit)\n", "file_path": "python_bindings/correctness/bit_generator.cpp", "rank": 95, "score": 181776.15534559736 }, { "content": "class FuncCallInliner : public Halide::Internal::IRMutator {\n\n Halide::Expr visit(const Halide::Internal::Call *op) override {\n\n if (op->call_type != Halide::Internal::Call::Halide) {\n\n return Halide::Internal::IRMutator::visit(op);\n\n }\n\n\n\n assert(op->func.defined());\n\n\n\n // Mutate the args\n\n std::vector<Halide::Expr> args(op->args.size());\n\n for (size_t i = 0; i < args.size(); i++) {\n\n args[i] = mutate(op->args[i]);\n\n }\n\n // Grab the body\n\n Halide::Internal::Function func(op->func);\n\n Halide::Expr body =\n\n qualify(func.name() + \".\", func.values()[op->value_index]);\n\n\n\n // Bind the args using Let nodes\n\n const std::vector<std::string> func_args = func.args();\n", "file_path": "apps/onnx/onnx_converter.cc", "rank": 96, "score": 181776.15534559736 }, { "content": "class PipelineCpp : public Halide::Generator<PipelineCpp> {\n\npublic:\n\n Input<Buffer<uint16_t>> input{\"input\", 2};\n\n Output<Buffer<uint16_t>> output{\"output\", 2};\n\n\n\n void generate() {\n\n Var x, y;\n\n\n\n assert(get_target().has_feature(Target::CPlusPlusMangling));\n\n\n\n Expr add_all_the_things = cast<int>(0);\n\n add_all_the_things += make_call_cpp_extern_toplevel(input(x, y), x + y);\n\n\n\n add_all_the_things += make_call_cpp_extern_namespace(input(x, y), x + y);\n\n\n\n add_all_the_things += make_call_cpp_extern_shared_namespace_1(input(x, y), x + y);\n\n add_all_the_things += make_call_cpp_extern_shared_namespace_2(input(x, y), x + y);\n\n add_all_the_things += make_call_cpp_extern_shared_namespace_3(input(x, y), x + y);\n\n\n\n add_all_the_things += make_call_cpp_extern_nested_namespace_outer(input(x, y), x + y);\n", "file_path": "apps/c_backend/pipeline_cpp_generator.cpp", "rank": 97, "score": 181776.15534559736 }, { "content": "class inverse_daubechies_x : public Halide::Generator<inverse_daubechies_x> {\n\npublic:\n\n Input<Buffer<float>> in_{\"in\", 3};\n\n Output<Buffer<float>> out_{\"out\", 2};\n\n\n\n void generate() {\n\n Func in = Halide::BoundaryConditions::repeat_edge(in_);\n\n\n\n out_(x, y) = select(x % 2 == 0,\n\n D2 * in(x / 2, y, 0) + D1 * in(x / 2, y, 1) + D0 * in(x / 2 + 1, y, 0) + D3 * in(x / 2 + 1, y, 1),\n\n D3 * in(x / 2, y, 0) - D0 * in(x / 2, y, 1) + D1 * in(x / 2 + 1, y, 0) - D2 * in(x / 2 + 1, y, 1));\n\n out_.unroll(x, 2);\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nHALIDE_REGISTER_GENERATOR(inverse_daubechies_x, inverse_daubechies_x)\n", "file_path": "apps/wavelet/inverse_daubechies_x_generator.cpp", "rank": 98, "score": 181776.15534559736 }, { "content": "class ComplexStub : public Halide::Generator<ComplexStub> {\n\npublic:\n\n GeneratorParam<Type> untyped_buffer_output_type{\"untyped_buffer_output_type\", Float(32)};\n\n GeneratorParam<bool> vectorize{\"vectorize\", true};\n\n GeneratorParam<LoopLevel> intermediate_level{\"intermediate_level\", LoopLevel::root()};\n\n\n\n Input<Buffer<uint8_t>> typed_buffer_input{\"typed_buffer_input\", 3};\n\n Input<Buffer<>> untyped_buffer_input{\"untyped_buffer_input\"};\n\n Input<Func> simple_input{\"simple_input\", 3}; // require a 3-dimensional Func but leave Type unspecified\n\n Input<Func[]> array_input{\"array_input\", 3}; // require a 3-dimensional Func but leave Type and ArraySize unspecified\n\n // Note that Input<Func> does not (yet) support Tuples\n\n Input<float> float_arg{\"float_arg\", 1.0f, 0.0f, 100.0f};\n\n Input<int32_t[]> int_arg{\"int_arg\", 1}; // leave ArraySize unspecified\n\n\n\n Output<Func> simple_output{\"simple_output\", Float(32), 3};\n\n Output<Func> tuple_output{\"tuple_output\", 3}; // require a 3-dimensional Func but leave Type(s) unspecified\n\n Output<Func[]> array_output{\"array_output\", Int(16), 2}; // leave ArraySize unspecified\n\n Output<Buffer<float>> typed_buffer_output{\"typed_buffer_output\"};\n\n Output<Buffer<>> untyped_buffer_output{\"untyped_buffer_output\"};\n\n Output<Buffer<uint8_t>> static_compiled_buffer_output{\"static_compiled_buffer_output\", 3};\n", "file_path": "python_bindings/correctness/complexstub_generator.cpp", "rank": 99, "score": 181776.15534559736 } ]
C++
tests/rwops/customRWops/main.cpp
jamesl-github/scc
c1dddf41778eeb2ef2a910372d1eb6a6a8dfa68e
#include <iostream> #include <sstream> #include <string> #include <ios> #include <SDL.h> #include "rwops.hpp" const int ERR_SDL_INIT = -1; const int BUFFER_SIZE = 4; const int CHAR_SKIP = 2; bool init(Uint32 sdlInitFlags) { if(SDL_Init(sdlInitFlags) < 0) { return false; } return true; } void quit() { SDL_Quit(); } Sint64 stringstreamSize(SDL_RWops *rwops) { auto ss = static_cast<std::stringstream*>(rwops->hidden.unknown.data1); return ss == NULL ? -1 : ss->str().size(); } Sint64 stringstreamSeek(SDL_RWops *rwops, Sint64 offset, int whence) { auto ss = static_cast<std::stringstream*>(rwops->hidden.unknown.data1); if(ss == NULL) { return -1; } std::ios_base::seekdir direction; switch(whence) { case RW_SEEK_SET: direction = ss->beg; break; case RW_SEEK_CUR: direction = ss->cur; break; case RW_SEEK_END: direction = ss->end; break; default: return -1; } ss->seekg(offset, direction); ss->seekp(offset, direction); return ss->tellp(); } size_t stringstreamRead(SDL_RWops *rwops, void *ptr, size_t size, size_t maxnum) { size_t byteCount = size * maxnum; auto ss = static_cast<std::stringstream*>(rwops->hidden.unknown.data1); if(ss == NULL) { return 0; } ss->read(static_cast<char*>(ptr), byteCount); return ss->gcount(); } size_t stringstreamWrite(SDL_RWops *rwops, const void *ptr, size_t size, size_t num) { auto ss = static_cast<std::stringstream*>(rwops->hidden.unknown.data1); if(ss == NULL) { return 0; } size_t oldSize = ss->str().size(); ss->write(static_cast<const char*>(ptr), size * num); size_t newSize = ss->str().size(); return newSize - oldSize; } int stringstreamClose(SDL_RWops *rwops) { if(rwops != NULL) { SDL_FreeRW(rwops); } return 0; } void test() { std::stringstream ss; SDL::RWops custom(stringstreamSize, stringstreamSeek, stringstreamRead, stringstreamWrite, stringstreamClose, SDL_RWOPS_UNKNOWN, &ss); std::string str = "abcdefghijklmnopqrstuvwxyz"; char buffer[BUFFER_SIZE]; custom.write(str.c_str(), sizeof(char), str.size()); std::cout << "output buffer position after writing: " << custom.tell() << std::endl; custom.seek(0, RW_SEEK_SET); custom.read(buffer, sizeof(char), BUFFER_SIZE); std::cout << BUFFER_SIZE << " first characters: "; std::cout.write(buffer, BUFFER_SIZE); std::cout << std::endl; custom.seek(CHAR_SKIP, RW_SEEK_CUR); custom.read(buffer, sizeof(char), BUFFER_SIZE); std::cout << BUFFER_SIZE << " characters after skipping " << CHAR_SKIP << " characters from the previous position: "; std::cout.write(buffer, BUFFER_SIZE); std::cout << std::endl; custom.seek(-BUFFER_SIZE, RW_SEEK_END); custom.read(buffer, sizeof(char), BUFFER_SIZE); std::cout << BUFFER_SIZE << " last characters: "; std::cout.write(buffer, BUFFER_SIZE); std::cout << std::endl; custom.seek(0, RW_SEEK_SET); } int main(int argc, char **argv) { Uint32 sdlFlags = SDL_INIT_VIDEO; if(!init(sdlFlags)) { SDL_LogCritical(SDL_LOG_CATEGORY_ERROR, "couldn't initialize SDL\n"); return ERR_SDL_INIT; } test(); quit(); return 0; }
#include <iostream> #include <sstream> #include <string> #include <ios> #include <SDL.h> #include "rwops.hpp" const int ERR_SDL_INIT = -1; const int BUFFER_SIZE = 4; const int CHAR_SKIP = 2; bool init(Uint32 sdlInitFlags) { if(SDL_Init(sdlInitFlags) < 0) { return false; } return true; } void quit() { SDL_Quit(); } Sint64 stringstreamSize(SDL_RWops *rwops) { auto ss = static_cast<std::stringstream*>(rwops->hidden.unknown.data1); return ss == NULL ? -1 : ss->str().size(); } Sint64 stringstreamSeek(SDL_RWops *rwops, Sint64 offset, int whence) { auto ss = static_cast<std::stringstream*>(rwops->hidden.unknown.data1); if(ss == NULL) { return -1; } std::ios_base::seekdir direction; switch(whence) { case RW_SEEK_SET: direction = ss->beg; break; case RW_SEEK_CUR: direction = ss->cur; break; case RW_SEEK_END: direction = ss->end; break; default: return -1; } ss->seekg(offset, direction); ss->seekp(offset, direction); return ss->tellp(); } size_t stringstreamRead(SDL_RWops *rwops, void *ptr, size_t size, size_t maxnum) { size_t byteCount = size * maxnum; auto ss = static_cast<std::stringstream*>(rwops->hidden.unknown.data1); if(ss == NULL) { return 0; } ss->read(static_cast<char*>(ptr), byteCount); return ss->gcount(); } size_t stringstreamWrite(SDL_RWops *rwops, const void *ptr, size_t size, size_t num) { auto ss = static_cast<std::stringstream*>(rwops->hidden.unknown.data1); if(ss == NULL) { return 0; } size_t oldSize = ss->str().size(); ss->write(static_cast<const char*>(ptr), size * num); size_t newSize = ss->str().size(); return newSize - oldSize; } int stringstreamClose(SDL_RWops *rwops) { if(rwops != NULL) { SDL_FreeRW(rwops); } return 0; } void test() { std::stringstream ss; SDL::RWops custom(stringstreamSize, stringstreamSeek, stringstreamRead, stringstreamWrite, stringstreamClose, SDL_RWOPS_UNKNOWN, &ss); std::string str = "abcdefghijklmnopqrstuvwxyz"; char buffer[BUFFER_SIZE]; custom.write(str.c_str(), sizeof(char), str.size()); std::cout << "output buffer position after writing: " << custom.tell() <<
FER_SIZE, RW_SEEK_END); custom.read(buffer, sizeof(char), BUFFER_SIZE); std::cout << BUFFER_SIZE << " last characters: "; std::cout.write(buffer, BUFFER_SIZE); std::cout << std::endl; custom.seek(0, RW_SEEK_SET); } int main(int argc, char **argv) { Uint32 sdlFlags = SDL_INIT_VIDEO; if(!init(sdlFlags)) { SDL_LogCritical(SDL_LOG_CATEGORY_ERROR, "couldn't initialize SDL\n"); return ERR_SDL_INIT; } test(); quit(); return 0; }
std::endl; custom.seek(0, RW_SEEK_SET); custom.read(buffer, sizeof(char), BUFFER_SIZE); std::cout << BUFFER_SIZE << " first characters: "; std::cout.write(buffer, BUFFER_SIZE); std::cout << std::endl; custom.seek(CHAR_SKIP, RW_SEEK_CUR); custom.read(buffer, sizeof(char), BUFFER_SIZE); std::cout << BUFFER_SIZE << " characters after skipping " << CHAR_SKIP << " characters from the previous position: "; std::cout.write(buffer, BUFFER_SIZE); std::cout << std::endl; custom.seek(-BUF
random
[ { "content": "\tstd::cout << \"byte 0x\" << std::setbase(16)\n\n\t\t<< (static_cast<int>(c) & 0xff) << std::setbase(10)\n\n\t\t<< \" at position \" << pos << std::endl;\n\n\tconstMem.seek(0, RW_SEEK_SET);\n\n}\n\n\n\nvoid test()\n\n{\n\n\tSDL::RWops constMem(memory, sizeof(memory));\n\n\n\n\t// read. Positions are random just to make it more interesting.\n\n\tfor(int i = 0; i < BYTES_TO_READ.size(); ++i) {\n\n\t\tprintByteAt(constMem, BYTES_TO_READ[i]);\n\n\t}\n\n\n\n\t// write. Should not change the buffer, and should give us a warning\n\n\tconst unsigned char someValue = 0x01;\n\n\tconstMem.seek(0, RW_SEEK_SET); // just in case\n\n\tconstMem.write(&someValue, sizeof(char), 1); // write at first pos\n\n\n", "file_path": "tests/rwops/fromConstMemory/main.cpp", "rank": 0, "score": 90355.49570701736 }, { "content": "\t\treturn false;\n\n\t}\n\n\treturn true;\n\n}\n\n\n\nvoid quit()\n\n{\n\n\tSDL_Quit();\n\n}\n\n\n\nvoid printByteAt(SDL::RWops &constMem, int pos)\n\n{\n\n\tchar c;\n\n\tconstMem.seek(pos, RW_SEEK_SET);\n\n\tsize_t charsRead = constMem.read(&c, sizeof(char), 1);\n\n\tif(charsRead < 1) {\n\n\t\tstd::cout << \"RWops::read() failed\" << std::endl;\n\n\t\treturn;\n\n\t}\n\n\n", "file_path": "tests/rwops/fromConstMemory/main.cpp", "rank": 1, "score": 90345.39699897461 }, { "content": "\tstd::cout << std::endl << \"after attempting to write:\" << std::endl;\n\n\tprintByteAt(constMem, 0);\n\n\tstd::cout << \"writing error we've got: \\\"\" << SDL_GetError() << \"\\\"\"\n\n\t\t<< std::endl;\n\n}\n\n\n\nint main(int argc, char **argv)\n\n{\n\n\tUint32 sdlFlags = SDL_INIT_VIDEO;\n\n\tif(!init(sdlFlags)) {\n\n\t\tSDL_LogCritical(SDL_LOG_CATEGORY_ERROR,\n\n\t\t\t\"couldn't initialize SDL\\n\");\n\n\t\treturn ERR_SDL_INIT;\n\n\t}\n\n\ttest();\n\n\tquit();\n\n\treturn 0;\n\n}\n", "file_path": "tests/rwops/fromConstMemory/main.cpp", "rank": 2, "score": 90339.72958026709 }, { "content": "\n\n#include <iostream>\n\n#include <iomanip>\n\n#include <vector>\n\n#include <SDL.h>\n\n#include \"rwops.hpp\"\n\n\n\nconst int ERR_SDL_INIT = -1;\n\n\n\n// another 256 bytes from /dev/urandom\n\nconst unsigned char memory[] = {\n\n\t0x3a, 0xc3, 0x17, 0x22, 0x25, 0xc9, 0x17, 0xb8, 0xd5, 0x60, 0x15, 0x23,\n\n\t0x35, 0x27, 0x29, 0x12, 0x6a, 0x6d, 0x68, 0xa3, 0x80, 0xcf, 0x81, 0xd9,\n\n\t0xc9, 0x78, 0xa7, 0x56, 0x65, 0x2e, 0xdf, 0x74, 0x23, 0x04, 0x44, 0x37,\n\n\t0x30, 0xfc, 0x83, 0x08, 0xa5, 0x8d, 0x78, 0xbe, 0x19, 0x3e, 0x67, 0x3d,\n\n\t0xbc, 0xae, 0x27, 0x17, 0x9c, 0x7c, 0xaa, 0xc0, 0xbf, 0xf4, 0xed, 0x45,\n\n\t0x54, 0xba, 0x58, 0xb4, 0xd2, 0x84, 0x85, 0x3b, 0x16, 0x01, 0x7d, 0x05,\n\n\t0x67, 0xf7, 0x6a, 0xbb, 0x2c, 0x28, 0xb5, 0xb5, 0x6b, 0x11, 0x91, 0x90,\n\n\t0x55, 0xd8, 0x49, 0x87, 0xb2, 0x18, 0xfa, 0x4a, 0x4f, 0xa0, 0x1d, 0x33,\n\n\t0x9c, 0x3b, 0x1d, 0x5e, 0xd5, 0x1a, 0x42, 0xf4, 0xb4, 0xb6, 0x7f, 0x50,\n", "file_path": "tests/rwops/fromConstMemory/main.cpp", "rank": 3, "score": 90336.16739526397 }, { "content": "\t0x5b, 0x27, 0xf8, 0xb1, 0x1e, 0xc6, 0xa7, 0xd9, 0x97, 0x0a, 0xb2, 0xcd,\n\n\t0xe2, 0xdb, 0xec, 0xfc, 0x78, 0x64, 0x5b, 0x3a, 0xbf, 0x97, 0xed, 0x6b,\n\n\t0xd5, 0xa2, 0x9c, 0xce, 0xa8, 0xcd, 0xf2, 0xde, 0x6d, 0xc7, 0x06, 0x91,\n\n\t0x75, 0x81, 0x49, 0x9a, 0xb3, 0xad, 0x78, 0x6f, 0x3b, 0x8a, 0x0a, 0x1d,\n\n\t0xe9, 0x66, 0xb8, 0x3e, 0x19, 0x19, 0xf8, 0x65, 0xb1, 0x24, 0x27, 0xbd,\n\n\t0xbe, 0x13, 0xd9, 0x26, 0x00, 0x0b, 0xcb, 0xe9, 0x9f, 0x30, 0x1b, 0x02,\n\n\t0x1a, 0xf5, 0xcf, 0xbb, 0xee, 0x00, 0x51, 0x95, 0x89, 0x7f, 0x2c, 0xbe,\n\n\t0x4e, 0x3b, 0x7c, 0x24, 0x48, 0x50, 0x76, 0xa1, 0xe9, 0x94, 0x64, 0xb8,\n\n\t0x93, 0x87, 0x85, 0x25, 0x9e, 0xeb, 0x55, 0x06, 0xcf, 0x27, 0xe1, 0x27,\n\n\t0xeb, 0x51, 0xac, 0xfb, 0x9c, 0xc8, 0xe4, 0x6f, 0xca, 0x91, 0xfe, 0xf7,\n\n\t0x7d, 0x38, 0x95, 0x1b, 0xe0, 0x8f, 0x17, 0xd8, 0xd5, 0x86, 0x42, 0xc6,\n\n\t0xcd, 0x88, 0x61, 0x11, 0xc0, 0xd0, 0xba, 0xd8, 0xe7, 0xaf, 0x84, 0x54,\n\n\t0x32, 0x62, 0x08, 0x59\n\n};\n\n\n\nconst std::vector<int> BYTES_TO_READ{3, 251, 53, 162};\n\n\n\nbool init(Uint32 sdlInitFlags)\n\n{\n\n\tif(SDL_Init(sdlInitFlags) < 0) {\n", "file_path": "tests/rwops/fromConstMemory/main.cpp", "rank": 4, "score": 90324.686370386 }, { "content": "/*\n\n SDL C++ Classes\n\n Copyright (C) 2017-2018 Mateus Carmo M. de F. Barbosa\n\n \n\n This software is provided 'as-is', without any express or implied\n\n warranty. In no event will the authors be held liable for any damages\n\n arising from the use of this software.\n\n \n\n Permission is granted to anyone to use this software for any purpose,\n\n including commercial applications, and to alter it and redistribute it\n\n freely, subject to the following restrictions:\n\n \n\n 1. The origin of this software must not be misrepresented; you must not\n\n claim that you wrote the original software. If you use this software\n\n in a product, an acknowledgment in the product documentation would be\n\n appreciated but is not required.\n\n 2. Altered source versions must be plainly marked as such, and must not be\n\n misrepresented as being the original software.\n\n 3. This notice may not be removed or altered from any source distribution.\n\n*/\n", "file_path": "tests/rwops/fromConstMemory/main.cpp", "rank": 5, "score": 90322.67239691204 }, { "content": "\n\n#ifndef SCC_NULL_HPP\n\n#define SCC_NULL_HPP\n\n\n\n// If you've defined NULL as anything else, screw you and the NULL you rode on\n\n#if NULL != 0\n\n# undef NULL\n\n# define NULL 0\n\n#endif\n\n\n\n#endif // SCC_NULL_HPP\n", "file_path": "include/null.hpp", "rank": 6, "score": 73563.99453014325 }, { "content": "/*\n\n SDL C++ Classes\n\n Copyright (C) 2017-2018 Mateus Carmo M. de F. Barbosa\n\n \n\n This software is provided 'as-is', without any express or implied\n\n warranty. In no event will the authors be held liable for any damages\n\n arising from the use of this software.\n\n \n\n Permission is granted to anyone to use this software for any purpose,\n\n including commercial applications, and to alter it and redistribute it\n\n freely, subject to the following restrictions:\n\n \n\n 1. The origin of this software must not be misrepresented; you must not\n\n claim that you wrote the original software. If you use this software\n\n in a product, an acknowledgment in the product documentation would be\n\n appreciated but is not required.\n\n 2. Altered source versions must be plainly marked as such, and must not be\n\n misrepresented as being the original software.\n\n 3. This notice may not be removed or altered from any source distribution.\n\n*/\n", "file_path": "include/null.hpp", "rank": 7, "score": 73561.8626957015 }, { "content": "\tsize_t write(const void *ptr, size_t size, size_t num)\n\n\t{\n\n\t\treturn SDL_RWwrite(rwops_.get(), ptr, size, num);\n\n\t}\n\n\tSint64 seek(Sint64 offset, int whence)\n\n\t{\n\n\t\treturn SDL_RWseek(rwops_.get(), offset, whence);\n\n\t}\n\n\tSint64 tell() const { return SDL_RWtell(rwops_.get()); }\n\n\n\n\tRWops(const RWops &that) = delete;\n\n\tRWops(RWops &&that) = default;\n\n\t~RWops() = default;\n\n\tRWops & operator=(RWops that) { swap(*this, that); return *this; }\n\n\tfriend void swap(RWops &first, RWops &second) noexcept\n\n\t{\n\n\t\tusing std::swap;\n\n\t\tswap(first.rwops_, second.rwops_);\n\n\t}\n\n\n", "file_path": "include/rwops.hpp", "rank": 8, "score": 72918.16854998878 }, { "content": "\tRWops(\n\n\t\tdecltype(SDL_RWops::size) size,\n\n\t\tdecltype(SDL_RWops::seek) seek,\n\n\t\tdecltype(SDL_RWops::read) read,\n\n\t\tdecltype(SDL_RWops::write) write,\n\n\t\tdecltype(SDL_RWops::close) close,\n\n\t\tUint32 type = SDL_RWOPS_UNKNOWN,\n\n\t\tvoid *data1 = NULL, // hidden.unknown\n\n\t\tvoid *data2 = NULL // hidden.unknown\n\n\t);\n\n\n\n\t// wrappers around SDL_RW* functions. The args and return value are the\n\n\t// same as in SDL.\n\n\t// There's no wrapper around SDL_RWclose() because that will only be\n\n\t// called upon destruction\n\n\tSint64 size() const { return SDL_RWsize(rwops_.get()); }\n\n\tsize_t read(void *ptr, size_t size, size_t maxnum) const\n\n\t{\n\n\t\treturn SDL_RWread(rwops_.get(), ptr, size, maxnum);\n\n\t}\n", "file_path": "include/rwops.hpp", "rank": 9, "score": 72909.27077666871 }, { "content": "\t: rwops_{CStyleAlloc<RWops::Deleter>::alloc(SDL_RWFromFile,\n\n\t\t\"Making RWops from file failed\", filename, mode)}\n\n{}\n\n\n\nRWops::RWops(void *mem, int size)\n\n\t: rwops_{CStyleAlloc<RWops::Deleter>::alloc(SDL_RWFromMem,\n\n\t\t\"Making RWops from memory failed\", mem, size)}\n\n{}\n\n\n\nRWops::RWops(const void *mem, int size)\n\n\t: rwops_{CStyleAlloc<RWops::Deleter>::alloc(SDL_RWFromConstMem,\n\n\t\t\"Making RWops from const memory failed\", mem, size)}\n\n{}\n\n\n\nRWops::RWops(\n\n\tdecltype(SDL_RWops::size) size,\n\n\tdecltype(SDL_RWops::seek) seek,\n\n\tdecltype(SDL_RWops::read) read,\n\n\tdecltype(SDL_RWops::write) write,\n\n\tdecltype(SDL_RWops::close) close,\n", "file_path": "include/rwops.hpp", "rank": 10, "score": 72899.03684715502 }, { "content": "\tUint32 type,\n\n\tvoid *data1,\n\n\tvoid *data2\n\n) : rwops_{CStyleAlloc<RWops::Deleter>::alloc(SDL_AllocRW,\n\n\t\"Making custom RWops failed\")}\n\n{\n\n\t// here, rwops_ already has valid data\n\n\trwops_->size = size;\n\n\trwops_->seek = seek;\n\n\trwops_->read = read;\n\n\trwops_->write = write;\n\n\trwops_->close = close;\n\n\trwops_->type = type;\n\n\trwops_->hidden.unknown.data1 = data1;\n\n\trwops_->hidden.unknown.data2 = data2;\n\n}\n\n\n\n} // namespace SDL\n\n\n\n#endif // SCC_RWOPS_HPP\n", "file_path": "include/rwops.hpp", "rank": 11, "score": 72892.8117688439 }, { "content": "\n\n#ifndef SCC_RWOPS_HPP\n\n#define SCC_RWOPS_HPP\n\n\n\n#include <memory>\n\n#include \"null.hpp\"\n\n#include \"cstylealloc.hpp\"\n\n\n\nnamespace SDL {\n\n\n", "file_path": "include/rwops.hpp", "rank": 12, "score": 72887.80841634051 }, { "content": "\tstruct Deleter {\n\n\t\tvoid operator()(SDL_RWops *rwops) { SDL_RWclose(rwops); }\n\n\t};\n\nprivate:\n\n\tstd::unique_ptr<SDL_RWops, Deleter> rwops_;\n\n};\n\n\n\n// Class that actually allows loading from RWops, while ensuring freesrc will\n\n// always be false (only the dtor should free the SDL_RWops)\n\n//\n\n// Note: once again, Deleter type can't be automatically deduced, so we put it\n\n// in a class\n\ntemplate <typename Deleter>\n", "file_path": "include/rwops.hpp", "rank": 13, "score": 72886.31465999877 }, { "content": "/*\n\n SDL C++ Classes\n\n Copyright (C) 2017-2018 Mateus Carmo M. de F. Barbosa\n\n \n\n This software is provided 'as-is', without any express or implied\n\n warranty. In no event will the authors be held liable for any damages\n\n arising from the use of this software.\n\n \n\n Permission is granted to anyone to use this software for any purpose,\n\n including commercial applications, and to alter it and redistribute it\n\n freely, subject to the following restrictions:\n\n \n\n 1. The origin of this software must not be misrepresented; you must not\n\n claim that you wrote the original software. If you use this software\n\n in a product, an acknowledgment in the product documentation would be\n\n appreciated but is not required.\n\n 2. Altered source versions must be plainly marked as such, and must not be\n\n misrepresented as being the original software.\n\n 3. This notice may not be removed or altered from any source distribution.\n\n*/\n", "file_path": "include/rwops.hpp", "rank": 14, "score": 72876.9967575268 }, { "content": "struct FromRWops {\n\n\t// Note: this assumes the function's signature is\n\n\t//\tf(SDL_RWops *rwops, int freesrc, Args ... args)\n\n\t// Meaning any extra argument that the function takes has to go\n\n\t// after the rwops pointer (otherwise, use std::bind or a lambda).\n\n\t// freesrc is assumed to mean whether or not rwops should be freed,\n\n\t// and 0 means it shouldn't.\n\n\ttemplate<typename F, typename ... Args>\n\n\tstatic auto load(const RWops& rwops, F f, const char *errorMsg,\n\n\t\tArgs&& ... args)\n\n\t-> decltype(CStyleAlloc<Deleter>::alloc(std::declval<F>(),\n\n\t\tstd::declval<const char*>(), std::declval<SDL_RWops*>(),\n\n\t\tstd::declval<int>(), std::declval<Args>()...))\n\n\t{\n\n\t\treturn CStyleAlloc<Deleter>::alloc(f, errorMsg,\n\n\t\t\trwops.rwops_.get(), 0, std::forward<Args>(args)...);\n\n\t}\n\n};\n\n\n\nRWops::RWops(const char *filename, const char *mode)\n", "file_path": "include/rwops.hpp", "rank": 15, "score": 66569.07115603215 }, { "content": "class RWops {\n\n\ttemplate <typename Deleter> friend struct FromRWops; // defined below\n\npublic:\n\n\tRWops(const char *filename, const char *mode); // fromFile\n\n\tRWops(void *memory, int size); // fromMem\n\n\tRWops(const void *memory, int size); // fromConstMem\n\n\n\n\t// custom SDL_RWops.\n\n\t// Notes:\n\n\t// - Doesn't work with lambdas, since SDL wants function pointers\n\n\t// - Doesn't work with member functions, since their prototype is\n\n\t// different, but you may wrap them around free functions\n\n\t// (by putting a pointer to the object in one of the data fields)\n\n\t// - Make sure your close() calls SDL_FreeRW(), because this is\n\n\t// allocated with SDL_AllocRW()\n\n\t// - Make sure whatever the data fields point to isn't deleted while\n\n\t// this object exists. You could do that by making close()\n\n\t// responsible for deallocating what they point to, but if you do\n\n\t// that and the ctor throws, the dtor will never be called\n\n\t// (hence, neither will close()) and you'll have a memory leak.\n", "file_path": "include/rwops.hpp", "rank": 16, "score": 66569.07115603215 }, { "content": "#ifdef HAVE_SDL_TTF\n\nclass TrueTypeFont;\n\n#endif\n\n\n", "file_path": "include/surface.hpp", "rank": 17, "score": 64394.69494981236 }, { "content": "class TrueTypeFont;\n", "file_path": "include/texture.hpp", "rank": 18, "score": 64394.69494981236 }, { "content": "class TrueTypeFont {\n\n\tfriend class Surface;\n\npublic:\n\n\tTrueTypeFont(const char *path, int size);\n\n\n\n\tTrueTypeFont(const TrueTypeFont &that) = delete;\n\n\tTrueTypeFont(TrueTypeFont &&that) = default;\n\n\t~TrueTypeFont() = default;\n\n\tTrueTypeFont& operator=(TrueTypeFont that)\n\n\t{\n\n\t\tswap(*this, that);\n\n\t\treturn *this;\n\n\t}\n\n\tfriend void swap(TrueTypeFont &first, TrueTypeFont &second) noexcept\n\n\t{\n\n\t\tusing std::swap;\n\n\t\tswap(first.font_, second.font_);\n\n\t}\n\n\n\n\tstruct Deleter {\n", "file_path": "include/truetypefont.hpp", "rank": 19, "score": 64394.69494981236 }, { "content": "\t\treturn false;\n\n\t}\n\n\treturn true;\n\n}\n\n\n\nvoid quit()\n\n{\n\n\tSDL_Quit();\n\n}\n\n\n\n// returns -1 if c isn't found; otherwise, returns the offset in bytes\n\n// between the beginning of the memory and the byte\n\nSint64 findAndMarkByte(SDL::RWops &memory, int c)\n\n{\n\n\tchar buffer[BUFFER_SIZE];\n\n\tSint64 offset = -1;\n\n\tsize_t bytesRead;\n\n\n\n\tdo {\n\n\t\tSint64 memLastPos = memory.tell();\n", "file_path": "tests/rwops/fromMemory/main.cpp", "rank": 20, "score": 59983.55543928084 }, { "content": "\t\tbytesRead = memory.read(buffer, sizeof(char), BUFFER_SIZE);\n\n\n\n\t\t// we can't use strchr() because buffer isn't null terminated\n\n\t\tchar *byteFirstMatch = static_cast<char*>(memchr(buffer, c,\n\n\t\t\tBUFFER_SIZE));\n\n\t\tif(byteFirstMatch != NULL) {\n\n\t\t\toffset = memLastPos + (byteFirstMatch - buffer);\n\n\t\t\t*byteFirstMatch = 0xff; // \"mark\" char\n\n\n\n\t\t\t// go back and write buffer, with the marked char\n\n\t\t\tmemory.seek(memLastPos, RW_SEEK_SET);\n\n\t\t\tmemory.write(buffer, sizeof(char), BUFFER_SIZE);\n\n\t\t\tbreak;\n\n\t\t}\n\n\t} while(bytesRead == BUFFER_SIZE);\n\n\n\n\tmemory.seek(0, RW_SEEK_SET); // rewind\n\n\treturn offset;\n\n}\n\n\n", "file_path": "tests/rwops/fromMemory/main.cpp", "rank": 21, "score": 59976.51794837321 }, { "content": "\t\t}\n\n\t}\n\n\treturn quit;\n\n}\n\n\n\nvoid test()\n\n{\n\n\tSDL::RWops memory(mem, sizeof(mem));\n\n\tbool quit = true;\n\n\tdo {\n\n\t\tint byteChosen = askForByte();\n\n\t\tSint64 offset = findAndMarkByte(memory, byteChosen);\n\n\t\tif(offset >= 0) {\n\n\t\t\tstd::cout << \"Byte \" << std::setbase(16) << byteChosen\n\n\t\t\t\t<< std::setbase(10) << \" found at offset \"\n\n\t\t\t\t<< offset << std::endl;\n\n\t\t} else {\n\n\t\t\tstd::cout << \"Byte \" << std::setbase(16) << byteChosen\n\n\t\t\t\t<< std::setbase(10) << \" not found.\"\n\n\t\t\t\t<< std::endl;\n", "file_path": "tests/rwops/fromMemory/main.cpp", "rank": 22, "score": 59976.24350156953 }, { "content": "\n\n#include <iostream>\n\n#include <SDL.h>\n\n#include \"rwops.hpp\"\n\n\n\nconst int ERR_SDL_INIT = -1;\n\n\n\nconst int BUFFER_SIZE = 64;\n\n\n\n// This file will be read from, and won't be changed. It could be any file,\n\n// as long as it's ASCII encoded. (Also, I obviously don't own the file)\n\nconst char *fileName = \"sonnet116.txt\";\n\n// This one will be written to, and if it already existed, its previous contents\n\n// will be discarded. You can check if it worked with vim's 'g?' command.\n\nconst char *newFileName = \"sonnet116_rot13.txt\";\n\n\n\nbool init(Uint32 sdlInitFlags)\n\n{\n\n\tif(SDL_Init(sdlInitFlags) < 0) {\n\n\t\treturn false;\n", "file_path": "tests/rwops/fromFile/main.cpp", "rank": 23, "score": 59975.786078260135 }, { "content": "{\n\n\tchar buffer[BUFFER_SIZE];\n\n\tsize_t charsRead = 0;\n\n\tdo {\n\n\t\tcharsRead = oldFile.read(buffer, sizeof(char), BUFFER_SIZE - 1);\n\n\t\tbuffer[charsRead] = '\\0';\n\n\t\trot13str(buffer);\n\n\t\tnewFile.write(buffer, sizeof(char), charsRead);\n\n\t} while(charsRead == BUFFER_SIZE - 1);\n\n\n\n\toldFile.seek(0, RW_SEEK_SET);\n\n\tnewFile.seek(0, RW_SEEK_SET);\n\n}\n\n\n\nvoid test()\n\n{\n\n\tSDL::RWops file(fileName, \"r\"); // read-only\n\n\tSDL::RWops newFile(newFileName, \"w\"); // write-only\n\n\n\n\tSint64 fileSize = file.size();\n", "file_path": "tests/rwops/fromFile/main.cpp", "rank": 24, "score": 59975.380371787935 }, { "content": "\t}\n\n\treturn true;\n\n}\n\n\n\nvoid quit()\n\n{\n\n\tSDL_Quit();\n\n}\n\n\n\nvoid printFile(SDL::RWops &file)\n\n{\n\n\tchar buffer[BUFFER_SIZE];\n\n\tsize_t charsRead = 0;\n\n\tdo {\n\n\t\tcharsRead = file.read(buffer, sizeof(char), BUFFER_SIZE - 1);\n\n\t\tbuffer[charsRead] = '\\0';\n\n\t\tstd::cout << buffer;\n\n\t} while(charsRead == BUFFER_SIZE - 1);\n\n\n\n\tfile.seek(0, RW_SEEK_SET);\n", "file_path": "tests/rwops/fromFile/main.cpp", "rank": 25, "score": 59973.07580640967 }, { "content": "\n\n#include <iostream>\n\n#include <stdexcept>\n\n#include <SDL.h>\n\n#include \"rwops.hpp\"\n\nusing SDL::RWops;\n\nusing SDL::FromRWops;\n\n\n\nconst int ERR_SDL_INIT = -1;\n\n\n\nchar mem[] = {\n\n\t0, 1, 2, 3\n\n};\n\n\n\nbool init(Uint32 sdlInitFlags)\n\n{\n\n\tif(SDL_Init(sdlInitFlags) < 0) {\n\n\t\treturn false;\n\n\t}\n\n\treturn true;\n", "file_path": "tests/rwops/load/main.cpp", "rank": 26, "score": 59972.78167451257 }, { "content": "\n\n#include <iostream>\n\n#include <iomanip>\n\n#include <string>\n\n#include <cstring>\n\n#include <SDL.h>\n\n#include \"rwops.hpp\"\n\n\n\nconst int ERR_SDL_INIT = -1;\n\nconst int BUFFER_SIZE = 32;\n\n\n\n// 256 bytes from /dev/urandom. Conveniently, none turned out to be 0xff\n\nunsigned char mem[] = {\n\n\t0x1c, 0x83, 0xc1, 0xba, 0xdd, 0x32, 0x75, 0x25, 0x8f, 0x1f, 0xc5, 0xa7,\n\n\t0x09, 0xa1, 0x5c, 0x49, 0x07, 0x8d, 0xc2, 0xd0, 0xae, 0x89, 0x69, 0x66,\n\n\t0xfb, 0xa0, 0x56, 0x03, 0x94, 0x4f, 0x7e, 0x0f, 0x37, 0x17, 0x4c, 0x5c,\n\n\t0xf4, 0x37, 0x63, 0x47, 0x9c, 0xbd, 0xf5, 0xfe, 0x97, 0x86, 0xc1, 0x20,\n\n\t0x63, 0xaa, 0x40, 0x79, 0xf3, 0x77, 0xe2, 0x46, 0x52, 0x68, 0x2d, 0xd2,\n\n\t0x79, 0x85, 0xd8, 0x03, 0x93, 0x88, 0x39, 0xf5, 0xea, 0x74, 0x7e, 0xdb,\n\n\t0x95, 0x3c, 0x03, 0xf0, 0x8f, 0x1c, 0x1f, 0x1d, 0x37, 0xdc, 0x17, 0xbb,\n", "file_path": "tests/rwops/fromMemory/main.cpp", "rank": 27, "score": 59972.066036231394 }, { "content": "\tif(fileSize < 0) {\n\n\t\tstd::cerr << \"RWops::tell() failed.\" << std::endl;\n\n\t\treturn;\n\n\t}\n\n\tstd::cout << \"File size (in bytes): \" << fileSize << std::endl\n\n\t\t<< std::endl;\n\n\n\n\t// test 1: read\n\n\tprintFile(file);\n\n\n\n\t// test 2: write\n\n\trot13File(file, newFile);\n\n}\n\n\n\nint main(int argc, char **argv)\n\n{\n\n\tUint32 sdlFlags = SDL_INIT_VIDEO;\n\n\tif(!init(sdlFlags)) {\n\n\t\tSDL_LogCritical(SDL_LOG_CATEGORY_ERROR,\n\n\t\t\t\"couldn't initialize SDL\\n\");\n\n\t\treturn ERR_SDL_INIT;\n\n\t}\n\n\ttest();\n\n\tquit();\n\n\treturn 0;\n\n}\n", "file_path": "tests/rwops/fromFile/main.cpp", "rank": 28, "score": 59969.12541065607 }, { "content": "}\n\n\n\nvoid quit()\n\n{\n\n\tSDL_Quit();\n\n}\n\n\n\nvoid printRWopsType(SDL_RWops *rwops)\n\n{\n\n\tstd::cout << \"RWops type: \";\n\n\tswitch(rwops->type) {\n\n\tcase SDL_RWOPS_UNKNOWN:\n\n\t\tstd::cout << \"unknown\";\n\n\tbreak;\n\n\tcase SDL_RWOPS_WINFILE:\n\n\t\tstd::cout << \"win32 file\";\n\n\tbreak;\n\n\tcase SDL_RWOPS_STDFILE:\n\n\t\tstd::cout << \"stdio file\";\n\n\tbreak;\n", "file_path": "tests/rwops/load/main.cpp", "rank": 29, "score": 59968.5076153774 }, { "content": "\t\t\tcontinue;\n\n\t\t}\n\n\t\tnumIsValid = true;\n\n\t}\n\n\treturn num;\n\n}\n\n\n\nbool shouldItQuit() {\n\n\tbool quit = true;\n\n\tbool validAnswer = false;\n\n\twhile(!validAnswer) {\n\n\t\tstd::string answer;\n\n\t\tstd::cout << \"continue? (y/n) \";\n\n\t\tstd::cin >> answer;\n\n\t\tif(answer == \"y\") {\n\n\t\t\tquit = false;\n\n\t\t\tvalidAnswer = true;\n\n\t\t} else if(answer == \"n\") {\n\n\t\t\tquit = true;\n\n\t\t\tvalidAnswer = true;\n", "file_path": "tests/rwops/fromMemory/main.cpp", "rank": 30, "score": 59968.21458840683 }, { "content": "// except for 0xff, that's not valid\n\nint askForByte()\n\n{\n\n\tint num;\n\n\tbool numIsValid = false;\n\n\twhile(!numIsValid) {\n\n\t\tstd::string strTyped;\n\n\n\n\t\tstd::cout << \"Type a number between 0x00 and 0xfe: \";\n\n\t\tstd::cin >> strTyped;\n\n\t\ttry {\n\n\t\t\tnum = std::stoi(strTyped, nullptr, 0); // guess base\n\n\t\t} catch(const std::invalid_argument& e) {\n\n\t\t\tstd::cout << \"Format not recognized. Try again.\"\n\n\t\t\t\t<< std::endl;\n\n\t\t\tcontinue;\n\n\t\t}\n\n\t\tif(num < 0x00 || num > 0xfe) {\n\n\t\t\tstd::cout << \"Number is not in the requested interval.\"\n\n\t\t\t\t<< std::endl;\n", "file_path": "tests/rwops/fromMemory/main.cpp", "rank": 31, "score": 59966.254650631236 }, { "content": "\tcase SDL_RWOPS_JNIFILE:\n\n\t\tstd::cout << \"android asset\";\n\n\tbreak;\n\n\tcase SDL_RWOPS_MEMORY:\n\n\t\tstd::cout << \"memory (read-write)\";\n\n\tbreak;\n\n\tcase SDL_RWOPS_MEMORY_RO:\n\n\t\tstd::cout << \"memory (read-only)\";\n\n\tbreak;\n\n\t}\n\n\tstd::cout << std::endl;\n\n}\n\n\n", "file_path": "tests/rwops/load/main.cpp", "rank": 32, "score": 59963.40085356999 }, { "content": "\t\t}\n\n\t\tquit = shouldItQuit();\n\n\t} while(!quit);\n\n}\n\n\n\nint main(int argc, char **argv)\n\n{\n\n\tUint32 sdlFlags = SDL_INIT_VIDEO;\n\n\tif(!init(sdlFlags)) {\n\n\t\tSDL_LogCritical(SDL_LOG_CATEGORY_ERROR,\n\n\t\t\t\"couldn't initialize SDL\\n\");\n\n\t\treturn ERR_SDL_INIT;\n\n\t}\n\n\ttest();\n\n\tquit();\n\n\treturn 0;\n\n}\n", "file_path": "tests/rwops/fromMemory/main.cpp", "rank": 33, "score": 59961.71895559737 }, { "content": "\tRWops rwops(mem, sizeof(mem));\n\n\n\n\t// in both cases, we ignore load's return value\n\n\ttry {\n\n\t\tFromRWops<PseudoDeleter>::load(rwops, pseudoLoad,\n\n\t\t\t\"error: first load throws, but it shouldn't\", 42);\n\n\t} catch(const std::exception &ex) {\n\n\t\tstd::cout << ex.what() << std::endl;\n\n\t}\n\n\n\n\ttry {\n\n\t\tFromRWops<PseudoDeleter>::load(rwops, pseudoLoad,\n\n\t\t\t\"success: second load throws, as it should\", -2);\n\n\t} catch(const std::exception &ex) {\n\n\t\tstd::cout << ex.what() << std::endl;\n\n\t}\n\n}\n\n\n\nint main(int argc, char **argv)\n\n{\n", "file_path": "tests/rwops/load/main.cpp", "rank": 34, "score": 59960.88773087222 }, { "content": "}\n\n\n\n// ASCII characters only\n\ninline void rot13char(char &c)\n\n{\n\n\tif((c >= 'a' && c <= 'm') || (c >= 'A' && c <= 'M')) {\n\n\t\tc += 13;\n\n\t} else if((c >= 'n' && c <= 'z') || (c >= 'N' && c <= 'Z')) {\n\n\t\tc -= 13;\n\n\t}\n\n}\n\n\n\nvoid rot13str(char *s)\n\n{\n\n\tfor(; *s != '\\0'; s++) {\n\n\t\trot13char(*s);\n\n\t}\n\n}\n\n\n\nvoid rot13File(SDL::RWops &oldFile, SDL::RWops &newFile)\n", "file_path": "tests/rwops/fromFile/main.cpp", "rank": 35, "score": 59953.75149379793 }, { "content": "\tUint32 sdlFlags = SDL_INIT_VIDEO;\n\n\tif(!init(sdlFlags)) {\n\n\t\tSDL_LogCritical(SDL_LOG_CATEGORY_ERROR,\n\n\t\t\t\"couldn't initialize SDL\\n\");\n\n\t\treturn ERR_SDL_INIT;\n\n\t}\n\n\ttest();\n\n\tquit();\n\n\treturn 0;\n\n}\n", "file_path": "tests/rwops/load/main.cpp", "rank": 36, "score": 59952.13766753847 }, { "content": "/*\n\n SDL C++ Classes\n\n Copyright (C) 2017-2018 Mateus Carmo M. de F. Barbosa\n\n \n\n This software is provided 'as-is', without any express or implied\n\n warranty. In no event will the authors be held liable for any damages\n\n arising from the use of this software.\n\n \n\n Permission is granted to anyone to use this software for any purpose,\n\n including commercial applications, and to alter it and redistribute it\n\n freely, subject to the following restrictions:\n\n \n\n 1. The origin of this software must not be misrepresented; you must not\n\n claim that you wrote the original software. If you use this software\n\n in a product, an acknowledgment in the product documentation would be\n\n appreciated but is not required.\n\n 2. Altered source versions must be plainly marked as such, and must not be\n\n misrepresented as being the original software.\n\n 3. This notice may not be removed or altered from any source distribution.\n\n*/\n", "file_path": "tests/rwops/fromFile/main.cpp", "rank": 37, "score": 59947.374090099605 }, { "content": "/*\n\n SDL C++ Classes\n\n Copyright (C) 2017-2018 Mateus Carmo M. de F. Barbosa\n\n \n\n This software is provided 'as-is', without any express or implied\n\n warranty. In no event will the authors be held liable for any damages\n\n arising from the use of this software.\n\n \n\n Permission is granted to anyone to use this software for any purpose,\n\n including commercial applications, and to alter it and redistribute it\n\n freely, subject to the following restrictions:\n\n \n\n 1. The origin of this software must not be misrepresented; you must not\n\n claim that you wrote the original software. If you use this software\n\n in a product, an acknowledgment in the product documentation would be\n\n appreciated but is not required.\n\n 2. Altered source versions must be plainly marked as such, and must not be\n\n misrepresented as being the original software.\n\n 3. This notice may not be removed or altered from any source distribution.\n\n*/\n", "file_path": "tests/rwops/fromMemory/main.cpp", "rank": 38, "score": 59947.374090099605 }, { "content": "/*\n\n SDL C++ Classes\n\n Copyright (C) 2017-2018 Mateus Carmo M. de F. Barbosa\n\n \n\n This software is provided 'as-is', without any express or implied\n\n warranty. In no event will the authors be held liable for any damages\n\n arising from the use of this software.\n\n \n\n Permission is granted to anyone to use this software for any purpose,\n\n including commercial applications, and to alter it and redistribute it\n\n freely, subject to the following restrictions:\n\n \n\n 1. The origin of this software must not be misrepresented; you must not\n\n claim that you wrote the original software. If you use this software\n\n in a product, an acknowledgment in the product documentation would be\n\n appreciated but is not required.\n\n 2. Altered source versions must be plainly marked as such, and must not be\n\n misrepresented as being the original software.\n\n 3. This notice may not be removed or altered from any source distribution.\n\n*/\n", "file_path": "tests/rwops/load/main.cpp", "rank": 39, "score": 59947.374090099605 }, { "content": "\t0x37, 0xcf, 0x9c, 0xb2, 0x8b, 0x25, 0xb3, 0xed, 0xe5, 0x5a, 0x0f, 0x6f,\n\n\t0x2d, 0x1d, 0xb7, 0x64, 0x16, 0x78, 0xcf, 0x34, 0x27, 0xb2, 0x2c, 0xce,\n\n\t0x26, 0xf2, 0x3c, 0xdf, 0xd5, 0xd7, 0x7f, 0x96, 0xed, 0x78, 0xec, 0xc2,\n\n\t0xa0, 0xf2, 0x6c, 0xfd, 0xb0, 0x24, 0x55, 0x11, 0xcd, 0x81, 0x4a, 0x73,\n\n\t0xad, 0x37, 0x31, 0xa5, 0x43, 0xfb, 0xc5, 0x24, 0xbe, 0x80, 0x1c, 0xe0,\n\n\t0xe9, 0x77, 0x83, 0x71, 0xe7, 0x4c, 0xc5, 0x91, 0x5c, 0xf6, 0xd2, 0x71,\n\n\t0x19, 0xcb, 0x40, 0xf0, 0x49, 0x91, 0x0e, 0x24, 0x6c, 0x7c, 0x5d, 0x1d,\n\n\t0x78, 0x77, 0x94, 0x4f, 0x1d, 0x6f, 0xfe, 0x4d, 0xe3, 0x4a, 0x95, 0xad,\n\n\t0x28, 0x11, 0xd7, 0x9e, 0x48, 0x7f, 0x47, 0xdd, 0xde, 0x9f, 0x36, 0x04,\n\n\t0xf5, 0x2f, 0xd4, 0xc4, 0x2b, 0x15, 0x5c, 0x86, 0xab, 0x4c, 0x5f, 0xa1,\n\n\t0x5c, 0xfc, 0x0c, 0x34, 0xdb, 0x9d, 0x06, 0x95, 0x86, 0xba, 0xb9, 0x2b,\n\n\t0x84, 0xf2, 0x8f, 0xd8, 0xf3, 0x89, 0x01, 0x69, 0xb9, 0x17, 0xf2, 0x4c,\n\n\t0xae, 0x3d, 0xf6, 0xc3, 0xf6, 0x3c, 0x72, 0x82, 0x28, 0xfc, 0xd7, 0x79,\n\n\t0x17, 0xa4, 0x41, 0x64, 0xc9, 0xae, 0x21, 0xbb, 0x22, 0x87, 0xe0, 0x6a,\n\n\t0x7d, 0xa0, 0x29, 0x4d\n\n};\n\n\n\nbool init(Uint32 sdlInitFlags)\n\n{\n\n\tif(SDL_Init(sdlInitFlags) < 0) {\n", "file_path": "tests/rwops/fromMemory/main.cpp", "rank": 40, "score": 59946.55897659107 }, { "content": "{\n\n\tconst int windowWidth = Window::DEFAULT_WIDTH;\n\n\tconst int windowHeight = Window::DEFAULT_HEIGHT;\n\n\n\n\tWindow window(\"test\", windowWidth, windowHeight,\n\n\t\tSDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,\n\n\t\tSDL_WINDOW_RESIZABLE);\n\n\twindow.makeRenderer();\n\n\n\n\tint logicalWidth = 100;\n\n\tint logicalHeight = 100;\n\n\tconst SDL_Rect rect{0, 0, windowWidth, windowHeight};\n\n\n\n\twindow.renderer->setLogicalSize(logicalWidth, logicalHeight);\n\n\n\n\tbool quit = false;\n\n\twhile(!quit) {\n\n\t\tSDL_Event e;\n\n\t\twhile(SDL_PollEvent(&e)) {\n\n\t\t\tif(e.type == SDL_QUIT) {\n", "file_path": "tests/renderer/logicalSize/main.cpp", "rank": 41, "score": 58055.83318688708 }, { "content": "\n\n#include <SDL.h>\n\n#include \"window.hpp\"\n\n#include \"renderer.hpp\"\n\nusing SDL::Window;\n\nusing SDL::Renderer;\n\n\n\nconst int ERR_SDL_INIT = -1;\n\n\n\nbool init(Uint32 sdlInitFlags)\n\n{\n\n\treturn SDL_Init(sdlInitFlags) == 0;\n\n}\n\n\n\nvoid quit()\n\n{\n\n\tSDL_Quit();\n\n}\n\n\n\nvoid gameLoop()\n", "file_path": "tests/renderer/logicalSize/main.cpp", "rank": 42, "score": 58052.64143072818 }, { "content": "\t\t\t\tquit = true;\n\n\t\t\t} else if(e.type == SDL_KEYDOWN) {\n\n\t\t\t}\n\n\t\t}\n\n\t\twindow.renderer->setDrawColor(0x00, 0x00, 0x00, 0xff);\n\n\t\twindow.renderer->clear();\n\n\n\n\t\twindow.renderer->setDrawColor(0xff, 0x00, 0x00, 0xff);\n\n\t\t// the red portion should always appear as a square, regardless\n\n\t\t// of the window's dimensions\n\n\t\twindow.renderer->fillRect(&rect);\n\n\n\n\t\twindow.renderer->present();\n\n\t}\n\n}\n\n\n\nint main(int argc, char **argv)\n\n{\n\n\tif(!init(SDL_INIT_VIDEO)) {\n\n\t\tSDL_LogCritical(SDL_LOG_CATEGORY_ERROR,\n\n\t\t\t\"couldn't initialize SDL\\n\");\n\n\t\treturn ERR_SDL_INIT;\n\n\t}\n\n\tgameLoop();\n\n\tquit();\n\n\treturn 0;\n\n}\n", "file_path": "tests/renderer/logicalSize/main.cpp", "rank": 43, "score": 58046.52541626246 }, { "content": "/*\n\n SDL C++ Classes\n\n Copyright (C) 2017-2018 Mateus Carmo M. de F. Barbosa\n\n \n\n This software is provided 'as-is', without any express or implied\n\n warranty. In no event will the authors be held liable for any damages\n\n arising from the use of this software.\n\n \n\n Permission is granted to anyone to use this software for any purpose,\n\n including commercial applications, and to alter it and redistribute it\n\n freely, subject to the following restrictions:\n\n \n\n 1. The origin of this software must not be misrepresented; you must not\n\n claim that you wrote the original software. If you use this software\n\n in a product, an acknowledgment in the product documentation would be\n\n appreciated but is not required.\n\n 2. Altered source versions must be plainly marked as such, and must not be\n\n misrepresented as being the original software.\n\n 3. This notice may not be removed or altered from any source distribution.\n\n*/\n", "file_path": "tests/renderer/logicalSize/main.cpp", "rank": 44, "score": 58034.076078362625 }, { "content": "struct PseudoDeleter {\n\n\tvoid operator()(char *) {}\n\n};\n\n\n\n// has to return the same type that PseudoDeleter::operator() recieves\n\nchar * pseudoLoad(SDL_RWops *rwops, int freesrc, int extraArg)\n\n{\n\n\tif(freesrc != 0) {\n\n\t\tstd::cout << \"error: non-zero freesrc!\" << std::endl;\n\n\t}\n\n\tprintRWopsType(rwops);\n\n\tstd::cout << \"extra argument: \" << extraArg << std::endl;\n\n\tif(extraArg < 0) {\n\n\t\treturn NULL;\n\n\t}\n\n\treturn mem; // could be any non-null char*\n\n}\n\n\n\nvoid test()\n\n{\n", "file_path": "tests/rwops/load/main.cpp", "rank": 53, "score": 55170.94382026842 }, { "content": "\t\tvoid operator()(TTF_Font *font) { TTF_CloseFont(font); }\n\n\t};\n\nprivate:\n\n\tstd::unique_ptr<TTF_Font, Deleter> font_;\n\n};\n\n\n\nTrueTypeFont::TrueTypeFont(const char *path, int size)\n\n\t: font_{CStyleAlloc<TrueTypeFont::Deleter>::alloc(TTF_OpenFont,\n\n\t\t\"Making TrueTypeFont failed\", path, size)}\n\n{}\n\n\n\n} // namespace SDL\n\n\n\n#endif\n", "file_path": "include/truetypefont.hpp", "rank": 54, "score": 35992.27784367891 }, { "content": "\tvoid getLogicalSize(int *w, int *h) const\n\n\t{\n\n\t\tSDL_RenderGetLogicalSize(renderer_.get(), w, h);\n\n\t}\n\n\tbool setLogicalSize(int w, int h)\n\n\t{\n\n\t\treturn SDL_RenderSetLogicalSize(renderer_.get(), w, h) >= 0;\n\n\t}\n\n\n\n\tbool getOutputSize(int *w, int *h) const\n\n\t{\n\n\t\treturn SDL_GetRendererOutputSize(renderer_.get(), w, h) >= 0;\n\n\t}\n\n\tbool getInfo(SDL_RendererInfo *info) const\n\n\t{\n\n\t\treturn SDL_GetRendererInfo(renderer_.get(), info) >= 0;\n\n\t}\n\n\n\n\t// \"used for drawing operations (Fill and Line)\" (SDL wiki)\n\n\tbool setDrawBlendMode(SDL_BlendMode mode)\n", "file_path": "include/renderer.hpp", "rank": 55, "score": 35990.76061364734 }, { "content": "\n\n\t// SDL_GetWindowSize(). You may pass NULL as a parameter if you're not\n\n\t// interested in its value, though you can also use getWidth() or\n\n\t// getHeight() in that case\n\n\tvoid getSize(int *width, int *height) const\n\n\t{\n\n\t\tSDL_GetWindowSize(window_.get(), width, height);\n\n\t}\n\n\n\n\t// wrappers around SDL_GetWindowSize(), but they return the value.\n\n\tint getWidth() const;\n\n\tint getHeight() const;\n\n\n\n\t// again, you may pass NULL if you don't want a value.\n\n\tvoid getDrawableSize(int *width, int *height)\n\n\t{\n\n\t\tSDL_GL_GetDrawableSize(window_.get(), width, height);\n\n\t}\n\n\n\n\tUint32 getID() { return SDL_GetWindowID(window_.get()); }\n", "file_path": "include/window.hpp", "rank": 56, "score": 35989.83718982832 }, { "content": "\t\tSDL_Color color);\n\n#endif\n\n\n\n\t// Wrapper around SDL_QueryTexture(). You can pass NULL for parameters\n\n\t// you're not interested in.\n\n\tint query(Uint32 *format, int *access, int *w, int *h) const\n\n\t{\n\n\t\treturn SDL_QueryTexture(texture_.get(), format, access, w, h);\n\n\t}\n\n\n\n\t// convenience wrappers around query(); they return by value instead.\n\n\t// Errors are ignored.\n\n\tint getWidth() const;\n\n\tint getHeight() const;\n\n\n\n\t// warning:\n\n\t// as SDL documentation states, the data in pixels is not necessarily\n\n\t// meaningful; you're supposed to write to it, not to read from it.\n\n\tbool lock(const SDL_Rect *rect, void **pixels, int *pitch)\n\n\t{\n", "file_path": "include/texture.hpp", "rank": 57, "score": 35987.01240457806 }, { "content": "\n\n#ifdef HAVE_SDL_IMAGE\n\nTexture::Texture(SDL_Renderer *renderer, const char *imagePath)\n\n\t: Texture(renderer, RWops(imagePath, \"rb\"))\n\n{}\n\n\n\nTexture::Texture(SDL_Renderer *renderer, const RWops &image)\n\n\t: texture_{FromRWops<Texture::Deleter>::load(image,\n\n\t\t[](SDL_RWops *rwops, int freesrc, SDL_Renderer *renderer)\n\n\t\t-> SDL_Texture*\n\n\t\t{\n\n\t\t\treturn IMG_LoadTexture_RW(renderer, rwops, freesrc);\n\n\t\t}\n\n\t\t, \"Making texture from image failed\", renderer)}\n\n{}\n\n#endif\n\n\n\n#ifdef HAVE_SDL_TTF\n\n// unfortunately, SDL_ttf has no function to load to a texture directly\n\nTexture::Texture(SDL_Renderer *renderer, const char *text, TrueTypeFont &font,\n", "file_path": "include/texture.hpp", "rank": 58, "score": 35986.53808653922 }, { "content": "\tstatic void pause() { Mix_PauseMusic(); }\n\n\tstatic void resume() { Mix_ResumeMusic(); }\n\n\tstatic void rewind() { Mix_RewindMusic(); }\n\n\n\n\tstatic bool isPaused() { return Mix_PausedMusic(); }\n\n\tstatic bool isPlaying() { return Mix_PlayingMusic(); }\n\n\n\n\tstatic int setVolume(int volume) { return Mix_VolumeMusic(volume); }\n\n\tstatic int getVolume() { return setVolume(-1); }\n\n\n\n\tstatic int setPosition(double position)\n\n\t{\n\n\t\treturn Mix_SetMusicPosition(position);\n\n\t}\n\n\n\n\tMusic(const Music &that) = delete;\n\n\tMusic(Music &&that) = default;\n\n\t~Music() = default;\n\n\tMusic & operator=(Music that) { swap(*this, that); return *this; }\n\n\tfriend void swap(Music &first, Music &second) noexcept\n", "file_path": "include/music.hpp", "rank": 59, "score": 35986.50373161012 }, { "content": "\n\nWindow::Window(const char *title, int width, int height, int x, int y,\n\n\tUint32 flags)\n\n\t: window_{CStyleAlloc<Window::Deleter>::alloc(SDL_CreateWindow,\n\n\t\t\"Making window failed\", title, x, y, width, height, flags)}\n\n{}\n\n\n\nint Window::getWidth() const\n\n{\n\n\tint width;\n\n\tSDL_GetWindowSize(window_.get(), &width, NULL);\n\n\treturn width;\n\n}\n\n\n\nint Window::getHeight() const\n\n{\n\n\tint height;\n\n\tSDL_GetWindowSize(window_.get(), NULL, &height);\n\n\treturn height;\n\n}\n\n\n\n} // namespace SDL\n\n\n\n#endif\n", "file_path": "include/window.hpp", "rank": 60, "score": 35985.27476825038 }, { "content": "\t\treturn Surface(image, FromImage::dummy);\n\n\t}\n\n#endif\n\n\n\n#ifdef HAVE_SDL_TTF\n\n\tstatic Surface fromText(const char *text, TrueTypeFont &font,\n\n\t\tSDL_Color color)\n\n\t{\n\n\t\treturn Surface(text, font, color);\n\n\t}\n\n#endif\n\n\tfriend bool blit(Surface &src, Surface &dest,\n\n\t\tconst SDL_Rect *srcRect = NULL, SDL_Rect *destRect = NULL)\n\n\t{\n\n\t\treturn SDL_BlitSurface(src.surface_.get(), srcRect,\n\n\t\t\tdest.surface_.get(), destRect) >= 0;\n\n\t}\n\n\tfriend bool blitScaled(Surface &src, Surface &dest,\n\n\t\tconst SDL_Rect *srcRect = NULL, SDL_Rect *destRect = NULL)\n\n\t{\n", "file_path": "include/surface.hpp", "rank": 61, "score": 35983.82226997811 }, { "content": "\t\treturn SDL_BlitScaled(src.surface_.get(), srcRect,\n\n\t\t\tdest, destRect) >= 0;\n\n\t}\n\n\tfriend bool blitScaled(SDL_Surface *src, Surface &dest,\n\n\t\tconst SDL_Rect *srcRect = NULL, SDL_Rect *destRect = NULL)\n\n\t{\n\n\t\treturn SDL_BlitScaled(src, srcRect,\n\n\t\t\tdest.surface_.get(), destRect) >= 0;\n\n\t}\n\n\n\n\tint getWidth() const { return surface_->w; }\n\n\tint getHeight() const { return surface_->h; }\n\n\tint getPitch() const { return surface_->pitch; }\n\n\tvoid *getPixels() const { return surface_->pixels; }\n\n\tUint32 getPixelFormat() const { return surface_->format->format; }\n\n\n\n\tSurface(const Surface &that) = delete;\n\n\tSurface(Surface &&that) = default;\n\n\t~Surface() = default;\n\n\tSurface & operator=(Surface that) { swap(*this, that); return *this; }\n", "file_path": "include/surface.hpp", "rank": 62, "score": 35983.185465563314 }, { "content": "\t// ill-formed (e.g. when F is not a callable type at all). C++14 changes\n\n\t// that to a SFINAE\"\n\n\t// (<en.cppreference.com/w/cpp/types/result_of>)\n\n\t//\n\n\t// Lo, and behold: C++ templates in all their majesty!\n\n\t//\n\n\ttemplate<typename F, typename ... Args>\n\n\tstatic auto alloc(F f, const char *errorMsg, Args&& ... args)\n\n\t-> std::unique_ptr<\n\n\t\ttypename std::remove_pointer<\n\n\t\t\ttypename std::result_of<F(Args&&...)>::type\n\n\t\t>::type // T\n\n\t\t, Deleter\n\n\t>\n\n\t{\n\n\t\tauto tmp = f(std::forward<Args>(args)...);\n\n\t\tstatic_assert(std::is_pointer<decltype(tmp)>::value,\n\n\t\t\t\"CStyleAlloc: f must return a pointer\");\n\n\t\tif(tmp == NULL) {\n\n\t\t\tthrow std::runtime_error(errorMsg);\n", "file_path": "include/cstylealloc.hpp", "rank": 63, "score": 35982.56408986017 }, { "content": "\tstatic int halt(int which) { return Mix_HaltChannel(which); }\n\n\tstatic int haltGroup(int tag) { return Mix_HaltGroup(tag); }\n\n\n\n\tstatic int expireChannel(int which, int ticks)\n\n\t{\n\n\t\treturn Mix_ExpireChannel(which, ticks);\n\n\t}\n\n\n\n\tstatic int fadeOut(int which, int ms)\n\n\t{\n\n\t\treturn Mix_FadeOutChannel(which, ms);\n\n\t}\n\n\tstatic int fadeOutGroup(int tag, int ms)\n\n\t{\n\n\t\treturn Mix_FadeOutGroup(tag, ms);\n\n\t}\n\n\tstatic bool isFading(int which) { return Mix_FadingChannel(which); }\n\n\n\n\tstatic void pause(int which) { Mix_Pause(which); }\n\n\tstatic void resume(int which) { Mix_Resume(which); }\n\n\n\n\tstatic bool isPaused(int which) { return Mix_Paused(which); }\n\n\tstatic bool isPlaying(int which) { return Mix_Playing(which); }\n\n};\n\n\n\n} // namespace SDL\n\n\n\n#endif\n", "file_path": "include/audiochannels.hpp", "rank": 64, "score": 35981.68074388703 }, { "content": "\t}\n\n\tbool getDrawColor(Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) const\n\n\t{\n\n\t\treturn SDL_GetRenderDrawColor(renderer_.get(), r, g, b, a) >= 0;\n\n\t}\n\n\n\n\t// Remember:\n\n\t// - you can only render a texture with the renderer that created it\n\n\t// - you need to call present() when you're done rendering!\n\n\n\n\t// renders a part or the entire texture with its own width and height,\n\n\t// using SDL_RenderCopy().\n\n\t// (x, y): top-left coordinates\n\n\t// src: the portion of the texture to be copied, NULL for whole texture\n\n\tbool render(Texture &texture, int x, int y,\n\n\t\tconst SDL_Rect *src = NULL) const;\n\n\n\n\t// SDL_RenderCopy()\n\n\tbool render(Texture &texture, const SDL_Rect *src = NULL,\n\n\t\tconst SDL_Rect *dest = NULL) const\n", "file_path": "include/renderer.hpp", "rank": 65, "score": 35981.385767919164 }, { "content": "\t{\n\n\t\treturn SDL_SetRenderDrawBlendMode(renderer_.get(), mode) >= 0;\n\n\t}\n\n\tbool getDrawBlendMode(SDL_BlendMode *mode) const\n\n\t{\n\n\t\treturn SDL_GetRenderDrawBlendMode(renderer_.get(), mode) >= 0;\n\n\t}\n\n\n\n\tbool drawPoint(int x, int y) const\n\n\t{\n\n\t\treturn SDL_RenderDrawPoint(renderer_.get(), x, y) >= 0;\n\n\t}\n\n\tbool drawPoints(const std::vector<SDL_Point> points) const\n\n\t{\n\n\t\tif(points.empty()) { return false; }\n\n\t\treturn SDL_RenderDrawPoints(renderer_.get(), points.data(),\n\n\t\t\tpoints.size()) >= 0;\n\n\t}\n\n\n\n\tbool drawLine(int x1, int y1, int x2, int y2) const\n", "file_path": "include/renderer.hpp", "rank": 66, "score": 35980.981935762466 }, { "content": "\n\n#ifndef SCC_SURFACE_HPP\n\n#define SCC_SURFACE_HPP\n\n\n\n#include <memory>\n\n#include \"null.hpp\"\n\n#include \"cstylealloc.hpp\"\n\n#include \"rwops.hpp\"\n\n\n\n#ifdef HAVE_SDL_TTF\n\n# include \"truetypefont.hpp\"\n\n#endif\n\n\n\nnamespace SDL {\n\n\n", "file_path": "include/surface.hpp", "rank": 67, "score": 35980.812623520986 }, { "content": "\n\n#ifndef SCC_TEXTURE_HPP\n\n#define SCC_TEXTURE_HPP\n\n\n\n#include <memory>\n\n#include <stdexcept>\n\n#include \"null.hpp\"\n\n#include \"cstylealloc.hpp\"\n\n#include \"rwops.hpp\"\n\n#include \"renderer.hpp\"\n\n#include \"surface.hpp\"\n\n\n\n#ifdef HAVE_SDL_TTF\n\n# include \"truetypefont.hpp\"\n\n#endif\n\n\n\nnamespace SDL {\n\n\n", "file_path": "include/texture.hpp", "rank": 68, "score": 35980.7323242966 }, { "content": "\n\n#ifndef SCC_MUSIC_HPP\n\n#define SCC_MUSIC_HPP\n\n\n\n#include <memory>\n\n#include <stdexcept>\n\n#include \"null.hpp\"\n\n#include \"cstylealloc.hpp\"\n\n#include \"rwops.hpp\"\n\n\n\n#ifndef HAVE_SDL_MIXER\n\n# error \"cannot use Music class without SDL_mixer\"\n\n#endif\n\n\n\nnamespace SDL {\n\n\n", "file_path": "include/music.hpp", "rank": 69, "score": 35980.6521550143 }, { "content": "\n\n#ifndef SCC_AUDIOCHUNK_HPP\n\n#define SCC_AUDIOCHUNK_HPP\n\n\n\n#include <memory>\n\n#include <stdexcept>\n\n#include \"null.hpp\"\n\n#include \"cstylealloc.hpp\"\n\n#include \"rwops.hpp\"\n\n\n\n#ifndef HAVE_SDL_MIXER\n\n# error \"cannot use AudioChunk class without SDL_mixer\"\n\n#endif\n\n\n\nnamespace SDL {\n\n\n", "file_path": "include/audiochunk.hpp", "rank": 70, "score": 35980.620631477075 }, { "content": "\n\n#ifndef SCC_TRUETYPEFONT_HPP\n\n#define SCC_TRUETYPEFONT_HPP\n\n\n\n#include <memory>\n\n#include <stdexcept>\n\n#include \"null.hpp\"\n\n#include \"cstylealloc.hpp\"\n\n\n\n#ifndef HAVE_SDL_TTF\n\n# error \"can't use TrueTypeFont without SDL_ttf\"\n\n#endif\n\n\n\nnamespace SDL {\n\n\n", "file_path": "include/truetypefont.hpp", "rank": 71, "score": 35980.49891345648 }, { "content": "Renderer::Renderer(SDL_Window *window, Uint32 flags)\n\n\t: renderer_{CStyleAlloc<Renderer::Deleter>::alloc(SDL_CreateRenderer,\n\n\t\t\"Making renderer failed\", window, -1, flags)}\n\n{}\n\n\n\nbool Renderer::render(Texture &texture, int x, int y, const SDL_Rect *src) const\n\n{\n\n\tSDL_Rect dest;\n\n\tdest.x = x;\n\n\tdest.y = y;\n\n\ttexture.query(NULL, NULL, &dest.w, &dest.h);\n\n\n\n\treturn SDL_RenderCopy(renderer_.get(), texture.texture_.get(),\n\n\t\tsrc, &dest) >= 0;\n\n}\n\n\n\nbool Renderer::setTarget(SDL_Texture *texture)\n\n{\n\n\t// \"Before using this function, you should check the\n\n\t// SDL_RENDERER_TARGETTEXTURE bit in the flags of SDL_RendererInfo to\n", "file_path": "include/renderer.hpp", "rank": 72, "score": 35980.403554515586 }, { "content": "\tUint32 getFlags() { return SDL_GetWindowFlags(window_.get()); }\n\n\n\n\tvoid setTitle(const char *title)\n\n\t{\n\n\t\tSDL_SetWindowTitle(window_.get(), title);\n\n\t}\n\n\tconst char *getTitle() { return SDL_GetWindowTitle(window_.get()); }\n\n\n\n\tvoid show() { SDL_ShowWindow(window_.get()); }\n\n\tvoid hide() { SDL_HideWindow(window_.get()); }\n\n\n\n\tvoid raise() { SDL_RaiseWindow(window_.get()); }\n\n\n\n\tvoid maximize() { SDL_MaximizeWindow(window_.get()); }\n\n\tvoid minimize() { SDL_MinimizeWindow(window_.get()); }\n\n\tvoid restore() { SDL_RestoreWindow(window_.get()); }\n\n\tbool setFullscreen(Uint32 flags)\n\n\t{\n\n\t\treturn SDL_SetWindowFullscreen(window_.get(), flags) >= 0;\n\n\t}\n", "file_path": "include/window.hpp", "rank": 73, "score": 35980.20036580169 }, { "content": "\t}\n\n\n\n\tbool setBlendMode(SDL_BlendMode blendMode)\n\n\t{\n\n\t\treturn SDL_SetTextureBlendMode(texture_.get(), blendMode) >= 0;\n\n\t}\n\n\tbool getBlendMode(SDL_BlendMode *blendMode)\n\n\t{\n\n\t\treturn SDL_GetTextureBlendMode(texture_.get(), blendMode) >= 0;\n\n\t}\n\n\n\n\t// \"You need a renderer to create a SDL_Texture, therefore you can only\n\n\t// use this function with an implicit OpenGL context from\n\n\t// SDL_CreateRenderer(), not with your own OpenGL context.\n\n\t// If you need control over your OpenGL context, you need to write your\n\n\t// own texture-loading methods.\"\n\n\t// <wiki.libsdl.org/SDL_GL_BindTexture>\n\n\t//\n\n\tbool bind(float *w = NULL, float *h = NULL)\n\n\t{\n", "file_path": "include/texture.hpp", "rank": 74, "score": 35979.92833775643 }, { "content": "\n\n\tbool setScale(float scaleX, float scaleY)\n\n\t{\n\n\t\treturn SDL_RenderSetScale(renderer_.get(), scaleX, scaleY) >= 0;\n\n\t}\n\n\tvoid getScale(float *scaleX, float *scaleY) const\n\n\t{\n\n\t\tSDL_RenderGetScale(renderer_.get(), scaleX, scaleY);\n\n\t}\n\n\n\n\tvoid getViewport(SDL_Rect *rect) const\n\n\t{\n\n\t\tSDL_RenderGetViewport(renderer_.get(), rect);\n\n\t}\n\n\tbool setViewport(const SDL_Rect *rect)\n\n\t{\n\n\t\tif(rect == nullptr) { rect = NULL; }\n\n\t\treturn SDL_RenderSetViewport(renderer_.get(), rect) >= 0;\n\n\t}\n\n\n", "file_path": "include/renderer.hpp", "rank": 75, "score": 35979.665701011305 }, { "content": "private:\n\n\t// since this type is a typedef to void*, we can't use std::unique_ptr\n\n\t// (I think), but we don't use this knowledge in this class; instead,\n\n\t// we treat it like any non-opaque type\n\n\tSDL_GLContext context_;\n\n\t// since we're not using std::unique_ptr, it's convenient to have\n\n\t// an empty ctor to implement the move ctor.\n\n\t// I don't want users to be able to instantiate an empty object, though,\n\n\t// so this ctor has been made private.\n\n\tGLContext() : context_(NULL) {}\n\n};\n\n\n\n} // namespace SDL\n\n\n\n#endif\n", "file_path": "include/glcontext.hpp", "rank": 76, "score": 35979.63298995802 }, { "content": "\n\n#ifndef SCC_CSTYLEALLOC_HPP\n\n#define SCC_CSTYLEALLOC_HPP\n\n\n\n#include <memory>\n\n#include <stdexcept>\n\n#include <utility>\n\n#include <type_traits>\n\n\n\nnamespace SDL {\n\n\n\n// This is meant for SCC internal use, but you can use it as well.\n\n// It gaps the bridge between C and C++ allocators.\n\n// The function it recieves as parameter should try to allocate memory, and\n\n// return NULL (ie, 0) in case of failure.\n\n//\n\n// Notes:\n\n// - you can only use this with actual functions, not with macros like\n\n// SDL_LoadBMP (use the *_RW counterpart instead)\n\n// - the Deleter type cannot be automatically deduced, which is why it's\n\n// been put in a template class, but all other types can, which is why they've\n\n// been put in the template function\n\n//\n\ntemplate <typename Deleter>\n", "file_path": "include/cstylealloc.hpp", "rank": 77, "score": 35979.53319375261 }, { "content": "\tSDL_Color color) : Texture(renderer, Surface(text, font, color))\n\n{}\n\n#endif\n\n\n\nint Texture::getWidth() const\n\n{\n\n\tint width;\n\n\tSDL_QueryTexture(texture_.get(), NULL, NULL, &width, NULL);\n\n\treturn width;\n\n}\n\n\n\nint Texture::getHeight() const\n\n{\n\n\tint height;\n\n\tSDL_QueryTexture(texture_.get(), NULL, NULL, NULL, &height);\n\n\treturn height;\n\n}\n\n\n\n} // namespace SDL\n\n\n\n#endif\n", "file_path": "include/texture.hpp", "rank": 78, "score": 35977.75138751982 }, { "content": "\t\treturn SDL_BlitScaled(src.surface_.get(), srcRect,\n\n\t\t\tdest.surface_.get(), destRect) >= 0;\n\n\t}\n\n\n\n\t// these overloads are for blitting to the Window's surface\n\n\tfriend bool blit(Surface &src, SDL_Surface *dest,\n\n\t\tconst SDL_Rect *srcRect = NULL, SDL_Rect *destRect = NULL)\n\n\t{\n\n\t\treturn SDL_BlitSurface(src.surface_.get(), srcRect,\n\n\t\t\tdest, destRect) >= 0;\n\n\t}\n\n\tfriend bool blit(SDL_Surface *src, Surface &dest,\n\n\t\tconst SDL_Rect *srcRect = NULL, SDL_Rect *destRect = NULL)\n\n\t{\n\n\t\treturn SDL_BlitSurface(src, srcRect,\n\n\t\t\tdest.surface_.get(), destRect) >= 0;\n\n\t}\n\n\tfriend bool blitScaled(Surface &src, SDL_Surface *dest,\n\n\t\tconst SDL_Rect *srcRect = NULL, SDL_Rect *destRect = NULL)\n\n\t{\n", "file_path": "include/surface.hpp", "rank": 79, "score": 35977.12467356362 }, { "content": "# define HAVE_SDL_IMAGE\n\n#endif\n\n\n\n#ifdef SDL_TTF_MAJOR_VERSION\n\n# define HAVE_SDL_TTF\n\n# include \"truetypefont.hpp\"\n\n#endif\n\n\n\n#ifdef SDL_MIXER_MAJOR_VERSION\n\n# define HAVE_SDL_MIXER\n\n# include \"audiochunk.hpp\"\n\n# include \"audiochannels.hpp\"\n\n# include \"music.hpp\"\n\n#endif\n\n\n\n#include \"glcontext.hpp\"\n\n#include \"renderer.hpp\"\n\n#include \"rect.hpp\"\n\n#include \"rwops.hpp\"\n\n#include \"surface.hpp\"\n\n#include \"texture.hpp\"\n\n#include \"window.hpp\"\n\n\n\n#endif\n", "file_path": "include/scc.hpp", "rank": 80, "score": 35976.56448087112 }, { "content": "\ttemplate <typename ... Args>\n\n\tvoid makeRenderer(Args&& ... args)\n\n\t{\n\n\t\tif(!renderer && !context) {\n\n\t\t\trenderer = std::unique_ptr<Renderer>(new Renderer(\n\n\t\t\t\twindow_.get(), std::forward<Args>(args)...));\n\n\t\t}\n\n\t}\n\n\n\n\t// this not only creates an OpenGL context but also makes it the current\n\n\t// context. Will throw if the window wasn't created with the\n\n\t// SDL_WINDOW_OPENGL flag.\n\n\ttemplate <typename ... Args>\n\n\tvoid makeGLContext(Args&& ... args)\n\n\t{\n\n\t\tif(!renderer && !context) {\n\n\t\t\tcontext = std::unique_ptr<GLContext>(new GLContext(\n\n\t\t\t\twindow_.get(), std::forward<Args>(args)...));\n\n\t\t}\n\n\t}\n", "file_path": "include/window.hpp", "rank": 81, "score": 35976.28094177218 }, { "content": "\t// (SDL wiki)\n\n\t// Because this surface mustn't be freed, it is not and must not\n\n\t// be put in a Surface class.\n\n\tSDL_Surface *getSurface()\n\n\t{\n\n\t\treturn SDL_GetWindowSurface(window_.get());\n\n\t}\n\n\tbool updateSurface()\n\n\t{\n\n\t\treturn SDL_UpdateWindowSurface(window_.get()) >= 0;\n\n\t}\n\n\tbool updateSurfaceRects(const std::vector<SDL_Rect> rects)\n\n\t{\n\n\t\treturn SDL_UpdateWindowSurfaceRects(window_.get(),\n\n\t\t\trects.data(), rects.size()) >= 0;\n\n\t}\n\n\n\n\tbool hasRenderer() { return static_cast<bool>(renderer); }\n\n\tbool hasContext() { return static_cast<bool>(context); }\n\n\n", "file_path": "include/window.hpp", "rank": 82, "score": 35976.249900848095 }, { "content": "\t\tif(rects.empty()) { return false; }\n\n\t\treturn SDL_RenderDrawRects(renderer_.get(), rects.data(),\n\n\t\t\trects.size()) >= 0;\n\n\t}\n\n\n\n\tbool fillRect(const SDL_Rect *rect) const\n\n\t{\n\n\t\treturn SDL_RenderFillRect(renderer_.get(), rect);\n\n\t}\n\n\tbool fillRects(const std::vector<SDL_Rect> rects) const\n\n\t{\n\n\t\tif(rects.empty()) { return false; }\n\n\t\treturn SDL_RenderFillRects(renderer_.get(), rects.data(),\n\n\t\t\trects.size()) >= 0;\n\n\t}\n\n\n\n\t// TODO readPixels(), updateTexture(), setClip(), getClip(),\n\n\t// isClipEnabled()\n\n\n\n\t// renderers must NOT be copied. They belong to 1 window only.\n", "file_path": "include/renderer.hpp", "rank": 83, "score": 35976.22627934971 }, { "content": "\t{\n\n\t\treturn SDL_RenderDrawLine(renderer_.get(), x1, y1, x2, y2);\n\n\t}\n\n\tbool drawLine(const SDL_Point &p1, const SDL_Point &p2) const\n\n\t{\n\n\t\treturn drawLine(p1.x, p1.y, p2.x, p2.y);\n\n\t}\n\n\tbool drawLines(const std::vector<SDL_Point> points) const\n\n\t{\n\n\t\tif(points.empty()) { return false; }\n\n\t\treturn SDL_RenderDrawLines(renderer_.get(), points.data(),\n\n\t\t\tpoints.size()) >= 0;\n\n\t}\n\n\n\n\tbool drawRect(const SDL_Rect *rect) const\n\n\t{\n\n\t\treturn SDL_RenderDrawRect(renderer_.get(), rect) >= 0;\n\n\t}\n\n\tbool drawRects(const std::vector<SDL_Rect> rects) const\n\n\t{\n", "file_path": "include/renderer.hpp", "rank": 84, "score": 35975.89584456896 }, { "content": "\t\t\tticks);\n\n\t}\n\n\t\n\n\tint setVolume(int volume)\n\n\t{\n\n\t\treturn Mix_VolumeChunk(chunk_.get(), volume);\n\n\t}\n\n\tint getVolume() { return setVolume(-1); }\n\n\n\n\tAudioChunk(const AudioChunk &that) = delete;\n\n\tAudioChunk(AudioChunk &&that) = default;\n\n\t~AudioChunk() = default;\n\n\tAudioChunk & operator=(AudioChunk that)\n\n\t{\n\n\t\tswap(*this, that);\n\n\t\treturn *this;\n\n\t}\n\n\tfriend void swap(AudioChunk &first, AudioChunk &second) noexcept\n\n\t{\n\n\t\tusing std::swap;\n", "file_path": "include/audiochunk.hpp", "rank": 85, "score": 35975.85310945686 }, { "content": "\t\treturn SDL_LockTexture(texture_.get(), rect, pixels, pitch) >= 0;\n\n\t}\n\n\tvoid unlock() { SDL_UnlockTexture(texture_.get()); }\n\n\n\n\tbool setColorMod(Uint8 r, Uint8 g, Uint8 b)\n\n\t{\n\n\t\treturn SDL_SetTextureColorMod(texture_.get(), r, g, b) >= 0;\n\n\t}\n\n\tbool getColorMod(Uint8 *r, Uint8 *g, Uint8 *b)\n\n\t{\n\n\t\treturn SDL_GetTextureColorMod(texture_.get(), r, g, b) >= 0;\n\n\t}\n\n\n\n\tbool setAlphaMod(Uint8 alpha)\n\n\t{\n\n\t\treturn SDL_SetTextureAlphaMod(texture_.get(), alpha) >= 0;\n\n\t}\n\n\tbool getAlphaMod(Uint8 *alpha)\n\n\t{\n\n\t\treturn SDL_GetTextureAlphaMod(texture_.get(), alpha) >= 0;\n", "file_path": "include/texture.hpp", "rank": 86, "score": 35975.764755737386 }, { "content": "\tRenderer(const Renderer &that) = delete;\n\n\tRenderer(Renderer &&that) = default; // moving is fine though\n\n\t~Renderer() = default;\n\n\tRenderer & operator=(Renderer that) { swap(*this, that); return *this; }\n\n\tfriend void swap(Renderer &first, Renderer &second) noexcept\n\n\t{\n\n\t\tusing std::swap;\n\n\t\tswap(first.renderer_, second.renderer_);\n\n\t}\n\n\n\n\tstruct Deleter {\n\n\t\tvoid operator()(SDL_Renderer *renderer)\n\n\t\t{\n\n\t\t\tSDL_DestroyRenderer(renderer);\n\n\t\t}\n\n\t};\n\nprivate:\n\n\tstd::unique_ptr<SDL_Renderer, Deleter> renderer_;\n\n};\n\n\n", "file_path": "include/renderer.hpp", "rank": 87, "score": 35975.707552508095 }, { "content": "\t// I don't think SDL has any way of copying windows...\n\n\tWindow(const Window &that) = delete;\n\n\tWindow(Window &&that) = default;\n\n\t~Window() = default;\n\n\tWindow & operator=(Window that) { swap(*this, that); return *this; }\n\n\tfriend void swap(Window &first, Window &second) noexcept\n\n\t{\n\n\t\tusing std::swap;\n\n\t\tswap(first.window_, second.window_);\n\n\t}\n\n\n\n\tstruct Deleter {\n\n\t\tvoid operator()(SDL_Window *window)\n\n\t\t{\n\n\t\t\tSDL_DestroyWindow(window);\n\n\t\t}\n\n\t};\n\nprivate:\n\n\tstd::unique_ptr<SDL_Window, Deleter> window_;\n\n};\n", "file_path": "include/window.hpp", "rank": 88, "score": 35975.66596369382 }, { "content": "\t\t\tSDL_DestroyTexture(texture);\n\n\t\t}\n\n\t};\n\nprivate:\n\n\tstd::unique_ptr<SDL_Texture, Deleter> texture_;\n\n};\n\n\n\nTexture::Texture(SDL_Renderer *renderer, Uint32 format, int access,\n\n\tint width, int height)\n\n\t: texture_{CStyleAlloc<Texture::Deleter>::alloc(SDL_CreateTexture,\n\n\t\t\"Making texture failed\",\n\n\t\trenderer, format, access, width, height)}\n\n{}\n\n\n\nTexture::Texture(SDL_Renderer *renderer, const Surface &surface)\n\n\t: texture_{CStyleAlloc<Texture::Deleter>::alloc(\n\n\t\tSDL_CreateTextureFromSurface,\n\n\t\t\"Making texture from surface failed\",\n\n\t\trenderer, surface.surface_.get())}\n\n{}\n", "file_path": "include/texture.hpp", "rank": 89, "score": 35975.63223026116 }, { "content": "\t\treturn SDL_GL_BindTexture(texture_.get(), w, h);\n\n\t}\n\n\tbool unbind()\n\n\t{\n\n\t\treturn SDL_GL_UnbindTexture(texture_.get());\n\n\t}\n\n\n\n\tTexture(const Texture &that) = delete;\n\n\tTexture(Texture &&that) = default;\n\n\t~Texture() = default;\n\n\tTexture & operator=(Texture that) { swap(*this, that); return *this; }\n\n\tfriend void swap(Texture &first, Texture &second) noexcept\n\n\t{\n\n\t\tusing std::swap;\n\n\t\tswap(first.texture_, second.texture_);\n\n\t}\n\n\n\n\tstruct Deleter {\n\n\t\tvoid operator()(SDL_Texture *texture)\n\n\t\t{\n", "file_path": "include/texture.hpp", "rank": 90, "score": 35975.60257215819 }, { "content": "\t{\n\n\t\treturn SDL_RenderCopy(renderer_.get(), texture.texture_.get(),\n\n\t\t\tsrc, dest) >= 0;\n\n\t}\n\n\n\n\t// SDL_RenderCopyEx()\n\n\tbool render(Texture &texture, const SDL_Rect *src, const SDL_Rect *dest,\n\n\t\tconst double angle, const SDL_Point *center,\n\n\t\tconst SDL_RendererFlip flip = SDL_FLIP_NONE) const\n\n\t{\n\n\t\treturn SDL_RenderCopyEx(renderer_.get(), texture.texture_.get(),\n\n\t\t\tsrc, dest, angle, center, flip) >= 0;\n\n\t}\n\n\n\n\tbool setTarget(Texture &tex) { return setTarget(tex.texture_.get()); }\n\n\t// Does the actual work. You can use this overload to pass either NULL\n\n\t// or nullptr, which will set the target as the default\n\n\t// Note: This will call SDL_SetError if this Renderer wasn't created\n\n\t// with SDL_RENDERER_TARGETTEXTURE.\n\n\tbool setTarget(SDL_Texture *texture);\n", "file_path": "include/renderer.hpp", "rank": 91, "score": 35975.29987601834 }, { "content": "\n\n#ifndef SCC_AUDIO_CHANNELS\n\n#define SCC_AUDIO_CHANNELS\n\n\n\n#include \"null.hpp\"\n\n\n\n#ifndef HAVE_SDL_MIXER\n\n# error \"cannot use class AudioChannels without SDL_mixer\"\n\n#endif\n\n\n\nnamespace SDL {\n\n\n\n// TODO sound effects\n\n//\n\n// convenience wrapper around channel-related functions.\n", "file_path": "include/audiochannels.hpp", "rank": 92, "score": 35975.271893810845 }, { "content": "\n\n\t// you might want to call SDL_GL_SetSwapInterval() before using this\n\n\tvoid swapWindow() { SDL_GL_SwapWindow(window_.get()); }\n\n\n\n\tbool makeCurrent(GLContext &context)\n\n\t{\n\n\t\treturn makeCurrent(context.context_);\n\n\t}\n\n\t// if you created your context through other means, you can use this\n\n\t// overload instead.\n\n\tbool makeCurrent(SDL_GLContext context)\n\n\t{\n\n\t\treturn SDL_GL_MakeCurrent(window_.get(), context) >= 0;\n\n\t}\n\n\n\n\t// \"Do not free this surface.\n\n\t// This surface will be invalidated if the window is resized.\n\n\t// After resizing a window this function must be called again to return\n\n\t// a valid surface.\n\n\t// You may not combine this with 3D or the rendering API on this window.\"\n", "file_path": "include/window.hpp", "rank": 93, "score": 35975.2521947691 }, { "content": "\t{\n\n\t\tusing std::swap;\n\n\t\tswap(first.music_, second.music_);\n\n\t}\n\n\n\n\tstruct Deleter {\n\n\t\tvoid operator()(Mix_Music *music) { Mix_FreeMusic(music); }\n\n\t};\n\nprivate:\n\n\tstd::unique_ptr<Mix_Music, Deleter> music_;\n\n};\n\n\n\nMusic::Music(const RWops &file)\n\n\t: music_{FromRWops<Music::Deleter>::load(file, Mix_LoadMUS_RW,\n\n\t\t\"Loading music from file failed\")}\n\n{}\n\n\n\n} // namespace SDL\n\n\n\n#endif\n", "file_path": "include/music.hpp", "rank": 94, "score": 35974.94300575015 }, { "content": "/*\n\n SDL C++ Classes\n\n Copyright (C) 2017-2018 Mateus Carmo M. de F. Barbosa\n\n \n\n This software is provided 'as-is', without any express or implied\n\n warranty. In no event will the authors be held liable for any damages\n\n arising from the use of this software.\n\n \n\n Permission is granted to anyone to use this software for any purpose,\n\n including commercial applications, and to alter it and redistribute it\n\n freely, subject to the following restrictions:\n\n \n\n 1. The origin of this software must not be misrepresented; you must not\n\n claim that you wrote the original software. If you use this software\n\n in a product, an acknowledgment in the product documentation would be\n\n appreciated but is not required.\n\n 2. Altered source versions must be plainly marked as such, and must not be\n\n misrepresented as being the original software.\n\n 3. This notice may not be removed or altered from any source distribution.\n\n*/\n\n\n\n#ifndef SCC_GLCONTEXT_HPP\n\n#define SCC_GLCONTEXT_HPP\n\n\n\n#include \"null.hpp\"\n\n\n\nnamespace SDL {\n\n\n", "file_path": "include/glcontext.hpp", "rank": 95, "score": 35974.920543814515 }, { "content": "\t\tswap(first.chunk_, second.chunk_);\n\n\t}\n\n\n\n\tstruct Deleter {\n\n\t\tvoid operator()(Mix_Chunk *chunk) { Mix_FreeChunk(chunk); }\n\n\t};\n\nprivate:\n\n\tstd::unique_ptr<Mix_Chunk, Deleter> chunk_;\n\n};\n\n\n\nAudioChunk::AudioChunk(const RWops &wavFile)\n\n\t: chunk_{FromRWops<AudioChunk::Deleter>::load(wavFile, Mix_LoadWAV_RW,\n\n\t\t\"Loading audio chunk from file failed\")}\n\n{}\n\n\n\nAudioChunk::AudioChunk(Uint8 *mem)\n\n\t: chunk_{CStyleAlloc<AudioChunk::Deleter>::alloc(Mix_QuickLoad_WAV,\n\n\t\t\"Quickloading audio chunk from memory failed\", mem)}\n\n{}\n\n\n\nAudioChunk::AudioChunk(Uint8 *mem, Uint32 len)\n\n\t: chunk_{CStyleAlloc<AudioChunk::Deleter>::alloc(Mix_QuickLoad_RAW,\n\n\t\t\"Quickloading raw audio chunk from memory failed\", mem, len)}\n\n{}\n\n\n\n} // namespace SDL\n\n\n\n#endif\n", "file_path": "include/audiochunk.hpp", "rank": 96, "score": 35973.80813793511 }, { "content": "\n\n#ifndef SCC_RENDERER_HPP\n\n#define SCC_RENDERER_HPP\n\n\n\n#include <memory>\n\n#include <vector>\n\n#include <stdexcept>\n\n#include \"cstylealloc.hpp\"\n\n#include \"texture.hpp\"\n\n\n\nnamespace SDL {\n\n\n", "file_path": "include/renderer.hpp", "rank": 97, "score": 35972.594390512655 }, { "content": "\n\n#ifndef SCC_WINDOW_HPP\n\n#define SCC_WINDOW_HPP\n\n\n\n#include <memory>\n\n#include \"cstylealloc.hpp\"\n\n#include \"renderer.hpp\"\n\n#include \"glcontext.hpp\"\n\n\n\nnamespace SDL {\n\n\n\n// note: to actually draw something to the window, you'll have to choose between\n\n// - creating a Renderer (2D)\n\n// - creating a GLContext and drawing with OpenGL (3D)\n\n// - blitting to the window's surface (no hardware acceleration)\n\n//\n", "file_path": "include/window.hpp", "rank": 98, "score": 35972.37937463086 }, { "content": "\n\n// This is the only SCC header users should include.\n\n// Make sure to include SDL.h and any SDL subprojects' headers' that you want\n\n// before this!\n\n#ifndef SCC_HPP\n\n#define SCC_HPP\n\n\n\n#if __cplusplus < 201103L\n\n# error \"at least C++11 is needed\"\n\n#endif\n\n\n\n#if !defined(SDL_MAJOR_VERSION) || !defined(SDL_MINOR_VERSION)\n\n# error \"Could not determine the SDL version. Is SDL.h included?\"\n\n#endif\n\n\n\n#if SDL_MAJOR_VERSION < 2\n\n# error \"at least SDL 2.0 is needed.\"\n\n#endif\n\n\n\n#ifdef SDL_IMAGE_MAJOR_VERSION\n", "file_path": "include/scc.hpp", "rank": 99, "score": 35972.148420091304 } ]
C++
xdl/ps-plus/ps-plus/common/test/hashmap_test.cc
Ru-Xiang/x-deeplearning
04cc0497150920c64b06bb8c314ef89977a3427a
#include <iostream> #include "gtest/gtest.h" #include "ps-plus/common/hashmap.h" #include "ps-plus/common/thread_pool.h" using ps::Hash128Key; using ps::HashMap; using ps::Range; using ps::Status; using std::vector; TEST(HashMap64Test, Get) { std::unique_ptr<HashMap> hashmap(new ps::HashMapImpl<int64_t>(1)); int64_t keys[] = {1, 2, 3, 4}; vector<size_t> ids; tbb::concurrent_vector<size_t> reused_ids; size_t filtered; int64_t max = hashmap->Get((const int64_t*)keys, 4ul, false, 1.0, &ids, &reused_ids, &filtered); EXPECT_EQ(4, max); EXPECT_EQ(4u, ids.size()); size_t total = 0; for (size_t i = 0; i < 4; i++) { total += ids[i]; } EXPECT_EQ(6ul, total); EXPECT_EQ(0ul, reused_ids.size()); int64_t keys1[] = {4, 3, 2, 1, 13, 14}; max = hashmap->Get((const int64_t*)keys1, 6ul, false, 1.0, &ids, &reused_ids, &filtered); EXPECT_EQ(6, max); EXPECT_EQ(6u, ids.size()); total = 0; for (size_t i = 0; i < 4; i++) { total += ids[i]; } EXPECT_EQ(6ul, total); total = 0; for (size_t i = 4; i < 6; i++) { total += ids[i]; } EXPECT_EQ(9u, total); EXPECT_EQ(0u, reused_ids.size()); } TEST(HashMap128Test, Get) { std::unique_ptr<HashMap> hashmap(new ps::HashMapImpl<Hash128Key>(1)); int64_t keys[] = {1, 2, 3, 4}; vector<size_t> ids; tbb::concurrent_vector<size_t> reused_ids; size_t filtered; int64_t max = hashmap->Get((const int64_t*)keys, 2ul, false, 1.0, &ids, &reused_ids, &filtered); EXPECT_EQ(2, max); EXPECT_EQ(2u, ids.size()); size_t total = 0; for (size_t i = 0; i < 2; i++) { total += ids[i]; } EXPECT_EQ(1, total); EXPECT_EQ(0u, reused_ids.size()); int64_t keys1[] = {4, 3, 2, 1, 13, 14}; max = hashmap->Get((const int64_t*)keys1, 3ul, false, 1.0, &ids, &reused_ids, &filtered); EXPECT_EQ(5, max); EXPECT_EQ(3u, ids.size()); total = 0; for (size_t i = 0; i < 3; i++) { total += ids[i]; } EXPECT_EQ(9, total); EXPECT_EQ(0u, reused_ids.size()); } TEST(HashMap128Test, BloomFilter) { std::unique_ptr<HashMap> hashmap(new ps::HashMapImpl<Hash128Key>(1)); hashmap->SetBloomFilterThrethold(2); int64_t keys[] = {1, 2, 3, 4}; vector<size_t> ids; tbb::concurrent_vector<size_t> reused_ids; size_t filtered; int64_t max = hashmap->Get((const int64_t*)keys, 2ul, false, 1.0, &ids, &reused_ids, &filtered); EXPECT_EQ(max, 0); max = hashmap->Get((const int64_t*)keys, 2ul, false, 1.0, &ids, &reused_ids, &filtered); EXPECT_EQ(max, 2); } TEST(HashMap128Test, Erase) { std::unique_ptr<HashMap> hashmap(new ps::HashMapImpl<Hash128Key>(1)); int64_t keys[] = {1, 2}; vector<size_t> ids; tbb::concurrent_vector<size_t> reused_ids; size_t filtered; int64_t max = hashmap->Get(keys, 1ul, false, 1.0, &ids, &reused_ids, &filtered); ASSERT_EQ(1, max); ASSERT_EQ(1, ids.size()); ASSERT_EQ(0, ids[0]); ASSERT_EQ(0, reused_ids.size()); int64_t keys2[] = {3, 4}; max = hashmap->Get(keys2, 1ul, false, 1.0, &ids, &reused_ids, &filtered); ASSERT_EQ(2, max); ASSERT_EQ(1, ids.size()); ASSERT_EQ(1, ids[0]); ASSERT_EQ(0, reused_ids.size()); int64_t del_keys[] = {3, 4}; hashmap->Erase(del_keys, 1); int64_t keys3[] = {1, 2, 5, 6}; max = hashmap->Get(keys3, 2, false, 1.0, &ids, &reused_ids, &filtered); ASSERT_EQ(2, max); EXPECT_EQ(2u, ids.size()); EXPECT_EQ(0, ids[0]); EXPECT_EQ(1, ids[1]); EXPECT_EQ(1u, reused_ids.size()); EXPECT_EQ(1, reused_ids[0]); int64_t del_keys1[] = {1, 2}; hashmap->Erase(del_keys1, 1); int64_t keys4[] = {5, 6, 1, 2, 3, 4, 7, 8}; max = hashmap->Get(keys4, 4, false, 1.0, &ids, &reused_ids, &filtered); EXPECT_EQ(4u, max); EXPECT_EQ(4u, ids.size()); EXPECT_EQ(1, ids[0]); size_t total = 0; for (size_t i = 0; i < 3; i++) { total += ids[i+1]; } EXPECT_EQ(5, total); } TEST(HashMap128Test, MultiThread) { int thread_count = 10; size_t key_count = 20000l; std::unique_ptr<HashMap> hashmap(new ps::HashMapImpl<Hash128Key>(key_count)); int64_t* keys = new int64_t[key_count]; for (size_t i = 0; i < key_count; i++) { keys[i] = i; } std::atomic<size_t> total(0); auto start = std::chrono::system_clock::now(); ps::MultiThreadDoTBB(thread_count, [&](const Range& r) { for (size_t i = r.begin; i < r.end; i++) { vector<size_t> ids; tbb::concurrent_vector<size_t> reused_ids; size_t filtered; hashmap->Get(keys + i* key_count/thread_count, key_count/2/thread_count, false, 1.0, &ids, &reused_ids, &filtered); EXPECT_EQ(key_count/2/thread_count, ids.size()); size_t sub_total = 0; for (size_t j = 0; j < ids.size(); j++) { sub_total += ids[j]; } total.fetch_add(sub_total); } return Status::Ok(); }); EXPECT_EQ(49995000, total); auto end = std::chrono::system_clock::now(); std::cout << "insert " << key_count/2 << " keys, takes " << (end-start).count()/1000000 << "ms" <<std::endl; delete [] keys; }
#include <iostream> #include "gtest/gtest.h" #include "ps-plus/common/hashmap.h" #include "ps-plus/common/thread_pool.h" using ps::Hash128Key; using ps::HashMap; using ps::Range; using ps::Status; using std::vector; TEST(HashMap64Test, Get) { std::unique_ptr<HashMap> hashmap(new ps::HashMapImpl<int64_t>(1)); int64_t keys[] = {1, 2, 3, 4}; vector<size_t> ids; tbb::concurrent_vector<size_t> reused_ids; size_t filtered; int64_t max = hashmap->Get((const int64_t*)keys, 4ul, false, 1.0, &ids, &reused_ids, &filtered); EXPECT_EQ(4, max); EXPECT_EQ(4u, ids.size()); size_t total = 0; for (size_t i = 0; i < 4; i++) { total += ids[i]; } EXPECT_EQ(6ul, total); EXPECT_EQ(0ul, reused_ids.size()); int64_t keys1[] = {4, 3, 2, 1, 13, 14}; max = hashmap->Get((const int64_t*)keys1, 6ul, false, 1.0, &ids, &reused_ids, &filtered); EXPECT_EQ(6, max); EXPECT_EQ(6u, ids.size()); total = 0; for (size_t i = 0; i < 4; i++) { total += ids[i]; } EXPECT_EQ(6ul, total); total = 0; for (size_t i = 4; i < 6; i++) { total += ids[i]; } EXPECT_EQ(9u, total); EXPECT_EQ(0u, reused_ids.size()); } TEST(HashMap128Test, Get) { std::unique_ptr<HashMap> hashmap(new ps::HashMapImpl<Hash128Key>(1)); int64_t keys[] = {1, 2, 3, 4}; vector<size_t> ids; tbb::concurrent_vector<size_t> reused_ids; size_t filtered; int64_t max = hashmap->Get((const int64_t*)keys, 2ul, false, 1.0, &ids, &reused_ids, &filtered); EXPECT_EQ(2, max); EXPECT_EQ(2u, ids.size()); size_t total = 0; for (size_t i = 0; i < 2; i++) { total += ids[i]; } EXPECT_EQ(1, total); EXPECT_EQ(0u, reused_ids.size()); int64_t keys1[] = {4, 3, 2, 1, 13, 14}; max = hashmap->Get((const int64_t*)keys1, 3ul, false, 1.0, &ids, &reused_ids, &filtered); EXPECT_EQ(5, max); EXPECT_EQ(3u, ids.size()); total = 0; for (size_t i = 0; i < 3; i++) { total += ids[i]; } EXPECT_EQ(9, total); EXPECT_EQ(0u, reused_ids.size()); } TEST(HashMap128Test, BloomFilter) { std::unique_ptr<HashMap> hashmap(new ps::HashMapImpl<Hash128Key>(1)); hashmap->SetBloomFilterThrethold(2); int64_t keys[] = {1, 2, 3, 4}; vector<size_t> ids; tbb::concurrent_vector<size_t> reused_ids; size_t filtered; int64_t max = hashmap->Get((const int64_t*)keys, 2ul, false, 1.0, &ids, &reused_ids, &filtered); EXPECT_EQ(max, 0); max = hashmap->Get((const int64_t*)keys, 2ul, false, 1.0, &ids, &reused_ids, &filtered); EXPECT_EQ(max, 2); } TEST(HashMap128Test, Erase) { std::unique_ptr<HashMap> hashmap(new ps::HashMapImpl<Hash128Key>(1)); int64_t keys[] = {1, 2}; vector<size_t> ids; tbb::concurrent_vector<size_t> reused_ids; size_t filtered; int64_t max = hashmap->Get(keys, 1ul, false, 1.0, &ids, &reused_ids, &filtered); ASSERT_EQ(1, max); ASSERT_EQ(1, ids.size()); ASSERT_EQ(0, ids[0]); ASSERT_EQ(0, reused_ids.size()); int64_t keys2[] = {3, 4}; max = hashmap->Get(keys2, 1ul, false, 1.0, &ids, &reused_ids, &filtered); ASSERT_EQ(2, max); ASSERT_EQ(1, ids.size()); ASSERT_EQ(1, ids[0]); ASSERT_EQ(0, reused_ids.size()); int64_t del_keys[] = {3, 4}; hashmap->Erase(del_keys, 1); int64_t keys3[] = {1, 2, 5, 6}; max = hashmap->Get(keys3, 2, false, 1.0, &ids, &reused_ids, &filtered); ASSERT_EQ(2, max); EXPECT_EQ(2u, ids.size()); EXPECT_EQ(0, ids[0]); EXPECT_EQ(1, ids[1]); EXPECT_EQ(1u, reused_ids.size()); EXPECT_EQ(1, reused_ids[0]); int64_t del_keys1[] = {1, 2}; hashmap->Erase(del_keys1, 1); int64_t keys4[] = {5, 6, 1, 2, 3, 4, 7, 8}; max = hashmap->Get(keys4, 4, false, 1.0, &ids, &reused_ids, &filtered); EXPECT_EQ(4u, max); EXPECT_EQ(4u, ids.size()); EXPECT_EQ(1, ids[0]); size_t total = 0; for (size_t i = 0; i < 3; i++) { total += ids[i+1]; } EXPECT_EQ(5, total); } TEST(HashMap128Test, MultiThread) { int thread_count = 10; size_t key_count = 20000l; std::unique_ptr<HashMap> hashmap(new ps::HashMapImpl<Hash128Key>(key_count)); int64_t* keys = new int64_t[key_count]; for (size_t i = 0; i < key_count; i++) { keys[i] = i; } std::atomic<size_t> total(0); auto start = std::chrono::system_clock::now();
; EXPECT_EQ(49995000, total); auto end = std::chrono::system_clock::now(); std::cout << "insert " << key_count/2 << " keys, takes " << (end-start).count()/1000000 << "ms" <<std::endl; delete [] keys; }
ps::MultiThreadDoTBB(thread_count, [&](const Range& r) { for (size_t i = r.begin; i < r.end; i++) { vector<size_t> ids; tbb::concurrent_vector<size_t> reused_ids; size_t filtered; hashmap->Get(keys + i* key_count/thread_count, key_count/2/thread_count, false, 1.0, &ids, &reused_ids, &filtered); EXPECT_EQ(key_count/2/thread_count, ids.size()); size_t sub_total = 0; for (size_t j = 0; j < ids.size(); j++) { sub_total += ids[j]; } total.fetch_add(sub_total); } return Status::Ok(); })
call_expression
[]
C++
Mesh.cpp
nvpro-samples/gl_vk_chopper
e7ffdd0b0277843fc14af7ba110538089efb459e
#include "Mesh.h" #include <stdlib.h> Mesh::Mesh() : m_vertices(NULL) , m_indices(NULL) , m_normals(NULL) , m_max_vertices(0) , m_max_indices(0) , m_vertex_count(0) , m_index_count(0) , m_material_id(-1) { } Mesh::Mesh(const Mesh::ID& inID) : m_id(inID) , m_vertices(NULL) , m_indices(NULL) , m_normals(NULL) , m_max_vertices(0) , m_max_indices(0) , m_vertex_count(0) , m_index_count(0) , m_material_id(-1) { } void Mesh::allocate(uint32_t inMaxVerts, uint32_t inMaxIdx) { dispose(); m_max_vertices = inMaxVerts; m_max_indices = inMaxIdx; m_vertices = new Vec4f[m_max_vertices]; m_normals = new Vec4f[m_max_vertices]; m_indices = new uint32_t[m_max_indices]; m_uvs = new Vec2f[m_max_vertices]; } Vec4f*& Mesh::getVertices() { return m_vertices; } Vec4f*& Mesh::getNormals() { return m_normals; } uint32_t*& Mesh::getIndices() { return m_indices; } Vec2f*& Mesh::getUVs() { return m_uvs; } void Mesh::addVertex(const Vec4f& inVertex) { Vec4f normal = {0.0, 0.0, 0.0, 1.0}; addVertex(inVertex, normal); } void Mesh::addVertex(const Vec4f& inVertex, const Vec4f& inNormal) { if(m_vertex_count >= m_max_vertices) return; m_normals[m_vertex_count] = inNormal; m_vertices[m_vertex_count++] = inVertex; } void Mesh::addIndex(const uint32_t& inIndex) { if(m_index_count >= m_max_indices) return; m_indices[m_index_count++] = inIndex; m_triangle_count = m_index_count / 3; } Triangle4f Mesh::getTriangle(const uint32_t inIndex) { uint32_t startIndex = inIndex * 3; Triangle4f out = {m_vertices[m_indices[startIndex]], m_vertices[m_indices[startIndex + 1]], m_vertices[m_indices[startIndex + 2]], m_normals[m_indices[startIndex]], m_normals[m_indices[startIndex + 1]], m_normals[m_indices[startIndex + 2]]}; return out; } Triangle4f Mesh::getTransformedTriangle(Mat4x4f& inTransform, const uint32_t inIndex) { uint32_t startIndex = inIndex * 3; Triangle4f out = { inTransform(m_vertices[m_indices[startIndex]]), inTransform(m_vertices[m_indices[startIndex + 1]]), inTransform(m_vertices[m_indices[startIndex + 2]]), inTransform(m_normals[m_indices[startIndex]]), inTransform(m_normals[m_indices[startIndex + 1]]), inTransform(m_normals[m_indices[startIndex + 2]])}; return out; } void Mesh::dispose() { if(m_vertices) { delete[] m_vertices; m_vertices = NULL; } if(m_indices) { delete[] m_indices; m_indices = NULL; } if(m_normals) { delete[] m_normals; m_normals = NULL; } m_max_indices = 0; m_max_vertices = 0; m_index_count = 0; m_vertex_count = 0; m_triangle_count = 0; } void Mesh::getTransformedTriangles(Mat4x4f& inTransform, TriangleList4f& outTriangles) { for(uint32_t i = 0; i < m_triangle_count; ++i) { Triangle4f tri = getTransformedTriangle(inTransform, i); outTriangles.push_back(tri); } } Mesh::~Mesh() {}
#include "Mesh.h" #include <stdlib.h> Mesh::Mesh() : m_vertices(NULL) , m_indices(NULL) , m_normals(NULL) , m_max_vertices(0) , m_max_indices(0) , m_vertex_count(0) , m_index_count(0) , m_material_id(-1) { } Mesh::Mesh(const Mesh::ID& inID) : m_id(inID) , m_vertices(NULL) , m_indices(NULL) , m_normals(NULL) , m_max_vertices(0) , m_max_indices(0) , m_vertex_count(0) , m_index_count(0) , m_material_id(-1) { } void Mesh::allocate(uint32_t inMaxVerts, uint32_t inMaxIdx) { dispose(); m_max_vertices = inMaxVerts; m_max_indices = inMaxIdx; m_vertices =
Vec4f*& Mesh::getVertices() { return m_vertices; } Vec4f*& Mesh::getNormals() { return m_normals; } uint32_t*& Mesh::getIndices() { return m_indices; } Vec2f*& Mesh::getUVs() { return m_uvs; } void Mesh::addVertex(const Vec4f& inVertex) { Vec4f normal = {0.0, 0.0, 0.0, 1.0}; addVertex(inVertex, normal); } void Mesh::addVertex(const Vec4f& inVertex, const Vec4f& inNormal) { if(m_vertex_count >= m_max_vertices) return; m_normals[m_vertex_count] = inNormal; m_vertices[m_vertex_count++] = inVertex; } void Mesh::addIndex(const uint32_t& inIndex) { if(m_index_count >= m_max_indices) return; m_indices[m_index_count++] = inIndex; m_triangle_count = m_index_count / 3; } Triangle4f Mesh::getTriangle(const uint32_t inIndex) { uint32_t startIndex = inIndex * 3; Triangle4f out = {m_vertices[m_indices[startIndex]], m_vertices[m_indices[startIndex + 1]], m_vertices[m_indices[startIndex + 2]], m_normals[m_indices[startIndex]], m_normals[m_indices[startIndex + 1]], m_normals[m_indices[startIndex + 2]]}; return out; } Triangle4f Mesh::getTransformedTriangle(Mat4x4f& inTransform, const uint32_t inIndex) { uint32_t startIndex = inIndex * 3; Triangle4f out = { inTransform(m_vertices[m_indices[startIndex]]), inTransform(m_vertices[m_indices[startIndex + 1]]), inTransform(m_vertices[m_indices[startIndex + 2]]), inTransform(m_normals[m_indices[startIndex]]), inTransform(m_normals[m_indices[startIndex + 1]]), inTransform(m_normals[m_indices[startIndex + 2]])}; return out; } void Mesh::dispose() { if(m_vertices) { delete[] m_vertices; m_vertices = NULL; } if(m_indices) { delete[] m_indices; m_indices = NULL; } if(m_normals) { delete[] m_normals; m_normals = NULL; } m_max_indices = 0; m_max_vertices = 0; m_index_count = 0; m_vertex_count = 0; m_triangle_count = 0; } void Mesh::getTransformedTriangles(Mat4x4f& inTransform, TriangleList4f& outTriangles) { for(uint32_t i = 0; i < m_triangle_count; ++i) { Triangle4f tri = getTransformedTriangle(inTransform, i); outTriangles.push_back(tri); } } Mesh::~Mesh() {}
new Vec4f[m_max_vertices]; m_normals = new Vec4f[m_max_vertices]; m_indices = new uint32_t[m_max_indices]; m_uvs = new Vec2f[m_max_vertices]; }
function_block-function_prefixed
[ { "content": "class VkeIBO : public VkeBuffer<uint32_t>\n\n{\n\npublic:\n\n VkeIBO();\n\n ~VkeIBO();\n\n\n\n void bind(VkCommandBuffer* inCmd);\n\n};\n\n\n\n#endif", "file_path": "VkeIBO.h", "rank": 0, "score": 14104.936708526924 }, { "content": "\n\n#include \"VKSFile.h\"\n\n#include \"nvh/nvprint.hpp\"\n\n#include \"nvpwindow.hpp\"\n\n#include <iostream>\n\n\n\n#if defined(WIN32)\n\n#else\n\n\n\nvoid fopen_s(FILE** inFile, const char* inPath, const char* inPermissions)\n\n{\n\n *inFile = fopen(inPath, inPermissions);\n\n}\n\n\n\nvoid fread_s(void* inBuffer, size_t inBufSize, size_t inSize, size_t inCount, FILE* inFP)\n\n{\n\n fread(inBuffer, inSize, inCount, inFP);\n\n}\n\n\n\n#endif\n", "file_path": "VKSFile.cpp", "rank": 1, "score": 9.180046561142575 }, { "content": "\n\n#include <include_gl.h>\n\n\n\n#include \"VkeCamera.h\"\n\n#include \"VkeGameRendererDynamic.h\"\n\n#include \"VkeIBO.h\"\n\n#include \"VkeMaterial.h\"\n\n#include \"VkeTexture.h\"\n\n#include \"VkeVBO.h\"\n\n#include \"VulkanAppContext.h\"\n\n#include <algorithm>\n\n#ifndef INIT_COMMAND_ID\n\n#define INIT_COMMAND_ID 1\n\n#endif\n\n\n\n#ifndef GL_NV_draw_vulkan_image\n\n#define GL_NV_draw_vulkan_image 1\n\n//typedef GLVULKANPROCNV (GLAPIENTRY* PFNGLGETVKINSTANCEPROCADDRNVPROC) (const GLchar *name);\n\ntypedef void(GLAPIENTRY* PFNGLWAITVKSEMAPHORENVPROC)(GLuint64 vkSemaphore);\n\ntypedef void(GLAPIENTRY* PFNGLSIGNALVKSEMAPHORENVPROC)(GLuint64 vkSemaphore);\n", "file_path": "VkeGameRendererDynamic.cpp", "rank": 2, "score": 8.64557066960791 }, { "content": "\n\n#include \"Transform.h\"\n\n\n\n\n\nTransform::Transform()\n\n{\n\n reset();\n\n}\n\n\n\n\n\nvoid Transform::reset()\n\n{\n\n\n\n m_matrix.identity();\n\n}\n\n\n\nvoid Transform::update(Transform* inParent)\n\n{\n\n\n\n m_transform = m_matrix;\n", "file_path": "Transform.cpp", "rank": 3, "score": 8.352283284427966 }, { "content": "\n\n#include \"VkeMaterial.h\"\n\n#include \"VKSFile.h\"\n\n#include <iostream>\n\n\n\nVkeMaterial::VkeMaterial()\n\n : VkeBuffer()\n\n , m_id(0)\n\n{\n\n initMaterialData();\n\n}\n\n\n\nVkeMaterial::VkeMaterial(const ID& inID)\n\n : VkeBuffer()\n\n , m_id(inID)\n\n{\n\n initMaterialDataSubAlloc();\n\n}\n\n\n\nvoid VkeMaterial::initMaterialData()\n", "file_path": "VkeMaterial.cpp", "rank": 4, "score": 7.63027901914345 }, { "content": "\n\n#include \"VkeMesh.h\"\n\n#include \"VKSFile.h\"\n\n\n\nVkeMesh::VkeMesh()\n\n : m_id(0)\n\n , m_material_id(-1)\n\n{\n\n}\n\n\n\nVkeMesh::VkeMesh(const ID& inID)\n\n : m_id(inID)\n\n , m_material_id(-1)\n\n{\n\n}\n\n\n\nVkeMesh::~VkeMesh() {}\n\n\n\nvoid VkeMesh::initVKBuffers()\n\n{\n", "file_path": "VkeMesh.cpp", "rank": 5, "score": 7.435129031267305 }, { "content": "\n\n#include \"VkeAnimationChannel.h\"\n\n#include \"VkeSceneAnimation.h\"\n\n\n\n\n\ndouble& VkeAnimationChannel::getDuration()\n\n{\n\n return m_parent->getDuration();\n\n}\n\n\n\nVkeAnimationKey::List& VkeAnimationChannel::Keys()\n\n{\n\n return m_keys;\n\n}\n\n\n\nvoid VkeAnimationChannel::setParent(VkeSceneAnimation* inParent)\n\n{\n\n m_parent = inParent;\n\n}\n\n\n", "file_path": "VkeAnimationChannel.cpp", "rank": 6, "score": 7.1779834869619155 }, { "content": "\n\n#include \"Scene.h\"\n\n\n\n\n\nScene::Scene()\n\n : m_id(0)\n\n{\n\n}\n\n\n\nScene::Scene(const Scene::ID& inID)\n\n : m_id(inID)\n\n{\n\n}\n\n\n\nvoid Scene::update()\n\n{\n\n size_t cnt = m_root_nodes.count();\n\n\n\n for(size_t i = 0; i < cnt; ++i)\n\n {\n", "file_path": "Scene.cpp", "rank": 7, "score": 7.15252826173239 }, { "content": "\n\n#include \"vkaUtils.h\"\n\n\n\n#ifdef USE_LIB_PNG\n\n#include \"png.h\"\n\n#endif\n\n\n\n\n\nvoid dumpGlobalLayerNames(VkLayerProperties* props, uint32_t count)\n\n{\n\n\n\n LOGI(\"Found : %d layers.\\n\", count);\n\n for(uint32_t i = 0; i < count; ++i)\n\n {\n\n LOGI(\"Layer %d : %s.\\n\", i, props[i].layerName);\n\n }\n\n}\n\n\n\nbool loadTextFile(const char* filename, char** buffer, size_t& outSize)\n\n{\n", "file_path": "vkaUtils.cpp", "rank": 8, "score": 7.032412848705363 }, { "content": "\n\n#include \"Renderable.h\"\n\n#include \"RenderContext.h\"\n\n\n\nRenderable::Renderable()\n\n : m_mesh_id(0)\n\n{\n\n}\n\n\n\nMesh* Renderable::getMesh()\n\n{\n\n if(m_mesh_id == 0)\n\n return NULL;\n\n RenderContext* ctx = RenderContext::Get();\n\n if(!ctx)\n\n return NULL;\n\n return ctx->getMesh(m_mesh_id);\n\n}\n\n\n\nvoid Renderable::setMesh(const Mesh::ID& inID)\n\n{\n\n m_mesh_id = inID;\n\n}\n\n\n\n\n\nRenderable::~Renderable() {}\n", "file_path": "Renderable.cpp", "rank": 9, "score": 7.032412848705363 }, { "content": "\n\n#include \"VkeRenderer.h\"\n\n\n\n\n\nVkeRenderer::VkeRenderer()\n\n{\n\n m_samples = VK_SAMPLE_COUNT_8_BIT;\n\n m_width = 1024;\n\n m_height = 768;\n\n}\n\n\n\n\n\nVkeRenderer::~VkeRenderer() {}\n\n\n\nvoid VkeRenderer::initLayouts()\n\n{\n\n initDescriptorLayout();\n\n initRenderPass();\n\n initPipeline();\n\n}\n", "file_path": "VkeRenderer.cpp", "rank": 10, "score": 6.561761230463743 }, { "content": "\n\n#define DEBUG_FILTER 1\n\n\n\n#include <include_gl.h>\n\n\n\n#include <nvmath/nvmath_glsltypes.h>\n\n\n\n#include <nvh/cameracontrol.hpp>\n\n#include <nvh/geometry.hpp>\n\n#include <nvh/misc.hpp>\n\n\n\n#include <nvgl/appwindowprofiler_gl.hpp>\n\n#include <nvgl/base_gl.hpp>\n\n#include <nvgl/error_gl.hpp>\n\n\n\n\n\n#include <iostream>\n\n#include <stdint.h>\n\n\n\n\n", "file_path": "vulkansandbox.cpp", "rank": 11, "score": 5.645763478265353 }, { "content": "\n\n\n\n#include \"VulkanAppContext.h\"\n\n#include \"VKSFile.h\"\n\n#include \"vkaUtils.h\"\n\n\n\n#include <string>\n\n\n\n#include \"nvpwindow.hpp\"\n\n\n\n#include \"VkeCreateUtils.h\"\n\n#include \"VkeRenderer.h\"\n\n\n\n\n\n#include \"VkeGameRendererDynamic.h\"\n\n\n\n#include \"VulkanDeviceContext.h\"\n\n#include <iostream>\n\n#ifndef INIT_COMMAND_ID\n\n#define INIT_COMMAND_ID 1\n", "file_path": "VulkanAppContext.cpp", "rank": 12, "score": 5.5997991445106114 }, { "content": "#include \"Mesh.h\"\n\n#include \"VkeIBO.h\"\n\n#include \"VkeVBO.h\"\n\n#include <map>\n\n#include <queue>\n\nstruct VKSMeshRecord;\n", "file_path": "VkeMesh.h", "rank": 13, "score": 5.591380038771202 }, { "content": "\n\n#ifndef __H_VULKAN_APP_CONTEXT_\n\n#define __H_VULKAN_APP_CONTEXT_\n\n\n\n#include <chrono>\n\n#include <nvmath/nvmath.h>\n\n#include <nvvk/shadermodulemanager_vk.hpp>\n\n#include <vulkan/vulkan.h>\n\n\n\n#include \"RenderContext.h\"\n\n#include \"VkeMaterial.h\"\n\n#include \"VkeMesh.h\"\n\n#include \"VkeNodeData.h\"\n\n#include \"VkeSceneAnimation.h\"\n\n#include \"vkaUtils.h\"\n\n\n\n\n\n#define TEXTURE_COUNT 2\n\n\n", "file_path": "VulkanAppContext.h", "rank": 14, "score": 5.557614215213248 }, { "content": "\n\n#ifndef __H_VKE_GAME_RENDERER_DYNAMIC_\n\n#define __H_VKE_GAME_RENDERER_DYNAMIC_\n\n\n\n#pragma once\n\n\n\n#include \"VkeCubeTexture.h\"\n\n#include \"VkeMaterial.h\"\n\n#include \"VkeRenderer.h\"\n\n#include \"VkeScreenQuad.h\"\n\n#include \"VkeTerrainQuad.h\"\n\n\n\n#include <condition_variable>\n\n#include <mutex>\n\n#include <stdint.h>\n\n#include <thread>\n\n\n", "file_path": "VkeGameRendererDynamic.h", "rank": 15, "score": 5.553902750371332 }, { "content": "\n\n#ifndef __H_RENDERCONTEXT_\n\n#define __H_RENDERCONTEXT_\n\n\n\n#pragma once\n\n\n\n#include \"Mesh.h\"\n\n#include \"MeshUtils.h\"\n\n#include \"Scene.h\"\n\n#include \"Types.h\"\n\n#include \"WMath.h\"\n\n#include <map>\n\n\n", "file_path": "RenderContext.h", "rank": 16, "score": 5.549298717965559 }, { "content": "\n\n#include \"VkeTerrainQuad.h\"\n\n\n\n\n\nVkeTerrainQuad::VkeTerrainQuad()\n\n : VkeBuffer()\n\n{\n\n}\n\n\n\n\n\nVkeTerrainQuad::~VkeTerrainQuad() {}\n\n\n\nvoid VkeTerrainQuad::initQuadData()\n\n{\n\n m_usage_flags = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;\n\n m_memory_flags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;\n\n initBackingStore(sizeof(TerrainUniform));\n\n\n\n float ww = 1800.0;\n\n float hh = 1000.0;\n", "file_path": "VkeTerrainQuad.cpp", "rank": 17, "score": 5.544155473820712 }, { "content": "\n\n#include \"VkeScreenQuad.h\"\n\n\n\n\n\nVkeScreenQuad::VkeScreenQuad()\n\n : VkeBuffer()\n\n{\n\n}\n\n\n\n\n\nVkeScreenQuad::~VkeScreenQuad() {}\n\n\n\nvoid VkeScreenQuad::initQuadData()\n\n{\n\n m_usage_flags = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;\n\n m_memory_flags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;\n\n initBackingStore(sizeof(QuadUniform));\n\n\n\n float ww = 1800.0;\n\n float hh = 1000.0;\n", "file_path": "VkeScreenQuad.cpp", "rank": 18, "score": 5.544155473820712 }, { "content": "\n\n#include <include_gl.h>\n\n\n\n#include \"VkeCreateUtils.h\"\n\n#include \"VkeTexture.h\"\n\n#include \"nvh/nvprint.hpp\"\n\n#include \"nvpwindow.hpp\"\n\n#include \"vkaUtils.h\"\n\n#include <fileformats/nv_dds.h>\n\n#include <iostream>\n\n\n\n#ifndef INIT_COMMAND_ID\n\n#define INIT_COMMAND_ID 1\n\n#endif\n\n\n\nVkeTexture::VkeTexture()\n\n : m_width(0)\n\n , m_height(0)\n\n , m_mip_level(0)\n\n , m_id(0)\n", "file_path": "VkeTexture.cpp", "rank": 19, "score": 5.526167789468637 }, { "content": "\n\n#ifndef __H_NODE_\n\n#define __H_NODE_\n\n\n\n#include \"Renderable.h\"\n\n#include \"Transform.h\"\n\n#include \"Types.h\"\n\n#include <map>\n\n#include <vector>\n\n\n\n\n\n#pragma once\n", "file_path": "Node.h", "rank": 20, "score": 5.507890741988408 }, { "content": "\n\n#ifndef __H_SCENE_\n\n#define __H_SCENE_\n\n\n\n#include \"Camera.h\"\n\n#include \"Node.h\"\n\n#include \"Types.h\"\n\n#include <map>\n\n#include <stdint.h>\n\n\n\n\n\n#pragma once\n", "file_path": "Scene.h", "rank": 21, "score": 5.507890741988408 }, { "content": "\n\n#include <include_gl.h>\n\n\n\n#include \"VkeCreateUtils.h\"\n\n#include \"VkeCubeTexture.h\"\n\n#include \"nvh/nvprint.hpp\"\n\n#include \"nvpwindow.hpp\"\n\n#include \"vkaUtils.h\"\n\n#include <fileformats/nv_dds.h>\n\n#include <iostream>\n\n\n\n#ifndef INIT_COMMAND_ID\n\n#define INIT_COMMAND_ID 1\n\n#endif\n\n\n\nVkeCubeTexture::VkeCubeTexture()\n\n : m_width(0)\n\n , m_height(0)\n\n , m_mip_level(0)\n\n , m_id(0)\n", "file_path": "VkeCubeTexture.cpp", "rank": 22, "score": 5.498708456650767 }, { "content": "\n\n#ifndef __H_MESH_\n\n#define __H_MESH_\n\n\n\n#include \"Transform.h\"\n\n#include \"WMath.h\"\n\n#include <map>\n\n#include <stdio.h>\n\n\n\n#pragma once\n", "file_path": "Mesh.h", "rank": 23, "score": 5.3872613434297785 }, { "content": "\n\n#ifndef __H_VKE_RENDERER_\n\n#define __H_VKE_RENDERER_\n\n\n\n\n\n#include \"VkeMesh.h\"\n\n#include \"VkeNodeData.h\"\n\n#include <map>\n\n#include <nvvk/shadermodulemanager_vk.hpp>\n\n#include <vulkan/vulkan.h>\n\n\n\n#pragma once\n", "file_path": "VkeRenderer.h", "rank": 24, "score": 5.3637286437076535 }, { "content": "\n\n#ifndef __H_VKE_MESH_\n\n#define __H_VKE_MESH_\n\n\n\n\n\n#ifndef USE_SINGLE_VBO\n\n#define USE_SINGLE_VBO 1\n\n#endif\n\n\n\n\n\n#pragma once\n\n\n\n#include \"Mesh.h\"\n\n#include \"VkeIBO.h\"\n\n#include \"VkeVBO.h\"\n\n#include <map>\n\n#include <queue>\n", "file_path": "VkeMesh.h", "rank": 25, "score": 5.317337111319989 }, { "content": "\n\n#ifndef __H_VULKAN_DEVICE_CONTEXT_\n\n#define __H_VULKAN_DEVICE_CONTEXT_\n\n\n\n#pragma once\n\n\n\n\n\n#include <vulkan/vulkan.h>\n\n\n\n#include <map>\n\n#include <string>\n\n#include <vector>\n\n\n", "file_path": "VulkanDeviceContext.h", "rank": 26, "score": 5.309714224667077 }, { "content": "\n\n#ifndef __H_VKE_NODE_DATA_\n\n#define __H_VKE_NODE_DATA_\n\n\n\n#pragma once\n\n\n\n#include \"Node.h\"\n\n#include \"VkeBuffer.h\"\n\n#include \"VkeMesh.h\"\n\n#include \"WMath.h\"\n\n#include <algorithm>\n\n#include <map>\n\n\n\n\n\ntypedef struct _VkeNodeUniform\n\n{\n\n nvmath::mat4f view_matrix;\n\n nvmath::mat4f normal_matrix;\n\n nvmath::vec4i lookup;\n\n nvmath::vec4f p1[3];\n\n} VkeNodeUniform;\n\n\n\n\n", "file_path": "VkeNodeData.h", "rank": 27, "score": 5.209675517708491 }, { "content": "\n\n#ifndef __H_VKE_TEXTURE_\n\n#define __H_VKE_TEXTURE_\n\n\n\n\n\n#include <map>\n\n#include <vector>\n\n#include <vulkan/vulkan.h>\n\n\n\n\n\n#pragma once\n", "file_path": "VkeTexture.h", "rank": 28, "score": 5.173242993203498 }, { "content": "\n\n#include \"VkeIBO.h\"\n\n\n\n\n\nVkeIBO::VkeIBO()\n\n{\n\n m_use_staging = true;\n\n\n\n m_usage_flags = (VkBufferUsageFlagBits)(VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT);\n\n m_memory_flags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;\n\n}\n\n\n\nvoid VkeIBO::bind(VkCommandBuffer* inCmd)\n\n{\n\n vkCmdBindIndexBuffer(*inCmd, m_data.buffer, 0, VK_INDEX_TYPE_UINT32);\n\n}\n\n\n\n\n\nVkeIBO::~VkeIBO() {}\n", "file_path": "VkeIBO.cpp", "rank": 29, "score": 5.145194058643531 }, { "content": "\n\n#include \"VkeCreateUtils.h\"\n\n#include \"VulkanDeviceContext.h\"\n\n#include \"nvh/nvprint.hpp\"\n\n#include <iostream>\n\n#include <memory.h>\n\n#include <vulkan/vulkan.h>\n\n\n\nVkDevice getDefaultDevice()\n\n{\n\n VulkanDC* dc = VulkanDC::Get();\n\n\n\n if(!dc)\n\n return VK_NULL_HANDLE;\n\n\n\n VulkanDC::Device* defaultDevice = dc->getDefaultDevice();\n\n if(!defaultDevice)\n\n return VK_NULL_HANDLE;\n\n\n\n return defaultDevice->getVKDevice();\n", "file_path": "VkeCreateUtils.cpp", "rank": 30, "score": 5.13712223804337 }, { "content": "\n\n#ifndef __H_VKE_ANIMATION_KEY_\n\n#define __H_VKE_ANIMATION_KEY_\n\n\n\n#pragma once\n\n\n\n#include <nvmath/nvmath.h>\n\n#include <stdint.h>\n\n#include <vector>\n\n\n", "file_path": "VkeAnimationKey.h", "rank": 31, "score": 5.125322717300316 }, { "content": "\n\n#ifndef __H_VKE_MATERIAL_\n\n#define __H_VKE_MATERIAL_\n\n\n\n#pragma once\n\n\n\n#include \"MeshUtils.h\"\n\n#include \"VkeBuffer.h\"\n\n#include \"VkeTexture.h\"\n\n#include <map>\n\n#include <nvmath/nvmath.h>\n\n#include <vector>\n\n\n\ntypedef struct VkeMaterialUniform\n\n{\n\n //nvmath::vec4f diffuseColor;\n\n //nvmath::vec4f ambientColor;\n\n //nvmath::vec4f specularColor;\n\n float reflectivity;\n\n float shininess;\n\n float opacity;\n\n\n\n float padding;\n\n float morepadding[48];\n\n\n\n} VkeMaterialUniform;\n\n\n", "file_path": "VkeMaterial.h", "rank": 32, "score": 5.12522604102057 }, { "content": "\n\n#ifndef __H_VKE_CUBE_TEXTURE_\n\n#define __H_VKE_CUBE_TEXTURE_\n\n\n\n#include <map>\n\n#include <vector>\n\n#include <vulkan/vulkan.h>\n\n\n\n\n\n#pragma once\n\n\n\n\n\n#pragma once\n", "file_path": "VkeCubeTexture.h", "rank": 33, "score": 5.101693962323088 }, { "content": "\n\n#ifndef __H_VKE_TERRAIN_QUAD_\n\n#define __H_VKE_TERRAIN_QUAD_\n\n\n\n\n\n#pragma once\n\n\n\n#include \"VkeBuffer.h\"\n\n#include \"VkeIBO.h\"\n\n#include \"VkeVBO.h\"\n\n#include <nvmath/nvmath.h>\n\n\n\ntypedef struct _TerrainUniform\n\n{\n\n nvmath::mat4f view_matrix;\n\n} TerrainUniform;\n\n\n", "file_path": "VkeTerrainQuad.h", "rank": 34, "score": 5.0899134229929155 }, { "content": "\n\n#ifndef __H_VKE_SCREEN_QUAD_\n\n#define __H_VKE_SCREEN_QUAD_\n\n\n\n\n\n#pragma once\n\n\n\n#include \"VkeBuffer.h\"\n\n#include \"VkeIBO.h\"\n\n#include \"VkeVBO.h\"\n\n#include <nvmath/nvmath.h>\n\n\n\ntypedef struct _QuadUniform\n\n{\n\n nvmath::mat4f view_matrix;\n\n} QuadUniform;\n\n\n", "file_path": "VkeScreenQuad.h", "rank": 35, "score": 5.0899134229929155 }, { "content": "\n\n void setNear(float inNear);\n\n void setFar(float inFar);\n\n void setFOV(float inFOV);\n\n\n\n float getNear();\n\n float getFar();\n\n float getFOV();\n\n\n\n nvmath::vec4f worldPosition();\n\n nvmath::vec4f worldPosition(nvmath::vec4f& inPosition);\n\n\n\n void lookAt(nvmath::vec4f& inPosition);\n\n void setLookAtMatrix(nvmath::mat4f& inMat);\n\n\n\nprivate:\n\n void updateProjection();\n\n void updateTransform();\n\n void updateViewProjection();\n\n\n", "file_path": "VkeCamera.h", "rank": 36, "score": 4.991290911001797 }, { "content": "\n\n#ifndef __H_VKE_CAMERA_\n\n#define __H_VKE_CAMERA_\n\n\n\n#pragma once\n\n\n\n#include \"Transform.h\"\n\n#include \"VkeBuffer.h\"\n\n#include <map>\n\n#include <nvmath/nvmath.h>\n\n\n\n\n\n#ifndef VKE_DEFAULT_CAMERA_VIEWPORT\n\n#define VKE_DEFAULT_CAMERA_VIEWPORT 0, 0, 1024, 768\n\n#endif\n\n\n\n#ifndef VKE_DEFAULT_CAMERA_NEAR_PLANE\n\n#define VKE_DEFAULT_CAMERA_NEAR_PLANE 0.001\n\n#endif\n\n\n", "file_path": "VkeCamera.h", "rank": 37, "score": 4.936645480279675 }, { "content": "\n\n void initNodeData();\n\n void initNodeDataSubAlloc();\n\n void updateFromNode();\n\n void updateFromNode(Node* const inNode, VkCommandBuffer* inBuffer = NULL);\n\n void updateFromNode(VkCommandBuffer* inBuffer);\n\n void updateFromNode(Node* const inNode, VkeNodeUniform* inData, uint32_t inInstanceCount = 1);\n\n void updateFromNode(VkeNodeUniform* inData, uint32_t inInstanceCount = 1);\n\n void updateConstantVKBufferData(VkCommandBuffer* inBuffer = NULL);\n\n\n\n void updateVKBufferData(VkeNodeUniform* inData);\n\n\n\n void bind(VkCommandBuffer* inBuffer);\n\n\n\n void setLayer(uint32_t inLayer) { m_layer = inLayer; }\n\n\n\n uint32_t getLayer() { return m_layer; }\n\n\n\n Node* m_node;\n\n VkeMesh* m_mesh;\n\n\n\n uint32_t m_layer;\n\n\n\n bool m_needs_buffer_update;\n\n};\n\n\n\n\n\n#endif", "file_path": "VkeNodeData.h", "rank": 38, "score": 4.895802485636662 }, { "content": "\n\n VkFramebuffer getFramebuffer(uint32_t inIdx) { return m_framebuffers[inIdx]; }\n\n VkRenderPass getRenderPass() { return m_render_pass; }\n\n\n\n\n\n virtual void initDescriptorLayout() = 0;\n\n virtual void initDescriptorSets() = 0;\n\n virtual void initPipeline() = 0;\n\n virtual void initRenderPass() = 0;\n\n\n\n virtual void initFramebuffer(uint32_t inWidth, uint32_t inHeight) = 0;\n\n virtual void releaseFramebuffer() = 0;\n\n\n\n virtual void present() = 0;\n\n virtual void initShaders(nvvk::ShaderModuleManager& inShaderModuleManager) = 0;\n\n virtual void setCameraLookAt(nvmath::mat4f& inMat) = 0;\n\n\n\n VkPipeline getPipeline() { return m_pipeline; }\n\n\n\n VkPipelineLayout getPipelineLayout() { return m_pipeline_layout; }\n", "file_path": "VkeRenderer.h", "rank": 39, "score": 4.869377182174303 }, { "content": "\n\n#ifndef __H_VKE_BUFFER_\n\n#define __H_VKE_BUFFER_\n\n\n\n#pragma once\n\n\n\n\n\n#include \"VkeCreateUtils.h\"\n\n#include \"vkaUtils.h\"\n\n#include <vulkan/vulkan.h>\n\n\n\n\n\n#ifndef INIT_COMMAND_ID\n\n#define INIT_COMMAND_ID 1\n\n#endif\n\n\n\ntemplate <typename T>\n", "file_path": "VkeBuffer.h", "rank": 40, "score": 4.855462841063568 }, { "content": " void initMaterialDataSubAlloc();\n\n\n\n void bind(VkCommandBuffer* inBuffer);\n\n\n\n void initFromData(meshimport::MaterialDataf* inData);\n\n void initFromData(VKSFile* inFile, VKSMaterialRecord* inMaterial);\n\n void initWithDefaults();\n\n\n\n void updateVKBufferData(VkeMaterialUniform* inData);\n\n\n\n VkeTexture::List& getTextures() { return m_textures; }\n\n\n\n ID getID() { return m_id; }\n\n void setID(const ID& inID) { m_id = inID; }\n\n\n\nprivate:\n\n ID m_id;\n\n\n\n VkeTexture::List m_textures;\n\n};\n\n\n\n\n\n#endif\n", "file_path": "VkeMaterial.h", "rank": 41, "score": 4.828423206444436 }, { "content": "\n\n\n\n VkeMesh();\n\n VkeMesh(const ID& inID);\n\n ~VkeMesh();\n\n\n\n void initFromMesh(Mesh* const inMesh);\n\n void initFromMesh(VKSFile* inFile, VKSMeshRecord* inMesh);\n\n\n\n void initVKBuffers();\n\n\n\n void bind(VkCommandBuffer* inCmd);\n\n\n\n void initBindCommand(VkCommandPool* inPool, VkQueue* inQueue);\n\n void initDrawCommand(VkCommandBuffer* inCommand);\n\n void initDrawCommand(VkCommandBuffer* inCommand, VkBuffer& inIndirectBuffer, uint32_t inIndex);\n\n\n\n void draw(VkCommandBuffer* inCommand);\n\n\n\n ID getID() { return m_id; }\n", "file_path": "VkeMesh.h", "rank": 42, "score": 4.826009074056894 }, { "content": "\n\n#include \"VkeVBO.h\"\n\n\n\n\n\nVkeVBO::VkeVBO()\n\n : VkeBuffer()\n\n{\n\n m_use_staging = true;\n\n\n\n m_usage_flags = (VkBufferUsageFlagBits)(VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT);\n\n //m_memory_flags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;#\n\n\n\n m_memory_flags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;\n\n}\n\n\n\nvoid VkeVBO::bind(VkCommandBuffer* inCmd)\n\n{\n\n VkDeviceSize ofst = 0;\n\n vkCmdBindVertexBuffers(*inCmd, 0, 1, &m_data.buffer, &ofst);\n\n}\n\n\n\n\n\nVkeVBO::~VkeVBO() {}\n", "file_path": "VkeVBO.cpp", "rank": 43, "score": 4.767791020779375 }, { "content": " VkeCamera::Map m_data;\n\n std::vector<VkeCamera::ID> m_deleted_keys;\n\n };\n\n\n\n VkeCamera();\n\n VkeCamera(const ID& inID);\n\n VkeCamera(const ID& inID, const float inX, const float inY, const float inZ);\n\n ~VkeCamera();\n\n\n\n void initCameraData();\n\n void updateCameraCmd(VkCommandBuffer inCommand);\n\n void update();\n\n\n\n void bind(VkCommandBuffer* inBuffer);\n\n\n\n void setViewport(float inX, float inY, float inW, float inH);\n\n\n\n void setPosition(float inX, float inY, float inZ);\n\n void setRotation(float inX, float inY, float inZ);\n\n void setRotation(nvmath::quatf& inQuat);\n", "file_path": "VkeCamera.h", "rank": 44, "score": 4.759646483442346 }, { "content": "\n\n#ifndef __H_VKE_SCENE_ANIMATION_\n\n#define __H_VKE_SCENE_ANIMATION_\n\n\n\n#pragma once\n\n\n\n\n\n#include \"VkeAnimationNode.h\"\n\n#include <nvmath/nvmath.h>\n\n\n", "file_path": "VkeSceneAnimation.h", "rank": 45, "score": 4.730998477483912 }, { "content": " void generateDrawCommands();\n\n\n\n void setNodeData(VkeNodeData::List* inData);\n\n void setMaterialData(VkeMaterial::List* inData);\n\n virtual size_t getRequiredDescriptorCount();\n\n\n\n void initCamera();\n\n virtual void update();\n\n\n\n virtual void present();\n\n virtual void initShaders(nvvk::ShaderModuleManager& inShaderModuleManager);\n\n virtual void setCameraLookAt(nvmath::mat4f& inMat);\n\n\n\n VkDescriptorSet getSceneDescriptorSet() { return m_scene_descriptor_set; }\n\n\n\n VkDescriptorSet* getTextureDescriptorSets() { return m_texture_descriptor_sets; }\n\n\n\n VkBuffer getSceneIndirectBuffer() { return m_scene_indirect_buffer; }\n\n\n\n VkDescriptorSetLayout* getTransformDescriptorLayout() { return &m_transform_descriptor_layout; }\n", "file_path": "VkeGameRendererDynamic.h", "rank": 46, "score": 4.67132267984467 }, { "content": "\n\n\n\n#include \"VulkanDeviceContext.h\"\n\n#include \"VkeCreateUtils.h\"\n\n#include \"vkaUtils.h\"\n\n#include <iostream>\n\nVulkanDC::Device::Queue::Queue() {}\n\n\n\nVulkanDC::Device::Queue::Queue(VulkanDC::Device::Queue::Name& inName, VulkanDC::Device::Queue::NodeID inNodeID)\n\n : m_name(inName)\n\n , m_node_id(inNodeID)\n\n , m_queue(VK_NULL_HANDLE)\n\n{\n\n}\n\n\n\nVulkanDC::Device::Queue::Queue(const VulkanDC::Device::Queue& inOther)\n\n{\n\n m_name = inOther.m_name;\n\n m_node_id = inOther.m_node_id;\n\n m_queue = inOther.m_queue;\n", "file_path": "VulkanDeviceContext.cpp", "rank": 47, "score": 4.583900048138968 }, { "content": " VkeTexture::Map m_data;\n\n std::vector<VkeTexture::ID> m_deleted_keys;\n\n };\n\n\n\n\n\n void initTexture();\n\n\n\n void loadDDSTextureFile(const char* inFile);\n\n\n\n#ifdef USE_LIB_PNG\n\n void loadTextureFile(const char* inFile);\n\n#endif\n\n\n\n void loadTextureFloatData(float* inData, uint32_t inWidth, uint32_t inHeight, uint32_t inCompCount = 4);\n\n\n\n\n\n inline bool& isReady() { return m_ready; }\n\n\n\n ID getID() { return m_id; }\n\n void setID(const ID& inID) { m_id = inID; }\n", "file_path": "VkeTexture.h", "rank": 48, "score": 4.580185508086746 }, { "content": " addNode(node);\n\n\n\n return node;\n\n }\n\n\n\n ID nextID();\n\n Count count();\n\n\n\n private:\n\n Node::List m_data;\n\n };\n\n\n\n void setPosition(float inX, float inY, float inZ);\n\n void setRotation(float inX, float inY, float inZ);\n\n void setRotation(nvmath::quatf& inQuat);\n\n void setScale(float inX, float inY, float inZ);\n\n void setScale(float inScale);\n\n\n\n nvmath::vec4f worldPosition();\n\n nvmath::vec4f worldPosition(nvmath::vec4f& inPosition);\n", "file_path": "Node.h", "rank": 49, "score": 4.568095995669614 }, { "content": "#include \"WMath.h\"\n\nclass Node;\n\n\n\nnamespace render {\n\n\n", "file_path": "Types.h", "rank": 50, "score": 4.5559379019258355 }, { "content": "\n\n#include \"VkeNodeData.h\"\n\n#include \"VulkanAppContext.h\"\n\n#include <iostream>\n\n\n\nVkeNodeData::VkeNodeData()\n\n : VkeBuffer()\n\n , m_layer(0)\n\n , m_needs_buffer_update(true)\n\n{\n\n //initNodeData();\n\n initNodeDataSubAlloc();\n\n}\n\n\n\nVkeNodeData::VkeNodeData(const ID& inID)\n\n : VkeBuffer()\n\n , m_layer(0)\n\n , m_needs_buffer_update(true)\n\n{\n\n\n", "file_path": "VkeNodeData.cpp", "rank": 51, "score": 4.53695487609893 }, { "content": "#include \"VkeAnimationKey.h\"\n\nclass VkeSceneAnimation;\n\n\n", "file_path": "VkeAnimationChannel.h", "rank": 52, "score": 4.5003537576352155 }, { "content": "#include \"VkeBuffer.h\"\n\n#pragma once\n\nclass VkeVBO : public VkeBuffer<float>\n\n{\n\npublic:\n\n VkeVBO();\n\n ~VkeVBO();\n\n\n\n\n\n void bind(VkCommandBuffer* inBuffer);\n\n\n\n\n\nprotected:\n\n};\n\n\n\n#endif", "file_path": "VkeVBO.h", "rank": 53, "score": 4.5003537576352155 }, { "content": " VkeCubeTexture::Map m_data;\n\n std::vector<VkeCubeTexture::ID> m_deleted_keys;\n\n };\n\n\n\n\n\n void initTexture();\n\n\n\n void loadCubeDDS(const char* inPath);\n\n#ifdef USE_LIB_PNG\n\n void loadTextureFiles(const char** inFile);\n\n#endif\n\n\n\n inline bool& isReady() { return m_ready; }\n\n\n\n ID getID() { return m_id; }\n\n void setID(const ID& inID) { m_id = inID; }\n\n\n\n Data& getData() { return m_data; }\n\n\n\n\n", "file_path": "VkeCubeTexture.h", "rank": 54, "score": 4.482343482276933 }, { "content": "\n\nvoid VkeRenderer::initDescriptors()\n\n{\n\n initDescriptorPool();\n\n initDescriptorSets();\n\n}\n\n\n\n\n\nvoid VkeRenderer::initDescriptorPool()\n\n{\n\n m_descriptor_pool_size = uint32_t(getRequiredDescriptorCount());\n\n}\n\n\n\nvoid VkeRenderer::releaseDescriptorPool() {}\n\n\n\nVkDescriptorPool& VkeRenderer::getDescriptorPool()\n\n{\n\n return m_descriptor_pool;\n\n}\n\n\n\nvoid VkeRenderer::resize(uint32_t inWidth, uint32_t inHeight)\n\n{\n\n initFramebuffer(inWidth, inHeight);\n\n initDescriptors();\n\n\n\n m_is_first_frame = true;\n\n}", "file_path": "VkeRenderer.cpp", "rank": 55, "score": 4.38301436496323 }, { "content": "void VkeNodeData::initNodeDataSubAlloc()\n\n{\n\n initBackingStore(sizeof(VkeNodeUniform));\n\n}\n\n\n\nvoid VkeNodeData::bind(VkCommandBuffer* inCmd) {}\n\n\n\nvoid VkeNodeData::updateVKBufferData(VkeNodeUniform* inData)\n\n{\n\n uint8_t* ptr = (uint8_t*)inData + (sizeof(VkeNodeUniform) * m_index);\n\n memcpy(ptr, (void*)&m_backing_store->view_matrix, sizeof(VkeNodeUniform));\n\n}\n\n\n\nvoid VkeNodeData::updateFromNode(Node* const inNode, VkCommandBuffer* inBuffer)\n\n{\n\n\n\n m_node = inNode;\n\n\n\n inNode->update();\n\n Transform transform = inNode->GetTransform();\n", "file_path": "VkeNodeData.cpp", "rank": 56, "score": 4.371919576498615 }, { "content": "\n\n double& getDuration();\n\n\n\n void setParent(VkeSceneAnimation* m_parent);\n\n\n\n void update();\n\n\n\nprivate:\n\n VkeAnimationKey::List m_keys;\n\n VkeSceneAnimation* m_parent;\n\n};\n\n\n\n#endif\n", "file_path": "VkeAnimationChannel.h", "rank": 57, "score": 4.355549718114537 }, { "content": "}\n\n\n\nvoid Transform::translate(float inX, float inY, float inZ)\n\n{\n\n nvmath::vec3f vec = nvmath::vec3f(inX, inY, inZ);\n\n m_matrix.translate(vec);\n\n}\n\n\n\nvoid Transform::rotate(const float inValue, nvmath::vec3f& inBasis)\n\n{\n\n\n\n\n\n m_matrix.rotate(inValue, inBasis);\n\n}\n\n\n\nvoid Transform::rotate(nvmath::quatf& inQuat)\n\n{\n\n\n\n m_matrix.rotate(inQuat);\n\n}\n", "file_path": "Transform.cpp", "rank": 58, "score": 4.34636002349474 }, { "content": "\n\n#include \"VkeSceneAnimation.h\"\n\n#include <float.h>\n\n\n\nVkeSceneAnimation::VkeSceneAnimation()\n\n : m_current_time(0.0)\n\n , m_duration(0.0)\n\n , m_start_time(DBL_MAX)\n\n , m_end_time(DBL_MIN)\n\n{\n\n}\n\n\n\n\n\nVkeSceneAnimation::~VkeSceneAnimation() {}\n\n\n\n\n\ndouble& VkeSceneAnimation::getDuration()\n\n{\n\n return m_duration;\n\n}\n", "file_path": "VkeSceneAnimation.cpp", "rank": 60, "score": 4.241409130555521 }, { "content": "\n\nvoid Transform::scale(const nvmath::vec3f& inScale)\n\n{\n\n m_matrix.scale(inScale);\n\n}\n\n\n\nvoid Transform::scale(const float inX, const float inY, const float inZ)\n\n{\n\n scale(nvmath::vec3f(inX, inY, inZ));\n\n}\n\n\n\n\n\nTransform::~Transform() {}\n", "file_path": "Transform.cpp", "rank": 61, "score": 4.222707984805246 }, { "content": "void VkeCamera::update()\n\n{\n\n updateTransform();\n\n updateProjection();\n\n updateViewProjection();\n\n}\n\n\n\nvoid VkeCamera::bind(VkCommandBuffer* inBuffer) {}\n\n\n\nvoid VkeCamera::setViewport(float inX, float inY, float inW, float inH)\n\n{\n\n\n\n if((m_viewport.z == inW) && (m_viewport.w == inH))\n\n return;\n\n\n\n m_viewport.x = inX;\n\n m_viewport.y = inY;\n\n m_viewport.z = inW;\n\n m_viewport.w = inH;\n\n m_projection_needs_update = true;\n", "file_path": "VkeCamera.cpp", "rank": 62, "score": 4.222638049798503 }, { "content": "}\n\n\n\nvoid VkeCamera::setPosition(float inX, float inY, float inZ)\n\n{\n\n m_position.x = inX;\n\n m_position.y = inY;\n\n m_position.z = inZ;\n\n\n\n m_transform_needs_update = true;\n\n}\n\nvoid VkeCamera::setRotation(float inX, float inY, float inZ)\n\n{\n\n m_rotation.x = inX;\n\n m_rotation.y = inY;\n\n m_rotation.z = inZ;\n\n\n\n m_transform_needs_update = true;\n\n}\n\n\n\nvoid VkeCamera::setRotation(nvmath::quatf& inQuat)\n", "file_path": "VkeCamera.cpp", "rank": 64, "score": 4.188572209618156 }, { "content": " uint32_t* iData = m_ibo.getBackingStore();\n\n memcpy(iData, (const void*)quadIdxs, dataSize);\n\n\n\n m_vbo.initVKBufferData();\n\n m_ibo.initVKBufferData();\n\n}\n\n\n\nvoid VkeScreenQuad::draw(VkCommandBuffer* inCommand)\n\n{\n\n vkCmdDrawIndexed(*inCommand, 6, 1, 0, 0, 0);\n\n}\n\n\n\nvoid VkeScreenQuad::bind(VkCommandBuffer* inCmd)\n\n{\n\n m_vbo.bind(inCmd);\n\n m_ibo.bind(inCmd);\n\n}\n", "file_path": "VkeScreenQuad.cpp", "rank": 65, "score": 4.155051618295699 }, { "content": "\n\nvoid Node::setRotation(nvmath::quatf& inQuat)\n\n{\n\n nvmath::vec3f angles;\n\n inQuat.to_euler_xyz(angles);\n\n setRotation(angles.x, angles.y, angles.z);\n\n}\n\n\n\nvoid Node::setRotation(float inX, float inY, float inZ)\n\n{\n\n m_rotation.x = inX;\n\n m_rotation.y = inY;\n\n m_rotation.z = inZ;\n\n m_transform_needs_update = true;\n\n}\n\n\n\nvoid Node::setScale(float inX, float inY, float inZ)\n\n{\n\n m_scale.x = inX;\n\n m_scale.y = inY;\n", "file_path": "Node.cpp", "rank": 66, "score": 4.138491716427565 }, { "content": " void sortByMeshID();\n\n\n\n\n\n private:\n\n VkeNodeData::Map m_data;\n\n std::vector<VkeNodeData::ID> m_deleted_keys;\n\n };\n\n\n\n\n\n VkeNodeData();\n\n VkeNodeData(const ID& inID);\n\n ~VkeNodeData();\n\n\n\n\n\n void setMesh(VkeMesh* inMesh) { m_mesh = inMesh; }\n\n VkeMesh* getMesh() { return m_mesh; }\n\n\n\n Node* getNode() { return m_node; }\n\n\n\n inline void setIndex(size_t inIndex) { m_index = inIndex; }\n", "file_path": "VkeNodeData.h", "rank": 67, "score": 4.138491716427565 }, { "content": " void addVertex(const Vec4f& inVertex, const Vec4f& inNormal);\n\n void addIndex(const uint32_t& inIndex);\n\n\n\n Triangle4f getTriangle(const uint32_t inIndex);\n\n Triangle4f getTransformedTriangle(Mat4x4f& inTransform, const uint32_t inIndex);\n\n\n\n uint32_t getVertexCount() { return m_vertex_count; }\n\n uint32_t getIndexCount() { return m_index_count; }\n\n\n\n uint32_t getMaxVertexCount() { return m_max_vertices; }\n\n uint32_t getMaxIndexCount() { return m_max_indices; }\n\n\n\n uint32_t getTriangleCount() { return m_triangle_count; }\n\n\n\n void setVertexCount(const uint32_t& inCount) { m_vertex_count = inCount; };\n\n void setIndexCount(const uint32_t& inCount)\n\n {\n\n m_index_count = inCount;\n\n m_triangle_count = m_index_count / 3;\n\n };\n", "file_path": "Mesh.h", "rank": 68, "score": 4.109794186396051 }, { "content": " initProjection();\n\n}\n\n\n\nvoid Camera::initProjection(const float& inFOV, const float& inNear, const float& inFar)\n\n{\n\n\n\n m_fov = inFOV;\n\n m_near = inNear;\n\n m_far = inFar;\n\n\n\n m_viewport.m_data[2] = 800.0f;\n\n m_viewport.m_data[3] = 800.0f;\n\n\n\n m_projection_dirty = true;\n\n}\n\n\n\nvoid Camera::updateProjection()\n\n{\n\n\n\n if(!m_projection_dirty)\n", "file_path": "Camera.cpp", "rank": 69, "score": 4.097729614707298 }, { "content": "{\n\n m_usage_flags = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;\n\n m_memory_flags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;\n\n\n\n initBackingStore(sizeof(VkeMaterialUniform));\n\n initVKBufferData();\n\n}\n\n\n\nvoid VkeMaterial::initMaterialDataSubAlloc()\n\n{\n\n initBackingStore(sizeof(VkeMaterialUniform));\n\n}\n\n\n\nvoid VkeMaterial::updateVKBufferData(VkeMaterialUniform* inData)\n\n{\n\n uint8_t* ptr = (uint8_t*)inData + (sizeof(VkeMaterialUniform) * m_id);\n\n memcpy(ptr, (void*)&m_backing_store->reflectivity, sizeof(VkeMaterialUniform));\n\n}\n\n\n\nvoid VkeMaterial::bind(VkCommandBuffer* inBuffer) {}\n", "file_path": "VkeMaterial.cpp", "rank": 70, "score": 4.097630830595087 }, { "content": "\n\n void initProjection(const float& inFOV = 45.0f, const float& inNear = 0.01, const float& inFar = 100.0);\n\n void updateProjection();\n\n\n\n void setViewport(const float inMinX, const float inMinY, const float inMaxX, const float inMaxY)\n\n {\n\n m_viewport.m_data[0] = inMinX;\n\n m_viewport.m_data[1] = inMinY;\n\n m_viewport.m_data[2] = inMaxX;\n\n m_viewport.m_data[3] = inMaxY;\n\n }\n\n\n\nprotected:\n\n nvmath::mat4f m_projection;\n\n\n\n float m_fov;\n\n float m_near;\n\n float m_far;\n\n\n\n Vec4f m_viewport;\n\n\n\n bool m_projection_dirty;\n\n};\n\n\n\n#endif\n", "file_path": "Camera.h", "rank": 71, "score": 4.073551381311355 }, { "content": " m_ibo.initBackingStore(dataSize);\n\n uint32_t* iData = m_ibo.getBackingStore();\n\n memcpy(iData, (const void*)quadIdxs, dataSize);\n\n\n\n m_vbo.initVKBufferData();\n\n m_ibo.initVKBufferData();\n\n}\n\n\n\nvoid VkeTerrainQuad::draw(VkCommandBuffer* inCommand)\n\n{\n\n vkCmdDrawIndexed(*inCommand, 4, 256, 0, 0, 0);\n\n}\n\n\n\nvoid VkeTerrainQuad::bind(VkCommandBuffer* inCmd)\n\n{\n\n m_vbo.bind(inCmd);\n\n m_ibo.bind(inCmd);\n\n}\n", "file_path": "VkeTerrainQuad.cpp", "rank": 72, "score": 4.057633500031995 }, { "content": " void resetCommandBuffer(CommandBufferID& inID);\n\n void flushCommandBuffer(CommandBufferID& inID, VkFence* inFence = NULL, bool inDestroy = true);\n\n void flushPersistentBuffer(CommandBufferID& inID, VkFence* inFence = NULL);\n\n\n\n VkCommandBuffer getCachedCommandBuffer(CommandBufferID& inID);\n\n void destroyCachedCommandBuffer(CommandBufferID& inID);\n\n\n\n inline VkQueue& getVKQueue() { return m_queue; }\n\n\n\n\n\n private:\n\n Name m_name;\n\n NodeID m_node_id;\n\n VkQueue m_queue;\n\n VulkanDC::Device* m_device;\n\n\n\n VkCommandPool m_command_pool;\n\n CommandBufferMap m_cached_buffers;\n\n };\n\n\n", "file_path": "VulkanDeviceContext.h", "rank": 73, "score": 4.037878264188139 }, { "content": "\n\n#include \"WMath.h\"\n\n\n\n// clang-format off\n\nMat4x4f identity4x4(){\n\n\tMat4x4f out = {\n\n\t\t1.0, 0.0, 0.0, 0.0,\n\n\t\t0.0, 1.0, 0.0, 0.0,\n\n\t\t0.0, 0.0, 1.0, 0.0,\n\n\t\t0.0, 0.0, 0.0, 1.0\n\n\t};\n\n\n\n\treturn out;\n\n}\n\n\n\nMat4x4f rotate4x4(const Quaternion<float> &q){\n\n\n\n\tMat4x4f out = identity4x4();\n\n\n\n\tout.m_data[0] = 1.0 - (2.0*q.j*q.j + 2.0*q.k*q.k);\n", "file_path": "WMath.cpp", "rank": 74, "score": 3.9678517487001503 }, { "content": "\n\nvoid VkeNodeData::updateConstantVKBufferData(VkCommandBuffer* inBuffer)\n\n{\n\n\n\n vkCmdUpdateBuffer(*inBuffer, m_data.buffer, 0, m_data_size, (const uint32_t*)&m_backing_store[0]);\n\n}\n\n\n\nvoid VkeNodeData::updateFromNode(VkeNodeUniform* inData, uint32_t inInstanceCount)\n\n{\n\n updateFromNode(m_node, inData, inInstanceCount);\n\n}\n\n\n\nvoid VkeNodeData::updateFromNode()\n\n{\n\n updateFromNode(m_node);\n\n}\n\n\n\nVkeNodeData::~VkeNodeData() {}\n\n\n\nVkeNodeData::List::List() {}\n", "file_path": "VkeNodeData.cpp", "rank": 75, "score": 3.9646788067208307 }, { "content": " {\n\n m_fov = inFOV;\n\n m_projection_dirty = true;\n\n }\n\n\n\n inline float getNear() { return m_near; }\n\n\n\n inline void setNear(const float& inNear)\n\n {\n\n m_near = inNear;\n\n m_projection_dirty = true;\n\n }\n\n\n\n inline float getFar() { return m_far; }\n\n\n\n inline void setFar(const float& inFar)\n\n {\n\n m_far = inFar;\n\n m_projection_dirty = true;\n\n }\n", "file_path": "Camera.h", "rank": 76, "score": 3.9571858756581424 }, { "content": "\n\nNode::NodeList& Scene::Lights()\n\n{\n\n return m_light_list;\n\n}\n\n\n\nvoid Scene::CurrentCamera(Camera* inCamera)\n\n{\n\n m_current_camera = inCamera;\n\n}\n\n\n\nvoid Scene::CurrentCamera(const Camera::ID& inCamera)\n\n{\n\n m_current_camera = (Camera*)m_camera_list.getNode(inCamera);\n\n}\n\n\n\nCamera* Scene::CurrentCamera()\n\n{\n\n return m_current_camera;\n\n}\n", "file_path": "Scene.cpp", "rank": 77, "score": 3.9571858756581424 }, { "content": "{\n\n nvmath::vec4f outPosition(0.0, 0.0, 0.0, 1.0);\n\n\n\n return m_transform(outPosition);\n\n}\n\n\n\nnvmath::vec4f Node::worldPosition(nvmath::vec4f& inPosition)\n\n{\n\n return m_transform(inPosition);\n\n}\n\n\n\nvoid Node::draw() {}\n\n\n\nvoid Node::setPosition(float inX, float inY, float inZ)\n\n{\n\n m_position.x = inX;\n\n m_position.y = inY;\n\n m_position.z = inZ;\n\n m_transform_needs_update = true;\n\n}\n", "file_path": "Node.cpp", "rank": 78, "score": 3.934693884460903 }, { "content": "#include \"VulkanAppContext.h\"\n\n#include \"VulkanDeviceContext.h\"\n\n\n\nusing namespace nvh;\n\nusing namespace nvgl;\n\nusing namespace nvmath;\n\n\n\n\n\nextern bool vulkanInitLibrary();\n\n\n\nnamespace pathclipping {\n\nint const SAMPLE_SIZE_WIDTH(1024);\n\nint const SAMPLE_SIZE_HEIGHT(768);\n\nint const SAMPLE_MAJOR_VERSION(4);\n\nint const SAMPLE_MINOR_VERSION(5);\n\n\n\nint const PERLIN_GRID_U_SIZE(128);\n\nint const PERLIN_GRID_V_SIZE(128);\n\n\n\n\n", "file_path": "vulkansandbox.cpp", "rank": 79, "score": 3.925454564114192 }, { "content": "\n\n#include \"VkeAnimationNode.h\"\n\n#include \"Node.h\"\n\n\n\nVkeAnimationNode::VkeAnimationNode()\n\n : m_scene_node(NULL)\n\n , m_parent(NULL)\n\n{\n\n}\n\n\n\nVkeAnimationNode::VkeAnimationNode(VkeAnimationNode::Name& inName, VkeSceneAnimation* inParent)\n\n : m_name(inName)\n\n , m_scene_node(NULL)\n\n , m_parent(inParent)\n\n{\n\n\n\n m_position.setParent(inParent);\n\n m_rotation.setParent(inParent);\n\n m_scale.setParent(inParent);\n\n}\n", "file_path": "VkeAnimationNode.cpp", "rank": 80, "score": 3.904678098461293 }, { "content": " struct\n\n {\n\n GLuint scene_color, scene_depthstencil;\n\n } textures;\n\n\n\n\n\n bool begin();\n\n void think(double time);\n\n void resize(int width, int height);\n\n\n\n bool initProgram();\n\n bool initVulkan();\n\n bool initScene();\n\n bool initMisc();\n\n\n\n bool initFramebuffers(int width, int height, int samples);\n\n\n\npublic:\n\n};\n\n\n", "file_path": "vulkansandbox.cpp", "rank": 81, "score": 3.8904683251508407 }, { "content": "{\n\n nvmath::vec3f angles;\n\n inQuat.to_euler_xyz(angles);\n\n setRotation(angles.x, angles.y, angles.z);\n\n\n\n m_transform_needs_update = true;\n\n}\n\n\n\nvoid VkeCamera::setNear(float inNear)\n\n{\n\n m_near = inNear;\n\n m_projection_needs_update = true;\n\n}\n\n\n\nvoid VkeCamera::setFar(float inFar)\n\n{\n\n m_far = inFar;\n\n m_projection_needs_update = true;\n\n}\n\n\n", "file_path": "VkeCamera.cpp", "rank": 82, "score": 3.8472258971275144 }, { "content": "/*\n\n * Copyright (c) 2014-2021, NVIDIA CORPORATION. All rights reserved.\n\n *\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n *\n\n * SPDX-FileCopyrightText: Copyright (c) 2014-2021 NVIDIA CORPORATION\n\n * SPDX-License-Identifier: Apache-2.0\n\n */\n\n\n\n/* Contact [email protected] (Chris Hebert) for feedback */\n\n\n\n#ifndef __H_VKE_ANIMATION_NODE_\n\n#define __H_VKE_ANIMATION_NODE_\n\n\n\n#pragma once\n\n#include \"VkeAnimationChannel.h\"\n\n#include \"VkeNodeData.h\"\n\n#include <map>\n\n\n", "file_path": "VkeAnimationNode.h", "rank": 83, "score": 3.830289526855651 }, { "content": " VkDeviceMemory memory;\n\n VkBufferView view;\n\n VkDescriptorBufferInfo descriptor;\n\n };\n\n\n\n void deleteBackingStore()\n\n {\n\n if(m_backing_store == NULL)\n\n return;\n\n free(m_backing_store);\n\n }\n\n\n\n void initBackingStore(size_t inSize)\n\n {\n\n m_data_size = inSize;\n\n m_backing_store = (T*)malloc(m_data_size);\n\n }\n\n\n\n T*& getBackingStore() { return m_backing_store; }\n\n\n", "file_path": "VkeBuffer.h", "rank": 84, "score": 3.804934178344741 }, { "content": " Data& getData() { return m_data; }\n\n\n\n VkDescriptorBufferInfo& getDescriptor() { return m_data.descriptor; }\n\n\n\n virtual void updateVKBufferData(VkCommandBuffer* inBuffer = NULL, bool doStage = true)\n\n {\n\n if(m_backing_store == NULL)\n\n return;\n\n uint8_t* vData = NULL;\n\n\n\n Data& useData = (m_use_staging) ? m_staging : m_data;\n\n\n\n VKA_CHECK_ERROR(vkMapMemory(getDefaultDevice(), useData.memory, 0, VK_WHOLE_SIZE, 0, (void**)&vData),\n\n \"Could not map buffer memory.\\n\");\n\n\n\n memcpy(vData, (const void*)&(m_backing_store[0]), m_data_size);\n\n\n\n vkUnmapMemory(getDefaultDevice(), useData.memory);\n\n\n\n if(m_use_staging)\n", "file_path": "VkeBuffer.h", "rank": 85, "score": 3.7771965423197074 }, { "content": "}\n\n\n\nvoid VkeNodeData::List::update()\n\n{\n\n VkeNodeData::Map::iterator itr;\n\n\n\n size_t sz = m_data.size();\n\n for(size_t i = 0; i < sz; ++i)\n\n {\n\n m_data[i]->updateFromNode();\n\n }\n\n}\n\n\n\nvoid VkeNodeData::List::update(VkeNodeUniform* inData, uint32_t inInstanceCount)\n\n{\n\n VkeNodeData::Map::iterator itr;\n\n\n\n size_t sz = m_data.size();\n\n for(size_t i = 0; i < sz; ++i)\n\n {\n", "file_path": "VkeNodeData.cpp", "rank": 87, "score": 3.763562156889104 }, { "content": "\n\n\n\nvoid VkeNodeData::List::sortByMaterialID()\n\n{\n\n std::sort(m_data.begin(), m_data.end(), sortByMatFunc);\n\n size_t sz = m_data.size();\n\n for(size_t i = 0; i < sz; ++i)\n\n {\n\n m_data[i]->setIndex(i);\n\n }\n\n}\n\n\n\nvoid VkeNodeData::List::sortByOpacity()\n\n{\n\n std::sort(m_data.begin(), m_data.end(), sortByOpacityFunc);\n\n size_t sz = m_data.size();\n\n for(size_t i = 0; i < sz; ++i)\n\n {\n\n m_data[i]->setIndex(i);\n\n }\n", "file_path": "VkeNodeData.cpp", "rank": 88, "score": 3.7031639846815745 }, { "content": "void RenderContext::deleteMesh(const Mesh::ID& inID)\n\n{\n\n Mesh* mesh = m_mesh_map[inID];\n\n if(mesh)\n\n {\n\n m_mesh_map.erase(inID);\n\n delete mesh;\n\n mesh = NULL;\n\n }\n\n}\n\n\n\n\n\nvoid RenderContext::getRenderTriangles(const Scene::ID& inID, render::TriangleList& outTriangles)\n\n{\n\n Scene* scene = getScene(inID);\n\n if(!scene)\n\n return;\n\n\n\n scene->getTriangles(outTriangles);\n\n}\n\n\n\nRenderContext::~RenderContext() {}\n", "file_path": "RenderContext.cpp", "rank": 89, "score": 3.7031639846815745 }, { "content": "\n\n\n\n int32_t getMaterialID() { return m_material_id; }\n\n void setFirstIndex(const uint32_t inFirstIndex) { m_first_index = inFirstIndex; }\n\n void setFirstVertex(const uint32_t inFirstvertex) { m_first_vertex = inFirstvertex; }\n\n\n\n const uint32_t getFirstIndex() { return m_first_index; }\n\n const uint32_t getFirstVertex() { return m_first_vertex; }\n\n\n\n const uint32_t getIndexCount() { return m_index_count; }\n\n\n\n\n\nprotected:\n\n ID m_id;\n\n\n\n /*\n\n\t\tVertex Buffer\n\n\t*/\n\n VkeVBO m_vbo;\n\n\n", "file_path": "VkeMesh.h", "rank": 90, "score": 3.6639641121174398 }, { "content": "\n\n for(uint32_t i = 0; i < 32; ++i)\n\n {\n\n\n\n if((inType & 1) == 1)\n\n {\n\n if((m_memory_properties.memoryTypes[i].propertyFlags & inFlags) == inFlags)\n\n {\n\n return i;\n\n }\n\n }\n\n inType >>= 1;\n\n }\n\n\n\n return 0;\n\n}\n\n\n\n\n\nvoid VulkanDC::Device::waitIdle()\n\n{\n", "file_path": "VulkanDeviceContext.cpp", "rank": 91, "score": 3.644830056716689 }, { "content": "\n\n Device* m_default_device;\n\n Device::Queue* m_default_queue;\n\n\n\n void initDevices();\n\n\n\n Device* newDevice(const VkPhysicalDevice& inDevice);\n\n};\n\n\n\n#endif\n", "file_path": "VulkanDeviceContext.h", "rank": 92, "score": 3.644830056716689 }, { "content": "}\n\n\n\nvoid VkeNodeData::List::sortByMeshID()\n\n{\n\n std::sort(m_data.begin(), m_data.end(), sortByMeshFunc);\n\n}\n\n\n\nvoid VkeNodeData::initNodeData()\n\n{\n\n\n\n\n\n m_usage_flags = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;\n\n m_memory_flags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;\n\n m_use_staging = true;\n\n\n\n\n\n initBackingStore(sizeof(VkeNodeUniform));\n\n initVKBufferData();\n\n}\n\n\n", "file_path": "VkeNodeData.cpp", "rank": 93, "score": 3.625585447788346 }, { "content": " uint32_t m_queue_count;\n\n Queue::Map m_queues;\n\n VkPhysicalDevice m_physical_device;\n\n VkDevice m_device;\n\n Name m_name;\n\n\n\n\n\n char* m_extension_names[64];\n\n uint32_t m_extension_count;\n\n\n\n void initDevice();\n\n };\n\n\n\n\n\n void initDC(const VkInstance& inInstance);\n\n\n\n uint32_t getQueueCount(uint32_t inDeviceID = 0);\n\n inline uint32_t getDeviceCount() const { return m_device_count; }\n\n\n\n VulkanDC::Device* getDevice(uint32_t inDeviceID = 0);\n", "file_path": "VulkanDeviceContext.h", "rank": 94, "score": 3.625585447788346 }, { "content": " VulkanDC::Device* device = dc->getDefaultDevice();\n\n\n\n bufferCreate(&outData->buf, inputSize, usage);\n\n bufferAlloc(&outData->buf, &outData->memory, flags);\n\n\n\n /*\n\n\tPopulate the data with the vertices.\n\n\tmap/copy/unmap\n\n\t*/\n\n uint8_t* vData;\n\n VKA_CHECK_ERROR(vkMapMemory(device->getVKDevice(), outData->memory, 0, VK_WHOLE_SIZE, 0, (void**)&vData),\n\n \"Could not map vertex buffer memory.\\n\");\n\n memcpy(vData, (const void*)&(inputData[0]), inputSize);\n\n vkUnmapMemory(device->getVKDevice(), outData->memory);\n\n bufferViewCreate(&outData->buf, &outData->view, inputSize);\n\n}\n\n\n\n\n\nvoid bufferAlloc(VkBuffer* inBuffer, VkDeviceMemory* outMemory, VkMemoryPropertyFlags inFlags)\n\n{\n", "file_path": "VkeCreateUtils.cpp", "rank": 95, "score": 3.5941614165195217 }, { "content": "\n\n void getTransformedTriangles(Mat4x4f& inTransform, TriangleList4f& outTriangles);\n\n\n\n ID getID() { return m_id; }\n\n int32_t getMaterialID() { return m_material_id; }\n\n void setMaterialID(const int32_t inID) { m_material_id = inID; }\n\n\n\nprivate:\n\n ID m_id;\n\n\n\n Vec4f* m_vertices;\n\n Vec4f* m_normals;\n\n Vec2f* m_uvs;\n\n\n\n uint32_t* m_indices;\n\n\n\n uint32_t m_max_vertices;\n\n uint32_t m_max_indices;\n\n\n\n uint32_t m_vertex_count;\n\n uint32_t m_index_count;\n\n\n\n uint32_t m_triangle_count;\n\n\n\n int32_t m_material_id;\n\n};\n\n\n\n#endif\n", "file_path": "Mesh.h", "rank": 96, "score": 3.569501640298755 }, { "content": "//GLAPI GLVULKANPROCNV GLAPIENTRY glGetVkInstanceProcAddrNV (const GLchar *name);\n\n//GLAPI void GLAPIENTRY glWaitVkSemaphoreNV(GLuint64 vkSemaphore);\n\n//GLAPI void GLAPIENTRY glSignalVkSemaphoreNV(GLuint64 vkSemaphore);\n\n//GLAPI void GLAPIENTRY glSignalVkFenceNV(GLuint64 vkFence);\n\n//GLAPI void GLAPIENTRY glDrawVkImageNV(GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);\n\n#endif /* GL_GLEXT_PROTOTYPES */\n\n\n\nVkeDrawCall::VkeDrawCall(vkeGameRendererDynamic* inRenderer)\n\n : m_renderer(inRenderer)\n\n , m_buffer_ready(false)\n\n{\n\n m_draw_command[0] = VK_NULL_HANDLE;\n\n m_draw_command[1] = VK_NULL_HANDLE;\n\n\n\n initCommandPool();\n\n initDescriptorPool();\n\n}\n\n\n\nVkeDrawCall::~VkeDrawCall() {}\n\n\n", "file_path": "VkeGameRendererDynamic.cpp", "rank": 97, "score": 3.5602480236148817 }, { "content": "\n\n m_vbo.initVKBufferData();\n\n m_ibo.initVKBufferData();\n\n}\n\n\n\nvoid VkeMesh::initFromMesh(VKSFile* inFile, VKSMeshRecord* inMesh)\n\n{\n\n m_vertex_count = inMesh->vertexCount;\n\n m_index_count = inMesh->indexCount;\n\n m_material_id = inMesh->materialID;\n\n}\n\n\n\nvoid VkeMesh::initFromMesh(Mesh* const inMesh)\n\n{\n\n\n\n if(!inMesh)\n\n return;\n\n\n\n m_vertex_count = inMesh->getVertexCount();\n\n m_index_count = inMesh->getIndexCount();\n", "file_path": "VkeMesh.cpp", "rank": 98, "score": 3.551190639674398 }, { "content": " m_data[i]->updateFromNode(inData, inInstanceCount);\n\n }\n\n}\n\n\n\nvoid VkeNodeData::List::getDescriptors(VkDescriptorBufferInfo* outDescriptors)\n\n{\n\n VkeNodeData::Map::iterator itr;\n\n size_t sz = m_data.size();\n\n for(size_t i = 0; i < sz; ++i)\n\n {\n\n outDescriptors[i] = m_data[i]->getDescriptor();\n\n }\n\n}\n\n\n\nvoid VkeNodeData::List::getMeshes(VkeMesh** outMeshes)\n\n{\n\n VkeNodeData::Map::iterator itr;\n\n size_t sz = m_data.size();\n\n\n\n for(size_t i = 0; i < sz; ++i)\n\n {\n\n outMeshes[i] = m_data[i]->getMesh();\n\n }\n\n}\n", "file_path": "VkeNodeData.cpp", "rank": 99, "score": 3.4973677455349765 } ]
C++
src/carnot/end_to_end_join_test.cc
hangqiu/pixie
1dd4af47d40ff856c4d52a1d6de81f78a76ff31e
#include <google/protobuf/text_format.h> #include <algorithm> #include <map> #include <tuple> #include <unordered_map> #include <vector> #include <pypa/parser/parser.hh> #include "src/carnot/carnot.h" #include "src/carnot/exec/local_grpc_result_server.h" #include "src/carnot/exec/test_utils.h" #include "src/carnot/udf_exporter/udf_exporter.h" #include "src/common/testing/testing.h" #include "src/table_store/table_store.h" namespace px { namespace carnot { using exec::CarnotTestUtils; class JoinTest : public ::testing::Test { protected: void SetUp() override { Test::SetUp(); table_store_ = std::make_shared<table_store::TableStore>(); result_server_ = std::make_unique<exec::LocalGRPCResultSinkServer>(); carnot_ = Carnot::Create(sole::uuid4(), table_store_, std::bind(&exec::LocalGRPCResultSinkServer::StubGenerator, result_server_.get(), std::placeholders::_1)) .ConsumeValueOrDie(); auto left_table = CarnotTestUtils::TestTable(); table_store_->AddTable("left_table", left_table); auto right_table = CarnotTestUtils::TestTable(); table_store_->AddTable("right_table", right_table); } std::shared_ptr<table_store::TableStore> table_store_; std::unique_ptr<exec::LocalGRPCResultSinkServer> result_server_; std::unique_ptr<Carnot> carnot_; }; TEST_F(JoinTest, basic) { std::string queryString = "import px\n" "src1 = px.DataFrame(table='left_table', select=['col1', 'col2'])\n" "src2 = px.DataFrame(table='right_table', select=['col1', 'col2'])\n" "join = src1.merge(src2, how='inner', left_on=['col1', 'col2'], right_on=['col1', 'col2'], " "suffixes=['', '_x'])\n" "join['left_col1'] = join['col1']\n" "join['right_col2'] = join['col2']\n" "df = join[['left_col1', 'right_col2']]\n" "px.display(df, 'joined')"; auto query = absl::StrJoin({queryString}, "\n"); auto query_id = sole::uuid4(); auto s = carnot_->ExecuteQuery(query, query_id, 0); ASSERT_OK(s); auto exec_stats = result_server_->exec_stats().ConsumeValueOrDie(); EXPECT_EQ(10, exec_stats.execution_stats().records_processed()); EXPECT_EQ(10 * sizeof(double) + 10 * sizeof(int64_t), exec_stats.execution_stats().bytes_processed()); EXPECT_LT(0, exec_stats.execution_stats().timing().execution_time_ns()); EXPECT_THAT(result_server_->output_tables(), ::testing::UnorderedElementsAre("joined")); auto output_batches = result_server_->query_results("joined"); EXPECT_EQ(1, output_batches.size()); auto rb1 = output_batches[0]; std::vector<types::Float64Value> expected_col1 = {0.5, 1.2, 5.3, 0.1, 5.1}; std::vector<types::Int64Value> expected_col2 = {1, 2, 3, 5, 6}; EXPECT_TRUE(rb1.ColumnAt(0)->Equals(types::ToArrow(expected_col1, arrow::default_memory_pool()))); EXPECT_TRUE(rb1.ColumnAt(1)->Equals(types::ToArrow(expected_col2, arrow::default_memory_pool()))); } TEST_F(JoinTest, self_join) { std::string queryString = "import px\n" "src1 = px.DataFrame(table='left_table', select=['col1', 'col2'])\n" "join = src1.merge(src1, how='inner', left_on=['col1'], right_on=['col1'], " "suffixes=['', '_x'])\n" "join['left_col1'] = join['col1']\n" "join['right_col2'] = join['col2_x']\n" "output = join[['left_col1', 'right_col2']]\n" "px.display(output, 'joined')"; auto query = absl::StrJoin({queryString}, "\n"); auto query_id = sole::uuid4(); auto s = carnot_->ExecuteQuery(query, query_id, 0); ASSERT_OK(s); auto exec_stats = result_server_->exec_stats().ConsumeValueOrDie(); EXPECT_EQ(5, exec_stats.execution_stats().records_processed()); EXPECT_EQ(5 * sizeof(double) + 5 * sizeof(int64_t), exec_stats.execution_stats().bytes_processed()); EXPECT_LT(0, exec_stats.execution_stats().timing().execution_time_ns()); EXPECT_THAT(result_server_->output_tables(), ::testing::UnorderedElementsAre("joined")); auto output_batches = result_server_->query_results("joined"); EXPECT_EQ(1, output_batches.size()); auto rb1 = output_batches[0]; std::vector<types::Float64Value> expected_col1 = {0.5, 1.2, 5.3, 0.1, 5.1}; std::vector<types::Int64Value> expected_col2 = {1, 2, 3, 5, 6}; EXPECT_TRUE(rb1.ColumnAt(0)->Equals(types::ToArrow(expected_col1, arrow::default_memory_pool()))); EXPECT_TRUE(rb1.ColumnAt(1)->Equals(types::ToArrow(expected_col2, arrow::default_memory_pool()))); } } }
#include <google/protobuf/text_format.h> #include <algorithm> #include <map> #include <tuple> #include <unordered_map> #include <vector> #include <pypa/parser/parser.hh> #include "src/carnot/carnot.h" #include "src/carnot/exec/local_grpc_result_server.h" #include "src/carnot/exec/test_utils.h" #include "src/carnot/udf_exporter/udf_exporter.h" #include "src/common/testing/testing.h" #include "src/table_store/table_store.h" namespace px { namespace carnot { using exec::CarnotTestUtils; class JoinTest : public ::testing::Test { protected: void SetUp() override { Test::SetUp(); table_store_ = std::make_shared<table_store::TableStore>(); result_server_ = std::make_unique<exec::LocalGRPCResultSinkServer>(); carnot_ = Carnot::Create(sole::uuid4(), table_store_, std::bind(&exec::LocalGRPCResultSinkServer::StubGenerator, result_server_.get(), std::placeholders::_1)) .ConsumeValueOrDie(); auto left_table = CarnotTestUtils::TestTable(); table_store_->AddTable("left_table", left_table); auto right_table = CarnotTestUtils::TestTable(); table_store_->AddTable("right_table", right_table); } std::shared_ptr<table_store::TableStore> table_store_; std::unique_ptr<exec::LocalGRPCResultSinkServer> result_server_; std::unique_ptr<Carnot> carnot_; }; TEST_F(JoinTest, basic) { std::string queryString = "import px\n" "src1 = px.DataFrame(table='left_table', select=['col1', 'col2'])\n" "src2 = px.DataFrame(table='right_table', select=['col1', 'col2'])\n" "join = src1.merge(src2, how='inner', left_on=['col1', 'col2'], right_on=['col1', 'col2'], " "suffixes=['', '_x'])\n" "join['left_col1'] = join['col1']\n" "join['right_col2'] = join['col2']\n" "df = join[['left_col1', 'right_col2']]\n" "px.display(df, 'joined')"; auto query = absl::StrJoin({queryString}, "\n"); auto query_id = sole::uuid4(); auto s = carnot_->ExecuteQuery(query, query_id, 0); ASSERT_OK(s); auto exec_stats = result_server_->exec_stats().ConsumeValueOrDie(); EXPECT_EQ(10, exec_stats.execution_stats().records_processed()); EXPECT_EQ(10 * sizeof(double) + 10 * sizeof(int64_t), exec_stats.execution_stats().bytes_processed()); EXPECT_LT(0, exec_stats.execution_stats().timing().execution_time_ns()); EXPECT_THAT(result_server_->output_tables(), ::testing::UnorderedElementsAre("joined")); auto output_batches = result_server_->query_results("joined"); EXPECT_EQ(1, output_batches.size()); auto rb1 = output_batches[0]; std::vector<types::Float64Value> expected_col1 = {0.5, 1.2, 5.3, 0.
auto query = absl::StrJoin({queryString}, "\n"); auto query_id = sole::uuid4(); auto s = carnot_->ExecuteQuery(query, query_id, 0); ASSERT_OK(s); auto exec_stats = result_server_->exec_stats().ConsumeValueOrDie(); EXPECT_EQ(5, exec_stats.execution_stats().records_processed()); EXPECT_EQ(5 * sizeof(double) + 5 * sizeof(int64_t), exec_stats.execution_stats().bytes_processed()); EXPECT_LT(0, exec_stats.execution_stats().timing().execution_time_ns()); EXPECT_THAT(result_server_->output_tables(), ::testing::UnorderedElementsAre("joined")); auto output_batches = result_server_->query_results("joined"); EXPECT_EQ(1, output_batches.size()); auto rb1 = output_batches[0]; std::vector<types::Float64Value> expected_col1 = {0.5, 1.2, 5.3, 0.1, 5.1}; std::vector<types::Int64Value> expected_col2 = {1, 2, 3, 5, 6}; EXPECT_TRUE(rb1.ColumnAt(0)->Equals(types::ToArrow(expected_col1, arrow::default_memory_pool()))); EXPECT_TRUE(rb1.ColumnAt(1)->Equals(types::ToArrow(expected_col2, arrow::default_memory_pool()))); } } }
1, 5.1}; std::vector<types::Int64Value> expected_col2 = {1, 2, 3, 5, 6}; EXPECT_TRUE(rb1.ColumnAt(0)->Equals(types::ToArrow(expected_col1, arrow::default_memory_pool()))); EXPECT_TRUE(rb1.ColumnAt(1)->Equals(types::ToArrow(expected_col2, arrow::default_memory_pool()))); } TEST_F(JoinTest, self_join) { std::string queryString = "import px\n" "src1 = px.DataFrame(table='left_table', select=['col1', 'col2'])\n" "join = src1.merge(src1, how='inner', left_on=['col1'], right_on=['col1'], " "suffixes=['', '_x'])\n" "join['left_col1'] = join['col1']\n" "join['right_col2'] = join['col2_x']\n" "output = join[['left_col1', 'right_col2']]\n" "px.display(output, 'joined')";
random
[ { "content": "class SetupJoinTypeRule : public Rule {\n\n /**\n\n * @brief Converts a right join into a left join.\n\n *\n\n */\n\n public:\n\n SetupJoinTypeRule()\n\n : Rule(nullptr, /*use_topo*/ false, /*reverse_topological_execution*/ false) {}\n\n\n\n protected:\n\n StatusOr<bool> Apply(IRNode* ir_node) override;\n\n\n\n private:\n\n /**\n\n * @brief Swaps the parents and updates any parent references within Join's children nodes.\n\n */\n\n Status ConvertRightJoinToLeftJoin(JoinIR* join_ir);\n\n void FlipColumns(const std::vector<ColumnIR*>& cols);\n\n};\n\n\n\n} // namespace compiler\n\n} // namespace planner\n\n} // namespace carnot\n\n} // namespace px\n", "file_path": "src/carnot/planner/compiler/analyzer/setup_join_type_rule.h", "rank": 0, "score": 403149.0996719601 }, { "content": "class MapNode : public ProcessingNode {\n\n public:\n\n MapNode() = default;\n\n virtual ~MapNode() = default;\n\n\n\n protected:\n\n std::string DebugStringImpl() override;\n\n Status InitImpl(const plan::Operator& plan_node) override;\n\n Status PrepareImpl(ExecState* exec_state) override;\n\n Status OpenImpl(ExecState* exec_state) override;\n\n Status CloseImpl(ExecState* exec_state) override;\n\n Status ConsumeNextImpl(ExecState* exec_state, const table_store::schema::RowBatch& rb,\n\n size_t parent_index) override;\n\n\n\n private:\n\n std::unique_ptr<ExpressionEvaluator> evaluator_;\n\n std::unique_ptr<plan::MapOperator> plan_node_;\n\n std::unique_ptr<udf::FunctionContext> function_ctx_;\n\n};\n\n\n\n} // namespace exec\n\n} // namespace carnot\n\n} // namespace px\n", "file_path": "src/carnot/exec/map_node.h", "rank": 2, "score": 341334.1801830397 }, { "content": "class MySQLCommandNameUDF : public px::carnot::udf::ScalarUDF {\n\n public:\n\n StringValue Exec(FunctionContext*, Int64Value api_key);\n\n\n\n static udf::ScalarUDFDocBuilder Doc() {\n\n return udf::ScalarUDFDocBuilder(\"Convert a MySQL command code to its name.\")\n\n .Details(\"UDF to convert MySQL request command codes into their corresponding names.\")\n\n .Arg(\"cmd\", \"A MySQL command code\")\n\n .Example(\"df.cmd = px.kafka_api_key_name(df.req_cmd)\")\n\n .Returns(\"The request code's name.\");\n\n }\n\n};\n\n\n\nvoid RegisterProtocolOpsOrDie(px::carnot::udf::Registry* registry);\n\n\n\n} // namespace protocols\n\n} // namespace funcs\n\n} // namespace carnot\n\n} // namespace px\n", "file_path": "src/carnot/funcs/protocols/protocol_ops.h", "rank": 3, "score": 339460.66864179086 }, { "content": "class HTTPRespMessageUDF : public px::carnot::udf::ScalarUDF {\n\n public:\n\n StringValue Exec(FunctionContext*, Int64Value resp_code);\n\n\n\n static udf::ScalarUDFDocBuilder Doc() {\n\n return udf::ScalarUDFDocBuilder(\"Convert an HTTP response code to its corresponding message.\")\n\n .Details(\"UDF to convert HTTP response codes into their corresponding messages.\")\n\n .Arg(\"code\", \"An HTTP response code (e.g. 404)\")\n\n .Example(\"df.resp_message = px.http_resp_message(df.resp_status)\")\n\n .Returns(\"The HTTP response message.\");\n\n }\n\n};\n\n\n", "file_path": "src/carnot/funcs/protocols/protocol_ops.h", "rank": 4, "score": 339460.66864179086 }, { "content": "class JoinIR : public OperatorIR {\n\n public:\n", "file_path": "src/carnot/planner/ir/join_ir.h", "rank": 5, "score": 337661.8248173473 }, { "content": "class MapIR : public OperatorIR {\n\n public:\n\n MapIR() = delete;\n\n explicit MapIR(int64_t id) : OperatorIR(id, IRNodeType::kMap) {}\n\n\n\n Status Init(OperatorIR* parent, const ColExpressionVector& col_exprs, bool keep_input_columns);\n\n\n\n const ColExpressionVector& col_exprs() const { return col_exprs_; }\n\n Status SetColExprs(const ColExpressionVector& exprs);\n\n Status AddColExpr(const ColumnExpression& expr);\n\n Status UpdateColExpr(std::string_view name, ExpressionIR* expr);\n\n Status UpdateColExpr(ExpressionIR* old_expr, ExpressionIR* new_expr);\n\n Status ToProto(planpb::Operator*) const override;\n\n Status CopyFromNodeImpl(const IRNode* node,\n\n absl::flat_hash_map<const IRNode*, IRNode*>* copied_nodes_map) override;\n\n\n\n bool keep_input_columns() const { return keep_input_columns_; }\n\n void set_keep_input_columns(bool keep_input_columns) { keep_input_columns_ = keep_input_columns; }\n\n\n\n StatusOr<std::vector<absl::flat_hash_set<std::string>>> RequiredInputColumns() const override;\n", "file_path": "src/carnot/planner/ir/map_ir.h", "rank": 6, "score": 337624.23530047166 }, { "content": "class KafkaAPIKeyNameUDF : public px::carnot::udf::ScalarUDF {\n\n public:\n\n StringValue Exec(FunctionContext*, Int64Value api_key);\n\n\n\n static udf::ScalarUDFDocBuilder Doc() {\n\n return udf::ScalarUDFDocBuilder(\"Convert a Kafka API key to its name.\")\n\n .Details(\"UDF to convert Kafka API keys into their corresponding human-readable names.\")\n\n .Arg(\"api_key\", \"A Kafka API key\")\n\n .Example(\"df.api_key_name = px.kafka_api_key_name(df.req_cmd)\")\n\n .Returns(\"The API key's name.\");\n\n }\n\n};\n\n\n", "file_path": "src/carnot/funcs/protocols/protocol_ops.h", "rank": 7, "score": 336283.99643706065 }, { "content": "class JoinOperator : public Operator {\n\n public:\n\n explicit JoinOperator(int64_t id) : Operator(id, planpb::JOIN_OPERATOR) {}\n\n ~JoinOperator() override = default;\n\n\n\n StatusOr<table_store::schema::Relation> OutputRelation(\n\n const table_store::schema::Schema& schema, const PlanState& state,\n\n const std::vector<int64_t>& input_ids) const override;\n\n Status Init(const planpb::JoinOperator& pb);\n\n std::string DebugString() const override;\n\n\n\n // Static debug functions on the helper classes.\n\n // These can also be for printing debug information in both the operator and exec node.\n\n static std::string DebugString(planpb::JoinOperator::JoinType type);\n\n static std::string DebugString(\n\n const std::vector<planpb::JoinOperator::EqualityCondition>& conditions);\n\n\n\n const std::vector<std::string>& column_names() const { return column_names_; }\n\n planpb::JoinOperator::JoinType type() const { return pb_.type(); }\n\n std::vector<planpb::JoinOperator::EqualityCondition> equality_conditions() const {\n", "file_path": "src/carnot/plan/operators.h", "rank": 8, "score": 334885.7712183613 }, { "content": "class MapOperator : public Operator {\n\n public:\n\n explicit MapOperator(int64_t id) : Operator(id, planpb::MAP_OPERATOR) {}\n\n ~MapOperator() override = default;\n\n\n\n StatusOr<table_store::schema::Relation> OutputRelation(\n\n const table_store::schema::Schema& schema, const PlanState& state,\n\n const std::vector<int64_t>& input_ids) const override;\n\n Status Init(const planpb::MapOperator& pb);\n\n std::string DebugString() const override;\n\n\n\n const std::vector<std::shared_ptr<const ScalarExpression>>& expressions() const {\n\n return expressions_;\n\n }\n\n\n\n private:\n\n std::vector<std::shared_ptr<const ScalarExpression>> expressions_;\n\n std::vector<std::string> column_names_;\n\n\n\n planpb::MapOperator pb_;\n\n};\n\n\n", "file_path": "src/carnot/plan/operators.h", "rank": 9, "score": 334853.6475253421 }, { "content": "class FakeGRPCSourceNode : public px::carnot::exec::GRPCSourceNode {\n\n public:\n\n Status EnqueueRowBatch(std::unique_ptr<px::carnotpb::TransferResultChunkRequest> row_batch) {\n\n row_batches.emplace_back(std::move(row_batch));\n\n\n\n return Status::OK();\n\n }\n\n\n\n std::vector<std::unique_ptr<px::carnotpb::TransferResultChunkRequest>> row_batches;\n\n};\n\n\n\nTEST_F(GRPCRouterTest, no_node_router_test) {\n\n int64_t grpc_source_node_id = 1;\n\n uint64_t ab = 0xea8aa095697f49f1, cd = 0xb127d50e5b6e2645;\n\n\n\n carnotpb::TransferResultChunkRequest initiate_stream_req0;\n\n auto query_id = initiate_stream_req0.mutable_query_id();\n\n query_id->set_high_bits(ab);\n\n query_id->set_low_bits(cd);\n\n initiate_stream_req0.mutable_query_result()->set_grpc_source_id(grpc_source_node_id);\n", "file_path": "src/carnot/exec/grpc_router_test.cc", "rank": 10, "score": 333185.3137481618 }, { "content": "class DropToMapOperatorRule : public Rule {\n\n /**\n\n * @brief Takes a DropIR and converts it to the corresponding Map IR.\n\n */\n\n public:\n\n explicit DropToMapOperatorRule(CompilerState* compiler_state)\n\n : Rule(compiler_state, /*use_topo*/ false, /*reverse_topological_execution*/ false) {}\n\n\n\n protected:\n\n StatusOr<bool> Apply(IRNode* ir_node) override;\n\n\n\n private:\n\n StatusOr<bool> DropToMap(DropIR* drop_ir);\n\n};\n\n\n\n} // namespace compiler\n\n} // namespace planner\n\n} // namespace carnot\n\n} // namespace px\n", "file_path": "src/carnot/planner/compiler/analyzer/drop_to_map_rule.h", "rank": 11, "score": 327071.3101314036 }, { "content": "class CombineConsecutiveMapsRule : public Rule {\n\n public:\n\n CombineConsecutiveMapsRule()\n\n : Rule(nullptr, /*use_topo*/ true, /*reverse_topological_execution*/ false) {}\n\n\n\n protected:\n\n StatusOr<bool> Apply(IRNode* ir_node) override;\n\n bool ShouldCombineMaps(MapIR* parent, MapIR* child,\n\n const absl::flat_hash_set<std::string>& parent_col_names);\n\n Status CombineMaps(MapIR* parent, MapIR* child,\n\n const absl::flat_hash_set<std::string>& parent_col_names);\n\n};\n\n\n\n} // namespace compiler\n\n} // namespace planner\n\n} // namespace carnot\n\n} // namespace px\n", "file_path": "src/carnot/planner/compiler/analyzer/combine_consecutive_maps_rule.h", "rank": 12, "score": 323733.3493381846 }, { "content": "class RowTupleTest : public ::testing::Test {\n\n void SetUp() override {\n\n rt1_.SetValue(0, types::BoolValue(false));\n\n rt1_.SetValue(1, types::Int64Value(1));\n\n rt1_.SetValue(2, types::Float64Value(2.0));\n\n rt1_.SetValue(3, types::StringValue(\"ABC\"));\n\n\n\n rt2_.SetValue(0, types::BoolValue(false));\n\n rt2_.SetValue(1, types::Int64Value(1));\n\n rt2_.SetValue(2, types::Float64Value(2.0));\n\n rt2_.SetValue(3, types::StringValue(\"ABC\"));\n\n }\n\n\n\n protected:\n\n RowTuple rt0_{&types_single};\n\n RowTuple rt1_{&types_variable1};\n\n RowTuple rt2_{&types_variable1};\n\n RowTuple rt3_{&types_variable2};\n\n RowTuple rt4_{&types_variable2};\n\n};\n", "file_path": "src/carnot/exec/row_tuple_test.cc", "rank": 13, "score": 322799.0873189191 }, { "content": "class MapNodeTest : public ::testing::Test {\n\n public:\n\n MapNodeTest() {\n\n auto op_proto = planpb::testutils::CreateTestMapAddTwoCols();\n\n plan_node_ = plan::MapOperator::FromProto(op_proto, 1);\n\n\n\n func_registry_ = std::make_unique<udf::Registry>(\"test_registry\");\n\n EXPECT_OK(func_registry_->Register<AddUDF>(\"add\"));\n\n auto table_store = std::make_shared<table_store::TableStore>();\n\n\n\n exec_state_ = std::make_unique<ExecState>(func_registry_.get(), table_store,\n\n MockResultSinkStubGenerator, sole::uuid4(), nullptr);\n\n EXPECT_OK(exec_state_->AddScalarUDF(\n\n 0, \"add\", std::vector<types::DataType>({types::DataType::INT64, types::DataType::INT64})));\n\n }\n\n\n\n protected:\n\n std::unique_ptr<plan::Operator> plan_node_;\n\n std::unique_ptr<ExecState> exec_state_;\n\n std::unique_ptr<udf::Registry> func_registry_;\n", "file_path": "src/carnot/exec/map_node_test.cc", "rank": 14, "score": 322725.01666448545 }, { "content": "class TupleObject : public CollectionObject {\n\n public:\n\n static constexpr TypeDescriptor TupleType = {\n\n /* name */ \"tuple\",\n\n /* type */ QLObjectType::kTuple,\n\n };\n\n\n\n static StatusOr<std::shared_ptr<TupleObject>> Create(const std::vector<QLObjectPtr>& items,\n\n ASTVisitor* visitor) {\n\n auto tuple = std::shared_ptr<TupleObject>(new TupleObject(items, visitor));\n\n PL_RETURN_IF_ERROR(tuple->Init());\n\n return tuple;\n\n }\n\n\n\n protected:\n\n TupleObject(const std::vector<QLObjectPtr>& items, ASTVisitor* visitor)\n\n : CollectionObject(items, TupleType, visitor) {}\n\n};\n\n\n\n/**\n\n * @brief Contains a list of QLObjects\n\n */\n", "file_path": "src/carnot/planner/objects/collection_object.h", "rank": 15, "score": 322657.6399940734 }, { "content": "class UPIDToNamespaceUDF : public ScalarUDF {\n\n public:\n\n StringValue Exec(FunctionContext* ctx, UInt128Value upid_value) {\n\n auto md = GetMetadataState(ctx);\n\n auto pod_info = UPIDtoPod(md, upid_value);\n\n if (pod_info == nullptr) {\n\n return \"\";\n\n }\n\n return pod_info->ns();\n\n }\n\n\n\n static udf::InfRuleVec SemanticInferenceRules() {\n\n return {\n\n udf::ExplicitRule::Create<UPIDToNamespaceUDF>(types::ST_NAMESPACE_NAME, {types::ST_NONE})};\n\n }\n\n\n\n static udf::ScalarUDFDocBuilder Doc() {\n\n return udf::ScalarUDFDocBuilder(\"Get the Kubernetes namespace from a UPID.\")\n\n .Details(\n\n \"Gets the Kubernetes namespace for the process \"\n", "file_path": "src/carnot/funcs/metadata/metadata_ops.h", "rank": 16, "score": 318780.560226956 }, { "content": "class Carnot : public NotCopyable {\n\n public:\n\n static StatusOr<std::unique_ptr<Carnot>> Create(\n\n const sole::uuid& agent_id, std::unique_ptr<udf::Registry> func_registry,\n\n std::shared_ptr<table_store::TableStore> table_store,\n\n const exec::ResultSinkStubGenerator& stub_generator,\n\n std::function<void(grpc::ClientContext* ctx)> add_auth_to_grpc_context_func,\n\n int grpc_server_port, std::shared_ptr<grpc::ServerCredentials> grpc_server_creds);\n\n\n\n static StatusOr<std::unique_ptr<Carnot>> Create(\n\n const sole::uuid& agent_id, std::shared_ptr<table_store::TableStore> table_store,\n\n const exec::ResultSinkStubGenerator& stub_generator, int grpc_server_port = 0,\n\n std::shared_ptr<grpc::ServerCredentials> grpc_server_creds = nullptr);\n\n\n\n using AgentMetadataCallbackFunc = std::function<std::shared_ptr<const md::AgentMetadataState>()>;\n\n\n\n virtual ~Carnot() = default;\n\n\n\n /**\n\n * Executes the given query.\n", "file_path": "src/carnot/carnot.h", "rank": 17, "score": 318074.5515562056 }, { "content": "class ServiceNameToNamespaceUDF : public ScalarUDF {\n\n public:\n\n StringValue Exec(FunctionContext*, StringValue service_name) {\n\n // This UDF expects the service name to be in the format of \"<ns>/<svc-name>\".\n\n PL_ASSIGN_OR(auto service_name_view, internal::K8sName(service_name), return \"\");\n\n return std::string(service_name_view.first);\n\n }\n\n\n\n static udf::InfRuleVec SemanticInferenceRules() {\n\n return {udf::ExplicitRule::Create<ServiceNameToNamespaceUDF>(types::ST_NAMESPACE_NAME,\n\n {types::ST_NONE})};\n\n }\n\n static udf::ScalarUDFDocBuilder Doc() {\n\n return udf::ScalarUDFDocBuilder(\"Gets the namespace from the service name.\")\n\n .Details(\n\n \"Extracts the namespace from the service name. It expects the service name to come in \"\n\n \"the format\"\n\n \"`<namespace>/<service_name>`, otherwise it'll return an empty string.\")\n\n .Example(R\"doc(# df.service is `pl/kelvin`\n\n | df.namespace = px.service_name_to_namespace(df.service) # \"pl\"\n\n )doc\")\n\n .Arg(\"service_name\", \"The service to extract the namespace.\")\n\n .Returns(\"The namespace of the service.\");\n\n }\n\n};\n\n\n\n/**\n\n * @brief Returns the service ids for services that are currently running.\n\n */\n", "file_path": "src/carnot/funcs/metadata/metadata_ops.h", "rank": 18, "score": 315039.4029132834 }, { "content": "class PodIDToNamespaceUDF : public ScalarUDF {\n\n public:\n\n StringValue Exec(FunctionContext* ctx, StringValue pod_id) {\n\n auto md = GetMetadataState(ctx);\n\n\n\n const auto* pod_info = md->k8s_metadata_state().PodInfoByID(pod_id);\n\n if (pod_info != nullptr) {\n\n return pod_info->ns();\n\n }\n\n\n\n return \"\";\n\n }\n\n static udf::InfRuleVec SemanticInferenceRules() {\n\n return {\n\n udf::ExplicitRule::Create<PodIDToNamespaceUDF>(types::ST_NAMESPACE_NAME, {types::ST_NONE})};\n\n }\n\n static udf::ScalarUDFDocBuilder Doc() {\n\n return udf::ScalarUDFDocBuilder(\"Get the Kubernetes namespace from a pod ID.\")\n\n .Details(\"Gets the Kubernetes namespace that the Pod ID belongs to.\")\n\n .Example(\"df.namespace = px.pod_id_to_namespace(df.pod_id)\")\n\n .Arg(\"pod_id\", \"The Pod ID of the Pod to get the namespace for.\")\n\n .Returns(\"The k8s namespace for the Pod ID passed in.\");\n\n }\n\n};\n\n\n", "file_path": "src/carnot/funcs/metadata/metadata_ops.h", "rank": 19, "score": 315039.4029132834 }, { "content": "class PodNameToNamespaceUDF : public ScalarUDF {\n\n public:\n\n StringValue Exec(FunctionContext*, StringValue pod_name) {\n\n // This UDF expects the pod name to be in the format of \"<ns>/<pod-name>\".\n\n PL_ASSIGN_OR(auto k8s_name_view, internal::K8sName(pod_name), return \"\");\n\n return std::string(k8s_name_view.first);\n\n }\n\n\n\n static udf::InfRuleVec SemanticInferenceRules() {\n\n return {udf::ExplicitRule::Create<PodNameToNamespaceUDF>(types::ST_NAMESPACE_NAME,\n\n {types::ST_NONE})};\n\n }\n\n static udf::ScalarUDFDocBuilder Doc() {\n\n return udf::ScalarUDFDocBuilder(\"Get the Kubernetes namespace from a pod name.\")\n\n .Details(\"Gets the Kubernetes namespace that the pod belongs to.\")\n\n .Example(\"df.namespace = px.pod_name_to_namespace(df.pod_name)\")\n\n .Arg(\"pod_name\", \"The name of the Pod to get the namespace for.\")\n\n .Returns(\"The k8s namespace for the pod passed in.\");\n\n }\n\n};\n\n\n", "file_path": "src/carnot/funcs/metadata/metadata_ops.h", "rank": 20, "score": 315039.4029132834 }, { "content": "class BasicUDTFOneCol : public UDTF<BasicUDTFOneCol> {\n\n public:\n\n static constexpr auto Executor() { return udfspb::UDTFSourceExecutor::UDTF_ALL_AGENTS; }\n\n\n\n static constexpr auto InitArgs() {\n\n return MakeArray(UDTFArg::Make<types::INT64>(\"some_int\", \"Int arg\", 123),\n\n UDTFArg::Make<types::STRING>(\"some_string\", \"String arg\"));\n\n }\n\n\n\n static constexpr auto OutputRelation() {\n\n return MakeArray(\n\n ColInfo(\"out_str\", types::DataType::STRING, types::PatternType::GENERAL, \"string result\"));\n\n }\n\n\n\n Status Init(FunctionContext*, types::Int64Value, types::StringValue) { return Status::OK(); }\n\n\n\n bool NextRecord(FunctionContext*, RecordWriter*) { return false; }\n\n};\n\n\n\nTEST(Registry, init_with_factory) {\n", "file_path": "src/carnot/udf/registry_test.cc", "rank": 21, "score": 312777.85617421695 }, { "content": "class BasicUDTFOneCol : public UDTF<BasicUDTFOneCol> {\n\n public:\n\n static constexpr auto Executor() { return udfspb::UDTFSourceExecutor::UDTF_ALL_AGENTS; }\n\n\n\n static constexpr auto InitArgs() {\n\n return MakeArray(UDTFArg::Make<types::INT64>(\"some_int\", \"Int arg\"),\n\n UDTFArg::Make<types::STRING>(\"some_string\", \"String arg\"));\n\n }\n\n\n\n static constexpr auto OutputRelation() {\n\n return MakeArray(\n\n ColInfo(\"out_str\", types::DataType::STRING, types::PatternType::GENERAL, \"string result\"));\n\n }\n\n\n\n Status Init(FunctionContext*, types::Int64Value init1, types::StringValue init2) {\n\n EXPECT_EQ(init1, 1337);\n\n EXPECT_EQ(init2, \"abc\");\n\n return Status::OK();\n\n }\n\n\n", "file_path": "src/carnot/udf/udtf_test.cc", "rank": 22, "score": 312777.85617421695 }, { "content": "class BasicUDTFTwoCol : public UDTF<BasicUDTFTwoCol> {\n\n public:\n\n static constexpr auto Executor() { return udfspb::UDTFSourceExecutor::UDTF_ALL_AGENTS; }\n\n\n\n static constexpr auto OutputRelation() {\n\n return MakeArray(\n\n ColInfo(\"out_str\", types::DataType::STRING, types::PatternType::GENERAL, \"string result\"),\n\n ColInfo(\"int_val\", types::DataType::INT64, types::PatternType::GENERAL, \"int result\"));\n\n }\n\n\n\n bool NextRecord(FunctionContext*, RecordWriter*) { return false; }\n\n};\n\n\n", "file_path": "src/carnot/udf/registry_test.cc", "rank": 23, "score": 312777.85617421695 }, { "content": "class BasicTestUDTF : public UDTF<BasicTestUDTF> {\n\n public:\n\n static constexpr auto InitArgs() {\n\n return MakeArray(UDTFArg::Make<types::DataType::INT64>(\"some_int\", \"Int arg\"),\n\n UDTFArg::Make<types::DataType::STRING>(\"some_string\", \"String arg\"));\n\n }\n\n\n\n static constexpr auto Executor() { return udfspb::UDTFSourceExecutor::UDTF_ALL_AGENTS; }\n\n\n\n static constexpr auto OutputRelation() {\n\n return MakeArray(\n\n ColInfo(\"out_int\", types::DataType::INT64, types::PatternType::GENERAL, \"int result\"),\n\n ColInfo(\"out_str\", types::DataType::STRING, types::PatternType::GENERAL, \"string result\"));\n\n }\n\n\n\n Status Init(FunctionContext*, Int64Value some_int, StringValue some_string) {\n\n some_int_ = some_int.val;\n\n some_string_ = std::string(some_string);\n\n return Status::OK();\n\n }\n", "file_path": "src/carnot/exec/udtf_source_node_test.cc", "rank": 24, "score": 312777.85617421695 }, { "content": "class VectorNativeScalarExpressionEvaluator : public ScalarExpressionEvaluator {\n\n public:\n\n explicit VectorNativeScalarExpressionEvaluator(\n\n const plan::ConstScalarExpressionVector& expressions, udf::FunctionContext* function_ctx)\n\n : ScalarExpressionEvaluator(expressions, function_ctx) {}\n\n\n\n Status Open(ExecState* exec_state) override;\n\n Status Close(ExecState* exec_state) override;\n\n\n\n StatusOr<types::SharedColumnWrapper> EvaluateSingleExpression(\n\n ExecState* exec_state, const table_store::schema::RowBatch& input,\n\n const plan::ScalarExpression& expr);\n\n\n\n protected:\n\n Status EvaluateSingleExpression(ExecState* exec_state, const table_store::schema::RowBatch& input,\n\n const plan::ScalarExpression& expr,\n\n table_store::schema::RowBatch* output) override;\n\n};\n\n\n\n/**\n\n * A scalar expression evaluator that uses Arrow arrays for intermediate state.\n\n */\n", "file_path": "src/carnot/exec/expression_evaluator.h", "rank": 25, "score": 311427.5351682437 }, { "content": "class MapRemovableOperatorsRule : public Rule {\n\n public:\n\n /**\n\n * @brief Returns a mapping of operators in the query that can be removed from the plans of\n\n * corresponding agents.\n\n *\n\n * Intended to create a set of Operators that can be removed per agent which will then be used to\n\n * identify unique plans that are duplicated across all agents in a distributed plan.\n\n *\n\n * @param plan The distributed plan which describes all the agents in the system.\n\n * @param pem_instances The Agent IDs from `plan` that we use to build OperatorToAgentSet.\n\n * @param query The main plan that will derive all other plans. The source of all operators.\n\n * @return StatusOr<OperatorToAgentSet> the mapping of removable operators to the agents whose\n\n * plans can remove those operators.\n\n */\n\n static StatusOr<OperatorToAgentSet> GetRemovableOperators(\n\n DistributedPlan* plan, const SchemaToAgentsMap& agent_schema_map,\n\n const absl::flat_hash_set<int64_t>& pem_instances, IR* query);\n\n\n\n protected:\n", "file_path": "src/carnot/planner/distributed/coordinator/removable_ops_rule.h", "rank": 26, "score": 311369.4374526362 }, { "content": "class JoinNodeTest : public ::testing::Test {\n\n public:\n\n JoinNodeTest() {\n\n func_registry_ = std::make_unique<udf::Registry>(\"test_registry\");\n\n auto table_store = std::make_shared<table_store::TableStore>();\n\n exec_state_ = std::make_unique<ExecState>(func_registry_.get(), table_store,\n\n MockResultSinkStubGenerator, sole::uuid4(), nullptr);\n\n }\n\n\n\n protected:\n\n std::unique_ptr<ExecState> exec_state_;\n\n std::unique_ptr<udf::Registry> func_registry_;\n\n};\n\n\n\nstd::unique_ptr<plan::Operator> PlanNodeFromPbtxt(const std::string& pbtxt) {\n\n planpb::Operator op_pb;\n\n EXPECT_TRUE(google::protobuf::TextFormat::MergeFromString(\n\n absl::Substitute(planpb::testutils::kOperatorProtoTmpl, \"JOIN_OPERATOR\", \"join_op\", pbtxt),\n\n &op_pb));\n\n return plan::JoinOperator::FromProto(op_pb, 1);\n", "file_path": "src/carnot/exec/equijoin_node_test.cc", "rank": 27, "score": 307263.38894355524 }, { "content": "// TOOD(zasgar): refactor these into test udfs.\n\nclass AddUDF : public udf::ScalarUDF {\n\n public:\n\n types::Int64Value Exec(FunctionContext*, types::Int64Value v1, types::Int64Value v2) {\n\n return v1.val + v2.val;\n\n }\n\n};\n\n\n", "file_path": "src/carnot/exec/map_node_test.cc", "rank": 28, "score": 307233.54892774374 }, { "content": "class BasicUDTFTwoColBad : public UDTF<BasicUDTFTwoColBad> {\n\n public:\n\n static constexpr auto Executor() { return udfspb::UDTFSourceExecutor::UDTF_ALL_AGENTS; }\n\n\n\n static constexpr auto OutputRelation() {\n\n return MakeArray(\n\n ColInfo(\"out_str\", types::DataType::STRING, types::PatternType::GENERAL, \"string result\"),\n\n ColInfo(\"int_val\", types::DataType::INT64, types::PatternType::GENERAL, \"int result\"));\n\n }\n\n\n\n bool NextRecord(FunctionContext*, RecordWriter* rw) {\n\n while (idx++ < 2) {\n\n rw->Append<IndexOf(\"out_str\")>(\"abc \" + std::to_string(idx));\n\n return true;\n\n }\n\n return false;\n\n }\n\n\n\n private:\n\n int idx = 0;\n", "file_path": "src/carnot/udf/udtf_test.cc", "rank": 29, "score": 306508.20104132005 }, { "content": "class BasicUDTFTwoColOverload : public UDTF<BasicUDTFTwoColOverload> {\n\n public:\n\n static constexpr auto Executor() { return udfspb::UDTFSourceExecutor::UDTF_ALL_AGENTS; }\n\n\n\n static constexpr auto OutputRelation() {\n\n return MakeArray(\n\n ColInfo(\"out_str\", types::DataType::STRING, types::PatternType::GENERAL, \"string result\"));\n\n }\n\n\n\n bool NextRecord(FunctionContext*, RecordWriter*) { return false; }\n\n};\n\n\n\nTEST(Registry, init_with_udtf) {\n\n Registry registry(\"test registry\");\n\n registry.RegisterOrDie<BasicUDTFTwoCol>(\"test_udtf\");\n\n\n\n auto statusor = registry.GetUDTFDefinition(\"test_udtf\");\n\n ASSERT_OK(statusor);\n\n auto def = statusor.ConsumeValueOrDie();\n\n ASSERT_NE(nullptr, def);\n", "file_path": "src/carnot/udf/registry_test.cc", "rank": 30, "score": 306508.20104132005 }, { "content": "class CarnotImpl final : public Carnot {\n\n public:\n\n ~CarnotImpl() override;\n\n /**\n\n * Initializes the engine with the state necessary to compile and execute a query.\n\n * This includes the tables, udf registries, and the stub generator for generating stubs\n\n * to the Kelvin GRPC service.\n\n * grpc_server_port of 0 disables the GRPC server.\n\n * @return a status of whether initialization was successful.\n\n */\n\n Status Init(const sole::uuid& agent_id, std::shared_ptr<table_store::TableStore> table_store,\n\n const exec::ResultSinkStubGenerator& stub_generator, int grpc_server_port = 0,\n\n std::shared_ptr<grpc::ServerCredentials> grpc_server_creds = nullptr);\n\n\n\n Status Init(const sole::uuid& agent_id, std::unique_ptr<udf::Registry> func_registry,\n\n std::shared_ptr<table_store::TableStore> table_store,\n\n const exec::ResultSinkStubGenerator& stub_generator,\n\n std::function<void(grpc::ClientContext*)> add_auth_to_grpc_context_func,\n\n int grpc_server_port = 0,\n\n std::shared_ptr<grpc::ServerCredentials> grpc_server_creds = nullptr);\n", "file_path": "src/carnot/carnot.cc", "rank": 31, "score": 301542.5047987402 }, { "content": "class MapOperatorRelationRuleTest : public OldOperatorRelationRuleTest {\n\n protected:\n\n void SetUpGraph(bool keep_input_columns) {\n\n mem_src =\n\n graph->CreateNode<MemorySourceIR>(ast, \"source\", std::vector<std::string>{}).ValueOrDie();\n\n compiler_state_->relation_map()->emplace(\"source\", cpu_relation);\n\n auto constant1 = graph->CreateNode<IntIR>(ast, 10).ValueOrDie();\n\n auto constant2 = graph->CreateNode<IntIR>(ast, 10).ValueOrDie();\n\n\n\n auto func_1 = graph\n\n ->CreateNode<FuncIR>(ast, FuncIR::Op{FuncIR::Opcode::add, \"+\", \"add\"},\n\n std::vector<ExpressionIR*>{constant1, constant2})\n\n .ValueOrDie();\n\n auto func_2 = graph\n\n ->CreateNode<FuncIR>(ast, FuncIR::Op{FuncIR::Opcode::add, \"*\", \"multiply\"},\n\n std::vector<ExpressionIR*>{constant1, constant2})\n\n .ValueOrDie();\n\n map = graph\n\n ->CreateNode<MapIR>(\n\n ast, mem_src, ColExpressionVector{{new_col_name, func_1}, {old_col_name, func_2}},\n", "file_path": "src/carnot/planner/compiler/analyzer/resolve_types_rule_test.cc", "rank": 32, "score": 288518.1393676423 }, { "content": "class CarnotLimitTest : public CarnotTest,\n\n public ::testing::WithParamInterface<std::tuple<int64_t, int64_t>> {\n\n protected:\n\n void SetUp() { CarnotTest::SetUp(); }\n\n};\n\n\n\nTEST_P(CarnotLimitTest, limit) {\n\n auto query = absl::StrJoin(\n\n {\n\n \"import px\",\n\n \"queryDF = px.DataFrame(table='big_test_table', select=['time_', 'col2'])\",\n\n \"mapDF = queryDF.head(n=$0)\",\n\n \"px.display(mapDF, 'test_output')\",\n\n },\n\n \"\\n\");\n\n int64_t num_rows;\n\n int64_t expected_num_batches;\n\n std::tie(expected_num_batches, num_rows) = GetParam();\n\n VLOG(2) << absl::Substitute(\"{$0, $1}\", expected_num_batches, num_rows);\n\n query = absl::Substitute(query, num_rows);\n", "file_path": "src/carnot/carnot_test.cc", "rank": 33, "score": 280337.74812352634 }, { "content": "class Manager : public px::NotCopyable {\n\n public:\n\n using VizierNATSConnector = px::event::NATSConnector<px::vizier::messages::VizierMessage>;\n\n using MsgCase = messages::VizierMessage::MsgCase;\n\n using MDSService = services::metadata::MetadataService;\n\n using MDSServiceSPtr = std::shared_ptr<Manager::MDSService::Stub>;\n\n using MDTPService = services::metadata::MetadataTracepointService;\n\n using MDTPServiceSPtr = std::shared_ptr<Manager::MDTPService::Stub>;\n\n using ResultSinkStub = px::carnotpb::ResultSinkService::StubInterface;\n\n\n\n Manager() = delete;\n\n virtual ~Manager() = default;\n\n\n", "file_path": "src/vizier/services/agent/manager/manager.h", "rank": 34, "score": 276055.3360380225 }, { "content": "class CarnotTest : public ::testing::Test {\n\n protected:\n\n void SetUp() override {\n\n Test::SetUp();\n\n table_store_ = std::make_shared<table_store::TableStore>();\n\n result_server_ = std::make_unique<exec::LocalGRPCResultSinkServer>();\n\n carnot_ = Carnot::Create(sole::uuid4(), table_store_,\n\n std::bind(&exec::LocalGRPCResultSinkServer::StubGenerator,\n\n result_server_.get(), std::placeholders::_1))\n\n .ConsumeValueOrDie();\n\n auto table = CarnotTestUtils::TestTable();\n\n table_store_->AddTable(\"test_table\", table);\n\n big_table_ = CarnotTestUtils::BigTestTable();\n\n table_store_->AddTable(\"big_test_table\", big_table_);\n\n empty_table_ = table_store::Table::Create(\n\n table_store::schema::Relation({types::UINT128, types::INT64}, {\"upid\", \"cycles\"}));\n\n table_store_->AddTable(\"empty_table\", empty_table_);\n\n table_store_->AddTable(\"duration_table\", CarnotTestUtils::TestDuration64Table());\n\n\n\n process_stats_table_ = CarnotTestUtils::ProcessStatsTable();\n", "file_path": "src/carnot/carnot_test.cc", "rank": 35, "score": 271467.3944426755 }, { "content": "class DistributedPlanner : public NotCopyable, public Planner {\n\n public:\n\n /**\n\n * @brief The Creation function for the planner.\n\n *\n\n * @return StatusOr<std::unique_ptr<DistributedPlanner>>: the distributed planner object or an\n\n * error.\n\n */\n\n static StatusOr<std::unique_ptr<DistributedPlanner>> Create();\n\n\n\n /**\n\n * @brief Takes in a logical plan and outputs the distributed plan.\n\n *\n\n * @param distributed_state: the distributed layout of the vizier instance.\n\n * @param compiler_state: informastion passed to the compiler.\n\n * @param logical_plan\n\n * @return StatusOr<std::unique_ptr<DistributedPlan>>\n\n */\n\n StatusOr<std::unique_ptr<DistributedPlan>> Plan(\n\n const distributedpb::DistributedState& distributed_state, CompilerState* compiler_state,\n", "file_path": "src/carnot/planner/distributed/distributed_planner.h", "rank": 36, "score": 268101.69726444664 }, { "content": "class UDTF : public AnyUDTF {\n\n public:\n\n using RecordWriter = RecordWriterProxy<Derived>;\n\n using Checker = UDTFChecker<Derived>;\n\n using UDTFArg = udf::UDTFArg;\n\n using ColInfo = udf::ColInfo;\n\n\n\n /**\n\n * Returns the index of the output column if it exists.\n\n * @param col The name of the column.\n\n * @return Index of the column (or compile time assert).\n\n */\n\n static constexpr size_t IndexOf(std::string_view col) { return RecordWriter::ColIdx(col); }\n\n};\n\n\n\n/**\n\n * UDTFFactory is the interface for a class that creates a new UDTF.\n\n *\n\n * We add this level of indirection so that parameters can be passed to UDTF that don't exist on the\n\n * internal FunctionContext of carnot.\n\n */\n", "file_path": "src/carnot/udf/udtf.h", "rank": 37, "score": 267893.9951337086 }, { "content": "class UDA : public AnyUDA {\n\n public:\n\n ~UDA() override = default;\n\n};\n\n\n\n// SFINAE test for init fn.\n\ntemplate <typename T, typename = void>\n", "file_path": "src/carnot/udf/udf.h", "rank": 38, "score": 267893.9951337086 }, { "content": "class FilterOperator : public Operator {\n\n public:\n\n explicit FilterOperator(int64_t id) : Operator(id, planpb::FILTER_OPERATOR) {}\n\n ~FilterOperator() override = default;\n\n\n\n StatusOr<table_store::schema::Relation> OutputRelation(\n\n const table_store::schema::Schema& schema, const PlanState& state,\n\n const std::vector<int64_t>& input_ids) const override;\n\n Status Init(const planpb::FilterOperator& pb);\n\n std::string DebugString() const override;\n\n std::vector<int64_t> selected_cols() { return selected_cols_; }\n\n\n\n const std::shared_ptr<const ScalarExpression>& expression() const { return expression_; }\n\n\n\n private:\n\n std::shared_ptr<const ScalarExpression> expression_;\n\n std::vector<int64_t> selected_cols_;\n\n planpb::FilterOperator pb_;\n\n};\n\n\n", "file_path": "src/carnot/plan/operators.h", "rank": 39, "score": 264645.4013019598 }, { "content": "class AggregateOperator : public Operator {\n\n public:\n\n explicit AggregateOperator(int64_t id) : Operator(id, planpb::AGGREGATE_OPERATOR) {}\n\n ~AggregateOperator() override = default;\n\n\n\n StatusOr<table_store::schema::Relation> OutputRelation(\n\n const table_store::schema::Schema& schema, const PlanState& state,\n\n const std::vector<int64_t>& input_ids) const override;\n\n Status Init(const planpb::AggregateOperator& pb);\n\n std::string DebugString() const override;\n\n\n\n struct GroupInfo {\n\n std::string name;\n\n uint64_t idx;\n\n };\n\n\n\n const std::vector<GroupInfo>& groups() const { return groups_; }\n\n const std::vector<std::shared_ptr<AggregateExpression>>& values() const { return values_; }\n\n bool windowed() const { return pb_.windowed(); }\n\n\n\n private:\n\n std::vector<std::shared_ptr<AggregateExpression>> values_;\n\n std::vector<GroupInfo> groups_;\n\n planpb::AggregateOperator pb_;\n\n};\n\n\n", "file_path": "src/carnot/plan/operators.h", "rank": 40, "score": 264645.4013019598 }, { "content": "class AnyUDTF : public BaseFunc {\n\n public:\n\n virtual ~AnyUDTF() = default;\n\n};\n\n\n\n// Forward declaration for UDTF since there is a circular dependency with some code in this file.\n\ntemplate <typename Derived>\n", "file_path": "src/carnot/udf/udtf.h", "rank": 41, "score": 264645.4013019598 }, { "content": "class Operator : public PlanNode {\n\n public:\n\n ~Operator() override = default;\n\n\n\n // Create a new operator using the Operator proto.\n\n static std::unique_ptr<Operator> FromProto(const planpb::Operator& pb, int64_t id);\n\n\n\n // Returns the ID of the operator.\n\n int64_t id() const { return id_; }\n\n\n\n // Returns the type of the operator.\n\n planpb::OperatorType op_type() const { return op_type_; }\n\n\n\n bool is_initialized() const { return is_initialized_; }\n\n\n\n // Generate a string that will help debug operators.\n\n std::string DebugString() const override = 0;\n\n\n\n // Prints out the debug to INFO log.\n\n void Debug() { LOG(INFO) << DebugString(); }\n", "file_path": "src/carnot/plan/operators.h", "rank": 42, "score": 264645.4013019598 }, { "content": "class ScalarUDF : public AnyUDF {\n\n public:\n\n ~ScalarUDF() override = default;\n\n};\n\n\n\n/**\n\n * UDA is a stateful function that updates internal state bases on the input\n\n * values. It must be Merge-able with other UDAs of the same type.\n\n *\n\n * In the lifetime of the query one or more instances will be created. The Merge function\n\n * will be called to combine multiple instances together before destruction.\n\n *\n\n * The derived class must implement:\n\n * void Update(FunctionContext *ctx, Args...) {}\n\n * void Merge(FunctionContext *ctx, const SampleUDA& other) {}\n\n * ReturnValue Finalize(FunctionContext *ctx) {}\n\n *\n\n * It may optionally implement:\n\n * Status Init(FunctionContext *ctx, InitArgs...) {}\n\n *\n\n * To support partial aggregation to UDAs must also implement:\n\n * StringValue Serialize(FunctionContext*) {}\n\n * Status DeSerialize(FunctionContext*, const StringValue& data) {}\n\n *\n\n * All argument types must me valid UDFValueTypes.\n\n */\n", "file_path": "src/carnot/udf/udf.h", "rank": 43, "score": 264645.4013019598 }, { "content": "class UnionOperator : public Operator {\n\n public:\n\n explicit UnionOperator(int64_t id) : Operator(id, planpb::UNION_OPERATOR) {}\n\n ~UnionOperator() override = default;\n\n\n\n StatusOr<table_store::schema::Relation> OutputRelation(\n\n const table_store::schema::Schema& schema, const PlanState& state,\n\n const std::vector<int64_t>& input_ids) const override;\n\n Status Init(const planpb::UnionOperator& pb);\n\n std::string DebugString() const override;\n\n\n\n const std::vector<std::string>& column_names() const { return column_names_; }\n\n bool order_by_time() const;\n\n int64_t time_column_index(int64_t parent_index) const;\n\n const std::vector<std::vector<int64_t>>& column_mappings() const { return column_mappings_; }\n\n const std::vector<int64_t>& column_mapping(int64_t parent_index) const {\n\n return column_mappings_.at(parent_index);\n\n }\n\n size_t rows_per_batch() const { return pb_.rows_per_batch(); }\n\n\n\n private:\n\n std::vector<std::string> column_names_;\n\n std::vector<std::vector<int64_t>> column_mappings_;\n\n\n\n planpb::UnionOperator pb_;\n\n};\n\n\n", "file_path": "src/carnot/plan/operators.h", "rank": 44, "score": 264645.4013019598 }, { "content": "class LimitOperator : public Operator {\n\n public:\n\n explicit LimitOperator(int64_t id) : Operator(id, planpb::LIMIT_OPERATOR) {}\n\n ~LimitOperator() override = default;\n\n\n\n StatusOr<table_store::schema::Relation> OutputRelation(\n\n const table_store::schema::Schema& schema, const PlanState& state,\n\n const std::vector<int64_t>& input_ids) const override;\n\n Status Init(const planpb::LimitOperator& pb);\n\n std::string DebugString() const override;\n\n std::vector<int64_t> selected_cols() { return selected_cols_; }\n\n\n\n int64_t record_limit() const { return record_limit_; }\n\n\n\n const std::vector<int64_t>& abortable_srcs() const { return abortable_srcs_; }\n\n\n\n private:\n\n int64_t record_limit_ = 0;\n\n std::vector<int64_t> selected_cols_;\n\n std::vector<int64_t> abortable_srcs_;\n\n planpb::LimitOperator pb_;\n\n};\n\n\n", "file_path": "src/carnot/plan/operators.h", "rank": 45, "score": 264645.4013019598 }, { "content": "class AnyUDF : public BaseFunc {\n\n public:\n\n virtual ~AnyUDF() = default;\n\n};\n\n\n\n/**\n\n * Any UDA is a base class for all UDAs in carnot.\n\n */\n", "file_path": "src/carnot/udf/udf.h", "rank": 46, "score": 264645.4013019598 }, { "content": "class EngineState : public NotCopyable {\n\n public:\n\n EngineState() = delete;\n\n EngineState(std::unique_ptr<udf::Registry> func_registry,\n\n std::shared_ptr<table_store::TableStore> table_store,\n\n std::unique_ptr<planner::RegistryInfo> registry_info,\n\n const exec::ResultSinkStubGenerator& stub_generator,\n\n std::function<void(grpc::ClientContext*)> add_auth_to_grpc_context_func,\n\n exec::GRPCRouter* grpc_router, std::unique_ptr<exec::ml::ModelPool> model_pool)\n\n : func_registry_(std::move(func_registry)),\n\n table_store_(std::move(table_store)),\n\n registry_info_(std::move(registry_info)),\n\n stub_generator_(stub_generator),\n\n add_auth_to_grpc_context_func_(add_auth_to_grpc_context_func),\n\n grpc_router_(grpc_router),\n\n model_pool_(std::move(model_pool)) {}\n\n\n\n static StatusOr<std::unique_ptr<EngineState>> CreateDefault(\n\n std::unique_ptr<udf::Registry> func_registry,\n\n std::shared_ptr<table_store::TableStore> table_store,\n", "file_path": "src/carnot/engine_state.h", "rank": 47, "score": 264645.4013019598 }, { "content": "class AnyUDA : public BaseFunc {\n\n public:\n\n virtual ~AnyUDA() = default;\n\n};\n\n\n\n/**\n\n * ScalarUDF is a wrapper around a stateless function that can take one more more UDF values\n\n * and return a single UDF value.\n\n *\n\n * In the lifetime of a query, one more more instances may be created. The implementation should\n\n * take care not to store local state that can change functionality from call to call (ie. The\n\n * Exec function should be pure).\n\n *\n\n * The derived class must implement:\n\n * UDFValue Exec(FunctionContext *ctx, UDFValue... value) {}\n\n * This function is called for each record for which this UDF needs to execute.\n\n *\n\n * The ScalarUDF can _optionally_ implement the following function:\n\n * Status Init(FunctionContext *ctx, UDFValue... init_args) {}\n\n * This function is called once during initialization of each instance (many instances\n\n * may exists in a given query). The arguments are as provided by the query.\n\n */\n", "file_path": "src/carnot/udf/udf.h", "rank": 48, "score": 264645.4013019598 }, { "content": "class DoOnce : public Strategy {\n\n public:\n\n explicit DoOnce(const std::string& name) : Strategy(name, 1) {}\n\n Status MaxIterationsHandler() override { return Status::OK(); }\n\n};\n\n\n\n/**\n\n * @brief Rules modify the IR graph. Each rule should extend this\n\n * abstract class.\n\n */\n\ntemplate <typename TRuleType>\n", "file_path": "src/carnot/planner/rules/rule_executor.h", "rank": 49, "score": 264645.4013019598 }, { "content": "// DeathHandler is meant for fatal errors (like seg-faults),\n\n// where no graceful termination is performed.\n\nclass DeathHandler : public px::FatalErrorHandlerInterface {\n\n public:\n\n DeathHandler() = default;\n\n void OnFatalError() const override {}\n\n};\n\n\n\nstd::unique_ptr<px::SignalAction> g_signal_action;\n\n\n\n//-----------------------------------------------------------------------------\n\n// DynamicTracing Specific Code\n\n//-----------------------------------------------------------------------------\n\n\n", "file_path": "src/stirling/binaries/stirling_wrapper.cc", "rank": 50, "score": 264606.3899654005 }, { "content": "class ObjectPool final : public px::NotCopyable {\n\n public:\n\n ObjectPool() = default;\n\n explicit ObjectPool(std::string_view name) : name_(name) {\n\n VLOG(1) << \"Creating Object Pool: \" << name_;\n\n }\n\n\n\n ~ObjectPool() {\n\n Clear();\n\n VLOG_IF(1, !name_.empty()) << \"Deleting Object Pool: \" << name_;\n\n }\n\n /**\n\n * Take ownership of passed in pointer.\n\n *\n\n * @tparam T The entity type to track.\n\n * @param entity A pointer to the entity.\n\n * @return The pointer to the entity.\n\n */\n\n template <typename T>\n\n T* Add(T* entity) {\n", "file_path": "src/common/memory/object_pool.h", "rank": 51, "score": 264259.3418807045 }, { "content": "class Splitter : public NotCopyable {\n\n public:\n\n /**\n\n * @brief Inserts a GRPCBridge in front of blocking operators in a graph.\n\n * Inserts a GRPCBridge (GRPCSink -> GRPCSourceGroup) between the parent_op\n\n * and blocking ops. The returned SplitPlan should contain two IRs now:\n\n * 1. Where all sources are MemorySources and all sinks are GRPCSinks\n\n * 2. Where all sources are GRPCSourceGroups and all sinks are MemorySinks\n\n *\n\n * Graphically, we want to be able to convert the following logical plan:\n\n * MemSrc1\n\n * | \\\n\n * | Agg\n\n * | /\n\n * Join\n\n * |\n\n * Sink\n\n *\n\n * Into\n\n * MemSrc1\n", "file_path": "src/carnot/planner/distributed/splitter/splitter.h", "rank": 52, "score": 261494.75512973047 }, { "content": "class UDA1 : public UDA {\n\n public:\n\n Status Init(FunctionContext*, types::StringValue) { return Status::OK(); }\n\n void Update(FunctionContext*, types::Int64Value) {}\n\n void Merge(FunctionContext*, const UDA1&) {}\n\n types::Int64Value Finalize(FunctionContext*) { return 0; }\n\n static UDADocBuilder Doc() {\n\n return UDADocBuilder(\"This function computes the sum of a list of numbers.\")\n\n .Details(\"The detailed version of this.\")\n\n .Arg(\"a\", \"random init arg\")\n\n .Arg(\"b\", \"The argument to sum\")\n\n .Returns(\"The sum of all values of b.\")\n\n .Example(\"df.sum = df.agg\");\n\n }\n\n};\n\n\n", "file_path": "src/carnot/udf/registry_test.cc", "rank": 53, "score": 261494.75512973047 }, { "content": "class EmptySourceOperator : public Operator {\n\n public:\n\n explicit EmptySourceOperator(int64_t id) : Operator(id, planpb::EMPTY_SOURCE_OPERATOR) {}\n\n ~EmptySourceOperator() override = default;\n\n StatusOr<table_store::schema::Relation> OutputRelation(\n\n const table_store::schema::Schema& schema, const PlanState& state,\n\n const std::vector<int64_t>& input_ids) const override;\n\n Status Init(const planpb::EmptySourceOperator& pb);\n\n std::string DebugString() const override;\n\n\n\n private:\n\n planpb::EmptySourceOperator pb_;\n\n std::vector<int64_t> column_idxs_;\n\n};\n\n\n\n} // namespace plan\n\n} // namespace carnot\n\n} // namespace px\n", "file_path": "src/carnot/plan/operators.h", "rank": 54, "score": 261494.75512973047 }, { "content": "class GRPCSinkOperator : public Operator {\n\n public:\n\n explicit GRPCSinkOperator(int64_t id) : Operator(id, planpb::GRPC_SINK_OPERATOR) {}\n\n ~GRPCSinkOperator() override = default;\n\n\n\n StatusOr<table_store::schema::Relation> OutputRelation(\n\n const table_store::schema::Schema& schema, const PlanState& state,\n\n const std::vector<int64_t>& input_ids) const override;\n\n Status Init(const planpb::GRPCSinkOperator& pb);\n\n std::string DebugString() const override;\n\n\n\n std::string address() const { return pb_.address(); }\n\n\n\n // Returns the SSL target override for the GRPC connection if it is present,\n\n // empty string otherwise.\n\n std::string ssl_targetname() const {\n\n if (pb_.has_connection_options()) {\n\n return pb_.connection_options().ssl_targetname();\n\n }\n\n return \"\";\n", "file_path": "src/carnot/plan/operators.h", "rank": 55, "score": 261494.75512973047 }, { "content": "class Module : public QLObject {\n\n public:\n\n static constexpr TypeDescriptor ModuleType = {\n\n /* name */ \"Module\",\n\n /* type */ QLObjectType::kModule,\n\n };\n\n /**\n\n * @brief Create will parse the module_text into an object. It should have it's own var_table\n\n * owned by the module, which will be exposed through the GetAttributeImpl.\n\n *\n\n * @param visitor\n\n * @return StatusOr<std::shared_ptr<Module>>\n\n */\n\n static StatusOr<std::shared_ptr<Module>> Create(std::string_view module_text,\n\n ASTVisitor* visitor);\n\n\n\n protected:\n\n explicit Module(ASTVisitor* visitor) : QLObject(ModuleType, visitor) {}\n\n StatusOr<std::shared_ptr<QLObject>> GetAttributeImpl(const pypa::AstPtr& ast,\n\n std::string_view name) const override;\n", "file_path": "src/carnot/planner/objects/module.h", "rank": 56, "score": 261494.75512973047 }, { "content": "class UDTFSourceOperator : public Operator {\n\n public:\n\n explicit UDTFSourceOperator(int64_t id) : Operator(id, planpb::UDTF_SOURCE_OPERATOR) {}\n\n ~UDTFSourceOperator() override = default;\n\n StatusOr<table_store::schema::Relation> OutputRelation(\n\n const table_store::schema::Schema& schema, const PlanState& state,\n\n const std::vector<int64_t>& input_ids) const override;\n\n Status Init(const planpb::UDTFSourceOperator& pb);\n\n std::string DebugString() const override;\n\n const std::string& name() const { return pb_.name(); }\n\n const std::vector<ScalarValue>& init_arguments() const;\n\n\n\n private:\n\n planpb::UDTFSourceOperator pb_;\n\n std::vector<ScalarValue> init_arguments_;\n\n};\n\n\n", "file_path": "src/carnot/plan/operators.h", "rank": 57, "score": 261494.75512973047 }, { "content": "class GRPCSourceOperator : public Operator {\n\n public:\n\n explicit GRPCSourceOperator(int64_t id) : Operator(id, planpb::GRPC_SOURCE_OPERATOR) {}\n\n ~GRPCSourceOperator() override = default;\n\n\n\n StatusOr<table_store::schema::Relation> OutputRelation(\n\n const table_store::schema::Schema& schema, const PlanState& state,\n\n const std::vector<int64_t>& input_ids) const override;\n\n Status Init(const planpb::GRPCSourceOperator& pb);\n\n std::string DebugString() const override;\n\n\n\n private:\n\n planpb::GRPCSourceOperator pb_;\n\n};\n\n\n", "file_path": "src/carnot/plan/operators.h", "rank": 58, "score": 261494.75512973047 }, { "content": "class Coordinator : public NotCopyable {\n\n public:\n\n virtual ~Coordinator() = default;\n\n static StatusOr<std::unique_ptr<Coordinator>> Create(\n\n CompilerState* compiler_state, const distributedpb::DistributedState& distributed_state);\n\n\n\n /**\n\n * @brief Using the physical state and the current plan, assembles a proto Distributed Plan. This\n\n * plan is not ready to be sent out yet, but can be processed to work.\n\n * @param plan: the plan, pre-split along the expected lines.\n\n * @return StatusOr<std::unique_ptr<DistributedPlan>>\n\n */\n\n StatusOr<std::unique_ptr<DistributedPlan>> Coordinate(const IR* logical_plan);\n\n\n\n Status Init(CompilerState* compiler_state,\n\n const distributedpb::DistributedState& distributed_state);\n\n\n\n protected:\n\n Status ProcessConfig(const CarnotInfo& carnot_info);\n\n\n", "file_path": "src/carnot/planner/distributed/coordinator/coordinator.h", "rank": 59, "score": 261494.75512973047 }, { "content": "class MemorySinkOperator : public Operator {\n\n public:\n\n explicit MemorySinkOperator(int64_t id) : Operator(id, planpb::MEMORY_SINK_OPERATOR) {}\n\n ~MemorySinkOperator() override = default;\n\n\n\n StatusOr<table_store::schema::Relation> OutputRelation(\n\n const table_store::schema::Schema& schema, const PlanState& state,\n\n const std::vector<int64_t>& input_ids) const override;\n\n Status Init(const planpb::MemorySinkOperator& pb);\n\n std::string TableName() const { return pb_.name(); }\n\n std::string ColumnName(int64_t i) const { return pb_.column_names(i); }\n\n std::string DebugString() const override;\n\n\n\n private:\n\n planpb::MemorySinkOperator pb_;\n\n};\n\n\n", "file_path": "src/carnot/plan/operators.h", "rank": 60, "score": 261494.75512973047 }, { "content": "class MemorySourceOperator : public Operator {\n\n public:\n\n explicit MemorySourceOperator(int64_t id) : Operator(id, planpb::MEMORY_SOURCE_OPERATOR) {}\n\n ~MemorySourceOperator() override = default;\n\n StatusOr<table_store::schema::Relation> OutputRelation(\n\n const table_store::schema::Schema& schema, const PlanState& state,\n\n const std::vector<int64_t>& input_ids) const override;\n\n Status Init(const planpb::MemorySourceOperator& pb);\n\n std::string DebugString() const override;\n\n std::string TableName() const { return pb_.name(); }\n\n bool HasStartTime() const { return pb_.has_start_time(); }\n\n bool HasStopTime() const { return pb_.has_stop_time(); }\n\n int64_t start_time() const { return pb_.start_time().value(); }\n\n int64_t stop_time() const { return pb_.stop_time().value(); }\n\n std::vector<int64_t> Columns() const { return column_idxs_; }\n\n const types::TabletID& Tablet() const { return pb_.tablet(); }\n\n bool infinite_stream() const { return pb_.streaming(); }\n\n\n\n private:\n\n planpb::MemorySourceOperator pb_;\n\n std::vector<int64_t> column_idxs_;\n\n};\n\n\n", "file_path": "src/carnot/plan/operators.h", "rank": 61, "score": 261494.75512973047 }, { "content": "class Column : public ScalarExpression {\n\n public:\n\n Column() = default;\n\n ~Column() override = default;\n\n\n\n /// Initializes the column value based on the passed in protobuf msg.\n\n Status Init(const planpb::Column& pb);\n\n\n\n // Implementation of base class methods.\n\n StatusOr<types::DataType> OutputDataType(\n\n const PlanState& state, const table_store::schema::Schema& input_schema) const override;\n\n std::vector<const Column*> ColumnDeps() override;\n\n std::vector<ScalarExpression*> Deps() const override;\n\n Expression ExpressionType() const override;\n\n std::string DebugString() const override;\n\n\n\n /// The index of the column in the operator that is referenced.\n\n int64_t Index() const;\n\n\n\n /// NodeID gets the ID of the operator that this column refers to.\n\n int64_t NodeID() const;\n\n\n\n private:\n\n planpb::Column pb_;\n\n};\n\n\n\n/**\n\n * A ScalarValue is just a single constant value.\n\n */\n", "file_path": "src/carnot/plan/scalar_expression.h", "rank": 62, "score": 261494.75512973047 }, { "content": "class LogicalPlanner : public NotCopyable {\n\n public:\n\n /**\n\n * @brief The Creation function for the planner.\n\n *\n\n * @return StatusOr<std::unique_ptr<DistributedPlanner>>: the distributed planner object or an\n\n * error.\n\n */\n\n static StatusOr<std::unique_ptr<LogicalPlanner>> Create(const udfspb::UDFInfo& udf_info);\n\n\n\n /**\n\n * @brief Takes in a logical plan and outputs the distributed plan.\n\n *\n\n * @param logical_state: the distributed layout of the vizier instance.\n\n * @param query: QueryRequest\n\n * @return std::unique_ptr<DistributedPlan> or error if one occurs during compilation.\n\n */\n\n StatusOr<std::unique_ptr<distributed::DistributedPlan>> Plan(\n\n const distributedpb::LogicalPlannerState& logical_state,\n\n const plannerpb::QueryRequest& query);\n", "file_path": "src/carnot/planner/logical_planner.h", "rank": 63, "score": 261494.75512973047 }, { "content": "class Dataframe : public QLObject {\n\n public:\n\n static constexpr TypeDescriptor DataframeType = {\n\n /* name */ \"DataFrame\",\n\n /* type */ QLObjectType::kDataframe,\n\n };\n\n static StatusOr<std::shared_ptr<Dataframe>> Create(OperatorIR* op, ASTVisitor* visitor);\n\n static StatusOr<std::shared_ptr<Dataframe>> Create(IR* graph, ASTVisitor* visitor);\n\n\n\n /**\n\n * @brief Get the operator that this dataframe represents.\n\n *\n\n * @return OperatorIR*\n\n */\n\n OperatorIR* op() const { return op_; }\n\n\n\n /**\n\n * @brief Shortcut to get the IR graph that contains the operator.\n\n *\n\n * @return IR*\n", "file_path": "src/carnot/planner/objects/dataframe.h", "rank": 64, "score": 261494.75512973047 }, { "content": "namespace px {\n\nnamespace carnot {\n\nnamespace exec {\n\n\n\nusing VariableSizeValueTypeVariant = std::variant<types::StringValue>;\n\n\n\nstruct RowTuple;\n\n\n\nnamespace internal {\n\ntemplate <typename T>\n\ninline void SetValueHelper(RowTuple* rt, size_t idx, const T& val);\n\ntemplate <>\n\ninline void SetValueHelper<types::StringValue>(RowTuple* rt, size_t idx,\n\n const types::StringValue& val);\n\n\n\ntemplate <typename T>\n\ninline const T& GetValueHelper(const RowTuple& rt, size_t idx);\n\ntemplate <>\n\ninline const types::StringValue& GetValueHelper<types::StringValue>(const RowTuple& rt, size_t idx);\n\n\n\n} // namespace internal\n\n\n\n/**\n\n * RowTuple stores a tuple of values corresponding to ValueTypes.\n\n */\n\nstruct RowTuple : public NotCopyable {\n\n explicit RowTuple(const std::vector<types::DataType>* types) : types(types) {\n\n Reset();\n\n // We set the values to zero since not all fixed size values are the same size.\n\n // Without this when we write values we might leave gaps that introduce mismatches during\n\n // comparisons, etc.\n\n memset(reinterpret_cast<uint8_t*>(fixed_values.data()), 0,\n\n sizeof(types::FixedSizeValueUnion) * fixed_values.size());\n\n }\n\n\n\n void Reset() {\n\n fixed_values.resize(types->size());\n\n variable_values.clear();\n\n }\n\n\n\n /**\n\n * Sets the value at the given index.\n\n * @tparam T The type value.\n\n * @param idx The index in the tuple.\n\n * @param val The value.\n\n */\n\n template <typename T>\n\n void SetValue(size_t idx, const T& val) {\n\n internal::SetValueHelper<T>(this, idx, val);\n\n }\n\n\n\n /**\n\n * Gets the value at the given index with type specified.\n\n * Will die in debug mode if wrong type is specified.\n\n * @tparam T The type to read as.\n\n * @param idx The index to read.\n\n * @return The return value (as reference).\n\n */\n\n template <typename T>\n\n const T& GetValue(size_t idx) const {\n\n return internal::GetValueHelper<T>(*this, idx);\n\n }\n\n\n\n bool operator==(const RowTuple& other) const {\n\n DCHECK(types != nullptr);\n\n DCHECK(other.types != nullptr);\n\n // This should actually be part of the check, but we assume that row-tuples\n\n // are consistently using the same types when they are being compared.\n\n DCHECK(*types == *(other.types));\n\n DCHECK(fixed_values.size() == other.fixed_values.size());\n\n DCHECK(types->size() == fixed_values.size());\n\n DCHECK(CheckSequentialWriteOrder()) << \"Variable sized write ordering mismatch\";\n\n DCHECK(other.CheckSequentialWriteOrder()) << \"Variable sized write ordering mismatch\";\n\n\n\n if (memcmp(fixed_values.data(), other.fixed_values.data(),\n\n sizeof(types::FixedSizeValueUnion) * fixed_values.size()) != 0) {\n\n // Early exit for failed comparisons.\n\n return false;\n\n }\n\n // Do deep compare of the variable sized values;\n\n for (size_t idx = 0; idx < variable_values.size(); ++idx) {\n\n // This will invoke the correct operator on the variant.\n\n if (variable_values[idx] != other.variable_values[idx]) {\n\n return false;\n\n }\n\n }\n\n return true;\n\n }\n\n\n\n /**\n\n * Compute the hash of this RowTuple.\n\n *\n\n * @return the hash results.\n\n */\n\n size_t Hash() const {\n\n DCHECK(CheckSequentialWriteOrder()) << \"Variable sized write ordering mismatch\";\n\n // For fixed sized data we just hash the stored array.\n\n size_t hash = ::util::Hash64(reinterpret_cast<const char*>(fixed_values.data()),\n\n sizeof(types::FixedSizeValueUnion) * fixed_values.size());\n\n // For variable sized data we run the appropriate hash function.\n\n for (const auto& val : variable_values) {\n\n // This should be edited when we add support for new variable sized types.\n\n DCHECK(std::holds_alternative<types::StringValue>(val));\n\n hash = ::px::HashCombine(\n\n hash, types::utils::hash<types::StringValue>()(std::get<types::StringValue>(val)));\n\n }\n\n return hash;\n\n }\n\n\n\n /**\n\n * Checks to make sure the write order of variable sized data is sequential, implying that\n\n * the variable_sized data is in the correct order.\n\n * @return false if the write ordering is bad.\n\n */\n\n bool CheckSequentialWriteOrder() const {\n\n DCHECK(types != nullptr);\n\n DCHECK(types->size() >= fixed_values.size());\n\n int64_t expected_seq_id = 0;\n\n for (size_t idx = 0; idx < fixed_values.size(); ++idx) {\n\n // TODO(zasgar): Replace with IsVariableSizedType().\n\n if (types->at(idx) == types::STRING) {\n\n auto actual_seq_id = types::Get<types::Int64Value>(fixed_values[idx]).val;\n\n if (actual_seq_id != expected_seq_id) {\n\n LOG(ERROR) << absl::Substitute(\"Expected seq_id: $0, got $1\", expected_seq_id,\n\n actual_seq_id);\n\n return false;\n\n }\n\n ++expected_seq_id;\n\n }\n\n }\n\n return true;\n\n }\n\n\n\n // We store a pointer to the types, since they are likely to be shared across different RowTuples.\n\n // This pointer needs to be valid for the lifetime of this object.\n\n const std::vector<types::DataType>* types;\n\n\n\n // We store data in two chunks. The first being fixed size values which store values of fixed size\n\n // values in line, and for variable size data stores the index into the variables_values array.\n\n // This index is stored as a Int64Value.\n\n std::vector<types::FixedSizeValueUnion> fixed_values;\n\n std::vector<VariableSizeValueTypeVariant> variable_values;\n\n};\n\n\n\nnamespace internal {\n\ntemplate <typename T>\n\ninline void SetValueHelper(RowTuple* rt, size_t idx, const T& val) {\n\n static_assert(types::ValueTypeTraits<T>::is_fixed_size, \"Only fixed size values allowed\");\n\n types::SetValue<T>(&rt->fixed_values[idx], val);\n\n}\n\n\n\ntemplate <>\n\ninline void SetValueHelper<types::StringValue>(RowTuple* rt, size_t idx,\n\n const types::StringValue& val) {\n\n DCHECK_LT(idx, rt->fixed_values.size());\n\n rt->SetValue(idx, types::Int64Value(rt->variable_values.size()));\n\n rt->variable_values.emplace_back(val);\n\n}\n\n\n\ntemplate <typename T>\n\ninline const T& GetValueHelper(const RowTuple& rt, size_t idx) {\n\n static_assert(types::ValueTypeTraits<T>::is_fixed_size, \"Only fixed size values allowed\");\n\n DCHECK_LT(idx, rt.types->size());\n\n DCHECK_EQ(types::ValueTypeTraits<T>::data_type, rt.types->at(idx));\n\n return types::Get<T>(rt.fixed_values[idx]);\n\n}\n\n\n\ntemplate <>\n\ninline const types::StringValue& GetValueHelper<types::StringValue>(const RowTuple& rt,\n\n size_t idx) {\n\n DCHECK_LT(idx, rt.types->size());\n\n DCHECK_EQ(types::ValueTypeTraits<types::StringValue>::data_type, rt.types->at(idx));\n\n size_t v_offset = types::Get<types::Int64Value>(rt.fixed_values[idx]).val;\n\n DCHECK_LT(v_offset, rt.variable_values.size());\n\n return std::get<types::StringValue>(rt.variable_values[v_offset]);\n\n}\n\n} // namespace internal\n\n\n\n/**\n\n * Hash operator for RowTuple pointers.\n\n */\n\nstruct RowTuplePtrHasher {\n\n size_t operator()(const RowTuple* k) const {\n\n DCHECK(k != nullptr);\n\n return k->Hash();\n\n }\n\n};\n\n\n\n/**\n\n * Equality operator for RowTuple pointers.\n\n */\n\nstruct RowTuplePtrEq {\n\n bool operator()(const RowTuple* k1, const RowTuple* k2) const { return *k1 == *k2; }\n\n};\n\n\n\ntemplate <class T>\n\nusing AbslRowTupleHashMap = absl::flat_hash_map<RowTuple*, T, RowTuplePtrHasher, RowTuplePtrEq>;\n\n\n\nusing AbslRowTupleHashSet = absl::flat_hash_set<RowTuple*, RowTuplePtrHasher, RowTuplePtrEq>;\n\n\n\ntemplate <types::DataType DT>\n\nvoid ExtractIntoRowTuple(RowTuple* rt, arrow::Array* col, int rt_col_idx, int rt_row_idx) {\n\n using UDFValueType = typename types::DataTypeTraits<DT>::value_type;\n\n using ArrowArrayType = typename types::DataTypeTraits<DT>::arrow_array_type;\n\n rt->SetValue<UDFValueType>(rt_col_idx,\n\n types::GetValue(static_cast<ArrowArrayType*>(col), rt_row_idx));\n\n}\n\n\n\n} // namespace exec\n\n} // namespace carnot\n", "file_path": "src/carnot/exec/row_tuple.h", "rank": 65, "score": 260483.52915356515 }, { "content": "class AggNode : public ProcessingNode {\n\n using AggHashMap = AbslRowTupleHashMap<AggHashValue*>;\n\n\n\n public:\n\n AggNode() = default;\n\n virtual ~AggNode() = default;\n\n\n\n protected:\n\n Status AggregateGroupByNone(ExecState* exec_state, const table_store::schema::RowBatch& rb);\n\n Status AggregateGroupByClause(ExecState* exec_state, const table_store::schema::RowBatch& rb);\n\n\n\n std::string DebugStringImpl() override;\n\n Status InitImpl(const plan::Operator& plan_node) override;\n\n Status PrepareImpl(ExecState* exec_state) override;\n\n Status OpenImpl(ExecState* exec_state) override;\n\n Status CloseImpl(ExecState* exec_state) override;\n\n Status ConsumeNextImpl(ExecState* exec_state, const table_store::schema::RowBatch& rb,\n\n size_t parent_index) override;\n\n\n\n private:\n", "file_path": "src/carnot/exec/agg_node.h", "rank": 66, "score": 258437.69260770062 }, { "content": "class ExplicitRule : public InferenceRule {\n\n /**\n\n * @brief Explicitly declared semantic type inference rule.\n\n *\n\n * This rule specifies a set of exec (UDF) or update (UDA) arg types and an output type.\n\n * If a UDF is called with these arg types then this rule specifies the output type.\n\n *\n\n * NOTE: Currently, the compiler ignores the init_arg_types.\n\n */\n\n public:\n\n template <typename TUDF>\n\n static std::shared_ptr<ExplicitRule> Create(\n\n types::SemanticType out_type, std::vector<types::SemanticType> exec_or_update_types) {\n\n return std::make_shared<ExplicitRule>(SemanticInferenceTraits<TUDF>::udf_exec_type(), out_type,\n\n exec_or_update_types);\n\n }\n\n ExplicitRule(udfspb::UDFExecType udf_exec_type, types::SemanticType out_type,\n\n std::vector<types::SemanticType> exec_or_update_types)\n\n : ExplicitRule(udf_exec_type, out_type, {}, exec_or_update_types) {}\n\n ExplicitRule(udfspb::UDFExecType udf_exec_type, types::SemanticType out_type,\n", "file_path": "src/carnot/udf/type_inference.h", "rank": 67, "score": 258437.69260770062 }, { "content": "class UDA1Overload : public UDA {\n\n public:\n\n Status Init(FunctionContext*, types::StringValue) { return Status::OK(); }\n\n void Update(FunctionContext*, types::Int64Value, types::Float64Value) {}\n\n void Merge(FunctionContext*, const UDA1Overload&) {}\n\n types::Float64Value Finalize(FunctionContext*) { return 0; }\n\n};\n\n\n\nTEST(Registry, init_with_udas) {\n\n auto registry = Registry(\"test registry\");\n\n registry.RegisterOrDie<UDA1>(\"uda1\");\n\n registry.RegisterOrDie<UDA1Overload>(\"uda1\");\n\n\n\n auto statusor = registry.GetUDADefinition(\n\n \"uda1\", std::vector<types::DataType>({types::DataType::STRING, types::DataType::INT64}));\n\n ASSERT_OK(statusor);\n\n auto def = statusor.ConsumeValueOrDie();\n\n ASSERT_NE(nullptr, def);\n\n EXPECT_EQ(\"uda1\", def->name());\n\n EXPECT_EQ(std::vector<types::DataType>({types::DataType::INT64}), def->update_arguments());\n", "file_path": "src/carnot/udf/registry_test.cc", "rank": 68, "score": 258437.69260770062 }, { "content": "class ScalarFunc : public ScalarExpression {\n\n public:\n\n ScalarFunc() = default;\n\n ~ScalarFunc() override = default;\n\n\n\n Status Init(const planpb::ScalarFunc& pb);\n\n // Override base class methods.\n\n std::vector<const Column*> ColumnDeps() override;\n\n StatusOr<types::DataType> OutputDataType(\n\n const PlanState& state, const table_store::schema::Schema& input_schema) const override;\n\n std::vector<ScalarExpression*> Deps() const override;\n\n Expression ExpressionType() const override;\n\n std::string DebugString() const override;\n\n\n\n std::string name() const { return name_; }\n\n int64_t udf_id() const { return udf_id_; }\n\n const ScalarExpressionPtrVector& arg_deps() const { return arg_deps_; }\n\n const std::vector<types::DataType> registry_arg_types() const { return registry_arg_types_; }\n\n const std::vector<ScalarValue> init_arguments() const { return init_arguments_; }\n\n\n\n private:\n\n std::string name_;\n\n int64_t udf_id_;\n\n ScalarExpressionPtrVector arg_deps_;\n\n std::vector<types::DataType> registry_arg_types_;\n\n std::vector<ScalarValue> init_arguments_;\n\n};\n\n\n", "file_path": "src/carnot/plan/scalar_expression.h", "rank": 69, "score": 258437.69260770062 }, { "content": "class CoordinatorImpl : public Coordinator {\n\n protected:\n\n StatusOr<std::unique_ptr<DistributedPlan>> CoordinateImpl(const IR* logical_plan) override;\n\n Status InitImpl(CompilerState* compiler_state,\n\n const distributedpb::DistributedState& distributed_state) override;\n\n Status ProcessConfigImpl(const CarnotInfo& carnot_info) override;\n\n\n\n private:\n\n const distributedpb::CarnotInfo& GetRemoteProcessor() const;\n\n bool HasExecutableNodes(const IR* plan);\n\n\n\n /**\n\n * @brief Removes the sources and any operators depending on that source. Operators that depend on\n\n * the source not only means the Transitive dependents, but also any parents of those Transitive\n\n * dependents that are not dependents of the sources to be deleted but don't feed data anywhere\n\n * else as a result of the source being deleted.\n\n *\n\n * For example in the following graph with UDTFSrc set for\n\n * removal:\n\n *\n", "file_path": "src/carnot/planner/distributed/coordinator/coordinator.h", "rank": 70, "score": 258437.69260770062 }, { "content": "class SourceNode : public ExecNode {\n\n public:\n\n SourceNode() : ExecNode(ExecNodeType::kSourceNode) {}\n\n virtual ~SourceNode() = default;\n\n\n\n bool HasBatchesRemaining() { return !sent_eos_; }\n\n virtual bool NextBatchReady() = 0;\n\n int64_t BytesProcessed() const { return bytes_processed_; }\n\n int64_t RowsProcessed() const { return rows_processed_; }\n\n Status SendEndOfStream(ExecState* exec_state) {\n\n // TODO(philkuz) this part is not tracked w/ the timer. Need to include this in NVI or cut\n\n // losses.\n\n PL_ASSIGN_OR_RETURN(auto rb, table_store::schema::RowBatch::WithZeroRows(\n\n *output_descriptor_, /*eow*/ true, /*eos*/ true));\n\n return SendRowBatchToChildren(exec_state, *rb);\n\n }\n\n\n\n protected:\n\n int64_t rows_processed_ = 0;\n\n int64_t bytes_processed_ = 0;\n\n};\n\n\n\n/**\n\n * Sink node is the base class for anything that consumes records and writes to some sink.\n\n * For example: MemorySink.\n\n */\n", "file_path": "src/carnot/exec/exec_node.h", "rank": 71, "score": 258437.69260770062 }, { "content": "class ScalarExpression : public PlanNode {\n\n public:\n\n static StatusOr<std::unique_ptr<ScalarExpression>> FromProto(const planpb::ScalarExpression& pb);\n\n\n\n ~ScalarExpression() override = default;\n\n bool is_initialized() const { return is_initialized_; }\n\n\n\n /**\n\n * Compute the output data type of the expression.\n\n *\n\n * @param input_schema The input schema which is used to look up potential dependencies.\n\n * @return Either an Status or the compute data type.\n\n */\n\n virtual StatusOr<types::DataType> OutputDataType(\n\n const PlanState& state, const table_store::schema::Schema& input_schema) const = 0;\n\n\n\n /**\n\n * Computes the column dependencies and returns a reference to all of them. No\n\n * ownership transfer is done for the columns and the lifetime is the same as the\n\n * parent class.\n", "file_path": "src/carnot/plan/scalar_expression.h", "rank": 72, "score": 258437.69260770062 }, { "content": "class UDTFDefinition : public UDFDefinition {\n\n public:\n\n UDTFDefinition() = delete;\n\n ~UDTFDefinition() override = default;\n\n\n\n explicit UDTFDefinition(std::string_view name) : UDFDefinition(UDFDefinitionKind::kUDTF, name) {}\n\n\n\n /**\n\n * Init a UDTF definition with the given name and type.\n\n *\n\n * @tparam T the UDTF class. Must be derived from UDTF.\n\n * @param name The name of the UDTF.\n\n * @return Status success/error.\n\n */\n\n template <typename T>\n\n Status Init() {\n\n auto factory = std::make_unique<GenericUDTFFactory<T>>();\n\n return Init<T>(std::move(factory));\n\n }\n\n\n", "file_path": "src/carnot/udf/udf_definition.h", "rank": 73, "score": 258437.69260770062 }, { "content": "class FilterNode : public ProcessingNode {\n\n public:\n\n FilterNode() = default;\n\n virtual ~FilterNode() = default;\n\n\n\n protected:\n\n std::string DebugStringImpl() override;\n\n Status InitImpl(const plan::Operator& plan_node) override;\n\n Status PrepareImpl(ExecState* exec_state) override;\n\n Status OpenImpl(ExecState* exec_state) override;\n\n Status CloseImpl(ExecState* exec_state) override;\n\n Status ConsumeNextImpl(ExecState* exec_state, const table_store::schema::RowBatch& rb,\n\n size_t parent_index) override;\n\n\n\n private:\n\n std::unique_ptr<VectorNativeScalarExpressionEvaluator> evaluator_;\n\n std::unique_ptr<plan::FilterOperator> plan_node_;\n\n std::unique_ptr<udf::FunctionContext> function_ctx_;\n\n};\n\n\n\n} // namespace exec\n\n} // namespace carnot\n\n} // namespace px\n", "file_path": "src/carnot/exec/filter_node.h", "rank": 74, "score": 258437.69260770062 }, { "content": "// This node presumes that input streams will always come in ordered by time\n\n// when there is a time column.\n\nclass UnionNode : public ProcessingNode {\n\n public:\n\n UnionNode() = default;\n\n virtual ~UnionNode() = default;\n\n\n\n // For the time ordered case: A MergeRow represents a row in an input row batch.\n\n struct MergeRow {\n\n size_t parent_index;\n\n size_t row_batch_id;\n\n size_t row_number;\n\n types::Time64NSValue time;\n\n bool end_of_row_batch;\n\n };\n\n\n\n void disable_data_flush_timeout() { enable_data_flush_timeout_ = false; }\n\n void set_data_flush_timeout(const std::chrono::milliseconds& data_flush_timeout) {\n\n enable_data_flush_timeout_ = true;\n\n data_flush_timeout_ = data_flush_timeout;\n\n }\n\n\n", "file_path": "src/carnot/exec/union_node.h", "rank": 75, "score": 258437.69260770062 }, { "content": "class SinkNode : public ExecNode {\n\n public:\n\n SinkNode() : ExecNode(ExecNodeType::kSinkNode) {}\n\n virtual ~SinkNode() = default;\n\n};\n\n\n\n} // namespace exec\n\n} // namespace carnot\n\n} // namespace px\n", "file_path": "src/carnot/exec/exec_node.h", "rank": 76, "score": 258437.69260770062 }, { "content": "class UDADefinition : public UDFDefinition {\n\n public:\n\n UDADefinition() = delete;\n\n ~UDADefinition() override = default;\n\n\n\n explicit UDADefinition(std::string_view name) : UDFDefinition(UDFDefinitionKind::kUDA, name) {}\n\n\n\n /**\n\n * Init a UDA definition with the given name and type.\n\n *\n\n * @tparam T the UDA class. Must be derived from UDA.\n\n * @param name The name of the UDA.\n\n * @return Status success/error.\n\n */\n\n template <typename T>\n\n Status Init() {\n\n auto update_arguments_array = UDATraits<T>::UpdateArgumentTypes();\n\n update_arguments_ = {update_arguments_array.begin(), update_arguments_array.end()};\n\n finalize_return_type_ = UDATraits<T>::FinalizeReturnType();\n\n make_fn_ = UDAWrapper<T>::Make;\n", "file_path": "src/carnot/udf/udf_definition.h", "rank": 77, "score": 258437.69260770062 }, { "content": "class EquijoinNode : public ProcessingNode {\n", "file_path": "src/carnot/exec/equijoin_node.h", "rank": 78, "score": 258437.69260770062 }, { "content": "class TypedUDA2 : public UDA {\n\n public:\n\n Status Init(FunctionContext*) { return Status::OK(); }\n\n void Update(FunctionContext*, types::Int64Value) {}\n\n void Merge(FunctionContext*, const TypedUDA2&) {}\n\n types::Int64Value Finalize(FunctionContext*) { return 0; }\n\n\n\n static InfRuleVec SemanticInferenceRules() {\n\n return {\n\n InheritTypeFromArgs<TypedUDA2>::Create({types::ST_BYTES}),\n\n };\n\n }\n\n};\n\n\n", "file_path": "src/carnot/udf/registry_test.cc", "rank": 79, "score": 258437.69260770062 }, { "content": "class ASIDUDF : public ScalarUDF {\n\n public:\n\n Int64Value Exec(FunctionContext* ctx) {\n\n auto md = GetMetadataState(ctx);\n\n return md->asid();\n\n }\n\n\n\n static udf::ScalarUDFDocBuilder Doc() {\n\n return udf::ScalarUDFDocBuilder(\"Get the agent ID.\")\n\n .Details(\"Get the agent ID of the node that the data originated from.\")\n\n .Example(\"df.agent = px.asid()\")\n\n .Returns(\"The agent ID.\");\n\n }\n\n static udf::InfRuleVec SemanticInferenceRules() {\n\n return {udf::ExplicitRule::Create<ASIDUDF>(types::ST_ASID, {})};\n\n }\n\n};\n\n\n", "file_path": "src/carnot/funcs/metadata/metadata_ops.h", "rank": 80, "score": 258437.69260770062 }, { "content": "class MetadataProperty : public NotCopyable {\n\n public:\n\n MetadataProperty() = delete;\n\n virtual ~MetadataProperty() = default;\n\n\n\n /**\n\n @brief Returns a bool that notifies whether an expression fits the expected format for this\n\n * property when comparing. This is used to make sure comparison operations (==, >, <, !=) are\n\n * pre-checked during compilation, preventing unnecssary operations during execution and exposing\n\n * query errors to the user.\n\n *\n\n * For example, we expect values compared to POD_NAMES to be Strings of the format\n\n * `<namespace>/<pod-name>`.\n\n *\n\n * ExplainFormat should describe the expected format of this method in string form.\n\n *\n\n * @param value: the ExpressionIR node that\n\n */\n\n virtual bool ExprFitsFormat(ExpressionIR* value) const = 0;\n\n\n", "file_path": "src/carnot/planner/ir/metadata_ir.h", "rank": 81, "score": 258437.69260770062 }, { "content": "class RegexTagger : public Tagger {\n\n public:\n\n RegexTagger() : regex_(TagTypeTraits<TTag>::BuildRegexPattern()) {\n\n // Since the regex patterns are defined at compile time, using a DCHECK is ok here.\n\n DCHECK_EQ(regex_.error_code(), RE2::NoError) << regex_.error();\n\n }\n\n\n\n Status AddTags(std::string* input, std::vector<Tag>* tags) {\n\n re2::StringPiece input_piece(input->data(), input->length());\n\n auto prev_length = input_piece.length();\n\n int curr_idx = 0;\n\n std::string match;\n\n while (RE2::FindAndConsume(&input_piece, regex_, &match)) {\n\n auto consumed = prev_length - input_piece.length();\n\n if (consumed == 0) {\n\n return Status(statuspb::Code::INVALID_ARGUMENT,\n\n \"RegexTagger has a regex pattern which matches an empty string.\");\n\n }\n\n if (!TagTypeTraits<TTag>::Filter(match)) {\n\n continue;\n", "file_path": "src/carnot/funcs/builtins/pii_ops.h", "rank": 82, "score": 258437.69260770062 }, { "content": "class TryUntilMax : public Strategy {\n\n public:\n\n TryUntilMax(const std::string& name, int64_t max_iterations) : Strategy(name, max_iterations) {}\n\n Status MaxIterationsHandler() override {\n\n VLOG(1) << absl::Substitute(\"Max iterations reached for rule batch $0. Continuing.\", name_);\n\n return Status::OK();\n\n }\n\n};\n\n\n\n/**\n\n * @brief Run the rule batch once and silently accept that the max iterations are reached.\n\n */\n", "file_path": "src/carnot/planner/rules/rule_executor.h", "rank": 83, "score": 258437.69260770062 }, { "content": "class ValueType : public BaseType {\n\n /**\n\n * @brief ValueType is the most basic type. It stores the primitive data type and the semantic\n\n * type.\n\n */\n\n public:\n\n DataType data_type() const { return data_type_; }\n\n SemanticType semantic_type() const { return semantic_type_; }\n\n\n\n TypePtr Copy() const override { return ValueType::Create(data_type_, semantic_type_); }\n\n\n\n bool operator==(const ValueType& other) const {\n\n return (data_type_ == other.data_type()) && (semantic_type_ == other.semantic_type());\n\n }\n\n bool operator!=(const ValueType& other) const { return !(*this == other); }\n\n\n\n std::string DebugString() const override {\n\n return absl::Substitute(\"ValueType($0, $1)\", types::ToString(data_type_),\n\n types::ToString(semantic_type_));\n\n }\n", "file_path": "src/carnot/planner/types/types.h", "rank": 84, "score": 258437.69260770062 }, { "content": "class AggregateExpression : public ScalarExpression {\n\n public:\n\n AggregateExpression() = default;\n\n ~AggregateExpression() override = default;\n\n\n\n Status Init(const planpb::AggregateExpression& pb);\n\n // Override base class methods.\n\n std::vector<const Column*> ColumnDeps() override;\n\n StatusOr<types::DataType> OutputDataType(\n\n const PlanState& state, const table_store::schema::Schema& input_schema) const override;\n\n std::vector<ScalarExpression*> Deps() const override;\n\n Expression ExpressionType() const override;\n\n std::string DebugString() const override;\n\n\n\n std::string name() const { return name_; }\n\n int64_t uda_id() const { return uda_id_; }\n\n const ScalarExpressionPtrVector& arg_deps() const { return arg_deps_; }\n\n const std::vector<types::DataType> registry_arg_types() const { return registry_arg_types_; }\n\n const std::vector<ScalarValue> init_arguments() const { return init_arguments_; }\n\n\n", "file_path": "src/carnot/plan/scalar_expression.h", "rank": 85, "score": 258437.69260770062 }, { "content": "class FailOnMax : public Strategy {\n\n public:\n\n FailOnMax(const std::string& name, int64_t max_iterations) : Strategy(name, max_iterations) {}\n\n Status MaxIterationsHandler() override {\n\n return error::DeadlineExceeded(\"Reached max iterations ($0) for rule batch '$1'\",\n\n max_iterations(), name_);\n\n }\n\n};\n\n\n\n/**\n\n * @brief When max iterations are reached, don't fail and warn quietly.\n\n */\n", "file_path": "src/carnot/planner/rules/rule_executor.h", "rank": 86, "score": 258437.69260770062 }, { "content": "class TableType : public BaseType {\n\n /**\n\n * @brief TableType stores column data types, mapping column names to there type.\n\n *\n\n * Currently, all Operators have a TableType and all expressions have a ValueType, but with the\n\n * data model changes we might want to extend the type system to make tags data there own type\n\n * structure.\n\n */\n\n public:\n\n static std::shared_ptr<TableType> Create() { return std::shared_ptr<TableType>(new TableType); }\n\n\n\n static std::shared_ptr<TableType> Create(Relation rel) {\n\n return std::shared_ptr<TableType>(new TableType(rel));\n\n }\n\n\n\n void AddColumn(std::string col_name, TypePtr type_) {\n\n DCHECK_EQ(0, map_.count(col_name)) << absl::Substitute(\n\n \"Cannot AddColumn '$0'. Column already exists in type: $1\", col_name, DebugString());\n\n map_.insert({col_name, type_});\n\n ordered_col_names_.push_back(col_name);\n", "file_path": "src/carnot/planner/types/types.h", "rank": 87, "score": 258437.69260770062 }, { "content": "class TypedUDA1 : public UDA {\n\n public:\n\n Status Init(FunctionContext*) { return Status::OK(); }\n\n void Update(FunctionContext*, types::Int64Value) {}\n\n void Merge(FunctionContext*, const TypedUDA1&) {}\n\n types::Int64Value Finalize(FunctionContext*) { return 0; }\n\n\n\n static InfRuleVec SemanticInferenceRules() {\n\n return {\n\n InheritTypeFromArgs<TypedUDA1>::Create({types::ST_BYTES}),\n\n };\n\n }\n\n};\n\n\n", "file_path": "src/carnot/udf/registry_test.cc", "rank": 88, "score": 258437.69260770062 }, { "content": "class ProcessingNode : public ExecNode {\n\n public:\n\n ProcessingNode() : ExecNode(ExecNodeType::kProcessingNode) {}\n\n virtual ~ProcessingNode() = default;\n\n};\n\n\n\n/**\n\n * Source node is the base class for anything that produces records from some source.\n\n * For example: MemorySource.\n\n */\n", "file_path": "src/carnot/exec/exec_node.h", "rank": 89, "score": 258437.69260770062 }, { "content": "class MockRule : public Rule {\n\n public:\n\n explicit MockRule(CompilerState* compiler_state)\n\n : Rule(compiler_state, /*use_topo*/ false, /*reverse_topological_execution*/ false) {}\n\n MockRule() : Rule(nullptr, /*use_topo*/ false, /*reverse_topological_execution*/ false) {}\n\n\n\n MOCK_METHOD1(Execute, StatusOr<bool>(IR* ir_graph));\n\n\n\n protected:\n\n MOCK_METHOD1(Apply, StatusOr<bool>(IRNode* ir_node));\n\n};\n\n} // namespace planner\n\n} // namespace carnot\n\n} // namespace px\n", "file_path": "src/carnot/planner/rules/rule_mock.h", "rank": 90, "score": 258437.69260770062 }, { "content": "class FuncObject : public QLObject {\n\n public:\n\n static constexpr TypeDescriptor FuncType = {\n\n /* name */ \"Function\",\n\n /* type */ QLObjectType::kFunction,\n\n };\n\n // The default type. I haven't completely decided this API so using an alias for now.\n\n using DefaultType = std::string;\n\n\n\n static StatusOr<std::shared_ptr<FuncObject>> Create(\n\n std::string_view name, const std::vector<std::string>& arguments,\n\n const absl::flat_hash_map<std::string, DefaultType>& defaults, bool has_variable_len_args,\n\n bool has_variable_len_kwargs, FunctionType impl, ASTVisitor* visitor);\n\n\n\n /**\n\n * @brief Construct a new Python Function.\n\n *\n\n * @param name the name of the function.\n\n * @param arguments the list of all argument names.\n\n * @param defaults the list of all defaults. Each key must be a part of arguments, otherwise will\n", "file_path": "src/carnot/planner/objects/funcobject.h", "rank": 91, "score": 258437.69260770062 }, { "content": "class ScalarValue : public ScalarExpression {\n\n public:\n\n ScalarValue() = default;\n\n ~ScalarValue() override = default;\n\n\n\n /// Initializes the constant scalar value based on the passed in protobuf msg.\n\n Status Init(const planpb::ScalarValue& pb);\n\n\n\n // Override base class methods.\n\n std::vector<const Column*> ColumnDeps() override;\n\n StatusOr<types::DataType> OutputDataType(\n\n const PlanState& state, const table_store::schema::Schema& input_schema) const override;\n\n std::vector<ScalarExpression*> Deps() const override;\n\n Expression ExpressionType() const override;\n\n std::string DebugString() const override;\n\n\n\n /// Returns the data type of the constant value.\n\n types::DataType DataType() const { return pb_.data_type(); }\n\n // Accessor functions that return the value based on type.\n\n // If the wrong function is called then an invalid value may be returned.\n", "file_path": "src/carnot/plan/scalar_expression.h", "rank": 92, "score": 258437.69260770062 }, { "content": "class LimitNode : public ProcessingNode {\n\n public:\n\n LimitNode() = default;\n\n virtual ~LimitNode() = default;\n\n\n\n protected:\n\n std::string DebugStringImpl() override;\n\n Status InitImpl(const plan::Operator& plan_node) override;\n\n Status PrepareImpl(ExecState* exec_state) override;\n\n Status OpenImpl(ExecState* exec_state) override;\n\n Status CloseImpl(ExecState* exec_state) override;\n\n Status ConsumeNextImpl(ExecState* exec_state, const table_store::schema::RowBatch& rb,\n\n size_t parent_index) override;\n\n\n\n private:\n\n size_t records_processed_ = 0;\n\n bool limit_reached_ = false;\n\n std::unique_ptr<plan::LimitOperator> plan_node_;\n\n};\n\n\n\n} // namespace exec\n\n} // namespace carnot\n\n} // namespace px\n", "file_path": "src/carnot/exec/limit_node.h", "rank": 93, "score": 258437.69260770062 }, { "content": "class NamespaceInfo : public K8sMetadataObject {\n\n public:\n\n NamespaceInfo(UID uid, std::string_view ns, std::string_view name)\n\n : K8sMetadataObject(K8sObjectType::kNamespace, std::move(uid), std::move(ns),\n\n std::move(name)) {}\n\n virtual ~NamespaceInfo() = default;\n\n\n\n std::unique_ptr<K8sMetadataObject> Clone() const override {\n\n return std::unique_ptr<NamespaceInfo>(new NamespaceInfo(*this));\n\n }\n\n\n\n std::string DebugString(int indent = 0) const override;\n\n\n\n protected:\n\n NamespaceInfo(const NamespaceInfo& other) = default;\n\n NamespaceInfo& operator=(const NamespaceInfo& other) = delete;\n\n};\n\n\n\n} // namespace md\n\n} // namespace px\n", "file_path": "src/shared/metadata/k8s_objects.h", "rank": 94, "score": 256870.15013850314 }, { "content": "class AgentDeathHandler : public px::FatalErrorHandlerInterface {\n\n public:\n\n AgentDeathHandler() = default;\n\n void OnFatalError() const override {\n\n // Stack trace will print automatically; any additional state dumps can be done here.\n\n // Note that actions here must be async-signal-safe and must not allocate memory.\n\n }\n\n};\n\n\n", "file_path": "src/vizier/services/agent/kelvin/kelvin_main.cc", "rank": 95, "score": 256828.2951019961 }, { "content": "class AgentDeathHandler : public px::FatalErrorHandlerInterface {\n\n public:\n\n AgentDeathHandler() = default;\n\n void OnFatalError() const override {\n\n // Stack trace will print automatically; any additional state dumps can be done here.\n\n // Note that actions here must be async-signal-safe and must not allocate memory.\n\n }\n\n};\n\n\n", "file_path": "src/vizier/services/agent/pem/pem_main.cc", "rank": 96, "score": 256828.2951019961 }, { "content": "class NetNamespaceTest : public ::testing::Test {\n\n protected:\n\n void SetUp() override { ASSERT_OK(container_.Run()); }\n\n\n\n DummyTestContainer container_;\n\n};\n\n\n\nTEST_F(NetNamespaceTest, NetNamespace) {\n\n ASSERT_OK_AND_ASSIGN(uint32_t net_ns, NetNamespace(system::Config::GetInstance().proc_path(),\n\n container_.process_pid()));\n\n EXPECT_NE(net_ns, 0);\n\n EXPECT_NE(net_ns, -1);\n\n}\n\n\n\nTEST_F(NetNamespaceTest, NetlinkSocketProber) {\n\n {\n\n ASSERT_OK_AND_ASSIGN(std::unique_ptr<NetlinkSocketProber> socket_prober,\n\n NetlinkSocketProber::Create());\n\n\n\n std::map<int, SocketInfo> socket_info_entries;\n", "file_path": "src/common/system/socket_info_namespace_test.cc", "rank": 97, "score": 256346.15578642258 }, { "content": "class ComputePi : public px::event::AsyncTask {\n\n public:\n\n ~ComputePi() { ++g_compute_pi_destructor_count; }\n\n\n\n void Work() override {\n\n ++work_call_count_;\n\n VLOG(1) << \"PI_ID : \" << std::this_thread::get_id();\n\n int n = 10000;\n\n double sum = 0.0;\n\n int sign = 1;\n\n for (int i = 0; i < n; ++i) {\n\n sum += sign / (2.0 * i + 1.0);\n\n sign *= -1;\n\n }\n\n pi_ = 4.0 * sum;\n\n }\n\n\n\n void Done() override {\n\n ++done_call_count_;\n\n VLOG(1) << \"PI_COMPUTE_DONE : \" << std::this_thread::get_id();\n", "file_path": "src/common/event/libuv_dispatcher_test.cc", "rank": 98, "score": 255798.29162345995 }, { "content": "class ProcessTarget : public QLObject {\n\n public:\n\n static constexpr TypeDescriptor ProcessTracepointType = {\n\n /* name */ \"ProcessTarget\",\n\n /* type */ QLObjectType::kProcessTarget,\n\n };\n\n\n\n static StatusOr<std::shared_ptr<ProcessTarget>> Create(ASTVisitor* visitor,\n\n const std::string& pod_name,\n\n const std::string& container_name,\n\n const std::string& cmdline) {\n\n return std::shared_ptr<ProcessTarget>(\n\n new ProcessTarget(visitor, pod_name, container_name, cmdline));\n\n }\n\n\n\n static bool IsProcessTarget(const QLObjectPtr& ptr) {\n\n return ptr->type() == ProcessTracepointType.type();\n\n }\n\n\n\n ProcessSpec target() const { return {pod_name_, container_name_, process_}; }\n", "file_path": "src/carnot/planner/probes/process_target.h", "rank": 99, "score": 255470.1051810248 } ]
C++
GLAC/observables/latticeactionchargedensity.cpp
hmvege/GluonicLQCD
9bb7466fce408bf51cb98d65f639acd37d034d62
#include "latticeactionchargedensity.h" #include <cmath> #include "parallelization/communicator.h" #include "config/parameters.h" #include "io/fieldio.h" LatticeActionChargeDensity::LatticeActionChargeDensity(const bool flow) : Correlator() { initializeObservableStorer(flow); m_plaqMultiplicationFactor = 1.0/(18.0*double(m_latticeSize)); m_topcMultiplicationFactor = 1.0/(16*16*M_PI*M_PI); m_energyMultiplicationFactor = 1.0/double(Parameters::getLatticeSize()); m_clov1.allocate(m_N); m_clov2.allocate(m_N); m_U2Temp.allocate(m_N); m_U3Temp.allocate(m_N); m_temp.allocate(m_N); m_tempDiag.allocate(m_N); m_topCharge.allocate(m_N); m_energy.allocate(m_N); m_samplingFrequency = Parameters::getSamplingFrequency(); } LatticeActionChargeDensity::~LatticeActionChargeDensity() { delete m_plaqObservable; delete m_topcObservable; delete m_energyObservable; } void LatticeActionChargeDensity::initializeObservableStorer(const bool storeFlowObservable) { m_storeFlowObservable = storeFlowObservable; if (m_storeFlowObservable) { m_plaqObservable = new ObservableStorer(Parameters::getNFlows() + 1); m_topcObservable = new ObservableStorer(Parameters::getNFlows() + 1); m_energyObservable = new ObservableStorer(Parameters::getNFlows() + 1); } else { if (Parameters::getStoreThermalizationObservables()) { m_plaqObservable = new ObservableStorer(Parameters::getNCf() + Parameters::getNTherm() + 1); m_topcObservable = new ObservableStorer(Parameters::getNCf() + Parameters::getNTherm() + 1); m_energyObservable = new ObservableStorer(Parameters::getNCf() + Parameters::getNTherm() + 1); } else { m_plaqObservable = new ObservableStorer(Parameters::getNCf()); m_topcObservable = new ObservableStorer(Parameters::getNCf()); m_energyObservable = new ObservableStorer(Parameters::getNCf()); } } m_plaqObservable->setNormalizeObservableByProcessor(true); m_plaqObservable->setObservableName("plaq"); m_topcObservable->setObservableName("topc"); m_energyObservable->setObservableName("energy"); } void LatticeActionChargeDensity::writeFlowObservablesToFile(const unsigned int iFlow) { m_plaqObservable->gatherResults(); m_plaqObservable->writeFlowObservableToFile(iFlow); m_topcObservable->gatherResults(); m_topcObservable->writeFlowObservableToFile(iFlow); m_energyObservable->gatherResults(); m_energyObservable->writeFlowObservableToFile(iFlow); } void LatticeActionChargeDensity::writeObservableToFile(const double acceptanceRatio) { m_plaqObservable->writeObservableToFile(acceptanceRatio); m_topcObservable->writeObservableToFile(acceptanceRatio); m_energyObservable->writeObservableToFile(acceptanceRatio); } void LatticeActionChargeDensity::reset() { m_plaqObservable->reset(); m_topcObservable->reset(); m_energyObservable->reset(); } void LatticeActionChargeDensity::runStatistics() { m_plaqObservable->runStatistics(); m_topcObservable->runStatistics(); m_energyObservable->runStatistics(); } void LatticeActionChargeDensity::printHeader() { if (!m_storeFlowObservable) { printf("%-*s %-*s %-*s", m_headerWidth,m_plaqObservable->getObservableName().c_str(), m_headerWidth,m_topcObservable->getObservableName().c_str(), m_headerWidth,m_energyObservable->getObservableName().c_str()); } else { printf("\ni t %-*s %-*s %-*s", m_headerWidth,m_plaqObservable->getObservableName().c_str(), m_headerWidth,m_topcObservable->getObservableName().c_str(), m_headerWidth,m_energyObservable->getObservableName().c_str()); } } void LatticeActionChargeDensity::printObservable(const unsigned int iObs) { if (!m_storeFlowObservable) { if (Parallel::Communicator::getProcessRank() == 0) { printf("%-*.8f %-*.8f %-*.8f", m_headerWidth,m_plaqObservable->getObservable(iObs), m_headerWidth,m_topcObservable->getObservable(iObs), m_headerWidth,m_energyObservable->getObservable(iObs)); } } else { double plaqObs = m_plaqObservable->getObservable(iObs); double topcObs = m_topcObservable->getObservable(iObs); double energyObs = m_energyObservable->getObservable(iObs); Parallel::Communicator::gatherDoubleResults(&plaqObs,1); Parallel::Communicator::gatherDoubleResults(&topcObs,1); Parallel::Communicator::gatherDoubleResults(&energyObs,1); if (Parallel::Communicator::getProcessRank() == 0) { printf("\n%-4d %-3.3f %-*.15f %-*.15f %-*.15f", iObs, double(iObs)*Parameters::getFlowEpsilon(), m_headerWidth,plaqObs/double(Parallel::Communicator::getNumProc()), m_headerWidth,topcObs, m_headerWidth,energyObs); } } } void LatticeActionChargeDensity::printStatistics() { m_plaqObservable->printStatistics(); m_topcObservable->printStatistics(); m_energyObservable->printStatistics(); } void LatticeActionChargeDensity::copyObservable(const unsigned int iObs, const std::vector<double> &obs) { (*m_plaqObservable)[iObs] = obs[0]; (*m_topcObservable)[iObs] = obs[1]; (*m_energyObservable)[iObs] = obs[2]; } std::vector<double> LatticeActionChargeDensity::getObservablesVector(const unsigned int iObs) { std::vector<double> obs(3); obs[0] = (*m_plaqObservable)[iObs]; obs[1] = (*m_topcObservable)[iObs]; obs[2] = (*m_energyObservable)[iObs]; return obs; } void LatticeActionChargeDensity::calculate(Lattice<SU3> *lattice, const unsigned int iObs) { m_topCharge.zeros(); m_energy.zeros(); m_plaquette = 0; mu = 0; for (int nu = 1; nu < 4; nu++) { m_temp = lattice[mu]; m_temp *= shift(lattice[nu],FORWARDS,mu); m_temp *= inv(shift(lattice[mu],FORWARDS,nu)); m_temp *= inv(lattice[nu]); m_clov1 = m_temp; m_plaquette += sumRealTrace(m_clov1); m_U2Temp = shift(lattice[nu],BACKWARDS,nu); m_U3Temp = inv(shift(lattice[mu],BACKWARDS,mu)); m_temp = lattice[mu]; m_temp *= inv(shift(shift(lattice[nu],FORWARDS,mu),BACKWARDS,nu)); m_temp *= inv(shift(lattice[mu],BACKWARDS,nu)); m_temp *= m_U2Temp; m_clov1 -= m_temp; m_temp = m_U3Temp; m_temp *= inv(shift(shift(lattice[nu],BACKWARDS,mu),BACKWARDS,nu)); m_temp *= shift(shift(lattice[mu],BACKWARDS,mu),BACKWARDS,nu); m_temp *= m_U2Temp; m_clov1 += m_temp; m_temp = m_U3Temp; m_temp *= shift(lattice[nu],BACKWARDS,mu); m_temp *= shift(shift(lattice[mu],FORWARDS,nu),BACKWARDS,mu); m_temp *= inv(lattice[nu]); m_clov1 -= m_temp; rho = nu % 3; rho++; sigma = rho % 3; sigma++; m_temp = lattice[rho]; m_temp *= shift(lattice[sigma],FORWARDS,rho); m_temp *= inv(shift(lattice[rho],FORWARDS,sigma)); m_temp *= inv(lattice[sigma]); m_clov2 = m_temp; m_U2Temp = shift(lattice[sigma],BACKWARDS,sigma); m_U3Temp = inv(shift(lattice[rho],BACKWARDS,rho)); m_plaquette += sumRealTrace(m_clov2); m_temp = lattice[rho]; m_temp *= inv(shift(shift(lattice[sigma],FORWARDS,rho),BACKWARDS,sigma)); m_temp *= inv(shift(lattice[rho],BACKWARDS,sigma)); m_temp *= m_U2Temp; m_clov2 -= m_temp; m_temp = m_U3Temp; m_temp *= inv(shift(shift(lattice[sigma],BACKWARDS,rho),BACKWARDS,sigma)); m_temp *= shift(shift(lattice[rho],BACKWARDS,rho),BACKWARDS,sigma); m_temp *= m_U2Temp; m_clov2 += m_temp; m_temp = m_U3Temp; m_temp *= shift(lattice[sigma],BACKWARDS,rho); m_temp *= shift(shift(lattice[rho],FORWARDS,sigma),BACKWARDS,rho); m_temp *= inv(lattice[sigma]); m_clov2 -= m_temp; m_temp = inv(m_clov1); m_clov1 -= m_temp; m_tempDiag = imagTrace(m_clov1)/3.0; m_clov1 = subtractImag(m_clov1,m_tempDiag); m_temp = inv(m_clov2); m_clov2 -= m_temp; m_tempDiag = imagTrace(m_clov2)/3.0; m_clov2 = subtractImag(m_clov2,m_tempDiag); m_topCharge -= realTraceMultiplication(m_clov1,m_clov2); m_energy += realTraceMultiplication(m_clov1,m_clov1); m_energy += realTraceMultiplication(m_clov2,m_clov2); } m_plaquette *= m_plaqMultiplicationFactor; (*m_plaqObservable)[iObs] = m_plaquette; m_topCharge *= m_topcMultiplicationFactor; if (m_storeFlowObservable && (iObs % m_samplingFrequency) == 0) { IO::FieldIO::writeDoublesFieldToFile(m_topCharge, iObs, m_topcObservable->getObservableName()); } if (!m_storeFlowObservable) { IO::FieldIO::writeDoublesFieldToFile(m_topCharge, iObs, m_topcObservable->getObservableName()); } (*m_topcObservable)[iObs] = sum(m_topCharge); if (m_storeFlowObservable && (iObs % m_samplingFrequency) == 0) { IO::FieldIO::writeDoublesFieldToFile(m_energy, iObs, m_energyObservable->getObservableName()); } if (!m_storeFlowObservable) { IO::FieldIO::writeDoublesFieldToFile(m_energy, iObs, m_energyObservable->getObservableName()); } (*m_energyObservable)[iObs] = m_energyMultiplicationFactor * sum(m_energy); }
#include "latticeactionchargedensity.h" #include <cmath> #include "parallelization/communicator.h" #include "config/parameters.h" #include "io/fieldio.h" LatticeActionChargeDensity::LatticeActionChargeDensity(const bool flow) : Correlator() { initializeObservableStorer(flow); m_plaqMultiplicationFactor = 1.0/(18.0*double(m_latticeSize)); m_topcMultiplicationFactor = 1.0/(16*16*M_PI*M_PI); m_energyMultiplicationFactor = 1.0/double(Parameters::getLatticeSize()); m_clov1.allocate(m_N); m_clov2.allocate(m_N); m_U2Temp.allocate(m_N); m_U3Temp.allocate(m_N); m_temp.allocate(m_N); m_tempDiag.allocate(m_N); m_topCharge.allocate(m_N); m_energy.allocate(m_N); m_samplingFrequency = Parameters::getSamplingFrequency(); } LatticeActionChargeDensity::~LatticeActionChargeDensity() { delete m_plaqObservable; delete m_topcObservable; delete m_energyObservable; } void LatticeActionChargeDensity::initializeObservableStorer(const bool storeFlowObservable) { m_storeFlowObservable = storeFlowObservable; if (m_storeFlowObservable) { m_plaqObservable = new ObservableStorer(Parameters::getNFlows() + 1); m_topcObservable = new ObservableStorer(Parameters::getNFlows() + 1); m_energyObservable = new ObservableStorer(Parameters::getNFlows() + 1); } else { if (Parameters::getStoreThermalizationObservables()) { m_plaqObservable = new ObservableStorer(Parameters::getNCf() + Parameters::getNTherm() + 1); m_topcObservable = new ObservableStorer(Parameters::getNCf() + Parameters::getNTherm() + 1); m_energyObservable = new ObservableStorer(Parameters::getNCf() + Parameters::getNTherm() + 1); } else { m_plaqObservable = new ObservableStorer(Parameters::getNCf()); m_topcObservable = new ObservableStorer(Parameters::getNCf()); m_energyObservable = new ObservableStorer(Parameters::getNCf()); } } m_plaqObservable->setNormalizeObservableByProcessor(true); m_plaqObservable->setObservableName("plaq"); m_topcObservable->setObservableName("topc"); m_energyObservable->setObservableName("energy"); } void LatticeActionChargeDensity::writeFlowObservablesToFile(const unsigned int iFlow) { m_plaqObservable->gatherResults(); m_plaqObservable->writeFlowObservableToFile(iFlow); m_topcObservable->gatherResults(); m_topcObservable->writeFlowObservableToFile(iFlow); m_energyObservable->gatherResults(); m_energyObservable->writeFlowObservableToFile(iFlow); } void LatticeActionChargeDensity::writeObservableToFile(const double acceptanceRatio) { m_plaqObservable->writeObservableToFile(acceptanceRatio); m_topcObservable->writeObservableToFile(acceptanceRatio); m_energyObservable->writeObservableToFile(acceptanceRatio); } void LatticeActionChargeDensity::reset() { m_plaqObservable->reset(); m_topcObservable->reset(); m_energyObservable->reset(); } void LatticeActionChargeDensity::runStatistics() { m_plaqObservable->runStatistics(); m_topcObservable->runStatistics(); m_energyObservable->runStatistics(); } void LatticeActionChargeDensity::printHeader() { if (!m_storeFlowObservable) { printf("%-*s %-*s %-*s", m_headerWidth,m_plaqObservable->getObservableName().c_str(), m_headerWidth,m_topcObservable->getObservableName().c_str(), m_headerWidth,m_energyObservable->getObservableName().c_str()); } else { printf("\ni t %-*s %-*s %-*s", m_headerWidth,m_plaqObservable->getObservableName().c_str(), m_headerWidth,m_topcObservable->getObservableName().c_str(), m_headerWidth,m_energyObservable->getObservableName().c_str()); } } void LatticeActionChargeDensity::printObservable(const unsigned int iObs) { if (!m_storeFlowObservable) { if (Parallel::Communicator::getProcessRank() == 0) { printf("%-*.8f %-*.8f %-*.8f", m_headerWidth,m_plaqObservable->getObservable(iObs), m_headerWidth,m_topcObservable->getObservable(iObs), m_headerWidth,m_energyObservable->getObservable(iObs)); } } else { double plaqObs = m_plaqObservable->getObservable(iObs); double topcObs = m_topcObservable->getObservable(iObs); double energyObs = m_energyObservable->getObservable(iObs); Parallel::Communicator::gatherDoubleResults(&plaqObs,1); Parallel::Communicator::gatherDoubleResults(&topcObs,1); Parallel::Communicator::gatherDoubleResults(&energyObs,1); if (Parallel::Communicator::getProcessRank() == 0) { printf("\n%-4d %-3.3f %-*.15f %-*.15f %-*.15f", iObs, double(iObs)*Parameters::getFlowEpsilon(), m_headerWidth,plaqObs/double(Parallel::Communicator::getNumProc()), m_headerWidth,topcObs, m_headerWidth,energyObs); } } } void LatticeActio
void LatticeActionChargeDensity::copyObservable(const unsigned int iObs, const std::vector<double> &obs) { (*m_plaqObservable)[iObs] = obs[0]; (*m_topcObservable)[iObs] = obs[1]; (*m_energyObservable)[iObs] = obs[2]; } std::vector<double> LatticeActionChargeDensity::getObservablesVector(const unsigned int iObs) { std::vector<double> obs(3); obs[0] = (*m_plaqObservable)[iObs]; obs[1] = (*m_topcObservable)[iObs]; obs[2] = (*m_energyObservable)[iObs]; return obs; } void LatticeActionChargeDensity::calculate(Lattice<SU3> *lattice, const unsigned int iObs) { m_topCharge.zeros(); m_energy.zeros(); m_plaquette = 0; mu = 0; for (int nu = 1; nu < 4; nu++) { m_temp = lattice[mu]; m_temp *= shift(lattice[nu],FORWARDS,mu); m_temp *= inv(shift(lattice[mu],FORWARDS,nu)); m_temp *= inv(lattice[nu]); m_clov1 = m_temp; m_plaquette += sumRealTrace(m_clov1); m_U2Temp = shift(lattice[nu],BACKWARDS,nu); m_U3Temp = inv(shift(lattice[mu],BACKWARDS,mu)); m_temp = lattice[mu]; m_temp *= inv(shift(shift(lattice[nu],FORWARDS,mu),BACKWARDS,nu)); m_temp *= inv(shift(lattice[mu],BACKWARDS,nu)); m_temp *= m_U2Temp; m_clov1 -= m_temp; m_temp = m_U3Temp; m_temp *= inv(shift(shift(lattice[nu],BACKWARDS,mu),BACKWARDS,nu)); m_temp *= shift(shift(lattice[mu],BACKWARDS,mu),BACKWARDS,nu); m_temp *= m_U2Temp; m_clov1 += m_temp; m_temp = m_U3Temp; m_temp *= shift(lattice[nu],BACKWARDS,mu); m_temp *= shift(shift(lattice[mu],FORWARDS,nu),BACKWARDS,mu); m_temp *= inv(lattice[nu]); m_clov1 -= m_temp; rho = nu % 3; rho++; sigma = rho % 3; sigma++; m_temp = lattice[rho]; m_temp *= shift(lattice[sigma],FORWARDS,rho); m_temp *= inv(shift(lattice[rho],FORWARDS,sigma)); m_temp *= inv(lattice[sigma]); m_clov2 = m_temp; m_U2Temp = shift(lattice[sigma],BACKWARDS,sigma); m_U3Temp = inv(shift(lattice[rho],BACKWARDS,rho)); m_plaquette += sumRealTrace(m_clov2); m_temp = lattice[rho]; m_temp *= inv(shift(shift(lattice[sigma],FORWARDS,rho),BACKWARDS,sigma)); m_temp *= inv(shift(lattice[rho],BACKWARDS,sigma)); m_temp *= m_U2Temp; m_clov2 -= m_temp; m_temp = m_U3Temp; m_temp *= inv(shift(shift(lattice[sigma],BACKWARDS,rho),BACKWARDS,sigma)); m_temp *= shift(shift(lattice[rho],BACKWARDS,rho),BACKWARDS,sigma); m_temp *= m_U2Temp; m_clov2 += m_temp; m_temp = m_U3Temp; m_temp *= shift(lattice[sigma],BACKWARDS,rho); m_temp *= shift(shift(lattice[rho],FORWARDS,sigma),BACKWARDS,rho); m_temp *= inv(lattice[sigma]); m_clov2 -= m_temp; m_temp = inv(m_clov1); m_clov1 -= m_temp; m_tempDiag = imagTrace(m_clov1)/3.0; m_clov1 = subtractImag(m_clov1,m_tempDiag); m_temp = inv(m_clov2); m_clov2 -= m_temp; m_tempDiag = imagTrace(m_clov2)/3.0; m_clov2 = subtractImag(m_clov2,m_tempDiag); m_topCharge -= realTraceMultiplication(m_clov1,m_clov2); m_energy += realTraceMultiplication(m_clov1,m_clov1); m_energy += realTraceMultiplication(m_clov2,m_clov2); } m_plaquette *= m_plaqMultiplicationFactor; (*m_plaqObservable)[iObs] = m_plaquette; m_topCharge *= m_topcMultiplicationFactor; if (m_storeFlowObservable && (iObs % m_samplingFrequency) == 0) { IO::FieldIO::writeDoublesFieldToFile(m_topCharge, iObs, m_topcObservable->getObservableName()); } if (!m_storeFlowObservable) { IO::FieldIO::writeDoublesFieldToFile(m_topCharge, iObs, m_topcObservable->getObservableName()); } (*m_topcObservable)[iObs] = sum(m_topCharge); if (m_storeFlowObservable && (iObs % m_samplingFrequency) == 0) { IO::FieldIO::writeDoublesFieldToFile(m_energy, iObs, m_energyObservable->getObservableName()); } if (!m_storeFlowObservable) { IO::FieldIO::writeDoublesFieldToFile(m_energy, iObs, m_energyObservable->getObservableName()); } (*m_energyObservable)[iObs] = m_energyMultiplicationFactor * sum(m_energy); }
nChargeDensity::printStatistics() { m_plaqObservable->printStatistics(); m_topcObservable->printStatistics(); m_energyObservable->printStatistics(); }
function_block-function_prefixed
[ { "content": "class Flow\n\n{\n\nprivate:\n\n // Flow update step\n\n double m_epsilon = 0.02;\n\n // Lattice constants\n\n std::vector<unsigned int> m_N;\n\n unsigned long int m_subLatticeSize;\n\n // Temporary lattice to use when flowing\n\n Lattice<SU3> *m_tempLattice;\n\n Lattice<SU3> m_tempExpLattice;\n\n // Updates the lattice with the exponantiated lattice values using move semantics\n\n inline Lattice<SU3> matrixExp(const Lattice<SU3> &lattice);\n\n inline Lattice<SU3> matrixExp(Lattice<SU3> &&lattice);\n\n // SU3 exponentiation function\n\n SU3Exp *m_SU3ExpFunc = nullptr;\n\n void setSU3ExpFunc();\n\n // Action pointer\n\n Action *m_S = nullptr;\n\npublic:\n\n Flow(Action *S);\n\n ~Flow();\n\n void flowField(Lattice<SU3> *lattice);\n\n};\n\n\n\n#endif // FLOW_H\n", "file_path": "GLAC/flow/flow.h", "rank": 0, "score": 99108.49663563029 }, { "content": " class BooleanType = bool,\n", "file_path": "GLAC/lib/json.hpp", "rank": 1, "score": 75121.87700221714 }, { "content": "/*!\n\n * \\class Flow\n\n *\n\n * \\brief Class for applying gradient flow on lattice.\n\n *\n\n * Performs one step with gradient flow on the lattice, see <a href=\"https://arxiv.org/abs/1006.4518\">this paper</a> for a detailed description.\n\n *\n\n * \\author Mathias M. Vege\n\n * \\version 1.0\n\n * \\date 2017-2019\n\n * \\copyright MIT Licence\n\n */\n\n#ifndef FLOW_H\n\n#define FLOW_H\n\n\n\n#include \"math/lattice.h\"\n\n#include \"math/flowexpfunctions.h\"\n\n#include \"actions/action.h\"\n\n\n", "file_path": "GLAC/flow/flow.h", "rank": 2, "score": 60714.84126196623 }, { "content": " for (unsigned int mu = 0; mu < 4; mu++) {\n\n m_tempLattice[mu].allocate(m_N);\n\n }\n\n m_S = S;\n\n setSU3ExpFunc();\n\n}\n\n\n\n/*!\n\n * \\brief Flow::~Flow\n\n *\n\n * De-allocates the temporary lattice used in the Flow::flowField method, and de-allocates the SU3 exponential class.\n\n */\n\nFlow::~Flow()\n\n{\n\n delete m_SU3ExpFunc;\n\n delete [] m_tempLattice;\n\n}\n\n\n\n/*!\n\n * \\brief Flow::flowField method for flowing the lattice one step ahead.\n", "file_path": "GLAC/flow/flow.cpp", "rank": 3, "score": 59525.48016188231 }, { "content": " * \\param lattice a pointer of 4 lattices of SU3 matrices, one for each Lorentz index.\n\n */\n\nvoid Flow::flowField(Lattice<SU3> *lattice)\n\n{\n\n /*\n\n * Performs a single flow on the lattice.\n\n */\n\n // W0 is simply just the original lattice times epsilon\n\n // Sets Z0 in temporary lattice\n\n for (unsigned int mu = 0; mu < 4; mu++) {\n\n m_tempLattice[mu] = m_S->getActionDerivative(lattice,mu);\n\n }\n\n // Sets W1 in main lattice\n\n for (unsigned int mu = 0; mu < 4; mu++) {\n\n lattice[mu] = matrixExp(m_tempLattice[mu]*(m_epsilon*0.25))*lattice[mu];\n\n }\n\n // Sets \"Z1\" in temporary lattice\n\n for (unsigned int mu = 0; mu < 4; mu++) {\n\n m_tempLattice[mu] = m_S->getActionDerivative(lattice,mu)*(m_epsilon*0.8888888888888888) - m_tempLattice[mu]*(m_epsilon*0.4722222222222222);\n\n }\n", "file_path": "GLAC/flow/flow.cpp", "rank": 4, "score": 59524.31125985529 }, { "content": " // Sets W2 in main lattice\n\n for (unsigned int mu = 0; mu < 4; mu++) {\n\n lattice[mu] = matrixExp(m_tempLattice[mu])*lattice[mu];\n\n }\n\n // Sets \"Z2\" in temporary lattice\n\n for (unsigned int mu = 0; mu < 4; mu++) {\n\n m_tempLattice[mu] = m_S->getActionDerivative(lattice,mu)*(0.75*m_epsilon) - m_tempLattice[mu];\n\n }\n\n // Sets V_{t+1} in main lattice\n\n for (unsigned int mu = 0; mu < 4; mu++) {\n\n lattice[mu] = matrixExp(m_tempLattice[mu])*lattice[mu];\n\n }\n\n}\n\n\n\nvoid Flow::setSU3ExpFunc()\n\n{\n\n /*\n\n * Sets the prefered method of exponentiation.\n\n * Does nothing if name is not recognized.\n\n * If Morningstar, do nothing as that is default.\n", "file_path": "GLAC/flow/flow.cpp", "rank": 5, "score": 59523.20967480197 }, { "content": "#include \"flow.h\"\n\n#include \"parallelization/index.h\"\n\n#include \"config/parameters.h\"\n\n\n\n/*!\n\n * \\brief Flow::Flow\n\n * \\param S sets an action.\n\n *\n\n * Sets the lattice sizes, flow epsilon, sub lattice size parameters.\n\n * Allocates a temporary lattice for the flowing procedure.\n\n * Sets a up a temporary lattice for exponentiation.\n\n * Initiates the method for the SU3 exponential function.\n\n */\n\nFlow::Flow(Action *S)\n\n{\n\n m_N = Parameters::getN();\n\n m_epsilon = Parameters::getFlowEpsilon();\n\n m_subLatticeSize = Parameters::getSubLatticeSize();\n\n m_tempLattice = new Lattice<SU3>[4];\n\n m_tempExpLattice.allocate(m_N);\n", "file_path": "GLAC/flow/flow.cpp", "rank": 6, "score": 59521.60015996852 }, { "content": " */\n\n if (Parameters::getExpFuncName() == \"taylor2\") { // ENSURE WE DONT GO OUT OF SCOPE!!\n\n m_SU3ExpFunc = new Taylor2Exp;\n\n } else if (Parameters::getExpFuncName() == \"taylor4\") {\n\n m_SU3ExpFunc = new Taylor4Exp;\n\n } else if (Parameters::getExpFuncName() == \"luscher\") {\n\n m_SU3ExpFunc = new ExpLuscher;\n\n } else if (Parameters::getExpFuncName() == \"morningstar\") {\n\n m_SU3ExpFunc = new SU3Exp;\n\n } else {\n\n printf(\"SU3 exp. func. %s not recognized\",Parameters::getExpFuncName().c_str());\n\n }\n\n}\n\n\n\ninline Lattice<SU3> Flow::matrixExp(const Lattice<SU3> &lattice)\n\n{\n\n /*\n\n * Move semantic method for exponentiating the lattice, using reference.\n\n */\n\n for (unsigned long iSite = 0; iSite < lattice.m_latticeSize; iSite++) {\n", "file_path": "GLAC/flow/flow.cpp", "rank": 7, "score": 59521.285587423605 }, { "content": " m_tempExpLattice.m_sites[iSite] = m_SU3ExpFunc->exp(lattice.m_sites[iSite]);\n\n }\n\n return m_tempExpLattice;\n\n}\n\n\n\ninline Lattice<SU3> Flow::matrixExp(Lattice<SU3> &&lattice)\n\n{\n\n /*\n\n * Move semantic method for exponentiating the lattice, using rvalue.\n\n */\n\n for (unsigned long iSite = 0; iSite < lattice.m_latticeSize; iSite++) {\n\n m_tempExpLattice.m_sites[iSite] = m_SU3ExpFunc->exp(lattice.m_sites[iSite]);\n\n }\n\n return m_tempExpLattice;\n\n}\n", "file_path": "GLAC/flow/flow.cpp", "rank": 8, "score": 59513.95759430987 }, { "content": "class Correlator\n\n{\n\nprotected:\n\n // Lattice dimension array\n\n std::vector<unsigned int> m_N;\n\n\n\n // (sub)lattice size\n\n double m_latticeSize;\n\n\n\n // Lattice spacing\n\n double m_a;\n\n\n\n // Observable name\n\n const int m_headerWidth = 20;\n\n const std::string m_observableName = \"Correlator\";\n\n const std::string m_observableNameCompact = \"correlator\";\n\n\n\n // Creates a object that store the observable\n\n ObservableStorer * m_observable = nullptr;\n\n\n", "file_path": "GLAC/observables/correlator.h", "rank": 9, "score": 59474.88603735296 }, { "content": "def getFlowPlaq(arr):\n\n\ttflow = arr[0::2] * 0.01\n\n\tplaq_flow = arr[1::2]\n", "file_path": "scripts/flowed_plaquette_plot.py", "rank": 10, "score": 51401.838667252865 }, { "content": " // Object that holds info of whether or not we are storing flow observables\n\n bool m_storeFlowObservable = false;\n\npublic:\n\n Correlator(bool storeFlowObservable);\n\n Correlator();\n\n virtual ~Correlator();\n\n virtual void calculate(Lattice<SU3> *lattice, unsigned int iObs) = 0;\n\n virtual void writeObservableToFile(const double acceptanceRatio);\n\n virtual void writeFlowObservablesToFile(const unsigned int iFlow);\n\n virtual void runStatistics();\n\n\n\n // Printers\n\n virtual void printObservable(const unsigned int iObs);\n\n virtual void printHeader();\n\n virtual void printStatistics();\n\n\n\n // Observable copyer\n\n virtual void copyObservable(const unsigned int iObs, const std::vector<double> &obs);\n\n virtual std::vector<double> getObservablesVector(const unsigned int iObs);\n\n\n", "file_path": "GLAC/observables/correlator.h", "rank": 11, "score": 50575.27555160421 }, { "content": " // Getters\n\n virtual double getObservable(const unsigned int iObs);\n\n virtual std::string getObservableName() { return m_observableName; }\n\n virtual int getHeaderWidth() { return m_headerWidth; }\n\n\n\n // Setters\n\n virtual void reset();\n\n virtual void initializeObservableStorer(const bool storeFlowObservable);\n\n};\n\n\n\n\n\n#endif // CORRELATOR_H\n", "file_path": "GLAC/observables/correlator.h", "rank": 12, "score": 50569.8580168029 }, { "content": "/*!\n\n * \\class Correlator\n\n *\n\n * \\brief base class for observables.\n\n *\n\n * \\todo Rename to observable, as correlator is a bit misleading.\n\n *\n\n * \\author Mathias M. Vege\n\n * \\version 1.0\n\n * \\date 2017-2019\n\n * \\copyright MIT Licence\n\n */\n\n#ifndef CORRELATOR_H\n\n#define CORRELATOR_H\n\n\n\n#include \"math/lattice.h\"\n\n#include \"tools/observablestorer.h\"\n\n#include <vector>\n\n\n", "file_path": "GLAC/observables/correlator.h", "rank": 13, "score": 50555.42736092352 }, { "content": "{\n\n printf(\"%-*s\",m_headerWidth,m_observableName.c_str());\n\n}\n\n\n\n/*!\n\n * \\brief Correlator::getObservable\n\n * \\param iObs number of the observable to print.\n\n * \\return the observable for given iObs.\n\n */\n\ndouble Correlator::getObservable(const unsigned int iObs)\n\n{\n\n return (*m_observable)[iObs];\n\n}\n\n\n\n/*!\n\n * \\brief Correlator::printObservable prints the observable for the output.\n\n * \\param iObs\n\n */\n\nvoid Correlator::printObservable(const unsigned int iObs)\n\n{\n", "file_path": "GLAC/observables/correlator.cpp", "rank": 14, "score": 48928.95952536464 }, { "content": " /*\n\n * Used before writeObservableToFile()\n\n */\n\n m_observable->gatherResults();\n\n m_observable->runStatistics();\n\n}\n\n\n\n/*!\n\n * \\brief Correlator::writeFlowObservablesToFile\n\n * \\param iFlow\n\n *\n\n * Gathers results and performs statistics in the ObservableStorer object.\n\n */\n\nvoid Correlator::writeFlowObservablesToFile(const unsigned int iFlow)\n\n{\n\n m_observable->gatherResults();\n\n m_observable->writeFlowObservableToFile(iFlow);\n\n}\n\n\n\n/*!\n", "file_path": "GLAC/observables/correlator.cpp", "rank": 15, "score": 48928.313749236404 }, { "content": " * \\brief Correlator::writeObservableToFile calls the ObservableStorer for writing observable to file.\n\n * \\param acceptanceRatio\n\n */\n\nvoid Correlator::writeObservableToFile(const double acceptanceRatio)\n\n{\n\n m_observable->writeObservableToFile(acceptanceRatio);\n\n}\n\n\n\n/*!\n\n * \\brief Correlator::initializeObservableStorer initializes ObservableStorer.\n\n * \\param storeFlowObservable\n\n */\n\nvoid Correlator::initializeObservableStorer(const bool storeFlowObservable)\n\n{\n\n m_storeFlowObservable = storeFlowObservable;\n\n if (m_storeFlowObservable)\n\n {\n\n m_observable = new ObservableStorer(Parameters::getNFlows() + 1); // +1 as we are storing the initial value at t=0 as well.\n\n }\n\n else\n", "file_path": "GLAC/observables/correlator.cpp", "rank": 16, "score": 48928.02056939206 }, { "content": "/*!\n\n * \\brief Correlator::copyObservable copies the observable if has already been calculated at zero flow time.\n\n * \\param iObs observable number.\n\n * \\param obs vector containing observable information. Is a vector in case it consists of multiple values(e.g. topc in Euclidean time).\n\n */\n\nvoid Correlator::copyObservable(const unsigned int iObs, const std::vector<double> &obs)\n\n{\n\n /*\n\n * Used when we already have calculated the observable in the\n\n */\n\n (*m_observable)[iObs] = obs[0];\n\n}\n\n\n\n/*!\n\n * \\brief Correlator::getObservablesVector\n\n * \\param iObs\n\n * \\return a vector containing the observables at given iObs.\n\n */\n\nstd::vector<double> Correlator::getObservablesVector(const unsigned int iObs)\n\n{\n", "file_path": "GLAC/observables/correlator.cpp", "rank": 17, "score": 48926.421814502944 }, { "content": "#include \"correlator.h\"\n\n#include \"parallelization/parallel.h\"\n\n#include \"config/parameters.h\"\n\n\n\n/*!\n\n * \\brief Correlator::Correlator\n\n * \\param storeFlowObservable specifies if one is to sample (and store) a flow observable when initialized.\n\n */\n\nCorrelator::Correlator(bool storeFlowObservable)\n\n{\n\n initializeObservableStorer(storeFlowObservable);\n\n // Initiates the lattice dimensions\n\n m_a = Parameters::getLatticeSpacing();\n\n m_N = Parameters::getN();\n\n m_latticeSize = double(Parameters::getSubLatticeSize());\n\n}\n\n\n\n/*!\n\n * \\brief Correlator::Correlator\n\n *\n", "file_path": "GLAC/observables/correlator.cpp", "rank": 18, "score": 48926.28487205994 }, { "content": " if (Parallel::Communicator::getProcessRank() == 0)\n\n {\n\n if (!m_storeFlowObservable)\n\n {\n\n printf(\"%-*.8f\",m_headerWidth,(*m_observable)[iObs]);\n\n }\n\n else\n\n {\n\n printf(\"\\n%-4d %-*.8f\",iObs,m_headerWidth,(*m_observable)[iObs]);\n\n }\n\n }\n\n}\n\n\n\n/*!\n\n * \\brief Correlator::runStatistics\n\n *\n\n * Gathers results and performs statistics in the ObservableStorer object.\n\n */\n\nvoid Correlator::runStatistics()\n\n{\n", "file_path": "GLAC/observables/correlator.cpp", "rank": 19, "score": 48924.29048254391 }, { "content": " * When no storeFlowObservable is passed, default is to store observables for the configurations.\n\n */\n\nCorrelator::Correlator()\n\n{\n\n // Initiates the lattice dimensions\n\n m_a = Parameters::getLatticeSpacing();\n\n m_N = Parameters::getN();\n\n m_latticeSize = double(Parameters::getSubLatticeSize());\n\n}\n\n\n\nCorrelator::~Correlator()\n\n{\n\n // Freeing observable storage container\n\n delete m_observable;\n\n}\n\n\n\n/*!\n\n * \\brief Correlator::printHeader prints a the observable name for output in header.\n\n */\n\nvoid Correlator::printHeader()\n", "file_path": "GLAC/observables/correlator.cpp", "rank": 20, "score": 48922.772947296005 }, { "content": " {\n\n if (Parameters::getStoreThermalizationObservables())\n\n {\n\n m_observable = new ObservableStorer(Parameters::getNCf() + Parameters::getNTherm() + 1);\n\n }\n\n else\n\n {\n\n m_observable = new ObservableStorer(Parameters::getNCf());\n\n }\n\n }\n\n}\n\n\n\n/*!\n\n * \\brief Correlator::reset resets ObservableStorer.\n\n */\n\nvoid Correlator::reset()\n\n{\n\n m_observable->reset();\n\n}\n\n\n", "file_path": "GLAC/observables/correlator.cpp", "rank": 21, "score": 48919.843761016185 }, { "content": " std::vector<double> obs(1);\n\n obs[0] = (*m_observable)[iObs];\n\n return obs;\n\n}\n\n\n\n/*!\n\n * \\brief Correlator::printStatistics prints statistics from ObservableStorer.\n\n */\n\nvoid Correlator::printStatistics()\n\n{\n\n m_observable->printStatistics();\n\n}\n", "file_path": "GLAC/observables/correlator.cpp", "rank": 22, "score": 48915.27005770894 }, { "content": "struct conjunction<B1, Bn...> : std::conditional<bool(B1::value), conjunction<Bn...>, B1>::type {};\n\n\n\ntemplate<class B> struct negation : std::integral_constant < bool, !B::value > {};\n\n\n\n// dispatch utility (taken from ranges-v3)\n\ntemplate<unsigned N> struct priority_tag : priority_tag < N - 1 > {};\n\ntemplate<> struct priority_tag<0> {};\n\n\n\n\n\n//////////////////\n\n// constructors //\n\n//////////////////\n\n\n\ntemplate<value_t> struct external_constructor;\n\n\n\ntemplate<>\n", "file_path": "GLAC/lib/json.hpp", "rank": 23, "score": 48630.48699691755 }, { "content": "class Plaquette : public Correlator\n\n{\n\nprivate:\n\n double m_multiplicationFactor;\n\n double m_tempObservable = 0;\n\n // Initializes temporary sample storer\n\n Lattice<SU3> m_temp;\n\n // Observable names, human readability and for io\n\n const std::string m_observableName = \"Plaquette\";\n\n const std::string m_observableNameCompact = \"plaq\";\n\npublic:\n\n Plaquette(const bool storeFlowObservable);\n\n ~Plaquette();\n\n void calculate(Lattice<SU3> *lattice, const unsigned int iObs);\n\n // Statistics getter\n\n void runStatistics();\n\n // Setters\n\n void setLatticeSize(const unsigned long int latticeSize);\n\n // Getters\n\n std::string getObservableName() { return m_observableName; }\n\n // Printers\n\n void printObservable(const unsigned int iObs);\n\n void printHeader();\n\n};\n\n\n\n#endif // PLAQUETTE_H\n", "file_path": "GLAC/observables/plaquette.h", "rank": 24, "score": 45927.755168946176 }, { "content": "class SuperSampler : public Correlator\n\n{\n\nprivate:\n\n const std::string m_observableName = \"Weinberg operator\";\n\n const std::string m_observableNameCompact = \"weinberg\";\n\n\n\n int mu, rho, sigma;\n\n double m_plaqMultiplicationFactor, m_topcMultiplicationFactor, m_energyMultiplicationFactor, m_wMultiplicationFactor;\n\n double m_topCharge, m_energy, m_plaquette, m_weinberg;\n\n Lattice <double> m_tempDiag;\n\n Lattice<SU3> m_fieldTensorG[6];\n\n Lattice<SU3> m_clov1, m_clov2, m_U2Temp, m_U3Temp, m_temp;\n\n\n\n // Container for the spatial observables\n\n std::vector<double> m_topctGatherVector;\n\n std::vector<double> m_wtGatherVector;\n\n std::vector<double> m_tempEucl;\n\n\n\n // Creates a object that store the observable\n\n ObservableStorer * m_plaqObservable = nullptr;\n", "file_path": "GLAC/observables/supersampler.h", "rank": 25, "score": 44571.0070516379 }, { "content": "class MasterSampler : public Correlator\n\n{\n\nprivate:\n\n int mu, rho, sigma;\n\n double m_plaqMultiplicationFactor, m_topcMultiplicationFactor, m_energyMultiplicationFactor;\n\n double m_topCharge, m_energy, m_plaquette;\n\n Lattice <double> m_tempDiag;\n\n Lattice<SU3> m_clov1, m_clov2, m_U2Temp, m_U3Temp, m_temp;\n\n\n\n // Creates a object that store the observable\n\n ObservableStorer * m_plaqObservable = nullptr;\n\n ObservableStorer * m_topcObservable = nullptr;\n\n ObservableStorer * m_energyObservable = nullptr;\n\npublic:\n\n MasterSampler(const bool flow);\n\n ~MasterSampler();\n\n void calculate(Lattice<SU3> * lattice, const unsigned int iObs);\n\n void initializeObservableStorer(const bool storeFlowObservable);\n\n\n\n void writeObservableToFile(const double acceptanceRatio);\n", "file_path": "GLAC/observables/mastersampler.h", "rank": 26, "score": 44571.0070516379 }, { "content": "class EnergyDensity : public Correlator\n\n{\n\nprivate:\n\n const std::string m_observableName = \"Energy density\";\n\n const std::string m_observableNameCompact = \"energy\";\n\n\n\n // Indexes for retrieving the clovers\n\n int mu = 0, rho, sigma;\n\n double m_energyDensity;\n\n double m_multiplicationFactor;\n\n Lattice <double> m_tempDiag;\n\n Lattice<SU3> m_clov1, m_clov2, m_U2Temp, m_U3Temp, m_temp;\n\npublic:\n\n EnergyDensity(const bool storeFlowObservable);\n\n ~EnergyDensity();\n\n void calculate(Lattice<SU3> *lattice, const unsigned int iObs);\n\n\n\n // Printers\n\n void printStatistics();\n\n // Getters\n\n std::string getObservableName() { return m_observableName; }\n\n void runStatistics();\n\n};\n\n\n\n#endif // ENERGYDENSITY_H\n", "file_path": "GLAC/observables/energydensity.h", "rank": 27, "score": 44571.0070516379 }, { "content": "class TopologicalCharge : public Correlator\n\n{\n\nprivate:\n\n const std::string m_observableName = \"Topological Charge\";\n\n const std::string m_observableNameCompact = \"topc\";\n\n\n\n // Indexes for retrieving the clovers\n\n int mu = 0, rho, sigma;\n\n double m_topCharge;\n\n double m_multiplicationFactor;\n\n\n\n Lattice <double> m_tempDiag;\n\n Lattice<SU3> m_clov1, m_clov2, m_U2Temp, m_U3Temp, m_temp;\n\npublic:\n\n TopologicalCharge(const bool storeFlowObservable);\n\n ~TopologicalCharge();\n\n\n\n void calculate(Lattice<SU3> *lattice, const unsigned int iObs);\n\n\n\n // Stats\n\n void runStatistics();\n\n // Printers\n\n void printStatistics();\n\n // Getters\n\n std::string getObservableName() { return m_observableName; }\n\n};\n\n\n\n#endif // TOPOLOGICALCHARGE_H\n", "file_path": "GLAC/observables/topologicalcharge.h", "rank": 28, "score": 44571.0070516379 }, { "content": " class NumberFloatType = double,\n\n template<typename U> class AllocatorType = std::allocator,\n\n template<typename T, typename SFINAE = void> class JSONSerializer = adl_serializer\n\n >\n", "file_path": "GLAC/lib/json.hpp", "rank": 29, "score": 43347.6867250829 }, { "content": "struct external_constructor<value_t::number_unsigned>\n\n{\n\n template<typename BasicJsonType>\n\n static void construct(BasicJsonType& j, typename BasicJsonType::number_unsigned_t val) noexcept\n\n {\n\n j.m_type = value_t::number_unsigned;\n\n j.m_value = val;\n\n j.assert_invariant();\n\n }\n\n};\n\n\n\ntemplate<>\n", "file_path": "GLAC/lib/json.hpp", "rank": 30, "score": 42135.43563567462 }, { "content": " class NumberUnsignedType = std::uint64_t,\n", "file_path": "GLAC/lib/json.hpp", "rank": 31, "score": 42135.43563567462 }, { "content": "import matplotlib.pyplot as plt, numpy as np\n\n\n\nplaq_morningstar_ubuntu = np.array(\"\"\"\n\n0 0.61401745 \n\n1 0.62927918 \n\n2 0.64409064 \n\n3 0.65844519 \n\n4 0.67233862 \n\n5 0.68576903 \n\n6 0.69873661 \n\n7 0.71124351 \n\n8 0.72329362 \n\n9 0.73489239 \n\n10 0.74604666 \n\n11 0.75676448 \n\n12 0.76705495 \n\n13 0.77692801 \n\n14 0.78639435 \n\n15 0.79546523 \n\n16 0.80415238 \n\n17 0.81246785 \n\n18 0.82042391 \n\n19 0.82803298 \n\n20 0.83530752 \n\n21 0.84225997 \n\n22 0.84890267 \n\n23 0.85524782 \n\n24 0.86130743 \n\n25 0.86709327 \n\n26 0.87261685 \n\n27 0.87788938 \n\n28 0.88292176 \n\n29 0.88772457 \n\n30 0.89230805 \n\n31 0.89668206 \n\n32 0.90085616 \n\n33 0.90483950 \n\n34 0.90864091 \n\n35 0.91226887 \n\n36 0.91573149 \n\n37 0.91903657 \n\n38 0.92219154 \n\n39 0.92520354 \n\n40 0.92807937 \n\n41 0.93082553 \n\n42 0.93344823 \n\n43 0.93595338 \n\n44 0.93834663 \n\n45 0.94063334 \n\n46 0.94281864 \n\n47 0.94490740 \n\n48 0.94690426 \n\n49 0.94881362 \n\n50 0.95063970 \n\n51 0.95238648 \n\n52 0.95405775 \n\n53 0.95565713 \n\n54 0.95718804 \n\n55 0.95865374 \n\n56 0.96005734 \n\n57 0.96140177 \n\n58 0.96268983 \n\n59 0.96392419 \n\n60 0.96510736 \n\n61 0.96624174 \n\n62 0.96732962 \n\n63 0.96837315 \n\n64 0.96937441 \n\n65 0.97033534 \n\n66 0.97125780 \n\n67 0.97214355 \n\n68 0.97299429 \n\n69 0.97381159 \n\n70 0.97459698 \n\n71 0.97535190 \n\n72 0.97607772 \n\n73 0.97677575 \n\n74 0.97744721 \n\n75 0.97809330 \n\n76 0.97871513 \n\n77 0.97931378 \n\n78 0.97989024 \n\n79 0.98044550 \n\n80 0.98098048 \n\n81 0.98149603 \n\n82 0.98199301 \n\n83 0.98247220 \n\n84 0.98293437 \n\n85 0.98338022 \n\n86 0.98381045 \n\n87 0.98422571 \n\n88 0.98462662 \n\n89 0.98501378 \n\n90 0.98538776 \n\n91 0.98574909 \n\n92 0.98609828 \n\n93 0.98643585 \n\n94 0.98676224 \n\n95 0.98707791 \n\n96 0.98738328 \n\n97 0.98767877 \n\n98 0.98796476 \n\n99 0.98824163\"\"\".split(),dtype=float)\n\n\n\nplaq_morningstar_mac = np.array(\"\"\"\n\n0 0.61049840 \n\n1 0.62569628 \n\n2 0.64044857 \n\n3 0.65474864 \n\n4 0.66859227 \n\n5 0.68197751 \n\n6 0.69490449 \n\n7 0.70737526 \n\n8 0.71939361 \n\n9 0.73096487 \n\n10 0.74209574 \n\n11 0.75279414 \n\n12 0.76306898 \n\n13 0.77293008 \n\n14 0.78238795 \n\n15 0.79145369 \n\n16 0.80013886 \n\n17 0.80845533 \n\n18 0.81641522 \n\n19 0.82403079 \n\n20 0.83131432 \n\n21 0.83827811 \n\n22 0.84493434 \n\n23 0.85129505 \n\n24 0.85737212 \n\n25 0.86317717 \n\n26 0.86872158 \n\n27 0.87401642 \n\n28 0.87907249 \n\n29 0.88390022 \n\n30 0.88850975 \n\n31 0.89291083 \n\n32 0.89711292 \n\n33 0.90112507 \n\n34 0.90495602 \n\n35 0.90861415 \n\n36 0.91210751 \n\n37 0.91544379 \n\n38 0.91863039 \n\n39 0.92167434 \n\n40 0.92458240 \n\n41 0.92736100 \n\n42 0.93001630 \n\n43 0.93255417 \n\n44 0.93498018 \n\n45 0.93729968 \n\n46 0.93951774 \n\n47 0.94163920 \n\n48 0.94366865 \n\n49 0.94561049 \n\n50 0.94746888 \n\n51 0.94924778 \n\n52 0.95095098 \n\n53 0.95258204 \n\n54 0.95414440 \n\n55 0.95564128 \n\n56 0.95707577 \n\n57 0.95845080 \n\n58 0.95976915 \n\n59 0.96103347 \n\n60 0.96224629 \n\n61 0.96340998 \n\n62 0.96452682 \n\n63 0.96559897 \n\n64 0.96662848 \n\n65 0.96761731 \n\n66 0.96856731 \n\n67 0.96948024 \n\n68 0.97035779 \n\n69 0.97120154 \n\n70 0.97201301 \n\n71 0.97279364 \n\n72 0.97354481 \n\n73 0.97426782 \n\n74 0.97496390 \n\n75 0.97563425 \n\n76 0.97627999 \n\n77 0.97690217 \n\n78 0.97750183 \n\n79 0.97807993 \n\n80 0.97863740 \n\n81 0.97917510 \n\n82 0.97969389 \n\n83 0.98019456 \n\n84 0.98067786 \n\n85 0.98114453 \n\n86 0.98159524 \n\n87 0.98203067 \n\n88 0.98245144 \n\n89 0.98285814 \n\n90 0.98325135 \n\n91 0.98363161 \n\n92 0.98399945 \n\n93 0.98435535 \n\n94 0.98469980 \n\n95 0.98503324 \n\n96 0.98535610 \n\n97 0.98566881 \n\n98 0.98597174 \n\n99 0.98626529\"\"\".split(),dtype=float)\n\n\n\nplaq_luscher_mac = np.array(\"\"\"\n\n0 0.61049839 \n\n1 0.62569626 \n\n2 0.64044854 \n\n3 0.65474860 \n\n4 0.66859222 \n\n5 0.68197746 \n\n6 0.69490443 \n\n7 0.70737520 \n\n8 0.71939354 \n\n9 0.73096480 \n\n10 0.74209567 \n\n11 0.75279406 \n\n12 0.76306891 \n\n13 0.77293000 \n\n14 0.78238787 \n\n15 0.79145362 \n\n16 0.80013878 \n\n17 0.80845525 \n\n18 0.81641514 \n\n19 0.82403071 \n\n20 0.83131425 \n\n21 0.83827803 \n\n22 0.84493426 \n\n23 0.85129498 \n\n24 0.85737205 \n\n25 0.86317710 \n\n26 0.86872151 \n\n27 0.87401636 \n\n28 0.87907242 \n\n29 0.88390016 \n\n30 0.88850969 \n\n31 0.89291078 \n\n32 0.89711286 \n\n33 0.90112501 \n\n34 0.90495597 \n\n35 0.90861410 \n\n36 0.91210746 \n\n37 0.91544375 \n\n38 0.91863034 \n\n39 0.92167429 \n\n40 0.92458235 \n\n41 0.92736096 \n\n42 0.93001626 \n\n43 0.93255413 \n\n44 0.93498014 \n\n45 0.93729964 \n\n46 0.93951770 \n\n47 0.94163916 \n\n48 0.94366862 \n\n49 0.94561046 \n\n50 0.94746885 \n\n51 0.94924775 \n\n52 0.95095095 \n\n53 0.95258202 \n\n54 0.95414437 \n\n55 0.95564125 \n\n56 0.95707574 \n\n57 0.95845077 \n\n58 0.95976913 \n\n59 0.96103345 \n\n60 0.96224627 \n\n61 0.96340996 \n\n62 0.96452680 \n\n63 0.96559895 \n\n64 0.96662846 \n\n65 0.96761729 \n\n66 0.96856729 \n\n67 0.96948023 \n\n68 0.97035777 \n\n69 0.97120152 \n\n70 0.97201299 \n\n71 0.97279363 \n\n72 0.97354480 \n\n73 0.97426780 \n\n74 0.97496389 \n\n75 0.97563424 \n\n76 0.97627997 \n\n77 0.97690216 \n\n78 0.97750182 \n\n79 0.97807992 \n\n80 0.97863739 \n\n81 0.97917509 \n\n82 0.97969388 \n\n83 0.98019455 \n\n84 0.98067785 \n\n85 0.98114452 \n\n86 0.98159524 \n\n87 0.98203066 \n\n88 0.98245143 \n\n89 0.98285813 \n\n90 0.98325134 \n\n91 0.98363161 \n\n92 0.98399944 \n\n93 0.98435535 \n\n94 0.98469979 \n\n95 0.98503323 \n\n96 0.98535610 \n\n97 0.98566880 \n\n98 0.98597174 \n\n99 0.98626529\"\"\".split(),dtype=float)\n\n\n\n\n\nplaq_taylor_mac = np.array(\"\"\"\n\n0 0.61049847 \n\n1 0.62569641 \n\n2 0.64044875 \n\n3 0.65474887 \n\n4 0.66859255 \n\n5 0.68197783 \n\n6 0.69490485 \n\n7 0.70737565 \n\n8 0.71939403 \n\n9 0.73096531 \n\n10 0.74209620 \n\n11 0.75279461 \n\n12 0.76306947 \n\n13 0.77293058 \n\n14 0.78238846 \n\n15 0.79145420 \n\n16 0.80013937 \n\n17 0.80845584 \n\n18 0.81641573 \n\n19 0.82403129 \n\n20 0.83131482 \n\n21 0.83827860 \n\n22 0.84493482 \n\n23 0.85129553 \n\n24 0.85737258 \n\n25 0.86317762 \n\n26 0.86872202 \n\n27 0.87401685 \n\n28 0.87907291 \n\n29 0.88390063 \n\n30 0.88851014 \n\n31 0.89291122 \n\n32 0.89711329 \n\n33 0.90112543 \n\n34 0.90495637 \n\n35 0.90861449 \n\n36 0.91210784 \n\n37 0.91544411 \n\n38 0.91863069 \n\n39 0.92167464 \n\n40 0.92458268 \n\n41 0.92736128 \n\n42 0.93001657 \n\n43 0.93255442 \n\n44 0.93498043 \n\n45 0.93729992 \n\n46 0.93951797 \n\n47 0.94163942 \n\n48 0.94366887 \n\n49 0.94561070 \n\n50 0.94746908 \n\n51 0.94924798 \n\n52 0.95095116 \n\n53 0.95258222 \n\n54 0.95414457 \n\n55 0.95564144 \n\n56 0.95707593 \n\n57 0.95845095 \n\n58 0.95976930 \n\n59 0.96103362 \n\n60 0.96224643 \n\n61 0.96341011 \n\n62 0.96452695 \n\n63 0.96559909 \n\n64 0.96662860 \n\n65 0.96761743 \n\n66 0.96856742 \n\n67 0.96948035 \n\n68 0.97035789 \n\n69 0.97120164 \n\n70 0.97201311 \n\n71 0.97279374 \n\n72 0.97354490 \n\n73 0.97426791 \n\n74 0.97496399 \n\n75 0.97563434 \n\n76 0.97628007 \n\n77 0.97690225 \n\n78 0.97750191 \n\n79 0.97808000 \n\n80 0.97863747 \n\n81 0.97917517 \n\n82 0.97969396 \n\n83 0.98019462 \n\n84 0.98067792 \n\n85 0.98114459 \n\n86 0.98159530 \n\n87 0.98203073 \n\n88 0.98245149 \n\n89 0.98285820 \n\n90 0.98325140 \n\n91 0.98363167 \n\n92 0.98399950 \n\n93 0.98435540 \n\n94 0.98469984 \n\n95 0.98503328 \n\n96 0.98535615 \n\n97 0.98566885 \n\n98 0.98597179 \n\n99 0.98626533\"\"\".split(),dtype=float)\n\n\n\nplaq_taylor4_mac = np.array(\"\"\"\n\n0 0.61049840 \n\n1 0.62569628 \n\n2 0.64044857 \n\n3 0.65474864 \n\n4 0.66859227 \n\n5 0.68197751 \n\n6 0.69490449 \n\n7 0.70737526 \n\n8 0.71939361 \n\n9 0.73096487 \n\n10 0.74209574 \n\n11 0.75279414 \n\n12 0.76306898 \n\n13 0.77293008 \n\n14 0.78238795 \n\n15 0.79145369 \n\n16 0.80013886 \n\n17 0.80845533 \n\n18 0.81641522 \n\n19 0.82403079 \n\n20 0.83131432 \n\n21 0.83827811 \n\n22 0.84493434 \n\n23 0.85129505 \n\n24 0.85737212 \n\n25 0.86317717 \n\n26 0.86872158 \n\n27 0.87401642 \n\n28 0.87907249 \n\n29 0.88390022 \n\n30 0.88850975 \n\n31 0.89291083 \n\n32 0.89711292 \n\n33 0.90112507 \n\n34 0.90495602 \n\n35 0.90861415 \n\n36 0.91210751 \n\n37 0.91544379 \n\n38 0.91863039 \n\n39 0.92167434 \n\n40 0.92458240 \n\n41 0.92736100 \n\n42 0.93001630 \n\n43 0.93255417 \n\n44 0.93498018 \n\n45 0.93729968 \n\n46 0.93951774 \n\n47 0.94163920 \n\n48 0.94366865 \n\n49 0.94561049 \n\n50 0.94746888 \n\n51 0.94924778 \n\n52 0.95095098 \n\n53 0.95258204 \n\n54 0.95414440 \n\n55 0.95564128 \n\n56 0.95707577 \n\n57 0.95845080 \n\n58 0.95976915 \n\n59 0.96103347 \n\n60 0.96224629 \n\n61 0.96340998 \n\n62 0.96452682 \n\n63 0.96559897 \n\n64 0.96662848 \n\n65 0.96761731 \n\n66 0.96856731 \n\n67 0.96948024 \n\n68 0.97035779 \n\n69 0.97120154 \n\n70 0.97201301 \n\n71 0.97279364 \n\n72 0.97354481 \n\n73 0.97426782 \n\n74 0.97496390 \n\n75 0.97563425 \n\n76 0.97627999 \n\n77 0.97690217 \n\n78 0.97750183 \n\n79 0.97807993 \n\n80 0.97863740 \n\n81 0.97917510 \n\n82 0.97969389 \n\n83 0.98019456 \n\n84 0.98067786 \n\n85 0.98114453 \n\n86 0.98159524 \n\n87 0.98203067 \n\n88 0.98245144 \n\n89 0.98285814 \n\n90 0.98325135 \n\n91 0.98363161 \n\n92 0.98399945 \n\n93 0.98435535 \n\n94 0.98469980 \n\n95 0.98503324 \n\n96 0.98535610 \n\n97 0.98566881 \n\n98 0.98597174 \n\n99 0.98626529\"\"\".split(),dtype=float)\n\n\n\n\n\ndef getFlowPlaq(arr):\n\n\ttflow = arr[0::2] * 0.01\n\n\tplaq_flow = arr[1::2]\n\n\treturn tflow, plaq_flow\n\n\n\nfig1 = plt.figure(dpi=300)\n\n\n\n# Morningstar plot\n\nax1 = fig1.add_subplot(311)\n\nt_morningstar, pf_morningstar = getFlowPlaq(plaq_morningstar_mac)\n\nax1.plot(t_morningstar, pf_morningstar,\"-\", label=\"Flowed Plaquette\")\n\nax1.grid(True)\n\n# ax.set_xlabel(r\"Flow time $\\tau$\")\n\nax1.set_ylabel(r\"$P_{Morningstar}$\")\n\nax1.set_title(\"Flowed plaquette value with different SU3 exponentiating methods\")\n\nax1.tick_params(axis='x',which='major',labelsize=8)\n\n\n\n# Luscher plot\n\nax2 = fig1.add_subplot(312)\n\nt_luscher, pf_luscher = getFlowPlaq(plaq_luscher_mac)\n\nax2.plot(t_luscher, pf_luscher,\"-\", label=\"Flowed Plaquette\")\n\nax2.grid(True)\n\nax2.set_ylabel(r\"$P_{Lushcer}$\")\n\nax2.tick_params(axis='x',which='major',labelsize=8)\n\n\n\n# Taylor plot\n\nax3 = fig1.add_subplot(313)\n\nt_taylor, pf_taylor = getFlowPlaq(plaq_taylor4_mac)\n\nax3.plot(t_taylor, pf_luscher,\"-\", label=\"Flowed Plaquette\")\n\nax3.grid(True)\n\nax3.set_ylabel(r\"$P_{Taylor}$\")\n\nax3.tick_params(axis='x',which='major',labelsize=8)\n\nfig1.savefig(\"../figures/plaquette_flow.png\")\n\n\n\n#### Differences ####\n\nfig2 = plt.figure(dpi=300)\n\nax4 = fig2.add_subplot(111)\n\npf_diff1 = np.absolute(pf_morningstar - pf_luscher)\n\npf_diff2 = np.absolute(pf_morningstar - pf_taylor)\n\npf_diff3 = np.absolute(pf_luscher - pf_taylor)\n\n\n\n# ax4.plot(t_luscher,pf_diff1,label=r\"$|P_{Morningstar} - P_{Luscher}|$\")\n\nax4.plot(t_luscher,pf_diff2,label=r\"$|P_{Morningstar} - P_{Taylor}|$\")\n\nax4.plot(t_luscher,pf_diff3,'--',label=r\"$|P_{Luscher} - P_{Taylor}|$\")\n\nax4.set_title(r\"Differences in $SU(3)$ exponentiation methods\")\n\nax4.set_yscale(\"log\",nonposy='clip')\n\nax4.set_ylabel(r\"$\\Delta P$\")\n\nax4.tick_params(axis='y',which='minor',labelsize=8)\n\nax4.tick_params(axis='y',which='major',labelsize=8)\n\nax4.set_xlabel(r\"Flow time $\\tau$\")\n\nax4.legend()\n\nfig2.savefig(\"../figures/exponentiation_differences.png\")\n\n\n\n# ax5 = fig2.add_subplot(312)\n\n# ax5.set_yscale(\"log\",nonposy='clip')\n\n# ax5.set_ylabel(r\"$\\Delta P$\")\n\n# ax5.tick_params(axis='y',which='minor',labelsize=8)\n\n# ax5.tick_params(axis='y',which='major',labelsize=8)\n\n# ax5.legend()\n\n\n\n\n\n# ax5 = fig2.add_subplot(312)\n\n# ax5.set_yscale(\"log\",nonposy='clip')\n\n# ax5.tick_params(axis='y',which='minor',labelsize=8)\n\n# ax5.tick_params(axis='y',which='major',labelsize=8)\n\n# ax5.legend()\n", "file_path": "scripts/flowed_plaquette_plot.py", "rank": 32, "score": 42107.06144185775 }, { "content": "class LatticeActionChargeDensity : public Correlator\n\n{\n\nprivate:\n\n int m_samplingFrequency = 25;\n\n int mu, rho, sigma;\n\n double m_plaqMultiplicationFactor, m_topcMultiplicationFactor, m_energyMultiplicationFactor;\n\n double m_plaquette;\n\n Lattice <double> m_tempDiag, m_topCharge, m_energy;\n\n Lattice<SU3> m_clov1, m_clov2, m_U2Temp, m_U3Temp, m_temp;\n\n\n\n // Creates a object that store the observable\n\n ObservableStorer * m_plaqObservable = nullptr;\n\n ObservableStorer * m_topcObservable = nullptr;\n\n ObservableStorer * m_energyObservable = nullptr;\n\npublic:\n\n LatticeActionChargeDensity(const bool flow);\n\n ~LatticeActionChargeDensity();\n\n void calculate(Lattice<SU3> * lattice, const unsigned int iObs);\n\n void initializeObservableStorer(const bool storeFlowObservable);\n\n\n", "file_path": "GLAC/observables/latticeactionchargedensity.h", "rank": 33, "score": 42084.57308216094 }, { "content": "class MasterSamplerTopcXYZ : public Correlator\n\n{\n\nprivate:\n\n int mu, rho, sigma;\n\n double m_plaqMultiplicationFactor, m_topcMultiplicationFactor, m_energyMultiplicationFactor;\n\n double m_topCharge, m_energy, m_plaquette;\n\n Lattice <double> m_tempDiag;\n\n Lattice<SU3> m_clov1, m_clov2, m_U2Temp, m_U3Temp, m_temp;\n\n\n\n // Container for the topc xyz observable\n\n std::vector<double> m_topctGatherVector;//m_tempTopctArray;\n\n std::vector<double> m_tempTopct;\n\n\n\n // Creates a object that store the observable\n\n ObservableStorer * m_plaqObservable = nullptr;\n\n ObservableStorer * m_topcObservable = nullptr;\n\n ObservableStorer * m_energyObservable = nullptr;\n\n ObservableStorer * m_topctObservable = nullptr;\n\npublic:\n\n MasterSamplerTopcXYZ(const bool flow);\n", "file_path": "GLAC/observables/mastersamplertopcxyz.h", "rank": 34, "score": 42084.57308216094 }, { "content": "\tdef _get_flow_files(self, obs_folder):\n\n\t\t\"\"\"\n\n\t\tFunction for populating a data dicitonary for a given observable folder.\n\n\t\t\"\"\"\n\n\t\tdata_dict = {}\n\n\n\n\t\t# Goes through flow observables in observable folder\n\n\t\tfor flow_obs_file in sorted(os.listdir(obs_folder)):\n\n\t\t\tflow_obs_file_path = os.path.join(obs_folder, flow_obs_file)\n\n\t\t\t\n\n\t\t\t# Gets data array\n\n\t\t\traw_data = np.fromfile(flow_obs_file_path)\n\n\n\n\t\t\tif self.verbose:\n\n\t\t\t\tprint \"Retrieved file %s\" % flow_obs_file_path\n\n\n\n\t\t\t# Gets the flow time\n\n\t\t\tflow_time = self._get_cfg_num_from_file(flow_obs_file)\n\n\n\n\t\t\t# Converts data array to data field, and sets it in the dictionary\n\n\t\t\tdata_dict[flow_time] = self._convert_to_field(raw_data) \n\n\n", "file_path": "scripts/field_visualizer.py", "rank": 35, "score": 39882.19698573675 }, { "content": "def print_flow_time_estimates(beta, tot_gen_time, time_per_generation, tot_flow_time, time_per_flow_time, scaling=1.0, config_number_scaling_factor=1.0):\n\n\tmsg = \"\"\"BETA={0:<g}:\n\n Total config generation time: {1:<.0f} seconds/{2:<.1f} minutes/{3:<.2f} hours\n\n Time per configuration: {4:<.4f} minutes\n\n Total flow time: \t\t\t\t{5:<.0f} seconds/{6:<.1f} minutes/{7:<.2f} hours\n\n Time per flow: \t\t\t\t{8:<.4f} minutes\"\"\".format(\n\n\t\tbeta,\n\n\t\ttot_gen_time * scaling * config_number_scaling_factor,\n\n\t\ttot_gen_time/60.0 * scaling * config_number_scaling_factor,\n\n\t\ttot_gen_time/3600.0 * scaling * config_number_scaling_factor,\n\n\t\ttime_per_generation/60.0 * scaling,\n\n\t\ttot_flow_time * scaling * config_number_scaling_factor,\n\n\t\ttot_flow_time/60.0 * scaling * config_number_scaling_factor,\n\n\t\ttot_flow_time/3600.0 * scaling * config_number_scaling_factor,\n\n\t\ttime_per_flow_time/60.0 * scaling)\n", "file_path": "scripts/time_estimates.py", "rank": 36, "score": 38855.663875663085 }, { "content": "#include \"plaquette.h\"\n\n#include \"math/functions.h\"\n\n#include \"parallelization/parallel.h\"\n\n#include \"config/parameters.h\"\n\n#include <vector>\n\n#include <cmath>\n\n\n\nPlaquette::Plaquette(const bool storeFlowObservable) : Correlator(storeFlowObservable)\n\n{\n\n m_observable->setObservableName(m_observableNameCompact);\n\n m_observable->setNormalizeObservableByProcessor(true);\n\n setLatticeSize(Parameters::getSubLatticeSize());\n\n}\n\n\n\nPlaquette::~Plaquette()\n\n{\n\n}\n\n\n\nvoid Plaquette::setLatticeSize(const unsigned long latticeSize)\n\n{\n", "file_path": "GLAC/observables/plaquette.cpp", "rank": 37, "score": 29.011990725137093 }, { "content": " }\n\n }\n\n\n\n if (m_processRank == 0) {\n\n printf(\"\\nFlow test improvement for (Wilson Gauge Action) / (Wilson explicit Action) = %8.4f\\n\", timerWilsonGauge/timerWilsonExplicit);\n\n }\n\n\n\n delete [] L;\n\n}\n\n\n\nvoid PerformanceTests::testShift()\n\n{\n\n /*\n\n * Runs performance tests on the shift method.\n\n */\n\n\n\n Lattice<SU3> *L = new Lattice<SU3>[4];\n\n for (unsigned int mu = 0; mu < 4; ++mu) {\n\n L[mu].allocate(m_dim);\n\n }\n", "file_path": "GLAC/tests/performancetests.cpp", "rank": 38, "score": 27.17205618236566 }, { "content": " SuperSampler(const bool flow);\n\n ~SuperSampler();\n\n void calculate(Lattice<SU3> * lattice, const unsigned int iObs);\n\n void initializeObservableStorer(const bool storeFlowObservable);\n\n\n\n void writeObservableToFile(const double acceptanceRatio);\n\n void writeFlowObservablesToFile(const unsigned int configNumber);\n\n void reset();\n\n void runStatistics();\n\n void printHeader();\n\n void printObservable(const unsigned int iObs);\n\n void printStatistics();\n\n std::string getObservableName() { return m_observableName; }\n\n std::vector<double> getObservablesVector(const unsigned int iObs);\n\n void copyObservable(const unsigned int iObs, const std::vector<double> &obs);\n\n};\n\n\n\n#endif // SUPERSAMPLER_H\n", "file_path": "GLAC/observables/supersampler.h", "rank": 39, "score": 26.71064863240162 }, { "content": " // Deleting flow related variables - should strictly speaking not be necesseary.\n\n delete [] m_flowLattice;\n\n delete m_flowCorrelator;\n\n delete m_flow;\n\n }\n\n}\n\n\n\nvoid System::subLatticeSetup()\n\n{\n\n /*\n\n * Sets up the sub-lattices.\n\n */\n\n Parallel::Communicator::initializeSubLattice();\n\n m_N = Parameters::getN();\n\n m_subLatticeSize = Parameters::getSubLatticeSize();\n\n\n\n // Creates/allocates (sub) lattice\n\n m_lattice = new Lattice<SU3>[4];\n\n for (int mu = 0; mu < 4; mu++) {\n\n m_lattice[mu].allocate(m_N);\n", "file_path": "GLAC/system.cpp", "rank": 40, "score": 26.104590558411594 }, { "content": " steady_clock::time_point preUpdate;\n\n preUpdate = steady_clock::now();\n\n\n\n for (unsigned int itest = 0; itest < NTests; itest++) {\n\n for (unsigned int mu = 0; mu < 4; mu++) {\n\n L[mu] = shift(L[mu], FORWARDS, mu);\n\n L[mu] = shift(L[mu], BACKWARDS, mu);\n\n }\n\n }\n\n\n\n timer = duration_cast<duration<double>>(steady_clock::now() - preUpdate).count();\n\n if (m_processRank == 0) {\n\n printf(\"\\nShift test: %8.4f seconds (%8.4E seconds per flow step)\",timer,timer/double(NTests));\n\n }\n\n\n\n delete [] L;\n\n}\n\n\n\nvoid PerformanceTests::testDoubleShift()\n\n{\n", "file_path": "GLAC/tests/performancetests.cpp", "rank": 41, "score": 25.4572679011265 }, { "content": " printf(\"\\nAverage update time: %.6f sec.\", m_updateStorer/double(m_NCf*m_NCor));\n\n printf(\"\\nTotal update time for %d updates: %.6f sec.\\n\", m_NCf*m_NCor, m_updateStorer + m_updateStorerTherm);\n\n SysPrint::printLine();\n\n }\n\n\n\n m_correlator->runStatistics();\n\n m_correlator->writeObservableToFile(getAcceptanceRate()); // Runs statistics, writes to file, and prints results (if verbose is on)\n\n m_correlator->printStatistics();\n\n}\n\n\n\nvoid System::flowConfiguration(const unsigned int iConfig)\n\n{\n\n /*\n\n * Flows configuration, performs flow statistics and writes it to a file.\n\n */\n\n\n\n // After each configuration has been flowed, the values must be resetted.\n\n m_flowCorrelator->reset();\n\n\n\n // Calculates the flow observables at zeroth flow time\n", "file_path": "GLAC/system.cpp", "rank": 42, "score": 25.45004724008817 }, { "content": " ~MasterSamplerTopcXYZ();\n\n void calculate(Lattice<SU3> * lattice, const unsigned int iObs);\n\n void initializeObservableStorer(const bool storeFlowObservable);\n\n\n\n void writeObservableToFile(const double acceptanceRatio);\n\n void writeFlowObservablesToFile(const unsigned int configNumber);\n\n void reset();\n\n void runStatistics();\n\n void printHeader();\n\n void printObservable(const unsigned int iObs);\n\n void printStatistics();\n\n std::vector<double> getObservablesVector(const unsigned int iObs);\n\n void copyObservable(const unsigned int iObs, const std::vector<double> &obs);\n\n};\n\n\n\n#endif // MASTERSAMPLERTOPCXYZ_H\n", "file_path": "GLAC/observables/mastersamplertopcxyz.h", "rank": 43, "score": 25.396385987241796 }, { "content": " //// Setters ////\n\n /////////////////\n\n // Lattice related run setters\n\n static void setNSpatial(const unsigned int NSpatial);\n\n static void setNTemporal(const unsigned int NTemporal);\n\n static void setBeta(const double beta);\n\n static void setNCf(unsigned int NCf) { m_NCf = NCf; }\n\n static void setNCor(unsigned int NCor) { m_NCor = NCor; }\n\n static void setNTherm(unsigned int NTherm) { m_NTherm = NTherm; }\n\n static void setNFlows(unsigned int NFlows) { m_NFlows = NFlows; }\n\n static void setNUpdates(unsigned int NUpdates) { m_NUpdates = NUpdates; }\n\n\n\n // Data storage related setters\n\n static void setOutputFolder(std::string outputFolder) { m_outputFolder = outputFolder; }\n\n static void setInputFolder(std::string inputFolder) { m_inputFolder = inputFolder; }\n\n static void setStoreConfigurations(bool storeConfigurations) { m_storeConfigurations = storeConfigurations; }\n\n static void setStoreThermalizationObservables(bool storeThermalizationObservables) { m_storeThermalizationObservables = storeThermalizationObservables; }\n\n\n\n // Human readable output related setters\n\n static void setVerbose(bool verbose) { m_verbose = verbose; }\n", "file_path": "GLAC/config/parameters.h", "rank": 44, "score": 25.190700845057123 }, { "content": "#include \"configloader.h\"\n\n#include <fstream>\n\n#include \"lib/json.hpp\"\n\n#include \"parameters.h\"\n\n#include \"parallelization/parallel.h\"\n\n\n\n\n\nusing nlohmann::json;\n\n\n\nnamespace ConfigLoader\n\n{\n\nnamespace\n\n {\n\n // Namespace unaccessible outside of the ConfigLoader namespace.\n\n void setObservable(json iterable, bool flow)\n\n {\n\n std::vector<std::string> observableVector;\n\n for (unsigned int i = 0; i < iterable.size(); i++)\n\n {\n\n observableVector.push_back(iterable[i]);\n", "file_path": "GLAC/config/configloader.cpp", "rank": 45, "score": 24.96737000693154 }, { "content": " delete [] L;\n\n delete [] LNew;\n\n\n\n return passed;\n\n}\n\n\n\nbool ActionTests::testActionDeltaS(Action &S)\n\n{\n\n// double getDeltaAction(SU3 U, SU3 UPrime);\n\n// void computeStaple(Lattice<SU3> *lattice, int i, int j, int k, int l, int mu);\n\n bool passed = true;\n\n\n\n Lattice<SU3> * L = new Lattice<SU3>[4];\n\n for (int i = 0; i < 4; i++) L[i].allocate(m_dim);\n\n\n\n for (int mu = 0; mu < 4; mu++)\n\n {\n\n L[mu].identity();\n\n }\n\n\n", "file_path": "GLAC/tests/unit_tests/actiontests.cpp", "rank": 46, "score": 24.230390636680895 }, { "content": "\n\n for (unsigned int i = 0; i < NTests; ++i) {\n\n V0 = m_SU3Generator->generateRandom();\n\n V1 = m_SU3Generator->generateRandom();\n\n V2 = V1*V0;\n\n }\n\n\n\n timer = duration_cast<duration<double>>(steady_clock::now() - preUpdate).count();\n\n\n\n printf(\"\\nMatrix multiplication tests: %8.4f seconds (%8.4E seconds per test)\",timer,timer/double(NTests));\n\n}\n\n\n\nvoid PerformanceTests::testFlow()\n\n{\n\n /*\n\n * Runs performance tests on the flow method.\n\n */\n\n Lattice<SU3> *L = new Lattice<SU3>[4];\n\n for (unsigned int mu = 0; mu < 4; ++mu) {\n\n L[mu].allocate(m_dim);\n", "file_path": "GLAC/tests/performancetests.cpp", "rank": 47, "score": 23.88505385686666 }, { "content": "}\n\n\n\nSuperSampler::~SuperSampler()\n\n{\n\n // Freeing class specific observable\n\n delete m_plaqObservable;\n\n delete m_topcObservable;\n\n delete m_energyObservable;\n\n delete m_topctObservable;\n\n delete m_wObservable;\n\n delete m_wtObservable;\n\n}\n\n\n\nvoid SuperSampler::initializeObservableStorer(const bool storeFlowObservable)\n\n{\n\n m_storeFlowObservable = storeFlowObservable;\n\n if (m_storeFlowObservable) {\n\n // +1 as we are storing the initial value at t=0 as well.\n\n m_plaqObservable = new ObservableStorer(Parameters::getNFlows() + 1);\n\n m_energyObservable = new ObservableStorer(Parameters::getNFlows() + 1);\n", "file_path": "GLAC/observables/supersampler.cpp", "rank": 48, "score": 23.771086697075162 }, { "content": "#include \"parameters.h\"\n\n#include \"config/sysprint.h\"\n\n#include <cmath>\n\n\n\n// Lattice specific constants\n\nunsigned int Parameters::m_NSpatial = 0;\n\nunsigned int Parameters::m_NTemporal = 0;\n\nunsigned int Parameters::m_latticeSize = 1;\n\n\n\n// Sub lattice / parallel related variables\n\nstd::vector<unsigned int> Parameters::m_N;\n\nunsigned int Parameters::m_subLatticeSize = 1;\n\nint Parameters::m_processorsPerDimension[4] = {0,0,0,0};\n\nbool Parameters::m_subLatticeSizePreset = false;\n\n\n\n// Physical lattice size dependent values\n\ndouble Parameters::m_beta = 0;\n\ndouble Parameters::m_a = 0;\n\nconst double Parameters::r0 = 0.5; // Sommer parameter\n\n\n", "file_path": "GLAC/config/parameters.cpp", "rank": 49, "score": 23.54479456295251 }, { "content": "#include \"communicator.h\"\n\n#include \"neighbours.h\"\n\n#include \"index.h\"\n\n#include \"parallelparameters.h\"\n\n#include \"config/parameters.h\"\n\n#include <mpi.h>\n\n#include <cmath>\n\n#include \"math/lattice.h\"\n\n\n\n// Internal variables\n\nbool Parallel::Communicator::muDir = 0;\n\nbool Parallel::Communicator::nuDir = 0;\n\nSU3 Parallel::Communicator::exchangeU; // Carefull! This might give a bug!\n\nstd::vector<unsigned int> Parallel::Communicator::m_N = {0,0,0,0};\n\n// Variables used externally\n\nint Parallel::Communicator::m_processRank = 0;\n\nint Parallel::Communicator::m_numprocs = 0;\n\nint Parallel::Communicator::m_processorsPerDimension[4] = {0,0,0,0};\n\n\n\nusing Parallel::Neighbours;\n", "file_path": "GLAC/parallelization/communicator.cpp", "rank": 50, "score": 23.114987118790854 }, { "content": " m_U3Temp.allocate(m_N);\n\n m_temp.allocate(m_N);\n\n}\n\n\n\nMasterSampler::~MasterSampler()\n\n{\n\n // Freeing class specific observable\n\n delete m_plaqObservable;\n\n delete m_topcObservable;\n\n delete m_energyObservable;\n\n}\n\n\n\nvoid MasterSampler::initializeObservableStorer(const bool storeFlowObservable)\n\n{\n\n m_storeFlowObservable = storeFlowObservable;\n\n if (m_storeFlowObservable) {\n\n // +1 as we are storing the initial value at t=0 as well.\n\n m_plaqObservable = new ObservableStorer(Parameters::getNFlows() + 1);\n\n m_topcObservable = new ObservableStorer(Parameters::getNFlows() + 1);\n\n m_energyObservable = new ObservableStorer(Parameters::getNFlows() + 1);\n", "file_path": "GLAC/observables/mastersampler.cpp", "rank": 51, "score": 23.094093794576757 }, { "content": " void writeFlowObservablesToFile(const unsigned int iFlow);\n\n void reset();\n\n void runStatistics();\n\n void printHeader();\n\n void printObservable(const unsigned int iObs);\n\n void printStatistics();\n\n std::vector<double> getObservablesVector(const unsigned int iObs);\n\n void copyObservable(const unsigned int iObs, const std::vector<double> &obs);\n\n};\n\n\n\n#endif // MASTERSAMPLER_H\n", "file_path": "GLAC/observables/mastersampler.h", "rank": 52, "score": 22.912354195789458 }, { "content": " void writeObservableToFile(const double acceptanceRatio);\n\n void writeFlowObservablesToFile(const unsigned int iFlow);\n\n void reset();\n\n void runStatistics();\n\n void printHeader();\n\n void printObservable(const unsigned int iObs);\n\n void printStatistics();\n\n std::vector<double> getObservablesVector(const unsigned int iObs);\n\n void copyObservable(const unsigned int iObs, const std::vector<double> &obs);\n\n};\n\n\n\n#endif // LATTICEACTIONCHARGEDENSITY_H\n", "file_path": "GLAC/observables/latticeactionchargedensity.h", "rank": 53, "score": 22.59840091471055 }, { "content": " } else {\n\n m_correlator = new MasterSamplerTopcXYZ(flow);\n\n }\n\n }\n\n}\n\n\n\n/*!\n\n * \\brief System::~System de-allocates action, lattice, correlator RNGs, flow lattice, flow correlator and flow.\n\n */\n\nSystem::~System()\n\n{\n\n /*\n\n * Class destructor\n\n */\n\n if (Parallel::ParallelParameters::active) {\n\n delete m_S;\n\n delete m_SU3Generator;\n\n delete [] m_lattice;\n\n delete m_correlator;\n\n\n", "file_path": "GLAC/system.cpp", "rank": 54, "score": 22.302808776504094 }, { "content": "#include \"fieldio.h\"\n\n#include \"config/parameters.h\"\n\n#include \"parallelization/index.h\"\n\n#include \"parallelization/communicator.h\"\n\n#include <mpi.h>\n\n#include <cmath>\n\n#include <fstream>\n\n\n\nusing std::cout;\n\nusing std::endl;\n\n\n\nconst long long IO::FieldIO::m_SU3Doubles = 18;\n\nconst long long IO::FieldIO::m_SU3Size = m_SU3Doubles*sizeof(double);\n\nconst long long IO::FieldIO::m_linkDoubles = m_SU3Doubles*4;\n\nconst long long IO::FieldIO::m_linkSize = m_linkDoubles*sizeof(double);\n\nstd::vector<unsigned int> IO::FieldIO::m_N;\n\n\n\n/*!\n\n * \\namespace IO\n\n *\n", "file_path": "GLAC/io/fieldio.cpp", "rank": 55, "score": 21.984303207673083 }, { "content": " L[mu][isite] = m_SU3Generator->generateRST();\n\n }\n\n }\n\n\n\n const unsigned int NTests = 1000;\n\n\n\n // Timers\n\n double timer = 0;\n\n steady_clock::time_point preUpdate;\n\n preUpdate = steady_clock::now();\n\n\n\n for (unsigned int itest = 0; itest < NTests; itest++) {\n\n for (unsigned int mu = 0; mu < 4; mu++) {\n\n L[mu] = shift(shift(L[mu], FORWARDS, mu), BACKWARDS, mu);\n\n L[mu] = shift(shift(L[mu], BACKWARDS, mu), FORWARDS, mu);\n\n }\n\n }\n\n\n\n timer = duration_cast<duration<double>>(steady_clock::now() - preUpdate).count();\n\n if (m_processRank == 0) {\n\n printf(\"\\nDouble shift test: %8.4f seconds (%8.4E seconds per flow step)\",timer,timer/double(NTests));\n\n }\n\n\n\n delete [] L;\n\n}\n", "file_path": "GLAC/tests/performancetests.cpp", "rank": 56, "score": 21.955498007313185 }, { "content": " // Flow\n\n Flow * m_flow = nullptr;\n\n void flowConfiguration(const unsigned int iConfig);\n\n void copyToFlowLattice();\n\n Lattice<SU3> * m_flowLattice;\n\n\n\n // Function for updating our system using the Metropolis algorithm\n\n void update();\n\n inline void updateLink(const unsigned int iSite, const int mu);\n\n\n\n // Thermalization function\n\n void thermalize();\n\n\n\n // SU3 generator\n\n SU3MatrixGenerator * m_SU3Generator = nullptr;\n\n\n\n // RNGs\n\n std::mt19937_64 m_generator;\n\n std::uniform_real_distribution<double> m_uniform_distribution;\n\n\n", "file_path": "GLAC/system.h", "rank": 57, "score": 21.952821807917985 }, { "content": "#include \"su3.h\"\n\n#include <iostream>\n\n#include <cmath>\n\n\n\nusing std::cout;\n\nusing std::endl;\n\n\n\nvoid SU3::zeros()\n\n{\n\n for (int i = 0; i < 18; i++) {\n\n mat[i] = 0;\n\n }\n\n}\n\n\n\nvoid SU3::identity()\n\n{\n\n for (int i = 0; i < 18; i++)\n\n {\n\n mat[i] = 0;\n\n }\n", "file_path": "GLAC/math/matrices/su3.cpp", "rank": 58, "score": 21.799564604233822 }, { "content": "#include \"actiontests.h\"\n\n#include \"actions/actions.h\"\n\n#include \"parallelization/communicator.h\"\n\n\n\nActionTests::ActionTests()\n\n{\n\n\n\n}\n\n\n\nbool ActionTests::testActionDerivative(Action &S)\n\n{\n\n bool passed = true;\n\n\n\n Lattice<SU3> * L = new Lattice<SU3>[4];\n\n Lattice<SU3> * LNew = new Lattice<SU3>[4];\n\n for (int i = 0; i < 4; i++) L[i].allocate(m_dim);\n\n for (int i = 0; i < 4; i++) LNew[i].allocate(m_dim);\n\n\n\n\n\n for (int mu = 0; mu < 4; mu++)\n", "file_path": "GLAC/tests/unit_tests/actiontests.cpp", "rank": 59, "score": 21.739885770084438 }, { "content": " // Data generation related setters\n\n static void setFlowEpsilon(const double flowEpsilon) { m_flowEpsilon = flowEpsilon; }\n\n static void setSU3Eps(const double SU3Eps) { m_SU3Eps = SU3Eps; }\n\n static void setMetropolisSeed(const double metropolisSeed);\n\n static void setRandomMatrixSeed(double randomMatrixSeed);\n\n\n\n // Lattice related setters, initiated after config input\n\n static void setLatticeSize(const unsigned int latticeSize) { m_latticeSize = latticeSize; }\n\n\n\n // Sub lattice / parallel related setters\n\n static void setN(const std::vector<unsigned int> N) { m_N = N; }\n\n static void setSubLatticePreset(const bool subLatticeSizePreset) { m_subLatticeSizePreset = subLatticeSizePreset; }\n\n static void setSubLatticeSize(const unsigned int subLatticeSize) { m_subLatticeSize = subLatticeSize; }\n\n static void setProcessorsPerDimension(int *processorsPerDimension) { for (unsigned int i = 0; i < 4; i++) m_processorsPerDimension[i] = processorsPerDimension[i]; }\n\n\n\n // Action type\n\n static void setActionType(std::string actionType) { m_actionType = actionType; }\n\n\n\n // Name of samplers setters\n\n static void setExpFuncName(std::string expFuncName) { m_expFuncName = expFuncName;}\n", "file_path": "GLAC/config/parameters.h", "rank": 60, "score": 21.721234621081187 }, { "content": " }\n\n\n\n // Sets pointers\n\n setAction();\n\n setObservable(Parameters::getObservablesList(),false);\n\n\n\n // Passes the index handler and dimensionality to the action and correlator classes.\n\n if (m_NFlows != 0) {\n\n setObservable(Parameters::getFlowObservablesList(),true);\n\n m_flow = new Flow(m_S); // Ensure it does not go out of scope\n\n m_flowLattice = new Lattice<SU3>[4];\n\n for (int mu = 0; mu < 4; mu++) {\n\n m_flowLattice[mu].allocate(m_N);\n\n }\n\n }\n\n IO::FieldIO::init();\n\n}\n\n\n\nvoid System::copyToFlowLattice()\n\n{\n", "file_path": "GLAC/system.cpp", "rank": 61, "score": 21.712222037257263 }, { "content": "\n\nvoid Plaquette::runStatistics()\n\n{\n\n /*\n\n * Statistics. Should perhaps make into its own class?\n\n */\n\n // Gathers results from processors\n\n m_observable->gatherResults();\n\n // Runs statistics, normalization defined in initialization\n\n m_observable->runStatistics();\n\n}\n\n\n\nvoid Plaquette::printObservable(const unsigned int iObs)\n\n{\n\n if (Parallel::Communicator::getProcessRank() == 0) {\n\n if (!m_storeFlowObservable) {\n\n printf(\"%-*.8f\", m_headerWidth, (*m_observable)[iObs]);\n\n } else {\n\n printf(\"\\n%-4d %-*.8f\", iObs, m_headerWidth, (*m_observable)[iObs]);\n\n }\n\n }\n\n}\n\n\n\nvoid Plaquette::printHeader()\n\n{\n\n printf(\"%-*s\", m_headerWidth, m_observableName.c_str());\n\n}\n", "file_path": "GLAC/observables/plaquette.cpp", "rank": 62, "score": 21.56213247865537 }, { "content": " // Accessor for the observable\n\n double &operator[](const unsigned long int iObs) { return m_observables.at(iObs); }\n\n// double &operator[](unsigned long int iObs) { return m_observables[iObs]; }\n\n\n\n // Runs statistics, perhaps create its own class? But that increases overhead, so maybe not\n\n void gatherResults();\n\n void runStatistics();\n\n\n\n // Printers\n\n void printStatistics();\n\n\n\n // File writers\n\n void writeObservableToFile(const double acceptanceRatio);\n\n void writeFlowObservableToFile(const unsigned long int configNumber);\n\n\n\n // Getters\n\n std::vector<double> getObservableArray() { return m_observables; }\n\n double getObservable(const unsigned long int iObs) { return m_observables[iObs]; }\n\n std::string getObservableName() { return m_observableName; }\n\n\n\n // Setters\n\n void setObservableName(const std::string &observableName) { m_observableName = observableName; }\n\n void setNormalizeObservableByProcessor(const bool norm) { m_normalizeObservableByProcessor = norm; }\n\n void reset();\n\n};\n\n\n\n#endif // OBSERVABLESTORER_H\n", "file_path": "GLAC/observables/tools/observablestorer.h", "rank": 63, "score": 21.523228199476293 }, { "content": " delete m_topcObservable;\n\n delete m_energyObservable;\n\n delete m_topctObservable;\n\n}\n\n\n\nvoid MasterSamplerTopcXYZ::initializeObservableStorer(const bool storeFlowObservable)\n\n{\n\n m_storeFlowObservable = storeFlowObservable;\n\n if (m_storeFlowObservable) {\n\n // +1 as we are storing the initial value at t=0 as well.\n\n m_plaqObservable = new ObservableStorer(Parameters::getNFlows() + 1);\n\n m_topcObservable = new ObservableStorer(Parameters::getNFlows() + 1);\n\n m_energyObservable = new ObservableStorer(Parameters::getNFlows() + 1);\n\n m_topctObservable = new ObservableStorer((Parameters::getNFlows() + 1) * m_N[3]);\n\n } else {\n\n if (Parameters::getStoreThermalizationObservables()) {\n\n m_plaqObservable = new ObservableStorer(Parameters::getNCf() + Parameters::getNTherm() + 1);\n\n m_topcObservable = new ObservableStorer(Parameters::getNCf() + Parameters::getNTherm() + 1);\n\n m_energyObservable = new ObservableStorer(Parameters::getNCf() + Parameters::getNTherm() + 1);\n\n m_topctObservable = new ObservableStorer((Parameters::getNCf() + Parameters::getNTherm() + 1) * m_N[3]);\n", "file_path": "GLAC/observables/mastersamplertopcxyz.cpp", "rank": 64, "score": 21.194968269317357 }, { "content": "\n\n for (unsigned int i = 0; i < configurationNames.size(); i++) {\n\n // Loads configuration, either in chroma format(reversed doubles) or regular format.\n\n if (!Parameters::getLoadChromaConfigurations()) {\n\n load(configurationNames[i]);\n\n } else {\n\n loadChroma(configurationNames[i]);\n\n }\n\n\n\n // Prints a new header for each flow.\n\n if (Parallel::Communicator::getProcessRank() == 0 && Parameters::getVerbose()) {\n\n m_flowCorrelator->printHeader();\n\n }\n\n\n\n // Flows the configuration loaded\n\n flowConfiguration(i);\n\n }\n\n\n\n\n\n\n", "file_path": "GLAC/system.cpp", "rank": 65, "score": 21.173438429450115 }, { "content": "// Action type\n\nstd::string Parameters::m_actionType = \"\";\n\n\n\n// Run specific constants\n\nunsigned int Parameters::m_NCf = 0;\n\nunsigned int Parameters::m_NCor = 0;\n\nunsigned int Parameters::m_NTherm = 0;\n\nunsigned int Parameters::m_NUpdates = 0;\n\nunsigned int Parameters::m_NFlows = 0;\n\n\n\n// Number of points we are storing\n\nunsigned int Parameters::m_configSamplePoints = 0;\n\nunsigned int Parameters::m_flowSamplePoints = 0;\n\n\n\n// Variables holding if we are to calculate and store the thermalization variables\n\nbool Parameters::m_storeThermalizationObservables = false;\n\n\n\n// Variable storing gauge configurations\n\nbool Parameters::m_storeConfigurations = false;\n\n\n", "file_path": "GLAC/config/parameters.cpp", "rank": 66, "score": 21.088625594894477 }, { "content": "\n\nvoid System::setObservable(const std::vector<std::string> &obsList, const bool flow)\n\n{\n\n /*\n\n * Sets the observables to be sampled.\n\n * Arguments:\n\n * obsList : vector of string\n\n * flow : flag if we are initializing a flow variable\n\n */\n\n bool plaq = false;\n\n bool topc = false;\n\n bool energy = false;\n\n bool topct = false;\n\n bool weinberg = false;\n\n bool energyTopcFieldDensity = false;\n\n for (unsigned int i = 0; i < obsList.size(); i++) {\n\n if (obsList[i] == \"plaq\") plaq = true;\n\n if (obsList[i] == \"topc\") topc = true;\n\n if (obsList[i] == \"energy\") energy = true;\n\n if (obsList[i] == \"topct\") topct = true;\n", "file_path": "GLAC/system.cpp", "rank": 67, "score": 21.059520624815086 }, { "content": " // IO parameters\n\n static std::string m_pwd;\n\n static std::string m_batchName;\n\n static std::string m_inputFolder;\n\n static std::string m_outputFolder;\n\n\n\n // Run specific variables\n\n static unsigned int m_NCf;\n\n static unsigned int m_NCor;\n\n static unsigned int m_NTherm;\n\n static unsigned int m_NUpdates;\n\n static unsigned int m_NFlows;\n\n static unsigned int m_configSamplePoints;\n\n static unsigned int m_flowSamplePoints;\n\n\n\n // Unit testing\n\n static bool m_unitTesting;\n\n static bool m_unitTestingVerbose;\n\n static bool m_testLatticeGaugeInvariance;\n\n static std::string m_latticeFileNameToCheck;\n", "file_path": "GLAC/config/parameters.h", "rank": 68, "score": 20.986553103033202 }, { "content": "#include \"topologicalcharge.h\"\n\n#include \"math/functions.h\"\n\n#include \"parallelization/parallel.h\"\n\n#include \"config/parameters.h\"\n\n#include <cmath>\n\n\n\nTopologicalCharge::TopologicalCharge(const bool storeFlowObservable) : Correlator(storeFlowObservable)\n\n{\n\n m_multiplicationFactor = 1.0/(16*16*M_PI*M_PI);\n\n m_observable->setObservableName(m_observableNameCompact);\n\n m_observable->setNormalizeObservableByProcessor(false);\n\n\n\n // Allocates disc space for the lattices to be used for calculations.\n\n m_clov1.allocate(m_N);\n\n m_clov2.allocate(m_N);\n\n m_U2Temp.allocate(m_N);\n\n m_U3Temp.allocate(m_N);\n\n m_temp.allocate(m_N);\n\n}\n\n\n", "file_path": "GLAC/observables/topologicalcharge.cpp", "rank": 69, "score": 20.783239602635987 }, { "content": " for (unsigned int isite = 0; isite < L[0].m_latticeSize; ++isite) {\n\n L[mu][isite] = m_SU3Generator->generateRST();\n\n }\n\n }\n\n\n\n // Scopes the test to save memory in the flow method.\n\n {\n\n // Runs performance test with Wilson Explicit Exponential Action\n\n // Sets new flow\n\n WilsonExplicitDer S2;\n\n Flow flow2(&S2);\n\n\n\n preUpdate = steady_clock::now();\n\n for (unsigned int iflow = 0; iflow < NFlow; ++iflow) {\n\n flow2.flowField(L);\n\n }\n\n\n\n timerWilsonExplicit = duration_cast<duration<double>>(steady_clock::now() - preUpdate).count();\n\n if (m_processRank == 0) {\n\n printf(\"\\nFlow test for Wilson explicit Action: %8.4f seconds (%8.4E seconds per flow step)\",timerWilsonExplicit,timerWilsonExplicit/double(NFlow));\n", "file_path": "GLAC/tests/performancetests.cpp", "rank": 71, "score": 20.4628391201277 }, { "content": "#include \"mastersampler.h\"\n\n\n\n#include <cmath>\n\n#include \"parallelization/communicator.h\"\n\n#include \"config/parameters.h\"\n\n\n\nMasterSampler::MasterSampler(const bool flow) : Correlator()\n\n{\n\n // Sets up observable storage containers\n\n initializeObservableStorer(flow);\n\n\n\n // Sets up multiplication factors\n\n m_plaqMultiplicationFactor = 1.0/(18.0*double(m_latticeSize));\n\n m_topcMultiplicationFactor = 1.0/(16*16*M_PI*M_PI);\n\n m_energyMultiplicationFactor = 1.0/double(Parameters::getLatticeSize()); // Cant divide by size if we are not normalizing as well\n\n\n\n // Allocates memory to the helper variables\n\n m_clov1.allocate(m_N);\n\n m_clov2.allocate(m_N);\n\n m_U2Temp.allocate(m_N);\n", "file_path": "GLAC/observables/mastersampler.cpp", "rank": 72, "score": 20.438253377248145 }, { "content": "#include \"mastersamplertopcxyz.h\"\n\n\n\n#include <cmath>\n\n#include \"parallelization/communicator.h\"\n\n#include \"config/parameters.h\"\n\n#include \"io/observablesio.h\"\n\n\n\nMasterSamplerTopcXYZ::MasterSamplerTopcXYZ(const bool flow) : Correlator()\n\n{\n\n // Sets up observable storage containers\n\n initializeObservableStorer(flow);\n\n\n\n // Sets up multiplication factors\n\n m_plaqMultiplicationFactor = 1.0/(18.0*double(m_latticeSize));\n\n m_topcMultiplicationFactor = 1.0/(16*16*M_PI*M_PI);\n\n m_energyMultiplicationFactor = 1.0/double(Parameters::getLatticeSize()); // Cant divide by size if we are not normalizing as well\n\n\n\n // Allocates memory to the helper variables\n\n m_clov1.allocate(m_N);\n\n m_clov2.allocate(m_N);\n", "file_path": "GLAC/observables/mastersamplertopcxyz.cpp", "rank": 73, "score": 20.437417169695813 }, { "content": "\n\n // Time counting\n\n steady_clock::time_point m_preUpdate;\n\n duration<double> m_updateTime;\n\n double m_updateStorer = 0;\n\n double m_updateStorerTherm = 0;\n\n\n\n // Function for choosing and setting the correlators/observables\n\n void setObservable(const std::vector<std::string> &obsList, const bool flow);\n\n\n\n // Storing the action as a pointer\n\n void setAction();\n\n Action * m_S = nullptr;\n\n\n\n // Config correlator\n\n Correlator * m_correlator = nullptr;\n\n\n\n // Flow correlator\n\n Correlator * m_flowCorrelator = nullptr;\n\n\n", "file_path": "GLAC/system.h", "rank": 74, "score": 20.244045368548253 }, { "content": " {\n\n L[mu].identity();\n\n LNew[mu].zeros();\n\n }\n\n\n\n // Tests the action derivative as used in flow.\n\n for (int mu = 0; mu < 4; mu++) {\n\n LNew[mu] = S.getActionDerivative(L, mu);\n\n }\n\n\n\n\n\n// SU3 updateLink;\n\n// updateLink.identity();\n\n// updateLink *= 2;\n\n\n\n// double dS = 0;\n\n\n\n// for (unsigned int x = 0; x < L->m_dim[0]; x++) {\n\n// for (unsigned int y = 0; y < L->m_dim[1]; y++) {\n\n// for (unsigned int z = 0; z < L->m_dim[2]; z++) {\n", "file_path": "GLAC/tests/unit_tests/actiontests.cpp", "rank": 75, "score": 20.07572399180983 }, { "content": " /////////////////\n\n // Lattice related run getters\n\n static unsigned int getNSpatial() { return m_NSpatial; }\n\n static unsigned int getNTemporal() { return m_NTemporal; }\n\n static double getBeta() { return m_beta; }\n\n static unsigned int getNCf() { return m_NCf; }\n\n static unsigned int getNCor() { return m_NCor; }\n\n static unsigned int getNTherm() { return m_NTherm; }\n\n static unsigned int getNUpdates() { return m_NUpdates; }\n\n static unsigned int getNFlows() { return m_NFlows; }\n\n\n\n // Data storage related getters\n\n static std::string getOutputFolder() { return m_outputFolder; }\n\n static std::string getInputFolder() { return m_inputFolder; }\n\n static bool getStoreConfigurations() { return m_storeConfigurations; }\n\n static bool getStoreThermalizationObservables() { return m_storeThermalizationObservables; }\n\n\n\n // Human readable output related getters\n\n static bool getVerbose() { return m_verbose; }\n\n\n", "file_path": "GLAC/config/parameters.h", "rank": 76, "score": 19.857517639466405 }, { "content": " for (unsigned long int iFlow = 0; iFlow < Parameters::getNFlows() + 1; iFlow++) {\n\n // Places obs values into temporary buffer\n\n for (unsigned long int it = 0; it < m_N[3]; it++) {\n\n tempSend[it + m_N[3]*Neighbours::getProcessorDimensionPosition(3)] = obs[iFlow * m_N[3] + it];\n\n }\n\n\n\n MPI_Reduce(tempSend, tempRecv, Parameters::getNTemporal(), MPI_DOUBLE, MPI_SUM, 0, ParallelParameters::ACTIVE_COMM);\n\n\n\n for (unsigned long int it = 0; it < Parameters::getNTemporal(); it++) {\n\n obsResults[iFlow * Parameters::getNTemporal() + it] = tempRecv[it];\n\n }\n\n\n\n // Resets temporary buffer\n\n for (unsigned long int it = 0; it < Parameters::getNTemporal(); it++) {\n\n tempSend[it] = 0;\n\n tempRecv[it] = 0;\n\n }\n\n }\n\n}\n\n\n", "file_path": "GLAC/parallelization/communicator.cpp", "rank": 77, "score": 19.84866779373446 }, { "content": " delete [] ExplicitExpLattice;\n\n delete [] MorningstarLattice;\n\n}\n\n\n\nvoid PerformanceTests::testMatrixMultiplication()\n\n{\n\n /*\n\n * Runs a SU3 matrix multiplication 10000000 time in order to test the performance.\n\n */\n\n unsigned int NTests = 10000000;\n\n\n\n printf(\"\\n\\nRunning timing of SU3 matrix multiplication for %d tests\",NTests);\n\n\n\n SU3 V0, V1, V2;\n\n\n\n // Timers\n\n double timer = 0;\n\n steady_clock::time_point preUpdate;\n\n\n\n preUpdate = steady_clock::now();\n", "file_path": "GLAC/tests/performancetests.cpp", "rank": 78, "score": 19.681477909671028 }, { "content": " }\n\n for (unsigned int mu = 0; mu < 4; ++mu) {\n\n for (unsigned int isite = 0; isite < L[0].m_latticeSize; ++isite) {\n\n L[mu][isite] = m_SU3Generator->generateRST();\n\n }\n\n }\n\n\n\n if (m_processRank == 0) {\n\n printf(\"\\nRunning flow performance tests for a lattice of size: %d^3 x %d\", m_N, m_NT);\n\n }\n\n\n\n unsigned int NFlow = 100;\n\n\n\n // Timers\n\n double timerWilsonGauge = 0;\n\n double timerWilsonExplicit = 0;\n\n steady_clock::time_point preUpdate;\n\n\n\n // Scopes the test to save memory in the flow method.\n\n {\n", "file_path": "GLAC/tests/performancetests.cpp", "rank": 79, "score": 19.635091302556315 }, { "content": "#include \"supersampler.h\"\n\n#include <cmath>\n\n#include \"parallelization/communicator.h\"\n\n#include \"config/parameters.h\"\n\n#include \"io/observablesio.h\"\n\n//#include <map>\n\n\n\nSuperSampler::SuperSampler(const bool flow) : Correlator()\n\n{\n\n // Sets up observable storage containers\n\n initializeObservableStorer(flow);\n\n\n\n // Sets up multiplication factors\n\n m_plaqMultiplicationFactor = 1.0/(18.0*double(m_latticeSize));\n\n m_topcMultiplicationFactor = 1.0/(16*16*M_PI*M_PI);\n\n // Saves calculating about the G_munu about 16 times(8*2) compared to Chroma.\n\n // Weinberg gets one 8 factor from the symmetries related to the levi-cevita\n\n // Factor 1/3 from form Weinberg definition. 1/16^3 from the clover term definition, F_munu->G_munu\n\n m_wMultiplicationFactor = 2*8.0*8.0/(3*16*16*16);\n\n m_energyMultiplicationFactor = 1.0/double(Parameters::getLatticeSize()); // Cant divide by size if we are not normalizing as well\n", "file_path": "GLAC/observables/supersampler.cpp", "rank": 80, "score": 19.456058191470557 }, { "content": "#include \"su2.h\"\n\n#include <iostream>\n\n#include <cmath>\n\n\n\n/*!\n\n * \\brief SU2::setComplex\n\n * \\param w complex number\n\n * \\param i matrix position(contigious) to set w as.\n\n */\n\nvoid SU2::setComplex(complex w, int i)\n\n{\n\n mat[i] = w.z[0];\n\n mat[i+1] = w.z[1];\n\n}\n\n\n\ndouble SU2::normSquared(int i)\n\n{\n\n /*\n\n * Returns the norm squared of the complex number.\n\n */\n", "file_path": "GLAC/math/matrices/su2.cpp", "rank": 81, "score": 19.185247052542355 }, { "content": " static double getFlowEpsilon() { return m_flowEpsilon; }\n\n static double getSU3Eps() { return m_SU3Eps; }\n\n static double getMetropolisSeed() { return m_metropolisSeed; }\n\n static double getRandomMatrixSeed() { return m_randomMatrixSeed; }\n\n\n\n // Lattice related getters, initiated after config input\n\n static double getLatticeSpacing() { return m_a; }\n\n static unsigned int getLatticeSize() { return m_latticeSize; }\n\n\n\n // Sub lattice / parallel related getters\n\n static std::vector<unsigned int> getN() { return m_N; }\n\n static bool getSubLatticePreset() { return m_subLatticeSizePreset; }\n\n static unsigned int getSubLatticeSize() { return m_subLatticeSize; }\n\n static void getProcessorsPerDimension(int *processorsPerDimension) { for (unsigned int i = 0; i < 4; i++) m_processorsPerDimension[i] = processorsPerDimension[i]; }\n\n\n\n // Action type\n\n static std::string getActionType() { return m_actionType; }\n\n\n\n // Exponential getters\n\n static std::string getExpFuncName() { return m_expFuncName; }\n", "file_path": "GLAC/config/parameters.h", "rank": 82, "score": 19.006930883781052 }, { "content": "\n\n // Setup related setters\n\n static void setFilePath(std::string pwd) { m_pwd = pwd; }\n\n static void setBatchName(std::string batchName) { m_batchName = batchName; }\n\n static void setHotStart(bool hotStart) { m_hotStart = hotStart; }\n\n static void setRSTHotStart(bool RSTHotStart) { m_RSTHotStart = RSTHotStart; }\n\n\n\n // Testing related setters\n\n static void setUnitTesting(const bool unitTesting) { m_unitTesting = unitTesting; }\n\n static void setUnitTestingVerbose(const bool unitTestingVerbose) { m_unitTestingVerbose = unitTestingVerbose; }\n\n static void setCheckFieldGaugeInvariance(const bool testLatticeGaugeInvariance) { m_testLatticeGaugeInvariance = testLatticeGaugeInvariance; }\n\n static void setGaugeFieldToCheck(const std::string &latticeFileNameToCheck) { m_latticeFileNameToCheck = latticeFileNameToCheck; }\n\n\n\n // Performance testing related setters\n\n static void setPerformanceTesting(const bool performanceTesting) { m_performanceTesting = performanceTesting; }\n\n static void setNExpTests(const unsigned int NExpTests) { m_NExpTests = NExpTests; }\n\n static void setNRandTests(const unsigned int NRandTests) { m_NRandTests = NRandTests; }\n\n static void setNDerivaitveTests(const unsigned int NDerivativeTests) { m_NDerivativeTests = NDerivativeTests; }\n\n static void setTaylorPolDegree(const unsigned int NTaylorPolDegree) { m_NTaylorPolDegree = NTaylorPolDegree; }\n\n\n", "file_path": "GLAC/config/parameters.h", "rank": 83, "score": 18.80573912909589 }, { "content": " double wtObs = 0;\n\n for (unsigned int it = 0; it < m_N[3]; it++) {\n\n topctObs += (*m_topctObservable)[iObs*m_N[3] + it];\n\n wtObs += (*m_wtObservable)[iObs*m_N[3] + it];\n\n }\n\n\n\n double topcObs = 0;\n\n double wObs = 0;\n\n topcObs = m_topcObservable->getObservable(iObs);\n\n wObs = m_wObservable->getObservable(iObs);\n\n\n\n if (Parameters::getNFlows() != 0) {\n\n Parallel::Communicator::gatherDoubleResults(&topcObs,1);\n\n Parallel::Communicator::gatherDoubleResults(&wObs,1);\n\n }\n\n Parallel::Communicator::gatherDoubleResults(&topctObs,1);\n\n Parallel::Communicator::gatherDoubleResults(&wtObs,1);\n\n\n\n if (Parallel::Communicator::getProcessRank() == 0) {\n\n printf(\"%-*.8f %-*.8f %-*.8f %-*.8f %-*.8f %-*.8f\",\n", "file_path": "GLAC/observables/supersampler.cpp", "rank": 84, "score": 18.688386274695944 }, { "content": " /*\n\n * Runs performance tests on the shift method.\n\n */\n\n\n\n Lattice<SU3> *L = new Lattice<SU3>[4];\n\n for (unsigned int mu = 0; mu < 4; ++mu) {\n\n L[mu].allocate(m_dim);\n\n }\n\n for (unsigned int mu = 0; mu < 4; ++mu) {\n\n for (unsigned int isite = 0; isite < L[0].m_latticeSize; ++isite) {\n\n L[mu][isite] = m_SU3Generator->generateRST();\n\n }\n\n }\n\n\n\n if (m_processRank == 0) {\n\n printf(\"\\nRunning shift performance tests for a lattice of size: %d^3 x %d\", m_N, m_NT);\n\n }\n\n\n\n for (unsigned int mu = 0; mu < 4; ++mu) {\n\n for (unsigned int isite = 0; isite < L[0].m_latticeSize; ++isite) {\n", "file_path": "GLAC/tests/performancetests.cpp", "rank": 86, "score": 18.50286529163748 }, { "content": " // Runs performance test with Wilson Gauge Action\n\n WilsonGaugeAction S1;\n\n Flow flow(&S1);\n\n\n\n\n\n preUpdate = steady_clock::now();\n\n\n\n for (unsigned int iflow = 0; iflow < NFlow; ++iflow) {\n\n flow.flowField(L);\n\n }\n\n\n\n timerWilsonGauge = duration_cast<duration<double>>(steady_clock::now() - preUpdate).count();\n\n if (m_processRank == 0) {\n\n printf(\"\\nFlow test for Wilson Action: %8.4f seconds (%8.4E seconds per flow step)\",timerWilsonGauge,timerWilsonGauge/double(NFlow));\n\n }\n\n\n\n }\n\n\n\n // Resets the lattice\n\n for (unsigned int mu = 0; mu < 4; ++mu) {\n", "file_path": "GLAC/tests/performancetests.cpp", "rank": 87, "score": 18.49409713662638 }, { "content": " setBarrier();\n\n if (m_processRank == 0) cout << \"\\n\" << message.c_str() << endl;\n\n setBarrier();\n\n}\n\n\n\n/*!\n\n * \\brief Parallel::Communicator::gatherDoubleResults\n\n * \\param data to reduce.\n\n * \\param N number of points in data to reduce.\n\n *\n\n * \\todo Remove the unsigned long int, and use instead just unsigned long? Change globally to only use long?\n\n * \\todo This should really be a std::vector, not a pointer.\n\n */\n\nvoid Parallel::Communicator::gatherDoubleResults(double * data, const unsigned int N)\n\n{\n\n double tempData[N];\n\n MPI_Allreduce(data,tempData,N,MPI_DOUBLE,MPI_SUM,Parallel::ParallelParameters::ACTIVE_COMM);\n\n for (unsigned long int i = 0; i < N; i++) data[i] = tempData[i];\n\n}\n\n\n", "file_path": "GLAC/parallelization/communicator.cpp", "rank": 88, "score": 18.46084625501095 }, { "content": "\n\n // Performance testing\n\n static bool m_performanceTesting;\n\n static unsigned int m_NExpTests;\n\n static unsigned int m_NRandTests;\n\n static unsigned int m_NDerivativeTests;\n\n static unsigned int m_NTaylorPolDegree;\n\n\n\n // Data generation related variables\n\n static double m_SU3Eps;\n\n static double m_flowEpsilon;\n\n static double m_metropolisSeed;\n\n static double m_randomMatrixSeed;\n\n\n\n // Name of samplers\n\n static std::string m_expFuncName;\n\n static std::vector<std::string> m_observablesList;\n\n static std::vector<std::string> m_flowObservablesList;\n\n\n\n // Field configurations\n", "file_path": "GLAC/config/parameters.h", "rank": 89, "score": 18.325628739316777 }, { "content": " for (unsigned int it = 0; it < m_N[3]; it++) {\n\n topctObs += (*m_topctObservable)[iObs*m_N[3] + it];\n\n }\n\n\n\n double topcObs = 0;\n\n topcObs = m_topcObservable->getObservable(iObs);\n\n\n\n if (Parameters::getNFlows() != 0) {\n\n Parallel::Communicator::gatherDoubleResults(&topcObs,1);\n\n }\n\n Parallel::Communicator::gatherDoubleResults(&topctObs,1);\n\n\n\n if (Parallel::Communicator::getProcessRank() == 0) {\n\n printf(\"%-*.8f %-*.8f %-*.8f %-*.8f\",\n\n m_headerWidth,m_plaqObservable->getObservable(iObs),\n\n m_headerWidth,topcObs,\n\n m_headerWidth,m_energyObservable->getObservable(iObs),\n\n m_headerWidth,topctObs);\n\n }\n\n } else {\n", "file_path": "GLAC/observables/mastersamplertopcxyz.cpp", "rank": 90, "score": 18.314384569632104 }, { "content": " static void setObservableList(std::vector<std::string> observablesList) { m_observablesList = observablesList; }\n\n static void setFlowObservablesList(std::vector<std::string> flowObservablesList) { m_flowObservablesList = flowObservablesList; }\n\n\n\n // Field configurations setters\n\n static void setLoadFieldConfigurations(bool loadFieldConfigurations) { m_loadFieldConfigurations = loadFieldConfigurations; }\n\n static void setLoadChromaConfigurations(bool loadChromaConfigurations) { m_loadChromaConfigurations = loadChromaConfigurations; }\n\n static void setFieldConfigurationFileNames(std::vector<std::string> fieldConfigurationFileNames) { m_fieldConfigurationFileNames = fieldConfigurationFileNames; }\n\n\n\n // Setters for storing if we are to load and run from a given configuration\n\n static void setLoadConfigAndRun(bool loadConfigAndRun) { m_loadConfigAndRun = loadConfigAndRun; }\n\n static void setConfigStartNumber(int configStartNumber) { m_configStartNumber = configStartNumber; }\n\n\n\n // Setter for the sampling frequency\n\n static void setSamplingFrequency(int samplingFrequency) { m_samplingFrequency = samplingFrequency; }\n\n\n\n // Getter for debug parameter\n\n static void setDebug(bool debug) { m_debug = debug; }\n\n\n\n /////////////////\n\n //// Getters ////\n", "file_path": "GLAC/config/parameters.h", "rank": 91, "score": 18.27073640457364 }, { "content": "\n\n// Performance testing\n\nbool Parameters::m_performanceTesting = false;\n\nunsigned int Parameters::m_NExpTests = 0;\n\nunsigned int Parameters::m_NRandTests = 0;\n\nunsigned int Parameters::m_NDerivativeTests = 0;\n\nunsigned int Parameters::m_NTaylorPolDegree = 8;\n\n\n\n// Data generation related variables\n\ndouble Parameters::m_SU3Eps = 0.24;\n\ndouble Parameters::m_flowEpsilon = 0.01;\n\ndouble Parameters::m_metropolisSeed = 0;\n\ndouble Parameters::m_randomMatrixSeed = 0;\n\n\n\n// Name of samplers\n\nstd::string Parameters::m_expFuncName = \"\";\n\nstd::vector<std::string> Parameters::m_observablesList = {};\n\nstd::vector<std::string> Parameters::m_flowObservablesList = {};\n\n\n\n// Field configurations\n", "file_path": "GLAC/config/parameters.cpp", "rank": 92, "score": 18.267448487416708 }, { "content": " m_flowCorrelator = new Plaquette(flow);\n\n } else {\n\n m_correlator = new Plaquette(flow);\n\n }\n\n } else if (energyTopcFieldDensity && !plaq && !topc && !energy && !topct) {\n\n // Initates energyTopcFieldDensity if only that and no other samplers are specified.\n\n // Also then sets number of configurations to generate to one,\n\n // in order to avoid writing out too many fields.\n\n m_NCf = 1;\n\n Parameters::setNCf(m_NCf);\n\n m_writeConfigsToFile = false;\n\n Parameters::setStoreConfigurations(m_writeConfigsToFile);\n\n if (flow) {\n\n m_flowCorrelator = new LatticeActionChargeDensity(flow);\n\n } else {\n\n m_correlator = new LatticeActionChargeDensity(flow);\n\n }\n\n } else {\n\n if (flow) {\n\n m_flowCorrelator = new MasterSamplerTopcXYZ(flow);\n", "file_path": "GLAC/system.cpp", "rank": 93, "score": 17.98945022732198 }, { "content": " } else {\n\n m_plaqObservable = new ObservableStorer(Parameters::getNCf());\n\n m_topcObservable = new ObservableStorer(Parameters::getNCf());\n\n m_energyObservable = new ObservableStorer(Parameters::getNCf());\n\n m_topctObservable = new ObservableStorer(Parameters::getNCf() * m_N[3]);\n\n }\n\n }\n\n m_plaqObservable->setNormalizeObservableByProcessor(true);\n\n m_plaqObservable->setObservableName(\"plaq\");\n\n m_topcObservable->setObservableName(\"topc\");\n\n m_energyObservable->setObservableName(\"energy\");\n\n m_topctObservable->setObservableName(\"topct\");\n\n}\n\n\n\nvoid MasterSamplerTopcXYZ::writeFlowObservablesToFile(const unsigned int configNumber)\n\n{\n\n // Gathers and writes plaquette results to file\n\n m_plaqObservable->gatherResults();\n\n m_plaqObservable->writeFlowObservableToFile(configNumber);\n\n\n", "file_path": "GLAC/observables/mastersamplertopcxyz.cpp", "rank": 94, "score": 17.937818679202802 }, { "content": " m_flowCorrelator->calculate(m_flowLattice, 0);\n\n if (Parameters::getVerbose()) {\n\n m_flowCorrelator->printObservable(0);\n\n }\n\n\n\n if (Parameters::getDebug()) {\n\n Parallel::Communicator::checkLattice(m_flowLattice, \"Configuration is corrupt at flowConfiguration pt 2.\");\n\n }\n\n\n\n // Runs the flow\n\n for (unsigned int iFlow = 0; iFlow < m_NFlows; iFlow++)\n\n {\n\n if (Parameters::getDebug()) {\n\n Parallel::Communicator::checkLattice(m_flowLattice, \"Configuration is corrupt at flowConfiguration pt 2.5, before flow.\");\n\n }\n\n\n\n m_flow->flowField(m_flowLattice);\n\n\n\n if (Parameters::getDebug()) {\n\n Parallel::Communicator::checkLattice(m_flowLattice, \"Configuration is corrupt at flowConfiguration pt 2.5, after flow.\");\n", "file_path": "GLAC/system.cpp", "rank": 95, "score": 17.919512668066538 }, { "content": " m_U2Temp.allocate(m_N);\n\n m_U3Temp.allocate(m_N);\n\n m_temp.allocate(m_N);\n\n\n\n // Allocates temporary vector for retrieves results from the lattice method\n\n m_tempTopct.resize(m_N[3]);\n\n\n\n // Allocates temporary array for gathering results into a single time array\n\n m_topctGatherVector.resize(Parameters::getNTemporal() * (Parameters::getNFlows() + 1));\n\n for (unsigned int iFlow = 0; iFlow < Parameters::getNFlows() + 1; iFlow++) {\n\n for (unsigned int it = 0; it < Parameters::getNTemporal(); it++) {\n\n m_topctGatherVector[iFlow*Parameters::getNTemporal() + it] = 0;\n\n }\n\n }\n\n}\n\n\n\nMasterSamplerTopcXYZ::~MasterSamplerTopcXYZ()\n\n{\n\n // Freeing class specific observable\n\n delete m_plaqObservable;\n", "file_path": "GLAC/observables/mastersamplertopcxyz.cpp", "rank": 96, "score": 17.77281936590218 }, { "content": " if (obsList[i] == \"weinberg\") weinberg = true;\n\n if (obsList[i] == \"energyTopcFieldDensity\") energyTopcFieldDensity = true;\n\n }\n\n if (weinberg) {\n\n // Initializes the full mechinery except for the QxyzQt sampler\n\n if (flow) {\n\n m_flowCorrelator = new SuperSampler(flow);\n\n } else {\n\n m_correlator = new SuperSampler(flow);\n\n }\n\n }else if ((topc || energy) && !topct) {\n\n // Initializes the full mechinery except for the QxyzQt sampler\n\n if (flow) {\n\n m_flowCorrelator = new MasterSampler(flow);\n\n } else {\n\n m_correlator = new MasterSampler(flow);\n\n }\n\n } else if (plaq && !topc && !energy && !topct) {\n\n // Initialize plaquette sampler when no other samplers are specified\n\n if (flow) {\n", "file_path": "GLAC/system.cpp", "rank": 97, "score": 17.727128499056338 }, { "content": "{\n\n if (!m_storeFlowObservable) {\n\n printf(\"%-*s %-*s %-*s %-*s\",\n\n m_headerWidth,m_plaqObservable->getObservableName().c_str(),\n\n m_headerWidth,m_topcObservable->getObservableName().c_str(),\n\n m_headerWidth,m_energyObservable->getObservableName().c_str(),\n\n m_headerWidth,m_topctObservable->getObservableName().c_str());\n\n } else {\n\n printf(\"\\ni t %-*s %-*s %-*s %-*s\",\n\n m_headerWidth,m_plaqObservable->getObservableName().c_str(),\n\n m_headerWidth,m_topcObservable->getObservableName().c_str(),\n\n m_headerWidth,m_energyObservable->getObservableName().c_str(),\n\n m_headerWidth,m_topctObservable->getObservableName().c_str());\n\n }\n\n}\n\n\n\nvoid MasterSamplerTopcXYZ::printObservable(const unsigned int iObs)\n\n{\n\n if (!m_storeFlowObservable) {\n\n double topctObs = 0;\n", "file_path": "GLAC/observables/mastersamplertopcxyz.cpp", "rank": 98, "score": 17.68494213594035 }, { "content": " } else {\n\n if (Parameters::getStoreThermalizationObservables()) {\n\n m_plaqObservable = new ObservableStorer(Parameters::getNCf() + Parameters::getNTherm() + 1);\n\n m_topcObservable = new ObservableStorer(Parameters::getNCf() + Parameters::getNTherm() + 1);\n\n m_energyObservable = new ObservableStorer(Parameters::getNCf() + Parameters::getNTherm() + 1);\n\n } else {\n\n m_plaqObservable = new ObservableStorer(Parameters::getNCf());\n\n m_topcObservable = new ObservableStorer(Parameters::getNCf());\n\n m_energyObservable = new ObservableStorer(Parameters::getNCf());\n\n }\n\n }\n\n m_plaqObservable->setNormalizeObservableByProcessor(true);\n\n m_plaqObservable->setObservableName(\"plaq\");\n\n m_topcObservable->setObservableName(\"topc\");\n\n m_energyObservable->setObservableName(\"energy\");\n\n}\n\n\n\nvoid MasterSampler::writeFlowObservablesToFile(const unsigned int iFlow)\n\n{\n\n // Gathers and writes plaquette results to file\n", "file_path": "GLAC/observables/mastersampler.cpp", "rank": 99, "score": 17.65892440816003 } ]
C++
src/Cluster/ClusterMain.cpp
BBN-E/serif
1e2662d82fb1c377ec3c79355a5a9b0644606cb4
#include "Generic/common/leak_detection.h" #include "Generic/common/limits.h" #include "Generic/common/ParamReader.h" #include "Generic/common/UnrecoverableException.h" #include "Generic/common/UTF8InputStream.h" #include "Generic/common/UTF8OutputStream.h" #include "Generic/common/UTF8Token.h" #include "ReplaceLowFreq/ReplaceLowFreq.h" #include "ExtractBigrams/ExtractBigrams.h" #include "ExtractBigrams/WSTokenizer.h" #include "Cluster/MICluster.h" #include <vector> #if defined (_WIN32) #include <direct.h> #include <process.h> #endif #include <ctime> #include <boost/scoped_ptr.hpp> using namespace std; const int max_token_sequences = 1; void printDot(time_t &t) { time_t cur_time; time(&cur_time); if (cur_time - t >= 60) { cout << "."; t = cur_time; } } void printPercentage(int cur_count, int &prev_percentage, int total_count) { int percentage = static_cast<int>((cur_count / float(total_count)) * 100); if (percentage > prev_percentage) { if (percentage > 0) cout << "\b\b"; if (percentage > 10) cout << "\b"; cout << percentage << "%"; prev_percentage = percentage; } } void print100Percent(int percentage) { if (percentage < 100) { cout << "\b\b\b100%"; } } void runTokenizer(const char* param_file, const char* input_file, const char* output_file, const wchar_t* debug_filename) { static const std::string standaloneTokenizerBin = ParamReader::getParam("standalone_tokenizer_bin", "StandaloneTokenizer.exe "); string command = standaloneTokenizerBin+" "; command.append("\""); command.append(param_file); command.append("\""); command.append(" \""); command.append(input_file); command.append("\" \""); command.append(output_file); command.append("\" 1"); cout << "The tokenizer cmd is: " << command.c_str() << "\n"; if (system(command.c_str()) != 0) { cerr << "The tokenizer has failed on " << debug_filename << "\n"; } } int main(int argc, char **argv) { if (argc != 2) { cerr << "Cluster.exe should be invoked with a single argument, which provides a\n" << "path to the parameter file.\n"; return -1; } const int MAX_TOKEN_COUNT = 1000000; char tokens_file[500]; char temp_file[500]; try { time_t cur_time; time(&cur_time); cout << ctime(&cur_time); cout << "Initializing...\n"; const char* param_file = argv[1]; ParamReader::readParamFile(param_file); char document_filelist[500]; if(!ParamReader::getParam("cluster_document_filelist",document_filelist, 500)){ throw UnexpectedInputException( "Cluster::Main()", "Missing Parameter: cluster-document-filelist"); } bool skip_tokenization = ParamReader::isParamTrue("skip_tokenization"); bool make_lowercase = ParamReader::isParamTrue("make_tokens_lowercase"); if (make_lowercase && !skip_tokenization) { throw UnexpectedInputException( "Cluster::Main()", "make-tokens-lowercase can only be 'true' when skip-tokenization is also 'true'"); } if(!ParamReader::getParam("tokens_file", tokens_file, 500)){ throw UnexpectedInputException( "Cluster::Main()", "Missing Parameter: tokens-file"); } UTF8OutputStream tokenStream; if (skip_tokenization) { tokenStream.open(tokens_file); } else { if(!ParamReader::getParam("temp_file",temp_file, 500)){ throw UnexpectedInputException( "Cluster::Main()", "Missing Parameter: temp-file"); } } char outfile[500]; if(!ParamReader::getParam("cluster_outfile",outfile, 500)){ throw UnexpectedInputException( "Cluster::Main()", "Missing Parameter: cluster-outfile"); } char threshold_str[10]; if(!ParamReader::getParam("prune_threshold",threshold_str, 10)){ throw UnexpectedInputException( "Cluster::Main()", "Missing Parameter: prune-threshold"); } int threshold = atoi(threshold_str); char output_rare_words[10]; if(!ParamReader::getParam("output_rare_words",output_rare_words, 10)){ throw UnexpectedInputException( "Cluster::Main()", "Missing Parameter: output-rare-words"); } char rare_words_file[500]; if (strcmp(output_rare_words, "true") == 0) { if(!ParamReader::getParam("rare_words_file",rare_words_file, 500)){ throw UnexpectedInputException("Cluster::Main()", "Missing Parameter: rare-words-file"); } } char serif_style_cluster_output[10]; if(!ParamReader::getParam("serif_style_cluster_output", serif_style_cluster_output, 10)){ throw UnexpectedInputException( "Cluster::Main()", "Missing Parameter: serif-style-cluster-output"); } boost::scoped_ptr<UTF8InputStream> uis_scoped_ptr(UTF8InputStream::build()); UTF8InputStream& uis(*uis_scoped_ptr); char msg[1000]; if(uis.fail()){ strcpy(msg, "Couldn't open document file list: "); strcat(msg, document_filelist); throw UnexpectedInputException( "Cluster::Main()", msg); } wstring path; UTF8Token token; int token_counter = 0; int batch_counter = 0; uis.open(document_filelist); while (!uis.eof()) { uis.getLine(path); if (path.size() == 0) continue; Symbol path_sym = Symbol(path.c_str()); boost::scoped_ptr<UTF8InputStream> in_scoped_ptr(UTF8InputStream::build(path.c_str())); UTF8InputStream& in(*in_scoped_ptr); if (skip_tokenization) { wstring line; while (!in.eof()) { in.getLine(line); if (make_lowercase) { std::wstring::size_type length = line.length(); for (size_t i = 0; i < length; ++i) { line[i] = towlower(line[i]); } } tokenStream << line << L"\n"; } in.close(); } else { UTF8OutputStream temp(temp_file); batch_counter = 0; while (!in.eof()) { if (token_counter > MAX_TOKEN_COUNT) { temp.close(); batch_counter++; time(&cur_time); cout << ctime(&cur_time); cout << "Running Tokenizer on " << path_sym.to_debug_string() << ", batch # " << batch_counter << " consisting of 1 million words...\n"; runTokenizer(param_file, temp_file, tokens_file, path_sym.to_string()); token_counter = 0; temp.open(temp_file); } token_counter++; in >> token; if (token_counter > 1) temp << L" "; temp << token.chars(); } in.close(); temp.close(); if (token_counter > 0) { batch_counter++; time(&cur_time); cout << ctime(&cur_time); cout << "Running Tokenizer on " << path_sym.to_debug_string() << ", batch # " << batch_counter << " consisting of " << token_counter << " words...\n"; runTokenizer(param_file, temp_file, tokens_file, path_sym.to_string()); } } } uis.close(); if (skip_tokenization) tokenStream.close(); else remove(temp_file); int prev_percentage = -1; int cur_count = 0; int token_count = 0; time(&cur_time); cout << ctime(&cur_time); cout << "Counting the total number of words..."; uis.close(); boost::scoped_ptr<UTF8InputStream> tokensIn_scoped_ptr(UTF8InputStream::build()); UTF8InputStream& tokensIn(*tokensIn_scoped_ptr); tokensIn.open(tokens_file); if(tokensIn.fail()){ strcpy(msg, "Couldn't open tokens file: "); strcat(msg, document_filelist); throw UnexpectedInputException( "Cluster::Main()", msg); } while (!tokensIn.eof()) { tokensIn >> token; token_count++; } tokensIn.close(); cout << token_count << "\n"; time(&cur_time); cout << ctime(&cur_time); cout << "Adding counts..."; ReplaceLowFreq * replaceLowFreq = _new ReplaceLowFreq(); boost::scoped_ptr<UTF8InputStream> tokensIn2_scoped_ptr(UTF8InputStream::build()); UTF8InputStream& tokensIn2(*tokensIn2_scoped_ptr); tokensIn2.open(tokens_file); while (!tokensIn2.eof()) { tokensIn2 >> token; replaceLowFreq->addCounts(token.symValue()); cur_count++; printPercentage(cur_count, prev_percentage, token_count); } tokensIn2.close(); print100Percent(prev_percentage); cout << endl; time(&cur_time); cout << ctime(&cur_time); cout << "Pruning...\n"; if (strcmp(output_rare_words, "true") == 0) replaceLowFreq->pruneToThreshold(threshold, rare_words_file); else replaceLowFreq->pruneToThreshold(threshold); time(&cur_time); cout << ctime(&cur_time); cout << "Replacing low frequency words and Extracting Bigrams..."; cur_count = 0; prev_percentage = -1; ExtractBigrams * extractor = _new ExtractBigrams(); boost::scoped_ptr<UTF8InputStream> tokensIn3_scoped_ptr(UTF8InputStream::build()); UTF8InputStream& tokensIn3(*tokensIn3_scoped_ptr); tokensIn3.open(tokens_file); while (!tokensIn3.eof()) { wstring tokenized_sent; tokensIn3.getLine(tokenized_sent); vector<wstring> tokens; WSTokenizer::tokenize(tokenized_sent, tokens); vector <wstring> results = replaceLowFreq->doReplaceLowFreq(tokens); extractor->extractBigrams(results); cur_count = cur_count + static_cast<int>(tokens.size()); printPercentage(cur_count, prev_percentage, token_count); } tokensIn3.close(); print100Percent(prev_percentage); cout << endl; delete replaceLowFreq; time(&cur_time); cout << ctime(&cur_time); cout << "Loading bigrams..."; MICluster * cluster = _new MICluster(); cluster->loadVocabulary(extractor->getVocabulary()); ExtractBigrams::BigramCount * bigramCount = extractor->getBigrams(); for (ExtractBigrams::BigramCount::iterator iter = bigramCount->begin(); iter != bigramCount->end(); ++iter) { cluster->loadBigram((*iter).first._h, (*iter).first._f, (*iter).second); printDot(cur_time); } cout << endl; delete extractor; time(&cur_time); cout << ctime(&cur_time); cout << "Clustering...\n"; cluster->doClusters(outfile); delete cluster; remove(tokens_file); } catch (UnexpectedInputException& e){ cout<<e.getMessage()<<" in "<<e.getSource()<<endl; return -1; } catch (char * err) { cout << "Internal error.\n" << err << "\nExiting...\n"; remove(tokens_file); return -1; } catch (char const* err) { cout << "Internal error.\n" << err << "\nExiting...\n"; remove(tokens_file); return -1; } #ifdef ENABLE_LEAK_DETECTION ParamReader::finalize(); _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDOUT); _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT); _CrtDumpMemoryLeaks(); #endif #if defined(_DEBUG) || defined(_UNOPTIMIZED) printf("Press enter to exit....\n"); getchar(); #endif return 0; }
#include "Generic/common/leak_detection.h" #include "Generic/common/limits.h" #include "Generic/common/ParamReader.h" #include "Generic/common/UnrecoverableException.h" #include "Generic/common/UTF8InputStream.h" #include "Generic/common/UTF8OutputStream.h" #include "Generic/common/UTF8Token.h" #include "ReplaceLowFreq/ReplaceLowFreq.h" #include "ExtractBigrams/ExtractBigrams.h" #include "ExtractBigrams/WSTokenizer.h" #include "Cluster/MICluster.h" #include <vector> #if defined (_WIN32) #include <direct.h> #include <process.h> #endif #include <ctime> #include <boost/scoped_ptr.hpp> using namespace std; const int max_token_sequences = 1; void printDot(time_t &t) { time_t cur_time; time(&cur_time); if (cur_time - t >= 60) { cout << "."; t = cur_time; } } void printPercentage(int cur_count, int &prev_percentage, int total_count) { int percentage = static_cast<int>((cur_count / float(total_count)) * 100); if (percentage > prev_percentage) { if (percentage > 0) cout << "\b\b"; if (percentage > 10) cout << "\b"; cout << percentage << "%"; prev_percentage = percentage; } } void print100Percent(int percentage) { if (percentage < 100) { cout << "\b\b\b100%"; } } void runTokenizer(const char* param_file, const char* input_file, const char* output_file, const wchar_t* debug_filename) { static const std::string standaloneTokenizerBin = ParamReader::getParam("standalone_tokenizer_bin", "StandaloneTokenizer.exe "); string command = standaloneTokenizerBin+" "; command.append("\""); command.append(param_file); command.append("\""); command.append(" \""); command.append(input_file); command.append("\" \""); command.append(output_file); command.append("\" 1"); cout << "The tokenizer cmd is: " << command.c_str() << "\n"; if (system(command.c_str()) != 0) { cerr << "The tokenizer has failed on " << debug_filename << "\n"; } } int main(int argc, char **argv) { if (argc != 2) { cerr << "Cluster.exe should be invoked with a single argument, which provides a\n" << "path to the parameter file.\n"; return -1; } const int MAX_TOKEN_COUNT = 1000000; char tokens_file[500]; char temp_file[500]; try { time_t cur_time; time(&cur_time); cout << ctime(&cur_time); cout << "Initializing...\n"; const char* param_file = argv[1]; ParamReader::readParamFile(param_file); char document_filelist[500]; if(!ParamReader::getParam("cluster_document_filelist",document_filelist, 500)){ throw UnexpectedInputException( "Cluster::Main()", "Missing Parameter: cluster-document-filelist"); } bool skip_tokenization = ParamReader::isParamTrue("skip_tokenization"); bool make_lowercase = ParamReader::isParamTrue("make_tokens_lowercase"); if (make_lowercase && !skip_tokenization) { throw UnexpectedInputException( "Cluster::Main()", "make-tokens-lowercase can only be 'true' when skip-tokenization is also 'true'"); } if(!ParamReader::getParam("tokens_file", tokens_file, 500)){ throw UnexpectedInputException( "Cluster::Main()", "Missing Parameter: tokens-file"); } UTF8OutputStream tokenStream; if (skip_tokenization) { tokenStream.open(tokens_file); } else { if(!ParamReader::getParam("temp_file",temp_file, 500)){ throw UnexpectedInputException( "Cluster::Main()", "Missing Parameter: temp-file"); } } char outfile[500]; if(!ParamReader::getParam("cluster_outfile",outfile, 500)){ throw UnexpectedInputException( "Cluster::Main()", "Missing Parameter: cluster-outfile"); } char threshold_str[10]; if(!ParamReader::getParam("prune_threshold",threshold_str, 10)){ throw UnexpectedInputException( "Cluster::Main()", "Missing Parameter: prune-threshold"); } int threshold = atoi(threshold_str); char output_rare_words[10];
char rare_words_file[500]; if (strcmp(output_rare_words, "true") == 0) { if(!ParamReader::getParam("rare_words_file",rare_words_file, 500)){ throw UnexpectedInputException("Cluster::Main()", "Missing Parameter: rare-words-file"); } } char serif_style_cluster_output[10]; if(!ParamReader::getParam("serif_style_cluster_output", serif_style_cluster_output, 10)){ throw UnexpectedInputException( "Cluster::Main()", "Missing Parameter: serif-style-cluster-output"); } boost::scoped_ptr<UTF8InputStream> uis_scoped_ptr(UTF8InputStream::build()); UTF8InputStream& uis(*uis_scoped_ptr); char msg[1000]; if(uis.fail()){ strcpy(msg, "Couldn't open document file list: "); strcat(msg, document_filelist); throw UnexpectedInputException( "Cluster::Main()", msg); } wstring path; UTF8Token token; int token_counter = 0; int batch_counter = 0; uis.open(document_filelist); while (!uis.eof()) { uis.getLine(path); if (path.size() == 0) continue; Symbol path_sym = Symbol(path.c_str()); boost::scoped_ptr<UTF8InputStream> in_scoped_ptr(UTF8InputStream::build(path.c_str())); UTF8InputStream& in(*in_scoped_ptr); if (skip_tokenization) { wstring line; while (!in.eof()) { in.getLine(line); if (make_lowercase) { std::wstring::size_type length = line.length(); for (size_t i = 0; i < length; ++i) { line[i] = towlower(line[i]); } } tokenStream << line << L"\n"; } in.close(); } else { UTF8OutputStream temp(temp_file); batch_counter = 0; while (!in.eof()) { if (token_counter > MAX_TOKEN_COUNT) { temp.close(); batch_counter++; time(&cur_time); cout << ctime(&cur_time); cout << "Running Tokenizer on " << path_sym.to_debug_string() << ", batch # " << batch_counter << " consisting of 1 million words...\n"; runTokenizer(param_file, temp_file, tokens_file, path_sym.to_string()); token_counter = 0; temp.open(temp_file); } token_counter++; in >> token; if (token_counter > 1) temp << L" "; temp << token.chars(); } in.close(); temp.close(); if (token_counter > 0) { batch_counter++; time(&cur_time); cout << ctime(&cur_time); cout << "Running Tokenizer on " << path_sym.to_debug_string() << ", batch # " << batch_counter << " consisting of " << token_counter << " words...\n"; runTokenizer(param_file, temp_file, tokens_file, path_sym.to_string()); } } } uis.close(); if (skip_tokenization) tokenStream.close(); else remove(temp_file); int prev_percentage = -1; int cur_count = 0; int token_count = 0; time(&cur_time); cout << ctime(&cur_time); cout << "Counting the total number of words..."; uis.close(); boost::scoped_ptr<UTF8InputStream> tokensIn_scoped_ptr(UTF8InputStream::build()); UTF8InputStream& tokensIn(*tokensIn_scoped_ptr); tokensIn.open(tokens_file); if(tokensIn.fail()){ strcpy(msg, "Couldn't open tokens file: "); strcat(msg, document_filelist); throw UnexpectedInputException( "Cluster::Main()", msg); } while (!tokensIn.eof()) { tokensIn >> token; token_count++; } tokensIn.close(); cout << token_count << "\n"; time(&cur_time); cout << ctime(&cur_time); cout << "Adding counts..."; ReplaceLowFreq * replaceLowFreq = _new ReplaceLowFreq(); boost::scoped_ptr<UTF8InputStream> tokensIn2_scoped_ptr(UTF8InputStream::build()); UTF8InputStream& tokensIn2(*tokensIn2_scoped_ptr); tokensIn2.open(tokens_file); while (!tokensIn2.eof()) { tokensIn2 >> token; replaceLowFreq->addCounts(token.symValue()); cur_count++; printPercentage(cur_count, prev_percentage, token_count); } tokensIn2.close(); print100Percent(prev_percentage); cout << endl; time(&cur_time); cout << ctime(&cur_time); cout << "Pruning...\n"; if (strcmp(output_rare_words, "true") == 0) replaceLowFreq->pruneToThreshold(threshold, rare_words_file); else replaceLowFreq->pruneToThreshold(threshold); time(&cur_time); cout << ctime(&cur_time); cout << "Replacing low frequency words and Extracting Bigrams..."; cur_count = 0; prev_percentage = -1; ExtractBigrams * extractor = _new ExtractBigrams(); boost::scoped_ptr<UTF8InputStream> tokensIn3_scoped_ptr(UTF8InputStream::build()); UTF8InputStream& tokensIn3(*tokensIn3_scoped_ptr); tokensIn3.open(tokens_file); while (!tokensIn3.eof()) { wstring tokenized_sent; tokensIn3.getLine(tokenized_sent); vector<wstring> tokens; WSTokenizer::tokenize(tokenized_sent, tokens); vector <wstring> results = replaceLowFreq->doReplaceLowFreq(tokens); extractor->extractBigrams(results); cur_count = cur_count + static_cast<int>(tokens.size()); printPercentage(cur_count, prev_percentage, token_count); } tokensIn3.close(); print100Percent(prev_percentage); cout << endl; delete replaceLowFreq; time(&cur_time); cout << ctime(&cur_time); cout << "Loading bigrams..."; MICluster * cluster = _new MICluster(); cluster->loadVocabulary(extractor->getVocabulary()); ExtractBigrams::BigramCount * bigramCount = extractor->getBigrams(); for (ExtractBigrams::BigramCount::iterator iter = bigramCount->begin(); iter != bigramCount->end(); ++iter) { cluster->loadBigram((*iter).first._h, (*iter).first._f, (*iter).second); printDot(cur_time); } cout << endl; delete extractor; time(&cur_time); cout << ctime(&cur_time); cout << "Clustering...\n"; cluster->doClusters(outfile); delete cluster; remove(tokens_file); } catch (UnexpectedInputException& e){ cout<<e.getMessage()<<" in "<<e.getSource()<<endl; return -1; } catch (char * err) { cout << "Internal error.\n" << err << "\nExiting...\n"; remove(tokens_file); return -1; } catch (char const* err) { cout << "Internal error.\n" << err << "\nExiting...\n"; remove(tokens_file); return -1; } #ifdef ENABLE_LEAK_DETECTION ParamReader::finalize(); _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDOUT); _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT); _CrtDumpMemoryLeaks(); #endif #if defined(_DEBUG) || defined(_UNOPTIMIZED) printf("Press enter to exit....\n"); getchar(); #endif return 0; }
if(!ParamReader::getParam("output_rare_words",output_rare_words, 10)){ throw UnexpectedInputException( "Cluster::Main()", "Missing Parameter: output-rare-words"); }
if_condition
[ { "content": "\tclass const_iterator: public boost::iterator_facade<const_iterator, std::vector<ActorMention_ptr> const, boost::forward_traversal_tag> {\n\n\tprivate:\n\n\t\tfriend class boost::iterator_core_access;\n\n\t\tfriend class ActorMentionSet;\n\n\t\texplicit const_iterator(ActorMentionMap::const_iterator it): _base(it) {}\n\n\t\tvoid increment() { ++_base; }\n\n\t\tbool equal(const_iterator const& other) const { return _base==other._base; }\n\n\t\tstd::vector<ActorMention_ptr> const& dereference() const { return (*_base).second; }\n\n\t\tActorMentionMap::const_iterator _base;\n\n\t};\n\n\n\nprivate:\n\n\tActorMentionMap _actor_mentions;\n\n};\n\n\n\n#endif\n", "file_path": "src/Generic/theories/ActorMentionSet.h", "rank": 0, "score": 225970.07739994884 }, { "content": "\tclass SentenceTheory * getSentenceTheory(int i) const {return _docTheory->getSentenceTheory(i);}\n\n\tMention* getMention(MentionUID uid) const {return getSentenceTheory(Mention::getSentenceNumberFromUID(uid))->getMentionSet()->getMention(Mention::getIndexFromUID(uid)); }\n\n\tEntitySet* getEntitySet() const {return _docTheory->getEntitySet();}\n\n\tEntity* getEntity(int i) const {return _docTheory->getEntitySet()->getEntity(i);}\n\n\tEntity* getEntityByMention(const Mention* ment) const {return _docTheory->getEntityByMention(ment);}\n\n\tEntity* getEntityByMention(MentionUID uid) const {return _docTheory->getEntitySet()->getEntityByMention(uid);}\n\n\tEntity* getEntityByMention(MentionUID uid, EntityType type) const {\n\n\t\treturn _docTheory->getEntitySet()->getEntityByMention(uid, type);}\n\n\tDocument* getDocument() {return _docTheory->getDocument();}\n\n\n\n\t// convenience methods - ElfDocument\n\n\tstd::set<ElfRelation_ptr> get_relations(void) const {return _elfDoc->get_relations();}\n\n\tvoid remove_relations(const std::set<ElfRelation_ptr> & relations) {return _elfDoc->remove_relations(relations);}\n\n\tvoid remove_individuals(const ElfIndividualSet & individuals) {return _elfDoc->remove_individuals(individuals);}\n\n\tElfIndividual_ptr get_merged_individual_by_uri(const std::wstring & uri) const {return _elfDoc->get_merged_individual_by_uri(uri);}\n\n\tElfRelationMap get_relations_by_individual(const ElfIndividual_ptr search_ind) {return _elfDoc->get_relations_by_individual(search_ind);}\n\n\tElfIndividualSet get_individuals_by_type(const std::wstring & search_type = L\"\") {return _elfDoc->get_individuals_by_type(search_type);}\n\n\tElfIndividualSet get_merged_individuals_by_type(const std::wstring & search_type = L\"\") {return _elfDoc->get_merged_individuals_by_type(search_type);}\n\n\n\nprotected:\n", "file_path": "src/PredFinder/inference/EIDocData.h", "rank": 1, "score": 217234.46425133687 }, { "content": "\tclass _Alloc = std::allocator< std::pair<const _Key, _Tp> > >\n", "file_path": "src/Generic/common/std_hash.h", "rank": 2, "score": 205261.03909950837 }, { "content": "\tclass _Alloc = std::allocator< std::pair<const _Kty, _Ty> > >\n", "file_path": "src/Generic/common/std_hash.h", "rank": 3, "score": 205261.03909950837 }, { "content": "struct gemv_static_vector_if<Scalar,Size,Dynamic,true>\n\n{\n\n EIGEN_STRONG_INLINE Scalar* data() { return 0; }\n\n};\n\n\n\ntemplate<typename Scalar,int Size,int MaxSize>\n", "file_path": "src/LearnIt/Eigen/src/Core/Product.h", "rank": 4, "score": 197028.64908674953 }, { "content": "struct gemv_static_vector_if<Scalar,Size,MaxSize,true>\n\n{\n\n #if EIGEN_ALIGN_STATICALLY\n\n internal::plain_array<Scalar,EIGEN_SIZE_MIN_PREFER_FIXED(Size,MaxSize),0> m_data;\n\n EIGEN_STRONG_INLINE Scalar* data() { return m_data.array; }\n\n #else\n\n // Some architectures cannot align on the stack,\n\n // => let's manually enforce alignment by allocating more data and return the address of the first aligned element.\n\n enum {\n\n ForceAlignment = internal::packet_traits<Scalar>::Vectorizable,\n\n PacketSize = internal::packet_traits<Scalar>::size\n\n };\n\n internal::plain_array<Scalar,EIGEN_SIZE_MIN_PREFER_FIXED(Size,MaxSize)+(ForceAlignment?PacketSize:0),0> m_data;\n\n EIGEN_STRONG_INLINE Scalar* data() {\n\n return ForceAlignment\n\n ? reinterpret_cast<Scalar*>((reinterpret_cast<size_t>(m_data.array) & ~(size_t(15))) + 16)\n\n : m_data.array;\n\n }\n\n #endif\n\n};\n", "file_path": "src/LearnIt/Eigen/src/Core/Product.h", "rank": 5, "score": 193223.93964538386 }, { "content": "struct has_std_result_type {int a[2];};\n", "file_path": "src/LearnIt/Eigen/src/Core/util/Meta.h", "rank": 6, "score": 190351.68417070777 }, { "content": "\tclass SentenceTheory* getSentenceTheory(int i) const;\n\n\n\n\tSentenceTheoryBeam* getSentenceTheoryBeam(int i);\n\n\n\n\t/** Associates the given SentenceTheoryBeam with this \n\n\t * DocTheory's i-th Sentence. DocTheory takes\n\n\t * over sole ownership of the SentenceTheory. If the\n\n\t * DocTheory already had a SentenceTheoryBeam for this\n\n\t * sentence, then it is deleted.\n\n\t *\n\n\t * @param i the index of the Sentence the theory represents\n\n\t * @param theory a pointer to the theory to be set\n\n\t */\n\n\tvoid setSentenceTheoryBeam(int i, SentenceTheoryBeam *beam);\n\n\n\n\tconst SentenceTheoryBeam* getSentenceTheoryBeam(int i) const;\n\n\n\n\n\n\t/** Accessor to EntitySet of document theory:\n\n\t * This is kept up-to-date when new sentence theories\n", "file_path": "src/Generic/theories/DocTheory.h", "rank": 7, "score": 180964.82079723 }, { "content": "class BaseSegment : public std::map< Str_t, std::vector< serif_segment_internals::field_entry_t< Str_t > > > {\n\npublic:\n\n\t\n\n\t// attribute/value pair & containing mapping\n\n typedef serif_segment_internals::attributes_t< Str_t > attributes_t;\n\n\t\n\n\ttypedef serif_segment_internals::field_entry_t< Str_t > field_entry_t;\n\n\t\n\n\ttypedef std::vector< field_entry_t > field_entries_t;\n\n\t\n\n\ttypedef std::map< Str_t, field_entries_t > segment_t;\n\n\t\n\n\tBaseSegment() {}\n\n\t\n\n\t// Constructs from a serialized segment\n\n\tSERIF_EXPORTED BaseSegment( const Str_t & ) throw(UnexpectedInputException);\n\n\t\n\n\t// Constructs a segment with particular segment_attributes()\n\n\tBaseSegment( const attributes_t & a )\n\n\t\t: _seg_attr(a) {}\n", "file_path": "src/Generic/common/Segment.h", "rank": 8, "score": 178069.02956232027 }, { "content": " class vector<__VA_ARGS__, _Ay> \\\n\n : public vector<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > \\\n\n { \\\n\n typedef vector<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > vector_base; \\\n\n public: \\\n\n typedef __VA_ARGS__ value_type; \\\n\n typedef typename vector_base::allocator_type allocator_type; \\\n\n typedef typename vector_base::size_type size_type; \\\n\n typedef typename vector_base::iterator iterator; \\\n\n explicit vector(const allocator_type& a = allocator_type()) : vector_base(a) {} \\\n\n template<typename InputIterator> \\\n\n vector(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) : vector_base(first, last, a) {} \\\n\n vector(const vector& c) : vector_base(c) {} \\\n\n explicit vector(size_type num, const value_type& val = value_type()) : vector_base(num, val) {} \\\n\n vector(iterator start, iterator end) : vector_base(start, end) {} \\\n\n vector& operator=(const vector& x) { \\\n\n vector_base::operator=(x); \\\n\n return *this; \\\n\n } \\\n\n }; \\\n", "file_path": "src/LearnIt/Eigen/src/StlSupport/StdVector.h", "rank": 9, "score": 170315.08808486856 }, { "content": "class Argument; // Defined in \"Generic/theories/Argument.h\"\n", "file_path": "src/LearnIt/MatchInfo.h", "rank": 10, "score": 168427.42719285583 }, { "content": " class vector<T,EIGEN_ALIGNED_ALLOCATOR<T> >\n\n : public vector<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T),\n\n Eigen::aligned_allocator_indirection<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T)> >\n\n{\n\n typedef vector<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T),\n\n Eigen::aligned_allocator_indirection<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T)> > vector_base;\n\n EIGEN_STD_VECTOR_SPECIALIZATION_BODY\n\n\n\n void resize(size_type new_size)\n\n { resize(new_size, T()); }\n\n\n\n#if defined(_VECTOR_)\n\n // workaround MSVC std::vector implementation\n\n void resize(size_type new_size, const value_type& x)\n\n {\n\n if (vector_base::size() < new_size)\n\n vector_base::_Insert_n(vector_base::end(), new_size - vector_base::size(), x);\n\n else if (new_size < vector_base::size())\n\n vector_base::erase(vector_base::begin() + new_size, vector_base::end());\n\n }\n", "file_path": "src/LearnIt/Eigen/src/StlSupport/StdVector.h", "rank": 11, "score": 161474.90880144804 }, { "content": "struct CharOffset_tag { typedef int ValueType; };\n\ntypedef Offset<CharOffset_tag> CharOffset;\n\n\n\n/** Tag for EDT (Entity Detection and Tracking) offsets. EDT offsets are \n\n * similar to character offsets, except that the character \"\\r\" and any \n\n * string starting with \"<\" and ending with the matching \">\" are skipped \n\n * when counting offsets. */\n", "file_path": "src/Generic/common/Offset.h", "rank": 12, "score": 151833.03315831197 }, { "content": "\tclass DevNullStreamBuff: public std::basic_streambuf<C> {\n\n\t\ttypename std::char_traits<C>::int_type overflow(typename std::char_traits<C>::int_type c) { return c; }\n\n\t};\n\n\tDevNullStreamBuff<char> _CHAR_DEV_NULL;\n\n\tDevNullStreamBuff<wchar_t> _WCHAR_DEV_NULL;\n\n\n\n\tstd::ofstream *cout_file = 0;\n\n\tstd::ofstream *cerr_file = 0;\n\n\tstd::wofstream *wcout_file = 0;\n\n\tstd::wofstream *wcerr_file = 0;\n\n}\n\n\n\nvoid addModifyCommandLineHook(ModifyCommandLineHook_ptr hook) {\n\n\tcliHooks().push_back(hook);\n\n}\n\n\n\n//=======================================================================\n\n/** Run the standard SERIF command-line interface. This is typically \n\n * called by the main() method of each language-specific binary (such\n\n * as Serif_English/EnglishSerif.cpp). */\n", "file_path": "src/Generic/commandLineInterface/CommandLineInterface.cpp", "rank": 13, "score": 149531.21262331656 }, { "content": "\tclass IdVectorMap: public hash_map<KeyType, boost::shared_ptr<std::vector<IdType> >, HashOp, EqualOp> {};\n\n\n\n\tIdVectorMap<ActorId> associatedActorIds;\n\n\tIdVectorMap<SectorId> associatedSectorIds;\n\n\tIdVectorMap<Symbol> associatedSectorCodes;\n\n\n\n\ttemplate<typename IdType> \n\n\tboost::shared_ptr<std::vector<IdType> > &lookup(IdVectorMap<IdType> &idVectorMap, ActorId target, const char *date) {\n\n\t\tboost::shared_ptr<std::vector<IdType> > &result = idVectorMap[std::make_pair(target, date?date:\"\")];\n\n\t\t++(result?num_hits:num_misses);\n\n\t\tif ((!result) && (idVectorMap.size() > Cache::MAX_SIZE))\n\n\t\t\tidVectorMap.clear();\n\n\t\treturn result;\n\n\t}\n\n};\n\n\n\nActorInfo::ActorInfo(): _cache(0)\n\n{\n\n\t_cache = _new ActorInfo::Cache();\n\n}\n", "file_path": "src/ICEWS_LocRes_Branch/ActorInfo.cpp", "rank": 14, "score": 145309.7352022375 }, { "content": "\tclass IdVectorMap: public serif::hash_map<KeyType, boost::shared_ptr<std::vector<IdType> >, HashOp, EqualOp> {};\n\n\n\n\tIdVectorMap<ActorId> associatedActorIds;\n\n\tIdVectorMap<SectorId> associatedSectorIds;\n\n\tIdVectorMap<Symbol> associatedSectorCodes;\n\n\n\n\ttemplate<typename IdType> \n\n\tboost::shared_ptr<std::vector<IdType> > &lookup(IdVectorMap<IdType> &idVectorMap, ActorId target, const char *date) {\n\n\t\tboost::shared_ptr<std::vector<IdType> > &result = idVectorMap[std::make_pair(target, date?date:\"\")];\n\n\t\t++(result?num_hits:num_misses);\n\n\t\tif ((!result) && (idVectorMap.size() > Cache::MAX_SIZE))\n\n\t\t\tidVectorMap.clear();\n\n\t\treturn result;\n\n\t}\n\n};\n\n\n\nICEWSActorInfo::ICEWSActorInfo(): ActorInfo(), _cache(0)\n\n{\t\n\n\t_cache = _new ICEWSActorInfo::Cache();\n\n}\n", "file_path": "src/Generic/icews/ICEWSActorInfo.cpp", "rank": 15, "score": 142820.7222077406 }, { "content": "\tclass IdVectorMap: public serif::hash_map<KeyType, boost::shared_ptr<std::vector<IdType> >, HashOp, EqualOp> {};\n\n\n\n\tIdVectorMap<ActorId> associatedActorIds;\n\n\tIdVectorMap<ActorId> associatedCountryActorIds;\n\n\tIdVectorMap<ActorId> associatedLocationActorIds;\n\n\tIdVectorMap<SectorId> associatedSectorIds;\n\n\tIdVectorMap<CountryId> associatedCountryIds;\n\n\tIdVectorMap<Symbol> associatedSectorCodes;\n\n\n\n\ttemplate<typename IdType> \n\n\tboost::shared_ptr<std::vector<IdType> > &lookup(IdVectorMap<IdType> &idVectorMap, ActorId target, const char *date) {\n\n\t\tboost::shared_ptr<std::vector<IdType> > &result = idVectorMap[std::make_pair(target, date?date:\"\")];\n\n\t\tif ((!result) && (idVectorMap.size() > Cache::MAX_SIZE))\n\n\t\t\tidVectorMap.clear();\n\n\t\treturn result;\n\n\t}\n\n\n\n\tstatic const size_t MAX_SIZE = 1000;\n\n\n\n\tAgentId defaultPersonAgentId;\n", "file_path": "src/Generic/actors/AWAKEActorInfo.cpp", "rank": 16, "score": 142820.7222077406 }, { "content": "class Token;\n", "file_path": "src/Generic/tokens/DefaultTokenizer.cpp", "rank": 17, "score": 139599.80187929317 }, { "content": "class StringFactArgument : public FactArgument {\n\npublic:\n\n\tStringFactArgument(Symbol role, std::wstring str);\n\n\tStringFactArgument(const StringFactArgument &other);\n\n\tStringFactArgument(SerifXML::XMLTheoryElement elem, const DocTheory* theory=0);\n\n\tvirtual void saveXML(SerifXML::XMLTheoryElement elem, const Theory *context=0) const;\n\n\n\n\tstd::wstring getString() { return _string; }\n\n\n\nprivate:\n\n\tstd::wstring _string;\n\n};\n\ntypedef boost::shared_ptr<StringFactArgument> StringFactArgument_ptr;\n\n\n\n#endif \n", "file_path": "src/Generic/theories/FactArgument.h", "rank": 18, "score": 138666.55614957743 }, { "content": "struct matrix_swap_impl<MatrixTypeA, MatrixTypeB, true>\n\n{\n\n static inline void run(MatrixTypeA& a, MatrixTypeB& b)\n\n {\n\n static_cast<typename MatrixTypeA::Base&>(a).m_storage.swap(static_cast<typename MatrixTypeB::Base&>(b).m_storage);\n\n }\n\n};\n\n\n\n} // end namespace internal\n\n\n\n#endif // EIGEN_DENSESTORAGEBASE_H\n", "file_path": "src/LearnIt/Eigen/src/Core/PlainObjectBase.h", "rank": 19, "score": 136919.07186472535 }, { "content": "struct has_none {int a[1];};\n", "file_path": "src/LearnIt/Eigen/src/Core/util/Meta.h", "rank": 20, "score": 136704.22434483544 }, { "content": "class Argument;\n", "file_path": "src/Generic/patterns/ArgumentPattern.h", "rank": 21, "score": 133864.26047022076 }, { "content": "class TokenSequence; // defined in \"Generic/theories/TokenSequence.h\"\n", "file_path": "src/LearnIt/SlotFiller.h", "rank": 22, "score": 130335.37351228422 }, { "content": "class TokenSpanReturnPFeature: public ReturnPatternFeature {\n\nprivate:\n\n\tTokenSpanReturnPFeature(Pattern_ptr pattern, int sent_no, int start_token, int end_token, const LanguageVariant_ptr& languageVariant)\n\n\t\t: ReturnPatternFeature(pattern,languageVariant), _sent_no(sent_no), _start_token(start_token), _end_token(end_token) {}\n\n\tBOOST_MAKE_SHARED_5ARG_CONSTRUCTOR(TokenSpanReturnPFeature, Pattern_ptr, int, int, int, const LanguageVariant_ptr&);\n\n\tTokenSpanReturnPFeature(Symbol returnLabel, int sent_no, int start_token, int end_token, const LanguageVariant_ptr& languageVariant)\n\n\t\t: ReturnPatternFeature(returnLabel,languageVariant), _sent_no(sent_no), _start_token(start_token), _end_token(end_token) {}\n\n\tBOOST_MAKE_SHARED_5ARG_CONSTRUCTOR(TokenSpanReturnPFeature, Symbol, int, int, int, const LanguageVariant_ptr&);\n\n\t\n\n\tTokenSpanReturnPFeature(Pattern_ptr pattern, int sent_no, int start_token, int end_token)\n\n\t\t: ReturnPatternFeature(pattern), _sent_no(sent_no), _start_token(start_token), _end_token(end_token) {}\n\n\tBOOST_MAKE_SHARED_4ARG_CONSTRUCTOR(TokenSpanReturnPFeature, Pattern_ptr, int, int, int);\n\n\tTokenSpanReturnPFeature(Symbol returnLabel, int sent_no, int start_token, int end_token)\n\n\t\t: ReturnPatternFeature(returnLabel), _sent_no(sent_no), _start_token(start_token), _end_token(end_token) {}\n\n\tBOOST_MAKE_SHARED_4ARG_CONSTRUCTOR(TokenSpanReturnPFeature, Symbol, int, int, int);\n\npublic:\n\n\tint getSentenceNumber() const { return _sent_no; }\n\n\tvirtual int getStartToken() const { return _start_token; }\n\n\tvirtual int getEndToken() const { return _end_token; }\n\n\tvirtual void setCoverage(const DocTheory * docTheory) { /* do nothing*/ }\n", "file_path": "src/Generic/patterns/features/ReturnPFeature.h", "rank": 23, "score": 127546.3538055391 }, { "content": "// XX WARNING -- STATE SAVER DOES NOT CURRENTLY SAVE CHARACTER OFFSETS!\n\nclass LexicalToken :public Token {\n\npublic:\n\n\t// [xx] should this require an original_token_index arg?\n\n\t/** Create a new token from a LocatedString, starting at begin_pos\n\n\t * (inclusive) and extending through end_pos (inclusive). The new\n\n\t * Token's symbol value is copied from the LocatedString. All offset\n\n\t * information is automatically set based on the LocatedString. */\n\n\tLexicalToken(const LocatedString *locString, int begin_pos, int end_pos) \n\n\t\t: Token(locString, begin_pos, end_pos), _original_token_index(0) {} \n\n\n\n\t// [xx] should this require an original_token_index arg?\n\n\t/** Create a new token from a substring of a located string, but set\n\n\t * the symbol for the new token manually (rather than copying it from\n\n\t * the located string. All offset information is automatically set\n\n\t * based on the LocatedString. */\n\n\tLexicalToken(const LocatedString *locString, int begin_pos, int end_pos, const Symbol &symbol) \n\n\t\t: Token(locString, begin_pos, end_pos, symbol), _original_token_index(0) {} \n\n\n\n\t/** Create a token with a given symbol value, whose offsets are undefined.\n\n\t * This constructor should only be used if the resulting token's offsets\n", "file_path": "src/Generic/theories/LexicalToken.h", "rank": 24, "score": 126440.1620548222 }, { "content": "class TokenSequence;\n\n\n", "file_path": "src/English/timex/TemporalString.h", "rank": 25, "score": 125937.14141620448 }, { "content": "class Argument(TheoryObject):\n\n \"\"\"@see: ``Serif/Generic/theories/Argument.cpp``\"\"\"\n\n\n\n #{ Argument.Type Enumeration\n\n MENTION_ARG = 'MENTION_ARG'; TEXT_ARG = 'TEXT_ARG'\n\n PROPOSITION_ARG = 'PROPOSITION_ARG'\n\n Type = (MENTION_ARG, PROPOSITION_ARG, TEXT_ARG)\n\n #}\n\n\n\n def _load(self, state_loader):\n\n self.type = self.Type[state_loader.load_integer()]\n\n self.role_sym = state_loader.load_symbol()\n\n if self.type == self.MENTION_ARG:\n\n self.mention_index = state_loader.load_integer()\n\n elif self.type == self.PROPOSITION_ARG:\n\n self.prop = state_loader.load_pointer()\n\n elif self.type == self.TEXT_ARG:\n\n self.node = state_loader.load_pointer()\n\n\n\n _mention_set = None # set by SentenceTheory._load().\n\n\n\n @property\n\n def mention(self):\n\n if getattr(self, 'mention_index', None) is not None:\n\n return self._mention_set.mentions[self.mention_index]\n\n else:\n\n return None\n\n\n\n def __repr__(self):\n\n if self.type == self.MENTION_ARG:\n\n return '%r' % ' '.join(self.mention.node.leaves)\n\n elif self.type == self.PROPOSITION_ARG:\n\n return '%r' % ' '.join(self.prop.node.leaves)\n\n elif self.type == self.TEXT_ARG:\n", "file_path": "python/statefile.py", "rank": 26, "score": 122734.52351747834 }, { "content": "class Argument(SerifTheory):\n\n role = _SimpleAttribute(default='')\n\n mention = _ReferenceAttribute('mention_id', cls=Mention)\n\n syn_node = _ReferenceAttribute('syn_node_id', cls=SynNode)\n\n proposition = _ReferenceAttribute('proposition_id', cls=Proposition)\n\n\n\n value = property(\n\n lambda self: self.mention or self.syn_node or self.proposition)\n\n\n\n def _get_summary(self):\n", "file_path": "python/serifxml3.py", "rank": 27, "score": 122727.07158275892 }, { "content": "class Argument(SerifTheory):\n\n role = _SimpleAttribute(default='')\n\n mention = _ReferenceAttribute('mention_id', cls=Mention)\n\n syn_node = _ReferenceAttribute('syn_node_id', cls=SynNode)\n\n proposition = _ReferenceAttribute('proposition_id', cls=Proposition)\n\n\n\n value = property(\n\n lambda self: self.mention or self.syn_node or self.proposition)\n\n\n\n def _get_summary(self):\n", "file_path": "python/serifxml.py", "rank": 28, "score": 122727.07158275892 }, { "content": "class Token(TheoryObject):\n\n \"\"\"@see: ``Serif/Generic/theories/Token.cpp``\"\"\"\n\n def _load(self, state_loader):\n\n self.symbol = state_loader.load_symbol()\n\n self.start_offset = state_loader.load_integer()\n\n self.end_offset = state_loader.load_integer()\n\n\n\n def __repr__(self):\n\n reprstring = '%r' % self.symbol\n\n if reprstring[0] == 'u': reprstring = reprstring[1:]\n", "file_path": "python/statefile.py", "rank": 29, "score": 122645.94138225028 }, { "content": "//\n\n// You should have received a copy of the GNU Lesser General Public\n\n// License and a copy of the GNU General Public License along with\n\n// Eigen. If not, see <http://www.gnu.org/licenses/>.\n\n\n\n#ifndef EIGEN_STDVECTOR_H\n\n#define EIGEN_STDVECTOR_H\n\n\n\n#include \"Eigen/src/StlSupport/details.h\"\n\n\n\n// Define the explicit instantiation (e.g. necessary for the Intel compiler)\n\n#if defined(__INTEL_COMPILER) || defined(__GNUC__)\n\n #define EIGEN_EXPLICIT_STL_VECTOR_INSTANTIATION(...) template class std::vector<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> >;\n\n#else\n\n #define EIGEN_EXPLICIT_STL_VECTOR_INSTANTIATION(...)\n\n#endif\n\n\n\n/**\n\n * This section contains a convenience MACRO which allows an easy specialization of\n\n * std::vector such that for data types with alignment issues the correct allocator\n\n * is used automatically.\n\n */\n\n#define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) \\\n\nEIGEN_EXPLICIT_STL_VECTOR_INSTANTIATION(__VA_ARGS__) \\\n\nnamespace std \\\n\n{ \\\n\n template<typename _Ay> \\\n", "file_path": "src/LearnIt/Eigen/src/StlSupport/StdVector.h", "rank": 30, "score": 122645.84201227287 }, { "content": " void push_back(const value_type& x)\n\n { vector_base::push_back(x); } \n\n using vector_base::insert; \n\n iterator insert(const_iterator position, const value_type& x)\n\n { return vector_base::insert(position,x); }\n\n void insert(const_iterator position, size_type new_size, const value_type& x)\n\n { vector_base::insert(position, new_size, x); }\n\n#elif defined(_GLIBCXX_VECTOR) && (!(EIGEN_GNUC_AT_LEAST(4,1)))\n\n /* Note that before gcc-4.1 we already have: std::vector::resize(size_type,const T&).\n\n * However, this specialization is still needed to make the above EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION trick to work. */\n\n void resize(size_type new_size, const value_type& x)\n\n {\n\n vector_base::resize(new_size,x);\n\n }\n\n#elif defined(_GLIBCXX_VECTOR) && EIGEN_GNUC_AT_LEAST(4,2)\n\n // workaround GCC std::vector implementation\n\n void resize(size_type new_size, const value_type& x)\n\n {\n\n if (new_size < vector_base::size())\n\n vector_base::_M_erase_at_end(this->_M_impl._M_start + new_size);\n", "file_path": "src/LearnIt/Eigen/src/StlSupport/StdVector.h", "rank": 31, "score": 122642.29737743821 }, { "content": "class Token(SerifTokenTheory):\n\n # note: default value for text is extracted from the original string.\n\n text = _TextOfElement(strip=True)\n\n lexical_entries = _ReferenceListAttribute('lexical_entries',\n\n cls='LexicalEntry')\n", "file_path": "python/serifxml.py", "rank": 32, "score": 122638.56904826435 }, { "content": "class Token(SerifTokenTheory):\n\n # note: default value for text is extracted from the original string.\n\n text = _TextOfElement(strip=True)\n\n lexical_entries = _ReferenceListAttribute('lexical_entries',\n\n cls='LexicalEntry')\n", "file_path": "python/serifxml3.py", "rank": 33, "score": 122638.56904826435 }, { "content": "}\n\n\n\nnamespace std {\n\n\n\n#define EIGEN_STD_VECTOR_SPECIALIZATION_BODY \\\n\n public: \\\n\n typedef T value_type; \\\n\n typedef typename vector_base::allocator_type allocator_type; \\\n\n typedef typename vector_base::size_type size_type; \\\n\n typedef typename vector_base::iterator iterator; \\\n\n typedef typename vector_base::const_iterator const_iterator; \\\n\n explicit vector(const allocator_type& a = allocator_type()) : vector_base(a) {} \\\n\n template<typename InputIterator> \\\n\n vector(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) \\\n\n : vector_base(first, last, a) {} \\\n\n vector(const vector& c) : vector_base(c) {} \\\n\n explicit vector(size_type num, const value_type& val = value_type()) : vector_base(num, val) {} \\\n\n vector(iterator start, iterator end) : vector_base(start, end) {} \\\n\n vector& operator=(const vector& x) { \\\n\n vector_base::operator=(x); \\\n\n return *this; \\\n\n }\n\n\n\n template<typename T>\n", "file_path": "src/LearnIt/Eigen/src/StlSupport/StdVector.h", "rank": 34, "score": 122632.69788524452 }, { "content": " else\n\n vector_base::insert(vector_base::end(), new_size - vector_base::size(), x);\n\n }\n\n#else\n\n // either GCC 4.1 or non-GCC\n\n // default implementation which should always work.\n\n void resize(size_type new_size, const value_type& x)\n\n {\n\n if (new_size < vector_base::size())\n\n vector_base::erase(vector_base::begin() + new_size, vector_base::end());\n\n else if (new_size > vector_base::size())\n\n vector_base::insert(vector_base::end(), new_size - vector_base::size(), x);\n\n }\n\n#endif\n\n };\n\n}\n\n\n\n#endif // EIGEN_STDVECTOR_H\n", "file_path": "src/LearnIt/Eigen/src/StlSupport/StdVector.h", "rank": 35, "score": 122627.98365265662 }, { "content": "// This file is part of Eigen, a lightweight C++ template library\n\n// for linear algebra.\n\n//\n\n// Copyright (C) 2009 Gael Guennebaud <[email protected]>\n\n// Copyright (C) 2009 Hauke Heibel <[email protected]>\n\n//\n\n// Eigen is free software; you can redistribute it and/or\n\n// modify it under the terms of the GNU Lesser General Public\n\n// License as published by the Free Software Foundation; either\n\n// version 3 of the License, or (at your option) any later version.\n\n//\n\n// Alternatively, you can redistribute it and/or\n\n// modify it under the terms of the GNU General Public License as\n\n// published by the Free Software Foundation; either version 2 of\n\n// the License, or (at your option) any later version.\n\n//\n\n// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY\n\n// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n\n// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the\n\n// GNU General Public License for more details.\n", "file_path": "src/LearnIt/Eigen/src/StlSupport/StdVector.h", "rank": 36, "score": 122617.88086660022 }, { "content": "class LocatedString;\n\n\n\n#define MAX_SUBSTITUTION_MAP_SIZE 300\n\n\n\n/**\n\n * A map of Symbol substitutions that should be made on a\n\n * token sequence as it is created by a tokenizer.\n\n *\n\n * @author David A. Herman\n\n */\n", "file_path": "src/Generic/tokens/SymbolSubstitutionMap.h", "rank": 37, "score": 122489.34986544627 }, { "content": "documentation, including modifications that you make for internal \\n\\\n", "file_path": "src/Generic/wordnet/license.h", "rank": 38, "score": 121134.84367625028 }, { "content": " void *token; /* Copy of SubProgram.token */\n", "file_path": "src/Generic/sqlite/sqlite3.c", "rank": 39, "score": 121007.51712048432 }, { "content": "class Argument;\n", "file_path": "src/LearnIt/SlotFiller.h", "rank": 40, "score": 120253.90749390557 }, { "content": "class Token;\n\n\n\n// Currently, the default Transliterator factory raises an exception\n\n// saying that the \"Transliterator\" feature module is required. Should\n\n// we instead return a Transliterator that always returns empty strings?\n\n\n\n/** Interface for transliterators, which transliterate (or translate)\n\n * languages from their native language into English strings. */\n", "file_path": "src/Generic/transliterate/Transliterator.h", "rank": 41, "score": 120157.72740908046 }, { "content": "BSP_DECLARE(DistillationDoc)\n\n\n", "file_path": "src/LearnIt/util/FileUtilities.h", "rank": 42, "score": 119544.00546914933 }, { "content": "\tclass const_iterator; // defined below.\n\n\ttypedef const_iterator iterator;\n\n\n\n\t/** Return an iterator pointing to the first actor mention vector in this set. */\n\n\tconst_iterator begin() const { return const_iterator(_actor_mentions.begin()); }\n\n\n\n\t/** Return an iterator pointing just past the last actor mention vector in this set. */\n\n\tconst_iterator end() const { return const_iterator(_actor_mentions.end()); }\n\n\n\n\t/** Return the ActorMention for the given mention (or a \"null\" shared_ptr, if\n\n\t * no ActorMention with the specified Mention::UID is in this set). Throws\n\n\t * an exception if there are multiple entries for this mention UID. */\n\n\tActorMention_ptr find(MentionUID mention_uid) const;\n\n\n\n\t/** Rerun all the ActorMentions for the given mention */\n\n\tstd::vector<ActorMention_ptr> findAll(MentionUID mention_uid) const;\n\n\n\n\t/** Return a vector containing all ActorMentions in this set */\n\n\tstd::vector<ActorMention_ptr> getAll() const;\n\n\n", "file_path": "src/Generic/theories/ActorMentionSet.h", "rank": 43, "score": 119377.96227698654 }, { "content": "class TokenSequence;\n", "file_path": "src/Generic/events/stat/EventArgumentFinder.h", "rank": 44, "score": 119239.61538192534 }, { "content": "class LocatedString;\n", "file_path": "src/Generic/sentences/StatSentBreakerTokens.h", "rank": 45, "score": 119225.30871444315 }, { "content": "class Argument;\n", "file_path": "src/Generic/patterns/MentionPattern.h", "rank": 46, "score": 118319.74931146184 }, { "content": "class Argument;\n", "file_path": "src/Generic/patterns/PatternTypes.h", "rank": 47, "score": 118319.74931146184 }, { "content": "class Argument;\n", "file_path": "src/Generic/icews/TenseDetection.h", "rank": 48, "score": 118319.74931146184 }, { "content": "class Token;\n", "file_path": "src/Korean/parse/kr_Parser.h", "rank": 49, "score": 118226.32706278958 }, { "content": "class Token;\n\n\n", "file_path": "src/Generic/morphSelection/Retokenizer.h", "rank": 50, "score": 118226.32706278958 }, { "content": "class Token;\n", "file_path": "src/Generic/events/EventFinder.h", "rank": 51, "score": 118226.32706278958 }, { "content": "class Token;\n\n\n", "file_path": "src/Korean/morphology/kr_Klex.h", "rank": 52, "score": 118226.32706278958 }, { "content": "class Token;\n", "file_path": "src/Arabic/parse/ar_Parser.h", "rank": 53, "score": 118226.32706278958 }, { "content": " EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)\n", "file_path": "src/LearnIt/Eigen/src/Core/Assign.h", "rank": 54, "score": 118118.67082526331 }, { "content": " EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a) const { return a / m_other; }\n", "file_path": "src/LearnIt/Eigen/src/Core/Functors.h", "rank": 55, "score": 118076.99487974079 }, { "content": "EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar\n\nMatrixBase<Derived>::trace() const\n\n{\n\n return derived().diagonal().sum();\n", "file_path": "src/LearnIt/Eigen/src/Core/Redux.h", "rank": 56, "score": 118076.99487974079 }, { "content": " inline const Scalar& coeffRef(Index index) const\n\n {\n\n return derived().nestedExpression().coeffRef(index);\n", "file_path": "src/LearnIt/Eigen/src/Core/Transpose.h", "rank": 57, "score": 118076.99487974079 }, { "content": " const ExpressionType& _expression() const { return m_matrix; }\n", "file_path": "src/LearnIt/Eigen/src/Core/Flagged.h", "rank": 58, "score": 118076.99487974079 }, { "content": " RealScalar threshold = maxAbsOnLowerPart * prec;\n", "file_path": "src/LearnIt/Eigen/src/Core/TriangularMatrix.h", "rank": 59, "score": 116719.8012722916 }, { "content": "namespace std\n\n{\n\n EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(real,scalar_real_op)\n\n EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(imag,scalar_imag_op)\n\n EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(sin,scalar_sin_op)\n\n EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(cos,scalar_cos_op)\n\n EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(asin,scalar_asin_op)\n\n EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(acos,scalar_acos_op)\n\n EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(tan,scalar_tan_op)\n\n EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(exp,scalar_exp_op)\n\n EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(log,scalar_log_op)\n\n EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(abs,scalar_abs_op)\n\n EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(sqrt,scalar_sqrt_op)\n\n\n\n template<typename Derived>\n\n inline const Eigen::CwiseUnaryOp<Eigen::internal::scalar_pow_op<typename Derived::Scalar>, const Derived>\n\n pow(const Eigen::ArrayBase<Derived>& x, const typename Derived::Scalar& exponent) { \\\n\n return x.derived().pow(exponent); \\\n\n }\n", "file_path": "src/LearnIt/Eigen/src/Core/GlobalFunctions.h", "rank": 60, "score": 116694.64941174866 }, { "content": " using std::max;\n", "file_path": "src/LearnIt/Eigen/src/Core/StableNorm.h", "rank": 61, "score": 116694.64941174866 }, { "content": "inline const Block<const Derived> bottomLeftCorner(Index cRows, Index cCols) const\n\n{\n\n return Block<const Derived>(derived(), rows() - cRows, 0, cRows, cCols);\n", "file_path": "src/LearnIt/Eigen/src/plugins/BlockMethods.h", "rank": 62, "score": 116686.18097706123 }, { "content": " const Minor<Derived> minor(Index row, Index col) const;\n", "file_path": "src/LearnIt/Eigen/src/Core/MatrixBase.h", "rank": 63, "score": 116678.76108664574 }, { "content": "#include \"Generic/common/Symbol.h\"\n\n#include \"Generic/theories/Mention.h\"\n\nclass Argument;\n", "file_path": "src/Generic/relations/PotentialRelationInstance.h", "rank": 64, "score": 116502.91979697003 }, { "content": "// Copyright 2008 by BBN Technologies Corp.\n\n// All Rights Reserved.\n\n\n\n#include \"Generic/common/leak_detection.h\"\n\n\n\n#include \"Generic/common/UTF8InputStream.h\"\n\n#include \"Generic/common/ParamReader.h\"\n\n\n\n#include <iostream>\n\n\n\nusing namespace std;\n\n\n\n\n\nint main (int argc, char *argv[]) {\n\n\n\n\tif (argc != 2) {\n\n\t\tcerr << \"ArabicSerif.exe sould be invoked with a single argument, which provides a\\n\"\n\n\t\t\t << \"path to the parameter file.\\n\";\n\n\t\treturn -1;\n\n\t}\n\n\n\n\tParamReader::readParamFile(argv[1]);\n\n\n\n\tcout << \"So far so good....\\n\";\n\n\n\n\treturn 0;\n\n}\n", "file_path": "src/Arabic/driver/ar_main.cpp", "rank": 65, "score": 89.61256705855739 }, { "content": "\n\n#ifdef DO_SERIF_PROFILING\n\n#include \"Generic/common/GenericTimer.h\"\n\n\n\nGenericTimer totalLoadTimer;\n\nGenericTimer totalProcessTimer;\n\n#endif\n\n\n\n\n\nusing namespace std;\n\n\n\nint main(int argc, char **argv) {\n\n\n\n\tif (argc != 2) {\n\n\t\tcerr << \"PIdfTrainer.exe sould be invoked with a single argument, which provides a\\n\"\n\n\t\t\t<< \"path to the parameter file.\\n\";\n\n\t\treturn -1;\n\n\t}\n\n\n\n\ttry {\n", "file_path": "src/PIdFTrainer/PIdFTrainerMain.cpp", "rank": 67, "score": 87.12333869618317 }, { "content": "//\t#else\n\n//\t\t#error \"Add a case for your langauge here!\" \n\n//\t#endif\n\n\treturn true;\n\n}\n\n\n\nint main(int argc, char **argv) {\n\n\tif (argc != 2) {\n\n\t\tcerr << argv[0] << \"should be invoked with a single argument, which provides a\\n\"\n\n\t\t\t<< \"path to the parameter file.\\n\";\n\n\t\treturn -1;\n\n\t}\n\n\tstd::cerr << \"Serif XML Server starting up\" << std::endl;\n\n\tSerifXMLServer(argv[1], 8080).run();\n\n\tstd::cerr << \"Serif XML Server shutting down\" << std::endl;\n\n return 0;\n\n}\n", "file_path": "src/SerifHTTPServer/SerifXMLServer.cpp", "rank": 68, "score": 83.63877350751564 }, { "content": "using namespace std;\n\n\n\nint main(int argc, char **argv) {\n\n\tif (argc != 2) {\n\n\t\tcerr << \"MaxEntSimulatedActiveLearningMain.exe sould be invoked with a single argument, which provides a\\n\"\n\n\t\t\t<< \"path to the parameter file.\\n\";\n\n\t\treturn -1;\n\n\t}\n\n\n\n\ttry {\n\n\t\tParamReader::readParamFile(argv[1]);\n\n\n\n\t\t// Load modules specified in the parameter file.\n\n\t\tFeatureModule::load();\n\n\n\n/*\t\tInstanceSetTester tester;\n\n\t\ttester.runTest();\n\n\t\texit(0);\n\n*/\n\n\n", "file_path": "src/MaxEntSimulatedActiveLearning/MaxEntSALRelationMain.cpp", "rank": 69, "score": 81.83197326453146 }, { "content": "// Copyright 2008 by BBN Technologies Corp.\n\n// All Rights Reserved.\n\n\n\n#include \"Generic/common/leak_detection.h\"\n\n\n\n#include \"Generic/common/UnrecoverableException.h\"\n\n#include \"Generic/common/FileSessionLogger.h\"\n\n#include \"Generic/common/ParamReader.h\"\n\n#include \"Generic/sentences/StatSentBreakerTrainer.h\"\n\n\n\n#include <iostream>\n\n\n\n\n\nusing namespace std;\n\n\n\n\n\nint main(int argc, char **argv) {\n\n\tif (argc != 2) {\n\n\t\tcerr << \"StatSentBreakerTrainer.exe sould be invoked with a single argument, which provides a\\n\"\n\n\t\t\t<< \"path to the parameter file.\\n\";\n", "file_path": "src/StatSentBreakerTrainer/StatSentBreakerMain.cpp", "rank": 70, "score": 81.08792447829603 }, { "content": "#ifdef Boost_PROGRAM_OPTIONS_FOUND\n\n#define USE_BOOST_LIBS\n\n#include <boost/program_options.hpp>\n\n#include <boost/regex.hpp>\n\n#endif\n\n#endif\n\n\n\n\n\nusing namespace std;\n\n\n\n//=======================================================================\n\n// Forward-delcarations for file-local helper functions.\n\nnamespace {\n\n\tstd::vector<ModifyCommandLineHook_ptr> &cliHooks();\n\n\tvoid initializeLeakDetection();\n\n\tvoid checkForLeaks();\n\n\tvoid displayVersionAndCopyright();\n\n\tbool parseCommandLine(int argc, const char **argv,\n\n\t\t\t\t\t\t // output parameters:\n\n\t\t\t\t\t\t string &parfile, map<string,string> &overrides,\n", "file_path": "src/Generic/commandLineInterface/CommandLineInterface.cpp", "rank": 71, "score": 80.75309500360444 }, { "content": "using namespace std;\n\n\n\n\n\nint main(int argc, char **argv) {\n\n\tif (argc != 2) {\n\n\t\tcerr << \"PNPChunkTrainer.exe sould be invoked with a single argument, which provides a\\n\"\n\n\t\t\t<< \"path to the parameter file.\\n\";\n\n\t\treturn -1;\n\n\t}\n\n\n\n\ttry {\n\n\t\tParamReader::readParamFile(argv[1]);\n\n\n\n\t\tchar buffer[500];\n\n\t\tParamReader::getRequiredParam(\"pnpchunk_trainer_standalone_mode\", buffer, 500);\n\n\n\n\t\tif (strcmp(buffer, \"train\") == 0) {\n\n\t\t\tPNPChunkTrainer trainer;\n\n\t\t\ttrainer.train();\n\n\t\t}\n", "file_path": "src/PNPChunkTrainer/PNPChunkTrainer.cpp", "rank": 72, "score": 80.38333239352808 }, { "content": "// Copyright 2008 by BBN Technologies Corp.\n\n// All Rights Reserved.\n\n\n\n#include \"Generic/common/leak_detection.h\"\n\n\n\n#include \"Generic/common/UnrecoverableException.h\"\n\n#include \"Generic/common/ParamReader.h\"\n\n#include \"Generic/common/HeapChecker.h\"\n\n#include \"Generic/common/FileSessionLogger.h\"\n\n#include \"Generic/relations/discmodel/P1RelationTrainer.h\"\n\n\n\nusing namespace std;\n\n\n\n\n\nint main(int argc, char **argv) {\n\n\tif (argc != 2) {\n\n\t\tcerr << \"P1RelationTrainer.exe sould be invoked with a single argument, which provides a\\n\"\n\n\t\t\t<< \"path to the parameter file.\\n\";\n\n\t\treturn -1;\n\n\t}\n", "file_path": "src/P1RelationTrainer/P1RelationTrainerMain.cpp", "rank": 73, "score": 80.2179176673816 }, { "content": "\texpandMacrosHelper(search_path, include_once, use_quotes, use_hash_comments, encrypted, defined_symbols, files_to_skip, 0);\n\n}\n\n\n\n// Returns a pointer to the replacement value, and also modifies in place.\n\nvoid Sexp::expandMacrosHelper(std::vector<std::string> *search_path, \n\n\t\t\t\t\t\t\t bool include_once, bool use_quotes, \n\n\t\t\t\t\t\t\t bool use_hash_comments, bool encrypted,\n\n\t\t\t\t\t\t\t std::set<Symbol> &defined_symbols,\n\n\t\t\t\t\t\t\t std::set<Symbol> &files_to_skip,\n\n\t\t\t\t\t\t\t int depth) {\n\n\tstatic const bool debug = true;\n\n\tif (_type != LIST)\n\n\t\treturn;\n\n\n\n\t#ifdef DEBUG_SEXP_MACROS\n\n\t\tfor (int i=0; i<depth; ++i) std::cout<<\" \";\n\n\t\tstd::cout << \"Before macros: \" << to_debug_string() << std::endl;\n\n\t#endif\n\n\tSexp **ptr_to_child = &_children;\n\n\twhile (*ptr_to_child) {\n", "file_path": "src/Generic/common/Sexp.cpp", "rank": 74, "score": 79.76664014483536 }, { "content": "// Copyright 2008 by BBN Technologies Corp.\n\n// All Rights Reserved.\n\n\n\n#include \"Generic/common/leak_detection.h\"\n\n\n\n#include \"Generic/common/UnrecoverableException.h\"\n\n#include \"Generic/common/ParamReader.h\"\n\n#include \"Generic/common/HeapChecker.h\"\n\n#include \"Generic/common/FileSessionLogger.h\"\n\n#include \"Generic/docRelationsEvents/RelationTimexArgFinder.h\"\n\n\n\nusing namespace std;\n\n\n\n\n\nint main(int argc, char **argv) {\n\n\tif (argc != 2) {\n\n\t\tcerr << \"RelationTimexArgFinder.exe sould be invoked with a single argument, which provides a\\n\"\n\n\t\t\t<< \"path to the parameter file.\\n\";\n\n\t\treturn -1;\n\n\t}\n", "file_path": "src/RelationTimexArgFinder/RelationTimexArgFinderMain.cpp", "rank": 75, "score": 79.36765332014345 }, { "content": "// Copyright 2008 by BBN Technologies Corp.\n\n// All Rights Reserved.\n\n\n\n#include \"Generic/common/leak_detection.h\"\n\n\n\n#include \"Generic/common/UnrecoverableException.h\"\n\n#include \"Generic/common/ParamReader.h\"\n\n#include \"Generic/common/HeapChecker.h\"\n\n#include \"Generic/common/FileSessionLogger.h\"\n\n#include \"Generic/relations/MaxEntRelationTrainer.h\"\n\n\n\n#include <time.h>\n\n\n\nusing namespace std;\n\n\n\nint main(int argc, char **argv) {\n\n\tif (argc != 2) {\n\n\t\tcerr << \"MaxEntRelationTrainer.exe sould be invoked with a single argument, which provides a\\n\"\n\n\t\t\t<< \"path to the parameter file.\\n\";\n\n\t\treturn -1;\n", "file_path": "src/MaxEntRelationTrainer/MaxEntRelationTrainer.cpp", "rank": 76, "score": 79.1485974390626 }, { "content": "// Copyright 2008 by BBN Technologies Corp.\n\n// All Rights Reserved.\n\n\n\n#include \"Generic/common/leak_detection.h\"\n\n\n\n#include \"Generic/common/UnrecoverableException.h\"\n\n#include \"Generic/common/ParamReader.h\"\n\n#include \"Generic/common/HeapChecker.h\"\n\n#include \"Generic/common/FileSessionLogger.h\"\n\n#include \"Generic/edt/discmodel/DTCorefTrainer.h\"\n\n#include \"Generic/common/FeatureModule.h\" \n\n\n\nusing namespace std;\n\n\n\n\n\nint main(int argc, char **argv) {\n\n\n\n\tif (argc != 2) {\n\n\t\tcerr << \"DTCorefTrainer.exe sould be invoked with a single argument, which provides a\\n\"\n\n\t\t\t<< \"path to the parameter file.\\n\";\n", "file_path": "src/DTCorefTrainer/DTCorefTrainerMain.cpp", "rank": 77, "score": 78.32980821877462 }, { "content": "// Copyright 2008 by BBN Technologies Corp.\n\n// All Rights Reserved.\n\n\n\n#include \"Generic/common/leak_detection.h\"\n\n\n\n#include \"Generic/common/UnrecoverableException.h\"\n\n#include \"Generic/common/ParamReader.h\"\n\n#include \"Generic/common/HeapChecker.h\"\n\n#include \"Generic/common/FileSessionLogger.h\"\n\n#include \"Generic/descriptors/discmodel/P1DescTrainer.h\"\n\n#include \"Generic/common/FeatureModule.h\"\n\n\n\nusing namespace std;\n\n\n\n\n\nint main(int argc, char **argv) {\n\n\tif (argc != 2) {\n\n\t\tcerr << \"P1DescTrainer.exe sould be invoked with a single argument, which provides a\\n\"\n\n\t\t\t<< \"path to the parameter file.\\n\";\n\n\t\treturn -1;\n", "file_path": "src/P1DescTrainer/P1DescTrainerMain.cpp", "rank": 78, "score": 78.32980821877462 }, { "content": "// Copyright 2008 by BBN Technologies Corp.\n\n// All Rights Reserved.\n\n\n\n#include \"Generic/common/leak_detection.h\"\n\n\n\n#include \"Generic/common/UnrecoverableException.h\"\n\n#include \"Generic/common/ParamReader.h\"\n\n#include \"Generic/common/HeapChecker.h\"\n\n#include \"Generic/common/FileSessionLogger.h\"\n\n#include \"Generic/discourseRel/DiscourseRelTrainer.h\"\n\n//#include \"discourseRel/PennDiscourseTreebank.h\"\n\nusing namespace std;\n\n\n\n\n\nint main(int argc, char **argv) {\n\n\tif (argc != 2) {\n\n\t\tcerr << \"DiscourseRelTrainer.exe sould be invoked with a single argument, which provides a\\n\"\n\n\t\t\t<< \"path to the parameter file.\\n\";\n\n\t\treturn -1;\n\n\t}\n", "file_path": "src/DiscourseRelTrainer/DiscourseRelTrainerMain.cpp", "rank": 79, "score": 77.92721886911002 }, { "content": "// Copyright 2008 by BBN Technologies Corp.\n\n// All Rights Reserved.\n\n\n\n#include \"Generic/common/leak_detection.h\"\n\n\n\n#include \"Generic/common/UnrecoverableException.h\"\n\n#include \"Generic/common/ParamReader.h\"\n\n#include \"Generic/common/HeapChecker.h\"\n\n#include \"Generic/common/FileSessionLogger.h\"\n\n#include \"Generic/events/stat/StatEventTrainer.h\"\n\n#include \"Generic/docRelationsEvents/StatEventLinker.h\"\n\n#include \"Generic/common/FeatureModule.h\"\n\n\n\nusing namespace std;\n\n\n\n\n\nint main(int argc, char **argv) {\n\n\tif (argc != 2) {\n\n\t\tcerr << \"EventFinder.exe sould be invoked with a single argument, which provides a\\n\"\n\n\t\t\t<< \"path to the parameter file.\\n\";\n", "file_path": "src/EventFinder/EventFinderMain.cpp", "rank": 80, "score": 76.14475845388226 }, { "content": "#include <string>\n\n#include <iostream>\n\n#include <fstream>\n\n\n\nusing namespace std;\n\n\n\nvoid initializeWinsock();\n\nvoid initializeListenSocket(SOCKET& sock, const char *port);\n\nwstring getRetVal(bool ok, const char* txt);\n\nvoid writeToSocket(SOCKET& sock, wstring wstr);\n\nint getCommand(SOCKET& sock, char *command, int max_length);\n\nint getIntParameter(SOCKET &sock);\n\nbool getBoolParameter(SOCKET &sock);\n\nwstring getStringParameter(SOCKET &sock);\n\nint getNumber(SOCKET &sock);\n\nwchar_t getNextUTF8Char(char * text, size_t & pos, size_t max_pos);\n\nvoid makeUTF8CharArray(const wchar_t* input, char* output, size_t max_len);\n\n\n\nint main(int argc, char **argv)\n\n{ \n", "file_path": "src/PIdFQLSocketServer/PIdFQLSocketServer.cpp", "rank": 81, "score": 75.52741131313348 }, { "content": "\n\nusing namespace std;\n\n\n\n#undef ENABLE_LEAK_DETECTION\n\n\n\n\n\nint main(int argc, char **argv) {\n\n\n\n#ifdef _DEBUG\n\n//\t_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF);\n\n\n\n//\t_crtBreakAlloc = 9999223;\n\n#endif\n\n\n\n\tcout << \"This is English Serif for the ACE task, version 1.00.\\n\"\n\n\t\t << \"Serif version: \" << SerifVersion::getVersionString() << \"\\n\"\n\n\t\t << \"\\n\";\n\n\n\n\tif (argc != 2) {\n\n\t\tcerr << \"EnglishSerif.exe sould be invoked with a single argument, which provides a\\n\"\n", "file_path": "src/ATEASerif_Batch_English/ATEAEnglishSerif.cpp", "rank": 82, "score": 75.42550334601921 }, { "content": "\tstatic void unsetParam(const char* paramName);\n\n\n\n private:\n\n\n\n\t//Hash containing Parameters and their Values\n\n\tstatic HashTable &_params();\n\n\n\n\t//List of Include Files to Process\n\n\tstatic std::map<std::string, int> &_includes();\n\n \n\n\t//The path of the base configuration file. This value will be used to convert\n\n\t//Relative Paths to Absolute Paths. All Parameter values with relative paths must\n\n\t//make the value relative to the base path.\n\n\tstatic std::string _basePath;\n\n\tstatic size_t _paramCount;\n\n\n\n\t// If true, print out all parameters that get used, prefixed by \"ParamReader::outputUsedParamName\"\n\n\tstatic bool _output_used_param_names;\n\n\n\n\tstatic void checkForIllegalDashes(std::string str);\n", "file_path": "src/Generic/common/ParamReader.h", "rank": 83, "score": 75.17701404535569 }, { "content": "\t\t\t_spans->erase(_spans->begin());\n\n\t\t} else\n\n\t\t\t// _spans is sorted by start offset\n\n\t\t\tbreak;\n\n\t}\n\n\n\n}\n\n\n\nint main(int argc, char **argv) {\n\n\tif (argc != 2) {\n\n\t\tstd::cerr << \"StandaloneSentenceBreaker.exe should be invoked with a single argument, which provides a\\n\"\n\n\t\t\t<< \"path to the parameter file.\\n\";\n\n\t\treturn -1;\n\n\t}\n\n\ttry {\n\n\t\tParamReader::readParamFile(argv[1]);\n\n\t\t//_documentReader = new DocumentReader();\n\n\n\n\t\tstd::string log_file = ParamReader::getRequiredParam(\"sb_session_log\");\n\n\t\tstd::wstring log_file_as_wstring(log_file.begin(), log_file.end());\n", "file_path": "src/StandaloneSentenceBreaker/StandaloneSentenceBreaker.cpp", "rank": 84, "score": 70.95218803100182 }, { "content": "\t\t\t << \" parameter file, specifying where models are located.\\n\"\n\n\t\t\t << \" INPUT_FILES: An optional list of input files. This will override the\\n\"\n\n\t\t\t << \" \\\"batch\\\" parameter from the parameter file\\n\\n\"\n\n\t\t\t << opts_spec << endl;\n\n\t}\n\n\n\n\tbool parseCommandLine(int argc, const char **argv,\n\n\t\t\t\t\t\t // output parameters:\n\n\t\t\t\t\t\t string &parfile, \n\n\t\t\t\t\t\t map<string,string> &overrides,\n\n\t\t\t\t\t\t vector<string> &unset_params,\n\n\t\t\t\t\t\t string &outdir, int &verbosity) \n\n\t{\n\n\t\tnamespace opts = boost::program_options;\n\n\t\topts::command_line_parser optparser(argc, const_cast<char **>(argv));\n\n\t\topts::options_description arg_spec; // Argument specification.\n\n\n\n\t\t// Destination variables for arguments.\n\n\t\tvector<string> override_strings;\n\n\t\tvector<string> input_files;\n", "file_path": "src/Generic/commandLineInterface/CommandLineInterface.cpp", "rank": 85, "score": 70.12568281449735 }, { "content": "\t\t\t\t\t\t vector<string> &unsets,\n\n\t\t\t\t\t\t string &outdir, int &verbosity);\n\n\tvoid initializeParameters(const string& parfile,\n\n\t\t\t\t\t\t\t const map<string,string> &overrides,\n\n\t\t\t\t\t\t\t const vector<string> &unsets,\n\n\t\t\t\t\t\t\t int verbosity);\n\n\tResultCollector* createResultCollector(string outputFormat, bool use_correct_answers);\n\n std::vector<ResultCollector*>* createMultipleResultCollectors(bool use_correct_answers);\n\n\n\n\tint reportError(const char *what, const char *source=0);\n\n\tvoid checkHeap(const char *context);\n\n\tvoid printStages();\n\n\tvoid reportOpenedFiles();\n\n\tvoid restart(int argc, const char **argv);\n\n\tvoid quiet(const std::string &outdir);\n\n\tvoid runSerif(int verbosity, GenericTimer &totalLoadTimer);\n\n\n\n\ttemplate<class C>\n", "file_path": "src/Generic/commandLineInterface/CommandLineInterface.cpp", "rank": 86, "score": 69.7113976128368 }, { "content": "\t * should contain a comma-separated list. If the parameter is not defined,\n\n\t * then return the empty vector. */\n\n\tstatic std::vector<int> getIntVectorParam(const char* paramName);\n\n\n\n\t/** Return the value of a parameter as a vector of wstrings. The parameter\n\n\t * should contain a comma-separated list. If the parameter is not defined,\n\n\t * then return the empty vector. */\n\n\tstatic std::vector<std::wstring> getWStringVectorParam(const char* paramName);\n\n\n\n\t/** A module that needs a non-required boolean parameter calls this.\n\n\t * If the parameter exists and is 1 or = 'true', it returns true. \n\n\t * Anything else, it returns false\n\n\t */\n\n\tstatic bool isParamTrue(const char* paramName);\n\n\n\n\t/** Outputs parameters to session log */\n\n\tstatic void logParams();\n\n\n\n\t/** The only purpose of this is to deallocate everything so that\n\n\t * MS's CRT's stupid leak detection doesn't think that our\n", "file_path": "src/Generic/common/ParamReader.h", "rank": 87, "score": 68.54538383472286 }, { "content": "\tstatic int checkInclude(const char* incName);\n\n\tstatic bool hasDataDriveString(const std::string& str);\n\n\tstatic void includeFile(const char* line, const std::map<std::string,std::string>& overrides);\n\n\tstatic void outputUsedParamName(const char* param_name);\n\n\tstatic void replaceDataDriveString(std::string& str);\t\n\n\t\n\n\n\npublic:\n\n\t// Result is returned in the 'param_name' and 'value' parameters.\n\n\tstatic bool parseParamLine(const char* buffer, std::string& param_name, std::string& value);\n\n\n\nprivate:\n\n\tstatic void readParameter(const char* param, const char* value, HashTable &prefix_list, bool override_value);\n\n\tstatic void readPrefixParameter(const char* param, const char* value, HashTable &prefix_list, bool override_value);\n\n\tstatic void readListParameter(const char* param, const char* value, HashTable &prefix_list, bool override_value);\n\n\tstatic UnexpectedInputException reportOverrideError(const char* paramName, const char* newParamValue);\n\n\tstatic UnexpectedInputException reportMissingParamError(const char* paramName);\n\n\tstatic UnexpectedInputException reportBadValueError(const char* paramName, const char* expectedValueType);\t\n\n};\n\n\n\n#endif\n", "file_path": "src/Generic/common/ParamReader.h", "rank": 88, "score": 67.67587029431115 }, { "content": "\tbool isMessageSuppressed(const char* identifier) const;\n\n\tbool isMessageForced(const char* identifier) const;\n\n\tvoid writeContext();\n\n\n\n\t// STATIC METHODS\n\n\tstatic SessionLogger * getLogger();\n\n\n\n // STATIC DATA MEMBERS\n\n\tstatic SessionLogger *_globalLoggerPtr;\n\n\tstatic SessionLogger *_prevGlobalLoggerPtr;\n\n\t//static NullSessionLogger _defaultLogger;\n\nprotected:\n\n\t// We expect these to be used only by subclasses that can write to different output streams.\n\n\t/** Returns true for \"std::wcerr\", \"std:cerr\", \"wcerr\", or \"cerr\". */\n\n\tstatic bool is_wcerr_synonym(const char * stream_id);\n\n\t/** Returns true for \"std::wcout\", \"std:cout\", \"wcout\", or \"cout\". */\n\n\tstatic bool is_wcout_synonym(const char * stream_id);\n\n\n\npublic:\n\n\t// Don't use this except within SessionLogger.cpp! It's only public in order to resolve a \n", "file_path": "src/Generic/common/SessionLogger.h", "rank": 89, "score": 64.78436314217704 }, { "content": "\n\n\n\nint main(int argc, char **argv) {\n\n\tif (argc != 2) {\n\n\t\tcerr << \"PPartOfSpeechTrainer.exe sould be invoked with a single argument, which provides a\\n\"\n\n\t\t\t<< \"path to the parameter file.\\n\";\n\n\t\treturn -1;\n\n\t}\n\n\n\n\n\n\tchar emptyModelFileSuffix[1];\n\n\temptyModelFileSuffix[0] = '\\0';\n\n\ttry {\n\n\t\tParamReader::readParamFile(argv[1]);\n\n\n\n\t\tstring mode = ParamReader::getRequiredParam(\"pidf_trainer_standalone_mode\");\n\n\n\n\t\tif (mode == \"train\") {\n\n\t\t\tPPartOfSpeechModel *trainer = _new PPartOfSpeechModel(PPartOfSpeechModel::TRAIN);\n\n \n", "file_path": "src/PPartOfSpeechTrainer/PPartOfSpeechTrainer.cpp", "rank": 90, "score": 64.66504702751533 }, { "content": "\n\nint findMentionPairs(const DocTheory* dtFrom, const DocTheory* dtTo, MentionMappings& mmFrom, MentionMappings& mmTo);\n\nvoid saveDocStates(DocTheory* dt, StateSaver* ss);\n\nint changeRelations(const DocTheory* dtFrom, DocTheory* dtTo, const MentionMappings& mmFrom, const MentionMappings& mmTo, const bool generate_ignore = false);\n\nconst Mention* getRelationCapableParent(const Mention* m);\n\n//bool checkMentionETypes(DocTheory* dt); //TEMP\n\n//void collectETypesForHeadwords(const DocTheory* dt, HWordCounts& hwc); //TEMP\n\n//void printHeadwordsWithETypes(const HWordCounts& hwc); //TEMP\n\n\n\nint main(int argc, char **argv) {\n\n\tif (argc != 2) {\n\n\t\tcerr << \"MentionMapper.exe sould be invoked with a single argument, which provides a\\n\"\n\n\t\t\t<< \"path to the parameter file.\\n\";\n\n\t\treturn -1;\n\n\t}\n\n\n\n\ttry {\n\n\t\tParamReader::readParamFile(argv[1]);\n\n\n\n\t\tbool verbose=ParamReader::isParamTrue(\"verbose\");\n", "file_path": "src/MentionMapper/mentionMapperMain.cpp", "rank": 91, "score": 63.632371991381504 }, { "content": "int main(int argc, char* argv[]) {\n\n\tUTF8Token token;\n\n\n\n\tif (argc != 19 && argc != 18) {\n\n cerr << \"wrong number of arguments to pruner\\n\";\n\n\t\tcerr << \"Usage:\\n\";\n\n\t\tcerr << \" 7 pairs of input/output files --\\n\";\n\n\t\tcerr << \" vocab head pre post left right part-of-speech\\n\";\n\n\t\tcerr << \" unknown word pruning threshold\\n\";\n\n\t\tcerr << \" feature vector output file \\n\";\n\n\t\tcerr << \" language\\n\\n\";\n\n\t\tcerr << \" [smooth]\\n\\n\";\n\n\t\tcerr << \"(language parameter is new: it should be English, Arabic, etc)\\n\\n\";\n\n\t\tcerr << \"if the 'smooth' option is specified, then the program will prune\\n\";\n\n\t\tcerr << \" in such a way as to produce events for use in smoothing\\n\";\n\n\n\n return -1;\n\n }\n\n\n\n\n", "file_path": "src/ParserTrainer/VocabPruner/VocabPrunerMain.cpp", "rank": 93, "score": 62.846932795402225 }, { "content": "#include \"Generic/common/leak_detection.h\"\n\n#include \"ProgramOptionsUtils.h\"\n\n#include <iostream>\n\n#include <boost/program_options.hpp>\n\n\n\nusing std::cout;\n\nusing std::endl;\n\n\n\nvoid write_help_msg(const boost::program_options::options_description & desc) {\n\n\tcout << desc << \"\\n\";\n\n\tcout << \"An argument whose value is \\\"\\\" will be ignored.\\n\"\n\n\t\t << \"Multiple instances can be given where indicated (e.g., \\\"-p param1:true -p param2:false\\\").\" << endl;\n\n\texit(-1);\n\n}\n\n\n\n// Validates a command-line argument that must be defined at least once.\n\nvoid validate_mandatory_cmd_line_arg(const boost::program_options::options_description & desc,\n\n\t\t\t\t\t\t\t\t const boost::program_options::variables_map & var_map, const std::string & param_name) {\n\n\tif (var_map.count(param_name) < 1) {\n\n\t\tstd::cerr << \"Mandatory command-line argument '\" << param_name << \"' was not specified.\" << std::endl; \n", "file_path": "src/LearnIt/ProgramOptionsUtils.cpp", "rank": 94, "score": 62.78708375872801 }, { "content": "\t\t\t\t\t\t\t\t\t const std::string& dummyStringsFile);\n\n\n\nvoid usage() {\n\n\tSessionLogger::info(\"LEARNIT\") << \"LearnIt2Trainer.exe <param file> <feature_vectors_file> \"\n\n\t\t<< \"<input_db_file> <output_db_file>\" << endl;\n\n}\n\n\n\nvoid parse_arguments(int argc, char ** argv, string& feature_vectors_file, \n\n string& preview_strings_file, string& db_file)\n\n{\n\n\tusing namespace boost::program_options;\n\n\tif (argc < 5) {\n\n\t\tusage();\n\n\t}\n\n\n\n\tstring param_file;\n\n\toptions_description desc(\"Options\");\n\n\tdesc.add_options()\n\n\t\t(\"param-file,P\", value<string>(&param_file),\"[required] parameter file\")\n\n\t\t(\"fv,F\", value<string>(&feature_vectors_file), \"[required] file of input feature vectors\")\n", "file_path": "src/LearnIt2Trainer/LearnIt2Trainer.cpp", "rank": 95, "score": 62.71552984284273 }, { "content": "\t */\n\n\tstatic double getOptionalFloatParamWithDefaultValue(const char* paramName, double defaultVal);\n\n\n\n\t/** optional argument, so returns that size of the array and fills\n\n\t* the supplied one up to the max size indicated.\n\n\t* array elements are character sequences separated by commas\n\n\t*/\n\n\tstatic size_t getSymbolArrayParam(const char *paramName, Symbol *sarray, int maxSize);\n\n\n\n\t/** Return the value of a parameter as a vector of symbols. The parameter\n\n\t * should contain a comma-separated list. If the parameter is not defined,\n\n\t * then return the empty vector. */\n\n\tstatic std::vector<Symbol> getSymbolVectorParam(const char* paramName);\n\n\n\n\t/** Return the value of a parameter as a vector of strings. The parameter\n\n\t * should contain a comma-separated list. If the parameter is not defined,\n\n\t * then return the empty vector. */\n\n\tstatic std::vector<std::string> getStringVectorParam(const char* paramName);\n\n\n\n\t/** Return the value of a parameter as a vector of ints. The parameter\n", "file_path": "src/Generic/common/ParamReader.h", "rank": 96, "score": 60.981071644163656 }, { "content": "using Eigen::SparseVector;\n\nusing Eigen::VectorXd;\n\nusing boost::make_shared;\n\nusing boost::lexical_cast;\n\nusing boost::dynamic_pointer_cast;\n\n\n\nvoid usage() {\n\n\tSessionLogger::info(\"LEARNIT\") << \"L2Analyzer <param file> <feature_vectors_file> \"\n\n\t\t<< \"<input_db_file> <output_db_file>\" << endl;\n\n}\n\n\n\nvoid parse_arguments(int argc, char ** argv, string& feature_vectors_file, \n\n string& preview_strings_file, string& db_file)\n\n{\n\n\tusing namespace boost::program_options;\n\n\tif (argc < 5) {\n\n\t\tusage();\n\n\t}\n\n\n\n\tstring param_file;\n", "file_path": "src/L2Analyzer/L2Analyzer.cpp", "rank": 97, "score": 60.96550934989929 }, { "content": "\n\nprotected:\n\n\t/// 'base' tokenizer, used for backoff.\n\n\tTokenizer *_tokenizer;\n\n\n\n\t/// The token substitution map.\n\n\tSymbolSubstitutionMap *_substitutionMap;\n\n\n\n\t/// The internal buffer of tokens used to construct the token sequence.\n\n\tToken *_tokenBuffer[MAX_SENTENCE_TOKENS+1];\n\n\n\n\tbool _create_lexical_tokens;\n\n\n\nprivate:\n\n\tconst Document *_document;\n\n\tint _cur_sent_no;\n\n\tstatic void regexCallback(const boost::wsmatch& what, int sub_string_pos, std::vector<RegexMatch>* matches_p);\n\n\tstatic void printMatchCallback(const RegexMatch& match);\n\n\tvoid applyExpression (const RegexData& expr, const LocatedString * target_text, vector <RegexMatch> &matches);\n\n\tvoid processRegexps (const std::vector<RegexData>& expressions, LocatedString *target_text, TokenOffsets *token_offsets);\n\n\tvoid readRegExFile(const char filename[]);\n\n\t\n\n};\n\n\n\n#endif\n", "file_path": "src/Generic/tokens/RegExTokenizer.h", "rank": 98, "score": 60.85134057975658 }, { "content": "\t\t\tif (find(search_path->begin(), search_path->end(), base_path) == search_path->end()){\n\n\t\t\t\tsearch_path->push_back(base_path);\n\n\t\t\t\t//std::cerr << \" Sexp::find_include pushed new base_path \" << base_path << \" onto search_path\\n\";\n\n\t\t\t}else{\n\n\t\t\t\t//std::cerr << \" Sexp::find_include used previous base path \" << base_path << \"\\n\";\n\n\t\t\t}\n\n\t\t\treturn result;\n\n\t\t}\n\n\n\n\t}\n\n}\n\n\n\nvoid Sexp::expandMacros(std::vector<std::string> *search_path, bool include_once,\n\n\t\t\t\t\t\tbool use_quotes, bool use_hash_comments, bool encrypted) {\n\n\tstd::set<Symbol> defined_symbols;\n\n\tstd::vector<std::wstring> macros = ParamReader::getWStringVectorParam(\"sexp_macros\");\n\n\tBOOST_FOREACH(std::wstring macro, macros) {\n\n\t\tdefined_symbols.insert(Symbol(macro));\n\n\t}\n\n\tstd::set<Symbol> files_to_skip;\n", "file_path": "src/Generic/common/Sexp.cpp", "rank": 99, "score": 60.30868628291036 } ]
C++
src/bustools_extract.cpp
johan-gson/bustools
b0df3edef7e0df53d6461cd76572ae38280c4a94
#include <iostream> #include <fstream> #include <zlib.h> #include "kseq.h" #include "Common.hpp" #include "BUSData.h" #include "bustools_extract.h" KSEQ_INIT(gzFile, gzread); inline bool open_fastqs( std::vector<gzFile> &outFastq, std::vector<gzFile> &inFastq, std::vector<kseq_t *> &seq, const Bustools_opt &opt, size_t &iFastq) { for (int i = 0; i < opt.nFastqs; ++i) { gzclose(outFastq[i]); outFastq[i] = gzopen(std::string(opt.output + "/" + std::to_string(iFastq + 1) + ".fastq.gz").c_str(), "w"); gzclose(inFastq[i]); inFastq[i] = gzopen(opt.fastq[iFastq].c_str(), "r"); if (seq[i]) { kseq_destroy(seq[i]); } seq[i] = kseq_init(inFastq[i]); if (kseq_read(seq[i]) < 0) { return false; } ++iFastq; } return true; } void bustools_extract(const Bustools_opt &opt) { BUSHeader h; size_t nr = 0; size_t N = 100000; BUSData *p = new BUSData[N]; char *buf = new char[N]; buf[0] = '@'; std::streambuf *inbuf; std::ifstream inf; if (!opt.stream_in) { inf.open(opt.files[0].c_str(), std::ios::binary); inbuf = inf.rdbuf(); } else { inbuf = std::cin.rdbuf(); } std::istream in(inbuf); parseHeader(in, h); std::vector<gzFile> outFastq(opt.nFastqs); std::vector<gzFile> inFastq(opt.nFastqs); std::vector<kseq_t *> seq(opt.nFastqs, nullptr); uint32_t iRead = 0; size_t iFastq = 0; if (!open_fastqs(outFastq, inFastq, seq, opt, iFastq)) { std::cerr << "Error reading FASTQ " << opt.fastq[iFastq] << std::endl; goto end_extract; } while (true) { in.read((char *) p, N * sizeof(BUSData)); size_t rc = in.gcount() / sizeof(BUSData); if (rc == 0) { break; } nr += rc; for (size_t i = 0; i < rc; ++i) { while (iRead < p[i].flags) { for (const auto &s : seq) { int err_kseq_read = kseq_read(s); if (err_kseq_read == -1) { if (iFastq == opt.fastq.size()) { std::cerr << "Warning: number of reads in FASTQs was less than number of reads in BUS file" << std::endl; goto end_extract; } else { if (!open_fastqs(outFastq, inFastq, seq, opt, iFastq)) { std::cerr << "Error: cannot read FASTQ " << opt.fastq[iFastq] << std::endl; goto end_extract; } } } else if (err_kseq_read == -2) { std::cerr << "Error: truncated FASTQ" << std::endl; goto end_extract; } } ++iRead; } if (iRead > p[i].flags) { std::cerr << "BUS file not sorted by flag" << std::endl; goto end_extract; } for (int i = 0; i < opt.nFastqs; ++i) { int bufLen = 1; memcpy(buf + bufLen, seq[i]->name.s, seq[i]->name.l); bufLen += seq[i]->name.l; memcpy(buf + bufLen, seq[i]->comment.s, seq[i]->comment.l); bufLen += seq[i]->comment.l; buf[bufLen++] = '\n'; memcpy(buf + bufLen, seq[i]->seq.s, seq[i]->seq.l); bufLen += seq[i]->seq.l; buf[bufLen++] = '\n'; buf[bufLen++] = '+'; memcpy(buf + bufLen, seq[i]->name.s, seq[i]->name.l); bufLen += seq[i]->name.l; memcpy(buf + bufLen, seq[i]->comment.s, seq[i]->comment.l); bufLen += seq[i]->comment.l; buf[bufLen++] = '\n'; memcpy(buf + bufLen, seq[i]->qual.s, seq[i]->qual.l); bufLen += seq[i]->qual.l; buf[bufLen++] = '\n'; if (gzwrite(outFastq[i], buf, bufLen) != bufLen) { std::cerr << "Error writing to FASTQ" << std::endl; goto end_extract; } } } } std::cout << "Read in " << nr << " BUS records" << std::endl; end_extract: delete[] p; delete[] buf; for (auto &elt : outFastq) { gzclose(elt); } for (auto &elt : inFastq) { gzclose(elt); } for (auto &elt : seq) { if (elt) { kseq_destroy(elt); } } }
#include <iostream> #include <fstream> #include <zlib.h> #include "kseq.h" #include "Common.hpp" #include "BUSData.h" #include "bustools_extract.h" KSEQ_INIT(gzFile, gzread); inline bool open_fastqs( std::vector<gzFile> &outFastq, std::vector<gzFile> &inFastq, std::vector<kseq_t *> &seq, const Bustools_opt &opt, size_t &iFastq) { for (int i = 0; i < opt.nFastqs; ++i) { gzclose(outFastq[i]); outFastq[i] = gzopen(std::string(opt.output + "/" + std::to_string(iFastq + 1) + ".fastq.gz").c_str(), "w"); gzclose(inFastq[i]); inFastq[i] = gzopen(opt.fastq[iFastq].c_str(), "r"); if (seq[i]) { kseq_destroy(seq[i]); } seq[i] = kseq_init(inFastq[i]); if (kseq_read(seq[i]) < 0) { return false; } ++iFastq; } return true; } void bustools_extract(const Bustools_opt &opt) { BUSHeader h; size_t nr = 0; size_t N = 100000; BUSData *p = new BUSData[N]; char *buf = new char[N]; buf[0] = '@'; std::streambuf *inbuf; std::ifstream inf; if (!opt.stream_in) { inf.open(opt.files[0].c_str(), std::ios::binary); inbuf = inf.rdbuf(); } else { inbuf = std::cin.rdbuf(); } std::istream in(inbuf); parseHeader(in, h); std::vector<gzFile> outFastq(opt.nFastqs); std::vector<gzFile> inFastq(opt.nFastqs); std::vector<kseq_t *> seq(opt.nFastqs, nullptr); uint32_t iRead = 0; size_t iFastq = 0; if (!open_fastqs(outFastq, inFastq, seq, opt, iFastq)) { std::cerr << "Error reading FASTQ " << opt.fastq[iFastq] << std::endl; goto end_extract; } while (true) { in.read((char *) p, N * sizeof(BUSData)); size_t rc = in.gcount() / sizeof(BUSData); if (rc == 0) { break; } nr += rc; for (size_t i = 0; i < rc; ++i) { while (iRead < p[i].flags) { for (const auto &s : seq) { int err_kseq_read = kseq_read(s); if (err_kseq_read == -1) { if (iFastq == opt.fastq.size()) { std::cerr << "Warning: number of reads in FASTQs was less than number of reads in BUS file" << std::endl; goto end_extract; } else { if (!open_fastqs(outFastq, inFastq, seq, opt, iFastq)) { std::cerr << "Error: cannot read FASTQ " << opt.fastq[iFastq] << std::endl; goto end_extract; } } } else if (err_kseq_read == -2) { std::cerr << "Error: truncated FASTQ" << std::endl; goto end_extract; } } ++iRead; } if (iRead > p[i].flags) { std::cerr << "BUS file not sorted by flag" << std::endl; goto end_extract; } for (int i = 0; i < opt.nFastqs; ++i) { int bufLen = 1; memcpy(buf + bufLen, seq[i]->name.s, seq[i]->name.l); bufLen += seq[i]->name.l; memcpy(buf + bufLen, seq[i]->comment.s, seq[i]->comment.l); bufLen += seq[i]->comment.l; buf[bufLen++] = '\n'; memcpy(buf + bufLen, seq[i]->seq.s, seq[i]->seq.l); bufLen += seq[i]->seq.l; buf[bufLen++] = '\n'; buf[bufLen++] = '+'; memcpy(buf + bufLen, seq[i]->name.s, seq[i]->name.l); bufLen += seq[i]->name.l; memcpy(buf + bufLen, seq[i]->comment.s, seq[i]->comment.l); bufLen += seq[i]->comment.l; buf[bufLen++] = '\n'; memcpy(buf + bufLen, seq[i]->qual.s, seq[i]->qual.l); bufLen += seq[i]->qual.l;
buf[bufLen++] = '\n'; if (gzwrite(outFastq[i], buf, bufLen) != bufLen) { std::cerr << "Error writing to FASTQ" << std::endl; goto end_extract; } } } } std::cout << "Read in " << nr << " BUS records" << std::endl; end_extract: delete[] p; delete[] buf; for (auto &elt : outFastq) { gzclose(elt); } for (auto &elt : inFastq) { gzclose(elt); } for (auto &elt : seq) { if (elt) { kseq_destroy(elt); } } }
function_block-function_prefix_line
[ { "content": "enum SORT_TYPE : char {SORT_BC = 0, SORT_UMI, SORT_F, SORT_COUNT};\n", "file_path": "src/Common.hpp", "rank": 0, "score": 97682.47177461298 }, { "content": " function returns true and set element to the element of given rank.\n\n Otherwise, it returns false.\n\n */\n\n bool select(uint64_t rnk, uint64_t *element) const {\n\n for (const auto &map_entry : roarings) {\n\n uint64_t sub_cardinality = (uint64_t)map_entry.second.cardinality();\n\n if (rnk < sub_cardinality) {\n\n *element = ((uint64_t)map_entry.first) << 32;\n\n // assuming little endian\n\n return map_entry.second.select((uint32_t)rnk,\n\n ((uint32_t *)element));\n\n }\n\n rnk -= sub_cardinality;\n\n }\n\n return false;\n\n }\n\n\n\n /**\n\n * Returns the number of integers that are smaller or equal to x.\n\n */\n", "file_path": "src/roaring.hh", "rank": 1, "score": 71114.70752991548 }, { "content": "struct Bustools_opt {\n\n int threads;\n\n \n\n std::string whitelist; \n\n std::string output;\n\n std::vector<std::string> files;\n\n\n\n bool stream_in = false;\n\n bool stream_out = false;\n\n\n\n /* extract */\n\n int nFastqs;\n\n std::vector<std::string> fastq;\n\n \n\n char type;\n\n\n\n int ec_d;\n\n int ec_dmin;\n\n size_t max_memory;\n\n std::string temp_files;\n", "file_path": "src/Common.hpp", "rank": 2, "score": 60520.95501911439 }, { "content": "void bustools_sort(const Bustools_opt& opt);", "file_path": "src/bustools_sort.h", "rank": 3, "score": 44928.48918309802 }, { "content": "enum PROJECT_TYPE : char {PROJECT_BC = 0, PROJECT_UMI, PROJECT_TX, PROJECT_F};\n\n\n", "file_path": "src/Common.hpp", "rank": 4, "score": 44672.21611193452 }, { "content": "void bustools_sort_orig(const Bustools_opt& opt);\n", "file_path": "src/bustools_sort.h", "rank": 5, "score": 43915.75440345302 }, { "content": "enum CAPTURE_TYPE : char {CAPTURE_NONE = 0, CAPTURE_TX, CAPTURE_BC, CAPTURE_UMI, CAPTURE_F};\n", "file_path": "src/Common.hpp", "rank": 6, "score": 41568.17401380536 }, { "content": " std::ifstream inf;\n\n if (!opt.stream_in) {\n\n inf.open(infn.c_str(), std::ios::binary);\n\n inbuf = inf.rdbuf();\n\n } else {\n\n inbuf = std::cin.rdbuf();\n\n }\n\n std::istream in(inbuf);\n\n\n\n parseHeader(in, h);\n\n\n\n int rc = 1;\n\n while (true) {\n\n in.read((char*)p, N*sizeof(BUSData));\n\n size_t rc = in.gcount() / sizeof(BUSData);\n\n if (rc == 0) {\n\n break;\n\n }\n\n // todo, reserve max memory\n\n b.insert(b.end(), p, p+rc);\n", "file_path": "src/bustools_sort.cpp", "rank": 7, "score": 40860.2846028982 }, { "content": "\n\n \n\n }\n\n\n\n if (!opt.stream_out) {\n\n of.close(); \n\n }\n\n \n\n\n\n}\n\n\n\nvoid bustools_sort_orig(const Bustools_opt& opt) {\n\n BUSHeader h;\n\n std::vector<BUSData> b;\n\n size_t N = 100000;\n\n BUSData* p = new BUSData[N];\n\n char magic[4];\n\n uint32_t version = 0;\n\n for (const auto& infn : opt.files) { \n\n std::streambuf *inbuf;\n", "file_path": "src/bustools_sort.cpp", "rank": 8, "score": 40855.986741437206 }, { "content": " \n\n \n\n \n\n while (in.good()) {\n\n // read as much as we can\n\n in.read((char*)p, N*sizeof(BUSData));\n\n size_t rc = in.gcount() / sizeof(BUSData);\n\n if (rc == 0) {\n\n break;\n\n }\n\n // now sort the data\n\n std::sort(p,p+rc, cmp);\n\n sc += rc;\n\n \n\n\n\n // write the output\n\n std::ofstream outf(opt.temp_files + std::to_string(tmp_file_no), std::ios::binary);\n\n writeHeader(outf, h);\n\n\n\n for (size_t i = 0; i < rc; ) {\n", "file_path": "src/bustools_sort.cpp", "rank": 9, "score": 40855.65188303785 }, { "content": " exit(1);\n\n }\n\n\n\n \n\n size_t sc = 0;\n\n int tmp_file_no = 0;\n\n for (const auto& infn : opt.files) {\n\n std::streambuf *inbuf;\n\n std::ifstream inf;\n\n if (!opt.stream_in) {\n\n inf.open(infn.c_str(), std::ios::binary);\n\n inbuf = inf.rdbuf();\n\n } else {\n\n inbuf = std::cin.rdbuf();\n\n }\n\n std::istream in(inbuf);\n\n\n\n parseHeader(in, h);\n\n\n\n int rc = 1;\n", "file_path": "src/bustools_sort.cpp", "rank": 10, "score": 40855.27213450391 }, { "content": " return a.first.UMI > b.first.UMI;\n\n }\n\n } else {\n\n return a.first.barcode > b.first.barcode;\n\n } \n\n } else { \n\n return a.first.count > b.first.count;\n\n }\n\n};\n\n\n\nvoid bustools_sort(const Bustools_opt& opt) {\n\n BUSHeader h;\n\n size_t N = opt.max_memory / sizeof(BUSData);\n\n BUSData* p = new BUSData[N];\n\n char magic[4];\n\n uint32_t version = 0;\n\n\n\n int no_temp_files = 0;\n\n\n\n bool (*cmp)(const BUSData&, const BUSData&);\n", "file_path": "src/bustools_sort.cpp", "rank": 11, "score": 40854.95672995348 }, { "content": "#include <iostream>\n\n#include <fstream>\n\n#include <cstring>\n\n#include <algorithm>\n\n#include <queue>\n\n#include <functional>\n\n\n\n#include \"Common.hpp\"\n\n#include \"BUSData.h\"\n\n#include \"bustools_sort.h\"\n\n\n\n#define TP std::pair<BUSData, int>\n\n\n\ninline bool cmp1(const BUSData &a, const BUSData &b) {\n\n if (a.barcode == b.barcode) {\n\n if (a.UMI == b.UMI) {\n\n if (a.ec == b.ec) {\n\n return a.flags < b.flags;\n\n } else {\n\n return a.ec < b.ec;\n", "file_path": "src/bustools_sort.cpp", "rank": 12, "score": 40854.57567110972 }, { "content": " size_t j = i+1;\n\n uint32_t c = p[i].count;\n\n auto ec = p[i].ec; \n\n for (; j < rc; j++) {\n\n if (p[i].barcode == p[j].barcode && p[i].UMI == p[j].UMI && p[i].ec == p[j].ec\n\n && (opt.type != SORT_F || p[i].flags == p[j].flags)) {\n\n c += p[j].count;\n\n } else {\n\n break;\n\n }\n\n }\n\n // merge identical things\n\n p[i].count = c;\n\n outf.write((char*)(&(p[i])), sizeof(p[i]));\n\n // increment\n\n i = j;\n\n }\n\n\n\n outf.close();\n\n tmp_file_no++;\n", "file_path": "src/bustools_sort.cpp", "rank": 13, "score": 40854.47606207508 }, { "content": "\n\n\n\n // todo: skip writing to disk if it fits in memory\n\n if (tmp_file_no == 1) {\n\n size_t M = N / 8;\n\n p = new BUSData[M];\n\n std::ifstream in(opt.temp_files + \"0\", std::ios::binary);\n\n BUSHeader tmp;\n\n parseHeader(in,tmp);\n\n while (in.good()) {\n\n // read as much as we can\n\n in.read((char*)p, M*sizeof(BUSData));\n\n size_t rc = in.gcount() / sizeof(BUSData);\n\n if (rc == 0) {\n\n break;\n\n }\n\n busf_out.write((char*)p,rc*sizeof(BUSData));\n\n }\n\n in.close();\n\n std::remove((opt.temp_files + \"0\").c_str());\n", "file_path": "src/bustools_sort.cpp", "rank": 14, "score": 40853.891786545704 }, { "content": " bool (*ncmp)(const TP &a, const TP &b);\n\n switch (opt.type) {\n\n case SORT_BC:\n\n cmp = &cmp1;\n\n ncmp = &ncmp1;\n\n break;\n\n case SORT_UMI:\n\n cmp = &cmp2;\n\n ncmp = &ncmp2;\n\n break;\n\n case SORT_F:\n\n cmp = &cmp3;\n\n ncmp = &ncmp3;\n\n break;\n\n case SORT_COUNT:\n\n cmp = &cmp4;\n\n ncmp = &ncmp4;\n\n break;\n\n default:\n\n std::cerr << \"ERROR: Unknown sort type\" << std::endl;\n", "file_path": "src/bustools_sort.cpp", "rank": 15, "score": 40847.61814392588 }, { "content": " } else {\n\n // TODO: test if replacing with k-way merge is better\n\n // adapted from https://github.com/arq5x/kway-mergesort/blob/master/kwaymergesort.h\n\n int k = tmp_file_no;\n\n size_t M = N / (k);\n\n //std::memset(p, 0, N*sizeof(BUSData)); \n\n std::vector<std::ifstream> bf(k);\n\n for (int i = 0; i < k; i++) {\n\n bf[i].open((opt.temp_files + std::to_string(i)).c_str(), std::ios::binary);\n\n BUSHeader tmp;\n\n parseHeader(bf[i],tmp);\n\n }\n\n\n\n std::priority_queue<TP, std::vector<TP>, std::function<bool(const TP &a, const TP &b)>> pq(ncmp);\n\n BUSData t;\n\n for (int i = 0; i < k; i++) {\n\n bf[i].read((char*) &t, sizeof(t));\n\n pq.push({t,i});\n\n }\n\n\n", "file_path": "src/bustools_sort.cpp", "rank": 16, "score": 40847.12809752689 }, { "content": " }\n\n // read next from stream\n\n if (bf[i].good()) {\n\n bf[i].read((char*) &t, sizeof(t));\n\n if (bf[i].gcount() > 0) {\n\n pq.push({t,i});\n\n }\n\n }\n\n }\n\n\n\n if (curr.count > 0) {\n\n // write out remaining straggler\n\n busf_out.write((char*) &curr, sizeof(curr));\n\n }\n\n \n\n // remove intermediary files\n\n for (int i = 0; i < k; i++) {\n\n bf[i].close();\n\n std::remove((opt.temp_files + std::to_string(i)).c_str());\n\n }\n", "file_path": "src/bustools_sort.cpp", "rank": 17, "score": 40846.24306367246 }, { "content": " }\n\n }\n\n delete[] p;\n\n p = nullptr;\n\n\n\n\n\n std::cerr << \"Read in \" << sc << \" BUS records\" << std::endl;\n\n\n\n std::streambuf *buf = nullptr;\n\n std::ofstream of;\n\n\n\n if (!opt.stream_out) {\n\n of.open(opt.output, std::ios::out | std::ios::binary); \n\n buf = of.rdbuf();\n\n } else {\n\n buf = std::cout.rdbuf();\n\n }\n\n std::ostream busf_out(buf);\n\n\n\n writeHeader(busf_out, h);\n", "file_path": "src/bustools_sort.cpp", "rank": 18, "score": 40845.838256079995 }, { "content": " BUSData curr = pq.top().first;\n\n curr.count = 0; // we'll count this again in the first loop\n\n while (!pq.empty()) {\n\n TP min = pq.top();\n\n \n\n pq.pop();\n\n // process the data\n\n BUSData &m = min.first;\n\n int i = min.second;\n\n if (m.barcode == curr.barcode && m.UMI == curr.UMI && m.ec == curr.ec\n\n && (opt.type != SORT_F || m.flags == curr.flags)) {\n\n // same data, increase count\n\n curr.count += m.count;\n\n } else {\n\n\n\n // new data let's output curr, new curr is m\n\n if (curr.count != 0) {\n\n busf_out.write((char*)&curr, sizeof(curr));\n\n }\n\n curr = m;\n", "file_path": "src/bustools_sort.cpp", "rank": 19, "score": 40844.745582022064 }, { "content": "\n\n std::streambuf *buf = nullptr;\n\n std::ofstream of;\n\n\n\n if (!opt.stream_out) {\n\n of.open(opt.output, std::ios::out | std::ios::binary); \n\n buf = of.rdbuf();\n\n } else {\n\n buf = std::cout.rdbuf();\n\n }\n\n std::ostream busf_out(buf);\n\n\n\n writeHeader(busf_out, h);\n\n\n\n size_t n = b.size();\n\n for (size_t i = 0; i < n; ) {\n\n size_t j = i+1;\n\n uint32_t c = b[i].count;\n\n auto ec = b[i].ec; \n\n for (; j < n; j++) {\n", "file_path": "src/bustools_sort.cpp", "rank": 20, "score": 40844.67857637463 }, { "content": "};\n\n\n\ninline bool ncmp2(const TP &a, const TP &b) {\n\n if (a.first.UMI == b.first.UMI) {\n\n if (a.first.barcode == b.first.barcode) {\n\n if (a.first.ec == b.first.ec) {\n\n return a.second > b.second;\n\n } else {\n\n return a.first.ec > b.first.ec;\n\n }\n\n } else {\n\n return a.first.barcode > b.first.barcode;\n\n } \n\n } else { \n\n return a.first.UMI > b.first.UMI;\n\n }\n\n};\n\n\n\ninline bool cmp3(const BUSData &a, const BUSData &b) {\n\n if (a.flags == b.flags) {\n", "file_path": "src/bustools_sort.cpp", "rank": 21, "score": 40842.008642466535 }, { "content": " }\n\n } else {\n\n return a.UMI < b.UMI;\n\n } \n\n } else { \n\n return a.barcode < b.barcode;\n\n }\n\n};\n\n\n\ninline bool ncmp1(const TP &a, const TP &b) {\n\n if (a.first.barcode == b.first.barcode) {\n\n if (a.first.UMI == b.first.UMI) {\n\n if (a.first.ec == b.first.ec) {\n\n if (a.first.flags == b.first.flags) {\n\n return a.second > b.second;\n\n } else {\n\n return a.first.flags > b.first.flags;\n\n }\n\n } else {\n\n return a.first.ec > b.first.ec;\n", "file_path": "src/bustools_sort.cpp", "rank": 22, "score": 40841.27087284807 }, { "content": " if (a.barcode == b.barcode) {\n\n if (a.UMI == b.UMI) {\n\n return a.ec < b.ec;\n\n } else {\n\n return a.UMI < b.UMI;\n\n }\n\n } else {\n\n return a.barcode < b.barcode;\n\n } \n\n } else {\n\n return a.flags < b.flags;\n\n }\n\n};\n\n\n\ninline bool ncmp3(const TP &a, const TP &b) {\n\n if (a.first.flags == b.first.flags) {\n\n if (a.first.barcode == b.first.barcode) {\n\n if (a.first.UMI == b.first.UMI) {\n\n if (a.first.ec == b.first.ec) {\n\n return a.second > b.second;\n", "file_path": "src/bustools_sort.cpp", "rank": 23, "score": 40841.27087284807 }, { "content": " if (b[i].barcode != b[j].barcode || b[i].UMI != b[j].UMI || b[i].ec != b[j].ec) {\n\n break;\n\n }\n\n c += b[j].count;\n\n }\n\n // merge identical things\n\n b[i].count = c;\n\n busf_out.write((char*)(&(b[i])), sizeof(b[i]));\n\n // increment\n\n i = j;\n\n }\n\n\n\n if (!opt.stream_out) {\n\n of.close(); \n\n }\n\n}\n", "file_path": "src/bustools_sort.cpp", "rank": 24, "score": 40841.06054944606 }, { "content": " }\n\n }\n\n\n\n delete[] p; p = nullptr;\n\n std::cerr << \"Read in \" << b.size() << \" BUS records\" << std::endl;\n\n\n\n // todo: replace with radix sort \n\n std::sort(b.begin(), b.end(), [&](const BUSData& a, const BUSData &b) \n\n {\n\n if (a.barcode == b.barcode) {\n\n if (a.UMI == b.UMI) {\n\n return a.ec < b.ec;\n\n } else {\n\n return a.UMI < b.UMI;\n\n } \n\n } else { \n\n return a.barcode < b.barcode;\n\n }});\n\n std::cerr << \"All sorted\" << std::endl;\n\n\n", "file_path": "src/bustools_sort.cpp", "rank": 25, "score": 40840.980412344674 }, { "content": " } else {\n\n return a.first.ec > b.first.ec;\n\n }\n\n } else {\n\n return a.first.UMI > b.first.UMI;\n\n }\n\n } else {\n\n return a.first.barcode > b.first.barcode;\n\n } \n\n } else { \n\n return a.first.flags > b.first.flags;\n\n }\n\n};\n\n\n\ninline bool cmp4(const BUSData &a, const BUSData &b) {\n\n if (a.count == b.count) {\n\n if (a.barcode == b.barcode) {\n\n if (a.UMI == b.UMI) {\n\n return a.ec < b.ec;\n\n } else {\n", "file_path": "src/bustools_sort.cpp", "rank": 26, "score": 40840.71189814136 }, { "content": " }\n\n } else {\n\n return a.first.UMI > b.first.UMI;\n\n } \n\n } else { \n\n return a.first.barcode > b.first.barcode;\n\n }\n\n};\n\n\n\n\n\ninline bool cmp2(const BUSData &a, const BUSData &b) {\n\n if (a.UMI == b.UMI) {\n\n if (a.barcode == b.barcode) {\n\n return a.ec < b.ec;\n\n } else {\n\n return a.barcode < b.barcode;\n\n } \n\n } else {\n\n return a.UMI < b.UMI;\n\n }\n", "file_path": "src/bustools_sort.cpp", "rank": 27, "score": 40837.20397720352 }, { "content": " return a.UMI < b.UMI;\n\n }\n\n } else {\n\n return a.barcode < b.barcode;\n\n } \n\n } else {\n\n return a.count < b.count;\n\n }\n\n};\n\n\n\ninline bool ncmp4(const TP &a, const TP &b) {\n\n if (a.first.count == b.first.count) {\n\n if (a.first.barcode == b.first.barcode) {\n\n if (a.first.UMI == b.first.UMI) {\n\n if (a.first.ec == b.first.ec) {\n\n return a.second > b.second;\n\n } else {\n\n return a.first.ec > b.first.ec;\n\n }\n\n } else {\n", "file_path": "src/bustools_sort.cpp", "rank": 28, "score": 40836.51971074829 }, { "content": "struct SortedVectorHasher {\n\n size_t operator()(const std::vector<int32_t>& v) const {\n\n uint64_t r = 0;\n\n int i=0;\n\n for (auto x : v) {\n\n uint64_t t = std::hash<int32_t>{}(x);\n\n t = (x>>i) | (x<<(64-i));\n\n r = r ^ t;\n\n i = (i+1)%64;\n\n }\n\n return r;\n\n }\n\n};\n\nstd::vector<int32_t> intersect(std::vector<int32_t> &u, std::vector<int32_t> &v);\n\nstd::vector<int32_t> union_vectors(const std::vector<std::vector<int32_t>> &v);\n\nstd::vector<int32_t> intersect_vectors(const std::vector<std::vector<int32_t>> &v);\n\nint32_t intersect_ecs(const std::vector<int32_t> &ecs, std::vector<int32_t> &u, const std::vector<int32_t> &genemap, std::vector<std::vector<int32_t>> &ecmap, std::unordered_map<std::vector<int32_t>, int32_t, SortedVectorHasher> &ecmapinv, std::vector<std::vector<int32_t>> &ec2genes);\n\nvoid vt2gene(const std::vector<int32_t> &v, const std::vector<int32_t> &genemap, std::vector<int32_t> &glist);\n\nvoid intersect_genes_of_ecs(const std::vector<int32_t> &ecs, const std::vector<std::vector<int32_t>> &ec2genes, std::vector<int32_t> &glist);\n\nint32_t intersect_ecs_with_genes(const std::vector<int32_t> &ecs, const std::vector<int32_t> &genemap, std::vector<std::vector<int32_t>> &ecmap, std::unordered_map<std::vector<int32_t>, int32_t, SortedVectorHasher> &ecmapinv, std::vector<std::vector<int32_t>> &ec2genes, bool assumeIntersectionIsEmpty = true);\n\nvoid create_ec2genes(const std::vector<std::vector<int32_t>> &ecmap, const std::vector<int32_t> &genemap, std::vector<std::vector<int32_t>> &ec2gene);\n\n\n\n\n\n\n\n\n\n#endif // BUSTOOLS_COMMON_HPP\n", "file_path": "src/Common.hpp", "rank": 29, "score": 37672.75997087697 }, { "content": " uint8_t flags;\n", "file_path": "src/roaring.h", "rank": 30, "score": 36433.3078695566 }, { "content": "int32_t array_container_read(int32_t cardinality, array_container_t *container,\n\n const char *buf) {\n\n if (container->capacity < cardinality) {\n\n array_container_grow(container, cardinality, false);\n\n }\n\n container->cardinality = cardinality;\n\n memcpy(container->array, buf, container->cardinality * sizeof(uint16_t));\n\n\n\n return array_container_size_in_bytes(container);\n", "file_path": "src/roaring.c", "rank": 31, "score": 33889.1870571214 }, { "content": "int32_t run_container_read(int32_t cardinality, run_container_t *container,\n\n const char *buf) {\n\n (void)cardinality;\n\n memcpy(&container->n_runs, buf, sizeof(uint16_t));\n\n if (container->n_runs > container->capacity)\n\n run_container_grow(container, container->n_runs, false);\n\n if(container->n_runs > 0) {\n\n memcpy(container->runs, buf + sizeof(uint16_t),\n\n container->n_runs * sizeof(rle16_t));\n\n }\n\n return run_container_size_in_bytes(container);\n", "file_path": "src/roaring.c", "rank": 32, "score": 33889.1870571214 }, { "content": "int32_t bitset_container_read(int32_t cardinality, bitset_container_t *container,\n\n\t\tconst char *buf) {\n\n\tcontainer->cardinality = cardinality;\n\n\tmemcpy(container->array, buf, BITSET_CONTAINER_SIZE_IN_WORDS * sizeof(uint64_t));\n\n\treturn bitset_container_size_in_bytes(container);\n", "file_path": "src/roaring.c", "rank": 33, "score": 33889.1870571214 }, { "content": "int32_t array_container_number_of_runs(const array_container_t *a) {\n\n // Can SIMD work here?\n\n int32_t nr_runs = 0;\n\n int32_t prev = -2;\n\n for (const uint16_t *p = a->array; p != a->array + a->cardinality; ++p) {\n\n if (*p != prev + 1) nr_runs++;\n\n prev = *p;\n\n }\n\n return nr_runs;\n", "file_path": "src/roaring.c", "rank": 34, "score": 32770.87097567382 }, { "content": "int bitset_container_number_of_runs(bitset_container_t *b) {\n\n int num_runs = 0;\n\n uint64_t next_word = b->array[0];\n\n\n\n for (int i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS-1; ++i) {\n\n uint64_t word = next_word;\n\n next_word = b->array[i+1];\n\n num_runs += hamming((~word) & (word << 1)) + ( (word >> 63) & ~next_word);\n\n }\n\n\n\n uint64_t word = next_word;\n\n num_runs += hamming((~word) & (word << 1));\n\n if((word & 0x8000000000000000ULL) != 0)\n\n num_runs++;\n\n return num_runs;\n", "file_path": "src/roaring.c", "rank": 35, "score": 32766.127120372283 }, { "content": "uint32_t roaring_read_uint32_iterator(roaring_uint32_iterator_t *it, uint32_t* buf, uint32_t count) {\n\n uint32_t ret = 0;\n\n uint32_t num_values;\n\n uint32_t wordindex; // used for bitsets\n\n uint64_t word; // used for bitsets\n\n const array_container_t* acont; //TODO remove\n\n const run_container_t* rcont; //TODO remove\n\n const bitset_container_t* bcont; //TODO remove\n\n\n\n while (it->has_value && ret < count) {\n\n switch (it->typecode) {\n\n case BITSET_CONTAINER_TYPE_CODE:\n\n bcont = (const bitset_container_t*)(it->container);\n\n wordindex = it->in_container_index / 64;\n\n word = bcont->array[wordindex] & (UINT64_MAX << (it->in_container_index % 64));\n\n do {\n\n while (word != 0 && ret < count) {\n\n buf[0] = it->highbits | (wordindex * 64 + __builtin_ctzll(word));\n\n word = word & (word - 1);\n\n buf++;\n\n ret++;\n\n }\n\n while (word == 0 && wordindex+1 < BITSET_CONTAINER_SIZE_IN_WORDS) {\n\n wordindex++;\n\n word = bcont->array[wordindex];\n\n }\n\n } while (word != 0 && ret < count);\n\n it->has_value = (word != 0);\n\n if (it->has_value) {\n\n it->in_container_index = wordindex * 64 + __builtin_ctzll(word);\n\n it->current_value = it->highbits | it->in_container_index;\n\n }\n\n break;\n\n case ARRAY_CONTAINER_TYPE_CODE:\n\n acont = (const array_container_t *)(it->container);\n\n num_values = minimum_uint32(acont->cardinality - it->in_container_index, count - ret);\n\n for (uint32_t i = 0; i < num_values; i++) {\n\n buf[i] = it->highbits | acont->array[it->in_container_index + i];\n\n }\n\n buf += num_values;\n\n ret += num_values;\n\n it->in_container_index += num_values;\n\n it->has_value = (it->in_container_index < acont->cardinality);\n\n if (it->has_value) {\n\n it->current_value = it->highbits | acont->array[it->in_container_index];\n\n }\n\n break;\n\n case RUN_CONTAINER_TYPE_CODE:\n\n rcont = (const run_container_t*)(it->container);\n\n //\"in_run_index\" name is misleading, read it as \"max_value_in_current_run\"\n\n do {\n\n uint32_t largest_run_value = it->highbits | (rcont->runs[it->run_index].value + rcont->runs[it->run_index].length);\n\n num_values = minimum_uint32(largest_run_value - it->current_value + 1, count - ret);\n\n for (uint32_t i = 0; i < num_values; i++) {\n\n buf[i] = it->current_value + i;\n\n }\n\n it->current_value += num_values; // this can overflow to zero: UINT32_MAX+1=0\n\n buf += num_values;\n\n ret += num_values;\n\n\n\n if (it->current_value > largest_run_value || it->current_value == 0) {\n\n it->run_index++;\n\n if (it->run_index < rcont->n_runs) {\n\n it->current_value = it->highbits | rcont->runs[it->run_index].value;\n\n } else {\n\n it->has_value = false;\n\n }\n\n }\n\n } while ((ret < count) && it->has_value);\n\n break;\n\n default:\n\n assert(false);\n\n }\n\n if (it->has_value) {\n\n assert(ret == count);\n\n return ret;\n\n }\n\n it->container_index++;\n\n it->has_value = loadfirstvalue(it);\n\n }\n\n return ret;\n", "file_path": "src/roaring.c", "rank": 36, "score": 32754.161681868125 }, { "content": "static bool iter_new_container_partial_init(roaring_uint32_iterator_t *newit) {\n\n newit->in_container_index = 0;\n\n newit->run_index = 0;\n\n newit->current_value = 0;\n\n if (newit->container_index >= newit->parent->high_low_container.size ||\n\n newit->container_index < 0) {\n\n newit->current_value = UINT32_MAX;\n\n return (newit->has_value = false);\n\n }\n\n // assume not empty\n\n newit->has_value = true;\n\n // we precompute container, typecode and highbits so that successive\n\n // iterators do not have to grab them from odd memory locations\n\n // and have to worry about the (easily predicted) container_unwrap_shared\n\n // call.\n\n newit->container =\n\n newit->parent->high_low_container.containers[newit->container_index];\n\n newit->typecode =\n\n newit->parent->high_low_container.typecodes[newit->container_index];\n\n newit->highbits =\n\n ((uint32_t)\n\n newit->parent->high_low_container.keys[newit->container_index])\n\n << 16;\n\n newit->container =\n\n container_unwrap_shared(newit->container, &(newit->typecode));\n\n return newit->has_value;\n", "file_path": "src/roaring.c", "rank": 37, "score": 31709.12893807664 }, { "content": "void ra_insert_new_key_value_at(roaring_array_t *ra, int32_t i, uint16_t key,\n\n void *container, uint8_t typecode) {\n\n extend_array(ra, 1);\n\n // May be an optimization opportunity with DIY memmove\n\n memmove(&(ra->keys[i + 1]), &(ra->keys[i]),\n\n sizeof(uint16_t) * (ra->size - i));\n\n memmove(&(ra->containers[i + 1]), &(ra->containers[i]),\n\n sizeof(void *) * (ra->size - i));\n\n memmove(&(ra->typecodes[i + 1]), &(ra->typecodes[i]),\n\n sizeof(uint8_t) * (ra->size - i));\n\n ra->keys[i] = key;\n\n ra->containers[i] = container;\n\n ra->typecodes[i] = typecode;\n\n ra->size++;\n", "file_path": "src/roaring.c", "rank": 38, "score": 31704.27924007504 }, { "content": " inbuf = std::cin.rdbuf();\n\n }\n\n std::istream in(inbuf);\n\n\n\n\n\n parseHeader(in, h);\n\n uint32_t bclen = h.bclen;\n\n uint32_t umilen = h.umilen;\n\n int rc = 0;\n\n while (true) {\n\n in.read((char*)p, N*sizeof(BUSData));\n\n size_t rc = in.gcount() / sizeof(BUSData);\n\n if (rc == 0) {\n\n break;\n\n }\n\n nr += rc;\n\n for (size_t i = 0; i < rc; i++) {\n\n o << binaryToString(p[i].barcode, bclen) << \"\\t\" << binaryToString(p[i].UMI,umilen) << \"\\t\" << p[i].ec << \"\\t\" << p[i].count;\n\n if (opt.text_dumpflags) {\n\n o << \"\\t\" << p[i].flags;\n", "file_path": "src/bustools_main.cpp", "rank": 43, "score": 28.7693248846226 }, { "content": "#include <iostream>\n\n#include <fstream>\n\n#include <cstring>\n\n\n\n#include \"Common.hpp\"\n\n#include \"BUSData.h\"\n\n\n\n#include \"bustools_count.h\"\n\n\n\n\n\nvoid bustools_count(Bustools_opt &opt) {\n\n BUSHeader h;\n\n size_t nr = 0;\n\n size_t N = 100000;\n\n uint32_t bclen = 0;\n\n BUSData* p = new BUSData[N];\n\n\n\n // read and parse the equivelence class files\n\n\n\n std::unordered_map<std::vector<int32_t>, int32_t, SortedVectorHasher> ecmapinv;\n", "file_path": "src/bustools_count.cpp", "rank": 44, "score": 27.852627341444276 }, { "content": "#include <iostream>\n\n#include <fstream>\n\n#include <algorithm>\n\n#include <cmath>\n\n\n\n#include \"Common.hpp\"\n\n#include \"BUSData.h\"\n\n\n\n#include \"bustools_whitelist.h\"\n\n\n\n#define ERROR_RATE 0.01\n\n\n\nvoid bustools_whitelist(Bustools_opt &opt) {\n\n BUSHeader h;\n\n size_t nr = 0;\n\n size_t N = 100000;\n\n BUSData *p = new BUSData[N];\n\n\n\n std::ofstream of(opt.output);\n\n std::ostream o(of.rdbuf());\n", "file_path": "src/bustools_whitelist.cpp", "rank": 45, "score": 27.568698296514608 }, { "content": " \n\n int rc = 0;\n\n while (true) {\n\n in.read((char*)p, N*sizeof(BUSData));\n\n size_t rc = in.gcount() / sizeof(BUSData);\n\n nr += rc;\n\n if (rc == 0) {\n\n break;\n\n }\n\n\n\n \n\n for (size_t i = 0; i < rc; i++) {\n\n if (p[i].barcode != current_bc) { \n\n // output whatever is in v\n\n if (!v.empty()) {\n\n if (!opt.count_collapse) {\n\n write_barcode_matrix(v);\n\n } else {\n\n write_barcode_matrix_collapsed(v);\n\n }\n", "file_path": "src/bustools_count.cpp", "rank": 46, "score": 26.402904203670747 }, { "content": " if (!outheader_written) {\n\n writeHeader(o, h);\n\n outheader_written = true;\n\n }\n\n\n\n while(true) {\n\n in.read((char*)p, N*sizeof(BUSData));\n\n size_t rc = in.gcount() / sizeof(BUSData);\n\n if (rc == 0) {\n\n break;\n\n }\n\n nr += rc;\n\n\n\n for (size_t i = 0; i < rc; i++) {\n\n bd = p[i];\n\n bool capt = false;\n\n\n\n if (opt.type == CAPTURE_TX) {\n\n if (bd.ec < 0 || bd.ec > ecmap.size()) {\n\n continue;\n", "file_path": "src/bustools_capture.cpp", "rank": 47, "score": 26.367210398465037 }, { "content": "#include <iostream>\n\n#include <fstream>\n\n#include <algorithm>\n\n\n\n#include \"Common.hpp\"\n\n#include \"BUSData.h\"\n\n\n\n#include \"bustools_project.h\"\n\n\n\nvoid bustools_project(Bustools_opt &opt) {\n\n uint32_t bclen = 0; \n\n uint32_t wc_bclen = 0;\n\n uint32_t umilen = 0;\n\n BUSHeader h;\n\n size_t nr = 0;\n\n size_t N = 100000;\n\n BUSData* p = new BUSData[N];\n\n char magic[4]; \n\n uint32_t version = 0;\n\n size_t stat_map = 0;\n", "file_path": "src/bustools_project.cpp", "rank": 48, "score": 26.26345528187614 }, { "content": "\n\n if (!outheader_written) {\n\n writeHeader(bus_out, h);\n\n outheader_written = true;\n\n }\n\n\n\n uint32_t bclen = h.bclen;\n\n uint32_t umilen = h.umilen;\n\n int rc = 0;\n\n while (true) {\n\n in.read((char*)p, N*sizeof(BUSData));\n\n size_t rc = in.gcount() / sizeof(BUSData);\n\n if (rc == 0) {\n\n break;\n\n }\n\n nr += rc;\n\n \n\n for (size_t i = 0; i < rc; i++) {\n\n bd = p[i];\n\n auto it = project_map.find(bd.barcode);\n", "file_path": "src/bustools_project.cpp", "rank": 49, "score": 26.13870592686815 }, { "content": " std::ostream o(buf);\n\n\n\n BUSHeader h;\n\n size_t nr = 0;\n\n size_t nw = 0;\n\n size_t N = 100000;\n\n BUSData *p = new BUSData[N];\n\n uint32_t bclen = 0;\n\n int start, end, preShift;\n\n uint64_t preMask, sufMask;\n\n\n\n auto infn = opt.files.begin();\n\n\n\n do {\n\n std::streambuf *inbuf;\n\n std::ifstream inf;\n\n if (!opt.stream_in) {\n\n inf.open(infn->c_str(), std::ios::binary);\n\n inbuf = inf.rdbuf();\n\n } else {\n", "file_path": "src/bustools_linker.cpp", "rank": 50, "score": 25.44095132037365 }, { "content": "#include <iostream>\n\n#include <fstream>\n\n#include <cstring>\n\n#include <map>\n\n#include <time.h>\n\n\n\n#include \"Common.hpp\"\n\n#include \"BUSData.h\"\n\n\n\n#include \"bustools_linker.h\"\n\n\n\nvoid bustools_linker(Bustools_opt &opt) {\n\n std::streambuf *buf = nullptr;\n\n std::ofstream of;\n\n if (!opt.stream_out) {\n\n of.open(opt.output); \n\n buf = of.rdbuf();\n\n } else {\n\n buf = std::cout.rdbuf();\n\n }\n", "file_path": "src/bustools_linker.cpp", "rank": 52, "score": 24.519760541163865 }, { "content": " opt.temp_files = optarg;\n\n break;\n\n case 'c':\n\n opt.type = SORT_COUNT;\n\n break;\n\n case 'u':\n\n opt.type = SORT_UMI;\n\n break;\n\n case 'F':\n\n opt.type = SORT_F;\n\n break;\n\n case 'p':\n\n opt.stream_out = true;\n\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n\n\n // all other arguments are fast[a/q] files to be read\n", "file_path": "src/bustools_main.cpp", "rank": 53, "score": 23.676038098859173 }, { "content": " uint32_t bclen = h.bclen;\n\n uint32_t umilen = h.umilen;\n\n int rc = 0;\n\n while (true) {\n\n in.read((char*)p, N*sizeof(BUSData));\n\n size_t rc = in.gcount() / sizeof(BUSData);\n\n if (rc == 0) {\n\n break;\n\n }\n\n nr += rc;\n\n \n\n for (size_t i = 0; i < rc; i++) {\n\n bd = p[i];\n\n auto it = project_map.find(bd.UMI);\n\n if (it != project_map.end()){\n\n stat_map++;\n\n uint64_t dest = project_map[bd.UMI];\n\n bd.UMI = dest;\n\n bus_out.write((char*) &bd, sizeof(bd));\n\n } else {\n", "file_path": "src/bustools_project.cpp", "rank": 54, "score": 23.525291453934965 }, { "content": " size_t nr = 0;\n\n size_t nw = 0;\n\n size_t N = 100000;\n\n BUSData *p = new BUSData[N];\n\n BUSData currRec;\n\n // Gene EC --> counts for current barcode/UMI pair\n\n std::unordered_map<uint32_t, uint32_t> counts;\n\n \n\n while (true) {\n\n in.read((char*) p, N * sizeof(BUSData));\n\n size_t rc = in.gcount() / sizeof(BUSData);\n\n if (rc == 0) {\n\n break;\n\n }\n\n nr += rc;\n\n\n\n for (size_t i = 0; i < rc; i++) {\n\n if (currRec.barcode != p[i].barcode || currRec.UMI != p[i].UMI) {\n\n // Output BUG record\n\n for (const auto &rec : counts) {\n", "file_path": "src/bustools_project.cpp", "rank": 55, "score": 23.199219217176022 }, { "content": " } else {\n\n for (const auto &f : opt.fastq) {\n\n if (!checkFileExists(f)) {\n\n std::cerr << \"Error: File not found, \" << f << std::endl;\n\n ret = false;\n\n }\n\n }\n\n }\n\n\n\n if (opt.nFastqs == 0) {\n\n std::cerr << \"Error: nFastqs is zero\" << std::endl;\n\n ret = false;\n\n } else {\n\n if (opt.fastq.size() % opt.nFastqs != 0) {\n\n std::cerr << \"Error: incorrect number of FASTQ file(s)\" << std::endl;\n\n ret = false;\n\n }\n\n }\n\n \n\n return ret;\n", "file_path": "src/bustools_main.cpp", "rank": 57, "score": 23.091898503353057 }, { "content": " default:\n\n break;\n\n }\n\n }\n\n\n\n /* All other argumuments are (sorted) BUS files. */\n\n while (optind < argc) opt.files.push_back(argv[optind++]);\n\n \n\n if (opt.files.size() == 1 && opt.files[0] == \"-\") {\n\n opt.stream_in = true;\n\n }\n\n}\n\n\n\nvoid parse_ProgramOptions_extract(int argc, char **argv, Bustools_opt &opt) {\n\n \n\n /* Parse options. */\n\n const char *opt_string = \"o:f:N:p\";\n\n\n\n static struct option long_options[] = {\n\n {\"output\", required_argument, 0, 'o'},\n", "file_path": "src/bustools_main.cpp", "rank": 58, "score": 22.79276610104442 }, { "content": "\n\n size_t nr = 0, nw = 0;\n\n size_t N = 100000;\n\n uint32_t bclen = 0;\n\n BUSData* p = new BUSData[N];\n\n BUSData bd;\n\n\n\n for (const auto& infn : opt.files) { \n\n\n\n std::streambuf *inbuf;\n\n std::ifstream inf;\n\n if (!opt.stream_in) {\n\n inf.open(infn.c_str(), std::ios::binary);\n\n inbuf = inf.rdbuf();\n\n } else {\n\n inbuf = std::cin.rdbuf();\n\n }\n\n std::istream in(inbuf); \n\n parseHeader(in, h);\n\n\n", "file_path": "src/bustools_capture.cpp", "rank": 59, "score": 22.75760647731404 }, { "content": " }\n\n std::ostream bus_out(buf);\n\n\n\n bool outheader_written = false;\n\n\n\n\n\n\n\n nr = 0;\n\n BUSData bd;\n\n for (const auto& infn : opt.files) { \n\n std::streambuf *inbuf;\n\n std::ifstream inf;\n\n if (!opt.stream_in) {\n\n inf.open(infn.c_str(), std::ios::binary);\n\n inbuf = inf.rdbuf();\n\n } else {\n\n inbuf = std::cin.rdbuf();\n\n }\n\n std::istream in(inbuf); \n\n parseHeader(in, h);\n", "file_path": "src/bustools_project.cpp", "rank": 60, "score": 22.408495669475705 }, { "content": " r = r << 2;\n\n r |= (x + ((x ^ (*s & 2)) >>1));\n\n s++;\n\n }\n\n if (numN>0) {\n\n if (numN > 3) {\n\n numN = 3; \n\n } \n\n flag = (numN & 3) | (posN & 15) << 2;\n\n }\n\n return r;\n\n}\n\n\n\n\n\nbool parseHeader(std::istream &inf, BUSHeader &header) {\n\n char magic[4]; \n\n inf.read((char*)(&magic[0]), 4);\n\n if (std::strcmp(&magic[0], \"BUS\\0\") != 0) {\n\n return false;\n\n }\n", "file_path": "src/BUSData.cpp", "rank": 61, "score": 21.99610438575893 }, { "content": " break;\n\n case 'f':\n\n opt.filter = true;\n\n break;\n\n case 'p':\n\n opt.stream_out = true;\n\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n\n\n while (optind < argc) opt.files.push_back(argv[optind++]);\n\n\n\n if (opt.files.size() == 1 && opt.files[0] == \"-\") {\n\n opt.stream_in = true;\n\n }\n\n}\n\n\n\nvoid parse_ProgramOptions_count(int argc, char **argv, Bustools_opt& opt) {\n", "file_path": "src/bustools_main.cpp", "rank": 62, "score": 21.978415631799663 }, { "content": " std::ofstream of;\n\n\n\n if (!opt.stream_out) {\n\n of.open(opt.output); \n\n buf = of.rdbuf();\n\n } else {\n\n buf = std::cout.rdbuf();\n\n }\n\n std::ostream o(buf);\n\n\n\n\n\n char magic[4]; \n\n uint32_t version = 0;\n\n for (const auto& infn : opt.files) { \n\n std::streambuf *inbuf;\n\n std::ifstream inf;\n\n if (!opt.stream_in) {\n\n inf.open(infn.c_str(), std::ios::binary);\n\n inbuf = inf.rdbuf();\n\n } else {\n", "file_path": "src/bustools_main.cpp", "rank": 63, "score": 21.859054557405685 }, { "content": "#include <iostream>\n\n#include <fstream>\n\n#include <cstring>\n\n#include <map>\n\n\n\n#include \"Common.hpp\"\n\n#include \"BUSData.h\"\n\n\n\n#include \"bustools_inspect.h\"\n\n\n\n// From kallisto PlaintextWriter.cpp\n\nstd::string to_json(const std::string& id, const std::string& val, bool quote,\n\n bool comma = true, int level = 1) {\n\n std::string out;\n\n\n\n for (auto i = 0; i < level; ++i) {\n\n out += \"\\t\";\n\n }\n\n\n\n out += '\"';\n", "file_path": "src/bustools_inspect.cpp", "rank": 64, "score": 21.726707615182693 }, { "content": " if (rc == 0) {\n\n break;\n\n }\n\n nr += rc;\n\n\n\n for (size_t i = 0; i < rc; i++) {\n\n uint64_t prefix = p[i].barcode & preMask;\n\n prefix >>= preShift;\n\n uint64_t suffix = p[i].barcode & sufMask;\n\n p[i].barcode = prefix + suffix;\n\n o.write((char *) &p[i], sizeof(BUSData));\n\n ++nw;\n\n }\n\n /* Done going through BUSdata *p. */\n\n\n\n }\n\n /* Done reading BUS file. */\n\n \n\n } while (++infn != opt.files.end());\n\n\n\n delete[] p; p = nullptr;\n\n of.close();\n\n\n\n std::cerr << \"Read in \" << nr << \" BUS records, wrote \" << nw << \" BUS records\" << std::endl;\n\n}\n\n\n", "file_path": "src/bustools_linker.cpp", "rank": 65, "score": 21.703413224923455 }, { "content": " }\n\n wl.close();\n\n }\n\n\n\n /* Inspect. */\n\n size_t N = 100000;\n\n BUSData *p = new BUSData[N];\n\n\n\n std::streambuf *inbuf;\n\n std::ifstream inf;\n\n if (!opt.stream_in) {\n\n inf.open(opt.files[0].c_str(), std::ios::binary);\n\n inbuf = inf.rdbuf();\n\n } else {\n\n inbuf = std::cin.rdbuf();\n\n }\n\n std::istream in(inbuf);\n\n parseHeader(in, h);\n\n\n\n /* Number of records. */\n", "file_path": "src/bustools_inspect.cpp", "rank": 66, "score": 21.45080095734774 }, { "content": " << std::endl;\n\n}\n\n\n\nvoid Bustools_extract_Usage() {\n\n std::cout << \"Usage: bustools extract [options] sorted-bus-file\" << std::endl\n\n << \" Note: BUS file should be sorted by flag using bustools sort --flag\" << std::endl << std::endl\n\n << \"Options: \" << std::endl\n\n << \"-o, --output Output directory for FASTQ files\" << std::endl\n\n << \"-f, --fastq FASTQ file(s) from which to extract reads (comma-separated list)\" << std::endl\n\n << \"-N, --nFastqs Number of FASTQ file(s) per run\" << std::endl\n\n << std::endl;\n\n}\n\n\n\nvoid print_citation() {\n\n std::cout << \"When using this program in your research, please cite\" << std::endl << std::endl\n\n << \" Melsted, P., Booeshaghi, A. S., et al.\" << std::endl\n\n << \" Modular and efficient pre-processing of single-cell RNA-seq, \"<< std::endl\n\n << \" bioRxiv doi:10.1101/673285\" << std::endl\n\n << std::endl;\n\n}\n", "file_path": "src/bustools_main.cpp", "rank": 67, "score": 21.184155789292817 }, { "content": "#include <iostream>\n\n#include <fstream>\n\n#include <algorithm>\n\n#include <queue>\n\n#include <functional>\n\n\n\n#include \"Common.hpp\"\n\n#include \"BUSData.h\"\n\n\n\n#include \"bustools_merge.h\"\n\n\n\n#define TP std::pair<BUSData, int>\n\n\n\ninline bool ncmp(const TP &a, const TP &b) {\n\n if (a.first.flags == b.first.flags) {\n\n if (a.first.ec == b.first.ec) {\n\n return a.second > b.second;\n\n } else {\n\n return a.first.ec > b.first.ec;\n\n }\n", "file_path": "src/bustools_merge.cpp", "rank": 68, "score": 21.156945117173063 }, { "content": " std::cerr << \"Error: Missing BUS input files\" << std::endl;\n\n ret = false;\n\n } else {\n\n if (!opt.stream_in) {\n\n for (const auto& it : opt.files) { \n\n if (!checkFileExists(it)) {\n\n std::cerr << \"Error: File not found, \" << it << std::endl;\n\n ret = false;\n\n }\n\n }\n\n }\n\n }\n\n \n\n return ret;\n\n}\n\n\n\nbool check_ProgramOptions_extract(Bustools_opt &opt) {\n\n bool ret = true;\n\n \n\n if (opt.output.empty()) {\n", "file_path": "src/bustools_main.cpp", "rank": 69, "score": 20.90951092468751 }, { "content": " bclen = h.bclen;\n\n\n\n if (bclen != wc_bclen) { \n\n std::cerr << \"Error: barcode length and whitelist length differ, barcodes = \" << bclen << \", whitelist = \" << wc_bclen << std::endl\n\n << \" check that your whitelist matches the technology used\" << std::endl;\n\n\n\n exit(1);\n\n }\n\n }\n\n if (umilen == 0) {\n\n umilen = h.umilen;\n\n }\n\n\n\n int rc = 0;\n\n while (true) {\n\n in.read((char*)p, N*sizeof(BUSData));\n\n size_t rc = in.gcount() / sizeof(BUSData);\n\n if (rc == 0) {\n\n break;\n\n }\n", "file_path": "src/bustools_correct.cpp", "rank": 70, "score": 20.896529951144785 }, { "content": "\n\n /* Determine threshold. */ \n\n if (opt.threshold) { // Custom threshold\n\n threshold = opt.threshold;\n\n } else { // Determine threshold from BUS data\n\n /* Get counts for all barcodes in first >=200 barcodes. */\n\n std::vector<wl_Record> vec;\n\n\n\n while (true) { \n\n in.read((char*) p, N * sizeof(BUSData));\n\n rc = in.gcount() / sizeof(BUSData);\n\n if (rc == 0) {\n\n break;\n\n }\n\n nr += rc;\n\n\n\n for (size_t i = 0; i < rc; i++) {\n\n if (curr_bc != p[i].barcode) {\n\n if (bc_count != -1) {\n\n vec.emplace_back(curr_bc, bc_r, bc_u, bc_count);\n", "file_path": "src/bustools_whitelist.cpp", "rank": 71, "score": 20.59116454319671 }, { "content": " for (const auto& it : opt.files) { \n\n if (!checkFileExists(it)) {\n\n std::cerr << \"Error: File not found, \" << it << std::endl;\n\n ret = false;\n\n }\n\n }\n\n }\n\n\n\n return ret;\n\n}\n\n\n\n\n\n\n\nbool check_ProgramOptions_merge(Bustools_opt& opt) {\n\n bool ret = true;\n\n \n\n if (opt.output.empty()) {\n\n std::cerr << \"Error: missing output directory\" << std::endl;\n\n } else {\n\n // check if output directory exists or if we can create it\n", "file_path": "src/bustools_main.cpp", "rank": 72, "score": 20.445548914997907 }, { "content": " bool ret = true;\n\n\n\n size_t max_threads = std::thread::hardware_concurrency();\n\n\n\n if (opt.threads <= 0) {\n\n std::cerr << \"Error: Number of threads cannot be less than or equal to 0\" << std::endl;\n\n ret = false;\n\n } else if (opt.threads > max_threads) {\n\n std::cerr << \"Warning: Number of threads cannot be greater than or equal to \" << max_threads \n\n << \". Setting number of threads to \" << max_threads << std::endl;\n\n opt.threads = max_threads;\n\n }\n\n\n\n if (!opt.stream_out) {\n\n if (opt.output.empty()) {\n\n std::cerr << \"Error: missing output file\" << std::endl;\n\n ret = false;\n\n } else if (!checkOutputFileValid(opt.output)) {\n\n std::cerr << \"Error: unable to open output file\" << std::endl;\n\n ret = false;\n", "file_path": "src/bustools_main.cpp", "rank": 73, "score": 20.424025861392977 }, { "content": "\n\nvoid print_version() {\n\n std::cout << \"bustools, version \" << \tBUSTOOLS_VERSION << std::endl;\n\n}\n\n\n\n\n\nint main(int argc, char **argv) {\n\n\n\n if (argc < 2) {\n\n // Print error message, function?\n\n Bustools_Usage();\n\n exit(1);\n\n } else {\n\n bool disp_help = argc == 2;\n\n std::string cmd(argv[1]);\n\n Bustools_opt opt;\n\n\n\n\n\n if (cmd == \"sort\") {\n\n if (disp_help) {\n", "file_path": "src/bustools_main.cpp", "rank": 74, "score": 20.352218267974653 }, { "content": " ret = false;\n\n }\n\n }\n\n }\n\n\n\n if (opt.files.size() == 0) {\n\n std::cerr << \"Error: Missing BUS input files\" << std::endl;\n\n ret = false;\n\n } else if (!opt.stream_in) { \n\n for (const auto& it : opt.files) { \n\n if (!checkFileExists(it)) {\n\n std::cerr << \"Error: File not found, \" << it << std::endl;\n\n ret = false;\n\n }\n\n }\n\n }\n\n\n\n if (opt.filter && (opt.complement || opt.type != CAPTURE_TX)) {\n\n std::cerr << \"Warning: filter only meaningful without complement flag, and to\"\n\n << \" capture transcripts; no new ec file will be generated\" << std::endl;\n", "file_path": "src/bustools_main.cpp", "rank": 75, "score": 20.200363502255314 }, { "content": " inf.read((char*)(&header.version), sizeof(header.version));\n\n if (header.version != BUSFORMAT_VERSION) {\n\n return false;\n\n }\n\n inf.read((char*)(&header.bclen), sizeof(header.bclen));\n\n inf.read((char*)(&header.umilen), sizeof(header.umilen));\n\n uint32_t tlen = 0;\n\n inf.read((char*)(&tlen), sizeof(tlen));\n\n char* t = new char[tlen+1];\n\n inf.read(t, tlen);\n\n t[tlen] = '\\0';\n\n header.text.assign(t);\n\n delete[] t;\n\n\n\n return true;\n\n}\n\n\n\n\n\n\n\nbool parseECs(const std::string &filename, BUSHeader &header) {\n", "file_path": "src/BUSData.cpp", "rank": 76, "score": 20.148352491593755 }, { "content": " }\n\n if (em_flag) {\n\n opt.count_em = true;\n\n }\n\n\n\n while (optind < argc) opt.files.push_back(argv[optind++]);\n\n\n\n if (opt.files.size() == 1 && opt.files[0] == \"-\") {\n\n opt.stream_in = true;\n\n }\n\n}\n\n\n\nvoid parse_ProgramOptions_dump(int argc, char **argv, Bustools_opt& opt) {\n\n\n\n const char* opt_string = \"o:pf\";\n\n\n\n static struct option long_options[] = {\n\n {\"output\", required_argument, 0, 'o'},\n\n {\"pipe\", no_argument, 0, 'p'},\n\n {\"flags\", no_argument, 0, 'f'},\n", "file_path": "src/bustools_main.cpp", "rank": 77, "score": 20.107195280880653 }, { "content": "\n\n nr = 0;\n\n BUSData bd;\n\n for (const auto& infn : opt.files) { \n\n std::streambuf *inbuf;\n\n std::ifstream inf;\n\n if (!opt.stream_in) {\n\n inf.open(infn.c_str(), std::ios::binary);\n\n inbuf = inf.rdbuf();\n\n } else {\n\n inbuf = std::cin.rdbuf();\n\n }\n\n std::istream in(inbuf); \n\n parseHeader(in, h);\n\n\n\n if (!outheader_written) {\n\n writeHeader(bus_out, h);\n\n outheader_written = true;\n\n }\n\n\n", "file_path": "src/bustools_project.cpp", "rank": 78, "score": 19.904072929794324 }, { "content": " opt.stream_out = true;\n\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n\n\n /* All other argumuments are (sorted) BUS files. */\n\n while (optind < argc) opt.files.push_back(argv[optind++]);\n\n \n\n if (opt.files.size() == 1 && opt.files[0] == \"-\") {\n\n opt.stream_in = true;\n\n }\n\n}\n\n\n\n\n\n\n\n\n\nbool check_ProgramOptions_sort(Bustools_opt& opt) {\n\n\n", "file_path": "src/bustools_main.cpp", "rank": 79, "score": 19.8648952991881 }, { "content": "\n\n return ret;\n\n}\n\n\n\nbool check_ProgramOptions_inspect(Bustools_opt &opt) {\n\n bool ret = true;\n\n\n\n if (opt.output.size() && !checkOutputFileValid(opt.output)) {\n\n std::cerr << \"Error: unable to open output file\" << std::endl;\n\n ret = false;\n\n }\n\n \n\n if (opt.files.size() == 0) {\n\n std::cerr << \"Error: Missing BUS input file\" << std::endl;\n\n ret = false;\n\n } else if (opt.files.size() == 1) {\n\n if (!opt.stream_in) {\n\n for (const auto& it : opt.files) {\n\n if (!checkFileExists(it)) {\n\n std::cerr << \"Error: File not found, \" << it << std::endl;\n", "file_path": "src/bustools_main.cpp", "rank": 80, "score": 19.7644631734095 }, { "content": " nr = 0;\n\n BUSData bd;\n\n for (const auto& infn : opt.files) { \n\n std::streambuf *inbuf;\n\n std::ifstream inf;\n\n if (!opt.stream_in) {\n\n inf.open(infn.c_str(), std::ios::binary);\n\n inbuf = inf.rdbuf();\n\n } else {\n\n inbuf = std::cin.rdbuf();\n\n }\n\n std::istream in(inbuf); \n\n parseHeader(in, h);\n\n\n\n if (!outheader_written) {\n\n writeHeader(bus_out, h);\n\n outheader_written = true;\n\n }\n\n\n\n if (bclen == 0) {\n", "file_path": "src/bustools_correct.cpp", "rank": 81, "score": 19.73132415577178 }, { "content": " {\"fastq\", required_argument, 0, 'f'},\n\n {\"nFastqs\", required_argument, 0, 'N'},\n\n {\"pipe\", no_argument, 0, 'p'},\n\n {0, 0, 0, 0}\n\n };\n\n\n\n int option_index = 0, c;\n\n\n\n while ((c = getopt_long(argc, argv, opt_string, long_options, &option_index)) != -1) {\n\n switch (c) {\n\n case 'o':\n\n opt.output = optarg;\n\n break;\n\n case 'f':\n\n opt.fastq = parseList(optarg);\n\n break;\n\n case 'N':\n\n opt.nFastqs = std::stoi(optarg);\n\n break;\n\n case 'p':\n", "file_path": "src/bustools_main.cpp", "rank": 82, "score": 19.483415711425547 }, { "content": "#include \"BUSData.h\"\n\n\n\n#include <cstring>\n\n#include <assert.h>\n\n#include <unordered_map>\n\n#include <sstream>\n\n#include <iostream>\n\n\n\nuint64_t stringToBinary(const std::string &s, uint32_t &flag) {\n\n return stringToBinary(s.c_str(), s.size(), flag);\n\n}\n\n\n\nstd::string binaryToString(uint64_t x, size_t len) {\n\n std::string s(len, 'N');\n\n size_t sh = len-1;\n\n for (size_t i = 0; i < len; i++) {\n\n char c = 'N';\n\n switch((x >> (2*sh)) & 0x03ULL) {\n\n case 0x00: c = 'A'; break;\n\n case 0x01: c = 'C'; break;\n", "file_path": "src/BUSData.cpp", "rank": 83, "score": 19.130096094225458 }, { "content": " }\n\n\n\n // all other arguments are fast[a/q] files to be read\n\n while (optind < argc) opt.files.push_back(argv[optind++]);\n\n\n\n if (opt.files.size() == 1 && opt.files[0] == \"-\") {\n\n opt.stream_in = true;\n\n }\n\n}\n\n\n\nvoid parse_ProgramOptions_correct(int argc, char **argv, Bustools_opt& opt) {\n\n\n\n const char* opt_string = \"o:w:p\";\n\n static struct option long_options[] = {\n\n {\"output\", required_argument, 0, 'o'},\n\n {\"whitelist\", required_argument, 0, 'w'},\n\n {\"pipe\", no_argument, 0, 'p'},\n\n {0, 0, 0, 0 }\n\n };\n\n\n", "file_path": "src/bustools_main.cpp", "rank": 85, "score": 18.043092889108447 }, { "content": " }\n\n // Done going through BUSdata *p.\n\n }\n\n // Done reading BUS file. \n\n\n\n for (const auto &rec : counts) {\n\n ++nw;\n\n currRec.ec = rec.first;\n\n currRec.count = rec.second;\n\n o.write((char *) &currRec, sizeof(BUSData));\n\n }\n\n\n\n delete[] p; p = nullptr;\n\n of.close();\n\n\n\n\n\n std::cerr << \"Read in \" << nr << \" BUS records, wrote \" << nw << \" BUG records\" << std::endl;\n\n }\n\n/////////////////////////////////////////////////////////////////////\n\n/*\n\n if (opt.type == PROJECT_TX) { \n\n \n\n }\n\n */\n\n \n\n}\n", "file_path": "src/bustools_project.cpp", "rank": 86, "score": 17.830554140537288 }, { "content": " else\n\n return roaring_bitmap_serialize(&roaring, buf);\n\n }\n\n\n\n /**\n\n * read a bitmap from a serialized version. This is meant to be compatible\n\n * with the Java and Go versions.\n\n *\n\n * Setting the portable flag to false enable a custom format that\n\n * can save space compared to the portable format (e.g., for very\n\n * sparse bitmaps).\n\n *\n\n * This function is unsafe in the sense that if you provide bad data,\n\n * many, many bytes could be read. See also readSafe.\n\n */\n\n static Roaring read(const char *buf, bool portable = true) {\n\n roaring_bitmap_t * r = portable ? roaring_bitmap_portable_deserialize(buf) : roaring_bitmap_deserialize(buf);\n\n if (r == NULL) {\n\n throw std::runtime_error(\"failed alloc while reading\");\n\n }\n", "file_path": "src/roaring.hh", "rank": 87, "score": 17.792693800259208 }, { "content": " if (opt.files.size() == 0) {\n\n std::cerr << \"Error: Missing BUS input file\" << std::endl;\n\n ret = false;\n\n } else if (opt.files.size() == 1) {\n\n if (!opt.stream_in) {\n\n for (const auto& it : opt.files) {\n\n if (!checkFileExists(it)) {\n\n std::cerr << \"Error: File not found, \" << it << std::endl;\n\n ret = false;\n\n }\n\n }\n\n }\n\n } else {\n\n std::cerr << \"Error: Only one input file allowed\" << std::endl;\n\n ret = false;\n\n }\n\n\n\n if (opt.fastq.size() == 0) {\n\n std::cerr << \"Error: Missing FASTQ file(s)\" << std::endl;\n\n ret = false;\n", "file_path": "src/bustools_main.cpp", "rank": 88, "score": 17.789921482837514 }, { "content": " }\n\n }\n\n\n\n /* All other argumuments are (sorted) BUS files. */\n\n while (optind < argc) opt.files.push_back(argv[optind++]);\n\n \n\n if (opt.files.size() == 1 && opt.files[0] == \"-\") {\n\n opt.stream_in = true;\n\n }\n\n}\n\n\n\nvoid parse_ProgramOptions_linker(int argc, char **argv, Bustools_opt &opt) {\n\n \n\n /* Parse options. */\n\n const char *opt_string = \"o:s:e:p\";\n\n\n\n static struct option long_options[] = {\n\n {\"output\", required_argument, 0, 'o'},\n\n {\"start\", required_argument, 0, 's'},\n\n {\"end\", required_argument, 0, 'e'},\n", "file_path": "src/bustools_main.cpp", "rank": 89, "score": 17.743453176535514 }, { "content": "}\n\n\n\n\n\n\n\nvoid parse_ProgramOptions_sort(int argc, char **argv, Bustools_opt& opt) {\n\n\n\n const char* opt_string = \"t:o:m:T:cusp\";\n\n\n\n static struct option long_options[] = {\n\n {\"threads\", required_argument, 0, 't'},\n\n {\"output\", required_argument, 0, 'o'},\n\n {\"memory\", required_argument, 0, 'm'},\n\n {\"temp\", required_argument, 0, 'T'},\n\n {\"umi\", no_argument, 0, 'u'},\n\n {\"count\", no_argument, 0, 'c'},\n\n {\"flags\", no_argument, 0, 'F'},\n\n {\"pipe\", no_argument, 0, 'p'},\n\n {0, 0, 0, 0 }\n\n };\n\n\n", "file_path": "src/bustools_main.cpp", "rank": 90, "score": 17.65945021782534 }, { "content": " }\n\n /* Done determining threshold. */\n\n\n\n\n\n /* Go through remainder of records. */\n\n while (rc) {\n\n in.read((char*) p, N * sizeof(BUSData));\n\n rc = in.gcount() / sizeof(BUSData);\n\n if (rc == 0) {\n\n break;\n\n }\n\n nr += rc;\n\n\n\n for (size_t i = 0; i < rc; i++) {\n\n if (curr_bc != p[i].barcode || bc_count == -1) {\n\n if (bc_count >= threshold) {\n\n o << binaryToString(curr_bc, bclen) << \"\\n\";\n\n ++wl_count;\n\n }\n\n bc_count = p[i].count;\n", "file_path": "src/bustools_whitelist.cpp", "rank": 91, "score": 17.56462782538015 }, { "content": " std::cerr << \"Error: File not found \" << opt.count_txp << std::endl;\n\n ret = false;\n\n }\n\n }\n\n\n\n return ret;\n\n}\n\n\n\nbool check_ProgramOptions_whitelist(Bustools_opt &opt) {\n\n bool ret = true;\n\n\n\n if (opt.output.empty()) {\n\n std::cerr << \"Error: missing output file\" << std::endl;\n\n ret = false;\n\n } else if (!checkOutputFileValid(opt.output)) {\n\n std::cerr << \"Error: unable to open output file\" << std::endl;\n\n ret = false;\n\n }\n\n\n\n if (opt.files.size() == 0) {\n", "file_path": "src/bustools_main.cpp", "rank": 92, "score": 17.524029735353555 }, { "content": "\n\n /* All other argumuments are (sorted) BUS files. */\n\n while (optind < argc) opt.files.push_back(argv[optind++]);\n\n \n\n if (opt.files.size() == 1 && opt.files[0] == \"-\") {\n\n opt.stream_in = true;\n\n }\n\n}\n\n\n\nvoid parse_ProgramOptions_inspect(int argc, char **argv, Bustools_opt &opt) {\n\n \n\n /* Parse options. */\n\n const char *opt_string = \"o:e:w:p\";\n\n\n\n static struct option long_options[] = {\n\n {\"output\", required_argument, 0, 'o'},\n\n {\"ecmap\", required_argument, 0, 'e'},\n\n {\"whitelist\", required_argument, 0, 'w'},\n\n {\"pipe\", no_argument, 0, 'p'},\n\n {0, 0, 0, 0}\n", "file_path": "src/bustools_main.cpp", "rank": 93, "score": 17.308847381833157 }, { "content": " std::streambuf *inbuf;\n\n std::ifstream inf;\n\n if (!opt.stream_in) {\n\n inf.open(opt.files[0].c_str(), std::ios::binary);\n\n inbuf = inf.rdbuf();\n\n } else {\n\n inbuf = std::cin.rdbuf();\n\n }\n\n std::istream in(inbuf);\n\n parseHeader(in, h);\n\n\n\n uint32_t bclen = h.bclen;\n\n size_t rc = 1; // Non-zero so that second while loop works when using custom threshold\n\n int threshold;\n\n int wl_count = 0;\n\n \n\n uint32_t bc_r = 0, bc_u = 0;\n\n uint64_t curr_umi;\n\n uint64_t curr_bc;\n\n int bc_count = -1;\n", "file_path": "src/bustools_whitelist.cpp", "rank": 94, "score": 17.294163695138206 }, { "content": " \n\n if (opt.files.size() == 1 && opt.files[0] == \"-\") {\n\n opt.stream_in = true;\n\n }\n\n}\n\n\n\nvoid parse_ProgramOptions_project(int argc, char **argv, Bustools_opt &opt) {\n\n \n\n /* Parse options. */\n\n const char *opt_string = \"o:m:e:t:s:Fbup\";\n\n\n\n static struct option long_options[] = {\n\n {\"output\", required_argument, 0, 'o'},\n\n {\"map\", required_argument, 0, 'm'},\n\n {\"ecmap\", required_argument, 0, 'e'},\n\n {\"txnames\", required_argument, 0, 't'},\n\n {\"flags\", no_argument, 0, 'F'},\n\n {\"barcode\", no_argument, 0, 'b'},\n\n {\"umi\", no_argument, 0, 'u'},\n\n {\"transcripts\", optional_argument, 0, 's'},\n", "file_path": "src/bustools_main.cpp", "rank": 95, "score": 17.13765991973596 }, { "content": " } else {\n\n \n\n if (checkDirectoryExists(opt.temp_files)) {\n\n // if it is a directory, create random file prefix\n\n opt.temp_files += \"/bus.sort.\" + std::to_string(getpid()) + \".\";\n\n } else {\n\n if (opt.temp_files.at(opt.temp_files.size()-1) == '/') {\n\n // try creating the directory\n\n if (my_mkdir(opt.temp_files.c_str(),0777) == 0) {\n\n // \n\n opt.temp_files += \"/bus.sort.\" + std::to_string(getpid()) + \".\";\n\n } else {\n\n std::cerr << \"Error: directory \" << opt.temp_files << \" does not exist and could not be created. Check that the parent directory exists and you have write permissions.\" << std::endl;\n\n ret = false;\n\n } \n\n } else {\n\n int n = opt.temp_files.size();\n\n if (opt.temp_files[n-1] != '.') {\n\n opt.temp_files += '.';\n\n }\n", "file_path": "src/bustools_main.cpp", "rank": 96, "score": 17.030898890452043 }, { "content": " //hard code options for now\n\n opt.ec_d = 1;\n\n opt.ec_dmin = 3;\n\n\n\n // all other arguments are fast[a/q] files to be read\n\n while (optind < argc) opt.files.push_back(argv[optind++]);\n\n\n\n if (opt.files.size() == 1 && opt.files[0] == \"-\") {\n\n opt.stream_in = true;\n\n }\n\n}\n\n\n\nvoid parse_ProgramOptions_whitelist(int argc, char **argv, Bustools_opt &opt) {\n\n \n\n /* Parse options. */\n\n const char *opt_string = \"o:f:h\";\n\n\n\n static struct option long_options[] = {\n\n {\"output\", required_argument, 0, 'o'},\n\n {\"threshold\", required_argument, 0, 'f'},\n", "file_path": "src/bustools_main.cpp", "rank": 97, "score": 17.030173041542998 }, { "content": " opt.output = optarg;\n\n break;\n\n case 'g':\n\n opt.count_genes = optarg;\n\n break;\n\n case 't':\n\n opt.count_txp = optarg;\n\n break;\n\n case 'e':\n\n opt.count_ecs = optarg;\n\n break;\n\n case 'm':\n\n opt.count_gene_multimapping = true;\n\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n if (gene_flag) {\n\n opt.count_collapse = true;\n", "file_path": "src/bustools_main.cpp", "rank": 98, "score": 16.956355846191997 }, { "content": " opt.filter = false;\n\n }\n\n\n\n return ret;\n\n}\n\n\n\nbool check_ProgramOptions_correct(Bustools_opt& opt) {\n\n bool ret = true;\n\n\n\n if (!opt.stream_out) {\n\n if (opt.output.empty()) {\n\n std::cerr << \"Error: missing output file\" << std::endl;\n\n ret = false;\n\n } else if (!checkOutputFileValid(opt.output)) {\n\n std::cerr << \"Error: unable to open output file\" << std::endl;\n\n ret = false;\n\n }\n\n } \n\n\n\n\n", "file_path": "src/bustools_main.cpp", "rank": 99, "score": 16.90174334630292 } ]
C++
TAO/orbsvcs/Logging_Service/RTEvent_Logging_Service/RTEvent_Logging_Service.cpp
cflowe/ACE
5ff60b41adbe1772372d1a43bcc1f2726ff8f810
#include "orbsvcs/Log_Macros.h" #include "RTEvent_Logging_Service.h" #include "tao/IORTable/IORTable.h" #include "ace/Get_Opt.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_unistd.h" RTEvent_Logging_Service::RTEvent_Logging_Service (void) : service_name_ ("RTEventLogFactory"), ior_file_name_ (0), pid_file_name_ (0), bind_to_naming_service_ (true), nthreads_ (0) { } RTEvent_Logging_Service::~RTEvent_Logging_Service (void) { } void RTEvent_Logging_Service::init_ORB (int& argc, ACE_TCHAR *argv[]) { this->orb_ = CORBA::ORB_init (argc, argv); CORBA::Object_var poa_object = this->orb_->resolve_initial_references("RootPOA"); this->poa_ = PortableServer::POA::_narrow (poa_object.in ()); PortableServer::POAManager_var poa_manager = this->poa_->the_POAManager (); poa_manager->activate (); } int RTEvent_Logging_Service::parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("n:o:p:t:x")); int opt; while ((opt = get_opt ()) != EOF) { switch (opt) { case 'n': this->service_name_ = ACE_TEXT_ALWAYS_CHAR(get_opt.opt_arg ()); break; case 'o': this->ior_file_name_ = get_opt.opt_arg (); break; case 'p': this->pid_file_name_ = get_opt.opt_arg (); break; case 't': this->nthreads_ = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'x': this->bind_to_naming_service_ = false; break; case '?': default: ORBSVCS_DEBUG ((LM_DEBUG, "Usage: %s " "-n service_name " "-o ior_file_name " "-p pid_file_name " "-t threads " "-x [disable naming service bind] " "\n", argv[0])); return -1; } } return 0; } int RTEvent_Logging_Service::init (int argc, ACE_TCHAR* argv[]) { this->init_ORB (argc, argv); if (this->parse_args (argc, argv) == -1) return -1; ACE_NEW_THROW_EX (this->rtevent_log_factory_, TAO_RTEventLogFactory_i (), CORBA::NO_MEMORY ()); if (this->rtevent_log_factory_->init (orb_.in (), poa_.in ()) != 0) { ORBSVCS_ERROR_RETURN ((LM_ERROR, "(%P|%t) Unable to initialize " "the factory.\n"), -1); } RTEventLogAdmin::EventLogFactory_var obj = this->rtevent_log_factory_->activate (); CORBA::String_var ior = this->orb_->object_to_string (obj.in ()); if (true) { CORBA::Object_var table_object = this->orb_->resolve_initial_references ("IORTable"); IORTable::Table_var adapter = IORTable::Table::_narrow (table_object.in ()); adapter->bind("RTEventLogService", ior.in ()); } if (this->ior_file_name_ != 0) { FILE* iorf = ACE_OS::fopen (this->ior_file_name_, ACE_TEXT("w")); if (iorf == 0) { ORBSVCS_ERROR_RETURN ((LM_ERROR, "Cannot open output file for writing IOR: %s", this->ior_file_name_), -1); } ACE_OS::fprintf (iorf, "%s\n", ior.in ()); ACE_OS::fclose (iorf); } if (this->pid_file_name_ != 0) { FILE* pidf = ACE_OS::fopen (this->pid_file_name_, ACE_TEXT("w")); if (pidf != 0) { ACE_OS::fprintf (pidf, "%ld\n", static_cast<long> (ACE_OS::getpid ())); ACE_OS::fclose (pidf); } } if (this->bind_to_naming_service_) { this->resolve_naming_service (); CosNaming::Name name (1); name.length (1); name[0].id = CORBA::string_dup (this->service_name_.c_str ()); this->naming_->rebind (name, obj.in ()); } return 0; } void RTEvent_Logging_Service::resolve_naming_service (void) { CORBA::Object_var naming_obj = this->orb_->resolve_initial_references ("NameService"); if (CORBA::is_nil (naming_obj.in ())) throw CORBA::UNKNOWN (); this->naming_ = CosNaming::NamingContext::_narrow (naming_obj.in ()); } int RTEvent_Logging_Service::run (void) { if (this->nthreads_ > 0) { if (this->activate ((THR_NEW_LWP | THR_JOINABLE), this->nthreads_) != 0) return -1; this->thr_mgr ()->wait (); return 0; } this->orb_->run (); return 0; } int RTEvent_Logging_Service::svc (void) { try { this->orb_->run (); } catch (const CORBA::Exception&) { return -1; } return 0; } void RTEvent_Logging_Service::shutdown (void) { if (this->bind_to_naming_service_) { CosNaming::Name name (1); name.length (1); name[0].id = CORBA::string_dup (this->service_name_.c_str ()); this->naming_->unbind (name); } if (!CORBA::is_nil (this->orb_.in ())) this->orb_->shutdown (); }
#include "orbsvcs/Log_Macros.h" #include "RTEvent_Logging_Service.h" #include "tao/IORTable/IORTable.h" #include "ace/Get_Opt.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_unistd.h" RTEvent_Logging_Service::RTEvent_Logging_Service (void) : service_name_ ("RTEventLogFactory"), ior_file_name_ (0), pid_file_name_ (0), bind_to_naming_service_ (true), nthreads_ (0) { } RTEvent_Logging_Service::~RTEvent_Logging_Service (void) { } void RTEvent_Logging_Service::init_ORB (int& argc, ACE_TCHAR *argv[]) { this->orb_ = CORBA::ORB_init (argc, argv); CORBA::Object_var poa_object = this->orb_->resolve_initial_references("RootPOA"); this->poa_ = PortableServer::POA::_narrow (poa_object.in ()); PortableServer::POAManager_var poa_manager = this->poa_->the_POAManager (); poa_manager->activate (); } int RTEvent_Logging_Service::parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("n:o:p:t:x")); int opt; while ((opt = get_opt ()) != EOF) { switch (opt) { case 'n': this->service_name_ = ACE_TEXT_ALWAYS_CHAR(get_opt.opt_arg ()); break; case 'o': this->ior_file_name_ = get_opt.opt_arg (); break; case 'p': this->pid_file_name_ = get_opt.opt_arg (); break; case 't': this->nthreads_ = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'x': this->bind_to_naming_service_ = false; break; case '?': default: ORBSVCS_DEBUG ((LM_DEBUG, "Usage: %s " "-n service_name " "-o ior_file_name " "-p pid_file_name " "-t threads " "-x [disable naming service bind] " "\n", argv[0])); return -1; } } return 0; } int RTEvent_Logging_Service::init (int argc, ACE_TCHAR* argv[]) { this->init_ORB (argc, argv); if (this->parse_args (argc, argv) == -1) return -1; ACE_NEW_THROW_EX (this->rtevent_log_factory_, TAO_RTEventLogFactory_i (), CORBA::NO_MEMORY ()); if (this->rtevent_log_factory_->init (orb_.in (), poa_.in ()) != 0) { ORBSVCS_ERROR_RETURN ((LM_ERROR, "(%P|%t) Unable to initialize " "the factory.\n"), -1); } RTEventLogAdmin::EventLogFactory_var obj = this->rtevent_log_factory_->activate (); CORBA::String_var ior = this->orb_->object_to_string (obj.in ()); if (true) { CORBA::Object_var table_object = this->orb_->resolve_initial_references ("IORTable"); IORTable::Table_var adapter = IORTable::Table::_narrow (table_object.in ()); adapter->bind("RTEventLogService", ior.in ()); } if (this->ior_file_name_ != 0) { FILE* iorf = ACE_OS::fopen (this->ior_file_name_, ACE_TEXT("w")); if (iorf == 0) { ORBSVCS_ERROR_RETURN ((LM_ERROR, "Cannot open output file for writing IOR: %s", this->ior_file_name_), -1); } ACE_OS::fprintf (iorf, "%s\n", ior.in ()); ACE_OS::fclose (iorf); } if (this->pid_file_name_ != 0) { FILE* pidf = ACE_OS::fopen (this->pid_file_name_, ACE_TEXT("w")); if (pidf != 0) { ACE_OS::fprintf (pidf, "%ld\n", static_cast<long> (ACE_OS::getpid ())); ACE_OS::fclose (pidf); } } if (this->bind_to_naming_service_) { this->resolve_naming_service (); CosNaming::Name name (1); name.length (1); name[0].id = CORBA::string_dup (this->service_name_.c_str ()); this->naming_->rebind (name, obj.in ()); } return 0; } void RTEvent_Logging_Service::resolve_naming_service (void) { CORBA::Object_var naming_obj = this->orb_->resolve_initial_references ("NameService"); if (CORBA::is_nil (naming_obj.in ())) throw CORBA::UNKNOWN (); this->naming_ = CosNaming::NamingContext::_narrow (naming_obj.in ()); } int RTEvent_Logging_Service::run (void) { if (this->nthreads_ > 0) { if (this->activate ((THR_NEW_LWP | THR_JOINABLE), this->nthreads_) != 0) return -1; this->thr_mgr ()->wait (); return 0; } this->orb_->run (); return 0; } int RTEvent_Logging_Service::svc (void) { try { this->orb_->run (); } catch (const CORBA::Exception&) { return -1; } return 0; }
void RTEvent_Logging_Service::shutdown (void) { if (this->bind_to_naming_service_) { CosNaming::Name name (1); name.length (1); name[0].id = CORBA::string_dup (this->service_name_.c_str ()); this->naming_->unbind (name); } if (!CORBA::is_nil (this->orb_.in ())) this->orb_->shutdown (); }
function_block-full_function
[]
C++
mediapipe/calculators/video/tracked_detection_manager_calculator.cc
nodamu/sign-langage-recogntion
41a22d4f28cc94d6eb14d2c89456eba874c7f05b
#include <memory> #include <string> #include <unordered_map> #include <vector> #include "absl/container/node_hash_map.h" #include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/formats/detection.pb.h" #include "mediapipe/framework/formats/location_data.pb.h" #include "mediapipe/framework/formats/rect.pb.h" #include "mediapipe/framework/port/status.h" #include "mediapipe/util/tracking/box_tracker.h" #include "mediapipe/util/tracking/tracked_detection.h" #include "mediapipe/util/tracking/tracked_detection_manager.h" #include "mediapipe/util/tracking/tracking.h" namespace mediapipe { namespace { constexpr int kDetectionUpdateTimeOutMS = 5000; constexpr char kDetectionsTag[] = "DETECTIONS"; constexpr char kDetectionBoxesTag[] = "DETECTION_BOXES"; constexpr char kDetectionListTag[] = "DETECTION_LIST"; constexpr char kTrackingBoxesTag[] = "TRACKING_BOXES"; constexpr char kCancelObjectIdTag[] = "CANCEL_OBJECT_ID"; void MoveIds(std::vector<int>* dst, std::vector<int> src) { dst->insert(dst->end(), std::make_move_iterator(src.begin()), std::make_move_iterator(src.end())); } int64 GetInputTimestampMs(::mediapipe::CalculatorContext* cc) { return cc->InputTimestamp().Microseconds() / 1000; } std::unique_ptr<TrackedDetection> GetTrackedDetectionFromDetection( const Detection& detection, int64 timestamp) { std::unique_ptr<TrackedDetection> tracked_detection = absl::make_unique<TrackedDetection>(detection.detection_id(), timestamp); const float top = detection.location_data().relative_bounding_box().ymin(); const float bottom = detection.location_data().relative_bounding_box().ymin() + detection.location_data().relative_bounding_box().height(); const float left = detection.location_data().relative_bounding_box().xmin(); const float right = detection.location_data().relative_bounding_box().xmin() + detection.location_data().relative_bounding_box().width(); NormalizedRect bounding_box; bounding_box.set_x_center((left + right) / 2.f); bounding_box.set_y_center((top + bottom) / 2.f); bounding_box.set_height(bottom - top); bounding_box.set_width(right - left); tracked_detection->set_bounding_box(bounding_box); for (int i = 0; i < detection.label_size(); ++i) { tracked_detection->AddLabel(detection.label(i), detection.score(i)); } return tracked_detection; } Detection GetAxisAlignedDetectionFromTrackedDetection( const TrackedDetection& tracked_detection) { Detection detection; LocationData* location_data = detection.mutable_location_data(); auto corners = tracked_detection.GetCorners(); float x_min = std::numeric_limits<float>::max(); float x_max = std::numeric_limits<float>::min(); float y_min = std::numeric_limits<float>::max(); float y_max = std::numeric_limits<float>::min(); for (int i = 0; i < 4; ++i) { x_min = std::min(x_min, corners[i].x()); x_max = std::max(x_max, corners[i].x()); y_min = std::min(y_min, corners[i].y()); y_max = std::max(y_max, corners[i].y()); } location_data->set_format(LocationData::RELATIVE_BOUNDING_BOX); LocationData::RelativeBoundingBox* relative_bbox = location_data->mutable_relative_bounding_box(); relative_bbox->set_xmin(x_min); relative_bbox->set_ymin(y_min); relative_bbox->set_width(x_max - x_min); relative_bbox->set_height(y_max - y_min); if (tracked_detection.previous_id() > 0) { detection.set_detection_id(tracked_detection.previous_id()); } else { detection.set_detection_id(tracked_detection.unique_id()); } for (const auto& label_and_score : tracked_detection.label_to_score_map()) { detection.add_label(label_and_score.first); detection.add_score(label_and_score.second); } return detection; } } class TrackedDetectionManagerCalculator : public CalculatorBase { public: static ::mediapipe::Status GetContract(CalculatorContract* cc); ::mediapipe::Status Process(CalculatorContext* cc) override; private: void AddDetectionList(const DetectionList& detection_list, CalculatorContext* cc); void AddDetections(const std::vector<Detection>& detections, CalculatorContext* cc); TrackedDetectionManager tracked_detection_manager_; absl::node_hash_map<int, std::unique_ptr<TrackedDetection>> waiting_for_update_detections_; }; REGISTER_CALCULATOR(TrackedDetectionManagerCalculator); ::mediapipe::Status TrackedDetectionManagerCalculator::GetContract( CalculatorContract* cc) { if (cc->Inputs().HasTag(kDetectionsTag)) { cc->Inputs().Tag(kDetectionsTag).Set<std::vector<Detection>>(); } if (cc->Inputs().HasTag(kDetectionListTag)) { cc->Inputs().Tag(kDetectionListTag).Set<DetectionList>(); } if (cc->Inputs().HasTag(kTrackingBoxesTag)) { cc->Inputs().Tag(kTrackingBoxesTag).Set<TimedBoxProtoList>(); } if (cc->Outputs().HasTag(kCancelObjectIdTag)) { cc->Outputs().Tag(kCancelObjectIdTag).Set<int>(); } if (cc->Outputs().HasTag(kDetectionsTag)) { cc->Outputs().Tag(kDetectionsTag).Set<std::vector<Detection>>(); } if (cc->Outputs().HasTag(kDetectionBoxesTag)) { cc->Outputs().Tag(kDetectionBoxesTag).Set<std::vector<NormalizedRect>>(); } return ::mediapipe::OkStatus(); } ::mediapipe::Status TrackedDetectionManagerCalculator::Process( CalculatorContext* cc) { if (cc->Inputs().HasTag("TRACKING_BOXES")) { if (!cc->Inputs().Tag("TRACKING_BOXES").IsEmpty()) { const TimedBoxProtoList& tracked_boxes = cc->Inputs().Tag("TRACKING_BOXES").Get<TimedBoxProtoList>(); auto removed_detection_ids = absl::make_unique<std::vector<int>>(); for (const TimedBoxProto& tracked_box : tracked_boxes.box()) { NormalizedRect bounding_box; bounding_box.set_x_center((tracked_box.left() + tracked_box.right()) / 2.f); bounding_box.set_y_center((tracked_box.bottom() + tracked_box.top()) / 2.f); bounding_box.set_height(tracked_box.bottom() - tracked_box.top()); bounding_box.set_width(tracked_box.right() - tracked_box.left()); bounding_box.set_rotation(tracked_box.rotation()); auto waiting_for_update_detectoin_ptr = waiting_for_update_detections_.find(tracked_box.id()); if (waiting_for_update_detectoin_ptr != waiting_for_update_detections_.end()) { auto removed_ids = tracked_detection_manager_.AddDetection( std::move(waiting_for_update_detectoin_ptr->second)); MoveIds(removed_detection_ids.get(), std::move(removed_ids)); waiting_for_update_detections_.erase( waiting_for_update_detectoin_ptr); } auto removed_ids = tracked_detection_manager_.UpdateDetectionLocation( tracked_box.id(), bounding_box, tracked_box.time_msec()); MoveIds(removed_detection_ids.get(), std::move(removed_ids)); } auto removed_ids = tracked_detection_manager_.RemoveObsoleteDetections( GetInputTimestampMs(cc) - kDetectionUpdateTimeOutMS); MoveIds(removed_detection_ids.get(), std::move(removed_ids)); removed_ids = tracked_detection_manager_.RemoveOutOfViewDetections(); MoveIds(removed_detection_ids.get(), std::move(removed_ids)); if (!removed_detection_ids->empty() && cc->Outputs().HasTag(kCancelObjectIdTag)) { auto timestamp = cc->InputTimestamp(); for (int box_id : *removed_detection_ids) { cc->Outputs() .Tag(kCancelObjectIdTag) .AddPacket(mediapipe::MakePacket<int>(box_id).At(timestamp++)); } } const auto& all_detections = tracked_detection_manager_.GetAllTrackedDetections(); auto output_detections = absl::make_unique<std::vector<Detection>>(); auto output_boxes = absl::make_unique<std::vector<NormalizedRect>>(); for (const auto& detection_ptr : all_detections) { const auto& detection = *detection_ptr.second; if (detection.last_updated_timestamp() < cc->InputTimestamp().Microseconds() / 1000) { continue; } output_detections->emplace_back( GetAxisAlignedDetectionFromTrackedDetection(detection)); output_boxes->emplace_back(detection.bounding_box()); } if (cc->Outputs().HasTag(kDetectionsTag)) { cc->Outputs() .Tag(kDetectionsTag) .Add(output_detections.release(), cc->InputTimestamp()); } if (cc->Outputs().HasTag(kDetectionBoxesTag)) { cc->Outputs() .Tag(kDetectionBoxesTag) .Add(output_boxes.release(), cc->InputTimestamp()); } } } if (cc->Inputs().HasTag(kDetectionsTag) && !cc->Inputs().Tag(kDetectionsTag).IsEmpty()) { const auto detections = cc->Inputs().Tag(kDetectionsTag).Get<std::vector<Detection>>(); AddDetections(detections, cc); } if (cc->Inputs().HasTag(kDetectionListTag) && !cc->Inputs().Tag(kDetectionListTag).IsEmpty()) { const auto detection_list = cc->Inputs().Tag(kDetectionListTag).Get<DetectionList>(); AddDetectionList(detection_list, cc); } return ::mediapipe::OkStatus(); } void TrackedDetectionManagerCalculator::AddDetectionList( const DetectionList& detection_list, CalculatorContext* cc) { for (const auto& detection : detection_list.detection()) { std::unique_ptr<TrackedDetection> new_detection = GetTrackedDetectionFromDetection( detection, cc->InputTimestamp().Microseconds() / 1000); const int id = new_detection->unique_id(); waiting_for_update_detections_[id] = std::move(new_detection); } } void TrackedDetectionManagerCalculator::AddDetections( const std::vector<Detection>& detections, CalculatorContext* cc) { for (const auto& detection : detections) { std::unique_ptr<TrackedDetection> new_detection = GetTrackedDetectionFromDetection( detection, cc->InputTimestamp().Microseconds() / 1000); const int id = new_detection->unique_id(); waiting_for_update_detections_[id] = std::move(new_detection); } } }
#include <memory> #include <string> #include <unordered_map> #include <vector> #include "absl/container/node_hash_map.h" #include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/formats/detection.pb.h" #include "mediapipe/framework/formats/location_data.pb.h" #include "mediapipe/framework/formats/rect.pb.h" #include "mediapipe/framework/port/status.h" #include "mediapipe/util/tracking/box_tracker.h" #include "mediapipe/util/tracking/tracked_detection.h" #include "mediapipe/util/tracking/tracked_detection_manager.h" #include "mediapipe/util/tracking/tracking.h" namespace mediapipe { namespace { constexpr int kDetectionUpdateTimeOutMS = 5000; constexpr char kDetectionsTag[] = "DETECTIONS"; constexpr char kDetectionBoxesTag[] = "DETECTION_BOXES"; constexpr char kDetectionListTag[] = "DETECTION_LIST"; constexpr char kTrackingBoxesTag[] = "TRACKING_BOXES"; constexpr char kCancelObjectIdTag[] = "CANCEL_OBJECT_ID"; void MoveIds(std::vector<int>* dst, std::vector<int> src) { dst->insert(dst->end(), std::make_move_iterator(src.begin()), std::make_move_iterator(src.end())); } int64 GetInputTimestampMs(::mediapipe::CalculatorContext* cc) { return cc->InputTimestamp().Microseconds() / 1000; } std::unique_ptr<TrackedDetection> GetTrackedDetectionFromDetection( const Detection& detection, int64 timestamp) { std::unique_ptr<TrackedDetection> tracked_detection = absl::make_unique<TrackedDetection>(detection.detection_id(), timestamp); const float top = detection.location_data().relative_bounding_box().ymin(); const float bottom = detection.location_data().relative_bounding_box().ymin() + detection.location_data().relative_bounding_box().height(); const float left = detection.location_data().relative_bounding_box().xmin(); const float right = detection.location_data().relative_bounding_box().xmin() + detection.location_data().relative_bounding_box().width(); NormalizedRect bounding_box; bounding_box.set_x_center((left + right) / 2.f); bounding_box.set_y_center((top + bottom) / 2.f); bounding_box.set_height(bottom - top); bounding_box.set_width(right - left); tracked_detection->set_bounding_box(bounding_box); for (int i = 0; i < detection.label_size(); ++i) { tracked_detection->AddLabel(detection.label(i), detection.score(i)); } return tracked_detection; } Detection GetAxisAlignedDetectionFromTrackedDetection( const TrackedDetection& tracked_detection) { Detection detection; LocationData* location_data = detection.mutable_location_data(); auto corners = tracked_detection.GetCorners(); float x_min = std::numeric_limits<float>::max(); float x_max = std::numeric_limits<float>::min(); float y_min = std::numeric_limits<float>::max(); float y_max = std::numeric_limits<float>::min(); for (int i = 0; i < 4; ++i) { x_min = std::min(x_min, corners[i].x()); x_max = std::max(x_max, corners[i].x()); y_min = std::min(y_min, corners[i].y()); y_max = std::max(y_max, corners[i].y()); } location_data->set_format(LocationData::RELATIVE_BOUNDING_BOX); LocationData::RelativeBoundingBox* relative_bbox = location_data->mutable_relative_bounding_box(); relative_bbox->set_xmin(x_min); relative_bbox->set_ymin(y_min); relative_bbox->set_width(x_max - x_min); relative_bbox->set_height(y_max - y_min); if (tracked_detection.previous_id() > 0) { detection.set_detection_id(tracked_detection.previous_id()); } else { detection.set_detection_id(tracked_detection.unique_id()); } for (const auto& label_and_score : tracked_detection.label_to_score_map()) { detection.add_label(label_and_score.first); detection.add_score(label_and_score.second); } return detection; } } class TrackedDetectionManagerCalculator : public CalculatorBase { public: static ::mediapipe::Status GetContract(CalculatorContract* cc); ::mediapipe::Status Process(CalculatorContext* cc) override; private: void AddDetectionList(const DetectionList& detection_list, CalculatorContext* cc); void AddDetections(const std::vector<Detection>& detections, CalculatorContext* cc); TrackedDetectionManager tracked_detection_manager_; absl::node_hash_map<int, std::unique_ptr<TrackedDetection>> waiting_for_update_detections_; }; REGISTER_CALCULATOR(TrackedDetectionManagerCalculator); ::mediapipe::Status TrackedDetectionManagerCalculator::GetContract( CalculatorContract* cc) { if (cc->Inputs().HasTag(kDetectionsTag)) { cc->Inputs().Tag(kDetectionsTag).Set<std::vector<Detection>>(); } if (cc->Inputs().HasTag(kDetectionListTag)) { cc->Inputs().Tag(kDetectionListTag).Set<DetectionList>(); } if (cc->Inputs().HasTag(kTrackingBoxesTag)) { cc->Inputs().Tag(kTrackingBoxesTag).Set<TimedBoxProtoList>(); } if (cc->Outputs().HasTag(kCancelObjectIdTag)) { cc->Outputs().Tag(kCancelObjectIdTag).Set<int>(); } if (cc->Outputs().HasTag(kDetectionsTag)) { cc->Outputs().Tag(kDetectionsTag).Set<std::vector<Detection>>(); } if (cc->Outputs().HasTag(kDetectionBoxesTag)) { cc->Outputs().Tag(kDetectionBoxesTag).Set<std::vector<NormalizedRect>>(); } return ::mediapipe::OkStatus(); } ::mediapipe::Status TrackedDetectionManagerCalculator::Process( CalculatorContext* cc) { if (cc->Inputs().HasTag("TRACKING_BOXES")) { if (!cc->Inputs().Tag("TRACKING_BOXES").IsEmpty()) { const TimedBoxProtoList& tracked_boxes = cc->Inputs().Tag("TRACKING_BOXES").Get<TimedBoxProtoList>(); auto removed_detection_ids = absl::make_unique<std::vector<int>>(); for (const TimedBoxProto& tracked_box : tracked_boxes.box()) { NormalizedRect bounding_box; bounding_box.set_x_center((tracked_box.left() + tracked_box.right()) / 2.f); bounding_box.set_y_center((tracked_box.bottom() + tracked_box.top()) / 2.f); bounding_box.set_height(tracked_box.bottom() - tracked_box.top()); bounding_box.set_width(tracked_box.right() - tracked_box.left()); bounding_box.set_rotation(tracked_box.rotation()); auto waiting_for_update_detectoin_ptr = waiting_for_update_detections_.find(tracked_box.id()); if (waiting_for_update_detectoin_ptr != waiting_for_update_detections_.end()) { auto removed_ids = tracked_detection_manager_.AddDetection( std::move(waiting_for_update_detectoin_ptr->second)); MoveIds(removed_detection_ids.get(), std::move(removed_ids)); waiting_for_update_detections_.erase( waiting_for_update_detectoin_ptr); } auto removed_ids = tracked_detection_manager_.UpdateDetectionLocation( tracked_box.id(), bounding_box, tracked_box.time_msec()); MoveIds(removed_detection_ids.get(), std::move(removed_ids)); } auto removed_ids = tracked_detection_manager_.RemoveObsoleteDetections( GetInputTimestampMs(cc) - kDetectionUpdateTimeOutMS); MoveIds(removed_detection_ids.get(), std::move(removed_ids)); removed_ids = tracked_detection_manager_.RemoveOutOfViewDetections(); MoveIds(removed_detection_ids.get(), std::move(removed_ids)); if (!removed_detection_ids->empty() && cc->Outputs().HasTag(kCancelObjectIdTag)) { auto timestamp = cc->InputTimestamp(); for (int box_id : *removed_detection_ids) { cc->Outputs() .Tag(kCancelObjectIdTag) .AddPacket(mediapipe::MakePacket<int>(box_id).At(timestamp++)); } } const auto& all_detections = tracked_detection_manager_.GetAllTrackedDetections(); auto output_detections = absl::make_unique<std::vector<Detection>>(); auto output_boxes = absl::make_unique<std::vector<NormalizedRect>>(); for (const auto& detection_ptr : all_detections) { const auto& detection = *detection_ptr.second; if (detection.last_updated_timestamp() < cc->InputTimestamp().Microseconds() / 1000) { continue; } output_detections->emplace_back( GetAxisAlignedDetectionFromTrackedDetection(detection)); output_boxes->emplace_back(detection.bounding_box()); } if (cc->Outputs().HasTag(kDetectionsTag)) { cc->Outputs() .Tag(kDetectionsTag) .Add(output_detections.release(), cc->InputTimestamp()); } if (cc->Outputs().HasTag(kDetectionBoxesTag)) { cc->Outputs() .Tag(kDetectionBoxesTag) .Add(output_boxes.release(), cc->InputTimestamp()); } } } if (cc->Inputs().HasTag(kDetectionsTag) && !cc->Inputs().Tag(kDetectionsTag).IsEmpty()) { const auto detections = cc->Inputs().Tag(kDetectionsTag).Get<std::vector<Detection>>(); AddDetections(detections, cc); } if (cc->Inputs().HasTag(kDetectionListTag) && !cc->Inputs().Tag(kDetectionListTag).IsEmpty()) { const auto detection_list = cc->Inputs().Tag(kDetectionListTag).Get<DetectionList>(); AddDetectionList(detection_list, cc); } return ::mediapipe::OkStatus(); }
void TrackedDetectionManagerCalculator::AddDetections( const std::vector<Detection>& detections, CalculatorContext* cc) { for (const auto& detection : detections) { std::unique_ptr<TrackedDetection> new_detection = GetTrackedDetectionFromDetection( detection, cc->InputTimestamp().Microseconds() / 1000); const int id = new_detection->unique_id(); waiting_for_update_detections_[id] = std::move(new_detection); } } }
void TrackedDetectionManagerCalculator::AddDetectionList( const DetectionList& detection_list, CalculatorContext* cc) { for (const auto& detection : detection_list.detection()) { std::unique_ptr<TrackedDetection> new_detection = GetTrackedDetectionFromDetection( detection, cc->InputTimestamp().Microseconds() / 1000); const int id = new_detection->unique_id(); waiting_for_update_detections_[id] = std::move(new_detection); } }
function_block-full_function
[ { "content": "class StringToIntCalculatorTemplate : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->InputSidePackets().Index(0).Set<std::string>();\n\n cc->OutputSidePackets().Index(0).Set<IntType>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override {\n\n IntType number;\n\n if (!absl::SimpleAtoi(cc->InputSidePackets().Index(0).Get<std::string>(),\n\n &number)) {\n\n return ::mediapipe::InvalidArgumentError(\n\n \"The std::string could not be parsed as an integer.\");\n\n }\n\n cc->OutputSidePackets().Index(0).Set(MakePacket<IntType>(number));\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) override {\n", "file_path": "mediapipe/calculators/core/string_to_int_calculator.cc", "rank": 0, "score": 317365.1781639274 }, { "content": "// The calculator expects one input (a packet containing a vector<float> or\n\n// vector<vector<float>>) and generates one output (a packet containing a\n\n// tf::Tensor containing the same data). The output tensor will be either\n\n// 1D or 2D with dimensions corresponding to the input vector float.\n\n// It will hold DT_FLOAT values.\n\n//\n\n// Example config:\n\n// node {\n\n// calculator: \"VectorFloatToTensorCalculator\"\n\n// input_stream: \"vector_float_features\"\n\n// output_stream: \"tensor_features\"\n\n// }\n\nclass VectorFloatToTensorCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc);\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override;\n\n ::mediapipe::Status Process(CalculatorContext* cc) override;\n\n\n\n private:\n\n VectorFloatToTensorCalculatorOptions options_;\n\n};\n\nREGISTER_CALCULATOR(VectorFloatToTensorCalculator);\n\n\n\n::mediapipe::Status VectorFloatToTensorCalculator::GetContract(\n\n CalculatorContract* cc) {\n\n const auto& options = cc->Options<VectorFloatToTensorCalculatorOptions>();\n\n // Start with only one input packet.\n\n RET_CHECK_EQ(cc->Inputs().NumEntries(), 1)\n\n << \"Only one input stream is supported.\";\n\n if (options.input_size() == INPUT_2D) {\n\n cc->Inputs().Index(0).Set<std::vector<std::vector<float>>>(\n", "file_path": "mediapipe/calculators/tensorflow/vector_float_to_tensor_calculator.cc", "rank": 1, "score": 312024.1882095577 }, { "content": "class QuantizeFloatVectorCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Tag(\"FLOAT_VECTOR\").Set<std::vector<float>>();\n\n cc->Outputs().Tag(\"ENCODED\").Set<std::string>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) final {\n\n const auto options =\n\n cc->Options<::mediapipe::QuantizeFloatVectorCalculatorOptions>();\n\n if (!options.has_max_quantized_value() ||\n\n !options.has_min_quantized_value()) {\n\n return ::mediapipe::InvalidArgumentError(\n\n \"Both max_quantized_value and min_quantized_value must be provided \"\n\n \"in QuantizeFloatVectorCalculatorOptions.\");\n\n }\n\n max_quantized_value_ = options.max_quantized_value();\n\n min_quantized_value_ = options.min_quantized_value();\n\n if (max_quantized_value_ < min_quantized_value_ + FLT_EPSILON) {\n", "file_path": "mediapipe/calculators/core/quantize_float_vector_calculator.cc", "rank": 2, "score": 312008.829038242 }, { "content": "class TensorToVectorFloatCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc);\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override;\n\n ::mediapipe::Status Process(CalculatorContext* cc) override;\n\n\n\n private:\n\n TensorToVectorFloatCalculatorOptions options_;\n\n};\n\nREGISTER_CALCULATOR(TensorToVectorFloatCalculator);\n\n\n\n::mediapipe::Status TensorToVectorFloatCalculator::GetContract(\n\n CalculatorContract* cc) {\n\n // Start with only one input packet.\n\n RET_CHECK_EQ(cc->Inputs().NumEntries(), 1)\n\n << \"Only one input stream is supported.\";\n\n cc->Inputs().Index(0).Set<tf::Tensor>(\n\n // Input Tensor\n\n );\n", "file_path": "mediapipe/calculators/tensorflow/tensor_to_vector_float_calculator.cc", "rank": 3, "score": 312008.829038242 }, { "content": "// The calculator expects one input (a packet containing a single int or\n\n// vector<int> or vector<vector<int>>) and generates one output (a packet\n\n// containing a tf::Tensor containing the same data). The output tensor will be\n\n// either 1D or 2D with dimensions corresponding to the input vector int. It\n\n// will hold DT_INT32 or DT_UINT8 or DT_INT64 values.\n\n//\n\n// Example config:\n\n// node {\n\n// calculator: \"VectorIntToTensorCalculator\"\n\n// input_stream: \"SINGLE_INT:segment_size_int_stream\"\n\n// output_stream: \"TENSOR_OUT:segment_size_tensor\"\n\n// }\n\n//\n\n// or\n\n//\n\n// node {\n\n// calculator: \"VectorIntToTensorCalculator\"\n\n// input_stream: \"VECTOR_INT:vector_int_features\"\n\n// output_stream: \"TENSOR_OUT:tensor_features\"\n\n// }\n\nclass VectorIntToTensorCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc);\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override;\n\n ::mediapipe::Status Process(CalculatorContext* cc) override;\n\n\n\n private:\n\n VectorIntToTensorCalculatorOptions options_;\n\n};\n\nREGISTER_CALCULATOR(VectorIntToTensorCalculator);\n\n\n\n::mediapipe::Status VectorIntToTensorCalculator::GetContract(\n\n CalculatorContract* cc) {\n\n const auto& options = cc->Options<VectorIntToTensorCalculatorOptions>();\n\n // Start with only one input packet.\n\n RET_CHECK_EQ(cc->Inputs().NumEntries(), 1)\n\n << \"Only one input stream is supported.\";\n\n if (options.input_size() == INPUT_2D) {\n\n cc->Inputs().Tag(kVectorInt).Set<std::vector<std::vector<int>>>();\n", "file_path": "mediapipe/calculators/tensorflow/vector_int_to_tensor_calculator.cc", "rank": 4, "score": 311995.60215334763 }, { "content": "// A Calculator that converts an integer to a float.\n\nclass IntToFloatCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Index(0).Set<int>();\n\n cc->Outputs().Index(0).Set<float>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) final {\n\n cc->SetOffset(TimestampDiff(0));\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n int value = cc->Inputs().Index(0).Value().Get<int>();\n\n cc->Outputs().Index(0).Add(new float(static_cast<float>(value)),\n\n cc->InputTimestamp());\n\n return ::mediapipe::OkStatus();\n\n }\n\n};\n\nREGISTER_CALCULATOR(IntToFloatCalculator);\n\n\n\ntemplate <typename OutputType>\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 5, "score": 298168.45373686793 }, { "content": "class TensorToVectorFloatCalculatorTest : public ::testing::Test {\n\n protected:\n\n void SetUpRunner(const bool tensor_is_2d, const bool flatten_nd) {\n\n CalculatorGraphConfig::Node config;\n\n config.set_calculator(\"TensorToVectorFloatCalculator\");\n\n config.add_input_stream(\"input_tensor\");\n\n config.add_output_stream(\"output_tensor\");\n\n auto options = config.mutable_options()->MutableExtension(\n\n TensorToVectorFloatCalculatorOptions::ext);\n\n options->set_tensor_is_2d(tensor_is_2d);\n\n options->set_flatten_nd(flatten_nd);\n\n runner_ = absl::make_unique<CalculatorRunner>(config);\n\n }\n\n\n\n std::unique_ptr<CalculatorRunner> runner_;\n\n};\n\n\n\nTEST_F(TensorToVectorFloatCalculatorTest, ConvertsToVectorFloat) {\n\n SetUpRunner(false, false);\n\n const tf::TensorShape tensor_shape(std::vector<tf::int64>{5});\n", "file_path": "mediapipe/calculators/tensorflow/tensor_to_vector_float_calculator_test.cc", "rank": 6, "score": 295518.383019197 }, { "content": "class VectorToTensorFloatCalculatorTest : public ::testing::Test {\n\n protected:\n\n void SetUpRunner(\n\n const VectorFloatToTensorCalculatorOptions::InputSize input_size,\n\n const bool transpose) {\n\n CalculatorGraphConfig::Node config;\n\n config.set_calculator(\"VectorFloatToTensorCalculator\");\n\n config.add_input_stream(\"input_float\");\n\n config.add_output_stream(\"output_tensor\");\n\n auto options = config.mutable_options()->MutableExtension(\n\n VectorFloatToTensorCalculatorOptions::ext);\n\n options->set_input_size(input_size);\n\n options->set_transpose(transpose);\n\n runner_ = ::absl::make_unique<CalculatorRunner>(config);\n\n }\n\n\n\n void TestConvertFromVectoVectorFloat(const bool transpose) {\n\n SetUpRunner(VectorFloatToTensorCalculatorOptions::INPUT_2D, transpose);\n\n auto input = ::absl::make_unique<std::vector<std::vector<float>>>(\n\n 2, std::vector<float>(2));\n", "file_path": "mediapipe/calculators/tensorflow/vector_float_to_tensor_calculator_test.cc", "rank": 7, "score": 295518.383019197 }, { "content": "class VectorIntToTensorCalculatorTest : public ::testing::Test {\n\n protected:\n\n void SetUpRunner(\n\n const VectorIntToTensorCalculatorOptions::InputSize input_size,\n\n const tensorflow::DataType tensor_data_type, const bool transpose,\n\n const bool single_value) {\n\n CalculatorGraphConfig::Node config;\n\n config.set_calculator(\"VectorIntToTensorCalculator\");\n\n if (single_value) {\n\n config.add_input_stream(\"SINGLE_INT:input_int\");\n\n } else {\n\n config.add_input_stream(\"VECTOR_INT:input_int\");\n\n }\n\n config.add_output_stream(\"TENSOR_OUT:output_tensor\");\n\n auto options = config.mutable_options()->MutableExtension(\n\n VectorIntToTensorCalculatorOptions::ext);\n\n options->set_input_size(input_size);\n\n options->set_transpose(transpose);\n\n options->set_tensor_data_type(tensor_data_type);\n\n runner_ = ::absl::make_unique<CalculatorRunner>(config);\n", "file_path": "mediapipe/calculators/tensorflow/vector_int_to_tensor_calculator_test.cc", "rank": 8, "score": 295486.8532044283 }, { "content": " // Returns the timestamp.\n\n class Timestamp Timestamp() const;\n\n\n\n std::string DebugString() const;\n\n friend std::ostream& operator<<(std::ostream& stream, const Packet& p) {\n\n return stream << p.DebugString();\n\n }\n\n\n\n // Returns the type name. If the packet is empty or the type is not\n\n // registered (with MEDIAPIPE_REGISTER_TYPE or companion macros) then\n\n // the empty std::string is returned.\n\n std::string RegisteredTypeName() const;\n\n // Returns a std::string with the best guess at the type name.\n\n std::string DebugTypeName() const;\n\n\n\n private:\n\n friend Packet packet_internal::Create(packet_internal::HolderBase* holder);\n\n friend Packet packet_internal::Create(packet_internal::HolderBase* holder,\n", "file_path": "mediapipe/framework/packet.h", "rank": 9, "score": 294889.33290856495 }, { "content": "// A std::string generator that will succeed.\n\nclass StaticCounterStringGenerator : public PacketGenerator {\n\n public:\n\n static ::mediapipe::Status FillExpectations(\n\n const PacketGeneratorOptions& extendable_options,\n\n PacketTypeSet* input_side_packets, PacketTypeSet* output_side_packets) {\n\n for (int i = 0; i < input_side_packets->NumEntries(); ++i) {\n\n input_side_packets->Index(i).SetAny();\n\n }\n\n output_side_packets->Index(0).Set<std::string>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n static ::mediapipe::Status Generate(\n\n const PacketGeneratorOptions& extendable_options,\n\n const PacketSet& input_side_packets, PacketSet* output_side_packets) {\n\n output_side_packets->Index(0) = MakePacket<std::string>(\"fixed_string\");\n\n ++num_packets_generated_;\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n static int NumPacketsGenerated() { return num_packets_generated_; }\n\n\n\n private:\n\n static int num_packets_generated_;\n\n};\n\n\n\nint StaticCounterStringGenerator::num_packets_generated_ = 0;\n\n\n\nREGISTER_PACKET_GENERATOR(StaticCounterStringGenerator);\n\n\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 10, "score": 292233.8429579273 }, { "content": "// Converts a vector of landmarks to a vector of floats or a matrix.\n\n// Input:\n\n// NORM_LANDMARKS: A NormalizedLandmarkList proto.\n\n//\n\n// Output:\n\n// FLOATS(optional): A vector of floats from flattened landmarks.\n\n// MATRIX(optional): A matrix of floats of the landmarks.\n\n//\n\n// Usage example:\n\n// node {\n\n// calculator: \"LandmarksToFloatsCalculator\"\n\n// input_stream: \"NORM_LANDMARKS:landmarks\"\n\n// output_stream: \"MATRIX:landmark_matrix\"\n\n// }\n\nclass LandmarksToFloatsCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Tag(kLandmarksTag).Set<NormalizedLandmarkList>();\n\n RET_CHECK(cc->Outputs().HasTag(kFloatsTag) ||\n\n cc->Outputs().HasTag(kMatrixTag));\n\n if (cc->Outputs().HasTag(kFloatsTag)) {\n\n cc->Outputs().Tag(kFloatsTag).Set<std::vector<float>>();\n\n }\n\n if (cc->Outputs().HasTag(kMatrixTag)) {\n\n cc->Outputs().Tag(kMatrixTag).Set<Matrix>();\n\n }\n\n\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override {\n\n cc->SetOffset(TimestampDiff(0));\n\n const auto& options =\n\n cc->Options<::mediapipe::LandmarksToFloatsCalculatorOptions>();\n", "file_path": "mediapipe/calculators/util/landmarks_to_floats_calculator.cc", "rank": 11, "score": 261544.4913701957 }, { "content": "// A calculator that converts a Matrix M to a vector containing all the\n\n// entries of M in column-major order.\n\n//\n\n// Example config:\n\n// node {\n\n// calculator: \"MatrixToVectorCalculator\"\n\n// input_stream: \"input_matrix\"\n\n// output_stream: \"column_major_vector\"\n\n// }\n\nclass MatrixToVectorCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Index(0).Set<Matrix>(\n\n // Input Packet containing a Matrix.\n\n );\n\n cc->Outputs().Index(0).Set<std::vector<float>>(\n\n // Output Packet containing a vector, one for each input Packet.\n\n );\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override;\n\n\n\n // Outputs a packet containing a vector for each input packet.\n\n ::mediapipe::Status Process(CalculatorContext* cc) override;\n\n};\n\nREGISTER_CALCULATOR(MatrixToVectorCalculator);\n\n\n\n::mediapipe::Status MatrixToVectorCalculator::Open(CalculatorContext* cc) {\n", "file_path": "mediapipe/calculators/core/matrix_to_vector_calculator.cc", "rank": 12, "score": 261436.42989598442 }, { "content": "// Converts NormalizedLandmark to Detection proto. A relative bounding box will\n\n// be created containing all landmarks exactly. A calculator option is provided\n\n// to specify a subset of landmarks for creating the detection.\n\n//\n\n// Input:\n\n// NOMR_LANDMARKS: A NormalizedLandmarkList proto.\n\n//\n\n// Output:\n\n// DETECTION: A Detection proto.\n\n//\n\n// Example config:\n\n// node {\n\n// calculator: \"LandmarksToDetectionCalculator\"\n\n// input_stream: \"NORM_LANDMARKS:landmarks\"\n\n// output_stream: \"DETECTIONS:detections\"\n\n// }\n\nclass LandmarksToDetectionCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc);\n\n ::mediapipe::Status Open(CalculatorContext* cc) override;\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) override;\n\n\n\n private:\n\n ::mediapipe::LandmarksToDetectionCalculatorOptions options_;\n\n};\n\nREGISTER_CALCULATOR(LandmarksToDetectionCalculator);\n\n\n\n::mediapipe::Status LandmarksToDetectionCalculator::GetContract(\n\n CalculatorContract* cc) {\n\n RET_CHECK(cc->Inputs().HasTag(kNormalizedLandmarksTag));\n\n RET_CHECK(cc->Outputs().HasTag(kDetectionTag));\n\n // TODO: Also support converting Landmark to Detection.\n\n cc->Inputs().Tag(kNormalizedLandmarksTag).Set<NormalizedLandmarkList>();\n\n cc->Outputs().Tag(kDetectionTag).Set<Detection>();\n\n\n", "file_path": "mediapipe/calculators/util/landmarks_to_detection_calculator.cc", "rank": 13, "score": 261363.8393589653 }, { "content": "class MovableSplitUniqueIntPtrCalculatorTest : public ::testing::Test {\n\n protected:\n\n void ValidateVectorOutput(std::vector<Packet>& output_packets,\n\n int expected_elements, int input_begin_index) {\n\n ASSERT_EQ(1, output_packets.size());\n\n const std::vector<std::unique_ptr<int>>& output_vec =\n\n output_packets[0].Get<std::vector<std::unique_ptr<int>>>();\n\n ASSERT_EQ(expected_elements, output_vec.size());\n\n\n\n for (int i = 0; i < expected_elements; ++i) {\n\n const int expected_value = input_begin_index + i;\n\n const std::unique_ptr<int>& result = output_vec[i];\n\n ASSERT_NE(result, nullptr);\n\n ASSERT_EQ(expected_value, *result);\n\n }\n\n }\n\n\n\n void ValidateElementOutput(std::vector<Packet>& output_packets,\n\n int expected_value) {\n\n ASSERT_EQ(1, output_packets.size());\n", "file_path": "mediapipe/calculators/core/split_vector_calculator_test.cc", "rank": 14, "score": 259405.23675266776 }, { "content": "// Takes object detection results and converts them into MediaPipe Detections.\n\n//\n\n// Inputs are assumed to be tensors of the form:\n\n// `num_detections` : float32 scalar tensor indicating the number of valid\n\n// detections.\n\n// `detection_boxes` : float32 tensor of the form [num_boxes, 4]. Format for\n\n// coordinates is {ymin, xmin, ymax, xmax}.\n\n// `detection_scores` : float32 tensor of the form [num_boxes].\n\n// `detection_classes` : float32 tensor of the form [num_boxes].\n\n// `detection_keypoints`: float32 tensor of the form\n\n// [num_boxes, num_keypoints, 2].\n\n// `detection_masks` : float32 tensor of the form\n\n// [num_boxes, height, width].\n\n//\n\n// These are generated according to the Vale object detector model exporter,\n\n// which may be found in\n\n// image/understanding/object_detection/export_inference_graph.py\n\n//\n\n// By default, the output Detections store label ids (integers) for each\n\n// detection. Optionally, a label map (of the form std::map<int, std::string>\n\n// mapping label ids to label names as strings) can be made available as an\n\n// input side packet, in which case the output Detections store\n\n// labels as their associated std::string provided by the label map.\n\n//\n\n// Usage example:\n\n// node {\n\n// calculator: \"ObjectDetectionTensorsToDetectionsCalculator\"\n\n// input_stream: \"BOXES:detection_boxes_tensor\"\n\n// input_stream: \"SCORES:detection_scores_tensor\"\n\n// input_stream: \"CLASSES:detection_classes_tensor\"\n\n// input_stream: \"NUM_DETECTIONS:num_detections_tensor\"\n\n// output_stream: \"DETECTIONS:detections\"\n\n// options: {\n\n// [mediapipe.ObjectDetectionsTensorToDetectionsCalculatorOptions.ext]: {\n\n// tensor_dim_to_squeeze: 0\n\n// }\n\n// }\n\n// }\n\nclass ObjectDetectionTensorsToDetectionsCalculator : public CalculatorBase {\n\n public:\n\n ObjectDetectionTensorsToDetectionsCalculator() = default;\n\n\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Tag(kBoxes).Set<tf::Tensor>();\n\n cc->Inputs().Tag(kScores).Set<tf::Tensor>();\n\n\n\n if (cc->Inputs().HasTag(kNumDetections)) {\n\n cc->Inputs().Tag(kNumDetections).Set<tf::Tensor>();\n\n }\n\n if (cc->Inputs().HasTag(kClasses)) {\n\n cc->Inputs().Tag(kClasses).Set<tf::Tensor>();\n\n }\n\n if (cc->Inputs().HasTag(kKeypoints)) {\n\n cc->Inputs().Tag(kKeypoints).Set<tf::Tensor>();\n\n }\n\n\n\n if (cc->Inputs().HasTag(kMasks)) {\n\n cc->Inputs().Tag(kMasks).Set<tf::Tensor>();\n", "file_path": "mediapipe/calculators/tensorflow/object_detection_tensors_to_detections_calculator.cc", "rank": 15, "score": 257838.62355008812 }, { "content": "// A calculator that takes a vector of scores and returns the indexes, scores,\n\n// labels of the top k elements, classification protos, and summary std::string\n\n// (in csv format).\n\n//\n\n// Usage example:\n\n// node {\n\n// calculator: \"TopKScoresCalculator\"\n\n// input_stream: \"SCORES:score_vector\"\n\n// output_stream: \"TOP_K_INDEXES:top_k_indexes\"\n\n// output_stream: \"TOP_K_SCORES:top_k_scores\"\n\n// output_stream: \"TOP_K_LABELS:top_k_labels\"\n\n// output_stream: \"TOP_K_CLASSIFICATIONS:top_k_classes\"\n\n// output_stream: \"SUMMARY:summary\"\n\n// options: {\n\n// [mediapipe.TopKScoresCalculatorOptions.ext] {\n\n// top_k: 5\n\n// threshold: 0.1\n\n// label_map_path: \"/path/to/label/map\"\n\n// }\n\n// }\n\n// }\n\nclass TopKScoresCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc);\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override;\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) override;\n\n\n\n private:\n\n ::mediapipe::Status LoadLabelmap(std::string label_map_path);\n\n\n\n int top_k_ = -1;\n\n float threshold_ = 0.0;\n\n std::unordered_map<int, std::string> label_map_;\n\n bool label_map_loaded_ = false;\n\n};\n\nREGISTER_CALCULATOR(TopKScoresCalculator);\n\n\n\n::mediapipe::Status TopKScoresCalculator::GetContract(CalculatorContract* cc) {\n\n RET_CHECK(cc->Inputs().HasTag(\"SCORES\"));\n", "file_path": "mediapipe/calculators/util/top_k_scores_calculator.cc", "rank": 16, "score": 257115.98145612734 }, { "content": "class PrintHandVectorCalculator : public CalculatorBase\n\n{\n\npublic:\n\n PrintHandVectorCalculator(){};\n\n // ~GestureRecognizerCalculator() override{};\n\n\n\n static ::mediapipe::Status GetContract(CalculatorContract *cc);\n\n\n\n ::mediapipe::Status Open(CalculatorContext *cc) override;\n\n\n\n ::mediapipe::Status Process(CalculatorContext *cc) override;\n\n};\n\n\n\n::mediapipe::Status PrintHandVectorCalculator::GetContract(CalculatorContract *cc)\n\n{\n\n // Checks if input stream has the normalizedLandmarkListTag\n\n RET_CHECK(cc->Inputs().HasTag(normalizedLandmarkListTag));\n\n // Set normalizedLandmarkListTag to receive a NormalizedLandmarkList as input\n\n cc->Inputs().Tag(normalizedLandmarkListTag).Set<NormalizedLandmarkList>();\n\n\n", "file_path": "mediapipe/calculators/custom/print_hand_vector.cc", "rank": 17, "score": 256947.1574683338 }, { "content": "// A Calculator that outputs twice the value of its input packet (an int).\n\nclass DoubleIntCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Index(0).Set<int>();\n\n cc->Outputs().Index(0).SetSameAs(&cc->Inputs().Index(0));\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) final {\n\n cc->SetOffset(TimestampDiff(0));\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n int value = cc->Inputs().Index(0).Value().Get<int>();\n\n cc->Outputs().Index(0).Add(new int(2 * value), cc->InputTimestamp());\n\n return ::mediapipe::OkStatus();\n\n }\n\n};\n\nREGISTER_CALCULATOR(DoubleIntCalculator);\n\n\n", "file_path": "mediapipe/framework/test_calculators.cc", "rank": 18, "score": 256093.5995653982 }, { "content": "class StringToSequenceExampleCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc);\n\n ::mediapipe::Status Open(CalculatorContext* cc) override;\n\n ::mediapipe::Status Process(CalculatorContext* cc) override;\n\n ::mediapipe::Status Close(CalculatorContext* cc) override;\n\n};\n\n\n\nREGISTER_CALCULATOR(StringToSequenceExampleCalculator);\n\n\n\n::mediapipe::Status StringToSequenceExampleCalculator::GetContract(\n\n CalculatorContract* cc) {\n\n if (cc->InputSidePackets().HasTag(kString)) {\n\n cc->InputSidePackets().Tag(kString).Set<std::string>();\n\n cc->OutputSidePackets().Tag(kSequenceExample).Set<tf::SequenceExample>();\n\n }\n\n if (cc->InputSidePackets().HasTag(kSequenceExample)) {\n\n cc->InputSidePackets().Tag(kSequenceExample).Set<tf::SequenceExample>();\n\n cc->OutputSidePackets().Tag(kString).Set<std::string>();\n\n }\n", "file_path": "mediapipe/calculators/tensorflow/string_to_sequence_example_calculator.cc", "rank": 19, "score": 252792.6800939143 }, { "content": "// Adjusts detection locations on a letterboxed image to the corresponding\n\n// locations on the same image with the letterbox removed. This is useful to map\n\n// the detections inferred from a letterboxed image, for example, output of\n\n// the ImageTransformationCalculator when the scale mode is FIT, back to the\n\n// corresponding input image before letterboxing.\n\n//\n\n// Input:\n\n// DETECTIONS: An std::vector<Detection> representing detections on an\n\n// letterboxed image.\n\n//\n\n// LETTERBOX_PADDING: An std::array<float, 4> representing the letterbox\n\n// padding from the 4 sides ([left, top, right, bottom]) of the letterboxed\n\n// image, normalized to [0.f, 1.f] by the letterboxed image dimensions.\n\n//\n\n// Output:\n\n// DETECTIONS: An std::vector<Detection> representing detections with their\n\n// locations adjusted to the letterbox-removed (non-padded) image.\n\n//\n\n// Usage example:\n\n// node {\n\n// calculator: \"DetectionLetterboxRemovalCalculator\"\n\n// input_stream: \"DETECTIONS:detections\"\n\n// input_stream: \"LETTERBOX_PADDING:letterbox_padding\"\n\n// output_stream: \"DETECTIONS:adjusted_detections\"\n\n// }\n\nclass DetectionLetterboxRemovalCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n RET_CHECK(cc->Inputs().HasTag(kDetectionsTag) &&\n\n cc->Inputs().HasTag(kLetterboxPaddingTag))\n\n << \"Missing one or more input streams.\";\n\n\n\n cc->Inputs().Tag(kDetectionsTag).Set<std::vector<Detection>>();\n\n cc->Inputs().Tag(kLetterboxPaddingTag).Set<std::array<float, 4>>();\n\n\n\n cc->Outputs().Tag(kDetectionsTag).Set<std::vector<Detection>>();\n\n\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override {\n\n cc->SetOffset(TimestampDiff(0));\n\n\n\n return ::mediapipe::OkStatus();\n\n }\n", "file_path": "mediapipe/calculators/util/detection_letterbox_removal_calculator.cc", "rank": 20, "score": 252624.47216632593 }, { "content": "// A calculator that converts Detection proto to RenderData proto for\n\n// visualization.\n\n//\n\n// Detection is the format for encoding one or more detections in an image.\n\n// The input can be std::vector<Detection> or DetectionList.\n\n//\n\n// Please note that only Location Data formats of BOUNDING_BOX and\n\n// RELATIVE_BOUNDING_BOX are supported. Normalized coordinates for\n\n// RELATIVE_BOUNDING_BOX must be between 0.0 and 1.0. Any incremental normalized\n\n// coordinates calculation in this calculator is capped at 1.0.\n\n//\n\n// The text(s) for \"label(_id),score\" will be shown on top left\n\n// corner of the bounding box. The text for \"feature_tag\" will be shown on\n\n// bottom left corner of the bounding box.\n\n//\n\n// Example config:\n\n// node {\n\n// calculator: \"DetectionsToRenderDataCalculator\"\n\n// input_stream: \"DETECTIONS:detections\"\n\n// input_stream: \"DETECTION_LIST:detection_list\"\n\n// output_stream: \"RENDER_DATA:render_data\"\n\n// options {\n\n// [DetectionsToRenderDataCalculatorOptions.ext] {\n\n// produce_empty_packet : false\n\n// }\n\n// }\n\n// }\n\nclass DetectionsToRenderDataCalculator : public CalculatorBase {\n\n public:\n\n DetectionsToRenderDataCalculator() {}\n\n ~DetectionsToRenderDataCalculator() override {}\n\n DetectionsToRenderDataCalculator(const DetectionsToRenderDataCalculator&) =\n\n delete;\n\n DetectionsToRenderDataCalculator& operator=(\n\n const DetectionsToRenderDataCalculator&) = delete;\n\n\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc);\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override;\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) override;\n\n\n\n private:\n\n // These utility methods are supposed to be used only by this class. No\n\n // external client should depend on them. Due to C++ style guide unnamed\n\n // namespace should not be used in header files. So, these has been defined\n\n // as private static methods.\n", "file_path": "mediapipe/calculators/util/detections_to_render_data_calculator.cc", "rank": 21, "score": 252621.67377875053 }, { "content": "// Assign a unique id to detections.\n\n// Note that the calculator will consume the input vector of Detection or\n\n// DetectionList. So the input stream can not be connected to other calculators.\n\n//\n\n// Example config:\n\n// node {\n\n// calculator: \"DetectionUniqueIdCalculator\"\n\n// input_stream: \"DETECTIONS:detections\"\n\n// output_stream: \"DETECTIONS:output_detections\"\n\n// }\n\nclass DetectionUniqueIdCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n RET_CHECK(cc->Inputs().HasTag(kDetectionListTag) ||\n\n cc->Inputs().HasTag(kDetectionsTag))\n\n << \"None of the input streams are provided.\";\n\n\n\n if (cc->Inputs().HasTag(kDetectionListTag)) {\n\n RET_CHECK(cc->Outputs().HasTag(kDetectionListTag));\n\n cc->Inputs().Tag(kDetectionListTag).Set<DetectionList>();\n\n cc->Outputs().Tag(kDetectionListTag).Set<DetectionList>();\n\n }\n\n if (cc->Inputs().HasTag(kDetectionsTag)) {\n\n RET_CHECK(cc->Outputs().HasTag(kDetectionsTag));\n\n cc->Inputs().Tag(kDetectionsTag).Set<std::vector<Detection>>();\n\n cc->Outputs().Tag(kDetectionsTag).Set<std::vector<Detection>>();\n\n }\n\n\n\n return ::mediapipe::OkStatus();\n\n }\n", "file_path": "mediapipe/calculators/util/detection_unique_id_calculator.cc", "rank": 22, "score": 252605.96447989895 }, { "content": "// This calculator takes a sequence of images (video) and detects solid color\n\n// borders as well as the dominant color of the non-border area. This per-frame\n\n// information is passed to downstream calculators.\n\nclass BorderDetectionCalculator : public CalculatorBase {\n\n public:\n\n BorderDetectionCalculator() : frame_width_(-1), frame_height_(-1) {}\n\n ~BorderDetectionCalculator() override {}\n\n BorderDetectionCalculator(const BorderDetectionCalculator&) = delete;\n\n BorderDetectionCalculator& operator=(const BorderDetectionCalculator&) =\n\n delete;\n\n\n\n static mediapipe::Status GetContract(mediapipe::CalculatorContract* cc);\n\n mediapipe::Status Open(mediapipe::CalculatorContext* cc) override;\n\n mediapipe::Status Process(mediapipe::CalculatorContext* cc) override;\n\n\n\n private:\n\n // Given a color and image direction, check to see if a border of that color\n\n // exists.\n\n void DetectBorder(const cv::Mat& frame, const Color& color,\n\n const Border::RelativePosition& direction,\n\n StaticFeatures* features);\n\n\n\n // Provide the percent this color shows up in a given image.\n", "file_path": "mediapipe/examples/desktop/autoflip/calculators/border_detection_calculator.cc", "rank": 24, "score": 252598.35292419328 }, { "content": "// A Calculator that adds the float values in the packets in all the input\n\n// streams and outputs the sum to the output stream.\n\nclass FloatAdderCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n for (int i = 0; i < cc->Inputs().NumEntries(); ++i) {\n\n cc->Inputs().Index(i).Set<float>();\n\n }\n\n cc->Outputs().Index(0).Set<float>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) final {\n\n cc->SetOffset(TimestampDiff(0));\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n float sum = 0.0;\n\n for (int i = 0; i < cc->Inputs().NumEntries(); ++i) {\n\n sum += cc->Inputs().Index(i).Get<float>();\n\n }\n\n cc->Outputs().Index(0).Add(new float(sum), cc->InputTimestamp());\n\n return ::mediapipe::OkStatus();\n\n }\n\n};\n\nREGISTER_CALCULATOR(FloatAdderCalculator);\n\n\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 25, "score": 251029.27190774336 }, { "content": "// A Calculator that outputs the square of its input packet (an int).\n\nclass SquareIntCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Index(0).Set<int>();\n\n cc->Outputs().Index(0).SetSameAs(&cc->Inputs().Index(0));\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) final {\n\n cc->SetOffset(TimestampDiff(0));\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n int value = cc->Inputs().Index(0).Value().Get<int>();\n\n cc->Outputs().Index(0).Add(new int(value * value), cc->InputTimestamp());\n\n return ::mediapipe::OkStatus();\n\n }\n\n};\n\nREGISTER_CALCULATOR(SquareIntCalculator);\n\n\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 26, "score": 251003.54199475565 }, { "content": "// Splits a uint64 into a pair of two uint32, the first element of which\n\n// holds the high order bits and the second the low order ones.\n\nclass IntSplitterPacketGenerator : public PacketGenerator {\n\n public:\n\n static ::mediapipe::Status FillExpectations(\n\n const PacketGeneratorOptions& extendable_options, //\n\n PacketTypeSet* input_side_packets, //\n\n PacketTypeSet* output_side_packets) {\n\n input_side_packets->Index(0).Set<uint64>();\n\n output_side_packets->Index(0).Set<std::pair<uint32, uint32>>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n static ::mediapipe::Status Generate(\n\n const PacketGeneratorOptions& extendable_options, //\n\n const PacketSet& input_side_packets, //\n\n PacketSet* output_side_packets) {\n\n uint64 value = input_side_packets.Index(0).Get<uint64>();\n\n uint32 high = value >> 32;\n\n uint32 low = value & 0xFFFFFFFF;\n\n output_side_packets->Index(0) =\n\n Adopt(new std::pair<uint32, uint32>(high, low));\n\n return ::mediapipe::OkStatus();\n\n }\n\n};\n\nREGISTER_PACKET_GENERATOR(IntSplitterPacketGenerator);\n\n\n", "file_path": "mediapipe/framework/test_calculators.cc", "rank": 27, "score": 250997.18527861132 }, { "content": "// A Calculator that adds the integer values in the packets in all the input\n\n// streams and outputs the sum to the output stream.\n\nclass IntAdderCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n for (int i = 0; i < cc->Inputs().NumEntries(); ++i) {\n\n cc->Inputs().Index(i).Set<int>();\n\n }\n\n cc->Outputs().Index(0).Set<int>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) final {\n\n cc->SetOffset(TimestampDiff(0));\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n int sum = 0;\n\n for (int i = 0; i < cc->Inputs().NumEntries(); ++i) {\n\n sum += cc->Inputs().Index(i).Get<int>();\n\n }\n\n cc->Outputs().Index(0).Add(new int(sum), cc->InputTimestamp());\n\n return ::mediapipe::OkStatus();\n\n }\n\n};\n\nREGISTER_CALCULATOR(IntAdderCalculator);\n\n\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 28, "score": 250997.18527861132 }, { "content": "// A Calculator that multiplies the integer values in the packets in all the\n\n// input streams and outputs the product to the output stream.\n\nclass IntMultiplierCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n for (int i = 0; i < cc->Inputs().NumEntries(); ++i) {\n\n cc->Inputs().Index(i).Set<int>();\n\n }\n\n cc->Outputs().Index(0).Set<int>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) final {\n\n cc->SetOffset(TimestampDiff(0));\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n int product = 1;\n\n for (int i = 0; i < cc->Inputs().NumEntries(); ++i) {\n\n product *= cc->Inputs().Index(i).Get<int>();\n\n }\n\n cc->Outputs().Index(0).Add(new int(product), cc->InputTimestamp());\n\n return ::mediapipe::OkStatus();\n\n }\n\n};\n\nREGISTER_CALCULATOR(IntMultiplierCalculator);\n\n\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 29, "score": 250997.18527861132 }, { "content": "class UnsignedSafeIntTest : public ::testing::Test {\n\n public:\n\n typedef T SafeIntTypeUnderTest;\n\n};\n\n\n\ntypedef ::testing::Types<SafeUInt8, SafeUInt16, SafeUInt32, SafeUInt64>\n\n UnsignedSafeIntTypes;\n\n\n\nTYPED_TEST_SUITE(UnsignedSafeIntTest, UnsignedSafeIntTypes);\n\n\n\nTYPED_TEST(UnsignedSafeIntTest, TestCtors) {\n\n typedef typename TestFixture::SafeIntTypeUnderTest T;\n\n typedef typename T::ValueType V;\n\n\n\n { // Test out-of-bounds construction.\n\n EXPECT_DEATH(T(-1), \"bounds\");\n\n }\n\n { // Test out-of-bounds construction from float.\n\n EXPECT_DEATH((T(static_cast<float>(-1))), \"bounds\");\n\n }\n", "file_path": "mediapipe/framework/deps/safe_int_test.cc", "rank": 30, "score": 250404.027592391 }, { "content": "class SignedSafeIntTest : public ::testing::Test {\n\n public:\n\n typedef T SafeIntTypeUnderTest;\n\n};\n\n\n\ntypedef ::testing::Types<SafeInt8, SafeInt16, SafeInt32, SafeInt64>\n\n SignedSafeIntTypes;\n\n\n\nTYPED_TEST_SUITE(SignedSafeIntTest, SignedSafeIntTypes);\n\n\n\nTYPED_TEST(SignedSafeIntTest, TestCtors) {\n\n typedef typename TestFixture::SafeIntTypeUnderTest T;\n\n typedef typename T::ValueType V;\n\n\n\n { // Test construction from a negative value.\n\n T x(-1);\n\n EXPECT_EQ(V(-1), x.value());\n\n }\n\n}\n\n\n", "file_path": "mediapipe/framework/deps/safe_int_test.cc", "rank": 31, "score": 250404.027592391 }, { "content": "// A calculator for converting TFLite tensors to to a float or a float vector.\n\n//\n\n// Input:\n\n// TENSORS - Vector of TfLiteTensor of type kTfLiteFloat32. Only the first\n\n// tensor will be used.\n\n// Output:\n\n// FLOAT(optional) - Converted single float number.\n\n// FLOATS(optional) - Converted float vector.\n\n//\n\n// Notes: To output FLOAT stream, the input TFLite tensor must have size 1, e.g.\n\n// only 1 float number in the tensor.\n\n//\n\n// Usage example:\n\n// node {\n\n// calculator: \"TfLiteTensorsToFloatsCalculator\"\n\n// input_stream: \"TENSORS:tensors\"\n\n// output_stream: \"FLOATS:floats\"\n\n// }\n\nclass TfLiteTensorsToFloatsCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc);\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override;\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) override;\n\n};\n\nREGISTER_CALCULATOR(TfLiteTensorsToFloatsCalculator);\n\n\n\n::mediapipe::Status TfLiteTensorsToFloatsCalculator::GetContract(\n\n CalculatorContract* cc) {\n\n RET_CHECK(cc->Inputs().HasTag(\"TENSORS\"));\n\n RET_CHECK(cc->Outputs().HasTag(\"FLOATS\") || cc->Outputs().HasTag(\"FLOAT\"));\n\n\n\n cc->Inputs().Tag(\"TENSORS\").Set<std::vector<TfLiteTensor>>();\n\n if (cc->Outputs().HasTag(\"FLOATS\")) {\n\n cc->Outputs().Tag(\"FLOATS\").Set<std::vector<float>>();\n\n }\n\n if (cc->Outputs().HasTag(\"FLOAT\")) {\n", "file_path": "mediapipe/calculators/tflite/tflite_tensors_to_floats_calculator.cc", "rank": 32, "score": 248675.44592910478 }, { "content": "// Convert result TFLite tensors from object detection models into MediaPipe\n\n// Detections.\n\n//\n\n// Input:\n\n// TENSORS - Vector of TfLiteTensor of type kTfLiteFloat32. The vector of\n\n// tensors can have 2 or 3 tensors. First tensor is the predicted\n\n// raw boxes/keypoints. The size of the values must be (num_boxes\n\n// * num_predicted_values). Second tensor is the score tensor. The\n\n// size of the valuse must be (num_boxes * num_classes). It's\n\n// optional to pass in a third tensor for anchors (e.g. for SSD\n\n// models) depend on the outputs of the detection model. The size\n\n// of anchor tensor must be (num_boxes * 4).\n\n// TENSORS_GPU - vector of GlBuffer of MTLBuffer.\n\n// Output:\n\n// DETECTIONS - Result MediaPipe detections.\n\n//\n\n// Usage example:\n\n// node {\n\n// calculator: \"TfLiteTensorsToDetectionsCalculator\"\n\n// input_stream: \"TENSORS:tensors\"\n\n// input_side_packet: \"ANCHORS:anchors\"\n\n// output_stream: \"DETECTIONS:detections\"\n\n// options: {\n\n// [mediapipe.TfLiteTensorsToDetectionsCalculatorOptions.ext] {\n\n// num_classes: 91\n\n// num_boxes: 1917\n\n// num_coords: 4\n\n// ignore_classes: [0, 1, 2]\n\n// x_scale: 10.0\n\n// y_scale: 10.0\n\n// h_scale: 5.0\n\n// w_scale: 5.0\n\n// }\n\n// }\n\n// }\n\nclass TfLiteTensorsToDetectionsCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc);\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override;\n\n ::mediapipe::Status Process(CalculatorContext* cc) override;\n\n ::mediapipe::Status Close(CalculatorContext* cc) override;\n\n\n\n private:\n\n ::mediapipe::Status ProcessCPU(CalculatorContext* cc,\n\n std::vector<Detection>* output_detections);\n\n ::mediapipe::Status ProcessGPU(CalculatorContext* cc,\n\n std::vector<Detection>* output_detections);\n\n\n\n ::mediapipe::Status LoadOptions(CalculatorContext* cc);\n\n ::mediapipe::Status GpuInit(CalculatorContext* cc);\n\n ::mediapipe::Status DecodeBoxes(const float* raw_boxes,\n\n const std::vector<Anchor>& anchors,\n\n std::vector<float>* boxes);\n\n ::mediapipe::Status ConvertToDetections(\n", "file_path": "mediapipe/calculators/tflite/tflite_tensors_to_detections_calculator.cc", "rank": 33, "score": 248516.9690089627 }, { "content": "// A Calculator that multiplies the float value in an input packet by a float\n\n// constant scalar (specified in a side packet) and outputs the product to the\n\n// output stream.\n\nclass FloatScalarMultiplierCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Index(0).Set<float>();\n\n cc->Outputs().Index(0).Set<float>();\n\n cc->InputSidePackets().Index(0).Set<float>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) final {\n\n scalar_ = cc->InputSidePackets().Index(0).Get<float>();\n\n cc->SetOffset(TimestampDiff(0));\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n float value = cc->Inputs().Index(0).Value().Get<float>();\n\n cc->Outputs().Index(0).Add(new float(scalar_ * value),\n\n cc->InputTimestamp());\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n private:\n\n float scalar_;\n\n};\n\nREGISTER_CALCULATOR(FloatScalarMultiplierCalculator);\n\n\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 34, "score": 246194.28558350282 }, { "content": "class FloatUnitDelayCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Index(0).Set<float>();\n\n cc->Outputs().Index(0).Set<float>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) final {\n\n cc->Outputs().Index(0).Add(new float(0.0), Timestamp(0));\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n const Packet& packet = cc->Inputs().Index(0).Value();\n\n cc->Outputs().Index(0).AddPacket(\n\n packet.At(packet.Timestamp().NextAllowedInStream()));\n\n return ::mediapipe::OkStatus();\n\n }\n\n};\n\nREGISTER_CALCULATOR(FloatUnitDelayCalculator);\n\n\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 35, "score": 246187.13877834665 }, { "content": "// A Calculator that adds the integer values in the packets in all the input\n\n// streams and outputs the sum to the output stream.\n\nclass IntAdderCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n for (int i = 0; i < cc->Inputs().NumEntries(); ++i) {\n\n cc->Inputs().Index(i).Set<int>();\n\n }\n\n cc->Outputs().Index(0).Set<int>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) final {\n\n cc->SetOffset(TimestampDiff(0));\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n int sum = 0;\n\n for (int i = 0; i < cc->Inputs().NumEntries(); ++i) {\n\n sum += cc->Inputs().Index(i).Get<int>();\n\n }\n\n cc->Outputs().Index(0).Add(new int(sum), cc->InputTimestamp());\n\n return ::mediapipe::OkStatus();\n\n }\n\n};\n\nREGISTER_CALCULATOR(IntAdderCalculator);\n\n\n\ntemplate <typename InputType>\n", "file_path": "mediapipe/framework/calculator_graph_bounds_test.cc", "rank": 36, "score": 246161.91849199423 }, { "content": "// Takes a uint64 and produces three input side packets, a uint32 of the\n\n// high order bits, a uint32 of the low order bits and a pair of uint32\n\n// with both the high and low order bits.\n\nclass TaggedIntSplitterPacketGenerator : public PacketGenerator {\n\n public:\n\n static ::mediapipe::Status FillExpectations(\n\n const PacketGeneratorOptions& extendable_options, //\n\n PacketTypeSet* input_side_packets, //\n\n PacketTypeSet* output_side_packets) {\n\n input_side_packets->Index(0).Set<uint64>();\n\n output_side_packets->Tag(\"HIGH\").Set<uint32>();\n\n output_side_packets->Tag(\"LOW\").Set<uint32>();\n\n output_side_packets->Tag(\"PAIR\").Set<std::pair<uint32, uint32>>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n static ::mediapipe::Status Generate(\n\n const PacketGeneratorOptions& extendable_options, //\n\n const PacketSet& input_side_packets, //\n\n PacketSet* output_side_packets) {\n\n uint64 value = input_side_packets.Index(0).Get<uint64>();\n\n uint32 high = value >> 32;\n\n uint32 low = value & 0xFFFFFFFF;\n\n output_side_packets->Tag(\"HIGH\") = Adopt(new uint32(high));\n\n output_side_packets->Tag(\"LOW\") = Adopt(new uint32(low));\n\n output_side_packets->Tag(\"PAIR\") =\n\n Adopt(new std::pair<uint32, uint32>(high, low));\n\n return ::mediapipe::OkStatus();\n\n }\n\n};\n\nREGISTER_PACKET_GENERATOR(TaggedIntSplitterPacketGenerator);\n\n\n", "file_path": "mediapipe/framework/test_calculators.cc", "rank": 37, "score": 246161.91849199423 }, { "content": "class SignNeutralSafeIntTest : public ::testing::Test {\n\n public:\n\n typedef T SafeIntTypeUnderTest;\n\n};\n\n\n\ntypedef ::testing::Types<SafeInt8, SafeUInt8, SafeInt16, SafeUInt16, SafeInt32,\n\n SafeUInt32, SafeInt64, SafeUInt64>\n\n AllSafeIntTypes;\n\n\n\nTYPED_TEST_SUITE(SignNeutralSafeIntTest, AllSafeIntTypes);\n\n\n\nTYPED_TEST(SignNeutralSafeIntTest, TestCtors) {\n\n typedef typename TestFixture::SafeIntTypeUnderTest T;\n\n typedef typename T::ValueType V;\n\n\n\n { // Test default construction.\n\n T x;\n\n EXPECT_EQ(V(), x.value());\n\n }\n\n\n", "file_path": "mediapipe/framework/deps/safe_int_test.cc", "rank": 38, "score": 246119.25949762977 }, { "content": "// Takes a label map (from label IDs to names), and replaces the label IDs\n\n// in Detection protos with label names. Note that the calculator makes a copy\n\n// of the input detections. Consider using it only when the size of input\n\n// detections is small.\n\n//\n\n// Example usage:\n\n// node {\n\n// calculator: \"DetectionLabelIdToTextCalculator\"\n\n// input_stream: \"input_detections\"\n\n// output_stream: \"output_detections\"\n\n// node_options: {\n\n// [type.googleapis.com/mediapipe.DetectionLabelIdToTextCalculatorOptions] {\n\n// label_map_path: \"labelmap.txt\"\n\n// }\n\n// }\n\n// }\n\nclass DetectionLabelIdToTextCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc);\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override;\n\n ::mediapipe::Status Process(CalculatorContext* cc) override;\n\n\n\n private:\n\n std::unordered_map<int, std::string> label_map_;\n\n};\n\nREGISTER_CALCULATOR(DetectionLabelIdToTextCalculator);\n\n\n\n::mediapipe::Status DetectionLabelIdToTextCalculator::GetContract(\n\n CalculatorContract* cc) {\n\n cc->Inputs().Index(0).Set<std::vector<Detection>>();\n\n cc->Outputs().Index(0).Set<std::vector<Detection>>();\n\n\n\n return ::mediapipe::OkStatus();\n\n}\n\n\n", "file_path": "mediapipe/calculators/util/detection_label_id_to_text_calculator.cc", "rank": 39, "score": 244582.88010540325 }, { "content": "// A calculator that converts Detection proto to TimedBoxList proto for\n\n// tracking.\n\n//\n\n// Please note that only Location Data formats of RELATIVE_BOUNDING_BOX are\n\n// supported.\n\n//\n\n// Example config:\n\n// node {\n\n// calculator: \"DetectionsToTimedBoxListCalculator\"\n\n// input_stream: \"DETECTIONS:detections\"\n\n// output_stream: \"BOXES:boxes\"\n\n// }\n\nclass DetectionsToTimedBoxListCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n RET_CHECK(cc->Inputs().HasTag(kDetectionListTag) ||\n\n cc->Inputs().HasTag(kDetectionsTag))\n\n << \"None of the input streams are provided.\";\n\n if (cc->Inputs().HasTag(kDetectionListTag)) {\n\n cc->Inputs().Tag(kDetectionListTag).Set<DetectionList>();\n\n }\n\n if (cc->Inputs().HasTag(kDetectionsTag)) {\n\n cc->Inputs().Tag(kDetectionsTag).Set<std::vector<Detection>>();\n\n }\n\n cc->Outputs().Tag(kBoxesTag).Set<TimedBoxProtoList>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override {\n\n cc->SetOffset(TimestampDiff(0));\n\n return ::mediapipe::OkStatus();\n\n }\n", "file_path": "mediapipe/calculators/util/detections_to_timed_box_list_calculator.cc", "rank": 40, "score": 244578.37229752183 }, { "content": "// A source calculator for testing the Calculator::InputTimestamp() method.\n\n// It outputs five int packets with timestamps 0, 1, 2, 3, 4.\n\nclass CheckInputTimestampSourceCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Outputs().Index(0).Set<int>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n // InputTimestamp() returns Timestamp::Unstarted() in Open() for both source\n\n // and non-source nodes.\n\n ::mediapipe::Status Open(CalculatorContext* cc) final {\n\n RET_CHECK_EQ(cc->InputTimestamp(), Timestamp::Unstarted());\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n // InputTimestamp() always returns Timestamp(0) in Process() for source\n\n // nodes.\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n RET_CHECK_EQ(cc->InputTimestamp(), Timestamp(0));\n\n cc->Outputs().Index(0).Add(new int(count_), Timestamp(count_));\n\n ++count_;\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 41, "score": 241593.36721598997 }, { "content": "// A sink calculator for testing the Calculator::InputTimestamp() method.\n\n// It expects to consume the output of a CheckInputTimestampSourceCalculator.\n\nclass CheckInputTimestampSinkCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Index(0).Set<int>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n // InputTimestamp() returns Timestamp::Unstarted() in Open() for both source\n\n // and non-source nodes.\n\n ::mediapipe::Status Open(CalculatorContext* cc) final {\n\n RET_CHECK_EQ(cc->InputTimestamp(), Timestamp::Unstarted());\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n // InputTimestamp() returns the timestamp of input packets in Process() for\n\n // non-source nodes.\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n RET_CHECK_EQ(cc->InputTimestamp(),\n\n cc->Inputs().Index(0).Value().Timestamp());\n\n RET_CHECK_EQ(cc->InputTimestamp(), Timestamp(count_));\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 42, "score": 241587.22147353462 }, { "content": "// A Calculator that passes an input packet through if it contains an even\n\n// integer.\n\nclass EvenIntFilterCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Index(0).Set<int>();\n\n cc->Outputs().Index(0).Set<int>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n int value = cc->Inputs().Index(0).Get<int>();\n\n if (value % 2 == 0) {\n\n cc->Outputs().Index(0).AddPacket(cc->Inputs().Index(0).Value());\n\n } else {\n\n cc->Outputs().Index(0).SetNextTimestampBound(\n\n cc->InputTimestamp().NextAllowedInStream());\n\n }\n\n return ::mediapipe::OkStatus();\n\n }\n\n};\n\nREGISTER_CALCULATOR(EvenIntFilterCalculator);\n\n\n", "file_path": "mediapipe/framework/calculator_graph_bounds_test.cc", "rank": 43, "score": 241562.8258981234 }, { "content": "class MyClass : public MyClassBase {\n\n public:\n\n MyClass() : value_(0), exist_(nullptr) {}\n\n MyClass(const MyClass&) = delete;\n\n MyClass& operator=(const MyClass&) = delete;\n\n // Creates an object and sets the value of *exist to true. It will set\n\n // *exist=false upon destruction, which allows the testing of Packet's\n\n // reference counting mechanism.\n\n explicit MyClass(bool* exist) : value_(0), exist_(exist) { *exist_ = true; }\n\n ~MyClass() override {\n\n if (exist_) *exist_ = false;\n\n }\n\n int value() const override { return value_; }\n\n void set_value(int value) override { value_ = value; }\n\n\n\n private:\n\n int value_;\n\n bool* exist_;\n\n};\n\n\n", "file_path": "mediapipe/framework/packet_test.cc", "rank": 44, "score": 237412.23140811035 }, { "content": "// The input streams must have the same time unit but may have different time\n\n// origins (also called epochs). The timestamp_base_tag_index option\n\n// designates an input stream as the timestamp base.\n\n//\n\n// TimestampAlignInputStreamHandler operates in two phases:\n\n//\n\n// 1. Pre-initialization: In this phase, the input stream handler passes\n\n// through input packets in the timestamp base input stream, but buffers the\n\n// input packets in all other input streams. This phase ends when the input\n\n// stream handler has an input packet in every input stream. It uses the\n\n// the timestamps of these input packets to calculate the timestamp offset of\n\n// each input stream with respect to the timestamp base input stream. The\n\n// timestamp offsets are saved for use in the next phase.\n\n//\n\n// 2. Post-initialization: In this phase, the input stream handler behaves\n\n// like the DefaultInputStreamHandler, except that timestamp offsets are\n\n// applied to the packet timestamps.\n\nclass TimestampAlignInputStreamHandler : public InputStreamHandler {\n\n public:\n\n TimestampAlignInputStreamHandler() = delete;\n\n TimestampAlignInputStreamHandler(std::shared_ptr<tool::TagMap> tag_map,\n\n CalculatorContextManager* cc_manager,\n\n const MediaPipeOptions& options,\n\n bool calculator_run_in_parallel);\n\n\n\n void PrepareForRun(\n\n std::function<void()> headers_ready_callback,\n\n std::function<void()> notification_callback,\n\n std::function<void(CalculatorContext*)> schedule_callback,\n\n std::function<void(::mediapipe::Status)> error_callback) override;\n\n\n\n protected:\n\n // In TimestampAlignInputStreamHandler, a node is \"ready\" if:\n\n // - before the timestamp offsets are initialized: we have received a packet\n\n // in the timestamp base input stream, or\n\n // - after the timestamp offsets are initialized: the minimum bound (over\n\n // all empty streams) is greater than the smallest timestamp of any\n", "file_path": "mediapipe/framework/stream_handler/timestamp_align_input_stream_handler.cc", "rank": 45, "score": 237355.21720551696 }, { "content": "class AssociationDetectionCalculatorTest : public ::testing::Test {\n\n protected:\n\n AssociationDetectionCalculatorTest() {\n\n // 0.4 ================\n\n // | | | |\n\n // 0.3 ===================== | DET2 | |\n\n // | | | DET1 | | | DET4 |\n\n // 0.2 | DET0 | =========== ================\n\n // | | | | | |\n\n // 0.1 =====|=============== |\n\n // | DET3 | | |\n\n // 0.0 ================ |\n\n // | DET5 |\n\n // -0.1 ===========\n\n // 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2\n\n\n\n // Detection det_0.\n\n det_0 = DetectionWithRelativeLocationData(/*xmin=*/0.1, /*ymin=*/0.1,\n\n /*width=*/0.2, /*height=*/0.2);\n\n det_0.set_detection_id(0);\n", "file_path": "mediapipe/calculators/util/association_calculator_test.cc", "rank": 46, "score": 234851.00022854417 }, { "content": "class SplitTfLiteTensorVectorCalculatorTest : public ::testing::Test {\n\n protected:\n\n void TearDown() {\n\n // Note: Since the pointers contained in this vector will be cleaned up by\n\n // the interpreter, only ensure that the vector is cleaned up for the next\n\n // test.\n\n input_buffers_.clear();\n\n }\n\n\n\n void PrepareTfLiteTensorVector(int vector_size) {\n\n ASSERT_NE(interpreter_, nullptr);\n\n\n\n // Prepare input tensors.\n\n std::vector<int> indices(vector_size);\n\n for (int i = 0; i < vector_size; ++i) {\n\n indices[i] = i;\n\n }\n\n interpreter_->AddTensors(vector_size);\n\n interpreter_->SetInputs(indices);\n\n\n", "file_path": "mediapipe/calculators/core/split_vector_calculator_test.cc", "rank": 47, "score": 234267.03326720023 }, { "content": "// Takes an input stream packet and passes it (with timestamp intact) as an\n\n// output side packet. This triggers an error in the graph.\n\nclass OutputSidePacketWithTimestampCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Index(0).SetAny();\n\n cc->OutputSidePackets().Index(0).SetSameAs(&cc->Inputs().Index(0));\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n cc->OutputSidePackets().Index(0).Set(cc->Inputs().Index(0).Value());\n\n return ::mediapipe::OkStatus();\n\n }\n\n};\n\nREGISTER_CALCULATOR(OutputSidePacketWithTimestampCalculator);\n\n\n", "file_path": "mediapipe/framework/calculator_graph_side_packet_test.cc", "rank": 48, "score": 233029.7036367838 }, { "content": "class StaticAccessToGeneratorTyped : public StaticAccessToGenerator {\n\n public:\n\n static_assert(std::is_base_of<::mediapipe::PacketGenerator,\n\n PacketGeneratorSubclass>::value,\n\n \"Classes registered with REGISTER_PACKET_GENERATOR must be \"\n\n \"subclasses of ::mediapipe::PacketGenerator.\");\n\n static_assert(\n\n PacketGeneratorHasFillExpectations<PacketGeneratorSubclass>(nullptr),\n\n \"FillExpectations() must be defined with the correct signature in \"\n\n \"every PacketGenerator.\");\n\n static_assert(PacketGeneratorHasGenerate<PacketGeneratorSubclass>(nullptr),\n\n \"Generate() must be defined with the correct signature in \"\n\n \"every PacketGenerator.\");\n\n\n\n ::mediapipe::Status FillExpectations(\n\n const PacketGeneratorOptions& extendable_options, //\n\n PacketTypeSet* input_side_packets, //\n\n PacketTypeSet* output_side_packets) final {\n\n return PacketGeneratorSubclass::FillExpectations(\n\n extendable_options, input_side_packets, output_side_packets);\n", "file_path": "mediapipe/framework/packet_generator.h", "rank": 49, "score": 224702.52413668402 }, { "content": "class SplitVectorCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n RET_CHECK(cc->Inputs().NumEntries() == 1);\n\n RET_CHECK(cc->Outputs().NumEntries() != 0);\n\n\n\n cc->Inputs().Index(0).Set<std::vector<T>>();\n\n\n\n const auto& options =\n\n cc->Options<::mediapipe::SplitVectorCalculatorOptions>();\n\n\n\n if (!std::is_copy_constructible<T>::value || move_elements) {\n\n // Ranges of elements shouldn't overlap when the vector contains\n\n // non-copyable elements.\n\n RET_CHECK_OK(checkRangesDontOverlap(options));\n\n }\n\n\n\n if (options.combine_outputs()) {\n\n RET_CHECK_EQ(cc->Outputs().NumEntries(), 1);\n\n cc->Outputs().Index(0).Set<std::vector<T>>();\n", "file_path": "mediapipe/calculators/core/split_vector_calculator.h", "rank": 50, "score": 224557.21080550057 }, { "content": "class ConcatenateVectorCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n RET_CHECK(cc->Inputs().NumEntries() != 0);\n\n RET_CHECK(cc->Outputs().NumEntries() == 1);\n\n\n\n for (int i = 0; i < cc->Inputs().NumEntries(); ++i) {\n\n cc->Inputs().Index(i).Set<std::vector<T>>();\n\n }\n\n\n\n cc->Outputs().Index(0).Set<std::vector<T>>();\n\n\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override {\n\n cc->SetOffset(TimestampDiff(0));\n\n only_emit_if_all_present_ =\n\n cc->Options<::mediapipe::ConcatenateVectorCalculatorOptions>()\n\n .only_emit_if_all_present();\n", "file_path": "mediapipe/calculators/core/concatenate_vector_calculator.h", "rank": 51, "score": 224557.21080550057 }, { "content": "// A calculator that converts Detection proto to Rect proto.\n\n//\n\n// Detection is the format for encoding one or more detections in an image.\n\n// The input can be a single Detection or std::vector<Detection>. The output can\n\n// be either a single Rect or NormalizedRect, or std::vector<Rect> or\n\n// std::vector<NormalizedRect>. If Rect is used, the LocationData format is\n\n// expected to be BOUNDING_BOX, and if NormalizedRect is used it is expected to\n\n// be RELATIVE_BOUNDING_BOX.\n\n//\n\n// When the input is std::vector<Detection> and the output is a Rect or\n\n// NormalizedRect, only the first detection is converted. When the input is a\n\n// single Detection and the output is a std::vector<Rect> or\n\n// std::vector<NormalizedRect>, the output is a vector of size 1.\n\n//\n\n// Inputs:\n\n//\n\n// One of the following:\n\n// DETECTION: A Detection proto.\n\n// DETECTIONS: An std::vector<Detection>.\n\n//\n\n// IMAGE_SIZE (optional): A std::pair<int, int> represention image width and\n\n// height. This is required only when rotation needs to be computed (see\n\n// calculator options).\n\n//\n\n// Output:\n\n// One of the following:\n\n// RECT: A Rect proto.\n\n// NORM_RECT: A NormalizedRect proto.\n\n// RECTS: An std::vector<Rect>.\n\n// NORM_RECTS: An std::vector<NormalizedRect>.\n\n//\n\n// Example config:\n\n// node {\n\n// calculator: \"DetectionsToRectsCalculator\"\n\n// input_stream: \"DETECTIONS:detections\"\n\n// input_stream: \"IMAGE_SIZE:image_size\"\n\n// output_stream: \"NORM_RECT:rect\"\n\n// options: {\n\n// [mediapipe.DetectionsToRectCalculatorOptions.ext] {\n\n// rotation_vector_start_keypoint_index: 0\n\n// rotation_vector_end_keypoint_index: 2\n\n// rotation_vector_target_angle_degrees: 90\n\n// output_zero_rect_for_empty_detections: true\n\n// }\n\n// }\n\n// }\n\nclass DetectionsToRectsCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc);\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override;\n\n ::mediapipe::Status Process(CalculatorContext* cc) override;\n\n\n\n protected:\n\n virtual float ComputeRotation(const ::mediapipe::Detection& detection,\n\n const std::pair<int, int> image_size);\n\n virtual ::mediapipe::Status DetectionToRect(\n\n const ::mediapipe::Detection& detection, ::mediapipe::Rect* rect);\n\n virtual ::mediapipe::Status DetectionToNormalizedRect(\n\n const ::mediapipe::Detection& detection,\n\n ::mediapipe::NormalizedRect* rect);\n\n\n\n static inline float NormalizeRadians(float angle) {\n\n return angle - 2 * M_PI * std::floor((angle - (-M_PI)) / (2 * M_PI));\n\n }\n\n\n", "file_path": "mediapipe/calculators/util/detections_to_rects_calculator.h", "rank": 52, "score": 224504.64447650945 }, { "content": "class Derived : public Base1, public Base2 {\n\n public:\n\n ~Derived() override {}\n\n int evenmorepad_;\n\n};\n\n\n", "file_path": "mediapipe/framework/deps/statusor_test.cc", "rank": 53, "score": 223446.2110130841 }, { "content": "// A class which represents a timestamp in the calculator framework.\n\n// There are several special values which can only be created with the\n\n// static functions provided in this class.\n\nclass Timestamp {\n\n public:\n\n Timestamp();\n\n // Construction of Timestamp() is explicit (TimestampDiff is not explicit).\n\n explicit Timestamp(int64 timestamp);\n\n explicit Timestamp(TimestampBaseType timestamp);\n\n\n\n // Timestamps are in microseconds.\n\n static constexpr double kTimestampUnitsPerSecond = 1000000.0;\n\n\n\n // Use the default copy constructor, assignment operator, and destructor.\n\n\n\n // Get the underlying int64 value being used. This should generally be\n\n // avoided, but may be necessary for things like serialization.\n\n int64 Value() const { return timestamp_.value(); }\n\n // Return the value in units of seconds (the underlying value is in\n\n // microseconds).\n\n double Seconds() const { return Value() / kTimestampUnitsPerSecond; }\n\n // Return the value in units of microseconds. The underlying value is already\n\n // in microseconds, but this function should be preferred over Value() in case\n", "file_path": "mediapipe/framework/timestamp.h", "rank": 54, "score": 223141.33166554407 }, { "content": " class Timestamp timestamp);\n\n friend const packet_internal::HolderBase* packet_internal::GetHolder(\n\n const Packet& packet);\n\n std::shared_ptr<packet_internal::HolderBase> holder_;\n", "file_path": "mediapipe/framework/packet.h", "rank": 55, "score": 221515.85181108076 }, { "content": "class StaticAccessToCalculatorBaseTyped : public StaticAccessToCalculatorBase {\n\n public:\n\n static_assert(std::is_base_of<::mediapipe::CalculatorBase,\n\n CalculatorBaseSubclass>::value,\n\n \"Classes registered with REGISTER_CALCULATOR must be \"\n\n \"subclasses of ::mediapipe::CalculatorBase.\");\n\n static_assert(CalculatorHasGetContract<CalculatorBaseSubclass>(nullptr),\n\n \"GetContract() must be defined with the correct signature in \"\n\n \"every calculator.\");\n\n\n\n // Provides access to the static function GetContract within a specific\n\n // subclass of CalculatorBase.\n\n ::mediapipe::Status GetContract(CalculatorContract* cc) final {\n\n // CalculatorBaseSubclass must implement this function, since it is not\n\n // implemented in the parent class.\n\n return CalculatorBaseSubclass::GetContract(cc);\n\n }\n\n};\n\n\n\n} // namespace internal\n\n\n\n} // namespace mediapipe\n\n\n\n#endif // MEDIAPIPE_FRAMEWORK_CALCULATOR_BASE_H_\n", "file_path": "mediapipe/framework/calculator_base.h", "rank": 56, "score": 217551.47044316895 }, { "content": "class StaticAccessToStatusHandlerTyped : public StaticAccessToStatusHandler {\n\n public:\n\n static_assert(\n\n std::is_base_of<StatusHandler, StatusHandlerSubclass>::value,\n\n \"Classes registered with REGISTER_STATUS_HANDLER must be subclasses of \"\n\n \"::mediapipe::StatusHandler.\");\n\n static_assert(\n\n StatusHandlerHasFillExpectations<StatusHandlerSubclass>(nullptr),\n\n \"FillExpectations() must be defined with the correct signature in every \"\n\n \"StatusHandler.\");\n\n static_assert(\n\n StatusHandlerHasHandlePreRunStatus<StatusHandlerSubclass>(nullptr),\n\n \"HandlePreRunStatus() must be defined with the correct signature in \"\n\n \"every StatusHandler.\");\n\n static_assert(StatusHandlerHasHandleStatus<StatusHandlerSubclass>(nullptr),\n\n \"HandleStatus() must be defined with the correct signature in \"\n\n \"every StatusHandler.\");\n\n\n\n ::mediapipe::Status FillExpectations(\n\n const MediaPipeOptions& extendable_options,\n", "file_path": "mediapipe/framework/status_handler.h", "rank": 57, "score": 217551.47044316895 }, { "content": "class ClipVectorSizeCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n RET_CHECK(cc->Inputs().NumEntries() == 1);\n\n RET_CHECK(cc->Outputs().NumEntries() == 1);\n\n\n\n if (cc->Options<::mediapipe::ClipVectorSizeCalculatorOptions>()\n\n .max_vec_size() < 1) {\n\n return ::mediapipe::InternalError(\n\n \"max_vec_size should be greater than or equal to 1.\");\n\n }\n\n\n\n cc->Inputs().Index(0).Set<std::vector<T>>();\n\n cc->Outputs().Index(0).Set<std::vector<T>>();\n\n // Optional input side packet that determines `max_vec_size`.\n\n if (cc->InputSidePackets().NumEntries() > 0) {\n\n cc->InputSidePackets().Index(0).Set<int>();\n\n }\n\n\n\n return ::mediapipe::OkStatus();\n", "file_path": "mediapipe/calculators/core/clip_vector_size_calculator.h", "rank": 58, "score": 217410.92887203494 }, { "content": "// Counter implementation when we're not using Flume.\n\n// TODO: Consider using Dax atomic counters instead of this.\n\n// This class is thread safe.\n\nclass BasicCounter : public Counter {\n\n public:\n\n explicit BasicCounter(const std::string& name) : value_(0) {}\n\n\n\n void Increment() ABSL_LOCKS_EXCLUDED(mu_) override {\n\n absl::WriterMutexLock lock(&mu_);\n\n ++value_;\n\n }\n\n\n\n void IncrementBy(int amount) ABSL_LOCKS_EXCLUDED(mu_) override {\n\n absl::WriterMutexLock lock(&mu_);\n\n value_ += amount;\n\n }\n\n\n\n int64 Get() ABSL_LOCKS_EXCLUDED(mu_) override {\n\n absl::ReaderMutexLock lock(&mu_);\n\n return value_;\n\n }\n\n\n\n private:\n", "file_path": "mediapipe/framework/counter_factory.cc", "rank": 59, "score": 216050.40165714565 }, { "content": "// A calculator that receives some number of input streams carrying ints.\n\n// Outputs, for each input timestamp, a space separated std::string containing\n\n// the timestamp and all the inputs for that timestamp (Empty inputs\n\n// will be denoted with \"empty\"). Sets the header to be a space-separated\n\n// concatenation of the input stream headers.\n\nclass MergeCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n for (int i = 0; i < cc->Inputs().NumEntries(); ++i) {\n\n cc->Inputs().Index(i).Set<int>();\n\n }\n\n cc->Outputs().Index(0).Set<std::string>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) final {\n\n auto header = absl::make_unique<std::string>();\n\n for (auto& input : cc->Inputs()) {\n\n if (!input.Header().IsEmpty()) {\n\n if (!header->empty()) {\n\n absl::StrAppend(header.get(), \" \");\n\n }\n\n absl::StrAppend(header.get(), input.Header().Get<std::string>());\n\n }\n\n }\n", "file_path": "mediapipe/framework/test_calculators.cc", "rank": 60, "score": 211780.2160349445 }, { "content": "// A Calculator that gets a pointer to input side packet pair<int,\n\n// int>(N, K), and outputs Packets each containing an int value of K,\n\n// at timestamps 0, N, and all the timestamps between 0 and N that are\n\n// divisible by K. Sets the output stream header to \"RangeCalculatorK\". In\n\n// the second output stream output an int Packet at Timestamp::PostStream\n\n// with the total sum of all values sent over the first stream. In the\n\n// third output a double Packet with the arithmetic mean of the values\n\n// on the first stream (output at Timestamp::PreStream()).\n\nclass RangeCalculator : public CalculatorBase {\n\n public:\n\n RangeCalculator() : initialized_(false) {}\n\n\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Outputs().Index(0).Set<int>();\n\n cc->Outputs().Index(1).Set<int>();\n\n cc->Outputs().Index(2).Set<double>();\n\n cc->InputSidePackets().Index(0).Set<std::pair<uint32, uint32>>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) final {\n\n Initialize(cc);\n\n\n\n // Fail if requested, without setting any stream headers. This tests that\n\n // the downstream Calculators will not try to access the headers in case\n\n // this one failed.\n\n if (k_ == 0) {\n\n return ::mediapipe::Status(::mediapipe::StatusCode::kCancelled,\n", "file_path": "mediapipe/framework/test_calculators.cc", "rank": 61, "score": 211776.5227943227 }, { "content": "// -----------------------------------------------------------------\n\n// RealTimeClock\n\n//\n\n// This class is thread-safe.\n\nclass RealTimeClock : public Clock {\n\n public:\n\n virtual ~RealTimeClock() {\n\n LOG(FATAL) << \"RealTimeClock should never be destroyed\";\n\n }\n\n\n\n absl::Time TimeNow() override { return absl::Now(); }\n\n\n\n void Sleep(absl::Duration d) override { absl::SleepFor(d); }\n\n\n\n void SleepUntil(absl::Time wakeup_time) override {\n\n absl::Duration d = wakeup_time - TimeNow();\n\n if (d > absl::ZeroDuration()) {\n\n Sleep(d);\n\n }\n\n }\n\n};\n\n\n\n} // namespace\n\n\n\nClock::~Clock() {}\n\n\n\nClock* Clock::RealClock() {\n\n static RealTimeClock* rtclock = new RealTimeClock;\n\n return rtclock;\n\n}\n\n\n\n} // namespace mediapipe\n", "file_path": "mediapipe/framework/deps/clock.cc", "rank": 62, "score": 211769.03921701302 }, { "content": "// A calculator receiving strings from the input stream, and setting\n\n// the output PostStream packet to be the '/'-separated concatenation\n\n// of all the input values.\n\nclass SaverCalculator : public CalculatorBase {\n\n public:\n\n SaverCalculator() : result_(new std::string) {}\n\n\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Index(0).Set<std::string>();\n\n cc->Outputs().Index(0).Set<std::string>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) final {\n\n cc->Outputs().Index(0).SetNextTimestampBound(Timestamp::PostStream());\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n if (!result_->empty()) {\n\n result_->append(\"/\");\n\n }\n\n result_->append(cc->Inputs().Index(0).Get<std::string>());\n", "file_path": "mediapipe/framework/test_calculators.cc", "rank": 63, "score": 211768.48031073873 }, { "content": "class PassThroughSubgraph : public Subgraph {\n\n public:\n\n ::mediapipe::StatusOr<CalculatorGraphConfig> GetConfig(\n\n const SubgraphOptions& options) override {\n\n CalculatorGraphConfig config =\n\n ::mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R\"(\n\n input_stream: 'INPUT:input'\n\n output_stream: 'OUTPUT:output'\n\n node {\n\n calculator: 'PassThroughCalculator'\n\n input_stream: 'input'\n\n output_stream: 'output'\n\n }\n\n )\");\n\n return config;\n\n }\n\n};\n\nREGISTER_MEDIAPIPE_GRAPH(PassThroughSubgraph);\n\n\n\nTEST(CalculatorGraph, ObserveOutputStreamSubgraph) {\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 64, "score": 211762.42902277404 }, { "content": "// A Calculator that runs a testing callback function in Process,\n\n// Open, or Close, which is specified as an input side packet.\n\nclass LambdaCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n for (CollectionItemId id = cc->Inputs().BeginId();\n\n id < cc->Inputs().EndId(); ++id) {\n\n cc->Inputs().Get(id).SetAny();\n\n }\n\n for (CollectionItemId id = cc->Outputs().BeginId();\n\n id < cc->Outputs().EndId(); ++id) {\n\n cc->Outputs().Get(id).SetAny();\n\n }\n\n if (cc->InputSidePackets().HasTag(\"\") > 0) {\n\n cc->InputSidePackets().Tag(\"\").Set<ProcessFunction>();\n\n }\n\n for (std::string tag : {\"OPEN\", \"PROCESS\", \"CLOSE\"}) {\n\n if (cc->InputSidePackets().HasTag(tag)) {\n\n cc->InputSidePackets().Tag(tag).Set<CalculatorContextFunction>();\n\n }\n\n }\n\n return ::mediapipe::OkStatus();\n", "file_path": "mediapipe/framework/test_calculators.cc", "rank": 65, "score": 211762.42902277404 }, { "content": " class Timestamp timestamp_;\n\n};\n\n\n\n// Factory functions for creating Packets. Non-members as opposed to static\n\n// methods, to prevent users from mistakenly calling them on Packet instances.\n\n\n\n// Returns a Packet that adopts the object; the Packet assumes the ownership.\n\n// The timestamp of the returned Packet is Timestamp::Unset(). To set the\n\n// timestamp, the caller should do Adopt(...).At(...).\n\n//\n\n// Generally prefer MakePacket<T>().\n\ntemplate <typename T>\n\nPacket Adopt(const T* ptr);\n\n\n\n// Returns a Packet that does not own its data. The data pointed to by *ptr\n\n// remains owned by the caller, who must ensure that it outlives not only the\n\n// returned Packet but also all of its copies. The timestamp of the returned\n\n// Packet is Timestamp::Unset(). To set the timestamp, the caller should do\n\n// PointToForeign(...).At(...).\n\ntemplate <typename T>\n", "file_path": "mediapipe/framework/packet.h", "rank": 66, "score": 207818.31315940106 }, { "content": "// Applies a threshold on a stream of numeric values and outputs a flag and/or\n\n// accept/reject stream. The threshold can be specified by one of the following:\n\n// 1) Input stream.\n\n// 2) Input side packet.\n\n// 3) Calculator option.\n\n//\n\n// Input:\n\n// FLOAT: A float, which will be cast to double to be compared with a\n\n// threshold of double type.\n\n// THRESHOLD(optional): A double specifying the threshold at current timestamp.\n\n//\n\n// Output:\n\n// FLAG(optional): A boolean indicating if the input value is larger than the\n\n// threshold.\n\n// ACCEPT(optional): A packet will be sent if the value is larger than the\n\n// threshold.\n\n// REJECT(optional): A packet will be sent if the value is no larger than the\n\n// threshold.\n\n//\n\n// Usage example:\n\n// node {\n\n// calculator: \"ThresholdingCalculator\"\n\n// input_stream: \"FLOAT:score\"\n\n// output_stream: \"ACCEPT:accept\"\n\n// output_stream: \"REJECT:reject\"\n\n// options: {\n\n// [mediapipe.ThresholdingCalculatorOptions.ext] {\n\n// threshold: 0.1\n\n// }\n\n// }\n\n// }\n\nclass ThresholdingCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc);\n\n ::mediapipe::Status Open(CalculatorContext* cc) override;\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) override;\n\n\n\n private:\n\n double threshold_{};\n\n};\n\nREGISTER_CALCULATOR(ThresholdingCalculator);\n\n\n\n::mediapipe::Status ThresholdingCalculator::GetContract(\n\n CalculatorContract* cc) {\n\n RET_CHECK(cc->Inputs().HasTag(\"FLOAT\"));\n\n cc->Inputs().Tag(\"FLOAT\").Set<float>();\n\n\n\n if (cc->Outputs().HasTag(\"FLAG\")) {\n\n cc->Outputs().Tag(\"FLAG\").Set<bool>();\n\n }\n", "file_path": "mediapipe/calculators/util/thresholding_calculator.cc", "rank": 67, "score": 207719.75392321314 }, { "content": "// MediaPipe Calculator for computing the \"spectrogram\" (short-time Fourier\n\n// transform squared-magnitude, by default) of a multichannel input\n\n// time series, including optionally overlapping frames. Options are\n\n// specified in SpectrogramCalculatorOptions proto (where names are chosen\n\n// to mirror TimeSeriesFramerCalculator):\n\n//\n\n// Result is a MatrixData record (for single channel input and when the\n\n// allow_multichannel_input flag is false), or a vector of MatrixData records,\n\n// one for each channel (when the allow_multichannel_input flag is set). The\n\n// rows of each spectrogram matrix correspond to the n_fft/2+1 unique complex\n\n// values, or squared/linear/dB magnitudes, depending on the output_type option.\n\n// Each input packet will result in zero or one output packets, each containing\n\n// one Matrix for each channel of the input, where each Matrix has one or more\n\n// columns of spectral values, one for each complete frame of input samples. If\n\n// the input packet contains too few samples to trigger a new output frame, no\n\n// output packet is generated (since zero-length packets are not legal since\n\n// they would result in timestamps that were equal, not strictly increasing).\n\n//\n\n// Output packet Timestamps are set to the beginning of each frame. This is to\n\n// allow calculators downstream from SpectrogramCalculator to have aligned\n\n// Timestamps regardless of a packet's signal length.\n\n//\n\n// Both frame_duration_seconds and frame_overlap_seconds will be\n\n// rounded to the nearest integer number of samples. Conseqently, all output\n\n// frames will be based on the same number of input samples, and each\n\n// analysis frame will advance from its predecessor by the same time step.\n\nclass SpectrogramCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Index(0).Set<Matrix>(\n\n // Input stream with TimeSeriesHeader.\n\n );\n\n\n\n SpectrogramCalculatorOptions spectrogram_options =\n\n cc->Options<SpectrogramCalculatorOptions>();\n\n if (!spectrogram_options.allow_multichannel_input()) {\n\n if (spectrogram_options.output_type() ==\n\n SpectrogramCalculatorOptions::COMPLEX) {\n\n cc->Outputs().Index(0).Set<Eigen::MatrixXcf>(\n\n // Complex spectrogram frames with TimeSeriesHeader.\n\n );\n\n } else {\n\n cc->Outputs().Index(0).Set<Matrix>(\n\n // Spectrogram frames with TimeSeriesHeader.\n\n );\n\n }\n", "file_path": "mediapipe/calculators/audio/spectrogram_calculator.cc", "rank": 68, "score": 207716.87751044327 }, { "content": "// This calculator takes a set of input streams and combines them into a single\n\n// output stream. The packets from different streams do not need to contain the\n\n// same type. If there are packets arriving at the same time from two or more\n\n// input streams, the packet corresponding to the input stream with the smallest\n\n// index is passed to the output and the rest are ignored.\n\n//\n\n// Example use-case:\n\n// Suppose we have two (or more) different algorithms for detecting shot\n\n// boundaries and we need to merge their packets into a single stream. The\n\n// algorithms may emit shot boundaries at the same time and their output types\n\n// may not be compatible. Subsequent calculators that process the merged stream\n\n// may be interested only in the timestamps of the shot boundary packets and so\n\n// it may not even need to inspect the values stored inside the packets.\n\n//\n\n// Example config:\n\n// node {\n\n// calculator: \"MergeCalculator\"\n\n// input_stream: \"shot_info1\"\n\n// input_stream: \"shot_info2\"\n\n// input_stream: \"shot_info3\"\n\n// output_stream: \"merged_shot_infos\"\n\n// }\n\n//\n\nclass MergeCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n RET_CHECK_GT(cc->Inputs().NumEntries(), 0)\n\n << \"Needs at least one input stream\";\n\n RET_CHECK_EQ(cc->Outputs().NumEntries(), 1);\n\n if (cc->Inputs().NumEntries() == 1) {\n\n LOG(WARNING)\n\n << \"MergeCalculator expects multiple input streams to merge but is \"\n\n \"receiving only one. Make sure the calculator is configured \"\n\n \"correctly or consider removing this calculator to reduce \"\n\n \"unnecessary overhead.\";\n\n }\n\n\n\n for (int i = 0; i < cc->Inputs().NumEntries(); ++i) {\n\n cc->Inputs().Index(i).SetAny();\n\n }\n\n cc->Outputs().Index(0).SetAny();\n\n\n\n return ::mediapipe::OkStatus();\n", "file_path": "mediapipe/calculators/core/merge_calculator.cc", "rank": 69, "score": 207713.5033746317 }, { "content": "// A mediapipe::Executor that signals the start and finish of each task.\n\nclass CountingExecutor : public Executor {\n\n public:\n\n CountingExecutor(int num_threads, std::function<void()> start_callback,\n\n std::function<void()> finish_callback)\n\n : thread_pool_(num_threads),\n\n start_callback_(std::move(start_callback)),\n\n finish_callback_(std::move(finish_callback)) {\n\n thread_pool_.StartWorkers();\n\n }\n\n void Schedule(std::function<void()> task) override {\n\n start_callback_();\n\n thread_pool_.Schedule([this, task] {\n\n task();\n\n finish_callback_();\n\n });\n\n }\n\n\n\n private:\n\n ThreadPool thread_pool_;\n\n std::function<void()> start_callback_;\n\n std::function<void()> finish_callback_;\n\n};\n\n\n", "file_path": "mediapipe/framework/calculator_graph_bounds_test.cc", "rank": 70, "score": 207712.50239291304 }, { "content": "// A simple executor that runs tasks directly on the current thread.\n\n// NOTE: If CurrentThreadExecutor is used, some CalculatorGraph methods may\n\n// behave differently. For example, CalculatorGraph::StartRun will run the\n\n// graph rather than returning immediately after starting the graph.\n\n// Similarly, CalculatorGraph::AddPacketToInputStream will run the graph\n\n// (until it's idle) rather than returning immediately after adding the packet\n\n// to the graph input stream.\n\nclass CurrentThreadExecutor : public Executor {\n\n public:\n\n ~CurrentThreadExecutor() override {\n\n CHECK(!executing_);\n\n CHECK(tasks_.empty());\n\n }\n\n\n\n void Schedule(std::function<void()> task) override {\n\n if (executing_) {\n\n // Queue the task for later execution (after the currently-running task\n\n // returns) rather than running the task immediately. This is especially\n\n // important for a source node (which can be rescheduled immediately after\n\n // running) to avoid an indefinitely-deep call stack.\n\n tasks_.emplace_back(std::move(task));\n\n } else {\n\n CHECK(tasks_.empty());\n\n executing_ = true;\n\n task();\n\n while (!tasks_.empty()) {\n\n task = tasks_.front();\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 71, "score": 207712.47788150312 }, { "content": "// Source Calculator that produces matrices on the output stream with\n\n// each coefficient from a normal gaussian. A std::string seed must be given\n\n// as an input side packet.\n\nclass RandomMatrixCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Outputs().Index(0).Set<Matrix>();\n\n cc->InputSidePackets().Index(0).Set<std::string>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override {\n\n auto& options = cc->Options<RandomMatrixCalculatorOptions>();\n\n CHECK_LT(0, options.timestamp_step());\n\n CHECK_LT(0, options.rows());\n\n CHECK_LT(0, options.cols());\n\n CHECK_LT(options.start_timestamp(), options.limit_timestamp());\n\n\n\n current_timestamp_ = Timestamp(options.start_timestamp());\n\n cc->Outputs().Index(0).SetNextTimestampBound(current_timestamp_);\n\n const std::string& seed_str =\n\n cc->InputSidePackets().Index(0).Get<std::string>();\n\n std::seed_seq seq(seed_str.begin(), seed_str.end());\n", "file_path": "mediapipe/framework/test_calculators.cc", "rank": 72, "score": 207712.1694382636 }, { "content": "// This calculator posts to a semaphore when it starts its Process method,\n\n// and waits on a different semaphore before returning from Process.\n\n// This allows a test to run code when the calculator is running Process\n\n// without having to depend on any specific timing.\n\nclass SemaphoreCalculator : public CalculatorBase {\n\n public:\n\n using Semaphore = AtomicSemaphore;\n\n\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Index(0).SetAny();\n\n cc->Outputs().Index(0).SetSameAs(&cc->Inputs().Index(0));\n\n cc->InputSidePackets().Tag(\"POST_SEM\").Set<Semaphore*>();\n\n cc->InputSidePackets().Tag(\"WAIT_SEM\").Set<Semaphore*>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override {\n\n cc->SetOffset(TimestampDiff(0));\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) override {\n\n cc->InputSidePackets().Tag(\"POST_SEM\").Get<Semaphore*>()->Release(1);\n\n cc->InputSidePackets().Tag(\"WAIT_SEM\").Get<Semaphore*>()->Acquire(1);\n\n cc->Outputs().Index(0).AddPacket(cc->Inputs().Index(0).Value());\n\n return ::mediapipe::OkStatus();\n\n }\n\n};\n\nREGISTER_CALCULATOR(SemaphoreCalculator);\n\n\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 73, "score": 207712.02423823607 }, { "content": "// Calculate the mean and covariance of the input samples. Each sample\n\n// must be a column matrix. The computation is done in an online fashion,\n\n// so the number of samples can be arbitrarily large without fear of\n\n// using too much memory (however, no algorithm is used to mitigate the\n\n// effect of round off error).\n\nclass MeanAndCovarianceCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Index(0).Set<Matrix>();\n\n cc->Outputs().Index(0).Set<std::pair<Matrix, Matrix>>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override {\n\n cc->Outputs().Index(0).SetNextTimestampBound(Timestamp::PostStream());\n\n\n\n rows_ = -1;\n\n num_samples_ = 0;\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) override {\n\n const Eigen::MatrixXd sample =\n\n cc->Inputs().Index(0).Get<Matrix>().cast<double>();\n\n CHECK_EQ(1, sample.cols());\n", "file_path": "mediapipe/framework/test_calculators.cc", "rank": 74, "score": 207711.7258071981 }, { "content": "// A calculator to recolor a masked area of an image to a specified color.\n\n//\n\n// A mask image is used to specify where to overlay a user defined color.\n\n// The luminance of the input image is used to adjust the blending weight,\n\n// to help preserve image textures.\n\n//\n\n// TODO implement cpu support.\n\n//\n\n// Inputs:\n\n// One of the following IMAGE tags:\n\n// IMAGE: An ImageFrame input image, RGB or RGBA.\n\n// IMAGE_GPU: A GpuBuffer input image, RGBA.\n\n// One of the following MASK tags:\n\n// MASK: An ImageFrame input mask, Gray, RGB or RGBA.\n\n// MASK_GPU: A GpuBuffer input mask, RGBA.\n\n// Output:\n\n// One of the following IMAGE tags:\n\n// IMAGE: An ImageFrame output image.\n\n// IMAGE_GPU: A GpuBuffer output image.\n\n//\n\n// Options:\n\n// color_rgb (required): A map of RGB values [0-255].\n\n// mask_channel (optional): Which channel of mask image is used [RED or ALPHA]\n\n//\n\n// Usage example:\n\n// node {\n\n// calculator: \"RecolorCalculator\"\n\n// input_stream: \"IMAGE_GPU:input_image\"\n\n// input_stream: \"MASK_GPU:input_mask\"\n\n// output_stream: \"IMAGE_GPU:output_image\"\n\n// node_options: {\n\n// [mediapipe.RecolorCalculatorOptions] {\n\n// color { r: 0 g: 0 b: 255 }\n\n// mask_channel: RED\n\n// }\n\n// }\n\n// }\n\n//\n\nclass RecolorCalculator : public CalculatorBase {\n\n public:\n\n RecolorCalculator() = default;\n\n ~RecolorCalculator() override = default;\n\n\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc);\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override;\n\n ::mediapipe::Status Process(CalculatorContext* cc) override;\n\n ::mediapipe::Status Close(CalculatorContext* cc) override;\n\n\n\n private:\n\n ::mediapipe::Status LoadOptions(CalculatorContext* cc);\n\n ::mediapipe::Status InitGpu(CalculatorContext* cc);\n\n ::mediapipe::Status RenderGpu(CalculatorContext* cc);\n\n ::mediapipe::Status RenderCpu(CalculatorContext* cc);\n\n void GlRender();\n\n\n\n bool initialized_ = false;\n\n std::vector<float> color_;\n", "file_path": "mediapipe/calculators/image/recolor_calculator.cc", "rank": 75, "score": 207709.21069836605 }, { "content": "class CountCalculator : public CalculatorBase {\n\n public:\n\n CountCalculator() { ++num_constructed_; }\n\n ~CountCalculator() override { ++num_destroyed_; }\n\n\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n ++num_fill_expectations_;\n\n cc->Inputs().Get(cc->Inputs().BeginId()).Set<int>();\n\n cc->Outputs().Get(cc->Outputs().BeginId()).Set<int>();\n\n cc->InputSidePackets().Get(cc->InputSidePackets().BeginId()).Set<int>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override {\n\n ++num_open_;\n\n // Simulate doing nontrivial work to ensure that the time spent in the\n\n // method will register on streamz each time it is called.\n\n usleep(100);\n\n return ::mediapipe::OkStatus();\n\n }\n", "file_path": "mediapipe/framework/calculator_node_test.cc", "rank": 76, "score": 207706.2626445511 }, { "content": "class DeadCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n return ::mediapipe::OkStatus();\n\n }\n\n ::mediapipe::Status Open(CalculatorContext* cc) override {\n\n return ::mediapipe::OkStatus();\n\n }\n\n ::mediapipe::Status Process(CalculatorContext* cc) override {\n\n return ::mediapipe::OkStatus();\n\n }\n\n};\n\n\n\n} // namespace whitelisted_ns\n\n} // namespace test_ns\n\n\n", "file_path": "mediapipe/framework/calculator_base_test.cc", "rank": 77, "score": 207706.2626445511 }, { "content": "// A subgraph used in the ExecutorFieldOfNodeInSubgraphPreserved test. The\n\n// subgraph contains a NodeWithExecutorSubgraph.\n\nclass EnclosingSubgraph : public Subgraph {\n\n public:\n\n ::mediapipe::StatusOr<CalculatorGraphConfig> GetConfig(\n\n const SubgraphOptions& options) override {\n\n CalculatorGraphConfig config =\n\n ::mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R\"(\n\n input_stream: \"IN:in\"\n\n output_stream: \"OUT:out\"\n\n node {\n\n calculator: \"NodeWithExecutorSubgraph\"\n\n input_stream: \"INPUT:in\"\n\n output_stream: \"OUTPUT:out\"\n\n }\n\n )\");\n\n return config;\n\n }\n\n};\n\nREGISTER_MEDIAPIPE_GRAPH(EnclosingSubgraph);\n\n\n\nTEST(SubgraphExpansionTest, TransformStreamNames) {\n", "file_path": "mediapipe/framework/tool/subgraph_expansion_test.cc", "rank": 78, "score": 207706.2626445511 }, { "content": "// Controls whether or not the input packets are passed further along the graph.\n\n// Takes multiple data input streams and either an ALLOW or a DISALLOW control\n\n// input stream. It outputs an output stream for each input stream that is not\n\n// ALLOW or DISALLOW as well as an optional STATE_CHANGE stream which downstream\n\n// calculators can use to respond to state-change events.\n\n//\n\n// If the current ALLOW packet is set to true, the input packets are passed to\n\n// their corresponding output stream unchanged. If the ALLOW packet is set to\n\n// false, the current input packet is NOT passed to the output stream. If using\n\n// DISALLOW, the behavior is opposite of ALLOW.\n\n//\n\n// By default, an empty packet in the ALLOW or DISALLOW input stream indicates\n\n// disallowing the corresponding packets in other input streams. The behavior\n\n// can be inverted with a calculator option.\n\n//\n\n// Intended to be used with the default input stream handler, which synchronizes\n\n// all data input streams with the ALLOW/DISALLOW control input stream.\n\n//\n\n// Example config:\n\n// node {\n\n// calculator: \"GateCalculator\"\n\n// input_stream: \"input_stream0\"\n\n// input_stream: \"input_stream1\"\n\n// input_stream: \"input_streamN\"\n\n// input_stream: \"ALLOW:allow\" or \"DISALLOW:disallow\"\n\n// output_stream: \"STATE_CHANGE:state_change\"\n\n// output_stream: \"output_stream0\"\n\n// output_stream: \"output_stream1\"\n\n// output_stream: \"output_streamN\"\n\n// }\n\nclass GateCalculator : public CalculatorBase {\n\n public:\n\n GateCalculator() {}\n\n\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n // Assume that input streams do not have a tag and that gating signal is\n\n // tagged either ALLOW or DISALLOW.\n\n RET_CHECK(cc->Inputs().HasTag(\"ALLOW\") ^ cc->Inputs().HasTag(\"DISALLOW\"));\n\n const int num_data_streams = cc->Inputs().NumEntries(\"\");\n\n RET_CHECK_GE(num_data_streams, 1);\n\n RET_CHECK_EQ(cc->Outputs().NumEntries(\"\"), num_data_streams)\n\n << \"Number of data output streams must match with data input streams.\";\n\n\n\n for (int i = 0; i < num_data_streams; ++i) {\n\n cc->Inputs().Get(\"\", i).SetAny();\n\n cc->Outputs().Get(\"\", i).SetSameAs(&cc->Inputs().Get(\"\", i));\n\n }\n\n if (cc->Inputs().HasTag(\"ALLOW\")) {\n\n cc->Inputs().Tag(\"ALLOW\").Set<bool>();\n\n } else {\n", "file_path": "mediapipe/calculators/core/gate_calculator.cc", "rank": 79, "score": 207706.26264455114 }, { "content": "class DoNothingGenerator : public PacketGenerator {\n\n public:\n\n static ::mediapipe::Status FillExpectations(\n\n const PacketGeneratorOptions& extendable_options,\n\n PacketTypeSet* input_side_packets, PacketTypeSet* output_side_packets) {\n\n for (CollectionItemId id = input_side_packets->BeginId();\n\n id < input_side_packets->EndId(); ++id) {\n\n input_side_packets->Get(id).SetAny();\n\n }\n\n for (CollectionItemId id = output_side_packets->BeginId();\n\n id < output_side_packets->EndId(); ++id) {\n\n output_side_packets->Get(id).Set<bool>();\n\n }\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n static ::mediapipe::Status Generate(\n\n const PacketGeneratorOptions& extendable_options,\n\n const PacketSet& input_side_packets, PacketSet* output_side_packets) {\n\n for (CollectionItemId id = output_side_packets->BeginId();\n", "file_path": "mediapipe/framework/packet_generator_test.cc", "rank": 80, "score": 207706.2626445511 }, { "content": "// A calculator that passes through one out of every 101 input packets and\n\n// discards the rest. The decimation ratio (101) is carefully chosen to be\n\n// greater than max_queue_size (100) so that an input stream parallel to the\n\n// input stream connected to this calculator can become full.\n\nclass DecimatorCalculator : public CalculatorBase {\n\n public:\n\n static const int kDecimationRatio = 101;\n\n\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Index(0).SetAny();\n\n cc->Outputs().Index(0).SetSameAs(&cc->Inputs().Index(0));\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n if (index_ % kDecimationRatio == 0) {\n\n cc->Outputs().Index(0).AddPacket(cc->Inputs().Index(0).Value());\n\n }\n\n ++index_;\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n private:\n\n int index_ = 0;\n\n};\n\nREGISTER_CALCULATOR(DecimatorCalculator);\n\n\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 81, "score": 207706.2626445511 }, { "content": "// Compute the standard deviation of values on the stream \"DATA\" given\n\n// the mean on stream \"MEAN\".\n\nclass StdDevCalculator : public CalculatorBase {\n\n public:\n\n StdDevCalculator() {}\n\n\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Tag(\"DATA\").Set<int>();\n\n cc->Inputs().Tag(\"MEAN\").Set<double>();\n\n cc->Outputs().Index(0).Set<int>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) final {\n\n cc->Outputs().Index(0).SetNextTimestampBound(Timestamp::PostStream());\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n if (cc->InputTimestamp() == Timestamp::PreStream()) {\n\n RET_CHECK(cc->Inputs().Tag(\"DATA\").Value().IsEmpty());\n\n RET_CHECK(!cc->Inputs().Tag(\"MEAN\").Value().IsEmpty());\n", "file_path": "mediapipe/framework/test_calculators.cc", "rank": 82, "score": 207706.2626445511 }, { "content": "// A Calculator that selects an input stream from \"INPUT:0\", \"INPUT:1\", ...,\n\n// using the integer value (0, 1, ...) in the packet on the \"SELECT\" input\n\n// stream, and passes the packet on the selected input stream to the \"OUTPUT\"\n\n// output stream.\n\n//\n\n// Note that this calculator defaults to use MuxInputStreamHandler, which is\n\n// required for this calculator.\n\nclass MuxCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n cc->Inputs().Tag(\"SELECT\").Set<int>();\n\n CollectionItemId data_input_id = cc->Inputs().BeginId(\"INPUT\");\n\n PacketType* data_input0 = &cc->Inputs().Get(data_input_id);\n\n data_input0->SetAny();\n\n ++data_input_id;\n\n for (; data_input_id < cc->Inputs().EndId(\"INPUT\"); ++data_input_id) {\n\n cc->Inputs().Get(data_input_id).SetSameAs(data_input0);\n\n }\n\n RET_CHECK_EQ(cc->Outputs().NumEntries(), 1);\n\n cc->Outputs().Tag(\"OUTPUT\").SetSameAs(data_input0);\n\n\n\n // Assign this calculator's default InputStreamHandler.\n\n cc->SetInputStreamHandler(\"MuxInputStreamHandler\");\n\n MediaPipeOptions options;\n\n cc->SetInputStreamHandlerOptions(options);\n\n\n\n return ::mediapipe::OkStatus();\n", "file_path": "mediapipe/calculators/core/mux_calculator.cc", "rank": 83, "score": 207706.26264455108 }, { "content": "// A PacketGenerator that simply passes its input Packets through\n\n// unchanged. The inputs may be specified by tag or index. The outputs\n\n// must match the inputs exactly. Any options may be specified and will\n\n// also be ignored.\n\nclass PassThroughGenerator : public PacketGenerator {\n\n public:\n\n static ::mediapipe::Status FillExpectations(\n\n const PacketGeneratorOptions& extendable_options, PacketTypeSet* inputs,\n\n PacketTypeSet* outputs) {\n\n if (!inputs->TagMap()->SameAs(*outputs->TagMap())) {\n\n return ::mediapipe::InvalidArgumentError(\n\n \"Input and outputs to PassThroughGenerator must use the same tags \"\n\n \"and indexes.\");\n\n }\n\n for (CollectionItemId id = inputs->BeginId(); id < inputs->EndId(); ++id) {\n\n inputs->Get(id).SetAny();\n\n outputs->Get(id).SetSameAs(&inputs->Get(id));\n\n }\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n static ::mediapipe::Status Generate(\n\n const PacketGeneratorOptions& extendable_options,\n\n const PacketSet& input_side_packets, PacketSet* output_side_packets) {\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 84, "score": 207706.2626445511 }, { "content": "class EndCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n return ::mediapipe::OkStatus();\n\n }\n\n ::mediapipe::Status Open(CalculatorContext* cc) override {\n\n return ::mediapipe::OkStatus();\n\n }\n\n ::mediapipe::Status Process(CalculatorContext* cc) override {\n\n return ::mediapipe::OkStatus();\n\n }\n\n};\n\nREGISTER_CALCULATOR(::mediapipe::EndCalculator);\n\n\n\nnamespace {\n\n\n\nTEST(CalculatorTest, SourceProcessOrder) {\n\n internal::Collection<OutputStreamManager> output_stream_managers(\n\n tool::CreateTagMap(2).ValueOrDie());\n\n\n", "file_path": "mediapipe/framework/calculator_base_test.cc", "rank": 85, "score": 207706.2626445511 }, { "content": "// A Calculator that doesn't check anything about input & output and doesn't do\n\n// anything.\n\n// It provides flexility to define the input, output, side packets as\n\n// you wish with any type, with/out tag.\n\n// This is useful if you need to test something about the graph definition and\n\n// stream connections.\n\nclass DummyTestCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n for (CollectionItemId id = cc->Inputs().BeginId();\n\n id < cc->Inputs().EndId(); ++id) {\n\n cc->Inputs().Get(id).SetAny();\n\n }\n\n for (CollectionItemId id = cc->Outputs().BeginId();\n\n id < cc->Outputs().EndId(); ++id) {\n\n cc->Outputs().Get(id).SetAny();\n\n }\n\n for (CollectionItemId id = cc->InputSidePackets().BeginId();\n\n id < cc->InputSidePackets().EndId(); ++id) {\n\n cc->InputSidePackets().Get(id).SetAny();\n\n }\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n return ::mediapipe::OkStatus();\n\n }\n\n};\n\nREGISTER_CALCULATOR(DummyTestCalculator);\n\n\n\n} // namespace mediapipe\n", "file_path": "mediapipe/framework/test_calculators.cc", "rank": 86, "score": 207706.26264455114 }, { "content": "// A Calculator that simply passes its input Packets and header through,\n\n// unchanged. The inputs may be specified by tag or index. The outputs\n\n// must match the inputs exactly. Any number of input side packets may\n\n// also be specified. If output side packets are specified, they must\n\n// match the input side packets exactly and the Calculator passes its\n\n// input side packets through, unchanged. Otherwise, the input side\n\n// packets will be ignored (allowing PassThroughCalculator to be used to\n\n// test internal behavior). Any options may be specified and will be\n\n// ignored.\n\nclass PassThroughCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n if (!cc->Inputs().TagMap()->SameAs(*cc->Outputs().TagMap())) {\n\n return ::mediapipe::InvalidArgumentError(\n\n \"Input and output streams to PassThroughCalculator must use \"\n\n \"matching tags and indexes.\");\n\n }\n\n for (CollectionItemId id = cc->Inputs().BeginId();\n\n id < cc->Inputs().EndId(); ++id) {\n\n cc->Inputs().Get(id).SetAny();\n\n cc->Outputs().Get(id).SetSameAs(&cc->Inputs().Get(id));\n\n }\n\n for (CollectionItemId id = cc->InputSidePackets().BeginId();\n\n id < cc->InputSidePackets().EndId(); ++id) {\n\n cc->InputSidePackets().Get(id).SetAny();\n\n }\n\n if (cc->OutputSidePackets().NumEntries() != 0) {\n\n if (!cc->InputSidePackets().TagMap()->SameAs(\n\n *cc->OutputSidePackets().TagMap())) {\n", "file_path": "mediapipe/calculators/core/pass_through_calculator.cc", "rank": 87, "score": 207706.2626445511 }, { "content": "class TestSubgraph : public Subgraph {\n\n public:\n\n ::mediapipe::StatusOr<CalculatorGraphConfig> GetConfig(\n\n const SubgraphOptions& /*options*/) override {\n\n CalculatorGraphConfig config =\n\n ::mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(R\"(\n\n input_stream: \"DATA:input_1\"\n\n node {\n\n name: \"regular_node\"\n\n calculator: \"SomeRegularCalculator\"\n\n input_stream: \"input_1\"\n\n output_stream: \"stream_a\"\n\n input_side_packet: \"side\"\n\n }\n\n node {\n\n name: \"simple_sink\"\n\n calculator: \"SomeSinkCalculator\"\n\n input_stream: \"stream_a\"\n\n }\n\n packet_generator {\n\n packet_generator: \"SomePacketGenerator\"\n\n output_side_packet: \"side\"\n\n }\n\n )\");\n\n return config;\n\n }\n\n};\n\nREGISTER_MEDIAPIPE_GRAPH(TestSubgraph);\n\n\n", "file_path": "mediapipe/framework/tool/subgraph_expansion_test.cc", "rank": 88, "score": 207706.26264455114 }, { "content": "// A subclass of AssociationCalculator<T> for Detection. Example:\n\n// node {\n\n// calculator: \"AssociationDetectionCalculator\"\n\n// input_stream: \"PREV:input_vec_0\"\n\n// input_stream: \"input_vec_1\"\n\n// input_stream: \"input_vec_2\"\n\n// output_stream: \"output_vec\"\n\n// options {\n\n// [mediapipe.AssociationCalculatorOptions.ext] {\n\n// min_similarity_threshold: 0.1\n\n// }\n\n// }\n\nclass AssociationDetectionCalculator\n\n : public AssociationCalculator<::mediapipe::Detection> {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n return AssociationCalculator<::mediapipe::Detection>::GetContract(cc);\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override {\n\n return AssociationCalculator<::mediapipe::Detection>::Open(cc);\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) override {\n\n return AssociationCalculator<::mediapipe::Detection>::Process(cc);\n\n }\n\n\n\n ::mediapipe::Status Close(CalculatorContext* cc) override {\n\n return AssociationCalculator<::mediapipe::Detection>::Close(cc);\n\n }\n\n\n\n protected:\n", "file_path": "mediapipe/calculators/util/association_detection_calculator.cc", "rank": 89, "score": 207339.8284068781 }, { "content": "class SubgraphTest : public ::testing::Test {\n\n protected:\n\n void TestGraphEnclosing(const std::string& subgraph_type_name) {\n\n EXPECT_TRUE(SubgraphRegistry::IsRegistered(subgraph_type_name));\n\n\n\n CalculatorGraphConfig config;\n\n config.add_input_stream(\"in\");\n\n CalculatorGraphConfig::Node* node = config.add_node();\n\n node->set_calculator(subgraph_type_name);\n\n node->add_input_stream(\"INTS:in\");\n\n node->add_output_stream(\"DUBS:dubs_tmp\");\n\n node->add_output_stream(\"QUADS:quads\");\n\n node = config.add_node();\n\n node->set_calculator(\"PassThroughCalculator\");\n\n node->add_input_stream(\"dubs_tmp\");\n\n node->add_output_stream(\"dubs\");\n\n\n\n std::vector<Packet> dubs;\n\n tool::AddVectorSink(\"dubs\", &config, &dubs);\n\n\n", "file_path": "mediapipe/framework/subgraph_test.cc", "rank": 90, "score": 205153.30026244425 }, { "content": "// NOTE: If we need to update this class, that means there is a\n\n// backward-incompatible change in the MediaPipe API and MediaPipe clients also\n\n// need to update their mediapipe::Executor subclasses.\n\nclass MyExecutor : public ::mediapipe::Executor {\n\n public:\n\n MyExecutor();\n\n ~MyExecutor() override;\n\n\n\n // To verify a mediapipe::Executor subclass outside the mediapipe namespace\n\n // can override any method, override every method in the mediapipe::Executor\n\n // interface.\n\n void AddTask(::mediapipe::TaskQueue* task_queue) override;\n\n void Schedule(std::function<void()> task) override;\n\n\n\n private:\n\n std::unique_ptr<::mediapipe::ThreadPool> thread_pool_;\n\n};\n\n\n\nMyExecutor::MyExecutor() {\n\n thread_pool_ = absl::make_unique<::mediapipe::ThreadPool>(\"my_executor\", 1);\n\n thread_pool_->StartWorkers();\n\n}\n\n\n\nMyExecutor::~MyExecutor() { thread_pool_.reset(nullptr); }\n\n\n\nvoid MyExecutor::AddTask(::mediapipe::TaskQueue* task_queue) {\n\n thread_pool_->Schedule([task_queue] { task_queue->RunNextTask(); });\n\n}\n\n\n\nvoid MyExecutor::Schedule(std::function<void()> task) {\n\n thread_pool_->Schedule(std::move(task));\n\n}\n\n\n", "file_path": "mediapipe/framework/executor_external_build_test.cc", "rank": 91, "score": 204506.14670150395 }, { "content": "// Scales, rotates, horizontal or vertical flips the image.\n\n// See GlSimpleCalculatorBase for inputs, outputs and input side packets.\n\n// Additional input streams:\n\n// ROTATION: the counterclockwise rotation angle in degrees. This allows\n\n// user to specify different rotation angles for different frames. If this\n\n// stream is provided, it will override the ROTATION input side packet.\n\n// Additional output streams:\n\n// TOP_BOTTOM_PADDING: If use FIT scale mode, this stream outputs the padding\n\n// size of the input image in normalized value [0, 1] for top and bottom\n\n// sides with equal padding. E.g. Using FIT scale mode, if the input images\n\n// size is 10x10 and the required output size is 20x40, then the top and\n\n// bottom side of the image will both having padding of 10 pixels. So the\n\n// value of output stream is 10 / 40 = 0.25.\n\n// LEFT_RIGHT_PADDING: If use FIT scale mode, this stream outputs the padding\n\n// size of the input image in normalized value [0, 1] for left and right side.\n\n// E.g. Using FIT scale mode, if the input images size is 10x10 and the\n\n// required output size is 6x5, then the left and right side of the image will\n\n// both having padding of 1 pixels. So the value of output stream is 1 / 5 =\n\n// 0.2.\n\n// Additional input side packets:\n\n// OPTIONS: the GlScalerCalculatorOptions to use. Will replace or merge with\n\n// existing calculator options, depending on field merge_fields.\n\n// OUTPUT_DIMENSIONS: the output width and height in pixels.\n\n// ROTATION: the counterclockwise rotation angle in degrees.\n\n// These can also be specified as options.\n\n// To enable horizontal or vertical flip, specify them in options.\n\n// The flipping is applied after rotation.\n\nclass GlScalerCalculator : public CalculatorBase {\n\n public:\n\n GlScalerCalculator() {}\n\n ~GlScalerCalculator();\n\n\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc);\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) override;\n\n ::mediapipe::Status Process(CalculatorContext* cc) override;\n\n\n\n ::mediapipe::Status GlSetup();\n\n ::mediapipe::Status GlRender(const GlTexture& src, const GlTexture& dst);\n\n void GetOutputDimensions(int src_width, int src_height, int* dst_width,\n\n int* dst_height);\n\n void GetOutputPadding(int src_width, int src_height, int dst_width,\n\n int dst_height, float* top_bottom_padding,\n\n float* left_right_padding);\n\n GpuBufferFormat GetOutputFormat() { return GpuBufferFormat::kBGRA32; }\n\n\n\n private:\n", "file_path": "mediapipe/gpu/gl_scaler_calculator.cc", "rank": 92, "score": 203881.465133835 }, { "content": "// A calculator which takes N input side packets and passes them as\n\n// N outputs. Each input side packet contains a vector of Packets, or a single\n\n// Packet, as given in the options. The elements of the vector contained in\n\n// the i-th input side packet are output as individual packets to the i-th\n\n// output stream. Optionally, the packets can be timestamped, with either their\n\n// index within the vector, or with Timestamp::PostStream(). No type\n\n// checking is performed. It is only checked that the calculator receives 0\n\n// inputs and the number of outputs equals the number of input side packets.\n\nclass SidePacketsToStreamsCalculator : public CalculatorBase {\n\n public:\n\n SidePacketsToStreamsCalculator() {}\n\n SidePacketsToStreamsCalculator(const SidePacketsToStreamsCalculator&) =\n\n delete;\n\n SidePacketsToStreamsCalculator& operator=(\n\n const SidePacketsToStreamsCalculator&) = delete;\n\n ~SidePacketsToStreamsCalculator() override {}\n\n\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n auto& options = cc->Options<SidePacketsToStreamsCalculatorOptions>();\n\n if (options.has_num_inputs() &&\n\n (options.num_inputs() != cc->InputSidePackets().NumEntries() ||\n\n options.num_inputs() != cc->Outputs().NumEntries())) {\n\n return ::mediapipe::InvalidArgumentError(\n\n \"If num_inputs is specified it must be equal to the number of \"\n\n \"input side packets and output streams.\");\n\n }\n\n if (!options.vectors_of_packets() &&\n\n options.set_timestamp() ==\n", "file_path": "mediapipe/framework/tool/source.cc", "rank": 93, "score": 203871.00847472085 }, { "content": "// A Status handler which takes an int side packet and fails in pre run\n\n// if that packet is FailableStatusHandler::kFailPreRun and fails post\n\n// run if that value is FailableStatusHandler::kFailPostRun. If the\n\n// int is any other value then no failures occur.\n\nclass FailableStatusHandler : public StatusHandler {\n\n public:\n\n enum {\n\n kOk = 0,\n\n kFailPreRun = 1,\n\n kFailPostRun = 2,\n\n };\n\n\n\n static ::mediapipe::Status FillExpectations(\n\n const MediaPipeOptions& extendable_options,\n\n PacketTypeSet* input_side_packets) {\n\n input_side_packets->Index(0).Set<int>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n static ::mediapipe::Status HandlePreRunStatus(\n\n const MediaPipeOptions& extendable_options,\n\n const PacketSet& input_side_packets,\n\n const ::mediapipe::Status& pre_run_status) {\n\n if (input_side_packets.Index(0).Get<int>() == kFailPreRun) {\n\n return ::mediapipe::UnknownError(\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 94, "score": 203864.94889965322 }, { "content": "// A simple output selecting test calculator, which omits timestamp bounds\n\n// for the unselected outputs.\n\nclass DemuxUntimedCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n RET_CHECK_EQ(cc->Inputs().NumEntries(), 2);\n\n cc->Inputs().Tag(\"INPUT\").SetAny();\n\n cc->Inputs().Tag(\"SELECT\").Set<int>();\n\n for (CollectionItemId id = cc->Outputs().BeginId(\"OUTPUT\");\n\n id < cc->Outputs().EndId(\"OUTPUT\"); ++id) {\n\n cc->Outputs().Get(id).SetSameAs(&cc->Inputs().Tag(\"INPUT\"));\n\n }\n\n return ::mediapipe::OkStatus();\n\n }\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n int index = cc->Inputs().Tag(\"SELECT\").Get<int>();\n\n if (!cc->Inputs().Tag(\"INPUT\").IsEmpty()) {\n\n cc->Outputs()\n\n .Get(\"OUTPUT\", index)\n\n .AddPacket(cc->Inputs().Tag(\"INPUT\").Value());\n\n } else {\n\n cc->Outputs()\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 95, "score": 203864.64219528052 }, { "content": "// A mediapipe::Executor that signals the start and finish of each task.\n\n// Provides 4 worker threads.\n\nclass CountingExecutor : public Executor {\n\n public:\n\n CountingExecutor(std::function<void()> start_callback,\n\n std::function<void()> finish_callback)\n\n : thread_pool_(4),\n\n start_callback_(std::move(start_callback)),\n\n finish_callback_(std::move(finish_callback)) {\n\n thread_pool_.StartWorkers();\n\n }\n\n void Schedule(std::function<void()> task) override {\n\n start_callback_();\n\n thread_pool_.Schedule([this, task] {\n\n task();\n\n finish_callback_();\n\n });\n\n }\n\n\n\n private:\n\n ThreadPool thread_pool_;\n\n std::function<void()> start_callback_;\n\n std::function<void()> finish_callback_;\n\n};\n\n\n\n// Returns a new mediapipe::Executor with 4 worker threads.\n\nstd::shared_ptr<Executor> MakeExecutor(std::function<void()> start_callback,\n\n std::function<void()> finish_callback) {\n\n return std::make_shared<CountingExecutor>(start_callback, finish_callback);\n\n}\n\n\n", "file_path": "mediapipe/calculators/core/immediate_mux_calculator_test.cc", "rank": 96, "score": 203864.47054590704 }, { "content": "// A calculator checks if either of two input streams contains a packet and\n\n// sends the packet to the single output stream with the same timestamp.\n\nclass SimpleMuxCalculator : public CalculatorBase {\n\n public:\n\n static ::mediapipe::Status GetContract(CalculatorContract* cc) {\n\n RET_CHECK_EQ(cc->Inputs().NumEntries(), 2);\n\n cc->Inputs().Index(0).SetAny();\n\n cc->Inputs().Index(1).SetSameAs(&cc->Inputs().Index(0));\n\n RET_CHECK_EQ(cc->Outputs().NumEntries(), 1);\n\n cc->Outputs().Index(0).SetSameAs(&cc->Inputs().Index(0));\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Open(CalculatorContext* cc) final {\n\n data_input_base_ = cc->Inputs().BeginId();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n ::mediapipe::Status Process(CalculatorContext* cc) final {\n\n int select_packet_index = -1;\n\n if (!cc->Inputs().Index(0).IsEmpty()) {\n\n select_packet_index = 0;\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 97, "score": 203864.43826801653 }, { "content": "// A failing PacketGenerator and Calculator to verify that status handlers get\n\n// called. Both claim to output strings but instead always fail.\n\nclass FailingPacketGenerator : public PacketGenerator {\n\n public:\n\n static ::mediapipe::Status FillExpectations(\n\n const PacketGeneratorOptions& extendable_options,\n\n PacketTypeSet* input_side_packets, PacketTypeSet* output_side_packets) {\n\n for (int i = 0; i < input_side_packets->NumEntries(); ++i) {\n\n input_side_packets->Index(i).SetAny();\n\n }\n\n output_side_packets->Index(0).Set<std::string>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n static ::mediapipe::Status Generate(\n\n const PacketGeneratorOptions& extendable_options,\n\n const PacketSet& input_side_packets, PacketSet* output_side_packets) {\n\n return ::mediapipe::UnknownError(\"this always fails.\");\n\n }\n\n};\n\nREGISTER_PACKET_GENERATOR(FailingPacketGenerator);\n\n\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 98, "score": 203864.39226844767 }, { "content": "// Mock status handler that reports the number of times HandleStatus was called\n\n// by modifying the int in its input side packet.\n\nclass IncrementingStatusHandler : public StatusHandler {\n\n public:\n\n static ::mediapipe::Status FillExpectations(\n\n const MediaPipeOptions& extendable_options,\n\n PacketTypeSet* input_side_packets) {\n\n input_side_packets->Tag(\"EXTRA\").SetAny().Optional();\n\n input_side_packets->Tag(\"COUNTER1\").Set<std::unique_ptr<int>>();\n\n input_side_packets->Tag(\"COUNTER2\").Set<std::unique_ptr<int>>();\n\n return ::mediapipe::OkStatus();\n\n }\n\n\n\n static ::mediapipe::Status HandlePreRunStatus(\n\n const MediaPipeOptions& extendable_options,\n\n const PacketSet& input_side_packets, //\n\n const ::mediapipe::Status& pre_run_status) {\n\n int* counter = GetFromUniquePtr<int>(input_side_packets.Tag(\"COUNTER1\"));\n\n (*counter)++;\n\n return pre_run_status_result_;\n\n }\n\n\n", "file_path": "mediapipe/framework/calculator_graph_test.cc", "rank": 99, "score": 203864.3319727021 } ]
C++
Examples/ReadWriteExample/ReadWriteExample.cpp
scaredyfish/MPCDI
1ddbc9abf99d39d4464afa2005934c325443cf28
#include "mpcdiDisplay.h" #include "mpcdiWriter.h" #include "mpcdiReader.h" #include "CreateSampleProfile.h" #include "VerboseCompareProfile.h" #include <iostream> #include <algorithm> #define DO_PAUSE #ifdef DO_PAUSE # define PAUSE {std::cout<< "Press enter to continue....";std::cin.ignore();} #else # definE PAUSE #endif mpcdi::MPCDI_Error WriteTest(const std::string &FileName, mpcdi::Profile *profile); mpcdi::MPCDI_Error ReadTest(const std::string &FileName, mpcdi::Profile * &profileIn); int main( int argc, const char ** argv ) { bool DoWriteTest = true; bool DoReadTest = true; mpcdi::MPCDI_Error mpcdi_err = mpcdi::MPCDI_SUCCESS; std::string profileName= "SampleMPCDI.mpcdi"; mpcdi::Profile *profileOut = NULL; if (MPCDI_FAILED(mpcdi_err = CreateSampleProfile(std::cout, profileOut))) { PAUSE; return mpcdi_err; } if (DoWriteTest) { if(MPCDI_FAILED(WriteTest(profileName,profileOut))) { delete profileOut; PAUSE; return mpcdi::MPCDI_FAILURE; } } mpcdi::Profile *profileIn = NULL; if (DoReadTest) { if (MPCDI_FAILED(ReadTest(profileName,profileIn))) { delete profileOut; PAUSE; return mpcdi::MPCDI_FAILURE; } } if(DoReadTest && DoWriteTest) { if (MPCDI_FAILED(VerboseCompareProfile(std::cout,profileIn,profileOut))) { std::cout << "Error on Read/Write Test: " << std::endl; PAUSE; delete profileOut; delete profileIn; return mpcdi_err; } std::cout << "Success on Read/Write Test. " << std::endl; } if (profileOut) delete profileOut; if (profileIn) delete profileIn; PAUSE; return mpcdi::MPCDI_SUCCESS; } mpcdi::MPCDI_Error WriteTest(const std::string &FileName, mpcdi::Profile *profile) { mpcdi::Writer *writer = mpcdi::Writer::CreateWriter(); writer->SetOverwriteExistingFile(true); bool test = writer->GetOverwriteExistingFile(); mpcdi::MPCDI_Error mpcdi_err = writer->Write(FileName, *profile); delete writer; if (MPCDI_FAILED(mpcdi_err)) { std::cout << "Error writing: " << mpcdi_err << mpcdi::ErrorHelper::GetLastError() << std::endl; } return mpcdi_err; } mpcdi::MPCDI_Error ReadTest(const std::string &FileName, mpcdi::Profile * &profileIn) { profileIn = new mpcdi::Profile(); mpcdi::Reader *Reader = mpcdi::Reader::CreateReader(); std::cout << Reader->GetSupportedVersions() << std::endl; mpcdi::MPCDI_Error mpcdi_err = Reader->Read(FileName, profileIn); if (MPCDI_FAILED(mpcdi_err)) { std::cout << "Error encountered while reading: " << mpcdi_err << ": " << mpcdi::ErrorHelper::GetLastError() << std::endl; delete profileIn; profileIn = NULL; } delete Reader; return mpcdi_err; }
#include "mpcdiDisplay.h" #include "mpcdiWriter.h" #include "mpcdiReader.h" #include "CreateSampleProfile.h" #include "VerboseCompareProfile.h" #include <iostream> #include <algorithm> #define DO_PAUSE #ifdef DO_PAUSE # define PAUSE {std::cout<< "Press enter to continue....";std::cin.ignore();} #else # definE PAUSE #endif mpcdi::MPCDI_Error WriteTest(const std::string &FileName, mpcdi::Profile *profile); mpcdi::MPCDI_Error ReadTest(const std::string &FileName, mpcdi::Profile * &profileIn); int main( int argc, const char ** argv ) { bool DoWriteTest = true; bool DoReadTest = true; mpcdi::MPCDI_Error mpcdi_err = mpcdi::MPCDI_SUCCESS; std::string profileName= "SampleMPCDI.mpcdi"; mpcdi::Profile *profileOut = NULL; if (MPCDI_FAILED(mpcdi_err = CreateSampleProfile(std::cout, profileOut))) { PAUSE; return mpcdi_err; } if (DoWriteTes
mpcdi::MPCDI_Error WriteTest(const std::string &FileName, mpcdi::Profile *profile) { mpcdi::Writer *writer = mpcdi::Writer::CreateWriter(); writer->SetOverwriteExistingFile(true); bool test = writer->GetOverwriteExistingFile(); mpcdi::MPCDI_Error mpcdi_err = writer->Write(FileName, *profile); delete writer; if (MPCDI_FAILED(mpcdi_err)) { std::cout << "Error writing: " << mpcdi_err << mpcdi::ErrorHelper::GetLastError() << std::endl; } return mpcdi_err; } mpcdi::MPCDI_Error ReadTest(const std::string &FileName, mpcdi::Profile * &profileIn) { profileIn = new mpcdi::Profile(); mpcdi::Reader *Reader = mpcdi::Reader::CreateReader(); std::cout << Reader->GetSupportedVersions() << std::endl; mpcdi::MPCDI_Error mpcdi_err = Reader->Read(FileName, profileIn); if (MPCDI_FAILED(mpcdi_err)) { std::cout << "Error encountered while reading: " << mpcdi_err << ": " << mpcdi::ErrorHelper::GetLastError() << std::endl; delete profileIn; profileIn = NULL; } delete Reader; return mpcdi_err; }
t) { if(MPCDI_FAILED(WriteTest(profileName,profileOut))) { delete profileOut; PAUSE; return mpcdi::MPCDI_FAILURE; } } mpcdi::Profile *profileIn = NULL; if (DoReadTest) { if (MPCDI_FAILED(ReadTest(profileName,profileIn))) { delete profileOut; PAUSE; return mpcdi::MPCDI_FAILURE; } } if(DoReadTest && DoWriteTest) { if (MPCDI_FAILED(VerboseCompareProfile(std::cout,profileIn,profileOut))) { std::cout << "Error on Read/Write Test: " << std::endl; PAUSE; delete profileOut; delete profileIn; return mpcdi_err; } std::cout << "Success on Read/Write Test. " << std::endl; } if (profileOut) delete profileOut; if (profileIn) delete profileIn; PAUSE; return mpcdi::MPCDI_SUCCESS; }
function_block-function_prefixed
[ { "content": "local int gz_decomp(state)\n", "file_path": "ThirdParty/zlib-1.2.7/gzread.c", "rank": 0, "score": 99229.37633994885 }, { "content": "local int build_bl_tree(s)\n", "file_path": "ThirdParty/zlib-1.2.7/trees.c", "rank": 1, "score": 99229.01503971723 }, { "content": "local int gz_init(state)\n", "file_path": "ThirdParty/zlib-1.2.7/gzwrite.c", "rank": 2, "score": 99228.95319408871 }, { "content": "local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));\n", "file_path": "ThirdParty/zlib-1.2.7/deflate.c", "rank": 3, "score": 99224.4193916482 }, { "content": "local int updatewindow OF((z_streamp strm, unsigned out));\n", "file_path": "ThirdParty/zlib-1.2.7/inflate.c", "rank": 4, "score": 99224.4193916482 }, { "content": " char *argv[];\n", "file_path": "ThirdParty/zlib-1.2.7/test/example.c", "rank": 5, "score": 98626.17742202016 }, { "content": " int argc;\n", "file_path": "ThirdParty/zlib-1.2.7/test/example.c", "rank": 6, "score": 98626.17742202016 }, { "content": " int argc;\n", "file_path": "ThirdParty/zlib-1.2.7/test/minigzip.c", "rank": 7, "score": 98626.17742202016 }, { "content": " char *argv[];\n", "file_path": "ThirdParty/zlib-1.2.7/test/minigzip.c", "rank": 8, "score": 98626.17742202016 }, { "content": "int main(argc, argv)\n", "file_path": "ThirdParty/zlib-1.2.7/test/example.c", "rank": 9, "score": 98503.71886053367 }, { "content": "int main(int argc, char **argv)\n\n{\n\n int ret, len, test;\n\n char *outname;\n\n unsigned char *window;\n\n z_stream strm;\n\n\n\n /* initialize inflateBack state for repeated use */\n\n window = match; /* reuse LZW match buffer */\n\n strm.zalloc = Z_NULL;\n\n strm.zfree = Z_NULL;\n\n strm.opaque = Z_NULL;\n\n ret = inflateBackInit(&strm, 15, window);\n\n if (ret != Z_OK) {\n\n fprintf(stderr, \"gun out of memory error--aborting\\n\");\n\n return 1;\n\n }\n\n\n\n /* decompress each file to the same name with the suffix removed */\n\n argc--;\n\n argv++;\n\n test = 0;\n\n if (argc && strcmp(*argv, \"-h\") == 0) {\n\n fprintf(stderr, \"gun 1.6 (17 Jan 2010)\\n\");\n\n fprintf(stderr, \"Copyright (C) 2003-2010 Mark Adler\\n\");\n\n fprintf(stderr, \"usage: gun [-t] [file1.gz [file2.Z ...]]\\n\");\n\n return 0;\n\n }\n\n if (argc && strcmp(*argv, \"-t\") == 0) {\n\n test = 1;\n\n argc--;\n\n argv++;\n\n }\n\n if (argc)\n\n do {\n\n if (test)\n\n outname = NULL;\n\n else {\n\n len = (int)strlen(*argv);\n\n if (strcmp(*argv + len - 3, \".gz\") == 0 ||\n\n strcmp(*argv + len - 3, \"-gz\") == 0)\n\n len -= 3;\n\n else if (strcmp(*argv + len - 2, \".z\") == 0 ||\n\n strcmp(*argv + len - 2, \"-z\") == 0 ||\n\n strcmp(*argv + len - 2, \"_z\") == 0 ||\n\n strcmp(*argv + len - 2, \".Z\") == 0)\n\n len -= 2;\n\n else {\n\n fprintf(stderr, \"gun error: no gz type on %s--skipping\\n\",\n\n *argv);\n\n continue;\n\n }\n\n outname = malloc(len + 1);\n\n if (outname == NULL) {\n\n fprintf(stderr, \"gun out of memory error--aborting\\n\");\n\n ret = 1;\n\n break;\n\n }\n\n memcpy(outname, *argv, len);\n\n outname[len] = 0;\n\n }\n\n ret = gunzip(&strm, *argv, outname, test);\n\n if (outname != NULL) free(outname);\n\n if (ret) break;\n\n } while (argv++, --argc);\n\n else\n\n ret = gunzip(&strm, NULL, NULL, test);\n\n\n\n /* clean up */\n\n inflateBackEnd(&strm);\n\n return ret;\n", "file_path": "ThirdParty/zlib-1.2.7/examples/gun.c", "rank": 10, "score": 98503.71886053367 }, { "content": "int main(int argc, char **argv)\n\n{\n\n int ret; /* return code */\n\n unsigned size; /* requested fixed output block size */\n\n unsigned have; /* bytes written by deflate() call */\n\n unsigned char *blk; /* intermediate and final stream */\n\n unsigned char *tmp; /* close to desired size stream */\n\n z_stream def, inf; /* zlib deflate and inflate states */\n\n\n\n /* get requested output size */\n\n if (argc != 2)\n\n quit(\"need one argument: size of output block\");\n\n ret = strtol(argv[1], argv + 1, 10);\n\n if (argv[1][0] != 0)\n\n quit(\"argument must be a number\");\n\n if (ret < 8) /* 8 is minimum zlib stream size */\n\n quit(\"need positive size of 8 or greater\");\n\n size = (unsigned)ret;\n\n\n\n /* allocate memory for buffers and compression engine */\n\n blk = malloc(size + EXCESS);\n\n def.zalloc = Z_NULL;\n\n def.zfree = Z_NULL;\n\n def.opaque = Z_NULL;\n\n ret = deflateInit(&def, Z_DEFAULT_COMPRESSION);\n\n if (ret != Z_OK || blk == NULL)\n\n quit(\"out of memory\");\n\n\n\n /* compress from stdin until output full, or no more input */\n\n def.avail_out = size + EXCESS;\n\n def.next_out = blk;\n\n ret = partcompress(stdin, &def);\n\n if (ret == Z_ERRNO)\n\n quit(\"error reading input\");\n\n\n\n /* if it all fit, then size was undersubscribed -- done! */\n\n if (ret == Z_STREAM_END && def.avail_out >= EXCESS) {\n\n /* write block to stdout */\n\n have = size + EXCESS - def.avail_out;\n\n if (fwrite(blk, 1, have, stdout) != have || ferror(stdout))\n\n quit(\"error writing output\");\n\n\n\n /* clean up and print results to stderr */\n\n ret = deflateEnd(&def);\n\n assert(ret != Z_STREAM_ERROR);\n\n free(blk);\n\n fprintf(stderr,\n\n \"%u bytes unused out of %u requested (all input)\\n\",\n\n size - have, size);\n\n return 0;\n\n }\n\n\n\n /* it didn't all fit -- set up for recompression */\n\n inf.zalloc = Z_NULL;\n\n inf.zfree = Z_NULL;\n\n inf.opaque = Z_NULL;\n\n inf.avail_in = 0;\n\n inf.next_in = Z_NULL;\n\n ret = inflateInit(&inf);\n\n tmp = malloc(size + EXCESS);\n\n if (ret != Z_OK || tmp == NULL)\n\n quit(\"out of memory\");\n\n ret = deflateReset(&def);\n\n assert(ret != Z_STREAM_ERROR);\n\n\n\n /* do first recompression close to the right amount */\n\n inf.avail_in = size + EXCESS;\n\n inf.next_in = blk;\n\n def.avail_out = size + EXCESS;\n\n def.next_out = tmp;\n\n ret = recompress(&inf, &def);\n\n if (ret == Z_MEM_ERROR)\n\n quit(\"out of memory\");\n\n\n\n /* set up for next reocmpression */\n\n ret = inflateReset(&inf);\n\n assert(ret != Z_STREAM_ERROR);\n\n ret = deflateReset(&def);\n\n assert(ret != Z_STREAM_ERROR);\n\n\n\n /* do second and final recompression (third compression) */\n\n inf.avail_in = size - MARGIN; /* assure stream will complete */\n\n inf.next_in = tmp;\n\n def.avail_out = size;\n\n def.next_out = blk;\n\n ret = recompress(&inf, &def);\n\n if (ret == Z_MEM_ERROR)\n\n quit(\"out of memory\");\n\n assert(ret == Z_STREAM_END); /* otherwise MARGIN too small */\n\n\n\n /* done -- write block to stdout */\n\n have = size - def.avail_out;\n\n if (fwrite(blk, 1, have, stdout) != have || ferror(stdout))\n\n quit(\"error writing output\");\n\n\n\n /* clean up and print results to stderr */\n\n free(tmp);\n\n ret = inflateEnd(&inf);\n\n assert(ret != Z_STREAM_ERROR);\n\n ret = deflateEnd(&def);\n\n assert(ret != Z_STREAM_ERROR);\n\n free(blk);\n\n fprintf(stderr,\n\n \"%u bytes unused out of %u requested (%lu input)\\n\",\n\n size - have, size, def.total_in);\n\n return 0;\n", "file_path": "ThirdParty/zlib-1.2.7/examples/fitblk.c", "rank": 11, "score": 98503.71886053367 }, { "content": "int main(int argc, char **argv)\n\n{\n\n int gd, level;\n\n z_stream strm;\n\n\n\n /* ignore command name */\n\n argv++;\n\n\n\n /* provide usage if no arguments */\n\n if (*argv == NULL) {\n\n printf(\"gzappend 1.1 (4 Nov 2003) Copyright (C) 2003 Mark Adler\\n\");\n\n printf(\n\n \"usage: gzappend [-level] file.gz [ addthis [ andthis ... ]]\\n\");\n\n return 0;\n\n }\n\n\n\n /* set compression level */\n\n level = Z_DEFAULT_COMPRESSION;\n\n if (argv[0][0] == '-') {\n\n if (argv[0][1] < '0' || argv[0][1] > '9' || argv[0][2] != 0)\n\n bye(\"invalid compression level\", \"\");\n\n level = argv[0][1] - '0';\n\n if (*++argv == NULL) bye(\"no gzip file name after options\", \"\");\n\n }\n\n\n\n /* prepare to append to gzip file */\n\n gd = gzscan(*argv++, &strm, level);\n\n\n\n /* append files on command line, or from stdin if none */\n\n if (*argv == NULL)\n\n gztack(NULL, gd, &strm, 1);\n\n else\n\n do {\n\n gztack(*argv, gd, &strm, argv[1] == NULL);\n\n } while (*++argv != NULL);\n\n return 0;\n", "file_path": "ThirdParty/zlib-1.2.7/examples/gzappend.c", "rank": 12, "score": 98503.71886053367 }, { "content": "int main(int argc, char **argv)\n\n{\n\n int ret;\n\n\n\n /* avoid end-of-line conversions */\n\n SET_BINARY_MODE(stdin);\n\n SET_BINARY_MODE(stdout);\n\n\n\n /* do compression if no arguments */\n\n if (argc == 1) {\n\n ret = def(stdin, stdout, Z_DEFAULT_COMPRESSION);\n\n if (ret != Z_OK)\n\n zerr(ret);\n\n return ret;\n\n }\n\n\n\n /* do decompression if -d specified */\n\n else if (argc == 2 && strcmp(argv[1], \"-d\") == 0) {\n\n ret = inf(stdin, stdout);\n\n if (ret != Z_OK)\n\n zerr(ret);\n\n return ret;\n\n }\n\n\n\n /* otherwise, report usage */\n\n else {\n\n fputs(\"zpipe usage: zpipe [-d] < source > dest\\n\", stderr);\n\n return 1;\n\n }\n", "file_path": "ThirdParty/zlib-1.2.7/examples/zpipe.c", "rank": 13, "score": 98503.71886053367 }, { "content": "int main(argc, argv)\n", "file_path": "ThirdParty/zlib-1.2.7/test/minigzip.c", "rank": 14, "score": 98503.71886053367 }, { "content": "int main(int argc, char **argv)\n\n{\n\n unsigned long crc, tot; /* running crc and total uncompressed length */\n\n\n\n /* skip command name */\n\n argc--;\n\n argv++;\n\n\n\n /* show usage if no arguments */\n\n if (argc == 0) {\n\n fputs(\"gzjoin usage: gzjoin f1.gz [f2.gz [f3.gz ...]] > fjoin.gz\\n\",\n\n stderr);\n\n return 0;\n\n }\n\n\n\n /* join gzip files on command line and write to stdout */\n\n gzinit(&crc, &tot, stdout);\n\n while (argc--)\n\n gzcopy(*argv++, argc, &crc, &tot, stdout);\n\n\n\n /* done */\n\n return 0;\n", "file_path": "ThirdParty/zlib-1.2.7/examples/gzjoin.c", "rank": 15, "score": 98503.71886053367 }, { "content": "int main(void)\n\n{\n\n fprintf(stderr, \"%s\\n\", zlibVersion());\n\n cover_support();\n\n cover_wrap();\n\n cover_back();\n\n cover_inflate();\n\n cover_trees();\n\n cover_fast();\n\n return 0;\n", "file_path": "ThirdParty/zlib-1.2.7/test/infcover.c", "rank": 16, "score": 98503.71886053367 }, { "content": "int main(int argc, char **argv)\n\n{\n\n int syms; /* total number of symbols to code */\n\n int n; /* number of symbols to code for this run */\n\n big_t got; /* return value of count() */\n\n big_t sum; /* accumulated number of codes over n */\n\n\n\n /* set up globals for cleanup() */\n\n code = NULL;\n\n num = NULL;\n\n done = NULL;\n\n\n\n /* get arguments -- default to the deflate literal/length code */\n\n syms = 286;\n\n root = 9;\n\n max = 15;\n\n if (argc > 1) {\n\n syms = atoi(argv[1]);\n\n if (argc > 2) {\n\n root = atoi(argv[2]);\n\n if (argc > 3)\n\n max = atoi(argv[3]);\n\n }\n\n }\n\n if (argc > 4 || syms < 2 || root < 1 || max < 1) {\n\n fputs(\"invalid arguments, need: [sym >= 2 [root >= 1 [max >= 1]]]\\n\",\n\n stderr);\n\n return 1;\n\n }\n\n\n\n /* if not restricting the code length, the longest is syms - 1 */\n\n if (max > syms - 1)\n\n max = syms - 1;\n\n\n\n /* determine the number of bits in a code_t */\n\n n = 0;\n\n while (((code_t)1 << n) != 0)\n\n n++;\n\n\n\n /* make sure that the calculation of most will not overflow */\n\n if (max > n || syms - 2 >= (((code_t)0 - 1) >> (max - 1))) {\n\n fputs(\"abort: code length too long for internal types\\n\", stderr);\n\n return 1;\n\n }\n\n\n\n /* reject impossible code requests */\n\n if (syms - 1 > ((code_t)1 << max) - 1) {\n\n fprintf(stderr, \"%d symbols cannot be coded in %d bits\\n\",\n\n syms, max);\n\n return 1;\n\n }\n\n\n\n /* allocate code vector */\n\n code = calloc(max + 1, sizeof(int));\n\n if (code == NULL) {\n\n fputs(\"abort: unable to allocate enough memory\\n\", stderr);\n\n return 1;\n\n }\n\n\n\n /* determine size of saved results array, checking for overflows,\n\n allocate and clear the array (set all to zero with calloc()) */\n\n if (syms == 2) /* iff max == 1 */\n\n num = NULL; /* won't be saving any results */\n\n else {\n\n size = syms >> 1;\n\n if (size > ((size_t)0 - 1) / (n = (syms - 1) >> 1) ||\n\n (size *= n, size > ((size_t)0 - 1) / (n = max - 1)) ||\n\n (size *= n, size > ((size_t)0 - 1) / sizeof(big_t)) ||\n\n (num = calloc(size, sizeof(big_t))) == NULL) {\n\n fputs(\"abort: unable to allocate enough memory\\n\", stderr);\n\n cleanup();\n\n return 1;\n\n }\n\n }\n\n\n\n /* count possible codes for all numbers of symbols, add up counts */\n\n sum = 0;\n\n for (n = 2; n <= syms; n++) {\n\n got = count(n, 1, 2);\n\n sum += got;\n\n if (got == -1 || sum < got) { /* overflow */\n\n fputs(\"abort: can't count that high!\\n\", stderr);\n\n cleanup();\n\n return 1;\n\n }\n\n printf(\"%llu %d-codes\\n\", got, n);\n\n }\n\n printf(\"%llu total codes for 2 to %d symbols\", sum, syms);\n\n if (max < syms - 1)\n\n printf(\" (%d-bit length limit)\\n\", max);\n\n else\n\n puts(\" (no length limit)\");\n\n\n\n /* allocate and clear done array for beenhere() */\n\n if (syms == 2)\n\n done = NULL;\n\n else if (size > ((size_t)0 - 1) / sizeof(struct tab) ||\n\n (done = calloc(size, sizeof(struct tab))) == NULL) {\n\n fputs(\"abort: unable to allocate enough memory\\n\", stderr);\n\n cleanup();\n\n return 1;\n\n }\n\n\n\n /* find and show maximum inflate table usage */\n\n if (root > max) /* reduce root to max length */\n\n root = max;\n\n if (syms < ((code_t)1 << (root + 1)))\n\n enough(syms);\n\n else\n\n puts(\"cannot handle minimum code lengths > root\");\n\n\n\n /* done */\n\n cleanup();\n\n return 0;\n", "file_path": "ThirdParty/zlib-1.2.7/examples/enough.c", "rank": 17, "score": 98503.71886053367 }, { "content": "int main(int argc, char **argv)\n\n{\n\n int len;\n\n off_t offset;\n\n FILE *in;\n\n struct access *index = NULL;\n\n unsigned char buf[CHUNK];\n\n\n\n /* open input file */\n\n if (argc != 2) {\n\n fprintf(stderr, \"usage: zran file.gz\\n\");\n\n return 1;\n\n }\n\n in = fopen(argv[1], \"rb\");\n\n if (in == NULL) {\n\n fprintf(stderr, \"zran: could not open %s for reading\\n\", argv[1]);\n\n return 1;\n\n }\n\n\n\n /* build index */\n\n len = build_index(in, SPAN, &index);\n\n if (len < 0) {\n\n fclose(in);\n\n switch (len) {\n\n case Z_MEM_ERROR:\n\n fprintf(stderr, \"zran: out of memory\\n\");\n\n break;\n\n case Z_DATA_ERROR:\n\n fprintf(stderr, \"zran: compressed data error in %s\\n\", argv[1]);\n\n break;\n\n case Z_ERRNO:\n\n fprintf(stderr, \"zran: read error on %s\\n\", argv[1]);\n\n break;\n\n default:\n\n fprintf(stderr, \"zran: error %d while building index\\n\", len);\n\n }\n\n return 1;\n\n }\n\n fprintf(stderr, \"zran: built index with %d access points\\n\", len);\n\n\n\n /* use index by reading some bytes from an arbitrary offset */\n\n offset = (index->list[index->have - 1].out << 1) / 3;\n\n len = extract(in, index, offset, buf, CHUNK);\n\n if (len < 0)\n\n fprintf(stderr, \"zran: extraction failed: %s error\\n\",\n\n len == Z_MEM_ERROR ? \"out of memory\" : \"input corrupted\");\n\n else {\n\n fwrite(buf, 1, len, stdout);\n\n fprintf(stderr, \"zran: extracted %d bytes at %llu\\n\", len, offset);\n\n }\n\n\n\n /* clean up and exit */\n\n free_index(index);\n\n fclose(in);\n\n return 0;\n", "file_path": "ThirdParty/zlib-1.2.7/examples/zran.c", "rank": 18, "score": 98503.71886053367 }, { "content": "static PNG_CONST char sep[] = \": \";\n", "file_path": "ThirdParty/lpng161/contrib/libtests/pngvalid.c", "rank": 19, "score": 97952.75581695366 }, { "content": "local int unz64local_getByte OF((\n", "file_path": "ThirdParty/zlib-1.2.7/contrib/minizip/unzip.c", "rank": 20, "score": 97858.82905782327 }, { "content": "local int zip64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX));\n", "file_path": "ThirdParty/zlib-1.2.7/contrib/minizip/zip.c", "rank": 21, "score": 97854.35545854775 }, { "content": "int main(int argc, char *argv[])\n\n{\n\n FILE *fp_rd = stdin;\n\n FILE *fp_al = NULL;\n\n FILE *fp_wr = stdout;\n\n BOOL interlace = FALSE;\n\n BOOL alpha = FALSE;\n\n int argi;\n\n\n\n for (argi = 1; argi < argc; argi++)\n\n {\n\n if (argv[argi][0] == '-')\n\n {\n\n switch (argv[argi][1])\n\n {\n\n case 'i':\n\n interlace = TRUE;\n\n break;\n\n case 'a':\n\n alpha = TRUE;\n\n argi++;\n\n if ((fp_al = fopen (argv[argi], \"rb\")) == NULL)\n\n {\n\n fprintf (stderr, \"PNM2PNG\\n\");\n\n fprintf (stderr, \"Error: alpha-channel file %s does not exist\\n\",\n\n argv[argi]);\n\n exit (1);\n\n }\n\n break;\n\n case 'h':\n\n case '?':\n\n usage();\n\n exit(0);\n\n break;\n\n default:\n\n fprintf (stderr, \"PNM2PNG\\n\");\n\n fprintf (stderr, \"Error: unknown option %s\\n\", argv[argi]);\n\n usage();\n\n exit(1);\n\n break;\n\n } /* end switch */\n\n }\n\n else if (fp_rd == stdin)\n\n {\n\n if ((fp_rd = fopen (argv[argi], \"rb\")) == NULL)\n\n {\n\n fprintf (stderr, \"PNM2PNG\\n\");\n\n fprintf (stderr, \"Error: file %s does not exist\\n\", argv[argi]);\n\n exit (1);\n\n }\n\n }\n\n else if (fp_wr == stdout)\n\n {\n\n if ((fp_wr = fopen (argv[argi], \"wb\")) == NULL)\n\n {\n\n fprintf (stderr, \"PNM2PNG\\n\");\n\n fprintf (stderr, \"Error: can not create PNG-file %s\\n\", argv[argi]);\n\n exit (1);\n\n }\n\n }\n\n else\n\n {\n\n fprintf (stderr, \"PNM2PNG\\n\");\n\n fprintf (stderr, \"Error: too many parameters\\n\");\n\n usage();\n\n exit (1);\n\n }\n\n } /* end for */\n\n\n\n#ifdef __TURBOC__\n\n /* set stdin/stdout to binary, we're reading the PNM always! in binary format */\n\n if (fp_rd == stdin)\n\n {\n\n setmode (STDIN, O_BINARY);\n\n }\n\n if (fp_wr == stdout)\n\n {\n\n setmode (STDOUT, O_BINARY);\n\n }\n\n#endif\n\n\n\n /* call the conversion program itself */\n\n if (pnm2png (fp_rd, fp_wr, fp_al, interlace, alpha) == FALSE)\n\n {\n\n fprintf (stderr, \"PNM2PNG\\n\");\n\n fprintf (stderr, \"Error: unsuccessful converting to PNG-image\\n\");\n\n exit (1);\n\n }\n\n\n\n /* close input file */\n\n fclose (fp_rd);\n\n /* close output file */\n\n fclose (fp_wr);\n\n /* close alpha file */\n\n if (alpha)\n\n fclose (fp_al);\n\n\n\n return 0;\n", "file_path": "ThirdParty/lpng161/contrib/pngminus/pnm2png.c", "rank": 22, "score": 97832.95124843795 }, { "content": "int main(int argc, char *argv[])\n\n{\n\n FILE *fp_rd = stdin;\n\n FILE *fp_wr = stdout;\n\n FILE *fp_al = NULL;\n\n BOOL raw = TRUE;\n\n BOOL alpha = FALSE;\n\n int argi;\n\n\n\n for (argi = 1; argi < argc; argi++)\n\n {\n\n if (argv[argi][0] == '-')\n\n {\n\n switch (argv[argi][1])\n\n {\n\n case 'n':\n\n raw = FALSE;\n\n break;\n\n case 'r':\n\n raw = TRUE;\n\n break;\n\n case 'a':\n\n alpha = TRUE;\n\n argi++;\n\n if ((fp_al = fopen (argv[argi], \"wb\")) == NULL)\n\n {\n\n fprintf (stderr, \"PNM2PNG\\n\");\n\n fprintf (stderr, \"Error: can not create alpha-channel file %s\\n\", argv[argi]);\n\n exit (1);\n\n }\n\n break;\n\n case 'h':\n\n case '?':\n\n usage();\n\n exit(0);\n\n break;\n\n default:\n\n fprintf (stderr, \"PNG2PNM\\n\");\n\n fprintf (stderr, \"Error: unknown option %s\\n\", argv[argi]);\n\n usage();\n\n exit(1);\n\n break;\n\n } /* end switch */\n\n }\n\n else if (fp_rd == stdin)\n\n {\n\n if ((fp_rd = fopen (argv[argi], \"rb\")) == NULL)\n\n {\n\n fprintf (stderr, \"PNG2PNM\\n\");\n\n fprintf (stderr, \"Error: file %s does not exist\\n\", argv[argi]);\n\n exit (1);\n\n }\n\n }\n\n else if (fp_wr == stdout)\n\n {\n\n if ((fp_wr = fopen (argv[argi], \"wb\")) == NULL)\n\n {\n\n fprintf (stderr, \"PNG2PNM\\n\");\n\n fprintf (stderr, \"Error: can not create file %s\\n\", argv[argi]);\n\n exit (1);\n\n }\n\n }\n\n else\n\n {\n\n fprintf (stderr, \"PNG2PNM\\n\");\n\n fprintf (stderr, \"Error: too many parameters\\n\");\n\n usage();\n\n exit(1);\n\n }\n\n } /* end for */\n\n\n\n#ifdef __TURBOC__\n\n /* set stdin/stdout if required to binary */\n\n if (fp_rd == stdin)\n\n {\n\n setmode (STDIN, O_BINARY);\n\n }\n\n if ((raw) && (fp_wr == stdout))\n\n {\n\n setmode (STDOUT, O_BINARY);\n\n }\n\n#endif\n\n\n\n /* call the conversion program itself */\n\n if (png2pnm (fp_rd, fp_wr, fp_al, raw, alpha) == FALSE)\n\n {\n\n fprintf (stderr, \"PNG2PNM\\n\");\n\n fprintf (stderr, \"Error: unsuccessful conversion of PNG-image\\n\");\n\n exit(1);\n\n }\n\n\n\n /* close input file */\n\n fclose (fp_rd);\n\n /* close output file */\n\n fclose (fp_wr);\n\n /* close alpha file */\n\n if (alpha)\n\n fclose (fp_al);\n\n\n\n return 0;\n", "file_path": "ThirdParty/lpng161/contrib/pngminus/png2pnm.c", "rank": 23, "score": 97832.95124843795 }, { "content": "int main(int argc, char **argv)\n\n{\n\n int ok = 0;\n\n FILE *fp = tmpfile();\n\n\n\n if (fp != NULL)\n\n {\n\n int err = 0;\n\n int nfiles = 0;\n\n\n\n if (argc > 1)\n\n {\n\n int i;\n\n\n\n for (i=1; i<argc; ++i)\n\n {\n\n if (add_one_file(fp, argv[i]))\n\n ++nfiles;\n\n\n\n else\n\n {\n\n err = 1;\n\n break;\n\n }\n\n }\n\n }\n\n\n\n else\n\n {\n\n char filename[FILENAME_MAX+1];\n\n\n\n while (fgets(filename, FILENAME_MAX+1, stdin))\n\n {\n\n int len = strlen(filename);\n\n\n\n if (filename[len-1] == '\\n')\n\n {\n\n filename[len-1] = 0;\n\n if (add_one_file(fp, filename))\n\n ++nfiles;\n\n\n\n else\n\n {\n\n err = 1;\n\n break;\n\n }\n\n }\n\n\n\n else\n\n {\n\n fprintf(stderr, \"timepng: truncated file name ...%s\\n\",\n\n filename+len-32);\n\n err = 1;\n\n break;\n\n }\n\n }\n\n\n\n if (ferror(stdin))\n\n {\n\n fprintf(stderr, \"timepng: stdin: read error\\n\");\n\n err = 1;\n\n }\n\n }\n\n\n\n if (!err)\n\n {\n\n if (nfiles > 0)\n\n ok = perform_one_test(fp, nfiles);\n\n\n\n else\n\n fprintf(stderr, \"usage: timepng {files} or ls files | timepng\\n\");\n\n }\n\n\n\n (void)fclose(fp);\n\n }\n\n\n\n else\n\n fprintf(stderr, \"timepng: could not open temporary file\\n\");\n\n\n\n /* Exit code 0 on success. */\n\n return ok == 0;\n", "file_path": "ThirdParty/lpng161/contrib/libtests/timepng.c", "rank": 24, "score": 97827.28991681694 }, { "content": "int main(int argc, const char **argv)\n\n{\n\n int result = 1;\n\n\n\n if (argc == 3)\n\n {\n\n png_image image;\n\n\n\n /* Only the image structure version number needs to be set. */\n\n memset(&image, 0, sizeof image);\n\n image.version = PNG_IMAGE_VERSION;\n\n\n\n if (png_image_begin_read_from_file(&image, argv[1]))\n\n {\n\n png_bytep buffer;\n\n\n\n /* Change this to try different formats! If you set a colormap format\n\n * then you must also supply a colormap below.\n\n */\n\n image.format = PNG_FORMAT_RGBA;\n\n\n\n buffer = malloc(PNG_IMAGE_SIZE(image));\n\n\n\n if (buffer != NULL)\n\n {\n\n if (png_image_finish_read(&image, NULL/*background*/, buffer,\n\n 0/*row_stride*/, NULL/*colormap for PNG_FORMAT_FLAG_COLORMAP */))\n\n {\n\n if (png_image_write_to_file(&image, argv[2],\n\n 0/*convert_to_8bit*/, buffer, 0/*row_stride*/,\n\n NULL/*colormap*/))\n\n result = 0;\n\n\n\n else\n\n fprintf(stderr, \"pngtopng: write %s: %s\\n\", argv[2],\n\n image.message);\n\n\n\n free(buffer);\n\n }\n\n\n\n else\n\n {\n\n fprintf(stderr, \"pngtopng: read %s: %s\\n\", argv[1],\n\n image.message);\n\n\n\n /* This is the only place where a 'free' is required; libpng does\n\n * the cleanup on error and success, but in this case we couldn't\n\n * complete the read because of running out of memory.\n\n */\n\n png_image_free(&image);\n\n }\n\n }\n\n\n\n else\n\n fprintf(stderr, \"pngtopng: out of memory: %lu bytes\\n\",\n\n (unsigned long)PNG_IMAGE_SIZE(image));\n\n }\n\n\n\n else\n\n /* Failed to read the first argument: */\n\n fprintf(stderr, \"pngtopng: %s: %s\\n\", argv[1], image.message);\n\n }\n\n\n\n else\n\n /* Wrong number of arguments */\n\n fprintf(stderr, \"pngtopng: usage: pngtopng input-file output-file\\n\");\n\n\n\n return result;\n", "file_path": "ThirdParty/lpng161/contrib/examples/pngtopng.c", "rank": 25, "score": 97827.28991681694 }, { "content": "int\n\nmain(int argc, const char **argv)\n\n{\n\n const char *prog = *argv++;\n\n int to_linear = 0, to_gray = 0, to_color = 0;\n\n int channels = 0;\n\n double c[4];\n\n\n\n /* FE_TONEAREST is the IEEE754 round to nearest, preferring even, mode; i.e.\n\n * everything rounds to the nearest value except that '.5' rounds to the\n\n * nearest even value.\n\n */\n\n fesetround(FE_TONEAREST);\n\n\n\n c[3] = c[2] = c[1] = c[0] = 0;\n\n\n\n while (--argc > 0 && **argv == '-')\n\n {\n\n const char *arg = 1+*argv++;\n\n\n\n if (strcmp(arg, \"sRGB\") == 0)\n\n to_linear = 0;\n\n\n\n else if (strcmp(arg, \"linear\") == 0)\n\n to_linear = 1;\n\n\n\n else if (strcmp(arg, \"gray\") == 0)\n\n to_gray = 1, to_color = 0;\n\n\n\n else if (strcmp(arg, \"color\") == 0)\n\n to_gray = 0, to_color = 1;\n\n\n\n else\n\n usage(prog);\n\n }\n\n\n\n switch (argc)\n\n {\n\n default:\n\n usage(prog);\n\n break;\n\n\n\n case 4:\n\n c[3] = component(prog, argv[3], to_linear);\n\n ++channels;\n\n case 3:\n\n c[2] = component(prog, argv[2], to_linear);\n\n ++channels;\n\n case 2:\n\n c[1] = component(prog, argv[1], to_linear);\n\n ++channels;\n\n case 1:\n\n c[0] = component(prog, argv[0], to_linear);\n\n ++channels;\n\n break;\n\n }\n\n\n\n if (to_linear)\n\n {\n\n int i;\n\n int components = channels;\n\n\n\n if ((components & 1) == 0)\n\n --components;\n\n\n\n for (i=0; i<components; ++i) c[i] = linear_from_sRGB(c[i] / 255);\n\n if (components < channels)\n\n c[components] = c[components] / 255;\n\n }\n\n\n\n else\n\n {\n\n int i;\n\n for (i=0; i<4; ++i) c[i] /= 65535;\n\n\n\n if ((channels & 1) == 0)\n\n {\n\n double alpha = c[channels-1];\n\n\n\n if (alpha > 0)\n\n for (i=0; i<channels-1; ++i) c[i] /= alpha;\n\n else\n\n for (i=0; i<channels-1; ++i) c[i] = 1;\n\n }\n\n }\n\n\n\n if (to_gray)\n\n {\n\n if (channels < 3)\n\n {\n\n fprintf(stderr, \"%s: too few channels (%d) for -gray\\n\",\n\n prog, channels);\n\n usage(prog);\n\n }\n\n\n\n c[0] = YfromRGB(c[0], c[1], c[2]);\n\n channels -= 2;\n\n }\n\n\n\n if (to_color)\n\n {\n\n if (channels > 2)\n\n {\n\n fprintf(stderr, \"%s: too many channels (%d) for -color\\n\",\n\n prog, channels);\n\n usage(prog);\n\n }\n\n\n\n c[3] = c[1]; /* alpha, if present */\n\n c[2] = c[1] = c[0];\n\n }\n\n\n\n if (to_linear)\n\n {\n\n int i;\n\n if ((channels & 1) == 0)\n\n {\n\n double alpha = c[channels-1];\n\n for (i=0; i<channels-1; ++i) c[i] *= alpha;\n\n }\n\n\n\n for (i=0; i<channels; ++i) c[i] = nearbyint(c[i] * 65535);\n\n }\n\n\n\n else /* to sRGB */\n\n {\n\n int i = (channels+1)&~1;\n\n while (--i >= 0)\n\n c[i] = sRGB_from_linear(c[i]);\n\n\n\n for (i=0; i<channels; ++i) c[i] = nearbyint(c[i] * 255);\n\n }\n\n\n\n {\n\n int i;\n\n for (i=0; i<channels; ++i) printf(\" %g\", c[i]);\n\n }\n\n printf(\"\\n\");\n\n\n\n return 0;\n", "file_path": "ThirdParty/lpng161/contrib/tools/cvtcolor.c", "rank": 26, "score": 97827.28991681694 }, { "content": "int main(int argc, char **argv)\n\n{\n\n int ret, put = 0, fail = 0;\n\n unsigned skip = 0;\n\n char *arg, *name = NULL;\n\n unsigned char *source = NULL, *dest;\n\n size_t len = 0;\n\n unsigned long sourcelen, destlen;\n\n\n\n /* process arguments */\n\n while (arg = *++argv, --argc)\n\n if (arg[0] == '-') {\n\n if (arg[1] == 'w' && arg[2] == 0)\n\n put = 1;\n\n else if (arg[1] == 'f' && arg[2] == 0)\n\n fail = 1, put = 1;\n\n else if (arg[1] >= '0' && arg[1] <= '9')\n\n skip = (unsigned)atoi(arg + 1);\n\n else {\n\n fprintf(stderr, \"invalid option %s\\n\", arg);\n\n return 3;\n\n }\n\n }\n\n else if (name != NULL) {\n\n fprintf(stderr, \"only one file name allowed\\n\");\n\n return 3;\n\n }\n\n else\n\n name = arg;\n\n source = load(name, &len);\n\n if (source == NULL) {\n\n fprintf(stderr, \"memory allocation failure\\n\");\n\n return 4;\n\n }\n\n if (len == 0) {\n\n fprintf(stderr, \"could not read %s, or it was empty\\n\",\n\n name == NULL ? \"<stdin>\" : name);\n\n free(source);\n\n return 3;\n\n }\n\n if (skip >= len) {\n\n fprintf(stderr, \"skip request of %d leaves no input\\n\", skip);\n\n free(source);\n\n return 3;\n\n }\n\n\n\n /* test inflate data with offset skip */\n\n len -= skip;\n\n sourcelen = (unsigned long)len;\n\n ret = puff(NIL, &destlen, source + skip, &sourcelen);\n\n if (ret)\n\n fprintf(stderr, \"puff() failed with return code %d\\n\", ret);\n\n else {\n\n fprintf(stderr, \"puff() succeeded uncompressing %lu bytes\\n\", destlen);\n\n if (sourcelen < len) fprintf(stderr, \"%lu compressed bytes unused\\n\",\n\n len - sourcelen);\n\n }\n\n\n\n /* if requested, inflate again and write decompressd data to stdout */\n\n if (put && ret == 0) {\n\n if (fail)\n\n destlen >>= 1;\n\n dest = malloc(destlen);\n\n if (dest == NULL) {\n\n fprintf(stderr, \"memory allocation failure\\n\");\n\n free(source);\n\n return 4;\n\n }\n\n puff(dest, &destlen, source + skip, &sourcelen);\n\n SET_BINARY_MODE(stdout);\n\n fwrite(dest, 1, destlen, stdout);\n\n free(dest);\n\n }\n\n\n\n /* clean up */\n\n free(source);\n\n return ret;\n", "file_path": "ThirdParty/zlib-1.2.7/contrib/puff/pufftest.c", "rank": 27, "score": 97827.28991681694 }, { "content": "int main(int argc, char **argv)\n\n{\n\n#ifndef DOS_OS2_W32\n\n FILE *keybd;\n\n#endif\n\n#ifdef sgi\n\n FILE *tmpfile; /* or we could just use keybd, since no overlap */\n\n char tmpline[80];\n\n#endif\n\n char *inname = NULL, outname[256];\n\n char *p, pnmchar, pnmline[256];\n\n char *bgstr, *textbuf = NULL;\n\n ulg rowbytes;\n\n int rc, len = 0;\n\n int error = 0;\n\n int text = FALSE;\n\n int maxval;\n\n double LUT_exponent; /* just the lookup table */\n\n double CRT_exponent = 2.2; /* just the monitor */\n\n double default_display_exponent; /* whole display system */\n\n double default_gamma = 0.0;\n\n\n\n\n\n wpng_info.infile = NULL;\n\n wpng_info.outfile = NULL;\n\n wpng_info.image_data = NULL;\n\n wpng_info.row_pointers = NULL;\n\n wpng_info.filter = FALSE;\n\n wpng_info.interlaced = FALSE;\n\n wpng_info.have_bg = FALSE;\n\n wpng_info.have_time = FALSE;\n\n wpng_info.have_text = 0;\n\n wpng_info.gamma = 0.0;\n\n\n\n\n\n /* First get the default value for our display-system exponent, i.e.,\n\n * the product of the CRT exponent and the exponent corresponding to\n\n * the frame-buffer's lookup table (LUT), if any. If the PNM image\n\n * looks correct on the user's display system, its file gamma is the\n\n * inverse of this value. (Note that this is not an exhaustive list\n\n * of LUT values--e.g., OpenStep has a lot of weird ones--but it should\n\n * cover 99% of the current possibilities. This section must ensure\n\n * that default_display_exponent is positive.) */\n\n\n\n#if defined(NeXT)\n\n /* third-party utilities can modify the default LUT exponent */\n\n LUT_exponent = 1.0 / 2.2;\n\n /*\n\n if (some_next_function_that_returns_gamma(&next_gamma))\n\n LUT_exponent = 1.0 / next_gamma;\n\n */\n\n#elif defined(sgi)\n\n LUT_exponent = 1.0 / 1.7;\n\n /* there doesn't seem to be any documented function to\n\n * get the \"gamma\" value, so we do it the hard way */\n\n tmpfile = fopen(\"/etc/config/system.glGammaVal\", \"r\");\n\n if (tmpfile) {\n\n double sgi_gamma;\n\n\n\n fgets(tmpline, 80, tmpfile);\n\n fclose(tmpfile);\n\n sgi_gamma = atof(tmpline);\n\n if (sgi_gamma > 0.0)\n\n LUT_exponent = 1.0 / sgi_gamma;\n\n }\n\n#elif defined(Macintosh)\n\n LUT_exponent = 1.8 / 2.61;\n\n /*\n\n if (some_mac_function_that_returns_gamma(&mac_gamma))\n\n LUT_exponent = mac_gamma / 2.61;\n\n */\n\n#else\n\n LUT_exponent = 1.0; /* assume no LUT: most PCs */\n\n#endif\n\n\n\n /* the defaults above give 1.0, 1.3, 1.5 and 2.2, respectively: */\n\n default_display_exponent = LUT_exponent * CRT_exponent;\n\n\n\n\n\n /* If the user has set the SCREEN_GAMMA environment variable as suggested\n\n * (somewhat imprecisely) in the libpng documentation, use that; otherwise\n\n * use the default value we just calculated. Either way, the user may\n\n * override this via a command-line option. */\n\n\n\n if ((p = getenv(\"SCREEN_GAMMA\")) != NULL) {\n\n double exponent = atof(p);\n\n\n\n if (exponent > 0.0)\n\n default_gamma = 1.0 / exponent;\n\n }\n\n\n\n if (default_gamma == 0.0)\n\n default_gamma = 1.0 / default_display_exponent;\n\n\n\n\n\n /* Now parse the command line for options and the PNM filename. */\n\n\n\n while (*++argv && !error) {\n\n if (!strncmp(*argv, \"-i\", 2)) {\n\n wpng_info.interlaced = TRUE;\n\n } else if (!strncmp(*argv, \"-time\", 3)) {\n\n wpng_info.modtime = time(NULL);\n\n wpng_info.have_time = TRUE;\n\n } else if (!strncmp(*argv, \"-text\", 3)) {\n\n text = TRUE;\n\n } else if (!strncmp(*argv, \"-gamma\", 2)) {\n\n if (!*++argv)\n\n ++error;\n\n else {\n\n wpng_info.gamma = atof(*argv);\n\n if (wpng_info.gamma <= 0.0)\n\n ++error;\n\n else if (wpng_info.gamma > 1.01)\n\n fprintf(stderr, PROGNAME\n\n \" warning: file gammas are usually less than 1.0\\n\");\n\n }\n\n } else if (!strncmp(*argv, \"-bgcolor\", 4)) {\n\n if (!*++argv)\n\n ++error;\n\n else {\n\n bgstr = *argv;\n\n if (strlen(bgstr) != 7 || bgstr[0] != '#')\n\n ++error;\n\n else {\n\n unsigned r, g, b; /* this way quiets compiler warnings */\n\n\n\n sscanf(bgstr+1, \"%2x%2x%2x\", &r, &g, &b);\n\n wpng_info.bg_red = (uch)r;\n\n wpng_info.bg_green = (uch)g;\n\n wpng_info.bg_blue = (uch)b;\n\n wpng_info.have_bg = TRUE;\n\n }\n\n }\n\n } else {\n\n if (**argv != '-') {\n\n inname = *argv;\n\n if (argv[1]) /* shouldn't be any more args after filename */\n\n ++error;\n\n } else\n\n ++error; /* not expecting any other options */\n\n }\n\n }\n\n\n\n\n\n /* open the input and output files, or register an error and abort */\n\n\n\n if (!inname) {\n\n if (isatty(0)) {\n\n fprintf(stderr, PROGNAME\n\n \": must give input filename or provide image data via stdin\\n\");\n\n ++error;\n\n } else {\n\n#ifdef DOS_OS2_W32\n\n /* some buggy C libraries require BOTH setmode() and fdopen(bin) */\n\n setmode(fileno(stdin), O_BINARY);\n\n setmode(fileno(stdout), O_BINARY);\n\n#endif\n\n if ((wpng_info.infile = fdopen(fileno(stdin), \"rb\")) == NULL) {\n\n fprintf(stderr, PROGNAME\n\n \": unable to reopen stdin in binary mode\\n\");\n\n ++error;\n\n } else\n\n if ((wpng_info.outfile = fdopen(fileno(stdout), \"wb\")) == NULL) {\n\n fprintf(stderr, PROGNAME\n\n \": unable to reopen stdout in binary mode\\n\");\n\n fclose(wpng_info.infile);\n\n ++error;\n\n } else\n\n wpng_info.filter = TRUE;\n\n }\n\n } else if ((len = strlen(inname)) > 250) {\n\n fprintf(stderr, PROGNAME \": input filename is too long [%d chars]\\n\",\n\n len);\n\n ++error;\n\n } else if (!(wpng_info.infile = fopen(inname, \"rb\"))) {\n\n fprintf(stderr, PROGNAME \": can't open input file [%s]\\n\", inname);\n\n ++error;\n\n }\n\n\n\n if (!error) {\n\n fgets(pnmline, 256, wpng_info.infile);\n\n if (pnmline[0] != 'P' || ((pnmchar = pnmline[1]) != '5' &&\n\n pnmchar != '6' && pnmchar != '8'))\n\n {\n\n fprintf(stderr, PROGNAME\n\n \": input file [%s] is not a binary PGM, PPM or PAM file\\n\",\n\n inname);\n\n ++error;\n\n } else {\n\n wpng_info.pnmtype = (int)(pnmchar - '0');\n\n if (wpng_info.pnmtype != 8)\n\n wpng_info.have_bg = FALSE; /* no need for bg if opaque */\n\n do {\n\n fgets(pnmline, 256, wpng_info.infile); /* lose any comments */\n\n } while (pnmline[0] == '#');\n\n sscanf(pnmline, \"%ld %ld\", &wpng_info.width, &wpng_info.height);\n\n do {\n\n fgets(pnmline, 256, wpng_info.infile); /* more comment lines */\n\n } while (pnmline[0] == '#');\n\n sscanf(pnmline, \"%d\", &maxval);\n\n if (wpng_info.width <= 0L || wpng_info.height <= 0L ||\n\n maxval != 255)\n\n {\n\n fprintf(stderr, PROGNAME\n\n \": only positive width/height, maxval == 255 allowed \\n\");\n\n ++error;\n\n }\n\n wpng_info.sample_depth = 8; /* <==> maxval 255 */\n\n\n\n if (!wpng_info.filter) {\n\n /* make outname from inname */\n\n if ((p = strrchr(inname, '.')) == NULL ||\n\n (p - inname) != (len - 4))\n\n {\n\n strcpy(outname, inname);\n\n strcpy(outname+len, \".png\");\n\n } else {\n\n len -= 4;\n\n strncpy(outname, inname, len);\n\n strcpy(outname+len, \".png\");\n\n }\n\n /* check if outname already exists; if not, open */\n\n if ((wpng_info.outfile = fopen(outname, \"rb\")) != NULL) {\n\n fprintf(stderr, PROGNAME \": output file exists [%s]\\n\",\n\n outname);\n\n fclose(wpng_info.outfile);\n\n ++error;\n\n } else if (!(wpng_info.outfile = fopen(outname, \"wb\"))) {\n\n fprintf(stderr, PROGNAME \": can't open output file [%s]\\n\",\n\n outname);\n\n ++error;\n\n }\n\n }\n\n }\n\n if (error) {\n\n fclose(wpng_info.infile);\n\n wpng_info.infile = NULL;\n\n if (wpng_info.filter) {\n\n fclose(wpng_info.outfile);\n\n wpng_info.outfile = NULL;\n\n }\n\n }\n\n }\n\n\n\n\n\n /* if we had any errors, print usage and die horrible death...arrr! */\n\n\n\n if (error) {\n\n fprintf(stderr, \"\\n%s %s: %s\\n\", PROGNAME, VERSION, APPNAME);\n\n writepng_version_info();\n\n fprintf(stderr, \"\\n\"\n\n\"Usage: %s [-gamma exp] [-bgcolor bg] [-text] [-time] [-interlace] pnmfile\\n\"\n\n\"or: ... | %s [-gamma exp] [-bgcolor bg] [-text] [-time] [-interlace] | ...\\n\"\n\n \" exp \\ttransfer-function exponent (``gamma'') of the image in\\n\"\n\n \"\\t\\t floating-point format (e.g., ``%.5f''); if image looks\\n\"\n\n \"\\t\\t correct on given display system, image gamma is equal to\\n\"\n\n \"\\t\\t inverse of display-system exponent, i.e., 1 / (LUT * CRT)\\n\"\n\n \"\\t\\t (where LUT = lookup-table exponent and CRT = CRT exponent;\\n\"\n\n \"\\t\\t first varies, second is usually 2.2, all are positive)\\n\"\n\n \" bg \\tdesired background color for alpha-channel images, in\\n\"\n\n \"\\t\\t 7-character hex RGB format (e.g., ``#ff7700'' for orange:\\n\"\n\n \"\\t\\t same as HTML colors)\\n\"\n\n \" -text\\tprompt interactively for text info (tEXt chunks)\\n\"\n\n \" -time\\tinclude a tIME chunk (last modification time)\\n\"\n\n \" -interlace\\twrite interlaced PNG image\\n\"\n\n \"\\n\"\n\n\"pnmfile or stdin must be a binary PGM (`P5'), PPM (`P6') or (extremely\\n\"\n\n\"unofficial and unsupported!) PAM (`P8') file. Currently it is required\\n\"\n\n\"to have maxval == 255 (i.e., no scaling). If pnmfile is specified, it\\n\"\n\n\"is converted to the corresponding PNG file with the same base name but a\\n\"\n\n\"``.png'' extension; files read from stdin are converted and sent to stdout.\\n\"\n\n\"The conversion is progressive (low memory usage) unless interlacing is\\n\"\n\n\"requested; in that case the whole image will be buffered in memory and\\n\"\n\n\"written in one call.\\n\"\n\n \"\\n\", PROGNAME, PROGNAME, default_gamma);\n\n exit(1);\n\n }\n\n\n\n\n\n /* prepare the text buffers for libpng's use; note that even though\n\n * PNG's png_text struct includes a length field, we don't have to fill\n\n * it out */\n\n\n\n if (text &&\n\n#ifndef DOS_OS2_W32\n\n (keybd = fdopen(fileno(stderr), \"r\")) != NULL &&\n\n#endif\n\n (textbuf = (char *)malloc((5 + 9)*75)) != NULL)\n\n {\n\n int i, valid, result;\n\n\n\n fprintf(stderr,\n\n \"Enter text info (no more than 72 characters per line);\\n\");\n\n fprintf(stderr, \"to skip a field, hit the <Enter> key.\\n\");\n\n /* note: just <Enter> leaves len == 1 */\n\n\n\n do {\n\n valid = TRUE;\n\n p = textbuf + TEXT_TITLE_OFFSET;\n\n fprintf(stderr, \" Title: \");\n\n fflush(stderr);\n\n if (FGETS(p, 74, keybd) && (len = strlen(p)) > 1) {\n\n if (p[len-1] == '\\n')\n\n p[--len] = '\\0';\n\n wpng_info.title = p;\n\n wpng_info.have_text |= TEXT_TITLE;\n\n if ((result = wpng_isvalid_latin1((uch *)p, len)) >= 0) {\n\n fprintf(stderr, \" \" PROGNAME \" warning: character code\"\n\n \" %u is %sdiscouraged by the PNG\\n specification \"\n\n \"[first occurrence was at character position #%d]\\n\",\n\n (unsigned)p[result], (p[result] == 27)? \"strongly \" : \"\",\n\n result+1);\n\n fflush(stderr);\n\n#ifdef FORBID_LATIN1_CTRL\n\n wpng_info.have_text &= ~TEXT_TITLE;\n\n valid = FALSE;\n\n#else\n\n if (p[result] == 27) { /* escape character */\n\n wpng_info.have_text &= ~TEXT_TITLE;\n\n valid = FALSE;\n\n }\n\n#endif\n\n }\n\n }\n\n } while (!valid);\n\n\n\n do {\n\n valid = TRUE;\n\n p = textbuf + TEXT_AUTHOR_OFFSET;\n\n fprintf(stderr, \" Author: \");\n\n fflush(stderr);\n\n if (FGETS(p, 74, keybd) && (len = strlen(p)) > 1) {\n\n if (p[len-1] == '\\n')\n\n p[--len] = '\\0';\n\n wpng_info.author = p;\n\n wpng_info.have_text |= TEXT_AUTHOR;\n\n if ((result = wpng_isvalid_latin1((uch *)p, len)) >= 0) {\n\n fprintf(stderr, \" \" PROGNAME \" warning: character code\"\n\n \" %u is %sdiscouraged by the PNG\\n specification \"\n\n \"[first occurrence was at character position #%d]\\n\",\n\n (unsigned)p[result], (p[result] == 27)? \"strongly \" : \"\",\n\n result+1);\n\n fflush(stderr);\n\n#ifdef FORBID_LATIN1_CTRL\n\n wpng_info.have_text &= ~TEXT_AUTHOR;\n\n valid = FALSE;\n\n#else\n\n if (p[result] == 27) { /* escape character */\n\n wpng_info.have_text &= ~TEXT_AUTHOR;\n\n valid = FALSE;\n\n }\n\n#endif\n\n }\n\n }\n\n } while (!valid);\n\n\n\n do {\n\n valid = TRUE;\n\n p = textbuf + TEXT_DESC_OFFSET;\n\n fprintf(stderr, \" Description (up to 9 lines):\\n\");\n\n for (i = 1; i < 10; ++i) {\n\n fprintf(stderr, \" [%d] \", i);\n\n fflush(stderr);\n\n if (FGETS(p, 74, keybd) && (len = strlen(p)) > 1)\n\n p += len; /* now points at NULL; char before is newline */\n\n else\n\n break;\n\n }\n\n if ((len = p - (textbuf + TEXT_DESC_OFFSET)) > 1) {\n\n if (p[-1] == '\\n') {\n\n p[-1] = '\\0';\n\n --len;\n\n }\n\n wpng_info.desc = textbuf + TEXT_DESC_OFFSET;\n\n wpng_info.have_text |= TEXT_DESC;\n\n p = textbuf + TEXT_DESC_OFFSET;\n\n if ((result = wpng_isvalid_latin1((uch *)p, len)) >= 0) {\n\n fprintf(stderr, \" \" PROGNAME \" warning: character code\"\n\n \" %u is %sdiscouraged by the PNG\\n specification \"\n\n \"[first occurrence was at character position #%d]\\n\",\n\n (unsigned)p[result], (p[result] == 27)? \"strongly \" : \"\",\n\n result+1);\n\n fflush(stderr);\n\n#ifdef FORBID_LATIN1_CTRL\n\n wpng_info.have_text &= ~TEXT_DESC;\n\n valid = FALSE;\n\n#else\n\n if (p[result] == 27) { /* escape character */\n\n wpng_info.have_text &= ~TEXT_DESC;\n\n valid = FALSE;\n\n }\n\n#endif\n\n }\n\n }\n\n } while (!valid);\n\n\n\n do {\n\n valid = TRUE;\n\n p = textbuf + TEXT_COPY_OFFSET;\n\n fprintf(stderr, \" Copyright: \");\n\n fflush(stderr);\n\n if (FGETS(p, 74, keybd) && (len = strlen(p)) > 1) {\n\n if (p[len-1] == '\\n')\n\n p[--len] = '\\0';\n\n wpng_info.copyright = p;\n\n wpng_info.have_text |= TEXT_COPY;\n\n if ((result = wpng_isvalid_latin1((uch *)p, len)) >= 0) {\n\n fprintf(stderr, \" \" PROGNAME \" warning: character code\"\n\n \" %u is %sdiscouraged by the PNG\\n specification \"\n\n \"[first occurrence was at character position #%d]\\n\",\n\n (unsigned)p[result], (p[result] == 27)? \"strongly \" : \"\",\n\n result+1);\n\n fflush(stderr);\n\n#ifdef FORBID_LATIN1_CTRL\n\n wpng_info.have_text &= ~TEXT_COPY;\n\n valid = FALSE;\n\n#else\n\n if (p[result] == 27) { /* escape character */\n\n wpng_info.have_text &= ~TEXT_COPY;\n\n valid = FALSE;\n\n }\n\n#endif\n\n }\n\n }\n\n } while (!valid);\n\n\n\n do {\n\n valid = TRUE;\n\n p = textbuf + TEXT_EMAIL_OFFSET;\n\n fprintf(stderr, \" E-mail: \");\n\n fflush(stderr);\n\n if (FGETS(p, 74, keybd) && (len = strlen(p)) > 1) {\n\n if (p[len-1] == '\\n')\n\n p[--len] = '\\0';\n\n wpng_info.email = p;\n\n wpng_info.have_text |= TEXT_EMAIL;\n\n if ((result = wpng_isvalid_latin1((uch *)p, len)) >= 0) {\n\n fprintf(stderr, \" \" PROGNAME \" warning: character code\"\n\n \" %u is %sdiscouraged by the PNG\\n specification \"\n\n \"[first occurrence was at character position #%d]\\n\",\n\n (unsigned)p[result], (p[result] == 27)? \"strongly \" : \"\",\n\n result+1);\n\n fflush(stderr);\n\n#ifdef FORBID_LATIN1_CTRL\n\n wpng_info.have_text &= ~TEXT_EMAIL;\n\n valid = FALSE;\n\n#else\n\n if (p[result] == 27) { /* escape character */\n\n wpng_info.have_text &= ~TEXT_EMAIL;\n\n valid = FALSE;\n\n }\n\n#endif\n\n }\n\n }\n\n } while (!valid);\n\n\n\n do {\n\n valid = TRUE;\n\n p = textbuf + TEXT_URL_OFFSET;\n\n fprintf(stderr, \" URL: \");\n\n fflush(stderr);\n\n if (FGETS(p, 74, keybd) && (len = strlen(p)) > 1) {\n\n if (p[len-1] == '\\n')\n\n p[--len] = '\\0';\n\n wpng_info.url = p;\n\n wpng_info.have_text |= TEXT_URL;\n\n if ((result = wpng_isvalid_latin1((uch *)p, len)) >= 0) {\n\n fprintf(stderr, \" \" PROGNAME \" warning: character code\"\n\n \" %u is %sdiscouraged by the PNG\\n specification \"\n\n \"[first occurrence was at character position #%d]\\n\",\n\n (unsigned)p[result], (p[result] == 27)? \"strongly \" : \"\",\n\n result+1);\n\n fflush(stderr);\n\n#ifdef FORBID_LATIN1_CTRL\n\n wpng_info.have_text &= ~TEXT_URL;\n\n valid = FALSE;\n\n#else\n\n if (p[result] == 27) { /* escape character */\n\n wpng_info.have_text &= ~TEXT_URL;\n\n valid = FALSE;\n\n }\n\n#endif\n\n }\n\n }\n\n } while (!valid);\n\n\n\n#ifndef DOS_OS2_W32\n\n fclose(keybd);\n\n#endif\n\n\n\n } else if (text) {\n\n fprintf(stderr, PROGNAME \": unable to allocate memory for text\\n\");\n\n text = FALSE;\n\n wpng_info.have_text = 0;\n\n }\n\n\n\n\n\n /* allocate libpng stuff, initialize transformations, write pre-IDAT data */\n\n\n\n if ((rc = writepng_init(&wpng_info)) != 0) {\n\n switch (rc) {\n\n case 2:\n\n fprintf(stderr, PROGNAME\n\n \": libpng initialization problem (longjmp)\\n\");\n\n break;\n\n case 4:\n\n fprintf(stderr, PROGNAME \": insufficient memory\\n\");\n\n break;\n\n case 11:\n\n fprintf(stderr, PROGNAME\n\n \": internal logic error (unexpected PNM type)\\n\");\n\n break;\n\n default:\n\n fprintf(stderr, PROGNAME\n\n \": unknown writepng_init() error\\n\");\n\n break;\n\n }\n\n exit(rc);\n\n }\n\n\n\n\n\n /* free textbuf, since it's a completely local variable and all text info\n\n * has just been written to the PNG file */\n\n\n\n if (text && textbuf) {\n\n free(textbuf);\n\n textbuf = NULL;\n\n }\n\n\n\n\n\n /* calculate rowbytes on basis of image type; note that this becomes much\n\n * more complicated if we choose to support PBM type, ASCII PNM types, or\n\n * 16-bit-per-sample binary data [currently not an official NetPBM type] */\n\n\n\n if (wpng_info.pnmtype == 5)\n\n rowbytes = wpng_info.width;\n\n else if (wpng_info.pnmtype == 6)\n\n rowbytes = wpng_info.width * 3;\n\n else /* if (wpng_info.pnmtype == 8) */\n\n rowbytes = wpng_info.width * 4;\n\n\n\n\n\n /* read and write the image, either in its entirety (if writing interlaced\n\n * PNG) or row by row (if non-interlaced) */\n\n\n\n fprintf(stderr, \"Encoding image data...\\n\");\n\n fflush(stderr);\n\n\n\n if (wpng_info.interlaced) {\n\n long i;\n\n ulg bytes;\n\n ulg image_bytes = rowbytes * wpng_info.height; /* overflow? */\n\n\n\n wpng_info.image_data = (uch *)malloc(image_bytes);\n\n wpng_info.row_pointers = (uch **)malloc(wpng_info.height*sizeof(uch *));\n\n if (wpng_info.image_data == NULL || wpng_info.row_pointers == NULL) {\n\n fprintf(stderr, PROGNAME \": insufficient memory for image data\\n\");\n\n writepng_cleanup(&wpng_info);\n\n wpng_cleanup();\n\n exit(5);\n\n }\n\n for (i = 0; i < wpng_info.height; ++i)\n\n wpng_info.row_pointers[i] = wpng_info.image_data + i*rowbytes;\n\n bytes = fread(wpng_info.image_data, 1, image_bytes, wpng_info.infile);\n\n if (bytes != image_bytes) {\n\n fprintf(stderr, PROGNAME \": expected %lu bytes, got %lu bytes\\n\",\n\n image_bytes, bytes);\n\n fprintf(stderr, \" (continuing anyway)\\n\");\n\n }\n\n if (writepng_encode_image(&wpng_info) != 0) {\n\n fprintf(stderr, PROGNAME\n\n \": libpng problem (longjmp) while writing image data\\n\");\n\n writepng_cleanup(&wpng_info);\n\n wpng_cleanup();\n\n exit(2);\n\n }\n\n\n\n } else /* not interlaced: write progressively (row by row) */ {\n\n long j;\n\n ulg bytes;\n\n\n\n wpng_info.image_data = (uch *)malloc(rowbytes);\n\n if (wpng_info.image_data == NULL) {\n\n fprintf(stderr, PROGNAME \": insufficient memory for row data\\n\");\n\n writepng_cleanup(&wpng_info);\n\n wpng_cleanup();\n\n exit(5);\n\n }\n\n error = 0;\n\n for (j = wpng_info.height; j > 0L; --j) {\n\n bytes = fread(wpng_info.image_data, 1, rowbytes, wpng_info.infile);\n\n if (bytes != rowbytes) {\n\n fprintf(stderr, PROGNAME\n\n \": expected %lu bytes, got %lu bytes (row %ld)\\n\", rowbytes,\n\n bytes, wpng_info.height-j);\n\n ++error;\n\n break;\n\n }\n\n if (writepng_encode_row(&wpng_info) != 0) {\n\n fprintf(stderr, PROGNAME\n\n \": libpng problem (longjmp) while writing row %ld\\n\",\n\n wpng_info.height-j);\n\n ++error;\n\n break;\n\n }\n\n }\n\n if (error) {\n\n writepng_cleanup(&wpng_info);\n\n wpng_cleanup();\n\n exit(2);\n\n }\n\n if (writepng_encode_finish(&wpng_info) != 0) {\n\n fprintf(stderr, PROGNAME \": error on final libpng call\\n\");\n\n writepng_cleanup(&wpng_info);\n\n wpng_cleanup();\n\n exit(2);\n\n }\n\n }\n\n\n\n\n\n /* OK, we're done (successfully): clean up all resources and quit */\n\n\n\n fprintf(stderr, \"Done.\\n\");\n\n fflush(stderr);\n\n\n\n writepng_cleanup(&wpng_info);\n\n wpng_cleanup();\n\n\n\n return 0;\n", "file_path": "ThirdParty/lpng161/contrib/gregbook/wpng.c", "rank": 28, "score": 97827.28991681694 }, { "content": "int\n\nmain(int argc, const char **argv)\n\n{\n\n FILE *fp;\n\n png_uint_32 default_flags[4/*valid,unknown{before,after}*/];\n\n int strict = 0, default_tests = 0;\n\n const char *count_argv = \"default=save\";\n\n const char *touch_file = NULL;\n\n display d;\n\n\n\n init_display(&d, argv[0]);\n\n\n\n while (++argv, --argc > 0)\n\n {\n\n if (strcmp(*argv, \"--strict\") == 0)\n\n strict = 1;\n\n\n\n else if (strcmp(*argv, \"--default\") == 0)\n\n default_tests = 1;\n\n\n\n else if (strcmp(*argv, \"--touch\") == 0)\n\n {\n\n if (argc > 1)\n\n touch_file = *++argv, --argc;\n\n\n\n else\n\n usage(d.program, \"--touch: missing file name\");\n\n }\n\n\n\n else\n\n break;\n\n }\n\n\n\n /* A file name is required, but there should be no other arguments if\n\n * --default was specified.\n\n */\n\n if (argc <= 0)\n\n usage(d.program, \"missing test file\");\n\n\n\n /* GCC BUG: if (default_tests && argc != 1) triggers some weird GCC argc\n\n * optimization which causes warnings with -Wstrict-overflow!\n\n */\n\n else if (default_tests) if (argc != 1)\n\n usage(d.program, \"extra arguments\");\n\n\n\n# ifndef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED\n\n fprintf(stderr, \"%s: warning: no 'save' support so arguments ignored\\n\",\n\n d.program);\n\n# endif\n\n\n\n /* The name of the test file is the last argument; remove it. */\n\n d.file = argv[--argc];\n\n\n\n fp = fopen(d.file, \"rb\");\n\n if (fp == NULL)\n\n {\n\n perror(d.file);\n\n exit(2);\n\n }\n\n\n\n /* First find all the chunks, known and unknown, in the test file, a failure\n\n * here aborts the whole test.\n\n */\n\n if (check(fp, 1, &count_argv, default_flags, &d) !=\n\n PNG_HANDLE_CHUNK_ALWAYS)\n\n {\n\n fprintf(stderr, \"%s: %s: internal error\\n\", d.program, d.file);\n\n exit(3);\n\n }\n\n\n\n /* Now find what the various supplied options cause to change: */\n\n if (!default_tests)\n\n {\n\n d.test = cmd; /* acts as a flag to say exit, do not longjmp */\n\n perform_one_test(fp, argc, argv, default_flags, &d);\n\n d.test = init;\n\n }\n\n\n\n else\n\n {\n\n const char **test = standard_tests;\n\n\n\n /* Set the exit_test pointer here so we can continue after a libpng error.\n\n * NOTE: this leaks memory because the png_struct data from the failing\n\n * test is never freed.\n\n */\n\n while (*test)\n\n {\n\n const char *this_test = *test++;\n\n const char **next = test;\n\n int count = display_rc(&d, strict), new_count;\n\n const char *result;\n\n int arg_count = 0;\n\n\n\n while (*next) ++next, ++arg_count;\n\n\n\n perform_one_test_safe(fp, arg_count, test, default_flags, &d,\n\n this_test);\n\n\n\n new_count = display_rc(&d, strict);\n\n\n\n if (new_count == count)\n\n result = \"PASS\";\n\n\n\n else\n\n result = \"FAIL\";\n\n\n\n printf(\"%s: %s %s\\n\", result, d.program, this_test);\n\n\n\n test = next+1;\n\n }\n\n }\n\n\n\n fclose(fp);\n\n\n\n if (display_rc(&d, strict) == 0)\n\n {\n\n /* Success, touch the success file if appropriate */\n\n if (touch_file != NULL)\n\n {\n\n FILE *fsuccess = fopen(touch_file, \"wt\");\n\n\n\n if (fsuccess != NULL)\n\n {\n\n int err = 0;\n\n fprintf(fsuccess, \"PNG unknown tests succeeded\\n\");\n\n fflush(fsuccess);\n\n err = ferror(fsuccess);\n\n\n\n if (fclose(fsuccess) || err)\n\n {\n\n fprintf(stderr, \"%s: write failed\\n\", touch_file);\n\n exit(1);\n\n }\n\n }\n\n\n\n else\n\n {\n\n fprintf(stderr, \"%s: open failed\\n\", touch_file);\n\n exit(1);\n\n }\n\n }\n\n\n\n return 0;\n\n }\n\n\n\n return 1;\n", "file_path": "ThirdParty/lpng161/contrib/libtests/pngunknown.c", "rank": 29, "score": 97827.28991681694 }, { "content": "int main(int argc, const char **argv)\n\n{\n\n /* This program uses the default, <setjmp.h> based, libpng error handling\n\n * mechanism, therefore any local variable that exists before the call to\n\n * setjmp and is changed after the call to setjmp returns successfully must\n\n * be declared with 'volatile' to ensure that their values don't get\n\n * destroyed by longjmp:\n\n */\n\n volatile int result = 1/*fail*/;\n\n\n\n if (argc == 4)\n\n {\n\n long x = atol(argv[1]);\n\n long y = atol(argv[2]);\n\n FILE *f = fopen(argv[3], \"rb\");\n\n volatile png_bytep row = NULL;\n\n\n\n if (f != NULL)\n\n {\n\n /* libpng requires a callback function for handling errors; this\n\n * callback must not return. The default callback function uses a\n\n * stored <setjmp.h> style jmp_buf which is held in a png_struct and\n\n * writes error messages to stderr. Creating the png_struct is a\n\n * little tricky; just copy the following code.\n\n */\n\n png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,\n\n NULL, NULL, NULL);\n\n\n\n if (png_ptr != NULL)\n\n {\n\n png_infop info_ptr = png_create_info_struct(png_ptr);\n\n\n\n if (info_ptr != NULL)\n\n {\n\n /* Declare stack variables to hold pointers to locally allocated\n\n * data.\n\n */\n\n\n\n /* Initialize the error control buffer: */\n\n if (setjmp(png_jmpbuf(png_ptr)) == 0)\n\n {\n\n png_uint_32 width, height;\n\n int bit_depth, color_type, interlace_method,\n\n compression_method, filter_method;\n\n png_bytep row_tmp;\n\n\n\n /* Now associate the recently opened (FILE*) with the default\n\n * libpng initialization functions. Sometimes libpng is\n\n * compiled without stdio support (it can be difficult to do\n\n * in some environments); in that case you will have to write\n\n * your own read callback to read data from the (FILE*).\n\n */\n\n png_init_io(png_ptr, f);\n\n\n\n /* And read the first part of the PNG file - the header and\n\n * all the information up to the first pixel.\n\n */\n\n png_read_info(png_ptr, info_ptr);\n\n\n\n /* This fills in enough information to tell us the width of\n\n * each row in bytes, allocate the appropriate amount of\n\n * space. In this case png_malloc is used - it will not\n\n * return if memory isn't available.\n\n */\n\n row = png_malloc(png_ptr, png_get_rowbytes(png_ptr,\n\n info_ptr));\n\n\n\n /* To avoid the overhead of using a volatile auto copy row_tmp\n\n * to a local here - just use row for the png_free below.\n\n */\n\n row_tmp = row;\n\n\n\n /* All the information we need is in the header is returned by\n\n * png_get_IHDR, if this fails we can now use 'png_error' to\n\n * signal the error and return control to the setjmp above.\n\n */\n\n if (png_get_IHDR(png_ptr, info_ptr, &width, &height,\n\n &bit_depth, &color_type, &interlace_method,\n\n &compression_method, &filter_method))\n\n {\n\n int passes, pass;\n\n\n\n /* png_set_interlace_handling returns the number of\n\n * passes required as well as turning on libpng's\n\n * handling, but since we do it ourselves this is\n\n * necessary:\n\n */\n\n switch (interlace_method)\n\n {\n\n case PNG_INTERLACE_NONE:\n\n passes = 1;\n\n break;\n\n\n\n case PNG_INTERLACE_ADAM7:\n\n passes = PNG_INTERLACE_ADAM7_PASSES;\n\n break;\n\n\n\n default:\n\n png_error(png_ptr, \"pngpixel: unknown interlace\");\n\n }\n\n\n\n /* Now read the pixels, pass-by-pass, row-by-row: */\n\n png_start_read_image(png_ptr);\n\n\n\n for (pass=0; pass<passes; ++pass)\n\n {\n\n png_uint_32 ystart, xstart, ystep, xstep;\n\n png_uint_32 py;\n\n\n\n if (interlace_method == PNG_INTERLACE_ADAM7)\n\n {\n\n /* Sometimes the whole pass is empty because the\n\n * image is too narrow or too short. libpng\n\n * expects to be called for each row that is\n\n * present in the pass, so it may be necessary to\n\n * skip the loop below (over py) if the image is\n\n * too narrow.\n\n */\n\n if (PNG_PASS_COLS(width, pass) == 0)\n\n continue;\n\n\n\n /* We need the starting pixel and the offset\n\n * between each pixel in this pass; use the macros\n\n * in png.h:\n\n */\n\n xstart = PNG_PASS_START_COL(pass);\n\n ystart = PNG_PASS_START_ROW(pass);\n\n xstep = PNG_PASS_COL_OFFSET(pass);\n\n ystep = PNG_PASS_ROW_OFFSET(pass);\n\n }\n\n\n\n else\n\n {\n\n ystart = xstart = 0;\n\n ystep = xstep = 1;\n\n }\n\n\n\n /* To find the pixel, loop over 'py' for each pass\n\n * reading a row and then checking to see if it\n\n * contains the pixel.\n\n */\n\n for (py = ystart; py < height; py += ystep)\n\n {\n\n png_uint_32 px, ppx;\n\n\n\n /* png_read_row takes two pointers. When libpng\n\n * handles the interlace the first is filled in\n\n * pixel-by-pixel, and the second receives the same\n\n * pixels but they are replicated across the\n\n * unwritten pixels so far for each pass. When we\n\n * do the interlace, however, they just contain\n\n * the pixels from the interlace pass - giving\n\n * both is wasteful and pointless, so we pass a\n\n * NULL pointer.\n\n */\n\n png_read_row(png_ptr, row_tmp, NULL);\n\n\n\n /* Now find the pixel if it is in this row; there\n\n * are, of course, much better ways of doing this\n\n * than using a for loop:\n\n */\n\n if (y == py) for (px = xstart, ppx = 0;\n\n px < width; px += xstep, ++ppx) if (x == px)\n\n {\n\n /* 'ppx' is the index of the pixel in the row\n\n * buffer.\n\n */\n\n print_pixel(png_ptr, info_ptr, row_tmp, ppx);\n\n\n\n /* Now terminate the loops early - we have\n\n * found and handled the required data.\n\n */\n\n goto pass_loop_end;\n\n } /* x loop */\n\n } /* y loop */\n\n } /* pass loop */\n\n\n\n /* Finally free the temporary buffer: */\n\n pass_loop_end:\n\n row = NULL;\n\n png_free(png_ptr, row_tmp);\n\n }\n\n\n\n else\n\n png_error(png_ptr, \"pngpixel: png_get_IHDR failed\");\n\n\n\n }\n\n\n\n else\n\n {\n\n /* Else libpng has raised an error. An error message has\n\n * already been output, so it is only necessary to clean up\n\n * locally allocated data:\n\n */\n\n if (row != NULL)\n\n {\n\n /* The default implementation of png_free never errors out\n\n * (it just crashes if something goes wrong), but the safe\n\n * way of using it is still to clear 'row' before calling\n\n * png_free:\n\n */\n\n png_bytep row_tmp = row;\n\n row = NULL;\n\n png_free(png_ptr, row_tmp);\n\n }\n\n }\n\n\n\n png_destroy_info_struct(png_ptr, &info_ptr);\n\n }\n\n\n\n else\n\n fprintf(stderr, \"pngpixel: out of memory allocating png_info\\n\");\n\n\n\n png_destroy_read_struct(&png_ptr, NULL, NULL);\n\n }\n\n\n\n else\n\n fprintf(stderr, \"pngpixel: out of memory allocating png_struct\\n\");\n\n }\n\n\n\n else\n\n fprintf(stderr, \"pngpixel: %s: could not open file\\n\", argv[3]);\n\n }\n\n\n\n else\n\n /* Wrong number of arguments */\n\n fprintf(stderr, \"pngpixel: usage: pngpixel x y png-file\\n\");\n\n\n\n return result;\n", "file_path": "ThirdParty/lpng161/contrib/examples/pngpixel.c", "rank": 30, "score": 97827.28991681694 }, { "content": "int\n\nmain(void)\n\n{\n\n /* Exit code 0 on success. */\n\n return !read_png(stdin);\n", "file_path": "ThirdParty/lpng161/contrib/libtests/readpng.c", "rank": 31, "score": 97827.28991681694 }, { "content": "", "file_path": "ThirdParty/lpng161/contrib/gregbook/rpng2-x.c", "rank": 32, "score": 97827.28991681694 }, { "content": "int main OF((int, char **));\n", "file_path": "ThirdParty/zlib-1.2.7/contrib/untgz/untgz.c", "rank": 33, "score": 97827.28991681694 }, { "content": "int main(int argc, char *argv[])\n\n{\n\n int BlockSizeCompress=0x8000;\n\n int BlockSizeUncompress=0x8000;\n\n int cprLevel=Z_DEFAULT_COMPRESSION ;\n\n long lFileSize;\n\n unsigned char* FilePtr;\n\n long lBufferSizeCpr;\n\n long lBufferSizeUncpr;\n\n long lCompressedSize=0;\n\n unsigned char* CprPtr;\n\n unsigned char* UncprPtr;\n\n long lSizeCpr,lSizeUncpr;\n\n DWORD dwGetTick,dwMsecQP;\n\n LARGE_INTEGER li_qp,li_rdtsc,dwResRdtsc;\n\n\n\n if (argc<=1)\n\n {\n\n printf(\"run TestZlib <File> [BlockSizeCompress] [BlockSizeUncompress] [compres. level]\\n\");\n\n return 0;\n\n }\n\n\n\n if (ReadFileMemory(argv[1],&lFileSize,&FilePtr)==0)\n\n {\n\n printf(\"error reading %s\\n\",argv[1]);\n\n return 1;\n\n }\n\n else printf(\"file %s read, %u bytes\\n\",argv[1],lFileSize);\n\n\n\n if (argc>=3)\n\n BlockSizeCompress=atol(argv[2]);\n\n\n\n if (argc>=4)\n\n BlockSizeUncompress=atol(argv[3]);\n\n\n\n if (argc>=5)\n\n cprLevel=(int)atol(argv[4]);\n\n\n\n lBufferSizeCpr = lFileSize + (lFileSize/0x10) + 0x200;\n\n lBufferSizeUncpr = lBufferSizeCpr;\n\n\n\n CprPtr=(unsigned char*)malloc(lBufferSizeCpr + BlockSizeCompress);\n\n\n\n BeginCountPerfCounter(&li_qp,TRUE);\n\n dwGetTick=GetTickCount();\n\n BeginCountRdtsc(&li_rdtsc);\n\n {\n\n z_stream zcpr;\n\n int ret=Z_OK;\n\n long lOrigToDo = lFileSize;\n\n long lOrigDone = 0;\n\n int step=0;\n\n memset(&zcpr,0,sizeof(z_stream));\n\n deflateInit(&zcpr,cprLevel);\n\n\n\n zcpr.next_in = FilePtr;\n\n zcpr.next_out = CprPtr;\n\n\n\n\n\n do\n\n {\n\n long all_read_before = zcpr.total_in;\n\n zcpr.avail_in = min(lOrigToDo,BlockSizeCompress);\n\n zcpr.avail_out = BlockSizeCompress;\n\n ret=deflate(&zcpr,(zcpr.avail_in==lOrigToDo) ? Z_FINISH : Z_SYNC_FLUSH);\n\n lOrigDone += (zcpr.total_in-all_read_before);\n\n lOrigToDo -= (zcpr.total_in-all_read_before);\n\n step++;\n\n } while (ret==Z_OK);\n\n\n\n lSizeCpr=zcpr.total_out;\n\n deflateEnd(&zcpr);\n\n dwGetTick=GetTickCount()-dwGetTick;\n\n dwMsecQP=GetMsecSincePerfCounter(li_qp,TRUE);\n\n dwResRdtsc=GetResRdtsc(li_rdtsc,TRUE);\n\n printf(\"total compress size = %u, in %u step\\n\",lSizeCpr,step);\n\n printf(\"time = %u msec = %f sec\\n\",dwGetTick,dwGetTick/(double)1000.);\n\n printf(\"defcpr time QP = %u msec = %f sec\\n\",dwMsecQP,dwMsecQP/(double)1000.);\n\n printf(\"defcpr result rdtsc = %I64x\\n\\n\",dwResRdtsc.QuadPart);\n\n }\n\n\n\n CprPtr=(unsigned char*)realloc(CprPtr,lSizeCpr);\n\n UncprPtr=(unsigned char*)malloc(lBufferSizeUncpr + BlockSizeUncompress);\n\n\n\n BeginCountPerfCounter(&li_qp,TRUE);\n\n dwGetTick=GetTickCount();\n\n BeginCountRdtsc(&li_rdtsc);\n\n {\n\n z_stream zcpr;\n\n int ret=Z_OK;\n\n long lOrigToDo = lSizeCpr;\n\n long lOrigDone = 0;\n\n int step=0;\n\n memset(&zcpr,0,sizeof(z_stream));\n\n inflateInit(&zcpr);\n\n\n\n zcpr.next_in = CprPtr;\n\n zcpr.next_out = UncprPtr;\n\n\n\n\n\n do\n\n {\n\n long all_read_before = zcpr.total_in;\n\n zcpr.avail_in = min(lOrigToDo,BlockSizeUncompress);\n\n zcpr.avail_out = BlockSizeUncompress;\n\n ret=inflate(&zcpr,Z_SYNC_FLUSH);\n\n lOrigDone += (zcpr.total_in-all_read_before);\n\n lOrigToDo -= (zcpr.total_in-all_read_before);\n\n step++;\n\n } while (ret==Z_OK);\n\n\n\n lSizeUncpr=zcpr.total_out;\n\n inflateEnd(&zcpr);\n\n dwGetTick=GetTickCount()-dwGetTick;\n\n dwMsecQP=GetMsecSincePerfCounter(li_qp,TRUE);\n\n dwResRdtsc=GetResRdtsc(li_rdtsc,TRUE);\n\n printf(\"total uncompress size = %u, in %u step\\n\",lSizeUncpr,step);\n\n printf(\"time = %u msec = %f sec\\n\",dwGetTick,dwGetTick/(double)1000.);\n\n printf(\"uncpr time QP = %u msec = %f sec\\n\",dwMsecQP,dwMsecQP/(double)1000.);\n\n printf(\"uncpr result rdtsc = %I64x\\n\\n\",dwResRdtsc.QuadPart);\n\n }\n\n\n\n if (lSizeUncpr==lFileSize)\n\n {\n\n if (memcmp(FilePtr,UncprPtr,lFileSize)==0)\n\n printf(\"compare ok\\n\");\n\n\n\n }\n\n\n\n return 0;\n", "file_path": "ThirdParty/zlib-1.2.7/contrib/testzlib/testzlib.c", "rank": 34, "score": 97827.28991681694 }, { "content": "int main(void)\n\n{\n\n int ret, n;\n\n\n\n /* decompress to stdout */\n\n ret = blast(inf, stdin, outf, stdout);\n\n if (ret != 0) fprintf(stderr, \"blast error: %d\\n\", ret);\n\n\n\n /* see if there are any leftover bytes */\n\n n = 0;\n\n while (getchar() != EOF) n++;\n\n if (n) fprintf(stderr, \"blast warning: %d unused bytes of input\\n\", n);\n\n\n\n /* return blast() error code */\n\n return ret;\n", "file_path": "ThirdParty/zlib-1.2.7/contrib/blast/blast.c", "rank": 35, "score": 97827.28991681694 }, { "content": "int main(int argc, char **argv)\n\n{\n\n int count = COUNT;\n\n\n\n while (argc > 1)\n\n {\n\n if (argc > 2 && strcmp(argv[1], \"-c\") == 0)\n\n {\n\n count = atoi(argv[2]);\n\n argc -= 2;\n\n argv += 2;\n\n }\n\n\n\n else if (strcmp(argv[1], \"-v\") == 0)\n\n {\n\n ++verbose;\n\n --argc;\n\n ++argv;\n\n }\n\n\n\n else\n\n break;\n\n }\n\n\n\n if (count > 0 && argc > 1)\n\n {\n\n if (strcmp(argv[1], \"ascii\") == 0)\n\n return validation_ascii_to_fp(count, argc-1, argv+1);\n\n else if (strcmp(argv[1], \"checkfp\") == 0)\n\n return validation_checkfp(count, argc-1, argv+1);\n\n else if (strcmp(argv[1], \"muldiv\") == 0)\n\n return validation_muldiv(count, argc-1, argv+1);\n\n else if (strcmp(argv[1], \"gamma\") == 0)\n\n return validation_gamma(argc-1, argv+1);\n\n }\n\n\n\n /* Bad argument: */\n\n fprintf(stderr,\n\n \"usage: tarith [-v] [-c count] {ascii,muldiv,gamma} [args]\\n\");\n\n fprintf(stderr, \" arguments: ascii [-a (all results)] [-e error%%]\\n\");\n\n fprintf(stderr, \" checkfp [-l max-number-chars]\\n\");\n\n fprintf(stderr, \" muldiv\\n\");\n\n fprintf(stderr, \" gamma -s (silent) -g (only gamma; no log)\\n\");\n\n return 1;\n", "file_path": "ThirdParty/lpng161/contrib/libtests/tarith.c", "rank": 36, "score": 97827.28991681694 }, { "content": "", "file_path": "ThirdParty/lpng161/contrib/gregbook/rpng-x.c", "rank": 37, "score": 97827.28991681694 }, { "content": "int\n\nmain(int argc, char **argv)\n\n{\n\n int i;\n\n int extracted = 0;\n\n\n\n for (i=1; i<argc; ++i)\n\n {\n\n if (strcmp(argv[i], \"-q\") == 0)\n\n verbose = 0;\n\n\n\n else if (extract_one_file(argv[i]))\n\n extracted = 1;\n\n }\n\n\n\n /* Exit code is true if any extract succeeds */\n\n return extracted == 0;\n", "file_path": "ThirdParty/lpng161/contrib/examples/iccfrompng.c", "rank": 38, "score": 97827.28991681694 }, { "content": "int\n\nmain(int argc, char **argv)\n\n{\n\n png_uint_32 opts = FAST_WRITE;\n\n format_list formats;\n\n const char *touch = NULL;\n\n int log_pass = 0;\n\n int redundant = 0;\n\n int stride_extra = 0;\n\n int retval = 0;\n\n int c;\n\n\n\n init_sRGB_to_d();\n\n#if 0\n\n init_error_via_linear();\n\n#endif\n\n format_init(&formats);\n\n\n\n for (c=1; c<argc; ++c)\n\n {\n\n const char *arg = argv[c];\n\n\n\n if (strcmp(arg, \"--log\") == 0)\n\n log_pass = 1;\n\n else if (strcmp(arg, \"--fresh\") == 0)\n\n {\n\n memset(gpc_error, 0, sizeof gpc_error);\n\n memset(gpc_error_via_linear, 0, sizeof gpc_error_via_linear);\n\n }\n\n else if (strcmp(arg, \"--file\") == 0)\n\n opts |= READ_FILE;\n\n else if (strcmp(arg, \"--memory\") == 0)\n\n opts &= ~READ_FILE;\n\n else if (strcmp(arg, \"--stdio\") == 0)\n\n opts |= USE_STDIO;\n\n else if (strcmp(arg, \"--name\") == 0)\n\n opts &= ~USE_STDIO;\n\n else if (strcmp(arg, \"--verbose\") == 0)\n\n opts |= VERBOSE;\n\n else if (strcmp(arg, \"--quiet\") == 0)\n\n opts &= ~VERBOSE;\n\n else if (strcmp(arg, \"--preserve\") == 0)\n\n opts |= KEEP_TMPFILES;\n\n else if (strcmp(arg, \"--nopreserve\") == 0)\n\n opts &= ~KEEP_TMPFILES;\n\n else if (strcmp(arg, \"--keep-going\") == 0)\n\n opts |= KEEP_GOING;\n\n else if (strcmp(arg, \"--fast\") == 0)\n\n opts |= FAST_WRITE;\n\n else if (strcmp(arg, \"--slow\") == 0)\n\n opts &= ~FAST_WRITE;\n\n else if (strcmp(arg, \"--accumulate\") == 0)\n\n opts |= ACCUMULATE;\n\n else if (strcmp(arg, \"--redundant\") == 0)\n\n redundant = 1;\n\n else if (strcmp(arg, \"--stop\") == 0)\n\n opts &= ~KEEP_GOING;\n\n else if (strcmp(arg, \"--strict\") == 0)\n\n opts |= STRICT;\n\n else if (strcmp(arg, \"--sRGB-16bit\") == 0)\n\n opts |= sRGB_16BIT;\n\n else if (strcmp(arg, \"--linear-16bit\") == 0)\n\n opts &= ~sRGB_16BIT;\n\n else if (strcmp(arg, \"--tmpfile\") == 0)\n\n {\n\n if (c+1 < argc)\n\n {\n\n if (strlen(argv[++c]) >= sizeof tmpf)\n\n {\n\n fflush(stdout);\n\n fprintf(stderr, \"%s: %s is too long for a temp file prefix\\n\",\n\n argv[0], argv[c]);\n\n exit(99);\n\n }\n\n\n\n /* Safe: checked above */\n\n strcpy(tmpf, argv[c]);\n\n }\n\n\n\n else\n\n {\n\n fflush(stdout);\n\n fprintf(stderr, \"%s: %s requires a temporary file prefix\\n\",\n\n argv[0], arg);\n\n exit(99);\n\n }\n\n }\n\n else if (strcmp(arg, \"--touch\") == 0)\n\n {\n\n if (c+1 < argc)\n\n touch = argv[++c];\n\n\n\n else\n\n {\n\n fflush(stdout);\n\n fprintf(stderr, \"%s: %s requires a file name argument\\n\",\n\n argv[0], arg);\n\n exit(99);\n\n }\n\n }\n\n else if (arg[0] == '+')\n\n {\n\n png_uint_32 format = formatof(arg+1);\n\n\n\n if (format > FORMAT_COUNT)\n\n exit(99);\n\n\n\n format_set(&formats, format);\n\n }\n\n else if (arg[0] == '-' && arg[1] != 0 && (arg[1] != '0' || arg[2] != 0))\n\n {\n\n fflush(stdout);\n\n fprintf(stderr, \"%s: unknown option: %s\\n\", argv[0], arg);\n\n exit(99);\n\n }\n\n else\n\n {\n\n if (format_is_initial(&formats))\n\n format_default(&formats, redundant);\n\n\n\n if (arg[0] == '-')\n\n {\n\n const int term = (arg[1] == '0' ? 0 : '\\n');\n\n unsigned int ich = 0;\n\n\n\n /* Loop reading files, use a static buffer to simplify this and just\n\n * stop if the name gets to long.\n\n */\n\n static char buffer[4096];\n\n\n\n do\n\n {\n\n int ch = getchar();\n\n\n\n /* Don't allow '\\0' in file names, and terminate with '\\n' or,\n\n * for -0, just '\\0' (use -print0 to find to make this work!)\n\n */\n\n if (ch == EOF || ch == term || ch == 0)\n\n {\n\n buffer[ich] = 0;\n\n\n\n if (ich > 0 && !test_one_file(buffer, &formats, opts,\n\n stride_extra, log_pass))\n\n retval = 1;\n\n\n\n if (ch == EOF)\n\n break;\n\n\n\n ich = 0;\n\n --ich; /* so that the increment below sets it to 0 again */\n\n }\n\n\n\n else\n\n buffer[ich] = (char)ch;\n\n } while (++ich < sizeof buffer);\n\n\n\n if (ich)\n\n {\n\n buffer[32] = 0;\n\n buffer[4095] = 0;\n\n fprintf(stderr, \"%s...%s: file name too long\\n\", buffer,\n\n buffer+(4096-32));\n\n exit(99);\n\n }\n\n }\n\n\n\n else if (!test_one_file(arg, &formats, opts, stride_extra, log_pass))\n\n retval = 1;\n\n }\n\n }\n\n\n\n if (opts & ACCUMULATE)\n\n {\n\n unsigned int in;\n\n\n\n printf(\"static png_uint_16 gpc_error[16/*in*/][16/*out*/][4/*a*/] =\\n\");\n\n printf(\"{\\n\");\n\n for (in=0; in<16; ++in)\n\n {\n\n unsigned int out;\n\n printf(\" { /* input: %s */\\n \", format_names[in]);\n\n for (out=0; out<16; ++out)\n\n {\n\n unsigned int alpha;\n\n printf(\" {\");\n\n for (alpha=0; alpha<4; ++alpha)\n\n {\n\n printf(\" %d\", gpc_error[in][out][alpha]);\n\n if (alpha < 3) putchar(',');\n\n }\n\n printf(\" }\");\n\n if (out < 15)\n\n {\n\n putchar(',');\n\n if (out % 4 == 3) printf(\"\\n \");\n\n }\n\n }\n\n printf(\"\\n }\");\n\n\n\n if (in < 15)\n\n putchar(',');\n\n else\n\n putchar('\\n');\n\n }\n\n printf(\"};\\n\");\n\n\n\n printf(\"static png_uint_16 gpc_error_via_linear[16][4/*out*/][4] =\\n\");\n\n printf(\"{\\n\");\n\n for (in=0; in<16; ++in)\n\n {\n\n unsigned int out;\n\n printf(\" { /* input: %s */\\n \", format_names[in]);\n\n for (out=0; out<4; ++out)\n\n {\n\n unsigned int alpha;\n\n printf(\" {\");\n\n for (alpha=0; alpha<4; ++alpha)\n\n {\n\n printf(\" %d\", gpc_error_via_linear[in][out][alpha]);\n\n if (alpha < 3) putchar(',');\n\n }\n\n printf(\" }\");\n\n if (out < 3)\n\n putchar(',');\n\n }\n\n printf(\"\\n }\");\n\n\n\n if (in < 15)\n\n putchar(',');\n\n else\n\n putchar('\\n');\n\n }\n\n printf(\"};\\n\");\n\n\n\n printf(\"static png_uint_16 gpc_error_to_colormap[8/*i*/][8/*o*/][4] =\\n\");\n\n printf(\"{\\n\");\n\n for (in=0; in<8; ++in)\n\n {\n\n unsigned int out;\n\n printf(\" { /* input: %s */\\n \", format_names[in]);\n\n for (out=0; out<8; ++out)\n\n {\n\n unsigned int alpha;\n\n printf(\" {\");\n\n for (alpha=0; alpha<4; ++alpha)\n\n {\n\n printf(\" %d\", gpc_error_to_colormap[in][out][alpha]);\n\n if (alpha < 3) putchar(',');\n\n }\n\n printf(\" }\");\n\n if (out < 7)\n\n {\n\n putchar(',');\n\n if (out % 4 == 3) printf(\"\\n \");\n\n }\n\n }\n\n printf(\"\\n }\");\n\n\n\n if (in < 7)\n\n putchar(',');\n\n else\n\n putchar('\\n');\n\n }\n\n printf(\"};\\n\");\n\n }\n\n\n\n if (retval == 0 && touch != NULL)\n\n {\n\n FILE *fsuccess = fopen(touch, \"wt\");\n\n\n\n if (fsuccess != NULL)\n\n {\n\n int error = 0;\n\n fprintf(fsuccess, \"PNG simple API tests succeeded\\n\");\n\n fflush(fsuccess);\n\n error = ferror(fsuccess);\n\n\n\n if (fclose(fsuccess) || error)\n\n {\n\n fflush(stdout);\n\n fprintf(stderr, \"%s: write failed\\n\", touch);\n\n exit(99);\n\n }\n\n }\n\n\n\n else\n\n {\n\n fflush(stdout);\n\n fprintf(stderr, \"%s: open failed\\n\", touch);\n\n exit(99);\n\n }\n\n }\n\n\n\n return retval;\n", "file_path": "ThirdParty/lpng161/contrib/libtests/pngstest.c", "rank": 39, "score": 97827.28991681694 }, { "content": "int\n\nmain(int argc, char **argv)\n\n{\n\n FILE *fp = stdout;\n\n const char *file_name = NULL;\n\n int color_type = 8; /* invalid */\n\n int bit_depth = 32; /* invalid */\n\n unsigned int colors[5];\n\n unsigned int filters = PNG_ALL_FILTERS;\n\n png_fixed_point gamma = 0; /* not set */\n\n chunk_insert *head_insert = NULL;\n\n chunk_insert **insert_ptr = &head_insert;\n\n\n\n memset(colors, 0, sizeof colors);\n\n\n\n while (--argc > 0)\n\n {\n\n char *arg = *++argv;\n\n\n\n if (strcmp(arg, \"--sRGB\") == 0)\n\n {\n\n gamma = PNG_DEFAULT_sRGB;\n\n continue;\n\n }\n\n\n\n if (strcmp(arg, \"--linear\") == 0)\n\n {\n\n gamma = PNG_FP_1;\n\n continue;\n\n }\n\n\n\n if (strcmp(arg, \"--1.8\") == 0)\n\n {\n\n gamma = PNG_GAMMA_MAC_18;\n\n continue;\n\n }\n\n\n\n if (strcmp(arg, \"--nofilters\") == 0)\n\n {\n\n filters = PNG_FILTER_NONE;\n\n continue;\n\n }\n\n\n\n if (strncmp(arg, \"--color=\", 8) == 0)\n\n {\n\n parse_color(arg+8, colors);\n\n continue;\n\n }\n\n\n\n if (argc >= 3 && strcmp(arg, \"--insert\") == 0)\n\n {\n\n png_const_charp what = *++argv;\n\n png_charp param = *++argv;\n\n chunk_insert *new_insert;\n\n\n\n argc -= 2;\n\n\n\n new_insert = find_insert(what, param);\n\n\n\n if (new_insert != NULL)\n\n {\n\n *insert_ptr = new_insert;\n\n insert_ptr = &new_insert->next;\n\n }\n\n\n\n continue;\n\n }\n\n\n\n if (arg[0] == '-')\n\n {\n\n fprintf(stderr, \"makepng: %s: invalid option\\n\", arg);\n\n exit(1);\n\n }\n\n\n\n if (strcmp(arg, \"palette\") == 0)\n\n {\n\n color_type = PNG_COLOR_TYPE_PALETTE;\n\n continue;\n\n }\n\n\n\n if (strncmp(arg, \"gray\", 4) == 0)\n\n {\n\n if (arg[4] == 0)\n\n {\n\n color_type = PNG_COLOR_TYPE_GRAY;\n\n continue;\n\n }\n\n\n\n else if (strcmp(arg+4, \"a\") == 0 ||\n\n strcmp(arg+4, \"alpha\") == 0 ||\n\n strcmp(arg+4, \"-alpha\") == 0)\n\n {\n\n color_type = PNG_COLOR_TYPE_GRAY_ALPHA;\n\n continue;\n\n }\n\n }\n\n\n\n if (strncmp(arg, \"rgb\", 3) == 0)\n\n {\n\n if (arg[3] == 0)\n\n {\n\n color_type = PNG_COLOR_TYPE_RGB;\n\n continue;\n\n }\n\n\n\n else if (strcmp(arg+3, \"a\") == 0 ||\n\n strcmp(arg+3, \"alpha\") == 0 ||\n\n strcmp(arg+3, \"-alpha\") == 0)\n\n {\n\n color_type = PNG_COLOR_TYPE_RGB_ALPHA;\n\n continue;\n\n }\n\n }\n\n\n\n if (color_type == 8 && isdigit(arg[0]))\n\n {\n\n color_type = atoi(arg);\n\n if (color_type < 0 || color_type > 6 || color_type == 1 ||\n\n color_type == 5)\n\n {\n\n fprintf(stderr, \"makepng: %s: not a valid color type\\n\", arg);\n\n exit(1);\n\n }\n\n\n\n continue;\n\n }\n\n\n\n if (bit_depth == 32 && isdigit(arg[0]))\n\n {\n\n bit_depth = atoi(arg);\n\n if (bit_depth <= 0 || bit_depth > 16 ||\n\n (bit_depth & -bit_depth) != bit_depth)\n\n {\n\n fprintf(stderr, \"makepng: %s: not a valid bit depth\\n\", arg);\n\n exit(1);\n\n }\n\n\n\n continue;\n\n }\n\n\n\n if (argc == 1) /* It's the file name */\n\n {\n\n fp = fopen(arg, \"wb\");\n\n if (fp == NULL)\n\n {\n\n fprintf(stderr, \"%s: %s: could not open\\n\", arg, strerror(errno));\n\n exit(1);\n\n }\n\n\n\n file_name = arg;\n\n continue;\n\n }\n\n\n\n fprintf(stderr, \"makepng: %s: unknown argument\\n\", arg);\n\n exit(1);\n\n } /* argument while loop */\n\n\n\n if (color_type == 8 || bit_depth == 32)\n\n {\n\n fprintf(stderr, \"usage: makepng [--sRGB|--linear|--1.8] \"\n\n \"[--color=...] color-type bit-depth [file-name]\\n\"\n\n \" Make a test PNG file, by default writes to stdout.\\n\");\n\n exit(1);\n\n }\n\n\n\n /* Check the colors */\n\n {\n\n const unsigned int lim = (color_type == PNG_COLOR_TYPE_PALETTE ? 255U :\n\n (1U<<bit_depth)-1);\n\n unsigned int i;\n\n\n\n for (i=1; i<=colors[0]; ++i)\n\n if (colors[i] > lim)\n\n {\n\n fprintf(stderr, \"makepng: --color=...: %u out of range [0..%u]\\n\",\n\n colors[i], lim);\n\n exit(1);\n\n }\n\n }\n\n\n\n /* Restrict the filters for more speed to those we know are used for the\n\n * generated images.\n\n */\n\n if (filters == PNG_ALL_FILTERS)\n\n {\n\n if ((color_type & PNG_COLOR_MASK_PALETTE) != 0 || bit_depth < 8)\n\n filters = PNG_FILTER_NONE;\n\n\n\n else if (color_type & PNG_COLOR_MASK_COLOR) /* rgb */\n\n {\n\n if (bit_depth == 8)\n\n filters &= ~(PNG_FILTER_NONE | PNG_FILTER_AVG);\n\n\n\n else\n\n filters = PNG_FILTER_SUB | PNG_FILTER_PAETH;\n\n }\n\n\n\n else /* gray 8 or 16-bit */\n\n filters &= ~PNG_FILTER_NONE;\n\n }\n\n\n\n {\n\n int ret = write_png(&file_name, fp, color_type, bit_depth, gamma,\n\n head_insert, filters, colors);\n\n\n\n if (ret != 0 && file_name != NULL)\n\n remove(file_name);\n\n\n\n return ret;\n\n }\n", "file_path": "ThirdParty/lpng161/contrib/libtests/makepng.c", "rank": 40, "score": 97827.28991681694 }, { "content": "int\n\nmain(void)\n\n{\n\n fwrite(signature, sizeof signature, 1, stdout);\n\n put_chunk(IHDR, sizeof IHDR);\n\n\n\n for(;;)\n\n put_chunk(unknown, sizeof unknown);\n", "file_path": "ThirdParty/lpng161/contrib/libtests/fakepng.c", "rank": 41, "score": 97827.28991681694 }, { "content": "int\n\nmain(int argc, char **argv)\n\n{\n\n unsigned int i, i16, ibase;\n\n double min_error = 0;\n\n double max_error = 0;\n\n double min_error16 = 0;\n\n double max_error16 = 0;\n\n double adjust;\n\n double adjust_lo = 0.4, adjust_hi = 0.6, adjust_mid = 0.5;\n\n unsigned int ec_lo = 0, ec_hi = 0, ec_mid = 0;\n\n unsigned int error_count = 0;\n\n unsigned int error_count16 = 0;\n\n int test_only = 0;\n\n\n\n if (argc > 1)\n\n test_only = strcmp(\"--test\", argv[1]) == 0;\n\n\n\n /* Initialize the encoding table first. */\n\n for (i=0; i<256; ++i)\n\n {\n\n png_sRGB_table[i] = invsRGB(i);\n\n }\n\n\n\n /* Now work out the decoding tables (this is where the error comes in because\n\n * there are 512 set points and 512 straight lines between them.)\n\n */\n\n for (;;)\n\n {\n\n if (ec_lo == 0)\n\n adjust = adjust_lo;\n\n\n\n else if (ec_hi == 0)\n\n adjust = adjust_hi;\n\n\n\n else if (ec_mid == 0)\n\n adjust = adjust_mid;\n\n\n\n else if (ec_mid < ec_hi)\n\n adjust = (adjust_mid + adjust_hi)/2;\n\n\n\n else if (ec_mid < ec_lo)\n\n adjust = (adjust_mid + adjust_lo)/2;\n\n\n\n else\n\n {\n\n fprintf(stderr, \"not reached: %u .. %u .. %u\\n\", ec_lo, ec_mid, ec_hi);\n\n exit(1);\n\n }\n\n\n\n /* Calculate the table using the current 'adjust' */\n\n for (i=0; i<=511; ++i)\n\n {\n\n double lo = 255 * sRGB(i << 15);\n\n double hi = 255 * sRGB((i+1) << 15);\n\n unsigned int calc;\n\n\n\n calc = nearbyint((lo+adjust) * 256);\n\n if (calc > 65535)\n\n {\n\n fprintf(stderr, \"table[%d][0]: overflow %08x (%d)\\n\", i, calc,\n\n calc);\n\n exit(1);\n\n }\n\n png_sRGB_base[i] = calc;\n\n\n\n calc = nearbyint((hi-lo) * 32);\n\n if (calc > 255)\n\n {\n\n fprintf(stderr, \"table[%d][1]: overflow %08x (%d)\\n\", i, calc,\n\n calc);\n\n exit(1);\n\n }\n\n png_sRGB_delta[i] = calc;\n\n }\n\n\n\n /* Check the 16-bit linear values alone: */\n\n error_count16 = 0;\n\n for (i16=0; i16 <= 65535; ++i16)\n\n {\n\n unsigned int i = 255*i16;\n\n unsigned int iexact = nearbyint(255*sRGB(i));\n\n unsigned int icalc = PNG_sRGB_FROM_LINEAR(i);\n\n\n\n if (icalc != iexact)\n\n ++error_count16;\n\n }\n\n\n\n /* Now try changing the adjustment. */\n\n if (ec_lo == 0)\n\n ec_lo = error_count16;\n\n\n\n else if (ec_hi == 0)\n\n ec_hi = error_count16;\n\n\n\n else if (ec_mid == 0)\n\n {\n\n ec_mid = error_count16;\n\n printf(\"/* initial error counts: %u .. %u .. %u */\\n\", ec_lo, ec_mid,\n\n ec_hi);\n\n }\n\n\n\n else if (error_count16 < ec_mid)\n\n {\n\n printf(\"/* adjust (mid ): %f: %u -> %u */\\n\", adjust, ec_mid,\n\n error_count16);\n\n ec_mid = error_count16;\n\n adjust_mid = adjust;\n\n }\n\n\n\n else if (adjust < adjust_mid && error_count16 < ec_lo)\n\n {\n\n printf(\"/* adjust (low ): %f: %u -> %u */\\n\", adjust, ec_lo,\n\n error_count16);\n\n ec_lo = error_count16;\n\n adjust_lo = adjust;\n\n }\n\n\n\n else if (adjust > adjust_mid && error_count16 < ec_hi)\n\n {\n\n printf(\"/* adjust (high): %f: %u -> %u */\\n\", adjust, ec_hi,\n\n error_count16);\n\n ec_hi = error_count16;\n\n adjust_hi = adjust;\n\n }\n\n\n\n else\n\n {\n\n adjust = adjust_mid;\n\n printf(\"/* adjust: %f: %u */\\n\", adjust, ec_mid);\n\n break;\n\n }\n\n }\n\n\n\n /* For each entry in the table try to adjust it to minimize the error count\n\n * in that entry. Each entry corresponds to 128 input values.\n\n */\n\n for (ibase=0; ibase<65536; ibase+=128)\n\n {\n\n png_uint_16 base = png_sRGB_base[ibase >> 7], trybase = base, ob=base;\n\n png_byte delta = png_sRGB_delta[ibase >> 7], trydelta = delta, od=delta;\n\n unsigned int ecbase = 0, eco;\n\n\n\n for (;;)\n\n {\n\n png_sRGB_base[ibase >> 7] = trybase;\n\n png_sRGB_delta[ibase >> 7] = trydelta;\n\n\n\n /* Check the 16-bit linear values alone: */\n\n error_count16 = 0;\n\n for (i16=ibase; i16 < ibase+128; ++i16)\n\n {\n\n unsigned int i = 255*i16;\n\n unsigned int iexact = nearbyint(255*sRGB(i));\n\n unsigned int icalc = PNG_sRGB_FROM_LINEAR(i);\n\n\n\n if (icalc != iexact)\n\n ++error_count16;\n\n }\n\n\n\n if (error_count16 == 0)\n\n break;\n\n\n\n if (ecbase == 0)\n\n {\n\n eco = ecbase = error_count16;\n\n ++trybase; /* First test */\n\n }\n\n\n\n else if (error_count16 < ecbase)\n\n {\n\n if (trybase > base)\n\n {\n\n base = trybase;\n\n ++trybase;\n\n }\n\n else if (trybase < base)\n\n {\n\n base = trybase;\n\n --trybase;\n\n }\n\n else if (trydelta > delta)\n\n {\n\n delta = trydelta;\n\n ++trydelta;\n\n }\n\n else if (trydelta < delta)\n\n {\n\n delta = trydelta;\n\n --trydelta;\n\n }\n\n else\n\n {\n\n fprintf(stderr, \"makesRGB: impossible\\n\");\n\n exit(1);\n\n }\n\n ecbase = error_count16;\n\n }\n\n\n\n else\n\n {\n\n if (trybase > base)\n\n trybase = base-1;\n\n else if (trybase < base)\n\n {\n\n trybase = base;\n\n ++trydelta;\n\n }\n\n else if (trydelta > delta)\n\n trydelta = delta-1;\n\n else if (trydelta < delta)\n\n break; /* end of tests */\n\n }\n\n }\n\n\n\n png_sRGB_base[ibase >> 7] = base;\n\n png_sRGB_delta[ibase >> 7] = delta;\n\n if (base != ob || delta != od)\n\n {\n\n printf(\"/* table[%u]={%u,%u} -> {%u,%u} %u -> %u errors */\\n\",\n\n ibase>>7, ob, od, base, delta, eco, ecbase);\n\n }\n\n else if (0)\n\n printf(\"/* table[%u]={%u,%u} %u errors */\\n\", ibase>>7, ob, od,\n\n ecbase);\n\n }\n\n\n\n /* Only do the full (slow) test at the end: */\n\n min_error = -.4999;\n\n max_error = .4999;\n\n error_count = 0;\n\n\n\n for (i=0; i <= max_input; ++i)\n\n {\n\n unsigned int iexact = nearbyint(255*sRGB(i));\n\n unsigned int icalc = PNG_sRGB_FROM_LINEAR(i);\n\n\n\n if (icalc != iexact)\n\n {\n\n double err = 255*sRGB(i) - icalc;\n\n\n\n if (err > (max_error+.001) || err < (min_error-.001))\n\n {\n\n printf(\n\n \"/* 0x%08x: exact: %3d, got: %3d [tables: %08x, %08x] (%f) */\\n\",\n\n i, iexact, icalc, png_sRGB_base[i>>15],\n\n png_sRGB_delta[i>>15], err);\n\n }\n\n\n\n ++error_count;\n\n if (err > max_error)\n\n max_error = err;\n\n else if (err < min_error)\n\n min_error = err;\n\n }\n\n }\n\n\n\n /* Re-check the 16-bit cases too, including the warning if there is an error\n\n * bigger than 1.\n\n */\n\n error_count16 = 0;\n\n max_error16 = 0;\n\n min_error16 = 0;\n\n for (i16=0; i16 <= 65535; ++i16)\n\n {\n\n unsigned int i = 255*i16;\n\n unsigned int iexact = nearbyint(255*sRGB(i));\n\n unsigned int icalc = PNG_sRGB_FROM_LINEAR(i);\n\n\n\n if (icalc != iexact)\n\n {\n\n double err = 255*sRGB(i) - icalc;\n\n\n\n ++error_count16;\n\n if (err > max_error16)\n\n max_error16 = err;\n\n else if (err < min_error16)\n\n min_error16 = err;\n\n\n\n if (abs(icalc - iexact) > 1)\n\n printf(\n\n \"/* 0x%04x: exact: %3d, got: %3d [tables: %08x, %08x] (%f) */\\n\",\n\n i16, iexact, icalc, png_sRGB_base[i>>15],\n\n png_sRGB_delta[i>>15], err);\n\n }\n\n }\n\n\n\n /* Check the round trip for each 8-bit sRGB value. */\n\n for (i16=0; i16 <= 255; ++i16)\n\n {\n\n unsigned int i = 255 * png_sRGB_table[i16];\n\n unsigned int iexact = nearbyint(255*sRGB(i));\n\n unsigned int icalc = PNG_sRGB_FROM_LINEAR(i);\n\n\n\n if (i16 != iexact)\n\n {\n\n fprintf(stderr, \"8-bit rounding error: %d -> %d\\n\", i16, iexact);\n\n exit(1);\n\n }\n\n\n\n if (icalc != i16)\n\n {\n\n double finv = finvsRGB(i16);\n\n\n\n printf(\"/* 8-bit roundtrip error: %d -> %f -> %d(%f) */\\n\",\n\n i16, finv, icalc, fsRGB(255*finv));\n\n }\n\n }\n\n\n\n\n\n printf(\"/* error: %g - %g, %u (%g%%) of readings inexact */\\n\",\n\n min_error, max_error, error_count, (100.*error_count)/max_input);\n\n printf(\"/* 16-bit error: %g - %g, %u (%g%%) of readings inexact */\\n\",\n\n min_error16, max_error16, error_count16, (100.*error_count16)/65535);\n\n\n\n if (!test_only)\n\n {\n\n printf(\"PNG_CONST png_uint_16 png_sRGB_table[256] =\\n{\\n \");\n\n for (i=0; i<255; )\n\n {\n\n do\n\n {\n\n printf(\"%d,\", png_sRGB_table[i++]);\n\n }\n\n while ((i & 0x7) != 0 && i<255);\n\n if (i<255) printf(\"\\n \");\n\n }\n\n printf(\"%d\\n};\\n\\n\", png_sRGB_table[i]);\n\n\n\n\n\n printf(\"PNG_CONST png_uint_16 png_sRGB_base[512] =\\n{\\n \");\n\n for (i=0; i<511; )\n\n {\n\n do\n\n {\n\n printf(\"%d,\", png_sRGB_base[i++]);\n\n }\n\n while ((i & 0x7) != 0 && i<511);\n\n if (i<511) printf(\"\\n \");\n\n }\n\n printf(\"%d\\n};\\n\\n\", png_sRGB_base[i]);\n\n\n\n printf(\"PNG_CONST png_byte png_sRGB_delta[512] =\\n{\\n \");\n\n for (i=0; i<511; )\n\n {\n\n do\n\n {\n\n printf(\"%d,\", png_sRGB_delta[i++]);\n\n }\n\n while ((i & 0xf) != 0 && i<511);\n\n if (i<511) printf(\"\\n \");\n\n }\n\n printf(\"%d\\n};\\n\\n\", png_sRGB_delta[i]);\n\n }\n\n\n\n return 0;\n", "file_path": "ThirdParty/lpng161/contrib/tools/makesRGB.c", "rank": 42, "score": 97167.07758894571 }, { "content": "int main(int argc, char **argv)\n\n{\n\n int err = 0;\n\n\n\n printf(\"/* adler32, crc32, MD5[16], intent, date, length, file-name */\\n\");\n\n\n\n if (argc > 1)\n\n {\n\n int i;\n\n\n\n for (i=1; i<argc; ++i)\n\n {\n\n FILE *ip = fopen(argv[i], \"rb\");\n\n\n\n if (ip == NULL || !read_one_file(ip, argv[i]))\n\n {\n\n err = 1;\n\n perror(argv[i]);\n\n fprintf(stderr, \"%s: read error\\n\", argv[i]);\n\n printf(\"/* ERROR: %s */\\n\", argv[i]);\n\n }\n\n\n\n (void)fclose(ip);\n\n }\n\n }\n\n\n\n else\n\n {\n\n if (!read_one_file(stdin, \"-\"))\n\n {\n\n err = 1;\n\n perror(\"stdin\");\n\n fprintf(stderr, \"stdin: read error\\n\");\n\n printf(\"/* ERROR: stdin */\\n\");\n\n }\n\n }\n\n\n\n return err;\n", "file_path": "ThirdParty/lpng161/contrib/tools/checksum-icc.c", "rank": 43, "score": 97167.07758894571 }, { "content": "class Create3DSimulationProfile : public CreateProfile {\n\npublic:\n\n // Description:\n\n // Constructor/Destructor.\n\n inline Create3DSimulationProfile()\n\n {m_Profile->SetProfileType(ProfileType3d);}\n\n inline ~Create3DSimulationProfile() {};\n\n\n\n // Description:\n\n // 3D Specific creates.\n\n MPCDI_Error CreateFrustum(Region *r) {return r->SetFrustum(); }\n\n\n\n // Description:\n\n // Get the created frusutm\n\n Frustum *GetFrustum(Region *r) {return r->GetFrustum();}\n\n};\n\n\n\n}; // end namespace mpcdi \n\n\n\n\n\n\n\n\n", "file_path": "src/Creators/mpcdiCreate3DSimulationProfile.h", "rank": 44, "score": 69197.33050014233 }, { "content": "class CreateAdvanced3DProfile : public CreateProfile {\n\npublic:\n\n // Description:\n\n // Constructor/Destructor.\n\n inline CreateAdvanced3DProfile(){m_Profile->SetProfileType(ProfileTypea3);}\n\n inline ~CreateAdvanced3DProfile() {};\n\n\n\n // Description:\n\n // Geometric Unit Tag required.\n\n void SetGeometricUnit(GeometryWarpFile *gwf, const GeometricUnit &gu)\n\n { if (gwf) gwf->SetGeometricUnit(gu); }\n\n\n\n // Description:\n\n // Origin of 3D Data required.\n\n void SetOriginOf3DData(GeometryWarpFile *gwf, const OriginOf3DData &origin)\n\n { if (gwf) gwf->SetOriginOf3DData(origin); }\n\n};\n\n\n\n\n\n\n\n\n\n}; // end namespace mpcdi \n\n\n\n\n\n\n\n\n", "file_path": "src/Creators/mpcdiCreateAdvanced3DProfile.h", "rank": 45, "score": 69197.33050014233 }, { "content": "class Create2DMediaProfile : public CreateProfile {\n\npublic:\n\n // Description:\n\n // Constructor/Destructor.\n\n inline Create2DMediaProfile() {m_Profile->SetProfileType(ProfileType2d);}\n\n inline ~Create2DMediaProfile() {};\n\n};\n\n\n\n}; // end namespace mpcdi \n\n\n\n\n\n\n\n\n", "file_path": "src/Creators/mpcdiCreate2DMediaProfile.h", "rank": 46, "score": 69197.33050014233 }, { "content": "class CreateShaderLampProfile : public CreateProfile {\n\npublic:\n\n // Description:\n\n // Constructor/Destructor.\n\n inline CreateShaderLampProfile()\n\n {m_Profile->SetProfileType(ProfileTypesl);}\n\n inline ~CreateShaderLampProfile() {};\n\n\n\n // Description:\n\n // Need a frustum.\n\n MPCDI_Error CreateFrustum(Region *r) {return r->SetFrustum(); }\n\n\n\n// Description:\n\n // Need a coordinate frame\n\n MPCDI_Error CreateCoordinateFrame(Region *r)\n\n {return r->SetCoordinateFrame(); }\n\n\n\n // Description:\n\n // Create a new DisortionMap\n\n MPCDI_Error CreateDistortionMap(Region *r,\n", "file_path": "src/Creators/mpcdiCreateShaderLampProfile.h", "rank": 47, "score": 69197.33050014233 }, { "content": "var structmpcdi_1_1_profile =\n\n[\n\n [ \"Profile\", \"structmpcdi_1_1_profile.html#a4eea708cdbed0262d9e7ddbe3f1e3f89\", null ],\n\n [ \"~Profile\", \"structmpcdi_1_1_profile.html#a58fa758a59bc4ee3c1a9980e360e4e98\", null ],\n\n [ \"mpcdiGetConstMacro\", \"structmpcdi_1_1_profile.html#a165986bbbfb09e8fa91111e9f626ce3d\", null ],\n\n [ \"mpcdiGetConstMacro\", \"structmpcdi_1_1_profile.html#a68161584b303e7b0d8508e2b8ce09ca3\", null ],\n\n [ \"mpcdiGetConstMacro\", \"structmpcdi_1_1_profile.html#abff892e0d9e088bae8baa501cee2ce0a\", null ],\n\n [ \"mpcdiGetConstMacro\", \"structmpcdi_1_1_profile.html#a7b52f6e98d6009771e7e7c4a4368e179\", null ],\n\n [ \"mpcdiGetMacro\", \"structmpcdi_1_1_profile.html#a5026ee94b181d655e2dc4f5177a997e2\", null ],\n\n [ \"mpcdiSetMacro\", \"structmpcdi_1_1_profile.html#aa97118bcf26f2c17497eb1884e649c76\", null ],\n\n [ \"mpcdiSetMacro\", \"structmpcdi_1_1_profile.html#a2dd87fc2c4736fe106beea3f3d9e181e\", null ],\n\n [ \"mpcdiSetMacro\", \"structmpcdi_1_1_profile.html#a8cf934aaa25efb8cc185eae130cf91e7\", null ],\n\n [ \"mpcdiSetMacro\", \"structmpcdi_1_1_profile.html#af8a34b922b5793e6fc426f8cfd7d39a1\", null ],\n\n [ \"ValidateProfile\", \"structmpcdi_1_1_profile.html#a8d4fb3bd6ca0f39eb477b9539c77935a\", null ],\n\n [ \"m_Date\", \"structmpcdi_1_1_profile.html#aedfaf440a9a8f05a14079b13beb6804f\", null ],\n\n [ \"m_Display\", \"structmpcdi_1_1_profile.html#a119d7571b672226388d3db1fe6a62111\", null ],\n\n [ \"m_Level\", \"structmpcdi_1_1_profile.html#a942d0495f3e89515467e48fe1ae48d1f\", null ],\n\n [ \"m_ProfileType\", \"structmpcdi_1_1_profile.html#a6e3f93e114ef794095ea09bfe57d687c\", null ],\n\n [ \"m_Version\", \"structmpcdi_1_1_profile.html#af335064710cdbc9ba2ba676efc583379\", null ]\n", "file_path": "html/structmpcdi_1_1_profile.js", "rank": 48, "score": 66409.37648876276 }, { "content": "class EXPORT_MPCDI CreateProfile {\n\npublic:\n\n // Description:\n\n // Constructor/Destructor.\n\n virtual ~CreateProfile();\n\n\n\n // Description:\n\n // Set the Level. 1...4 as of May 2013. To some degree, this\n\n // command is optional. If you know the correct level, enter it. If,\n\n // however, you leave the data at level 1, we will do our best to\n\n // calculate it. We aren't yet perfect at this calculation.\n\n void SetLevel(const int &Level) { m_Profile->SetLevel(Level); }\n\n\n\n // Description:\n\n // Create a New Buffer\n\n MPCDI_Error CreateNewBuffer(const std::string &newBufferId)\n\n { return m_Profile->GetDisplay()->NewBuffer(newBufferId); }\n\n\n\n // Description:\n\n // Create a New Region\n", "file_path": "src/Creators/mpcdiCreateProfile.h", "rank": 49, "score": 66409.37648876276 }, { "content": "var mpcdi_profile_8h =\n\n[\n\n [ \"Profile\", \"structmpcdi_1_1_profile.html\", \"structmpcdi_1_1_profile\" ],\n\n [ \"PROFILE_TYPE_ENUMS\", \"mpcdi_profile_8h.html#a51b6305fa54194098c2d51378b3520dc\", null ],\n\n [ \"MPCDI_DECLARE_ENUM_CONV_FUNC\", \"mpcdi_profile_8h.html#a7070eb4b37923e76383941755601cdaa\", null ],\n\n [ \"MPCDI_DECLARE_ENUM_TYPEDEF\", \"mpcdi_profile_8h.html#abe6b7e79589ec4bb8b4a9203f3f55851\", null ]\n", "file_path": "html/mpcdi_profile_8h.js", "rank": 50, "score": 66409.37648876276 }, { "content": "var classmpcdi_1_1_create_profile =\n\n[\n\n [ \"~CreateProfile\", \"classmpcdi_1_1_create_profile.html#abbcee4cb44123df153180ce67c9c33df\", null ],\n\n [ \"CreateProfile\", \"classmpcdi_1_1_create_profile.html#a508f873a47eaad6552f9c077acb83c36\", null ],\n\n [ \"CheckPerPixelResolution\", \"classmpcdi_1_1_create_profile.html#ab085319c7159626ba2ac6f3776b5066e\", null ],\n\n [ \"CreateAlphaMap\", \"classmpcdi_1_1_create_profile.html#a84db63eb18a9c39c69b7ef6d36444c86\", null ],\n\n [ \"CreateBetaMap\", \"classmpcdi_1_1_create_profile.html#afb9b5c91b9e2ff9fa37409cbb2de043b\", null ],\n\n [ \"CreateGeometryWarpFile\", \"classmpcdi_1_1_create_profile.html#a54c3643935a7300c3c34bb5abfcf0197\", null ],\n\n [ \"CreateNewBuffer\", \"classmpcdi_1_1_create_profile.html#ac4d267dc35f38070d323078757b581d0\", null ],\n\n [ \"CreateNewRegion\", \"classmpcdi_1_1_create_profile.html#a16a5bdeec68497a8a8a67f9aaff43b81\", null ],\n\n [ \"CreateNewRegion\", \"classmpcdi_1_1_create_profile.html#a5eb67ce86e9555fe7421fa6eabf63c85\", null ],\n\n [ \"GetAlphaMap\", \"classmpcdi_1_1_create_profile.html#a2f2130c57574c761365da9a1e458e242\", null ],\n\n [ \"GetBetaMap\", \"classmpcdi_1_1_create_profile.html#a241906f1aa7ef66b32c38c90453f291b\", null ],\n\n [ \"GetBuffer\", \"classmpcdi_1_1_create_profile.html#a6736d02960858234689bb93017cafee7\", null ],\n\n [ \"GetGeometryWarpFile\", \"classmpcdi_1_1_create_profile.html#a738fbbc8aa5308ca22229bae905391c8\", null ],\n\n [ \"GetProfile\", \"classmpcdi_1_1_create_profile.html#a5d06655be2418fc86f8ee56ac507286e\", null ],\n\n [ \"GetRegion\", \"classmpcdi_1_1_create_profile.html#a338736278d286ad74187a6e82605c707\", null ],\n\n [ \"GetRegion\", \"classmpcdi_1_1_create_profile.html#ac0c8233c5d1a26edab956d50a4a7a12b\", null ],\n\n [ \"mpcdiGetConstMacro\", \"classmpcdi_1_1_create_profile.html#af38f85ffd8dd808aafd3f8a6c3fb43d9\", null ],\n\n [ \"mpcdiSetMacro\", \"classmpcdi_1_1_create_profile.html#a92fd289721f72714cf2f1c6aeda801dd\", null ],\n\n [ \"SetGammaEmbedded\", \"classmpcdi_1_1_create_profile.html#a755a89c34fb59678f64173629768287b\", null ],\n\n [ \"SetLevel\", \"classmpcdi_1_1_create_profile.html#a04c3a06e3506875c1b0950946a390d2a\", null ],\n\n [ \"UpdateLevel\", \"classmpcdi_1_1_create_profile.html#a256857dcbb0d0c6eb2d399ca6a6ca683\", null ],\n\n [ \"ValidateProfile\", \"classmpcdi_1_1_create_profile.html#ad3bf1c4b784c880893ca9e469bd847b9\", null ],\n\n [ \"m_DeleteProfile\", \"classmpcdi_1_1_create_profile.html#ab2c53843a282f5771fc7456a6f45b735\", null ],\n\n [ \"m_HaveBetaMap\", \"classmpcdi_1_1_create_profile.html#a6c88e60ff23d964a4e90e9f3a4a8b5dd\", null ],\n\n [ \"m_HaveDistortionMap\", \"classmpcdi_1_1_create_profile.html#ababe1db504a4e839d1a3c6ea304bfc42\", null ],\n\n [ \"m_HavePerPixelResolution\", \"classmpcdi_1_1_create_profile.html#a4482aded4f9ae70ab15a5bcc7f50bf20\", null ],\n\n [ \"m_Profile\", \"classmpcdi_1_1_create_profile.html#a3c74cfbbc6aa17bbc75273decde756f2\", null ]\n", "file_path": "html/classmpcdi_1_1_create_profile.js", "rank": 51, "score": 65449.466615923 }, { "content": "var _create_sample_profile_8h =\n\n[\n\n [ \"CreateSampleProfile\", \"_create_sample_profile_8h.html#a7ef44b76c670998da5adf6b0ff378204\", null ],\n\n [ \"CreateSampleProfile2\", \"_create_sample_profile_8h.html#a740662fe2e58e604d4675cad05b4f553\", null ]\n", "file_path": "html/_create_sample_profile_8h.js", "rank": 52, "score": 65449.466615923 }, { "content": "var mpcdi_profile_8cpp =\n\n[\n\n [ \"MPCDI_DEFINE_ENUM_CONV_FUNC\", \"mpcdi_profile_8cpp.html#aa90eae91f807ab97ee8bef9f9749a45b\", null ]\n", "file_path": "html/mpcdi_profile_8cpp.js", "rank": 53, "score": 65449.466615923 }, { "content": "var structmpcdi_1_1_profile_version =\n\n[\n\n [ \"ProfileVersion\", \"structmpcdi_1_1_profile_version.html#adce0871f0850951603a587f037b61202\", null ],\n\n [ \"operator==\", \"structmpcdi_1_1_profile_version.html#af94e28f4e8b7958bb82e6f7bc8cf8969\", null ],\n\n [ \"MajorVersion\", \"structmpcdi_1_1_profile_version.html#afa52aedcbd8ea27b7437a8eff8990c74\", null ],\n\n [ \"MinorVersion\", \"structmpcdi_1_1_profile_version.html#a596eb1297785780ca8515aa0c84e34be\", null ]\n", "file_path": "html/structmpcdi_1_1_profile_version.js", "rank": 54, "score": 65449.466615923 }, { "content": "var _verbose_compare_profile_8h =\n\n[\n\n [ \"VerboseCompareAlphaMap\", \"_verbose_compare_profile_8h.html#adc537ba62c45b7f3adc7a6f992b43dd1\", null ],\n\n [ \"VerboseCompareBetaMap\", \"_verbose_compare_profile_8h.html#a721ec38bd561cf567e932d1b5b10bce8\", null ],\n\n [ \"VerboseCompareDistortionMap\", \"_verbose_compare_profile_8h.html#a4c37480b22a9dbd186c03abd266d5cfa\", null ],\n\n [ \"VerboseCompareFrustum\", \"_verbose_compare_profile_8h.html#aae2124612f7f6b7ff6cd20d065da21f1\", null ],\n\n [ \"VerboseCompareGeometryWarpFile\", \"_verbose_compare_profile_8h.html#af4f40fbdb3f62af3127990e328da0d4c\", null ],\n\n [ \"VerboseCompareProfile\", \"_verbose_compare_profile_8h.html#a5cbff663d97fca6aecf260589a3e4137\", null ]\n", "file_path": "html/_verbose_compare_profile_8h.js", "rank": 55, "score": 65449.466615923 }, { "content": "var classmpcdi_1_1_create3_d_simulation_profile =\n\n[\n\n [ \"Create3DSimulationProfile\", \"classmpcdi_1_1_create3_d_simulation_profile.html#af9075d0f04ca42a6c4a01112cd1d0ac3\", null ],\n\n [ \"~Create3DSimulationProfile\", \"classmpcdi_1_1_create3_d_simulation_profile.html#ad51178ae90d888ab06c81735e2ca7280\", null ],\n\n [ \"CreateFrustum\", \"classmpcdi_1_1_create3_d_simulation_profile.html#a2d02b1509f37555ac6167b3fa99e5e3f\", null ],\n\n [ \"GetFrustum\", \"classmpcdi_1_1_create3_d_simulation_profile.html#a9b47299b09162cb8fdd31cc7d84885b2\", null ]\n", "file_path": "html/classmpcdi_1_1_create3_d_simulation_profile.js", "rank": 56, "score": 64516.91125472312 }, { "content": "var classmpcdi_1_1_create_advanced3_d_profile =\n\n[\n\n [ \"CreateAdvanced3DProfile\", \"classmpcdi_1_1_create_advanced3_d_profile.html#a5bb9115699ac84ceb46a783cbc8b92e7\", null ],\n\n [ \"~CreateAdvanced3DProfile\", \"classmpcdi_1_1_create_advanced3_d_profile.html#a3c3d0dd358ab3536e4e4fb8ae3db77a4\", null ],\n\n [ \"SetGeometricUnit\", \"classmpcdi_1_1_create_advanced3_d_profile.html#af4858f8fa1691b7ae680d9a7fb0266d7\", null ],\n\n [ \"SetOriginOf3DData\", \"classmpcdi_1_1_create_advanced3_d_profile.html#afd4dafb1415564b72939abc1a455b6ec\", null ]\n", "file_path": "html/classmpcdi_1_1_create_advanced3_d_profile.js", "rank": 57, "score": 64516.91125472312 }, { "content": "var _verbose_compare_profile_8cpp =\n\n[\n\n [ \"CHECK_VALUES\", \"_verbose_compare_profile_8cpp.html#a2ac0a1ee774a3e409fffdfd8c0e1eebf\", null ],\n\n [ \"CheckValues\", \"_verbose_compare_profile_8cpp.html#a08282d5d35567fe707cbb814e4ed312b\", null ],\n\n [ \"CheckValues< double >\", \"_verbose_compare_profile_8cpp.html#a77206748e7d36bcca7095bdd8b243eb7\", null ],\n\n [ \"CheckValues< float >\", \"_verbose_compare_profile_8cpp.html#ae704653f73a46196ce5b66741e195250\", null ],\n\n [ \"VerboseCompareAlphaMap\", \"_verbose_compare_profile_8cpp.html#adc537ba62c45b7f3adc7a6f992b43dd1\", null ],\n\n [ \"VerboseCompareBetaMap\", \"_verbose_compare_profile_8cpp.html#a721ec38bd561cf567e932d1b5b10bce8\", null ],\n\n [ \"VerboseCompareDistortionMap\", \"_verbose_compare_profile_8cpp.html#a4c37480b22a9dbd186c03abd266d5cfa\", null ],\n\n [ \"VerboseCompareFrustum\", \"_verbose_compare_profile_8cpp.html#aae2124612f7f6b7ff6cd20d065da21f1\", null ],\n\n [ \"VerboseCompareGeometryWarpFile\", \"_verbose_compare_profile_8cpp.html#af4f40fbdb3f62af3127990e328da0d4c\", null ],\n\n [ \"VerboseCompareProfile\", \"_verbose_compare_profile_8cpp.html#a5cbff663d97fca6aecf260589a3e4137\", null ]\n", "file_path": "html/_verbose_compare_profile_8cpp.js", "rank": 58, "score": 64516.91125472312 }, { "content": "var _create_sample_profile_8cpp =\n\n[\n\n [ \"CreateSampleProfile\", \"_create_sample_profile_8cpp.html#a7ef44b76c670998da5adf6b0ff378204\", null ],\n\n [ \"CreateSampleProfile2\", \"_create_sample_profile_8cpp.html#a740662fe2e58e604d4675cad05b4f553\", null ],\n\n [ \"DrawGradientInPFM\", \"_create_sample_profile_8cpp.html#a21539a6788d3c53890fdb1b1a11867d1\", null ],\n\n [ \"DrawRectangle\", \"_create_sample_profile_8cpp.html#a6e141689f91f2ed9334956b6e4893401\", null ],\n\n [ \"DrawRectangleInPFM\", \"_create_sample_profile_8cpp.html#acd4f7fb14ab8dc6d84039985eef1fe73\", null ]\n", "file_path": "html/_create_sample_profile_8cpp.js", "rank": 59, "score": 64516.91125472312 }, { "content": "var classmpcdi_1_1_create2_d_media_profile =\n\n[\n\n [ \"Create2DMediaProfile\", \"classmpcdi_1_1_create2_d_media_profile.html#a4be600f2f195c787bc69426a4e0f39ab\", null ],\n\n [ \"~Create2DMediaProfile\", \"classmpcdi_1_1_create2_d_media_profile.html#a4dc89430489c52c5f0fa9f29b4693b9c\", null ]\n", "file_path": "html/classmpcdi_1_1_create2_d_media_profile.js", "rank": 60, "score": 64516.91125472312 }, { "content": "var classmpcdi_1_1_create_shader_lamp_profile =\n\n[\n\n [ \"CreateShaderLampProfile\", \"classmpcdi_1_1_create_shader_lamp_profile.html#a3989bd6b63672e438598ae8d5b0572b9\", null ],\n\n [ \"~CreateShaderLampProfile\", \"classmpcdi_1_1_create_shader_lamp_profile.html#a71e509f4c0df04fb208f44f67645e9e7\", null ],\n\n [ \"CreateCoordinateFrame\", \"classmpcdi_1_1_create_shader_lamp_profile.html#ae997d970cce8caf40852d057644b1928\", null ],\n\n [ \"CreateDistortionMap\", \"classmpcdi_1_1_create_shader_lamp_profile.html#adf01d46b3c4c1a00d5cac69ebfd6ae76\", null ],\n\n [ \"CreateFrustum\", \"classmpcdi_1_1_create_shader_lamp_profile.html#a5e74af37a9053920aef65857f2c9636d\", null ],\n\n [ \"GetCoordinateFrame\", \"classmpcdi_1_1_create_shader_lamp_profile.html#a5f61ebf08ddf0963a1347ee9ed41d244\", null ],\n\n [ \"GetDistortionMap\", \"classmpcdi_1_1_create_shader_lamp_profile.html#ab96ea096fde7e47202a512a8ade8eca3\", null ],\n\n [ \"GetFrustum\", \"classmpcdi_1_1_create_shader_lamp_profile.html#a881af39b55a70d68eb5c0b4580ed3385\", null ],\n\n [ \"SetGeometricUnit\", \"classmpcdi_1_1_create_shader_lamp_profile.html#a72f87a66027f31f6230aeacd6190c507\", null ],\n\n [ \"SetOriginOf3DData\", \"classmpcdi_1_1_create_shader_lamp_profile.html#a2bafb57d6ff7157a8bbddc2a8108c14f\", null ]\n", "file_path": "html/classmpcdi_1_1_create_shader_lamp_profile.js", "rank": 61, "score": 63610.557551014244 }, { "content": " // The level can go up if you set something that requires it \n\n // to go up. This is implemented differently PerType. Returns the\n\n // new level.\n\n unsigned int UpdateLevel();\n\n\n\n protected:\n\n // Description:\n\n // The Constructor is protected because we should use the sub-classes.\n\n CreateProfile();\n\n\n\n // Description:\n\n // The profile to be created.\n\n Profile *m_Profile;\n\n bool m_DeleteProfile;\n\n\n\n // Information for calculating the level.\n\n bool m_HaveBetaMap; // Guarantees at least level 2.\n\n bool m_HaveDistortionMap; // Guarantees at least level 3 for Shader Lamps\n\n bool m_HavePerPixelResolution; // Level 3 for 2D and 3D and a3D\n\n\n", "file_path": "src/Creators/mpcdiCreateProfile.h", "rank": 62, "score": 58499.47947506169 }, { "content": " // Validate the Profile. Look for inconsistencies, or things not\n\n // allowed by the standard. It does not find every issues,\n\n // but should be pretty good.\n\n MPCDI_Error ValidateProfile() { return m_Profile->ValidateProfile(); }\n\n\n\n // Description:\n\n // The Results.\n\n Profile *GetProfile() { return m_Profile; }\n\n \n\n // Description:\n\n // When we delete this class, should we delete the profile?\n\n // The Default is 'yes'.\n\n // Why do this? You might want to create the profile, and then\n\n // make a copy of the pointer, and delete the creation class. It\n\n // means you don't have to copy the entire profile.\n\n mpcdiSetMacro(DeleteProfile, bool);\n\n mpcdiGetConstMacro(DeleteProfile, bool);\n\n\n\n // Description:\n\n // Update the Level. Guaranteed to never decrease the level.\n", "file_path": "src/Creators/mpcdiCreateProfile.h", "rank": 63, "score": 58496.14032897892 }, { "content": "{\n\n std::vector<std::string> bufferNames=m_Display->GetBufferNames();\n\n if (bufferNames.size() == 0)\n\n {\n\n CREATE_ERROR_MSG(msg,\"A profile should contain at least one buffer found none\");\n\n ReturnCustomErrorMacro(MPCDI_FAILURE,msg);\n\n }\n\n\n\n /* a3d or sl, number of buffers must be 1 */\n\n if (m_ProfileType == ProfileType3d || m_ProfileType == ProfileTypesl)\n\n if (bufferNames.size() != 1)\n\n {\n\n CREATE_ERROR_MSG(msg,\"When profile \" << mpcdi::GetProfileType(m_ProfileType) << \"there should only be one buffer not \" << bufferNames.size() << std::endl);\n\n ReturnCustomErrorMacro(MPCDI_FAILURE,msg);\n\n }\n\n\n\n bool firstRegion=true;\n\n OriginOf3DData globalOriginOf3DData = OriginOf3DDataunknown;\n\n for(mpcdi::Display::BufferIterator bufferIt=this->GetDisplay()->GetBufferBegin(); bufferIt != this->GetDisplay()->GetBufferEnd(); bufferIt++) \n\n {\n", "file_path": "src/Container/mpcdiProfile.cpp", "rank": 64, "score": 58495.791243695596 }, { "content": " if (m_ProfileType == ProfileTypesl)\n\n if (region->GetCoordinateFrame() == NULL)\n\n {\n\n CREATE_ERROR_MSG(msg, \"Profile of type\" << mpcdi::GetProfileType(m_ProfileType) \n\n << \"should have a coordinate frame set\");\n\n ReturnCustomErrorMacro(MPCDI_FAILURE,msg);\n\n }\n\n\n\n /* always contains geometry warp file */\n\n if (geometryWarpFile==NULL) \n\n {\n\n CREATE_ERROR_MSG(msg,\"Missing geometry warp file for region \" << regionIt->first);\n\n ReturnCustomErrorMacro(MPCDI_FAILURE,msg);\n\n }\n\n\n\n if(firstRegion)\n\n {\n\n globalOriginOf3DData = geometryWarpFile->GetOriginOf3DData();\n\n firstRegion = false;\n\n }\n", "file_path": "src/Container/mpcdiProfile.cpp", "rank": 65, "score": 58495.6907998203 }, { "content": "/* =========================================================================\n\n\n\n Program: MPCDI Library\n\n Language: C++\n\n Date: $Date: 2012-02-08 11:39:41 -0500 (Wed, 08 Feb 2012) $\n\n Version: $Revision: 18341 $\n\n\n\n Copyright (c) 2013 Scalable Display Technologies, Inc.\n\n All Rights Reserved.\n\n The MPCDI Library is distributed under the BSD license.\n\n Please see License.txt distributed with this package.\n\n\n\n===================================================================auto== */\n\n\n\n#include \"mpcdiProfile.h\"\n\n#include \"mpcdiErrorHelper.h\"\n\n\n\nusing namespace mpcdi;\n\n\n\nMPCDI_DEFINE_ENUM_CONV_FUNC(ProfileType,mpcdi,PROFILE_TYPE_ENUMS);\n", "file_path": "src/Container/mpcdiProfile.cpp", "rank": 66, "score": 58495.42355345055 }, { "content": " \n\n /* x/y size should be set */\n\n if (MPCDI_FAILED(mpcdi::Region::CheckRangeXsize(region->GetXsize())) || \n\n MPCDI_FAILED(mpcdi::Region::CheckRangeYsize(region->GetYsize())))\n\n {\n\n CREATE_ERROR_MSG(msg, \"Region should have xsize and ysize tags set or they are out of range\");\n\n ReturnCustomErrorMacro(MPCDI_FAILURE,msg);\n\n }\n\n\n\n /* If the profile is 3D Simulation (3d) or Shader Lamps (sl), the region tag must contain a frustum tag. */\n\n if (m_ProfileType == ProfileType3d || m_ProfileType == ProfileTypesl)\n\n if (region->GetFrustum() == NULL)\n\n {\n\n CREATE_ERROR_MSG(msg, \"Profile of type\" << mpcdi::GetProfileType(m_ProfileType) << \"should have frustum set\");\n\n ReturnCustomErrorMacro(MPCDI_FAILURE,msg);\n\n }\n\n\n\n /* If the profile is set to Shader Lamps (sl), the region tag must contain a coordinateFrame tag. \n\n A coordinateFrame tag shall contain nine consecutive tags. They are as follows and is described \n\n in further detail in section 2.3.1.2 */\n", "file_path": "src/Container/mpcdiProfile.cpp", "rank": 67, "score": 58493.79719727787 }, { "content": "// most common mechanisms for creating a profile in one location.\n\n//\n\n// . SECTION Usage\n\n//\n\n// (1) Set the Level (Somewhat optional. Read the docs below.)\n\n// (2) Create 1 or More Buffers (CreateNewBuffer)\n\n// (3) Create 1 or More Regions for each Buffer (CreateNewRegion)\n\n// (4) For each region, create and fill in\n\n// (i) Alpha Map (including gamma)\n\n// (ii) Beta Map, optionally\n\n// (iii) Warp Map File.\n\n// (5) If appropriate, add other data.\n\n// (6) Validate the profile.\n\n// (7) Get the Profile\n\n// (8) Decide if you want this class to delete the Profile or not.\n\n// \n\n\n\n#pragma once\n\n#include \"mpcdiProfile.h\"\n\nnamespace mpcdi {\n\n\n", "file_path": "src/Creators/mpcdiCreateProfile.h", "rank": 68, "score": 58492.71532627368 }, { "content": " }\n\n\n\n /* If the profile is a3 or sl. Then a geometricUnit tag and an \n\n originOf3DData tag must both be present inside the geometryWarpFile tag. */\n\n //FIXME: doubt if we need to do something with this here\n\n \n\n /* If shader lamp then we should have a distortionMap */\n\n if (m_ProfileType == ProfileTypesl)\n\n {\n\n /* A distortionMap tag, must exist within the fileset tag if profile is set to Shader Lamps (sl).*/\n\n if (region->GetFileSet()->GetDistortionMap() == NULL)\n\n {\n\n CREATE_ERROR_MSG(msg,\"ProfileType is \" << mpcdi::GetProfileType(m_ProfileType) << \"expected distortion map\");\n\n ReturnCustomErrorMacro(MPCDI_FAILURE,msg);\n\n }\n\n \n\n /* If the profile is set to Shader Lamps (sl), then this tag cannot be set to idealEyePoint */\n\n if (geometryWarpFile->GetOriginOf3DData() == OriginOf3DDataidealEyePoint)\n\n {\n\n CREATE_ERROR_MSG(msg,\"ProfileType is \" << mpcdi::GetProfileType(m_ProfileType) << \"origin of data should not be \" << mpcdi::GetOriginOf3DData(OriginOf3DDataidealEyePoint));\n", "file_path": "src/Container/mpcdiProfile.cpp", "rank": 69, "score": 58492.38528301218 }, { "content": "\n\n /* origin of 3d data is different on any geometry warp file */\n\n if (globalOriginOf3DData != geometryWarpFile->GetOriginOf3DData())\n\n {\n\n CREATE_ERROR_MSG(msg,\"All geometry warp files should have the same 3d origin found \" << globalOriginOf3DData << \" and \" << geometryWarpFile->GetOriginOf3DData());\n\n ReturnCustomErrorMacro(MPCDI_FAILURE,msg);\n\n }\n\n\n\n /* A betaMap tag must exist if profiles level is set to 2 or 4. */\n\n if (m_Level == 2 || m_Level == 3 && region->GetFileSet()->GetBetaMap() == NULL)\n\n {\n\n CREATE_ERROR_MSG(msg,\"With level \" << m_Level << \" a betamap must be present\");\n\n ReturnCustomErrorMacro(MPCDI_FAILURE,msg);\n\n }\n\n\n\n /* always contains alpha map */\n\n if (region->GetFileSet()->GetAlphaMap()==NULL) \n\n {\n\n CREATE_ERROR_MSG(msg,\"Missing alpha mape for region \" << regionIt->first);\n\n ReturnCustomErrorMacro(MPCDI_FAILURE,msg);\n", "file_path": "src/Container/mpcdiProfile.cpp", "rank": 70, "score": 58491.819892113905 }, { "content": " // Description:\n\n // A helper function. Checks if the resolution of the warp\n\n // is close enough to the resolution of the region to call\n\n // the warp per pixel, and then sets the HavePerPixelResolution flag.\n\n //\n\n // One of the profiles checks for 32x32 blocks, we don't do that yet.\n\n void CheckPerPixelResolution(Region *r,\n\n const int &xres,\n\n const int &yres);\n\n};\n\n\n\n}; // end namespace mpcdi \n\n\n\n\n\n\n\n\n", "file_path": "src/Creators/mpcdiCreateProfile.h", "rank": 71, "score": 58491.08766476878 }, { "content": "\n\n/* ====================================================================== */\n\n\n\nint main( int argc, const char ** argv )\n\n{\n\n mpcdi::Profile *Profile = NULL;\n\n if (MPCDI_FAILED(CreateExample2DMedia(Profile)))\n\n {\n\n std::cout << \"Failed to Create 2D Media Profile\" << std::endl;\n\n PAUSE;\n\n return mpcdi::MPCDI_FAILURE;\n\n }\n\n std::cout << \"Created 2D Media Profile\" << std::endl;\n\n MPCDI_FAIL_RET(Write(Profile,\"Media2D.mpcdi\"));\n\n if (Profile != NULL) { delete Profile; Profile = NULL; }\n\n\n\n if (MPCDI_FAILED(CreateExample3DSimulation(Profile)))\n\n {\n\n std::cout << \"Failed to Create 3D Simulation Profile\" << std::endl;\n\n PAUSE;\n", "file_path": "Examples/ExampleCreateProfileTypes/CreateAll.cpp", "rank": 73, "score": 29.871599640066336 }, { "content": "#include \"mpcdiWriter.h\"\n\n#include \"mpcdiCreateProfile.h\"\n\n#include \"CreateSampleData.h\"\n\n#include <iostream>\n\n\n\n#define DO_PAUSE\n\n#ifdef DO_PAUSE\n\n# define PAUSE {std::cout<< \"Press enter to continue....\";std::cin.ignore();}\n\n#else \n\n# definE PAUSE\n\n#endif\n\n\n\n/* ====================================================================== */\n\n\n\nmpcdi::MPCDI_Error CreateExample2DMedia(mpcdi::Profile *&profile);\n\nmpcdi::MPCDI_Error CreateExample3DSimulation(mpcdi::Profile *&profile);\n\nmpcdi::MPCDI_Error CreateExampleAdvanced3D(mpcdi::Profile *&profile);\n\nmpcdi::MPCDI_Error CreateExampleShaderLamp(mpcdi::Profile *&profile);\n\n\n\nmpcdi::MPCDI_Error Write(mpcdi::Profile *Profile,const std::string &FileName);\n", "file_path": "Examples/ExampleCreateProfileTypes/CreateAll.cpp", "rank": 75, "score": 23.49721194285186 }, { "content": " \n\n inline static bool IsNameStartChar( unsigned char ch ) {\n\n return ( ( ch < 128 ) ? isalpha( ch ) : 1 )\n\n || ch == ':'\n\n || ch == '_';\n\n }\n\n \n\n inline static bool IsNameChar( unsigned char ch ) {\n\n return IsNameStartChar( ch )\n\n || isdigit( ch )\n\n || ch == '.'\n\n || ch == '-';\n\n }\n\n\n\n inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX ) {\n\n int n = 0;\n\n if ( p == q ) {\n\n return true;\n\n }\n\n while( *p && *q && *p == *q && n<nChar ) {\n", "file_path": "ThirdParty/tinyxml2/tinyxml2.h", "rank": 76, "score": 20.12899996997438 }, { "content": "{\n\n if ( TIXML_SSCANF( str, \"%u\", value ) == 1 ) {\n\n return true;\n\n }\n\n return false;\n\n}\n\n\n\nbool XMLUtil::ToBool( const char* str, bool* value )\n\n{\n\n int ival = 0;\n\n if ( ToInt( str, &ival )) {\n\n *value = (ival==0) ? false : true;\n\n return true;\n\n }\n\n if ( StringEqual( str, \"true\" ) ) {\n\n *value = true;\n\n return true;\n\n }\n\n else if ( StringEqual( str, \"false\" ) ) {\n\n *value = false;\n", "file_path": "ThirdParty/tinyxml2/tinyxml2.cpp", "rank": 77, "score": 19.903180709406787 }, { "content": " mpcdi::Profile *&profile)\n\n{\n\n mpcdi::MPCDI_Error mpcdi_err = mpcdi::MPCDI_SUCCESS;\n\n\n\n /* profile settings */\n\n unsigned int X_RESOLUTION=200;\n\n unsigned int Y_RESOLUTION=200;\n\n mpcdi::ComponentDepth COMPONENT_DEPTH=mpcdi::CD_THREE;\n\n\n\n bool DoSetFrustum = true;\n\n bool DoSetBetaMap = true;\n\n bool DoSetDistortionmap = true;\n\n\n\n /* create profile */\n\n profile = new mpcdi::Profile();\n\n profile->SetProfileType(mpcdi::ProfileType2d);\n\n profile->SetLevel(1);\n\n\n\n mpcdi::Display *display= profile->GetDisplay();\n\n\n", "file_path": "Examples/ReadWriteExample/CreateSampleProfile.cpp", "rank": 78, "score": 19.896916247903896 }, { "content": " */\n\n int\n\n setcompression(int comp_level,\n\n int comp_strategy = Z_DEFAULT_STRATEGY);\n\n\n\n /**\n\n * @brief Check if file is open.\n\n * @return True if file is open.\n\n */\n\n bool\n\n is_open() const { return (file != NULL); }\n\n\n\n /**\n\n * @brief Open gzipped file.\n\n * @param name File name.\n\n * @param mode Open mode flags.\n\n * @return @c this on success, NULL on failure.\n\n */\n\n gzfilebuf*\n\n open(const char* name,\n", "file_path": "ThirdParty/zlib-1.2.7/contrib/iostream3/zfstream.h", "rank": 79, "score": 19.820505033505576 }, { "content": "#include <iostream>\n\n#include <algorithm>\n\n\n\n/* ====================================================================== */\n\n\n\nmpcdi::MPCDI_Error DrawRectangle(mpcdi::DataMap *data,\n\n const unsigned char &intensity,\n\n const int &cx,\n\n const int &cy,\n\n const int &cc,\n\n const int &Sidex, \n\n const int &Sidey);\n\nmpcdi::MPCDI_Error DrawGradientInPFM(mpcdi::PFM *data, \n\n const int &lx,\n\n const int &ly,\n\n const int &Sidex, \n\n const int &Sidey);\n\nmpcdi::MPCDI_Error DrawGradientInPFM(mpcdi::PFM *data, \n\n const int &lx,\n\n const int &ly,\n", "file_path": "Examples/ReadWriteExample/CreateSampleProfile.cpp", "rank": 80, "score": 19.5081947961285 }, { "content": "void makefixed()\n\n{\n\n unsigned low, size;\n\n struct inflate_state state;\n\n\n\n fixedtables(&state);\n\n puts(\" /* inffixed.h -- table for decoding fixed codes\");\n\n puts(\" * Generated automatically by makefixed().\");\n\n puts(\" */\");\n\n puts(\"\");\n\n puts(\" /* WARNING: this file should *not* be used by applications.\");\n\n puts(\" It is part of the implementation of this library and is\");\n\n puts(\" subject to change. Applications should only use zlib.h.\");\n\n puts(\" */\");\n\n puts(\"\");\n\n size = 1U << 9;\n\n printf(\" static const code lenfix[%u] = {\", size);\n\n low = 0;\n\n for (;;) {\n\n if ((low % 7) == 0) printf(\"\\n \");\n\n printf(\"{%u,%u,%d}\", (low & 127) == 99 ? 64 : state.lencode[low].op,\n\n state.lencode[low].bits, state.lencode[low].val);\n\n if (++low == size) break;\n\n putchar(',');\n\n }\n\n puts(\"\\n };\");\n\n size = 1U << 5;\n\n printf(\"\\n static const code distfix[%u] = {\", size);\n\n low = 0;\n\n for (;;) {\n\n if ((low % 6) == 0) printf(\"\\n \");\n\n printf(\"{%u,%u,%d}\", state.distcode[low].op, state.distcode[low].bits,\n\n state.distcode[low].val);\n\n if (++low == size) break;\n\n putchar(',');\n\n }\n\n puts(\"\\n };\");\n", "file_path": "ThirdParty/zlib-1.2.7/inflate.c", "rank": 81, "score": 19.165685906766843 }, { "content": "#endif\n\n\n\nusing namespace tinyxml2;\n\nint gPass = 0;\n\nint gFail = 0;\n\n\n\n\n\nbool XMLTest (const char* testString, const char* expected, const char* found, bool echo=true )\n\n{\n\n bool pass = !strcmp( expected, found );\n\n if ( pass )\n\n printf (\"[pass]\");\n\n else\n\n printf (\"[fail]\");\n\n\n\n if ( !echo )\n\n printf (\" %s\\n\", testString);\n\n else\n\n printf (\" %s [%s][%s]\\n\", testString, expected, found);\n\n\n", "file_path": "ThirdParty/tinyxml2/xmltest.cpp", "rank": 82, "score": 18.784694070555908 }, { "content": "{\n\n TIXML_SNPRINTF( buffer, bufferSize, \"%g\", v );\n\n}\n\n\n\n\n\nvoid XMLUtil::ToStr( double v, char* buffer, int bufferSize )\n\n{\n\n TIXML_SNPRINTF( buffer, bufferSize, \"%g\", v );\n\n}\n\n\n\n\n\nbool XMLUtil::ToInt( const char* str, int* value )\n\n{\n\n if ( TIXML_SSCANF( str, \"%d\", value ) == 1 ) {\n\n return true;\n\n }\n\n return false;\n\n}\n\n\n\nbool XMLUtil::ToUnsigned( const char* str, unsigned *value )\n", "file_path": "ThirdParty/tinyxml2/tinyxml2.cpp", "rank": 83, "score": 18.41345172151349 }, { "content": "\n\n @skip XMLElement* textApproachElement\n\n @until &v1 );\n\n*/\n\n\n\n\n\nint main( int argc, const char ** argv )\n\n{\n\n #if defined( _MSC_VER ) && defined( DEBUG )\n\n _CrtMemCheckpoint( &startMemState );\n\n #endif\n\n\n\n #if defined(_MSC_VER) || defined(MINGW32) || defined(__MINGW32__)\n\n _mkdir( \"resources/out/\" );\n\n #else\n\n mkdir( \"resources/out/\", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);\n\n #endif\n\n\n\n if ( argc > 1 ) {\n\n XMLDocument* doc = new XMLDocument();\n", "file_path": "ThirdParty/tinyxml2/xmltest.cpp", "rank": 84, "score": 18.201506840418013 }, { "content": "\n\n bool _elementJustOpened;\n\n bool _firstElement;\n\n FILE* _fp;\n\n int _depth;\n\n int _textDepth;\n\n bool _processEntities;\n\n bool _compactMode;\n\n\n\n enum {\n\n ENTITY_RANGE = 64,\n\n BUF_SIZE = 200\n\n };\n\n bool _entityFlag[ENTITY_RANGE];\n\n bool _restrictedEntityFlag[ENTITY_RANGE];\n\n\n\n DynArray< const char*, 10 > _stack;\n\n DynArray< char, 20 > _buffer;\n\n#ifdef _MSC_VER\n\n DynArray< char, 20 > _accumulator;\n\n#endif\n\n};\n\n\n\n\n\n} // tinyxml2\n\n\n\n\n\n#endif // TINYXML2_INCLUDED\n", "file_path": "ThirdParty/tinyxml2/tinyxml2.h", "rank": 85, "score": 18.192313277164835 }, { "content": " If in print to memory mode, return a pointer to\n\n the XML file in memory.\n\n */\n\n const char* CStr() const {\n\n return _buffer.Mem();\n\n }\n\n /**\n\n If in print to memory mode, return the size\n\n of the XML file in memory. (Note the size returned\n\n includes the terminating null.)\n\n */\n\n int CStrSize() const {\n\n return _buffer.Size();\n\n }\n\n\n\nprivate:\n\n void SealElement();\n\n void PrintSpace( int depth );\n\n void PrintString( const char*, bool restrictedEntitySet ); // prints out, after detecting entities.\n\n void Print( const char* format, ... );\n", "file_path": "ThirdParty/tinyxml2/tinyxml2.h", "rank": 86, "score": 18.10712259007711 }, { "content": " ++p;\n\n ++q;\n\n ++n;\n\n }\n\n if ( (n == nChar) || ( *p == 0 && *q == 0 ) ) {\n\n return true;\n\n }\n\n return false;\n\n }\n\n \n\n inline static int IsUTF8Continuation( const char p ) {\n\n return p & 0x80;\n\n }\n\n\n\n static const char* ReadBOM( const char* p, bool* hasBOM );\n\n // p is the starting location,\n\n // the UTF-8 value of the entity will be placed in value, and length filled in.\n\n static const char* GetCharacterRef( const char* p, char* value, int* length );\n\n static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );\n\n\n", "file_path": "ThirdParty/tinyxml2/tinyxml2.h", "rank": 87, "score": 17.577641784102095 }, { "content": "/*\n\n * Test program for gzifstream and gzofstream\n\n *\n\n * by Ludwig Schwardt <[email protected]>\n\n * original version by Kevin Ruland <[email protected]>\n\n */\n\n\n\n#include \"zfstream.h\"\n\n#include <iostream> // for cout\n\n\n\nint main() {\n\n\n\n gzofstream outf;\n\n gzifstream inf;\n\n char buf[80];\n\n\n\n outf.open(\"test1.txt.gz\");\n\n outf << \"The quick brown fox sidestepped the lazy canine\\n\"\n\n << 1.3 << \"\\nPlan \" << 9 << std::endl;\n\n outf.close();\n", "file_path": "ThirdParty/zlib-1.2.7/contrib/iostream3/test.cc", "rank": 88, "score": 17.205750653109302 }, { "content": " /// Add a comment\n\n void PushComment( const char* comment );\n\n\n\n void PushDeclaration( const char* value );\n\n void PushUnknown( const char* value );\n\n\n\n virtual bool VisitEnter( const XMLDocument& /*doc*/ );\n\n virtual bool VisitExit( const XMLDocument& /*doc*/ ) {\n\n return true;\n\n }\n\n\n\n virtual bool VisitEnter( const XMLElement& element, const XMLAttribute* attribute );\n\n virtual bool VisitExit( const XMLElement& element );\n\n\n\n virtual bool Visit( const XMLText& text );\n\n virtual bool Visit( const XMLComment& comment );\n\n virtual bool Visit( const XMLDeclaration& declaration );\n\n virtual bool Visit( const XMLUnknown& unknown );\n\n\n\n /**\n", "file_path": "ThirdParty/tinyxml2/tinyxml2.h", "rank": 89, "score": 17.0624355111628 }, { "content": " // converts primitive types to strings\n\n static void ToStr( int v, char* buffer, int bufferSize );\n\n static void ToStr( unsigned v, char* buffer, int bufferSize );\n\n static void ToStr( bool v, char* buffer, int bufferSize );\n\n static void ToStr( float v, char* buffer, int bufferSize );\n\n static void ToStr( double v, char* buffer, int bufferSize );\n\n\n\n // converts strings to primitive types\n\n static bool ToInt( const char* str, int* value );\n\n static bool ToUnsigned( const char* str, unsigned* value );\n\n static bool ToBool( const char* str, bool* value );\n\n static bool ToFloat( const char* str, float* value );\n\n static bool ToDouble( const char* str, double* value );\n\n};\n\n\n\n\n\n/** XMLNode is a base class for every object that is in the\n\n XML Document Object Model (DOM), except XMLAttributes.\n\n Nodes have siblings, a parent, and children which can\n\n be navigated. A node is always in a XMLDocument.\n", "file_path": "ThirdParty/tinyxml2/tinyxml2.h", "rank": 90, "score": 16.891334537962873 }, { "content": " // Build mode string for gzopen and check it [27.8.1.3.2]\n\n char char_mode[6] = \"\\0\\0\\0\\0\\0\";\n\n if (!this->open_mode(mode, char_mode))\n\n return NULL;\n\n\n\n // Attempt to open file\n\n if ((file = gzopen(name, char_mode)) == NULL)\n\n return NULL;\n\n\n\n // On success, allocate internal buffer and set flags\n\n this->enable_buffer();\n\n io_mode = mode;\n\n own_fd = true;\n\n return this;\n\n}\n\n\n\n// Attach to gzipped file\n\ngzfilebuf*\n\ngzfilebuf::attach(int fd,\n\n std::ios_base::openmode mode)\n", "file_path": "ThirdParty/zlib-1.2.7/contrib/iostream3/zfstream.cc", "rank": 91, "score": 16.665663873893916 }, { "content": " if ( pass )\n\n ++gPass;\n\n else\n\n ++gFail;\n\n return pass;\n\n}\n\n\n\n\n\ntemplate< class T > bool XMLTest( const char* testString, T expected, T found, bool echo=true )\n\n{\n\n bool pass = ( expected == found );\n\n if ( pass )\n\n printf (\"[pass]\");\n\n else\n\n printf (\"[fail]\");\n\n\n\n if ( !echo )\n\n printf (\" %s\\n\", testString);\n\n else\n\n printf (\" %s [%d][%d]\\n\", testString, static_cast<int>(expected), static_cast<int>(found) );\n", "file_path": "ThirdParty/tinyxml2/xmltest.cpp", "rank": 92, "score": 16.38243001137579 }, { "content": "\n\n#include \"zfstream.h\"\n\n\n\ngzfilebuf::gzfilebuf() :\n\n file(NULL),\n\n mode(0),\n\n own_file_descriptor(0)\n\n{ }\n\n\n\ngzfilebuf::~gzfilebuf() {\n\n\n\n sync();\n\n if ( own_file_descriptor )\n\n close();\n\n\n\n}\n\n\n\ngzfilebuf *gzfilebuf::open( const char *name,\n\n int io_mode ) {\n\n\n", "file_path": "ThirdParty/zlib-1.2.7/contrib/iostream/zfstream.cpp", "rank": 93, "score": 16.374287001933983 }, { "content": " QueryUnsignedAttribute( name, &i );\n\n return i;\n\n }\n\n /// See IntAttribute()\n\n bool BoolAttribute( const char* name ) const {\n\n bool b=false;\n\n QueryBoolAttribute( name, &b );\n\n return b;\n\n }\n\n /// See IntAttribute()\n\n double DoubleAttribute( const char* name ) const {\n\n double d=0;\n\n QueryDoubleAttribute( name, &d );\n\n return d;\n\n }\n\n /// See IntAttribute()\n\n float FloatAttribute( const char* name ) const {\n\n float f=0;\n\n QueryFloatAttribute( name, &f );\n\n return f;\n", "file_path": "ThirdParty/tinyxml2/tinyxml2.h", "rank": 94, "score": 15.991136802015633 }, { "content": " mpcdiGetConstMacro(DoProfileValidation, bool); \n\n\n\nprotected:\n\n // Description:\n\n // Member variables\n\n bool m_OverwriteExistingFile;\n\n bool m_DoProfileValidation;\n\n};\n\n\n\n}; // end namespace mpcdi \n", "file_path": "src/IO/mpcdiWriter.h", "rank": 95, "score": 15.84146018750793 }, { "content": " doc.Parse( xml );\n\n XMLTest( \"Ill formed XML\", true, doc.Error() );\n\n }\n\n\n\n // QueryXYZText\n\n {\n\n const char* xml = \"<point> <x>1.2</x> <y>1</y> <z>38</z> <valid>true</valid> </point>\";\n\n XMLDocument doc;\n\n doc.Parse( xml );\n\n\n\n const XMLElement* pointElement = doc.RootElement();\n\n\n\n int intValue = 0;\n\n unsigned unsignedValue = 0;\n\n float floatValue = 0;\n\n double doubleValue = 0;\n\n bool boolValue = false;\n\n\n\n pointElement->FirstChildElement( \"y\" )->QueryIntText( &intValue );\n\n pointElement->FirstChildElement( \"y\" )->QueryUnsignedText( &unsignedValue );\n", "file_path": "ThirdParty/tinyxml2/xmltest.cpp", "rank": 96, "score": 15.81549106043675 }, { "content": "distribution.\n\n*/\n\n\n\n#include \"tinyxml2.h\"\n\n\n\n#include <new> // yes, this one new style header, is in the Android SDK.\n\n# ifdef ANDROID_NDK\n\n# include <stddef.h>\n\n#else\n\n# include <cstddef>\n\n#endif\n\n\n\nstatic const char LINE_FEED = (char)0x0a; // all line endings are normalized to LF\n\nstatic const char LF = LINE_FEED;\n\nstatic const char CARRIAGE_RETURN = (char)0x0d; // CR gets filtered out\n\nstatic const char CR = CARRIAGE_RETURN;\n\nstatic const char SINGLE_QUOTE = '\\'';\n\nstatic const char DOUBLE_QUOTE = '\\\"';\n\n\n\n// Bunch of unicode info at:\n", "file_path": "ThirdParty/tinyxml2/tinyxml2.cpp", "rank": 97, "score": 15.567703052587426 }, { "content": " return true;\n\n }\n\n return false;\n\n}\n\n\n\n\n\nbool XMLUtil::ToFloat( const char* str, float* value )\n\n{\n\n if ( TIXML_SSCANF( str, \"%f\", value ) == 1 ) {\n\n return true;\n\n }\n\n return false;\n\n}\n\n\n\nbool XMLUtil::ToDouble( const char* str, double* value )\n\n{\n\n if ( TIXML_SSCANF( str, \"%lf\", value ) == 1 ) {\n\n return true;\n\n }\n\n return false;\n", "file_path": "ThirdParty/tinyxml2/tinyxml2.cpp", "rank": 98, "score": 15.528728057551135 } ]
C++
visual/gl/univtrans_sse2.cpp
wtnbgo/krkrz
d9bcf1b08b694385e1fab68fe56501c7fbbd9332
#include "tjsCommHead.h" #include "simd_def_x86x64.h" #include "tvpgl.h" #include "tvpgl_ia32_intf.h" extern "C" { extern unsigned char TVPOpacityOnOpacityTable[256*256]; extern unsigned char TVPNegativeMulTable[256*256]; } struct sse2_univ_trans_blend_func { const __m128i zero_; const tjs_uint32 *table_; inline sse2_univ_trans_blend_func(const tjs_uint32 *t) : zero_( _mm_setzero_si128() ), table_(t) {} inline tjs_uint32 operator()( tjs_uint32 s1, tjs_uint32 s2, tjs_uint8 rule) const { __m128i ms1 = _mm_cvtsi32_si128( s1 ); __m128i ms2 = _mm_cvtsi32_si128( s2 ); __m128i mopa = _mm_cvtsi32_si128( table_[rule] ); mopa = _mm_unpacklo_epi32( mopa, mopa ); ms1 = _mm_unpacklo_epi8( ms1, zero_ ); ms2 = _mm_unpacklo_epi8( ms2, zero_ ); ms2 = _mm_sub_epi16( ms2, ms1 ); ms2 = _mm_mullo_epi16( ms2, mopa ); ms2 = _mm_srli_epi16( ms2, 8 ); ms1 = _mm_add_epi8( ms1, ms2 ); ms1 = _mm_packus_epi16( ms1, zero_ ); return _mm_cvtsi128_si32( ms1 ); } inline __m128i operator()( __m128i ms11, __m128i ms21, const tjs_uint8 *rule ) const { __m128i ms12 = ms11; __m128i ms22 = ms21; __m128i mopa = _mm_cvtsi32_si128( table_[rule[0]] ); __m128i mopa2 = _mm_cvtsi32_si128( table_[rule[1]] ); mopa = _mm_unpacklo_epi32( mopa, mopa2 ); mopa = _mm_unpacklo_epi32( mopa, mopa ); ms21 = _mm_unpacklo_epi8( ms21, zero_ ); ms11 = _mm_unpacklo_epi8( ms11, zero_ ); ms21 = _mm_sub_epi16( ms21, ms11 ); ms21 = _mm_mullo_epi16( ms21, mopa ); ms21 = _mm_srli_epi16( ms21, 8 ); ms11 = _mm_add_epi8( ms11, ms21 ); mopa = _mm_cvtsi32_si128( table_[rule[2]] ); mopa2 = _mm_cvtsi32_si128( table_[rule[3]] ); mopa = _mm_unpacklo_epi32( mopa, mopa2 ); mopa = _mm_unpacklo_epi32( mopa, mopa ); ms22 = _mm_unpackhi_epi8( ms22, zero_ ); ms12 = _mm_unpackhi_epi8( ms12, zero_ ); ms22 = _mm_sub_epi16( ms22, ms12 ); ms22 = _mm_mullo_epi16( ms22, mopa ); ms22 = _mm_srli_epi16( ms22, 8 ); ms12 = _mm_add_epi8( ms12, ms22 ); return _mm_packus_epi16( ms11, ms12 ); } #if 0 inline void operator()( tjs_uint32 *d, const tjs_uint32 *s1, const tjs_uint32 *s2, const tjs_uint8 *rule ) const { __m128i ms1 = _mm_loadl_epi64( (const __m128i*)s1 ); __m128i ms2 = _mm_loadl_epi64( (const __m128i*)s2 ); __m128i mopa = _mm_cvtsi32_si128( table_[rule[0]] ); __m128i mopa2 = _mm_cvtsi32_si128( table_[rule[1]] ); mopa = _mm_unpacklo_epi32( mopa, mopa2 ); mopa = _mm_unpacklo_epi32( mopa, mopa ); ms1 = _mm_unpacklo_epi8( ms1, zero_ ); ms2 = _mm_unpacklo_epi8( ms2, zero_ ); ms1 = _mm_sub_epi16( ms1, ms2 ); ms1 = _mm_mulhi_epi16( ms1, mopa ); ms1 = _mm_slli_epi16( ms1, 1 ); ms2 = _mm_add_epi16( ms2, ms1 ); ms2 = _mm_packus_epi16( ms2, zero_ ); _mm_storel_epi64((__m128i*)d, ms2); } #endif }; struct sse2_univ_trans_d_blend_func { const __m128i zero_; const tjs_uint32 *table_; inline sse2_univ_trans_d_blend_func(const tjs_uint32 *t) : zero_( _mm_setzero_si128() ), table_(t) {} inline tjs_uint32 operator()( tjs_uint32 s1, tjs_uint32 s2, tjs_uint8 rule) const { tjs_uint32 a1 = s1 >> 24; tjs_uint32 a2 = s2 >> 24; tjs_int opa = table_[rule]; tjs_uint32 addr = (a2*opa & 0xff00) + (a1*(256-opa) >> 8); tjs_int alpha = TVPOpacityOnOpacityTable[addr]; __m128i mopa = _mm_cvtsi32_si128( alpha ); mopa = _mm_unpacklo_epi16( mopa, mopa ); mopa = _mm_unpacklo_epi16( mopa, mopa ); __m128i ms1 = _mm_cvtsi32_si128( s1 ); __m128i ms2 = _mm_cvtsi32_si128( s2 ); ms1 = _mm_unpacklo_epi8( ms1, zero_ ); ms2 = _mm_unpacklo_epi8( ms2, zero_ ); ms2 = _mm_sub_epi16( ms2, ms1 ); ms2 = _mm_mullo_epi16( ms2, mopa ); ms2 = _mm_srli_epi16( ms2, 8 ); ms1 = _mm_add_epi8( ms1, ms2 ); ms1 = _mm_packus_epi16( ms1, zero_ ); tjs_uint32 dst_alpha = TVPNegativeMulTable[addr]<<24; return (_mm_cvtsi128_si32( ms1 )&0x00ffffff) | dst_alpha; } inline __m128i operator()( __m128i ms11, __m128i ms21, const tjs_uint8 *rule ) const { __m128i a1 = ms11; a1 = _mm_srli_epi32( a1, 24 ); __m128i a2 = ms21; a2 = _mm_srli_epi32( a2, 24 ); __m128i mopa = _mm_cvtsi32_si128( table_[rule[0]] ); __m128i mopa2 = _mm_cvtsi32_si128( table_[rule[1]] ); mopa = _mm_unpacklo_epi32( mopa, mopa2 ); mopa2 = _mm_cvtsi32_si128( table_[rule[2]] ); __m128i mopa3 = _mm_cvtsi32_si128( table_[rule[3]] ); mopa2 = _mm_unpacklo_epi32( mopa2, mopa3 ); mopa = _mm_unpacklo_epi64( mopa, mopa2 ); a2 = _mm_mullo_epi16( a2, mopa ); __m128i mask = _mm_set1_epi32( 0x0000ff00 ); a2 = _mm_and_si128( a2, mask ); #if 0 mask = _mm_srli_epi32( mask, 8 ); mopa = _mm_xor_si128( mopa, mask ); a1 = _mm_mullo_epi16( a1, mopa ); #else __m128i invopa = _mm_set1_epi32( 256 ); invopa = _mm_sub_epi16( invopa, mopa ); a1 = _mm_mullo_epi16( a1, invopa ); #endif a1 = _mm_srli_epi32( a1, 8 ); a1 = _mm_or_si128( a1, a2 ); tjs_uint32 addr = _mm_cvtsi128_si32( a1 ); tjs_uint32 opa = TVPOpacityOnOpacityTable[addr]; mopa = _mm_cvtsi32_si128( opa ); a1 = _mm_shuffle_epi32( a1, _MM_SHUFFLE( 0, 3, 2, 1 ) ); addr = _mm_cvtsi128_si32( a1 ); opa = TVPOpacityOnOpacityTable[addr]; mopa2 = _mm_cvtsi32_si128( opa ); mopa = _mm_unpacklo_epi16( mopa, mopa2 ); mopa = _mm_unpacklo_epi16( mopa, mopa ); mopa = _mm_unpacklo_epi16( mopa, mopa ); __m128i ms12 = ms11; __m128i ms22 = ms21; ms21 = _mm_unpacklo_epi8( ms21, zero_ ); ms11 = _mm_unpacklo_epi8( ms11, zero_ ); ms21 = _mm_sub_epi16( ms21, ms11 ); ms21 = _mm_mullo_epi16( ms21, mopa ); ms21 = _mm_srli_epi16( ms21, 8 ); ms11 = _mm_add_epi8( ms11, ms21 ); a1 = _mm_shuffle_epi32( a1, _MM_SHUFFLE( 0, 3, 2, 1 ) ); addr = _mm_cvtsi128_si32( a1 ); opa = TVPOpacityOnOpacityTable[addr]; mopa = _mm_cvtsi32_si128( opa ); a1 = _mm_shuffle_epi32( a1, _MM_SHUFFLE( 0, 3, 2, 1 ) ); addr = _mm_cvtsi128_si32( a1 ); opa = TVPOpacityOnOpacityTable[addr]; mopa2 = _mm_cvtsi32_si128( opa ); mopa = _mm_unpacklo_epi16( mopa, mopa2 ); mopa = _mm_unpacklo_epi16( mopa, mopa ); mopa = _mm_unpacklo_epi16( mopa, mopa ); ms22 = _mm_unpackhi_epi8( ms22, zero_ ); ms12 = _mm_unpackhi_epi8( ms12, zero_ ); ms22 = _mm_sub_epi16( ms22, ms12 ); ms22 = _mm_mullo_epi16( ms22, mopa ); ms22 = _mm_srli_epi16( ms22, 8 ); ms12 = _mm_add_epi8( ms12, ms22 ); ms11 = _mm_packus_epi16( ms11, ms12 ); a1 = _mm_shuffle_epi32( a1, _MM_SHUFFLE( 0, 3, 2, 1 ) ); mask = _mm_set1_epi32( 0x0000ffff ); a1 = _mm_xor_si128( a1, mask ); __m128i mtmp = a1; a1 = _mm_slli_epi32( a1, 8 ); mtmp = _mm_slli_epi16( mtmp, 8 ); mtmp = _mm_slli_epi32( mtmp, 8 ); a1 = _mm_mullo_epi16( a1, mtmp ); a1 = _mm_srli_epi32( a1, 16 ); a1 = _mm_andnot_si128( a1, mask ); a1 = _mm_srli_epi16( a1, 8 ); a1 = _mm_slli_epi32( a1, 24 ); const __m128i colormask = _mm_set1_epi32(0x00ffffff); ms11 = _mm_and_si128( ms11, colormask ); return _mm_or_si128( ms11, a1 ); } }; void TVPInitUnivTransBlendTable_sse2_c(tjs_uint32 *table, tjs_int phase, tjs_int vague) { tjs_int i = 0; tjs_int phasemax = phase; phase -= vague; for(; i < phase; i++ ) table[i] = (255<<16)|(255); if( phasemax > 256 ) phasemax = 256; for(;i < phasemax; i++ ) { short tmp = (255-(( i - phase )*255 / vague)); if(tmp<0) tmp = 0; if(tmp>255) tmp = 255; table[i] = (tmp << 16) | (tmp & 0xffff); } for(;i < 256; i++ ) table[i] = 0; } void TVPInitUnivTransBlendTable_d_sse2_c(tjs_uint32 *table, tjs_int phase, tjs_int vague) { tjs_int i = 0; tjs_int phasemax = phase; phase -= vague; for(; i < phase; i++ ) table[i] = 255; if( phasemax > 256 ) phasemax = 256; for(;i < phasemax; i++ ) { short tmp = (255-(( i - phase )*255 / vague)); if(tmp<0) tmp = 0; if(tmp>255) tmp = 255; table[i] = tmp & 0xffff; } for(;i < 256; i++ ) table[i] = 0; } template<typename func_t> static inline void sse2_univ_trans(tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, const tjs_uint8 *rule, const tjs_uint32 *table, tjs_int len) { if( len <= 0 ) return; func_t func(table); tjs_int count = (tjs_int)(((unsigned)dest)&0xF); if( count ) { count = (16 - count)>>2; count = count > len ? len : count; tjs_uint32* limit = dest + count; while( dest < limit ) { *dest = func( *src1, *src2, *rule ); dest++; src1++; src2++, rule++; } len -= count; } tjs_uint32 rem = (len>>2)<<2; tjs_uint32* limit = dest + rem; if( ((((unsigned)src1)&0xF) == 0) && (((unsigned)src2)&0xF) == 0 ) { while( dest < limit ) { __m128i ms11 = _mm_load_si128( (__m128i const*)src1 ); __m128i ms21 = _mm_load_si128( (__m128i const*)src2 ); _mm_store_si128( (__m128i*)dest, func(ms11, ms21, rule) ); src1 += 4; src2 += 4; rule += 4; dest += 4; } } else { while( dest < limit ) { __m128i ms11 = _mm_loadu_si128( (__m128i const*)src1 ); __m128i ms21 = _mm_loadu_si128( (__m128i const*)src2 ); _mm_store_si128( (__m128i*)dest, func(ms11, ms21, rule) ); src1 += 4; src2 += 4; rule += 4; dest += 4; } } limit += (len-rem); while( dest < limit ) { *dest = func( *src1, *src2, *rule ); dest++; src1++; src2++, rule++; } } template<typename func_t> static inline void sse2_univ_trans_switch(tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, const tjs_uint8 *rule, const tjs_uint32 *table, tjs_int len, tjs_int src1lv, tjs_int src2lv) { if( len <= 0 ) return; func_t func(table); tjs_int count = (tjs_int)(((unsigned)dest)&0xF); if( count ) { count = (16 - count)>>2; count = count > len ? len : count; tjs_uint32* limit = dest + count; while( dest < limit ) { tjs_int opa = *rule; if( opa >= src1lv ) { *dest = *src1; rule++; src1++; src2++; dest++; } else if(opa < src2lv) { *dest = *src2; rule++; src1++; src2++; dest++; } else { *dest = func( *src1, *src2, *rule ); dest++; src1++; src2++, rule++; } } len -= count; } tjs_uint32 rem = (len>>2)<<2; tjs_uint32* limit = dest + rem; const __m128i msrc1lv = _mm_set1_epi32(src1lv); const __m128i msrc2lv = _mm_set1_epi32(src2lv); const __m128i not = _mm_set1_epi32(0xffffffff); while( dest < limit ) { tjs_uint32 r = *(tjs_uint32*)rule; __m128i mr = _mm_cvtsi32_si128( r ); mr = _mm_unpacklo_epi8( mr, func.zero_ ); mr = _mm_unpacklo_epi16( mr, func.zero_ ); __m128i opa1 = mr; opa1 = _mm_cmplt_epi32( opa1, msrc1lv ); __m128i md = opa1; __m128i ms11 = _mm_loadu_si128( (__m128i const*)src1 ); md = _mm_andnot_si128( md, ms11 ); if( _mm_movemask_epi8(opa1) != 0 ) { __m128i ms21 = _mm_loadu_si128( (__m128i const*)src2 ); opa1 = _mm_xor_si128( opa1, not ); __m128i opa2 = mr; opa2 = _mm_cmplt_epi32( mr, msrc2lv ); opa1 = _mm_or_si128( opa1, opa2 ); opa2 = _mm_and_si128( opa2, ms21 ); md = _mm_or_si128( md, opa2 ); if( _mm_movemask_epi8(opa1) != 0xffff ) { __m128i blend = func(ms11, ms21, rule); opa1 = _mm_andnot_si128( opa1, blend ); md = _mm_or_si128( md, opa1 ); } } _mm_store_si128( (__m128i*)dest, md ); src1 += 4; src2 += 4; rule += 4; dest += 4; } limit += (len-rem); while( dest < limit ) { tjs_int opa = *rule; if( opa >= src1lv ) { *dest = *src1; rule++; src1++; src2++; dest++; } else if(opa < src2lv) { *dest = *src2; rule++; src1++; src2++; dest++; } else { *dest = func( *src1, *src2, *rule ); dest++; src1++; src2++, rule++; } } } void TVPUnivTransBlend_sse2_c(tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, const tjs_uint8 *rule, const tjs_uint32 *table, tjs_int len) { sse2_univ_trans<sse2_univ_trans_blend_func>(dest,src1,src2,rule,table,len); } void TVPUnivTransBlend_switch_sse2_c(tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, const tjs_uint8 *rule, const tjs_uint32 *table, tjs_int len, tjs_int src1lv, tjs_int src2lv) { sse2_univ_trans_switch<sse2_univ_trans_blend_func>(dest,src1,src2,rule,table,len,src1lv,src2lv); } void TVPUnivTransBlend_d_sse2_c(tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, const tjs_uint8 *rule, const tjs_uint32 *table, tjs_int len) { sse2_univ_trans<sse2_univ_trans_d_blend_func>(dest,src1,src2,rule,table,len); } void TVPUnivTransBlend_switch_d_sse2_c(tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, const tjs_uint8 *rule, const tjs_uint32 *table, tjs_int len, tjs_int src1lv, tjs_int src2lv) { sse2_univ_trans_switch<sse2_univ_trans_d_blend_func>(dest,src1,src2,rule,table,len,src1lv,src2lv); }
#include "tjsCommHead.h" #include "simd_def_x86x64.h" #include "tvpgl.h" #include "tvpgl_ia32_intf.h" extern "C" { extern unsigned char TVPOpacityOnOpacityTable[256*256]; extern unsigned char TVPNegativeMulTable[256*256]; } struct sse2_univ_trans_blend_func { const __m128i zero_; const tjs_uint32 *table_; inline sse2_univ_trans_blend_func(const tjs_uint32 *t) : zero_( _mm_setzero_si128() ), table_(t) {} inline tjs_uint32 operator()( tjs_uint32 s1, tjs_uint32 s2, tjs_uint8 rule) const { __m128i ms1 = _mm_cvtsi32_si128( s1 ); __m128i ms2 = _mm_cvtsi32_si128( s2 ); __m128i mopa = _mm_cvtsi32_si128( table_[rule] ); mopa = _mm_unpacklo_epi32( mopa, mopa ); ms1 = _mm_unpacklo_epi8( ms1, zero_ ); ms2 = _mm_unpacklo_epi8( ms2, zero_ ); ms2 = _mm_sub_epi16( ms2, ms1 ); ms2 = _mm_mullo_epi16( ms2, mopa ); ms2 = _mm_srli_epi16( ms2, 8 ); ms1 = _mm_add_epi8( ms1, ms2 ); ms1 = _mm_packus_epi16( ms1, zero_ ); return _mm_cvtsi128_si32( ms1 ); } inline __m128i operator()( __m128i ms11, __m128i ms21, const tjs_uint8 *rule ) const { __m128i ms12 = ms11; __m128i ms22 = ms21; __m128i mopa = _mm_cvtsi32_si128( table_[rule[0]] ); __m128i mopa2 = _mm_cvtsi32_si128( table_[rule[1]] ); mopa = _mm_unpacklo_epi32( mopa, mopa2 ); mopa = _mm_unpacklo_epi32( mopa, mopa ); ms21 = _mm_unpacklo_epi8( ms21, zero_ ); ms11 = _mm_unpacklo_epi8( ms11, zero_ ); ms21 = _mm_sub_epi16( ms21, ms11 ); ms21 = _mm_mullo_epi16( ms21, mopa ); ms21 = _mm_srli_epi16( ms21, 8 ); ms11 = _mm_add_epi8( ms11, ms21 ); mopa = _mm_cvtsi32_si128( table_[rule[2]] ); mopa2 = _mm_cvtsi32_si128( table_[rule[3]] ); mopa = _mm_unpacklo_epi32( mopa, mopa2 ); mopa = _mm_unpacklo_epi32( mopa, mopa ); ms22 = _mm_unpackhi_epi8( ms22, zero_ ); ms12 = _mm_unpackhi_epi8( ms12, zero_ ); ms22 = _mm_sub_epi16( ms22, ms12 ); ms22 = _mm_mullo_epi16( ms22, mopa ); ms22 = _mm_srli_epi16( ms22, 8 ); ms12 = _mm_add_epi8( ms12, ms22 ); return _mm_packus_epi16( ms11, ms12 ); } #if 0 inline void operator()( tjs_uint32 *d, const tjs_uint32 *s1, const tjs_uint32 *s2, const tjs_uint8 *rule ) const { __m128i ms1 = _mm_loadl_epi64( (const __m128i*)s1 ); __m128i ms2 = _mm_loadl_epi64( (const __m128i*)s2 ); __m128i mopa = _mm_cvtsi32_si128( table_[rule[0]] ); __m128i mopa2 = _mm_cvtsi32_si128( table_[rule[1]] ); mopa = _mm_unpacklo_epi32( mopa, mopa2 ); mopa = _mm_unpacklo_epi32( mopa, mopa ); ms1 = _mm_unpacklo_epi8( ms1, zero_ ); ms2 = _mm_unpacklo_epi8( ms2, zero_ ); ms1 = _mm_sub_epi16( ms1, ms2 ); ms1 = _mm_mulhi_epi16( ms1, mopa ); ms1 = _mm_slli_epi16( ms1, 1 ); ms2 = _mm_add_epi16( ms2, ms1 ); ms2 = _mm_packus_epi16( ms2, zero_ ); _mm_storel_epi64((__m128i*)d, ms2); } #endif }; struct sse2_univ_trans_d_blend_func { const __m128i zero_; const tjs_uint32 *table_; inline sse2_univ_trans_d_blend_func(const tjs_uint32 *t) : zero_( _mm_setzero_si128() ), table_(t) {} inline tjs_uint32 operator()( tjs_uint32 s1, tjs_uint32 s2, tjs_uint8 rule) const { tjs_uint32 a1 = s1 >> 24; tjs_uint32 a2 = s2 >> 24; tjs_int opa = table_[rule]; tjs_uint32 addr = (a2*opa & 0xff00) + (a1*(256-opa) >> 8); tjs_int alpha = TVPOpacityOnOpacityTable[addr]; __m128i mopa = _mm_cvtsi32_si128( alpha ); mopa = _mm_unpacklo_epi16( mopa, mopa ); mopa = _mm_unpacklo_epi16( mopa, mopa ); __m128i ms1 = _mm_cvtsi32_si128( s1 ); __m128i ms2 = _mm_cvtsi32_si128( s2 ); ms1 = _mm_unpacklo_epi8( ms1, zero_ ); ms2 = _mm_unpacklo_epi8( ms2, zero_ ); ms2 = _mm_sub_epi16( ms2, ms1 ); ms2 = _mm_mullo_epi16( ms2, mopa ); ms2 = _mm_srli_epi16( ms2, 8 ); ms1 = _mm_add_epi8( ms1, ms2 ); ms1 = _mm_packus_epi16( ms1, zero_ ); tjs_uint32 dst_alpha = TVPNegativeMulTable[addr]<<24; return (_mm_cvtsi128_si32( ms1 )&0x00ffffff) | dst_alpha; } inline __m128i operator()( __m128i ms11, __m128i ms21, const tjs_uint8 *rule ) const { __m128i a1 = ms11; a1 = _mm_srli_epi32( a1, 24 ); __m128i a2 = ms21; a2 = _mm_srli_epi32( a2, 24 ); __m128i mopa = _mm_cvtsi32_si128( table_[rule[0]] ); __m128i mopa2 = _mm_cvtsi32_si128( table_[rule[1]] ); mopa = _mm_unpacklo_epi32( mopa, mopa2 ); mopa2 = _mm_cvtsi32_si128( table_[rule[2]] ); __m128i mopa3 = _mm_cvtsi32_si128( table_[rule[3]] ); mopa2 = _mm_unpacklo_epi32( mopa2, mopa3 ); mopa = _mm_unpacklo_epi64( mopa, mopa2 ); a2 = _mm_mullo_epi16( a2, mopa ); __m128i mask = _mm_set1_epi32( 0x0000ff00 ); a2 = _mm_and_si128( a2, mask ); #if 0 mask = _mm_srli_epi32( mask, 8 ); mopa = _mm_xor_si128( mopa, mask ); a1 = _mm_mullo_epi16( a1, mopa ); #else __m128i invopa = _mm_set1_epi32( 256 ); invopa = _mm_sub_epi16( invopa, mopa ); a1 = _mm_mullo_epi16( a1, invopa ); #endif a1 = _mm_srli_epi32( a1, 8 ); a1 = _mm_or_si128( a1, a2 ); tjs_uint32 addr = _mm_cvtsi128_si32( a1 ); tjs_uint32 opa = TVPOpacityOnOpacityTable[addr]; mopa = _mm_cvtsi32_si128( opa ); a1 = _mm_shuffle_epi32( a1, _MM_SHUFFLE( 0, 3, 2, 1 ) ); addr = _mm_cvtsi128_si32( a1 ); opa = TVPOpacityOnOpacityTable[addr]; mopa2 = _mm_cvtsi32_si128( opa ); mopa = _mm_unpacklo_epi16( mopa, mopa2 ); mopa = _mm_unpacklo_epi16( mopa, mopa ); mopa = _mm_unpacklo_epi16( mopa, mopa ); __m128i ms12 = ms11; __m128i ms22 = ms21; ms21 = _mm_unpacklo_epi8( ms21, zero_ ); ms11 = _mm_unpacklo_epi8( ms11, zero_ ); ms21 = _mm_sub_epi16( ms21, ms11 ); ms21 = _mm_mullo_epi16( ms21, mopa ); ms21 = _mm_srli_epi16( ms21, 8 ); ms11 = _mm_add_epi8( ms11, ms21 ); a1 = _mm_shuffle_epi32( a1, _MM_SHUFFLE( 0, 3, 2, 1 ) ); addr = _mm_cvtsi128_si32( a1 ); opa = TVPOpacityOnOpacityTable[addr]; mopa = _mm_cvtsi32_si128( opa ); a1 = _mm_shuffle_epi32( a1, _MM_SHUFFLE( 0, 3, 2, 1 ) ); addr = _mm_cvtsi128_si32( a1 ); opa = TVPOpacityOnOpacityTable[addr]; mopa2 = _mm_cvtsi32_si128( opa ); mopa = _mm_unpacklo_epi16( mopa, mopa2 ); mopa = _mm_unpacklo_epi16( mopa, mopa ); mopa = _mm_unpacklo_epi16( mopa, mopa ); ms22 = _mm_unpackhi_epi8( ms22, zero_ ); ms12 = _mm_unpackhi_epi8( ms12, zero_ ); ms22 = _mm_sub_epi16( ms22, ms12 ); ms22 = _mm_mullo_epi16( ms22, mopa ); ms22 = _mm_srli_epi16( ms22, 8 ); ms12 = _mm_add_epi8( ms12, ms22 ); ms11 = _mm_packus_epi16( ms11, ms12 ); a1 = _mm_shuffle_epi32( a1, _MM_SHUFFLE( 0, 3, 2, 1 ) ); mask = _mm_set1_epi32( 0x0000ffff ); a1 = _mm_xor_si128( a1, mask ); __m128i mtmp = a1; a1 = _mm_slli_epi32( a1, 8 ); mtmp = _mm_slli_epi16( mtmp, 8 ); mtmp = _mm_slli_epi32( mtmp, 8 ); a1 = _mm_mullo_epi16( a1, mtmp ); a1 = _mm_srli_epi32( a1, 16 ); a1 = _mm_andnot_si128( a1, mask ); a1 = _mm_srli_epi16( a1, 8 ); a1 = _mm_slli_epi32( a1, 24 ); const __m128i colormask = _mm_set1_epi32(0x00ffffff); ms11 = _mm_and_si128( ms11, colormask ); return _mm_or_si128( ms11, a1 ); } }; void TVPInitUnivTransBlendTable_sse2_c(tjs_uint32 *table, tjs_int phase, tjs_int vague) { tjs_int i = 0; tjs_int phasemax = phase; phase -= vague; for(; i < phase; i++ ) table[i] = (255<<16)|(255); if( phasemax > 256 ) phasemax = 256; for(;i < phasemax; i++ ) { short tmp = (255-(( i - phase )*255 / vague)); if(tmp<0) tmp = 0; if(tmp>255) tmp = 255; table[i] = (tmp << 16) | (tmp & 0xffff); } for(;i < 256; i++ ) table[i] = 0; } void TVPInitUnivTransBlendTable_d_sse2_c(tjs_uint32 *table, tjs_int phase, tjs_int vague) { tjs_int i = 0; tjs_int phasemax = phase; phase -= vague; for(; i < phase; i++ ) table[i] = 255; if( phasemax > 256 ) phasemax = 256; for(;i < phasemax; i++ ) { short tmp = (255-(( i - phase )*255 / vague)); if(tmp<0) tmp = 0; if(tmp>255) tmp = 255; table[i] = tmp & 0xffff; } for(;i < 256; i++ ) table[i] = 0; } template<typename func_t> static inline void sse2_univ_trans(tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, const tjs_uint8 *rule, const tjs_uint32 *table, tjs_int len) { if( len <= 0 ) return; func_t func(table); tjs_int count = (tjs_int)(((unsigned)dest)&0xF); if( count ) { count = (16 - count)>>2; count = count > len ? len : count; tjs_uint32* limit = dest + count; while( dest < limit ) { *dest = func( *src1, *src2, *rule ); dest++; src1++; src2++, rule++; } len -= count; } tjs_uint32 rem = (len>>2)<<2; tjs_uint32* limit = dest + rem; if( ((((unsigned)src1)&0xF) == 0) && (((unsigned)src2)&0xF) == 0 ) { while( dest < limit ) { __m128i ms11 = _mm_load_si128( (__m128i const*)src1 ); __m128i ms21 = _mm_load_si128( (__m128i const*)src2 ); _mm_store_si128( (__m128i*)dest, func(ms11, ms21, rule) ); src1 += 4; src2 += 4; rule += 4; dest += 4; } } else { while( dest < limit ) { __m128i ms11 = _mm_loadu_si128( (__m128i const*)src1 ); __m128i ms21 = _mm_loadu_si128( (__m128i const*)src2 ); _mm_store_si128( (__m128i*)dest, func(ms11, ms21, rule) ); src1 += 4; src2 += 4; rule += 4; dest += 4; } } limit += (len-rem); while( dest < limit ) { *dest = func( *src1, *src2, *rule ); dest++; src1++; src2++, rule++; } } template<typename func_t> static inline void sse2_univ_trans_switch(tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, const tjs_uint8 *rule, const tjs_uint32 *table, tjs_int len, tjs_int src1lv, tjs_int src2lv) { if( len <= 0 ) return; func_t func(table); tjs_int count = (tjs_int)(((unsigned)dest)&0xF); if( count ) { count = (16 - count)>>2; count = count > len ? len : count; tjs_uint32* limit = dest + count; while( dest < limit ) { tjs_int opa = *rule; if( opa >= src1lv ) { *dest = *src1; rule++; src1++; src2++; dest++; } else
} len -= count; } tjs_uint32 rem = (len>>2)<<2; tjs_uint32* limit = dest + rem; const __m128i msrc1lv = _mm_set1_epi32(src1lv); const __m128i msrc2lv = _mm_set1_epi32(src2lv); const __m128i not = _mm_set1_epi32(0xffffffff); while( dest < limit ) { tjs_uint32 r = *(tjs_uint32*)rule; __m128i mr = _mm_cvtsi32_si128( r ); mr = _mm_unpacklo_epi8( mr, func.zero_ ); mr = _mm_unpacklo_epi16( mr, func.zero_ ); __m128i opa1 = mr; opa1 = _mm_cmplt_epi32( opa1, msrc1lv ); __m128i md = opa1; __m128i ms11 = _mm_loadu_si128( (__m128i const*)src1 ); md = _mm_andnot_si128( md, ms11 ); if( _mm_movemask_epi8(opa1) != 0 ) { __m128i ms21 = _mm_loadu_si128( (__m128i const*)src2 ); opa1 = _mm_xor_si128( opa1, not ); __m128i opa2 = mr; opa2 = _mm_cmplt_epi32( mr, msrc2lv ); opa1 = _mm_or_si128( opa1, opa2 ); opa2 = _mm_and_si128( opa2, ms21 ); md = _mm_or_si128( md, opa2 ); if( _mm_movemask_epi8(opa1) != 0xffff ) { __m128i blend = func(ms11, ms21, rule); opa1 = _mm_andnot_si128( opa1, blend ); md = _mm_or_si128( md, opa1 ); } } _mm_store_si128( (__m128i*)dest, md ); src1 += 4; src2 += 4; rule += 4; dest += 4; } limit += (len-rem); while( dest < limit ) { tjs_int opa = *rule; if( opa >= src1lv ) { *dest = *src1; rule++; src1++; src2++; dest++; } else if(opa < src2lv) { *dest = *src2; rule++; src1++; src2++; dest++; } else { *dest = func( *src1, *src2, *rule ); dest++; src1++; src2++, rule++; } } } void TVPUnivTransBlend_sse2_c(tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, const tjs_uint8 *rule, const tjs_uint32 *table, tjs_int len) { sse2_univ_trans<sse2_univ_trans_blend_func>(dest,src1,src2,rule,table,len); } void TVPUnivTransBlend_switch_sse2_c(tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, const tjs_uint8 *rule, const tjs_uint32 *table, tjs_int len, tjs_int src1lv, tjs_int src2lv) { sse2_univ_trans_switch<sse2_univ_trans_blend_func>(dest,src1,src2,rule,table,len,src1lv,src2lv); } void TVPUnivTransBlend_d_sse2_c(tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, const tjs_uint8 *rule, const tjs_uint32 *table, tjs_int len) { sse2_univ_trans<sse2_univ_trans_d_blend_func>(dest,src1,src2,rule,table,len); } void TVPUnivTransBlend_switch_d_sse2_c(tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, const tjs_uint8 *rule, const tjs_uint32 *table, tjs_int len, tjs_int src1lv, tjs_int src2lv) { sse2_univ_trans_switch<sse2_univ_trans_d_blend_func>(dest,src1,src2,rule,table,len,src1lv,src2lv); }
if(opa < src2lv) { *dest = *src2; rule++; src1++; src2++; dest++; } else { *dest = func( *src1, *src2, *rule ); dest++; src1++; src2++, rule++; }
if_condition
[ { "content": "struct sse2_const_alpha_copy_functor {\n\n\tconst tjs_uint32 alpha32_;\n\n\tconst __m128i alpha_;\n\n\tconst __m128i colormask_;\n\n\tinline sse2_const_alpha_copy_functor( tjs_uint32 mask )\n\n\t: alpha32_(mask<<24), alpha_(_mm_set1_epi32(mask<<24)), colormask_(_mm_set1_epi32(0x00ffffff)) {}\n\n\tinline tjs_uint32 operator()( tjs_uint32 d ) const {\n\n\t\treturn (d&0x00ffffff) + alpha32_;\n\n\t}\n\n\tinline __m128i operator()( __m128i md1 ) const {\n\n\t\tmd1 = _mm_and_si128( md1, colormask_ );\n\n\t\treturn _mm_or_si128( md1, alpha_ );\n\n\t}\n\n};\n\ntemplate<typename functor>\n\ninline void sse2_const_color_copy_unroll( tjs_uint32 *dest, tjs_int len, const functor& func ) {\n\n\tif( len <= 0 ) return;\n\n\ttjs_int count = (tjs_int)((unsigned)dest & 0xF);\n\n\tif( count ) {\n\n\t\tcount = (16 - count)>>2;\n", "file_path": "visual/gl/colorfill_sse2.cpp", "rank": 0, "score": 166026.23816078558 }, { "content": "struct sse2_const_alpha_fill_blend_d_functor {\n\n\tconst tjs_int32 opa32_;\n\n\tconst __m128i colormask_;\n\n\tconst __m128i zero_;\n\n\tconst __m128i opa_;\n\n\t__m128i color_;\n\n\tinline sse2_const_alpha_fill_blend_d_functor( tjs_int32 opa, tjs_int32 color )\n\n\t\t: colormask_(_mm_set1_epi32(0x00ffffff)), opa32_(opa<<8), zero_(_mm_setzero_si128()), opa_(_mm_set1_epi32(opa<<8)) {\n\n\t\tcolor_ = _mm_cvtsi32_si128( color&0x00ffffff );\n\n\t\tcolor_ = _mm_shuffle_epi32( color_, _MM_SHUFFLE( 0, 0, 0, 0 ) );\n\n\t\tcolor_ = _mm_unpacklo_epi8( color_, zero_ );\n\n\t}\n\n\tinline tjs_uint32 operator()( tjs_uint32 d ) const {\n\n\t\ttjs_uint32 addr = opa32_ + (d>>24);\n\n\t\ttjs_uint32 sopa = TVPOpacityOnOpacityTable[addr];\n\n\t\t__m128i ma = _mm_cvtsi32_si128( sopa );\n\n\t\tma = _mm_shufflelo_epi16( ma, _MM_SHUFFLE( 0, 0, 0, 0 ) );\t// 0000000000000000 00oo00oo00oo00oo\n\n\t\t__m128i md = _mm_cvtsi32_si128( d );\n\n\t\t__m128i mc = color_;\n\n\t\tmd = _mm_unpacklo_epi8( md, zero_ );// 00 dd 00 dd 00 dd 00 dd\n", "file_path": "visual/gl/colorfill_sse2.cpp", "rank": 1, "score": 161375.2127587478 }, { "content": "struct sse2_const_alpha_fill_blend_functor {\n\n\tconst __m128i invopa_;\n\n\tconst __m128i zero_;\n\n\t__m128i color_;\n\n\tconst __m128i alphamask_;\n\n\tconst __m128i colormask_;\n\n\tinline sse2_const_alpha_fill_blend_functor( tjs_int32 opa, tjs_int32 color )\n\n\t: zero_(_mm_setzero_si128()), invopa_(_mm_set1_epi16((short)(255-opa))),\n\n\t alphamask_(_mm_set1_epi32(0xff000000)), colormask_(_mm_set1_epi32(0x00ffffff)) {\n\n\t\t__m128i mopa = _mm_set1_epi16((short)opa);\n\n\t\tcolor_ = _mm_cvtsi32_si128( color );\n\n\t\tcolor_ = _mm_shuffle_epi32( color_, _MM_SHUFFLE( 0, 0, 0, 0 ) );\n\n\t\tcolor_ = _mm_unpacklo_epi8( color_, zero_ );\n\n\t\tcolor_ = _mm_mullo_epi16( color_, mopa );\n\n\t}\n\n\tinline tjs_uint32 operator()( tjs_uint32 d ) const {\n\n\t\t__m128i md = _mm_cvtsi32_si128( d );\n\n\t\t__m128i ma = md;\n\n\t\tma = _mm_and_si128( ma, alphamask_ );\n\n\t\tmd = _mm_unpacklo_epi8( md, zero_ );// 00 dd 00 dd 00 dd 00 dd\n", "file_path": "visual/gl/colorfill_sse2.cpp", "rank": 2, "score": 161375.2127587478 }, { "content": "// Di = Di - SaDi + Si\n\n// Da = Da - SaDa + Sa\n\nstruct sse2_const_alpha_fill_blend_a_functor {\n\n\t__m128i mo_;\n\n\t__m128i mc_;\n\n\tconst __m128i zero_;\n\n\tinline sse2_const_alpha_fill_blend_a_functor( tjs_int32 opa, tjs_int32 color ) : zero_(_mm_setzero_si128()) {\n\n\t\topa += opa>>7;// adjust opacity\n\n\t\tmo_ = _mm_set1_epi16((short)(opa));\n\n\n\n\t\t__m128i msa = _mm_cvtsi32_si128( opa<<24 );\n\n\t\tmsa = _mm_shuffle_epi32( msa, _MM_SHUFFLE( 0, 0, 0, 0 ) );\n\n\t\tmsa = _mm_unpacklo_epi8( msa, zero_ );\t// 00 Sa 00 00 00 00 00 00\n\n\n\n\t\tmc_ = _mm_cvtsi32_si128( color&0x00ffffff );\n\n\t\tmc_ = _mm_shuffle_epi32( mc_, _MM_SHUFFLE( 0, 0, 0, 0 ) );\n\n\t\tmc_ = _mm_unpacklo_epi8( mc_, zero_ );\t// mc = 00 00 00 Si 00 Si 00 Si\n\n\t\tmc_ = _mm_mullo_epi16( mc_, mo_ );\t// mc *= mo\n\n\t\tmc_ = _mm_srli_epi16( mc_, 8 );\t// mc >>= 8\n\n\t\tmc_ = _mm_or_si128( mc_, msa );\t// mc = 00 Sa 00 Si 00 Si 00 Si\n\n\t}\n\n\tinline tjs_uint32 operator()( tjs_uint32 d ) const {\n", "file_path": "visual/gl/colorfill_sse2.cpp", "rank": 3, "score": 161375.2127587478 }, { "content": "\t\treturn (a + b - tmp) | tmp;\n", "file_path": "visual/gl/blend_util_func.h", "rank": 6, "score": 136050.0501690328 }, { "content": "// BaseBitmap を使うとリエントラントではないので、別の構造体に独自にロードする必要がある\n\nstruct tTVPTmpBitmapImage {\n\n\ttjs_uint32 w;\n\n\ttjs_uint32 h;\n\n\ttjs_int pitch;\n\n\ttjs_uint32* buf;\n\n\tstd::vector<tTVPGraphicMetaInfoPair> * MetaInfo;\n\n\ttTVPTmpBitmapImage();\n\n\t~tTVPTmpBitmapImage();\n\n// パレット関連は現状読まない、ファイルに従うのではなく、事前指定方式なので\n\n};\n\n\n", "file_path": "visual/GraphicsLoadThread.h", "rank": 7, "score": 129891.19937263231 }, { "content": "// 乗算済みアルファから通常アルファへ\n\n// alpha = alpha\n\n// color = color*255 / alpha\n\nstruct sse2_premulalpha_to_alpha {\n\n\tconst __m128i colormask_;\n\n\tconst __m128 f65535_;\n\n\tinline sse2_premulalpha_to_alpha() : colormask_(_mm_set1_epi32(0x00ffffff)), f65535_(_mm_set1_ps(65535.0f)) {}\n\n\tinline tjs_uint32 operator()( tjs_uint32 s ) const {\n\n\t\tconst tjs_uint8 *t = ((s >> 16) & 0xff00) + TVPDivTable;\n\n\t\treturn (s & 0xff000000) +\n\n\t\t\t(t[(s >> 16) & 0xff] << 16) +\n\n\t\t\t(t[(s >> 8) & 0xff] << 8) +\n\n\t\t\t(t[ s & 0xff] );\n\n\t}\n\n\tinline __m128i operator()( __m128i ms ) const {\n\n\t\t__m128i ma1 = ms;\n\n\t\tma1 = _mm_srli_epi32( ma1, 24 );\n\n\t\t__m128i ma = ma1;\n\n\t\tma = _mm_slli_epi32( ma, 24 );\n\n\t\t__m128 rcp = _mm_cvtepi32_ps(ma1);\n\n#if 1\n\n\t\trcp = _mm_rcp_ps(rcp);\n\n#else\n", "file_path": "visual/gl/blend_function_sse2.cpp", "rank": 8, "score": 126276.70597726823 }, { "content": "// 通常のアルファから乗算済みアルファへ\n\nstruct sse2_alpha_to_premulalpha {\n\n\tconst __m128i zero_;\n\n\tconst __m128i colormask_;\n\n\tinline sse2_alpha_to_premulalpha() : zero_( _mm_setzero_si128() ), colormask_(_mm_set1_epi32(0x00ffffff)) {}\n\n\tinline tjs_uint32 operator()( tjs_uint32 s ) const {\n\n\t\t__m128i ma = _mm_cvtsi32_si128( s>>24 );\n\n\t\tma = _mm_shufflelo_epi16( ma, _MM_SHUFFLE( 0, 0, 0, 0 ) );\t// 00oo00oo00oo00oo\n\n\t\t__m128i ms = _mm_cvtsi32_si128( s );\n\n\t\tms = _mm_unpacklo_epi16( ms, zero_ );\n\n\t\tms = _mm_mullo_epi16( ms, ma );\t\t// s *= a\n\n\t\tms = _mm_srli_epi16( ms, 8 );\t\t// s >>= 8\n\n\t\tms = _mm_packus_epi16( ms, ms );\n\n\t\treturn (_mm_cvtsi128_si32(ms)&0x00ffffff)|(s&0xff000000);\n\n\t}\n\n\tinline __m128i operator()( __m128i ms1 ) const {\n\n\t\t__m128i ma1 = ms1;\n\n\t\tma1 = _mm_srli_epi32( ma1, 24 );\n\n\t\t__m128i ma = ma1;\n\n\t\tma = _mm_slli_epi32( ma, 24 );\n\n\t\tma1 = _mm_packs_epi32( ma1, ma1 );\t\t// 0 1 2 3 0 1 2 3\n", "file_path": "visual/gl/blend_function_sse2.cpp", "rank": 9, "score": 126268.51438606865 }, { "content": "struct sse2_to_premul_alpha_functor {\n\n\tconst __m128i c_0000ffffffffffff_;\n\n\tconst __m128i c_0100000000000000_;\n\n\tinline sse2_to_premul_alpha_functor()\n\n\t: c_0000ffffffffffff_(_mm_set_epi32(0x0000ffff,0xffffffff,0x0000ffff,0xffffffff)),\n\n\t c_0100000000000000_(_mm_set_epi32(0x01000000,0x00000000,0x01000000,0x00000000)) {}\n\n\tinline __m128i operator()( __m128i src ) const {\n\n\t\t__m128i tmp = src;\n\n\t\ttmp = _mm_srli_epi16( tmp, 7 );\t\t// >>= 7\n\n\t\ttmp = _mm_add_epi16( tmp, src );\t// adjust alpha\n\n\t\ttmp = _mm_srli_epi64( tmp, 48 );\t// 000A|000A\n\n\t\ttmp = _mm_shufflelo_epi16( tmp, _MM_SHUFFLE( 0, 0, 0, 0 ) );\t// 000A|AAAA\n\n\t\ttmp = _mm_shufflehi_epi16( tmp, _MM_SHUFFLE( 0, 0, 0, 0 ) );\t// AAAA|AAAA\n\n\t\ttmp = _mm_and_si128( tmp, c_0000ffffffffffff_ );\t// drop alpha area\n\n\t\ttmp = _mm_or_si128( tmp, c_0100000000000000_ );\t// 0100|A|A|A\n\n\t\tsrc = _mm_mullo_epi16( src, tmp );\n\n\t\treturn _mm_srli_epi16( src, 8 );\n\n\t}\n\n};\n\n/* 以下のようなfunctorを使ってTVPAddSubVertSum16_d_sse2_cを汎用化してもいいが……\n", "file_path": "visual/gl/boxblur_sse2.cpp", "rank": 10, "score": 126268.51438606865 }, { "content": "struct sse2_bind_mask_to_main_functor {\n\n\tconst __m128i zero_;\n\n\tconst __m128i colormask_;\n\n\tinline sse2_bind_mask_to_main_functor() : zero_(_mm_setzero_si128()), colormask_(_mm_set1_epi32(0x00ffffff)) {}\n\n\tinline tjs_uint32 operator()( tjs_uint32 c, tjs_uint8 a ) const {\n\n\t\treturn (c&0xffffff) | (a<<24);\n\n\t}\n\n\tinline __m128i operator()( __m128i md, tjs_uint32 s ) const {\n\n\t\t__m128i mo = _mm_cvtsi32_si128( s );\n\n\t\tmo = _mm_unpacklo_epi8( mo, zero_ );\t// 0000 0a 0a 0a 0a\n\n\t\tmo = _mm_unpacklo_epi16( mo, zero_ );\t// 000a 000a 000a 000a\n\n\t\tmo = _mm_slli_epi32( mo, 24 );\n\n\t\tmd = _mm_and_si128( md, colormask_ );\n\n\t\treturn _mm_or_si128( md, mo );\n\n\t}\n\n};\n\nvoid TVPBindMaskToMain_sse2_c(tjs_uint32 *main, const tjs_uint8 *mask, tjs_int len) {\n\n\tsse2_bind_mask_to_main_functor func;\n\n\tapply_color_map_func_sse2( main, mask, len , func );\n\n}\n", "file_path": "visual/gl/colormap_sse2.cpp", "rank": 11, "score": 122936.41605972374 }, { "content": "struct sse2_alpha_color_mat_functor {\n\n\tconst __m128i zero_;\n\n\tconst __m128i color_;\n\n\tconst __m128i alphamask_;\n\n\tinline sse2_alpha_color_mat_functor( tjs_int32 color )\n\n\t: zero_(_mm_setzero_si128()), alphamask_(_mm_set1_epi32(0xff000000)), color_(_mm_unpacklo_epi8( _mm_set1_epi32(color), zero_)){}\n\n\tinline tjs_uint32 operator()( tjs_uint32 s ) const {\n\n\t\t__m128i md = color_;\n\n\t\t__m128i ms = _mm_cvtsi32_si128( s );\n\n\t\t__m128i ma = ms;\n\n\t\tma = _mm_srli_epi32( ma, 24 );\n\n\t\tma = _mm_shufflelo_epi16( ma, _MM_SHUFFLE( 0, 0, 0, 0 ) );\t// 下位のみ\n\n\t\t\n\n\t\tms = _mm_unpacklo_epi8( ms, zero_ );\n\n\t\tms = _mm_sub_epi16( ms, md );\t\t// ms -= md\n\n\t\tms = _mm_mullo_epi16( ms, ma );\t\t// ms *= ma\n\n\t\tms = _mm_srli_epi16( ms, 8 );\t\t// ms >>= 8\n\n\t\tms = _mm_add_epi8( ms, md );\t\t// md += ms : d + ((s-d)*sopa)>>8\n\n\t\tms = _mm_packus_epi16( ms, zero_ );\t// pack\n\n\t\treturn _mm_cvtsi128_si32( ms ) | 0xff000000;\t\t// store\n", "file_path": "visual/gl/colorfill_sse2.cpp", "rank": 12, "score": 122927.66669536696 }, { "content": "// テーブルバージョン、かなりの最適化任せ。速度と精度からこれになるか?\n\nstruct sse2_box_blur_avg_16_d_table {\n\n\t__m128i mrcp_;\n\n\tinline sse2_box_blur_avg_16_d_table( tjs_int n ) {\n\n\t\tmrcp_ = _mm_cvtsi32_si128( (1<<16) / n );\n\n\t\tmrcp_ = _mm_shufflelo_epi16( mrcp_, _MM_SHUFFLE( 0, 0, 0, 0 ) );\n\n\t\tmrcp_ = _mm_shuffle_epi32( mrcp_, _MM_SHUFFLE( 0, 0, 0, 0 ) );\n\n\t}\n\n\tinline void two( tjs_uint32 *dest, __m128i msum, const __m128i mhalf_n ) const {\n\n\t\tmsum = _mm_add_epi16( msum, mhalf_n );\t\t// sum + n/2\n\n\t\tmsum = _mm_mulhi_epu16( msum, mrcp_ );\t\t// (sum + n/2) * rcp, rcp は、16bitごとにする\n\n\t\tmsum = _mm_packus_epi16( msum, msum );\t\t// A8|R8|G8|B8|A8|R8|G8|B8\n\n\t\tunsigned char* lo = &TVPDivTable[msum.m128i_u8[3]<<8];\n\n\t\tunsigned char* hi = &TVPDivTable[msum.m128i_u8[7]<<8];\n\n\t\tdest[0] = (msum.m128i_u8[3]<<24) | (lo[msum.m128i_u8[2]]<<16) | (lo[msum.m128i_u8[1]]<<8) | lo[msum.m128i_u8[0]];\n\n\t\tdest[1] = (msum.m128i_u8[7]<<24) | (hi[msum.m128i_u8[6]]<<16) | (hi[msum.m128i_u8[5]]<<8) | hi[msum.m128i_u8[4]];\n\n\t}\n\n\tinline void one( tjs_uint32 *dest, __m128i msum, const __m128i mhalf_n ) const {\n\n\t\tmsum = _mm_add_epi16( msum, mhalf_n );\t\t// sum + n/2\n\n\t\tmsum = _mm_mulhi_epu16( msum, mrcp_ );\t\t// (sum + n/2) * rcp, rcp は、16bitごとにする\n\n\t\tmsum = _mm_packus_epi16( msum, msum );\t\t// A8|R8|G8|B8|A8|R8|G8|B8\n", "file_path": "visual/gl/boxblur_sse2.cpp", "rank": 13, "score": 122923.62398995642 }, { "content": "struct sse2_const_color_copy_functor {\n\n\tconst tjs_uint32 color32_;\n\n\tconst __m128i color_;\n\n\tconst __m128i alphamask_;\n\n\tinline sse2_const_color_copy_functor( tjs_uint32 color )\n\n\t: color32_(color&0x00ffffff), color_(_mm_set1_epi32(color&0x00ffffff)), alphamask_(_mm_set1_epi32(0xff000000)) {}\n\n\tinline tjs_uint32 operator()( tjs_uint32 d ) const {\n\n\t\treturn (d&0xff000000) + color32_;\n\n\t}\n\n\tinline __m128i operator()( __m128i md1 ) const {\n\n\t\tmd1 = _mm_and_si128( md1, alphamask_ );\n\n\t\treturn _mm_or_si128( md1, color_ );\n\n\t}\n\n};\n", "file_path": "visual/gl/colorfill_sse2.cpp", "rank": 14, "score": 122912.15099866709 }, { "content": "struct sse2_adjust_gamma_a_func {\n\n\tconst __m128i zero_;\n\n\tconst tTVPGLGammaAdjustTempData *param_;\n\n\tinline sse2_adjust_gamma_a_func(tTVPGLGammaAdjustTempData *p) : zero_(_mm_setzero_si128()), param_(p) {}\n\n\t//inline tjs_uint32 operator()( tjs_uint32 dst ) const {\n\n\tinline tjs_uint32 operator()( tjs_uint32 dst ) const {\n\n\t\tif( dst >= 0xff000000 ) {\n\n\t\t\t// completely opaque pixel\n\n\t\t\ttjs_uint32 ret = param_->B[dst&0xff];\t\t// look table B up (BB')\n\n\t\t\tret |= param_->G[(dst>>8)&0xff] << 8;\t\t// look table G up (GG')\n\n\t\t\tret |= param_->R[(dst>>16)&0xff] << 16;\t// look table R up (RR')\n\n\t\t\treturn 0xff000000|ret;\n\n\t\t} else if( dst != 0 ) {\t// premul なので完全透明の時は0になるはず //} else if( dst > 0x00ffffff ) {\n\n\t\t\t__m128i md = _mm_cvtsi32_si128( dst );\n\n\t\t\ttjs_uint32 alpha = dst >> 24;\n\n\t\t\ttjs_uint32 recip = TVPRecipTable256_16[alpha];\t// 65536/opacity (rcp)\n\n\n\n\t\t\tmd = _mm_unpacklo_epi8( md, zero_ );\t// 00 AA 00 RR 00 GG 00 BB\n\n\t\t\t__m128i maa = _mm_cvtsi32_si128( recip );\t// alpha adjust\n\n\t\t\t__m128i ma = _mm_cvtsi32_si128( alpha );\n", "file_path": "visual/gl/adjust_color_sse2.cpp", "rank": 15, "score": 122755.76700826787 }, { "content": "struct sse2_make_alpha_from_key_functor {\n\n\tconst tjs_uint32 key_;\n\n\tconst __m128i mmkey;\n\n\tconst __m128i mmask;\n\n\tconst __m128i alpha;\n\n\tinline sse2_make_alpha_from_key_functor( tjs_uint32 key ) : key_(key),\n\n\t\tmmkey(_mm_set1_epi32(key)), mmask(_mm_set1_epi32(0x00ffffff)), alpha(_mm_set1_epi32(0xff000000)) {}\n\n\tinline tjs_uint32 operator()( tjs_uint32 d ) const {\n\n\t\td = d&0x00ffffff;\n\n\t\tif( d != key_ ) d |= 0xff000000;\n\n\t\treturn d;\n\n\t}\n\n\tinline __m128i operator()( __m128i md ) const {\n\n\t\tmd = _mm_and_si128( md, mmask );\t// d &= mask アルファをクリア(透明に)\n\n\t\t__m128i mk = mmkey;\n\n\t\tmk = _mm_cmpeq_epi32( mk, md );\t\t// d == key ? 1111 : 0000\n\n\t\tmk = _mm_andnot_si128( mk, alpha );\t// maskalpha = (^cmpmask) & alpha\n\n\t\tmd = _mm_or_si128( md, mk );\t\t// d |= maskalpha\n\n\t\treturn md;\n\n\t}\n\n};\n", "file_path": "visual/gl/blend_function_sse2.cpp", "rank": 16, "score": 119827.20778327598 }, { "content": "\tclass iTVPLayerTreeOwner* GetLayerTreeOwner() const { return LayerTreeOwner; }\n\n\tvoid SetLayerTreeOwner(class iTVPLayerTreeOwner* owner);\n\n\tvoid NotifyResizeFromWindow(tjs_uint w, tjs_uint h); // draw device -> layer\n\n\tvirtual void TJS_INTF_METHOD RequestInvalidation(const tTVPRect &r); // draw device -> layer\n\n\n\n\tvirtual void TJS_INTF_METHOD NotifyClick(tjs_int x, tjs_int y) { PrimaryClick(x, y); }\n\n\tvirtual void TJS_INTF_METHOD NotifyDoubleClick(tjs_int x, tjs_int y) { PrimaryDoubleClick(x, y); }\n\n\tvirtual void TJS_INTF_METHOD NotifyMouseDown(tjs_int x, tjs_int y, tTVPMouseButton mb, tjs_uint32 flags)\n\n\t\t{ PrimaryMouseDown(x, y, mb, flags); }\n\n\tvirtual void TJS_INTF_METHOD NotifyMouseUp(tjs_int x, tjs_int y, tTVPMouseButton mb, tjs_uint32 flags)\n\n\t\t{ PrimaryMouseUp(x, y, mb, flags); }\n\n\tvirtual void TJS_INTF_METHOD NotifyMouseMove(tjs_int x, tjs_int y, tjs_uint32 flags)\n\n\t\t{ PrimaryMouseMove(x, y, flags); }\n\n\tvirtual void TJS_INTF_METHOD NotifyMouseOutOfWindow()\n\n\t\t{ MouseOutOfWindow(); }\n\n\tvirtual void TJS_INTF_METHOD NotifyKeyDown(tjs_uint key, tjs_uint32 shift)\n\n\t\t{ PrimaryKeyDown(key, shift); }\n\n\tvirtual void TJS_INTF_METHOD NotifyKeyUp(tjs_uint key, tjs_uint32 shift)\n\n\t\t{ PrimaryKeyUp(key, shift); }\n\n\tvirtual void TJS_INTF_METHOD NotifyKeyPress(tjs_char key)\n", "file_path": "visual/LayerManager.h", "rank": 17, "score": 110869.95043296534 }, { "content": "//---------------------------------------------------------------------------\n\n// TJSAlignedAlloc : aligned memory allocator\n\n//---------------------------------------------------------------------------\n\n// template classes to determine an integer type which have the same size as void *.\n\nstruct tTJSPointerSizeEnum { enum tTJSPointerSize { size = sizeof(void*) }; };\n\ntemplate <tjs_int size> struct tTJSPointerSizedIntegerBase { typedef long type; };\n\ntemplate <> struct tTJSPointerSizedIntegerBase<8> { typedef tjs_uint64 type; };\n\ntemplate <> struct tTJSPointerSizedIntegerBase<4> { typedef tjs_uint32 type; };\n", "file_path": "tjs2/tjsUtils.cpp", "rank": 18, "score": 108861.08679064974 }, { "content": "\tclass tTVPCharacterData* GetBitmap( const struct tTVPFontAndCharacterData & font, tjs_int aofsx, tjs_int aofsy );\n\n\tvoid GetGlyphDrawRect( const ttstr & text, struct tTVPRect& area );\n\n\tbool AddFont( const ttstr& storage, std::vector<tjs_string>* faces );\n\n\tvoid GetFontList(std::vector<ttstr> & list, tjs_uint32 flags, const struct tTVPFont & font );\n\n};\n\n\n\n#endif // __GDI_FONT_RASTERIZER_H__\n", "file_path": "visual/win32/GDIFontRasterizer.h", "rank": 19, "score": 106043.9018139251 }, { "content": "class tTJSHashFunc<tjs_char *> // a specialized template of tTJSHashFunc for tjs_char\n\n{\n\npublic:\n\n\tstatic tjs_uint32 Make(const tjs_char *str)\n\n\t{\n\n\t\tif(!str) return 0;\n\n\t\ttjs_uint32 ret = 0;\n\n\t\twhile(*str)\n\n\t\t{\n\n\t\t\tret += *str;\n\n\t\t\tret += (ret << 10);\n\n\t\t\tret ^= (ret >> 6);\n\n\t\t\tstr++;\n\n\t\t}\n\n\t\tret += (ret << 3);\n\n\t\tret ^= (ret >> 11);\n\n\t\tret += (ret << 15);\n\n\t\tif(!ret) ret = (tjs_uint32)-1;\n\n\t\treturn ret;\n\n\t}\n\n};\n\n//---------------------------------------------------------------------------\n\ntemplate <>\n", "file_path": "tjs2/tjsHashSearch.h", "rank": 20, "score": 102626.8821513097 }, { "content": "static inline tjs_uint32 alpha_to_additive_alpha( tjs_uint32 a ) {\n\n\treturn alpha_and_color_to_additive_alpha( a >> 24, a );\n", "file_path": "visual/gl/blend_util_func.h", "rank": 21, "score": 99238.7280063035 }, { "content": "#ifndef __BLEND_UTIL_FUNC_H__\n\n#define __BLEND_UTIL_FUNC_H__\n\n\n\n/** 飽和加算演算(8bit) */\n\nstruct saturated_u8_add_func {\n\n\tinline tjs_uint32 operator()( tjs_uint32 a, tjs_uint32 b ) const {\n\n\t\t/* Add each byte of packed 8bit values in two 32bit uint32, with saturation. */\n\n\t\ttjs_uint32 tmp = ( ( a & b ) + ( ((a ^ b)>>1) & 0x7f7f7f7f) ) & 0x80808080;\n\n\t\ttmp = (tmp<<1) - (tmp>>7);\n\n\t\treturn (a + b - tmp) | tmp;\n\n\t}\n\n};\n\n/**\n\n * add_aldpha_blend_dest_src[_o]\n\n * dest/src : a(additive-alpha) d(alpha) n(none alpha)\n\n * _o : with opacity\n\n */\n\nstruct premulalpha_blend_n_a_func {\t// TVPAddAlphaBlend_n_a\n\n\tsaturated_u8_add_func sat_add_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s ) const {\n\n\t\ttjs_uint32 sopa = (~s) >> 24;\n\n\t\treturn sat_add_( (((d & 0xff00ff)*sopa >> 8) & 0xff00ff) + \n\n\t\t\t(((d & 0xff00)*sopa >> 8) & 0xff00), s);\n\n\t}\n\n};\n\n/* struct add_alpha_blend_hda_n_a_func {\t// TVPAddAlphaBlend_HDA_n_a\n\n\tadd_aldpha_blend_n_a_func add_alpha_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s ) const {\n\n\t\treturn (d & 0xff000000) + (add_alpha_(d, s) & 0xffffff);\n\n\t}\n\n};*/\n\n/* struct add_aldpha_blend_n_a_o_func {\t// TVPAddAlphaBlend_n_a_o\n\n\tadd_aldpha_blend_n_a_func add_alpha_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s, tjs_int opa ) const {\n\n\t\ts = (((s & 0xff00ff)*opa >> 8) & 0xff00ff) + (((s >> 8) & 0xff00ff)*opa & 0xff00ff00);\n\n\t\treturn add_alpha_(d, s);\n\n\t}\n\n};*/\n\n/* struct add_alpha_blend_hda_n_a_o_func {\t// TVPAddAlphaBlend_HDA_n_a_o\n\n\tadd_aldpha_blend_n_a_o_func add_alpha_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s, tjs_int opa ) const {\n\n\t\treturn (d & 0xff000000) + (add_alpha_(d, s, opa) & 0xffffff);\n\n\t}\n\n};*/\n\n\n\n/** アルファ乗算済みカラー同士のブレンド\n\n *\n\n * Di = sat(Si, (1-Sa)*Di)\n\n * Da = Sa + Da - SaDa\n\n */\n\nstruct premulalpha_blend_a_a_func {\t// TVPAddAlphaBlend_a_a\n\n\tsaturated_u8_add_func sat_add_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s ) const {\n\n\t\ttjs_uint32 da = d >> 24;\n\n\t\ttjs_uint32 sa = s >> 24;\n\n\t\tda = da + sa - (da*sa >> 8);\n\n\t\tda -= (da >> 8); /* adjust alpha */\n\n\t\tsa ^= 0xff;\n\n\t\ts &= 0xffffff;\n\n\t\treturn (da << 24) + sat_add_((((d & 0xff00ff)*sa >> 8) & 0xff00ff) + (((d & 0xff00)*sa >> 8) & 0xff00), s);\n\n\t}\n\n};\n\nstruct premulalpha_blend_a_a_o_func {\t// TVPAddAlphaBlend_a_a_o\n\n\tpremulalpha_blend_a_a_func func_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s, tjs_int opa ) const {\n\n\t\ts = (((s & 0xff00ff)*opa >> 8) & 0xff00ff) + (((s >> 8) & 0xff00ff)*opa & 0xff00ff00);\n\n\t\treturn func_(d, s);\n\n\t}\n\n};\n\n\n\nstatic inline tjs_uint32 mul_color( tjs_uint32 color, tjs_uint32 fac ) {\n\n\treturn (((((color & 0x00ff00) * fac) & 0x00ff0000) +\n\n\t\t\t(((color & 0xff00ff) * fac) & 0xff00ff00) ) >> 8);\n\n}\n\nstatic inline tjs_uint32 alpha_and_color_to_additive_alpha( tjs_uint32 alpha, tjs_uint32 color ) {\n\n\treturn mul_color(color, alpha) + (color & 0xff000000);\n\n}\n\nstatic inline tjs_uint32 alpha_to_additive_alpha( tjs_uint32 a ) {\n\n\treturn alpha_and_color_to_additive_alpha( a >> 24, a );\n\n}\n\nstruct premulalpha_blend_a_d_func {\t// TVPAddAlphaBlend_a_d\n\n\tpremulalpha_blend_a_a_func func_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s ) const {\n\n\t\treturn func_(d, alpha_to_additive_alpha(s));\n\n\t}\n\n};\n\nstruct premulalpha_blend_a_d_o_func {\t// TVPAddAlphaBlend_a_d_o\n\n\tpremulalpha_blend_a_d_func func_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s, tjs_int opa ) const {\n\n\t\ts = (s & 0xffffff) + ((((s >> 24) * opa) >> 8) << 24);\n\n\t\treturn func_(d, s);\n\n\t}\n\n};\n\n/*\n\n\tDi = sat(Si, (1-Sa)*Di)\n\n\tDa = Sa + Da - SaDa\n\n*/\n\nstruct premulalpha_blend_a_ca_func {\t// = TVPAddAlphaBlend_a_ca\n\n\tsaturated_u8_add_func sat_add_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 dest, tjs_uint32 sopa, tjs_uint32 sopa_inv, tjs_uint32 src ) const {\n\n\t\ttjs_uint32 dopa = dest >> 24;\n\n\t\tdopa = dopa + sopa - (dopa*sopa >> 8);\n\n\t\tdopa -= (dopa >> 8); /* adjust alpha */\n\n\t\treturn (dopa << 24) + sat_add_((((dest & 0xff00ff)*sopa_inv >> 8) & 0xff00ff) + (((dest & 0xff00)*sopa_inv >> 8) & 0xff00), src);\n\n\t}\n\n};\n\n\n\n\n\n//------------------------------------------------------------------------------\n\n// カラー成分にfacをかける\n\nstruct mul_color_func {\n\n\tinline tjs_uint32 operator()(tjs_uint32 color, tjs_uint32 fac) const {\n\n\t\treturn (((((color & 0x00ff00) * fac) & 0x00ff0000) + (((color & 0xff00ff) * fac) & 0xff00ff00) ) >> 8);\n\n\t}\n\n};\n\n//------------------------------------------------------------------------------\n\n// カラー成分にアルファをかける、アルファは維持する\n\nstruct alpha_and_color_to_premulalpha_func {\n\n\tmul_color_func func_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 alpha, tjs_uint32 color ) const {\n\n\t\treturn func_( color, alpha ) + (color & 0xff000000);\n\n\t}\n\n};\n\n//------------------------------------------------------------------------------\n\n// 通常のアルファを持つ色からプレマルチプライド(乗算済み)アルファ形式の色に変換する\n\nstruct alpha_to_premulalpha_func {\n\n\talpha_and_color_to_premulalpha_func func_;\n\n\tinline tjs_uint32 operator()(tjs_uint32 a) const {\n\n\t\treturn func_( a >> 24, a );\n\n\t}\n\n};\n\n//------------------------------------------------------------------------------\n\n/* returns a * ratio + b * (1 - ratio) */\n\nstruct blend_argb {\n\n\tinline tjs_uint32 operator()(tjs_uint32 b, tjs_uint32 a, tjs_int ratio ) const {\n\n\t\ttjs_uint32 b2 = b & 0x00ff00ff;\n\n\t\ttjs_uint32 t = (b2 + (((a & 0x00ff00ff) - b2) * ratio >> 8)) & 0x00ff00ff;\n\n\t\tb2 = (b & 0xff00ff00) >> 8;\n\n\t\treturn t + (((b2 + (( ((a & 0xff00ff00) >> 8) - b2) * ratio >> 8)) << 8)& 0xff00ff00);\n\n\t}\n\n};\n\n//------------------------------------------------------------------------------\n\n\n", "file_path": "visual/gl/blend_util_func.h", "rank": 22, "score": 99180.8424851987 }, { "content": "struct BreakpointLine {\n\n\ttypedef std::map<int,int>\t\tlines;\n\n\ttypedef lines::iterator\t\t\titerator;\n\n\ttypedef lines::const_iterator\tconst_iterator;\n\n\n\n\tlines\tLines;\n\n\n\n\tbool IsBreakPoint( int lineno ) const {\n\n\t\tconst_iterator j = Lines.find( lineno );\n\n\t\tif( j != Lines.end() ) {\n\n\t\t\treturn true;\n\n\t\t}\n", "file_path": "utils/Debugger.h", "rank": 23, "score": 97358.7804989096 }, { "content": " md5_word_t count[2];\t/* message length in bits, lsw first */\n", "file_path": "utils/md5.h", "rank": 24, "score": 97351.18613036293 }, { "content": "static inline tjs_uint32 alpha_and_color_to_additive_alpha( tjs_uint32 alpha, tjs_uint32 color ) {\n\n\treturn mul_color(color, alpha) + (color & 0xff000000);\n", "file_path": "visual/gl/blend_util_func.h", "rank": 25, "score": 96388.45234917088 }, { "content": "#ifndef __BLEND_UTIL_FUNC_H__\n\n#define __BLEND_UTIL_FUNC_H__\n\n\n\n/** 飽和加算演算(8bit) */\n\nstruct saturated_u8_add_func {\n\n\tinline tjs_uint32 operator()( tjs_uint32 a, tjs_uint32 b ) const {\n\n\t\t/* Add each byte of packed 8bit values in two 32bit uint32, with saturation. */\n\n\t\ttjs_uint32 tmp = ( ( a & b ) + ( ((a ^ b)>>1) & 0x7f7f7f7f) ) & 0x80808080;\n\n\t\ttmp = (tmp<<1) - (tmp>>7);\n\n\t\treturn (a + b - tmp) | tmp;\n\n\t}\n\n};\n\n/**\n\n * add_aldpha_blend_dest_src[_o]\n\n * dest/src : a(additive-alpha) d(alpha) n(none alpha)\n\n * _o : with opacity\n\n */\n\nstruct premulalpha_blend_n_a_func {\t// TVPAddAlphaBlend_n_a\n\n\tsaturated_u8_add_func sat_add_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s ) const {\n\n\t\ttjs_uint32 sopa = (~s) >> 24;\n\n\t\treturn sat_add_( (((d & 0xff00ff)*sopa >> 8) & 0xff00ff) + \n\n\t\t\t(((d & 0xff00)*sopa >> 8) & 0xff00), s);\n\n\t}\n\n};\n\n/* struct add_alpha_blend_hda_n_a_func {\t// TVPAddAlphaBlend_HDA_n_a\n\n\tadd_aldpha_blend_n_a_func add_alpha_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s ) const {\n\n\t\treturn (d & 0xff000000) + (add_alpha_(d, s) & 0xffffff);\n\n\t}\n\n};*/\n\n/* struct add_aldpha_blend_n_a_o_func {\t// TVPAddAlphaBlend_n_a_o\n\n\tadd_aldpha_blend_n_a_func add_alpha_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s, tjs_int opa ) const {\n\n\t\ts = (((s & 0xff00ff)*opa >> 8) & 0xff00ff) + (((s >> 8) & 0xff00ff)*opa & 0xff00ff00);\n\n\t\treturn add_alpha_(d, s);\n\n\t}\n\n};*/\n\n/* struct add_alpha_blend_hda_n_a_o_func {\t// TVPAddAlphaBlend_HDA_n_a_o\n\n\tadd_aldpha_blend_n_a_o_func add_alpha_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s, tjs_int opa ) const {\n\n\t\treturn (d & 0xff000000) + (add_alpha_(d, s, opa) & 0xffffff);\n\n\t}\n\n};*/\n\n\n\n/** アルファ乗算済みカラー同士のブレンド\n\n *\n\n * Di = sat(Si, (1-Sa)*Di)\n\n * Da = Sa + Da - SaDa\n\n */\n\nstruct premulalpha_blend_a_a_func {\t// TVPAddAlphaBlend_a_a\n\n\tsaturated_u8_add_func sat_add_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s ) const {\n\n\t\ttjs_uint32 da = d >> 24;\n\n\t\ttjs_uint32 sa = s >> 24;\n\n\t\tda = da + sa - (da*sa >> 8);\n\n\t\tda -= (da >> 8); /* adjust alpha */\n\n\t\tsa ^= 0xff;\n\n\t\ts &= 0xffffff;\n\n\t\treturn (da << 24) + sat_add_((((d & 0xff00ff)*sa >> 8) & 0xff00ff) + (((d & 0xff00)*sa >> 8) & 0xff00), s);\n\n\t}\n\n};\n\nstruct premulalpha_blend_a_a_o_func {\t// TVPAddAlphaBlend_a_a_o\n\n\tpremulalpha_blend_a_a_func func_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s, tjs_int opa ) const {\n\n\t\ts = (((s & 0xff00ff)*opa >> 8) & 0xff00ff) + (((s >> 8) & 0xff00ff)*opa & 0xff00ff00);\n\n\t\treturn func_(d, s);\n\n\t}\n\n};\n\n\n\nstatic inline tjs_uint32 mul_color( tjs_uint32 color, tjs_uint32 fac ) {\n\n\treturn (((((color & 0x00ff00) * fac) & 0x00ff0000) +\n\n\t\t\t(((color & 0xff00ff) * fac) & 0xff00ff00) ) >> 8);\n\n}\n\nstatic inline tjs_uint32 alpha_and_color_to_additive_alpha( tjs_uint32 alpha, tjs_uint32 color ) {\n\n\treturn mul_color(color, alpha) + (color & 0xff000000);\n\n}\n\nstatic inline tjs_uint32 alpha_to_additive_alpha( tjs_uint32 a ) {\n\n\treturn alpha_and_color_to_additive_alpha( a >> 24, a );\n\n}\n\nstruct premulalpha_blend_a_d_func {\t// TVPAddAlphaBlend_a_d\n\n\tpremulalpha_blend_a_a_func func_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s ) const {\n\n\t\treturn func_(d, alpha_to_additive_alpha(s));\n\n\t}\n\n};\n\nstruct premulalpha_blend_a_d_o_func {\t// TVPAddAlphaBlend_a_d_o\n\n\tpremulalpha_blend_a_d_func func_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s, tjs_int opa ) const {\n\n\t\ts = (s & 0xffffff) + ((((s >> 24) * opa) >> 8) << 24);\n\n\t\treturn func_(d, s);\n\n\t}\n\n};\n\n/*\n\n\tDi = sat(Si, (1-Sa)*Di)\n\n\tDa = Sa + Da - SaDa\n\n*/\n\nstruct premulalpha_blend_a_ca_func {\t// = TVPAddAlphaBlend_a_ca\n\n\tsaturated_u8_add_func sat_add_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 dest, tjs_uint32 sopa, tjs_uint32 sopa_inv, tjs_uint32 src ) const {\n\n\t\ttjs_uint32 dopa = dest >> 24;\n\n\t\tdopa = dopa + sopa - (dopa*sopa >> 8);\n\n\t\tdopa -= (dopa >> 8); /* adjust alpha */\n\n\t\treturn (dopa << 24) + sat_add_((((dest & 0xff00ff)*sopa_inv >> 8) & 0xff00ff) + (((dest & 0xff00)*sopa_inv >> 8) & 0xff00), src);\n\n\t}\n\n};\n\n\n\n\n\n//------------------------------------------------------------------------------\n\n// カラー成分にfacをかける\n\nstruct mul_color_func {\n\n\tinline tjs_uint32 operator()(tjs_uint32 color, tjs_uint32 fac) const {\n\n\t\treturn (((((color & 0x00ff00) * fac) & 0x00ff0000) + (((color & 0xff00ff) * fac) & 0xff00ff00) ) >> 8);\n\n\t}\n\n};\n\n//------------------------------------------------------------------------------\n\n// カラー成分にアルファをかける、アルファは維持する\n\nstruct alpha_and_color_to_premulalpha_func {\n\n\tmul_color_func func_;\n\n\tinline tjs_uint32 operator()( tjs_uint32 alpha, tjs_uint32 color ) const {\n\n\t\treturn func_( color, alpha ) + (color & 0xff000000);\n\n\t}\n\n};\n\n//------------------------------------------------------------------------------\n\n// 通常のアルファを持つ色からプレマルチプライド(乗算済み)アルファ形式の色に変換する\n\nstruct alpha_to_premulalpha_func {\n\n\talpha_and_color_to_premulalpha_func func_;\n\n\tinline tjs_uint32 operator()(tjs_uint32 a) const {\n\n\t\treturn func_( a >> 24, a );\n\n\t}\n\n};\n\n//------------------------------------------------------------------------------\n\n/* returns a * ratio + b * (1 - ratio) */\n\nstruct blend_argb {\n\n\tinline tjs_uint32 operator()(tjs_uint32 b, tjs_uint32 a, tjs_int ratio ) const {\n\n\t\ttjs_uint32 b2 = b & 0x00ff00ff;\n\n\t\ttjs_uint32 t = (b2 + (((a & 0x00ff00ff) - b2) * ratio >> 8)) & 0x00ff00ff;\n\n\t\tb2 = (b & 0xff00ff00) >> 8;\n\n\t\treturn t + (((b2 + (( ((a & 0xff00ff00) >> 8) - b2) * ratio >> 8)) << 8)& 0xff00ff00);\n\n\t}\n\n};\n\n//------------------------------------------------------------------------------\n\n\n", "file_path": "visual/gl/blend_util_func.h", "rank": 26, "score": 96330.44422427328 }, { "content": "//---------------------------------------------------------------------------\n\n// meta callback information structure used by PNG_read_chunk_callback\n\nstruct PNG_read_chunk_callback_user_struct\n\n{\n\n\tvoid * callbackdata;\n\n tTVPMetaInfoPushCallback metainfopushcallback;\n\n};\n\n//---------------------------------------------------------------------------\n\n// user_malloc_fn\n\nstatic png_voidp PNG_malloc(png_structp ps, png_size_t size)\n\n{\n\n\treturn malloc(size);\n\n}\n\n//---------------------------------------------------------------------------\n\n// user_free_fn\n\nstatic void PNG_free (png_structp ps,void* /* png_structp*/ mem)\n\n{\n\n\tfree(mem);\n\n}\n\n//---------------------------------------------------------------------------\n\n// user_error_fn\n\nstatic void PNG_error (png_structp ps, png_const_charp msg)\n", "file_path": "visual/LoadPNG.cpp", "rank": 27, "score": 96007.44302390802 }, { "content": " unsigned short s2;\n", "file_path": "sound/win32/tvpsnd.c", "rank": 28, "score": 95218.7726015429 }, { "content": " unsigned short s1;\n", "file_path": "sound/win32/tvpsnd.c", "rank": 29, "score": 95218.01128009398 }, { "content": "\t\ttjs_uint32 a2 = s2 >> 24;\n", "file_path": "visual/gl/blend_functor_c.h", "rank": 30, "score": 93272.06277765673 }, { "content": "\t\ttjs_uint32 addr = (a2*opa_ & 0xff00) + (a1*iopa_ >> 8);\n", "file_path": "visual/gl/blend_functor_c.h", "rank": 31, "score": 93263.98737676191 }, { "content": " unsigned short s2;\n", "file_path": "movie/win32/IBufferRenderer_i.c", "rank": 32, "score": 93260.1314341363 }, { "content": " unsigned short s1;\n", "file_path": "movie/win32/IBufferRenderer_i.c", "rank": 33, "score": 93259.40081686343 }, { "content": "\tinline const_alpha_fill_blend_a_functor( tjs_int32 opa, tjs_int32 color ) : opa_(opa),\n\n\t\tcolor_( (((((color&0x00ff00) * opa) & 0x00ff0000) + (((color&0xff00ff) * opa) & 0xff00ff00) ) >> 8)),\n\n\t\topa_inv_(opa^0xff) {}\n\n\tinline tjs_uint32 operator()( tjs_uint32 d ) const {\n", "file_path": "visual/gl/blend_functor_c.h", "rank": 34, "score": 93256.59324320697 }, { "content": "\t\treturn ~tmp ^ (d & 0xff000000);\n", "file_path": "visual/gl/blend_functor_c.h", "rank": 35, "score": 93249.8205279505 }, { "content": "struct BicubicWeight {\n\n\tstatic const float RANGE;\n\n\n\n\tfloat coeff;\n\n\tfloat p[5];\n\n\t/**\n\n\t * @param c : シャープさ。小さくなるにしたがって強くなる\n\n\t */\n\n\tBicubicWeight( float c = -1 ) : coeff(c) {\n\n\t\tp[0] = coeff + 3.0f;\n\n\t\tp[1] = coeff + 2.0f;\n\n\t\tp[2] = -coeff*4.0f;\n\n\t\tp[3] = coeff*8.0f;\n\n\t\tp[4] = coeff*5.0f;\n\n\t}\n\n\tinline float operator()( float distance ) const {\n\n\t\tfloat x = std::abs(distance);\n\n\t\tif( x <= 1.0f ) {\n\n\t\t\treturn 1.0f - p[0]*x*x + p[1]*x*x*x;\n\n\t\t} else if( x <= 2.0f ) {\n\n\t\t\treturn p[2] + p[3]*x - p[4]*x*x + coeff*x*x*x;\n\n\t\t} else {\n\n\t\t\treturn 0.0f;\n\n\t\t}\n", "file_path": "visual/gl/WeightFunctor.h", "rank": 36, "score": 93158.51529171749 }, { "content": "DEFINE_BLEND_PS_VARIATION( ps_darken_blend )\n\n\n\n//--------------------------------------------------------------------------------------------------------\n\n//! Photoshop互換の「差の絶対値」合成\n", "file_path": "visual/gl/blend_functor_c.h", "rank": 37, "score": 92893.65853151242 }, { "content": "struct tTVPRect;\n", "file_path": "visual/drawable.h", "rank": 38, "score": 92238.74443543458 }, { "content": "struct BITMAPINFO;\n\n#endif\n\n\n\n/*[*/\n", "file_path": "visual/DrawDevice.h", "rank": 39, "score": 92238.74443543458 }, { "content": "\tint len = 0;\n", "file_path": "visual/gl/ResampleImageInternal.h", "rank": 40, "score": 91465.1934012654 }, { "content": "\t\t__m128i ms2 = ms;\n", "file_path": "visual/gl/blend_functor_sse2.h", "rank": 41, "score": 91461.05564782646 }, { "content": "\t\t__m128i ms2 = ms;\n", "file_path": "visual/gl/blend_functor_avx2.h", "rank": 42, "score": 91461.05564782646 }, { "content": "\t\treturn (ret&0x00ffffff) | addr;\n", "file_path": "visual/gl/blend_functor_sse2.h", "rank": 43, "score": 91457.17763926613 }, { "content": "\t\treturn (ret&0x00ffffff) | addr;\n", "file_path": "visual/gl/blend_functor_avx2.h", "rank": 44, "score": 91457.17763926613 }, { "content": " unsigned short s2;\n", "file_path": "movie/win32/IRendererBufferAccess_i.c", "rank": 45, "score": 91453.35015951308 }, { "content": " unsigned short s2;\n", "file_path": "movie/win32/IRendererBufferVideo_i.c", "rank": 46, "score": 91453.35015951308 }, { "content": " unsigned short s1;\n", "file_path": "movie/win32/IRendererBufferAccess_i.c", "rank": 47, "score": 91452.6478658205 }, { "content": " unsigned short s1;\n", "file_path": "movie/win32/IRendererBufferVideo_i.c", "rank": 48, "score": 91452.6478658205 }, { "content": "struct sse2_premul_alpha_blend_a_functor {\n\n\tconst __m128i mask_;\n\n\tconst __m128i zero_;\n\n\tinline sse2_premul_alpha_blend_a_functor() : zero_(_mm_setzero_si128()), mask_(_mm_set1_epi32(0x00ffffff)) {}\n\n\tinline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s ) const {\n\n\t\t__m128i ms = _mm_cvtsi32_si128( s );\n\n\t\t__m128i mo = ms;\n\n\t\tmo = _mm_srli_epi64( mo, 24 );\t\t\t// sopa\n\n\t\tms = _mm_unpacklo_epi8( ms, zero_ );\t// 00Sa00Si00Si00Si\n\n\t\tmo = _mm_unpacklo_epi16( mo, mo );\t\t// 0000000000Sa00Sa\n\n\t\t__m128i md = _mm_cvtsi32_si128( d );\n\n\t\tmo = _mm_unpacklo_epi16( mo, mo );\t\t// 00Sa00Sa00Sa00Sa\n\n\t\tmd = _mm_unpacklo_epi8( md, zero_ );\t// 00Da00Di00Di00Di\n\n\t\t__m128i md2 = md;\n\n\t\tmd2 = _mm_mullo_epi16( md2, mo );\t// d * sopa\n\n\t\tmd2 = _mm_srli_epi16( md2, 8 );\t\t// 00 SaDa 00 SaDi 00 SaDi 00 SaDi\n\n\t\tmd = _mm_sub_epi16( md, md2 );\t\t// d - d*sopa\n\n\t\tmd = _mm_add_epi16( md, ms );\t\t// (d-d*sopa) + s\n\n\t\tmd = _mm_packus_epi16( md, zero_ );\n\n\t\treturn _mm_cvtsi128_si32( md );\n\n\t}\n\n\tinline __m128i operator()( __m128i md, __m128i ms ) const {\n\n\t\t__m128i mo0 = ms;\n\n\t\tmo0 = _mm_srli_epi32( mo0, 24 );\n\n\t\tmo0 = _mm_packs_epi32( mo0, mo0 );\t\t// 0 1 2 3 0 1 2 3\n\n\t\tmo0 = _mm_unpacklo_epi16( mo0, mo0 );\t// 0 0 1 1 2 2 3 3\n\n\t\t__m128i mo1 = mo0;\n\n\t\tmo1 = _mm_unpacklo_epi16( mo1, mo1 );\t// 0 0 0 0 1 1 1 1 o[1]\n\n\t\tmo0 = _mm_unpackhi_epi16( mo0, mo0 );\t// 2 2 2 2 3 3 3 3 o[0]\n\n\n\n\t\t__m128i md1 = md;\n\n\t\t__m128i ms1 = ms;\n\n\t\tmd = _mm_unpackhi_epi8( md, zero_ );// 00dd00dd00dd00dd d[0]\n\n\t\t__m128i md02 = md;\n\n\t\tms = _mm_unpackhi_epi8( ms, zero_ );\n\n\t\tmd02 = _mm_mullo_epi16( md02, mo0 );\t// d * sopa | d[0]\n\n\t\tmd02 = _mm_srli_epi16( md02, 8 );\t// 00 SaDa 00 SaDi 00 SaDi 00 SaDi | d[0]\n\n\t\tmd = _mm_sub_epi16( md, md02 );\t\t// d - d*sopa | d[0]\n\n\t\tmd = _mm_add_epi16( md, ms );\t\t// d - d*sopa + s | d[0]\n\n\n\n\t\tmd1 = _mm_unpacklo_epi8( md1, zero_ );// 00dd00dd00dd00dd d[1]\n\n\t\t__m128i md12 = md1;\n\n\t\tms1 = _mm_unpacklo_epi8( ms1, zero_ );\n\n\t\tmd12 = _mm_mullo_epi16( md12, mo1 );// d * sopa | d[1]\n\n\t\tmd12 = _mm_srli_epi16( md12, 8 );\t// 00 SaDa 00 SaDi 00 SaDi 00 SaDi | d[1]\n\n\t\tmd1 = _mm_sub_epi16( md1, md12 );\t// d - d*sopa | d[1]\n\n\t\tmd1 = _mm_add_epi16( md1, ms1 );\t// d - d*sopa + s | d[1]\n\n\n\n\t\treturn _mm_packus_epi16( md1, md );\n", "file_path": "visual/gl/blend_functor_sse2.h", "rank": 49, "score": 91360.70707649158 }, { "content": "struct avx2_premul_alpha_blend_a_functor {\n\n\tconst __m256i zero_;\n\n\tinline avx2_premul_alpha_blend_a_functor() : zero_(_mm256_setzero_si256()) {}\n\n\tinline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s ) const {\n\n\t\t__m128i ms = _mm_cvtsi32_si128( s );\n\n\t\t__m128i mo = ms;\n\n\t\tmo = _mm_srli_epi64( mo, 24 );\t\t\t// sopa\n\n\t\tmo = _mm_shufflelo_epi16( mo, _MM_SHUFFLE( 0, 0, 0, 0 ) );\t// 00Sa00Sa00Sa00Sa\n\n\t\tms = _mm_cvtepu8_epi16( ms );\t// 00Sa00Si00Si00Si\n\n\t\t__m128i md = _mm_cvtsi32_si128( d );\n\n\t\tmd = _mm_cvtepu8_epi16( md );\t// 00Da00Di00Di00Di\n\n\t\t__m128i md2 = md;\n\n\t\tmd2 = _mm_mullo_epi16( md2, mo );\t// d * sopa\n\n\t\tmd2 = _mm_srli_epi16( md2, 8 );\t\t// 00 SaDa 00 SaDi 00 SaDi 00 SaDi\n\n\t\tmd = _mm_sub_epi16( md, md2 );\t\t// d - d*sopa\n\n\t\tmd = _mm_add_epi16( md, ms );\t\t// (d-d*sopa) + s\n\n\t\tmd = _mm_packus_epi16( md, md );\n\n\t\treturn _mm_cvtsi128_si32( md );\n\n\t}\n\n\tinline __m256i operator()( __m256i md, __m256i ms ) const {\n\n\t\t__m256i mo0 = ms;\n\n\t\tmo0 = _mm256_srli_epi32( mo0, 24 );\n\n\t\tmo0 = _mm256_packs_epi32( mo0, mo0 );\t\t// 0 1 2 3 0 1 2 3\n\n\t\tmo0 = _mm256_unpacklo_epi16( mo0, mo0 );\t// 0 0 1 1 2 2 3 3\n\n\t\t__m256i mo1 = mo0;\n\n\t\tmo1 = _mm256_unpacklo_epi16( mo1, mo1 );\t// 0 0 0 0 1 1 1 1 o[1]\n\n\t\tmo0 = _mm256_unpackhi_epi16( mo0, mo0 );\t// 2 2 2 2 3 3 3 3 o[0]\n\n\n\n\t\t__m256i md1 = md;\n\n\t\t__m256i ms1 = ms;\n\n\t\tmd = _mm256_unpackhi_epi8( md, zero_ );// 00dd00dd00dd00dd d[0]\n\n\t\t__m256i md02 = md;\n\n\t\tms = _mm256_unpackhi_epi8( ms, zero_ );\n\n\t\tmd02 = _mm256_mullo_epi16( md02, mo0 );\t// d * sopa | d[0]\n\n\t\tmd02 = _mm256_srli_epi16( md02, 8 );\t// 00 SaDa 00 SaDi 00 SaDi 00 SaDi | d[0]\n\n\t\tmd = _mm256_sub_epi16( md, md02 );\t\t// d - d*sopa | d[0]\n\n\t\tmd = _mm256_add_epi16( md, ms );\t\t// d - d*sopa + s | d[0]\n\n\n\n\t\tmd1 = _mm256_unpacklo_epi8( md1, zero_ );// 00dd00dd00dd00dd d[1]\n\n\t\t__m256i md12 = md1;\n\n\t\tms1 = _mm256_unpacklo_epi8( ms1, zero_ );\n\n\t\tmd12 = _mm256_mullo_epi16( md12, mo1 );// d * sopa | d[1]\n\n\t\tmd12 = _mm256_srli_epi16( md12, 8 );\t// 00 SaDa 00 SaDi 00 SaDi 00 SaDi | d[1]\n\n\t\tmd1 = _mm256_sub_epi16( md1, md12 );\t// d - d*sopa | d[1]\n\n\t\tmd1 = _mm256_add_epi16( md1, ms1 );\t// d - d*sopa + s | d[1]\n\n\n\n\t\treturn _mm256_packus_epi16( md1, md );\n", "file_path": "visual/gl/blend_functor_avx2.h", "rank": 50, "score": 91360.70707649158 }, { "content": "struct sse2_bilinear_fixy_functor {\n\n\tconst __m128i zero_;\n\n\tconst __m128i mby_;\n\n\tinline sse2_bilinear_fixy_functor( tjs_int blend_y ) : zero_(_mm_setzero_si128()),\n\n\t\tmby_(_mm_set1_epi16( (short)(blend_y+(blend_y>>7)) )) {}\n\n\n\n\tinline tjs_uint32 operator()( const tjs_uint32* src1, const tjs_uint32* src2, tjs_int srcstart ) const {\n\n\t\ttjs_int blend_x = (srcstart & 0xffff) >> 8;\n\n\t\t__m128i mbx = _mm_set1_epi16( (short)blend_x );\n\n\n\n\t\t// 2pixel 同時に読むとレジスタ節約できる\n\n\t\ttjs_int sp = srcstart >> 16;\n\n\t\t__m128i mp1 = _mm_loadl_epi64( (__m128i const*)(src1+sp) );\t// p1 | p2 : s0p0 s0p1\n\n\t\t__m128i mp2 = _mm_loadl_epi64( (__m128i const*)(src2+sp) );\t// p3 | p4 : s1p0 s1p1\n\n\t\tmp1 = _mm_unpacklo_epi32( mp1, mp2 );\t// 1 3 2 4\n\n\t\tmp2 = mp1;\n\n\t\tmp1 = _mm_shuffle_epi32( mp1, _MM_SHUFFLE( 1, 0, 1, 0 ) );\t// 1 3 1 3\n\n\t\tmp2 = _mm_shuffle_epi32( mp2, _MM_SHUFFLE( 3, 2, 3, 2 ) );\t// 2 4 2 4\n\n\t\tmp1 = _mm_unpacklo_epi8( mp1, zero_ );\n\n\t\tmp2 = _mm_unpacklo_epi8( mp2, zero_ );\n\n\n\n\t\t// 上下段を同時にmbxでブレンド\n\n\t\tmp2 = _mm_sub_epi16( mp2, mp1 );\t// s0: mm2 = s0p1 - s0p0\n\n\t\tmp2 = _mm_mullo_epi16( mp2, mbx );\t// s0:\n\n\t\tmp2 = _mm_srli_epi16( mp2, 8 );\t\t// s0: mm2 = (s0p1 - s0p0) * bx\n\n\t\tmp1 = _mm_add_epi8( mp1, mp2 );\t\t// s0: mm1 = s0p0 + (s0p1 - s0p0) * bx = S0\n\n\t\t__m128i mp3 = mp1;\n\n\t\tmp3 = _mm_srli_si128( mp3, 8 );\n\n\n\n\t\t// 上下をmbyでブレンド\n\n\t\tmp3 = _mm_sub_epi16( mp3, mp1 );\t// s0/s1: mm3 = S1 - S0\n\n\t\tmp3 = _mm_mullo_epi16( mp3, mby_ );\t// s0/s1:\n\n\t\tmp3 = _mm_srli_epi16( mp3, 8 );\t\t// s0/s1: mm3 = (S1 - S0) * by\n\n\t\tmp1 = _mm_add_epi8( mp1, mp3 );\t\t// s0/s1: mm1 = S0 + (S1 - S0) * by = dst\n\n\n\n\t\tmp1 = _mm_packus_epi16( mp1, mp1 );\n\n\t\treturn _mm_cvtsi128_si32( mp1 );\n\n\t}\n\n\n\n\tinline __m128i operator()( const tjs_uint32* src1, const tjs_uint32* src2, __m128i mstart ) const {\n\n\t\t__m128i offset = mstart;\n\n\t\toffset = _mm_srli_epi32( offset, 16 );\t// >> 16\n\n\t\ttjs_int o0 = offset.m128i_i32[0];\n\n\t\ttjs_int o1 = offset.m128i_i32[1];\n\n\t\ttjs_int o2 = offset.m128i_i32[2];\n\n\t\ttjs_int o3 = offset.m128i_i32[3];\n\n\n\n\t\t__m128i mbx = mstart;\n\n\t\tmbx = _mm_shufflelo_epi16( mbx, _MM_SHUFFLE( 2, 2, 0, 0 ) );\t// sx4 sx3 | sx2 sx2 sx1 sx1 = & 0x0000ffffに近い効果\n\n\t\tmbx = _mm_shufflehi_epi16( mbx, _MM_SHUFFLE( 2, 2, 0, 0 ) );\t// sx4 sx4 sx3 sx3 sx2 sx2 sx1 sx1\n\n\t\tmbx = _mm_srli_epi16( mbx, 8 );\n\n\t\t__m128i mbx2 = mbx;\n\n\t\tmbx = _mm_unpacklo_epi32( mbx, mbx );\t// sx2 sx2 sx2 sx2 sx1 sx1 sx1 sx1\n\n\t\t__m128i r0 = two( src1, src2, o0, o1, mbx );\n\n\t\tmbx2 = _mm_unpackhi_epi32( mbx2, mbx2 );\n\n\t\t__m128i r1 = two( src1, src2, o2, o3, mbx2 );\n\n\t\treturn _mm_packus_epi16( r0, r1 );\n", "file_path": "visual/gl/interpolation_functor_sse2.h", "rank": 51, "score": 91359.74066708586 }, { "content": "\topa = table[*rule];\n\n\trule++;\n\n\ts1 = *src1;\n\n\ts2 = *src2;\n\n\ta1 = s1 >> 24;\n\n\ta2 = s2 >> 24;\n\n\taddr = (a2*opa & 0xff00) + (a1*(256-opa) >> 8);\n\n\talpha = TVPOpacityOnOpacityTable[addr];\n\n\ts1_ = s1 & 0xff00ff;\n\n\ts1_ = ((s1_ + (((s2 & 0xff00ff) - s1_) * alpha >> 8)) & 0xff00ff);\n\n\tsrc1++;\n\n\tsrc2++;\n\n\ts1 &= 0xff00;\n\n\ts2 &= 0xff00;\n\n\ts1_ |= (a1 + ((a2 - a1)*opa >> 8)) << 24;\n\n\t*dest = s1_ | ((s1 + ((s2 - s1) * alpha >> 8)) & 0xff00);\n\n\tdest++;\n\n}\n\nEOF\n\n\n", "file_path": "visual/glgen/gengl.pl", "rank": 53, "score": 76.7827442415237 }, { "content": "\ts2 = *src2;\n\n\ta1 = s1 >> 24;\n\n\ta2 = s2 >> 24;\n\n\taddr = (a2*opa & 0xff00) + (a1*iopa >> 8);\n\n\talpha = TVPOpacityOnOpacityTable[addr];\n\n\ts1_ = s1 & 0xff00ff;\n\n\ts1_ = ((s1_ + (((s2 & 0xff00ff) - s1_) * alpha >> 8)) & 0xff00ff);\n\n\tsrc1++;\n\n\tsrc2++;\n\n\ts1 &= 0xff00;\n\n\ts2 &= 0xff00;\n\n\ts1_ |= (a1 + ((a2 - a1)*opa >> 8)) << 24;\n\n\t*dest = s1_ | ((s1 + ((s2 - s1) * alpha >> 8)) & 0xff00);\n\n\tdest++;\n\n}\n\nEOF\n\n\n\n&loop_unroll_c($content, 'len', 4);\n\n\n\nprint FC <<EOF;\n", "file_path": "visual/glgen/gengl.pl", "rank": 61, "score": 70.19332816460957 }, { "content": "\treturn TVPConstAlphaBlend_SD(dest, src1, src2, len, opa);\n\n}\n\nstatic void __stdcall TVP_Stub_6bbea3af36c35631641cc8356ff65475(tjs_uint32 * dest , const tjs_uint32 * src1 , const tjs_uint32 * src2 , tjs_int len , tjs_int opa)\n\n{\n\n\treturn TVPConstAlphaBlend_SD_a(dest, src1, src2, len, opa);\n\n}\n\nstatic void __stdcall TVP_Stub_cac02dfd62ba94abf6a346bef0bf3ab9(tjs_uint32 * dest , const tjs_uint32 * src1 , const tjs_uint32 * src2 , tjs_int len , tjs_int opa)\n\n{\n\n\treturn TVPConstAlphaBlend_SD_d(dest, src1, src2, len, opa);\n\n}\n\nstatic void __stdcall TVP_Stub_68eeb36d76d88ff00014f04b23454254(tjs_uint32 * table , tjs_int phase , tjs_int vague)\n\n{\n\n\treturn TVPInitUnivTransBlendTable(table, phase, vague);\n\n}\n\nstatic void __stdcall TVP_Stub_65e03b1c849b6e9cb5c478024aa9a5b7(tjs_uint32 * table , tjs_int phase , tjs_int vague)\n\n{\n\n\treturn TVPInitUnivTransBlendTable_d(table, phase, vague);\n\n}\n\nstatic void __stdcall TVP_Stub_7670c0c5630625ee6a73b7b9ee093650(tjs_uint32 * table , tjs_int phase , tjs_int vague)\n\n{\n", "file_path": "base/win32/FuncStubs.cpp", "rank": 62, "score": 69.78792502940094 }, { "content": "/*export*/\n\nTVP_GL_FUNC_DECL(void, TVPUnivTransBlend_switch_c, (tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, const tjs_uint8 *rule, const tjs_uint32 *table, tjs_int len, tjs_int src1lv, tjs_int src2lv))\n\n{\n\n\ttjs_uint32 s1_, s1, s2;\n\n\ttjs_int opa;\n\nEOF\n\n\n\n\n\n$content = <<EOF;\n\n{\n\n\topa = *rule;\n\n\tif(opa >= src1lv)\n\n\t{\n\n\t\t*dest = *src1;\n\n\t\trule++; src1++; src2++; dest++;\n\n\t}\n\n\telse if(opa < src2lv)\n\n\t{\n\n\t\t*dest = *src2;\n\n\t\trule++; src1++; src2++; dest++;\n", "file_path": "visual/glgen/gengl.pl", "rank": 63, "score": 69.40491006091568 }, { "content": "\t\ta1 = s1 >> 24;\n\n\t\ta2 = s2 >> 24;\n\n\t\taddr = (a2*opa & 0xff00) + (a1*(256-opa) >> 8);\n\n\t\talpha = TVPOpacityOnOpacityTable[addr];\n\n\t\ts1_ = s1 & 0xff00ff;\n\n\t\ts1_ = ((s1_ + (((s2 & 0xff00ff) - s1_) * alpha >> 8)) & 0xff00ff) +\n\n\t\t\t(TVPNegativeMulTable[addr]<<24);\n\n\t\tsrc1++;\n\n\t\tsrc2++;\n\n\t\ts1 &= 0xff00;\n\n\t\ts2 &= 0xff00;\n\n\t\t*dest = s1_ | ((s1 + ((s2 - s1) * alpha >> 8)) & 0xff00);\n\n\t\tdest++;\n\n\t}\n\n}\n\nEOF\n\n\n\n&loop_unroll_c($content, 'len', 4);\n\n\n\nprint FC <<EOF;\n", "file_path": "visual/glgen/gengl.pl", "rank": 64, "score": 69.04946440362095 }, { "content": "\treturn TVPLinTransConstAlphaBlend_a(dest, len, src, sx, sy, stepx, stepy, srcpitch, opa);\n\n}\n\nstatic void STDCALL TVP_Stub_247b25d497e48bc0191fdb2ac530f4ca(tjs_uint32 * dest , const tjs_uint32 * src1 , const tjs_uint32 * src2 , tjs_int len , tjs_int opa)\n\n{\n\n\treturn TVPConstAlphaBlend_SD(dest, src1, src2, len, opa);\n\n}\n\nstatic void STDCALL TVP_Stub_6bbea3af36c35631641cc8356ff65475(tjs_uint32 * dest , const tjs_uint32 * src1 , const tjs_uint32 * src2 , tjs_int len , tjs_int opa)\n\n{\n\n\treturn TVPConstAlphaBlend_SD_a(dest, src1, src2, len, opa);\n\n}\n\nstatic void STDCALL TVP_Stub_cac02dfd62ba94abf6a346bef0bf3ab9(tjs_uint32 * dest , const tjs_uint32 * src1 , const tjs_uint32 * src2 , tjs_int len , tjs_int opa)\n\n{\n\n\treturn TVPConstAlphaBlend_SD_d(dest, src1, src2, len, opa);\n\n}\n\nstatic void STDCALL TVP_Stub_68eeb36d76d88ff00014f04b23454254(tjs_uint32 * table , tjs_int phase , tjs_int vague)\n\n{\n\n\treturn TVPInitUnivTransBlendTable(table, phase, vague);\n\n}\n\nstatic void STDCALL TVP_Stub_65e03b1c849b6e9cb5c478024aa9a5b7(tjs_uint32 * table , tjs_int phase , tjs_int vague)\n\n{\n", "file_path": "base/android/FuncStubs.cpp", "rank": 65, "score": 68.4771450264801 }, { "content": "// dest = src1 * src2 となっているもの\n\ntemplate<typename functor>\n\nstatic inline void sd_blend_func_sse2( tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, tjs_int len, const functor& func ) {\n\n\tif( len <= 0 ) return;\n\n\n\n\ttjs_int count = (tjs_int)((unsigned)dest & 0xF);\n\n\tif( count ) {\n\n\t\tcount = (16 - count)>>2;\n\n\t\tcount = count > len ? len : count;\n\n\t\ttjs_uint32* limit = dest + count;\n\n\t\twhile( dest < limit ) {\n\n\t\t\t*dest = func( *src1, *src2 );\n\n\t\t\tdest++; src1++; src2++;\n\n\t\t}\n\n\t\tlen -= count;\n\n\t}\n\n\ttjs_uint32 rem = (len>>2)<<2;\n\n\ttjs_uint32* limit = dest + rem;\n\n\tif( (((unsigned)src1)&0xF) == 0 && (((unsigned)src2)&0xF) == 0 ) {\n\n\t\twhile( dest < limit ) {\n", "file_path": "visual/gl/blend_function_sse2.cpp", "rank": 66, "score": 68.03935767539015 }, { "content": "\n\n&loop_unroll_c($content, 'len', 4);\n\n\n\nprint FC <<EOF;\n\n}\n\n\n\nEOF\n\n\n\n;#-----------------------------------------------------------------\n\n\n\n\n\nprint FC <<EOF;\n\n/*export*/\n\nTVP_GL_FUNC_DECL(void, TVPUnivTransBlend_switch_d_c, (tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, const tjs_uint8 *rule, const tjs_uint32 *table, tjs_int len, tjs_int src1lv, tjs_int src2lv))\n\n{\n\n\ttjs_uint32 s1_, s2, s1, addr;\n\n\ttjs_uint32 a1, a2;\n\n\ttjs_int alpha;\n\n\ttjs_int opa;\n\nEOF\n", "file_path": "visual/glgen/gengl.pl", "rank": 67, "score": 67.95152466696493 }, { "content": "\treturn TVPInitUnivTransBlendTable_d(table, phase, vague);\n\n}\n\nstatic void STDCALL TVP_Stub_7670c0c5630625ee6a73b7b9ee093650(tjs_uint32 * table , tjs_int phase , tjs_int vague)\n\n{\n\n\treturn TVPInitUnivTransBlendTable_a(table, phase, vague);\n\n}\n\nstatic void STDCALL TVP_Stub_68a0abce6eefa08e74353ec48c4c87a8(tjs_uint32 * dest , const tjs_uint32 * src1 , const tjs_uint32 * src2 , const tjs_uint8 * rule , const tjs_uint32 * table , tjs_int len)\n\n{\n\n\treturn TVPUnivTransBlend(dest, src1, src2, rule, table, len);\n\n}\n\nstatic void STDCALL TVP_Stub_ccb6e098b9a0791a0f20e9f1af55e341(tjs_uint32 * dest , const tjs_uint32 * src1 , const tjs_uint32 * src2 , const tjs_uint8 * rule , const tjs_uint32 * table , tjs_int len , tjs_int src1lv , tjs_int src2lv)\n\n{\n\n\treturn TVPUnivTransBlend_switch(dest, src1, src2, rule, table, len, src1lv, src2lv);\n\n}\n\nstatic void STDCALL TVP_Stub_0f817efe47b451fd719c05a104c2b803(tjs_uint32 * dest , const tjs_uint32 * src1 , const tjs_uint32 * src2 , const tjs_uint8 * rule , const tjs_uint32 * table , tjs_int len)\n\n{\n\n\treturn TVPUnivTransBlend_d(dest, src1, src2, rule, table, len);\n\n}\n\nstatic void STDCALL TVP_Stub_efad1a3d774747bd2b5adb221ede2678(tjs_uint32 * dest , const tjs_uint32 * src1 , const tjs_uint32 * src2 , const tjs_uint8 * rule , const tjs_uint32 * table , tjs_int len , tjs_int src1lv , tjs_int src2lv)\n\n{\n", "file_path": "base/android/FuncStubs.cpp", "rank": 68, "score": 66.09838398799636 }, { "content": "static void overlap_copy_func_avx2( tjs_uint32 * __restrict dest, const tjs_uint32 * __restrict src, tjs_int len ) {\n\n\tfunctor func;\n\n\toverlap_blend_func_avx2<functor>( dest, src, len, func );\n\n}\n\n// dest = src1 * src2 となっているもの\n\ntemplate<typename functor>\n\nstatic inline void sd_blend_func_avx2( tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, tjs_int len, const functor& func ) {\n\n\tif( len <= 0 ) return;\n\n\n\n\ttjs_uint32 rem = (len>>3)<<3;\n\n\ttjs_uint32* limit = dest + rem;\n\n\twhile( dest < limit ) {\n\n\t\t__m256i ms1 = _mm256_loadu_si256( (__m256i const*)src1 );\n\n\t\t__m256i ms2 = _mm256_loadu_si256( (__m256i const*)src2 );\n\n\t\t_mm256_storeu_si256( (__m256i*)dest, func( ms1, ms2 ) );\n\n\t\tdest+=8; src1+=8; src2+=8;\n\n\t}\n\n\tlimit += (len-rem);\n\n\twhile( dest < limit ) {\n\n\t\t*dest = func( *src1, *src2 );\n", "file_path": "visual/gl/blend_function_avx2.cpp", "rank": 69, "score": 66.03639215702064 }, { "content": "\n\n$content = <<EOF;\n\n{\n\n\topa = *rule;\n\n\tif(opa >= src1lv)\n\n\t{\n\n\t\t*dest = *src1;\n\n\t\trule++; src1++; src2++; dest++;\n\n\t}\n\n\telse if(opa < src2lv)\n\n\t{\n\n\t\t*dest = *src2;\n\n\t\trule++; src1++; src2++; dest++;\n\n\t}\n\n\telse\n\n\t{\n\n\t\topa = table[opa];\n\n\t\trule++;\n\n\t\ts1 = *src1;\n\n\t\ts2 = *src2;\n", "file_path": "visual/glgen/gengl.pl", "rank": 70, "score": 64.54043672094927 }, { "content": "\treturn TVPInitUnivTransBlendTable_a(table, phase, vague);\n\n}\n\nstatic void __stdcall TVP_Stub_68a0abce6eefa08e74353ec48c4c87a8(tjs_uint32 * dest , const tjs_uint32 * src1 , const tjs_uint32 * src2 , const tjs_uint8 * rule , const tjs_uint32 * table , tjs_int len)\n\n{\n\n\treturn TVPUnivTransBlend(dest, src1, src2, rule, table, len);\n\n}\n\nstatic void __stdcall TVP_Stub_ccb6e098b9a0791a0f20e9f1af55e341(tjs_uint32 * dest , const tjs_uint32 * src1 , const tjs_uint32 * src2 , const tjs_uint8 * rule , const tjs_uint32 * table , tjs_int len , tjs_int src1lv , tjs_int src2lv)\n\n{\n\n\treturn TVPUnivTransBlend_switch(dest, src1, src2, rule, table, len, src1lv, src2lv);\n\n}\n\nstatic void __stdcall TVP_Stub_0f817efe47b451fd719c05a104c2b803(tjs_uint32 * dest , const tjs_uint32 * src1 , const tjs_uint32 * src2 , const tjs_uint8 * rule , const tjs_uint32 * table , tjs_int len)\n\n{\n\n\treturn TVPUnivTransBlend_d(dest, src1, src2, rule, table, len);\n\n}\n\nstatic void __stdcall TVP_Stub_efad1a3d774747bd2b5adb221ede2678(tjs_uint32 * dest , const tjs_uint32 * src1 , const tjs_uint32 * src2 , const tjs_uint8 * rule , const tjs_uint32 * table , tjs_int len , tjs_int src1lv , tjs_int src2lv)\n\n{\n\n\treturn TVPUnivTransBlend_switch_d(dest, src1, src2, rule, table, len, src1lv, src2lv);\n\n}\n\nstatic void __stdcall TVP_Stub_563285ed004ddd2945f91db7b5347d3c(tjs_uint32 * dest , const tjs_uint32 * src1 , const tjs_uint32 * src2 , const tjs_uint8 * rule , const tjs_uint32 * table , tjs_int len)\n\n{\n", "file_path": "base/win32/FuncStubs.cpp", "rank": 71, "score": 63.747283867640476 }, { "content": "\n\nprint FC <<EOF;\n\n}\n\n\n\nEOF\n\n\n\n;#-----------------------------------------------------------------\n\n\n\nprint FC <<EOF;\n\n/*export*/\n\nTVP_GL_FUNC_DECL(void, TVPUnivTransBlend_d_c, (tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, const tjs_uint8 *rule, const tjs_uint32 *table, tjs_int len))\n\n{\n\n\ttjs_uint32 s1_, s2, s1, addr;\n\n\ttjs_uint32 a1, a2;\n\n\ttjs_int alpha;\n\n\ttjs_int opa;\n\nEOF\n\n\n\n$content = <<EOF;\n\n{\n", "file_path": "visual/glgen/gengl.pl", "rank": 72, "score": 62.84213289488913 }, { "content": "\n\n#include \"tjsCommHead.h\"\n\n#include \"tvpgl.h\"\n\n#include \"tvpgl_ia32_intf.h\"\n\n#include \"simd_def_x86x64.h\"\n\n\n\nextern \"C\" {\n\nextern unsigned char TVPOpacityOnOpacityTable[256*256];\n\nextern unsigned char TVPNegativeMulTable[256*256];\n\n};\n\n\n\n//--------------------------------------------------------------------\n\nvoid TVPFillARGB_sse2_c( tjs_uint32 *dest, tjs_int len, tjs_uint32 value ) {\n\n\tif( len <= 0 ) return;\n\n\ttjs_int count = (tjs_int)((unsigned)dest & 0xF);\n\n\tif( count ) {\n\n\t\tcount = (16 - count)>>2;\n\n\t\tcount = count > len ? len : count;\n\n\t\ttjs_uint32* limit = dest + count;\n\n\t\twhile( dest < limit ) {\n", "file_path": "visual/gl/colorfill_sse2.cpp", "rank": 73, "score": 62.82842715033309 }, { "content": ";#-----------------------------------------------------------------\n\n\n\n\n\n\n\nprint FC <<EOF;\n\n/*export*/\n\nTVP_GL_FUNC_DECL(void, TVPConstAlphaBlend_SD_d_c, (tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, tjs_int len, tjs_int opa))\n\n{/* alpha vs alpha, destination has alpha */\n\n\ttjs_uint32 s1_, s2, s1, addr;\n\n\ttjs_uint32 a1, a2;\n\n\ttjs_int alpha;\n\n\ttjs_int iopa;\n\n\tif(opa > 127) opa ++; /* adjust for error */\n\n\tiopa = 256 - opa;\n\n\t/* blending function for 'alpha-per-pixel enabled alpha blending' is complex. */\n\nEOF\n\n\n\n$content = <<EOF;\n\n{\n\n\ts1 = *src1;\n", "file_path": "visual/glgen/gengl.pl", "rank": 76, "score": 61.71192535891667 }, { "content": "\treturn TVPUnivTransBlend_switch_d(dest, src1, src2, rule, table, len, src1lv, src2lv);\n\n}\n\nstatic void STDCALL TVP_Stub_563285ed004ddd2945f91db7b5347d3c(tjs_uint32 * dest , const tjs_uint32 * src1 , const tjs_uint32 * src2 , const tjs_uint8 * rule , const tjs_uint32 * table , tjs_int len)\n\n{\n\n\treturn TVPUnivTransBlend_a(dest, src1, src2, rule, table, len);\n\n}\n\nstatic void STDCALL TVP_Stub_4c032260ef83d44bfe05fdc16843a8f9(tjs_uint32 * dest , const tjs_uint32 * src1 , const tjs_uint32 * src2 , const tjs_uint8 * rule , const tjs_uint32 * table , tjs_int len , tjs_int src1lv , tjs_int src2lv)\n\n{\n\n\treturn TVPUnivTransBlend_switch_a(dest, src1, src2, rule, table, len, src1lv, src2lv);\n\n}\n\nstatic void STDCALL TVP_Stub_96fd614457f06499a430b0c6e0e8a941(tjs_uint32 * dest , const tjs_uint8 * src , tjs_int len , tjs_uint32 color)\n\n{\n\n\treturn TVPApplyColorMap(dest, src, len, color);\n\n}\n\nstatic void STDCALL TVP_Stub_d6e36d304ff7253088ab4bc1aaf13a98(tjs_uint32 * dest , const tjs_uint8 * src , tjs_int len , tjs_uint32 color , tjs_int opa)\n\n{\n\n\treturn TVPApplyColorMap_o(dest, src, len, color, opa);\n\n}\n\nstatic void STDCALL TVP_Stub_eddacf49735189e23d9d49831851ffdb(tjs_uint32 * dest , const tjs_uint8 * src , tjs_int len , tjs_uint32 color)\n\n{\n", "file_path": "base/android/FuncStubs.cpp", "rank": 78, "score": 59.588044991757904 }, { "content": "\n\n\n\n;#-----------------------------------------------------------------\n\n\n\nprint FC <<EOF;\n\n/*export*/\n\nTVP_GL_FUNC_DECL(void, TVPUnivTransBlend_c, (tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, const tjs_uint8 *rule, const tjs_uint32 *table, tjs_int len))\n\n{\n\n\ttjs_uint32 s1_, s1, s2;\n\n\ttjs_int opa;\n\nEOF\n\n\n\n\n\n$content = <<EOF;\n\n{\n\n\topa = table[*rule];\n\n\trule++;\n\n\ts1 = *src1;\n\n\tsrc1++;\n\n\ts2 = *src2;\n", "file_path": "visual/glgen/gengl.pl", "rank": 79, "score": 59.572329811055795 }, { "content": "extern unsigned char TVPOpacityOnOpacityTable65[65*256];\n\nextern unsigned char TVPNegativeMulTable65[65*256];\n\nextern unsigned char TVPDitherTable_5_6[8][4][2][256];\n\nextern unsigned char TVPDitherTable_676[3][4][4][256];\n\nextern unsigned char TVP252DitherPalette[3][256];\n\nextern tjs_uint32 TVPRecipTable256[256];\n\nextern tjs_uint16 TVPRecipTable256_16[256];\n\n}\n\n#if 0\n\nvoid TVPMakeAlphaFromKey_sse2_c(tjs_uint32 *dest, tjs_int len, tjs_uint32 key) {\n\n\tif( len <= 0 ) return;\n\n\n\n\tkey &= 0x00ffffff;\n\n\ttjs_int count = (tjs_int)((unsigned)dest & 0xF);\n\n\tif( count ) {\t// ここで len > 3 としてしまった方がいいかな\n\n\t\tcount = (16 - count)>>2;\n\n\t\tcount = count > len ? len : count;\n\n\t\ttjs_uint32* limit = dest + count;\n\n\t\twhile( dest < limit ) {\n\n\t\t\ttjs_uint32 c = (*dest)&0x00ffffff;\n", "file_path": "visual/gl/blend_function_sse2.cpp", "rank": 80, "score": 57.20571094348432 }, { "content": "static void TVPAlphaBlend_o_sse2_c( tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len, tjs_int opa ) {\n\n\tsse2_alpha_blend_o_functor func(opa);\n\n\tblend_func_sse2( dest, src, len, func );\n\n}\n\nstatic void TVPAlphaBlend_HDA_o_sse2_c( tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len, tjs_int opa ) {\n\n\tsse2_alpha_blend_hda_o_functor func(opa);\n\n\tblend_func_sse2( dest, src, len, func );\n\n}\n\nstatic void TVPAlphaBlend_d_sse2_c( tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len ) {\n\n\tcopy_src_branch_func_sse2<sse2_alpha_blend_d_functor>( dest, src, len );\n\n}\n\n\n\nstatic void TVPConstAlphaBlend_SD_sse2_c(tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, tjs_int len, tjs_int opa){\n\n\tsse2_const_alpha_blend_functor func(opa);\n\n\tsd_blend_func_sse2( dest, src1, src2, len, func );\n\n}\n\nstatic void TVPCopyColor_sse2_c(tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len) {\n\n\toverlap_copy_func_sse2<sse2_color_copy_functor>( dest, src, len );\n\n}\n\nstatic void TVPCopyMask_sse2_c(tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len) {\n", "file_path": "visual/gl/blend_function_sse2.cpp", "rank": 82, "score": 56.577459025283446 }, { "content": "extern tjs_uint32 TVPRecipTable256[256];\n\nextern tjs_uint16 TVPRecipTable256_16[256];\n\n};\n\n\n\n#include \"blend_functor_c.h\"\n\n\n\n\n\nunsigned char ps_soft_light_table::TABLE[256][256];\n\nunsigned char ps_color_dodge_table::TABLE[256][256];\n\nunsigned char ps_color_burn_table::TABLE[256][256];\n\n#ifdef TVPPS_USE_OVERLAY_TABLE\n\nunsigned char ps_overlay_table::TABLE[256][256];\n\n#endif\n\n// 変換する\n\ntemplate<typename functor>\n\nstatic inline void convert_func_c( tjs_uint32 *dest, tjs_int len ) {\n\n\tfunctor func;\n\n\tfor( int i = 0; i < len; i++ ) {\n\n\t\tdest[i] = func( dest[i] );\n\n\t}\n", "file_path": "visual/gl/blend_function.cpp", "rank": 83, "score": 56.40357831512146 }, { "content": "\t}\n\n\telse\n\n\t{\n\n\t\topa = table[opa];\n\n\t\trule++;\n\n\t\ts1 = *src1;\n\n\t\tsrc1++;\n\n\t\ts2 = *src2;\n\n\t\tsrc2++;\n\n\t\ts1_ = s1 & 0xff00ff;\n\n\t\ts1_ = (s1_ + (((s2 & 0xff00ff) - s1_) * opa >> 8)) & 0xff00ff;\n\n\t\ts2 &= 0xff00;\n\n\t\ts1 &= 0xff00;\n\n\t\t*dest = s1_ | ((s1 + ((s2 - s1) * opa >> 8)) & 0xff00);\n\n\t\tdest++;\n\n\t}\n\n}\n\nEOF\n\n\n\n&loop_unroll_c($content, 'len', 4);\n", "file_path": "visual/glgen/gengl.pl", "rank": 84, "score": 56.209205775962985 }, { "content": "\tblend_func_avx2( dest, src, len, func );\n\n}\n\nstatic void TVPAlphaBlend_HDA_o_avx2_c( tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len, tjs_int opa ) {\n\n\tavx2_alpha_blend_hda_o_functor func(opa);\n\n\tblend_func_avx2( dest, src, len, func );\n\n}\n\nstatic void TVPAlphaBlend_d_avx2_c( tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len ) {\n\n\tcopy_src_branch_func_avx2<avx2_alpha_blend_d_functor>( dest, src, len );\n\n}\n\nstatic void TVPConstAlphaBlend_SD_avx2_c(tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, tjs_int len, tjs_int opa){\n\n\tavx2_const_alpha_blend_functor func(opa);\n\n\tsd_blend_func_avx2( dest, src1, src2, len, func );\n\n}\n\nstatic void TVPCopyColor_avx2_c(tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len) {\n\n\toverlap_copy_func_avx2<avx2_color_copy_functor>( dest, src, len );\n\n}\n\nstatic void TVPCopyMask_avx2_c(tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len) {\n\n\toverlap_copy_func_avx2<avx2_alpha_copy_functor>( dest, src, len );\n\n}\n\nstatic void TVPCopyOpaqueImage_avx2_c(tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len) {\n", "file_path": "visual/gl/blend_function_avx2.cpp", "rank": 86, "score": 55.60839479735302 }, { "content": "\treturn TVPUnivTransBlend_a(dest, src1, src2, rule, table, len);\n\n}\n\nstatic void __stdcall TVP_Stub_4c032260ef83d44bfe05fdc16843a8f9(tjs_uint32 * dest , const tjs_uint32 * src1 , const tjs_uint32 * src2 , const tjs_uint8 * rule , const tjs_uint32 * table , tjs_int len , tjs_int src1lv , tjs_int src2lv)\n\n{\n\n\treturn TVPUnivTransBlend_switch_a(dest, src1, src2, rule, table, len, src1lv, src2lv);\n\n}\n\nstatic void __stdcall TVP_Stub_96fd614457f06499a430b0c6e0e8a941(tjs_uint32 * dest , const tjs_uint8 * src , tjs_int len , tjs_uint32 color)\n\n{\n\n\treturn TVPApplyColorMap(dest, src, len, color);\n\n}\n\nstatic void __stdcall TVP_Stub_d6e36d304ff7253088ab4bc1aaf13a98(tjs_uint32 * dest , const tjs_uint8 * src , tjs_int len , tjs_uint32 color , tjs_int opa)\n\n{\n\n\treturn TVPApplyColorMap_o(dest, src, len, color, opa);\n\n}\n\nstatic void __stdcall TVP_Stub_eddacf49735189e23d9d49831851ffdb(tjs_uint32 * dest , const tjs_uint8 * src , tjs_int len , tjs_uint32 color)\n\n{\n\n\treturn TVPApplyColorMap65(dest, src, len, color);\n\n}\n\nstatic void __stdcall TVP_Stub_20275a5de4aef464b85d3f6db2800063(tjs_uint32 * dest , const tjs_uint8 * src , tjs_int len , tjs_uint32 color , tjs_int opa)\n\n{\n", "file_path": "base/win32/FuncStubs.cpp", "rank": 87, "score": 55.04463165939895 }, { "content": "\t\t\t{\n\n\t\t\t\tTVPUnivTransBlend((tjs_uint32*)dest, (const tjs_uint32*)src1,\n\n\t\t\t\t\t(const tjs_uint32*)src2, rule, BlendTable, data->Width);\n\n\t\t\t\tdest += destpitch, src1 += src1pitch, src2 += src2pitch;\n\n\t\t\t\trule += rulepitch;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\telse\n\n\t{\n\n\t\ttjs_int src1lv = Phase;\n\n\t\ttjs_int src2lv = Phase - Vague;\n\n\n\n\t\tif(TVPIsTypeUsingAlpha(DestLayerType))\n\n\t\t{\n\n\t\t\twhile(h--)\n\n\t\t\t{\n\n\t\t\t\tTVPUnivTransBlend_switch_d((tjs_uint32*)dest, (const tjs_uint32*)src1,\n\n\t\t\t\t\t(const tjs_uint32*)src2, rule, BlendTable, data->Width,\n\n\t\t\t\t\t\tsrc1lv, src2lv);\n", "file_path": "visual/TransIntf.cpp", "rank": 88, "score": 54.74032897313039 }, { "content": "print FC <<EOF;\n\n}\n\n\n\nEOF\n\n\n\n;#-----------------------------------------------------------------\n\n\n\n\n\nprint FC <<EOF;\n\n/*export*/\n\nTVP_GL_FUNC_DECL(void, TVPUnivTransBlend_switch_a_c, (tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, const tjs_uint8 *rule, const tjs_uint32 *table, tjs_int len, tjs_int src1lv, tjs_int src2lv))\n\n{\n\n\ttjs_int opa;\n\nEOF\n\n\n\n$content = <<EOF;\n\n\topa = rule[{ofs}];\n\n\tif(opa >= src1lv)\n\n\t\tdest[{ofs}] = src1[{ofs}];\n\n\telse if(opa < src2lv)\n", "file_path": "visual/glgen/gengl.pl", "rank": 91, "score": 54.081887553668295 }, { "content": "\t\tdest+=4;\n\n\t}\n\n\tlimit += (len-rem);\n\n\twhile( dest < limit ) {\n\n\t\t*dest = func( *dest );\n\n\t\tdest++;\n\n\t}\n\n}\n\ntemplate<typename functor>\n\nstatic inline void blend_func_sse2( tjs_uint32 * __restrict dest, const tjs_uint32 * __restrict src, tjs_int len, const functor& func ) {\n\n\tif( len <= 0 ) return;\n\n\n\n\ttjs_int count = (tjs_int)((unsigned)dest & 0xF);\n\n\tif( count ) {\n\n\t\tcount = (16 - count)>>2;\n\n\t\tcount = count > len ? len : count;\n\n\t\ttjs_uint32* limit = dest + count;\n\n\t\twhile( dest < limit ) {\n\n\t\t\t*dest = func( *dest, *src );\n\n\t\t\tdest++; src++;\n", "file_path": "visual/gl/blend_function_sse2.cpp", "rank": 92, "score": 53.51131812356175 }, { "content": "template<typename functor>\n\nstatic inline void convert_func_sse2( tjs_uint32 *dest, tjs_int len, const functor& func ) {\n\n\tif( len <= 0 ) return;\n\n\n\n\ttjs_int count = (tjs_int)((unsigned)dest & 0xF);\n\n\tif( count ) {\n\n\t\tcount = (16 - count)>>2;\n\n\t\tcount = count > len ? len : count;\n\n\t\ttjs_uint32* limit = dest + count;\n\n\t\twhile( dest < limit ) {\n\n\t\t\t*dest = func( *dest );\n\n\t\t\tdest++;\n\n\t\t}\n\n\t\tlen -= count;\n\n\t}\n\n\ttjs_uint32 rem = (len>>2)<<2;\n\n\ttjs_uint32* limit = dest + rem;\n\n\twhile( dest < limit ) {\n\n\t\t__m128i md = _mm_load_si128( (__m128i const*)dest );\n\n\t\t_mm_store_si128( (__m128i*)dest, func( md ) );\n", "file_path": "visual/gl/blend_function_sse2.cpp", "rank": 93, "score": 53.106360776769655 }, { "content": "\n\n\n\n\n\n\n\n\n\n;#-----------------------------------------------------------------\n\n;# constant ratio alpha blending ( separated destination )\n\n;#-----------------------------------------------------------------\n\n\n\n\n\nprint FC <<EOF;\n\n/*export*/\n\nTVP_GL_FUNC_DECL(void, TVPConstAlphaBlend_SD_c, (tjs_uint32 *dest, const tjs_uint32 *src1, const tjs_uint32 *src2, tjs_int len, tjs_int opa))\n\n{\n\n\ttjs_uint32 s1_, s1, s2;\n\nEOF\n\n\n\n\n\n$content = <<EOF;\n\n{\n", "file_path": "visual/glgen/gengl.pl", "rank": 94, "score": 52.32063185698267 }, { "content": "\t\tss1 = _mm_packus_epi16( ss1, ss2 );\n\n\n\n\t\tms1 = _mm_packus_epi16( ms1, ms2 );\n\n\t\tms1 = _mm_sub_epi8( ms1, ss1 );\t\t// 符号なし16bit飽和packのための処理\n\n\t\tms1 = _mm_and_si128( ms1, colormask_ );\n\n\t\treturn _mm_or_si128( ms1, ma );\n\n\t}\n\n};\n\n\n\n\n\n\n\ntemplate<typename functor>\n\nstatic inline void convert_func_sse2( tjs_uint32 *dest, tjs_int len ) {\n\n\tif( len <= 0 ) return;\n\n\n\n\tfunctor func;\n\n\ttjs_int count = (tjs_int)((unsigned)dest & 0xF);\n\n\tif( count ) {\n\n\t\tcount = (16 - count)>>2;\n\n\t\tcount = count > len ? len : count;\n", "file_path": "visual/gl/blend_function_sse2.cpp", "rank": 95, "score": 51.92645533243677 }, { "content": "//--------------------------------------------------------------------\n\n// ブレンドなど何も行わない場合は、Cバージョンの方が少しだけ速い\n\n// 色々と試してみたが以下の実装がその中では一番速かった\n\ntemplate<typename functor>\n\nstatic inline void stretch_blend_func_sse2(tjs_uint32 *dest, tjs_int len, const tjs_uint32 *src, tjs_int srcstart, tjs_int srcstep, const functor &func ) {\n\n\tif( len <= 0 ) return;\n\n\n\n\ttjs_int count = (tjs_int)((unsigned)dest & 0xF);\n\n\tif( count ) {\n\n\t\tcount = (16 - count)>>2;\n\n\t\tcount = count > len ? len : count;\n\n\t\ttjs_uint32* limit = dest + count;\n\n\t\twhile( dest < limit ) {\n\n\t\t\t*dest = func( *dest, src[srcstart >> 16] );\n\n\t\t\tsrcstart += srcstep;\n\n\t\t\tdest++;\n\n\t\t}\n\n\t\tlen -= count;\n\n\t}\n\n\t//tjs_uint32 rem = (len>>2)<<2;\n", "file_path": "visual/gl/blend_function_sse2.cpp", "rank": 96, "score": 51.897344603240434 }, { "content": "template<typename functor>\n\nstatic inline void apply_color_map_func_sse2( tjs_uint32 *dest, const tjs_uint8 *src, tjs_int len, const functor& func ) {\n\n\tif( len <= 0 ) return;\n\n\n\n\ttjs_int count = (tjs_int)((unsigned)dest & 0xF);\n\n\tif( count ) {\n\n\t\tcount = (16 - count)>>2;\n\n\t\tcount = count > len ? len : count;\n\n\t\ttjs_uint32* limit = dest + count;\n\n\t\twhile( dest < limit ) {\n\n\t\t\t*dest = func( *dest, *src );\n\n\t\t\tdest++; src++;\n\n\t\t}\n\n\t\tlen -= count;\n\n\t}\n\n\ttjs_uint32 rem = (len>>2)<<2;\n\n\ttjs_uint32* limit = dest + rem;\n\n\twhile( dest < limit ) {\n\n\t\ttjs_uint32 s = *(const tjs_uint32*)src;\n\n\t\t__m128i md = _mm_load_si128( (__m128i const*)dest );\n", "file_path": "visual/gl/colormap_sse2.cpp", "rank": 97, "score": 51.72616641971818 }, { "content": "\tcopy_func_avx2<avx2_color_opaque_functor>( dest, src, len );\n\n}\n\n\n\nstatic void TVPConstAlphaBlend_avx2_c(tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len, tjs_int opa) {\n\n\tavx2_const_alpha_blend_functor func(opa);\n\n\tblend_func_avx2( dest, src, len, func );\n\n}\n\nstatic void TVPConstAlphaBlend_HDA_avx2_c(tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len, tjs_int opa) {\n\n\tavx2_const_alpha_blend_hda_functor func(opa);\n\n\tblend_func_avx2( dest, src, len, func );\n\n}\n\nstatic void TVPConstAlphaBlend_d_avx2_c(tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len, tjs_int opa) {\n\n\tavx2_const_alpha_blend_d_functor func(opa);\n\n\tblend_func_avx2( dest, src, len, func );\n\n}\n\nstatic void TVPConstAlphaBlend_a_avx2_c(tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len, tjs_int opa) {\n\n\tavx2_const_alpha_blend_a_functor func(opa);\n\n\tblend_func_avx2( dest, src, len, func );\n\n}\n\n\n", "file_path": "visual/gl/blend_function_avx2.cpp", "rank": 98, "score": 51.34356292176402 }, { "content": "\toverlap_copy_func_sse2<sse2_alpha_copy_functor>( dest, src, len );\n\n}\n\nstatic void TVPCopyOpaqueImage_sse2_c(tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len) {\n\n\tcopy_func_sse2<sse2_color_opaque_functor>( dest, src, len );\n\n}\n\nstatic void TVPConstAlphaBlend_sse2_c(tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len, tjs_int opa) {\n\n\tsse2_const_alpha_blend_functor func(opa);\n\n\tblend_func_sse2( dest, src, len, func );\n\n}\n\nstatic void TVPConstAlphaBlend_HDA_sse2_c(tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len, tjs_int opa) {\n\n\tsse2_const_alpha_blend_hda_functor func(opa);\n\n\tblend_func_sse2( dest, src, len, func );\n\n}\n\nstatic void TVPConstAlphaBlend_d_sse2_c(tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len, tjs_int opa) {\n\n\tsse2_const_alpha_blend_d_functor func(opa);\n\n\tblend_func_sse2( dest, src, len, func );\n\n}\n\nstatic void TVPConstAlphaBlend_a_sse2_c(tjs_uint32 *dest, const tjs_uint32 *src, tjs_int len, tjs_int opa) {\n\n\tsse2_const_alpha_blend_a_functor func(opa);\n\n\tblend_func_sse2( dest, src, len, func );\n", "file_path": "visual/gl/blend_function_sse2.cpp", "rank": 99, "score": 51.086109366400635 } ]
C++
framework/data/cfg_loader.inl
ans-hub/gdm_framework
4218bb658d542df2c0568c4d3aac813cd1f18e1b
#include "cfg_loader.h" template<> inline int gdm::Config::Get<int>(const std::string& name) const { return ints_.at(name); } template<> inline float gdm::Config::Get<float>(const std::string& name) const { return floats_.at(name); } template<> inline bool gdm::Config::Get<bool>(const std::string& name) const { return bools_.at(name); } template<> inline const std::string& gdm::Config::Get<const std::string&>(const std::string& name) const { static std::string s_dummy {""}; return strings_.count(name) ? strings_.at(name) : s_dummy; } template<> inline std::string gdm::Config::Get<std::string>(const std::string& name) const { return strings_.count(name) ? strings_.at(name) : ""; } template<> inline gdm::Vec3f gdm::Config::Get<gdm::Vec3f>(const std::string& name) const { return vectors3f_.at(name); } template<> inline gdm::Vec4f gdm::Config::Get<gdm::Vec4f>(const std::string& name) const { return vectors4f_.at(name); } template<> inline std::vector<float> gdm::Config::Get<std::vector<float>>(const std::string& name) const { return vectorsf_.at(name); } template<> inline std::vector<std::string> gdm::Config::GetAllVals<std::string>(const std::string& name) const { std::vector<std::string> result {}; std::for_each(strings_.begin(), strings_.end(), [&name, &result](const std::pair<std::string, std::string>& pair) { if (pair.first.find(name) == 0) result.push_back(pair.second); }); return result; } template<> inline std::vector<float> gdm::Config::GetAllVals<float>(const std::string& name) const { std::vector<float> result {}; std::for_each(floats_.begin(), floats_.end(), [&name, &result](const std::pair<std::string, float>& pair) { if (pair.first.find(name) == 0) result.push_back(pair.second); }); return result; } template<> inline std::vector<gdm::Vec3f> gdm::Config::GetAllVals<gdm::Vec3f>(const std::string& name) const { std::vector<Vec3f> result {}; std::for_each(vectors3f_.begin(), vectors3f_.end(), [&name, &result](const std::pair<std::string, Vec3f>& pair) { if (pair.first.find(name) == 0) result.push_back(pair.second); }); return result; } template<> inline std::vector<gdm::Vec4f> gdm::Config::GetAllVals<gdm::Vec4f>(const std::string& name) const { std::vector<Vec4f> result {}; std::for_each(vectors4f_.begin(), vectors4f_.end(), [&name, &result](const std::pair<std::string, Vec4f>& pair) { if (pair.first.find(name) == 0) result.push_back(pair.second); }); return result; } template<> inline std::vector<std::string> gdm::Config::GetAllKeys<std::string>(const std::string& name) const { std::vector<std::string> result {}; std::for_each(strings_.begin(), strings_.end(), [&name, &result](const std::pair<std::string, std::string>& pair) { if (pair.first.find(name) == 0) result.push_back(pair.first); }); return result; } template<> inline std::vector<std::string> gdm::Config::GetAllKeys<gdm::Vec3f>(const std::string& name) const { std::vector<std::string> result {}; std::for_each(vectors3f_.begin(), vectors3f_.end(), [&name, &result](const std::pair<std::string, gdm::Vec3f>& pair) { if (pair.first.find(name) == 0) result.push_back(pair.first); }); return result; } template<> inline std::vector<std::string> gdm::Config::GetAllKeys<gdm::Vec4f>(const std::string& name) const { std::vector<std::string> result {}; std::for_each(vectors4f_.begin(), vectors4f_.end(), [&name, &result](const std::pair<std::string, gdm::Vec4f>& pair) { if (pair.first.find(name) == 0) result.push_back(pair.first); }); return result; } template<> inline bool gdm::Config::Has<int>(const std::string& name) const { return ints_.count(name); } template<> inline bool gdm::Config::Has<float>(const std::string& name) const { return floats_.count(name); } template<> inline bool gdm::Config::Has<bool>(const std::string& name) const { return bools_.count(name); } template<> inline bool gdm::Config::Has<std::string>(const std::string& name) const { return strings_.count(name); } template<> inline bool gdm::Config::Has<gdm::Vec3f>(const std::string& name) const { return vectors3f_.count(name); } template<> inline bool gdm::Config::Has<gdm::Vec4f>(const std::string& name) const { return vectors4f_.count(name); } template<> inline bool gdm::Config::Has<std::vector<float>>(const std::string& name) const { return vectorsf_.count(name); }
#include "cfg_loader.h" template<> inline int gdm::Config::Get<int>(const std::string& name) const { return ints_.at(name); } template<> inline float gdm::Config::Get<float>(const std::string& name) const { return floats_.at(name); } template<> inline bool gdm::Config::Get<bool>(const std::string& name) const { return bools_.at(name); } template<> inline const std::string& gdm::Config::Get<const std::string&>(const std::string& name) const { static std::string s_dummy {""}; return strings_.count(name) ? strings_.at(name) : s_dummy; } template<> inline std::string gdm::Config::Get<std::string>(const std::string& name) const { return strings_.count(name) ? strings_.at(name) : ""; } template<> inline gdm::Vec3f gdm::Config::Get<gdm::Vec3f>(const std::string& name) const { return vectors3f_.at(name); } template<> inline gdm::Vec4f gdm::Config::Get<gdm::Vec4f>(const std::string& name) const { return vectors4f_.at(name); } template<> inline std::vector<float> gdm::Config::Get<std::vector<float>>(const std::string& name) const { return vectorsf_.at(name); } template<> inline std::vector<std::string> gdm::Config::GetAllVals<std::string>(const std::string& name) const { std::vector<std::string> result {}; std::for_each(strings_.begin(), strings_.end(), [&name, &result](const std::pair<std::string, std::string>& pair) { if (pair.first.find(name) == 0) result.push_back(pair.second); }); return result; } template<>
template<> inline std::vector<gdm::Vec3f> gdm::Config::GetAllVals<gdm::Vec3f>(const std::string& name) const { std::vector<Vec3f> result {}; std::for_each(vectors3f_.begin(), vectors3f_.end(), [&name, &result](const std::pair<std::string, Vec3f>& pair) { if (pair.first.find(name) == 0) result.push_back(pair.second); }); return result; } template<> inline std::vector<gdm::Vec4f> gdm::Config::GetAllVals<gdm::Vec4f>(const std::string& name) const { std::vector<Vec4f> result {}; std::for_each(vectors4f_.begin(), vectors4f_.end(), [&name, &result](const std::pair<std::string, Vec4f>& pair) { if (pair.first.find(name) == 0) result.push_back(pair.second); }); return result; } template<> inline std::vector<std::string> gdm::Config::GetAllKeys<std::string>(const std::string& name) const { std::vector<std::string> result {}; std::for_each(strings_.begin(), strings_.end(), [&name, &result](const std::pair<std::string, std::string>& pair) { if (pair.first.find(name) == 0) result.push_back(pair.first); }); return result; } template<> inline std::vector<std::string> gdm::Config::GetAllKeys<gdm::Vec3f>(const std::string& name) const { std::vector<std::string> result {}; std::for_each(vectors3f_.begin(), vectors3f_.end(), [&name, &result](const std::pair<std::string, gdm::Vec3f>& pair) { if (pair.first.find(name) == 0) result.push_back(pair.first); }); return result; } template<> inline std::vector<std::string> gdm::Config::GetAllKeys<gdm::Vec4f>(const std::string& name) const { std::vector<std::string> result {}; std::for_each(vectors4f_.begin(), vectors4f_.end(), [&name, &result](const std::pair<std::string, gdm::Vec4f>& pair) { if (pair.first.find(name) == 0) result.push_back(pair.first); }); return result; } template<> inline bool gdm::Config::Has<int>(const std::string& name) const { return ints_.count(name); } template<> inline bool gdm::Config::Has<float>(const std::string& name) const { return floats_.count(name); } template<> inline bool gdm::Config::Has<bool>(const std::string& name) const { return bools_.count(name); } template<> inline bool gdm::Config::Has<std::string>(const std::string& name) const { return strings_.count(name); } template<> inline bool gdm::Config::Has<gdm::Vec3f>(const std::string& name) const { return vectors3f_.count(name); } template<> inline bool gdm::Config::Has<gdm::Vec4f>(const std::string& name) const { return vectors4f_.count(name); } template<> inline bool gdm::Config::Has<std::vector<float>>(const std::string& name) const { return vectorsf_.count(name); }
inline std::vector<float> gdm::Config::GetAllVals<float>(const std::string& name) const { std::vector<float> result {}; std::for_each(floats_.begin(), floats_.end(), [&name, &result](const std::pair<std::string, float>& pair) { if (pair.first.find(name) == 0) result.push_back(pair.second); }); return result; }
function_block-full_function
[ { "content": "class TMap : public std::map<K, D, CMP, pool_allocator<std::pair<K const, D> > > {\n\n};\n\n\n\ntemplate <class K, class D, class HASH = std::hash<K>, class PRED = std::equal_to<K> >\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/glslang/Include/Common.h", "rank": 0, "score": 184367.25910232408 }, { "content": "class TMap : public std::map<K, D, CMP, pool_allocator<std::pair<K const, D> > > {\n\n};\n\n\n\ntemplate <class K, class D, class HASH = std::hash<K>, class PRED = std::equal_to<K> >\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/glslang/Include/Common.h", "rank": 1, "score": 184367.25910232408 }, { "content": "class TUnorderedMap : public std::unordered_map<K, D, HASH, PRED, pool_allocator<std::pair<K const, D> > > {\n\n};\n\n\n\n//\n\n// Persistent string memory. Should only be used for strings that survive\n\n// across compiles/links.\n\n//\n\ntypedef std::basic_string<char> TPersistString;\n\n\n\n//\n\n// templatized min and max functions.\n\n//\n\ntemplate <class T> T Min(const T a, const T b) { return a < b ? a : b; }\n\ntemplate <class T> T Max(const T a, const T b) { return a > b ? a : b; }\n\n\n\n//\n\n// Create a TString object from an integer.\n\n//\n\n#if defined _MSC_VER || defined MINGW_HAS_SECURE_API\n\ninline const TString String(const int i, const int base = 10)\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/glslang/Include/Common.h", "rank": 2, "score": 176539.07063145802 }, { "content": "class TUnorderedMap : public std::unordered_map<K, D, HASH, PRED, pool_allocator<std::pair<K const, D> > > {\n\n};\n\n\n\n//\n\n// Persistent string memory. Should only be used for strings that survive\n\n// across compiles/links.\n\n//\n\ntypedef std::basic_string<char> TPersistString;\n\n\n\n//\n\n// templatized min and max functions.\n\n//\n\ntemplate <class T> T Min(const T a, const T b) { return a < b ? a : b; }\n\ntemplate <class T> T Max(const T a, const T b) { return a > b ? a : b; }\n\n\n\n//\n\n// Create a TString object from an integer.\n\n//\n\n#if defined _MSC_VER || defined MINGW_HAS_SECURE_API\n\ninline const TString String(const int i, const int base = 10)\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/glslang/Include/Common.h", "rank": 3, "score": 176539.07063145802 }, { "content": " FT_String* name;\n", "file_path": "3rdparty/freetype/2.10.04/include/freetype/ftmm.h", "rank": 4, "score": 169270.0517533577 }, { "content": "\tconst char *name;\t\t\t\t// description\n", "file_path": "3rdparty/bass/win/include/bass.h", "rank": 5, "score": 169270.0517533577 }, { "content": " LPCWSTR Name;\n", "file_path": "3rdparty/dxc/include/dxc/dxcapi.h", "rank": 6, "score": 169270.0517533577 }, { "content": "\tconst char *name;\t\t\t\t// description\n", "file_path": "3rdparty/bass/linux/include/bass.h", "rank": 7, "score": 169270.0517533577 }, { "content": " char name[VK_MAX_EXTENSION_NAME_SIZE];\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan_core.h", "rank": 8, "score": 164901.20016907583 }, { "content": " LPCWSTR name;\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan_win32.h", "rank": 9, "score": 164901.20016907583 }, { "content": " char name[VK_MAX_EXTENSION_NAME_SIZE];\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan_core.h", "rank": 10, "score": 164901.20016907583 }, { "content": " LPCWSTR name;\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan_win32.h", "rank": 11, "score": 164901.20016907583 }, { "content": "struct DxilInst_QuadOp {\n\n llvm::Instruction *Instr;\n\n // Construction and identification\n\n DxilInst_QuadOp(llvm::Instruction *pInstr) : Instr(pInstr) {}\n\n operator bool() const {\n\n return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::QuadOp);\n\n }\n\n // Validation support\n", "file_path": "3rdparty/dxc/include/dxc/DXIL/DxilInstructions.h", "rank": 12, "score": 164809.36647151338 }, { "content": "#include <string>\n\n#include <memory>\n\n#include <set>\n\n#include <algorithm>\n\n\n\n#if !defined(CATCH_PLATFORM_WINDOWS) && ( defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) )\n\n#define CATCH_PLATFORM_WINDOWS\n\n#endif\n\n\n\nnamespace Catch { namespace clara {\n\nnamespace detail {\n\n\n\n // Traits for extracting arg and return type of lambdas (for single argument lambdas)\n\n template<typename L>\n\n struct UnaryLambdaTraits : UnaryLambdaTraits<decltype( &L::operator() )> {};\n\n\n\n template<typename ClassT, typename ReturnT, typename... Args>\n\n struct UnaryLambdaTraits<ReturnT( ClassT::* )( Args... ) const> {\n\n static const bool isValid = false;\n\n };\n\n\n\n template<typename ClassT, typename ReturnT, typename ArgT>\n\n struct UnaryLambdaTraits<ReturnT( ClassT::* )( ArgT ) const> {\n\n static const bool isValid = true;\n\n using ArgType = typename std::remove_const<typename std::remove_reference<ArgT>::type>::type;\n\n using ReturnType = ReturnT;\n\n };\n\n\n", "file_path": "3rdparty/catch/catch.hpp", "rank": 13, "score": 40.428393413454366 }, { "content": "// Timing\n\n\n\n\n\n#include <tuple>\n\n#include <type_traits>\n\n\n\nnamespace Catch {\n\n namespace Benchmark {\n\n template <typename Duration, typename Result>\n\n struct Timing {\n\n Duration elapsed;\n\n Result result;\n\n int iterations;\n\n };\n\n template <typename Clock, typename Func, typename... Args>\n\n using TimingOf = Timing<ClockDuration<Clock>, Detail::CompleteType_t<FunctionReturnType<Func, Args...>>>;\n\n } // namespace Benchmark\n\n} // namespace Catch\n\n\n\n// end catch_timing.hpp\n", "file_path": "3rdparty/catch/catch.hpp", "rank": 14, "score": 37.76487062637085 }, { "content": "\t//};\n\n\t\n\n\t//template <>\n\n\t//struct traits<float>\n\n\t//{\n\n\t//\tstatic const bool is_float = true;\n\n\t//\tstatic const bool is_genType = true;\n\n\t//};\n\n\t\n\n\t//template <>\n\n\t//struct traits<double>\n\n\t//{\n\n\t//\tstatic const bool is_float = true;\n\n\t//\tstatic const bool is_genType = true;\n\n\t//};\n\n\t\n\n\t//template <typename genType>\n\n\t//struct desc\n\n\t//{\n\n\t//\ttypedef genType\t\t\t\t\t\t\ttype;\n", "file_path": "3rdparty/microprofile/demo/vulkan/glm/detail/type_gentype.hpp", "rank": 15, "score": 36.920692594083775 }, { "content": "\n\n template<typename ReturnType>\n\n struct LambdaInvoker {\n\n static_assert( std::is_same<ReturnType, ParserResult>::value, \"Lambda must return void or clara::ParserResult\" );\n\n\n\n template<typename L, typename ArgType>\n\n static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult {\n\n return lambda( arg );\n\n }\n\n };\n\n\n\n template<>\n\n struct LambdaInvoker<void> {\n\n template<typename L, typename ArgType>\n\n static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult {\n\n lambda( arg );\n\n return ParserResult::ok( ParseResultType::Matched );\n\n }\n\n };\n\n\n", "file_path": "3rdparty/catch/catch.hpp", "rank": 16, "score": 35.52611656536395 }, { "content": " struct StringMaker<float> {\n\n static std::string convert(float value);\n\n static int precision;\n\n };\n\n\n\n template<>\n\n struct StringMaker<double> {\n\n static std::string convert(double value);\n\n static int precision;\n\n };\n\n\n\n template <typename T>\n\n struct StringMaker<T*> {\n\n template <typename U>\n\n static std::string convert(U* p) {\n\n if (p) {\n\n return ::Catch::Detail::rawMemoryToString(p);\n\n } else {\n\n return \"nullptr\";\n\n }\n", "file_path": "3rdparty/catch/catch.hpp", "rank": 17, "score": 34.89884443958414 }, { "content": "#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<int>::type Device::getFenceFdKHR( const FenceGetFdInfoKHR & getFdInfo, Dispatch const &d ) const\n\n {\n\n int fd;\n\n Result result = static_cast<Result>( d.vkGetFenceFdKHR( m_device, reinterpret_cast<const VkFenceGetFdInfoKHR*>( &getFdInfo ), &fd ) );\n\n return createResultValue( result, fd, VULKAN_HPP_NAMESPACE_STRING\"::Device::getFenceFdKHR\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::getFenceStatus( VULKAN_HPP_NAMESPACE::Fence fence, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkGetFenceStatus( m_device, static_cast<VkFence>( fence ) ) );\n\n }\n\n#else\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::getFenceStatus( VULKAN_HPP_NAMESPACE::Fence fence, Dispatch const &d ) const\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 18, "score": 34.88187228182037 }, { "content": "\t};\n\n*/\n\n\t\n\n\t//template <typename T>\n\n\t//struct traits\n\n\t//{\n\n\t//\tstatic const bool is_signed = false;\n\n\t//\tstatic const bool is_float = false;\n\n\t//\tstatic const bool is_vector = false;\n\n\t//\tstatic const bool is_matrix = false;\n\n\t//\tstatic const bool is_genType = false;\n\n\t//\tstatic const bool is_genIType = false;\n\n\t//\tstatic const bool is_genUType = false;\n\n\t//};\n\n\t\n\n\t//template <>\n\n\t//struct traits<half>\n\n\t//{\n\n\t//\tstatic const bool is_float = true;\n\n\t//\tstatic const bool is_genType = true;\n", "file_path": "3rdparty/microprofile/demo/vulkan/glm/detail/type_gentype.hpp", "rank": 19, "score": 34.868150141761895 }, { "content": "\n\n template <typename> struct true_given : std::true_type {};\n\n struct is_callable_tester {\n\n template <typename Fun, typename... Args>\n\n true_given<decltype(std::declval<Fun>()(std::declval<Args>()...))> static test(int);\n\n template <typename...>\n\n std::false_type static test(...);\n\n };\n\n\n\n template <typename T>\n\n struct is_callable;\n\n\n\n template <typename Fun, typename... Args>\n\n struct is_callable<Fun(Args...)> : decltype(is_callable_tester::test<Fun, Args...>(0)) {};\n\n\n\n#if defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703\n\n // std::result_of is deprecated in C++17 and removed in C++20. Hence, it is\n\n // replaced with std::invoke_result here.\n\n template <typename Func, typename... U>\n\n using FunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::invoke_result_t<Func, U...>>>;\n", "file_path": "3rdparty/catch/catch.hpp", "rank": 20, "score": 34.64690660722071 }, { "content": "\t///\n\n\t/// @see gtc_quaternion\n\n\ttemplate <typename T, precision P>\n\n\tGLM_FUNC_DECL detail::tvec4<bool, P> greaterThan(\n\n\t\tdetail::tquat<T, P> const & x, \n\n\t\tdetail::tquat<T, P> const & y);\n\n\n\n\t/// Returns the component-wise comparison of result x >= y.\n\n\t///\n\n\t/// @tparam quatType Floating-point quaternion types.\n\n\t///\n\n\t/// @see gtc_quaternion\n\n\ttemplate <typename T, precision P>\n\n\tGLM_FUNC_DECL detail::tvec4<bool, P> greaterThanEqual(\n\n\t\tdetail::tquat<T, P> const & x, \n\n\t\tdetail::tquat<T, P> const & y);\n\n\n\n\t/// Returns the component-wise comparison of result x == y.\n\n\t///\n\n\t/// @tparam quatType Floating-point quaternion types.\n", "file_path": "3rdparty/microprofile/demo/vulkan/glm/gtc/quaternion.hpp", "rank": 21, "score": 34.45919609409987 }, { "content": "\t///\n\n\t/// @see gtc_quaternion\n\n\ttemplate <typename T, precision P>\n\n\tGLM_FUNC_DECL detail::tvec4<bool, P> lessThan(\n\n\t\tdetail::tquat<T, P> const & x, \n\n\t\tdetail::tquat<T, P> const & y);\n\n\n\n\t/// Returns the component-wise comparison of result x <= y.\n\n\t///\n\n\t/// @tparam quatType Floating-point quaternion types.\n\n\t///\n\n\t/// @see gtc_quaternion\n\n\ttemplate <typename T, precision P>\n\n\tGLM_FUNC_DECL detail::tvec4<bool, P> lessThanEqual(\n\n\t\tdetail::tquat<T, P> const & x, \n\n\t\tdetail::tquat<T, P> const & y);\n\n\n\n\t/// Returns the component-wise comparison of result x > y.\n\n\t///\n\n\t/// @tparam quatType Floating-point quaternion types.\n", "file_path": "3rdparty/microprofile/demo/vulkan/glm/gtc/quaternion.hpp", "rank": 22, "score": 34.45919609409987 }, { "content": "\t///\n\n\t/// @see gtc_quaternion\n\n\ttemplate <typename T, precision P>\n\n\tGLM_FUNC_DECL detail::tvec4<bool, P> equal(\n\n\t\tdetail::tquat<T, P> const & x, \n\n\t\tdetail::tquat<T, P> const & y);\n\n\n\n\t/// Returns the component-wise comparison of result x != y.\n\n\t/// \n\n\t/// @tparam quatType Floating-point quaternion types.\n\n\t///\n\n\t/// @see gtc_quaternion\n\n\ttemplate <typename T, precision P>\n\n\tGLM_FUNC_DECL detail::tvec4<bool, P> notEqual(\n\n\t\tdetail::tquat<T, P> const & x, \n\n\t\tdetail::tquat<T, P> const & y);\n\n\n\n\t/// @}\n\n} //namespace glm\n\n\n\n#include \"quaternion.inl\"\n\n\n\n#endif//GLM_GTC_quaternion\n", "file_path": "3rdparty/microprofile/demo/vulkan/glm/gtc/quaternion.hpp", "rank": 23, "score": 34.26282412195645 }, { "content": "// code from https://wrf.ecse.rpi.edu//Research/Short_Notes/pnpoly.html\n\ntemplate <typename T>\n\nstatic inline int pnpoly(int nvert, T *vertx, T *verty, T testx, T testy) {\n\n int i, j, c = 0;\n\n for (i = 0, j = nvert - 1; i < nvert; j = i++) {\n\n if (((verty[i] > testy) != (verty[j] > testy)) &&\n\n (testx <\n\n (vertx[j] - vertx[i]) * (testy - verty[i]) / (verty[j] - verty[i]) +\n\n vertx[i]))\n\n c = !c;\n\n }\n\n return c;\n\n}\n\n\n\n// TODO(syoyo): refactor function.\n\nstatic inline bool exportGroupsToShape(shape_t *shape, const PrimGroup &prim_group,\n\n const std::vector<tag_t> &tags,\n\n const int material_id, const std::string &name,\n\n bool triangulate,\n\n const std::vector<real_t> &v) {\n", "file_path": "framework/data/obj_loader.h", "rank": 24, "score": 33.853644549110825 }, { "content": " template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::getEventStatus( VULKAN_HPP_NAMESPACE::Event event, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkGetEventStatus( m_device, static_cast<VkEvent>( event ) ) );\n\n }\n\n#else\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::getEventStatus( VULKAN_HPP_NAMESPACE::Event event, Dispatch const &d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkGetEventStatus( m_device, static_cast<VkEvent>( event ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING\"::Device::getEventStatus\", { Result::eEventSet, Result::eEventReset } );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::getFenceFdKHR( const VULKAN_HPP_NAMESPACE::FenceGetFdInfoKHR* pGetFdInfo, int* pFd, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkGetFenceFdKHR( m_device, reinterpret_cast<const VkFenceGetFdInfoKHR*>( pGetFdInfo ), pFd ) );\n\n }\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 25, "score": 33.62218954930739 }, { "content": "\n\n\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result CommandBuffer::end(Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkEndCommandBuffer( m_commandBuffer ) );\n\n }\n\n#else\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type CommandBuffer::end(Dispatch const &d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkEndCommandBuffer( m_commandBuffer ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING\"::CommandBuffer::end\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 26, "score": 32.95252696195056 }, { "content": "\n\n\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result Device::resetEvent( VULKAN_HPP_NAMESPACE::Event event, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkResetEvent( m_device, static_cast<VkEvent>( event ) ) );\n\n }\n\n#else\n\n template <typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::resetEvent( VULKAN_HPP_NAMESPACE::Event event, Dispatch const & d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkResetEvent( m_device, static_cast<VkEvent>( event ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING \"::Device::resetEvent\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n\n\n template <typename Dispatch>\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 27, "score": 32.9277631088013 }, { "content": " template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>\n\n operator std::string_view() const\n\n {\n\n return std::string_view( this->data() );\n\n }\n\n#endif\n\n\n\n template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>\n\n bool operator<( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return *static_cast<std::array<char, N> const *>( this ) < *static_cast<std::array<char, N> const *>( &rhs );\n\n }\n\n\n\n template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>\n\n bool operator<=( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return *static_cast<std::array<char, N> const *>( this ) <= *static_cast<std::array<char, N> const *>( &rhs );\n\n }\n\n\n\n template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 28, "score": 32.50258527865015 }, { "content": " template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>\n\n operator std::string_view() const\n\n {\n\n return std::string_view( this->data() );\n\n }\n\n#endif\n\n\n\n template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>\n\n bool operator<( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return *static_cast<std::array<char, N> const *>( this ) < *static_cast<std::array<char, N> const *>( &rhs );\n\n }\n\n\n\n template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>\n\n bool operator<=( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return *static_cast<std::array<char, N> const *>( this ) <= *static_cast<std::array<char, N> const *>( &rhs );\n\n }\n\n\n\n template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 29, "score": 32.50258527865015 }, { "content": " template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::getMemoryFdKHR( const VULKAN_HPP_NAMESPACE::MemoryGetFdInfoKHR* pGetFdInfo, int* pFd, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkGetMemoryFdKHR( m_device, reinterpret_cast<const VkMemoryGetFdInfoKHR*>( pGetFdInfo ), pFd ) );\n\n }\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<int>::type Device::getMemoryFdKHR( const MemoryGetFdInfoKHR & getFdInfo, Dispatch const &d ) const\n\n {\n\n int fd;\n\n Result result = static_cast<Result>( d.vkGetMemoryFdKHR( m_device, reinterpret_cast<const VkMemoryGetFdInfoKHR*>( &getFdInfo ), &fd ) );\n\n return createResultValue( result, fd, VULKAN_HPP_NAMESPACE_STRING\"::Device::getMemoryFdKHR\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::getMemoryFdPropertiesKHR( VULKAN_HPP_NAMESPACE::ExternalMemoryHandleTypeFlagBits handleType, int fd, VULKAN_HPP_NAMESPACE::MemoryFdPropertiesKHR* pMemoryFdProperties, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkGetMemoryFdPropertiesKHR( m_device, static_cast<VkExternalMemoryHandleTypeFlagBits>( handleType ), fd, reinterpret_cast<VkMemoryFdPropertiesKHR*>( pMemoryFdProperties ) ) );\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 30, "score": 32.44661112915478 }, { "content": " {\n\n uint64_t value;\n\n Result result = static_cast<Result>( d.vkGetSemaphoreCounterValueKHR( m_device, static_cast<VkSemaphore>( semaphore ), &value ) );\n\n return createResultValue( result, value, VULKAN_HPP_NAMESPACE_STRING \"::Device::getSemaphoreCounterValueKHR\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result Device::getSemaphoreFdKHR( const VULKAN_HPP_NAMESPACE::SemaphoreGetFdInfoKHR* pGetFdInfo, int* pFd, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkGetSemaphoreFdKHR( m_device, reinterpret_cast<const VkSemaphoreGetFdInfoKHR *>( pGetFdInfo ), pFd ) );\n\n }\n\n\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<int>::type Device::getSemaphoreFdKHR( const SemaphoreGetFdInfoKHR & getFdInfo, Dispatch const & d ) const\n\n {\n\n int fd;\n\n Result result = static_cast<Result>( d.vkGetSemaphoreFdKHR( m_device, reinterpret_cast<const VkSemaphoreGetFdInfoKHR *>( &getFdInfo ), &fd ) );\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 31, "score": 32.3723585565913 }, { "content": " {\n\n Result result = static_cast<Result>( d.vkGetEventStatus( m_device, static_cast<VkEvent>( event ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING \"::Device::getEventStatus\", { VULKAN_HPP_NAMESPACE::Result::eEventSet, VULKAN_HPP_NAMESPACE::Result::eEventReset } );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result Device::getFenceFdKHR( const VULKAN_HPP_NAMESPACE::FenceGetFdInfoKHR* pGetFdInfo, int* pFd, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkGetFenceFdKHR( m_device, reinterpret_cast<const VkFenceGetFdInfoKHR *>( pGetFdInfo ), pFd ) );\n\n }\n\n\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<int>::type Device::getFenceFdKHR( const FenceGetFdInfoKHR & getFdInfo, Dispatch const & d ) const\n\n {\n\n int fd;\n\n Result result = static_cast<Result>( d.vkGetFenceFdKHR( m_device, reinterpret_cast<const VkFenceGetFdInfoKHR *>( &getFdInfo ), &fd ) );\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 32, "score": 32.309699516192495 }, { "content": " }\n\n#else\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<void>::type CommandBuffer::end( Dispatch const & d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkEndCommandBuffer( m_commandBuffer ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING \"::CommandBuffer::end\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result CommandBuffer::reset( VULKAN_HPP_NAMESPACE::CommandBufferResetFlags flags, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkResetCommandBuffer( m_commandBuffer, static_cast<VkCommandBufferResetFlags>( flags ) ) );\n\n }\n\n#else\n\n template <typename Dispatch>\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 33, "score": 32.12811331926254 }, { "content": " uint64_t value;\n\n Result result = static_cast<Result>( d.vkGetSemaphoreCounterValueKHR( m_device, static_cast<VkSemaphore>( semaphore ), &value ) );\n\n return createResultValue( result, value, VULKAN_HPP_NAMESPACE_STRING\"::Device::getSemaphoreCounterValueKHR\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::getSemaphoreFdKHR( const VULKAN_HPP_NAMESPACE::SemaphoreGetFdInfoKHR* pGetFdInfo, int* pFd, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkGetSemaphoreFdKHR( m_device, reinterpret_cast<const VkSemaphoreGetFdInfoKHR*>( pGetFdInfo ), pFd ) );\n\n }\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<int>::type Device::getSemaphoreFdKHR( const SemaphoreGetFdInfoKHR & getFdInfo, Dispatch const &d ) const\n\n {\n\n int fd;\n\n Result result = static_cast<Result>( d.vkGetSemaphoreFdKHR( m_device, reinterpret_cast<const VkSemaphoreGetFdInfoKHR*>( &getFdInfo ), &fd ) );\n\n return createResultValue( result, fd, VULKAN_HPP_NAMESPACE_STRING\"::Device::getSemaphoreFdKHR\" );\n\n }\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 34, "score": 32.084753003723286 }, { "content": " bool operator>( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return *static_cast<std::array<char, N> const *>( this ) > *static_cast<std::array<char, N> const *>( &rhs );\n\n }\n\n\n\n template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>\n\n bool operator>=( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return *static_cast<std::array<char, N> const *>( this ) >= *static_cast<std::array<char, N> const *>( &rhs );\n\n }\n\n\n\n template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>\n\n bool operator==( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return *static_cast<std::array<char, N> const *>( this ) == *static_cast<std::array<char, N> const *>( &rhs );\n\n }\n\n\n\n template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>\n\n bool operator!=( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT\n\n {\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 35, "score": 31.929176397784524 }, { "content": " bool operator>( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return *static_cast<std::array<char, N> const *>( this ) > *static_cast<std::array<char, N> const *>( &rhs );\n\n }\n\n\n\n template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>\n\n bool operator>=( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return *static_cast<std::array<char, N> const *>( this ) >= *static_cast<std::array<char, N> const *>( &rhs );\n\n }\n\n\n\n template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>\n\n bool operator==( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return *static_cast<std::array<char, N> const *>( this ) == *static_cast<std::array<char, N> const *>( &rhs );\n\n }\n\n\n\n template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>\n\n bool operator!=( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT\n\n {\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 36, "score": 31.929176397784516 }, { "content": "\t/// otherwise, including for implementations with no infinity\n\n\t/// representations.\n\n\t/// \n\n\t/// @tparam genType Floating-point scalar or vector types.\n\n\t/// \n\n\t/// @see <a href=\"http://www.opengl.org/sdk/docs/manglsl/xhtml/isinf.xml\">GLSL isinf man page</a>\n\n\t/// @see <a href=\"http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf\">GLSL 4.20.8 specification, section 8.3 Common Functions</a>\n\n\ttemplate <typename genType> \n\n\tGLM_FUNC_DECL typename genType::bool_type isinf(genType const & x);\n\n\n\n\t/// Returns a signed integer value representing\n\n\t/// the encoding of a floating-point value. The floating-point\n\n\t/// value's bit-level representation is preserved.\n\n\t/// \n\n\t/// @see <a href=\"http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToInt.xml\">GLSL floatBitsToInt man page</a>\n\n\t/// @see <a href=\"http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf\">GLSL 4.20.8 specification, section 8.3 Common Functions</a>\n\n\tGLM_FUNC_DECL int floatBitsToInt(float const & v);\n\n\n\n\t/// Returns a signed integer value representing\n\n\t/// the encoding of a floating-point value. The floatingpoint\n", "file_path": "3rdparty/microprofile/demo/vulkan/glm/detail/func_common.hpp", "rank": 37, "score": 31.848674498936703 }, { "content": "\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result enumerateInstanceVersion( uint32_t* pApiVersion, Dispatch const &d) VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkEnumerateInstanceVersion( pApiVersion ) );\n\n }\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<uint32_t>::type enumerateInstanceVersion(Dispatch const &d )\n\n {\n\n uint32_t apiVersion;\n\n Result result = static_cast<Result>( d.vkEnumerateInstanceVersion( &apiVersion ) );\n\n return createResultValue( result, apiVersion, VULKAN_HPP_NAMESPACE_STRING\"::enumerateInstanceVersion\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result CommandBuffer::begin( const VULKAN_HPP_NAMESPACE::CommandBufferBeginInfo* pBeginInfo, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 38, "score": 31.688367003832745 }, { "content": "inline static bool v_register_type_B = Registrator::RegisterOps<float>(\"float\");\n\n\n\nTEST_CASE(\"Bind dynamic id to template\")\n\n{\n\n\tRegistrator r;\n\n\tauto* a = r.GetOps(gdm::TypeId<int>());\n\n\tauto* b = r.GetOps(gdm::TypeId<float>());\n\n\tCHECK(a->GetTypeId() == gdm::TypeId<int>());\n\n\tCHECK(b->GetTypeId() == gdm::TypeId<float>());\n\n}\n\n\n\n// Heterogen container\n\n\n\nTEST_CASE(\"Heterogen container\")\n\n{\n\n\n\n}\n\n\n\n} // namespace gdm::test\n", "file_path": "framework/system/ut/templates.cc", "rank": 39, "score": 31.536020538935624 }, { "content": " bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; }\n\n bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; }\n\n\n\n} // end namespace Catch\n\n// end catch_result_type.cpp\n\n// start catch_run_context.cpp\n\n\n\n#include <cassert>\n\n#include <algorithm>\n\n#include <sstream>\n\n\n\nnamespace Catch {\n\n\n\n namespace Generators {\n\n struct GeneratorTracker : TestCaseTracking::TrackerBase, IGeneratorTracker {\n\n GeneratorBasePtr m_generator;\n\n\n\n GeneratorTracker( TestCaseTracking::NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )\n\n : TrackerBase( nameAndLocation, ctx, parent )\n\n {}\n", "file_path": "3rdparty/catch/catch.hpp", "rank": 40, "score": 31.324700295476433 }, { "content": "#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<uint64_t>::type Device::getSemaphoreCounterValue( VULKAN_HPP_NAMESPACE::Semaphore semaphore, Dispatch const &d ) const\n\n {\n\n uint64_t value;\n\n Result result = static_cast<Result>( d.vkGetSemaphoreCounterValue( m_device, static_cast<VkSemaphore>( semaphore ), &value ) );\n\n return createResultValue( result, value, VULKAN_HPP_NAMESPACE_STRING\"::Device::getSemaphoreCounterValue\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::getSemaphoreCounterValueKHR( VULKAN_HPP_NAMESPACE::Semaphore semaphore, uint64_t* pValue, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkGetSemaphoreCounterValueKHR( m_device, static_cast<VkSemaphore>( semaphore ), pValue ) );\n\n }\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<uint64_t>::type Device::getSemaphoreCounterValueKHR( VULKAN_HPP_NAMESPACE::Semaphore semaphore, Dispatch const &d ) const\n\n {\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 41, "score": 31.22102670644572 }, { "content": "#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result Device::setEvent( VULKAN_HPP_NAMESPACE::Event event, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkSetEvent( m_device, static_cast<VkEvent>( event ) ) );\n\n }\n\n#else\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::setEvent( VULKAN_HPP_NAMESPACE::Event event, Dispatch const & d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkSetEvent( m_device, static_cast<VkEvent>( event ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING \"::Device::setEvent\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n\n\n template <typename Dispatch>\n\n VULKAN_HPP_INLINE void Device::setHdrMetadataEXT( uint32_t swapchainCount, const VULKAN_HPP_NAMESPACE::SwapchainKHR* pSwapchains, const VULKAN_HPP_NAMESPACE::HdrMetadataEXT* pMetadata, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n\n {\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 42, "score": 31.19290461275304 }, { "content": "#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::getSwapchainStatusKHR( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkGetSwapchainStatusKHR( m_device, static_cast<VkSwapchainKHR>( swapchain ) ) );\n\n }\n\n#else\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::getSwapchainStatusKHR( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, Dispatch const &d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkGetSwapchainStatusKHR( m_device, static_cast<VkSwapchainKHR>( swapchain ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING\"::Device::getSwapchainStatusKHR\", { Result::eSuccess, Result::eSuboptimalKHR } );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n template<typename Dispatch>\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 43, "score": 31.140878348723916 }, { "content": " uint64_t GetAllocSizeForType(llvm::Type *Ty);\n\n\n\n // LLVM helpers. Perhaps, move to a separate utility class.\n\n llvm::Constant *GetI1Const(bool v);\n\n llvm::Constant *GetI8Const(char v);\n\n llvm::Constant *GetU8Const(unsigned char v);\n\n llvm::Constant *GetI16Const(int v);\n\n llvm::Constant *GetU16Const(unsigned v);\n\n llvm::Constant *GetI32Const(int v);\n\n llvm::Constant *GetU32Const(unsigned v);\n\n llvm::Constant *GetU64Const(unsigned long long v);\n\n llvm::Constant *GetFloatConst(float v);\n\n llvm::Constant *GetDoubleConst(double v);\n\n\n\n static llvm::Type *GetOverloadType(OpCode OpCode, llvm::Function *F);\n\n static OpCode GetDxilOpFuncCallInst(const llvm::Instruction *I);\n\n static const char *GetOpCodeName(OpCode OpCode);\n\n static const char *GetAtomicOpName(DXIL::AtomicBinOpCode OpCode);\n\n static OpCodeClass GetOpCodeClass(OpCode OpCode);\n\n static const char *GetOpCodeClassName(OpCode OpCode);\n", "file_path": "3rdparty/dxc/include/dxc/DXIL/DxilOperations.h", "rank": 44, "score": 31.100614885265493 }, { "content": " auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); }\n\n template<typename T>\n\n auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; }\n\n template<typename T>\n\n auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; }\n\n\n\n template<typename LhsT, typename RhsT>\n\n auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return static_cast<bool>(lhs != rhs); }\n\n template<typename T>\n\n auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); }\n\n template<typename T>\n\n auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); }\n\n template<typename T>\n\n auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; }\n\n template<typename T>\n\n auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; }\n\n\n\n template<typename LhsT>\n", "file_path": "3rdparty/catch/catch.hpp", "rank": 45, "score": 31.061624732924468 }, { "content": "\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result Device::waitIdle( Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkDeviceWaitIdle( m_device ) );\n\n }\n\n#else\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::waitIdle( Dispatch const & d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkDeviceWaitIdle( m_device ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING \"::Device::waitIdle\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result Device::displayPowerControlEXT( VULKAN_HPP_NAMESPACE::DisplayKHR display, const VULKAN_HPP_NAMESPACE::DisplayPowerInfoEXT* pDisplayPowerInfo, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 46, "score": 30.929718103504463 }, { "content": "\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<void>::type Queue::submit2KHR( ArrayProxy<const VULKAN_HPP_NAMESPACE::SubmitInfo2KHR> const & submits, VULKAN_HPP_NAMESPACE::Fence fence, Dispatch const & d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkQueueSubmit2KHR( m_queue, submits.size(), reinterpret_cast<const VkSubmitInfo2KHR *>( submits.data() ), static_cast<VkFence>( fence ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING \"::Queue::submit2KHR\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result Queue::waitIdle( Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkQueueWaitIdle( m_queue ) );\n\n }\n\n#else\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<void>::type Queue::waitIdle( Dispatch const & d ) const\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 47, "score": 30.910259111207196 }, { "content": " return static_cast<Result>( d.vkDeviceWaitIdle( m_device ) );\n\n }\n\n#else\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::waitIdle(Dispatch const &d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkDeviceWaitIdle( m_device ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING\"::Device::waitIdle\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::displayPowerControlEXT( VULKAN_HPP_NAMESPACE::DisplayKHR display, const VULKAN_HPP_NAMESPACE::DisplayPowerInfoEXT* pDisplayPowerInfo, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkDisplayPowerControlEXT( m_device, static_cast<VkDisplayKHR>( display ), reinterpret_cast<const VkDisplayPowerInfoEXT*>( pDisplayPowerInfo ) ) );\n\n }\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::displayPowerControlEXT( VULKAN_HPP_NAMESPACE::DisplayKHR display, const DisplayPowerInfoEXT & displayPowerInfo, Dispatch const &d ) const\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 48, "score": 30.90928101306124 }, { "content": "\n\n\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result Queue::setPerformanceConfigurationINTEL( VULKAN_HPP_NAMESPACE::PerformanceConfigurationINTEL configuration, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkQueueSetPerformanceConfigurationINTEL( m_queue, static_cast<VkPerformanceConfigurationINTEL>( configuration ) ) );\n\n }\n\n#else\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<void>::type Queue::setPerformanceConfigurationINTEL( VULKAN_HPP_NAMESPACE::PerformanceConfigurationINTEL configuration, Dispatch const & d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkQueueSetPerformanceConfigurationINTEL( m_queue, static_cast<VkPerformanceConfigurationINTEL>( configuration ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING \"::Queue::setPerformanceConfigurationINTEL\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n\n\n template <typename Dispatch>\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 49, "score": 30.898040925887074 }, { "content": " template <typename B = T, typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxy( std::initializer_list<typename std::remove_const<T>::type> const & list ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( list.size() ) )\n\n , m_ptr( list.begin() )\n\n {}\n\n\n\n ArrayProxy( std::initializer_list<T> & list ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( list.size() ) )\n\n , m_ptr( list.begin() )\n\n {}\n\n\n\n template <typename B = T, typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxy( std::initializer_list<typename std::remove_const<T>::type> & list ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( list.size() ) )\n\n , m_ptr( list.begin() )\n\n {}\n\n\n\n template <size_t N>\n\n ArrayProxy( std::array<T, N> const & data ) VULKAN_HPP_NOEXCEPT\n\n : m_count( N )\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 50, "score": 30.874268091976045 }, { "content": " typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxyNoTemporaries( std::vector<typename std::remove_const<T>::type, Allocator> const & data )\n\n VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( data.size() ) )\n\n , m_ptr( data.data() )\n\n {}\n\n\n\n template <class Allocator = std::allocator<typename std::remove_const<T>::type>,\n\n typename B = T,\n\n typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxyNoTemporaries( std::vector<typename std::remove_const<T>::type, Allocator> const && data ) = delete;\n\n\n\n template <class Allocator = std::allocator<typename std::remove_const<T>::type>>\n\n ArrayProxyNoTemporaries( std::vector<T, Allocator> & data ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( data.size() ) )\n\n , m_ptr( data.data() )\n\n {}\n\n\n\n template <class Allocator = std::allocator<typename std::remove_const<T>::type>>\n\n ArrayProxyNoTemporaries( std::vector<T, Allocator> && data ) = delete;\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 51, "score": 30.80230623677546 }, { "content": "\n\n// Dependencies\n\n#include \"../detail/setup.hpp\"\n\n#include \"../detail/precision.hpp\"\n\n#include \"../detail/type_int.hpp\"\n\n\n\n#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))\n\n#\tpragma message(\"GLM: GLM_GTC_ulp extension included\")\n\n#endif\n\n\n\nnamespace glm\n\n{\n\n\t/// @addtogroup gtc_ulp\n\n\t/// @{\n\n\n\n\t/// Return the next ULP value(s) after the input value(s).\n\n\t/// @see gtc_ulp\n\n\ttemplate <typename genType>\n\n\tGLM_FUNC_DECL genType next_float(genType const & x);\n\n\n", "file_path": "3rdparty/microprofile/demo/vulkan/glm/gtc/ulp.hpp", "rank": 52, "score": 30.74356914435942 }, { "content": " template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Queue::submit( uint32_t submitCount, const VULKAN_HPP_NAMESPACE::SubmitInfo* pSubmits, VULKAN_HPP_NAMESPACE::Fence fence, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkQueueSubmit( m_queue, submitCount, reinterpret_cast<const VkSubmitInfo*>( pSubmits ), static_cast<VkFence>( fence ) ) );\n\n }\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type Queue::submit( ArrayProxy<const VULKAN_HPP_NAMESPACE::SubmitInfo> const &submits, VULKAN_HPP_NAMESPACE::Fence fence, Dispatch const &d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkQueueSubmit( m_queue, submits.size() , reinterpret_cast<const VkSubmitInfo*>( submits.data() ), static_cast<VkFence>( fence ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING\"::Queue::submit\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Queue::waitIdle(Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkQueueWaitIdle( m_queue ) );\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 53, "score": 30.6411113449162 }, { "content": " template<typename ArgType, typename L>\n\n inline auto invokeLambda( L const &lambda, std::string const &arg ) -> ParserResult {\n\n ArgType temp{};\n\n auto result = convertInto( arg, temp );\n\n return !result\n\n ? result\n\n : LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( lambda, temp );\n\n }\n\n\n\n template<typename L>\n\n struct BoundLambda : BoundValueRefBase {\n\n L m_lambda;\n\n\n\n static_assert( UnaryLambdaTraits<L>::isValid, \"Supplied lambda must take exactly one argument\" );\n\n explicit BoundLambda( L const &lambda ) : m_lambda( lambda ) {}\n\n\n\n auto setValue( std::string const &arg ) -> ParserResult override {\n\n return invokeLambda<typename UnaryLambdaTraits<L>::ArgType>( m_lambda, arg );\n\n }\n\n };\n", "file_path": "3rdparty/catch/catch.hpp", "rank": 54, "score": 30.61375866079058 }, { "content": "#include <cstdio>\n\n#include <cassert>\n\n#include <memory>\n\n#include <ostream>\n\n\n\nnamespace Catch {\n\n void prepareExpandedExpression(AssertionResult& result);\n\n\n\n // Returns double formatted as %.3f (format expected on output)\n\n std::string getFormattedDuration( double duration );\n\n\n\n //! Should the reporter show\n\n bool shouldShowDuration( IConfig const& config, double duration );\n\n\n\n std::string serializeFilters( std::vector<std::string> const& container );\n\n\n\n template<typename DerivedT>\n\n struct StreamingReporterBase : IStreamingReporter {\n\n\n\n StreamingReporterBase( ReporterConfig const& _config )\n", "file_path": "3rdparty/catch/catch.hpp", "rank": 55, "score": 30.563709983424076 }, { "content": "\n\n template<typename L>\n\n struct BoundFlagLambda : BoundFlagRefBase {\n\n L m_lambda;\n\n\n\n static_assert( UnaryLambdaTraits<L>::isValid, \"Supplied lambda must take exactly one argument\" );\n\n static_assert( std::is_same<typename UnaryLambdaTraits<L>::ArgType, bool>::value, \"flags must be boolean\" );\n\n\n\n explicit BoundFlagLambda( L const &lambda ) : m_lambda( lambda ) {}\n\n\n\n auto setFlag( bool flag ) -> ParserResult override {\n\n return LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( m_lambda, flag );\n\n }\n\n };\n\n\n", "file_path": "3rdparty/catch/catch.hpp", "rank": 56, "score": 30.544853023081863 }, { "content": " {\n\n Result result = static_cast<Result>( d.vkResetDescriptorPool( m_device, static_cast<VkDescriptorPool>( descriptorPool ), static_cast<VkDescriptorPoolResetFlags>( flags ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING\"::Device::resetDescriptorPool\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::resetEvent( VULKAN_HPP_NAMESPACE::Event event, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkResetEvent( m_device, static_cast<VkEvent>( event ) ) );\n\n }\n\n#else\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::resetEvent( VULKAN_HPP_NAMESPACE::Event event, Dispatch const &d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkResetEvent( m_device, static_cast<VkEvent>( event ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING\"::Device::resetEvent\" );\n\n }\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 57, "score": 30.530791331068198 }, { "content": "\t/// @see <a href=\"http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf\">GLSL 4.20.8 specification, section 8.3 Common Functions</a>\n\n\ttemplate <template <typename, precision> class vecType, precision P>\n\n\tGLM_FUNC_DECL vecType<uint, P> floatBitsToUint(vecType<float, P> const & v);\n\n\n\n\t/// Returns a floating-point value corresponding to a signed\n\n\t/// integer encoding of a floating-point value.\n\n\t/// If an inf or NaN is passed in, it will not signal, and the\n\n\t/// resulting floating point value is unspecified. Otherwise,\n\n\t/// the bit-level representation is preserved.\n\n\t/// \n\n\t/// @see <a href=\"http://www.opengl.org/sdk/docs/manglsl/xhtml/intBitsToFloat.xml\">GLSL intBitsToFloat man page</a>\n\n\t/// @see <a href=\"http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf\">GLSL 4.20.8 specification, section 8.3 Common Functions</a>\n\n\tGLM_FUNC_DECL float intBitsToFloat(int const & v);\n\n\n\n\t/// Returns a floating-point value corresponding to a signed\n\n\t/// integer encoding of a floating-point value.\n\n\t/// If an inf or NaN is passed in, it will not signal, and the\n\n\t/// resulting floating point value is unspecified. Otherwise,\n\n\t/// the bit-level representation is preserved.\n\n\t/// \n", "file_path": "3rdparty/microprofile/demo/vulkan/glm/detail/func_common.hpp", "rank": 58, "score": 30.50334421016263 }, { "content": "\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<uint64_t>::type Device::getSemaphoreCounterValue( VULKAN_HPP_NAMESPACE::Semaphore semaphore, Dispatch const & d ) const\n\n {\n\n uint64_t value;\n\n Result result = static_cast<Result>( d.vkGetSemaphoreCounterValue( m_device, static_cast<VkSemaphore>( semaphore ), &value ) );\n\n return createResultValue( result, value, VULKAN_HPP_NAMESPACE_STRING \"::Device::getSemaphoreCounterValue\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result Device::getSemaphoreCounterValueKHR( VULKAN_HPP_NAMESPACE::Semaphore semaphore, uint64_t* pValue, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkGetSemaphoreCounterValueKHR( m_device, static_cast<VkSemaphore>( semaphore ), pValue ) );\n\n }\n\n\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<uint64_t>::type Device::getSemaphoreCounterValueKHR( VULKAN_HPP_NAMESPACE::Semaphore semaphore, Dispatch const & d ) const\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 59, "score": 30.471843593085246 }, { "content": " void setExternal(bool e) { }\n\n bool isYuv() const { return false; }\n\n#else\n\n unsigned int vectorSize : 3; // vector return type size.\n\n // Some languages support structures as sample results. Storing the whole structure in the\n\n // TSampler is too large, so there is an index to a separate table.\n\n static const unsigned structReturnIndexBits = 4; // number of index bits to use.\n\n static const unsigned structReturnSlots = (1<<structReturnIndexBits)-1; // number of valid values\n\n static const unsigned noReturnStruct = structReturnSlots; // value if no return struct type.\n\n // Index into a language specific table of texture return structures.\n\n unsigned int structReturnIndex : structReturnIndexBits;\n\n\n\n bool external : 1; // GL_OES_EGL_image_external\n\n bool yuv : 1; // GL_EXT_YUV_target\n\n\n\n#ifdef ENABLE_HLSL\n\n unsigned int getVectorSize() const { return vectorSize; }\n\n void clearReturnStruct() { structReturnIndex = noReturnStruct; }\n\n bool hasReturnStruct() const { return structReturnIndex != noReturnStruct; }\n\n unsigned getStructReturnIndex() const { return structReturnIndex; }\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/glslang/Include/Types.h", "rank": 60, "score": 30.44605305493681 }, { "content": " void setExternal(bool e) { }\n\n bool isYuv() const { return false; }\n\n#else\n\n unsigned int vectorSize : 3; // vector return type size.\n\n // Some languages support structures as sample results. Storing the whole structure in the\n\n // TSampler is too large, so there is an index to a separate table.\n\n static const unsigned structReturnIndexBits = 4; // number of index bits to use.\n\n static const unsigned structReturnSlots = (1<<structReturnIndexBits)-1; // number of valid values\n\n static const unsigned noReturnStruct = structReturnSlots; // value if no return struct type.\n\n // Index into a language specific table of texture return structures.\n\n unsigned int structReturnIndex : structReturnIndexBits;\n\n\n\n bool external : 1; // GL_OES_EGL_image_external\n\n bool yuv : 1; // GL_EXT_YUV_target\n\n\n\n#ifdef ENABLE_HLSL\n\n unsigned int getVectorSize() const { return vectorSize; }\n\n void clearReturnStruct() { structReturnIndex = noReturnStruct; }\n\n bool hasReturnStruct() const { return structReturnIndex != noReturnStruct; }\n\n unsigned getStructReturnIndex() const { return structReturnIndex; }\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/glslang/Include/Types.h", "rank": 61, "score": 30.44605305493681 }, { "content": " {\n\n return static_cast<Result>( d.vkGetMemoryFdKHR( m_device, reinterpret_cast<const VkMemoryGetFdInfoKHR *>( pGetFdInfo ), pFd ) );\n\n }\n\n\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<int>::type Device::getMemoryFdKHR( const MemoryGetFdInfoKHR & getFdInfo, Dispatch const & d ) const\n\n {\n\n int fd;\n\n Result result = static_cast<Result>( d.vkGetMemoryFdKHR( m_device, reinterpret_cast<const VkMemoryGetFdInfoKHR *>( &getFdInfo ), &fd ) );\n\n return createResultValue( result, fd, VULKAN_HPP_NAMESPACE_STRING \"::Device::getMemoryFdKHR\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result Device::getMemoryFdPropertiesKHR( VULKAN_HPP_NAMESPACE::ExternalMemoryHandleTypeFlagBits handleType, int fd, VULKAN_HPP_NAMESPACE::MemoryFdPropertiesKHR* pMemoryFdProperties, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkGetMemoryFdPropertiesKHR( m_device, static_cast<VkExternalMemoryHandleTypeFlagBits>( handleType ), fd, reinterpret_cast< VkMemoryFdPropertiesKHR *>( pMemoryFdProperties ) ) );\n\n }\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 62, "score": 30.40062262739344 }, { "content": " }\n\n#else\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::resetCommandPool( VULKAN_HPP_NAMESPACE::CommandPool commandPool, VULKAN_HPP_NAMESPACE::CommandPoolResetFlags flags, Dispatch const &d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkResetCommandPool( m_device, static_cast<VkCommandPool>( commandPool ), static_cast<VkCommandPoolResetFlags>( flags ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING\"::Device::resetCommandPool\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::resetDescriptorPool( VULKAN_HPP_NAMESPACE::DescriptorPool descriptorPool, VULKAN_HPP_NAMESPACE::DescriptorPoolResetFlags flags, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkResetDescriptorPool( m_device, static_cast<VkDescriptorPool>( descriptorPool ), static_cast<VkDescriptorPoolResetFlags>( flags ) ) );\n\n }\n\n#else\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::resetDescriptorPool( VULKAN_HPP_NAMESPACE::DescriptorPool descriptorPool, VULKAN_HPP_NAMESPACE::DescriptorPoolResetFlags flags, Dispatch const &d ) const\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 63, "score": 30.289838129306773 }, { "content": " : m_count( count )\n\n , m_ptr( ptr )\n\n {}\n\n\n\n template <typename B = T, typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxyNoTemporaries( uint32_t count, typename std::remove_const<T>::type * ptr ) VULKAN_HPP_NOEXCEPT\n\n : m_count( count )\n\n , m_ptr( ptr )\n\n {}\n\n\n\n ArrayProxyNoTemporaries( std::initializer_list<T> const & list ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( list.size() ) )\n\n , m_ptr( list.begin() )\n\n {}\n\n\n\n template <typename B = T, typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxyNoTemporaries( std::initializer_list<typename std::remove_const<T>::type> const & list ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( list.size() ) )\n\n , m_ptr( list.begin() )\n\n {}\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 64, "score": 30.283857689649324 }, { "content": "\n\n template <typename Dispatch>\n\n VULKAN_HPP_INLINE void Device::releaseProfilingLockKHR( Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n d.vkReleaseProfilingLockKHR( m_device );\n\n }\n\n\n\n\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result Device::resetCommandPool( VULKAN_HPP_NAMESPACE::CommandPool commandPool, VULKAN_HPP_NAMESPACE::CommandPoolResetFlags flags, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkResetCommandPool( m_device, static_cast<VkCommandPool>( commandPool ), static_cast<VkCommandPoolResetFlags>( flags ) ) );\n\n }\n\n#else\n\n template <typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::resetCommandPool( VULKAN_HPP_NAMESPACE::CommandPool commandPool, VULKAN_HPP_NAMESPACE::CommandPoolResetFlags flags, Dispatch const & d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkResetCommandPool( m_device, static_cast<VkCommandPool>( commandPool ), static_cast<VkCommandPoolResetFlags>( flags ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING \"::Device::resetCommandPool\" );\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 65, "score": 30.253813528131897 }, { "content": " template<typename Dispatch>\n\n VULKAN_HPP_INLINE void CommandBuffer::setLineWidth( float lineWidth, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n d.vkCmdSetLineWidth( m_commandBuffer, lineWidth );\n\n }\n\n#else\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE void CommandBuffer::setLineWidth( float lineWidth, Dispatch const &d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n d.vkCmdSetLineWidth( m_commandBuffer, lineWidth );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result CommandBuffer::setPerformanceMarkerINTEL( const VULKAN_HPP_NAMESPACE::PerformanceMarkerInfoINTEL* pMarkerInfo, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkCmdSetPerformanceMarkerINTEL( m_commandBuffer, reinterpret_cast<const VkPerformanceMarkerInfoINTEL*>( pMarkerInfo ) ) );\n\n }\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 66, "score": 30.243074643007212 }, { "content": " template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::compileDeferredNV( VULKAN_HPP_NAMESPACE::Pipeline pipeline, uint32_t shader, Dispatch const &d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkCompileDeferredNV( m_device, static_cast<VkPipeline>( pipeline ), shader ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING\"::Device::compileDeferredNV\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n#ifdef VK_ENABLE_BETA_EXTENSIONS\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::copyAccelerationStructureKHR( const VULKAN_HPP_NAMESPACE::CopyAccelerationStructureInfoKHR* pInfo, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkCopyAccelerationStructureKHR( m_device, reinterpret_cast<const VkCopyAccelerationStructureInfoKHR*>( pInfo ) ) );\n\n }\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::copyAccelerationStructureKHR( const CopyAccelerationStructureInfoKHR & info, Dispatch const &d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkCopyAccelerationStructureKHR( m_device, reinterpret_cast<const VkCopyAccelerationStructureInfoKHR*>( &info ) ) );\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 67, "score": 30.221466537865382 }, { "content": " ArrayProxy( std::initializer_list<T> const & list ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( list.size() ) )\n\n , m_ptr( list.begin() )\n\n {}\n\n\n\n template <typename B = T, typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxy( std::initializer_list<typename std::remove_const<T>::type> const & list ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( list.size() ) )\n\n , m_ptr( list.begin() )\n\n {}\n\n\n\n ArrayProxy( std::initializer_list<T> & list ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( list.size() ) )\n\n , m_ptr( list.begin() )\n\n {}\n\n\n\n template <typename B = T, typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxy( std::initializer_list<typename std::remove_const<T>::type> & list ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( list.size() ) )\n\n , m_ptr( list.begin() )\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 68, "score": 30.19636684753974 }, { "content": "\n\n bool shouldContinueOnFailure( int flags );\n\n inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; }\n\n bool shouldSuppressFailure( int flags );\n\n\n\n} // end namespace Catch\n\n\n\n// end catch_result_type.h\n\nnamespace Catch {\n\n\n\n struct AssertionInfo\n\n {\n\n StringRef macroName;\n\n SourceLineInfo lineInfo;\n\n StringRef capturedExpression;\n\n ResultDisposition::Flags resultDisposition;\n\n\n\n // We want to delete this constructor but a compiler bug in 4.8 means\n\n // the struct is then treated as non-aggregate\n\n //AssertionInfo() = delete;\n", "file_path": "3rdparty/catch/catch.hpp", "rank": 69, "score": 30.16929632736897 }, { "content": "\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::debugMarkerSetObjectNameEXT( const VULKAN_HPP_NAMESPACE::DebugMarkerObjectNameInfoEXT* pNameInfo, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkDebugMarkerSetObjectNameEXT( m_device, reinterpret_cast<const VkDebugMarkerObjectNameInfoEXT*>( pNameInfo ) ) );\n\n }\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::debugMarkerSetObjectNameEXT( const DebugMarkerObjectNameInfoEXT & nameInfo, Dispatch const &d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkDebugMarkerSetObjectNameEXT( m_device, reinterpret_cast<const VkDebugMarkerObjectNameInfoEXT*>( &nameInfo ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING\"::Device::debugMarkerSetObjectNameEXT\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::debugMarkerSetObjectTagEXT( const VULKAN_HPP_NAMESPACE::DebugMarkerObjectTagInfoEXT* pTagInfo, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkDebugMarkerSetObjectTagEXT( m_device, reinterpret_cast<const VkDebugMarkerObjectTagInfoEXT*>( pTagInfo ) ) );\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 70, "score": 30.137974062951937 }, { "content": "\n\n template <class Allocator = std::allocator<typename std::remove_const<T>::type>>\n\n ArrayProxy( std::vector<T, Allocator> const & data ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( data.size() ) )\n\n , m_ptr( data.data() )\n\n {}\n\n\n\n template <class Allocator = std::allocator<typename std::remove_const<T>::type>,\n\n typename B = T,\n\n typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxy( std::vector<typename std::remove_const<T>::type, Allocator> const & data ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( data.size() ) )\n\n , m_ptr( data.data() )\n\n {}\n\n\n\n template <class Allocator = std::allocator<typename std::remove_const<T>::type>>\n\n ArrayProxy( std::vector<T, Allocator> & data ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( data.size() ) )\n\n , m_ptr( data.data() )\n\n {}\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 71, "score": 30.12433901127134 }, { "content": "\n\n template <class Allocator = std::allocator<typename std::remove_const<T>::type>,\n\n typename B = T,\n\n typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxyNoTemporaries( std::vector<typename std::remove_const<T>::type, Allocator> & data ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( data.size() ) )\n\n , m_ptr( data.data() )\n\n {}\n\n\n\n template <class Allocator = std::allocator<typename std::remove_const<T>::type>,\n\n typename B = T,\n\n typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxyNoTemporaries( std::vector<typename std::remove_const<T>::type, Allocator> && data ) = delete;\n\n\n\n const T * begin() const VULKAN_HPP_NOEXCEPT\n\n {\n\n return m_ptr;\n\n }\n\n\n\n const T * end() const VULKAN_HPP_NOEXCEPT\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 72, "score": 30.120929267825723 }, { "content": " template <size_t N, typename B = T, typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxyNoTemporaries( std::array<typename std::remove_const<T>::type, N> & data ) VULKAN_HPP_NOEXCEPT\n\n : m_count( N )\n\n , m_ptr( data.data() )\n\n {}\n\n\n\n template <size_t N, typename B = T, typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxyNoTemporaries( std::array<typename std::remove_const<T>::type, N> && data ) = delete;\n\n\n\n template <class Allocator = std::allocator<typename std::remove_const<T>::type>>\n\n ArrayProxyNoTemporaries( std::vector<T, Allocator> const & data ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( data.size() ) )\n\n , m_ptr( data.data() )\n\n {}\n\n\n\n template <class Allocator = std::allocator<typename std::remove_const<T>::type>>\n\n ArrayProxyNoTemporaries( std::vector<T, Allocator> const && data ) = delete;\n\n\n\n template <class Allocator = std::allocator<typename std::remove_const<T>::type>,\n\n typename B = T,\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 73, "score": 30.063042960180578 }, { "content": "#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result PhysicalDevice::acquireWinrtDisplayNV( VULKAN_HPP_NAMESPACE::DisplayKHR display, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkAcquireWinrtDisplayNV( m_physicalDevice, static_cast<VkDisplayKHR>( display ) ) );\n\n }\n\n#else\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<void>::type PhysicalDevice::acquireWinrtDisplayNV( VULKAN_HPP_NAMESPACE::DisplayKHR display, Dispatch const & d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkAcquireWinrtDisplayNV( m_physicalDevice, static_cast<VkDisplayKHR>( display ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING \"::PhysicalDevice::acquireWinrtDisplayNV\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n#endif /*VK_USE_PLATFORM_WIN32_KHR*/\n\n\n\n\n\n\n\n#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT\n\n template <typename Dispatch>\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 74, "score": 30.05524902473502 }, { "content": "#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result Device::release( VULKAN_HPP_NAMESPACE::PerformanceConfigurationINTEL configuration, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkReleasePerformanceConfigurationINTEL( m_device, static_cast<VkPerformanceConfigurationINTEL>( configuration ) ) );\n\n }\n\n#else\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::release( VULKAN_HPP_NAMESPACE::PerformanceConfigurationINTEL configuration, Dispatch const & d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkReleasePerformanceConfigurationINTEL( m_device, static_cast<VkPerformanceConfigurationINTEL>( configuration ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING \"::Device::release\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 75, "score": 30.01640415959177 }, { "content": " {}\n\n\n\n ArrayProxyNoTemporaries( std::initializer_list<T> && list ) = delete;\n\n\n\n template <typename B = T, typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxyNoTemporaries( std::initializer_list<typename std::remove_const<T>::type> & list ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( list.size() ) )\n\n , m_ptr( list.begin() )\n\n {}\n\n\n\n template <typename B = T, typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxyNoTemporaries( std::initializer_list<typename std::remove_const<T>::type> && list ) = delete;\n\n\n\n template <size_t N>\n\n ArrayProxyNoTemporaries( std::array<T, N> const & data ) VULKAN_HPP_NOEXCEPT\n\n : m_count( N )\n\n , m_ptr( data.data() )\n\n {}\n\n\n\n template <size_t N>\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 76, "score": 30.011449398763595 }, { "content": "\t//template <typename T, precision P, template <typename, precision> class vecType>\n\n\t//GLM_FUNC_DECL typename vecType<T, P>::bool_type lessThan(vecType<T, P> const & x, vecType<T, P> const & y);\n\n\n\n\t/// Returns the component-wise comparison of result x <= y.\n\n\t///\n\n\t/// @tparam vecType Floating-point or integer vector types.\n\n\t///\n\n\t/// @see <a href=\"http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThanEqual.xml\">GLSL lessThanEqual man page</a>\n\n\t/// @see <a href=\"http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf\">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>\n\n\ttemplate <typename T, precision P, template <typename, precision> class vecType>\n\n\tGLM_FUNC_DECL typename vecType<T, P>::bool_type lessThanEqual(vecType<T, P> const & x, vecType<T, P> const & y);\n\n\n\n\t/// Returns the component-wise comparison of result x > y.\n\n\t///\n\n\t/// @tparam vecType Floating-point or integer vector types.\n\n\t/// \n\n\t/// @see <a href=\"http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThan.xml\">GLSL greaterThan man page</a>\n\n\t/// @see <a href=\"http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf\">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>\n\n\ttemplate <typename T, precision P, template <typename, precision> class vecType>\n\n\tGLM_FUNC_DECL typename vecType<T, P>::bool_type greaterThan(vecType<T, P> const & x, vecType<T, P> const & y);\n", "file_path": "3rdparty/microprofile/demo/vulkan/glm/detail/func_vector_relational.hpp", "rank": 77, "score": 30.00855000660594 }, { "content": " template<typename Dispatch>\n\n VULKAN_HPP_INLINE void Device::resetQueryPoolEXT( VULKAN_HPP_NAMESPACE::QueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, Dispatch const &d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n d.vkResetQueryPoolEXT( m_device, static_cast<VkQueryPool>( queryPool ), firstQuery, queryCount );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::setDebugUtilsObjectNameEXT( const VULKAN_HPP_NAMESPACE::DebugUtilsObjectNameInfoEXT* pNameInfo, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkSetDebugUtilsObjectNameEXT( m_device, reinterpret_cast<const VkDebugUtilsObjectNameInfoEXT*>( pNameInfo ) ) );\n\n }\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::setDebugUtilsObjectNameEXT( const DebugUtilsObjectNameInfoEXT & nameInfo, Dispatch const &d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkSetDebugUtilsObjectNameEXT( m_device, reinterpret_cast<const VkDebugUtilsObjectNameInfoEXT*>( &nameInfo ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING\"::Device::setDebugUtilsObjectNameEXT\" );\n\n }\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 78, "score": 29.9911291783354 }, { "content": " return static_cast<Result>( d.vkBindBufferMemory( m_device, static_cast<VkBuffer>( buffer ), static_cast<VkDeviceMemory>( memory ), static_cast<VkDeviceSize>( memoryOffset ) ) );\n\n }\n\n#else\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::bindBufferMemory( VULKAN_HPP_NAMESPACE::Buffer buffer, VULKAN_HPP_NAMESPACE::DeviceMemory memory, VULKAN_HPP_NAMESPACE::DeviceSize memoryOffset, Dispatch const &d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkBindBufferMemory( m_device, static_cast<VkBuffer>( buffer ), static_cast<VkDeviceMemory>( memory ), static_cast<VkDeviceSize>( memoryOffset ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING\"::Device::bindBufferMemory\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::bindBufferMemory2( uint32_t bindInfoCount, const VULKAN_HPP_NAMESPACE::BindBufferMemoryInfo* pBindInfos, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkBindBufferMemory2( m_device, bindInfoCount, reinterpret_cast<const VkBindBufferMemoryInfo*>( pBindInfos ) ) );\n\n }\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::bindBufferMemory2( ArrayProxy<const VULKAN_HPP_NAMESPACE::BindBufferMemoryInfo> const &bindInfos, Dispatch const &d ) const\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 79, "score": 29.986017661582665 }, { "content": " : m_count( N )\n\n , m_ptr( data.data() )\n\n {}\n\n\n\n template <size_t N, typename B = T, typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxy( std::array<typename std::remove_const<T>::type, N> & data ) VULKAN_HPP_NOEXCEPT\n\n : m_count( N )\n\n , m_ptr( data.data() )\n\n {}\n\n\n\n template <class Allocator = std::allocator<typename std::remove_const<T>::type>>\n\n ArrayProxy( std::vector<T, Allocator> const & data ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( data.size() ) )\n\n , m_ptr( data.data() )\n\n {}\n\n\n\n template <class Allocator = std::allocator<typename std::remove_const<T>::type>,\n\n typename B = T,\n\n typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxy( std::vector<typename std::remove_const<T>::type, Allocator> const & data ) VULKAN_HPP_NOEXCEPT\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 80, "score": 29.904056969229973 }, { "content": "\n\n template <typename Dispatch>\n\n VULKAN_HPP_INLINE void Device::resetQueryPoolEXT( VULKAN_HPP_NAMESPACE::QueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n d.vkResetQueryPoolEXT( m_device, static_cast<VkQueryPool>( queryPool ), firstQuery, queryCount );\n\n }\n\n\n\n\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result Device::setDebugUtilsObjectNameEXT( const VULKAN_HPP_NAMESPACE::DebugUtilsObjectNameInfoEXT* pNameInfo, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkSetDebugUtilsObjectNameEXT( m_device, reinterpret_cast<const VkDebugUtilsObjectNameInfoEXT *>( pNameInfo ) ) );\n\n }\n\n\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::setDebugUtilsObjectNameEXT( const DebugUtilsObjectNameInfoEXT & nameInfo, Dispatch const & d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkSetDebugUtilsObjectNameEXT( m_device, reinterpret_cast<const VkDebugUtilsObjectNameInfoEXT *>( &nameInfo ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING \"::Device::setDebugUtilsObjectNameEXT\" );\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 81, "score": 29.883601128821418 }, { "content": "\n\n\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::bindImageMemory( VULKAN_HPP_NAMESPACE::Image image, VULKAN_HPP_NAMESPACE::DeviceMemory memory, VULKAN_HPP_NAMESPACE::DeviceSize memoryOffset, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkBindImageMemory( m_device, static_cast<VkImage>( image ), static_cast<VkDeviceMemory>( memory ), static_cast<VkDeviceSize>( memoryOffset ) ) );\n\n }\n\n#else\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::bindImageMemory( VULKAN_HPP_NAMESPACE::Image image, VULKAN_HPP_NAMESPACE::DeviceMemory memory, VULKAN_HPP_NAMESPACE::DeviceSize memoryOffset, Dispatch const &d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkBindImageMemory( m_device, static_cast<VkImage>( image ), static_cast<VkDeviceMemory>( memory ), static_cast<VkDeviceSize>( memoryOffset ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING\"::Device::bindImageMemory\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::bindImageMemory2( uint32_t bindInfoCount, const VULKAN_HPP_NAMESPACE::BindImageMemoryInfo* pBindInfos, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 82, "score": 29.821901135440957 }, { "content": "#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::resetFences( uint32_t fenceCount, const VULKAN_HPP_NAMESPACE::Fence* pFences, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkResetFences( m_device, fenceCount, reinterpret_cast<const VkFence*>( pFences ) ) );\n\n }\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::resetFences( ArrayProxy<const VULKAN_HPP_NAMESPACE::Fence> const &fences, Dispatch const &d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkResetFences( m_device, fences.size() , reinterpret_cast<const VkFence*>( fences.data() ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING\"::Device::resetFences\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 83, "score": 29.770946692294604 }, { "content": " : m_count( static_cast<uint32_t>( data.size() ) )\n\n , m_ptr( data.data() )\n\n {}\n\n\n\n template <class Allocator = std::allocator<typename std::remove_const<T>::type>>\n\n ArrayProxy( std::vector<T, Allocator> & data ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( data.size() ) )\n\n , m_ptr( data.data() )\n\n {}\n\n\n\n template <class Allocator = std::allocator<typename std::remove_const<T>::type>,\n\n typename B = T,\n\n typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxy( std::vector<typename std::remove_const<T>::type, Allocator> & data ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( data.size() ) )\n\n , m_ptr( data.data() )\n\n {}\n\n\n\n const T * begin() const VULKAN_HPP_NOEXCEPT\n\n {\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 84, "score": 29.744176550770163 }, { "content": " }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Queue::setPerformanceConfigurationINTEL( VULKAN_HPP_NAMESPACE::PerformanceConfigurationINTEL configuration, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkQueueSetPerformanceConfigurationINTEL( m_queue, static_cast<VkPerformanceConfigurationINTEL>( configuration ) ) );\n\n }\n\n#else\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type Queue::setPerformanceConfigurationINTEL( VULKAN_HPP_NAMESPACE::PerformanceConfigurationINTEL configuration, Dispatch const &d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkQueueSetPerformanceConfigurationINTEL( m_queue, static_cast<VkPerformanceConfigurationINTEL>( configuration ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING\"::Queue::setPerformanceConfigurationINTEL\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 85, "score": 29.679644440132954 }, { "content": "\t/// Return whether a matrix is a normalized matrix.\n\n\t/// From GLM_GTX_matrix_query extension.\n\n\ttemplate<typename T, precision P>\n\n\tGLM_FUNC_DECL bool isNormalized(detail::tmat3x3<T, P> const & m, T const & epsilon);\n\n\n\n\t/// Return whether a matrix is a normalized matrix.\n\n\t/// From GLM_GTX_matrix_query extension.\n\n\ttemplate<typename T, precision P>\n\n\tGLM_FUNC_DECL bool isNormalized(detail::tmat4x4<T, P> const & m, T const & epsilon);\n\n\n\n\t/// Return whether a matrix is an orthonormalized matrix.\n\n\t/// From GLM_GTX_matrix_query extension.\n\n\ttemplate<typename T, precision P, template <typename, precision> class matType>\n\n\tGLM_FUNC_DECL bool isOrthogonal(matType<T, P> const & m, T const & epsilon);\n\n\n\n\t/// @}\n\n}//namespace glm\n\n\n\n#include \"matrix_query.inl\"\n\n\n\n#endif//GLM_GTX_matrix_query\n", "file_path": "3rdparty/microprofile/demo/vulkan/glm/gtx/matrix_query.hpp", "rank": 86, "score": 29.481464933210752 }, { "content": "#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n#endif /*VK_USE_PLATFORM_WIN32_KHR*/\n\n\n\n\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::releasePerformanceConfigurationINTEL( VULKAN_HPP_NAMESPACE::PerformanceConfigurationINTEL configuration, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkReleasePerformanceConfigurationINTEL( m_device, static_cast<VkPerformanceConfigurationINTEL>( configuration ) ) );\n\n }\n\n#else\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::releasePerformanceConfigurationINTEL( VULKAN_HPP_NAMESPACE::PerformanceConfigurationINTEL configuration, Dispatch const &d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkReleasePerformanceConfigurationINTEL( m_device, static_cast<VkPerformanceConfigurationINTEL>( configuration ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING\"::Device::releasePerformanceConfigurationINTEL\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 87, "score": 29.432477625507286 }, { "content": " VULKAN_HPP_INLINE typename ResultValueType<void>::type CommandBuffer::reset( VULKAN_HPP_NAMESPACE::CommandBufferResetFlags flags, Dispatch const & d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkResetCommandBuffer( m_commandBuffer, static_cast<VkCommandBufferResetFlags>( flags ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING \"::CommandBuffer::reset\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n\n\n#ifdef VK_USE_PLATFORM_WIN32_KHR\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result Device::acquireFullScreenExclusiveModeEXT( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkAcquireFullScreenExclusiveModeEXT( m_device, static_cast<VkSwapchainKHR>( swapchain ) ) );\n\n }\n\n#else\n\n template <typename Dispatch>\n\n VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::acquireFullScreenExclusiveModeEXT( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, Dispatch const & d ) const\n\n {\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 88, "score": 29.402100070075797 }, { "content": " } while ( result == Result::eIncomplete );\n\n if ( ( result == Result::eSuccess ) && ( dataSize < data.size() ) )\n\n {\n\n data.resize( dataSize );\n\n }\n\n return createResultValue( result, data, VULKAN_HPP_NAMESPACE_STRING\"::Device::getPipelineCacheData\" );\n\n }\n\n\n\n template <typename Uint8_tAllocator, typename Dispatch, typename B, typename std::enable_if<std::is_same<typename B::value_type, uint8_t>::value, int>::type >\n\n VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE typename ResultValueType<std::vector<uint8_t, Uint8_tAllocator>>::type Device::getPipelineCacheData( VULKAN_HPP_NAMESPACE::PipelineCache pipelineCache, Uint8_tAllocator & uint8_tAllocator, Dispatch const & d ) const\n\n {\n\n std::vector<uint8_t, Uint8_tAllocator> data( uint8_tAllocator );\n\n size_t dataSize;\n\n Result result;\n\n do\n\n {\n\n result = static_cast<Result>( d.vkGetPipelineCacheData( m_device, static_cast<VkPipelineCache>( pipelineCache ), &dataSize, nullptr ) );\n\n if ( ( result == Result::eSuccess ) && dataSize )\n\n {\n\n data.resize( dataSize );\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 89, "score": 29.393963286906903 }, { "content": " ArrayProxyNoTemporaries( std::initializer_list<T> const & list ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( list.size() ) )\n\n , m_ptr( list.begin() )\n\n {}\n\n\n\n ArrayProxyNoTemporaries( std::initializer_list<T> const && list ) = delete;\n\n\n\n template <typename B = T, typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxyNoTemporaries( std::initializer_list<typename std::remove_const<T>::type> const & list )\n\n VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( list.size() ) )\n\n , m_ptr( list.begin() )\n\n {}\n\n\n\n template <typename B = T, typename std::enable_if<std::is_const<B>::value, int>::type = 0>\n\n ArrayProxyNoTemporaries( std::initializer_list<typename std::remove_const<T>::type> const && list ) = delete;\n\n\n\n ArrayProxyNoTemporaries( std::initializer_list<T> & list ) VULKAN_HPP_NOEXCEPT\n\n : m_count( static_cast<uint32_t>( list.size() ) )\n\n , m_ptr( list.begin() )\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 90, "score": 29.382852972910126 }, { "content": "#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<VULKAN_HPP_NAMESPACE::PerformanceValueINTEL>::type Device::getPerformanceParameterINTEL( VULKAN_HPP_NAMESPACE::PerformanceParameterTypeINTEL parameter, Dispatch const &d ) const\n\n {\n\n VULKAN_HPP_NAMESPACE::PerformanceValueINTEL value;\n\n Result result = static_cast<Result>( d.vkGetPerformanceParameterINTEL( m_device, static_cast<VkPerformanceParameterTypeINTEL>( parameter ), reinterpret_cast<VkPerformanceValueINTEL*>( &value ) ) );\n\n return createResultValue( result, value, VULKAN_HPP_NAMESPACE_STRING\"::Device::getPerformanceParameterINTEL\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::getPipelineCacheData( VULKAN_HPP_NAMESPACE::PipelineCache pipelineCache, size_t* pDataSize, void* pData, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkGetPipelineCacheData( m_device, static_cast<VkPipelineCache>( pipelineCache ), pDataSize, pData ) );\n\n }\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Allocator, typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<std::vector<uint8_t,Allocator>>::type Device::getPipelineCacheData( VULKAN_HPP_NAMESPACE::PipelineCache pipelineCache, Dispatch const &d ) const\n\n {\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 91, "score": 29.363566380325018 }, { "content": " template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<uint64_t>::type Device::getSwapchainCounterEXT( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, VULKAN_HPP_NAMESPACE::SurfaceCounterFlagBitsEXT counter, Dispatch const &d ) const\n\n {\n\n uint64_t counterValue;\n\n Result result = static_cast<Result>( d.vkGetSwapchainCounterEXT( m_device, static_cast<VkSwapchainKHR>( swapchain ), static_cast<VkSurfaceCounterFlagBitsEXT>( counter ), &counterValue ) );\n\n return createResultValue( result, counterValue, VULKAN_HPP_NAMESPACE_STRING\"::Device::getSwapchainCounterEXT\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::getSwapchainImagesKHR( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VULKAN_HPP_NAMESPACE::Image* pSwapchainImages, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkGetSwapchainImagesKHR( m_device, static_cast<VkSwapchainKHR>( swapchain ), pSwapchainImageCount, reinterpret_cast<VkImage*>( pSwapchainImages ) ) );\n\n }\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Allocator, typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<std::vector<Image,Allocator>>::type Device::getSwapchainImagesKHR( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, Dispatch const &d ) const\n\n {\n\n std::vector<Image,Allocator> swapchainImages;\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 92, "score": 29.361787367460018 }, { "content": " std::vector<uint64_t, Uint64_tAllocator> & timestamps = data.first;\n\n uint64_t & maxDeviation = data.second;\n\n Result result = static_cast<Result>( d.vkGetCalibratedTimestampsEXT( m_device, timestampInfos.size(), reinterpret_cast<const VkCalibratedTimestampInfoEXT *>( timestampInfos.data() ), timestamps.data(), &maxDeviation ) );\n\n return createResultValue( result, data, VULKAN_HPP_NAMESPACE_STRING \"::Device::getCalibratedTimestampsEXT\" );\n\n }\n\n\n\n template <typename Uint64_tAllocator, typename Dispatch, typename B, typename std::enable_if<std::is_same<typename B::value_type, uint64_t>::value, int>::type >\n\n VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<std::pair<std::vector<uint64_t, Uint64_tAllocator>, uint64_t>>::type Device::getCalibratedTimestampsEXT( ArrayProxy<const VULKAN_HPP_NAMESPACE::CalibratedTimestampInfoEXT> const & timestampInfos, Uint64_tAllocator & uint64_tAllocator, Dispatch const & d ) const\n\n {\n\n std::pair<std::vector<uint64_t, Uint64_tAllocator>,uint64_t> data( std::piecewise_construct, std::forward_as_tuple( timestampInfos.size(), uint64_tAllocator ), std::forward_as_tuple( 0 ) );\n\n std::vector<uint64_t, Uint64_tAllocator> & timestamps = data.first;\n\n uint64_t & maxDeviation = data.second;\n\n Result result = static_cast<Result>( d.vkGetCalibratedTimestampsEXT( m_device, timestampInfos.size(), reinterpret_cast<const VkCalibratedTimestampInfoEXT *>( timestampInfos.data() ), timestamps.data(), &maxDeviation ) );\n\n return createResultValue( result, data, VULKAN_HPP_NAMESPACE_STRING \"::Device::getCalibratedTimestampsEXT\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n template <typename Dispatch>\n\n VULKAN_HPP_INLINE uint32_t Device::getDeferredOperationMaxConcurrencyKHR( VULKAN_HPP_NAMESPACE::DeferredOperationKHR operation, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT\n", "file_path": "3rdparty/vulkan_sdk/1.2.170.0/Include/vulkan/vulkan.hpp", "rank": 93, "score": 29.35860261633507 }, { "content": " template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result PhysicalDevice::enumerateDeviceExtensionProperties( const char* pLayerName, uint32_t* pPropertyCount, VULKAN_HPP_NAMESPACE::ExtensionProperties* pProperties, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkEnumerateDeviceExtensionProperties( m_physicalDevice, pLayerName, pPropertyCount, reinterpret_cast<VkExtensionProperties*>( pProperties ) ) );\n\n }\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Allocator, typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<std::vector<ExtensionProperties,Allocator>>::type PhysicalDevice::enumerateDeviceExtensionProperties( Optional<const std::string> layerName, Dispatch const &d ) const\n\n {\n\n std::vector<ExtensionProperties,Allocator> properties;\n\n uint32_t propertyCount;\n\n Result result;\n\n do\n\n {\n\n result = static_cast<Result>( d.vkEnumerateDeviceExtensionProperties( m_physicalDevice, layerName ? layerName->c_str() : nullptr, &propertyCount, nullptr ) );\n\n if ( ( result == Result::eSuccess ) && propertyCount )\n\n {\n\n properties.resize( propertyCount );\n\n result = static_cast<Result>( d.vkEnumerateDeviceExtensionProperties( m_physicalDevice, layerName ? layerName->c_str() : nullptr, &propertyCount, reinterpret_cast<VkExtensionProperties*>( properties.data() ) ) );\n\n }\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 94, "score": 29.35192781240169 }, { "content": " VULKAN_HPP_INLINE Result CommandBuffer::reset( VULKAN_HPP_NAMESPACE::CommandBufferResetFlags flags, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkResetCommandBuffer( m_commandBuffer, static_cast<VkCommandBufferResetFlags>( flags ) ) );\n\n }\n\n#else\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type CommandBuffer::reset( VULKAN_HPP_NAMESPACE::CommandBufferResetFlags flags, Dispatch const &d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkResetCommandBuffer( m_commandBuffer, static_cast<VkCommandBufferResetFlags>( flags ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING\"::CommandBuffer::reset\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n#ifdef VK_USE_PLATFORM_WIN32_KHR\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::acquireFullScreenExclusiveModeEXT( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkAcquireFullScreenExclusiveModeEXT( m_device, static_cast<VkSwapchainKHR>( swapchain ) ) );\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 95, "score": 29.298176561311745 }, { "content": "\t/// Return the distance in the number of ULP between 2 vectors.\n\n\t/// @see gtc_ulp\n\n\ttemplate<typename T, template<typename> class vecType>\n\n\tGLM_FUNC_DECL vecType<uint> float_distance(vecType<T> const & x, vecType<T> const & y);\n\n\t\n\n\t/// @}\n\n}// namespace glm\n\n\n\n#include \"ulp.inl\"\n\n\n\n#endif//GLM_GTC_ulp\n\n\n", "file_path": "3rdparty/microprofile/demo/vulkan/glm/gtc/ulp.hpp", "rank": 96, "score": 29.290293012723286 }, { "content": "\n\n// Dependencies\n\n#include \"../detail/setup.hpp\"\n\n\n\n#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))\n\n#\tpragma message(\"GLM: GLM_GTC_constants extension included\")\n\n#endif\n\n\n\nnamespace glm\n\n{\n\n\t/// @addtogroup gtc_constants\n\n\t/// @{\n\n\n\n\t/// Return the epsilon constant for floating point types.\n\n\t/// @todo Implement epsilon for half-precision floating point type.\n\n\t/// @see gtc_constants\n\n\ttemplate <typename genType>\n\n\tGLM_FUNC_DECL genType epsilon();\n\n\n\n\t/// Return 0.\n", "file_path": "3rdparty/microprofile/demo/vulkan/glm/gtc/constants.hpp", "rank": 97, "score": 29.268136976268394 }, { "content": " unsigned int sequence;\n\n\n\n bool operator == ( MessageInfo const& other ) const;\n\n bool operator < ( MessageInfo const& other ) const;\n\n private:\n\n static unsigned int globalCount;\n\n };\n\n\n\n struct MessageStream {\n\n\n\n template<typename T>\n\n MessageStream& operator << ( T const& value ) {\n\n m_stream << value;\n\n return *this;\n\n }\n\n\n\n ReusableStringStream m_stream;\n\n };\n\n\n\n struct MessageBuilder : MessageStream {\n", "file_path": "3rdparty/catch/catch.hpp", "rank": 98, "score": 29.25340048449893 }, { "content": " }\n\n#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE typename ResultValueType<void>::type Device::debugMarkerSetObjectTagEXT( const DebugMarkerObjectTagInfoEXT & tagInfo, Dispatch const &d ) const\n\n {\n\n Result result = static_cast<Result>( d.vkDebugMarkerSetObjectTagEXT( m_device, reinterpret_cast<const VkDebugMarkerObjectTagInfoEXT*>( &tagInfo ) ) );\n\n return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING\"::Device::debugMarkerSetObjectTagEXT\" );\n\n }\n\n#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/\n\n\n\n\n\n#ifdef VK_ENABLE_BETA_EXTENSIONS\n\n#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE\n\n template<typename Dispatch>\n\n VULKAN_HPP_INLINE Result Device::deferredOperationJoinKHR( VULKAN_HPP_NAMESPACE::DeferredOperationKHR operation, Dispatch const &d) const VULKAN_HPP_NOEXCEPT\n\n {\n\n return static_cast<Result>( d.vkDeferredOperationJoinKHR( m_device, static_cast<VkDeferredOperationKHR>( operation ) ) );\n\n }\n\n#else\n\n template<typename Dispatch>\n", "file_path": "3rdparty/vulkan_sdk/1.2.148.1/Include/vulkan/vulkan.hpp", "rank": 99, "score": 29.24282266294551 } ]
C++
Boss2D/addon/_old/webrtc-qt5.11.2_for_boss/modules/rtp_rtcp/source/byte_io_unittest.cc
Yash-Wasalwar-07/Boss2D
37c5ba0f1c83c89810359a207cabfa0905f803d2
#include <limits> #include "modules/rtp_rtcp/source/byte_io.h" #include BOSS_WEBRTC_U_test__gtest_h namespace webrtc { namespace { class ByteIoTest : public ::testing::Test { protected: ByteIoTest() {} virtual ~ByteIoTest() {} enum { kAlignments = sizeof(uint64_t) - 1 }; template <typename T> T CreateTestValue(bool negative, uint8_t num_bytes) { T val = 0; for (uint8_t i = 0; i != num_bytes; ++i) { val = (val << 8) + (negative ? (0xFF - i) : (i + 1)); } if (std::numeric_limits<T>::is_signed && negative && num_bytes < sizeof(T)) { T mask = static_cast<T>(-1); const T neg_byte = static_cast<T>(0xFF); for (int i = 0; i < num_bytes; ++i) { mask &= ~(neg_byte << (i * 8)); } val |= mask; } return val; } template <typename T> void PopulateTestData(uint8_t* data, T value, int num_bytes, bool bigendian) { if (bigendian) { for (int i = 0; i < num_bytes; ++i) { data[i] = (value >> ((num_bytes - i - 1) * 8)) & 0xFF; } } else { for (int i = 0; i < num_bytes; ++i) { data[i] = (value >> (i * 8)) & 0xFF; } } } template <typename T, T (*RM)(const uint8_t*), int B> void TestRead(bool big_endian) { for (int neg = 0; neg < 2; ++neg) { bool negative = neg > 0; T test_value = CreateTestValue<T>(negative, B); uint8_t bytes[B + kAlignments]; for (int i = 0; i < kAlignments; ++i) { PopulateTestData(bytes + i, test_value, B, big_endian); EXPECT_EQ(test_value, RM(bytes + i)); } } } template <typename T, void (*WM)(uint8_t*, T), int B> void TestWrite(bool big_endian) { for (int neg = 0; neg < 2; ++neg) { bool negative = neg > 0; T test_value = CreateTestValue<T>(negative, B); uint8_t expected_bytes[B + kAlignments]; uint8_t bytes[B + kAlignments]; for (int i = 0; i < kAlignments; ++i) { PopulateTestData(expected_bytes + i, test_value, B, big_endian); memset(bytes, 0, B + kAlignments); WM(bytes + i, test_value); for (int j = 0; j < B; ++j) { EXPECT_EQ(expected_bytes[i + j], bytes[i + j]); } } } } }; TEST_F(ByteIoTest, Test16UBitBigEndian) { TestRead<uint16_t, ByteReader<uint16_t>::ReadBigEndian, sizeof(uint16_t)>(true); TestWrite<uint16_t, ByteWriter<uint16_t>::WriteBigEndian, sizeof(uint16_t)>(true); } TEST_F(ByteIoTest, Test24UBitBigEndian) { TestRead<uint32_t, ByteReader<uint32_t, 3>::ReadBigEndian, 3>(true); TestWrite<uint32_t, ByteWriter<uint32_t, 3>::WriteBigEndian, 3>(true); } TEST_F(ByteIoTest, Test32UBitBigEndian) { TestRead<uint32_t, ByteReader<uint32_t>::ReadBigEndian, sizeof(uint32_t)>(true); TestWrite<uint32_t, ByteWriter<uint32_t>::WriteBigEndian, sizeof(uint32_t)>(true); } TEST_F(ByteIoTest, Test64UBitBigEndian) { TestRead<uint64_t, ByteReader<uint64_t>::ReadBigEndian, sizeof(uint64_t)>(true); TestWrite<uint64_t, ByteWriter<uint64_t>::WriteBigEndian, sizeof(uint64_t)>(true); } TEST_F(ByteIoTest, Test16SBitBigEndian) { TestRead<int16_t, ByteReader<int16_t>::ReadBigEndian, sizeof(int16_t)>(true); TestWrite<int16_t, ByteWriter<int16_t>::WriteBigEndian, sizeof(int16_t)>(true); } TEST_F(ByteIoTest, Test24SBitBigEndian) { TestRead<int32_t, ByteReader<int32_t, 3>::ReadBigEndian, 3>(true); TestWrite<int32_t, ByteWriter<int32_t, 3>::WriteBigEndian, 3>(true); } TEST_F(ByteIoTest, Test32SBitBigEndian) { TestRead<int32_t, ByteReader<int32_t>::ReadBigEndian, sizeof(int32_t)>(true); TestWrite<int32_t, ByteWriter<int32_t>::WriteBigEndian, sizeof(int32_t)>(true); } TEST_F(ByteIoTest, Test64SBitBigEndian) { TestRead<int64_t, ByteReader<int64_t>::ReadBigEndian, sizeof(int64_t)>(true); TestWrite<int64_t, ByteWriter<int64_t>::WriteBigEndian, sizeof(int64_t)>(true); } TEST_F(ByteIoTest, Test16UBitLittleEndian) { TestRead<uint16_t, ByteReader<uint16_t>::ReadLittleEndian, sizeof(uint16_t)>(false); TestWrite<uint16_t, ByteWriter<uint16_t>::WriteLittleEndian, sizeof(uint16_t)>(false); } TEST_F(ByteIoTest, Test24UBitLittleEndian) { TestRead<uint32_t, ByteReader<uint32_t, 3>::ReadLittleEndian, 3>(false); TestWrite<uint32_t, ByteWriter<uint32_t, 3>::WriteLittleEndian, 3>(false); } TEST_F(ByteIoTest, Test32UBitLittleEndian) { TestRead<uint32_t, ByteReader<uint32_t>::ReadLittleEndian, sizeof(uint32_t)>(false); TestWrite<uint32_t, ByteWriter<uint32_t>::WriteLittleEndian, sizeof(uint32_t)>(false); } TEST_F(ByteIoTest, Test64UBitLittleEndian) { TestRead<uint64_t, ByteReader<uint64_t>::ReadLittleEndian, sizeof(uint64_t)>(false); TestWrite<uint64_t, ByteWriter<uint64_t>::WriteLittleEndian, sizeof(uint64_t)>(false); } TEST_F(ByteIoTest, Test16SBitLittleEndian) { TestRead<int16_t, ByteReader<int16_t>::ReadLittleEndian, sizeof(int16_t)>(false); TestWrite<int16_t, ByteWriter<int16_t>::WriteLittleEndian, sizeof(int16_t)>(false); } TEST_F(ByteIoTest, Test24SBitLittleEndian) { TestRead<int32_t, ByteReader<int32_t, 3>::ReadLittleEndian, 3>(false); TestWrite<int32_t, ByteWriter<int32_t, 3>::WriteLittleEndian, 3>(false); } TEST_F(ByteIoTest, Test32SBitLittleEndian) { TestRead<int32_t, ByteReader<int32_t>::ReadLittleEndian, sizeof(int32_t)>(false); TestWrite<int32_t, ByteWriter<int32_t>::WriteLittleEndian, sizeof(int32_t)>(false); } TEST_F(ByteIoTest, Test64SBitLittleEndian) { TestRead<int64_t, ByteReader<int64_t>::ReadLittleEndian, sizeof(int64_t)>(false); TestWrite<int64_t, ByteWriter<int64_t>::WriteLittleEndian, sizeof(int64_t)>(false); } TEST(ByteIo, SanityCheckFixedByteArrayUnsignedReadBigEndian) { uint8_t data[8] = {0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88}; uint64_t value = ByteReader<uint64_t, 2>::ReadBigEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xFFEE), value); value = ByteReader<uint64_t, 3>::ReadBigEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xFFEEDD), value); value = ByteReader<uint64_t, 4>::ReadBigEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xFFEEDDCC), value); value = ByteReader<uint64_t, 5>::ReadBigEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xFFEEDDCCBB), value); value = ByteReader<uint64_t, 6>::ReadBigEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xFFEEDDCCBBAA), value); value = ByteReader<uint64_t, 7>::ReadBigEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xFFEEDDCCBBAA99), value); value = ByteReader<uint64_t, 8>::ReadBigEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xFFEEDDCCBBAA9988), value); } TEST(ByteIo, SanityCheckFixedByteArrayUnsignedReadLittleEndian) { uint8_t data[8] = {0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88}; uint64_t value = ByteReader<uint64_t, 2>::ReadLittleEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xEEFF), value); value = ByteReader<uint64_t, 3>::ReadLittleEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xDDEEFF), value); value = ByteReader<uint64_t, 4>::ReadLittleEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xCCDDEEFF), value); value = ByteReader<uint64_t, 5>::ReadLittleEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xBBCCDDEEFF), value); value = ByteReader<uint64_t, 6>::ReadLittleEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xAABBCCDDEEFF), value); value = ByteReader<uint64_t, 7>::ReadLittleEndian(data); EXPECT_EQ(static_cast<uint64_t>(0x99AABBCCDDEEFF), value); value = ByteReader<uint64_t, 8>::ReadLittleEndian(data); EXPECT_EQ(static_cast<uint64_t>(0x8899AABBCCDDEEFF), value); } } }
#include <limits> #include "modules/rtp_rtcp/source/byte_io.h" #include BOSS_WEBRTC_U_test__gtest_h namespace webrtc { namespace { class ByteIoTest : public ::testing::Test { protected: ByteIoTest() {} virtual ~ByteIoTest() {} enum { kAlignments = sizeof(uint64_t) - 1 }; template <typename T> T CreateTestValue(bool negative, uint8_t num_bytes) { T val = 0; for (uint8_t i = 0; i != num_bytes; ++i) { val = (val << 8) + (negative ? (0xFF - i) : (i + 1)); } if (std::numeric_limits<T>::is_signed && negative && num_bytes < sizeof(T)) { T mask = static_cast<T>(-1); const T neg_byte = static_cast<T>(0xFF); for (int i = 0; i < num_bytes; ++i) { mask &= ~(neg_byte << (i * 8)); } val |= mask; } return val; } template <typename T> void PopulateTestData(uint8_t* data, T value, int num_bytes, bool bigendian) { if (bigendian) { for (int i = 0; i < num_bytes; ++i) { data[i] = (value >> ((num_bytes - i - 1) * 8)) & 0xFF; } } else { for (int i = 0; i < num_bytes; ++i) { data[i] = (value >> (i * 8)) & 0xFF; } } } template <typename T, T (*RM)(const uint8_t*), int B> void TestRead(bool big_endian) { for (int neg = 0; neg < 2; ++neg) { bool negative = neg > 0; T test_value = CreateTestValue<T>(negative, B); uint8_t bytes[B + kAlignments]; for (int i = 0; i < kAlignments; ++i) { PopulateTestData(bytes + i, test_value, B, big_endian); EXPECT_EQ(test_value, RM(bytes + i)); } } } template <typename T, void (*WM)(uint8_t*, T), int B> void TestWrite(bool big_endian) { for (int neg = 0; neg < 2; ++neg) { bool negative = neg > 0; T test_value = CreateTestValue<T>(negative, B); uint8_t expected_bytes[B + kAlignments]; uint8_t bytes[B + kAlignments]; for (int i = 0; i < kAlignments; ++i) { PopulateTestData(expected_bytes + i, test_value, B, big_endian); memset(bytes, 0, B + kAlignments); WM(bytes + i, test_value); for (int j = 0; j < B; ++j) { EXPECT_EQ(expected_bytes[i + j], bytes[i + j]); } } } } }; TEST_F(ByteIoTest, Test16UBitBigEndian) { TestRead<uint16_t, ByteReader<uint16_t>::ReadBigEndian, sizeof(uint16_t)>(true); TestWrite<uint16_t, ByteWriter<uint16_t>::WriteBigEndian, sizeof(uint16_t)>(true); } TEST_F(ByteIoTest, Test24UBitBigEndian) { TestRead<uint32_t, ByteReader<uint32_t, 3>::ReadBigEndian, 3>(true); TestWrite<uint32_t, ByteWriter<uint32_t, 3>::WriteBigEndian, 3>(true); } TEST_F(ByteIoTest, Test32UBitBigEndian) { TestRead<uint32_t, ByteReader<uint32_t>::ReadBigEndian, sizeof(uint32_t)>(true); TestWrite<uint32_t, ByteWriter<uint32_t>::WriteBigEndian, sizeof(uint32_t)>(true); } TEST_F(ByteIoTest, Test64UBitBigEndian) { TestRead<uint64_t, ByteReader<uint64_t>::ReadBigEndian, sizeof(uint64_t)>(true); TestWrite<uint64_t, ByteWriter<uint64_t>::WriteBigEndian, sizeof(uint64_t)>(true); } TEST_F(ByteIoTest, Test16SBitBigEndian) { TestRead<int16_t, ByteReader<int16_t>::ReadBigEndian, sizeof(int16_t)>(true); TestWrite<int16_t, ByteWriter<int16_t>::WriteBigEndian, sizeof(int16_t)>(true); } TEST_F(ByteIoTest, Test24SBitBigEndian) { TestRead<int32_t, ByteReader<int32_t, 3>::ReadBigEndian, 3>(true); TestWrite<int32_t, ByteWriter<int32_t, 3>::WriteBigEndian, 3>(true); } TEST_F(ByteIoTest, Test32SBitBigEndian) { TestRead<int32_t, ByteReader<int32_t>::ReadBigEndian, sizeof(int32_t)>(true); TestWrite<int32_t, ByteWriter<int32_t
4_t, ByteWriter<uint64_t>::WriteLittleEndian, sizeof(uint64_t)>(false); } TEST_F(ByteIoTest, Test16SBitLittleEndian) { TestRead<int16_t, ByteReader<int16_t>::ReadLittleEndian, sizeof(int16_t)>(false); TestWrite<int16_t, ByteWriter<int16_t>::WriteLittleEndian, sizeof(int16_t)>(false); } TEST_F(ByteIoTest, Test24SBitLittleEndian) { TestRead<int32_t, ByteReader<int32_t, 3>::ReadLittleEndian, 3>(false); TestWrite<int32_t, ByteWriter<int32_t, 3>::WriteLittleEndian, 3>(false); } TEST_F(ByteIoTest, Test32SBitLittleEndian) { TestRead<int32_t, ByteReader<int32_t>::ReadLittleEndian, sizeof(int32_t)>(false); TestWrite<int32_t, ByteWriter<int32_t>::WriteLittleEndian, sizeof(int32_t)>(false); } TEST_F(ByteIoTest, Test64SBitLittleEndian) { TestRead<int64_t, ByteReader<int64_t>::ReadLittleEndian, sizeof(int64_t)>(false); TestWrite<int64_t, ByteWriter<int64_t>::WriteLittleEndian, sizeof(int64_t)>(false); } TEST(ByteIo, SanityCheckFixedByteArrayUnsignedReadBigEndian) { uint8_t data[8] = {0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88}; uint64_t value = ByteReader<uint64_t, 2>::ReadBigEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xFFEE), value); value = ByteReader<uint64_t, 3>::ReadBigEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xFFEEDD), value); value = ByteReader<uint64_t, 4>::ReadBigEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xFFEEDDCC), value); value = ByteReader<uint64_t, 5>::ReadBigEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xFFEEDDCCBB), value); value = ByteReader<uint64_t, 6>::ReadBigEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xFFEEDDCCBBAA), value); value = ByteReader<uint64_t, 7>::ReadBigEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xFFEEDDCCBBAA99), value); value = ByteReader<uint64_t, 8>::ReadBigEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xFFEEDDCCBBAA9988), value); } TEST(ByteIo, SanityCheckFixedByteArrayUnsignedReadLittleEndian) { uint8_t data[8] = {0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88}; uint64_t value = ByteReader<uint64_t, 2>::ReadLittleEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xEEFF), value); value = ByteReader<uint64_t, 3>::ReadLittleEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xDDEEFF), value); value = ByteReader<uint64_t, 4>::ReadLittleEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xCCDDEEFF), value); value = ByteReader<uint64_t, 5>::ReadLittleEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xBBCCDDEEFF), value); value = ByteReader<uint64_t, 6>::ReadLittleEndian(data); EXPECT_EQ(static_cast<uint64_t>(0xAABBCCDDEEFF), value); value = ByteReader<uint64_t, 7>::ReadLittleEndian(data); EXPECT_EQ(static_cast<uint64_t>(0x99AABBCCDDEEFF), value); value = ByteReader<uint64_t, 8>::ReadLittleEndian(data); EXPECT_EQ(static_cast<uint64_t>(0x8899AABBCCDDEEFF), value); } } }
>::WriteBigEndian, sizeof(int32_t)>(true); } TEST_F(ByteIoTest, Test64SBitBigEndian) { TestRead<int64_t, ByteReader<int64_t>::ReadBigEndian, sizeof(int64_t)>(true); TestWrite<int64_t, ByteWriter<int64_t>::WriteBigEndian, sizeof(int64_t)>(true); } TEST_F(ByteIoTest, Test16UBitLittleEndian) { TestRead<uint16_t, ByteReader<uint16_t>::ReadLittleEndian, sizeof(uint16_t)>(false); TestWrite<uint16_t, ByteWriter<uint16_t>::WriteLittleEndian, sizeof(uint16_t)>(false); } TEST_F(ByteIoTest, Test24UBitLittleEndian) { TestRead<uint32_t, ByteReader<uint32_t, 3>::ReadLittleEndian, 3>(false); TestWrite<uint32_t, ByteWriter<uint32_t, 3>::WriteLittleEndian, 3>(false); } TEST_F(ByteIoTest, Test32UBitLittleEndian) { TestRead<uint32_t, ByteReader<uint32_t>::ReadLittleEndian, sizeof(uint32_t)>(false); TestWrite<uint32_t, ByteWriter<uint32_t>::WriteLittleEndian, sizeof(uint32_t)>(false); } TEST_F(ByteIoTest, Test64UBitLittleEndian) { TestRead<uint64_t, ByteReader<uint64_t>::ReadLittleEndian, sizeof(uint64_t)>(false); TestWrite<uint6
random
[]
C++
ErrorPrintout.cpp
dascenzo/MyDictionary
f258f987f05d58be0c0df6eec58eec6be0b441dc
#include "ErrorPrintout.h" #include "Options.h" #include "Error.h" #include "CommandLine.h" #include "StringViewOutput.h" template<typename T> class GeneratorBase { public: GeneratorBase(const CommandLine& commandLine, const T& error) noexcept : commandLine(commandLine), error(error) { } protected: ~GeneratorBase() = default; const CommandLine& commandLine; const T& error; }; template<typename T> class ErrorLineGenerator; template<> class ErrorLineGenerator<EnvironmentSetupError> : public GeneratorBase<EnvironmentSetupError> { public: void operator()() const noexcept { try { std::visit(*this, error.variant()); } catch (const std::bad_variant_access& ) { std::fprintf(stderr, "%.*s: %s\n", C_STR(commandLine.programName), error.what()); } } void operator()(const BadEnvVar& e) const noexcept { std::fprintf(stderr, "%.*s: invalid env var: %s\n", C_STR(commandLine.programName), e.variable()); } void operator()(const SetEnvFailed& e) const noexcept { std::fprintf(stderr, "%.*s: failed to set environment: %s\n", C_STR(commandLine.programName), std::strerror(e.errNo())); } using GeneratorBase::GeneratorBase; }; template<> class ErrorLineGenerator<UsageError> : public GeneratorBase<UsageError> { public: void operator()() const noexcept { try { std::visit(*this, error.variant()); } catch (const std::bad_variant_access& ) { std::fprintf(stderr, "%.*s: %s\n", C_STR(commandLine.programName), error.what()); } } void operator()(const GeneralActionMisuse& ) const noexcept { std::fprintf(stderr, "%.*s: invalid usage\n", C_STR(commandLine.programName)); } void operator()(const MissingArgument& e) const noexcept { std::fprintf(stderr, "%.*s: missing argument for %s\n", C_STR(commandLine.programName), e.option()); } void operator()(const InvalidArgument& e) const noexcept { std::fprintf(stderr, "%.*s: invalid argument for %s\n", C_STR(commandLine.programName), e.option()); } void operator()(const MultipleFormats& ) const noexcept { std::fprintf(stderr, "%.*s: multiple formats given\n", C_STR(commandLine.programName)); } void operator()(const NoAction& ) const noexcept { std::fprintf(stderr, "%.*s: no action given\n", C_STR(commandLine.programName)); } using GeneratorBase::GeneratorBase; }; template<> class ErrorLineGenerator<DataStateError> : public GeneratorBase<DataStateError> { public: void operator()() const noexcept { try { std::visit(*this, error.data()); } catch (const std::bad_variant_access& ) { std::fprintf(stderr, "%.*s: %s\n", C_STR(commandLine.programName), error.what()); } } void operator()(const DataStateError::WordData& data) const noexcept { std::fprintf(stderr, "%.*s: operation failed: word (%s) %s\n", C_STR(commandLine.programName), data.value(), problem()); } void operator()(const DataStateError::TagData& data) const noexcept { std::fprintf(stderr, "%.*s: operation failed: tag (%s) %s\n", C_STR(commandLine.programName), data.value(), problem()); } void operator()(const DataStateError::WordTagData& data) const noexcept { std::fprintf(stderr, "%.*s: operation failed: word/tag combination (%s/%s) %s\n", C_STR(commandLine.programName), data.first.value(), data.second.value(), problem()); } using GeneratorBase::GeneratorBase; private: const char* problem() const noexcept { switch (error.type()) { case DataStateError::MISSING: return "doesn't exist"; case DataStateError::ALREADY_PRESENT: return "already exists"; } } }; template<> class ErrorLineGenerator<pqxx::failure> : public GeneratorBase<pqxx::failure> { public: void operator()() const noexcept { std::fprintf(stderr, "%.*s: database runtime error: %s\n", C_STR(commandLine.programName), error.what()); } using GeneratorBase::GeneratorBase; }; template<> class ErrorLineGenerator<std::exception> : public GeneratorBase<std::exception> { public: void operator()() const noexcept { std::fprintf(stderr, "%.*s: internal error: %s\n", C_STR(commandLine.programName), error.what()); } using GeneratorBase::GeneratorBase; }; template<> class ErrorLineGenerator<UnknownException> : public GeneratorBase<UnknownException> { public: void operator()() const noexcept { std::fprintf(stderr, "%.*s: unknown internal error\n", C_STR(commandLine.programName)); } using GeneratorBase::GeneratorBase; }; template<typename T> class SuggestionLineGenerator : public GeneratorBase<T> { public: using GeneratorBase<T>::GeneratorBase; void operator()() const noexcept { } }; template<> class SuggestionLineGenerator<UsageError> : public GeneratorBase<UsageError> { public: void operator()() const noexcept { try { std::visit(*this, error.variant()); } catch (const std::bad_variant_access& ) { printGeneralHelp(); } } void operator()(const GeneralActionMisuse& e) const noexcept { try { std::visit(PrintActionHelp(*this), e.action()); } catch (const std::bad_variant_access& ) { printGeneralHelp(); } } void operator()(const MissingArgument& e) const noexcept { try { std::visit(PrintActionHelp(*this), e.action()); } catch (const std::bad_variant_access& ) { printGeneralHelp(); } } void operator()(const InvalidArgument& e) const noexcept { std::fprintf(stderr, "try: %s -- %s\n", e.option(), e.argument()); } void operator()(const MultipleFormats& ) const noexcept { std::fprintf(stderr, "try: zero or one of -f, -ff, -fff\n"); } void operator()(const NoAction& ) const noexcept { printGeneralHelp(); } using GeneratorBase::GeneratorBase; private: void printGeneralHelp() const noexcept { std::fprintf(stderr, "try: %.*s help\n", C_STR(commandLine.baseProgramName)); } void printActionHelp(const FailedAdd&) const noexcept { std::fprintf(stderr, ADD_USAGE "\n", C_STR(commandLine.baseProgramName)); } void printActionHelp(const FailedRm&) const noexcept { std::fprintf(stderr, RM_USAGE "\n", C_STR(commandLine.baseProgramName)); } void printActionHelp(const FailedFind&) const noexcept { std::fprintf(stderr, FIND_USAGE "\n", C_STR(commandLine.baseProgramName)); } void printActionHelp(const FailedTags&) const noexcept { std::fprintf(stderr, TAGS_USAGE "\n", C_STR(commandLine.baseProgramName)); } void printActionHelp(const FailedEdit&) const noexcept { std::fprintf(stderr, EDIT_USAGE "\n", C_STR(commandLine.baseProgramName)); } void printActionHelp(const FailedShorthandFind&) const noexcept { printGeneralHelp(); } class PrintActionHelp { public: PrintActionHelp(const SuggestionLineGenerator& generator) noexcept : m_generator(generator) {} template<typename FailedAction> void operator()(const FailedAction& failedAction) const noexcept { m_generator.printActionHelp(failedAction); } private: const SuggestionLineGenerator& m_generator; }; }; template<typename T> static void doPrintout(const CommandLine& commandLine, const T& e) noexcept { ErrorLineGenerator<T>{commandLine, e}(); SuggestionLineGenerator<T>{commandLine, e}(); } void ErrorPrintout::handle(const CommandLine& commandLine, const EnvironmentSetupError& e) noexcept { doPrintout(commandLine, e); } void ErrorPrintout::handle(const CommandLine& commandLine, const UsageError& e) noexcept { doPrintout(commandLine, e); } void ErrorPrintout::handle(const CommandLine& commandLine, const DataStateError& e) noexcept { doPrintout(commandLine, e); } void ErrorPrintout::handle(const CommandLine& commandLine, const pqxx::failure& e) noexcept { doPrintout(commandLine, e); } void ErrorPrintout::handle(const CommandLine& commandLine, const std::exception& e) noexcept { doPrintout(commandLine, e); } void ErrorPrintout::handle(const CommandLine& commandLine, const UnknownException& e) noexcept { doPrintout(commandLine, e); }
#include "ErrorPrintout.h" #include "Options.h" #include "Error.h" #include "CommandLine.h" #include "StringViewOutput.h" template<typename T> class GeneratorBase { public: GeneratorBase(const CommandLine& commandLine, const T& error) noexcept : commandLine(commandLine), error(error) { } protected: ~GeneratorBase() = default; const CommandLine& commandLine; const T& error; }; template<typename T> class ErrorLineGenerator; template<> class ErrorLineGenerator<EnvironmentSetupError> : public GeneratorBase<EnvironmentSetupError> { public: void operator()() const noexcept { try { std::visit(*this, error.variant()); } catch (const std::bad_variant_access& ) { std::fprintf(stderr, "%.*s: %s\n", C_STR(commandLine.programName), error.what()); } } void operator()(const BadEnvVar& e) const noexcept { std::fprintf(stderr, "%.*s: invalid env var: %s\n", C_STR(commandLine.programName), e.variable()); } void operator()(const SetEnvFailed& e) const noexcept { std::fprintf(stderr, "%.*s: failed to set environment: %s\n", C_STR(commandLine.programName), std::strerror(e.errNo())); } using GeneratorBase::GeneratorBase; }; template<> class ErrorLineGenerator<UsageError> : public GeneratorBase<UsageError> { public: void operator()() const noexcept { try { std::visit(*this, error.variant()); } catch (const std::bad_variant_access& ) { std::fprintf(stderr, "%.*s: %s\n", C_STR(commandLine.programName), error.what()); } } void operator()(const GeneralActionMisuse& ) const noexcept { std::fprintf(stderr, "%.*s: invalid usage\n", C_STR(commandLine.programName)); } void operator()(const MissingArgument& e) const noexcept { std::fprintf(stderr, "%.*s: missing argument for %s\n", C_STR(commandLine.programName), e.option()); } void operator()(const InvalidArgument& e) const noexcept {
failed: word (%s) %s\n", C_STR(commandLine.programName), data.value(), problem()); } void operator()(const DataStateError::TagData& data) const noexcept { std::fprintf(stderr, "%.*s: operation failed: tag (%s) %s\n", C_STR(commandLine.programName), data.value(), problem()); } void operator()(const DataStateError::WordTagData& data) const noexcept { std::fprintf(stderr, "%.*s: operation failed: word/tag combination (%s/%s) %s\n", C_STR(commandLine.programName), data.first.value(), data.second.value(), problem()); } using GeneratorBase::GeneratorBase; private: const char* problem() const noexcept { switch (error.type()) { case DataStateError::MISSING: return "doesn't exist"; case DataStateError::ALREADY_PRESENT: return "already exists"; } } }; template<> class ErrorLineGenerator<pqxx::failure> : public GeneratorBase<pqxx::failure> { public: void operator()() const noexcept { std::fprintf(stderr, "%.*s: database runtime error: %s\n", C_STR(commandLine.programName), error.what()); } using GeneratorBase::GeneratorBase; }; template<> class ErrorLineGenerator<std::exception> : public GeneratorBase<std::exception> { public: void operator()() const noexcept { std::fprintf(stderr, "%.*s: internal error: %s\n", C_STR(commandLine.programName), error.what()); } using GeneratorBase::GeneratorBase; }; template<> class ErrorLineGenerator<UnknownException> : public GeneratorBase<UnknownException> { public: void operator()() const noexcept { std::fprintf(stderr, "%.*s: unknown internal error\n", C_STR(commandLine.programName)); } using GeneratorBase::GeneratorBase; }; template<typename T> class SuggestionLineGenerator : public GeneratorBase<T> { public: using GeneratorBase<T>::GeneratorBase; void operator()() const noexcept { } }; template<> class SuggestionLineGenerator<UsageError> : public GeneratorBase<UsageError> { public: void operator()() const noexcept { try { std::visit(*this, error.variant()); } catch (const std::bad_variant_access& ) { printGeneralHelp(); } } void operator()(const GeneralActionMisuse& e) const noexcept { try { std::visit(PrintActionHelp(*this), e.action()); } catch (const std::bad_variant_access& ) { printGeneralHelp(); } } void operator()(const MissingArgument& e) const noexcept { try { std::visit(PrintActionHelp(*this), e.action()); } catch (const std::bad_variant_access& ) { printGeneralHelp(); } } void operator()(const InvalidArgument& e) const noexcept { std::fprintf(stderr, "try: %s -- %s\n", e.option(), e.argument()); } void operator()(const MultipleFormats& ) const noexcept { std::fprintf(stderr, "try: zero or one of -f, -ff, -fff\n"); } void operator()(const NoAction& ) const noexcept { printGeneralHelp(); } using GeneratorBase::GeneratorBase; private: void printGeneralHelp() const noexcept { std::fprintf(stderr, "try: %.*s help\n", C_STR(commandLine.baseProgramName)); } void printActionHelp(const FailedAdd&) const noexcept { std::fprintf(stderr, ADD_USAGE "\n", C_STR(commandLine.baseProgramName)); } void printActionHelp(const FailedRm&) const noexcept { std::fprintf(stderr, RM_USAGE "\n", C_STR(commandLine.baseProgramName)); } void printActionHelp(const FailedFind&) const noexcept { std::fprintf(stderr, FIND_USAGE "\n", C_STR(commandLine.baseProgramName)); } void printActionHelp(const FailedTags&) const noexcept { std::fprintf(stderr, TAGS_USAGE "\n", C_STR(commandLine.baseProgramName)); } void printActionHelp(const FailedEdit&) const noexcept { std::fprintf(stderr, EDIT_USAGE "\n", C_STR(commandLine.baseProgramName)); } void printActionHelp(const FailedShorthandFind&) const noexcept { printGeneralHelp(); } class PrintActionHelp { public: PrintActionHelp(const SuggestionLineGenerator& generator) noexcept : m_generator(generator) {} template<typename FailedAction> void operator()(const FailedAction& failedAction) const noexcept { m_generator.printActionHelp(failedAction); } private: const SuggestionLineGenerator& m_generator; }; }; template<typename T> static void doPrintout(const CommandLine& commandLine, const T& e) noexcept { ErrorLineGenerator<T>{commandLine, e}(); SuggestionLineGenerator<T>{commandLine, e}(); } void ErrorPrintout::handle(const CommandLine& commandLine, const EnvironmentSetupError& e) noexcept { doPrintout(commandLine, e); } void ErrorPrintout::handle(const CommandLine& commandLine, const UsageError& e) noexcept { doPrintout(commandLine, e); } void ErrorPrintout::handle(const CommandLine& commandLine, const DataStateError& e) noexcept { doPrintout(commandLine, e); } void ErrorPrintout::handle(const CommandLine& commandLine, const pqxx::failure& e) noexcept { doPrintout(commandLine, e); } void ErrorPrintout::handle(const CommandLine& commandLine, const std::exception& e) noexcept { doPrintout(commandLine, e); } void ErrorPrintout::handle(const CommandLine& commandLine, const UnknownException& e) noexcept { doPrintout(commandLine, e); }
std::fprintf(stderr, "%.*s: invalid argument for %s\n", C_STR(commandLine.programName), e.option()); } void operator()(const MultipleFormats& ) const noexcept { std::fprintf(stderr, "%.*s: multiple formats given\n", C_STR(commandLine.programName)); } void operator()(const NoAction& ) const noexcept { std::fprintf(stderr, "%.*s: no action given\n", C_STR(commandLine.programName)); } using GeneratorBase::GeneratorBase; }; template<> class ErrorLineGenerator<DataStateError> : public GeneratorBase<DataStateError> { public: void operator()() const noexcept { try { std::visit(*this, error.data()); } catch (const std::bad_variant_access& ) { std::fprintf(stderr, "%.*s: %s\n", C_STR(commandLine.programName), error.what()); } } void operator()(const DataStateError::WordData& data) const noexcept { std::fprintf(stderr, "%.*s: operation
random
[ { "content": "class SetEnvFailed {\n\npublic:\n\n SetEnvFailed(int errNo) noexcept;\n\n int errNo() const noexcept;\n\nprivate:\n\n int m_errNo;\n\n};\n", "file_path": "Error.h", "rank": 0, "score": 156967.1348443014 }, { "content": "// === EnvironmentSetupError ===\n\nclass BadEnvVar {\n\npublic:\n\n BadEnvVar(std::string_view badVariable) noexcept;\n\n const char* variable() const noexcept;\n\nprivate:\n\n SafeString m_badVariable;\n\n};\n", "file_path": "Error.h", "rank": 1, "score": 155378.63803255055 }, { "content": "class MissingArgument : public ActionMisuseNoShorthand {\n\npublic:\n\n MissingArgument(Variant action, std::string_view option) noexcept;\n\n const char* option() const noexcept;\n\nprivate:\n\n SafeString m_option;\n\n};\n", "file_path": "Error.h", "rank": 2, "score": 149142.26863512234 }, { "content": "class InvalidArgument : public ActionMisuseNoShorthand {\n\npublic:\n\n InvalidArgument(Variant action, std::string_view option, std::string_view argument) noexcept;\n\n const char* option() const noexcept;\n\n const char* argument() const noexcept;\n\nprivate:\n\n SafeString m_option, m_argument;\n\n};\n", "file_path": "Error.h", "rank": 3, "score": 149142.26863512234 }, { "content": "class EnvironmentSetupError : public std::exception {\n\npublic:\n\n using Variant = std::variant<BadEnvVar, SetEnvFailed>;\n\n static_assert(std::is_nothrow_move_constructible<Variant>::value);\n\n EnvironmentSetupError(Variant variant) noexcept;\n\n const Variant& variant() const noexcept;\n\n const char* what() const noexcept override;\n\nprivate:\n\n Variant m_variant;\n\n};\n\n\n", "file_path": "Error.h", "rank": 4, "score": 130738.38595771547 }, { "content": "class UsageError : public std::exception {\n\npublic:\n\n using Variant = std::variant<GeneralActionMisuse, MissingArgument, InvalidArgument,\n\n MultipleFormats, NoAction>;\n\n static_assert(std::is_nothrow_move_constructible<Variant>::value);\n\n UsageError(Variant variant) noexcept;\n\n const Variant& variant() const noexcept;\n\n const char* what() const noexcept override;\n\nprivate:\n\n Variant m_variant;\n\n SafeString m_message;\n\n};\n\n\n\ntemplate<typename T>\n", "file_path": "Error.h", "rank": 6, "score": 111351.33639552166 }, { "content": "// === UpdateSpecificationError ===\n\nclass UpdateSpecificationError : public std::exception {\n\npublic:\n\n UpdateSpecificationError(std::string_view word) noexcept;\n\n const char* word() const noexcept;\n\n const char* what() const noexcept override;\n\nprivate:\n\n SafeString m_word;\n\n};\n\n\n", "file_path": "Error.h", "rank": 7, "score": 107712.0474585159 }, { "content": "class DataStateError : public std::exception {\n\npublic:\n\n enum ErrorType { MISSING, ALREADY_PRESENT };\n\n using WordData = ErrorData<WordData>;\n\n using TagData = ErrorData<TagData>;\n\n using WordTagData = std::pair<WordData, TagData>;\n\n using DataVariant = std::variant<WordData, TagData, WordTagData>;\n\n static_assert(std::is_nothrow_move_constructible<DataVariant>::value);\n\n DataStateError(DataVariant data, ErrorType) noexcept;\n\n const DataVariant& data() const noexcept;\n\n ErrorType type() const noexcept;\n\n const char* what() const noexcept override;\n\nprivate:\n\n DataVariant m_data;\n\n ErrorType m_errorType;\n\n};\n\n\n", "file_path": "Error.h", "rank": 8, "score": 107709.09640114539 }, { "content": "class MultipleFormats : public ActionMisuseAll {\n\n using ActionMisuseAll::ActionMisuseAll;\n\n};\n", "file_path": "Error.h", "rank": 9, "score": 106693.09854674197 }, { "content": "class GeneralActionMisuse : public ActionMisuseAll {\n\n using ActionMisuseAll::ActionMisuseAll;\n\n};\n", "file_path": "Error.h", "rank": 10, "score": 102982.74027106562 }, { "content": "class TagsAction : public Action {\n\npublic:\n\n void execute(const CommandLine&) override;\n\n};\n", "file_path": "Actions.h", "rank": 16, "score": 86626.6577424196 }, { "content": "class EditAction : public Action {\n\npublic:\n\n void execute(const CommandLine&) override;\n\n};\n", "file_path": "Actions.h", "rank": 17, "score": 86626.6577424196 }, { "content": "class RmAction : public Action {\n\npublic:\n\n void execute(const CommandLine&) override;\n\n};\n", "file_path": "Actions.h", "rank": 18, "score": 86626.6577424196 }, { "content": "class FindAction : public Action {\n\npublic:\n\n void execute(const CommandLine&) override;\n\n};\n", "file_path": "Actions.h", "rank": 19, "score": 86626.6577424196 }, { "content": "class HelpAction : public Action {\n\npublic:\n\n void execute(const CommandLine&) override;\n\n};\n", "file_path": "Actions.h", "rank": 20, "score": 86626.6577424196 }, { "content": "class AddAction : public Action {\n\npublic:\n\n void execute(const CommandLine&) override;\n\n};\n", "file_path": "Actions.h", "rank": 21, "score": 86626.6577424196 }, { "content": "class ErrorData {\n\npublic:\n\n using kind = DataKind;\n\n ErrorData(std::string_view value) noexcept\n\n : m_value(value) {}\n\n const char* value() const noexcept\n\n { return m_value; }\n\nprivate:\n\n SafeString m_value;\n\n};\n", "file_path": "Error.h", "rank": 22, "score": 86174.47315116035 }, { "content": "class SetMatcher {\n\npublic:\n\n SetMatcher(const pqxx::dbtransaction& txn, const Set& set, std::string pattern, std::string replaceToken = \"VALUE\")\n\n : m_txn(txn), m_set(set), m_pattern(std::move(pattern)), m_replaceToken(std::move(replaceToken)) {\n\n\n\n }\n\n const std::string condition() const {\n\n return std::accumulate(m_set.begin(), m_set.end(), std::string(\"1 = 0\"), // false\n\n [this](const std::string& left, const std::string& right) {\n\n return left + \" OR \" + substitute(right);\n\n });\n\n }\n\nprivate:\n\n // returns m_pattern with all occurrences of m_replaceToken replaced with value.\n\n std::string substitute(const std::string& value) const {\n\n auto pos = m_pattern.find(m_replaceToken);\n\n if (pos != std::string::npos) {\n\n auto pattern = m_pattern;\n\n do {\n\n const auto replacement = m_txn.quote(value);\n", "file_path": "SetMatcher.h", "rank": 23, "score": 85139.253315803 }, { "content": "class ShorthandFindAction : public Action {\n\npublic:\n\n void execute(const CommandLine&) override;\n\n};\n", "file_path": "Actions.h", "rank": 26, "score": 83830.64550419514 }, { "content": "class ActionMisuseBase {\n\npublic:\n\n using Variant = std::variant<Actions...>;\n\n static_assert(std::is_nothrow_move_constructible<Variant>::value);\n\n ActionMisuseBase(Variant action) noexcept : m_action(std::move(action))\n\n { }\n\n const Variant& action() const noexcept\n\n { return m_action; }\n\nprivate:\n\n Variant m_action;\n\n};\n\nusing ActionMisuseAll = ActionMisuseBase<\n\n FailedAdd, FailedRm, FailedFind, FailedTags, FailedEdit, FailedShorthandFind\n\n>;\n\nusing ActionMisuseNoShorthand = ActionMisuseBase<\n\n FailedAdd, FailedRm, FailedFind, FailedTags, FailedEdit\n\n>;\n", "file_path": "Error.h", "rank": 28, "score": 74986.19191110891 }, { "content": "// === UsageError ===\n\nstruct FailedAdd {};\n", "file_path": "Error.h", "rank": 31, "score": 56398.52595946749 }, { "content": "struct FailedEdit {};\n", "file_path": "Error.h", "rank": 32, "score": 56395.50388542941 }, { "content": "struct FailedRm {};\n", "file_path": "Error.h", "rank": 33, "score": 56395.50388542941 }, { "content": "struct FailedTags {};\n", "file_path": "Error.h", "rank": 34, "score": 56395.50388542941 }, { "content": "struct FailedFind {};\n", "file_path": "Error.h", "rank": 35, "score": 56395.50388542941 }, { "content": "class Action {\n\npublic:\n\n virtual void execute(const CommandLine&) = 0;\n\n virtual ~Action() = default;\n\n};\n", "file_path": "Action.h", "rank": 36, "score": 53039.47813555955 }, { "content": "struct FailedShorthandFind {};\n\n\n\ntemplate<typename ... Actions>\n", "file_path": "Error.h", "rank": 37, "score": 52846.00160751252 }, { "content": "struct GetFailedAction\n\n{ };\n\ntemplate<>\n", "file_path": "Error.h", "rank": 38, "score": 52846.00160751252 }, { "content": " class Args {\n\n public:\n\n Args(int argc, char** argv) noexcept;\n\n int size() const noexcept;\n\n std::string_view operator[](int) const;\n\n private:\n\n int m_size;\n\n char** m_vector;\n\n };\n\npublic:\n\n CommandLine(int argc, char* argv[]) noexcept;\n\n std::string_view programName;\n\n std::string_view baseProgramName;\n\n Args args;\n\n int argc;\n\n char** argv;\n\nprivate:\n\n\n\n};\n", "file_path": "CommandLine.h", "rank": 39, "score": 51015.25464476894 }, { "content": "class CommandLine;\n\n\n", "file_path": "Action.h", "rank": 40, "score": 51015.25464476894 }, { "content": "// View object presenting a program's command line.\n\n// Its purpose is to be easier to work with than argc/argv.\n\nclass CommandLine {\n\npublic:\n", "file_path": "CommandLine.h", "rank": 41, "score": 49245.83820051774 }, { "content": "class SafeString {\n\nprivate:\n\n constexpr static char truncationString[] = \"...\";\n\n\n\npublic:\n\n SafeString() noexcept;\n\n SafeString(std::string_view string) noexcept;\n\n operator const char*() const noexcept;\n\n\n\n constexpr static std::size_t maxMessageLength = 100;\n\n constexpr static std::size_t maxStringLength =\n\n maxMessageLength + std::char_traits<char>::length(truncationString);\n\nprivate:\n\n std::array<char, maxStringLength + 1 /*null terminator*/> m_buffer;\n\n};\n\n\n", "file_path": "SafeString.h", "rank": 42, "score": 49245.83820051774 }, { "content": "class EntryQuery {\n\npublic:\n\n EntryQuery(EntryFormat);\n\n std::string select() const;\n\n std::vector<Entry> extract(const pqxx::result& result) const;\n\nprivate:\n\n EntryFormat m_format;\n\n};\n", "file_path": "EntryQuery.h", "rank": 43, "score": 49245.83820051774 }, { "content": "struct GetFailedAction<RmAction> {\n\n using type = FailedRm;\n\n};\n\ntemplate<>\n", "file_path": "Error.h", "rank": 44, "score": 46937.553532568 }, { "content": "struct GetFailedAction<EditAction> {\n\n using type = FailedEdit;\n\n};\n\ntemplate<>\n", "file_path": "Error.h", "rank": 45, "score": 46937.553532568 }, { "content": "struct GetFailedAction<TagsAction> {\n\n using type = FailedTags;\n\n};\n\ntemplate<>\n", "file_path": "Error.h", "rank": 46, "score": 46937.553532568 }, { "content": "struct GetFailedAction<FindAction> {\n\n using type = FailedFind;\n\n};\n\ntemplate<>\n", "file_path": "Error.h", "rank": 47, "score": 46937.553532568 }, { "content": "struct GetFailedAction<AddAction> {\n\n using type = FailedAdd;\n\n};\n\ntemplate<>\n", "file_path": "Error.h", "rank": 48, "score": 46937.553532568 }, { "content": "struct GetFailedAction<ShorthandFindAction> {\n\n using type = FailedShorthandFind;\n\n};\n\ntemplate<typename ErrorType, typename CallerAction, typename ... Args>\n\nUsageError actionUsageError(const CallerAction*, Args&& ... args) {\n\n return UsageError(ErrorType(typename GetFailedAction<CallerAction>::type(), std::forward<Args>(args)...));\n\n}\n", "file_path": "Error.h", "rank": 49, "score": 44452.54478388894 }, { "content": " virtual void missingArgument(std::string_view option) = 0;\n", "file_path": "CommandLineParsing.h", "rank": 50, "score": 43838.58775464796 }, { "content": " virtual void invalidArgument(std::string_view option, std::string_view arg) = 0;\n", "file_path": "CommandLineParsing.h", "rank": 51, "score": 43838.58775464796 }, { "content": "void setupEnvironment();\n", "file_path": "Environment.h", "rank": 52, "score": 33130.43221389506 }, { "content": "#pragma once\n\n#include <stdexcept>\n\n#include <string>\n\n#include <variant>\n\n#include <type_traits>\n\n#include \"SafeString.h\"\n\n#include \"Actions.h\"\n\n\n\n// XXX check that the variant is nothrow move constructible, which confirms\n\n// every alternative of the variant can be moved into the parent class\n\n// constructor, and the ctx param can be moved into the member variable.\n\n\n\n// XXX what() returns as much information as practical. Error data is exposed\n\n// through getters on the exception object. Code that prints out or whatever\n\n// can use those if it needs to. The purpose of this is to keep the exception\n\n// objects themselves from possibly throwing. For example a call to new might\n\n// be needed to create the \"full\" what() message.\n\n\n\n// === UnknownException, to signal catch(...) ===\n", "file_path": "Error.h", "rank": 53, "score": 31737.542216548823 }, { "content": "#pragma once\n\n#include <string>\n\n#include <algorithm>\n\n#include <pqxx/pqxx>\n\n\n\ntemplate<typename Set>\n", "file_path": "SetMatcher.h", "rank": 54, "score": 31363.263434885983 }, { "content": " pattern.replace(pos, m_replaceToken.size(), replacement);\n\n pos = pattern.find(m_replaceToken, pos + replacement.size());\n\n } while (pos != std::string::npos);\n\n return pattern;\n\n }\n\n return m_pattern;\n\n }\n\n const pqxx::dbtransaction& m_txn;\n\n const Set& m_set;\n\n std::string m_pattern,\n\n m_replaceToken;\n\n};\n", "file_path": "SetMatcher.h", "rank": 55, "score": 31356.93878459792 }, { "content": "#include \"Environment.h\"\n\n#include \"Error.h\"\n\n#include <cstring>\n\n#include <cstdlib>\n\n#include <map>\n\n#include <string>\n\n#include <type_traits>\n\n#include <iostream>\n\n#include <cerrno>\n\n\n\nextern char **environ;\n\nstatic constexpr auto prefix = \"MYDICT_\";\n\nstatic constexpr auto prefixLength = std::char_traits<char>::length(prefix);\n\n\n\nvoid setupEnvironment() {\n\n auto setEnv = std::map<std::string, std::string>();\n\n\n\n for (char** pp = environ; *pp; ++pp) {\n\n const auto str = *pp;\n\n\n", "file_path": "Environment.cpp", "rank": 56, "score": 31332.160951604925 }, { "content": " if (std::strncmp(str, prefix, prefixLength) == 0) {\n\n const auto endIt = str + std::strlen(str);\n\n const auto equalsIt = std::find(str, endIt, '=');\n\n // for some reason no '=' (don't really expect this to ever happen)\n\n if (equalsIt == endIt) {\n\n throw EnvironmentSetupError(BadEnvVar(str));\n\n }\n\n const auto base = std::string(str + prefixLength, equalsIt);\n\n const auto value = std::string(equalsIt + 1, endIt);\n\n setEnv[\"PG\" + base] = std::move(value);\n\n }\n\n }\n\n for (const auto& nameValuePair : setEnv) {\n\n if (setenv(nameValuePair.first.c_str(), nameValuePair.second.c_str(), true) != 0) {\n\n throw EnvironmentSetupError(SetEnvFailed(errno));\n\n }\n\n }\n\n}\n", "file_path": "Environment.cpp", "rank": 57, "score": 31331.336411212447 }, { "content": "namespace ErrorPrintout {\n\n void handle(const CommandLine&, const EnvironmentSetupError& e) noexcept;\n\n void handle(const CommandLine&, const UsageError& e) noexcept;\n\n void handle(const CommandLine&, const DataStateError& e) noexcept;\n\n void handle(const CommandLine&, const pqxx::failure& e) noexcept;\n\n void handle(const CommandLine&, const std::exception& e) noexcept;\n\n void handle(const CommandLine&, const UnknownException& e) noexcept;\n", "file_path": "ErrorPrintout.h", "rank": 58, "score": 30003.558935451856 }, { "content": "}\n\nconst char* UsageError::what() const noexcept {\n\n return \"invalid usage\";\n\n}\n\nconst UsageError::Variant& UsageError::variant() const noexcept {\n\n return m_variant;\n\n}\n\nBadEnvVar::BadEnvVar(std::string_view badVariable) noexcept\n\n : m_badVariable(badVariable) {\n\n}\n\nconst char* BadEnvVar::variable() const noexcept {\n\n return m_badVariable;\n\n}\n\nSetEnvFailed::SetEnvFailed(int errNo) noexcept\n\n : m_errNo(errNo) {\n\n}\n\nint SetEnvFailed::errNo() const noexcept {\n\n return m_errNo;\n\n}\n\nEnvironmentSetupError::EnvironmentSetupError(Variant variant) noexcept\n", "file_path": "Error.cpp", "rank": 59, "score": 29467.31583061631 }, { "content": "#include \"Error.h\"\n\n#include <cstdio>\n\n\n\nMissingArgument::MissingArgument(Variant action, std::string_view option) noexcept\n\n : ActionMisuseNoShorthand(std::move(action)), m_option(option) {\n\n}\n\nconst char* MissingArgument::option() const noexcept {\n\n return m_option;\n\n}\n\nInvalidArgument::InvalidArgument(Variant action, std::string_view option, std::string_view argument) noexcept\n\n : ActionMisuseNoShorthand(std::move(action)), m_option(option), m_argument(argument) {\n\n}\n\nconst char* InvalidArgument::option() const noexcept {\n\n return m_option;\n\n}\n\nconst char* InvalidArgument::argument() const noexcept {\n\n return m_argument;\n\n}\n\nUsageError::UsageError(Variant variant) noexcept\n\n : m_variant(std::move(variant)) {\n", "file_path": "Error.cpp", "rank": 60, "score": 29462.752217484976 }, { "content": " : m_variant(std::move(variant)) {\n\n}\n\nconst EnvironmentSetupError::Variant& EnvironmentSetupError::variant() const noexcept {\n\n return m_variant;\n\n}\n\nconst char* EnvironmentSetupError::what() const noexcept {\n\n return \"environment setup error\";\n\n};\n\nDataStateError::DataStateError(DataVariant data, ErrorType errorType) noexcept\n\n : m_data(std::move(data)), m_errorType(errorType) {\n\n}\n\nconst DataStateError::DataVariant& DataStateError::data() const noexcept {\n\n return m_data;\n\n}\n\nDataStateError::ErrorType DataStateError::type() const noexcept {\n\n return m_errorType;\n\n}\n\nconst char* DataStateError::what() const noexcept {\n\n return \"data state error\";\n\n}\n", "file_path": "Error.cpp", "rank": 61, "score": 29456.45871444657 }, { "content": "UpdateSpecificationError::UpdateSpecificationError(std::string_view word) noexcept\n\n : m_word(word) {\n\n}\n\nconst char* UpdateSpecificationError::word() const noexcept {\n\n return m_word;\n\n}\n\nconst char* UpdateSpecificationError::what() const noexcept {\n\n static_assert(std::is_same_v<decltype(m_word), SafeString>, \"buffer size determination not valid\");\n\n static std::array<char, SafeString::maxStringLength + 100 /* for context text */> buf;\n\n std::sprintf(buf.data(), \"nothing specified to be updated for entry (word=%s)\",\n\n static_cast<const char*>(m_word));\n\n return buf.data();\n\n}\n", "file_path": "Error.cpp", "rank": 62, "score": 29452.21221429835 }, { "content": "struct NoAction {};\n\n\n", "file_path": "Error.h", "rank": 63, "score": 29447.125808920577 }, { "content": "// === UnknownException, to signal catch(...) ===\n\nstruct UnknownException {};\n\n\n", "file_path": "Error.h", "rank": 71, "score": 27472.465989677115 }, { "content": "// === DataStateError ===\n\nstruct WordData {};\n", "file_path": "Error.h", "rank": 72, "score": 27472.20461564933 }, { "content": "struct TagData {};\n\ntemplate<typename DataKind>\n", "file_path": "Error.h", "rank": 73, "score": 27469.253558278826 }, { "content": "#include \"MyDictionaryApi.h\"\n\n#include \"EntryQuery.h\"\n\n#include \"SetMatcher.h\"\n\n#include \"Error.h\"\n\n#include <iostream>\n\n#include <algorithm>\n\n#include <pqxx/pqxx>\n\n\n\n// XXX: The pqxx::transaction constructor sends SQL BEGIN [...], commit()\n\n// sends COMMIT, destroying without committing sends ROLLBACK.\n\n\n\n// Use Repeatable Read isolation and lock tables before first \"real\" SQL command\n\n// to ensure the transaction 1) is serialized, 2) sees the latest data state.\n\n\n\n#define LOCK_TABLES \"LOCK TABLE entries, tags, word_tag, word_modified\"\n\n\n\n// TODO: perhaps use less restrictive lock mode for reads\n\n#define R_TXN(CONN_VAR, TXN_VAR) \\\n\n pqxx::connection CONN_VAR{}; \\\n\n pqxx::transaction<pqxx::repeatable_read, pqxx::write_policy::read_only> TXN_VAR{CONN_VAR}; \\\n", "file_path": "MyDictionaryApi.cpp", "rank": 74, "score": 9.32637420691923 }, { "content": "#include <iostream>\n\n#include <cstdlib>\n\n#include <cstring>\n\n#include <memory>\n\n#include \"Error.h\"\n\n#include \"CommandLine.h\"\n\n#include \"Actions.h\"\n\n#include \"Options.h\"\n\n#include \"Environment.h\"\n\n#include \"ErrorPrintout.h\"\n\n#include <pqxx/pqxx>\n\n\n\nstatic void dispatch(const CommandLine& commandLine);\n\nstatic std::unique_ptr<Action> getAction(std::string_view from);\n\n\n\nint main(int argc, char* argv[]) {\n\n const CommandLine commandLine(argc, argv);\n\n try {\n\n setupEnvironment();\n\n dispatch(commandLine);\n", "file_path": "Main.cpp", "rank": 75, "score": 9.059406667351045 }, { "content": " q += \"definition = \" + t.quote(*newDefinition);\n\n }\n\n q += \" WHERE word = \" + t.quote(word);\n\n q += \" RETURNING word\";\n\n try {\n\n t.exec1(q);\n\n }\n\n catch (const pqxx::unexpected_rows& ) {\n\n throw DataStateError(DataStateError::WordData(word),\n\n\t\t\t DataStateError::MISSING);\n\n }\n\n }\n\n t.commit();\n\n}\n\nvoid MD_updateTag(std::string_view old, std::string_view next) {\n\n RW_TXN(c, t);\n\n auto q =\n\n \"UPDATE tags SET tag = \" + t.quote(next) + \" WHERE tag = \" + t.quote(old) +\n\n \" RETURNING tag\";\n\n try {\n", "file_path": "MyDictionaryApi.cpp", "rank": 76, "score": 6.840184990590961 }, { "content": " t.exec1(q);\n\n }\n\n catch (const pqxx::unexpected_rows& ) {\n\n throw DataStateError(DataStateError::TagData(old),\n\n\t\t\t DataStateError::MISSING);\n\n }\n\n t.commit();\n\n}\n\nvoid MD_deleteEntry(std::string_view word) {\n\n RW_TXN(c, t);\n\n auto q =\n\n \"DELETE FROM entries\"\n\n \" WHERE word = \" + t.quote(word) +\n\n \" RETURNING word\";\n\n try {\n\n t.exec1(q);\n\n }\n\n catch (const pqxx::unexpected_rows& ) {\n\n throw DataStateError(DataStateError::WordData(word),\n\n\t\t\t DataStateError::MISSING);\n", "file_path": "MyDictionaryApi.cpp", "rank": 77, "score": 6.752366030462089 }, { "content": "#include \"Actions.h\"\n\n#include \"CommandLine.h\"\n\n#include \"MyDictionaryApi.h\"\n\n#include \"Error.h\"\n\n#include \"Entry.h\"\n\n#include \"EntryOutput.h\"\n\n#include \"SimilarCheck.h\"\n\n#include \"CommandLineParsing.h\"\n\n#include \"Options.h\"\n\n#include \"StringViewOutput.h\"\n\n#include <optional>\n\n#include <utility>\n\n#include <iostream>\n\n\n\nvoid AddAction::execute(const CommandLine& commandLine) {\n\n std::optional<std::string> word, definition;\n\n bool nocheck = false;\n\n std::vector<std::string> tag;\n\n\n\n for (int i = 1; i < commandLine.args.size(); ) {\n", "file_path": "Actions.cpp", "rank": 78, "score": 6.286599635724003 }, { "content": " }\n\n t.commit();\n\n}\n\nvoid MD_deleteTag(std::string_view tag) {\n\n RW_TXN(c, t);\n\n auto q =\n\n \"DELETE FROM tags\"\n\n \" WHERE tag = \" + t.quote(tag) +\n\n \" RETURNING tag\";\n\n try {\n\n t.exec1(q);\n\n }\n\n catch (const pqxx::unexpected_rows& ) {\n\n throw DataStateError(DataStateError::TagData(tag),\n\n\t\t\t DataStateError::MISSING);\n\n }\n\n t.commit();\n\n}\n", "file_path": "MyDictionaryApi.cpp", "rank": 79, "score": 6.276606261127323 }, { "content": "#pragma once\n\n#include <string>\n\n#include <array>\n\n#include <string_view>\n\n\n\n/**\n\n * Noexcept limited length string.\n\n */\n", "file_path": "SafeString.h", "rank": 80, "score": 6.184360073987694 }, { "content": "#include \"SafeString.h\"\n\n#include <cstdio>\n\n#include <cstdarg>\n\n\n\nSafeString::SafeString() noexcept {\n\n m_buffer.front() = '\\0';\n\n}\n\nSafeString::SafeString(std::string_view string) noexcept {\n\n if (string.size() > maxMessageLength) {\n\n std::copy(string.begin(), string.begin() + maxMessageLength, m_buffer.begin());\n\n std::strcpy(m_buffer.data() + maxMessageLength, truncationString);\n\n }\n\n else {\n\n std::copy(string.begin(), string.end(), m_buffer.begin());\n\n *(m_buffer.begin() + string.size()) = '\\0';\n\n }\n\n}\n\nSafeString::operator const char*() const noexcept {\n\n return m_buffer.data();\n\n}\n", "file_path": "SafeString.cpp", "rank": 81, "score": 6.159801969368827 }, { "content": " TXN_VAR.exec0(LOCK_TABLES)\n\n\n\n#define RW_TXN(CONN_VAR, TXN_VAR) \\\n\n pqxx::connection CONN_VAR{}; \\\n\n pqxx::transaction<pqxx::repeatable_read, pqxx::write_policy::read_write> TXN_VAR{CONN_VAR}; \\\n\n TXN_VAR.exec0(LOCK_TABLES)\n\n\n\n// TODO: what's the best similarity number? use incorporate phonetic checking?\n\nstatic const std::string similarityThreshold = \"0.65\";\n\n\n\nvoid MD_createEntry(const Entry& entry) {\n\n RW_TXN(c, t);\n\n std::string q;\n\n q =\n\n \"INSERT INTO entries (word, definition)\"\n\n \" VALUES (\" + t.quote(entry.word) + \", \" + t.quote(entry.definition) + \")\";\n\n try {\n\n t.exec0(q);\n\n }\n\n catch (const pqxx::unique_violation& ) {\n", "file_path": "MyDictionaryApi.cpp", "rank": 82, "score": 5.688480030030232 }, { "content": " \" WHERE word = \" + t.quote(word) + \" AND tag = \" + t.quote(tag) +\n\n \" RETURNING word\";\n\n try {\n\n t.exec1(q);\n\n }\n\n catch (const pqxx::unexpected_rows& ) {\n\n throw DataStateError(DataStateError::WordTagData(word, tag),\n\n\t\t\t DataStateError::MISSING);\n\n }\n\n }\n\n if (newWord || newDefinition) {\n\n std::string q;\n\n q += \"UPDATE entries SET \";\n\n if (newWord) {\n\n q += \"word = \" + t.quote(*newWord);\n\n }\n\n if (newWord && newDefinition) {\n\n q += \", \";\n\n }\n\n if (newDefinition) {\n", "file_path": "MyDictionaryApi.cpp", "rank": 83, "score": 5.650377060100395 }, { "content": "#include \"Options.h\"\n\n#include \"CommandLine.h\"\n\n#include \"Error.h\"\n\n#include <type_traits>\n\n#include <string>\n\n#include <sstream>\n\n\n\n// This file does some compile time validation to ensure the set of options have certain\n\n// properties. Namely that a given string can match one and only one option.\n\n// This validation depends on the options being in a certain format which is also statically confirmed.\n\n\n\n#define CHECK_OPT(s, opt) ([&]() {\\\n\n constexpr auto _idx = opt_indexOf((opt)); \\\n\n static_assert(_idx != opt_npos); \\\n\n if constexpr (_idx < opt_abbrevStartIdx) return ((s) == (opt)); \\\n\n else return isPrefix<_idx>((s)); }())\n\n\n\nstatic constexpr const char* opts[] = {\n\n // can't abbreviate\n\n \"add\", \"rm\", \"find\", \"tags\", \"edit\", \"help\", \"-f\", \"-ff\", \"-fff\", \"-h\",\n", "file_path": "Options.cpp", "rank": 84, "score": 5.206308066833983 }, { "content": " return 0;\n\n }\n\n catch (const EnvironmentSetupError& e) {\n\n ErrorPrintout::handle(commandLine, e);\n\n }\n\n catch (const UsageError& e) {\n\n ErrorPrintout::handle(commandLine, e);\n\n }\n\n catch (const DataStateError& e) {\n\n ErrorPrintout::handle(commandLine, e);\n\n }\n\n catch (const pqxx::failure& e) { // database runtime error\n\n ErrorPrintout::handle(commandLine, e);\n\n }\n\n catch (const std::exception& e) {\n\n ErrorPrintout::handle(commandLine, e);\n\n }\n\n catch (...) {\n\n ErrorPrintout::handle(commandLine, UnknownException());\n\n }\n", "file_path": "Main.cpp", "rank": 85, "score": 5.070453151196947 }, { "content": "#include \"StringViewOutput.h\"\n\n#include <limits>\n\n\n\nint StringViewOutput::size(std::string_view string) noexcept {\n\n if (string.size() > std::numeric_limits<int>::max()) {\n\n return std::numeric_limits<int>::max();\n\n }\n\n return static_cast<int>(string.size());\n\n}\n\nconst char* StringViewOutput::c_str(std::string_view string) noexcept {\n\n return string.data();\n\n}\n", "file_path": "StringViewOutput.cpp", "rank": 86, "score": 4.6764410900982565 }, { "content": "\n\n q = \"INSERT INTO word_tag (word, tag)\"\n\n\t\" VALUES (\" + t.quote(word) + \", \" + t.quote(tag) + \")\";\n\n try {\n\n t.exec0(q);\n\n }\n\n catch (const pqxx::unique_violation& ) {\n\n // word/tag combo already exists\n\n throw DataStateError(DataStateError::WordTagData(word, tag),\n\n\t\t\t DataStateError::ALREADY_PRESENT);\n\n }\n\n catch (const pqxx::foreign_key_violation& ) {\n\n // word doesn't exist (tag must exist since it was just added)\n\n throw DataStateError(DataStateError::WordData(word),\n\n\t\t\t DataStateError::MISSING);\n\n }\n\n }\n\n for (const auto& tag : rmTags) {\n\n std::string q;\n\n q = \"DELETE FROM word_tag\"\n", "file_path": "MyDictionaryApi.cpp", "rank": 87, "score": 4.1322911507030105 }, { "content": "#include \"CommandLine.h\"\n\n\n\nstatic std::string_view basename_nonModifying(char* path) noexcept;\n\n\n\nCommandLine::CommandLine(int _argc, char* _argv[]) noexcept\n\n : args(_argc, _argv),\n\n argc(_argc),\n\n argv(_argv) {\n\n if (_argv[0] != nullptr && _argv[0][0] != '\\0') {\n\n programName = _argv[0];\n\n baseProgramName = basename_nonModifying(_argv[0]);\n\n }\n\n}\n\nCommandLine::Args::Args(int argc, char** argv) noexcept\n\n : m_size(argc == 0 ? 0 : argc - 1),\n\n m_vector(argv) {\n\n}\n\nint CommandLine::Args::size() const noexcept {\n\n return m_size;\n\n}\n", "file_path": "CommandLine.cpp", "rank": 88, "score": 4.100799005239324 }, { "content": "#pragma once\n\n#include \"EntryFormat.h\"\n\n#include \"Entry.h\"\n\n#include <string>\n\n#include <vector>\n\n#include <pqxx/pqxx>\n\n\n", "file_path": "EntryQuery.h", "rank": 89, "score": 3.8148632243071154 }, { "content": "## Testing\n\nThe test script runs a series of `mydict` commands and checks if their output is what's expected:\n\n\n\n # set the database to be used (warning, MyDictionary related tables will be cleared) \n\n $ export MYDICTTEST_DB=\"my_test_database\"\n\n $ cd tests\n\n $ ./test-cmd-line.sh\n\n \n\n## License\n\n\n\nSee [LICENSE](LICENSE.txt).\n", "file_path": "README.md", "rank": 90, "score": 3.649887732904493 }, { "content": "# MyDictionary\n\n\n\nMyDictionary is a command line personal dictionary for those hard-to-remember words, terms, and acronyms.\n\n\n\nIf you often find yourself thinking things like, \"What does Synergistic Leverage Ratio mean again?\", and \"I wish I \n\nremembered what ICBINB stood for,\" then MyDictionary may be for you. Add words to your dictionary. Give them definitions\n\nand tags. Then use the flexible search and viewing options when you're scratching your head over a piece of terminology\n\nlater. MyDictionary's goal is to make life easier by making the information you need closer.\n\n\n\n## Building\n\nTo build, you'll need to be in a POSIX environment and have the following installed:\n\n* A C++ 17 compiler\n\n* Make\n\n* pkg-config\n\n* [libpqxx](https://github.com/jtv/libpqxx) (tested with version 7.2)\n\n\n\nOnce the dependencies are in place, from within the top-level directory of the project, run:\n\n\n\n $ make\n\n\n\nIf all went well, you should have an executable file `mydict` in the same directory. Execute `$ mydict help` to get a\n\ndetailed listing of MyDictionary's behavior, and the subcommands available to you.\n\n\n\n## Running\n\nBefore running, a PostgreSQL connection must be configured. First, attach to the database you want to hold MyDictionary's data, and\n\nrun the provided `Tables.sql` script. For example:\n\n\n\n $ psql -U myuser -d mydb -f Tables.sql\n\n\n\nThen in your environment, set variables in the form `MYDICT_FOO`. MyDictionary will then set in its environment `PGFOO`.\n\nNotice `PGFOO` is the format of [PostgreSQL environment variables](https://www.postgresql.org/docs/current/libpq-envars.html). So in this manner\n\nMyDictionary's database connection may be controlled.\n\n\n\n(Note, above tested with PostgreSQL server version 13.)\n\n\n\n## Examples\n\nAdd an entry to the dictionary:\n\n\n\n $ mydict add -word \"TPS Report\" -tag \"reports\" -tag \"quality assurance\" \\\n\n -def \"Test Procedure Set Report. Standard reporting document for RFC 1149. Must have cover sheet.\"\n\n \n\nList all entries with the tag \"reports\":\n\n\n\n $ mydict find -tag \"reports\"\n\n \n", "file_path": "README.md", "rank": 91, "score": 3.6173309931526347 }, { "content": " }\n\n else {\n\n throw actionUsageError<GeneralActionMisuse>(this);\n\n }\n\n}\n\nvoid TagsAction::execute(const CommandLine& commandLine) {\n\n if (commandLine.args.size() > 1 && matches(commandLine.args[1], Opt::_h)) {\n\n std::fprintf(stdout, TAGS_USAGE \"\\n\", C_STR(commandLine.baseProgramName));\n\n return;\n\n }\n\n else if (commandLine.args.size() == 1) {\n\n const auto tags = MD_readTags();\n\n for (const auto& tag : tags) {\n\n std::cout << tag << std::endl;\n\n }\n\n }\n\n else {\n\n throw actionUsageError<GeneralActionMisuse>(this);\n\n }\n\n}\n", "file_path": "Actions.cpp", "rank": 92, "score": 3.358915809872052 }, { "content": "#include \"Interactive.h\"\n\n#include <unistd.h>\n\n\n\nbool isInteractive(FILE* file) {\n\n return isatty(fileno(file));\n\n}\n", "file_path": "Interactive.cpp", "rank": 93, "score": 3.2836352988622592 }, { "content": "#include \"SimilarCheck.h\"\n\n#include \"MyDictionaryApi.h\"\n\n#include \"Interactive.h\"\n\n#include <iostream>\n\n#include <cctype>\n\n#include <optional>\n\n#include <utility>\n\n\n\nstatic bool isWhiteSpace(char c) {\n\n return std::isspace(static_cast<unsigned char>(c));\n\n}\n\n// returns iterator pointing to token beginning and token length (TODO: c++20 return string_view)\n\n// e.g. \" abc \" returns first == itr to a, second = 3\n\n// \" abc efg \" returns nullopt\n\nstatic std::optional<std::pair<std::string::const_iterator, std::size_t>> singleToken(const std::string& str) {\n\n auto it = str.begin();\n\n while (it != str.end() && isWhiteSpace(*it)) {\n\n ++it;\n\n }\n\n if (it == str.end()) {\n", "file_path": "SimilarCheck.cpp", "rank": 94, "score": 3.2415466258800247 }, { "content": "#include \"Entry.h\"\n\n\n\n// WORD\n\n// DEFINITON\n\n// [TAG1, TAG2 ...]\n\n// Created: ADSAFDA, Modified: ADFFS\n\nstd::ostream& operator<<(std::ostream& o, const Entry& entry) {\n\n o << entry.word << \"\\n\";\n\n\n\n if (entry.definition != \"\") {\n\n o << \"\\t\" << entry.definition << \"\\n\";\n\n }\n\n const auto tagCount = entry.tags.size();\n\n\n\n if (tagCount != 0) {\n\n auto written = Entry::TagList::size_type(0);\n\n o << \"[\";\n\n for (const auto& tag : entry.tags) {\n\n o << tag;\n\n if (written++ != tagCount - 1) {\n", "file_path": "Entry.cpp", "rank": 95, "score": 3.173926502869907 }, { "content": "#pragma once\n\n#include \"Action.h\"\n\n\n", "file_path": "Actions.h", "rank": 96, "score": 3.1243725782533422 }, { "content": " EntryQuery eq(format);\n\n SetMatcher sm(t, tags, \"tag = TAG\", \"TAG\");\n\n const auto q =\n\n \"SELECT \" + eq.select() +\n\n \" FROM entries LEFT OUTER JOIN word_tag wt\"\n\n \" USING (word)\"\n\n \" WHERE word IN\"\n\n \" (SELECT word FROM word_tag\"\n\n \" WHERE \" + sm.condition() + \")\"\n\n \" ORDER BY word\";\n\n const auto result = t.exec(q); t.commit();\n\n return eq.extract(result);\n\n}\n\nstd::vector<Entry> MD_readEntriesWordMatch(std::string_view pattern, EntryFormat format) {\n\n R_TXN(c, t);\n\n EntryQuery eq(format);\n\n const auto q =\n\n \"SELECT \" + eq.select() +\n\n \" FROM entries LEFT OUTER JOIN word_tag\"\n\n \" USING (word)\"\n", "file_path": "MyDictionaryApi.cpp", "rank": 97, "score": 3.1164239493300867 }, { "content": "void MD_createEntry(const Entry& entry);\n", "file_path": "MyDictionaryApi.h", "rank": 98, "score": 2.9675666322582694 }, { "content": " }\n\n else {\n\n throw actionUsageError<GeneralActionMisuse>(this);\n\n }\n\n}\n\n// already showing help so just ignore any extra/wrong arguments\n\nvoid HelpAction::execute(const CommandLine& commandLine) {\n\n if (commandLine.args.size() > 1) {\n\n if (matches(commandLine.args[1], Opt::add)) {\n\n std::fprintf(stdout, ADD_USAGE \"\\n\", C_STR(commandLine.baseProgramName));\n\n }\n\n else if (matches(commandLine.args[1], Opt::rm)) {\n\n std::fprintf(stdout, RM_USAGE \"\\n\", C_STR(commandLine.baseProgramName));\n\n }\n\n else if (matches(commandLine.args[1], Opt::find)) {\n\n std::fprintf(stdout, FIND_USAGE \"\\n\", C_STR(commandLine.baseProgramName));\n\n }\n\n else if (matches(commandLine.args[1], Opt::tags)) {\n\n std::fprintf(stdout, TAGS_USAGE \"\\n\", C_STR(commandLine.baseProgramName));\n\n }\n", "file_path": "Actions.cpp", "rank": 99, "score": 2.8874453923188153 } ]
C++
AltTabber/Gui.cpp
alzwded/AltTabber
9da50d23f5e132e9133ecea0093fe1b02ed01fc6
#include "stdafx.h" #include "AltTabber.h" #include <WinUser.h> extern ProgramState_t g_programState; extern void log(LPTSTR fmt, ...); extern MonitorGeom_t GetMonitorGeometry(); static inline BOOL IsAltTabWindow(HWND hwnd) { if(!IsWindowVisible(hwnd)) return FALSE; TCHAR str[MAX_PATH + 1]; GetWindowText(hwnd, str, MAX_PATH); log(_T("window %ls has style %lX and exstyle %lX\n"), str, GetWindowLong(hwnd, GWL_STYLE), GetWindowLong(hwnd, GWL_EXSTYLE)); log(_T("parent: %p\n"), GetParent(hwnd)); HWND hwndTry, hwndWalk = NULL; hwndTry = GetAncestor(hwnd, GA_ROOTOWNER); while(hwndTry != hwndWalk) { hwndWalk = hwndTry; hwndTry = GetLastActivePopup(hwndWalk); if(IsWindowVisible(hwndTry)) break; } if(hwndWalk != hwnd) return FALSE; #if 0 TITLEBARINFO ti; ti.cbSize = sizeof(ti); GetTitleBarInfo(hwnd, &ti); if(ti.rgstate[0] & STATE_SYSTEM_INVISIBLE) return FALSE; #endif if(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) return FALSE; if(GetWindowLong(hwnd, GWL_STYLE) & WS_CHILD) return FALSE; #if 0 LONG style = GetWindowLong(hwnd, GWL_EXSTYLE); if((style & (WS_VISIBLE | WS_EX_TOOLWINDOW | WS_POPUP | WS_CAPTION | WS_DLGFRAME | WS_OVERLAPPED | WS_TILED | WS_SYSMENU | WS_THICKFRAME )) == 0) { return FALSE; } #endif return TRUE; } static BOOL GetImagePathName(HWND hwnd, std::wstring& imagePathName) { BOOL hr = 0; TCHAR str2[MAX_PATH + 1]; DWORD procId; if(GetWindowThreadProcessId(hwnd, &procId) > 0) { auto hnd = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, procId); if(hnd != NULL) { UINT len; if((len = GetModuleFileNameEx(hnd, NULL, str2, MAX_PATH)) > 0) { imagePathName.assign(&str2[0], &str2[len]); hr = 1; } else { log(_T("GetModuleFileNameEx failed: %u errno %d\n"), len, GetLastError()); } CloseHandle(hnd); } } return hr; } static BOOL CALLBACK enumWindows(HWND hwnd, LPARAM lParam) { if(hwnd == g_programState.hWnd) return TRUE; if(!IsAltTabWindow(hwnd)) return TRUE; std::wstring filter = *((std::wstring const*)lParam); TCHAR str[257]; GetWindowText(hwnd, str, 256); std::wstring title(str); std::wstring imagePathName; if(GetImagePathName(hwnd, imagePathName)) { std::wstringstream wss; wss << imagePathName << std::wstring(L" // ") << title; title = wss.str(); } log(_T("the label is: %ls\n"), title.c_str()); std::transform(title.begin(), title.end(), title.begin(), ::tolower); std::transform(filter.begin(), filter.end(), filter.begin(), ::tolower); if(!filter.empty() && title.find(filter) == std::wstring::npos) { return TRUE; } HMONITOR hMonitor = NULL; if(g_programState.compatHacks & JAT_HACK_DEXPOT) { hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONULL); if(!hMonitor) return TRUE; } else { hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); } HTHUMBNAIL hThumb = NULL; auto hr = DwmRegisterThumbnail(g_programState.hWnd, hwnd, &hThumb); log(_T("register thumbnail for %p on monitor %p: %d\n"), (void*)hwnd, (void*)hMonitor, hr); if(hr == S_OK) { AppThumb_t at = { APP_THUMB_AERO, hwnd, }; at.thumb = hThumb; g_programState.thumbnails[hMonitor].push_back(at); } else { AppThumb_t at = { APP_THUMB_COMPAT, hwnd, }; HICON hIcon = NULL; hIcon = (HICON)GetClassLongPtr(hwnd, GCLP_HICON); if(!hIcon) { DWORD_PTR lresult; UINT sleepAmount = (g_programState.sleptThroughNWindows < 5) ? 50 : (g_programState.sleptThroughNWindows < 10) ? 25 : (g_programState.sleptThroughNWindows < 20) ? 10 : 5; auto hr = SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG | SMTO_ERRORONEXIT, sleepAmount , &lresult); if(hr) { g_programState.sleptThroughNWindows++; hIcon = (HICON)lresult; } else { log(_T("Sending WM_GETICON to %ld failed; lresult %ld errno %d\n"), hwnd, lresult, GetLastError()); } } at.icon = hIcon; g_programState.thumbnails[hMonitor].push_back(at); } return TRUE; } void PurgeThumbnails() { for(auto i = g_programState.thumbnails.begin(); i != g_programState.thumbnails.end(); ++i) { auto thumbs = i->second; decltype(thumbs) rest(thumbs.size()); std::remove_copy_if( thumbs.begin(), thumbs.end(), std::inserter(rest, rest.end()), [](AppThumb_t const& thumb) -> bool { return thumb.type != APP_THUMB_AERO; }); std::for_each(rest.begin(), rest.end(), [](AppThumb_t const& thumb) { DwmUnregisterThumbnail(thumb.thumb); }); } g_programState.thumbnails.clear(); } void CreateThumbnails(std::wstring const& filter) { PurgeThumbnails(); auto hDesktop = OpenInputDesktop(0, FALSE, GENERIC_READ); if(!hDesktop) { log(_T("open desktop failed; errno = %d\n"), GetLastError()); return; } g_programState.sleptThroughNWindows = 0; auto hr = EnumDesktopWindows(hDesktop, enumWindows, (LPARAM)&filter); CloseDesktop(hDesktop); log(_T("enum desktop windows: %d\n"), hr); } template<typename F> void PerformSlotting(F&& functor) { auto mis = GetMonitorGeometry(); for(size_t i = 0; i < mis.monitors.size(); ++i) { auto& mi = mis.monitors[i]; auto& thumbs = g_programState.thumbnails[mi.hMonitor]; auto nWindows = thumbs.size(); unsigned int nTiles = 1; while(nTiles < nWindows) nTiles <<= 1; if(nTiles != nWindows) nTiles = max(1, nTiles >> 1); long lala = (long)(sqrt((double)nTiles) + 0.5); long l1 = lala; long l2 = lala; while(((unsigned)l1) * ((unsigned)l2) < nWindows) l1++; lala = l1 * l2; long ws = (mi.extent.right - mi.extent.left) / l1; long hs = (mi.extent.bottom - mi.extent.top) / l2; for(size_t j = 0; j < thumbs.size(); ++j) { functor(mi, j, l1, l2, hs, ws); } } } void SetThumbnails() { g_programState.activeSlot = -1; g_programState.slots.clear(); size_t nthSlot = 0; MonitorGeom_t mis = GetMonitorGeometry(); PerformSlotting([&](MonitorInfo_t& mi, size_t j, long l1, long, long hs, long ws) { AppThumb_t& thumb = g_programState.thumbnails[mi.hMonitor][j]; long x = ((long)j % l1) * ws + 3; long y = ((long)j / l1) * hs + hs / 3 + 3; long x1 = x + ws - 6; long y1 = y + hs - hs / 3 - 6; RECT r; r.left = mi.extent.left - mis.r.left + x; r.right = mi.extent.left - mis.r.left + x1; r.top = mi.extent.top - mis.r.top + y; r.bottom = mi.extent.top - mis.r.top + y1; if(thumb.type == APP_THUMB_AERO) { DWM_THUMBNAIL_PROPERTIES thProps; thProps.dwFlags = DWM_TNP_RECTDESTINATION | DWM_TNP_VISIBLE; SIZE ws; HRESULT haveThumbSize = DwmQueryThumbnailSourceSize(thumb.thumb, &ws); if(haveThumbSize == S_OK) { SIZE rs; rs.cx = r.right - r.left; rs.cy = r.bottom - r.top; RECT dRect; dRect.left = r.left; dRect.top = r.top; float rRap = (float)rs.cx / (float)rs.cy; float sRap = (float)ws.cx / (float)ws.cy; if(sRap > rRap) { dRect.right = r.right; LONG h = (LONG)(rs.cx / sRap); LONG delta = (rs.cy - h) / 2; dRect.top += delta; dRect.bottom = dRect.top + h; } else { dRect.bottom = r.bottom; LONG w = (LONG)(rs.cy * sRap); LONG delta = (rs.cx - w) / 2; dRect.left += delta; dRect.right = dRect.left + w; } thProps.rcDestination = dRect; } else { thProps.rcDestination = r; log(_T("DwmQueryThumbnailSourceSize failed %d: errno %d\n"), haveThumbSize, GetLastError()); } thProps.fVisible = TRUE; DwmUpdateThumbnailProperties(thumb.thumb, &thProps); } if(thumb.hwnd == g_programState.prevActiveWindow) { g_programState.activeSlot = (long)nthSlot; } SlotThing_t st; st.hwnd = thumb.hwnd; st.r.left = mi.extent.left - mis.r.left + (j % l1) * ws; st.r.top = mi.extent.top - mis.r.top + ((long)j / l1) * hs; st.r.right = st.r.left + ws; st.r.bottom = st.r.top + hs; st.moveUpDownAmount = l1; g_programState.slots.push_back(st); ++nthSlot; }); if(g_programState.activeSlot < 0 && g_programState.slots.size() > 0) { g_programState.activeSlot = 0; } } void OnPaint(HDC hdc) { HGDIOBJ original = NULL; original = SelectObject(hdc, GetStockObject(DC_PEN)); auto originalBrush = SelectObject(hdc, GetStockObject(DC_BRUSH)); SelectObject(hdc, GetStockObject(DC_BRUSH)); LONG fSize = 12l; fSize = MulDiv(fSize, GetDeviceCaps(hdc, LOGPIXELSY), 72); if(fSize != 12l) log(_T("font size scaled to %ld\n"), fSize); HFONT font = CreateFont( fSize, 0, 0, 0, 0, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, DEFAULT_PITCH | FF_DONTCARE, _T("Courier New")); HFONT originalFont = (HFONT)SelectObject(hdc, font); auto mis = GetMonitorGeometry(); SetDCBrushColor(hdc, RGB(0, 0, 0)); log(_T("rectangle is %ld %ld %ld %ld\n"), mis.r.left, mis.r.top, mis.r.right, mis.r.bottom); RECT winRect; GetWindowRect(g_programState.hWnd, &winRect); log(_T("window rect %ld %ld %ld %ld\n"), winRect.left, winRect.top, winRect.right, winRect.bottom); auto hrRectangle = Rectangle(hdc, 0, 0, winRect.right - winRect.left, winRect.bottom - winRect.top); log(_T("rectangle returned %d: errno %d\n"), hrRectangle, GetLastError()); SetDCBrushColor(hdc, RGB(255, 0, 0)); if(g_programState.activeSlot >= 0) { RECT r = (g_programState.slots[g_programState.activeSlot]).r; Rectangle(hdc, r.left, r.top, r.right, r.bottom); } SelectObject(hdc, GetStockObject(WHITE_BRUSH)); SelectObject(hdc, GetStockObject(BLACK_PEN)); int prevBkMode = SetBkMode(hdc, TRANSPARENT); PerformSlotting([&](MonitorInfo_t& mi, size_t j, long l1, long, long hs, long ws) { AppThumb_t& thumb = g_programState.thumbnails[mi.hMonitor][j]; HWND hwnd = thumb.hwnd; long x = ((long)j % l1) * ws + 3; long y = ((long)j / l1) * hs + 3; long x1 = x + ws - 6; long y1 = y + hs - 2 * hs / 3 - 6; RECT r; r.left = mi.extent.left - mis.r.left + x; r.right = mi.extent.left - mis.r.left + x1; r.top = mi.extent.top - mis.r.top + y; r.bottom = mi.extent.top - mis.r.top + y1; TCHAR str[257]; GetWindowText(hwnd, str, 256); std::wstring title(str); Rectangle(hdc, r.left, r.top, r.right, r.bottom); r.left += 3; r.right -= 6; r.top += 3; r.bottom -= 6; DrawText(hdc, str, -1, &r, DT_BOTTOM | DT_LEFT | DT_WORDBREAK); if(thumb.type == APP_THUMB_COMPAT) { ICONINFO iconInfo; auto hr = GetIconInfo(thumb.icon, &iconInfo); if(!hr) { log(_T("GetIconInfo failed; errno %d\n"), GetLastError()); DrawIcon(hdc, r.left + 3, r.bottom + 6, thumb.icon); } else { BITMAP bmp; ZeroMemory(&bmp, sizeof(BITMAP)); auto nBytes = GetObject(iconInfo.hbmMask, sizeof(BITMAP), &bmp); if(nBytes != sizeof(BITMAP)) { log(_T("failed to retrieve bitmap from hicon for %p; errno %d\n"), (void*)thumb.hwnd, GetLastError()); } SIZE size = { bmp.bmWidth, bmp.bmHeight, }; if(iconInfo.hbmColor != NULL) { size.cy /= 2; } log(_T("bitmap %p size: %ld x %ld\n"), (void*)thumb.icon, size.cx, size.cy); POINT location = { (r.right + r.left) / 2 - size.cx / 2, r.top + 2 * hs / 3 - size.cy, }; DeleteBitmap(iconInfo.hbmColor); DeleteBitmap(iconInfo.hbmMask); DrawIcon(hdc, location.x, location.y, thumb.icon); } } }); DeleteObject(font); SetBkMode(hdc, prevBkMode); SelectObject(hdc, originalFont); SelectObject(hdc, originalBrush); SelectObject(hdc, original); }
#include "stdafx.h" #include "AltTabber.h" #include <WinUser.h> extern ProgramState_t g_programState; extern void log(LPTSTR fmt, ...); extern MonitorGeom_t GetMonitorGeometry(); static inline BOOL IsAltTabWindow(HWND hwnd) { if(!IsWindowVisible(hwnd)) return FALSE; TCHAR str[MAX_PATH + 1]; GetWindowText(hwnd, str, MAX_PATH); log(_T("window %ls has style %lX and exstyle %lX\n"), str, GetWindowLong(hwnd, GWL_STYLE), GetWindowLong(hwnd, GWL_EXSTYLE)); log(_T("parent: %p\n"), GetParent(hwnd)); HWND hwndTry, hwndWalk = NULL; hwndTry = GetAncestor(hwnd, GA_ROOTOWNER); while(hwndTry != hwndWalk) { hwndWalk = hwndTry; hwndTry = GetLastActivePopup(hwndWalk); if(IsWindowVisible(hwndTry)) break; } if(hwndWalk != hwnd) return FALSE; #if 0 TITLEBARINFO ti; ti.cbSize = sizeof(ti); GetTitleBarInfo(hwnd, &ti); if(ti.rgstate[0] & STATE_SYSTEM_INVISIBLE) return FALSE; #endif if(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) return FALSE; if(GetWindowLong(hwnd, GWL_STYLE) & WS_CHILD) return FALSE; #if 0 LONG style = GetWindowLong(hwnd, GWL_EXSTYLE); if((style & (WS_VISIBLE | WS_EX_TOOLWINDOW | WS_POPUP | WS_CAPTION | WS_DLGFRAME | WS_OVERLAPPED | WS_TILED | WS_SYSMENU | WS_THICKFRAME )) == 0) { return FALSE; } #endif return TRUE; } static BOOL GetImagePathName(HWND hwnd, std::wstring& imagePathName) { BOOL hr = 0; TCHAR str2[MAX_PATH + 1]; DWORD procId; if(GetWindowThreadProcessId(hwnd, &procId) > 0) { auto hnd = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, procId); if(hnd != NULL) { UINT len; if((len = GetModuleFileNameEx(hnd, NULL, str2, MAX_PATH)) > 0) { imagePathName.assign(&str2[0], &str2[len]); hr = 1; } else { log(_T("GetModuleFileNameEx failed: %u errno %d\n"), len, GetLastError()); } CloseHandle(hnd); } } return hr; } static BOOL CALLBACK enumWindows(HWND hwnd, LPARAM lParam) { if(hwnd == g_programState.hWnd) return TRUE; if(!IsAltTabWindow(hwnd)) return TRUE; std::wstring filter = *((std::wstring const*)lParam); TCHAR str[257]; GetWindowText(hwnd, str, 256); std::wstring title(str); std::wstring imagePathName; if(GetImagePathName(hwnd, imagePathName)) { std::wstringstream wss; wss << imagePathName << std::wstring(L" // ") << title; title = wss.str(); } log(_T("the label is: %ls\n"), title.c_str()); std::transform(title.begin(), title.end(), title.begin(), ::tolower); std::transform(filter.begin(), filter.end(), filter.begin(), ::tolower); if(!filter.empty() && title.find(filter) == std::wstring::npos) { return TRUE; } HMONITOR hMonitor = NULL; if(g_programState.compatHacks & JAT_HACK_DEXPOT) { hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONULL); if(!hMonitor) return TRUE; } else { hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); } HTHUMBNAIL hThumb = NULL; auto hr = DwmRegisterThumbnail(g_programState.hWnd, hwnd, &hThumb); log(_T("register thumbnail for %p on monitor %p: %d\n"), (void*)hwnd, (void*)hMonitor, hr); if(hr == S_OK) { AppThumb_t at = { APP_THUMB_AERO, hwnd, }; at.thumb = hThumb; g_programState.thumbnails[hMonitor].push_back(at); } else { AppThumb_t at = { APP_THUMB_COMPAT, hwnd, }; HICON hIcon = NULL; hIcon = (HICON)GetClassLongPtr(hwnd, GCLP_HICON); if(!hIcon) { DWORD_PTR lresult; UINT sleepAmount = (g_programState.sleptThroughNWindows < 5) ? 50 : (g_programState.sleptThroughNWindows < 10) ? 25 : (g_programState.sleptThroughNWindows < 20) ? 10 : 5; auto hr = SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG | SMTO_ERRORONEXIT, sleepAmount , &lresult); if(hr) { g_programState.sleptThroughNWindows++; hIcon = (HICON)lresult; } else { log(_T("Sending WM_GETICON to %ld failed; lresult %ld errno %d\n"), hwnd, lresult, GetLastError()); } } at.icon = hIcon; g_programState.thumbnails[hMonitor].push_back(at); } return TRUE; } void PurgeThumbnails() { for(auto i = g_programState.thumbnails.begin(); i != g_programState.thumbnails.end(); ++i) { auto thumbs = i->second; decltype(thumbs) rest(thumbs.size()); std::remove_copy_if( thumbs.begin(), thumbs.end(), std::inserter(rest, rest.end()), [](AppThumb_t const& thumb) -> bool { return thumb.type != APP_THUMB_AERO; }); std::for_each(rest.begin(), rest.end(), [](AppThumb_t const& thumb) { DwmUnregisterThumbnail(thumb.thumb); }); } g_programState.thumbnails.clear(); } void CreateThumbnails(std::wstring const& filter) { PurgeThumbnails(); auto hDesktop = OpenInputDesktop(0, FALSE, GENERIC_READ); if(!hDesktop) { log(_T("open desktop failed; errno = %d\n"), GetLastError()); return; } g_programState.sleptThroughNWindows = 0; auto hr = EnumDesktopWindows(hDesktop, enumWindows, (LPARAM)&filter); CloseDesktop(hDesktop); log(_T("enum desktop windows: %d\n"), hr); } template<typename F> void PerformSlotting(F&& functor) { auto mis = GetMonitorGeometry(); for(size_t i = 0; i < mis.monitors.size(); ++i) { auto& mi = mis.monitors[i]; auto& thumbs = g_programState.thumbnails[mi.hMonitor]; auto nWindows = thumbs.size(); unsigned int nTiles = 1; while(nTiles < nWindows) nTiles <<= 1; if(nTiles != nWindows) nTiles = max(1, nTiles >> 1); long lala = (long)(sqrt((double)nTiles) + 0.5); long l1 = lala; long l2 = lala; while(((unsigned)l1) * ((unsigned)l2) < nWindows) l1++; lala = l1 * l2; long ws = (mi.extent.right - mi.extent.left) / l1; long hs = (mi.extent.bottom - mi.extent.top) / l2; for(size_t j = 0; j < thumbs.size(); ++j) { functor(mi, j, l1, l2, hs, ws); } } } void SetThumbnails() { g_programState.activeSlot = -1; g_programState.slots.clear(); size_t nthSlot = 0; MonitorGeom_t mis = GetMonitorGeometry(); PerformSlotting([&](MonitorInfo_t& mi, size_t j, long l1, long, long hs, long ws) { AppThumb_t& thumb = g_programState.thumbnails[mi.hMonitor][j]; long x = ((long)j % l1) * ws + 3; long y = ((long)j / l1) * hs + hs / 3 + 3; long x1 = x + ws - 6; long y1 = y + hs - hs / 3 - 6; RECT r; r.left = mi.extent.left - mis.r.left + x; r.right = mi.extent.left - mis.r.left + x1; r.top = mi.extent.top - mis.r.top + y; r.bottom = mi.extent.top - mis.r.top + y1; if(thumb.type == APP_THUMB_AERO) { DWM_THUMBNAIL_PROPERTIES thProps; thProps.dwFlags = DWM_TNP_RECTDESTINATION | DWM_TNP_VISIBLE; SIZE ws; HRESULT haveThumbSize = DwmQueryThumbnailSourceSize(thumb.thumb, &ws); if(haveThumbSize == S_OK) { SIZE rs; rs.cx = r.right - r.left; rs.cy = r.bottom - r.top; RECT dRect; dRect.left = r.left; dRect.top = r.top; float rRap = (float)rs.cx / (float)rs.cy; float sRap = (float)ws.cx / (float)ws.cy; if(sRap > rRap) { dRect.right = r.right; LONG h = (LONG)(rs.cx / sRap); LONG delta = (rs.cy - h) / 2; dRect.top += de
rogramState.activeSlot >= 0) { RECT r = (g_programState.slots[g_programState.activeSlot]).r; Rectangle(hdc, r.left, r.top, r.right, r.bottom); } SelectObject(hdc, GetStockObject(WHITE_BRUSH)); SelectObject(hdc, GetStockObject(BLACK_PEN)); int prevBkMode = SetBkMode(hdc, TRANSPARENT); PerformSlotting([&](MonitorInfo_t& mi, size_t j, long l1, long, long hs, long ws) { AppThumb_t& thumb = g_programState.thumbnails[mi.hMonitor][j]; HWND hwnd = thumb.hwnd; long x = ((long)j % l1) * ws + 3; long y = ((long)j / l1) * hs + 3; long x1 = x + ws - 6; long y1 = y + hs - 2 * hs / 3 - 6; RECT r; r.left = mi.extent.left - mis.r.left + x; r.right = mi.extent.left - mis.r.left + x1; r.top = mi.extent.top - mis.r.top + y; r.bottom = mi.extent.top - mis.r.top + y1; TCHAR str[257]; GetWindowText(hwnd, str, 256); std::wstring title(str); Rectangle(hdc, r.left, r.top, r.right, r.bottom); r.left += 3; r.right -= 6; r.top += 3; r.bottom -= 6; DrawText(hdc, str, -1, &r, DT_BOTTOM | DT_LEFT | DT_WORDBREAK); if(thumb.type == APP_THUMB_COMPAT) { ICONINFO iconInfo; auto hr = GetIconInfo(thumb.icon, &iconInfo); if(!hr) { log(_T("GetIconInfo failed; errno %d\n"), GetLastError()); DrawIcon(hdc, r.left + 3, r.bottom + 6, thumb.icon); } else { BITMAP bmp; ZeroMemory(&bmp, sizeof(BITMAP)); auto nBytes = GetObject(iconInfo.hbmMask, sizeof(BITMAP), &bmp); if(nBytes != sizeof(BITMAP)) { log(_T("failed to retrieve bitmap from hicon for %p; errno %d\n"), (void*)thumb.hwnd, GetLastError()); } SIZE size = { bmp.bmWidth, bmp.bmHeight, }; if(iconInfo.hbmColor != NULL) { size.cy /= 2; } log(_T("bitmap %p size: %ld x %ld\n"), (void*)thumb.icon, size.cx, size.cy); POINT location = { (r.right + r.left) / 2 - size.cx / 2, r.top + 2 * hs / 3 - size.cy, }; DeleteBitmap(iconInfo.hbmColor); DeleteBitmap(iconInfo.hbmMask); DrawIcon(hdc, location.x, location.y, thumb.icon); } } }); DeleteObject(font); SetBkMode(hdc, prevBkMode); SelectObject(hdc, originalFont); SelectObject(hdc, originalBrush); SelectObject(hdc, original); }
lta; dRect.bottom = dRect.top + h; } else { dRect.bottom = r.bottom; LONG w = (LONG)(rs.cy * sRap); LONG delta = (rs.cx - w) / 2; dRect.left += delta; dRect.right = dRect.left + w; } thProps.rcDestination = dRect; } else { thProps.rcDestination = r; log(_T("DwmQueryThumbnailSourceSize failed %d: errno %d\n"), haveThumbSize, GetLastError()); } thProps.fVisible = TRUE; DwmUpdateThumbnailProperties(thumb.thumb, &thProps); } if(thumb.hwnd == g_programState.prevActiveWindow) { g_programState.activeSlot = (long)nthSlot; } SlotThing_t st; st.hwnd = thumb.hwnd; st.r.left = mi.extent.left - mis.r.left + (j % l1) * ws; st.r.top = mi.extent.top - mis.r.top + ((long)j / l1) * hs; st.r.right = st.r.left + ws; st.r.bottom = st.r.top + hs; st.moveUpDownAmount = l1; g_programState.slots.push_back(st); ++nthSlot; }); if(g_programState.activeSlot < 0 && g_programState.slots.size() > 0) { g_programState.activeSlot = 0; } } void OnPaint(HDC hdc) { HGDIOBJ original = NULL; original = SelectObject(hdc, GetStockObject(DC_PEN)); auto originalBrush = SelectObject(hdc, GetStockObject(DC_BRUSH)); SelectObject(hdc, GetStockObject(DC_BRUSH)); LONG fSize = 12l; fSize = MulDiv(fSize, GetDeviceCaps(hdc, LOGPIXELSY), 72); if(fSize != 12l) log(_T("font size scaled to %ld\n"), fSize); HFONT font = CreateFont( fSize, 0, 0, 0, 0, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, DEFAULT_PITCH | FF_DONTCARE, _T("Courier New")); HFONT originalFont = (HFONT)SelectObject(hdc, font); auto mis = GetMonitorGeometry(); SetDCBrushColor(hdc, RGB(0, 0, 0)); log(_T("rectangle is %ld %ld %ld %ld\n"), mis.r.left, mis.r.top, mis.r.right, mis.r.bottom); RECT winRect; GetWindowRect(g_programState.hWnd, &winRect); log(_T("window rect %ld %ld %ld %ld\n"), winRect.left, winRect.top, winRect.right, winRect.bottom); auto hrRectangle = Rectangle(hdc, 0, 0, winRect.right - winRect.left, winRect.bottom - winRect.top); log(_T("rectangle returned %d: errno %d\n"), hrRectangle, GetLastError()); SetDCBrushColor(hdc, RGB(255, 0, 0)); if(g_p
random
[ { "content": " HMONITOR hMonitor;\n", "file_path": "AltTabber/AltTabber.h", "rank": 0, "score": 29164.660110498233 }, { "content": " HWND hwnd;\n", "file_path": "AltTabber/AltTabber.h", "rank": 1, "score": 29068.905048625373 }, { "content": "#include \"stdafx.h\"\n\n#include \"AltTabber.h\"\n\n\n\nextern void log(LPTSTR fmt, ...);\n\n\n\nBOOL CALLBACK monitorEnumProc(\n\n HMONITOR hMonitor,\n\n HDC /*hdcMonitor*/,\n\n LPRECT /*lprcMonitor*/,\n\n LPARAM dwData)\n\n{\n\n MONITORINFO mi;\n\n mi.cbSize = sizeof(MONITORINFO);\n\n mi.dwFlags = 0;\n\n auto hr = GetMonitorInfo(hMonitor, &mi);\n\n log(\n\n _T(\"Get monitor info: %d; %ld %ld %ld %ld\\n\"),\n\n hr,\n\n mi.rcMonitor.left, mi.rcMonitor.top,\n\n mi.rcMonitor.right, mi.rcMonitor.bottom);\n", "file_path": "AltTabber/MonitorGeom.cpp", "rank": 2, "score": 21324.50606898314 }, { "content": " if(!hr) {\n\n log(_T(\"\\tlast error: %d\\n\"), GetLastError());\n\n }\n\n\n\n MonitorInfo_t mit = { hMonitor, mi.rcMonitor };\n\n\n\n std::vector<MonitorInfo_t>& stuff =\n\n *((std::vector<MonitorInfo_t>*)dwData);\n\n stuff.push_back(mit);\n\n return TRUE;\n\n}\n\n\n\nMonitorGeom_t GetMonitorGeometry()\n\n{\n\n MonitorGeom_t ret = { { MAXLONG, MAXLONG, -MAXLONG, -MAXLONG } };\n\n std::vector<MonitorInfo_t> stuff;\n\n\n\n EnumDisplayMonitors(NULL, NULL, monitorEnumProc, (LPARAM)&stuff);\n\n\n\n ret.monitors = stuff;\n", "file_path": "AltTabber/MonitorGeom.cpp", "rank": 3, "score": 21308.117384475874 }, { "content": "\n\n for(auto&& i = stuff.begin(); i != stuff.end(); ++i) {\n\n if(i->extent.left < ret.r.left) ret.r.left = i->extent.left;\n\n if(i->extent.top < ret.r.top) ret.r.top = i->extent.top;\n\n if(i->extent.right > ret.r.right) ret.r.right = i->extent.right;\n\n if(i->extent.bottom > ret.r.bottom) ret.r.bottom = i->extent.bottom;\n\n }\n\n\n\n std::sort(\n\n ret.monitors.begin(), ret.monitors.end(),\n\n [](\n\n std::vector<MonitorInfo_t>::value_type const& left,\n\n std::vector<MonitorInfo_t>::value_type const& right)\n\n -> bool {\n\n if(left.extent.top == right.extent.top) {\n\n return left.extent.left < right.extent.left;\n\n }\n\n return left.extent.top < right.extent.top;\n\n });\n\n\n\n return ret;\n\n}", "file_path": "AltTabber/MonitorGeom.cpp", "rank": 4, "score": 21301.075608453415 }, { "content": " HWND prevActiveWindow;\n", "file_path": "AltTabber/AltTabber.h", "rank": 5, "score": 15138.143936520748 }, { "content": " ULONG sleptThroughNWindows;\n", "file_path": "AltTabber/AltTabber.h", "rank": 6, "score": 15138.143936520748 }, { "content": "#define JAT_HACK_DEXPOT 1\n\n\n", "file_path": "AltTabber/AltTabber.h", "rank": 7, "score": 12460.650530193561 }, { "content": " RECT r;\n", "file_path": "AltTabber/AltTabber.h", "rank": 8, "score": 12377.936100699431 }, { "content": " HWND hWnd;\n", "file_path": "AltTabber/AltTabber.h", "rank": 9, "score": 12298.847723203096 }, { "content": " if(hrFW) {\n\n g_programState.compatHacks |= JAT_HACK_DEXPOT;\n\n }\n\n\n\n return TRUE;\n\n}\n\n\n\nstatic void ShowContextMenu(int x, int y)\n\n{ \n\n if(g_programState.activeSlot >= 0\n\n && (unsigned long)g_programState.activeSlot < g_programState.slots.size())\n\n {\n\n HMENU ctxMenu = CreatePopupMenu();\n\n AppendMenu(ctxMenu, MF_STRING, MY_CLOSE_BTN_ID, _T(\"&Close\"));\n\n\n\n auto isIconic = IsIconic(g_programState.slots[g_programState.activeSlot].hwnd);\n\n auto mis = GetMonitorGeometry();\n\n auto size = mis.monitors.size();\n\n if(!isIconic && size > 1 && size <= 10)\n\n {\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 25, "score": 20.9411347214562 }, { "content": "#include \"stdafx.h\"\n\n#include \"AltTabber.h\"\n\n\n\nextern ProgramState_t g_programState;\n\nextern void log(LPTSTR fmt, ...);\n\nextern MonitorGeom_t GetMonitorGeometry();\n\nextern void CreateThumbnails(std::wstring const& filter);\n\nextern void SetThumbnails();\n\nextern void MoveCursorOverActiveSlot();\n\n\n\nvoid ActivateSwitcher()\n\n{\n\n log(_T(\"activating switcher\\n\"));\n\n g_programState.prevActiveWindow = GetForegroundWindow();\n\n log(_T(\"previous window is %p\\n\"),\n\n (void*)g_programState.prevActiveWindow);\n\n g_programState.showing = TRUE;\n\n auto monitorGeom = GetMonitorGeometry();\n\n SetForegroundWindow(g_programState.hWnd);\n\n SetFocus(g_programState.hWnd);\n", "file_path": "AltTabber/OverlayActivation.cpp", "rank": 26, "score": 20.41307803017565 }, { "content": "\n\nvoid SelectByMouse(DWORD lParam)\n\n{\n\n int xPos = GET_X_LPARAM(lParam);\n\n int yPos = GET_Y_LPARAM(lParam);\n\n POINT pt = { xPos, yPos };\n\n auto found = std::find_if(\n\n g_programState.slots.begin(), g_programState.slots.end(),\n\n [&](SlotThing_t const& thing) -> BOOL {\n\n return PtInRect(&thing.r, pt);\n\n });\n\n if(found != g_programState.slots.end()) {\n\n g_programState.activeSlot = (long)(found - g_programState.slots.begin());\n\n RedrawWindow(g_programState.hWnd, NULL, NULL, RDW_INVALIDATE);\n\n }\n\n}\n\n\n\nvoid SelectCurrent()\n\n{\n\n if(g_programState.activeSlot >= 0) {\n\n g_programState.prevActiveWindow =\n\n g_programState.slots[g_programState.activeSlot]\n\n .hwnd;\n\n QuitOverlay();\n\n }\n\n}", "file_path": "AltTabber/MoveFunctions.cpp", "rank": 27, "score": 20.164630858281303 }, { "content": " AppendMenu(ctxMenu, MF_SEPARATOR, 0, NULL);\n\n for(size_t i = 0; i < size; ++i) {\n\n TCHAR str[256];\n\n wsprintf(str, _T(\"Move to monitor %lu\"), (unsigned long)(i + 1));\n\n AppendMenu(ctxMenu, MF_STRING, MY_MOVE_TO_BASE_ID + i, str);\n\n }\n\n } else if(isIconic) {\n\n AppendMenu(ctxMenu, MF_SEPARATOR, 0, NULL);\n\n AppendMenu(ctxMenu, MF_STRING | MF_DISABLED, 0, _T(\"Window is minimized\"));\n\n }\n\n\n\n TrackPopupMenu(ctxMenu, \n\n TPM_RIGHTBUTTON,\n\n x, y,\n\n 0, g_programState.hWnd, NULL);\n\n DestroyMenu(ctxMenu);\n\n }\n\n}\n\n\n\nstatic inline void NotificationAreaMenu(POINT location)\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 28, "score": 20.046713593032955 }, { "content": " CreateThumbnails(g_programState.filter);\n\n SetThumbnails();\n\n RedrawWindow(g_programState.hWnd, NULL, NULL, RDW_INVALIDATE);\n\n }\n\n break; }\n\n#else\n\n default:\n\n return DefWindowProc(hWnd, message, wParam, lParam);\n\n#endif\n\n }\n\n break;\n\n default:\n\n return DefWindowProc(hWnd, message, wParam, lParam);\n\n }\n\n return 0;\n\n}\n\n\n\n// Message handler for about box.\n\nINT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)\n\n{\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 30, "score": 19.851689442970056 }, { "content": " POINT tentativePoint = {\n\n (r.right + r.left) / 2,\n\n (r.bottom + r.top) / 2,\n\n };\n\n auto found = std::find_if(mis.monitors.begin(), mis.monitors.end(),\n\n [&tentativePoint](MonitorInfo_t& mon) -> bool {\n\n return PtInRect(&mon.extent, tentativePoint) != FALSE;\n\n });\n\n if(found != mis.monitors.end()) {\n\n log(_T(\"Moving the mouse centered on the window\\n\"));\n\n SetCursorPos(tentativePoint.x, tentativePoint.y);\n\n } else {\n\n auto hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);\n\n MONITORINFO mi;\n\n mi.cbSize = sizeof(MONITORINFO);\n\n mi.dwFlags = 0;\n\n GetMonitorInfo(hMonitor, &mi);\n\n \n\n RECT newTarget;\n\n BOOL hrIR = IntersectRect(&newTarget, &mi.rcWork, &r);\n", "file_path": "AltTabber/OverlayActivation.cpp", "rank": 31, "score": 19.53829595730538 }, { "content": " g_programState.logging = !g_programState.logging;\n\n break;\n\n case VK_BACK:\n\n if(!g_programState.filter.empty()) {\n\n g_programState.filter =\n\n g_programState.filter.substr(\n\n 0, g_programState.filter.size() - 1);\n\n \n\n CreateThumbnails(g_programState.filter);\n\n SetThumbnails();\n\n RedrawWindow(g_programState.hWnd, NULL, NULL, RDW_INVALIDATE);\n\n MoveCursorOverActiveSlot();\n\n }\n\n break;\n\n#if 0\n\n default: {\n\n INT hr = (INT)MapVirtualKey(wParam, MAPVK_VK_TO_CHAR);\n\n if(hr > 0) {\n\n g_programState.filter += (wchar_t)hr;\n\n log(_T(\"got filter %ls\\n\"), g_programState.filter.c_str());\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 33, "score": 17.700197556197644 }, { "content": "\n\n auto hr = PostMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);\n\n //auto hr = SendMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);\n\n //auto hr = OpenIcon(hwnd);\n\n log(_T(\"restoring %p hr = %ld\\n\"), (void*)hwnd, hr);\n\n }\n\n\n\n // I don't really need to do this since windows seem to sometimes do\n\n // it automatically, but it's curtosy (or however you spell it)\n\n \n\n\t\t// update 2016: virtualized coordinates are more convoluted than I thought\n\n\t\t// GetWindowRect gives me logical coordinates, which may or may\n\n\t\t// not be real. GetCursorPos returns the same coordinates as\n\n\t\t// not dpi aware applications, despite me declaring >this< as \n\n\t\t// dpi aware. GetPhysicalCursorPos seems to return the real\n\n\t\t// mouse position (which is what I hope).\n\n\t\t// TODO test on windows 10\n\n RECT r;\n\n BOOL hrGWR = GetWindowRect(hwnd, &r);\n\n\t\t{\n", "file_path": "AltTabber/OverlayActivation.cpp", "rank": 34, "score": 17.62277220982184 }, { "content": "\n\n#include \"stdafx.h\"\n\n#include \"AltTabber.h\"\n\n\n\nextern ProgramState_t g_programState;\n\nextern void log(LPTSTR fmt, ...);\n\n\n\nvoid SynchronizeWithRegistry()\n\n{\n\n#define SUBKEY (_T(\"Software\\\\jakkal\\\\AltTabber\"))\n\n HKEY phk = NULL;\n\n DWORD disposition = 0;\n\n auto hr = RegCreateKeyEx(HKEY_CURRENT_USER,\n\n SUBKEY,\n\n 0, \n\n NULL,\n\n 0,\n\n KEY_READ | KEY_QUERY_VALUE | KEY_SET_VALUE | KEY_WRITE,\n\n NULL,\n\n &phk,\n", "file_path": "AltTabber/Registry.cpp", "rank": 36, "score": 17.614869250642936 }, { "content": "\n\n// Forward declarations of functions included in this code module:\n\nATOM MyRegisterClass(HINSTANCE hInstance);\n\nBOOL InitInstance(HINSTANCE, int);\n\nLRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);\n\nINT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);\n\n\n\n\n\nint APIENTRY _tWinMain(HINSTANCE hInstance,\n\n HINSTANCE hPrevInstance,\n\n LPTSTR lpCmdLine,\n\n int nCmdShow)\n\n{\n\n UNREFERENCED_PARAMETER(hPrevInstance);\n\n UNREFERENCED_PARAMETER(lpCmdLine);\n\n\n\n\t// TODO still not clear if I still need to call this\n\n\t// or not, given that the manifest says this is\n\n\t// dpi aware. Hope to some day figure out if this\n\n\t// is needed/or not/or harmless\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 37, "score": 17.06966092714759 }, { "content": " auto hrSWP = SetWindowPos(g_programState.hWnd,\n\n NULL,\n\n 0, 0,\n\n 0, 0,\n\n SWP_SHOWWINDOW | SWP_NOSENDCHANGING);\n\n log(_T(\"SetWindowPos returned %d: errno %d\\n\"), hrSWP, GetLastError());\n\n hrSWP = SetWindowPos(g_programState.hWnd,\n\n HWND_TOPMOST,\n\n monitorGeom.r.left, monitorGeom.r.top,\n\n monitorGeom.r.right - monitorGeom.r.left, monitorGeom.r.bottom - monitorGeom.r.top,\n\n SWP_NOSENDCHANGING);\n\n log(_T(\"SetWindowPos returned %d: errno %d\\n\"), hrSWP, GetLastError());\n\n\n\n g_programState.filter = _T(\"\");\n\n CreateThumbnails(g_programState.filter);\n\n SetThumbnails();\n\n\n\n MoveCursorOverActiveSlot();\n\n}\n\n\n", "file_path": "AltTabber/OverlayActivation.cpp", "rank": 38, "score": 16.76692867021613 }, { "content": "#include \"stdafx.h\"\n\n#include \"AltTabber.h\"\n\n\n\nextern ProgramState_t g_programState;\n\n\n\nvoid log(LPTSTR fmt, ...)\n\n{\n\n if(!g_programState.logging) return;\n\n\n\n if(!g_programState.freopened) {\n\n // replace stdout with log file\n\n TCHAR tempPath[MAX_PATH + 1];\n\n auto hr = GetTempPath(MAX_PATH, tempPath);\n\n if(hr == 0) abort();\n\n\n\n TCHAR tempFile[MAX_PATH + 1];\n\n UINT hrTFN = GetTempFileName(\n\n tempPath,\n\n _T(\"altTabber\"),\n\n 0,\n", "file_path": "AltTabber/Log.cpp", "rank": 39, "score": 16.587152078018324 }, { "content": " HWND hwnd = g_programState.slots[g_programState.activeSlot].hwnd;\n\n auto mis = GetMonitorGeometry();\n\n auto mi = mis.monitors[monitor];\n\n \n\n WINDOWPLACEMENT wpl;\n\n wpl.length = sizeof(WINDOWPLACEMENT);\n\n GetWindowPlacement(hwnd, &wpl);\n\n WINDOWPLACEMENT newWpl;\n\n ZeroMemory(&newWpl, sizeof(newWpl));\n\n newWpl.flags = WPF_ASYNCWINDOWPLACEMENT;\n\n newWpl.length = sizeof(WINDOWPLACEMENT);\n\n newWpl.showCmd = wpl.showCmd;\n\n\n\n auto hmonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);\n\n auto found = std::find_if(mis.monitors.begin(), mis.monitors.end(), [&hmonitor](MonitorInfo_t& mif)->bool {\n\n return mif.hMonitor == hmonitor;\n\n });\n\n auto oldMonitor = *found;\n\n\n\n newWpl.rcNormalPosition = wpl.rcNormalPosition;\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 40, "score": 15.993625164368392 }, { "content": " });\n\n if(foundSlot != g_programState.slots.end()) {\n\n g_programState.activeSlot = (long)(foundSlot - g_programState.slots.begin());\n\n MoveCursorOverActiveSlot();\n\n }\n\n}\n\n\n\n//\n\n// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)\n\n//\n\n// PURPOSE: Processes messages for the main window.\n\n//\n\n// WM_COMMAND - process the application menu\n\n// WM_PAINT - Paint the main window\n\n// WM_DESTROY - post a quit message and return\n\n//\n\n//\n\nLRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\n\n{\n\n int wmId, wmEvent;\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 41, "score": 15.966669357656805 }, { "content": " {\n\n if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))\n\n {\n\n TranslateMessage(&msg);\n\n DispatchMessage(&msg);\n\n }\n\n }\n\n\n\n return (int) msg.wParam;\n\n}\n\n\n\nstatic inline void Cleanup()\n\n{\n\n PurgeThumbnails();\n\n \n\n if(g_programState.freopened != NULL) fclose(g_programState.freopened);\n\n\n\n NOTIFYICONDATA nid;\n\n nid.cbSize = sizeof(NOTIFYICONDATA);\n\n nid.uID = MY_NOTIFICATION_ICON;\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 42, "score": 15.942708111667311 }, { "content": " log(_T(\"RegQueryValue failed %d: errno %d\\n\"), hr, GetLastError());\n\n return;\n\n }\n\n hr = RegQueryValueEx(phk,\n\n _T(\"resetOnClose\"),\n\n 0,\n\n NULL,\n\n (BYTE*)&dResetOnClose,\n\n &dSize);\n\n if(hr != ERROR_SUCCESS) {\n\n log(_T(\"RegQueryValue failed %d: errno %d\\n\"), hr, GetLastError());\n\n return;\n\n }\n\n\n\n g_programState.hotkey.modifiers = (UINT)(ULONG)dModifiers;\n\n g_programState.hotkey.key = (UINT)(ULONG)dKey;\n\n g_programState.resetOnClose = dKey != 0x0;\n\n break;\n\n }\n\n}\n", "file_path": "AltTabber/Registry.cpp", "rank": 43, "score": 15.407041267018982 }, { "content": " // read values\n\n dSize = sizeof(DWORD);\n\n hr = RegQueryValueEx(phk,\n\n _T(\"modifiers\"),\n\n 0,\n\n NULL,\n\n (BYTE*)&dModifiers,\n\n &dSize);\n\n if(hr != ERROR_SUCCESS) {\n\n log(_T(\"RegQueryValue failed %d: errno %d\\n\"), hr, GetLastError());\n\n return;\n\n }\n\n dSize = sizeof(DWORD);\n\n hr = RegQueryValueEx(phk,\n\n _T(\"key\"),\n\n 0,\n\n NULL,\n\n (BYTE*)&dKey,\n\n &dSize);\n\n if(hr != ERROR_SUCCESS) {\n", "file_path": "AltTabber/Registry.cpp", "rank": 44, "score": 15.312007712598925 }, { "content": "#define MY_MOVE_TO_6_ID (MY_MOVE_TO_BASE_ID + 5)\n\n#define MY_MOVE_TO_7_ID (MY_MOVE_TO_BASE_ID + 6)\n\n#define MY_MOVE_TO_8_ID (MY_MOVE_TO_BASE_ID + 7)\n\n#define MY_MOVE_TO_9_ID (MY_MOVE_TO_BASE_ID + 8)\n\n#define MY_MOVE_TO_10_ID (MY_MOVE_TO_BASE_ID + 9)\n\n\n\nextern void log(LPTSTR fmt, ...);\n\nextern MonitorGeom_t GetMonitorGeometry();\n\nextern void SynchronizeWithRegistry();\n\nextern void ActivateSwitcher();\n\nextern void SelectCurrent();\n\nextern void MoveNext(DWORD);\n\nextern void SelectByMouse(DWORD);\n\nextern void QuitOverlay();\n\nextern void PurgeThumbnails();\n\nextern void CreateThumbnails(std::wstring const&);\n\nextern void SetThumbnails();\n\nextern void OnPaint(HDC);\n\nextern void MoveCursorOverActiveSlot(); \n\n\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 45, "score": 15.276571542408204 }, { "content": " p.y = 1;\n\n MoveNextGeographically(p);\n\n break;\n\n }\n\n if(g_programState.activeSlot < 0) {\n\n g_programState.activeSlot = (long)\n\n (g_programState.slots.size() + g_programState.activeSlot);\n\n }\n\n g_programState.activeSlot %= g_programState.slots.size();\n\n\n\n if(g_programState.activeSlot >= 0) {\n\n log(_T(\"Current active slot: %ld hwnd: %p\\n\"),\n\n g_programState.activeSlot,\n\n (void*)g_programState.slots[g_programState.activeSlot].hwnd);\n\n }\n\n\n\n MoveCursorOverActiveSlot();\n\n\n\n RedrawWindow(g_programState.hWnd, NULL, NULL, RDW_INVALIDATE);\n\n}\n", "file_path": "AltTabber/MoveFunctions.cpp", "rank": 47, "score": 14.679010766258255 }, { "content": "// FUNCTION: InitInstance(HINSTANCE, int)\n\n//\n\n// PURPOSE: Saves instance handle and creates main window\n\n//\n\n// COMMENTS:\n\n//\n\n// In this function, we save the instance handle in a global variable and\n\n// create and display the main program window.\n\n//\n\nBOOL InitInstance(HINSTANCE hInstance, int)\n\n{\n\n HWND hWnd;\n\n\n\n hInst = hInstance; // Store instance handle in our global variable\n\n\n\n auto geom = GetMonitorGeometry();\n\n // SetWindowPos(hWnd, HWND_TOPMOST, geom.x, geom.y, geom.cx, geom.cy);\n\n\n\n hWnd = CreateWindowEx(\n\n WS_EX_TOPMOST | WS_EX_COMPOSITED | WS_EX_LAYERED,\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 48, "score": 14.579543586812418 }, { "content": " nid.uFlags = NIF_ICON | NIF_TIP | NIF_SHOWTIP | NIF_MESSAGE ;\n\n nid.hWnd = hWnd;\n\n nid.uVersion = NOTIFYICON_VERSION_4;\n\n nid.uCallbackMessage = MY_NOTIFY_ICON_MESSAGE_ID;\n\n\n\n TCHAR tip[64];\n\n // TODO inform about current hotkey better\n\n wsprintf(tip, _T(\"AltTabber - hotkey in hexadecimal codes is %04X %04X\"),\n\n g_programState.hotkey.modifiers,\n\n g_programState.hotkey.key);\n\n _tcsncpy_s(nid.szTip, tip, _tcslen(tip));\n\n\n\n nid.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SMALL));\n\n HRESULT sniHr = Shell_NotifyIcon(NIM_ADD, &nid);\n\n log(_T(\"Shell_NotifyIcon result: %ld errno %ld\\n\"), sniHr, GetLastError());\n\n nid.uFlags = 0;\n\n sniHr = Shell_NotifyIcon(NIM_SETVERSION, &nid);\n\n log(_T(\"Shell_NotifyIcon result: %ld errno %ld\\n\"), sniHr, GetLastError());\n\n\n\n auto hrFW = FindWindow(_T(\"ThunderRT6Main\"), _T(\"Dexpot\"));\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 49, "score": 14.503542143610527 }, { "content": " + (p.y < 0) * r.top\n\n + (!p.y) * ( (r.top + r.bottom) / 2l)\n\n ,\n\n };\n\n\n\n auto found = std::find_if(slots.begin(), slots.end(),\n\n [&speculant](SlotThing_t& s) -> bool {\n\n return PtInRect(&s.r, speculant) != FALSE;\n\n });\n\n\n\n if(found != slots.end()) {\n\n g_programState.activeSlot = (long)(found - slots.begin());\n\n return;\n\n }\n\n /* else */\n\n log(_T(\"could not find a slot speculating at %ld %ld, trying wrap around\\n\"),\n\n speculant.x, speculant.y);\n\n RECT wr;\n\n (void) GetWindowRect(g_programState.hWnd, &wr);\n\n speculant.x = \n", "file_path": "AltTabber/MoveFunctions.cpp", "rank": 50, "score": 14.37022259118071 }, { "content": " }\n\n \n\n log(_T(\"could not find a slot speculating at %ld %ld, silently failing\\n\"),\n\n speculant.x, speculant.y);\n\n}\n\n\n\nvoid MoveNext(DWORD direction)\n\n{\n\n if(g_programState.activeSlot < 0) {\n\n if(g_programState.slots.size() > 0) {\n\n g_programState.activeSlot = (long)(g_programState.slots.size() - 1);\n\n } else {\n\n return;\n\n }\n\n }\n\n log(_T(\"Moving from %ld \"), g_programState.activeSlot);\n\n POINT p = { 0, 0 };\n\n switch(direction)\n\n {\n\n case VK_TAB:\n", "file_path": "AltTabber/MoveFunctions.cpp", "rank": 52, "score": 13.21480846673619 }, { "content": " 0,\n\n REG_DWORD,\n\n (BYTE*)&dKey,\n\n sizeof(DWORD));\n\n if(hr != ERROR_SUCCESS) {\n\n log(_T(\"RegSetValue failed %d: errno %d\\n\"), hr, GetLastError());\n\n return;\n\n }\n\n hr = RegSetValueEx(phk,\n\n _T(\"resetOnClose\"),\n\n 0,\n\n REG_DWORD,\n\n (BYTE*)&dResetOnClose,\n\n sizeof(DWORD));\n\n if(hr != ERROR_SUCCESS) {\n\n log(_T(\"RegSetValue failed %d: errno %d\\n\"), hr, GetLastError());\n\n return;\n\n }\n\n break; }\n\n case REG_OPENED_EXISTING_KEY:\n", "file_path": "AltTabber/Registry.cpp", "rank": 53, "score": 13.189896666523294 }, { "content": "void QuitOverlay()\n\n{\n\n log(_T(\"escape pressed; reverting\\n\"));\n\n g_programState.showing = FALSE;\n\n auto monitorGeom = GetMonitorGeometry();\n\n SetWindowPos(g_programState.hWnd,\n\n 0,\n\n 0, 0,\n\n 0, 0,\n\n SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOZORDER | SWP_NOSENDCHANGING);\n\n if(g_programState.prevActiveWindow) {\n\n HWND hwnd = g_programState.prevActiveWindow;\n\n auto hr = SetForegroundWindow(hwnd);\n\n log(_T(\"set foreground window to previous result: %d\\n\"), hr);\n\n if(IsIconic(hwnd)) {\n\n // note to self: apparently only the owner of the window\n\n // can re-maximize it/restore it properly; calling anything\n\n // else like SetWindowPlacement or ShowWindow results in\n\n // its internal min/max state being broken; by sending\n\n // that window an actual message, things seem to work fine\n", "file_path": "AltTabber/OverlayActivation.cpp", "rank": 54, "score": 12.927557264681043 }, { "content": " SelectCurrent();\n\n } else {\n\n ActivateSwitcher();\n\n }\n\n break;\n\n case WM_MOUSEWHEEL: {\n\n int amount = GET_WHEEL_DELTA_WPARAM(wParam);\n\n if(amount > 0) MoveNext(VK_BACK);\n\n else MoveNext(VK_TAB);\n\n break; }\n\n case WM_RBUTTONUP:\n\n if(!g_programState.showing) break;\n\n SelectByMouse((DWORD)lParam);\n\n {\n\n POINT p = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };\n\n ClientToScreen(g_programState.hWnd, &p);\n\n ShowContextMenu(p.x, p.y);\n\n }\n\n break;\n\n case WM_LBUTTONUP:\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 55, "score": 12.82100951066856 }, { "content": " SetWindowPlacement(hwnd, &newWpl);\n\n } else if(newWpl.showCmd == SW_MINIMIZE) {\n\n // FIXME\n\n // right now moving minimized windows is disabled\n\n // mostly because I don't know how to handle the\n\n // minimized maximized window case properly\n\n SetWindowPlacement(hwnd, &newWpl);\n\n } else {\n\n SetWindowPlacement(hwnd, &newWpl);\n\n }\n\n Sleep(50);\n\n\n\n CreateThumbnails(g_programState.filter);\n\n SetThumbnails();\n\n RedrawWindow(g_programState.hWnd, NULL, 0, RDW_INVALIDATE);\n\n\n\n auto foundSlot = std::find_if(g_programState.slots.begin(),\n\n g_programState.slots.end(),\n\n [&hwnd](SlotThing_t& sthing)->bool {\n\n return sthing.hwnd == hwnd;\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 56, "score": 12.635564034459646 }, { "content": " if(g_programState.resetOnClose) {\n\n // clear the filter because of use case\n\n if(g_programState.slots.size() <= 2) {\n\n g_programState.filter = L\"\";\n\n }\n\n // rebuild thumbnails because filter was changed\n\n // and there are maybe dangling slots\n\n CreateThumbnails(g_programState.filter);\n\n SetThumbnails();\n\n // force redraw window (the labels)\n\n RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE);\n\n }\n\n }\n\n break;\n\n case MY_MOVE_TO_1_ID:\n\n case MY_MOVE_TO_2_ID:\n\n case MY_MOVE_TO_3_ID:\n\n case MY_MOVE_TO_4_ID:\n\n case MY_MOVE_TO_5_ID:\n\n case MY_MOVE_TO_6_ID:\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 57, "score": 12.409665904290735 }, { "content": "\t\t\tlog(_T(\"transformed [%d,%d,%d,%d] \"), r.left, r.top, r.right, r.bottom);\n\n\t\t\tPOINT p = {r.left, r.top};\n\n\t\t\tLogicalToPhysicalPoint(hwnd, &p);\n\n\t\t\tr.left = p.x;\n\n\t\t\tr.top = p.y;\n\n\t\t\tp.x = r.right;\n\n\t\t\tp.y = r.bottom;\n\n\t\t\tLogicalToPhysicalPoint(hwnd, &p);\n\n\t\t\tr.right = p.x;\n\n\t\t\tr.bottom = p.y;\n\n\n\n\t\t\tlog(_T(\"to [%d,%d,%d,%d]\\n\"), r.left, r.top, r.right, r.bottom);\n\n\t\t}\n\n POINT p;\n\n\n\n BOOL hrGCP = GetPhysicalCursorPos(&p);\n\n\t\tlog(_T(\"cursor at %d,%d\\n\"), p.x, p.y);\n\n\n\n auto& mis = monitorGeom;\n\n if(hrGWR != FALSE && hrGCP != FALSE && !PtInRect(&r, p)) {\n", "file_path": "AltTabber/OverlayActivation.cpp", "rank": 58, "score": 12.318441443098116 }, { "content": "#include \"stdafx.h\"\n\n#include \"AltTabber.h\"\n\n\n\nextern ProgramState_t g_programState;\n\nextern void log(LPTSTR fmt, ...);\n\nextern void QuitOverlay();\n\n\n\nvoid MoveCursorOverActiveSlot()\n\n{\n\n if(g_programState.activeSlot < 0) return;\n\n\n\n auto& r = g_programState.slots[g_programState.activeSlot].r;\n\n POINT moveHere = {\n\n (r.right + r.left) / 2,\n\n (r.bottom + r.top) / 2,\n\n };\n\n ClientToScreen(g_programState.hWnd, &moveHere);\n\n SetCursorPos(moveHere.x, moveHere.y);\n\n}\n\n\n", "file_path": "AltTabber/MoveFunctions.cpp", "rank": 60, "score": 12.017266606872123 }, { "content": " if(!g_programState.showing) break;\n\n SelectByMouse((DWORD)lParam);\n\n break;\n\n case WM_LBUTTONDBLCLK:\n\n case WM_RBUTTONDBLCLK:\n\n if(!g_programState.showing) break;\n\n SelectByMouse((DWORD)lParam);\n\n SelectCurrent();\n\n break;\n\n case WM_CHAR:\n\n switch(wParam) {\n\n case 0x1B: // esc\n\n case 0x08: // backspace\n\n case 0x09: // tab\n\n case 0x0D: // enter\n\n // case 0x0A: // LF\n\n return DefWindowProc(hWnd, message, wParam, lParam);\n\n }\n\n g_programState.filter += (wchar_t)wParam;\n\n log(_T(\"got filter %ls\\n\"), g_programState.filter.c_str());\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 61, "score": 11.675292555908058 }, { "content": " DWORD dModifiers = (DWORD)g_programState.hotkey.modifiers;\n\n DWORD dKey = (DWORD)g_programState.hotkey.key;\n\n DWORD dSize = sizeof(DWORD);\n\n DWORD dResetOnClose = (DWORD)g_programState.resetOnClose;\n\n\n\n switch(disposition) {\n\n case REG_CREATED_NEW_KEY: {\n\n // set default values\n\n hr = RegSetValueEx(phk,\n\n _T(\"modifiers\"),\n\n 0,\n\n REG_DWORD,\n\n (BYTE*)&dModifiers,\n\n sizeof(DWORD));\n\n if(hr != ERROR_SUCCESS) {\n\n log(_T(\"RegSetValue failed %d: errno %d\\n\"), hr, GetLastError());\n\n return;\n\n }\n\n hr = RegSetValueEx(phk,\n\n _T(\"key\"),\n", "file_path": "AltTabber/Registry.cpp", "rank": 62, "score": 11.2010397894133 }, { "content": " CreateThumbnails(g_programState.filter);\n\n SetThumbnails();\n\n RedrawWindow(g_programState.hWnd, NULL, NULL, RDW_INVALIDATE);\n\n MoveCursorOverActiveSlot();\n\n break;\n\n case WM_KEYDOWN:\n\n switch(wParam) {\n\n case VK_APPS: // menu key\n\n if(g_programState.activeSlot >= 0) {\n\n RECT r = g_programState.slots[g_programState.activeSlot].r;\n\n POINT p;\n\n p.x = r.left;\n\n p.y = r.top;\n\n ClientToScreen(hWnd, &p);\n\n ShowContextMenu(p.x, p.y);\n\n }\n\n break;\n\n case VK_ESCAPE:\n\n QuitOverlay();\n\n break;\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 63, "score": 10.852798573280474 }, { "content": "static void MoveNextGeographically(POINT p)\n\n{\n\n if(g_programState.activeSlot < 0) {\n\n log(_T(\"no active slot\"));\n\n return;\n\n }\n\n\n\n auto& slots = g_programState.slots;\n\n SlotThing_t& slot = slots[g_programState.activeSlot];\n\n RECT& r = slot.r;\n\n log(_T(\"moving away from %ld %ld %ld %ld\\n\"),\n\n r.left, r.top, r.right, r.bottom);\n\n POINT speculant = {\n\n p.x * 5\n\n + (p.x > 0) * r.right\n\n + (p.x < 0) * r.left\n\n + (!p.x) * ( (r.left + r.right) / 2)\n\n ,\n\n p.y * 5\n\n + (p.y > 0) * r.bottom\n", "file_path": "AltTabber/MoveFunctions.cpp", "rank": 64, "score": 10.747058408966634 }, { "content": " MoveToEx(hdc, 0, 0, NULL);\n\n auto mi = GetMonitorGeometry();\n\n LineTo(hdc, mi.r.right - mi.r.left, mi.r.bottom - mi.r.top);\n\n SelectObject(hdc, original);\n\n DeleteObject(pen);\n\n\n\n OnPaint(hdc);\n\n }\n\n EndPaint(hWnd, &ps);\n\n break; }\n\n case WM_DESTROY:\n\n Cleanup();\n\n PostQuitMessage(0);\n\n break;\n\n case WM_HOTKEY:\n\n // only waiting for one, so skip over trying to decode it\n\n // even if multiple keys are registered as hotkeys, they'd\n\n // all do the same thing anyway\n\n log(_T(\"hotkey pressed\\n\"));\n\n if(g_programState.showing) {\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 65, "score": 10.44217467305069 }, { "content": "{\n\n // as per documentation, if hWnd is not the foreground window,\n\n // then the popup menu will not go away. So do that.\n\n SetForegroundWindow(g_programState.hWnd);\n\n // actually show the menu\n\n HMENU ctxMenu = CreatePopupMenu();\n\n AppendMenu(ctxMenu, MF_STRING, MY_TRAY_OPEN_BTN_ID, _T(\"&Open\"));\n\n AppendMenu(ctxMenu, MF_SEPARATOR, 0, NULL);\n\n AppendMenu(ctxMenu, MF_STRING, MY_TRAY_CLOSE_BTN_ID, _T(\"E&xit\"));\n\n TrackPopupMenu(ctxMenu, \n\n TPM_RIGHTBUTTON,\n\n location.x, location.y,\n\n 0, g_programState.hWnd, NULL);\n\n DestroyMenu(ctxMenu);\n\n}\n\n\n\nvoid MoveToMonitor(unsigned int monitor)\n\n{\n\n if(g_programState.activeSlot < 0) return;\n\n\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 66, "score": 10.303068558538316 }, { "content": " szWindowClass,\n\n szTitle, \n\n WS_POPUP,\n\n geom.r.left, geom.r.top,\n\n geom.r.right - geom.r.left, geom.r.bottom - geom.r.top,\n\n NULL,\n\n NULL,\n\n hInstance,\n\n NULL);\n\n\n\n if (!hWnd)\n\n {\n\n return FALSE;\n\n }\n\n\n\n ShowWindow(hWnd, SW_HIDE);\n\n UpdateWindow(hWnd);\n\n\n\n SynchronizeWithRegistry();\n\n\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 67, "score": 10.23425638742124 }, { "content": "ProgramState_t g_programState = {\n\n /*showing=*/FALSE,\n\n /*prevActiveWindow=*/NULL,\n\n /*activeSlot=*/-1,\n\n /*logging=*/FALSE,\n\n /*freopened=*/NULL,\n\n /*hotkey=*/\n\n#ifdef JAT_OLD_HOTKEY\n\n { MOD_ALT | MOD_CONTROL, '3' },\n\n#else\n\n { MOD_ALT, VK_OEM_3 },\n\n#endif\n\n /*compatHacks=*/0,\n\n /*resetOnClose=*/false,\n\n};\n\n\n\n// Global Variables:\n\nHINSTANCE hInst; // current instance\n\nTCHAR szTitle[MAX_LOADSTRING]; // The title bar text\n\nTCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 68, "score": 9.995057399855925 }, { "content": " PAINTSTRUCT ps;\n\n HDC hdc;\n\n\n\n switch (message)\n\n {\n\n case MY_NOTIFY_ICON_MESSAGE_ID: {\n\n auto what = LOWORD(lParam);\n\n switch(what) {\n\n case NIN_SELECT:\n\n ActivateSwitcher();\n\n break;\n\n case NIN_KEYSELECT:\n\n case WM_CONTEXTMENU: {\n\n POINT location;\n\n location.x = GET_X_LPARAM(wParam);\n\n location.y = GET_Y_LPARAM(wParam);\n\n NotificationAreaMenu(location);\n\n break; }\n\n }\n\n break; }\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 69, "score": 9.578021937957343 }, { "content": " int diffX = newWpl.rcNormalPosition.right - newWpl.rcNormalPosition.left;\n\n int diffY = newWpl.rcNormalPosition.bottom - newWpl.rcNormalPosition.top;\n\n\n\n MONITORINFO minfoOld;\n\n minfoOld.cbSize = sizeof(MONITORINFO);\n\n GetMonitorInfo(oldMonitor.hMonitor, &minfoOld);\n\n MONITORINFO minfoNew;\n\n minfoNew.cbSize = sizeof(MONITORINFO);\n\n GetMonitorInfo(mi.hMonitor, &minfoNew);\n\n\n\n newWpl.rcNormalPosition.left = minfoNew.rcWork.left + (newWpl.rcNormalPosition.left - minfoOld.rcWork.left);\n\n newWpl.rcNormalPosition.right = newWpl.rcNormalPosition.left + diffX;\n\n newWpl.rcNormalPosition.top = minfoNew.rcWork.top + (newWpl.rcNormalPosition.top - minfoOld.rcWork.top);\n\n newWpl.rcNormalPosition.bottom = newWpl.rcNormalPosition.top + diffY;\n\n newWpl.ptMaxPosition.x = minfoNew.rcWork.left;\n\n newWpl.ptMaxPosition.y = minfoNew.rcWork.top;\n\n\n\n // apparent SetWindowPlacement don't work if it's maximized\n\n if(newWpl.showCmd == SW_MAXIMIZE) {\n\n PostMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 70, "score": 9.307641458623225 }, { "content": "\n\n if(hrIR) {\n\n log(_T(\"Moving the mouse centered on the intersection of the window and the monitor it's on\\n\"));\n\n SetCursorPos(\n\n (newTarget.left + newTarget.right) / 2,\n\n (newTarget.top + newTarget.bottom) / 2);\n\n } else {\n\n log(_T(\"Moving the mouse centered on the monitor it's on\\n\"));\n\n SetCursorPos(\n\n (mi.rcWork.left + mi.rcWork.right) / 2,\n\n (mi.rcWork.top + mi.rcWork.bottom) / 2);\n\n }\n\n }\n\n }\n\n }\n\n}\n", "file_path": "AltTabber/OverlayActivation.cpp", "rank": 72, "score": 9.14754755353812 }, { "content": " UNREFERENCED_PARAMETER(lParam);\n\n switch (message)\n\n {\n\n case WM_INITDIALOG:\n\n return (INT_PTR)TRUE;\n\n\n\n case WM_COMMAND:\n\n if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)\n\n {\n\n EndDialog(hDlg, LOWORD(wParam));\n\n return (INT_PTR)TRUE;\n\n }\n\n break;\n\n }\n\n return (INT_PTR)FALSE;\n\n}\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 73, "score": 8.428467213536125 }, { "content": " case MY_MOVE_TO_7_ID:\n\n case MY_MOVE_TO_8_ID:\n\n case MY_MOVE_TO_9_ID:\n\n case MY_MOVE_TO_10_ID:\n\n log(_T(\"message was %ld\\n\"), message);\n\n MoveToMonitor(wmId - MY_MOVE_TO_BASE_ID);\n\n break;\n\n default:\n\n return DefWindowProc(hWnd, message, wParam, lParam);\n\n }\n\n break;\n\n case WM_PAINT: {\n\n hdc = BeginPaint(hWnd, &ps);\n\n // TODO: Add any drawing code here...\n\n if(g_programState.showing)\n\n {\n\n HGDIOBJ original = NULL;\n\n original = SelectObject(hdc, GetStockObject(DC_PEN));\n\n HPEN pen = CreatePen(PS_SOLID, 5, RGB(0, 255, 0));\n\n SelectObject(hdc, pen);\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 74, "score": 8.200749825904271 }, { "content": " p.x * 5\n\n + (p.x > 0) * 0\n\n + (p.x < 0) * (wr.right - wr.left)\n\n + (!p.x) * ( (r.left + r.right) / 2)\n\n ;\n\n speculant.y =\n\n p.y * 5\n\n + (p.y > 0) * 0\n\n + (p.y < 0) * (wr.bottom - wr.top)\n\n + (!p.y) * ( (r.top + r.bottom) / 2l)\n\n ;\n\n \n\n auto found2 = std::find_if(slots.begin(), slots.end(),\n\n [&speculant](SlotThing_t& s) -> bool {\n\n return PtInRect(&s.r, speculant) != FALSE;\n\n });\n\n \n\n if(found2 != slots.end()) {\n\n g_programState.activeSlot = (long)(found2 - slots.begin());\n\n return;\n", "file_path": "AltTabber/MoveFunctions.cpp", "rank": 75, "score": 8.154839533259858 }, { "content": " wmEvent = HIWORD(wParam);\n\n // Parse the menu selections:\n\n switch (wmId)\n\n {\n\n case IDM_ABOUT:\n\n DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);\n\n break;\n\n case IDM_EXIT:\n\n DestroyWindow(hWnd);\n\n break;\n\n case MY_TRAY_OPEN_BTN_ID:\n\n ActivateSwitcher();\n\n break;\n\n case MY_TRAY_CLOSE_BTN_ID:\n\n PostMessage(hWnd, WM_CLOSE, 0, 0);\n\n break;\n\n case MY_CLOSE_BTN_ID:\n\n if(g_programState.activeSlot >= 0) {\n\n auto& slot = g_programState.slots[g_programState.activeSlot];\n\n PostMessage(slot.hwnd, WM_SYSCOMMAND, SC_CLOSE, -1);\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 76, "score": 7.303834815422336 }, { "content": " case VK_TAB:\n\n if(GetAsyncKeyState(VK_SHIFT)) {\n\n MoveNext(VK_BACK);\n\n } else {\n\n MoveNext(VK_TAB);\n\n }\n\n break;\n\n case VK_RIGHT:\n\n case VK_UP:\n\n case VK_DOWN:\n\n case VK_LEFT:\n\n MoveNext((DWORD)wParam);\n\n break;\n\n case VK_RETURN:\n\n SelectCurrent();\n\n break;\n\n case VK_F1:\n\n DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);\n\n break;\n\n case VK_F2:\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 77, "score": 6.895920071397135 }, { "content": " WNDCLASSEX wcex;\n\n\n\n wcex.cbSize = sizeof(WNDCLASSEX);\n\n\n\n wcex.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;\n\n wcex.lpfnWndProc = WndProc;\n\n wcex.cbClsExtra = 0;\n\n wcex.cbWndExtra = 0;\n\n wcex.hInstance = hInstance;\n\n wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ALTTABBER));\n\n wcex.hCursor = LoadCursor(NULL, IDC_ARROW);\n\n wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);\n\n wcex.lpszMenuName = NULL; //MAKEINTRESOURCE(IDC_ALTTABBER);\n\n wcex.lpszClassName = szWindowClass;\n\n wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));\n\n\n\n return RegisterClassEx(&wcex);\n\n}\n\n\n\n//\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 78, "score": 6.873392647629365 }, { "content": " &disposition);\n\n\n\n if(hr != ERROR_SUCCESS) {\n\n log(_T(\"RegCreateKey failed %d: errno: %d\\n\"), hr, GetLastError());\n\n return;\n\n }\n\n\n\n#pragma warning(push)\n\n#pragma warning(disable:4512)\n\n struct x_SynchronizeWithRegistry_OnExit {\n\n HKEY& m_hk;\n\n x_SynchronizeWithRegistry_OnExit(HKEY& hk)\n\n : m_hk(hk)\n\n {}\n\n ~x_SynchronizeWithRegistry_OnExit() {\n\n RegCloseKey(m_hk);\n\n }\n\n } witness(phk);\n\n#pragma warning(pop)\n\n \n", "file_path": "AltTabber/Registry.cpp", "rank": 79, "score": 6.484642801709223 }, { "content": " case WM_SYSCOMMAND:\n\n switch (wParam)\n\n {\n\n case SC_KEYMENU:\n\n log(_T(\"SC_KEYMNU triggered\\n\"));\n\n if(g_programState.activeSlot >= 0) {\n\n RECT r = g_programState.slots[g_programState.activeSlot].r;\n\n POINT p;\n\n p.x = r.left;\n\n p.y = r.top;\n\n ClientToScreen(hWnd, &p);\n\n ShowContextMenu(p.x, p.y);\n\n }\n\n break;\n\n default:\n\n return DefWindowProc(hWnd, message, wParam, lParam);\n\n }\n\n break;\n\n case WM_COMMAND:\n\n wmId = LOWORD(wParam);\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 80, "score": 6.005758896145636 }, { "content": " tempFile);\n\n if(hrTFN == 0 || hrTFN == ERROR_BUFFER_OVERFLOW) abort();\n\n\n\n _tfreopen_s(\n\n &g_programState.freopened,\n\n tempFile,\n\n _T(\"w\"),\n\n stdout);\n\n }\n\n\n\n va_list ap;\n\n va_start(ap, fmt);\n\n\n\n _vwprintf_p(fmt, ap);\n\n fflush(stdout);\n\n\n\n va_end(ap);\n\n}", "file_path": "AltTabber/Log.cpp", "rank": 81, "score": 5.736853050479526 }, { "content": "\tSetProcessDPIAware();\n\n\n\n MSG msg;\n\n HACCEL hAccelTable;\n\n\n\n // Initialize global strings\n\n LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);\n\n LoadString(hInstance, IDC_ALTTABBER, szWindowClass, MAX_LOADSTRING);\n\n MyRegisterClass(hInstance);\n\n\n\n // Perform application initialization:\n\n if (!InitInstance (hInstance, nCmdShow))\n\n {\n\n return FALSE;\n\n }\n\n\n\n hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_ALTTABBER));\n\n\n\n // Main message loop:\n\n while (GetMessage(&msg, NULL, 0, 0))\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 82, "score": 5.677492299157635 }, { "content": "// stdafx.cpp : source file that includes just the standard includes\n\n// AltTabber.pch will be the pre-compiled header\n\n// stdafx.obj will contain the pre-compiled type information\n\n\n\n#include \"stdafx.h\"\n\n\n\n// TODO: reference any additional headers you need in STDAFX.H\n\n// and not in this file\n", "file_path": "AltTabber/stdafx.cpp", "rank": 83, "score": 5.61941568367525 }, { "content": "AltTabber\n\n=========\n\n\n\nRight, this app is a silly alternative to Alt-Tab that works somewhat better on multiple monitors (if by *better* you understand *differently*). You have to see it for yourself.\n\n\n\nThis project lives at https://github.com/alzwded/AltTabber/ .\n\n\n\nThe keys and functionality:\n\n\n\n(*hotkey refers to the global hotkey associated with AltTabber. By default, it is `ALT`-`key above tab`*)\n\n\n\n| action | inputs | comments |\n\n|-----------|-----------|-----------------|\n\n| open overlay | *hotkey* or clicking the icon in the notification area | the main bread of the application |\n\n| close overlay | `Esc` | exits the overlay without switching to a new window and without exiting |\n\n| exit the application | `Alt`-`F4` | duh |\n\n| move to other windows | `Tab`, `Shift`-`Tab`, arrow keys, mouse + click, mouse wheel | this doesn't actually switch the window, rather the selection for actually triggering the selection |\n\n| switch window | `Enter`, double click, *hotkey* | switches to the selected window (the one with a red background |\n\n| help/about | `F1` | |\n\n| start/stop logging | `F2` | this is a debug log; it writes it somewhere in `%TEMP%` in a file with a name like `alt????.tmp` |\n\n| search/filter | any printable characters | starts filtering the windows by name and/or image path in order to help find your window among a couple of dozen |\n\n\n", "file_path": "README.md", "rank": 84, "score": 5.46420017376399 }, { "content": "Changing the hotkey\n\n-------------------\n\n\n\nThe hotkey can be changed from `Alt`-`key above tab` by going in the registry under `HKEY_CURRENT_USER\\Software\\jakkal\\AltTabber` and modifying the `modifiers` and `key` values.\n\n\n\nThe `modifiers` value is a combination of [the values described for fsModifiers here](http://msdn.microsoft.com/en-us/library/windows/desktop/ms646309.aspx) things.\n\n\n\nThe `key` value is one of [these](http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731.aspx).\n\n\n\nFor example, you can set the `modifiers` value to `3` (Alt + Ctrl) and the `key` value to `33` (the `3` key). If you didn't catch on, the aforementioned values are numbers in hexadecimal.\n\n\n\nIf you mess something up, just delete the `HKEY_CURRENT_USER\\Software\\jakka\\AltTabber` key and the app will make sure to recreate it again from defaults.\n\n\n\nIf you want to remove this app from your computer forever, remember to also delete that key. No uninstaller is currently provided, and it's unlikely that one will be provided anytime in the future.\n\n\n\nThat key also contains a flag, `resetOnClose`, which, if set to `0x00000000`, will prevent the AltTabber interface from being reset when you close a window using the context menu.\n\n\n\nDisclaimer\n\n==========\n\n\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n", "file_path": "README.md", "rank": 85, "score": 4.891545060298538 }, { "content": " g_programState.activeSlot++;\n\n log(_T(\"by %d\\n\"), 1);\n\n break;\n\n case VK_BACK:\n\n g_programState.activeSlot--;\n\n log(_T(\"by %d\\n\"), -1);\n\n break;\n\n case VK_LEFT:\n\n p.x = -1;\n\n MoveNextGeographically(p);\n\n break;\n\n case VK_RIGHT:\n\n p.x = 1;\n\n MoveNextGeographically(p);\n\n break;\n\n case VK_UP:\n\n p.y = -1;\n\n MoveNextGeographically(p);\n\n break;\n\n case VK_DOWN:\n", "file_path": "AltTabber/MoveFunctions.cpp", "rank": 86, "score": 3.4933430379875325 }, { "content": " _T(\" the current hotkey, change it in that application\\n\" )\n\n _T(\"- Change AltTabber's hotkey by editing the registry\\n\" )\n\n _T(\" Refer to the README.md document (which you can find\\n\")\n\n _T(\" at http://github.com/alzwded/AltTabber ) on how to\\n\" )\n\n _T(\" accomplish this.\\n\" )\n\n _T(\"\\n\" )\n\n _T(\"The application will now exit\" )\n\n ,\n\n _T(\"AltTabber - Failed to register hotkey\"),\n\n MB_OK | MB_ICONERROR);\n\n Cleanup();\n\n PostQuitMessage(0);\n\n }\n\n\n\n g_programState.hWnd = hWnd;\n\n\n\n NOTIFYICONDATA nid = {};\n\n ZeroMemory(&nid,sizeof(NOTIFYICONDATA));\n\n nid.cbSize = sizeof(NOTIFYICONDATA);\n\n nid.uID = MY_NOTIFICATION_ICON;\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 87, "score": 3.1720651268265874 }, { "content": " if(RegisterHotKey(\n\n hWnd,\n\n 1,\n\n g_programState.hotkey.modifiers,\n\n g_programState.hotkey.key))\n\n {\n\n log(_T(\"hotkey registered successfully\\n\"));\n\n }\n\n else\n\n {\n\n log(_T(\"failed to register hotkey\\n\"));\n\n MessageBox(hWnd,\n\n _T(\"Failed to register hotkey.\\n\" )\n\n _T(\"\\n\" )\n\n _T(\"This usually means that there is already a program\\n\" )\n\n _T(\"running that has registered the same hotkey.\\n\" )\n\n _T(\"\\n\" )\n\n _T(\"Possible resolutions:\\n\" )\n\n _T(\"- Close the already running instance of AltTabber\\n\" )\n\n _T(\"- If there is another application that has registered\\n\")\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 88, "score": 2.5535573366655875 }, { "content": " nid.hWnd = g_programState.hWnd;\n\n nid.uFlags = 0;\n\n Shell_NotifyIcon(NIM_DELETE, &nid);\n\n}\n\n\n\n//\n\n// FUNCTION: MyRegisterClass()\n\n//\n\n// PURPOSE: Registers the window class.\n\n//\n\n// COMMENTS:\n\n//\n\n// This function and its usage are only necessary if you want this code\n\n// to be compatible with Win32 systems prior to the 'RegisterClassEx'\n\n// function that was added to Windows 95. It is important to call this function\n\n// so that the application will get 'well formed' small icons associated\n\n// with it.\n\n//\n\nATOM MyRegisterClass(HINSTANCE hInstance)\n\n{\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 89, "score": 2.2360157522538104 }, { "content": "// AltTabber.cpp : Defines the entry point for the application.\n\n//\n\n\n\n#include \"stdafx.h\"\n\n#include \"AltTabber.h\"\n\n\n\n#define MAX_LOADSTRING 100\n\n\n\n#define MY_NOTIFICATION_ICON 2\n\n#define MY_NOTIFY_ICON_MESSAGE_ID (WM_USER + 88)\n\n#define MY_CLOSE_BTN_ID (WM_USER + 89)\n\n#define MY_TRAY_CLOSE_BTN_ID (WM_USER + 90)\n\n#define MY_TRAY_OPEN_BTN_ID (WM_USER + 91)\n\n\n\n#define MY_MOVE_TO_BASE_ID (WM_USER + 100)\n\n#define MY_MOVE_TO_1_ID (MY_MOVE_TO_BASE_ID + 0)\n\n#define MY_MOVE_TO_2_ID (MY_MOVE_TO_BASE_ID + 1)\n\n#define MY_MOVE_TO_3_ID (MY_MOVE_TO_BASE_ID + 2)\n\n#define MY_MOVE_TO_4_ID (MY_MOVE_TO_BASE_ID + 3)\n\n#define MY_MOVE_TO_5_ID (MY_MOVE_TO_BASE_ID + 4)\n", "file_path": "AltTabber/AltTabber.cpp", "rank": 90, "score": 2.2214775845992354 } ]
C++
Battleships/Source/System/FSystem.cpp
RodrigoHolztrattner/Battleships
cf3e9c8a4a40f52aee41a7b9baaac5a406365a06
#include "FSystem.h" #include "..\Core\Sprite\FSprite.h" #include "..\Core\Video\FShaderBase.h" #include "..\Core\Time\FTime.h" #include "..\Core\Entity\IEntity.h" #include "..\Core\Renderable\IRenderable.h" #include "..\Core\Resource\IResource.h" #include "..\Core\Widget\IWidget.h" #include "..\Core\Entity\Actor\FActorController.h" #include "..\Core\Font\FFontLoader.h" #include "Engine\Widget\Text\FWidText.h" FWidText* s_FpsText; FWidText* s_FrameTime; FSystem::FSystem() { m_GraphicContext = nullptr; m_Player = nullptr; } FSystem::FSystem(const FSystem& other) { } FSystem::~FSystem() { } bool FSystem::Initialize() { bool bResult; m_GraphicContext = new FGraphic; if (!m_GraphicContext) { return false; } bResult = m_GraphicContext->Initialize(WVector2(1600, 900), false); if (!bResult) { return false; } bResult = IResource::InitializeResourceSystem("teste"); if (!bResult) { return false; } bResult = FFontLoader::InitializeFontSystem(); if (!bResult) { return false; } bResult = IWidget::InitializeWidgetSystem(m_GraphicContext); if (!bResult) { return false; } m_Player = new FPlayer; if (!m_Player) { return false; } bResult = m_Player->Initialize(m_GraphicContext); if (!bResult) { return false; } FTime::GetTimeElapsed(true); s_FpsText = IWidget::Create<FWidText>(); s_FpsText->SetLayout(IWidget::LayoutLocationHeight::Bottom, IWidget::LayoutLocationWidth::Left, IWidget::LayoutSize::Absolute, WVector2(0, 64)); s_FpsText->SetSize(WVector2(512, 64)); s_FpsText->SetFont(FHashedString("arial.ttf"), 32); s_FpsText->SetTextFormat(FWidText::TextFormat::Left); s_FrameTime = IWidget::Create<FWidText>(); s_FrameTime->SetLayout(IWidget::LayoutLocationHeight::Bottom, IWidget::LayoutLocationWidth::Left, IWidget::LayoutSize::Absolute, WVector2(0, 32)); s_FrameTime->SetSize(WVector2(512, 64)); s_FrameTime->SetFont(FHashedString("arial.ttf"), 32); s_FrameTime->SetTextFormat(FWidText::TextFormat::Left); return true; } void FSystem::StartEngine() { while (!glfwWindowShouldClose(m_GraphicContext->GetWindowReference())) { float elapsedTime = FTime::GetTimeElapsed(); Update(elapsedTime); Render(elapsedTime); glfwSwapBuffers(m_GraphicContext->GetWindowReference()); glfwPollEvents(); } } void FSystem::Shutdown() { } #include <Windows.h> void ClearConsole() { COORD topLeft = { 0, 0 }; HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE); CONSOLE_SCREEN_BUFFER_INFO screen; DWORD written; GetConsoleScreenBufferInfo(console, &screen); FillConsoleOutputCharacterA( console, ' ', screen.dwSize.X * screen.dwSize.Y, topLeft, &written ); FillConsoleOutputAttribute( console, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE, screen.dwSize.X * screen.dwSize.Y, topLeft, &written ); SetConsoleCursorPosition(console, topLeft); } void FSystem::Update(float _timeElapsed) { static float logTime = 0; static int frameCount = 0; IEntity::UpdateEntities(_timeElapsed); IRenderable::UpdateRenderables(_timeElapsed); IResource::UpdateResourceSystem(_timeElapsed); IWidget::UpdateWidgets(_timeElapsed); m_Player->Update(_timeElapsed); logTime += _timeElapsed; frameCount++; if (logTime >= 1) { ClearConsole(); std::cout << "////////////////////////////////////////////////////////////////////////////////"; std::cout << "// //"; std::cout << "// | Console log | //"; std::cout << "// //"; std::cout << "////////////////////////////////////////////////////////////////////////////////" << std::endl; LEntityLog::PrintNumberEntities(); LRenderableLog::PrintNumberRenderables(); LResourceLog::PrintNumberResources(); std::cout << std::endl; std::cout << "FPS: " << frameCount << std::endl; std::cout << "Frame time: " << 1.0 / frameCount << std::endl; s_FpsText->SetText("FPS: 1414", 32); s_FrameTime->SetText("Frame time: 0.00068736", 32); unsigned int actorCounter; FActor** pickedActors = FActorController::PickAllActorsInRange<FNormalShip>(WVector2(0, 0), 300, actorCounter); std::cout << "Total picked actors: " << actorCounter << std::endl; std::cout << std::endl << "////////////////////////////////////////////////////////////////////////////////" << std::endl; logTime = 0; frameCount = 0; } } void FSystem::Render(float _timeElapsed) { IRenderable::RenderRenderables(); IWidget::RenderWidgets(); m_GraphicContext->BindDeferredFramebuffer(); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); FShaderBase::RenderDeferredShaders(_timeElapsed, m_Player->Camera(), m_GraphicContext); m_GraphicContext->UnbindDeferredFramebuffer(); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); FShaderBase::RenderShaders(_timeElapsed, m_Player->Camera(), m_GraphicContext); }
#include "FSystem.h" #include "..\Core\Sprite\FSprite.h" #include "..\Core\Video\FShaderBase.h" #include "..\Core\Time\FTime.h" #include "..\Core\Entity\IEntity.h" #include "..\Core\Renderable\IRenderable.h" #include "..\Core\Resource\IResource.h" #include "..\Core\Widget\IWidget.h" #include "..\Core\Entity\Actor\FActorController.h" #include "..\Core\Font\FFontLoader.h" #include "Engine\Widget\Text\FWidText.h" FWidText* s_FpsText; FWidText* s_FrameTime; FSystem::FSystem() { m_GraphicContext = nullptr; m_Player = nullptr; } FSystem::FSystem(const FSystem& other) { } FSystem::~FSystem() { } bool FSystem::Initialize() { bool bResult; m_GraphicContext = new FGraphic; if (!m_GraphicContext) { return false; } bResult = m_GraphicContext->Initialize(WVector2(1600, 900), false); if (!bResult) { return false; } bResult = IResource::InitializeResourceSystem("teste"); if (!bResult) { return false; } bResult = FFontLoader::InitializeFontSystem(); if (!bResult) { return false; } bResult = IWidget::InitializeWidgetSystem(m_GraphicContext); if (!bResult) { return false; } m_Player = new FPlayer; if (!m_Player) { return false; } bResult = m_Player->Initialize(m_GraphicContext); if (!bResult) { return false; } FTime::GetTimeElapsed(true); s_FpsText = IWidget::Create<FWidText>(); s_FpsText->SetLayout(IWidget::LayoutLocationHeight::Bottom, IWidget::LayoutLocationWidth::Left, IWidget::LayoutSize::Absolute, WVector2(0, 64)); s_FpsText->SetSize(WVector2(512, 64)); s_FpsText->SetFont(FHashedString("arial.ttf"), 32); s_FpsText->SetTextFormat(FWidText::TextFormat::Left); s_FrameTime = IWidget::Create<FWidText>(); s_FrameTime->SetLayout(IWidget::LayoutLocationHeight::Bottom, IWidget::LayoutLocationWidth::Left, IWidget::LayoutSize::Absolute, WVector2(0, 32)); s_FrameTime->SetSize(WVector2(512, 64)); s_FrameTime->SetFont(FHashedString("arial.ttf"), 32); s_FrameTime->SetTextFormat(FWidText::TextFormat::Left); return true; }
void FSystem::Shutdown() { } #include <Windows.h> void ClearConsole() { COORD topLeft = { 0, 0 }; HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE); CONSOLE_SCREEN_BUFFER_INFO screen; DWORD written; GetConsoleScreenBufferInfo(console, &screen); FillConsoleOutputCharacterA( console, ' ', screen.dwSize.X * screen.dwSize.Y, topLeft, &written ); FillConsoleOutputAttribute( console, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE, screen.dwSize.X * screen.dwSize.Y, topLeft, &written ); SetConsoleCursorPosition(console, topLeft); } void FSystem::Update(float _timeElapsed) { static float logTime = 0; static int frameCount = 0; IEntity::UpdateEntities(_timeElapsed); IRenderable::UpdateRenderables(_timeElapsed); IResource::UpdateResourceSystem(_timeElapsed); IWidget::UpdateWidgets(_timeElapsed); m_Player->Update(_timeElapsed); logTime += _timeElapsed; frameCount++; if (logTime >= 1) { ClearConsole(); std::cout << "////////////////////////////////////////////////////////////////////////////////"; std::cout << "// //"; std::cout << "// | Console log | //"; std::cout << "// //"; std::cout << "////////////////////////////////////////////////////////////////////////////////" << std::endl; LEntityLog::PrintNumberEntities(); LRenderableLog::PrintNumberRenderables(); LResourceLog::PrintNumberResources(); std::cout << std::endl; std::cout << "FPS: " << frameCount << std::endl; std::cout << "Frame time: " << 1.0 / frameCount << std::endl; s_FpsText->SetText("FPS: 1414", 32); s_FrameTime->SetText("Frame time: 0.00068736", 32); unsigned int actorCounter; FActor** pickedActors = FActorController::PickAllActorsInRange<FNormalShip>(WVector2(0, 0), 300, actorCounter); std::cout << "Total picked actors: " << actorCounter << std::endl; std::cout << std::endl << "////////////////////////////////////////////////////////////////////////////////" << std::endl; logTime = 0; frameCount = 0; } } void FSystem::Render(float _timeElapsed) { IRenderable::RenderRenderables(); IWidget::RenderWidgets(); m_GraphicContext->BindDeferredFramebuffer(); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); FShaderBase::RenderDeferredShaders(_timeElapsed, m_Player->Camera(), m_GraphicContext); m_GraphicContext->UnbindDeferredFramebuffer(); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); FShaderBase::RenderShaders(_timeElapsed, m_Player->Camera(), m_GraphicContext); }
void FSystem::StartEngine() { while (!glfwWindowShouldClose(m_GraphicContext->GetWindowReference())) { float elapsedTime = FTime::GetTimeElapsed(); Update(elapsedTime); Render(elapsedTime); glfwSwapBuffers(m_GraphicContext->GetWindowReference()); glfwPollEvents(); } }
function_block-full_function
[ { "content": "function with a return - the return value is simply ignored.\n\n(See ethel example below)\n\n\n\nAll the correct virtual function behavior is preserved. (see ricky\n\nexample below).\n\n\n\nIf you somehow try to create something in violation\n\nof the type system you will get a compile-time or template-instantiation-\n\ntime error.\n\n\n\nThe CBFunctor base class and translator\n\nclasses are artifacts of this implementation. You should not write\n\ncode that relies upon their existence. Nor should you rely on the return\n\nvalue of makeFunctor being anything in particular.\n\n\n\nAll that is guaranteed is that the Functor classes have a default ctor,\n\nan operator() with the requested argument types and return type, an\n\noperator that will allow it to be evaluated in a conditional (with\n\n'true' meaning the functor is set, 'false' meaning it is not), and that\n\nFunctors can be constructed from the result of makeFunctor(), given\n", "file_path": "Battleships/Source/Core/Support/Callback/Callback.h", "rank": 0, "score": 81327.65190752767 }, { "content": "////////////////////////////////////////////////////////////////////////////////\n\n// Class name: FPlayer\n\n////////////////////////////////////////////////////////////////////////////////\n\nclass FPlayer\n\n{\n\nprivate:\n\n\n\npublic:\n\n\tFPlayer();\n\n\tFPlayer(const FPlayer&);\n\n\t~FPlayer();\n\n\n\n\t// Initialize this player\n\n\tbool Initialize(FGraphic* _graphicContext);\n\n\n\n\t// Update the player data and objects (process the input messages, etc etc)\n\n\tvoid Update(float _time);\n\n\n\n\t// Return the player camera\n\n\tFCamera* Camera()\n\n\t{\n\n\t\treturn m_Camera;\n\n\t}\n", "file_path": "Battleships/Source/System/Engine/Player/FPlayer.h", "rank": 1, "score": 34736.797052636095 }, { "content": "////////////////////////////////////////////////////////////////////////////////\n\n// Class name: FGraphic\n\n////////////////////////////////////////////////////////////////////////////////\n\nclass FGraphic\n\n{\n\npublic:\n\n\n\npublic:\n\n\tFGraphic();\n\n\tFGraphic(const FGraphic&);\n\n\t~FGraphic();\n\n\n\n\t// Initialize the opengl context\n\n\tbool Initialize(WVector2 _resolution, bool _fullScreen);\n\n\n\n\t// Create the deferred buffers\n\n\tbool CreateDeferredBuffers();\n\n\n\n\t// Bind the deferred framebuffer\n\n\tvoid BindDeferredFramebuffer();\n\n\n\n\t// Unbind the deferred framebuffer\n\n\tvoid UnbindDeferredFramebuffer();\n", "file_path": "Battleships/Source/Core/Video/FGraphic.h", "rank": 2, "score": 34736.797052636095 }, { "content": "////////////////////////////////////////////////////////////////////////////////\n\n// Class name: FSystem\n\n////////////////////////////////////////////////////////////////////////////////\n\nclass FSystem\n\n{\n\nprivate:\n\n\n\npublic:\n\n\tFSystem();\n\n\tFSystem(const FSystem&);\n\n\t~FSystem();\n\n\n\n\t// Initialize the system\n\n\tbool Initialize();\n\n\n\n\t// Start the system engine\n\n\tvoid StartEngine();\n\n\n\n\t// Shutdown the system\n\n\tvoid Shutdown();\n\n\n\n\tFSystem& operator + (FSystem other)\n\n\t{\n", "file_path": "Battleships/Source/System/FSystem.h", "rank": 3, "score": 34736.797052636095 }, { "content": "////////////////////////////////////////////////////////////////////////////////\n\n// Class name: FWidText\n\n////////////////////////////////////////////////////////////////////////////////\n\nclass FWidText : public IWidget\n\n{\n\n\t// Font shader is a friend class\n\n\tfriend FWidTextShader;\n\n\n\npublic:\n\n\n", "file_path": "Battleships/Source/System/Engine/Widget/Text/FWidText.h", "rank": 4, "score": 30036.91620742531 }, { "content": "\t\treturn nullptr;\n\n\t}\n\n\n\n\t// Set the font face hash\n\n\tnewFontFace->stringHash = _stringName.Hash();\n\n\n\n\t// Insert the new font into the font array\n\n\tm_FontFaces.Add(newFontFace);\n\n\t\n\n\t// Return the new font face\n\n\treturn m_FontFaces[m_FontFaces.Size() - 1];\n\n}\n\n\n\nbool FFontLoader::CreateFontTexture(FontFace* _fontFace)\n\n{\n\n\tint highestSize = 0;\n\n\n\n\t// Check each glyph and find the highest size\n\n\tfor (int i = 0; i < 256; i++)\n\n\t{\n", "file_path": "Battleships/Source/Core/Font/FFontLoader.cpp", "rank": 5, "score": 13.23746546035462 }, { "content": "\t\tLRenderableLog::PrintRenderableCreated(newRenderable);\n\n\n\n\t\treturn newRenderable;\n\n\t}\n\n\n\n\t// Release this object (mark it for deletion)\n\n\tvirtual void Release()\n\n\t{\n\n\t\t// Set the deletion mark to true\n\n\t\tm_DeletionMark = true;\n\n\t}\n\n\n\n\t// Return the owner\n\n\tFActor* GetOwner()\n\n\t{\n\n\t\treturn m_Owner;\n\n\t}\n\n\n\n\t///////////////\n\n\t// COLLISION //\n", "file_path": "Battleships/Source/Core/Renderable/IRenderable.h", "rank": 6, "score": 12.396708265191528 }, { "content": "FResourceManager* IResource::m_ResourceManager = nullptr;\n\nFResourceLoader* IResource::m_ResourceLoader = nullptr;\n\n\n\nbool IResource::InitializeResourceSystem(const char* _mainDataHeaderName)\n\n{\n\n\t// Create the resource manager\n\n\tm_ResourceManager = new FResourceManager;\n\n\tif (m_ResourceManager == nullptr)\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\n\n\t// Create the resource cache\n\n\tm_ResourceCache = new FResourceCache;\n\n\tif (m_ResourceCache == nullptr)\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\n\n\t// Create the resource loader\n", "file_path": "Battleships/Source/Core/Resource/IResource.cpp", "rank": 7, "score": 11.59358171546755 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FMap.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FMap.h\"\n\n\n\nFMap::FMap()\n\n{\n\n}\n\n\n\nFMap::FMap(const FMap& other)\n\n{\n\n}\n\n\n\nFMap::~FMap()\n\n{\n\n}\n\n\n\nbool FMap::Initialize()\n\n{\n\n\tbool result;\n\n\n\n\treturn true;\n\n}", "file_path": "Battleships/Source/System/Engine/Map/FMap.cpp", "rank": 8, "score": 11.52172171282606 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: TArray.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"TArray.h\"\n\n\n\n/*\n\n\n\nTArray::TArray()\n\n{\n\n}\n\n\n\nTArray::TArray(const TArray& other)\n\n{\n\n}\n\n\n\nTArray::~TArray()\n\n{\n\n}\n\n\n\nbool TArray::Initialize()\n\n{\n\n\tbool result;\n\n\n\n\treturn true;\n\n}\n\n\n\n*/", "file_path": "Battleships/Source/Core/Containers/Array/TArray.cpp", "rank": 9, "score": 11.52172171282606 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FTimeline.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FTimeline.h\"\n\n\n\nFTimeline::FTimeline()\n\n{\n\n}\n\n\n\nFTimeline::FTimeline(const FTimeline& other)\n\n{\n\n}\n\n\n\nFTimeline::~FTimeline()\n\n{\n\n}\n\n\n\nbool FTimeline::Initialize()\n\n{\n\n\tbool result;\n\n\n\n\treturn true;\n\n}", "file_path": "Battleships/Source/Core/Support/Timeline/FTimeline.cpp", "rank": 10, "score": 11.52172171282606 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: TQuadtree.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"TQuadtree.h\"\n\n\n\n/*\n\nTQuadtree::TQuadtree()\n\n{\n\n}\n\n\n\nTQuadtree::TQuadtree(const TQuadtree& other)\n\n{\n\n}\n\n\n\nTQuadtree::~TQuadtree()\n\n{\n\n}\n\n\n\nbool TQuadtree::Initialize()\n\n{\n\n\tbool result;\n\n\n\n\treturn true;\n\n}\n\n*/", "file_path": "Battleships/Source/Core/Containers/Tree/TQuadtree.cpp", "rank": 11, "score": 11.52172171282606 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: BaseClass.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"BaseClass.h\"\n\n\n\nBaseClass::BaseClass()\n\n{\n\n}\n\n\n\nBaseClass::BaseClass(const BaseClass& other)\n\n{\n\n}\n\n\n\nBaseClass::~BaseClass()\n\n{\n\n}\n\n\n\nbool BaseClass::Initialize()\n\n{\n\n\tbool result;\n\n\n\n\treturn true;\n\n}", "file_path": "Battleships/Source/System/BaseClass.cpp", "rank": 12, "score": 11.52172171282606 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: BaseClass.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"BaseClass.h\"\n\n\n\nBaseClass::BaseClass()\n\n{\n\n}\n\n\n\nBaseClass::BaseClass(const BaseClass& other)\n\n{\n\n}\n\n\n\nBaseClass::~BaseClass()\n\n{\n\n}\n\n\n\nbool BaseClass::Initialize()\n\n{\n\n\tbool result;\n\n\n\n\treturn true;\n\n}", "file_path": "Battleships/BaseClass.cpp", "rank": 13, "score": 11.52172171282606 }, { "content": "// Declare the widget panel and widget input variables\n\nFWidgetPanel* IWidget::m_WidgetPanel = nullptr;\n\nFWidgetInput* IWidget::m_WidgetInput = nullptr;\n\n\n\nbool IWidget::InitializeWidgetSystem(FGraphic* _graphicContext)\n\n{\n\n\t// Create the widget panel\n\n\tm_WidgetPanel = new FWidgetPanel;\n\n\tif (m_WidgetPanel == nullptr)\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\n\n\t// Create the widget input\n\n\tm_WidgetInput = new FWidgetInput;\n\n\tif (m_WidgetInput == nullptr)\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\n", "file_path": "Battleships/Source/Core/Widget/IWidget.cpp", "rank": 14, "score": 11.465532901456225 }, { "content": "\n\n\t\treturn true;\n\n\t}\n\n\n\n\treturn nullptr;\n\n}\n\n\n\nvoid FObject::SetLocation(WVector3 _location)\n\n{\n\n\t// Save the current position\n\n\tm_LastLocation = GetLocation();\n\n\n\n\t// Set the new location\n\n\tm_Location = _location;\n\n}", "file_path": "Battleships/Source/Core/Entity/Actor/FObject.cpp", "rank": 15, "score": 11.33258586982356 }, { "content": "\t// Return the alpha value\n\n\tfloat Alpha()\n\n\t{\n\n\t\treturn m_Alpha;\n\n\t}\n\n\n\n\t// Return the color\n\n\tWVector3 Color()\n\n\t{\n\n\t\treturn m_Color;\n\n\t}\n\n\n\n\t// Check if the given position is inside the colision region for this flipbook (if there is a collision, call the m_CollisionFunction function)\n\n\tbool VerifyPreciseCollision(WVector2 _location, bool _takeParentPosition = true);\n\n\n\nprotected:\n\n\n\n\t// Update the flipbook animation\n\n\tvoid Update(float _time);\n\n\n", "file_path": "Battleships/Source/Core/Renderable/Flipbook/FFlipbook.h", "rank": 16, "score": 11.301765949980355 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FTexture.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FTexture.h\"\n\n\n\nFTexture::FTexture()\n\n{\n\n\t// Set the initial data\n\n\tm_TextureHandle = -1;\n\n}\n\n\n\nFTexture::FTexture(const FTexture& other)\n\n{\n\n}\n\n\n\nFTexture::~FTexture()\n\n{\n\n}\n\n\n\nbool FTexture::Initialize()\n\n{\n\n\tbool result;\n\n\n\n\treturn true;\n\n}", "file_path": "Battleships/Source/Core/Sprite/FTexture.cpp", "rank": 17, "score": 11.013691633306289 }, { "content": "\t\tm_Free = true;\n\n\t}\n\n\tFThread(const FThread&){}\n\n\t~FThread(){}\n\n\n\n\t// Dispatch this thread (if we got a free thread) or just run inside the main thread\n\n\tvoid Dispatch(WCallback<CallType> _function, CallType* _Data)\n\n\t{\n\n\t\t// Set the threaded function\n\n\t\tm_ThreadedFunction = _function;\n\n\n\n\t\t// Create a new thread to dispatch\n\n\t\tstd::thread dispatchThread(FThread::DispatchHelper, this, _Data);\n\n\t\tdispatchThread.detach();\n\n\t}\n\n\n\n\t// Return if this thread is free\n\n\tbool Free()\n\n\t{\n\n\t\treturn m_Free;\n", "file_path": "Battleships/Source/Core/Support/Thread/FThread.h", "rank": 18, "score": 10.823957520705255 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FAllocatorBase.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FAllocatorBase.h\"\n\n\n\nFAllocatorBase::FAllocatorBase()\n\n{\n\n}\n\n\n\nFAllocatorBase::FAllocatorBase(const FAllocatorBase& other)\n\n{\n\n}\n\n\n\nFAllocatorBase::~FAllocatorBase()\n\n{\n\n}\n\n\n\nbool FAllocatorBase::Initialize()\n\n{\n\n\tbool result;\n\n\n\n\treturn true;\n\n}", "file_path": "Battleships/Source/Core/Allocators/FAllocatorBase.cpp", "rank": 19, "score": 10.550007154687314 }, { "content": "\n\n\t// Return true if the given point is inside this object\n\n\tbool IsPointInside(WVector2 _point);\n\n\n\nprotected:\n\n\n\n\t// The position\n\n\tWVector2 p_Position;\n\n\n\n\t// The size\n\n\tWVector2 p_Size;\n\n};\n\n\n\n//////////////\n\n// TYPEDEFS //\n\n//////////////\n\n\n\ntypedef WTransform2D WRect;\n\ntypedef WTransform2D WPoint;\n\n\n\n#endif\n", "file_path": "Battleships/Source/Core/Support/Math/Transform/WTransform2D.h", "rank": 20, "score": 10.11209350551242 }, { "content": "\t\t// Set the function\n\n\t\tm_Callback = makeFunctor((CBFunctor1<ParameterType*>*)0, member, function);\n\n\n\n\t\t// Set the bool variable\n\n\t\tm_Set = true;\n\n\t}\n\n\n\n\t// Set the callback\n\n\tWCallback(const CBFunctor1<ParameterType*> &uponClickDoThis) :m_Callback(uponClickDoThis){}\n\n\n\n\t// The function that will run\n\n\tvoid Run(ParameterType* data){ m_Callback(data); }\n\n\n\n\t// Return the set value\n\n\tbool IsSet()\n\n\t{\n\n\t\treturn m_Set;\n\n\t}\n\n\t\n\nprivate:\n", "file_path": "Battleships/Source/Core/Support/Callback/WCallback.h", "rank": 21, "score": 10.106170801101127 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: IWidget.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"IWidget.h\"\n\n#include \"FWidgetPanel.h\"\n\n#include \"FWidgetInput.h\"\n\n#include \"..\\Video\\FGraphic.h\"\n\n#include \"..\\Input\\FInput.h\"\n\n#include \"..\\Video\\FShaderBase.h\"\n\n\n\nIWidget::IWidget()\n\n{\n\n\t// Set the initial data\n\n\tm_Parent = nullptr;\n\n\tm_Shader = nullptr;\n\n\tm_StatusFlags = (IWidget::StatusFlag)0;\n\n\tm_ScreenPosition = WVector2(0, 0);\n\n\tm_Size = WVector2(0, 0);\n\n\tm_Rotation = 0;\n\n\tm_Layout = Layout::Normal;\n", "file_path": "Battleships/Source/Core/Widget/IWidget.cpp", "rank": 23, "score": 9.251568411398871 }, { "content": "\n\n\treturn true;\n\n}\n\n\n\nbool FActorController::RemoveActor(FActor* _actor)\n\n{\n\n\tbool result;\n\n\n\n\t// Remove the actor from the quadtree\n\n\tresult = m_ActorQuadtree.Remove(_actor);\n\n\tif (!result)\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\n\n\treturn true;\n\n}\n\n\n\nbool FActorController::UpdateActorPosition(FActor* _actor, WVector2 _position)\n\n{\n", "file_path": "Battleships/Source/Core/Entity/Actor/FActorController.cpp", "rank": 24, "score": 9.183719932314744 }, { "content": "\n\n\t// Return if we should keep track of this (if false, no pick or collision functions will have effect on this object)\n\n\tbool ShouldKeepTrack(){ return true; };\n\n\n\nprivate:\n\n\n\n\t// The current and expected turn direction\n\n\tfloat m_CurrentTurnDirection;\n\n\tfloat m_ExpectedTurnDirection;\n\n\n\n\t// The current (this will move out ship into the facing direction) and maximum accelerations\n\n\tfloat m_CurrentAcceleration;\n\n\tfloat m_ExpectedAcceleration;\n\n\tfloat m_MaximumAcceleration;\n\n\n\n\t// The lantern light and the light status\n\n\tFSpotLight* m_LanternLight;\n\n\tbool m_LightStatus;\n\n\n\n\t// The headlight\n\n\tFPointLight* m_Headlight;\n\n};\n\n\n\n#endif\n", "file_path": "Battleships/Source/System/Engine/Ship/FShip.h", "rank": 25, "score": 9.02833284832737 }, { "content": "\t\treturn &(*resource).second;\n\n\t}\n\n\n\n\t// Return a null ptr -header-\n\n\treturn nullptr;\n\n}\n\n\n\n////////////\n\n// GLOBAL //\n\n////////////\n", "file_path": "Battleships/Source/Core/Resource/FResourceManager.cpp", "rank": 26, "score": 9.019386320078523 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FWidgetPanel.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FWidgetPanel.h\"\n\n\n\nFWidgetPanel::FWidgetPanel()\n\n{\n\n\t// Set the initial data\n\n\tm_Root = nullptr;\n\n}\n\n\n\nFWidgetPanel::FWidgetPanel(const FWidgetPanel& other)\n\n{\n\n}\n\n\n\nFWidgetPanel::~FWidgetPanel()\n\n{\n\n}\n\n\n\nbool FWidgetPanel::Initialize(FGraphic* _graphicContext)\n", "file_path": "Battleships/Source/Core/Widget/FWidgetPanel.cpp", "rank": 27, "score": 8.968561553955606 }, { "content": "\n\n\t\t// Check if the leafs are the same\n\n\t\tif (leafNode == oldLeafNode)\n\n\t\t{\n\n\t\t\t// The object is inside the same leaf\n\n\t\t\treturn true;\n\n\t\t}\n\n\n\n\t\t// Remove the object\n\n\t\tRemove(_object);\n\n\n\n\t\t// Re-insert it (at the new location)\n\n\t\tInsert(_object, _location, true);\n\n\n\n\t\treturn true;\n\n\t}\n\n\n\n\t//////////\n\n\t// PICK //\n\n\t//////////\n", "file_path": "Battleships/Source/Core/Containers/Tree/TQuadtree.h", "rank": 28, "score": 8.948785963499285 }, { "content": "\tbool CreateShaderFromFile(char* _shaderPath, unsigned int _shaderType, unsigned int& _shader);\n\n\n\n\t// Output the error messages\n\n\tvoid OutputShaderErrorMessage(unsigned int _shader, char* _filename);\n\n\tvoid OutputLinkerErrorMessage(unsigned int _shaderProgram);\n\n\n\npublic:\n\n\n\n\t////////////\n\n\t// GLOBAL //\n\n\t////////////\n\n\n\n\t// Return a shader by type\n\n\ttemplate <typename ShaderClass>\n\n\tstatic FShaderBase* GetShader()\n\n\t{\n\n\t\tstatic FShaderBase* shader = nullptr;\n\n\n\n\t\t// Check if the shader already exist\n\n\t\tif (shader == nullptr)\n", "file_path": "Battleships/Source/Core/Video/FShaderBase.h", "rank": 29, "score": 8.946602511498856 }, { "content": "\n\n\treturn true;\n\n}\n\n\n\nbool FFileIO::Read(unsigned int _amount, void* _to)\n\n{\n\n\t// Read from the file\n\n\tint count = fread(_to, _amount, 1, m_File);\n\n\tif (count != 1)\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\n\n\treturn true;\n\n}\n\n\n\nbool FFileIO::Close()\n\n{\n\n\t// Close the file\n\n\tint error = fclose(m_File);\n", "file_path": "Battleships/Source/Core/Support/File/FFileIO.cpp", "rank": 30, "score": 8.933925258238823 }, { "content": "\n\n\t// Create the new font face\n\n\tint error = FT_New_Face(m_FontLibrary, _stringName.String(), 0, &newFontFace->face);\n\n\tif (error == FT_Err_Unknown_File_Format)\n\n\t{\n\n\t\t// Unknow file format\n\n\t\treturn nullptr;\n\n\t}\n\n\telse if (error)\n\n\t{\n\n\t\t// Invalid path, font does not exist or another error\n\n\t\treturn nullptr;\n\n\t}\n\n\n\n\t// Set the font height\n\n\tFT_Set_Pixel_Sizes(newFontFace->face, 0, _fontHeight);\n\n\n\n\t// Create the font texture\n\n\tif (!CreateFontTexture(newFontFace))\n\n\t{\n", "file_path": "Battleships/Source/Core/Font/FFontLoader.cpp", "rank": 31, "score": 8.860724442644496 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FGraphic.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FGraphic.h\"\n\n#include \"..\\Input\\FInput.h\"\n\n\n\nFGraphic::FGraphic()\n\n{\n\n}\n\n\n\nFGraphic::FGraphic(const FGraphic& other)\n\n{\n\n}\n\n\n\nFGraphic::~FGraphic()\n\n{\n\n}\n\n\n\nbool FGraphic::Initialize(WVector2 _resolution, bool _fullScreen)\n\n{\n", "file_path": "Battleships/Source/Core/Video/FGraphic.cpp", "rank": 32, "score": 8.61786084309545 }, { "content": "{\n\n\t// Call the log class\n\n\tLResourceLog::PrintResourceReleased(this);\n\n\n\n\t// Decrement the reference count\n\n\tDecrementReferences();\n\n}\n\n\n\n// The resource log \"watch\" initialization\n\nIResource* LResourceLog::ResourceWatch = nullptr;\n\n\n\n////////////\n\n// GLOBAL //\n\n////////////\n\n#include \"FResourceCache.h\"\n\n#include \"FResourceManager.h\"\n\n#include \"FResourceLoader.h\"\n\n\n\n// Set a null ptr for the resource cache, the resource manager and the resource loader\n\nFResourceCache* IResource::m_ResourceCache = nullptr;\n", "file_path": "Battleships/Source/Core/Resource/IResource.cpp", "rank": 33, "score": 8.360442392494033 }, { "content": "}\n\n\n\nFSprite::FSprite(const FSprite& other)\n\n{\n\n}\n\n\n\nFSprite::~FSprite()\n\n{\n\n}\n\n\n\nbool FSprite::Load()\n\n{\n\n\tbool result;\n\n\n\n\t// Use mutexes here //\n\n\n\n\treturn true;\n\n}\n\n\n\nvoid FSprite::Update(float _time)\n", "file_path": "Battleships/Source/Core/Sprite/FSprite.cpp", "rank": 34, "score": 8.27795687374804 }, { "content": "\tbool result;\n\n\n\n\t// Update the actor from the quadtree\n\n\tresult = m_ActorQuadtree.Update(_actor, _position);\n\n\tif (!result)\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\n\n\treturn true;\n\n}", "file_path": "Battleships/Source/Core/Entity/Actor/FActorController.cpp", "rank": 35, "score": 8.254167410368995 }, { "content": "\n\n\t// The callback function variable\n\n\tCBFunctor1<ParameterType*> m_Callback;\n\n\n\n\t// If the callback is set this will be true\n\n\tbool m_Set;\n\n};\n\n\n\n#endif\n", "file_path": "Battleships/Source/Core/Support/Callback/WCallback.h", "rank": 36, "score": 8.254167410368995 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FTime.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FTime.h\"\n\n#include <stdio.h>\n\n#include <time.h>\n\n\n\nFTime::FTime()\n\n{\n\n}\n\n\n\nFTime::FTime(const FTime& other)\n\n{\n\n}\n\n\n\nFTime::~FTime()\n\n{\n\n}\n\n\n\nfloat FTime::GetTimeElapsed(bool _reset)\n", "file_path": "Battleships/Source/Core/Time/FTime.cpp", "rank": 37, "score": 8.185885991197772 }, { "content": "}\n\n\n\nbool FWidgetInput::Initialize()\n\n{\n\n\tbool result;\n\n\n\n\treturn true;\n\n}\n\n\n\nvoid FWidgetInput::ProcessInput(IWidget* _root)\n\n{\n\n\tbool result;\n\n\n\n\t// Get the input iterator\n\n\tFInput::Iterator iterator;\n\n\n\n\t// For each input message\n\n\tfor (iterator.Begin(); iterator.End(); iterator.Next())\n\n\t{\n\n\t\t// Process this input for all widgets\n", "file_path": "Battleships/Source/Core/Widget/FWidgetInput.cpp", "rank": 38, "score": 8.090562695397344 }, { "content": "\tFProgramableShader::GetCurrentShaderReference()->OutputStream(&buffer);\n\n\n\n\treturn true;\n\n}\n\n\n\nbool FIFloat::operator> (const float& arg)\n\n{\n\n\tstd::ostringstream buffer;\n\n\n\n\t// Set the buffer\n\n\tbuffer << m_VariableName << \">\" << arg << \";\";\n\n\n\n\t// Output the stream\n\n\tFProgramableShader::GetCurrentShaderReference()->OutputStream(&buffer);\n\n\n\n\treturn true;\n\n}\n\nbool FIFloat::operator<=(const float& arg)\n\n{\n\n\tstd::ostringstream buffer;\n", "file_path": "Battleships/Source/Core/Shader/Intrinsics/FIFloat.cpp", "rank": 39, "score": 8.004961204008577 }, { "content": "\t\t\t\tdata = 0;\n\n\t\t\t}\n\n\n\n\t\t\t// Set the new array\n\n\t\t\tdata = tempArray;\n\n\t\t}\n\n\n\n\t\t// Copy the new data\n\n\t\tmemcpy(&data[numberUnits], from, sizeof(T) * quantity);\n\n\n\n\t\t// Increment the size\n\n\t\tnumberUnits += quantity;\n\n\t}\n\n\n\n\t// Return a value from the array\n\n\tT Get(int pos)\n\n\t{\n\n\t\treturn data[pos];\n\n\t}\n\n\n", "file_path": "Battleships/Source/Core/Containers/Array/TArray.h", "rank": 40, "score": 7.912500924279019 }, { "content": "\n\n\t// Output the stream\n\n\tFProgramableShader::GetCurrentShaderReference()->OutputStream(&buffer);\n\n\n\n\treturn true;\n\n}\n\nbool FIFloat::operator<=(const FIFloat& arg)\n\n{\n\n\tstd::ostringstream buffer;\n\n\n\n\t// Set the buffer\n\n\tbuffer << m_VariableName << \"<=\" << arg.m_VariableName << \";\";\n\n\n\n\t// Output the stream\n\n\tFProgramableShader::GetCurrentShaderReference()->OutputStream(&buffer);\n\n\n\n\treturn true;\n\n}\n\nbool FIFloat::operator>=(const FIFloat& arg)\n\n{\n", "file_path": "Battleships/Source/Core/Shader/Intrinsics/FIFloat.cpp", "rank": 41, "score": 7.860719375076062 }, { "content": "\t\t\t\tdata = 0;\n\n\t\t\t}\n\n\n\n\t\t\t// Set the new array\n\n\t\t\tdata = tempArray;\n\n\t\t}\n\n\n\n\t\t// Copy the new data\n\n\t\tmemcpy(&data[numberUnits], from, sizeof(T) * quantity);\n\n\n\n\t\t// Increment the size\n\n\t\tnumberUnits += quantity;\n\n\t}\n\n\n\n\t// Return a value from the array\n\n\tT Get(unsigned int pos)\n\n\t{\n\n\t\treturn data[pos];\n\n\t}\n\n\n", "file_path": "Battleships/GroupClass.h", "rank": 42, "score": 7.846882566450761 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FResourceLoader.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FResourceLoader.h\"\n\n#include \"IResource.h\"\n\n#include <assert.h> /* assert */\n\n\n\nFResourceLoader::FResourceLoader()\n\n{\n\n}\n\n\n\nFResourceLoader::FResourceLoader(const FResourceLoader& other)\n\n{\n\n}\n\n\n\nFResourceLoader::~FResourceLoader()\n\n{\n\n}\n\n\n\nbool FResourceLoader::Initialize()\n", "file_path": "Battleships/Source/Core/Resource/FResourceLoader.cpp", "rank": 43, "score": 7.799670420885366 }, { "content": "\n\n\t// <GLOBAL> Return the root widget\n\n\tstatic IWidget* RootWidget();\n\n\n\n\t// Pre-declare the function that return the root widget (so we can use it inside the Create() method) //\n\n\n\n\t// Create a instance of this object and return a ptr to it\n\n\ttemplate <typename WidgetClass>\n\n\tstatic WidgetClass* Create(IWidget* _parent = IWidget::RootWidget())\n\n\t{\n\n\t\t// Create a new widget\n\n\t\tWidgetClass* newWidget = new WidgetClass;\n\n\n\n\t\t// Set the parent\n\n\t\tnewWidget->SetParent(_parent);\n\n\n\n\t\t// Call the log class\n\n\t\t// LEntityLog::PrintEntityCreated(newWidget);\n\n\n\n\t\treturn newWidget;\n", "file_path": "Battleships/Source/Core/Widget/IWidget.h", "rank": 44, "score": 7.771260745146584 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FSprite.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FSprite.h\"\n\n#include \"..\\Video\\FShaderManager.h\"\n\n#include \"FSpriteShader.h\"\n\n\n\nFSprite::FSprite()\n\n{\n\n\t// Register this sprite\n\n\tRegisterSprite(this);\n\n\n\n\t// Set all ptrs to null\n\n\tm_TextureArray = nullptr;\n\n\n\n\t// Set the initial data\n\n\tm_bIsLoaded = false;\n\n\tm_CurrentAnimationTime = 0;\n\n\tm_Size = WVector2(1, 1);\n\n\tm_Rotation = 0;\n", "file_path": "Battleships/Source/Core/Sprite/FSprite.cpp", "rank": 45, "score": 7.749662663790168 }, { "content": "\t// Set the light\n\n\tvoid SetLight(FLight* _light);\n\n\n\nprotected:\n\n\n\n\t// Return if we should keep track of this (if false, no pick or collision functions will have effect on this object)\n\n\tbool ShouldKeepTrack(){ return false; };\n\n\n\n};\n\n\n\n#endif\n", "file_path": "Battleships/Source/System/Engine/Light/FPointLight.h", "rank": 46, "score": 7.594467754766203 }, { "content": "\t\t{\n\n\t\t\t// Create the shader\n\n\t\t\tshader = new ShaderClass;\n\n\n\n\t\t\t// Initialize the shader\n\n\t\t\tif (!shader->Initialize())\n\n\t\t\t{\n\n\t\t\t\t// ERROR //\n\n\n\n\t\t\t\t// Delete the shader object\n\n\t\t\t\tdelete shader;\n\n\n\n\t\t\t\t// Set a null ptr for the shader\n\n\t\t\t\treturn shader = nullptr;\n\n\t\t\t}\n\n\t\t}\n\n\n\n\t\treturn shader;\n\n\t}\n\n\n", "file_path": "Battleships/Source/Core/Video/FShaderBase.h", "rank": 47, "score": 7.5693265991502985 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FSpriteShader.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FSpriteShader.h\"\n\n\n\nFSpriteShader::FSpriteShader()\n\n{\n\n}\n\n\n\nFSpriteShader::FSpriteShader(const FSpriteShader& other)\n\n{\n\n}\n\n\n\nFSpriteShader::~FSpriteShader()\n\n{\n\n}\n\n\n\nbool FSpriteShader::Initialize()\n\n{\n\n\tbool result;\n", "file_path": "Battleships/Source/Core/Sprite/FSpriteShader.cpp", "rank": 48, "score": 7.428146778507594 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FResourceCache.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FResourceCache.h\"\n\n#include \"IResource.h\"\n\n\n\nFResourceCache::FResourceCache()\n\n{\n\n}\n\n\n\nFResourceCache::FResourceCache(const FResourceCache& other)\n\n{\n\n}\n\n\n\nFResourceCache::~FResourceCache()\n\n{\n\n}\n\n\n\nbool FResourceCache::Initialize()\n\n{\n", "file_path": "Battleships/Source/Core/Resource/FResourceCache.cpp", "rank": 49, "score": 7.416835868451315 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FWidText.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FWidText.h\"\n\n#include \"..\\..\\..\\..\\Core\\Widget\\FWidgetInput.h\"\n\n#include \"..\\..\\..\\..\\Core\\Video\\FShaderBase.h\"\n\n#include \"FWidTextShader.h\"\n\n#include \"..\\View\\FWidView.h\"\n\n\n\nFWidText::FWidText()\n\n{\n\n\t// Set the shader\n\n\tSetShader(FShaderBase::GetShader<FWidTextShader>());\n\n\n\n\t// Set the initial data\n\n\tm_FontFace = nullptr;\n\n\tm_TextSize = 0;\n\n\tm_TextFormat = TextFormat::Left;\n\n\n\n\t// Set the flags\n", "file_path": "Battleships/Source/System/Engine/Widget/Text/FWidText.cpp", "rank": 50, "score": 7.415565471417047 }, { "content": "\n\n\t\t\t// Null each child\n\n\t\t\tfor (int i = 0; i < 4; i++)\n\n\t\t\t{\n\n\t\t\t\t// Null this child\n\n\t\t\t\t_node->childs[i] = nullptr;\n\n\t\t\t}\n\n\t\t}\n\n\t\telse\n\n\t\t{\n\n\t\t\t// This node isnt a leaf\n\n\t\t\t_node->leaf = false;\n\n\n\n\t\t\t// Create the 4 childs\n\n\t\t\tfor (int i = 0; i < 4; i++)\n\n\t\t\t{\n\n\t\t\t\t// Create this child\n\n\t\t\t\t_node->childs[i] = new QuadtreeNode;\n\n\t\t\t}\n\n\n", "file_path": "Battleships/Source/Core/Containers/Tree/TQuadtree.h", "rank": 51, "score": 7.3997575085927565 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FActor.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FActor.h\"\n\n#include \"FActorController.h\"\n\n\n\nFActor::FActor() : IEntity()\n\n{\n\n\t// Set a null ptr for the owner\n\n\tm_Owner = nullptr;\n\n\n\n\t// Set the initial data\n\n\tm_DepthPlane = DepthPlane::Ground;\n\n\tm_Promoted = false;\n\n}\n\n\n\nFActor::FActor(const FActor& other) : IEntity(other)\n\n{\n\n}\n\n\n", "file_path": "Battleships/Source/Core/Entity/Actor/FActor.cpp", "rank": 52, "score": 7.355481369070488 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FResourceManager.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FResourceManager.h\"\n\n#include \"IResource.h\"\n\n\n\nFResourceManager::FResourceManager()\n\n{\n\n}\n\n\n\nFResourceManager::FResourceManager(const FResourceManager& other)\n\n{\n\n}\n\n\n\nFResourceManager::~FResourceManager()\n\n{\n\n}\n\n\n\nbool FResourceManager::Initialize(const char* _mainResourceHeader)\n\n{\n", "file_path": "Battleships/Source/Core/Resource/FResourceManager.cpp", "rank": 53, "score": 7.188772317822733 }, { "content": "////////////\n\n\n\n// Declare the actor quadtree\n\nTQuadtree<FActor, FActorController::QuadtreeWidth, FActorController::QuadtreeHeight, FActorController::QuadtreeDepth> FActorController::m_ActorQuadtree;\n\n\n\nbool FActorController::Initialize()\n\n{\n\n\treturn true;\n\n}\n\n\n\nbool FActorController::InsertActor(FActor* _actor)\n\n{\n\n\tbool result;\n\n\n\n\t// Insert the actor inside the quadtree\n\n\tresult = m_ActorQuadtree.Insert(_actor);\n\n\tif (!result)\n\n\t{\n\n\t\treturn false;\n\n\t}\n", "file_path": "Battleships/Source/Core/Entity/Actor/FActorController.cpp", "rank": 54, "score": 7.1609493155363575 }, { "content": "WCallback::~WCallback()\n\n{\n\n}\n\n\n\n\n\ntemplate <class CallType>\n\nvoid WCallback::Set(CallType* member, void (CallType::* const &function)(void*))\n\n{\n\n\t// Check if we didnt already set\n\n\tif(m_Set)\n\n\t{\n\n\t\treturn;\n\n\t}\n\n\n\n\t// Set the function\n\n\tm_Callback = makeFunctor((CBFunctor1<void*>*)0,*member,function);\n\n\n\n\t// Set the bool variable\n\n\tm_Set = true;\n\n}\n\n\n\n\n\nbool WCallback::IsSet()\n\n{\n\n\treturn m_Set;\n\n}\n\n\n\n*/", "file_path": "Battleships/Source/Core/Support/Callback/WCallback.cpp", "rank": 55, "score": 7.146198139842005 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FLightShader.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FLightShader.h\"\n\n#include \"..\\..\\Entity\\Actor\\FActor.h\"\n\n#include \"..\\..\\Camera\\FCamera.h\"\n\n\n\nFLightShader::FLightShader() : FShaderBase(ShaderType::Deferred)\n\n{\n\n}\n\n\n\nFLightShader::FLightShader(const FLightShader& other) : FShaderBase(ShaderType::Deferred)\n\n{\n\n}\n\n\n\nFLightShader::~FLightShader()\n\n{\n\n}\n\n\n\nbool FLightShader::Initialize()\n", "file_path": "Battleships/Source/Core/Renderable/Light/FLightShader.cpp", "rank": 56, "score": 7.051771329943589 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FFlipbookShader.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FFlipbookShader.h\"\n\n#include \"..\\..\\Entity\\Actor\\FActor.h\"\n\n#include \"..\\..\\Camera\\FCamera.h\"\n\n\n\nFFlipbookShader::FFlipbookShader() : FShaderBase(ShaderType::Normal)\n\n{\n\n}\n\n\n\nFFlipbookShader::FFlipbookShader(const FFlipbookShader& other) : FShaderBase(ShaderType::Normal)\n\n{\n\n}\n\n\n\nFFlipbookShader::~FFlipbookShader()\n\n{\n\n}\n\n\n\nbool FFlipbookShader::Initialize()\n", "file_path": "Battleships/Source/Core/Renderable/Flipbook/FFlipbookShader.cpp", "rank": 57, "score": 7.051771329943589 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: WCallback.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"WCallback.h\"\n\n\n\n/*\n\n\n\nWCallback::WCallback()\n\n{\n\n\t// Set to false\n\n\tm_Set = false;\n\n}\n\n\n\nWCallback::WCallback(const WCallback& other)\n\n{\n\n\t// Copy the new data\n\n\tm_Callback = other.m_Callback;\n\n\tm_Set = other.m_Set;\n\n}\n\n\n", "file_path": "Battleships/Source/Core/Support/Callback/WCallback.cpp", "rank": 58, "score": 6.9851514948528415 }, { "content": "\n\n\t// Return the index value\n\n\tT& operator [] (int index)\n\n\t{\n\n\t\treturn data[index];\n\n\t}\n\n\n\n\t// Insert a value at the selected position\n\n\tvoid Insert(T value, int pos)\n\n\t{\n\n\t\tT* tempArray;\n\n\n\n\t\t// Check if the size its ok\n\n\t\tif ((numberUnits + 1) >= currentSize)\n\n\t\t{\n\n\t\t\t// Set the new current size\n\n\t\t\tcurrentSize += expandSize;\n\n\n\n\t\t\t// Alocate space for the tempArray\n\n\t\t\ttempArray = new T[currentSize];\n", "file_path": "Battleships/Source/Core/Containers/Array/TArray.h", "rank": 59, "score": 6.982752419055254 }, { "content": "\n\n\t// Set the buffer\n\n\tbuffer << m_VariableName << \"<=\" << arg << \";\";\n\n\n\n\t// Output the stream\n\n\tFProgramableShader::GetCurrentShaderReference()->OutputStream(&buffer);\n\n\n\n\treturn true;\n\n}\n\nbool FIFloat::operator>=(const float& arg)\n\n{\n\n\tstd::ostringstream buffer;\n\n\n\n\t// Set the buffer\n\n\tbuffer << m_VariableName << \">=\" << arg << \";\";\n\n\n\n\t// Output the stream\n\n\tFProgramableShader::GetCurrentShaderReference()->OutputStream(&buffer);\n\n\n\n\treturn true;\n", "file_path": "Battleships/Source/Core/Shader/Intrinsics/FIFloat.cpp", "rank": 60, "score": 6.94547975721565 }, { "content": "\n\n\t// Return the index value\n\n\tT& operator [] (int index)\n\n\t{\n\n\t\treturn data[index];\n\n\t}\n\n\n\n\t// Insert a value at the selected position\n\n\tvoid Insert(T value, unsigned int pos)\n\n\t{\n\n\t\tT* tempArray;\n\n\t\n\n\t\t// Check if the size its ok\n\n\t\tif((numberUnits + 1) >= currentSize)\n\n\t\t{\n\n\t\t\t// Set the new current size\n\n\t\t\tcurrentSize += expandSize;\n\n\n\n\t\t\t// Alocate space for the tempArray\n\n\t\t\ttempArray = new T[currentSize];\n", "file_path": "Battleships/GroupClass.h", "rank": 61, "score": 6.932089608047452 }, { "content": "\t///////////////\n\n\n\n\t// Set the collision status\n\n\tvoid CollisionStatus(bool _collide)\n\n\t{\n\n\t\tm_IgnoreCollision = !_collide;\n\n\t}\n\n\n\n\t// Check if the given position is inside the colision region for this renderable (if there is a collision, call the m_CollisionFunction function)\n\n\tvirtual bool VerifyPreciseCollision(WVector2 _location, bool _takeParentPosition = true){ return false; };\n\n\n\nprotected:\n\n\n\n\t// The constructor and destructor are protected because we can only create and delethe those type of objects using the Create() and Release() functions\n\n\tIRenderable(FActor* _owner, FShaderBase* _shader);\n\n\tIRenderable(){}\n\n\tIRenderable(const IRenderable&);\n\n\n\n\t// We can only share ptrs, not the object itself\n\n\t~IRenderable();\n", "file_path": "Battleships/Source/Core/Renderable/IRenderable.h", "rank": 62, "score": 6.913948242088178 }, { "content": "\n\n\t// <GLOBAL> Return a reference to the entity array\n\n\tstatic TArray<IEntity*>* GetEntitiesReference()\n\n\t{\n\n\t\treturn &m_EntityArray;\n\n\t}\n\n\n\nprotected:\n\n\n\n\t// If this object is marked to be deleted\n\n\tbool m_DeletionMark;\n\n\n\nprivate:\n\n\n\n\t////////////\n\n\t// GLOBAL //\n\n\t////////////\n\n\n\n\t// <GLOBAL> The global entity array\n\n\tstatic TArray<IEntity*> m_EntityArray;\n\n};\n\n\n", "file_path": "Battleships/Source/Core/Entity/IEntity.h", "rank": 63, "score": 6.877085090906572 }, { "content": "}\n\n\n\nbool FIFloat::operator< (const FIFloat& arg)\n\n{\n\n\tstd::ostringstream buffer;\n\n\n\n\t// Set the buffer\n\n\tbuffer << m_VariableName << \"<\" << arg.m_VariableName << \";\";\n\n\n\n\t// Output the stream\n\n\tFProgramableShader::GetCurrentShaderReference()->OutputStream(&buffer);\n\n\n\n\treturn true;\n\n}\n\nbool FIFloat::operator> (const FIFloat& arg)\n\n{\n\n\tstd::ostringstream buffer;\n\n\n\n\t// Set the buffer\n\n\tbuffer << m_VariableName << \">\" << arg.m_VariableName << \";\";\n", "file_path": "Battleships/Source/Core/Shader/Intrinsics/FIFloat.cpp", "rank": 64, "score": 6.836913362571229 }, { "content": "\t\t\t\t\t_node->objectsInside.Remove(i);\n\n\t\t\t\t}\n\n\n\n\t\t\t\treturn true;\n\n\t\t\t}\n\n\t\t}\n\n\n\n\t\treturn false;\n\n\t}\n\n\n\n\t// Return the node quadrant that we should keep the search\n\n\tint NodeQuadrant(QuadtreeNode* _node, WVector2 _location)\n\n\t{\n\n\t\tif (_location.x >= _node->location.x + _node->size.x / 2.0)\n\n\t\t{\n\n\t\t\t// Quadrants 1 or 3\n\n\t\t\tif (_location.y >= _node->location.y + _node->size.y / 2.0)\n\n\t\t\t{\n\n\t\t\t\t// Quadrant 3\n\n\t\t\t\treturn 3;\n", "file_path": "Battleships/Source/Core/Containers/Tree/TQuadtree.h", "rank": 65, "score": 6.831893705860882 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FFlipbook.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FFlipbook.h\"\n\n#include \"..\\..\\Entity\\Actor\\FActor.h\"\n\n\n\nFFlipbook::FFlipbook(FActor* _owner, FShaderBase* _shader) : IRenderable(_owner, _shader)\n\n{\n\n\t// Set the initial data\n\n\tm_Alpha = 1.0f;\n\n\tm_Color = WVector3(1, 1, 1);\n\n\tm_TotalAnimationTime = 0;\n\n\tm_CurrentAnimationTime = 0;\n\n\tm_IgnoreCollision = true;\n\n}\n\n\n\nFFlipbook::FFlipbook(const FFlipbook& other) : IRenderable(other)\n\n{\n\n}\n\n\n", "file_path": "Battleships/Source/Core/Renderable/Flipbook/FFlipbook.cpp", "rank": 66, "score": 6.795715845082777 }, { "content": "\t// Update this ship\n\n\tvirtual void Update(float _time);\n\n\n\n\t// Set the light\n\n\tvoid SetLight(FLight* _light);\n\n\n\n\t// Return if we should keep track of this (if false, no pick or collision functions will have effect on this object)\n\n\tbool ShouldKeepTrack(){ return false; };\n\n\n\nprivate:\n\n\n\n\t// The light\n\n\tFLight* m_Light;\n\n\n\n};\n\n\n\n#endif\n", "file_path": "Battleships/Source/System/Engine/Light/FSpotLight.h", "rank": 67, "score": 6.735693577516278 }, { "content": "\tm_ResourceLoader = new FResourceLoader;\n\n\tif (m_ResourceLoader == nullptr)\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\n\n\t// Initialize the resource manager\n\n\tif (!m_ResourceManager->Initialize(_mainDataHeaderName))\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\n\n\t// Initialize the resource cache\n\n\tif (!m_ResourceCache->Initialize())\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\n\n\t// Initialize the resource loader\n\n\tif (!m_ResourceLoader->Initialize())\n", "file_path": "Battleships/Source/Core/Resource/IResource.cpp", "rank": 68, "score": 6.654394253965263 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FWidTextShader.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FWidTextShader.h\"\n\n#include \"..\\..\\..\\..\\Core\\Camera\\FCamera.h\"\n\n#include \"..\\..\\..\\..\\Core\\Resource\\Texture\\FTexture.h\"\n\n\n\nFWidTextShader::FWidTextShader() : FShaderBase(ShaderType::Normal)\n\n{\n\n}\n\n\n\nFWidTextShader::FWidTextShader(const FWidTextShader& other) : FShaderBase(ShaderType::Normal)\n\n{\n\n}\n\n\n\nFWidTextShader::~FWidTextShader()\n\n{\n\n}\n\n\n\nbool FWidTextShader::Initialize()\n", "file_path": "Battleships/Source/System/Engine/Widget/Text/FWidTextShader.cpp", "rank": 69, "score": 6.585705675763879 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FWidViewShader.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FWidViewShader.h\"\n\n#include \"..\\..\\..\\..\\Core\\Camera\\FCamera.h\"\n\n#include \"..\\..\\..\\..\\Core\\Resource\\Texture\\FTexture.h\"\n\n\n\nFWidViewShader::FWidViewShader() : FShaderBase(ShaderType::Normal)\n\n{\n\n}\n\n\n\nFWidViewShader::FWidViewShader(const FWidViewShader& other) : FShaderBase(ShaderType::Normal)\n\n{\n\n}\n\n\n\nFWidViewShader::~FWidViewShader()\n\n{\n\n}\n\n\n\nbool FWidViewShader::Initialize()\n", "file_path": "Battleships/Source/System/Engine/Widget/View/FWidViewShader.cpp", "rank": 70, "score": 6.585705675763879 }, { "content": "{\n\n\treturn p_Position;\n\n}\n\n\n\nWVector2 WTransform2D::GetSize()\n\n{\n\n\treturn p_Size;\n\n}\n\n\n\n//\n\n\n\nbool WTransform2D::IsPointInside(WVector2 _point)\n\n{\n\n\t// Check if the given point is inside this rect\n\n\tif (_point.x < p_Position.x || _point.y < p_Position.y || _point.x >(p_Position.x + p_Size.x) || _point.y >(p_Position.y + p_Size.y))\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\n\n\treturn true;\n\n}", "file_path": "Battleships/Source/Core/Support/Math/Transform/WTransform2D.cpp", "rank": 71, "score": 6.525583845708863 }, { "content": "\n\n\t// Pre-open a file\n\n\tvoid PreOpen(const char* _filePath)\n\n\t{\n\n\t\tm_FilePath = _filePath;\n\n\t}\n\n\n\n\t// Return the file size\n\n\tstd::ifstream::pos_type FileSize()\n\n\t{\n\n\t\tstd::ifstream in(m_FilePath, std::ifstream::ate | std::ifstream::binary);\n\n\t\treturn in.tellg();\n\n\t}\n\n\n\n\t// Try to open a file from the standard paths\n\n\tbool Open(OpenMode _openMode);\n\n\n\n\t// Open a file from the given path\n\n\tbool Open(const char* _filePath, OpenMode _openMode);\n\n\n", "file_path": "Battleships/Source/Core/Support/File/FFileIO.h", "rank": 72, "score": 6.472132400757975 }, { "content": "\n\n\t// Set without loading a id handle for this texture\n\n\tvoid SetHandleWithoutLoading(unsigned int _handle)\n\n\t{\n\n\t\tm_TextureHandle = _handle;\n\n\t}\n\n\n\n\t// Return the texture handle\n\n\tunsigned int GetHandle()\n\n\t{\n\n\t\treturn m_TextureHandle;\n\n\t}\n\n\n\n\t// Put this texture inside a shader program\n\n\tbool SetShaderTexture(unsigned int _shaderProgram, unsigned int _textureSlot, unsigned int _texturePosition, const char* _textureName);\n\n\n\n\t// Return the texture size\n\n\tWVector2 TextureSize()\n\n\t{\n\n\t\treturn m_TextureSize;\n", "file_path": "Battleships/Source/Core/Resource/Texture/FTexture.h", "rank": 73, "score": 6.397049493333885 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: IRenderable.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"IRenderable.h\"\n\n\n\nIRenderable::IRenderable(FActor* _owner, FShaderBase* _shader)\n\n{\n\n\t// Set the owner and the shader\n\n\tm_Owner = _owner;\n\n\tm_Shader = _shader;\n\n\n\n\t// Set the deletion mark to false\n\n\tm_DeletionMark = false;\n\n\n\n\t// Set to ignore collision\n\n\tm_IgnoreCollision = true;\n\n}\n\n\n\nIRenderable::IRenderable(const IRenderable& other)\n\n{\n", "file_path": "Battleships/Source/Core/Renderable/IRenderable.cpp", "rank": 74, "score": 6.364849423047209 }, { "content": "\t\tTArray<QuadtreeObjectTuple> objectsInside;\n\n\t};\n\n\n\npublic:\n\n\tTQuadtree()\n\n\t{\n\n\t\t// Create the root node\n\n\t\tm_RootNode = new QuadtreeNode;\n\n\n\n\t\t// Build the quadtree\n\n\t\tBuildTree(m_RootNode, WVector2(0, 0), WVector2(width, height));\n\n\t}\n\n\n\n\tTQuadtree(const TQuadtree&){}\n\n\t~TQuadtree(){}\n\n\n\n\t// Insert an object (return false if the object is out of range or if it already exist)\n\n\tbool Insert(ObjectType* _object, WVector2 _location = WVector2(0, 0), bool _useLocation = false)\n\n\t{\n\n\t\t// Check if the object is in range (the GetLocation() function ensure the object is an Actor)\n", "file_path": "Battleships/Source/Core/Containers/Tree/TQuadtree.h", "rank": 75, "score": 6.340757551197556 }, { "content": "public:\n\n\tFSprite();\n\n\tFSprite(const FSprite&);\n\n\t~FSprite();\n\n\n\n\t// Load this sprite\n\n\tbool Load();\n\n\n\n\t// Set this sprite to be rendered\n\n\tvoid Render();\n\n\n\n\t// Release this sprite\n\n\tvoid Release();\n\n\n\n\t// Return the current texture\n\n\tFTexture* GetCurrentTexture();\n\n\n\n\t// Set the world location for this sprite\n\n\tvoid SetWorldLocation(WVector2 _location)\n\n\t{\n", "file_path": "Battleships/Source/Core/Sprite/FSprite.h", "rank": 76, "score": 6.223849133824341 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FObject.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FObject.h\"\n\n\n\nFObject::FObject()\n\n{\n\n\t// Set the initial data\n\n\tm_Renderable = nullptr;\n\n\tm_Location = WVector3(0, 0, 0);\n\n\tm_Rotation = WVector3(0, 0, 0);\n\n\tm_Size = WVector3(1, 1, 1);\n\n\tm_LastLocation = m_Location;\n\n\tm_CollisionFlags = CanCollide | CanOverlap;\n\n}\n\n\n\nFObject::FObject(const FObject& other)\n\n{\n\n}\n\n\n", "file_path": "Battleships/Source/Core/Entity/Actor/FObject.cpp", "rank": 77, "score": 6.213489248071552 }, { "content": "\n\n\t// Decrement the reference count\n\n\tvoid DecrementReferences()\n\n\t{\n\n\t\tm_ReferenceCount--;\n\n\t}\n\n\n\npublic:\n\n\n\n\t////////////\n\n\t// GLOBAL //\n\n\t////////////\n\n\n\n\t// <GLOBAL> Initialize the resource system\n\n\tstatic bool InitializeResourceSystem(const char* _mainDataHeaderName);\n\n\n\n\t// <GLOBAL> Return a resource using a hashed string\n\n\ttemplate <typename ResourceType>\n\n\tstatic ResourceType* GetResourceByName(FHashedString _resourceHash)\n\n\t{\n", "file_path": "Battleships/Source/Core/Resource/IResource.h", "rank": 78, "score": 5.996030365678109 }, { "content": "\t\tm_ThreadedFunction.Run(_Data);\n\n\n\n\t\t// Set that this thread is free\n\n\t\tm_Free = true;\n\n\t}\n\n\n\npublic:\n\n\n\n\t////////////\n\n\t// GLOBAL //\n\n\t////////////\n\n\n\n\t// <GLOBAL> The global dispatch helper\n\n\tstatic void DispatchHelper(FThread* _resourceLoader, CallType* _Data)\n\n\t{\n\n\t\t_resourceLoader->DispatchThreaded(_Data);\n\n\t}\n\n\n\nprivate:\n\n\n\n\t// If this thread is free\n\n\tbool m_Free;\n\n\n\n\t// The function that we will call using this thread\n\n\tWCallback<CallType> m_ThreadedFunction;\n\n};\n\n\n\n#endif\n", "file_path": "Battleships/Source/Core/Support/Thread/FThread.h", "rank": 79, "score": 5.933840131694453 }, { "content": "\tvirtual bool Initialize() = 0;\n\n\n\n\t// Render all objects inside this shader\n\n\tvirtual void Render(float _elapsedTime, FCamera* _camera, FGraphic* _graphicContext) = 0;\n\n\n\n\t// Shutdown this shader\n\n\tvirtual void Shutdown();\n\n\n\n\t// Add a object to be rendered\n\n\tvirtual void AddObject(void* _objectPtr) = 0;\n\n\n\n\t// Return the shader type\n\n\tShaderType GetShaderType()\n\n\t{\n\n\t\treturn m_ShaderType;\n\n\t}\n\n\n\nprotected:\n\n\n\n\t// Load a shader source file\n", "file_path": "Battleships/Source/Core/Video/FShaderBase.h", "rank": 80, "score": 5.888262907528777 }, { "content": "\t/*\n\n\t\n\n\t\t=> Load the main data resource\n\n\n\n\t*/\n\n\n\n\treturn true;\n\n}\n\n\n\nFResourceManager::ResourceHeader* FResourceManager::GetResourceHeader(FHashedString _resourceName)\n\n{\n\n\t// LOCK // ???\n\n\n\n\t// Try to find the resource\n\n\tstd::unordered_map<size_t, ResourceHeader>::iterator resource = m_ResourceHeaders.find(_resourceName.Hash());\n\n\n\n\t// Check if we found it\n\n\tif (resource != m_ResourceHeaders.end())\n\n\t{\n\n\t\t// Return the resource header \n", "file_path": "Battleships/Source/Core/Resource/FResourceManager.cpp", "rank": 81, "score": 5.858318468267843 }, { "content": "\t}\n\n\n\n\t// Return a pixel info for the given texture coordinate\n\n\tWVector4 PixelInfo(WVector2 _textureCoordinate);\n\n\n\nprotected:\n\n\n\n\t// Load this resource (protected because this will be called by the GetResource() method (and not by the user))\n\n\tvoid Load(unsigned char* _resourceData);\n\n\n\n\t// Update this resource\n\n\tvoid Update(float _time);\n\n\n\nprivate:\n\n\n\n\t// Load a targe image\n\n\tbool LoadTarga(unsigned char* _resourceData, unsigned int _textureUnit);\n\n\n\nprivate:\n\n\n", "file_path": "Battleships/Source/Core/Resource/Texture/FTexture.h", "rank": 82, "score": 5.784300891620874 }, { "content": "{\n\n\t// Create the root widget\n\n\tm_Root = new IWidget;\n\n\tif (m_Root == nullptr)\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\t\n\n\t// Set the parent to be null\n\n\tm_Root->SetParent(nullptr);\n\n\n\n\t// Set the position and size to match the screen coordinates\n\n\tm_Root->SetLayout(IWidget::LayoutLocationHeight::Top, IWidget::LayoutLocationWidth::Left, IWidget::LayoutSize::Absolute);\n\n\tm_Root->SetPosition(WVector2(0, 0));\n\n\tm_Root->SetSize(_graphicContext->GetWindowResolution());\n\n\n\n\t// Set the root flags\n\n\tm_Root->SetFlag(IWidget::StatusFlag::Visible);\n\n\tm_Root->SetFlag(IWidget::StatusFlag::AcceptEvents);\n\n\tm_Root->UnsetFlag(IWidget::StatusFlag::Renderable);\n", "file_path": "Battleships/Source/Core/Widget/FWidgetPanel.cpp", "rank": 83, "score": 5.7579835330821885 }, { "content": "\t\t\treturn nullptr;\n\n\t\t}\n\n\n\n\t\t// USE A SAFE CAST HERE!\n\n\t\treturn (ResourceType*)resource;\n\n\t}\n\n\n\n\t// <GLOBAL> Update the resource system\n\n\tstatic void UpdateResourceSystem(float _time);\n\n\n\nprivate:\n\n\n\n\t// The reference count\n\n\tunsigned int m_ReferenceCount;\n\n\n\nprivate:\n\n\n\n\t////////////\n\n\t// GLOBAL //\n\n\t////////////\n\n\n\n\t// <GLOBAL> The resource cache, manager and loader objects\n\n\tstatic FResourceCache* m_ResourceCache;\n\n\tstatic FResourceManager* m_ResourceManager;\n\n\tstatic FResourceLoader* m_ResourceLoader;\n\n};\n\n\n\n#include <iostream>\n", "file_path": "Battleships/Source/Core/Resource/IResource.h", "rank": 84, "score": 5.674485058221211 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FPlayer.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FPlayer.h\"\n\n#include \"..\\..\\..\\Core\\Input\\FInput.h\"\n\n\n\n#include <iostream>\n\n#include \"string\"\n\n\n\n#include \"..\\..\\..\\Core\\Camera\\FCamera.h\"\n\n\n\n#include \"..\\..\\..\\Core\\Renderable\\Flipbook\\FFlipbook.h\"\n\n#include \"..\\..\\..\\Core\\Video\\FShaderBase.h\"\n\n#include \"..\\..\\..\\Core\\Renderable\\Flipbook\\FFlipbookShader.h\"\n\n\n\n#include \"..\\..\\..\\Core\\Environment\\Water\\FWaterShader.h\"\n\n\n\n#include \"..\\Widget\\View\\FWidView.h\"\n\n\n\n#include \"..\\Light\\FPointLight.h\"\n", "file_path": "Battleships/Source/System/Engine/Player/FPlayer.cpp", "rank": 85, "score": 5.672850678005322 }, { "content": "\t\tGetOwner()->OnRenderableAnimationExpired(this);\n\n\t}\n\n\n\n\t// Check if we dont overlap\n\n\twhile(m_CurrentAnimationTime > m_TotalAnimationTime)\n\n\t{\n\n\t\t// Set the new current time\n\n\t\tm_CurrentAnimationTime -= m_TotalAnimationTime;\n\n\t}\n\n}\n\n\n\nFTexture* FFlipbook::Texture()\n\n{\n\n\t// Check if we have at last one texture and the total animation time is not zero\n\n\tif (!m_Textures.Size() || !m_TotalAnimationTime)\n\n\t{\n\n\t\treturn nullptr;\n\n\t}\n\n\n\n\treturn m_Textures[(m_CurrentAnimationTime / m_TotalAnimationTime) * m_Textures.Size()];\n", "file_path": "Battleships/Source/Core/Renderable/Flipbook/FFlipbook.cpp", "rank": 86, "score": 5.633061044609454 }, { "content": "\n\n// <GLOBAL> Declare the font library object\n\nFT_Library FFontLoader::m_FontLibrary;\n\n\n\n// <GLOBAL> Declare the array of loaded font faces\n\nTArray<FFontLoader::FontFace*> FFontLoader::m_FontFaces;\n\n\n\nbool FFontLoader::InitializeFontSystem()\n\n{\n\n\tint error;\n\n\n\n\t// Initialize the freetype library\n\n\terror = FT_Init_FreeType(&m_FontLibrary);\n\n\tif (error)\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\n\n\treturn true;\n\n}\n", "file_path": "Battleships/Source/Core/Font/FFontLoader.cpp", "rank": 87, "score": 5.627649050929485 }, { "content": "////////////////////////////////////////////////////////////////////////////////\n\n// Filename: FGraphic.h\n\n////////////////////////////////////////////////////////////////////////////////\n\n#ifndef _FGraphic_H_\n\n#define _FGraphic_H_\n\n\n\n/////////////\n\n// LINKING //\n\n/////////////\n\n\n\n//////////////\n\n// INCLUDES //\n\n//////////////\n\n\n\n/* Base */\n\n#include <iostream>\n\n#include \"string\"\n\n// #include <windows.h>\n\n#include <math.h>\n\n\n", "file_path": "Battleships/Source/Core/Video/FGraphic.h", "rank": 88, "score": 5.59698942147466 }, { "content": "\t{\n\n\t\t// Check if the owner is NOT marked to deletion\n\n\t\t// ...\n\n\n\n\t\t// Create a new actor\n\n\t\tActorClass* newActor = new ActorClass;\n\n\n\n\t\t// Link those 2 actors\n\n\t\tnewActor->LinkActors(_owner);\n\n\n\n\t\t// Register the new actor/entity\n\n\t\tRegisterEntity(newActor);\n\n\n\n\t\treturn newActor;\n\n\t}\n\n\n\n\t// Release this object (mark it for deletion), also, mark any child for deletion too\n\n\tvirtual void Release()\n\n\t{\n\n\t\t// If we have an owner actor, remove the link\n", "file_path": "Battleships/Source/Core/Entity/Actor/FActor.h", "rank": 89, "score": 5.596221713517656 }, { "content": "\t\tunsigned int resourceCompressedSize;\n\n\n\n\t\t// The resource size (decompressed)\n\n\t\tunsigned int resourceSize;\n\n\t};\n\n\n\nprivate:\n\n\n\n\tFResourceManager();\n\n\tFResourceManager(const FResourceManager&);\n\n\t~FResourceManager();\n\n\n\n\t// Initialize the resource manager\n\n\tbool Initialize(const char* _mainResourceHeader);\n\n\n\n\t// Return a resource header by name (the name will be converted to a hashed string)\n\n\tResourceHeader* GetResourceHeader(FHashedString _resourceName);\n\n\n\nprivate:\n\n\n", "file_path": "Battleships/Source/Core/Resource/FResourceManager.h", "rank": 90, "score": 5.587014428035018 }, { "content": "\t\t}\n\n\n\n\t\treturn true;\n\n\t}\n\n\n\n\t// Update an object (return false if the object goes out of range)\n\n\tbool Update(ObjectType* _object, WVector2 _location)\n\n\t{\n\n\t\t// Check if the object is in range\n\n\t\tif (!InsideRange(_location))\n\n\t\t{\n\n\t\t\t// Out of range\n\n\t\t\treturn false;\n\n\t\t}\n\n\n\n\t\t// Get the leaf node\n\n\t\tQuadtreeNode* leafNode = LeafNode(m_RootNode, _location);\n\n\n\n\t\t// Get the old leaf node (the GetLocation() function ensure the object is an Actor)\n\n\t\tQuadtreeNode* oldLeafNode = LeafNode(m_RootNode, _object->GetLocation());\n", "file_path": "Battleships/Source/Core/Containers/Tree/TQuadtree.h", "rank": 92, "score": 5.5324887128951445 }, { "content": "///////////////////////////////////////////////////////////////////////////////\n\n// Filename: FIFloat.cpp\n\n///////////////////////////////////////////////////////////////////////////////\n\n#include \"FIFloat.h\"\n\n#include <stdio.h>\n\n#include <sstream>\n\n#include <string>\n\n#include <iostream>\n\n#include \"..\\FProgramableShader.h\"\n\n\n\nFIFloat::FIFloat()\n\n{\n\n\t// Call the creation string method\n\n\tCreationString();\n\n}\n\n\n\nFIFloat::FIFloat(const FIFloat& other)\n\n{\n\n}\n\n\n", "file_path": "Battleships/Source/Core/Shader/Intrinsics/FIFloat.cpp", "rank": 93, "score": 5.507983794708212 }, { "content": "\n\n\t// Update this ship\n\n\tvoid Update(float _time);\n\n\n\n\t// Set the ship flipbook\n\n\tvoid SetFlipbook(FFlipbook* _flipbook);\n\n\n\n\t// Return if we should keep track of this (if false, no pick or collision functions will have effect on this object)\n\n\tbool ShouldKeepTrack(){ return false; };\n\n\n\nprivate:\n\n\n\nprivate:\n\n\n\n\t// The maximum expiration time\n\n\tfloat m_MaximumExpirationTime;\n\n\n\n\t// The current expiration time\n\n\tfloat m_CurrentExpirationTime;\n\n\n\n\t// The initial size\n\n\tWVector2 m_InitialSize;\n\n\n\n\t// The dust flipbook\n\n\tFFlipbook* m_DustFlipbook;\n\n};\n\n\n\n#endif\n", "file_path": "Battleships/Source/System/Objects/Special Effects/Dust/FDust.h", "rank": 94, "score": 5.493333246012286 }, { "content": "\n\n\t// Update this ship\n\n\tvoid Update(float _time);\n\n\n\n\t// Set the ship flipbook\n\n\tvoid SetFlipbook(FFlipbook* _flipbook);\n\n\n\n\t// Return if we should keep track of this (if false, no pick or collision functions will have effect on this object)\n\n\tbool ShouldKeepTrack(){ return false; };\n\n\n\nprivate:\n\n\n\nprivate:\n\n\n\n\t// The maximum expiration time\n\n\tfloat m_MaximumExpirationTime;\n\n\n\n\t// The current expiration time\n\n\tfloat m_CurrentExpirationTime;\n\n\n\n\t// The initial size\n\n\tWVector2 m_InitialSize;\n\n\n\n\t// The dust flipbook\n\n\tFFlipbook* m_DustFlipbook;\n\n};\n\n\n\n#endif\n", "file_path": "Battleships/Source/System/Objects/Special Effects/Foam/FFoam.h", "rank": 95, "score": 5.493333246012286 }, { "content": "\n\n\t// Update this ship\n\n\tvoid Update(float _time);\n\n\n\n\t// Set the ship flipbook\n\n\tvoid SetFlipbook(FFlipbook* _flipbook);\n\n\n\n\t// Return if we should keep track of this (if false, no pick or collision functions will have effect on this object)\n\n\tbool ShouldKeepTrack(){ return false; };\n\n\n\nprivate:\n\n\n\nprivate:\n\n\n\n\t// The maximum expiration time\n\n\tfloat m_MaximumExpirationTime;\n\n\n\n\t// The current expiration time\n\n\tfloat m_CurrentExpirationTime;\n\n\n\n\t// The initial size\n\n\tWVector2 m_InitialSize;\n\n\n\n\t// The dust flipbook\n\n\tFFlipbook* m_DustFlipbook;\n\n};\n\n\n\n#endif\n", "file_path": "Battleships/Source/System/Objects/Special Effects/Trace/FTrace.h", "rank": 96, "score": 5.493333246012286 }, { "content": "\t\tIResource* resource;\n\n\t\tFResourceManager::ResourceHeader* resourceHeader;\n\n\n\n\t\t// Check if the resource is already loaded\n\n\t\tresource = m_ResourceCache->GetLoadedResource(_resourceHash);\n\n\t\tif (resource != nullptr)\n\n\t\t{\n\n\t\t\t// USE A SAFE CAST HERE!\n\n\t\t\treturn (ResourceType*)resource;\n\n\t\t}\n\n\n\n\t\t// Create the resource\n\n\t\tresource = new ResourceType;\n\n\n\n\t\t// Increase references , this sets the references count to 1\n\n\t\tresource->IncrementReferences();\n\n\n\n\t\t// Insert the created resource into the cache\n\n\t\tm_ResourceCache->InsertLoadedResource(_resourceHash, resource);\n\n\n", "file_path": "Battleships/Source/Core/Resource/IResource.h", "rank": 97, "score": 5.4925590751903295 }, { "content": "\t}\n\n\n\n\t// Remove an object (return false if the object is out of range or if it does not exist)\n\n\tbool Remove(ObjectType* _object)\n\n\t{\n\n\t\t// Check if the object is in range (the GetLocation() function ensure the object is an Actor)\n\n\t\tif (!InsideRange(_object->GetLocation()))\n\n\t\t{\n\n\t\t\t// Out of range\n\n\t\t\treturn false;\n\n\t\t}\n\n\n\n\t\t// Get the leaf node (the GetLocation() function ensure the object is an Actor)\n\n\t\tQuadtreeNode* leafNode = LeafNode(m_RootNode, _object->GetLocation());\n\n\n\n\t\t// Check if the object exist\n\n\t\tif (!ObjectExist(leafNode, _object, true))\n\n\t\t{\n\n\t\t\t// The object does not exist\n\n\t\t\treturn false;\n", "file_path": "Battleships/Source/Core/Containers/Tree/TQuadtree.h", "rank": 98, "score": 5.486105256325683 }, { "content": "////////////////////////////////////////////////////////////////////////////////\n\n// Filename: FFlipbookShader.h\n\n////////////////////////////////////////////////////////////////////////////////\n\n#ifndef _FFlipbookShader_H_\n\n#define _FFlipbookShader_H_\n\n\n\n/////////////\n\n// LINKING //\n\n/////////////\n\n\n\n//////////////\n\n// INCLUDES //\n\n//////////////\n\n#include \"..\\..\\Containers\\Array\\TArray.h\"\n\n#include \"..\\..\\Support\\Math\\WMath.h\"\n\n#include \"..\\..\\Video\\FShaderBase.h\" // Includes the opengl files\n\n#include \"FFlipbook.h\"\n\n#include <map>\n\n\n\n/////////////\n\n// DEFINES //\n\n/////////////\n\n\n\n////////////////////////////////////////////////////////////////////////////////\n\n// Class name: FFlipbookShader\n\n////////////////////////////////////////////////////////////////////////////////\n", "file_path": "Battleships/Source/Core/Renderable/Flipbook/FFlipbookShader.h", "rank": 99, "score": 5.485820985095636 } ]
C++
windows/advcore/gdiplus/engine/text/otls/gpos.cpp
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
#include "pch.h" long DesignToPP ( USHORT cFUnits, USHORT cPPEm, long lFValue ) { long lHalf; long lNegHalf; long lCorrect; lHalf = (long)cFUnits >> 1; lNegHalf = -lHalf + 1; if (lFValue >= 0) { lCorrect = lHalf; } else { lCorrect = lNegHalf; } if (cFUnits==0) return lFValue; return (lFValue * (long)cPPEm + lCorrect) / (long)cFUnits; } void otlValueRecord::adjustPos ( const otlMetrics& metr, otlPlacement* pplcGlyphPalcement, long* pduDAdvance, otlSecurityData sec ) const { if (!isValid()) return; assert(!isNull()); assert(pplcGlyphPalcement != NULL); assert(pduDAdvance != NULL); const BYTE* pbTableBrowser = pbTable; if (grfValueFormat & otlValueXPlacement) { pplcGlyphPalcement->dx += DesignToPP(metr.cFUnits, metr.cPPEmX, SShort(pbTableBrowser)); pbTableBrowser += 2; } if (grfValueFormat & otlValueYPlacement) { pplcGlyphPalcement->dy += DesignToPP(metr.cFUnits, metr.cPPEmY, SShort(pbTableBrowser)); pbTableBrowser += 2; } if (grfValueFormat & otlValueXAdvance) { if (metr.layout == otlRunLTR || metr.layout == otlRunRTL) { *pduDAdvance += DesignToPP(metr.cFUnits, metr.cPPEmX, SShort(pbTableBrowser)); } pbTableBrowser += 2; } if (grfValueFormat & otlValueYAdvance) { if (metr.layout == otlRunTTB || metr.layout == otlRunBTT) { *pduDAdvance += DesignToPP(metr.cFUnits, metr.cPPEmY, SShort(pbTableBrowser)); } pbTableBrowser += 2; } if (grfValueFormat & otlValueXPlaDevice) { if (Offset(pbTableBrowser) != 0) { pplcGlyphPalcement->dx += otlDeviceTable(pbMainTable + Offset(pbTableBrowser),sec) .value(metr.cPPEmX); } pbTableBrowser += 2; } if (grfValueFormat & otlValueYPlaDevice) { if (Offset(pbTableBrowser) != 0) { pplcGlyphPalcement->dx += otlDeviceTable(pbMainTable + Offset(pbTableBrowser),sec) .value(metr.cPPEmY); } pbTableBrowser += 2; } if (grfValueFormat & otlValueXAdvDevice) { if (metr.layout == otlRunLTR || metr.layout == otlRunRTL) { if (Offset(pbTableBrowser) != 0) { *pduDAdvance += otlDeviceTable(pbMainTable + Offset(pbTableBrowser),sec) .value(metr.cPPEmX); } } pbTableBrowser += 2; } if (grfValueFormat & otlValueYAdvDevice) { if (metr.layout == otlRunTTB || metr.layout == otlRunBTT) { if (Offset(pbTableBrowser) != 0) { *pduDAdvance += otlDeviceTable(pbMainTable + Offset(pbTableBrowser),sec) .value(metr.cPPEmY); } } pbTableBrowser += 2; } assert((pbTableBrowser-pbTable)==size(grfValueFormat)); return; } bool otlAnchor::getAnchor ( USHORT cFUnits, USHORT cPPEmX, USHORT cPPEmY, otlPlacement* rgPointCoords, otlPlacement* pplcAnchorPoint, otlSecurityData sec ) const { if (!isValid()) return false; assert(!isNull()); assert(pplcAnchorPoint != NULL); switch(format()) { case(1): { otlSimpleAnchorTable simpleAnchor = otlSimpleAnchorTable(pbTable,sec); if (!simpleAnchor.isValid()) return false; pplcAnchorPoint->dx = DesignToPP(cFUnits, cPPEmX, simpleAnchor.xCoordinate()); pplcAnchorPoint->dy = DesignToPP(cFUnits, cPPEmY, simpleAnchor.yCoordinate()); return true; } case(2): { otlContourAnchorTable contourAnchor = otlContourAnchorTable(pbTable,sec); if (!contourAnchor.isValid()) return false; if (rgPointCoords != NULL) { *pplcAnchorPoint = rgPointCoords[ contourAnchor.anchorPoint() ]; } else { pplcAnchorPoint->dx = DesignToPP(cFUnits, cPPEmX, contourAnchor.xCoordinate()); pplcAnchorPoint->dy = DesignToPP(cFUnits, cPPEmY, contourAnchor.yCoordinate()); } return true; } case(3): { otlDeviceAnchorTable deviceAnchor = otlDeviceAnchorTable(pbTable,sec); if (!deviceAnchor.isValid()) return false; pplcAnchorPoint->dx = DesignToPP(cFUnits, cPPEmX, deviceAnchor.xCoordinate()); pplcAnchorPoint->dy = DesignToPP(cFUnits, cPPEmY, deviceAnchor.yCoordinate()); otlDeviceTable deviceX = deviceAnchor.xDeviceTable(sec); otlDeviceTable deviceY = deviceAnchor.yDeviceTable(sec); if (!deviceX.isNull()) { pplcAnchorPoint->dx += deviceX.value(cPPEmX); } if (!deviceY.isNull()) { pplcAnchorPoint->dy += deviceY.value(cPPEmY); } return true; } default: return false; } } void AlignAnchors ( const otlList* pliGlyphInfo, otlList* pliPlacement, otlList* pliduDAdv, USHORT iglStatic, USHORT iglMobile, const otlAnchor& anchorStatic, const otlAnchor& anchorMobile, otlResourceMgr& resourceMgr, const otlMetrics& metr, USHORT grfOptions, otlSecurityData sec ) { assert(pliGlyphInfo->dataSize() == sizeof(otlGlyphInfo)); assert(pliPlacement->dataSize() == sizeof(otlPlacement)); assert(pliduDAdv->dataSize() == sizeof(long)); assert(pliGlyphInfo->length() == pliPlacement->length()); assert(pliPlacement->length() == pliduDAdv->length()); assert(iglStatic < pliGlyphInfo->length()); assert(iglMobile < pliGlyphInfo->length()); assert(!anchorStatic.isNull()); assert(!anchorMobile.isNull()); const otlGlyphInfo* pglinfStatic = readOtlGlyphInfo(pliGlyphInfo, iglStatic); const otlGlyphInfo* pglinfMobile = readOtlGlyphInfo(pliGlyphInfo, iglMobile); otlPlacement* pplcStatic = getOtlPlacement(pliPlacement, iglStatic); otlPlacement* pplcMobile = getOtlPlacement(pliPlacement, iglMobile); long* pduDAdvStatic = getOtlAdvance(pliduDAdv, iglStatic); long* pduDAdvMobile = getOtlAdvance(pliduDAdv, iglMobile); otlPlacement plcStaticAnchor; if (!anchorStatic.getAnchor(metr.cFUnits, metr.cPPEmX, metr.cPPEmY, resourceMgr.getPointCoords(pglinfStatic->glyph), &plcStaticAnchor,sec)) return; otlPlacement plcMobileAnchor; if (!anchorMobile.getAnchor(metr.cFUnits, metr.cPPEmX, metr.cPPEmY, resourceMgr.getPointCoords(pglinfMobile->glyph), &plcMobileAnchor,sec)) return; long duAdvanceInBetween = 0; for (USHORT igl = MIN(iglStatic, iglMobile) + 1; igl < MAX(iglStatic, iglMobile); ++igl) { duAdvanceInBetween += *getOtlAdvance(pliduDAdv, igl); } if (metr.layout == otlRunLTR || metr.layout == otlRunRTL) { pplcMobile->dy = pplcStatic->dy + plcStaticAnchor.dy - plcMobileAnchor.dy; if ((metr.layout == otlRunLTR) == (iglStatic < iglMobile)) { long dx = pplcStatic->dx - *pduDAdvStatic + plcStaticAnchor.dx - duAdvanceInBetween - plcMobileAnchor.dx; if (grfOptions & otlUseAdvances) { *pduDAdvStatic += dx; } else { pplcMobile->dx = dx; } } else { long dx = pplcStatic->dx + *pduDAdvMobile + plcStaticAnchor.dx + duAdvanceInBetween - plcMobileAnchor.dx; if (grfOptions & otlUseAdvances) { *pduDAdvMobile -= dx; } else { pplcMobile->dx = dx; } } } else { pplcMobile->dx = pplcStatic->dx + plcStaticAnchor.dx - plcMobileAnchor.dx; if ((metr.layout == otlRunTTB) == (iglStatic < iglMobile)) { long dy = pplcStatic->dy - *pduDAdvStatic + plcStaticAnchor.dy - duAdvanceInBetween - plcMobileAnchor.dy; if (grfOptions & otlUseAdvances) { *pduDAdvStatic += dy; } else { pplcMobile->dy = dy; } } else { long dy = pplcStatic->dy + *pduDAdvMobile + plcStaticAnchor.dy + duAdvanceInBetween - plcMobileAnchor.dy; if (grfOptions & otlUseAdvances) { *pduDAdvMobile -= dy; } else { pplcMobile->dy = dy; } } } }
#include "pch.h" long DesignToPP ( USHORT cFUnits, USHORT cPPEm, long lFValue ) { long lHalf; long lNegHalf; long lCorrect; lHalf = (long)cFUnits >> 1; lNegHalf = -lHalf + 1; if (lFValue >= 0) { lCorrect = lHalf; } else { lCorrect = lNegHalf; } if (cFUnits==0) return lFValue; return (lFValue * (long)cPPEm + lCorrect) / (long)cFUnits; } void otlValueRecord::adjustPos ( const otlMetrics& metr, otlPlacement* pplcGlyphPalcement, long* pduDAdvance, otlSecurityData sec ) const { if (!isValid()) return; assert(!isNull()); assert(pplcGlyphPalcement != NULL); assert(pduDAdvance != NULL); const BYTE* pbTableBrowser = pbTable; if (grfValueFormat & otlValueXPlacement) { pplcGlyphPalcement->dx += DesignToPP(metr.cFUnits, metr.cPPEmX, SShort(pbTableBrowser)); pbTableBrowser += 2; } if (grfValueFormat & otlValueYPlacement) { pplcGlyphPalcement->dy += DesignToPP(metr.cFUnits, metr.cPPEmY, SShort(pbTableBrowser)); pbTableBrowser += 2; } if (grfValueFormat & otlValueXAdvance) { if (metr.layout == otlRunLTR || metr.layout == otlRunRTL) { *pduDAdvance += DesignToPP(metr.cFUnits, metr.cPPEmX, SShort(pbTableBrowser)); } pbTableBrowser += 2; } if (grfValueFormat & otlValueYAdvance) { if (metr.layout == otlRunTTB || metr.layout == otlRunBTT) { *pduDAdvance += DesignToPP(metr.cFUnits, metr.cPPEmY, SShort(pbTableBrowser)); } pbTableBrowser += 2; } if (grfValueFormat & otlValueXPlaDevice) { if (Offset(pbTableBrowser) != 0) { pplcGlyphPalcement->dx += otlDeviceTable(pbMainTable + Offset(pbTableBrowser),sec) .value(metr.cPPEmX); } pbTableBrowser += 2; } if (grfValueFormat & otlValueYPlaDevice) { if (Offset(pbTableBrowser) != 0) { pplcGlyphPalcement->dx += otlDeviceTable(pbMainTable + Offset(pbTableBrowser),sec) .value(metr.cPPEmY); } pbTableBrowser += 2; } if (grfValueFormat & otlValueXAdvDevice) { if (metr.layout == otlRunLTR || metr.layout == otlRunRTL) { if (Offset(pbTableBrowser) != 0) { *pduDAdvance += otlDeviceTable(pbMainTable + Offset(pbTableBrowser),sec) .value(metr.cPPEmX); } } pbTableBrowser += 2; } if (grfValueFormat & otlValueYAdvDevice) { if (metr.layout == otlRunTTB || metr.layout == otlRunBTT) { if (Offset(pbTableBrowser) != 0) { *pduDAdvance += otlDeviceTable(pbMainTable + Offset(pbTableBrowser),sec) .value(metr.cPPEmY); } } pbTableBrowser += 2; } assert((pbTableBrowser-pbTable)==size(grfValueFormat)); return; } bool otlAnchor::getAnchor ( USHORT cFUnits, USHORT cPPEmX, USHORT cPPEmY, otlPlacement* rgPointCoords, otlPlacement* pplcAnchorPoint, otlSecurityData sec ) const { if (!isValid()) return false; assert(!isNull()); assert(pplcAnchorPoint != NULL); switch(format()) { case(1): { otlSimpleAnchorTable simpleAnchor = otlSimpleAnchorTable(pbTable,sec); if (!simpleAnchor.isValid()) return false; pplcAnchorPoint->dx = DesignToPP(cFUnits, cPPEmX, simpleAnchor.xCoordinate()); pplcAnchorPoint->dy = DesignToPP(cFUnits, cPPEmY, simpleAnchor.yCoordinate()); return true; } case(2): { otlContourAnchorTable contourAnchor = otlContourAnchorTable(pbTable,sec); if (!contourAnchor.isValid()) return false; if (rgPointCoords != NULL) { *pplcAnchorPoint = rgPointCoords[ contourAnchor.anchorPoint() ]; } else { pplcAnchorPoint->dx = DesignToPP(cFUnits, cPPEmX, contourAnchor.xCoordinate()); pplcAnchorPoint->dy = DesignToPP(cFUnits, cPPEmY, contourAnchor.yCoordinate()); } return true; } case(3): { otlDeviceAnchorTable deviceAnchor = otlDeviceAnchorTable(pbTable,sec); if (!deviceAnchor.isValid()) return false; pplcAnchorPoint->dx = DesignToPP(cFUnits, cPPEmX, deviceAnchor.xCoordinate()); pplcAnchorPoint->dy = DesignToPP(cFUnits, cPPEmY, deviceAnchor.yCoordinate()); otlDeviceTable deviceX = deviceAnchor.xDeviceTable(sec); otlDeviceTable deviceY = deviceAnchor.yDeviceTable(sec); if (!deviceX.isNull()) { pplcAnchorPoint->dx += deviceX.value(cPPEmX); } if (!deviceY.isNull()) { pplcAnchorPoint->dy += deviceY.value(cPPEmY); } return true; } default: return false; } } void AlignAnchors ( const otlList* pliGlyphInfo, otlList* pliPlacement, otlList* pliduDAdv, USHORT iglStatic, USHORT iglMobile, const otlAnchor& anchorStatic, const otlAnchor& anchorMobile, otlResourceMgr& resourceMgr, const otlMetrics& metr, USHORT grfOptions, otlSecurityData sec ) { assert(pliGlyphInfo->dataSize() == sizeof(otlGlyphInfo)); assert(pliPlacement->dataSize() == sizeof(otlPlacement)); assert(pliduDAdv->dataSize() == sizeof(long)); assert(pliGlyphInfo->length() == pliPlacement->length()); assert(pliPlacement->length() == pliduDAdv->length()); assert(iglStatic < pliGlyphInfo->length()); assert(iglMobile < pliGlyphInfo->length()); assert(!anchorStatic.isNull()); assert(!anchorMobile.isNull()); const otlGlyphInfo* pglinfStatic = readOtlGlyphInfo(pliGlyphInfo, iglStatic); const otlGlyphInfo* pglinfMobile = readOtlGlyphInfo(pliGlyphInfo, iglMobile); otlPlacement* pplcStatic = getOtlPlacement(pliPlacement, iglStatic); otlPlacement* pplcMobile = getOtlPlacement(pliPlacement, iglMobile); long* pduDAdvStatic = getOtlAdvance(pliduDAdv, iglStatic); long* pduDAdvMobile = getOtlAdvance(pliduDAdv, iglMobile); otlPlacement plcStaticAnchor; if (!anchorStatic.getAnchor(metr.cFUnits, metr.cPPEmX, metr.cPPEmY, resourceMgr.getPointCoords(pglinfStatic->glyph), &plcStaticAnchor,sec)) return; otlPlacement plcMobileAnchor; if (!
) return; long duAdvanceInBetween = 0; for (USHORT igl = MIN(iglStatic, iglMobile) + 1; igl < MAX(iglStatic, iglMobile); ++igl) { duAdvanceInBetween += *getOtlAdvance(pliduDAdv, igl); } if (metr.layout == otlRunLTR || metr.layout == otlRunRTL) { pplcMobile->dy = pplcStatic->dy + plcStaticAnchor.dy - plcMobileAnchor.dy; if ((metr.layout == otlRunLTR) == (iglStatic < iglMobile)) { long dx = pplcStatic->dx - *pduDAdvStatic + plcStaticAnchor.dx - duAdvanceInBetween - plcMobileAnchor.dx; if (grfOptions & otlUseAdvances) { *pduDAdvStatic += dx; } else { pplcMobile->dx = dx; } } else { long dx = pplcStatic->dx + *pduDAdvMobile + plcStaticAnchor.dx + duAdvanceInBetween - plcMobileAnchor.dx; if (grfOptions & otlUseAdvances) { *pduDAdvMobile -= dx; } else { pplcMobile->dx = dx; } } } else { pplcMobile->dx = pplcStatic->dx + plcStaticAnchor.dx - plcMobileAnchor.dx; if ((metr.layout == otlRunTTB) == (iglStatic < iglMobile)) { long dy = pplcStatic->dy - *pduDAdvStatic + plcStaticAnchor.dy - duAdvanceInBetween - plcMobileAnchor.dy; if (grfOptions & otlUseAdvances) { *pduDAdvStatic += dy; } else { pplcMobile->dy = dy; } } else { long dy = pplcStatic->dy + *pduDAdvMobile + plcStaticAnchor.dy + duAdvanceInBetween - plcMobileAnchor.dy; if (grfOptions & otlUseAdvances) { *pduDAdvMobile -= dy; } else { pplcMobile->dy = dy; } } } }
anchorMobile.getAnchor(metr.cFUnits, metr.cPPEmX, metr.cPPEmY, resourceMgr.getPointCoords(pglinfMobile->glyph), &plcMobileAnchor,sec)
call_expression
[]
C++
components/variations/field_trial_config/field_trial_util.cc
Ron423c/chromium
2edf7b980065b648f8b2a6e52193d83832fe36b7
#include "components/variations/field_trial_config/field_trial_util.h" #include <stddef.h> #include <map> #include <set> #include <string> #include <utility> #include <vector> #include "base/command_line.h" #include "base/feature_list.h" #include "base/metrics/field_trial.h" #include "base/metrics/field_trial_params.h" #include "base/optional.h" #include "base/strings/utf_string_conversions.h" #include "base/system/sys_info.h" #include "components/variations/client_filterable_state.h" #include "components/variations/field_trial_config/fieldtrial_testing_config.h" #include "components/variations/variations_seed_processor.h" #include "net/base/escape.h" #include "ui/base/device_form_factor.h" namespace variations { namespace { bool HasPlatform(const FieldTrialTestingExperiment& experiment, Study::Platform platform) { for (size_t i = 0; i < experiment.platforms_size; ++i) { if (experiment.platforms[i] == platform) return true; } return false; } bool HasDeviceLevelMismatch(const FieldTrialTestingExperiment& experiment) { if (!experiment.is_low_end_device.has_value()) { return false; } return experiment.is_low_end_device.value() != base::SysInfo::IsLowEndDevice(); } bool HasFormFactor(const FieldTrialTestingExperiment& experiment, Study::FormFactor current_form_factor) { for (size_t i = 0; i < experiment.form_factors_size; ++i) { if (experiment.form_factors[i] == current_form_factor) return true; } return experiment.form_factors_size == 0; } bool HasMinOSVersion(const FieldTrialTestingExperiment& experiment) { if (!experiment.min_os_version) return true; return base::Version(experiment.min_os_version) <= ClientFilterableState::GetOSVersion(); } void ApplyUIStringOverrides( const FieldTrialTestingExperiment& experiment, const VariationsSeedProcessor::UIStringOverrideCallback& callback) { for (size_t i = 0; i < experiment.override_ui_string_size; ++i) { callback.Run(experiment.override_ui_string[i].name_hash, base::UTF8ToUTF16(experiment.override_ui_string[i].value)); } } void AssociateParamsFromExperiment( const std::string& study_name, const FieldTrialTestingExperiment& experiment, const VariationsSeedProcessor::UIStringOverrideCallback& callback, base::FeatureList* feature_list) { if (experiment.params_size != 0) { base::FieldTrialParams params; for (size_t i = 0; i < experiment.params_size; ++i) { const FieldTrialTestingExperimentParams& param = experiment.params[i]; params[param.key] = param.value; } base::AssociateFieldTrialParams(study_name, experiment.name, params); } base::FieldTrial* trial = base::FieldTrialList::CreateFieldTrial(study_name, experiment.name); if (!trial) { DLOG(WARNING) << "Field trial config study skipped: " << study_name << "." << experiment.name << " (it is overridden from chrome://flags)"; return; } for (size_t i = 0; i < experiment.enable_features_size; ++i) { feature_list->RegisterFieldTrialOverride( experiment.enable_features[i], base::FeatureList::OVERRIDE_ENABLE_FEATURE, trial); } for (size_t i = 0; i < experiment.disable_features_size; ++i) { feature_list->RegisterFieldTrialOverride( experiment.disable_features[i], base::FeatureList::OVERRIDE_DISABLE_FEATURE, trial); } ApplyUIStringOverrides(experiment, callback); } void ChooseExperiment( const FieldTrialTestingStudy& study, const VariationsSeedProcessor::UIStringOverrideCallback& callback, Study::Platform platform, Study::FormFactor current_form_factor, base::FeatureList* feature_list) { const auto& command_line = *base::CommandLine::ForCurrentProcess(); const FieldTrialTestingExperiment* chosen_experiment = nullptr; for (size_t i = 0; i < study.experiments_size; ++i) { const FieldTrialTestingExperiment* experiment = study.experiments + i; if (HasPlatform(*experiment, platform)) { if (!chosen_experiment && !HasDeviceLevelMismatch(*experiment) && HasFormFactor(*experiment, current_form_factor) && HasMinOSVersion(*experiment)) { chosen_experiment = experiment; } if (experiment->forcing_flag && command_line.HasSwitch(experiment->forcing_flag)) { chosen_experiment = experiment; break; } } } if (chosen_experiment) { AssociateParamsFromExperiment(study.name, *chosen_experiment, callback, feature_list); } } } std::string EscapeValue(const std::string& value) { std::string net_escaped_str = net::EscapeQueryParamValue(value, true ); std::string escaped_str; escaped_str.reserve(net_escaped_str.length()); for (const char ch : net_escaped_str) { if (ch == '.') escaped_str.append("%2E"); else if (ch == '*') escaped_str.append("%2A"); else escaped_str.push_back(ch); } return escaped_str; } bool AssociateParamsFromString(const std::string& varations_string) { return base::AssociateFieldTrialParamsFromString(varations_string, &base::UnescapeValue); } void AssociateParamsFromFieldTrialConfig( const FieldTrialTestingConfig& config, const VariationsSeedProcessor::UIStringOverrideCallback& callback, Study::Platform platform, Study::FormFactor current_form_factor, base::FeatureList* feature_list) { for (size_t i = 0; i < config.studies_size; ++i) { const FieldTrialTestingStudy& study = config.studies[i]; if (study.experiments_size > 0) { ChooseExperiment(study, callback, platform, current_form_factor, feature_list); } else { DLOG(ERROR) << "Unexpected empty study: " << study.name; } } } void AssociateDefaultFieldTrialConfig( const VariationsSeedProcessor::UIStringOverrideCallback& callback, Study::Platform platform, Study::FormFactor current_form_factor, base::FeatureList* feature_list) { AssociateParamsFromFieldTrialConfig(kFieldTrialConfig, callback, platform, current_form_factor, feature_list); } }
#include "components/variations/field_trial_config/field_trial_util.h" #include <stddef.h> #include <map> #include <set> #include <string> #include <utility> #include <vector> #include "base/command_line.h" #include "base/feature_list.h" #include "base/metrics/field_trial.h" #include "base/metrics/field_trial_params.h" #include "base/optional.h" #include "base/strings/utf_string_conversions.h" #include "base/system/sys_info.h" #include "components/variations/client_filterable_state.h" #include "components/variations/field_trial_config/fieldtrial_testing_config.h" #include "components/variations/variations_seed_processor.h" #include "net/base/escape.h" #include "ui/base/device_form_factor.h" namespace variations { namespace { bool HasPlatform(const FieldTrialTestingExperiment& experiment, Study::Platform platform) { for (size_t i = 0; i < experiment.platforms_size; ++i) { if (experiment.platforms[i] == platform) return true; } return false; } bool HasDeviceLevelMismatch(const FieldTrialTestingExperiment& experiment) { if (!experiment.is_low_end_device.has_value()) { return false; } return experiment.is_low_end_device.value() != base::SysInfo::IsLowEndDevice(); } bool HasFormFactor(const FieldTrialTestingExperiment& experiment, Study::FormFactor current_form_factor) { for (size_t i = 0; i < experiment.form_factors_size; ++i) { if (experiment.form_factors[i] == current_form_factor) return true; } return experiment.form_factors_size == 0; } bool HasMinOSVersion(const FieldTrialTestingExperiment& experiment) { if (!experiment.min_os_version) return true; return base::Version(experiment.min_os_version) <= ClientFilterableState::GetOSVersion(); } void ApplyUIStringOverrides( const FieldTrialTestingExperiment& experiment, const VariationsSeedProcessor::UIStringOverrideCallback& callback) { for (size_t i = 0; i < experiment.override_ui_string_size; ++i) { callback.Run(experiment.override_ui_string[i].name_hash, base::UTF8ToUTF16(experiment.override_ui_string[i].value)); } } void AssociateParamsFromExperiment( const std::string& study_name, const FieldTrialTestingExperiment& experiment, const VariationsSeedProcessor::UIStringOverrideCallback& callback, base::FeatureList* feature_list) { if (experiment.params_size != 0) { base::FieldTrialParams params; for (size_t i = 0; i < experiment.params_size; ++i) { const FieldTrialTestingExperimentParams& param = experiment.params[i]; params[param.key] = param.value; } base::AssociateFieldTrialParams(study_name, experiment.name, params); } base::FieldTrial* trial = base::FieldTrialList::CreateFieldTrial(study_name, experiment.name); if (!trial) { DLOG(WARNING) << "Field trial config study skipped: " << study_name << "." << experiment.name << " (it is overridden from chrome://flags)"; return; } for (size_t i = 0; i < experiment.enable_features_size; ++i) { feature_list->RegisterFieldTrialOverride( experiment.enable_features[i], base::FeatureList::OVERRIDE_ENABLE_FEATURE, trial); } for (size_t i = 0; i < experiment.disable_features_size; ++i) { feature_list->RegisterFieldTrialOverride( experiment.disable_features[i], base::FeatureList::OVERRIDE_DISABLE_FEATURE, trial); } ApplyUIStringOverrides(experiment, callback); }
} std::string EscapeValue(const std::string& value) { std::string net_escaped_str = net::EscapeQueryParamValue(value, true ); std::string escaped_str; escaped_str.reserve(net_escaped_str.length()); for (const char ch : net_escaped_str) { if (ch == '.') escaped_str.append("%2E"); else if (ch == '*') escaped_str.append("%2A"); else escaped_str.push_back(ch); } return escaped_str; } bool AssociateParamsFromString(const std::string& varations_string) { return base::AssociateFieldTrialParamsFromString(varations_string, &base::UnescapeValue); } void AssociateParamsFromFieldTrialConfig( const FieldTrialTestingConfig& config, const VariationsSeedProcessor::UIStringOverrideCallback& callback, Study::Platform platform, Study::FormFactor current_form_factor, base::FeatureList* feature_list) { for (size_t i = 0; i < config.studies_size; ++i) { const FieldTrialTestingStudy& study = config.studies[i]; if (study.experiments_size > 0) { ChooseExperiment(study, callback, platform, current_form_factor, feature_list); } else { DLOG(ERROR) << "Unexpected empty study: " << study.name; } } } void AssociateDefaultFieldTrialConfig( const VariationsSeedProcessor::UIStringOverrideCallback& callback, Study::Platform platform, Study::FormFactor current_form_factor, base::FeatureList* feature_list) { AssociateParamsFromFieldTrialConfig(kFieldTrialConfig, callback, platform, current_form_factor, feature_list); } }
void ChooseExperiment( const FieldTrialTestingStudy& study, const VariationsSeedProcessor::UIStringOverrideCallback& callback, Study::Platform platform, Study::FormFactor current_form_factor, base::FeatureList* feature_list) { const auto& command_line = *base::CommandLine::ForCurrentProcess(); const FieldTrialTestingExperiment* chosen_experiment = nullptr; for (size_t i = 0; i < study.experiments_size; ++i) { const FieldTrialTestingExperiment* experiment = study.experiments + i; if (HasPlatform(*experiment, platform)) { if (!chosen_experiment && !HasDeviceLevelMismatch(*experiment) && HasFormFactor(*experiment, current_form_factor) && HasMinOSVersion(*experiment)) { chosen_experiment = experiment; } if (experiment->forcing_flag && command_line.HasSwitch(experiment->forcing_flag)) { chosen_experiment = experiment; break; } } } if (chosen_experiment) { AssociateParamsFromExperiment(study.name, *chosen_experiment, callback, feature_list); } }
function_block-full_function
[]
C++
test/range/test-transform.cpp
rogiervd/range
2ed4ee2063a02cadc575fe4e7a3b7dd61bbd2b5d
#define BOOST_TEST_MODULE test_range_transform #include "utility/test/boost_unit_test.hpp" #include "range/transform.hpp" #include <type_traits> #include <vector> #include <list> #include <tuple> #include <boost/mpl/assert.hpp> #include "range/std.hpp" #include "range/for_each_macro.hpp" #include "rime/check/check_equal.hpp" #include "weird_count.hpp" #include "unique_range.hpp" struct simple_count { int i; simple_count() : i (0) {} rime::false_type empty (direction::front) const { return rime::false_; } int chop_in_place (direction::front) { return i ++; } }; struct simple_count_tag {}; namespace range { template <> struct tag_of_qualified <simple_count> { typedef simple_count_tag type; }; } BOOST_AUTO_TEST_SUITE(test_range_transform) using range::transform; using range::front; using range::back; using range::default_direction; using range::empty; using range::size; using range::first; using range::drop; using range::chop; using range::chop_in_place; using range::second; using range::at; using range::is_homogeneous; struct callable_twice { template <class Argument> Argument operator() (Argument const & argument) const { return argument + argument; } }; callable_twice twice; struct callable_duplicate { template <class Argument> std::tuple <Argument, Argument> operator() (Argument const & argument) const { return std::make_tuple (argument, argument); } }; callable_duplicate duplicate; struct callable_point { template <class Argument> typename std::add_pointer <Argument>::type operator() (Argument && argument) const { return &argument; } }; callable_point point; BOOST_AUTO_TEST_CASE (example) { std::vector <int> v; v.push_back (5); v.push_back (7); { int count = 0; RANGE_FOR_EACH (i, v) count += i; BOOST_CHECK_EQUAL (count, 12); } { int count = 0; RANGE_FOR_EACH (i, transform (v, twice)) count += i; BOOST_CHECK_EQUAL (count, 24); } } BOOST_AUTO_TEST_CASE (test_range_transform) { { std::tuple <> t; auto v = transform (t, duplicate); auto direction = default_direction (v); BOOST_MPL_ASSERT (( std::is_same <decltype (direction), direction::front>)); BOOST_MPL_ASSERT_NOT ((is_homogeneous <decltype (v)>)); RIME_CHECK_EQUAL (empty (v), rime::true_); RIME_CHECK_EQUAL (size (v), rime::size_t <0u>()); BOOST_MPL_ASSERT_NOT (( range::has <range::callable::first (decltype (v))>)); BOOST_MPL_ASSERT_NOT (( range::has <range::callable::drop (decltype (v))>)); BOOST_MPL_ASSERT_NOT (( range::has <range::callable::chop (decltype (v))>)); } { std::tuple <int> t (7); auto v = transform (t, duplicate); BOOST_MPL_ASSERT_NOT ((is_homogeneous <decltype (v)>)); RIME_CHECK_EQUAL (empty (v), rime::false_); RIME_CHECK_EQUAL (size (v), rime::size_t <1u>()); BOOST_MPL_ASSERT ((range::has <range::callable::first (decltype (v))>)); BOOST_MPL_ASSERT ((range::has <range::callable::drop (decltype (v))>)); auto f = range::first (v); BOOST_MPL_ASSERT ((std::is_same <decltype (f), std::tuple <int, int>>)); BOOST_CHECK_EQUAL (first (f), 7); BOOST_CHECK_EQUAL (second (f), 7); RIME_CHECK_EQUAL (empty (drop (v)), rime::true_); auto chopped = chop (v); static_assert (std::is_same <decltype (chopped.first()), std::tuple <int, int> const &>::value, ""); BOOST_CHECK_EQUAL (first (chopped.first()), 7); BOOST_CHECK_EQUAL (second (chopped.first()), 7); RIME_CHECK_EQUAL (empty (chopped.rest()), rime::true_); } { std::tuple <int, char, double> t (7, 'a', 9.25); { auto v = transform (t, duplicate); BOOST_MPL_ASSERT_NOT ((is_homogeneous <decltype (v)>)); RIME_CHECK_EQUAL (empty (v), rime::false_); RIME_CHECK_EQUAL (size (v), rime::size_t <3u>()); BOOST_MPL_ASSERT (( range::has <range::callable::first (decltype (v))>)); BOOST_MPL_ASSERT (( range::has <range::callable::drop (decltype (v))>)); auto e1 = range::first (v); BOOST_MPL_ASSERT (( std::is_same <decltype (e1), std::tuple <int, int>>)); BOOST_CHECK_EQUAL (first (e1), 7); BOOST_CHECK_EQUAL (second (e1), 7); auto e2 = range::first (drop (v)); BOOST_MPL_ASSERT (( std::is_same <decltype (e2), std::tuple <char, char>>)); BOOST_CHECK_EQUAL (first (e2), 'a'); BOOST_CHECK_EQUAL (second (e2), 'a'); auto e3 = range::first (drop (v, rime::size_t <2>())); BOOST_MPL_ASSERT (( std::is_same <decltype (e3), std::tuple <double, double>>)); BOOST_CHECK_EQUAL (first (e3), 9.25); BOOST_CHECK_EQUAL (second (e3), 9.25); RIME_CHECK_EQUAL ( empty (drop (v, rime::size_t <3>())), rime::true_); auto chopped1 = chop (v); static_assert (std::is_same <decltype (chopped1.first()), std::tuple <int, int> const &>::value, ""); BOOST_CHECK_EQUAL (first (chopped1.first()), 7); BOOST_CHECK_EQUAL (second (chopped1.first()), 7); RIME_CHECK_EQUAL (empty (chopped1.rest()), rime::false_); auto chopped2 = chop (chopped1.rest()); static_assert (std::is_same <decltype (chopped2.first()), std::tuple <char, char> const &>::value, ""); BOOST_CHECK_EQUAL (first (chopped2.first()), 'a'); BOOST_CHECK_EQUAL (second (chopped2.first()), 'a'); RIME_CHECK_EQUAL (empty (chopped2.rest()), rime::false_); auto chopped3 = chop (chopped2.rest()); static_assert (std::is_same <decltype (chopped3.first()), std::tuple <double, double> const &>::value, ""); BOOST_CHECK_EQUAL (first (chopped3.first()), 9.25); BOOST_CHECK_EQUAL (second (chopped3.first()), 9.25); RIME_CHECK_EQUAL (empty (chopped3.rest()), rime::true_); } { auto v = transform (t, point); BOOST_CHECK_EQUAL (first (v), &first (t)); *at (v, rime::size_t <2>()) = 4.5; BOOST_CHECK_EQUAL (first (t, back), 4.5); } } } BOOST_AUTO_TEST_CASE (test_range_transform_homogeneous) { { std::vector <double> c; c.push_back (6); c.push_back (10.5); c.push_back (-8); { auto v = transform (c, twice); BOOST_MPL_ASSERT ((is_homogeneous <decltype (v)>)); BOOST_MPL_ASSERT (( range::has <range::callable::empty (decltype (v))>)); BOOST_MPL_ASSERT (( range::has <range::callable::size (decltype (v))>)); BOOST_MPL_ASSERT (( range::has <range::callable::first (decltype (v))>)); BOOST_MPL_ASSERT (( range::has <range::callable::drop (decltype (v))>)); BOOST_MPL_ASSERT (( range::has <range::callable::drop (decltype (v), int)>)); BOOST_CHECK (!empty (v)); BOOST_CHECK_EQUAL (size (v), 3u); BOOST_CHECK_EQUAL (first (v), 12.); BOOST_CHECK_EQUAL (at (v, 1), 21.); BOOST_CHECK_EQUAL (at (v, 2), -16.); BOOST_CHECK_EQUAL (first (v, back), -16.); BOOST_CHECK_EQUAL (at (v, 1, back), 21.); BOOST_CHECK_EQUAL (at (v, 2, back), 12.); auto chopped1 = chop (v); BOOST_CHECK_EQUAL (chopped1.first(), 12); auto chopped2 = chop (chopped1.rest()); BOOST_CHECK_EQUAL (chopped2.first(), 21); auto chopped3 = chop (chopped2.rest()); BOOST_CHECK_EQUAL (chopped3.first(), -16); BOOST_CHECK (empty (chopped3.rest())); v = drop (v); BOOST_CHECK_EQUAL (first (v), 21.); v = drop (v); BOOST_CHECK_EQUAL (first (v), -16.); v = drop (v); BOOST_CHECK (empty (v)); } { auto v = transform (c, point); BOOST_CHECK_EQUAL (first (v), &first (c)); BOOST_CHECK_EQUAL (at (v, 1), &at (c, 1)); *first (v) = 27.5; BOOST_CHECK_EQUAL (first (c), 27.5); } } { std::list <double> c; c.push_back (6); c.push_back (10.5); c.push_back (-8); { auto v = transform (c, twice); BOOST_MPL_ASSERT ((is_homogeneous <decltype (v)>)); BOOST_MPL_ASSERT (( range::has <range::callable::empty (decltype (v))>)); BOOST_MPL_ASSERT_NOT (( range::has <range::callable::size (decltype (v))>)); BOOST_MPL_ASSERT (( range::has <range::callable::first (decltype (v))>)); BOOST_MPL_ASSERT (( range::has <range::callable::drop (decltype (v))>)); BOOST_MPL_ASSERT_NOT (( range::has <range::callable::drop (decltype (v), int)>)); BOOST_CHECK (!empty (v)); BOOST_CHECK_EQUAL (first (v), 12.); BOOST_CHECK_EQUAL (first (drop (v)), 21.); BOOST_CHECK_EQUAL (first (drop (drop (v))), -16.); BOOST_CHECK_EQUAL (first (v, back), -16.); BOOST_CHECK_EQUAL (first (drop (v, back), back), 21.); BOOST_CHECK_EQUAL (first (drop (drop (v, back), back), back), 12.); } } { std::vector <double> c; c.push_back (6); c.push_back (10.5); c.push_back (-8); auto v = transform (transform (c, twice), duplicate); BOOST_CHECK_EQUAL (size (v), 3u); BOOST_CHECK (first (v) == std::make_tuple (12., 12.)); BOOST_CHECK (first (drop (v)) == std::make_tuple (21., 21.)); BOOST_CHECK (first (v, back) == std::make_tuple (-16., -16.)); auto chopped1 = chop (v); BOOST_CHECK (chopped1.first() == std::make_tuple (12., 12.)); auto chopped2 = chop (chopped1.rest()); BOOST_CHECK (chopped2.first() == std::make_tuple (21., 21.)); auto chopped3 = chop (chopped2.rest()); BOOST_CHECK (chopped3.first() == std::make_tuple (-16., -16.)); BOOST_CHECK (empty (chopped3.rest())); } } BOOST_AUTO_TEST_CASE (test_range_transform_weird_count) { { weird_count w; weird_direction direction (7); auto v = transform (w, twice, weird_direction (7)); BOOST_MPL_ASSERT ((std::is_same <range::result_of < range::callable::default_direction (decltype (v))>::type, forgotten_to_define_direction>)); BOOST_CHECK (!empty (v, direction)); BOOST_MPL_ASSERT_NOT ((range::has < range::callable::size (weird_direction, decltype (v))>)); BOOST_CHECK_EQUAL (first (v, direction), 0); BOOST_CHECK_EQUAL (first (drop (v, direction), direction), 2); BOOST_CHECK_EQUAL (first (drop (v, 5, direction), direction), 10); } { weird_count w; weird_direction direction (7); auto view = range::view (w, direction); auto transformed = transform (view, duplicate, direction); BOOST_CHECK (!empty (transformed, direction)); BOOST_CHECK (first (transformed, direction) == std::make_tuple (0, 0)); BOOST_CHECK (first (drop (transformed, 2, direction), direction) == std::make_tuple (2, 2)); } } template <class Type> struct show_type; BOOST_AUTO_TEST_CASE (unique_underlying) { std::vector <int> v; v.push_back (6); v.push_back (20); v.push_back (-5); { auto t = transform (unique_view (v), twice); BOOST_CHECK_EQUAL (first (t), 12); t = drop (std::move (t)); BOOST_CHECK_EQUAL (first (t), 40); t = drop (std::move (t)); BOOST_CHECK_EQUAL (first (t), -10); t = drop (std::move (t)); BOOST_CHECK (empty (t)); } { auto t = transform (one_time_view (v), twice); static_assert (range::has <range::callable::chop (decltype (t)) >::value, ""); static_assert (!range::has <range::callable::chop (decltype (t) const &) >::value, ""); auto chopped1 = chop (std::move (t)); BOOST_CHECK_EQUAL (chopped1.first(), 12); auto chopped2 = chop (chopped1.move_rest()); BOOST_CHECK_EQUAL (chopped2.first(), 40); BOOST_CHECK_EQUAL (first (chopped2.move_rest()), -10); } } BOOST_AUTO_TEST_CASE (only_chop_in_place) { { simple_count c; int zero = chop_in_place (c); BOOST_CHECK_EQUAL (zero, 0); int one = chop_in_place (c); BOOST_CHECK_EQUAL (one, 1); } { auto even = transform (simple_count(), twice); int zero = chop_in_place (even); BOOST_CHECK_EQUAL (zero, 0); int two = chop_in_place (even); BOOST_CHECK_EQUAL (two, 2); int four = chop_in_place (even); BOOST_CHECK_EQUAL (four, 4); int six = chop_in_place (even); BOOST_CHECK_EQUAL (six, 6); } } class round_up { int const & step; public: round_up (int const & step) : step (step) {} int operator() (int n) const { return ((n + (step - 1)) / step) * step; } }; BOOST_AUTO_TEST_CASE (function_with_reference) { int step = 5; round_up round (step); BOOST_CHECK_EQUAL (round (0), 0); BOOST_CHECK_EQUAL (round (1), 5); BOOST_CHECK_EQUAL (round (4), 5); BOOST_CHECK_EQUAL (round (5), 5); BOOST_CHECK_EQUAL (round (23), 25); step = 3; BOOST_CHECK_EQUAL (round (7), 9); std::vector <int> v; v.push_back (1); v.push_back (5); v.push_back (10); v.push_back (27); { auto rounded = transform (v, round); BOOST_CHECK_EQUAL (first (rounded), 3); rounded = drop (rounded); BOOST_CHECK_EQUAL (first (rounded), 6); rounded = drop (rounded); step = 7; int fourteen = chop_in_place (rounded); BOOST_CHECK_EQUAL (fourteen, 14); auto chopped = chop (rounded); BOOST_CHECK_EQUAL (chopped.first(), 28); BOOST_CHECK (empty (chopped.rest())); } { auto rounded = transform (one_time_view (v), round); step = 4; auto four = chop_in_place (rounded); BOOST_CHECK_EQUAL (four, 4); auto chopped = chop (std::move (rounded)); BOOST_CHECK_EQUAL (chopped.first(), 8); } } BOOST_AUTO_TEST_SUITE_END()
#define BOOST_TEST_MODULE test_range_transform #include "utility/test/boost_unit_test.hpp" #include "range/transform.hpp" #include <type_traits> #include <vector> #include <list> #include <tuple> #include <boost/mpl/assert.hpp> #include "range/std.hpp" #include "range/for_each_macro.hpp" #include "rime/check/check_equal.hpp" #include "weird_count.hpp" #include "unique_range.hpp" struct simple_count { int i; simple_count() : i (0) {} rime::false_type empty (direction::front) const { return rime::false_; } int chop_in_place (direction::front) { return i ++; } }; struct simple_count_tag {}; namespace range { template <> struct tag_of_qualified <simple_count> { typedef simple_count_tag type; }; } BOOST_AUTO_TEST_SUITE(test_range_transform) using range::transform; using range::front; using range::back; using range::default_direction; using range::empty; using range::size; using range::first; using range::drop; using range::chop; using range::chop_in_place; using range::second; using range::at; using range::is_homogeneous; struct callable_twice { template <class Argument> Argument operator() (Argument const & argument) const { return argument + argument; } }; callable_twice twice; struct callable_duplicate { template <class Argument> std::tuple <Argument, Argument> operator() (Argument const & argument) const { return std::make_tuple (argument, argument); } }; callable_duplicate duplicate; struct callable_point { template <class Argument> typename std::add_pointer <Argument>::type operator() (Argument && argument) const { return &argument; } }; callable_point point; BOOST_AUTO_TEST_CASE (example) { std::vector <int> v; v.push_back (5); v.push_back (7); { int count = 0; RANGE_FOR_EACH (i, v) count += i; BOOST_CHECK_EQUAL (count, 12); } { int count = 0; RANGE_FOR_EACH (i, transform (v, twice)) count += i; BOOST_CHECK_EQUAL (count, 24); } } BOOST_AUTO_TEST_CASE (test_range_transform) { { std::tuple <> t; auto v = transform (t, duplicate); auto direction = default_direction (v); BOOST_MPL_ASSERT (( std::is_same <decltype (direction), direction::front>)); BOOST_MPL_ASSERT_NOT ((is_homogeneous <decltype (v)>)); RIME_CHECK_EQUAL (empty (v), rime::true_); RIME_CHECK_EQUAL (size (v), rime::size_t <0u>()); BOOST_MPL_ASSERT_NOT (( range::has <range::callable::first (decltype (v))>)); BOOST_MPL_ASSERT_NOT (( range::has <range::callable::drop (decltype (v))>)); BOOST_MPL_ASSERT_NOT (( range::has <range::callable::chop (decltype (v))>)); } { std::tuple <int> t (7); auto v = transform (t, duplicate); BOOST_MPL_ASSERT_NOT ((is_homogeneous <decltype (v)>)); RIME_CHECK_EQUAL (empty (v), rime::false_); RIME_CHECK_EQUAL (size (v), rime::size_t <1u>()); BOOST_MPL_ASSERT ((range::has <range::callable::first (decltype (v))>)); BOOST_MPL_ASSERT ((range::has <range::callable::drop (decltype (v))>)); auto f = range::first (v); BOOST_MPL_ASSERT ((std::is_same <decltype (f), std::tuple <int, int>>)); BOOST_CHECK_EQUAL (first (f), 7); BOOST_CHECK_EQUAL (second (f), 7); RIME_CHECK_EQUAL (empty (drop (v)), rime::true_); auto chopped = chop (v); static_assert (std::is_same <decltype (chopped.first()),
L (empty (chopped3.rest()), rime::true_); } { auto v = transform (t, point); BOOST_CHECK_EQUAL (first (v), &first (t)); *at (v, rime::size_t <2>()) = 4.5; BOOST_CHECK_EQUAL (first (t, back), 4.5); } } } BOOST_AUTO_TEST_CASE (test_range_transform_homogeneous) { { std::vector <double> c; c.push_back (6); c.push_back (10.5); c.push_back (-8); { auto v = transform (c, twice); BOOST_MPL_ASSERT ((is_homogeneous <decltype (v)>)); BOOST_MPL_ASSERT (( range::has <range::callable::empty (decltype (v))>)); BOOST_MPL_ASSERT (( range::has <range::callable::size (decltype (v))>)); BOOST_MPL_ASSERT (( range::has <range::callable::first (decltype (v))>)); BOOST_MPL_ASSERT (( range::has <range::callable::drop (decltype (v))>)); BOOST_MPL_ASSERT (( range::has <range::callable::drop (decltype (v), int)>)); BOOST_CHECK (!empty (v)); BOOST_CHECK_EQUAL (size (v), 3u); BOOST_CHECK_EQUAL (first (v), 12.); BOOST_CHECK_EQUAL (at (v, 1), 21.); BOOST_CHECK_EQUAL (at (v, 2), -16.); BOOST_CHECK_EQUAL (first (v, back), -16.); BOOST_CHECK_EQUAL (at (v, 1, back), 21.); BOOST_CHECK_EQUAL (at (v, 2, back), 12.); auto chopped1 = chop (v); BOOST_CHECK_EQUAL (chopped1.first(), 12); auto chopped2 = chop (chopped1.rest()); BOOST_CHECK_EQUAL (chopped2.first(), 21); auto chopped3 = chop (chopped2.rest()); BOOST_CHECK_EQUAL (chopped3.first(), -16); BOOST_CHECK (empty (chopped3.rest())); v = drop (v); BOOST_CHECK_EQUAL (first (v), 21.); v = drop (v); BOOST_CHECK_EQUAL (first (v), -16.); v = drop (v); BOOST_CHECK (empty (v)); } { auto v = transform (c, point); BOOST_CHECK_EQUAL (first (v), &first (c)); BOOST_CHECK_EQUAL (at (v, 1), &at (c, 1)); *first (v) = 27.5; BOOST_CHECK_EQUAL (first (c), 27.5); } } { std::list <double> c; c.push_back (6); c.push_back (10.5); c.push_back (-8); { auto v = transform (c, twice); BOOST_MPL_ASSERT ((is_homogeneous <decltype (v)>)); BOOST_MPL_ASSERT (( range::has <range::callable::empty (decltype (v))>)); BOOST_MPL_ASSERT_NOT (( range::has <range::callable::size (decltype (v))>)); BOOST_MPL_ASSERT (( range::has <range::callable::first (decltype (v))>)); BOOST_MPL_ASSERT (( range::has <range::callable::drop (decltype (v))>)); BOOST_MPL_ASSERT_NOT (( range::has <range::callable::drop (decltype (v), int)>)); BOOST_CHECK (!empty (v)); BOOST_CHECK_EQUAL (first (v), 12.); BOOST_CHECK_EQUAL (first (drop (v)), 21.); BOOST_CHECK_EQUAL (first (drop (drop (v))), -16.); BOOST_CHECK_EQUAL (first (v, back), -16.); BOOST_CHECK_EQUAL (first (drop (v, back), back), 21.); BOOST_CHECK_EQUAL (first (drop (drop (v, back), back), back), 12.); } } { std::vector <double> c; c.push_back (6); c.push_back (10.5); c.push_back (-8); auto v = transform (transform (c, twice), duplicate); BOOST_CHECK_EQUAL (size (v), 3u); BOOST_CHECK (first (v) == std::make_tuple (12., 12.)); BOOST_CHECK (first (drop (v)) == std::make_tuple (21., 21.)); BOOST_CHECK (first (v, back) == std::make_tuple (-16., -16.)); auto chopped1 = chop (v); BOOST_CHECK (chopped1.first() == std::make_tuple (12., 12.)); auto chopped2 = chop (chopped1.rest()); BOOST_CHECK (chopped2.first() == std::make_tuple (21., 21.)); auto chopped3 = chop (chopped2.rest()); BOOST_CHECK (chopped3.first() == std::make_tuple (-16., -16.)); BOOST_CHECK (empty (chopped3.rest())); } } BOOST_AUTO_TEST_CASE (test_range_transform_weird_count) { { weird_count w; weird_direction direction (7); auto v = transform (w, twice, weird_direction (7)); BOOST_MPL_ASSERT ((std::is_same <range::result_of < range::callable::default_direction (decltype (v))>::type, forgotten_to_define_direction>)); BOOST_CHECK (!empty (v, direction)); BOOST_MPL_ASSERT_NOT ((range::has < range::callable::size (weird_direction, decltype (v))>)); BOOST_CHECK_EQUAL (first (v, direction), 0); BOOST_CHECK_EQUAL (first (drop (v, direction), direction), 2); BOOST_CHECK_EQUAL (first (drop (v, 5, direction), direction), 10); } { weird_count w; weird_direction direction (7); auto view = range::view (w, direction); auto transformed = transform (view, duplicate, direction); BOOST_CHECK (!empty (transformed, direction)); BOOST_CHECK (first (transformed, direction) == std::make_tuple (0, 0)); BOOST_CHECK (first (drop (transformed, 2, direction), direction) == std::make_tuple (2, 2)); } } template <class Type> struct show_type; BOOST_AUTO_TEST_CASE (unique_underlying) { std::vector <int> v; v.push_back (6); v.push_back (20); v.push_back (-5); { auto t = transform (unique_view (v), twice); BOOST_CHECK_EQUAL (first (t), 12); t = drop (std::move (t)); BOOST_CHECK_EQUAL (first (t), 40); t = drop (std::move (t)); BOOST_CHECK_EQUAL (first (t), -10); t = drop (std::move (t)); BOOST_CHECK (empty (t)); } { auto t = transform (one_time_view (v), twice); static_assert (range::has <range::callable::chop (decltype (t)) >::value, ""); static_assert (!range::has <range::callable::chop (decltype (t) const &) >::value, ""); auto chopped1 = chop (std::move (t)); BOOST_CHECK_EQUAL (chopped1.first(), 12); auto chopped2 = chop (chopped1.move_rest()); BOOST_CHECK_EQUAL (chopped2.first(), 40); BOOST_CHECK_EQUAL (first (chopped2.move_rest()), -10); } } BOOST_AUTO_TEST_CASE (only_chop_in_place) { { simple_count c; int zero = chop_in_place (c); BOOST_CHECK_EQUAL (zero, 0); int one = chop_in_place (c); BOOST_CHECK_EQUAL (one, 1); } { auto even = transform (simple_count(), twice); int zero = chop_in_place (even); BOOST_CHECK_EQUAL (zero, 0); int two = chop_in_place (even); BOOST_CHECK_EQUAL (two, 2); int four = chop_in_place (even); BOOST_CHECK_EQUAL (four, 4); int six = chop_in_place (even); BOOST_CHECK_EQUAL (six, 6); } } class round_up { int const & step; public: round_up (int const & step) : step (step) {} int operator() (int n) const { return ((n + (step - 1)) / step) * step; } }; BOOST_AUTO_TEST_CASE (function_with_reference) { int step = 5; round_up round (step); BOOST_CHECK_EQUAL (round (0), 0); BOOST_CHECK_EQUAL (round (1), 5); BOOST_CHECK_EQUAL (round (4), 5); BOOST_CHECK_EQUAL (round (5), 5); BOOST_CHECK_EQUAL (round (23), 25); step = 3; BOOST_CHECK_EQUAL (round (7), 9); std::vector <int> v; v.push_back (1); v.push_back (5); v.push_back (10); v.push_back (27); { auto rounded = transform (v, round); BOOST_CHECK_EQUAL (first (rounded), 3); rounded = drop (rounded); BOOST_CHECK_EQUAL (first (rounded), 6); rounded = drop (rounded); step = 7; int fourteen = chop_in_place (rounded); BOOST_CHECK_EQUAL (fourteen, 14); auto chopped = chop (rounded); BOOST_CHECK_EQUAL (chopped.first(), 28); BOOST_CHECK (empty (chopped.rest())); } { auto rounded = transform (one_time_view (v), round); step = 4; auto four = chop_in_place (rounded); BOOST_CHECK_EQUAL (four, 4); auto chopped = chop (std::move (rounded)); BOOST_CHECK_EQUAL (chopped.first(), 8); } } BOOST_AUTO_TEST_SUITE_END()
std::tuple <int, int> const &>::value, ""); BOOST_CHECK_EQUAL (first (chopped.first()), 7); BOOST_CHECK_EQUAL (second (chopped.first()), 7); RIME_CHECK_EQUAL (empty (chopped.rest()), rime::true_); } { std::tuple <int, char, double> t (7, 'a', 9.25); { auto v = transform (t, duplicate); BOOST_MPL_ASSERT_NOT ((is_homogeneous <decltype (v)>)); RIME_CHECK_EQUAL (empty (v), rime::false_); RIME_CHECK_EQUAL (size (v), rime::size_t <3u>()); BOOST_MPL_ASSERT (( range::has <range::callable::first (decltype (v))>)); BOOST_MPL_ASSERT (( range::has <range::callable::drop (decltype (v))>)); auto e1 = range::first (v); BOOST_MPL_ASSERT (( std::is_same <decltype (e1), std::tuple <int, int>>)); BOOST_CHECK_EQUAL (first (e1), 7); BOOST_CHECK_EQUAL (second (e1), 7); auto e2 = range::first (drop (v)); BOOST_MPL_ASSERT (( std::is_same <decltype (e2), std::tuple <char, char>>)); BOOST_CHECK_EQUAL (first (e2), 'a'); BOOST_CHECK_EQUAL (second (e2), 'a'); auto e3 = range::first (drop (v, rime::size_t <2>())); BOOST_MPL_ASSERT (( std::is_same <decltype (e3), std::tuple <double, double>>)); BOOST_CHECK_EQUAL (first (e3), 9.25); BOOST_CHECK_EQUAL (second (e3), 9.25); RIME_CHECK_EQUAL ( empty (drop (v, rime::size_t <3>())), rime::true_); auto chopped1 = chop (v); static_assert (std::is_same <decltype (chopped1.first()), std::tuple <int, int> const &>::value, ""); BOOST_CHECK_EQUAL (first (chopped1.first()), 7); BOOST_CHECK_EQUAL (second (chopped1.first()), 7); RIME_CHECK_EQUAL (empty (chopped1.rest()), rime::false_); auto chopped2 = chop (chopped1.rest()); static_assert (std::is_same <decltype (chopped2.first()), std::tuple <char, char> const &>::value, ""); BOOST_CHECK_EQUAL (first (chopped2.first()), 'a'); BOOST_CHECK_EQUAL (second (chopped2.first()), 'a'); RIME_CHECK_EQUAL (empty (chopped2.rest()), rime::false_); auto chopped3 = chop (chopped2.rest()); static_assert (std::is_same <decltype (chopped3.first()), std::tuple <double, double> const &>::value, ""); BOOST_CHECK_EQUAL (first (chopped3.first()), 9.25); BOOST_CHECK_EQUAL (second (chopped3.first()), 9.25); RIME_CHECK_EQUA
random
[ { "content": "struct negate { int operator() (int i) const { return -i; } };\n\n\n\nBOOST_AUTO_TEST_SUITE(range_less_lexicographical_homogeneous)\n\n\n\n#define CHECK_range_less_lexicographical(r1, r2, value) \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical (r1, r2), value); \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n r1, r2, range::front), value); \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n range::reverse (r1), range::reverse (r2), range::back), value); \\\n\n \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n r1, r2, std::less <int>()), value); \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n r1, r2, range::front, std::less <int>()), value); \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n range::reverse (r1), range::reverse (r2), \\\n\n range::back, std::less <int>()), value); \\\n\n \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n", "file_path": "test/range/test-less_lexicographical-homogeneous.cpp", "rank": 0, "score": 275017.08357312647 }, { "content": "struct negate { int operator() (int i) const { return -i; } };\n\n\n\nBOOST_AUTO_TEST_SUITE(range_test_less_lexicographical_heterogeneous)\n\n\n\n#define CHECK_range_less_lexicographical(r1, r2, value) \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical (r1, r2), value); \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n r1, r2, range::front), value); \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n range::reverse (r1), range::reverse (r2), range::back), value); \\\n\n \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n r1, r2, std::less <int>()), value); \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n r1, r2, range::front, std::less <int>()), value); \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n range::reverse (r1), range::reverse (r2), \\\n\n range::back, std::less <int>()), value); \\\n\n \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n", "file_path": "test/range/test-less_lexicographical-heterogeneous.cpp", "rank": 1, "score": 275017.0835731264 }, { "content": "struct negate { int operator() (int i) const { return -i; } };\n\n\n\nBOOST_AUTO_TEST_SUITE(range_less_lexicographical_test_suite_mixed)\n\n\n\n#define CHECK_range_less_lexicographical(r1, r2, value) \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical (r1, r2), value); \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n r1, r2, range::front), value); \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n range::reverse (r1), range::reverse (r2), range::back), value); \\\n\n \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n r1, r2, std::less <int>()), value); \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n r1, r2, range::front, std::less <int>()), value); \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n range::reverse (r1), range::reverse (r2), \\\n\n range::back, std::less <int>()), value); \\\n\n \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n", "file_path": "test/range/test-less_lexicographical-mixed.cpp", "rank": 2, "score": 275017.0835731264 }, { "content": "struct negate { int operator() (int i) const { return -i; } };\n\n\n\nBOOST_AUTO_TEST_SUITE(range_test_less_lexicographical_heterogeneous)\n\n\n\n#define CHECK_range_less_lexicographical(r1, r2, value) \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical (r1, r2), value); \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n r1, r2, range::front), value); \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n range::reverse (r1), range::reverse (r2), range::back), value); \\\n\n \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n r1, r2, std::less <int>()), value); \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n r1, r2, range::front, std::less <int>()), value); \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical ( \\\n\n range::reverse (r1), range::reverse (r2), \\\n\n range::back, std::less <int>()), value); \\\n\n \\\n\n RIME_CHECK_EQUAL (range::less_lexicographical (\\\n", "file_path": "test/range/test-less_lexicographical-heterogeneous-2.cpp", "rank": 3, "score": 275017.0835731264 }, { "content": " class Enable = typename std::enable_if <!Empty>::type,\n", "file_path": "include/range/tuple.hpp", "rank": 4, "score": 265244.14526694705 }, { "content": "struct negate { double operator() (double i) const { return -i; } };\n\n\n\nBOOST_AUTO_TEST_SUITE(range_test_tuple_less)\n\n\n\nusing range::make_tuple;\n\nusing range::less_lexicographical;\n\n\n\nusing range::drop;\n\nusing range::back;\n\nusing range::front;\n\n\n\nusing range::reverse;\n\nusing range::transform;\n\n\n\n#define CHECK_tuple_view_less(r1, r2, value) \\\n\n RIME_CHECK_EQUAL (less_lexicographical (r1, r2), value); \\\n\n RIME_CHECK_EQUAL (less_lexicographical ( \\\n\n r1, r2, front), value); \\\n\n RIME_CHECK_EQUAL (less_lexicographical ( \\\n\n make_tuple_from (reverse (r1)), make_tuple_from (reverse (r2)), back), \\\n", "file_path": "test/range/test-tuple-5-less-types.cpp", "rank": 5, "score": 264712.68649770506 }, { "content": " class First = decltype (\n\n callable::chop_in_place_direct() (\n\n std::declval <DecayedRange &>(), std::declval <Direction>(),\n\n pick_overload())),\n", "file_path": "include/range/detail/core_chop_in_place.hpp", "rank": 6, "score": 253930.10077617576 }, { "content": " class First = typename UnderlyingChopped::first_type,\n", "file_path": "test/range/unique_range.hpp", "rank": 7, "score": 248714.4499823365 }, { "content": " class First = typename std::decay <ScanRange>::type::state_type,\n", "file_path": "include/range/scan.hpp", "rank": 8, "score": 246147.78009117703 }, { "content": " class Result = chopped <typename UnderlyingChopped::first_type,\n\n view_of_shared <Heavyweight,\n\n typename UnderlyingChopped::rest_type>>>\n\n inline Result implement_chop (view_of_shared_tag const &,\n\n Range && range, Direction const & direction)\n\n {\n\n auto underlying_chopped = range::chop (\n\n range::helper::get_underlying <Range> (range), direction);\n\n return Result (underlying_chopped.move_first(),\n\n view_shared_detail::make_view_of_shared() (\n\n view_shared_detail::get_heavyweight_pointer() (\n\n std::forward <Range> (range)),\n\n underlying_chopped.move_rest()));\n\n }\n\n\n\n} // namespace view_of_shared_operation\n\n\n\nnamespace callable {\n\n\n\n struct view_shared {\n", "file_path": "include/range/view_shared.hpp", "rank": 9, "score": 244178.4041300153 }, { "content": " class FirstAndUnderlyingRest = decltype (callable::chop_direct() (\n\n std::declval <Underlying>(), std::declval <Direction>(),\n\n pick_overload())),\n", "file_path": "include/range/take.hpp", "rank": 10, "score": 240330.43644781836 }, { "content": "struct twice {\n\n template <class Type> Type operator() (Type const & o) const\n\n { return o + o; }\n\n};\n\n\n\nauto get_twice (int i, float f)\n\nRETURNS (range::transform (range::view_shared (get_int_float_string (i, f)),\n\n twice()));\n\n\n\nBOOST_PYTHON_MODULE (tuple_example) {\n\n using namespace boost::python;\n\n\n\n double_string = std::make_tuple (6.5, \"Excellent.\");\n\n\n\n range::python::register_tuple <std::tuple <double, std::string>>();\n\n range::python::register_tuple <range::tuple <int, float, std::string>>();\n\n range::python::register_tuple <decltype (get_twice (5, 6))>();\n\n\n\n def (\"getDoubleString\", &get_double_string);\n\n def (\"getIntBoolString\", &get_int_float_string);\n\n def (\"getTwice\", &get_twice);\n\n}\n", "file_path": "test/range/python/tuple_example.cpp", "rank": 11, "score": 239578.13447466 }, { "content": " class Empty = typename std::decay <ScanRange>::type::empty_type,\n", "file_path": "include/range/scan.hpp", "rank": 12, "score": 237694.84237829683 }, { "content": " class Element = typename decayed_result_of <callable::first (View)>::type>\n\nbuffer <Element> make_buffer (Range && range)\n\n{\n\n typedef typename buffer <Element>::producer_ptr producer_ptr;\n\n return buffer <Element> (producer_ptr::template construct <\n\n buffer_detail::range_element_producer <View, Element, Number>> (\n\n view (std::forward <Range> (range))));\n\n}\n\n/// \\endcond\n\n\n\ntemplate <class Element> class element_producer\n\n: public utility::shared\n\n{\n\npublic:\n\n typedef utility::pointer_policy::strict_weak_ordered <\n\n utility::pointer_policy::pointer_access <\n\n utility::pointer_policy::reference_count_shared <\n\n utility::pointer_policy::with_recursive_type <\n\n utility::pointer_policy::use_new_delete <\n\n element_producer>>>>>\n\n pointer_policy;\n\n\n", "file_path": "include/range/buffer.hpp", "rank": 13, "score": 236335.82501994335 }, { "content": " class UnderlyingChopped = decltype (\n\n callable::chop_direct() (\n\n range::helper::get_underlying <View> (std::declval <View &>()),\n\n std::declval <Direction>(), pick_overload())),\n", "file_path": "include/range/transform.hpp", "rank": 14, "score": 235734.94929590067 }, { "content": " class Rest = decltype (std::declval <drop_direct>() (\n\n std::declval <Range>(), one_type(),\n\n std::declval <Direction>(), pick_overload()))>\n\n chopped <Element, Rest>\n\n operator() (Range && range, Direction const & direction,\n\n overload_order <3> *) const\n\n {\n\n // Don't do the following in one line: make sure that\n\n // first_direct is called first.\n\n auto && element = first_direct() (range, direction,\n\n pick_overload());\n\n // Then forward the range to drop.\n\n // The static_cast is in case first returned an rvalue or\n\n // rvalue reference.\n\n // decltype (element) is then an rvalue reference.\n\n return chopped <Element, Rest> (\n\n static_cast <Element> (element),\n\n drop_direct() (std::forward <Range> (range),\n\n one_type(), direction, pick_overload()));\n\n }\n", "file_path": "include/range/detail/core_chop.hpp", "rank": 15, "score": 231861.32052375484 }, { "content": " class Element = decltype (std::declval <first_direct>() (\n\n std::declval <Range const &>(),\n\n std::declval <Direction>(), pick_overload())),\n", "file_path": "include/range/detail/core_chop.hpp", "rank": 16, "score": 231853.26508536565 }, { "content": "struct negate { double operator() (double i) const { return -i; } };\n\n\n\nBOOST_AUTO_TEST_SUITE(range_test_tuple_less)\n\n\n\nusing range::make_tuple;\n\nusing range::make_tuple_from;\n\nusing range::less_lexicographical;\n\n\n\nusing range::drop;\n\nusing range::back;\n\nusing range::front;\n\n\n\nusing range::reverse;\n\nusing range::transform;\n\n\n\n#define CHECK_tuple_view_less(r1, r2, value) \\\n\n RIME_CHECK_EQUAL (less_lexicographical (r1, r2), value); \\\n\n RIME_CHECK_EQUAL (less_lexicographical ( \\\n\n r1, r2, front), value); \\\n\n RIME_CHECK_EQUAL (less_lexicographical ( \\\n", "file_path": "test/range/test-tuple-5-less-heterogeneous.cpp", "rank": 17, "score": 231376.7269998425 }, { "content": " class Result = decltype (std::declval <first_direct>() (\n\n std::declval <Range &>(), std::declval <Direction>(),\n\n pick_overload())),\n", "file_path": "include/range/detail/core_chop_in_place.hpp", "rank": 18, "score": 225616.52155896302 }, { "content": " class Size = typename result_of <\n\n callable::size (Range2 const &, Direction)>::type,\n", "file_path": "include/range/take.hpp", "rank": 19, "score": 221336.47497956344 }, { "content": "struct member_extractor <ReturnType (Structure::*)() const, member_function> {\n\n ReturnType operator() (Structure const & structure) const\n\n { return (structure.*member_function)(); }\n\n};\n\n\n\n// Specialisation for a free function.\n\ntemplate <typename Structure, typename ReturnType,\n\n ReturnType (* function) (Structure)>\n", "file_path": "include/range/member_view.hpp", "rank": 20, "score": 218811.44019503845 }, { "content": "struct add_return_const {\n\n // \"const\" is only retained in return types for class types, so return\n\n // \"int_holder const\" and not just \"int const\".\n\n int_holder const operator() (int_holder i, int j) const\n\n { return int_holder (i.i + j); }\n\n};\n\n\n\nBOOST_AUTO_TEST_SUITE(test_range_tuple_fold_state_types)\n\n\n\nBOOST_AUTO_TEST_CASE (test_fold_const_state) {\n\n range::tuple <int, short, int> v (1,2,3);\n\n BOOST_MPL_ASSERT ((std::is_same <\n\n decltype (fold (int_holder(), v, add_return_const())),\n\n int_holder const>));\n\n BOOST_CHECK_EQUAL (fold (int_holder(), v, add_return_const()).i, 6);\n\n}\n\n\n", "file_path": "test/range/test-tuple-5-fold-state_types.cpp", "rank": 21, "score": 217716.49906921916 }, { "content": " class NewFirst = tuple <typename result_of <\n\n range::callable::first (Ranges, Direction)>::type ...>,\n", "file_path": "include/range/zip.hpp", "rank": 22, "score": 215727.65461807497 }, { "content": " class UnderlyingChopped = decltype (range::chop (\n\n range::helper::get_underlying <Range> (std::declval <Range &>()),\n\n std::declval <Direction>())),\n", "file_path": "include/range/view_shared.hpp", "rank": 23, "score": 215323.61518870498 }, { "content": " class Result = decltype (range::drop (\n\n std::declval <Range2>(), std::declval <Difference>(),\n\n direction::opposite (std::declval <Direction>())))>\n\n Result operator() (Range2 && range,\n\n Limit const & limit, Direction const & direction,\n\n overload_order <2> *) const\n\n {\n\n auto size = range::size (range, direction);\n\n return range::drop (std::forward <Range2> (range),\n\n size - take_detail::min() (limit, size),\n\n direction::opposite (direction));\n\n }\n\n\n\n /* Standard implementation. */\n\n template <class Range, class Limit, class Direction>\n\n auto operator() (Range && range, Limit const & limit,\n\n Direction const & direction, overload_order <3> *)\n\n const\n\n RETURNS (make_take_range (\n\n std::forward <Range> (range), limit, direction));\n", "file_path": "include/range/take.hpp", "rank": 24, "score": 213364.24531582516 }, { "content": " class DecayedRange = typename std::decay <Range>::type,\n", "file_path": "include/range/detail/core_chop_in_place.hpp", "rank": 25, "score": 211556.53568094852 }, { "content": " class Rest = decltype (range::callable::drop_direct() (\n\n std::declval <ScanRange>(), rime::size_t <1>(),\n\n std::declval <Direction>(), pick_overload())),\n", "file_path": "include/range/scan.hpp", "rank": 26, "score": 211126.37237564797 }, { "content": " class Result = chopped <First, Rest>>\n\n inline Result implement_chop (scan_tag <Direction> const &,\n\n ScanRange && range, Direction const & direction)\n\n {\n\n range.direction_must_be_equal (direction);\n\n // Get the current state.\n\n First first = range::first (range, direction);\n\n return Result (std::forward <First> (first),\n\n range::drop (std::forward <ScanRange> (range), direction));\n\n }\n\n\n\n // chop_in_place.\n\n template <class Direction, class ScanRange,\n", "file_path": "include/range/scan.hpp", "rank": 27, "score": 210945.4890755408 }, { "content": " class Enable = typename std::enable_if <is_range <RangeTuple>::value>::type>\n\ninline auto zip_from (RangeTuple && range_tuple)\n\nRETURNS (zip_from (std::forward <RangeTuple> (range_tuple),\n\n default_direction (first (range_tuple))));\n\n/// \\endcond\n\n\n\n/* zip_range. */\n\n\n\n/** \\brief\n\nRange that presents a tuple of ranges as a range of tuples.\n\n\n\nDirection is the direction in which the underlying ranges will be traversed.\n\nThe underlying ranges are kept in a tuple.\n\nThe type returned is also tuple.\n\n*/\n\ntemplate <class Direction, class ... Ranges> class zip_range\n\n: public helper::with_default_direction <Direction>\n\n{\n\npublic:\n\n typedef meta::vector <Ranges ...> range_types;\n", "file_path": "include/range/zip.hpp", "rank": 28, "score": 210088.04132554313 }, { "content": " class Result = typename std_tuple_operation::std_tuple_member_view <\n\n std::tuple <Types ...> const &, Types ...>::type>\n\n inline Result implement_make_view (std_tuple_operation::std_tuple_tag,\n\n bool once, std::tuple <Types ...> const & tuple,\n\n helper::front_or_back,\n\n helper::front_or_back = helper::front_or_back())\n\n { return Result (tuple); }\n\n\n\n // Reference.\n\n template <class ... Types,\n", "file_path": "include/range/std/tuple.hpp", "rank": 29, "score": 207068.6797919739 }, { "content": " class Result = chopped <First, DecayedRange>,\n", "file_path": "include/range/detail/core_chop_in_place.hpp", "rank": 30, "score": 206270.366751462 }, { "content": " class Result = decltype (std::declval <chop_direct>() (\n\n std::declval <Range &&>(), std::declval <Direction>(),\n\n pick_overload()).forward_first()),\n", "file_path": "include/range/detail/core_chop_in_place.hpp", "rank": 31, "score": 204786.60331488372 }, { "content": "struct count {\n\n int number;\n\n count() : number (0) {}\n\n\n\n template <class Element> void operator() (Element const &)\n\n { ++ number; }\n\n};\n\n\n", "file_path": "test/range/test-tuple-5-for_each.cpp", "rank": 32, "score": 203483.5472955592 }, { "content": " class Difference = decltype (std::declval <Size>() -\n\n take_detail::min() (\n\n std::declval <Limit>(), std::declval <Size>())),\n", "file_path": "include/range/take.hpp", "rank": 33, "score": 201708.12490677368 }, { "content": " class Result = chopped <\n\n typename std::decay <decltype (\n\n std::declval <View>().function() (\n\n std::declval <UnderlyingChopped>().move_first())\n\n )>::type,\n\n typename std::decay <decltype (\n\n range::transform (\n\n std::declval <UnderlyingChopped>().move_rest(),\n\n std::declval <View>().function(),\n\n std::declval <Direction>())\n\n )>::type>\n\n >\n\n inline Result implement_chop (transform_view_tag const &, View && view,\n\n Direction const & direction)\n\n {\n\n auto chopped = range::chop (\n\n range::helper::get_underlying <View> (view), direction);\n\n return Result (\n\n view.function() (chopped.move_first()),\n\n range::transform (chopped.move_rest(), view.function(), direction));\n\n }\n\n\n\n} // namespace transform_operation\n\n\n\n} // namespace range\n\n\n\n#endif // RANGE_TRANSFORM_HPP_INCLUDED\n", "file_path": "include/range/transform.hpp", "rank": 34, "score": 201172.76560997585 }, { "content": " class Result = typename std_tuple_operation::std_pair_member_view <\n\n std::pair <First, Second> &&>::type>\n\n inline Result implement_make_view (std_tuple_operation::std_pair_tag,\n\n rime::true_type once, std::pair <First, Second> && pair,\n\n helper::front_or_back,\n\n helper::front_or_back = helper::front_or_back())\n\n { return Result (std::move (pair)); }\n\n\n\n\n\n // implement_make_view for std::tuple.\n\n // Const reference.\n\n template <class ... Types,\n", "file_path": "include/range/std/tuple.hpp", "rank": 35, "score": 200452.68107075448 }, { "content": " class First, class ... Rest>\n\n struct convert_interface <TargetInterfacePtr,\n\n meta::set <TargetCapabilityKeysLeft ...>,\n\n meta::set <First, Rest ...>>\n\n {\n\n convert_interface <TargetInterfacePtr,\n\n meta::set <TargetCapabilityKeysLeft ...>,\n\n meta::set <Rest ...>> recursive;\n\n\n\n template <class OtherInterfacePtr>\n\n TargetInterfacePtr operator() (OtherInterfacePtr const & input)\n\n const\n\n {\n\n return recursive (\n\n input->lose_capability (capability::type <First>()));\n\n }\n\n };\n\n\n\n // Finished.\n\n template <class TargetInterfacePtr>\n", "file_path": "include/range/any_range/interface.hpp", "rank": 38, "score": 199510.07751320538 }, { "content": " - callable::implementation::one_type())),\n\n class Underlying = typename helper::underlying_type <TakeRange>::type,\n", "file_path": "include/range/take.hpp", "rank": 39, "score": 198471.2607006938 }, { "content": " class StoredArgumentsTuple, class ... StoredIndices>\n\n static typename call_result <Range>::type\n\n call_with (Range && range,\n\n StoredArgumentsTuple const & stored_arguments,\n\n meta::vector <StoredIndices ...>)\n\n {\n\n return Callable() (std::forward <Range> (range),\n\n ::range::at (stored_arguments, StoredIndices()) ...);\n\n }\n\n\n\n public:\n\n template <class ... QStoredArguments, class Enable =\n\n typename utility::disable_if_variadic_same_or_derived <\n\n lazy, QStoredArguments ...>::type>\n\n lazy (QStoredArguments && ... stored_arguments)\n\n : stored_arguments_ (\n\n std::forward <QStoredArguments> (stored_arguments) ...) {}\n\n\n\n /**\n\n Call a newly constructed <c>Callable()</c> with the additional\n", "file_path": "include/range/lazy.hpp", "rank": 40, "score": 196357.8905424471 }, { "content": " class UnderlyingEmpty = typename\n\n normalise_empty_type <Underlying, Direction>::type,\n", "file_path": "include/range/scan.hpp", "rank": 42, "score": 194809.50727275506 }, { "content": "struct const_or_not {\n\n const_or_not() {}\n\n\n\n bool operator() (int, int) const { return true; }\n\n bool operator() (int, int) { return false; }\n\n};\n\n\n\nBOOST_AUTO_TEST_CASE (test_fold_function_lvalue_rvalue) {\n\n const_or_not f;\n\n const_or_not const f_const;\n\n\n\n range::tuple <int> v (1);\n\n\n\n BOOST_CHECK_EQUAL (fold (true, v, f), false);\n\n BOOST_CHECK_EQUAL (fold (true, v, std::move (f)), false);\n\n BOOST_CHECK_EQUAL (fold (true, v, f_const), true);\n\n}\n\n\n\nBOOST_AUTO_TEST_SUITE_END()\n", "file_path": "test/range/test-tuple-5-fold-state_types.cpp", "rank": 43, "score": 192047.92440675973 }, { "content": " class Heavyweight = typename std::decay <Range>::type::heavyweight_type,\n", "file_path": "include/range/view_shared.hpp", "rank": 44, "score": 191452.24117776792 }, { "content": " class Limit = typename std::decay <TakeRange>::type::limit_type,\n", "file_path": "include/range/take.hpp", "rank": 45, "score": 191452.24117776786 }, { "content": " class Function = typename std::decay <ScanRange>::type::function_type,\n", "file_path": "include/range/scan.hpp", "rank": 46, "score": 191452.24117776792 }, { "content": " class Result = typename std::decay <ScanRange>::type::state_type>\n\n inline Result implement_chop_in_place (scan_tag <Direction> const &,\n\n ScanRange & range, Direction const & direction)\n\n {\n\n range.direction_must_be_equal (direction);\n\n // Find the current state.\n\n Result first = range::first (range, direction);\n\n range = range::drop (std::move (range), direction);\n\n return std::forward <Result> (first);\n\n }\n\n\n\n} // namespace scan_operation\n\n\n\nnamespace callable {\n\n\n\n struct scan {\n\n private:\n\n /**\n\n Compute type that indicates whether the resulting scan_range will be\n\n empty.\n", "file_path": "include/range/scan.hpp", "rank": 47, "score": 191452.24117776786 }, { "content": " class State = typename std::decay <ScanRange>::type::state_type,\n", "file_path": "include/range/scan.hpp", "rank": 48, "score": 191452.24117776786 }, { "content": " class Result = typename tuple_detail::tuple_view <\n\n 0, sizeof ... (Types), tuple <Types ...> &&>>\n\n inline Result implement_make_view (tuple_tag,\n\n rime::true_type once, tuple <Types ...> && tuple,\n\n helper::front_or_back, helper::front_or_back = helper::front_or_back())\n\n { return Result (std::move (tuple)); }\n\n\n\n} // namespace tuple_operation\n\n\n\n} // namespace range\n\n\n\n#endif // RANGE_CONTAINER_TUPLE_HPP_INCLUDED\n", "file_path": "include/range/tuple.hpp", "rank": 49, "score": 190871.12322532776 }, { "content": " class Enable1 = typename boost::enable_if <is_range <Range>>::type,\n", "file_path": "include/range/any_range.hpp", "rank": 50, "score": 189321.46656028868 }, { "content": " class Enable = typename\n\n std::enable_if <is_direction <Direction>::value>::type>\n\n auto operator() (Range && range, Increment const & increment,\n\n Direction const & direction) const\n\n RETURNS (dispatch() (\n\n std::forward <Range> (range), increment, direction,\n\n pick_overload()));\n\n\n\n // With increment but without direction: use default direction.\n\n template <class Range, class Increment, class Enable =\n\n typename std::enable_if <\n\n is_range <Range>::value && !is_direction <Increment>::value\n\n >::type>\n\n auto operator() (Range && range, Increment const & increment) const\n\n RETURNS (dispatch() (\n\n std::forward <Range> (range), increment,\n\n range::default_direction (range),\n\n pick_overload()));\n\n\n\n // Without increment but with direction: use one_type().\n", "file_path": "include/range/detail/core_drop.hpp", "rank": 51, "score": 189031.1123847761 }, { "content": " class Extract = extract <(tuple_size - Begin - 1)>>\n\n typename Extract::template result <TupleReference>::type\n\n first (direction::front const &) const\n\n { return Extract() (tuple()); }\n\n\n\n template <bool Empty = is_empty,\n", "file_path": "include/range/tuple.hpp", "rank": 52, "score": 188036.9939642109 }, { "content": "struct add_return_const {\n\n // \"const\" is only retained in return types for class types, so return\n\n // \"int_holder const\" and not just \"int const\".\n\n int_holder const operator() (int_holder i, int j) const\n\n { return int_holder (i.i + j); }\n\n};\n\n\n\nBOOST_AUTO_TEST_SUITE(test_range_fold_state_types)\n\n\n\nBOOST_AUTO_TEST_CASE (test_fold_const_state) {\n\n {\n\n std::vector <int> v;\n\n v.push_back (1);\n\n v.push_back (2);\n\n v.push_back (3);\n\n BOOST_MPL_ASSERT ((std::is_same <\n\n decltype (fold (int_holder(), v, add_return_const())),\n\n int_holder const>));\n\n BOOST_CHECK_EQUAL (fold (int_holder(), v, add_return_const()).i, 6);\n\n }\n\n {\n\n std::tuple <int, short, int> v (1,2,3);\n\n BOOST_MPL_ASSERT ((std::is_same <\n\n decltype (fold (int_holder(), v, add_return_const())),\n\n int_holder const>));\n\n BOOST_CHECK_EQUAL (fold (int_holder(), v, add_return_const()).i, 6);\n\n }\n\n}\n\n\n", "file_path": "test/range/test-fold-3-state_types.cpp", "rank": 53, "score": 187933.15390654278 }, { "content": "struct int_holder {\n\n int i;\n\n int_holder() : i(0) {}\n\n int_holder (int i) : i (i) {}\n\n};\n\n\n", "file_path": "test/range/test-tuple-5-fold-state_types.cpp", "rank": 54, "score": 186930.48350750888 }, { "content": "struct return_right {\n\n template <class Left, class Right>\n\n Right && operator() (Left && left, Right && right) const\n\n { return static_cast <Right &&> (right); }\n\n};\n\n\n\nBOOST_AUTO_TEST_CASE (test_fold_lvalue_state) {\n\n int i = 7;\n\n\n\n range::tuple <int, short, int> v (1,2,3);\n\n\n\n BOOST_MPL_ASSERT ((std::is_same <\n\n decltype (fold (i, v, return_right())), int &>));\n\n BOOST_CHECK_EQUAL (&fold (i, v, return_right()), &at_c <2> (v));\n\n\n\n // Check that nothing has changed.\n\n BOOST_CHECK_EQUAL (i, 7);\n\n BOOST_CHECK_EQUAL (at_c <0> (v), 1);\n\n BOOST_CHECK_EQUAL (at_c <1> (v), 2);\n\n BOOST_CHECK_EQUAL (at_c <2> (v), 3);\n", "file_path": "test/range/test-tuple-5-fold-state_types.cpp", "rank": 55, "score": 186850.33984924704 }, { "content": " // Implemented if \"empty\" is implemented.\n\n class Enable = decltype (range::empty (\n\n std::declval <Range>(), std::declval <Direction>()))>\n\n auto operator() (State && state, Range && range,\n\n Direction const & direction, Function && function) const\n\n RETURNS (apply() (std::forward <State> (state),\n\n range::view (std::forward <Range> (range), direction),\n\n direction,\n\n std::forward <Function> (function)));\n\n\n\n // Without direction: use default_direction.\n\n template <class State, class Range, class Function,\n", "file_path": "include/range/scan.hpp", "rank": 56, "score": 186669.26020663496 }, { "content": " // Implemented if \"empty\" is implemented.\n\n class Enable = decltype (range::empty (\n\n std::declval <Range>(), std::declval <Direction>()))>\n\n auto operator() (State && state, Range && range,\n\n Direction const & direction, Function && function) const\n\n RETURNS (dispatch() (std::forward <State> (state),\n\n range::view_once (std::forward <Range> (range), direction),\n\n direction,\n\n std::forward <Function> (function), pick_overload()));\n\n\n\n // Without direction: use default_direction.\n\n template <class State, class Range, class Function,\n", "file_path": "include/range/fold.hpp", "rank": 57, "score": 186669.260206635 }, { "content": " class Extract = extract <(tuple_size - end_position)>>\n\n typename Extract::template result <TupleReference>::type\n\n first (direction::back const &) const\n\n { return Extract() (tuple()); }\n\n\n\n // at.\n\n template <class Index, class Enable = typename\n\n std::enable_if <(Index::value < view_size)>::type,\n", "file_path": "include/range/tuple.hpp", "rank": 58, "score": 184991.27396091504 }, { "content": " class Enable = typename boost::enable_if <\n\n boost::mpl::and_<not_this_tuple <Range>, is_range <Range>,\n\n range_is_assignable <Range>\n\n >>::type>\n\n tuple & operator= (Range && range) {\n\n elements_ = view_once (std::forward <Range> (range), front);\n\n return *this;\n\n }\n\n\n\n // Explicit copy and move assignment.\n\n tuple & operator= (tuple_if_copy_assignable const & that) {\n\n elements_ = view_once (that, front);\n\n return *this;\n\n }\n\n tuple & operator= (tuple_if_move_assignable && that) {\n\n elements_ = view_once (std::move (that), front);\n\n return *this;\n\n }\n\n\n\n /**\n", "file_path": "include/range/tuple.hpp", "rank": 59, "score": 183053.41855587205 }, { "content": " class View = typename decayed_result_of <callable::view (Range)>::type,\n", "file_path": "include/range/buffer.hpp", "rank": 60, "score": 182971.31666275254 }, { "content": " class View = typename decayed_result_of <callable::view (Range)>::type>\n\nbuffer <Element> make_buffer (Range && range)\n\n{\n\n typedef typename buffer <Element>::producer_ptr producer_ptr;\n\n return buffer <Element> (producer_ptr::template construct <\n\n buffer_detail::range_element_producer <View, Element, Number>> (\n\n view (std::forward <Range> (range))));\n\n}\n\n\n\n/// \\cond DONT_DOCUMENT\n\ntemplate <std::size_t Number = 0, class Range,\n", "file_path": "include/range/buffer.hpp", "rank": 61, "score": 182971.31666275254 }, { "content": " class DecayedScanRange = typename std::decay <ScanRange>::type>\n\n inline Result implement_drop_one (scan_tag <Direction> const &,\n\n ScanRange && range, Direction const & direction)\n\n {\n\n range.direction_must_be_equal (direction);\n\n return rime::call_if (range::empty (range.underlying(), direction),\n\n scan_detail::when_empty <Result, DecayedScanRange>(),\n\n scan_detail::when_not_empty <Result, DecayedScanRange>(),\n\n std::forward <ScanRange> (range), direction);\n\n }\n\n\n\n // chop.\n\n template <class Direction, class ScanRange,\n", "file_path": "include/range/scan.hpp", "rank": 62, "score": 182953.08516366288 }, { "content": " class Result = decltype (range::chop_in_place (\n\n std::declval <Underlying2 &>(), std::declval <Direction>())),\n", "file_path": "include/range/take.hpp", "rank": 63, "score": 181229.00047293512 }, { "content": " class Result = scan_range <Direction, typename\n\n scan_range_empty <Range, Direction>::type,\n\n Function, State, typename std::decay <Range>::type>>\n\n Result operator() (State && state, Range && range,\n\n Direction const & direction, Function && function) const\n\n {\n\n return Result (direction, std::forward <Function> (function),\n\n std::forward <State> (state), std::forward <Range> (range));\n\n }\n\n };\n\n\n\n public:\n\n template <class State, class Range, class Direction, class Function,\n", "file_path": "include/range/scan.hpp", "rank": 64, "score": 180966.69258928314 }, { "content": " class DefaultDirection = typename decayed_result_of <\n\n default_direction (FirstRange)>::type,\n", "file_path": "include/range/zip.hpp", "rank": 65, "score": 180866.15501911726 }, { "content": " class scan_range <Direction, rime::true_type>\n\n: public helper::with_default_direction <Direction>\n\n{\n\npublic:\n\n scan_range (Direction const & direction)\n\n : helper::with_default_direction <Direction> (direction) {}\n\n\n\n rime::true_type empty (Direction const & direction) const {\n\n this->direction_must_be_equal (direction);\n\n return rime::true_;\n\n }\n\n};\n\n\n\n// Case 2: known to be non-empty.\n\ntemplate <class Direction,\n", "file_path": "include/range/scan.hpp", "rank": 66, "score": 175932.36073061993 }, { "content": " class Predicate, class NonEmptyActor, class EmptyActor>\n\n auto operator() (Range && range, Direction const & direction,\n\n Predicate && predicate, NonEmptyActor && non_empty_actor,\n\n EmptyActor && empty_actor) const\n\n RETURNS (\n\n find_detail::finder <Predicate, NonEmptyActor, EmptyActor> (\n\n std::forward <Predicate> (predicate),\n\n std::forward <NonEmptyActor> (non_empty_actor),\n\n std::forward <EmptyActor> (empty_actor)\n\n ) (\n\n std::forward <Range> (range), direction));\n\n\n\n // No empty_actor.\n\n template <class Range, class Direction,\n", "file_path": "include/range/find.hpp", "rank": 67, "score": 174051.3470956768 }, { "content": " class Result = chopped <NewFirst, NewRest>>\n\n inline Result implement_chop (zip_range_tag <Direction> const &,\n\n zip_range <Direction, Ranges ...> && r, Direction const & direction)\n\n {\n\n r.direction_must_be_equal (direction);\n\n // Apply \"chop\" to each of the ranges and store the result as\n\n // tuple <chopped <first1, rest1>, chopped <first2, rest2>, ...>\n\n auto chopped = make_tuple_from (\n\n transform (view_once (std::move (r.underlying())),\n\n lazy::chop (direction)));\n\n // Produce underlying with rvalue references to the \"first\"\n\n // elements first1 &&, first2 &&, ...\n\n auto first = transform (chopped, zip_detail::move_first());\n\n // ... and the \"rest\" elements\n\n // rest1 &&, rest2 &&, ....\n\n auto rest = transform (chopped, zip_detail::move_rest());\n\n\n\n return Result (std::move (first),\n\n NewRest (direction, std::move (rest)));\n\n }\n\n\n\n} // namespace zip_operation\n\n\n\n} // namespace range\n\n\n\n#endif // RANGE_ZIP_HPP_INCLUDED\n", "file_path": "include/range/zip.hpp", "rank": 68, "score": 173863.30210161008 }, { "content": " class Enable = typename std::enable_if <\n\n rime::is_constant <Increment>::value\n\n && Increment::value == 1\n\n >::type>\n\n auto operator() (\n\n Range && range, Increment const &,\n\n Direction const & direction,\n\n overload_order <8> *) const\n\n RETURNS (helper::member_access::chop (\n\n std::forward <Range> (range), direction).forward_rest());\n\n };\n\n\n\n public:\n\n // With direction and increment.\n\n template <class Range, class Increment, class Direction,\n", "file_path": "include/range/detail/core_drop.hpp", "rank": 69, "score": 173721.99757063272 }, { "content": " class Enable = typename std::enable_if <\n\n rime::is_constant <Increment>::value>::type>\n\n auto operator() (\n\n Range && range, Increment const & increment,\n\n Direction const & direction,\n\n overload_order <4> *) const\n\n RETURNS (helper::member_access::drop_constant (\n\n std::forward <Range> (range), increment, direction));\n\n\n\n // Call drop().\n\n template <class Range, class Increment, class Direction>\n\n auto operator() (\n\n Range && range, Increment const & increment,\n\n Direction const & direction,\n\n overload_order <5> *) const\n\n RETURNS (implement_drop (typename tag_of <Range>::type(),\n\n std::forward <Range> (range), increment, direction));\n\n\n\n // Forward to member if possible.\n\n template <class Range, class Increment, class Direction>\n", "file_path": "include/range/detail/core_drop.hpp", "rank": 70, "score": 173721.99757063272 }, { "content": " class tuple_view\n\n {\n\n static_assert (std::is_reference <TupleReference>::value, \"\");\n\n typedef typename std::add_pointer <TupleReference>::type pointer_type;\n\n pointer_type tuple_;\n\n public:\n\n static constexpr std::size_t begin_position = Begin;\n\n static constexpr std::size_t end_position = End;\n\n static constexpr bool is_empty = (Begin == End);\n\n static constexpr std::size_t view_size = (End - Begin);\n\n static constexpr std::size_t tuple_size\n\n = range::tuple_size <TupleReference>::value;\n\n\n\n tuple_view (TupleReference tuple) : tuple_ (&tuple) {}\n\n\n\n template <std::size_t ThatBegin, std::size_t ThatEnd>\n\n tuple_view (tuple_view <ThatBegin, ThatEnd, TupleReference> const &\n\n that)\n\n : tuple_ (that.pointer())\n\n {\n", "file_path": "include/range/tuple.hpp", "rank": 71, "score": 172361.46110434143 }, { "content": " class Direction, class Predicate,\n", "file_path": "include/range/equal.hpp", "rank": 72, "score": 172218.0931688008 }, { "content": " class Direction, class Predicate>\n\n auto operator() (Range1 && range1, Range2 && range2,\n\n Direction const & direction, Predicate && predicate,\n\n overload_order <2> *) const\n\n RETURNS (equal_detail::equal_default <Direction, Predicate>() (\n\n std::forward <Range1> (range1),\n\n std::forward <Range2> (range2), direction,\n\n std::forward <Predicate> (predicate)));\n\n };\n\n\n\n public:\n\n // With direction; with predicate.\n\n template <class Range1, class Range2,\n", "file_path": "include/range/equal.hpp", "rank": 73, "score": 172218.0931688008 }, { "content": "struct forgotten_to_define_direction;\n", "file_path": "test/range/weird_direction.hpp", "rank": 74, "score": 171581.31957283863 }, { "content": "struct forgotten_to_define_direction {\n\n // Cause linker error if this actually gets used.\n\n forgotten_to_define_direction();\n\n};\n\n\n", "file_path": "test/range/weird_direction.hpp", "rank": 75, "score": 171581.31957283863 }, { "content": "struct member_extractor <ReturnType (*) (Structure), function> {\n\n typedef ReturnType value_type;\n\n\n\n ReturnType operator() (Structure structure) const\n\n { return (function) (std::forward <Structure> (structure)); }\n\n};\n\n\n\nnamespace detail {\n\n /**\n\n Base class for member_view.\n\n Different views of the same member have the same instantiation of this\n", "file_path": "include/range/member_view.hpp", "rank": 76, "score": 171405.9036727089 }, { "content": "class empty_view;\n\n\n\nnamespace empty_view_operation {\n\n struct empty_view_tag {};\n\n} // namespace empty_view_operation\n\n\n\ntemplate <> struct tag_of_qualified <empty_view>\n\n{ typedef empty_view_operation::empty_view_tag type; };\n\n\n", "file_path": "include/range/empty_view.hpp", "rank": 77, "score": 169442.69753351837 }, { "content": "class empty_view {\n\nprivate:\n\n friend class helper::member_access;\n\n\n\n template <class Direction> rime::true_type empty (Direction const &) const\n\n { return rime::true_; }\n\n\n\n template <class Direction> rime::size_t <0> size (Direction const &) const\n\n { return rime::size_t <0>(); }\n\n};\n\n\n\n} // namespace range\n\n\n\n#endif // RANGE_EMPTY_VIEW_HPP_INCLUDED\n", "file_path": "include/range/empty_view.hpp", "rank": 78, "score": 169442.69753351837 }, { "content": " class UnderlyingRest = typename UnderlyingChopped::rest_type,\n", "file_path": "test/range/unique_range.hpp", "rank": 79, "score": 169368.07386045437 }, { "content": " class Enable = typename std::enable_if <\n\n !std::is_reference <Range>::value>::type>\n\n inline Result chop_by_chop_in_place (\n\n Range && range, Direction const & direction)\n\n {\n\n auto new_range = std::move (range);\n\n auto && first = callable::chop_in_place_direct() (\n\n new_range, direction, pick_overload());\n\n return Result (static_cast <First &&> (first), std::move (new_range));\n\n }\n\n\n\n} // namespace helper\n\n\n\n} // namespace range\n\n\n\n#endif // RANGE_DETAIL_CORE_CHOP_IN_PLACE_HPP_INCLUDED\n", "file_path": "include/range/detail/core_chop_in_place.hpp", "rank": 80, "score": 168916.05178175482 }, { "content": " class Direction, class Predicate>\n\n auto operator() (Range1 && range1, Range2 && range2,\n\n Direction const & direction, Predicate && predicate,\n\n overload_order <2> *) const\n\n RETURNS (\n\n less_lexicographical_detail::less_lexicographical_default <\n\n Direction, Predicate>() (\n\n std::forward <Range1> (range1),\n\n std::forward <Range2> (range2), direction,\n\n std::forward <Predicate> (predicate)));\n\n };\n\n\n\n public:\n\n // With direction; with predicate.\n\n template <class Range1, class Range2,\n", "file_path": "include/range/less_lexicographical.hpp", "rank": 81, "score": 168048.8885355011 }, { "content": " class Direction, class Predicate,\n", "file_path": "include/range/less_lexicographical.hpp", "rank": 82, "score": 168048.8885355011 }, { "content": " // Implemented if \"empty\" is implemented.\n\n class Enable = decltype (range::empty (std::declval <Range>()))>\n\n auto operator() (State && state, Range && range,\n\n Function && function) const\n\n RETURNS (apply() (std::forward <State> (state),\n\n range::view (std::forward <Range> (range)),\n\n range::default_direction (range),\n\n std::forward <Function> (function)));\n\n };\n\n\n\n} // namespace callable\n\n\n\n/** \\brief\n\nReturn a lazy \"prefix sum\", i.e. all the intermediate step of an accumulation.\n\n\n\nThis is often called a \"scan\", and seen as a lazy version of fold().\n\nLike fold(), scan() takes a function, a current state, and a range.\n\nLike fold(), it applies the function to the state and the first element of the\n\nrange, then to the result of that and the second element, et cetera.\n\nHowever, fold() performs the whole computation at once; scan() returns the\n\nintermediate values lazily.\n", "file_path": "include/range/scan.hpp", "rank": 83, "score": 167931.59677425458 }, { "content": " // Implemented if \"empty\" is implemented.\n\n class Enable = decltype (range::empty (std::declval <Range>()))>\n\n auto operator() (State && state, Range && range,\n\n Function && function) const\n\n RETURNS (dispatch() (std::forward <State> (state),\n\n range::view_once (std::forward <Range> (range)),\n\n range::default_direction (range),\n\n std::forward <Function> (function), pick_overload()));\n\n };\n\n\n\n } // namespace implementation\n\n\n\n using implementation::fold;\n\n\n\n} // namespace callable\n\n\n\n/** \\brief\n\nTraverse a range and accumulate a value.\n\n\n\nfold() is the equivalent of standard C++ \\c accumulate.\n\nIt is sometimes called \\c reduce.\n", "file_path": "include/range/fold.hpp", "rank": 84, "score": 167931.59677425458 }, { "content": "using range::capability::empty;\n\nusing range::capability::size;\n\nusing range::capability::first;\n\nusing range::capability::drop_one;\n\nusing range::capability::drop_n;\n\nusing range::capability::chop_destructive;\n\n\n\ntypedef decltype (range::view (std::declval <std::vector <int> &>())) vector;\n\ntypedef decltype (range::view (std::declval <std::list <int> &>())) list;\n\ntypedef decltype (range::view (std::declval <std::forward_list <int> &>()))\n\n forward_list;\n\n\n\ntypedef decltype (range::view (std::declval <range::tuple <int> &>())) tuple;\n\ntypedef decltype (range::view (std::declval <range::tuple<> &>())) empty_tuple;\n\n\n\ntypedef range::function_range <int (*) ()> function_range;\n\n\n\nBOOST_AUTO_TEST_CASE (test_capabilities_for_direction) {\n\n static_assert (std::is_same <detect_capabilities_for_key <\n\n vector, direction::front>::type,\n", "file_path": "test/range/test-any_range-capability.cpp", "rank": 85, "score": 59.62069380975171 }, { "content": "\n\nusing range::empty;\n\nusing range::size;\n\nusing range::first;\n\nusing range::second;\n\nusing range::third;\n\n\n\nusing range::drop;\n\nusing range::chop;\n\nusing range::chop_in_place;\n\n\n\nusing range::make_tuple;\n\n\n\nusing range::has;\n\nnamespace callable = range::callable;\n\n\n\nBOOST_AUTO_TEST_SUITE(test_range_zip)\n\n\n\nBOOST_AUTO_TEST_CASE (homogeneous_and_heterogeneous) {\n\n std::vector <int> v;\n", "file_path": "test/range/test-zip-heterogeneous-3.cpp", "rank": 87, "score": 54.3597602051617 }, { "content": "\n\nusing range::empty;\n\nusing range::size;\n\nusing range::first;\n\nusing range::second;\n\nusing range::third;\n\n\n\nusing range::drop;\n\nusing range::chop;\n\nusing range::chop_in_place;\n\n\n\nusing range::make_tuple;\n\n\n\nusing range::has;\n\nnamespace callable = range::callable;\n\n\n\nBOOST_AUTO_TEST_SUITE(test_range_zip)\n\n\n\nBOOST_AUTO_TEST_CASE (homogeneous_and_heterogeneous) {\n\n std::vector <int> v;\n", "file_path": "test/range/test-zip-heterogeneous-2.cpp", "rank": 88, "score": 54.359760205161706 }, { "content": "\n\n#include <list>\n\n#include <tuple>\n\n\n\n#include \"range/std/container.hpp\"\n\n#include \"range/std/tuple.hpp\"\n\n#include \"range/reverse.hpp\"\n\n#include \"range/transform.hpp\"\n\n\n\n#include \"unique_range.hpp\"\n\n\n\nusing range::back;\n\nusing range::empty;\n\nusing range::size;\n\nusing range::first;\n\nusing range::drop;\n\nusing range::chop;\n\nusing range::chop_in_place;\n\n\n\nusing range::second;\n", "file_path": "test/range/test-view_shared.cpp", "rank": 89, "score": 53.52325571178355 }, { "content": " scan_detail::next() (range::size (r.underlying())));\n\n\n\n template <class Direction, class ScanRange> inline\n\n auto implement_first (scan_tag <Direction> const &,\n\n ScanRange && r, Direction const & direction)\n\n RETURNS (r.direction_must_be_equal (direction),\n\n utility::storage::get <\n\n typename std::decay <ScanRange>::type::state_type,\n\n ScanRange &&>() (r.state()));\n\n\n\n} // namespace scan_operation\n\n\n\n/* drop_one. */\n\nnamespace scan_detail {\n\n\n\n /*\n\n Compute the return type.\n\n This depends on whether the underlying range is empty, and (therefore)\n\n whether the result of \"drop_one\" is empty.\n\n */\n\n\n\n /**\n\n Return an type, constant false if empty (direction, range) is constant,\n\n or \"bool\" if it is not.\n\n */\n\n template <class Range, class Direction, class Empty = typename\n\n result_of <range::callable::empty (Range, Direction)>::type,\n", "file_path": "include/range/scan.hpp", "rank": 90, "score": 52.78128920839955 }, { "content": "/** \\brief\n\nComputes the number of elements in a range.\n\n\n\nIf the range has a \\c size() operation, that is used.\n\nIf not, then the \\c drop() operation is used until the range is empty, and the\n\nnumber of steps is counted.\n\n\n\n\\todo Currently only works on homogeneous ranges; use fold to remedy this.\n\n\n\n\\param range The range to count the number of elements of.\n\n\\param direction The direction to traverse the range in.\n\n*/\n\nstatic const auto walk_size = callable::walk_size();\n\n\n\n} // namespace range\n\n\n\n#endif // RANGE_WALK_SIZE_HPP_INCLUDED\n", "file_path": "include/range/walk_size.hpp", "rank": 91, "score": 52.72268700074509 }, { "content": "\n\n#include <list>\n\n#include <vector>\n\n#include <tuple>\n\n\n\n#include \"range/std.hpp\"\n\n#include \"range/tuple.hpp\"\n\n#include \"range/function_range.hpp\"\n\n\n\n#include \"weird_count.hpp\"\n\n#include \"unique_range.hpp\"\n\n\n\nusing range::front;\n\nusing range::back;\n\n\n\nusing range::default_direction;\n\nusing range::empty;\n\nusing range::size;\n\nusing range::first;\n\nusing range::drop;\n", "file_path": "test/range/test-any_range.cpp", "rank": 92, "score": 52.53293469980792 }, { "content": "\n\n This requires an extra argument \\c pick_overload().\n\n\n\n \\param range\n\n \\param direction\n\n \\param overload_order\n\n */\n\n struct chop_in_place_direct {\n\n template <class Range, class Direction>\n\n auto operator() (Range & range, Direction const & direction,\n\n overload_order <1> *) const\n\n RETURNS (implement_chop_in_place (typename tag_of <Range>::type(),\n\n range, direction));\n\n\n\n // Forward to member if possible.\n\n template <class Range, class Direction>\n\n auto operator() (Range & range, Direction const & direction,\n\n overload_order <2> *) const\n\n RETURNS (helper::member_access::chop_in_place (range, direction));\n\n };\n\n\n\n struct chop_in_place {\n\n private:\n\n struct dispatch : public chop_in_place_direct {\n\n using chop_in_place_direct::operator();\n\n\n\n // Use \"first\" and \"drop\".\n\n // Only enabled if \"drop\" returns a range of the same type.\n\n template <class Range, class Direction,\n", "file_path": "include/range/detail/core_chop_in_place.hpp", "rank": 93, "score": 51.57372428995934 }, { "content": " auto current = range::view (range, direction);\n\n while (!range::empty (current, direction)) {\n\n current = range::drop (current, direction);\n\n ++ size;\n\n }\n\n return size;\n\n }\n\n\n\n // No direction: use default_direction.\n\n template <class Range> auto operator() (Range && range) const\n\n -> decltype (std::declval <walk_size>() (\n\n std::declval <Range>(), range::default_direction (range)))\n\n {\n\n return (*this) (\n\n std::forward <Range> (range), range::default_direction (range));\n\n }\n\n };\n\n\n\n} // namespace callable\n\n\n", "file_path": "include/range/walk_size.hpp", "rank": 94, "score": 51.38955830087655 }, { "content": " count() : i (0) {}\n\n\n\n int operator() () { return ++i; }\n\n };\n\n\n\n auto a = make_any_range (range::make_function_range (count()));\n\n\n\n BOOST_CHECK_EQUAL (range::chop_in_place (a), 1);\n\n BOOST_CHECK_EQUAL (range::chop_in_place (a), 2);\n\n }\n\n\n\n // Heterogeneous: only if there is at least one element.\n\n static_assert (std::is_same <\n\n std::result_of <callable::make_any_range (range::tuple <int> &)>::type,\n\n any_range <int &, map <\n\n map_element <default_direction, direction::front>,\n\n map_element <copy_construct, void>,\n\n map_element <direction::front, set <\n\n empty, size, first, drop_one, chop_destructive>>,\n\n map_element <direction::back, set <\n\n empty, size, first, drop_one, chop_destructive>>\n\n >> >::value, \"\");\n\n}\n\n\n\nBOOST_AUTO_TEST_SUITE_END()\n", "file_path": "test/range/test-any_range-make.cpp", "rank": 95, "score": 51.18030014834622 }, { "content": " RETURNS (dispatch() (range, direction, pick_overload()));\n\n\n\n // Without direction: use default direction.\n\n template <class Range, class Enable =\n\n typename std::enable_if <is_range <Range>::value>::type>\n\n auto operator() (Range const & range) const\n\n RETURNS (dispatch() (\n\n range, range::default_direction (range), pick_overload()));\n\n };\n\n\n\n } // namespace implementation\n\n\n\n using implementation::size;\n\n\n\n} // namespace callable\n\n\n\n/** \\brief\n\nReturn the number of elements in a range.\n\n\n\nApplying \\ref drop this number of times results in the range being empty.\n", "file_path": "include/range/detail/core_size.hpp", "rank": 96, "score": 51.015544668365855 }, { "content": " friend class helper::member_access;\n\n\n\n auto default_direction() const\n\n RETURNS (range::default_direction (underlying_));\n\n\n\n template <class Direction>\n\n decltype (range::empty (\n\n std::declval <Underlying const &>(),\n\n direction::opposite (std::declval <Direction>())))\n\n empty (Direction const & direction) const\n\n { return range::empty (underlying_, direction::opposite (direction)); }\n\n\n\n template <class Direction>\n\n decltype (range::size (\n\n std::declval <Underlying const &>(),\n\n direction::opposite (std::declval <Direction>())))\n\n size (Direction const & direction) const\n\n { return range::size (underlying_, direction::opposite (direction)); }\n\n\n\n // first and drop are implemented in namespace reverse_operation (below)\n", "file_path": "include/range/reverse.hpp", "rank": 98, "score": 50.83764739358516 }, { "content": "\n\n static callable_empty const empty;\n\n\n\n struct callable_size {\n\n template <class Range, class Direction>\n\n auto operator() (Range && range, Direction const & direction)\n\n const\n\n RETURNS (std::forward <Range> (range).size (direction));\n\n };\n\n\n\n static callable_size const size;\n\n\n\n struct callable_first {\n\n template <class Range, class Direction>\n\n auto operator() (Range && range, Direction const & direction)\n\n const\n\n RETURNS (std::forward <Range> (range).first (direction));\n\n };\n\n\n\n static callable_first const first;\n", "file_path": "include/range/detail/core_member_access.hpp", "rank": 99, "score": 50.70864246196505 } ]
C++
src/apply-supervised-mvdr.cc
unanan/setk
e1248c6d40806c3fff251f3971a585c6ec09d949
#include "include/stft.h" #include "include/beamformer.h" using namespace kaldi; void ParseInputRspecifier(const std::string &input_rspecifier, std::vector<std::string> *rspecifiers) { size_t found = input_rspecifier.find_first_of(":", 0); if (found == std::string::npos) KALDI_ERR << "Wrong input-rspecifier format: " << input_rspecifier; const std::string &decorator = input_rspecifier.substr(0, found); std::vector<std::string> tmp; SplitStringToVector(input_rspecifier.substr(found + 1), ",", false, &tmp); for (std::string &s : tmp) rspecifiers->push_back(decorator + ":" + s); } int main(int argc, char *argv[]) { try { const char *usage = "Do minimum variance distortionless response (MVDR) beamformer, " "depending on TF mask\n" "\n" "Usage: apply-supervised-mvdr [options...] <mask-rspecifier> " "<input-rspecifier> <target-wav-wspecifier>\n" "\n" "e.g.:\n" " apply-supervised-mvdr --config=mask.conf scp:mask.scp " "scp:CH1.scp,CH2.scp,CH3.scp scp:dst.scp\n"; ParseOptions po(usage); ShortTimeFTOptions stft_options; bool track_volumn = true, normalize_input = true; std::string window = "hamming"; BaseFloat frame_shift = 256, frame_length = 1024; int32 update_periods = 0, minimum_update_periods = 20; po.Register("frame-shift", &frame_shift, "Frame shift in number of samples"); po.Register("frame-length", &frame_length, "Frame length in number of samples"); po.Register( "window", &window, "Type of window(\"hamming\"|\"hanning\"|\"blackman\"|\"rectangular\")"); po.Register("track-volumn", &track_volumn, "If true, using average volumn of input channels as target's"); po.Register( "normalize-input", &normalize_input, "Scale samples into float in range [-1, 1], like MATLAB or librosa"); po.Register( "update-periods", &update_periods, "Number of frames to use for estimating psd of noise or target, " "if zero, do beamforming offline"); po.Read(argc, argv); int32 num_args = po.NumArgs(); if (num_args != 3) { po.PrintUsage(); exit(1); } KALDI_ASSERT(update_periods >= 0); if (update_periods < minimum_update_periods && update_periods > 0) { KALDI_WARN << "Value of update_periods may be too small, ignore it"; } std::string mask_rspecifier = po.GetArg(1), input_rspecifier = po.GetArg(2), enhan_wspecifier = po.GetArg(3); std::vector<std::string> rspecifiers; ParseInputRspecifier(input_rspecifier, &rspecifiers); int32 num_channels = rspecifiers.size(); std::vector<RandomAccessTableReader<WaveHolder> > wav_reader(num_channels); for (int32 c = 0; c < num_channels; c++) { std::string &cur_ch = rspecifiers[c]; if (ClassifyRspecifier(cur_ch, NULL, NULL) == kNoRspecifier) KALDI_ERR << cur_ch << " is not a rspecifier"; KALDI_ASSERT(wav_reader[c].Open(cur_ch)); } stft_options.window = window; stft_options.normalize_input = normalize_input; stft_options.frame_shift = frame_shift; stft_options.frame_length = frame_length; ShortTimeFTComputer stft_computer(stft_options); SequentialBaseFloatMatrixReader mask_reader(mask_rspecifier); TableWriter<WaveHolder> wav_writer(enhan_wspecifier); int32 num_done = 0, num_miss = 0, num_utts = 0; for (; !mask_reader.Done(); mask_reader.Next()) { std::string utt_key = mask_reader.Key(); const Matrix<BaseFloat> &target_mask = mask_reader.Value(); std::vector<Matrix<BaseFloat> > mstft(num_channels); std::vector<BaseFloat> mfreq(num_channels); BaseFloat range = 0.0; num_utts++; int32 cur_ch = 0; for (int32 c = 0; c < num_channels; c++) { if (wav_reader[c].HasKey(utt_key)) { const WaveData &wave_data = wav_reader[c].Value(utt_key); const Matrix<BaseFloat> &wave_samp = wave_data.Data(); if (track_volumn) range += wave_samp.LargestAbsElem(); mfreq[cur_ch] = wave_data.SampFreq(); stft_computer.Compute(wave_samp, &mstft[cur_ch], NULL, NULL); cur_ch++; } } KALDI_VLOG(2) << "Processing " << cur_ch << " channels for " << utt_key; if (cur_ch <= 1) { num_miss++; continue; } int32 num_frames = mstft[0].NumRows(), num_bins = mstft[0].NumCols() / 2 + 1; BaseFloat target_freq = mfreq[0]; bool problem = false; for (int32 c = 1; c < cur_ch; c++) { if (mstft[c].NumCols() != (num_bins - 1) * 2 || mstft[c].NumRows() != num_frames) { KALDI_WARN << "There is obvious length difference between" << "multiple channels, please check, skip for " << utt_key; problem = true; break; } if (target_freq != mfreq[c]) { KALDI_WARN << "Sample frequency may be difference between" << "multiple channels, please check, skip for " << utt_key; problem = true; break; } } if (problem) { num_miss++; continue; } if (target_mask.NumRows() != num_frames || target_mask.NumCols() != num_bins) { KALDI_WARN << "Utterance " << utt_key << ": The shape of target mask is different from stft" << " (" << target_mask.NumRows() << " x " << target_mask.NumCols() << ") vs" << " (" << num_frames << " x " << num_bins << ")"; num_miss++; continue; } CMatrix<BaseFloat> stft_reshape(num_frames, num_bins * cur_ch), src_stft; for (int32 c = 0; c < cur_ch; c++) { stft_reshape.ColRange(c * num_bins, num_bins).CopyFromRealfft(mstft[c]); } CMatrix<BaseFloat> noise_psd, target_psd, steer_vector, beam_weights, enh_stft; int32 num_segments = (num_frames - minimum_update_periods) / update_periods + 1; if (update_periods >= minimum_update_periods && num_segments > 1) { KALDI_VLOG(1) << "Do mvdr beamforming, update power spectrum matrix " "estimation per " << update_periods << " frames"; int32 duration = 0, start_from = 0; CMatrix<BaseFloat> enh_stft_segment; enh_stft.Resize(num_frames, num_bins); for (int32 i = 0; i < num_segments; i++) { start_from = i * update_periods; duration = (i == num_segments - 1 ? num_frames - start_from : update_periods); TrimStft(num_bins, cur_ch, stft_reshape.RowRange(start_from, duration), &src_stft); EstimatePsd(src_stft, target_mask.RowRange(start_from, duration), &target_psd, &noise_psd); EstimateSteerVector(target_psd, &steer_vector); ComputeMvdrBeamWeights(noise_psd, steer_vector, &beam_weights); Beamform(src_stft, beam_weights, &enh_stft_segment); enh_stft.RowRange(start_from, duration).CopyFromMat(enh_stft_segment); } } else { KALDI_VLOG(1) << "Do mvdr beamforming offline"; TrimStft(num_bins, cur_ch, stft_reshape, &src_stft); EstimatePsd(src_stft, target_mask, &target_psd, &noise_psd); EstimateSteerVector(target_psd, &steer_vector); ComputeMvdrBeamWeights(noise_psd, steer_vector, &beam_weights); Beamform(src_stft, beam_weights, &enh_stft); } Matrix<BaseFloat> rstft, enhan_speech; CastIntoRealfft(enh_stft, &rstft); stft_computer.InverseShortTimeFT(rstft, &enhan_speech, range / cur_ch - 1); WaveData target_data(target_freq, enhan_speech); wav_writer.Write(utt_key, target_data); num_done++; if (num_done % 100 == 0) KALDI_LOG << "Processed " << num_utts << " utterances."; KALDI_VLOG(2) << "Do mvdr beamforming for utterance-id " << utt_key << " done."; } KALDI_LOG << "Done " << num_done << " utterances out of " << num_utts << ", " << num_miss << " missing cause of some problems."; return num_done == 0 ? 1 : 0; } catch (const std::exception &e) { std::cerr << e.what(); return -1; } return 0; }
#include "include/stft.h" #include "include/beamformer.h" using namespace kaldi;
int main(int argc, char *argv[]) { try { const char *usage = "Do minimum variance distortionless response (MVDR) beamformer, " "depending on TF mask\n" "\n" "Usage: apply-supervised-mvdr [options...] <mask-rspecifier> " "<input-rspecifier> <target-wav-wspecifier>\n" "\n" "e.g.:\n" " apply-supervised-mvdr --config=mask.conf scp:mask.scp " "scp:CH1.scp,CH2.scp,CH3.scp scp:dst.scp\n"; ParseOptions po(usage); ShortTimeFTOptions stft_options; bool track_volumn = true, normalize_input = true; std::string window = "hamming"; BaseFloat frame_shift = 256, frame_length = 1024; int32 update_periods = 0, minimum_update_periods = 20; po.Register("frame-shift", &frame_shift, "Frame shift in number of samples"); po.Register("frame-length", &frame_length, "Frame length in number of samples"); po.Register( "window", &window, "Type of window(\"hamming\"|\"hanning\"|\"blackman\"|\"rectangular\")"); po.Register("track-volumn", &track_volumn, "If true, using average volumn of input channels as target's"); po.Register( "normalize-input", &normalize_input, "Scale samples into float in range [-1, 1], like MATLAB or librosa"); po.Register( "update-periods", &update_periods, "Number of frames to use for estimating psd of noise or target, " "if zero, do beamforming offline"); po.Read(argc, argv); int32 num_args = po.NumArgs(); if (num_args != 3) { po.PrintUsage(); exit(1); } KALDI_ASSERT(update_periods >= 0); if (update_periods < minimum_update_periods && update_periods > 0) { KALDI_WARN << "Value of update_periods may be too small, ignore it"; } std::string mask_rspecifier = po.GetArg(1), input_rspecifier = po.GetArg(2), enhan_wspecifier = po.GetArg(3); std::vector<std::string> rspecifiers; ParseInputRspecifier(input_rspecifier, &rspecifiers); int32 num_channels = rspecifiers.size(); std::vector<RandomAccessTableReader<WaveHolder> > wav_reader(num_channels); for (int32 c = 0; c < num_channels; c++) { std::string &cur_ch = rspecifiers[c]; if (ClassifyRspecifier(cur_ch, NULL, NULL) == kNoRspecifier) KALDI_ERR << cur_ch << " is not a rspecifier"; KALDI_ASSERT(wav_reader[c].Open(cur_ch)); } stft_options.window = window; stft_options.normalize_input = normalize_input; stft_options.frame_shift = frame_shift; stft_options.frame_length = frame_length; ShortTimeFTComputer stft_computer(stft_options); SequentialBaseFloatMatrixReader mask_reader(mask_rspecifier); TableWriter<WaveHolder> wav_writer(enhan_wspecifier); int32 num_done = 0, num_miss = 0, num_utts = 0; for (; !mask_reader.Done(); mask_reader.Next()) { std::string utt_key = mask_reader.Key(); const Matrix<BaseFloat> &target_mask = mask_reader.Value(); std::vector<Matrix<BaseFloat> > mstft(num_channels); std::vector<BaseFloat> mfreq(num_channels); BaseFloat range = 0.0; num_utts++; int32 cur_ch = 0; for (int32 c = 0; c < num_channels; c++) { if (wav_reader[c].HasKey(utt_key)) { const WaveData &wave_data = wav_reader[c].Value(utt_key); const Matrix<BaseFloat> &wave_samp = wave_data.Data(); if (track_volumn) range += wave_samp.LargestAbsElem(); mfreq[cur_ch] = wave_data.SampFreq(); stft_computer.Compute(wave_samp, &mstft[cur_ch], NULL, NULL); cur_ch++; } } KALDI_VLOG(2) << "Processing " << cur_ch << " channels for " << utt_key; if (cur_ch <= 1) { num_miss++; continue; } int32 num_frames = mstft[0].NumRows(), num_bins = mstft[0].NumCols() / 2 + 1; BaseFloat target_freq = mfreq[0]; bool problem = false; for (int32 c = 1; c < cur_ch; c++) { if (mstft[c].NumCols() != (num_bins - 1) * 2 || mstft[c].NumRows() != num_frames) { KALDI_WARN << "There is obvious length difference between" << "multiple channels, please check, skip for " << utt_key; problem = true; break; } if (target_freq != mfreq[c]) { KALDI_WARN << "Sample frequency may be difference between" << "multiple channels, please check, skip for " << utt_key; problem = true; break; } } if (problem) { num_miss++; continue; } if (target_mask.NumRows() != num_frames || target_mask.NumCols() != num_bins) { KALDI_WARN << "Utterance " << utt_key << ": The shape of target mask is different from stft" << " (" << target_mask.NumRows() << " x " << target_mask.NumCols() << ") vs" << " (" << num_frames << " x " << num_bins << ")"; num_miss++; continue; } CMatrix<BaseFloat> stft_reshape(num_frames, num_bins * cur_ch), src_stft; for (int32 c = 0; c < cur_ch; c++) { stft_reshape.ColRange(c * num_bins, num_bins).CopyFromRealfft(mstft[c]); } CMatrix<BaseFloat> noise_psd, target_psd, steer_vector, beam_weights, enh_stft; int32 num_segments = (num_frames - minimum_update_periods) / update_periods + 1; if (update_periods >= minimum_update_periods && num_segments > 1) { KALDI_VLOG(1) << "Do mvdr beamforming, update power spectrum matrix " "estimation per " << update_periods << " frames"; int32 duration = 0, start_from = 0; CMatrix<BaseFloat> enh_stft_segment; enh_stft.Resize(num_frames, num_bins); for (int32 i = 0; i < num_segments; i++) { start_from = i * update_periods; duration = (i == num_segments - 1 ? num_frames - start_from : update_periods); TrimStft(num_bins, cur_ch, stft_reshape.RowRange(start_from, duration), &src_stft); EstimatePsd(src_stft, target_mask.RowRange(start_from, duration), &target_psd, &noise_psd); EstimateSteerVector(target_psd, &steer_vector); ComputeMvdrBeamWeights(noise_psd, steer_vector, &beam_weights); Beamform(src_stft, beam_weights, &enh_stft_segment); enh_stft.RowRange(start_from, duration).CopyFromMat(enh_stft_segment); } } else { KALDI_VLOG(1) << "Do mvdr beamforming offline"; TrimStft(num_bins, cur_ch, stft_reshape, &src_stft); EstimatePsd(src_stft, target_mask, &target_psd, &noise_psd); EstimateSteerVector(target_psd, &steer_vector); ComputeMvdrBeamWeights(noise_psd, steer_vector, &beam_weights); Beamform(src_stft, beam_weights, &enh_stft); } Matrix<BaseFloat> rstft, enhan_speech; CastIntoRealfft(enh_stft, &rstft); stft_computer.InverseShortTimeFT(rstft, &enhan_speech, range / cur_ch - 1); WaveData target_data(target_freq, enhan_speech); wav_writer.Write(utt_key, target_data); num_done++; if (num_done % 100 == 0) KALDI_LOG << "Processed " << num_utts << " utterances."; KALDI_VLOG(2) << "Do mvdr beamforming for utterance-id " << utt_key << " done."; } KALDI_LOG << "Done " << num_done << " utterances out of " << num_utts << ", " << num_miss << " missing cause of some problems."; return num_done == 0 ? 1 : 0; } catch (const std::exception &e) { std::cerr << e.what(); return -1; } return 0; }
void ParseInputRspecifier(const std::string &input_rspecifier, std::vector<std::string> *rspecifiers) { size_t found = input_rspecifier.find_first_of(":", 0); if (found == std::string::npos) KALDI_ERR << "Wrong input-rspecifier format: " << input_rspecifier; const std::string &decorator = input_rspecifier.substr(0, found); std::vector<std::string> tmp; SplitStringToVector(input_rspecifier.substr(found + 1), ",", false, &tmp); for (std::string &s : tmp) rspecifiers->push_back(decorator + ":" + s); }
function_block-full_function
[ { "content": "namespace kaldi {\n\n\n\n// Cast CMatrix into Matrix, in Realfft format, to reconstruct speech\n\n// The Realfft format is space efficient, so I refused to use CMatrix in stft.h\n\nvoid CastIntoRealfft(const CMatrixBase<BaseFloat> &cstft,\n\n Matrix<BaseFloat> *rstft);\n\n\n\n// src_stft: (num_frames, num_bins x num_channels) or\n\n// (num_frames x num_channels, num_bins)\n\n// dst_stft: (num_bins x num_frames, num_channels)\n\n// Shape multiple complex stft from shape num_frames x [num_bins * num_channels]\n\n// or [num_frames x num_channels] x num_bins into [num_bins * num_frames] x\n\n// num_channels\n\n// for convenience of psd estimate and beamforming\n\nvoid TrimStft(const int32 num_bins, const int32 num_channels,\n\n const CMatrixBase<BaseFloat> &src_stft,\n\n CMatrix<BaseFloat> *dst_stft);\n\n\n\n//\n\n// src_stft: (num_bins x num_frames, num_channels)\n\n// target_mask: (num_frames, num_bins)\n\n// target_psd: (num_bins x num_channels, num_channels)\n\n//\n\nvoid EstimatePsd(const CMatrixBase<BaseFloat> &src_stft,\n\n const MatrixBase<BaseFloat> &target_mask,\n\n CMatrix<BaseFloat> *target_psd,\n\n CMatrix<BaseFloat> *second_psd);\n\n\n\n// target_psd: (num_bins x num_channels, num_channels)\n\n// steer_vector:(num_bins, num_channels)\n\n// using maximum eigen vector as estimation of steer vector\n\nvoid EstimateSteerVector(const CMatrixBase<BaseFloat> &target_psd,\n\n CMatrix<BaseFloat> *steer_vector);\n\n\n\n// target_psd: (num_bins x num_channels, num_channels)\n\n// steer_vector:(num_bins, num_channels)\n\n// beam_weights:(num_bins, num_channels)\n\n// NOTE mvdr:\n\n// numerator = psd_inv * steer_vector\n\n// denumerator = numerator * steer_vector^H\n\n// weight = numerator / denumerator\n\nvoid ComputeMvdrBeamWeights(const CMatrixBase<BaseFloat> &noise_psd,\n\n const CMatrixBase<BaseFloat> &steer_vector,\n\n CMatrix<BaseFloat> *beam_weights);\n\n\n\n// target_psd: (num_bins x num_channels, num_channels)\n\n// noise_psd: (num_bins x num_channels, num_channels)\n\n// beam_weights:(num_bins, num_channels)\n\nvoid ComputeGevdBeamWeights(const CMatrixBase<BaseFloat> &target_psd,\n\n const CMatrixBase<BaseFloat> &noise_psd,\n\n CMatrix<BaseFloat> *beam_weights);\n\n\n\n// src_stft: (num_bins x num_frames, num_channels)\n\n// weights: (num_bins, num_channels)\n\n// enh_stft: (num_frames, num_bins)\n\n// NOTE:\n\n// To avoid Transpose, using AddMatMat instead of:\n\n// enh_stft->Resize(num_bins, num_frames);\n\n// for (int32 f = 0; f < num_bins; f++)\n\n// enh_stft->Row(f).AddMatVec(1, 0, src_stft.RowRange(f * num_frames,\n\n// num_frames), kNoTrans, weights.Row(f), 0, 0);\n\n// enh_stft->Transpose();\n\n\n\nvoid Beamform(const CMatrixBase<BaseFloat> &src_stft,\n\n const CMatrixBase<BaseFloat> &weights,\n\n CMatrix<BaseFloat> *enh_stft);\n", "file_path": "include/beamformer.h", "rank": 0, "score": 133601.54306019886 }, { "content": "namespace kaldi {\n\n\n\n#if defined(HAVE_OPENBLAS)\n\n#define KaldiComplexFloat lapack_complex_float\n\n#define KaldiComplexDouble lapack_complex_double\n\n#elif defined(HAVE_CLAPACK)\n\n#define KaldiComplexFloat complex\n\n#define KaldiComplexDouble doublecomplex\n\n#else\n\n#error \\\n\n \"You must add definitions in CMakeLists.txt(-DHAVE_OPENBLAS or -DHAVE_CLAPACK)\"\n\n#endif\n\n\n\ninline void cblas_CZscal(const int N, const void *alpha, float *data,\n\n const int inc) {\n\n cblas_cscal(N, alpha, data, inc);\n\n}\n\n\n\ninline void cblas_CZscal(const int N, const void *alpha, double *data,\n\n const int inc) {\n\n cblas_zscal(N, alpha, data, inc);\n\n}\n\n\n\ninline void cblas_CZaxpy(const int N, const void *alpha, const float *X,\n\n const int incX, float *Y, const int incY) {\n\n cblas_caxpy(N, alpha, X, incX, Y, incY);\n\n}\n\n\n\ninline void cblas_CZaxpy(const int N, const void *alpha, const double *X,\n\n const int incX, double *Y, const int incY) {\n\n cblas_zaxpy(N, alpha, X, incX, Y, incY);\n\n}\n\n\n\ninline void cblas_CZdot(const int N, const float *X, const int incX,\n\n const float *Y, const int incY, bool conj, void *dot) {\n\n if (conj)\n\n cblas_cdotc_sub(N, X, incX, Y, incY, dot);\n\n else\n\n cblas_cdotu_sub(N, X, incX, Y, incY, dot);\n\n}\n\n\n\ninline void cblas_CZdot(const int N, const double *X, const int incX,\n\n const double *Y, const int incY, bool conj, void *dot) {\n\n if (conj)\n\n cblas_zdotc_sub(N, X, incX, Y, incY, dot);\n\n else\n\n cblas_zdotu_sub(N, X, incX, Y, incY, dot);\n\n}\n\n\n\ninline void cblas_CZgemm(const void *alpha, MatrixTransposeType transA,\n\n const float *Adata, MatrixIndexT a_num_rows,\n\n MatrixIndexT a_num_cols, MatrixIndexT a_stride,\n\n MatrixTransposeType transB, const float *Bdata,\n\n MatrixIndexT b_stride, const void *beta, float *Mdata,\n\n MatrixIndexT num_rows, MatrixIndexT num_cols,\n\n MatrixIndexT stride) {\n\n cblas_cgemm(CblasRowMajor, static_cast<CBLAS_TRANSPOSE>(transA),\n\n static_cast<CBLAS_TRANSPOSE>(transB), num_rows, num_cols,\n\n transA == kNoTrans ? a_num_cols : a_num_rows, alpha, Adata,\n\n a_stride >> 1, Bdata, b_stride >> 1, beta, Mdata, stride >> 1);\n\n}\n\n\n\ninline void cblas_CZgemm(const void *alpha, MatrixTransposeType transA,\n\n const double *Adata, MatrixIndexT a_num_rows,\n\n MatrixIndexT a_num_cols, MatrixIndexT a_stride,\n\n MatrixTransposeType transB, const double *Bdata,\n\n MatrixIndexT b_stride, const void *beta, double *Mdata,\n\n MatrixIndexT num_rows, MatrixIndexT num_cols,\n\n MatrixIndexT stride) {\n\n cblas_zgemm(CblasRowMajor, static_cast<CBLAS_TRANSPOSE>(transA),\n\n static_cast<CBLAS_TRANSPOSE>(transB), num_rows, num_cols,\n\n transA == kNoTrans ? a_num_cols : a_num_rows, alpha, Adata,\n\n a_stride >> 1, Bdata, b_stride >> 1, beta, Mdata, stride >> 1);\n\n}\n\n\n\ninline void cblas_CZger(MatrixIndexT num_rows, MatrixIndexT num_cols,\n\n void *alpha, const float *xdata, MatrixIndexT incX,\n\n const float *ydata, MatrixIndexT incY, float *Mdata,\n\n MatrixIndexT stride, bool conj) {\n\n if (conj)\n\n cblas_cgerc(CblasRowMajor, num_rows, num_cols, alpha, xdata, 1, ydata, 1,\n\n Mdata, stride >> 1);\n\n else\n\n cblas_cgeru(CblasRowMajor, num_rows, num_cols, alpha, xdata, 1, ydata, 1,\n\n Mdata, stride >> 1);\n\n}\n\n\n\ninline void cblas_CZger(MatrixIndexT num_rows, MatrixIndexT num_cols,\n\n void *alpha, const double *xdata, MatrixIndexT incX,\n\n const double *ydata, MatrixIndexT incY, double *Mdata,\n\n MatrixIndexT stride, bool conj) {\n\n if (conj)\n\n cblas_zgerc(CblasRowMajor, num_rows, num_cols, alpha, xdata, 1, ydata, 1,\n\n Mdata, stride >> 1);\n\n else\n\n cblas_zgeru(CblasRowMajor, num_rows, num_cols, alpha, xdata, 1, ydata, 1,\n\n Mdata, stride >> 1);\n\n}\n\n\n\ninline void cblas_CZgemv(MatrixTransposeType trans, MatrixIndexT num_rows,\n\n MatrixIndexT num_cols, void *alpha, const float *Mdata,\n\n MatrixIndexT stride, const float *xdata,\n\n MatrixIndexT incX, void *beta, float *ydata,\n\n MatrixIndexT incY) {\n\n cblas_cgemv(CblasRowMajor, static_cast<CBLAS_TRANSPOSE>(trans), num_rows,\n\n num_cols, alpha, Mdata, stride >> 1, xdata, incX, beta, ydata,\n\n incY);\n\n}\n\n\n\ninline void cblas_CZgemv(MatrixTransposeType trans, MatrixIndexT num_rows,\n\n MatrixIndexT num_cols, void *alpha,\n\n const double *Mdata, MatrixIndexT stride,\n\n const double *xdata, MatrixIndexT incX, void *beta,\n\n double *ydata, MatrixIndexT incY) {\n\n cblas_zgemv(CblasRowMajor, static_cast<CBLAS_TRANSPOSE>(trans), num_rows,\n\n num_cols, alpha, Mdata, stride >> 1, xdata, incX, beta, ydata,\n\n incY);\n\n}\n\n\n\n// function prototype: compute eigen vector & value for hermite matrix\n\n// int cheev_(char *jobz, char *uplo, integer *n, complex *a,\n\n// integer *lda, real *w, complex *work, integer *lwork, real *rwork,\n\n// integer *info);\n\n\n\ninline void clapack_CZheev(KaldiBlasInt *num_rows, void *V,\n\n KaldiBlasInt *stride, float *D, void *work,\n\n KaldiBlasInt *lwork, float *rwork,\n\n KaldiBlasInt *info) {\n\n cheev_(const_cast<char *>(\"V\"), const_cast<char *>(\"U\"), num_rows,\n\n reinterpret_cast<KaldiComplexFloat *>(V), stride, D,\n\n reinterpret_cast<KaldiComplexFloat *>(work), lwork, rwork, info);\n\n}\n\n\n\ninline void clapack_CZheev(KaldiBlasInt *num_rows, void *V,\n\n KaldiBlasInt *stride, double *D, void *work,\n\n KaldiBlasInt *lwork, double *rwork,\n\n KaldiBlasInt *info) {\n\n zheev_(const_cast<char *>(\"V\"), const_cast<char *>(\"U\"), num_rows,\n\n reinterpret_cast<KaldiComplexDouble *>(V), stride, D,\n\n reinterpret_cast<KaldiComplexDouble *>(work), lwork, rwork, info);\n\n}\n\n\n\n// function prototype: compute generalized eigen vector & value for hermite\n\n// matrix\n\n// int chegv_(integer *itype, char *jobz, char *uplo, integer *n,\n\n// complex *a, integer *lda, complex *b, integer *ldb, real *w,\n\n// complex *work, integer *lwork, real *rwork, integer *info);\n\n\n\ninline void clapack_CZhegv(KaldiBlasInt *itype, KaldiBlasInt *num_rows, void *A,\n\n KaldiBlasInt *stride_a, void *B,\n\n KaldiBlasInt *stride_b, float *D, void *work,\n\n KaldiBlasInt *lwork, float *rwork,\n\n KaldiBlasInt *info) {\n\n chegv_(itype, const_cast<char *>(\"V\"), const_cast<char *>(\"U\"), num_rows,\n\n reinterpret_cast<KaldiComplexFloat *>(A), stride_a,\n\n reinterpret_cast<KaldiComplexFloat *>(B), stride_b, D,\n\n reinterpret_cast<KaldiComplexFloat *>(work), lwork, rwork, info);\n\n}\n\n\n\ninline void clapack_CZhegv(KaldiBlasInt *itype, KaldiBlasInt *num_rows, void *A,\n\n KaldiBlasInt *stride_a, void *B,\n\n KaldiBlasInt *stride_b, double *D, void *work,\n\n KaldiBlasInt *lwork, double *rwork,\n\n KaldiBlasInt *info) {\n\n zhegv_(itype, const_cast<char *>(\"V\"), const_cast<char *>(\"U\"), num_rows,\n\n reinterpret_cast<KaldiComplexDouble *>(A), stride_a,\n\n reinterpret_cast<KaldiComplexDouble *>(B), stride_b, D,\n\n reinterpret_cast<KaldiComplexDouble *>(work), lwork, rwork, info);\n\n}\n\n\n\ninline void clapack_CZgetrf(KaldiBlasInt *num_rows, KaldiBlasInt *num_cols,\n\n float *Mdata, KaldiBlasInt *stride,\n\n KaldiBlasInt *pivot, KaldiBlasInt *result) {\n\n cgetrf_(num_rows, num_cols, reinterpret_cast<KaldiComplexFloat *>(Mdata),\n\n stride, pivot, result);\n\n}\n\n\n\ninline void clapack_CZgetrf(KaldiBlasInt *num_rows, KaldiBlasInt *num_cols,\n\n double *Mdata, KaldiBlasInt *stride,\n\n KaldiBlasInt *pivot, KaldiBlasInt *result) {\n\n zgetrf_(num_rows, num_cols, reinterpret_cast<KaldiComplexDouble *>(Mdata),\n\n stride, pivot, result);\n\n}\n\n\n\n// int cgetri_(integer *n, complex *a, integer *lda, integer *\n\n// ipiv, complex *work, integer *lwork, integer *info);\n\ninline void clapack_CZgetri(KaldiBlasInt *num_rows, float *Mdata,\n\n KaldiBlasInt *stride, KaldiBlasInt *pivot,\n\n float *work, KaldiBlasInt *lwork,\n\n KaldiBlasInt *result) {\n\n cgetri_(num_rows, reinterpret_cast<KaldiComplexFloat *>(Mdata), stride, pivot,\n\n reinterpret_cast<KaldiComplexFloat *>(work), lwork, result);\n\n}\n\n\n\ninline void clapack_CZgetri(KaldiBlasInt *num_rows, double *Mdata,\n\n KaldiBlasInt *stride, KaldiBlasInt *pivot,\n\n double *work, KaldiBlasInt *lwork,\n\n KaldiBlasInt *result) {\n\n zgetri_(num_rows, reinterpret_cast<KaldiComplexDouble *>(Mdata), stride,\n\n pivot, reinterpret_cast<KaldiComplexDouble *>(work), lwork, result);\n\n}\n\n\n", "file_path": "include/cblas-cpl-wrappers.h", "rank": 1, "score": 130813.42381931629 }, { "content": "#ifndef STFT_H_\n\n#define STFT_H_\n\n\n\n#include \"base/kaldi-common.h\"\n\n#include \"feat/wave-reader.h\"\n\n#include \"matrix/matrix-lib.h\"\n\n#include \"util/common-utils.h\"\n\n\n\nnamespace kaldi {\n\n\n", "file_path": "include/stft.h", "rank": 2, "score": 47770.20436841608 }, { "content": "// include/stft.h\n\n// [email protected]\n\n\n\n// Copyright 2018 Jian Wu\n\n\n\n// See ../../COPYING for clarification regarding multiple authors\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n\n// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n\n// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n\n// MERCHANTABLITY OR NON-INFRINGEMENT.\n\n// See the Apache 2 License for the specific language governing permissions and\n\n// limitations under the License.\n\n\n", "file_path": "include/stft.h", "rank": 3, "score": 47762.97509407161 }, { "content": " // 0.65699885])\n\n // using rfft, then get\n\n // [ 9.28052077+0.j 0.03687047-0.69766529j 1.50647284-0.10351507j\n\n // -0.04591224+0.08162118j 1.56411987+0.13796286j 0.08509277+0.27094417j\n\n // 0.72716829-0.08915424j 0.87527244-1.57259355j -2.86146448+0.j ]\n\n void ShortTimeFT(const MatrixBase<BaseFloat> &wave, Matrix<BaseFloat> *stft);\n\n\n\n // using overlapadd to reconstruct waveform from realfft's complex results\n\n void InverseShortTimeFT(const MatrixBase<BaseFloat> &stft,\n\n Matrix<BaseFloat> *wave, BaseFloat range = 0);\n\n\n\n // compute spectrogram from stft results, abs(i^2 + r^2) or i^2 + r^2...)\n\n void ComputeSpectrogram(const MatrixBase<BaseFloat> &stft,\n\n Matrix<BaseFloat> *spectra);\n\n\n\n // compute phase angle from stft results\n\n void ComputePhaseAngle(const MatrixBase<BaseFloat> &stft,\n\n Matrix<BaseFloat> *angle);\n\n\n\n // restore stft(complex) results using spectrogram(magnitude) & angle(phase\n", "file_path": "include/stft.h", "rank": 4, "score": 47760.64684263676 }, { "content": " BaseFloat frame_length_;\n\n\n\n BaseFloat int16_max =\n\n static_cast<BaseFloat>(std::numeric_limits<int16>::max());\n\n BaseFloat float_inf =\n\n static_cast<BaseFloat>(std::numeric_limits<BaseFloat>::infinity());\n\n\n\n // keep same as Kaldi's\n\n int32 NumFrames(int32 num_samples) {\n\n if (opts_.center) num_samples += opts_.PaddingLength();\n\n return static_cast<int32>((num_samples - opts_.frame_length) /\n\n opts_.frame_shift) +\n\n 1;\n\n }\n\n\n\n int32 NumSamples(int32 num_frames) {\n\n return static_cast<int32>((num_frames - 1) * opts_.frame_shift +\n\n opts_.frame_length);\n\n }\n\n};\n\n}\n\n\n\n#endif\n", "file_path": "include/stft.h", "rank": 5, "score": 47759.09709233734 }, { "content": " void Register(OptionsItf *opts) {\n\n opts->Register(\"frame-length\", &frame_length,\n\n \"Frame length in number of samples\");\n\n opts->Register(\"frame-shift\", &frame_shift,\n\n \"Frame shift in number of samples\");\n\n opts->Register(\n\n \"window\", &window,\n\n \"Type of window(\\\"hamming\\\"|\\\"hanning\\\"|\\\"blackman\\\"|\\\"rectangular\\\")\");\n\n opts->Register(\"center\", &center,\n\n \"If true, padding zeros on start/end of waveform\");\n\n opts->Register(\"normalize-input\", &normalize_input,\n\n \"Scale samples into range [-1, 1], like MATLAB or librosa\");\n\n opts->Register(\"enable-scale\", &enable_scale,\n\n \"Let infinite norm of input samples to be one\");\n\n opts->Register(\n\n \"apply-pow\", &apply_pow,\n\n \"Using power spectrum instead of magnitude spectrum. \"\n\n \"This options only works when computing (Power/Magnitude) spectrum\"\n\n \" and corresponding wave reconstruction(egs: wav-estimate).\");\n\n opts->Register(\"apply-log\", &apply_log,\n\n \"Apply log on computed spectrum if needed.\");\n\n }\n\n};\n\n\n", "file_path": "include/stft.h", "rank": 6, "score": 47758.761638531876 }, { "content": " // angle)\n\n void Polar(const MatrixBase<BaseFloat> &spectra,\n\n const MatrixBase<BaseFloat> &angle, Matrix<BaseFloat> *stft);\n\n\n\n // compute stft stats from raw waveform, calls above internal\n\n void Compute(const MatrixBase<BaseFloat> &wave, Matrix<BaseFloat> *stft,\n\n Matrix<BaseFloat> *spectra, Matrix<BaseFloat> *angle);\n\n\n\n private:\n\n void CacheAnalysisWindow(const ShortTimeFTOptions &opts);\n\n // Reference: _biorthogonal_window_brute_force in\n\n // https://github.com/fgnt/nara_wpe/blob/master/nara_wpe/utils.py\n\n void CacheSynthesisWindow(const ShortTimeFTOptions &opts);\n\n\n\n ShortTimeFTOptions opts_;\n\n SplitRadixRealFft<BaseFloat> *srfft_;\n\n\n\n Vector<BaseFloat> analysis_window_, synthesis_window_;\n\n\n\n BaseFloat frame_shift_;\n", "file_path": "include/stft.h", "rank": 7, "score": 47756.757621385965 }, { "content": "#ifndef SRP_PHAT_H_\n\n#define SRP_PHAT_H_\n\n\n\n#include <iterator>\n\n#include <sstream>\n\n\n\n#include \"base/kaldi-common.h\"\n\n#include \"include/complex-base.h\"\n\n#include \"include/complex-matrix.h\"\n\n#include \"include/complex-vector.h\"\n\n#include \"util/common-utils.h\"\n\n\n\nnamespace kaldi {\n\n\n", "file_path": "include/srp-phat.h", "rank": 8, "score": 46973.95322487495 }, { "content": "#ifndef RIR_GENERATOR_H_\n\n#define RIR_GENERATOR_H_\n\n\n\n#include <iterator>\n\n#include <map>\n\n\n\n#include \"base/kaldi-common.h\"\n\n#include \"util/common-utils.h\"\n\n\n\nnamespace kaldi {\n\n\n\ntypedef enum {\n\n kBidirectional,\n\n kHypercardioid,\n\n kCardioid,\n\n kSubcardioid,\n\n kOmnidirectional\n\n} PolorPattern;\n\n\n", "file_path": "include/rir-generator.h", "rank": 9, "score": 46973.629562936534 }, { "content": "#ifndef COMPLEX_BASE_H_\n\n#define COMPLEX_BASE_H_\n\n\n\n#include <complex>\n\n#include \"matrix/cblas-wrappers.h\"\n\n#include \"matrix/kaldi-matrix.h\"\n\n#include \"matrix/kaldi-vector.h\"\n\n#include \"matrix/matrix-common.h\"\n\n\n\n#include \"include/cblas-cpl-wrappers.h\"\n\n\n\nnamespace kaldi {\n\n\n\ntypedef enum { kReal, kImag } ComplexIndexType;\n\n\n\ntypedef enum {\n\n kConj,\n\n kNoConj,\n\n} ConjugateType;\n\n\n\n\n\ntypedef enum {\n\n// kNoTrans = 111, // CblasNoTrans\n\n// kTrans = 112, // CblasTrans\n\n kConjTrans = 113, // CblasConjTrans\n\n kConjNoTrans = 114 // CblasConjNoTrans\n\n} CMatrixTransposeType;\n\n\n\ntemplate <typename Real>\n", "file_path": "include/complex-base.h", "rank": 10, "score": 46972.450696583335 }, { "content": "// include/complex-matrix.h\n\n// wujian@2018\n\n\n\n// Copyright 2018 Jian Wu\n\n\n\n// See ../../COPYING for clarification regarding multiple authors\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n\n// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n\n// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n\n// MERCHANTABLITY OR NON-INFRINGEMENT.\n\n// See the Apache 2 License for the specific language governing permissions and\n\n// limitations under the License.\n\n\n\n#ifndef COMPLEX_MATRIX_H_\n\n#define COMPLEX_MATRIX_H_\n\n\n\n#include \"include/complex-base.h\"\n\n#include \"include/complex-vector.h\"\n\n\n\nnamespace kaldi {\n\n\n\ntemplate <typename Real>\n", "file_path": "include/complex-matrix.h", "rank": 11, "score": 46972.111689059464 }, { "content": "// include/complex-vector.h\n\n// wujian@2018\n\n\n\n// Copyright 2018 Jian Wu\n\n\n\n// See ../../COPYING for clarification regarding multiple authors\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n\n// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n\n// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n\n// MERCHANTABLITY OR NON-INFRINGEMENT.\n\n// See the Apache 2 License for the specific language governing permissions and\n\n// limitations under the License.\n\n\n\n#ifndef COMPLEX_VECTOR_H_\n\n#define COMPLEX_VECTOR_H_\n\n\n\n#include \"include/complex-base.h\"\n\n\n\nnamespace kaldi {\n\n\n\ntemplate <typename Real>\n", "file_path": "include/complex-vector.h", "rank": 12, "score": 46971.83219211419 }, { "content": "#include \"include/beamformer.h\"\n\n\n\nnamespace kaldi {\n\n\n\n// Cast CMatrix into Matrix(in Realfft format), for speech reconstrucion\n\n// The Realfft format is space efficient, so I refused to use CMatrix in stft.h\n\nvoid CastIntoRealfft(const CMatrixBase<BaseFloat> &cstft,\n\n Matrix<BaseFloat> *rstft) {\n\n int32 num_rows = cstft.NumRows(), num_cols = (cstft.NumCols() - 1) * 2;\n\n rstft->Resize(num_rows, num_cols);\n\n for (int32 r = 0; r < num_rows; r++) {\n\n for (int32 c = 0; c < cstft.NumCols(); c++) {\n\n if (c == 0)\n\n (*rstft)(r, 0) = cstft(r, c, kReal);\n\n else if (c == cstft.NumCols() - 1)\n\n (*rstft)(r, 1) = cstft(r, c, kReal);\n\n else\n\n (*rstft)(r, c * 2) = cstft(r, c, kReal),\n\n (*rstft)(r, c * 2 + 1) = cstft(r, c, kImag);\n\n }\n", "file_path": "include/beamformer.cc", "rank": 13, "score": 46971.37103368988 }, { "content": "#include \"include/stft.h\"\n\n\n\nnamespace kaldi {\n\n\n\n// support multi-channel input\n\n// wave: (num_channels, num_samples)\n\n// stft: (num_channels x num_frames, num_bins)\n\nvoid ShortTimeFTComputer::ShortTimeFT(const MatrixBase<BaseFloat> &wave,\n\n Matrix<BaseFloat> *stft) {\n\n KALDI_ASSERT(analysis_window_.Dim() == frame_length_);\n\n\n\n int32 num_samples = wave.NumCols(), num_channels = wave.NumRows();\n\n // affected by center\n\n int32 num_frames = NumFrames(num_samples);\n\n\n\n stft->Resize(num_frames * num_channels, opts_.PaddingLength(), kSetZero);\n\n\n\n // new copy of wave, cause may modify origin matrix\n\n int32 pad_samples = opts_.center ? opts_.PaddingLength() >> 1 : 0;\n\n Matrix<BaseFloat> copy_mat(num_channels, num_samples + pad_samples * 2);\n", "file_path": "include/stft.cc", "rank": 14, "score": 46968.76713559372 }, { "content": " beam_weights->Resize(num_bins, num_channels);\n\n for (int32 f = 0; f < num_bins; f++) {\n\n SubCVector<BaseFloat> numerator(*beam_weights, f), steer(steer_vector, f);\n\n psd_inv.CopyFromMat(noise_psd.RowRange(f * num_channels, num_channels));\n\n KALDI_VLOG(3) << \"Noise power spectrum matrix: \" << psd_inv;\n\n KALDI_VLOG(3) << \"Using steer vector: \" << steer;\n\n psd_inv.Invert(); // may be singular, using diag loading to avoid\n\n numerator.AddMatVec(1, 0, psd_inv, kNoTrans, steer, 0, 0);\n\n KALDI_VLOG(3) << \"R^{-1} * d: \" << numerator;\n\n std::complex<BaseFloat> s =\n\n std::complex<BaseFloat>(1.0, 0) / VecVec(numerator, steer, kConj);\n\n KALDI_VLOG(3) << \"1 / (d^H * R^{-1} * d): \"\n\n << \"(\" << std::real(s) << (std::imag(s) >= 0 ? \"+\" : \"\")\n\n << std::imag(s) << \")\";\n\n numerator.Scale(std::real(s), std::imag(s));\n\n KALDI_VLOG(3) << \"R^{-1} * d / (d^H * R^{-1} * d): \" << numerator;\n\n }\n\n // using beam_weights in Beamform\n\n}\n\n\n", "file_path": "include/beamformer.cc", "rank": 15, "score": 46968.47060628144 }, { "content": " opts->Register(\"samp-doa\", &samp_doa,\n\n \"Sample doa instead of tdoa on y-axis\");\n\n opts->Register(\"samp-tdoa\", &samp_tdoa,\n\n \"Sample tdoa instead of doa on y-axis, by default using it\");\n\n opts->Register(\"smooth-context\", &smooth_context,\n\n \"Context of frames used for spectra smoothing\");\n\n opts->Register(\n\n \"topo-descriptor\", &topo_descriptor,\n\n \"Description of microarray's topology, now only support linear array.\"\n\n \" egs: --topo-descriptor=0,0.3,0.6,0.9 described a ULA with element \"\n\n \"spacing equals 0.3\");\n\n }\n\n\n\n void ComputeDerived() {\n\n if (samp_tdoa && samp_doa)\n\n KALDI_ERR << \"Options --samp-tdoa conflicts with --samp-doa\";\n\n KALDI_ASSERT(topo_descriptor != \"\");\n\n KALDI_ASSERT(SplitStringToFloats(topo_descriptor, \",\", false, &array_topo));\n\n KALDI_ASSERT(array_topo.size() >= 2);\n\n KALDI_ASSERT(samp_rate);\n\n std::ostringstream oss;\n\n std::copy(array_topo.begin(), array_topo.end(),\n\n std::ostream_iterator<BaseFloat>(oss, \" \"));\n\n KALDI_VLOG(1) << \"Parse topo_descriptor(\" << topo_descriptor << \") to \"\n\n << oss.str();\n\n }\n\n};\n\n\n", "file_path": "include/srp-phat.h", "rank": 16, "score": 46967.90470226234 }, { "content": "// include/beamformer.cc\n\n// wujian@2018\n\n\n\n// Copyright 2018 Jian Wu\n\n\n\n// See ../../COPYING for clarification regarding multiple authors\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n\n// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n\n// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n\n// MERCHANTABLITY OR NON-INFRINGEMENT.\n\n// See the Apache 2 License for the specific language governing permissions and\n\n// limitations under the License.\n\n\n", "file_path": "include/beamformer.cc", "rank": 17, "score": 46966.8492098108 }, { "content": "// include/rir-generator.h\n\n// [email protected]\n\n\n\n// Copyright 2018 Jian Wu\n\n\n\n// See ../../COPYING for clarification regarding multiple authors\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n\n// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n\n// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n\n// MERCHANTABLITY OR NON-INFRINGEMENT.\n\n// See the Apache 2 License for the specific language governing permissions and\n\n// limitations under the License.\n\n\n", "file_path": "include/rir-generator.h", "rank": 18, "score": 46966.8492098108 }, { "content": "// include/srp-phat.h\n\n// [email protected]\n\n\n\n// Copyright 2018 Jian Wu\n\n\n\n// See ../../COPYING for clarification regarding multiple authors\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n\n// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n\n// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n\n// MERCHANTABLITY OR NON-INFRINGEMENT.\n\n// See the Apache 2 License for the specific language governing permissions and\n\n// limitations under the License.\n\n\n", "file_path": "include/srp-phat.h", "rank": 19, "score": 46966.8492098108 }, { "content": "// include/stft.cc\n\n// [email protected]\n\n\n\n// Copyright 2018 Jian Wu\n\n\n\n// See ../../COPYING for clarification regarding multiple authors\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n\n// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n\n// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n\n// MERCHANTABLITY OR NON-INFRINGEMENT.\n\n// See the Apache 2 License for the specific language governing permissions and\n\n// limitations under the License.\n\n\n", "file_path": "include/stft.cc", "rank": 20, "score": 46966.8492098108 }, { "content": "// include/complex-base.h\n\n// wujian@2018\n\n\n\n// Copyright 2018 Jian Wu\n\n\n\n// See ../../COPYING for clarification regarding multiple authors\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n\n// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n\n// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n\n// MERCHANTABLITY OR NON-INFRINGEMENT.\n\n// See the Apache 2 License for the specific language governing permissions and\n\n// limitations under the License.\n\n\n", "file_path": "include/complex-base.h", "rank": 21, "score": 46966.8492098108 }, { "content": " num_frames = src_stft.NumRows() / num_bins;\n\n\n\n enh_stft->Resize(num_frames, num_bins);\n\n // enh_stft[f] = src_stft[f * t: f * t + t] * w^H\n\n for (int32 f = 0; f < num_bins; f++) {\n\n enh_stft->ColRange(f, 1)\n\n .AddMatMat(1.f, 0.f, src_stft.RowRange(f * num_frames, num_frames),\n\n kNoTrans, weights.RowRange(f, 1), kConjTrans, 0.f, 0.f);\n\n }\n\n}\n\n} // namespace kaldi\n", "file_path": "include/beamformer.cc", "rank": 22, "score": 46966.568367632935 }, { "content": " KALDI_VLOG(3) << \"Computed eigen vectors(row-major):\" << V;\n\n beam_weights->Row(f).CopyFromVec(V.Row(num_channels - 1), kConj);\n\n }\n\n}\n\n\n\n// src_stft: (num_bins x num_frames, num_channels)\n\n// weights: (num_bins, num_channels)\n\n// enh_stft: (num_frames, num_bins)\n\n// To avoid Transpose, using AddMatMat instead of:\n\n// enh_stft->Resize(num_bins, num_frames);\n\n// for (int32 f = 0; f < num_bins; f++)\n\n// enh_stft->Row(f).AddMatVec(1, 0, src_stft.RowRange(f * num_frames,\n\n// num_frames), kNoTrans, weights.Row(f), 0, 0);\n\n// enh_stft->Transpose();\n\nvoid Beamform(const CMatrixBase<BaseFloat> &src_stft,\n\n const CMatrixBase<BaseFloat> &weights,\n\n CMatrix<BaseFloat> *enh_stft) {\n\n KALDI_ASSERT(src_stft.NumCols() == weights.NumCols());\n\n KALDI_ASSERT(src_stft.NumRows() % weights.NumRows() == 0);\n\n int32 num_bins = weights.NumRows(), num_channels = weights.NumCols(),\n", "file_path": "include/beamformer.cc", "rank": 23, "score": 46965.784219836 }, { "content": "\n\ndouble Sinc(double x) { return x == 0 ? 1.0 : std::sin(x) / x; }\n\n\n\nBaseFloat Sabine(Point3D &room_topo, std::vector<BaseFloat> &beta,\n\n BaseFloat c) {\n\n BaseFloat V = room_topo.V();\n\n BaseFloat alpha = ((1 - pow(beta[0], 2)) + (1 - pow(beta[1], 2))) *\n\n room_topo.y * room_topo.z +\n\n ((1 - pow(beta[2], 2)) + (1 - pow(beta[3], 2))) *\n\n room_topo.x * room_topo.z +\n\n ((1 - pow(beta[4], 2)) + (1 - pow(beta[5], 2))) *\n\n room_topo.x * room_topo.y;\n\n BaseFloat revb_time = 24 * Log(10.0) * V / (c * alpha);\n\n return std::max(0.128f, revb_time);\n\n}\n\n\n\n} // namespace kaldi\n\n\n\n#endif", "file_path": "include/rir-generator.h", "rank": 24, "score": 46965.77203347125 }, { "content": "\n\n// target_psd: (num_bins x num_channels, num_channels)\n\n// steer_vector:(num_bins, num_channels)\n\n// using maximum eigen vector as estimation of steer vector\n\n// after A.Hed(&D, &V), there is\n\n// A. * V^H = D * V^H\n\n// see test_cmatrix_hed() in test/test-complex.cc\n\nvoid EstimateSteerVector(const CMatrixBase<BaseFloat> &target_psd,\n\n CMatrix<BaseFloat> *steer_vector) {\n\n int32 num_channels = target_psd.NumCols();\n\n KALDI_ASSERT(target_psd.NumRows() % num_channels == 0);\n\n int32 num_bins = target_psd.NumRows() / num_channels;\n\n steer_vector->Resize(num_bins, num_channels);\n\n\n\n CMatrix<BaseFloat> V(num_channels, num_channels);\n\n Vector<BaseFloat> D(num_channels);\n\n for (int32 f = 0; f < num_bins; f++) {\n\n target_psd.RowRange(f * num_channels, num_channels).Hed(&D, &V);\n\n KALDI_VLOG(3) << \"Compute eigen-dcomposition for matrix: \"\n\n << target_psd.RowRange(f * num_channels, num_channels);\n", "file_path": "include/beamformer.cc", "rank": 25, "score": 46965.10031982653 }, { "content": "\n\n void Exp(const VectorBase<Real> &e);\n\n\n\n protected:\n\n ~CVectorBase() {}\n\n\n\n explicit CVectorBase() : data_(NULL), dim_(0) {\n\n KALDI_ASSERT_IS_FLOATING_TYPE(Real);\n\n }\n\n\n\n Real *data_;\n\n MatrixIndexT dim_;\n\n\n\n KALDI_DISALLOW_COPY_AND_ASSIGN(CVectorBase);\n\n};\n\n\n\ntemplate <typename Real>\n", "file_path": "include/complex-vector.h", "rank": 26, "score": 46964.78874824465 }, { "content": " }\n\n\n\n CMatrixBase() : data_(NULL) { KALDI_ASSERT_IS_FLOATING_TYPE(Real); }\n\n\n\n inline Real *Data_workaround() const { return data_; }\n\n\n\n ~CMatrixBase() {}\n\n\n\n Real *data_;\n\n\n\n MatrixIndexT num_cols_;\n\n MatrixIndexT num_rows_;\n\n MatrixIndexT stride_;\n\n\n\n private:\n\n KALDI_DISALLOW_COPY_AND_ASSIGN(CMatrixBase);\n\n};\n\n\n\ntemplate <typename Real>\n", "file_path": "include/complex-matrix.h", "rank": 27, "score": 46964.60361915755 }, { "content": " KALDI_VLOG(3) << \"Computed eigen values:\" << D;\n\n KALDI_VLOG(3) << \"Computed eigen vectors(row-major):\" << V;\n\n steer_vector->Row(f).CopyFromVec(V.Row(num_channels - 1), kConj);\n\n }\n\n}\n\n\n\n// target_psd: (num_bins x num_channels, num_channels)\n\n// steer_vector:(num_bins, num_channels)\n\n// beam_weights:(num_bins, num_channels)\n\n// NOTE mvdr beam weights computation:\n\n// w = \\frac{R^{-1} * d}{d^H * R^{-1} * d}\n\nvoid ComputeMvdrBeamWeights(const CMatrixBase<BaseFloat> &noise_psd,\n\n const CMatrixBase<BaseFloat> &steer_vector,\n\n CMatrix<BaseFloat> *beam_weights) {\n\n KALDI_ASSERT(noise_psd.NumCols() == steer_vector.NumCols());\n\n KALDI_ASSERT(noise_psd.NumRows() % steer_vector.NumCols() == 0);\n\n int32 num_bins = steer_vector.NumRows(),\n\n num_channels = steer_vector.NumCols();\n\n\n\n CMatrix<BaseFloat> psd_inv(num_channels, num_channels);\n", "file_path": "include/beamformer.cc", "rank": 28, "score": 46964.439346468156 }, { "content": "\n\n inline Real *RowData(MatrixIndexT i) {\n\n KALDI_ASSERT(static_cast<UnsignedMatrixIndexT>(i) <\n\n static_cast<UnsignedMatrixIndexT>(num_rows_));\n\n return data_ + i * stride_;\n\n }\n\n\n\n inline Real &operator()(MatrixIndexT r, MatrixIndexT c,\n\n ComplexIndexType kIndex) {\n\n KALDI_PARANOID_ASSERT(static_cast<UnsignedMatrixIndexT>(r) <\n\n static_cast<UnsignedMatrixIndexT>(num_rows_) &&\n\n static_cast<UnsignedMatrixIndexT>(c) <\n\n static_cast<UnsignedMatrixIndexT>(num_cols_));\n\n return *(data_ + r * stride_ + (kIndex == kReal ? c * 2 : c * 2 + 1));\n\n }\n\n\n\n inline const Real operator()(MatrixIndexT r, MatrixIndexT c,\n\n ComplexIndexType kIndex) const {\n\n KALDI_PARANOID_ASSERT(static_cast<UnsignedMatrixIndexT>(r) <\n\n static_cast<UnsignedMatrixIndexT>(num_rows_) &&\n", "file_path": "include/complex-matrix.h", "rank": 29, "score": 46964.22711042486 }, { "content": "\n\n private:\n\n SubCMatrix<Real> &operator=(const SubCMatrix<Real> &other);\n\n};\n\n\n\n// This function is only used for debug.\n\ntemplate <typename Real>\n\nstd::ostream &operator<<(std::ostream &os, const CMatrixBase<Real> &cm) {\n\n cm.Write(os, false);\n\n return os;\n\n}\n\n}\n\n\n\n#endif\n", "file_path": "include/complex-matrix.h", "rank": 30, "score": 46964.02336486768 }, { "content": " }\n\n\n\n\n\n inline const SubCVector<Real> Row(MatrixIndexT i) const {\n\n KALDI_ASSERT(static_cast<UnsignedMatrixIndexT>(i) <\n\n static_cast<UnsignedMatrixIndexT>(num_rows_));\n\n return SubCVector<Real>(data_ + (i * stride_), num_cols_);\n\n }\n\n\n\n inline SubCVector<Real> Row(MatrixIndexT i) {\n\n KALDI_ASSERT(static_cast<UnsignedMatrixIndexT>(i) <\n\n static_cast<UnsignedMatrixIndexT>(num_rows_));\n\n return SubCVector<Real>(data_ + (i * stride_), num_cols_);\n\n }\n\n\n\n void SetZero();\n\n\n\n void SetRandn();\n\n\n\n void SetUnit();\n", "file_path": "include/complex-matrix.h", "rank": 31, "score": 46964.020064438635 }, { "content": "// target_psd: (num_bins x num_channels, num_channels)\n\n// noise_psd: (num_bins x num_channels, num_channels)\n\n// beam_weights:(num_bins, num_channels)\n\nvoid ComputeGevdBeamWeights(const CMatrixBase<BaseFloat> &target_psd,\n\n const CMatrixBase<BaseFloat> &noise_psd,\n\n CMatrix<BaseFloat> *beam_weights) {\n\n KALDI_ASSERT(target_psd.NumCols() == noise_psd.NumCols() &&\n\n target_psd.NumRows() == noise_psd.NumRows());\n\n KALDI_ASSERT(target_psd.NumRows() % target_psd.NumRows() == 0);\n\n int32 num_channels = target_psd.NumCols(),\n\n num_bins = target_psd.NumRows() / target_psd.NumCols();\n\n\n\n beam_weights->Resize(num_bins, num_channels);\n\n CMatrix<BaseFloat> V(num_channels, num_channels);\n\n Vector<BaseFloat> D(num_channels);\n\n for (int32 f = 0; f < num_bins; f++) {\n\n SubCMatrix<BaseFloat> B(noise_psd, f * num_channels, num_channels, 0,\n\n num_channels);\n\n target_psd.RowRange(f * num_channels, num_channels).Hged(&B, &D, &V);\n\n KALDI_VLOG(3) << \"Computed eigen values:\" << D;\n", "file_path": "include/beamformer.cc", "rank": 32, "score": 46963.747506608815 }, { "content": " \"egs: --source-location=\\\"2,3.5,2\\\"\");\n\n opts->Register(\"room-topo\", &room_topo,\n\n \"Room dimensions(in meters) egs: --room-dim=\\\"5,4,6\\\"\");\n\n opts->Register(\"angle\", &orientation,\n\n \"Direction in which the microphones are pointed, \"\n\n \"specified using azimuth and elevation angles(in radians)\");\n\n opts->Register(\"beta\", &beta,\n\n \"6D vector specifying the reflection coefficients or \"\n\n \"reverberation time(T60) in seconds.\");\n\n }\n\n};\n\n\n", "file_path": "include/rir-generator.h", "rank": 33, "score": 46963.73603955845 }, { "content": "//\n\n// src_stft: (num_bins x num_frames, num_channels)\n\n// target_mask: (num_frames, num_bins)\n\n// target_psd: (num_bins x num_channels, num_channels)\n\n// In matrix format: for X in shape (num_bins x num_frames)\n\n// covar = m .* X^H * X (1)\n\n// which is equal to:\n\n// covar = \\sum_t m(t) * x(t)^H * x(t) (2)\n\n// I implement as (2)\n\n// TODO: implement (1) instead, which is more efficient\n\nvoid EstimatePsd(const CMatrixBase<BaseFloat> &src_stft,\n\n const MatrixBase<BaseFloat> &target_mask,\n\n CMatrix<BaseFloat> *target_psd,\n\n CMatrix<BaseFloat> *second_psd) {\n\n int32 num_channels = src_stft.NumCols(), num_frames = target_mask.NumRows(),\n\n num_bins = target_mask.NumCols();\n\n KALDI_ASSERT(num_frames == src_stft.NumRows() / num_bins);\n\n KALDI_ASSERT(target_psd);\n\n target_psd->Resize(num_bins * num_channels, num_channels);\n\n if (second_psd) second_psd->Resize(num_bins * num_channels, num_channels);\n", "file_path": "include/beamformer.cc", "rank": 34, "score": 46963.38360903126 }, { "content": " cblas_CZdot(dim, v1.Data(), 1, v2.Data(), 1, conj == kConj ? true : false,\n\n &dot);\n\n return std::complex<Real>(dot.real, dot.imag);\n\n}\n\n\n\n// I do not implement Write/Read function cause I refused to write them into\n\n// disk.\n\n// This function is only used for debug.\n\ntemplate <typename Real>\n\nstd::ostream &operator<<(std::ostream &os, const CVectorBase<Real> &cv) {\n\n os << \" [ \";\n\n for (MatrixIndexT i = 0; i < cv.Dim(); i++)\n\n os << cv(i, kReal) << (cv(i, kImag) >= 0 ? \"+\" : \"\") << cv(i, kImag)\n\n << \"i \";\n\n os << \"]\\n\";\n\n return os;\n\n}\n\n}\n\n\n\n#endif\n", "file_path": "include/complex-vector.h", "rank": 35, "score": 46963.36633964592 }, { "content": " for (int32 f = 1; f < num_bins - 1; f++) {\n\n BaseFloat r = stft(t, f * 2), i = stft(t, f * 2 + 1);\n\n (*angle)(t, f) = atan2(i, r);\n\n }\n\n }\n\n}\n\n\n\nvoid ShortTimeFTComputer::Compute(const MatrixBase<BaseFloat> &wave,\n\n Matrix<BaseFloat> *stft,\n\n Matrix<BaseFloat> *spectra,\n\n Matrix<BaseFloat> *angle) {\n\n KALDI_ASSERT(analysis_window_.Dim() == frame_length_);\n\n\n\n Matrix<BaseFloat> stft_cache;\n\n ShortTimeFT(wave, &stft_cache);\n\n\n\n if (spectra) {\n\n ComputeSpectrogram(stft_cache, spectra);\n\n }\n\n if (angle) {\n", "file_path": "include/stft.cc", "rank": 36, "score": 46963.30704529838 }, { "content": " int32 window_size = opts.frame_length;\n\n analysis_window_.Resize(window_size);\n\n double a = M_2PI / (window_size - 1);\n\n for (int32 i = 0; i < window_size; i++) {\n\n double d = static_cast<double>(i);\n\n // numpy's coeff is 0.42\n\n if (opts.window == \"blackman\") {\n\n analysis_window_(i) = 0.42 - 0.5 * cos(a * d) + 0.08 * cos(2 * a * d);\n\n } else if (opts.window == \"hamming\") {\n\n analysis_window_(i) = 0.54 - 0.46 * cos(a * d);\n\n } else if (opts.window == \"hanning\") {\n\n analysis_window_(i) = 0.50 - 0.50 * cos(a * d);\n\n } else if (opts.window == \"rectangular\") {\n\n analysis_window_(i) = 1.0;\n\n } else {\n\n KALDI_ERR << \"Unknown analysis window type \" << opts.window;\n\n }\n\n }\n\n synthesis_window_.Resize(window_size);\n\n synthesis_window_.CopyFromVec(analysis_window_);\n", "file_path": "include/stft.cc", "rank": 37, "score": 46963.122212505565 }, { "content": " cutoff.CopyFromMat(\n\n wave->ColRange(pad_samples, num_samples - pad_samples * 2));\n\n wave->Swap(&cutoff);\n\n }\n\n\n\n SubVector<BaseFloat> cutoff_samples(*wave, 0);\n\n // If range < 0, left what it is\n\n if (range >= 0) {\n\n BaseFloat samp_norm = cutoff_samples.Norm(float_inf);\n\n // by default, normalize to int16 to avoid cutoff when writing wave to disk\n\n if (range == 0) range = int16_max;\n\n // range < 0, do not normalize it.\n\n if (range >= 0) {\n\n cutoff_samples.Scale(range / samp_norm);\n\n KALDI_VLOG(3) << \"Rescale samples(\" << range << \"/\" << samp_norm << \")\";\n\n }\n\n }\n\n}\n\n\n\nvoid ShortTimeFTComputer::CacheAnalysisWindow(const ShortTimeFTOptions &opts) {\n", "file_path": "include/stft.cc", "rank": 38, "score": 46962.991998688376 }, { "content": " }\n\n\n\n SubCVector(const CMatrixBase<Real> &matrix, MatrixIndexT row) {\n\n CVectorBase<Real>::data_ = const_cast<Real *>(matrix.RowData(row));\n\n CVectorBase<Real>::dim_ = matrix.NumCols();\n\n }\n\n\n\n ~SubCVector() {}\n\n\n\n private:\n\n SubCVector &operator=(const SubCVector &other) {}\n\n};\n\n\n\ntemplate <typename Real>\n\nstd::complex<Real> VecVec(const CVectorBase<Real> &v1,\n\n const CVectorBase<Real> &v2,\n\n ConjugateType conj = kNoConj) {\n\n MatrixIndexT dim = v1.Dim();\n\n KALDI_ASSERT(dim == v2.Dim());\n\n Complex<Real> dot;\n", "file_path": "include/complex-vector.h", "rank": 39, "score": 46962.97668712587 }, { "content": " inline Real &operator()(MatrixIndexT i, ComplexIndexType kIndex) {\n\n KALDI_PARANOID_ASSERT(static_cast<UnsignedMatrixIndexT>(i * 2) <\n\n static_cast<UnsignedMatrixIndexT>(dim_));\n\n return *(data_ + (kIndex == kReal ? i * 2 : i * 2 + 1));\n\n }\n\n\n\n SubCVector<Real> Range(const MatrixIndexT offset, const MatrixIndexT dim) {\n\n return SubCVector<Real>(*this, offset, dim);\n\n }\n\n\n\n const SubCVector<Real> Range(const MatrixIndexT offset,\n\n const MatrixIndexT dim) const {\n\n return SubCVector<Real>(*this, offset, dim);\n\n }\n\n\n\n std::complex<Real> Sum() const;\n\n\n\n std::string Info() const;\n\n // ajust cblas mm results into normal form\n\n // (a, bi) => (b+a)/2 (b-a)/2\n", "file_path": "include/complex-vector.h", "rank": 40, "score": 46962.917406696986 }, { "content": " ComputePhaseAngle(stft_cache, angle);\n\n }\n\n // copy back to stft\n\n if (stft) {\n\n stft->Swap(&stft_cache);\n\n }\n\n}\n\n\n\nvoid ShortTimeFTComputer::Polar(const MatrixBase<BaseFloat> &spectra,\n\n const MatrixBase<BaseFloat> &angle,\n\n Matrix<BaseFloat> *stft) {\n\n KALDI_ASSERT(spectra.NumCols() == angle.NumCols() &&\n\n spectra.NumRows() == angle.NumRows());\n\n int32 num_frames = spectra.NumRows(), num_bins = spectra.NumCols();\n\n int32 window_size = (num_bins - 1) * 2;\n\n stft->Resize(num_frames, window_size);\n\n\n\n Matrix<BaseFloat> linear_spectra(spectra);\n\n if (opts_.apply_log) linear_spectra.ApplyExp();\n\n if (opts_.apply_pow) linear_spectra.ApplyPow(0.5);\n", "file_path": "include/stft.cc", "rank": 41, "score": 46962.781721264924 }, { "content": " // this = this^{-1}\n\n void Invert();\n\n\n\n // For Hermite matrix, eigen values are all real.\n\n // And eig_value is in ascend order.\n\n // To get same results as MATLAB, call eig_vector.Hermite()after\n\n void Hed(VectorBase<Real> *D, CMatrixBase<Real> *V);\n\n\n\n void Hged(CMatrixBase<Real> *B, VectorBase<Real> *D, CMatrixBase<Real> *V);\n\n\n\n // Now binary must be true\n\n void Read(std::istream &in, bool binary);\n\n\n\n void Write(std::ostream &out, bool binary) const;\n\n\n\n protected:\n\n CMatrixBase(Real *data, MatrixIndexT cols, MatrixIndexT rows,\n\n MatrixIndexT stride)\n\n : data_(data), num_cols_(cols), num_rows_(rows), stride_(stride) {\n\n KALDI_ASSERT_IS_FLOATING_TYPE(Real);\n", "file_path": "include/complex-matrix.h", "rank": 42, "score": 46962.744150960294 }, { "content": " }\n\n}\n\n\n\n// src_stft: (num_frames, num_bins x num_channels) or\n\n// (num_frames x num_channels, num_bins)\n\n// dst_stft: (num_bins x num_frames, num_channels)\n\n// Shape multiple complex stft from shape num_frames x [num_bins * num_channels]\n\n// or [num_frames x num_channels] x num_bins into [num_bins * num_frames] x\n\n// num_channels\n\n// for convenience of psd estimate and beamforming\n\nvoid TrimStft(const int32 num_bins, const int32 num_channels,\n\n const CMatrixBase<BaseFloat> &src_stft,\n\n CMatrix<BaseFloat> *dst_stft) {\n\n if (num_channels * num_bins != src_stft.NumCols() &&\n\n num_bins != src_stft.NumCols())\n\n KALDI_ERR << \"Check dimention of short-time fourier transform\";\n\n\n\n int32 num_frames =\n\n (num_bins == src_stft.NumCols() ? src_stft.NumRows() / num_channels\n\n : src_stft.NumRows());\n", "file_path": "include/beamformer.cc", "rank": 43, "score": 46962.534083308325 }, { "content": " void AdjustIn();\n\n\n\n // (a, bi) => (a-b) (a+b)\n\n void AdjustOut();\n\n\n\n // this += c\n\n void Add(Real cr, Real ci);\n\n\n\n // this = this + alpha * v\n\n void AddVec(Real alpha_r, Real alpha_i, CVectorBase<Real> &v);\n\n\n\n // this = beta * this + alpha * M * v\n\n void AddMatVec(const Real alpha_r, const Real alpha_i,\n\n const CMatrixBase<Real> &M, const MatrixTransposeType trans,\n\n const CVectorBase<Real> &v, const Real beta_r,\n\n const Real beta_i);\n\n\n\n // this = this .* v\n\n void MulElements(const CVectorBase<Real> &v, ConjugateType conj = kNoConj,\n\n bool mul_abs = false);\n", "file_path": "include/complex-vector.h", "rank": 44, "score": 46960.668043756574 }, { "content": " bool hp_filter_;\n\n int32 num_samples_, order_, room_dim_, num_mics_;\n\n\n\n RirGeneratorOptions opts_;\n\n\n\n std::vector<Point3D> receiver_location_;\n\n Point3D source_location_, room_topo_;\n\n std::vector<BaseFloat> angle_, beta_;\n\n\n\n std::map<std::string, PolorPattern> str_to_pattern_ = {\n\n {\"omnidirectional\", kOmnidirectional},\n\n {\"subcardioid\", kSubcardioid},\n\n {\"cardioid\", kCardioid},\n\n {\"hypercardioid\", kHypercardioid},\n\n {\"bidirectional\", kBidirectional}};\n\n\n\n void ComputeDerived();\n\n\n\n BaseFloat MicrophoneSim(const Point3D &p);\n\n};\n", "file_path": "include/rir-generator.h", "rank": 45, "score": 46960.668043756574 }, { "content": "\n\n // this = this ./ v\n\n void DivElements(const CVectorBase<Real> &v, ConjugateType conj = kNoConj,\n\n bool div_abs = false);\n\n\n\n // this = this * alpha\n\n void Scale(const Real alpha_r, const Real alpha_i);\n\n\n\n // this = this'\n\n void Conjugate();\n\n\n\n void CopyFromVec(const CVectorBase<Real> &v, ConjugateType conj = kNoConj);\n\n\n\n void CopyFromVec(const VectorBase<Real> &v, ComplexIndexType kIndex);\n\n\n\n void CopyFromRealfft(const VectorBase<Real> &v);\n\n\n\n void Part(VectorBase<Real> *p, ComplexIndexType index);\n\n\n\n void Abs(VectorBase<Real> *p);\n", "file_path": "include/complex-vector.h", "rank": 46, "score": 46960.668043756574 }, { "content": "\n\n for (int32 f = 0; f < num_bins; f++) {\n\n BaseFloat mask_sum = 0.0, mask = 0.0;\n\n for (int32 t = 0; t < num_frames; t++) {\n\n SubCVector<BaseFloat> obs(src_stft, f * num_frames + t);\n\n mask = target_mask(t, f);\n\n target_psd->RowRange(f * num_channels, num_channels)\n\n .AddVecVec(mask, 0, obs, obs, kConj);\n\n if (second_psd)\n\n second_psd->RowRange(f * num_channels, num_channels)\n\n .AddVecVec(1 - mask, 0, obs, obs, kConj);\n\n mask_sum += mask;\n\n }\n\n target_psd->RowRange(f * num_channels, num_channels)\n\n .Scale(1.0 / mask_sum, 0);\n\n if (second_psd)\n\n second_psd->RowRange(f * num_channels, num_channels)\n\n .Scale(1.0 / (num_frames - mask_sum), 0);\n\n }\n\n}\n", "file_path": "include/beamformer.cc", "rank": 47, "score": 46960.668043756574 }, { "content": " // init from real matrix\n\n void CopyFromMat(const MatrixBase<Real> &M, ComplexIndexType index = kReal);\n\n\n\n void CopyFromRealfft(const MatrixBase<Real> &M);\n\n\n\n // copy vector into rindex row of matrix\n\n void CopyRowFromVec(const CVectorBase<Real> &v, const MatrixIndexT rindex);\n\n\n\n // copy vector into cindex col of matrix\n\n void CopyColFromVec(const CVectorBase<Real> &v, const MatrixIndexT cindex);\n\n\n\n std::string Info() const;\n\n\n\n void AddToDiag(const Real alpha_r, const Real alpha_i);\n\n\n\n // this = this .* A\n\n void MulElements(const CMatrixBase<Real> &A, ConjugateType conj = kNoConj,\n\n bool mul_abs = false);\n\n\n\n // this = this ./ A\n", "file_path": "include/complex-matrix.h", "rank": 48, "score": 46960.668043756574 }, { "content": " CMatrix(const MatrixBase<Real> &M, ComplexIndexType index = kReal);\n\n\n\n // copy constructor\n\n CMatrix<Real> &operator=(const CMatrixBase<Real> &other) {\n\n if (CMatrixBase<Real>::NumRows() != other.NumRows() ||\n\n CMatrixBase<Real>::NumCols() != other.NumCols())\n\n Resize(other.NumRows(), other.NumCols(), kUndefined);\n\n CMatrixBase<Real>::CopyFromMat(other);\n\n return *this;\n\n }\n\n\n\n CMatrix<Real> &operator=(const CMatrix<Real> &other) {\n\n if (CMatrixBase<Real>::NumRows() != other.NumRows() ||\n\n CMatrixBase<Real>::NumCols() != other.NumCols())\n\n Resize(other.NumRows(), other.NumCols(), kUndefined);\n\n CMatrixBase<Real>::CopyFromMat(other);\n\n return *this;\n\n }\n\n\n\n void Swap(CMatrix<Real> *other);\n", "file_path": "include/complex-matrix.h", "rank": 49, "score": 46960.668043756574 }, { "content": " copy_mat.ColRange(pad_samples, num_samples).CopyFromMat(wave);\n\n\n\n if (opts_.normalize_input) copy_mat.Scale(1.0 / int16_max);\n\n\n\n int32 ibeg, iend;\n\n for (int32 c = 0; c < num_channels; c++) {\n\n // channel c\n\n SubVector<BaseFloat> samples(copy_mat, c);\n\n\n\n if (opts_.enable_scale) {\n\n BaseFloat samp_norm = samples.Norm(float_inf);\n\n samples.Scale(int16_max / samp_norm);\n\n }\n\n\n\n for (int32 i = 0; i < num_frames; i++) {\n\n SubVector<BaseFloat> spectra(*stft, c * num_frames + i);\n\n ibeg = i * frame_shift_;\n\n iend = ibeg + frame_length_ <= num_samples ? ibeg + frame_length_\n\n : num_samples;\n\n spectra.Range(0, iend - ibeg)\n", "file_path": "include/stft.cc", "rank": 50, "score": 46960.668043756574 }, { "content": " static_cast<UnsignedMatrixIndexT>(c) <\n\n static_cast<UnsignedMatrixIndexT>(num_cols_));\n\n return *(data_ + r * stride_ + (kIndex == kReal ? c * 2 : c * 2 + 1));\n\n }\n\n\n\n inline SubCMatrix<Real> Range(const MatrixIndexT row_offset,\n\n const MatrixIndexT num_rows,\n\n const MatrixIndexT col_offset,\n\n const MatrixIndexT num_cols) const {\n\n return SubCMatrix<Real>(*this, row_offset, num_rows, col_offset, num_cols);\n\n }\n\n\n\n inline SubCMatrix<Real> RowRange(const MatrixIndexT row_offset,\n\n const MatrixIndexT num_rows) const {\n\n return SubCMatrix<Real>(*this, row_offset, num_rows, 0, num_cols_);\n\n }\n\n\n\n inline SubCMatrix<Real> ColRange(const MatrixIndexT col_offset,\n\n const MatrixIndexT num_cols) const {\n\n return SubCMatrix<Real>(*this, 0, num_rows_, col_offset, num_cols);\n", "file_path": "include/complex-matrix.h", "rank": 51, "score": 46960.668043756574 }, { "content": "\n\n void Transpose();\n\n\n\n void Hermite();\n\n\n\n ~CMatrix() { Destroy(); }\n\n\n\n void Resize(const MatrixIndexT rows, const MatrixIndexT cols,\n\n MatrixResizeType resize_type = kSetZero,\n\n MatrixStrideType stride_type = kDefaultStride);\n\n\n\n void Read(std::istream &in, bool binary);\n\n\n\n private:\n\n void Destroy();\n\n\n\n void Init(const MatrixIndexT rows, const MatrixIndexT cols,\n\n const MatrixStrideType stride_type);\n\n};\n\n\n\ntemplate <typename Real>\n", "file_path": "include/complex-matrix.h", "rank": 52, "score": 46960.668043756574 }, { "content": "\n\n SubVector<BaseFloat> samples(*wave, 0);\n\n Vector<BaseFloat> seg(frame_length_);\n\n\n\n for (int32 i = 0; i < num_frames; i++) {\n\n SubVector<BaseFloat> spectra(stft, i);\n\n // iRealFFT\n\n srfft_->Compute(spectra.Data(), false);\n\n spectra.Scale(1.0 / frame_length_);\n\n\n\n seg.CopyFromVec(spectra.Range(0, frame_length_));\n\n // NOTE: synthetic window should be orthogonalized with analysis window\n\n seg.MulElements(synthesis_window_);\n\n samples.Range(i * frame_shift_, frame_length_).AddVec(1, seg);\n\n }\n\n\n\n // cutoff padding zeros\n\n if (opts_.center) {\n\n int32 pad_samples = opts_.PaddingLength() >> 1;\n\n Matrix<BaseFloat> cutoff(1, num_samples - pad_samples * 2);\n", "file_path": "include/stft.cc", "rank": 53, "score": 46960.668043756574 }, { "content": "\n\n void Add(Real alpha_r, Real alpha_i);\n\n\n\n // this = this * alpha\n\n void Scale(Real alpha_r, Real alpha_i);\n\n\n\n // ajust cblas mm results into normal form\n\n // (a, bi) => (b+a)/2 (b-a)/2\n\n void AdjustOut();\n\n\n\n // (a, bi) => (a-b) (a+b)\n\n void AdjustIn();\n\n\n\n // this = this'\n\n void Conjugate();\n\n\n\n // this = this^T\n\n void Transpose();\n\n\n\n // this = this^H\n", "file_path": "include/complex-matrix.h", "rank": 54, "score": 46960.668043756574 }, { "content": "}\n\n\n\nvoid ShortTimeFTComputer::CacheSynthesisWindow(const ShortTimeFTOptions &opts) {\n\n int32 window_size = opts_.frame_length;\n\n\n\n Vector<BaseFloat> analysis_window_square(analysis_window_),\n\n denominator(window_size);\n\n analysis_window_square.ApplyPow(2);\n\n\n\n int32 width = static_cast<int32>((window_size - 1) / opts_.frame_shift), s;\n\n\n\n for (int32 i = -width; i <= width; i++) {\n\n s = i * opts_.frame_shift;\n\n if (s < 0) {\n\n // [0: end - s] += [-s: end]\n\n denominator.Range(0, window_size + s)\n\n .AddVec(1, analysis_window_square.Range(-s, window_size + s));\n\n } else {\n\n // [s: end] += [0: end - s]\n\n denominator.Range(s, window_size - s)\n\n .AddVec(1, analysis_window_square.Range(0, window_size - s));\n\n }\n\n }\n\n // synthesis_window_.Resize(window_size);\n\n // synthesis_window_.CopyFromVec(analysis_window_);\n\n synthesis_window_.DivElements(denominator);\n\n}\n\n}\n", "file_path": "include/stft.cc", "rank": 55, "score": 46960.668043756574 }, { "content": " BaseFloat samp_frequency_;\n\n\n\n Vector<BaseFloat> frequency_axis_, delay_axis_;\n\n // note that exp_idtft_coef_j_ = exp(idtft_coef_)\n\n Matrix<BaseFloat> idtft_coef_;\n\n CMatrix<BaseFloat> exp_idtft_coef_j_;\n\n\n\n // This function implements GCC-PHAT algorithm. For MATLAB:\n\n // >> R = L .* conj(R) ./ (abs(L) .* abs(R));\n\n // >> frequency = linspace(0, fs / 2, num_bins);\n\n // >> augular = R * (exp(frequency' * tau * 2j * pi));\n\n void ComputeGccPhat(const CMatrixBase<BaseFloat> &L,\n\n const CMatrixBase<BaseFloat> &R, BaseFloat dist,\n\n CMatrixBase<BaseFloat> *spectra);\n\n\n\n void Smooth(CMatrix<BaseFloat> *spectra);\n\n};\n\n}\n\n\n\n#endif\n", "file_path": "include/srp-phat.h", "rank": 56, "score": 46960.668043756574 }, { "content": " void Register(OptionsItf *opts) {\n\n opts->Register(\"sound-velocity\", &sound_velocity, \"Sound velocity in m/s\");\n\n opts->Register(\"samp-frequency\", &samp_frequency,\n\n \"Sampling frequency in Hz\");\n\n opts->Register(\"hp-filter\", &hp_filter,\n\n \"If true, high-pass filter is enabled\");\n\n opts->Register(\"number-samples\", &num_samples,\n\n \"Number of samples to calculate\");\n\n opts->Register(\"order\", &order,\n\n \"Reflection order, default is -1, i.e. maximum order\");\n\n opts->Register(\"microphone-type\", &microphone_type,\n\n \"Type of micrphone arrays(\"\n\n \"\\\"omnidirectional\\\"|\\\"subcardioid\\\"|\\\"cardioid\\\"|\"\n\n \"\\\"hypercardioid\\\"|\\\"bidirectional\\\")\");\n\n opts->Register(\"receiver-location\", &receiver_location,\n\n \"3D-Coordinates of receivers(in meters). \"\n\n \"Each coordinate is separated by a single semicolon, egs: \"\n\n \"--receiver-location=\\\"2,1.5,2;1,1.5,2\\\"\");\n\n opts->Register(\"source-location\", &source_location,\n\n \"3D Coordinates of receivers(in meters). \"\n", "file_path": "include/rir-generator.h", "rank": 57, "score": 46960.668043756574 }, { "content": " void DivElements(const CMatrixBase<Real> &A, ConjugateType conj = kNoConj,\n\n bool div_abs = false);\n\n\n\n // this = this * beta + alpha * A * B\n\n void AddMatMat(const Real alpha_r, const Real alpha_i,\n\n const CMatrixBase<Real> &A, MatrixTransposeType transA,\n\n const CMatrixBase<Real> &B, MatrixTransposeType transB,\n\n const Real beta_r, const Real beta_i);\n\n\n\n\n\n\n\n // this = this + alpha * a * b^{T or H}\n\n void AddVecVec(const Real alpha_r, const Real alpha_i,\n\n const CVectorBase<Real> &a, const CVectorBase<Real> &b,\n\n ConjugateType conj = kNoConj);\n\n\n\n // this = this * alpha + M\n\n void AddMat(const Real alpha_r, const Real alpha_i,\n\n const CMatrixBase<Real> &M, MatrixTransposeType trans = kNoTrans);\n\n\n", "file_path": "include/complex-matrix.h", "rank": 58, "score": 46960.668043756574 }, { "content": "\n\n BaseFloat theta = 0;\n\n for (int32 t = 0; t < num_frames; t++) {\n\n (*stft)(t, 0) = linear_spectra(t, 0);\n\n (*stft)(t, 1) = -linear_spectra(t, num_bins - 1);\n\n for (int32 f = 1; f < num_bins - 1; f++) {\n\n theta = angle(t, f);\n\n (*stft)(t, f * 2) = cos(theta) * linear_spectra(t, f);\n\n (*stft)(t, f * 2 + 1) = sin(theta) * linear_spectra(t, f);\n\n }\n\n }\n\n}\n\n\n\nvoid ShortTimeFTComputer::InverseShortTimeFT(const MatrixBase<BaseFloat> &stft,\n\n Matrix<BaseFloat> *wave,\n\n BaseFloat range) {\n\n int32 num_frames = stft.NumRows();\n\n // should be longer than original\n\n int32 num_samples = NumSamples(num_frames);\n\n wave->Resize(1, num_samples);\n", "file_path": "include/stft.cc", "rank": 59, "score": 46960.668043756574 }, { "content": " dst_stft->Resize(num_bins * num_frames, num_channels);\n\n\n\n if (num_channels * num_bins == src_stft.NumCols()) {\n\n for (int32 c = 0; c < num_channels; c++) {\n\n for (int32 f = 0; f < num_bins; f++) {\n\n // D[f * T: f * T + T, c: c + 1] = S[:, F * c + f: F * c + f + 1]\n\n dst_stft->Range(f * num_frames, num_frames, c, 1)\n\n .CopyFromMat(src_stft.ColRange(num_bins * c + f, 1));\n\n }\n\n }\n\n } else {\n\n for (int32 c = 0; c < num_channels; c++) {\n\n for (int32 f = 0; f < num_bins; f++) {\n\n dst_stft->Range(f * num_frames, num_frames, c, 1)\n\n .CopyFromMat(src_stft.Range(num_frames * c, num_frames, f, 1));\n\n }\n\n }\n\n }\n\n}\n\n\n", "file_path": "include/beamformer.cc", "rank": 60, "score": 46960.668043756574 }, { "content": " }\n\n\n\n CVector<Real> &operator=(const CVector<Real> &other) {\n\n Resize(other.Dim(), kSetZero);\n\n this->CopyFromVec(other);\n\n return *this;\n\n }\n\n\n\n CVector(const CVector<Real> &v) : CVectorBase<Real>() {\n\n Resize(v.Dim(), kSetZero);\n\n this->CopyFromVec(v);\n\n }\n\n\n\n void Swap(CVector<Real> *other);\n\n\n\n ~CVector() { Destroy(); }\n\n\n\n void Resize(MatrixIndexT length, MatrixResizeType resize_type = kSetZero);\n\n\n\n private:\n\n void Init(const MatrixIndexT dim);\n\n\n\n void Destroy();\n\n};\n\n\n\ntemplate <typename Real>\n", "file_path": "include/complex-vector.h", "rank": 61, "score": 46960.668043756574 }, { "content": " }\n\n }\n\n if (!opts_.apply_pow) spectra->ApplyPow(0.5);\n\n if (opts_.apply_log) {\n\n // to avoid nan\n\n spectra->ApplyFloor(std::numeric_limits<BaseFloat>::epsilon());\n\n spectra->ApplyLog();\n\n }\n\n}\n\n\n\nvoid ShortTimeFTComputer::ComputePhaseAngle(const MatrixBase<BaseFloat> &stft,\n\n Matrix<BaseFloat> *angle) {\n\n int32 window_size = stft.NumCols(), num_frames = stft.NumRows();\n\n // index range(0, num_bins - 1)\n\n int32 num_bins = (window_size >> 1) + 1;\n\n angle->Resize(num_frames, num_bins);\n\n // processing angle(i, j)\n\n for (int32 t = 0; t < num_frames; t++) {\n\n (*angle)(t, 0) = atan2(0, stft(t, 0));\n\n (*angle)(t, num_bins - 1) = atan2(0, stft(t, 1));\n", "file_path": "include/stft.cc", "rank": 62, "score": 46960.668043756574 }, { "content": " .CopyFromVec(samples.Range(ibeg, iend - ibeg));\n\n spectra.Range(0, frame_length_).MulElements(analysis_window_);\n\n srfft_->Compute(spectra.Data(), true);\n\n }\n\n }\n\n}\n\n\n\nvoid ShortTimeFTComputer::ComputeSpectrogram(const MatrixBase<BaseFloat> &stft,\n\n Matrix<BaseFloat> *spectra) {\n\n int32 window_size = stft.NumCols(), num_frames = stft.NumRows();\n\n // index range(0, num_bins - 1)\n\n int32 num_bins = (window_size >> 1) + 1;\n\n\n\n spectra->Resize(num_frames, num_bins);\n\n for (int32 t = 0; t < num_frames; t++) {\n\n (*spectra)(t, 0) = stft(t, 0) * stft(t, 0);\n\n (*spectra)(t, num_bins - 1) = stft(t, 1) * stft(t, 1);\n\n for (int32 f = 1; f < num_bins - 1; f++) {\n\n BaseFloat r = stft(t, f * 2), i = stft(t, f * 2 + 1);\n\n (*spectra)(t, f) = r * r + i * i;\n", "file_path": "include/stft.cc", "rank": 63, "score": 46960.668043756574 }, { "content": " void Hermite();\n\n\n\n // this = this.Real/Imag\n\n void Part(MatrixBase<Real> *P, ComplexIndexType index);\n\n\n\n // this = |this|\n\n void Abs(MatrixBase<Real> *P);\n\n\n\n // this = exp(Ej)\n\n void Exp(const MatrixBase<Real> &E);\n\n\n\n // this == this^H\n\n bool IsHermitian(Real cutoff = 1.0e-5);\n\n\n\n bool IsHermitianPosDef();\n\n\n\n // init from complex matrix, enable conjugate & transpose\n\n void CopyFromMat(const CMatrixBase<Real> &M,\n\n MatrixTransposeType trans = kNoTrans);\n\n\n", "file_path": "include/complex-matrix.h", "rank": 64, "score": 46960.668043756574 }, { "content": "#include \"include/complex-vector.h\"\n\n#include \"include/complex-matrix.h\"\n\n\n\nnamespace kaldi {\n\n\n\n// Implement of CVectorBase\n\n\n\ntemplate <typename Real>\n\nvoid CVectorBase<Real>::SetZero() {\n\n std::memset(data_, 0, 2 * dim_ * sizeof(Real));\n\n}\n\n\n\ntemplate <typename Real>\n\nvoid CVectorBase<Real>::SetRandn() {\n\n kaldi::RandomState rstate;\n\n for (MatrixIndexT i = 0; i < dim_ * 2; i += 2) {\n\n kaldi::RandGauss2(data_ + i, data_ + i + 1, &rstate);\n\n }\n\n}\n\n\n", "file_path": "include/complex-vector.cc", "rank": 65, "score": 46202.58743879628 }, { "content": "#include \"include/rir-generator.h\"\n\n\n\nnamespace kaldi {\n\n\n\nvoid RirGenerator::ComputeDerived() {\n\n if (!str_to_pattern_.count(opts_.microphone_type))\n\n KALDI_ERR << \"Unknown option values: --microphone-type=\"\n\n << opts_.microphone_type;\n\n KALDI_ASSERT(frequency_ >= 1);\n\n KALDI_ASSERT(velocity_ >= 1);\n\n KALDI_ASSERT(order_ >= -1);\n\n\n\n // Process room topo\n\n KALDI_ASSERT(opts_.room_topo != \"\" &&\n\n \"Options --room-topo is not configured\");\n\n std::vector<BaseFloat> topo;\n\n KALDI_ASSERT(SplitStringToFloats(opts_.room_topo, \",\", false, &topo));\n\n room_dim_ = topo.size();\n\n KALDI_ASSERT(room_dim_ == 3);\n\n room_topo_.CopyFromVector(topo);\n", "file_path": "include/rir-generator.cc", "rank": 66, "score": 46201.63913990181 }, { "content": "#include \"include/complex-matrix.h\"\n\n//#include \"complex-matrix.h\"\n\n\n\nnamespace kaldi {\n\n\n\n// Implement for CMatrixBase\n\n\n\ntemplate <typename Real>\n\nvoid CMatrixBase<Real>::SetZero() {\n\n if (num_cols_ * 2 == stride_)\n\n memset(data_, 0, sizeof(Real) * num_rows_ * num_cols_ * 2);\n\n else\n\n for (MatrixIndexT row = 0; row < num_rows_; row++)\n\n memset(data_ + row * stride_, 0, sizeof(Real) * num_cols_ * 2);\n\n}\n\n\n\ntemplate <typename Real>\n\nvoid CMatrixBase<Real>::SetRandn() {\n\n kaldi::RandomState rstate;\n\n for (MatrixIndexT row = 0; row < num_rows_; row++) {\n", "file_path": "include/complex-matrix.cc", "rank": 67, "score": 46200.72453546803 }, { "content": "#include \"include/srp-phat.h\"\n\n\n\nnamespace kaldi {\n\n\n\n// GCC(x, y) = conj(GCC(y, x))\n\nvoid SrpPhatComputor::ComputeGccPhat(const CMatrixBase<BaseFloat> &L,\n\n const CMatrixBase<BaseFloat> &R,\n\n BaseFloat dist,\n\n CMatrixBase<BaseFloat> *gcc_phat) {\n\n KALDI_ASSERT(dist > 0);\n\n BaseFloat max_tdoa = dist / opts_.sound_speed;\n\n BaseFloat inc_tdoa = max_tdoa * 2 / (opts_.samp_rate - 1);\n\n for (int32 i = 0; i < opts_.samp_rate; i++)\n\n if (opts_.samp_tdoa)\n\n delay_axis_(i) = (max_tdoa - inc_tdoa * i) * 2 * M_PI;\n\n else\n\n delay_axis_(i) =\n\n std::cos(i * M_PI / opts_.samp_rate) * max_tdoa * 2 * M_PI;\n\n\n\n idtft_coef_.SetZero();\n", "file_path": "include/srp-phat.cc", "rank": 68, "score": 46199.29538794738 }, { "content": " oss << \"]\" << std::endl;\n\n oss << \"-- Beta Vector: [ \";\n\n std::copy(beta_.begin(), beta_.end(), std::ostream_iterator<float>(oss, \" \"));\n\n oss << \"]\" << std::endl;\n\n oss << \"-- Reciver Locations: \";\n\n for (int32 i = 0; i < receiver_location_.size(); i++) {\n\n oss << \"(\" << receiver_location_[i].x << \", \" << receiver_location_[i].y\n\n << \", \" << receiver_location_[i].z << \") \";\n\n }\n\n oss << std::endl;\n\n return oss.str();\n\n}\n\n\n\n} // namespace kaldi\n", "file_path": "include/rir-generator.cc", "rank": 69, "score": 46197.055583307665 }, { "content": "// include/srp-phat.cc\n\n// [email protected]\n\n\n\n// Copyright 2018 Jian Wu\n\n\n\n// See ../../COPYING for clarification regarding multiple authors\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n\n// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n\n// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n\n// MERCHANTABLITY OR NON-INFRINGEMENT.\n\n// See the Apache 2 License for the specific language governing permissions and\n\n// limitations under the License.\n\n\n", "file_path": "include/srp-phat.cc", "rank": 70, "score": 46196.82968960141 }, { "content": "// include/rir-generator.cc\n\n// [email protected]\n\n\n\n// Copyright 2018 Jian Wu\n\n\n\n// See ../../COPYING for clarification regarding multiple authors\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n\n// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n\n// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n\n// MERCHANTABLITY OR NON-INFRINGEMENT.\n\n// See the Apache 2 License for the specific language governing permissions and\n\n// limitations under the License.\n\n\n", "file_path": "include/rir-generator.cc", "rank": 71, "score": 46196.82968960141 }, { "content": "// include/complex-vector.cc\n\n// wujian@2018\n\n\n\n// Copyright 2018 Jian Wu\n\n\n\n// See ../../COPYING for clarification regarding multiple authors\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n\n// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n\n// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n\n// MERCHANTABLITY OR NON-INFRINGEMENT.\n\n// See the Apache 2 License for the specific language governing permissions and\n\n// limitations under the License.\n\n\n", "file_path": "include/complex-vector.cc", "rank": 72, "score": 46196.82968960141 }, { "content": "// include/complex-matrix.cc\n\n// wujian@2018\n\n\n\n// Copyright 2018 Jian Wu\n\n\n\n// See ../../COPYING for clarification regarding multiple authors\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n\n// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n\n// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n\n// MERCHANTABLITY OR NON-INFRINGEMENT.\n\n// See the Apache 2 License for the specific language governing permissions and\n\n// limitations under the License.\n\n\n", "file_path": "include/complex-matrix.cc", "rank": 73, "score": 46196.82968960141 }, { "content": " BaseFloat V = room_topo_.V(), S = room_topo_.S();\n\n beta_tmp.resize(6);\n\n if (revb_time_ != 0) {\n\n BaseFloat alfa = 24 * V * Log(10.0) / (velocity_ * S * revb_time_);\n\n if (alfa > 1)\n\n KALDI_ERR << alfa << \" > 1: The reflection coefficients cannot be \"\n\n \"calculated using the current\"\n\n << \" room parameters, i.e. room size and reverberation time.\";\n\n for (int32 i = 0; i < 6; i++) beta_tmp[i] = std::sqrt(1 - alfa);\n\n } else {\n\n for (int32 i = 0; i < 6; i++) beta_tmp[i] = 0;\n\n }\n\n } else {\n\n // compute from Sabine formula\n\n revb_time_ = Sabine(room_topo_, beta_tmp, velocity_);\n\n }\n\n beta_.swap(beta_tmp);\n\n KALDI_ASSERT(beta_.size() == 6);\n\n\n\n // Process number of samples\n", "file_path": "include/rir-generator.cc", "rank": 74, "score": 46196.57621708779 }, { "content": " for (MatrixIndexT row = 0; row < num_rows_; row++) {\n\n cblas_CZaxpy(num_cols_, &alpha, mdata + mstride * row, 1,\n\n data_ + stride_ * row, 1);\n\n }\n\n } else {\n\n KALDI_ASSERT(M.num_rows_ == num_cols_ && M.num_cols_ == num_rows_);\n\n if (num_rows_ == 0) return;\n\n // NOTE: mdata shift by row * 2\n\n for (MatrixIndexT row = 0; row < num_rows_; row++) {\n\n cblas_CZaxpy(num_cols_, &alpha, mdata + row * 2, mstride >> 1,\n\n data_ + stride_ * row, 1);\n\n }\n\n }\n\n AdjustOut();\n\n}\n\n\n\n// using clapack\n\ntemplate <typename Real>\n\nvoid CMatrixBase<Real>::Invert() {\n\n KaldiBlasInt M = num_rows_, N = num_cols_;\n", "file_path": "include/complex-matrix.cc", "rank": 75, "score": 46196.28825037183 }, { "content": "}\n\n\n\ntemplate <typename Real>\n\nvoid CVector<Real>::Destroy() {\n\n if (this->data_ != NULL) KALDI_MEMALIGN_FREE(this->data_);\n\n this->data_ = NULL;\n\n this->dim_ = 0;\n\n}\n\n\n\ntemplate <typename Real>\n\nvoid CVector<Real>::Swap(CVector<Real> *other) {\n\n std::swap(this->data_, other->data_);\n\n std::swap(this->dim_, other->dim_);\n\n}\n\n\n\ntemplate <typename Real>\n\nvoid CVector<Real>::Resize(const MatrixIndexT dim,\n\n MatrixResizeType resize_type) {\n\n // the next block uses recursion to handle what we have to do if\n\n // resize_type == kCopyData.\n", "file_path": "include/complex-vector.cc", "rank": 76, "score": 46195.82800133225 }, { "content": " // NOTE: stride_ / 2\n\n KaldiBlasInt stride = stride_ / 2, result = -1;\n\n // NOTE: double it\n\n KaldiBlasInt lwork = std::max<KaldiBlasInt>(1, N * 2);\n\n\n\n Real *work;\n\n void *temp;\n\n if ((work = static_cast<Real *>(\n\n KALDI_MEMALIGN(16, sizeof(Real) * lwork, &temp))) == NULL)\n\n throw std::bad_alloc();\n\n\n\n KaldiBlasInt *pivot = new KaldiBlasInt[num_rows_];\n\n clapack_CZgetrf(&M, &N, data_, &stride, pivot, &result);\n\n\n\n // free memory\n\n if (result != 0) {\n\n delete[] pivot;\n\n if (result < 0)\n\n KALDI_ERR << \"clapack_CZgetrf(): \" << -result\n\n << \"-th parameter had an illegal value\";\n", "file_path": "include/complex-matrix.cc", "rank": 77, "score": 46195.60455700971 }, { "content": " }\n\n // each row is a eigen vector\n\n // NOTE: can add V->Herimite() to get same results as MATLAB\n\n // and for A.Eig(&V, D)\n\n // have A * V = V * D, see test-complex.cc\n\n // by default, eigen value is in ascend order.\n\n}\n\n\n\n// void clapack_CZhegv(KaldiBlasInt *itype, KaldiBlasInt *num_rows, void *A,\n\n// KaldiBlasInt *stride_a, void *B, KaldiBlasInt *stride_b,\n\n// double *D, void *work, KaldiBlasInt *lwork, double\n\n// *rwork, KaldiBlasInt *info) {\n\ntemplate <typename Real>\n\nvoid CMatrixBase<Real>::Hged(CMatrixBase<Real> *B, VectorBase<Real> *D,\n\n CMatrixBase<Real> *V) {\n\n KALDI_ASSERT(IsHermitian());\n\n KALDI_ASSERT(B->IsHermitianPosDef());\n\n KALDI_ASSERT(V->NumCols() == V->NumRows() && num_rows_ == B->NumRows());\n\n KALDI_ASSERT(B->NumRows() == D->Dim() && num_rows_ == V->NumRows());\n\n\n", "file_path": "include/complex-matrix.cc", "rank": 78, "score": 46195.541674792126 }, { "content": " this->Hed(&D, &V);\n\n bool positive = true;\n\n for (int32 i = 0; i < num_rows_; i++) {\n\n if (D(i) <= 0) positive = false;\n\n }\n\n return positive;\n\n}\n\n\n\n// inline void clapack_CZheev(KaldiBlasInt *num_rows, void *eig_vecs,\n\n// KaldiBlasInt *stride, float *D,\n\n// void *work, KaldiBlasInt *lwork, float *rwork,\n\n// KaldiBlasInt *info)\n\ntemplate <typename Real>\n\nvoid CMatrixBase<Real>::Hed(VectorBase<Real> *D, CMatrixBase<Real> *V) {\n\n KALDI_ASSERT(IsHermitian());\n\n KALDI_ASSERT(V->NumCols() == V->NumRows() && num_rows_ == V->NumRows());\n\n KALDI_ASSERT(D->Dim() == num_rows_);\n\n\n\n KaldiBlasInt stride = (V->Stride() >> 1), num_rows = num_rows_, result = -1;\n\n\n", "file_path": "include/complex-matrix.cc", "rank": 79, "score": 46195.52743023668 }, { "content": " V->CopyFromMat(*this);\n\n KaldiBlasInt stride_a = (V->Stride() >> 1), num_rows = num_rows_;\n\n KaldiBlasInt stride_b = (B->Stride() >> 1), result = -1, itype = 1;\n\n\n\n KaldiBlasInt lwork = std::max(1, 2 * num_rows - 1);\n\n CVector<Real> work(lwork);\n\n\n\n Real *rwork;\n\n void *temp;\n\n if ((rwork = static_cast<Real *>(KALDI_MEMALIGN(\n\n 16, sizeof(Real) * std::max(1, 3 * num_rows - 2), &temp))) == NULL)\n\n throw std::bad_alloc();\n\n\n\n clapack_CZhegv(&itype, &num_rows, V->Data(), &stride_a, B->Data(), &stride_b,\n\n D->Data(), work.Data(), &lwork, rwork, &result);\n\n KALDI_MEMALIGN_FREE(rwork);\n\n\n\n if (result != 0) {\n\n if (result < 0)\n\n KALDI_ERR << \"clapack_CZhegv(): \" << -result\n", "file_path": "include/complex-matrix.cc", "rank": 80, "score": 46195.323102748975 }, { "content": " else\n\n KALDI_ERR << \"Cannot invert: matrix is singular\";\n\n }\n\n\n\n clapack_CZgetri(&M, data_, &stride, pivot, work, &lwork, &result);\n\n delete[] pivot;\n\n KALDI_MEMALIGN_FREE(work);\n\n\n\n if (result != 0) {\n\n if (result < 0)\n\n KALDI_ERR << \"clapack_CZgetrf(): \" << -result\n\n << \"-th parameter had an illegal value\";\n\n else\n\n KALDI_ERR << \"Cannot invert: matrix is singular\";\n\n }\n\n}\n\n\n\ntemplate <typename Real>\n\nbool CMatrixBase<Real>::IsHermitian(Real cutoff) {\n\n if (num_cols_ != num_rows_) return false;\n", "file_path": "include/complex-matrix.cc", "rank": 81, "score": 46195.285101898124 }, { "content": " V->CopyFromMat(*this);\n\n KaldiBlasInt lwork = std::max(1, 2 * num_rows - 1);\n\n CVector<Real> work(lwork);\n\n\n\n Real *rwork;\n\n void *temp;\n\n if ((rwork = static_cast<Real *>(KALDI_MEMALIGN(\n\n 16, sizeof(Real) * std::max(1, 3 * num_rows - 2), &temp))) == NULL)\n\n throw std::bad_alloc();\n\n\n\n clapack_CZheev(&num_rows, V->Data(), &stride, D->Data(), work.Data(), &lwork,\n\n rwork, &result);\n\n KALDI_MEMALIGN_FREE(rwork);\n\n\n\n if (result != 0) {\n\n if (result < 0)\n\n KALDI_ERR << \"clapack_CZheev(): \" << -result\n\n << \"-th parameter had an illegal value\";\n\n else\n\n KALDI_ERR << \"The algorithm failed to converge\";\n", "file_path": "include/complex-matrix.cc", "rank": 82, "score": 46195.27151196908 }, { "content": " // Process angle\n\n std::vector<BaseFloat> angle_tmp;\n\n if (opts_.orientation == \"\") {\n\n for (int32 i = 0; i <= 1; i++) angle_tmp.push_back(0.0);\n\n } else {\n\n KALDI_ASSERT(\n\n SplitStringToFloats(opts_.orientation, \",\", false, &angle_tmp));\n\n }\n\n if (angle_tmp.size() == 1) angle_tmp.push_back(0.0);\n\n KALDI_ASSERT(angle_tmp.size() == 2);\n\n angle_.swap(angle_tmp);\n\n\n\n // Process beta\n\n std::vector<BaseFloat> beta_tmp;\n\n KALDI_ASSERT(opts_.beta != \"\" && \"Options --beta is not configured\");\n\n KALDI_ASSERT(SplitStringToFloats(opts_.beta, \",\", false, &beta_tmp));\n\n KALDI_ASSERT(beta_tmp.size() == 1 || beta_tmp.size() == 6);\n\n if (beta_tmp.size() == 1) {\n\n // beta_tmp[0] is T60\n\n revb_time_ = beta_tmp[0];\n", "file_path": "include/rir-generator.cc", "rank": 83, "score": 46195.1430998652 }, { "content": " << \"-th parameter had an illegal value\";\n\n else\n\n KALDI_ERR << \"The algorithm failed to converge\";\n\n }\n\n}\n\n\n\ntemplate <typename Real>\n\nvoid CMatrixBase<Real>::Write(std::ostream &out, bool binary) const {\n\n if (!out.good()) {\n\n KALDI_ERR << \"Could not write complex matrix to stream cause it's not good\";\n\n }\n\n if (binary) {\n\n std::string token = (sizeof(Real) == 4 ? \"FCM\" : \"DCM\");\n\n WriteToken(out, binary, token);\n\n {\n\n int32 rows = num_rows_;\n\n int32 cols = num_cols_;\n\n KALDI_ASSERT(num_rows_ == (MatrixIndexT)rows);\n\n KALDI_ASSERT(num_cols_ == (MatrixIndexT)cols);\n\n WriteBasicType(out, binary, rows);\n", "file_path": "include/complex-matrix.cc", "rank": 84, "score": 46195.02843736004 }, { "content": "\n\n // Process source location\n\n KALDI_ASSERT(opts_.source_location != \"\" &&\n\n \"Options --source-location is not configured\");\n\n std::vector<BaseFloat> loc;\n\n KALDI_ASSERT(SplitStringToFloats(opts_.source_location, \",\", false, &loc));\n\n source_location_.CopyFromVector(loc);\n\n\n\n // Process receiver_location\n\n KALDI_ASSERT(opts_.receiver_location != \"\" &&\n\n \"Options --receiver-location is not configured\");\n\n std::vector<std::string> mics;\n\n SplitStringToVector(opts_.receiver_location, \";\", false, &mics);\n\n num_mics_ = mics.size();\n\n receiver_location_.resize(num_mics_);\n\n for (int32 i = 0; i < num_mics_; i++) {\n\n KALDI_ASSERT(SplitStringToFloats(mics[i], \",\", false, &loc));\n\n receiver_location_[i].CopyFromVector(loc);\n\n }\n\n\n", "file_path": "include/rir-generator.cc", "rank": 85, "score": 46194.89784824853 }, { "content": " ReadBasicType(in, binary, &rows);\n\n ReadBasicType(in, binary, &cols);\n\n if ((MatrixIndexT)rows != this->num_rows_ ||\n\n (MatrixIndexT)cols != this->num_cols_)\n\n this->Resize(rows, cols);\n\n\n\n if (this->stride_ == this->num_cols_ && rows * cols != 0) {\n\n in.read(reinterpret_cast<char *>(this->Data()),\n\n 2 * sizeof(Real) * rows * cols);\n\n if (in.fail()) KALDI_ERR << \"Failed to read complex matrix from stream\";\n\n } else {\n\n for (MatrixIndexT i = 0; i < (MatrixIndexT)rows; i++) {\n\n in.read(reinterpret_cast<char *>(this->RowData(i)),\n\n 2 * sizeof(Real) * cols);\n\n if (in.fail()) KALDI_ERR << \"Failed to read complex matrix from stream\";\n\n }\n\n }\n\n if (in.eof()) return;\n\n if (in.fail()) KALDI_ERR << \"Failed to read complex matrix from stream\";\n\n return;\n", "file_path": "include/complex-matrix.cc", "rank": 86, "score": 46194.54401664667 }, { "content": "inline void CVector<Real>::Init(const MatrixIndexT dim) {\n\n KALDI_ASSERT(dim >= 0);\n\n if (dim == 0) {\n\n this->dim_ = 0;\n\n this->data_ = NULL;\n\n return;\n\n }\n\n MatrixIndexT size;\n\n void *data;\n\n void *free_data;\n\n\n\n // scale by 2\n\n size = 2 * dim * sizeof(Real);\n\n\n\n if ((data = KALDI_MEMALIGN(16, size, &free_data)) != NULL) {\n\n this->data_ = static_cast<Real *>(data);\n\n this->dim_ = dim;\n\n } else {\n\n throw std::bad_alloc();\n\n }\n", "file_path": "include/complex-vector.cc", "rank": 87, "score": 46194.53350786867 }, { "content": "void CVectorBase<Real>::Abs(VectorBase<Real> *p) {\n\n KALDI_ASSERT(p->Dim() == dim_);\n\n for (MatrixIndexT i = 0; i < dim_; i++)\n\n (*p)(i) = (*this)(i, kReal) * (*this)(i, kReal) +\n\n (*this)(i, kImag) * (*this)(i, kImag);\n\n p->ApplyPow(0.5);\n\n}\n\n\n\ntemplate <typename Real>\n\nvoid CVectorBase<Real>::Exp(const VectorBase<Real> &e) {\n\n KALDI_ASSERT(dim_ == e.Dim());\n\n for (MatrixIndexT i = 0; i < dim_; i++) {\n\n (*this)(i, kReal) = std::cos(e(i));\n\n (*this)(i, kImag) = std::sin(e(i));\n\n }\n\n}\n\n\n\n// Implement of CVector\n\n\n\ntemplate <typename Real>\n", "file_path": "include/complex-vector.cc", "rank": 88, "score": 46194.390999731586 }, { "content": "void CVectorBase<Real>::CopyFromRealfft(const VectorBase<Real> &v) {\n\n KALDI_ASSERT((dim_ - 1) * 2 == v.Dim());\n\n for (MatrixIndexT i = 0; i < dim_; i++) {\n\n if (i == 0)\n\n (*this)(i, kReal) = v(0), (*this)(i, kImag) = 0;\n\n else if (i == dim_ - 1)\n\n (*this)(i, kReal) = v(1), (*this)(i, kImag) = 0;\n\n else\n\n (*this)(i, kReal) = v(i * 2), (*this)(i, kImag) = v(i * 2 + 1);\n\n }\n\n}\n\n\n\ntemplate <typename Real>\n\nvoid CVectorBase<Real>::Part(VectorBase<Real> *p, ComplexIndexType index) {\n\n KALDI_ASSERT(p->Dim() == dim_);\n\n for (MatrixIndexT i = 0; i < dim_; i++)\n\n (*p)(i) = (index == kReal ? (*this)(i, kReal) : (*this)(i, kImag));\n\n}\n\n\n\ntemplate <typename Real>\n", "file_path": "include/complex-vector.cc", "rank": 89, "score": 46194.37149830972 }, { "content": " data_ + i * 2, data_ + i * 2 + 1);\n\n else {\n\n Real abs_div =\n\n std::sqrt(v(i, kReal) * v(i, kReal) + v(i, kImag) * v(i, kImag)) +\n\n FLT_EPSILON;\n\n ComplexDiv(abs_div, static_cast<Real>(0), data_ + i * 2,\n\n data_ + i * 2 + 1);\n\n }\n\n }\n\n}\n\n\n\ntemplate <typename Real>\n\nvoid CVectorBase<Real>::AddVec(Real alpha_r, Real alpha_i,\n\n CVectorBase<Real> &v) {\n\n KALDI_ASSERT(v.dim_ == dim_);\n\n KALDI_ASSERT(&v != this);\n\n Complex<Real> alpha(alpha_r, alpha_i);\n\n cblas_CZaxpy(dim_, &alpha, v.Data(), 1, data_, 1);\n\n}\n\n\n", "file_path": "include/complex-vector.cc", "rank": 90, "score": 46194.333104668476 }, { "content": " << cache.NumCols();\n\n }\n\n CopyFromMat(cache);\n\n}\n\n\n\n// Implement for CMatrix\n\n\n\ntemplate <typename Real>\n\nvoid CMatrix<Real>::Read(std::istream &in, bool binary) {\n\n if (!binary) {\n\n KALDI_ERR << \"Could not read complex matrix in text model\";\n\n }\n\n const char *expect_token = (sizeof(Real) == 4 ? \"FCM\" : \"DCM\");\n\n std::string token;\n\n ReadToken(in, binary, &token);\n\n if (token != expect_token) {\n\n if (token.length() > 20) token = token.substr(0, 17) + \"...\";\n\n KALDI_ERR << \"Expect token \\'\" << expect_token << \"\\', but got \" << token;\n\n }\n\n int32 rows, cols;\n", "file_path": "include/complex-matrix.cc", "rank": 91, "score": 46194.25866719732 }, { "content": " out << \"\\n \";\n\n for (MatrixIndexT j = 0; j < num_cols_; j++)\n\n out << (*this)(i, j, kReal) << ((*this)(i, j, kImag) >= 0 ? \"+\" : \"\")\n\n << (*this)(i, j, kImag) << \"i \";\n\n }\n\n out << \"]\\n\";\n\n }\n\n }\n\n}\n\n\n\ntemplate <typename Real>\n\nvoid CMatrixBase<Real>::Read(std::istream &in, bool binary) {\n\n if (!binary) {\n\n KALDI_ERR << \"Could not read complex matrix in text model\";\n\n }\n\n CMatrix<Real> cache;\n\n cache.Read(in, binary);\n\n if (cache.NumRows() != NumRows() || cache.NumCols() != NumCols()) {\n\n KALDI_ERR << \"CMatrixBase<Real>::Read, size mismatch \" << NumRows() << \" x \"\n\n << NumCols() << \" versus \" << cache.NumRows() << \" x \"\n", "file_path": "include/complex-matrix.cc", "rank": 92, "score": 46194.240529984636 }, { "content": "template <typename Real>\n\nvoid CVectorBase<Real>::CopyFromVec(const CVectorBase<Real> &v,\n\n ConjugateType conj) {\n\n KALDI_ASSERT(dim_ == v.Dim());\n\n if (data_ != v.data_) {\n\n std::memcpy(this->data_, v.data_, 2 * dim_ * sizeof(Real));\n\n if (conj == kConj)\n\n for (MatrixIndexT i = 0; i < dim_; i++)\n\n if ((*this)(i, kImag) != 0) (*this)(i, kImag) *= (-1.0);\n\n }\n\n}\n\n\n\ntemplate <typename Real>\n\nvoid CVectorBase<Real>::CopyFromVec(const VectorBase<Real> &v,\n\n ComplexIndexType kIndex) {\n\n KALDI_ASSERT(dim_ == v.Dim());\n\n for (int32 i = 0; i < dim_; i++) (*this)(i, kIndex) = v(i);\n\n}\n\n\n\ntemplate <typename Real>\n", "file_path": "include/complex-vector.cc", "rank": 93, "score": 46194.20480222206 }, { "content": " this->CopyFromMat(M, index);\n\n}\n\n\n\ntemplate <typename Real>\n\nCMatrix<Real>::CMatrix(const VectorBase<Real> &v) {\n\n MatrixIndexT dim = v.Dim();\n\n KALDI_ASSERT(dim != 0);\n\n Resize(dim, dim);\n\n for (MatrixIndexT i = 0; i < dim; i++) {\n\n (*this)(i, i, kReal) = v(i);\n\n }\n\n}\n\n\n\ntemplate <typename Real>\n\nvoid CMatrix<Real>::Destroy() {\n\n if (NULL != CMatrixBase<Real>::data_)\n\n KALDI_MEMALIGN_FREE(CMatrixBase<Real>::data_);\n\n CMatrixBase<Real>::data_ = NULL;\n\n CMatrixBase<Real>::num_rows_ = CMatrixBase<Real>::num_cols_ =\n\n CMatrixBase<Real>::stride_ = 0;\n", "file_path": "include/complex-matrix.cc", "rank": 94, "score": 46194.02046002094 }, { "content": " this->stride_ = 0;\n\n this->data_ = NULL;\n\n return;\n\n }\n\n KALDI_ASSERT(rows > 0 && cols > 0);\n\n // In fact, we need 2 * cols space\n\n MatrixIndexT skip, stride, double_cols = cols * 2;\n\n size_t size;\n\n void *data; // aligned memory block\n\n void *temp; // memory block to be really freed\n\n\n\n // compute the size of skip and real cols\n\n skip = ((16 / sizeof(Real)) - double_cols % (16 / sizeof(Real))) %\n\n (16 / sizeof(Real));\n\n stride = double_cols + skip;\n\n size = static_cast<size_t>(rows) * static_cast<size_t>(stride) * sizeof(Real);\n\n\n\n // allocate the memory and set the right dimensions and parameters\n\n if (NULL != (data = KALDI_MEMALIGN(16, size, &temp))) {\n\n CMatrixBase<Real>::data_ = static_cast<Real *>(data);\n", "file_path": "include/complex-matrix.cc", "rank": 95, "score": 46193.92782090544 }, { "content": " int32 index = std::min(std::max(t + c, 0), spectra->NumRows() - 1);\n\n SubCVector<BaseFloat> ctx(*spectra, index);\n\n smooth_spectra.Row(t).AddVec(1, 0, ctx);\n\n }\n\n }\n\n smooth_spectra.Scale(1.0 / (2 * context + 1), 0);\n\n spectra->CopyFromMat(smooth_spectra);\n\n}\n\n\n\n} // kaldi\n", "file_path": "include/srp-phat.cc", "rank": 96, "score": 46193.90564930538 }, { "content": " if (num_rows_ == 0) return;\n\n AdjustIn();\n\n Complex<Real> alpha(alpha_r - alpha_i, alpha_r + alpha_i);\n\n cblas_CZger(a.Dim(), b.Dim(), &alpha, a.Data(), 1, b.Data(), 1, data_,\n\n stride_, (conj == kConj ? true : false));\n\n AdjustOut();\n\n}\n\n\n\ntemplate <typename Real>\n\nvoid CMatrixBase<Real>::AddMat(const Real alpha_r, const Real alpha_i,\n\n const CMatrixBase<Real> &M,\n\n MatrixTransposeType trans) {\n\n KALDI_ASSERT(&M != this);\n\n Complex<Real> alpha(alpha_r - alpha_i, alpha_r + alpha_i);\n\n Real *mdata = M.data_;\n\n MatrixIndexT mstride = M.stride_;\n\n AdjustIn();\n\n if (trans == kNoTrans) {\n\n KALDI_ASSERT(M.num_cols_ == num_cols_ && M.num_rows_ == num_rows_);\n\n if (num_rows_ == 0) return;\n", "file_path": "include/complex-matrix.cc", "rank": 97, "score": 46193.88340429702 }, { "content": "void CMatrixBase<Real>::Abs(MatrixBase<Real> *P) {\n\n KALDI_ASSERT(P->NumCols() == num_rows_ && P->NumRows() == num_cols_);\n\n for (MatrixIndexT i = 0; i < num_rows_; i++)\n\n for (MatrixIndexT j = 0; j < num_cols_; j++)\n\n (*P)(i, j) = (*this)(i, j, kReal) * (*this)(i, j, kReal) +\n\n (*this)(i, j, kImag) * (*this)(i, j, kImag);\n\n P->ApplyPow(0.5);\n\n}\n\n\n\ntemplate <typename Real>\n\nvoid CMatrixBase<Real>::Exp(const MatrixBase<Real> &E) {\n\n KALDI_ASSERT(E.NumRows() == num_rows_ && E.NumCols() == num_cols_);\n\n for (MatrixIndexT i = 0; i < num_rows_; i++)\n\n for (MatrixIndexT j = 0; j < num_cols_; j++) {\n\n (*this)(i, j, kReal) = std::cos(E(i, j));\n\n (*this)(i, j, kImag) = std::sin(E(i, j));\n\n }\n\n}\n\n\n\ntemplate <typename Real>\n", "file_path": "include/complex-matrix.cc", "rank": 98, "score": 46193.86886786881 }, { "content": " for (MatrixIndexT j = 0; j < num_cols_; j++) (*this)(i, j, index) = M(i, j);\n\n}\n\n\n\ntemplate <typename Real>\n\nvoid CMatrixBase<Real>::CopyFromMat(const CMatrixBase<Real> &M,\n\n MatrixTransposeType Trans) {\n\n if (static_cast<const void *>(M.Data()) ==\n\n static_cast<const void *>(this->Data())) {\n\n KALDI_ASSERT((Trans == kNoTrans || Trans == kConjNoTrans) &&\n\n M.NumRows() == NumRows() && M.NumCols() == NumCols() &&\n\n M.Stride() == Stride());\n\n return;\n\n }\n\n if (Trans == kNoTrans || Trans == kConjNoTrans) {\n\n KALDI_ASSERT(num_rows_ == M.NumRows() && num_cols_ == M.NumCols());\n\n for (MatrixIndexT i = 0; i < num_rows_; i++) {\n\n (*this).Row(i).CopyFromVec(M.Row(i));\n\n if (Trans == kConjNoTrans) (*this).Row(i).Conjugate();\n\n }\n\n } else {\n", "file_path": "include/complex-matrix.cc", "rank": 99, "score": 46193.8544629513 } ]
C++
security/keystore-engine/rsa_meth.cpp
Keneral/asystem
df12381b72ef3d629c8efc61100cc8c714195320
#include <UniquePtr.h> #define LOG_TAG "OpenSSL-keystore-rsa" #include <cutils/log.h> #include <binder/IServiceManager.h> #include <keystore/IKeystoreService.h> #include <openssl/rsa.h> #include <openssl/engine.h> #include "methods.h" using namespace android; int keystore_rsa_priv_enc(int flen, const unsigned char* from, unsigned char* to, RSA* rsa, int padding) { ALOGV("keystore_rsa_priv_enc(%d, %p, %p, %p, %d)", flen, from, to, rsa, padding); int num = RSA_size(rsa); UniquePtr<uint8_t> padded(new uint8_t[num]); if (padded.get() == NULL) { ALOGE("could not allocate padded signature"); return 0; } switch (padding) { case RSA_PKCS1_PADDING: if (!RSA_padding_add_PKCS1_type_1(padded.get(), num, from, flen)) { return 0; } break; case RSA_X931_PADDING: if (!RSA_padding_add_X931(padded.get(), num, from, flen)) { return 0; } break; case RSA_NO_PADDING: if (!RSA_padding_add_none(padded.get(), num, from, flen)) { return 0; } break; default: ALOGE("Unknown padding type: %d", padding); return 0; } uint8_t* key_id = reinterpret_cast<uint8_t*>(RSA_get_ex_data(rsa, rsa_key_handle)); if (key_id == NULL) { ALOGE("key had no key_id!"); return 0; } sp<IServiceManager> sm = defaultServiceManager(); sp<IBinder> binder = sm->getService(String16("android.security.keystore")); sp<IKeystoreService> service = interface_cast<IKeystoreService>(binder); if (service == NULL) { ALOGE("could not contact keystore"); return 0; } uint8_t* reply = NULL; size_t replyLen; int32_t ret = service->sign(String16(reinterpret_cast<const char*>(key_id)), padded.get(), num, &reply, &replyLen); if (ret < 0) { ALOGW("There was an error during signing: could not connect"); free(reply); return 0; } else if (ret != 0) { ALOGW("Error during signing from keystore: %d", ret); free(reply); return 0; } else if (replyLen <= 0) { ALOGW("No valid signature returned"); return 0; } memcpy(to, reply, replyLen); free(reply); ALOGV("rsa=%p keystore_rsa_priv_enc => returning %p len %llu", rsa, to, (unsigned long long) replyLen); return static_cast<int>(replyLen); } int keystore_rsa_priv_dec(int flen, const unsigned char* from, unsigned char* to, RSA* rsa, int padding) { ALOGV("keystore_rsa_priv_dec(%d, %p, %p, %p, %d)", flen, from, to, rsa, padding); uint8_t* key_id = reinterpret_cast<uint8_t*>(RSA_get_ex_data(rsa, rsa_key_handle)); if (key_id == NULL) { ALOGE("key had no key_id!"); return 0; } sp<IServiceManager> sm = defaultServiceManager(); sp<IBinder> binder = sm->getService(String16("android.security.keystore")); sp<IKeystoreService> service = interface_cast<IKeystoreService>(binder); if (service == NULL) { ALOGE("could not contact keystore"); return 0; } int num = RSA_size(rsa); uint8_t* reply = NULL; size_t replyLen; int32_t ret = service->sign(String16(reinterpret_cast<const char*>(key_id)), from, flen, &reply, &replyLen); if (ret < 0) { ALOGW("There was an error during rsa_mod_exp: could not connect"); return 0; } else if (ret != 0) { ALOGW("Error during sign from keystore: %d", ret); return 0; } else if (replyLen <= 0) { ALOGW("No valid signature returned"); return 0; } uint8_t* alignedReply; if (*reply == 0x00) { alignedReply = reply + 1; replyLen--; } else { alignedReply = reply; } int outSize; switch (padding) { case RSA_PKCS1_PADDING: outSize = RSA_padding_check_PKCS1_type_2(to, num, alignedReply, replyLen, num); break; case RSA_X931_PADDING: outSize = RSA_padding_check_X931(to, num, alignedReply, replyLen, num); break; case RSA_NO_PADDING: outSize = RSA_padding_check_none(to, num, alignedReply, replyLen, num); break; default: ALOGE("Unknown padding type: %d", padding); outSize = -1; break; } free(reply); ALOGV("rsa=%p keystore_rsa_priv_dec => returning %p len %d", rsa, to, outSize); return outSize; } static RSA_METHOD keystore_rsa_meth = { kKeystoreEngineId, NULL, NULL, keystore_rsa_priv_enc, keystore_rsa_priv_dec, NULL, NULL, NULL, NULL, RSA_FLAG_EXT_PKEY | RSA_FLAG_NO_BLINDING, NULL, NULL, NULL, NULL, }; static int register_rsa_methods() { const RSA_METHOD* rsa_meth = RSA_PKCS1_SSLeay(); keystore_rsa_meth.rsa_pub_enc = rsa_meth->rsa_pub_enc; keystore_rsa_meth.rsa_pub_dec = rsa_meth->rsa_pub_dec; keystore_rsa_meth.rsa_mod_exp = rsa_meth->rsa_mod_exp; keystore_rsa_meth.bn_mod_exp = rsa_meth->bn_mod_exp; return 1; } int rsa_pkey_setup(ENGINE *e, EVP_PKEY *pkey, const char *key_id) { Unique_RSA rsa(EVP_PKEY_get1_RSA(pkey)); if (!RSA_set_ex_data(rsa.get(), rsa_key_handle, reinterpret_cast<void*>(strdup(key_id)))) { ALOGW("Could not set ex_data for loaded RSA key"); return 0; } RSA_set_method(rsa.get(), &keystore_rsa_meth); RSA_blinding_off(rsa.get()); ENGINE_init(e); rsa->engine = e; rsa->flags |= RSA_FLAG_EXT_PKEY; return 1; } int rsa_register(ENGINE* e) { if (!ENGINE_set_RSA(e, &keystore_rsa_meth) || !register_rsa_methods()) { ALOGE("Could not set up keystore RSA methods"); return 0; } return 1; }
#include <UniquePtr.h> #define LOG_TAG "OpenSSL-keystore-rsa" #include <cutils/log.h> #include <binder/IServiceManager.h> #include <keystore/IKeystoreService.h> #include <openssl/rsa.h> #include <openssl/engine.h> #include "methods.h" using namespace android; int keystore_rsa_priv_enc(int flen, const unsigned char* from, unsigned char* to, RSA* rsa, int padding) { ALOGV("keystore_rsa_priv_enc(%d, %p, %p, %p, %d)", flen, from, to, rsa, padding); int num = RSA_size(rsa); UniquePtr<uint8_t> padded(new uint8_t[num]); if (padded.get() == NULL) { ALOGE("could not allocate padded signature"); return 0; } switch (padding) { case RSA_PKCS1_PADDING: if (!RSA_padding_add_PKCS1_type_1(padded.get(), num, from, flen)) { return 0; } break; case RSA_X931_PADDING: if (!RSA_padding_add_X931(padded.get(), num, from, flen)) { return 0; } break; case RSA_NO_PADDING: if (!RSA_padding_add_none(padded.get(), num, from, flen)) { return 0; } break; default: ALOGE("Unknown padding type: %d", padding); return 0; } uint8_t* key_id = reinterpret_cast<uint8_t*>(RSA_get_ex_data(rsa, rsa_key_handle)); if (key_id == NULL) { ALOGE("key had no key_id!"); return 0; } sp<IServiceManager> sm = defaultServiceManager(); sp<IBinder> binder = sm->getService(String16("android.security.keystore")); sp<IKeystoreService> service = interface_cast<IKeystoreService>(binder); if (service == NULL) { ALOGE("could not contact keystore"); return 0; } uint8_t* reply = NULL; size_t replyLen; int32_t ret = service->sign(String16(reinterpret_cast<const char*>(key_id)), padded.get(), num, &reply, &replyLen); if (ret < 0) { ALOGW("There was an error during signing: could not connect"); free(reply); return 0; } else if (ret != 0) { ALOGW("Error during signing from keystore: %d", ret); free(reply); return 0; } else if (replyLen <= 0) { ALOGW("No valid signature returned"); return 0; } memcpy(to, reply, replyLen); free(reply); ALOGV("rsa=%p keystore_rsa_priv_enc => returning %p len %llu", rsa, to, (unsigned long long) replyLen); return static_cast<int>(replyLen); } int keystore_rsa_priv_dec(int flen, const unsigned char* from, unsigned char* to, RSA* rsa, int padding) { ALOGV("keystore_rsa_priv_dec(%d, %p, %p, %p, %d)", flen, from, to, rsa, padding); uint8_t* key_id = reinterpret_cast<uint8_t*>(RSA_get_ex_data(rsa, rsa_key_handle)); if (key_id == NULL) { ALOGE("key had no key_id!"); return 0; } sp<IServiceManager> sm = defaultServiceManager(); sp<IBinder> binder = sm->getService(String16("android.security.keystore")); sp<IKeystoreService> service = interface_cast<IKeystoreService>(binder); if (service == NULL) { ALOGE("could not contact keystore"); return 0; } int num = RSA_size(rsa); uint8_t* reply = NULL; size_t replyLen; int32_t ret = service->sign(String16(reinterpret_cast<const char*>(key_id)), from, flen, &reply, &replyLen); if (ret < 0) { ALOGW("There was an error during rsa_mod_exp: could not connect"); return 0; } else if (ret != 0) { ALOGW("Error during sign from keystore: %d", ret); return 0; } else if (replyLen <= 0) { ALOGW("No valid signature returned"); return 0; } uint8_t* alignedReply; if (*reply == 0x00) { alignedReply = reply + 1; replyLen--; } else { alignedReply = reply; } int outSize; switch (padding) { case RSA_PKCS1_PADDING: outSize = RSA_padding_check_PKCS1_type_2(to, num, alignedReply, replyLen, num); break; case RSA_X931_PADDING: outSize = RSA_padding_check_X931(to, num, alignedReply, replyLen, num); break; case RSA_NO_PADDING: outSize = RSA_padding_check_none(to, num, alignedReply, replyLen, num); break; default: ALOGE("Unknown padding type: %d", padding); outSize = -1; break; } free(reply); ALOGV("rsa=%p keystore_rsa_priv_dec => returning %p len %d", rsa, to, outSize); return outSize; }
static int register_rsa_methods() { const RSA_METHOD* rsa_meth = RSA_PKCS1_SSLeay(); keystore_rsa_meth.rsa_pub_enc = rsa_meth->rsa_pub_enc; keystore_rsa_meth.rsa_pub_dec = rsa_meth->rsa_pub_dec; keystore_rsa_meth.rsa_mod_exp = rsa_meth->rsa_mod_exp; keystore_rsa_meth.bn_mod_exp = rsa_meth->bn_mod_exp; return 1; } int rsa_pkey_setup(ENGINE *e, EVP_PKEY *pkey, const char *key_id) { Unique_RSA rsa(EVP_PKEY_get1_RSA(pkey)); if (!RSA_set_ex_data(rsa.get(), rsa_key_handle, reinterpret_cast<void*>(strdup(key_id)))) { ALOGW("Could not set ex_data for loaded RSA key"); return 0; } RSA_set_method(rsa.get(), &keystore_rsa_meth); RSA_blinding_off(rsa.get()); ENGINE_init(e); rsa->engine = e; rsa->flags |= RSA_FLAG_EXT_PKEY; return 1; } int rsa_register(ENGINE* e) { if (!ENGINE_set_RSA(e, &keystore_rsa_meth) || !register_rsa_methods()) { ALOGE("Could not set up keystore RSA methods"); return 0; } return 1; }
static RSA_METHOD keystore_rsa_meth = { kKeystoreEngineId, NULL, NULL, keystore_rsa_priv_enc, keystore_rsa_priv_dec, NULL, NULL, NULL, NULL, RSA_FLAG_EXT_PKEY | RSA_FLAG_NO_BLINDING, NULL, NULL, NULL, NULL, };
assignment_statement
[ { "content": "class TypeNamespace : public ::android::aidl::LanguageTypeNamespace<Type> {\n\n public:\n\n TypeNamespace() = default;\n\n virtual ~TypeNamespace() = default;\n\n\n\n void Init() override;\n\n bool AddParcelableType(const AidlParcelable& p,\n\n const std::string& filename) override;\n\n bool AddBinderType(const AidlInterface& b,\n\n const std::string& filename) override;\n\n bool AddListType(const std::string& type_name) override;\n\n bool AddMapType(const std::string& key_type_name,\n\n const std::string& value_type_name) override;\n\n\n\n bool IsValidPackage(const std::string& package) const override;\n\n const ValidatableType* GetArgType(const AidlArgument& a,\n\n int arg_index,\n\n const std::string& filename) const override;\n\n\n\n const Type* VoidType() const { return void_type_; }\n", "file_path": "tools/aidl/type_cpp.h", "rank": 0, "score": 266703.43524065777 }, { "content": "class Error;\n", "file_path": "connectivity/shill/service.h", "rank": 1, "score": 260019.31440555697 }, { "content": "namespace android {\n\nnamespace base {\n\n\n\n// Returns a string describing the given system error code. |error_code| must\n\n// be errno on Unix or GetLastError()/WSAGetLastError() on Windows. Passing\n\n// errno on Windows has undefined behavior.\n\nstd::string SystemErrorCodeToString(int error_code);\n\n\n\n} // namespace base\n", "file_path": "core/base/include/android-base/errors.h", "rank": 2, "score": 257253.23654346276 }, { "content": "class Error;\n", "file_path": "connectivity/shill/service_under_test.h", "rank": 3, "score": 253778.04562665254 }, { "content": " int len; /* Length of n[] in number of uint32_t */\n", "file_path": "core/include/mincrypt/rsa.h", "rank": 4, "score": 249679.80140348471 }, { "content": "namespace android {\n\n\n\n// use this type to return error codes\n\n#ifdef _WIN32\n\ntypedef int status_t;\n\n#else\n\ntypedef int32_t status_t;\n\n#endif\n\n\n\n/* the MS C runtime lacks a few error codes */\n\n\n\n/*\n\n * Error codes. \n\n * All error codes are negative values.\n\n */\n\n\n\n// Win32 #defines NO_ERROR as well. It has the same value, so there's no\n\n// real conflict, though it's a bit awkward.\n\n#ifdef _WIN32\n\n# undef NO_ERROR\n\n#endif\n\n\n\nenum {\n\n OK = 0, // Everything's swell.\n\n NO_ERROR = 0, // No errors.\n\n\n\n UNKNOWN_ERROR = (-2147483647-1), // INT32_MIN value\n\n\n\n NO_MEMORY = -ENOMEM,\n\n INVALID_OPERATION = -ENOSYS,\n\n BAD_VALUE = -EINVAL,\n\n BAD_TYPE = (UNKNOWN_ERROR + 1),\n\n NAME_NOT_FOUND = -ENOENT,\n\n PERMISSION_DENIED = -EPERM,\n\n NO_INIT = -ENODEV,\n\n ALREADY_EXISTS = -EEXIST,\n\n DEAD_OBJECT = -EPIPE,\n\n FAILED_TRANSACTION = (UNKNOWN_ERROR + 2),\n\n#if !defined(_WIN32)\n\n BAD_INDEX = -EOVERFLOW,\n\n NOT_ENOUGH_DATA = -ENODATA,\n\n WOULD_BLOCK = -EWOULDBLOCK, \n\n TIMED_OUT = -ETIMEDOUT,\n\n UNKNOWN_TRANSACTION = -EBADMSG,\n\n#else \n\n BAD_INDEX = -E2BIG,\n\n NOT_ENOUGH_DATA = (UNKNOWN_ERROR + 3),\n\n WOULD_BLOCK = (UNKNOWN_ERROR + 4),\n\n TIMED_OUT = (UNKNOWN_ERROR + 5),\n\n UNKNOWN_TRANSACTION = (UNKNOWN_ERROR + 6),\n\n#endif \n\n FDS_NOT_ALLOWED = (UNKNOWN_ERROR + 7),\n\n UNEXPECTED_NULL = (UNKNOWN_ERROR + 8),\n\n};\n\n\n\n// Restore define; enumeration is in \"android\" namespace, so the value defined\n\n// there won't work for Win32 code in a different namespace.\n\n#ifdef _WIN32\n\n# define NO_ERROR 0L\n\n#endif\n\n\n", "file_path": "core/include/utils/Errors.h", "rank": 5, "score": 249604.2293829963 }, { "content": "class BinderUpdateEngineAndroidService : public android::os::BnUpdateEngine,\n\n public ServiceObserverInterface {\n\n public:\n\n BinderUpdateEngineAndroidService(\n\n ServiceDelegateAndroidInterface* service_delegate);\n\n ~BinderUpdateEngineAndroidService() override = default;\n\n\n\n const char* ServiceName() const {\n\n return \"android.os.UpdateEngineService\";\n\n }\n\n\n\n // ServiceObserverInterface overrides.\n\n void SendStatusUpdate(int64_t last_checked_time,\n\n double progress,\n\n update_engine::UpdateStatus status,\n\n const std::string& new_version,\n\n int64_t new_size) override;\n\n void SendPayloadApplicationComplete(ErrorCode error_code) override;\n\n\n\n // Channel tracking changes are ignored.\n", "file_path": "update_engine/binder_service_android.h", "rank": 6, "score": 248181.52816728954 }, { "content": "class Error;\n", "file_path": "connectivity/shill/pppoe/pppoe_service.h", "rank": 7, "score": 247892.9835879826 }, { "content": "class Error;\n", "file_path": "connectivity/shill/wifi/wifi_service.h", "rank": 8, "score": 247892.9835879826 }, { "content": "class Error;\n", "file_path": "connectivity/shill/cellular/cellular_service.h", "rank": 9, "score": 247892.9835879826 }, { "content": " UINT16 len;\n", "file_path": "bt/stack/include/bt_types.h", "rank": 10, "score": 244624.8926904695 }, { "content": "namespace android {\n\n\n\n/*\n\n * Types traits\n\n */\n\n\n\ntemplate <typename T> struct trait_trivial_ctor { enum { value = false }; };\n\ntemplate <typename T> struct trait_trivial_dtor { enum { value = false }; };\n\ntemplate <typename T> struct trait_trivial_copy { enum { value = false }; };\n\ntemplate <typename T> struct trait_trivial_move { enum { value = false }; };\n\ntemplate <typename T> struct trait_pointer { enum { value = false }; }; \n", "file_path": "core/include/utils/TypeHelpers.h", "rank": 11, "score": 244555.12707401477 }, { "content": " class BinderServiceInternal : public android::trunks::BnTrunks {\n\n public:\n\n BinderServiceInternal(TrunksBinderService* service);\n\n ~BinderServiceInternal() override = default;\n\n\n\n // ITrunks interface.\n\n android::binder::Status SendCommand(\n\n const std::vector<uint8_t>& command,\n\n const android::sp<android::trunks::ITrunksClient>& client) override;\n\n android::binder::Status SendCommandAndWait(\n\n const std::vector<uint8_t>& command,\n\n std::vector<uint8_t>* response) override;\n\n\n\n private:\n\n void OnResponse(const android::sp<android::trunks::ITrunksClient>& client,\n\n const std::string& response);\n\n\n\n base::WeakPtr<BinderServiceInternal> GetWeakPtr() {\n\n return weak_factory_.GetWeakPtr();\n\n }\n", "file_path": "tpm/trunks/trunks_binder_service.h", "rank": 12, "score": 230718.3678488504 }, { "content": "// An implementation of android::weave::IWeaveService binder.\n\n// This object is a proxy for weave::Device. A new instance of weave service is\n\n// created for each connected client. As soon as the client disconnects, this\n\n// object takes care of cleaning up that client's resources (e.g. it removes\n\n// the components and their state added by the client).\n\nclass BinderWeaveService final : public android::weave::BnWeaveService {\n\n public:\n\n BinderWeaveService(weave::Device* device,\n\n android::sp<android::weave::IWeaveClient> client);\n\n ~BinderWeaveService() override;\n\n\n\n private:\n\n // Binder methods for android::weave::IWeaveService:\n\n android::binder::Status addComponent(\n\n const android::String16& name,\n\n const std::vector<android::String16>& traits) override;\n\n android::binder::Status registerCommandHandler(\n\n const android::String16& component,\n\n const android::String16& command) override;\n\n android::binder::Status updateState(\n\n const android::String16& component,\n\n const android::String16& state) override;\n\n\n\n void OnCommand(const std::string& component_name,\n\n const std::string& command_name,\n", "file_path": "weaved/buffet/binder_weave_service.h", "rank": 13, "score": 230274.3836779408 }, { "content": "class IKeystoreService: public IInterface {\n\npublic:\n\n enum {\n\n GET_STATE = IBinder::FIRST_CALL_TRANSACTION + 0,\n\n GET = IBinder::FIRST_CALL_TRANSACTION + 1,\n\n INSERT = IBinder::FIRST_CALL_TRANSACTION + 2,\n\n DEL = IBinder::FIRST_CALL_TRANSACTION + 3,\n\n EXIST = IBinder::FIRST_CALL_TRANSACTION + 4,\n\n LIST = IBinder::FIRST_CALL_TRANSACTION + 5,\n\n RESET = IBinder::FIRST_CALL_TRANSACTION + 6,\n\n ON_USER_PASSWORD_CHANGED = IBinder::FIRST_CALL_TRANSACTION + 7,\n\n LOCK = IBinder::FIRST_CALL_TRANSACTION + 8,\n\n UNLOCK = IBinder::FIRST_CALL_TRANSACTION + 9,\n\n IS_EMPTY = IBinder::FIRST_CALL_TRANSACTION + 10,\n\n GENERATE = IBinder::FIRST_CALL_TRANSACTION + 11,\n\n IMPORT = IBinder::FIRST_CALL_TRANSACTION + 12,\n\n SIGN = IBinder::FIRST_CALL_TRANSACTION + 13,\n\n VERIFY = IBinder::FIRST_CALL_TRANSACTION + 14,\n\n GET_PUBKEY = IBinder::FIRST_CALL_TRANSACTION + 15,\n\n GRANT = IBinder::FIRST_CALL_TRANSACTION + 16,\n", "file_path": "security/keystore/include/keystore/IKeystoreService.h", "rank": 14, "score": 228285.04813066148 }, { "content": "class Service;\n\n\n", "file_path": "connectivity/shill/binder/service_binder_adaptor.h", "rank": 15, "score": 227551.00754983787 }, { "content": "class BnKeystoreService: public BnInterface<IKeystoreService> {\n\npublic:\n\n virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply,\n\n uint32_t flags = 0);\n\n};\n\n\n\n} // namespace android\n\n\n\n#endif\n", "file_path": "security/keystore/include/keystore/IKeystoreService.h", "rank": 16, "score": 227237.47093182182 }, { "content": "// Subclass of DBusAdaptor for Service objects\n\n// There is a 1:1 mapping between Service and ServiceBinderAdaptor\n\n// instances. Furthermore, the Service owns the ServiceBinderAdaptor\n\n// and manages its lifetime, so we're OK with ServiceBinderAdaptor\n\n// having a bare pointer to its owner service.\n\nclass ServiceBinderAdaptor\n\n : public android::system::connectivity::shill::BnService,\n\n public BinderAdaptor,\n\n public ServiceAdaptorInterface {\n\n public:\n\n ServiceBinderAdaptor(Service* service, const std::string& id);\n\n ~ServiceBinderAdaptor() override;\n\n\n\n // Implementation of ServiceAdaptorInterface.\n\n const std::string& GetRpcIdentifier() override { return id(); }\n\n void EmitBoolChanged(const std::string& name, bool value) override;\n\n void EmitUint8Changed(const std::string& name, uint8_t value) override;\n\n void EmitUint16Changed(const std::string& name, uint16_t value) override;\n\n void EmitUint16sChanged(const std::string& name,\n\n const Uint16s& value) override;\n\n void EmitUintChanged(const std::string& name, uint32_t value) override;\n\n void EmitIntChanged(const std::string& name, int value) override;\n\n void EmitRpcIdentifierChanged(\n\n const std::string& name, const std::string& value) override;\n\n void EmitStringChanged(\n", "file_path": "connectivity/shill/binder/service_binder_adaptor.h", "rank": 17, "score": 226742.9602329035 }, { "content": "/*\n\n * Copyright (C) 2012 The Android Open Source Project\n\n *\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef KEYSTORE_IKEYSTORESERVICE_H\n\n#define KEYSTORE_IKEYSTORESERVICE_H\n\n\n\n#include <hardware/keymaster_defs.h>\n\n#include <utils/RefBase.h>\n\n#include <binder/IInterface.h>\n\n#include <binder/Parcel.h>\n\n#include <vector>\n\n\n\nnamespace android {\n\n\n", "file_path": "security/keystore/include/keystore/IKeystoreService.h", "rank": 18, "score": 224259.03846911452 }, { "content": " virtual int32_t lock(int32_t userId) = 0;\n\n\n\n virtual int32_t unlock(int32_t userId, const String16& password) = 0;\n\n\n\n virtual bool isEmpty(int32_t userId) = 0;\n\n\n\n virtual int32_t generate(const String16& name, int32_t uid, int32_t keyType, int32_t keySize,\n\n int32_t flags, Vector<sp<KeystoreArg> >* args) = 0;\n\n\n\n virtual int32_t import(const String16& name, const uint8_t* data, size_t length, int uid,\n\n int32_t flags) = 0;\n\n\n\n virtual int32_t sign(const String16& name, const uint8_t* data, size_t length, uint8_t** out,\n\n size_t* outLength) = 0;\n\n\n\n virtual int32_t verify(const String16& name, const uint8_t* data, size_t dataLength,\n\n const uint8_t* signature, size_t signatureLength) = 0;\n\n\n\n virtual int32_t get_pubkey(const String16& name, uint8_t** pubkey, size_t* pubkeyLength) = 0;\n\n\n", "file_path": "security/keystore/include/keystore/IKeystoreService.h", "rank": 19, "score": 224245.66058849837 }, { "content": "\n\n DECLARE_META_INTERFACE(KeystoreService);\n\n\n\n virtual int32_t getState(int32_t userId) = 0;\n\n\n\n virtual int32_t get(const String16& name, int32_t uid, uint8_t** item, size_t* itemLength) = 0;\n\n\n\n virtual int32_t insert(const String16& name, const uint8_t* item, size_t itemLength, int uid,\n\n int32_t flags) = 0;\n\n\n\n virtual int32_t del(const String16& name, int uid) = 0;\n\n\n\n virtual int32_t exist(const String16& name, int uid) = 0;\n\n\n\n virtual int32_t list(const String16& prefix, int uid, Vector<String16>* matches) = 0;\n\n\n\n virtual int32_t reset() = 0;\n\n\n\n virtual int32_t onUserPasswordChanged(int32_t userId, const String16& newPassword) = 0;\n\n\n", "file_path": "security/keystore/include/keystore/IKeystoreService.h", "rank": 20, "score": 224238.5193407059 }, { "content": " const uint8_t* data, size_t dataLength, OperationResult* result) = 0;\n\n\n\n virtual void finish(const sp<IBinder>& token, const KeymasterArguments& params,\n\n const uint8_t* signature, size_t signatureLength,\n\n const uint8_t* entropy, size_t entropyLength,\n\n OperationResult* result) = 0;\n\n\n\n virtual int32_t abort(const sp<IBinder>& handle) = 0;\n\n\n\n virtual bool isOperationAuthorized(const sp<IBinder>& handle) = 0;\n\n\n\n virtual int32_t addAuthToken(const uint8_t* token, size_t length) = 0;\n\n\n\n virtual int32_t onUserAdded(int32_t userId, int32_t parentId) = 0;\n\n\n\n virtual int32_t onUserRemoved(int32_t userId) = 0;\n\n\n\n virtual int32_t attestKey(const String16& name, const KeymasterArguments& params,\n\n KeymasterCertificateChain* outChain) = 0;\n\n\n\n};\n\n\n\n// ----------------------------------------------------------------------------\n\n\n", "file_path": "security/keystore/include/keystore/IKeystoreService.h", "rank": 21, "score": 224234.5705421362 }, { "content": " const keymaster_blob_t* clientId,\n\n const keymaster_blob_t* appData,\n\n int32_t uid,\n\n KeyCharacteristics* outCharacteristics) = 0;\n\n\n\n virtual int32_t importKey(const String16& name, const KeymasterArguments& params,\n\n keymaster_key_format_t format, const uint8_t *keyData,\n\n size_t keyLength, int uid, int flags,\n\n KeyCharacteristics* outCharacteristics) = 0;\n\n\n\n virtual void exportKey(const String16& name, keymaster_key_format_t format,\n\n const keymaster_blob_t* clientId,\n\n const keymaster_blob_t* appData, int32_t uid, ExportResult* result) = 0;\n\n\n\n virtual void begin(const sp<IBinder>& apptoken, const String16& name,\n\n keymaster_purpose_t purpose, bool pruneable,\n\n const KeymasterArguments& params, const uint8_t* entropy,\n\n size_t entropyLength, int32_t uid, OperationResult* result) = 0;\n\n\n\n virtual void update(const sp<IBinder>& token, const KeymasterArguments& params,\n", "file_path": "security/keystore/include/keystore/IKeystoreService.h", "rank": 22, "score": 224232.95835295794 }, { "content": " virtual int32_t grant(const String16& name, int32_t granteeUid) = 0;\n\n\n\n virtual int32_t ungrant(const String16& name, int32_t granteeUid) = 0;\n\n\n\n virtual int64_t getmtime(const String16& name, int32_t uid) = 0;\n\n\n\n virtual int32_t duplicate(const String16& srcKey, int32_t srcUid, const String16& destKey,\n\n int32_t destUid) = 0;\n\n\n\n virtual int32_t is_hardware_backed(const String16& keyType) = 0;\n\n\n\n virtual int32_t clear_uid(int64_t uid) = 0;\n\n\n\n virtual int32_t addRngEntropy(const uint8_t* data, size_t dataLength) = 0;\n\n\n\n virtual int32_t generateKey(const String16& name, const KeymasterArguments& params,\n\n const uint8_t* entropy, size_t entropyLength, int uid, int flags,\n\n KeyCharacteristics* outCharacteristics) = 0;\n\n\n\n virtual int32_t getKeyCharacteristics(const String16& name,\n", "file_path": "security/keystore/include/keystore/IKeystoreService.h", "rank": 23, "score": 224231.41415752587 }, { "content": " UNGRANT = IBinder::FIRST_CALL_TRANSACTION + 17,\n\n GETMTIME = IBinder::FIRST_CALL_TRANSACTION + 18,\n\n DUPLICATE = IBinder::FIRST_CALL_TRANSACTION + 19,\n\n IS_HARDWARE_BACKED = IBinder::FIRST_CALL_TRANSACTION + 20,\n\n CLEAR_UID = IBinder::FIRST_CALL_TRANSACTION + 21,\n\n ADD_RNG_ENTROPY = IBinder::FIRST_CALL_TRANSACTION + 22,\n\n GENERATE_KEY = IBinder::FIRST_CALL_TRANSACTION + 23,\n\n GET_KEY_CHARACTERISTICS = IBinder::FIRST_CALL_TRANSACTION + 24,\n\n IMPORT_KEY = IBinder::FIRST_CALL_TRANSACTION + 25,\n\n EXPORT_KEY = IBinder::FIRST_CALL_TRANSACTION + 26,\n\n BEGIN = IBinder::FIRST_CALL_TRANSACTION + 27,\n\n UPDATE = IBinder::FIRST_CALL_TRANSACTION + 28,\n\n FINISH = IBinder::FIRST_CALL_TRANSACTION + 29,\n\n ABORT = IBinder::FIRST_CALL_TRANSACTION + 30,\n\n IS_OPERATION_AUTHORIZED = IBinder::FIRST_CALL_TRANSACTION + 31,\n\n ADD_AUTH_TOKEN = IBinder::FIRST_CALL_TRANSACTION + 32,\n\n ON_USER_ADDED = IBinder::FIRST_CALL_TRANSACTION + 33,\n\n ON_USER_REMOVED = IBinder::FIRST_CALL_TRANSACTION + 34,\n\n ATTEST_KEY = IBinder::FIRST_CALL_TRANSACTION + 35,\n\n };\n", "file_path": "security/keystore/include/keystore/IKeystoreService.h", "rank": 24, "score": 224229.96435952233 }, { "content": "class BinderUpdateEngineBrilloService : public android::brillo::BnUpdateEngine,\n\n public ServiceObserverInterface {\n\n public:\n\n explicit BinderUpdateEngineBrilloService(SystemState* system_state)\n\n : common_(new UpdateEngineService(system_state)) {}\n\n virtual ~BinderUpdateEngineBrilloService() = default;\n\n\n\n const char* ServiceName() const {\n\n return \"android.brillo.UpdateEngineService\";\n\n }\n\n\n\n // ServiceObserverInterface overrides.\n\n void SendStatusUpdate(int64_t last_checked_time,\n\n double progress,\n\n update_engine::UpdateStatus status,\n\n const std::string& new_version,\n\n int64_t new_size) override;\n\n void SendPayloadApplicationComplete(ErrorCode error_code) override {}\n\n // Channel tracking changes are ignored.\n\n void SendChannelChangeUpdate(const std::string& tracking_channel) override {}\n", "file_path": "update_engine/binder_service_brillo.h", "rank": 25, "score": 220318.7279616672 }, { "content": " const std::string& name, const std::string& value) override;\n\n void EmitStringmapChanged(const std::string& name,\n\n const Stringmap& value) override;\n\n\n\n // Implementation of BnService.\n\n android::binder::Status Connect();\n\n android::binder::Status GetState(int32_t* _aidl_return);\n\n android::binder::Status GetStrength(int8_t* _aidl_return);\n\n android::binder::Status GetError(int32_t* _aidl_return);\n\n android::binder::Status RegisterPropertyChangedSignalHandler(\n\n const android::sp<\n\n android::system::connectivity::shill::IPropertyChangedCallback>&\n\n callback);\n\n\n\n Service* service() const { return service_; }\n\n\n\n private:\n\n Service* service_;\n\n\n\n DISALLOW_COPY_AND_ASSIGN(ServiceBinderAdaptor);\n\n};\n\n\n\n} // namespace shill\n\n\n\n#endif // SHILL_BINDER_SERVICE_BINDER_ADAPTOR_H_\n", "file_path": "connectivity/shill/binder/service_binder_adaptor.h", "rank": 26, "score": 216373.82663549605 }, { "content": "\n\n#include <base/macros.h>\n\n#include <utils/StrongPointer.h>\n\n\n\n#include \"android/system/connectivity/shill/BnService.h\"\n\n#include \"shill/adaptor_interfaces.h\"\n\n#include \"shill/binder/binder_adaptor.h\"\n\n\n\nnamespace android {\n\nnamespace binder {\n", "file_path": "connectivity/shill/binder/service_binder_adaptor.h", "rank": 27, "score": 216370.4904261034 }, { "content": "//\n\n// Copyright (C) 2016 The Android Open Source Project\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n\n//\n\n\n\n#ifndef SHILL_BINDER_SERVICE_BINDER_ADAPTOR_H_\n\n#define SHILL_BINDER_SERVICE_BINDER_ADAPTOR_H_\n\n\n\n#include <string>\n", "file_path": "connectivity/shill/binder/service_binder_adaptor.h", "rank": 28, "score": 216353.79894005088 }, { "content": "// struct for serializing keymaster_key_characteristics_t's\n\nstruct KeyCharacteristics {\n\n KeyCharacteristics();\n\n ~KeyCharacteristics();\n\n void readFromParcel(const Parcel& in);\n\n void writeToParcel(Parcel* out) const;\n\n\n\n keymaster_key_characteristics_t characteristics;\n\n};\n\n\n", "file_path": "security/keystore/include/keystore/IKeystoreService.h", "rank": 29, "score": 214743.36075803603 }, { "content": "struct MallocDeleter {\n\n void operator()(uint8_t* p) { free(p); }\n\n};\n\n\n", "file_path": "security/keystore/include/keystore/IKeystoreService.h", "rank": 30, "score": 214743.36075803603 }, { "content": "// struct for serializing/deserializing a list of keymaster_key_param_t's\n\nstruct KeymasterArguments {\n\n KeymasterArguments();\n\n ~KeymasterArguments();\n\n void readFromParcel(const Parcel& in);\n\n void writeToParcel(Parcel* out) const;\n\n\n\n std::vector<keymaster_key_param_t> params;\n\n};\n\n\n", "file_path": "security/keystore/include/keystore/IKeystoreService.h", "rank": 31, "score": 214743.36075803603 }, { "content": "// struct for serializing the results of export\n\nstruct ExportResult {\n\n ExportResult();\n\n ~ExportResult();\n\n void readFromParcel(const Parcel& in);\n\n void writeToParcel(Parcel* out) const;\n\n\n\n int resultCode;\n\n std::unique_ptr<uint8_t[], MallocDeleter> exportData;\n\n size_t dataLength;\n\n};\n\n\n", "file_path": "security/keystore/include/keystore/IKeystoreService.h", "rank": 32, "score": 214743.36075803603 }, { "content": "// struct for serializing the results of begin/update/finish\n\nstruct OperationResult {\n\n OperationResult();\n\n ~OperationResult();\n\n void readFromParcel(const Parcel& in);\n\n void writeToParcel(Parcel* out) const;\n\n\n\n int resultCode;\n\n sp<IBinder> token;\n\n keymaster_operation_handle_t handle;\n\n int inputConsumed;\n\n std::unique_ptr<uint8_t[], MallocDeleter> data;\n\n size_t dataLength;\n\n KeymasterArguments outParams;\n\n};\n\n\n", "file_path": "security/keystore/include/keystore/IKeystoreService.h", "rank": 33, "score": 214743.36075803603 }, { "content": "#include \"shill/logging.h\"\n\n#include \"shill/service.h\"\n\n\n\nusing android::binder::Status;\n\nusing android::IBinder;\n\nusing android::sp;\n\nusing android::system::connectivity::shill::IPropertyChangedCallback;\n\nusing std::string;\n\n\n\nnamespace shill {\n\n\n\nnamespace Logging {\n\nstatic auto kModuleLogScope = ScopeLogger::kBinder;\n\nstatic string ObjectID(ServiceBinderAdaptor* s) {\n\n return \"Service binder adaptor (id \" + s->GetRpcIdentifier() + \", \" +\n\n s->service()->unique_name() + \")\";\n\n}\n\n} // namespace Logging\n\n\n\nServiceBinderAdaptor::ServiceBinderAdaptor(Service* service,\n", "file_path": "connectivity/shill/binder/service_binder_adaptor.cc", "rank": 34, "score": 211242.53196614332 }, { "content": " return Status::ok();\n\n}\n\n\n\nStatus ServiceBinderAdaptor::GetState(int32_t* _aidl_return) {\n\n // STUB IMPLEMENTATION.\n\n // TODO(samueltan): replace this with proper implementation.\n\n return Status::ok();\n\n}\n\n\n\nStatus ServiceBinderAdaptor::GetStrength(int8_t* _aidl_return) {\n\n // STUB IMPLEMENTATION.\n\n // TODO(samueltan): replace this with proper implementation.\n\n return Status::ok();\n\n}\n\n\n\nStatus ServiceBinderAdaptor::GetError(int32_t* _aidl_return) {\n\n // STUB IMPLEMENTATION.\n\n // TODO(samueltan): replace this with proper implementation.\n\n return Status::ok();\n\n}\n\n\n\nStatus ServiceBinderAdaptor::RegisterPropertyChangedSignalHandler(\n\n const sp<IPropertyChangedCallback>& callback) {\n\n AddPropertyChangedSignalHandler(callback);\n\n return Status::ok();\n\n}\n\n\n\n} // namespace shill\n", "file_path": "connectivity/shill/binder/service_binder_adaptor.cc", "rank": 35, "score": 211220.49877607755 }, { "content": "//\n\n// Copyright (C) 2016 The Android Open Source Project\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n\n//\n\n\n\n#include \"shill/binder/service_binder_adaptor.h\"\n\n\n\n#include <binder/Status.h>\n\n\n", "file_path": "connectivity/shill/binder/service_binder_adaptor.cc", "rank": 36, "score": 211217.98969950303 }, { "content": "}\n\n\n\nvoid ServiceBinderAdaptor::EmitUint16sChanged(const string& name,\n\n const Uint16s& /*value*/) {\n\n SLOG(this, 2) << __func__ << \": \" << name;\n\n SendPropertyChangedSignal(name);\n\n}\n\n\n\nvoid ServiceBinderAdaptor::EmitUintChanged(const string& name,\n\n uint32_t /*value*/) {\n\n SLOG(this, 2) << __func__ << \": \" << name;\n\n SendPropertyChangedSignal(name);\n\n}\n\n\n\nvoid ServiceBinderAdaptor::EmitIntChanged(const string& name, int /*value*/) {\n\n SLOG(this, 2) << __func__ << \": \" << name;\n\n SendPropertyChangedSignal(name);\n\n}\n\n\n\nvoid ServiceBinderAdaptor::EmitRpcIdentifierChanged(const string& name,\n", "file_path": "connectivity/shill/binder/service_binder_adaptor.cc", "rank": 37, "score": 211210.40641664763 }, { "content": " const string& /*value*/) {\n\n SLOG(this, 2) << __func__ << \": \" << name;\n\n SendPropertyChangedSignal(name);\n\n}\n\n\n\nvoid ServiceBinderAdaptor::EmitStringChanged(const string& name,\n\n const string& /*value*/) {\n\n SLOG(this, 2) << __func__ << \": \" << name;\n\n SendPropertyChangedSignal(name);\n\n}\n\n\n\nvoid ServiceBinderAdaptor::EmitStringmapChanged(const string& name,\n\n const Stringmap& /*value*/) {\n\n SLOG(this, 2) << __func__ << \": \" << name;\n\n SendPropertyChangedSignal(name);\n\n}\n\n\n\nStatus ServiceBinderAdaptor::Connect() {\n\n // STUB IMPLEMENTATION.\n\n // TODO(samueltan): replace this with proper implementation.\n", "file_path": "connectivity/shill/binder/service_binder_adaptor.cc", "rank": 38, "score": 211208.17819608474 }, { "content": " const std::string& id)\n\n : BinderAdaptor(id), service_(service) {}\n\n\n\nServiceBinderAdaptor::~ServiceBinderAdaptor() { service_ = nullptr; }\n\n\n\nvoid ServiceBinderAdaptor::EmitBoolChanged(const string& name, bool /*value*/) {\n\n SLOG(this, 2) << __func__ << \": \" << name;\n\n SendPropertyChangedSignal(name);\n\n}\n\n\n\nvoid ServiceBinderAdaptor::EmitUint8Changed(const string& name,\n\n uint8_t /*value*/) {\n\n SLOG(this, 2) << __func__ << \": \" << name;\n\n SendPropertyChangedSignal(name);\n\n}\n\n\n\nvoid ServiceBinderAdaptor::EmitUint16Changed(const string& name,\n\n uint16_t /*value*/) {\n\n SLOG(this, 2) << __func__ << \": \" << name;\n\n SendPropertyChangedSignal(name);\n", "file_path": "connectivity/shill/binder/service_binder_adaptor.cc", "rank": 39, "score": 211204.79059341902 }, { "content": "class Status;\n\n} // namespace binder\n\nnamespace system {\n\nnamespace connectivity {\n\nnamespace shill {\n", "file_path": "connectivity/shill/binder/service_binder_adaptor.h", "rank": 40, "score": 211186.53178734702 }, { "content": "// This class defines the Binder IPC interface for accessing the Bluetooth\n\n// service. This class was written based on the corresponding AIDL file at\n\n// /frameworks/base/core/java/android/bluetooth/IBluetooth.aidl.\n\n//\n\n// NOTE: KEEP THIS FILE UP-TO-DATE with the corresponding AIDL, otherwise this\n\n// won't be compatible with the Android framework.\n\nclass IBluetooth : public android::IInterface {\n\n public:\n\n DECLARE_META_INTERFACE(Bluetooth);\n\n\n\n static const char kServiceName[];\n\n\n\n // Transaction codes for interface methods.\n\n enum {\n\n IS_ENABLED_TRANSACTION = android::IBinder::FIRST_CALL_TRANSACTION,\n\n GET_STATE_TRANSACTION,\n\n ENABLE_TRANSACTION,\n\n ENABLE_NO_AUTO_CONNECT_TRANSACTION,\n\n DISABLE_TRANSACTION,\n\n\n\n GET_ADDRESS_TRANSACTION,\n\n GET_UUIDS_TRANSACTION, // TODO(armansito): Support this\n\n SET_NAME_TRANSACTION,\n\n GET_NAME_TRANSACTION,\n\n\n\n // TODO(armansito): Support the functions below.\n", "file_path": "bt/service/common/bluetooth/binder/IBluetooth.h", "rank": 41, "score": 210917.7920462207 }, { "content": "// struct for serializing keymaster_cert_chain_t's\n\nstruct KeymasterCertificateChain {\n\n KeymasterCertificateChain();\n\n ~KeymasterCertificateChain();\n\n void readFromParcel(const Parcel& in);\n\n void writeToParcel(Parcel* out) const;\n\n\n\n void FreeChain();\n\n\n\n keymaster_cert_chain_t chain;\n\n};\n\n\n\nbool readKeymasterArgumentFromParcel(const Parcel& in, keymaster_key_param_t* out);\n\nvoid writeKeymasterArgumentToParcel(const keymaster_key_param_t& param, Parcel* out);\n\n\n\n/*\n\n * This must be kept manually in sync with frameworks/base's IKeystoreService.java\n\n */\n", "file_path": "security/keystore/include/keystore/IKeystoreService.h", "rank": 42, "score": 210331.33306961146 }, { "content": "class AddIntsService : public BBinder\n\n{\n\n public:\n\n AddIntsService(int cpu = unbound);\n\n virtual ~AddIntsService() {}\n\n\n\n enum command {\n\n ADD_INTS = 0x120,\n\n };\n\n\n\n virtual status_t onTransact(uint32_t code,\n\n const Parcel& data, Parcel* reply,\n\n uint32_t flags = 0);\n\n\n\n private:\n\n int cpu_;\n\n};\n\n\n\n// File scope function prototypes\n\nstatic bool server(void);\n", "file_path": "extras/tests/binder/benchmarks/binderAddInts.cpp", "rank": 43, "score": 209346.11513555422 }, { "content": "\n\n // List of currently bound callbacks.\n\n std::vector<android::sp<android::os::IUpdateEngineCallback>> callbacks_;\n\n\n\n // Cached copy of the last status update sent. Used to send an initial\n\n // notification when bind() is called from the client.\n\n int last_status_{-1};\n\n double last_progress_{0.0};\n\n\n\n ServiceDelegateAndroidInterface* service_delegate_;\n\n};\n\n\n\n} // namespace chromeos_update_engine\n\n\n\n#endif // UPDATE_ENGINE_BINDER_SERVICE_ANDROID_H_\n", "file_path": "update_engine/binder_service_android.h", "rank": 44, "score": 207565.47109845083 }, { "content": "\n\n#include <string>\n\n#include <vector>\n\n\n\n#include <utils/Errors.h>\n\n#include <utils/String16.h>\n\n#include <utils/StrongPointer.h>\n\n\n\n#include \"android/os/BnUpdateEngine.h\"\n\n#include \"android/os/IUpdateEngineCallback.h\"\n\n#include \"update_engine/service_delegate_android_interface.h\"\n\n#include \"update_engine/service_observer_interface.h\"\n\n\n\nnamespace chromeos_update_engine {\n\n\n", "file_path": "update_engine/binder_service_android.h", "rank": 45, "score": 207562.89740716212 }, { "content": "//\n\n// Copyright (C) 2015 The Android Open Source Project\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n\n//\n\n\n\n#ifndef UPDATE_ENGINE_BINDER_SERVICE_ANDROID_H_\n\n#define UPDATE_ENGINE_BINDER_SERVICE_ANDROID_H_\n\n\n\n#include <stdint.h>\n", "file_path": "update_engine/binder_service_android.h", "rank": 46, "score": 207557.50555825463 }, { "content": " void SendChannelChangeUpdate(const std::string& tracking_channel) override {}\n\n\n\n // android::os::BnUpdateEngine overrides.\n\n android::binder::Status applyPayload(\n\n const android::String16& url,\n\n int64_t payload_offset,\n\n int64_t payload_size,\n\n const std::vector<android::String16>& header_kv_pairs) override;\n\n android::binder::Status bind(\n\n const android::sp<android::os::IUpdateEngineCallback>& callback,\n\n bool* return_value) override;\n\n android::binder::Status suspend() override;\n\n android::binder::Status resume() override;\n\n android::binder::Status cancel() override;\n\n android::binder::Status resetStatus() override;\n\n\n\n private:\n\n // Remove the passed |callback| from the list of registered callbacks. Called\n\n // whenever the callback object is destroyed.\n\n void UnbindCallback(android::os::IUpdateEngineCallback* callback);\n", "file_path": "update_engine/binder_service_android.h", "rank": 47, "score": 207543.4096622538 }, { "content": "class KeystoreArg : public RefBase {\n\npublic:\n\n KeystoreArg(const void *data, size_t len);\n\n ~KeystoreArg();\n\n\n\n const void* data() const;\n\n size_t size() const;\n\n\n\nprivate:\n\n const void* mData;\n\n size_t mSize;\n\n};\n\n\n", "file_path": "security/keystore/include/keystore/IKeystoreService.h", "rank": 48, "score": 207083.74459668095 }, { "content": "class Service;\n\ntypedef scoped_refptr<const Service> ServiceConstRefPtr;\n\ntypedef scoped_refptr<Service> ServiceRefPtr;\n\n\n", "file_path": "connectivity/shill/refptr_types.h", "rank": 49, "score": 206182.45128357303 }, { "content": " class CallbackDeathRecipient : public android::IBinder::DeathRecipient {\n\n public:\n\n CallbackDeathRecipient(const android::sp<T>& callback,\n\n RemoteCallbackList* owner);\n\n\n\n android::sp<T> get_callback() const { return callback_; }\n\n\n\n // android::IBinder::DeathRecipient override:\n\n void binderDied(const android::wp<android::IBinder>& who) override;\n\n\n\n private:\n\n android::sp<T> callback_;\n\n RemoteCallbackList<T>* owner_; // weak\n\n };\n\n\n\n // Typedef for internal map container. This keeps track of a given Binder and\n\n // a death receiver associated with it.\n\n using CallbackMap = std::unordered_map<android::IBinder*,\n\n android::sp<CallbackDeathRecipient>>;\n\n\n", "file_path": "bt/service/ipc/binder/remote_callback_list.h", "rank": 50, "score": 205401.18222735703 }, { "content": " class CallbackDeathRecipient : public android::IBinder::DeathRecipient {\n\n public:\n\n CallbackDeathRecipient(\n\n const K& key,\n\n const android::sp<V>& callback,\n\n RemoteCallbackMap<K, V>* owner,\n\n Delegate* delegate);\n\n\n\n android::sp<V> get_callback() const { return callback_; }\n\n\n\n // android::IBinder::DeathRecipient override:\n\n void binderDied(const android::wp<android::IBinder>& who) override;\n\n\n\n private:\n\n K key_;\n\n android::sp<V> callback_;\n\n RemoteCallbackMap<K, V>* owner_; // weak\n\n Delegate* delegate_; // weak\n\n };\n\n\n", "file_path": "bt/service/ipc/binder/remote_callback_map.h", "rank": 51, "score": 205401.18222735703 }, { "content": "class Error {\n\n public:\n\n enum Type {\n\n kSuccess = 0, // No error.\n\n kOperationInProgress,\n\n kInternalError,\n\n kInvalidArguments,\n\n kInvalidConfiguration,\n\n kNumErrors\n\n };\n\n\n\n Error();\n\n ~Error();\n\n\n\n void Populate(Type type,\n\n const std::string& message,\n\n const tracked_objects::Location& location);\n\n\n\n void Reset();\n\n\n", "file_path": "connectivity/apmanager/error.h", "rank": 52, "score": 203956.60398758555 }, { "content": "class Error;\n\nusing ErrorPtr = std::unique_ptr<Error>;\n\n} // namespace brillo\n\n\n\nnamespace shill {\n\n\n", "file_path": "connectivity/shill/error.h", "rank": 53, "score": 203956.60398758555 }, { "content": "class Error;\n\nusing ErrorPtr = std::unique_ptr<Error>;\n\n} // namespace brillo\n\n\n\nnamespace apmanager {\n\n\n", "file_path": "connectivity/apmanager/error.h", "rank": 54, "score": 203956.60398758555 }, { "content": "class Error {\n\n public:\n\n enum Type {\n\n kSuccess = 0, // No error.\n\n kOperationFailed, // failure, otherwise unspecified\n\n kAlreadyConnected,\n\n kAlreadyExists,\n\n kIncorrectPin,\n\n kInProgress,\n\n kInternalError,\n\n kInvalidApn,\n\n kInvalidArguments,\n\n kInvalidNetworkName,\n\n kInvalidPassphrase,\n\n kInvalidProperty,\n\n kNoCarrier,\n\n kNotConnected,\n\n kNotFound,\n\n kNotImplemented,\n\n kNotOnHomeNetwork,\n", "file_path": "connectivity/shill/error.h", "rank": 55, "score": 203956.60398758555 }, { "content": " // Clients can instantiate and use Binder to bind to a Connection and get\n\n // notified when the bound Connection disconnects. Note that the client's\n\n // disconnect callback will be executed at most once, and only if the bound\n\n // Connection is destroyed or signals disconnect. The Binder unbinds itself\n\n // from the underlying Connection when the Binder instance is destructed.\n\n class Binder {\n\n public:\n\n Binder(const std::string& name, const base::Closure& disconnect_callback);\n\n ~Binder();\n\n\n\n // Binds to |to_connection|. Unbinds the previous bound connection, if\n\n // any. Pass nullptr to just unbind this Binder.\n\n void Attach(const ConnectionRefPtr& to_connection);\n\n\n\n const std::string& name() const { return name_; }\n\n bool IsBound() const { return connection_ != nullptr; }\n\n ConnectionRefPtr connection() const { return connection_.get(); }\n\n\n\n private:\n\n friend class Connection;\n\n FRIEND_TEST(ConnectionTest, Binder);\n\n\n\n // Invoked by |connection_|.\n\n void OnDisconnect();\n\n\n", "file_path": "connectivity/shill/connection.h", "rank": 56, "score": 203645.94161439288 }, { "content": "class KeyStoreService : public BnKeystoreService, public IBinder::DeathRecipient {\n\n public:\n\n KeyStoreService(KeyStore* keyStore) : mKeyStore(keyStore), mOperationMap(this) {}\n\n\n\n void binderDied(const wp<IBinder>& who);\n\n\n\n int32_t getState(int32_t userId);\n\n\n\n int32_t get(const String16& name, int32_t uid, uint8_t** item, size_t* itemLength);\n\n int32_t insert(const String16& name, const uint8_t* item, size_t itemLength, int targetUid,\n\n int32_t flags);\n\n int32_t del(const String16& name, int targetUid);\n\n int32_t exist(const String16& name, int targetUid);\n\n int32_t list(const String16& prefix, int targetUid, Vector<String16>* matches);\n\n\n\n int32_t reset();\n\n\n\n int32_t onUserPasswordChanged(int32_t userId, const String16& password);\n\n int32_t onUserAdded(int32_t userId, int32_t parentId);\n\n int32_t onUserRemoved(int32_t userId);\n", "file_path": "security/keystore/key_store_service.h", "rank": 57, "score": 203073.53983704405 }, { "content": " alloc_fn alloc;\n", "file_path": "bt/osi/include/allocator.h", "rank": 58, "score": 202765.3366013423 }, { "content": "// This class defines the Binder IPC interface for receiving adapter state\n\n// updates from the Bluetooth service. This class was written based on the\n\n// corresponding AIDL file at\n\n// /frameworks/base/core/java/android/bluetooth/IBluetoothCallback.aidl.\n\n//\n\n// NOTE: KEEP THIS FILE UP-TO-DATE with the corresponding AIDL, otherwise this\n\n// won't be compatible with the Android framework.\n\nclass IBluetoothCallback : public android::IInterface {\n\n public:\n\n DECLARE_META_INTERFACE(BluetoothCallback);\n\n\n\n static const char kServiceName[];\n\n\n\n // Transaction codes for interface methods.\n\n enum {\n\n ON_BLUETOOTH_STATE_CHANGE_TRANSACTION =\n\n android::IBinder::FIRST_CALL_TRANSACTION,\n\n };\n\n\n\n virtual void OnBluetoothStateChange(\n\n bluetooth::AdapterState prev_state,\n\n bluetooth::AdapterState new_state) = 0;\n\n\n\n private:\n\n DISALLOW_COPY_AND_ASSIGN(IBluetoothCallback);\n\n};\n\n\n\n// TODO(armansito): Implement notification for when the process dies.\n\n\n", "file_path": "bt/service/common/bluetooth/binder/IBluetoothCallback.h", "rank": 59, "score": 202099.68058742356 }, { "content": "#include <binderwrapper/binder_wrapper.h>\n\n#include <brillo/errors/error.h>\n\n#include <utils/String8.h>\n\n\n\nusing android::binder::Status;\n\nusing android::os::IUpdateEngineCallback;\n\n\n\nnamespace {\n\nStatus ErrorPtrToStatus(const brillo::ErrorPtr& error) {\n\n return Status::fromServiceSpecificError(\n\n 1, android::String8{error->GetMessage().c_str()});\n\n}\n\n} // namespace\n\n\n\nnamespace chromeos_update_engine {\n\n\n\nBinderUpdateEngineAndroidService::BinderUpdateEngineAndroidService(\n\n ServiceDelegateAndroidInterface* service_delegate)\n\n : service_delegate_(service_delegate) {\n\n}\n", "file_path": "update_engine/binder_service_android.cc", "rank": 60, "score": 201661.88548423 }, { "content": "class IPropertyChangedCallback;\n\n} // namespace shill\n\n} // namespace connectivity\n\n} // namespace system\n\n} // namespace android\n\n\n\nnamespace shill {\n\n\n", "file_path": "connectivity/shill/binder/service_binder_adaptor.h", "rank": 61, "score": 201641.7165394148 }, { "content": " return Status::ok();\n\n}\n\n\n\nStatus BinderUpdateEngineAndroidService::resetStatus() {\n\n brillo::ErrorPtr error;\n\n if (!service_delegate_->ResetStatus(&error))\n\n return ErrorPtrToStatus(error);\n\n return Status::ok();\n\n}\n\n\n\nvoid BinderUpdateEngineAndroidService::UnbindCallback(\n\n IUpdateEngineCallback* callback) {\n\n auto it =\n\n std::find_if(callbacks_.begin(),\n\n callbacks_.end(),\n\n [&callback](const android::sp<IUpdateEngineCallback>& elem) {\n\n return elem.get() == callback;\n\n });\n\n if (it == callbacks_.end()) {\n\n LOG(ERROR) << \"Got death notification for unknown callback.\";\n\n return;\n\n }\n\n callbacks_.erase(it);\n\n}\n\n\n\n} // namespace chromeos_update_engine\n", "file_path": "update_engine/binder_service_android.cc", "rank": 62, "score": 201640.24023960347 }, { "content": "\n\nvoid BinderUpdateEngineAndroidService::SendStatusUpdate(\n\n int64_t /* last_checked_time */,\n\n double progress,\n\n update_engine::UpdateStatus status,\n\n const std::string& /* new_version */,\n\n int64_t /* new_size */) {\n\n last_status_ = static_cast<int>(status);\n\n last_progress_ = progress;\n\n for (auto& callback : callbacks_) {\n\n callback->onStatusUpdate(last_status_, last_progress_);\n\n }\n\n}\n\n\n\nvoid BinderUpdateEngineAndroidService::SendPayloadApplicationComplete(\n\n ErrorCode error_code) {\n\n for (auto& callback : callbacks_) {\n\n callback->onPayloadApplicationComplete(static_cast<int>(error_code));\n\n }\n\n}\n", "file_path": "update_engine/binder_service_android.cc", "rank": 63, "score": 201638.54502648162 }, { "content": "}\n\n\n\nStatus BinderUpdateEngineAndroidService::suspend() {\n\n brillo::ErrorPtr error;\n\n if (!service_delegate_->SuspendUpdate(&error))\n\n return ErrorPtrToStatus(error);\n\n return Status::ok();\n\n}\n\n\n\nStatus BinderUpdateEngineAndroidService::resume() {\n\n brillo::ErrorPtr error;\n\n if (!service_delegate_->ResumeUpdate(&error))\n\n return ErrorPtrToStatus(error);\n\n return Status::ok();\n\n}\n\n\n\nStatus BinderUpdateEngineAndroidService::cancel() {\n\n brillo::ErrorPtr error;\n\n if (!service_delegate_->CancelUpdate(&error))\n\n return ErrorPtrToStatus(error);\n", "file_path": "update_engine/binder_service_android.cc", "rank": 64, "score": 201637.90601227796 }, { "content": "//\n\n// Copyright (C) 2015 The Android Open Source Project\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n\n//\n\n\n\n#include \"update_engine/binder_service_android.h\"\n\n\n\n#include <base/bind.h>\n\n#include <base/logging.h>\n", "file_path": "update_engine/binder_service_android.cc", "rank": 65, "score": 201634.22242190858 }, { "content": "\n\nStatus BinderUpdateEngineAndroidService::bind(\n\n const android::sp<IUpdateEngineCallback>& callback, bool* return_value) {\n\n callbacks_.emplace_back(callback);\n\n\n\n auto binder_wrapper = android::BinderWrapper::Get();\n\n binder_wrapper->RegisterForDeathNotifications(\n\n IUpdateEngineCallback::asBinder(callback),\n\n base::Bind(&BinderUpdateEngineAndroidService::UnbindCallback,\n\n base::Unretained(this),\n\n base::Unretained(callback.get())));\n\n\n\n // Send an status update on connection (except when no update sent so far),\n\n // since the status update is oneway and we don't need to wait for the\n\n // response.\n\n if (last_status_ != -1)\n\n callback->onStatusUpdate(last_status_, last_progress_);\n\n\n\n *return_value = true;\n\n return Status::ok();\n", "file_path": "update_engine/binder_service_android.cc", "rank": 66, "score": 201632.04832589428 }, { "content": "}\n\n\n\nStatus BinderUpdateEngineAndroidService::applyPayload(\n\n const android::String16& url,\n\n int64_t payload_offset,\n\n int64_t payload_size,\n\n const std::vector<android::String16>& header_kv_pairs) {\n\n const std::string payload_url{android::String8{url}.string()};\n\n std::vector<std::string> str_headers;\n\n str_headers.reserve(header_kv_pairs.size());\n\n for (const auto& header : header_kv_pairs) {\n\n str_headers.emplace_back(android::String8{header}.string());\n\n }\n\n\n\n brillo::ErrorPtr error;\n\n if (!service_delegate_->ApplyPayload(\n\n payload_url, payload_offset, payload_size, str_headers, &error)) {\n\n return ErrorPtrToStatus(error);\n\n }\n\n return Status::ok();\n", "file_path": "update_engine/binder_service_android.cc", "rank": 67, "score": 201631.86814177898 }, { "content": "class CellularService;\n\ntypedef scoped_refptr<const CellularService> CellularServiceConstRefPtr;\n\ntypedef scoped_refptr<CellularService> CellularServiceRefPtr;\n\n\n", "file_path": "connectivity/shill/refptr_types.h", "rank": 68, "score": 200298.74546453217 }, { "content": "class VPNService;\n\ntypedef scoped_refptr<const VPNService> VPNServiceConstRefPtr;\n\ntypedef scoped_refptr<VPNService> VPNServiceRefPtr;\n\n\n", "file_path": "connectivity/shill/refptr_types.h", "rank": 69, "score": 200298.74546453217 }, { "content": "class EthernetService;\n\ntypedef scoped_refptr<const EthernetService> EthernetServiceConstRefPtr;\n\ntypedef scoped_refptr<EthernetService> EthernetServiceRefPtr;\n\n\n", "file_path": "connectivity/shill/refptr_types.h", "rank": 70, "score": 200298.74546453217 }, { "content": "class Error;\n", "file_path": "connectivity/shill/connection_diagnostics.h", "rank": 71, "score": 200030.23113651326 }, { "content": " tBLE_ADDR_TYPE type;\n", "file_path": "bt/stack/include/bt_types.h", "rank": 72, "score": 199706.11368267448 }, { "content": " UINT8 service_type; /* see below */\n", "file_path": "bt/stack/include/bt_types.h", "rank": 73, "score": 197838.33622249262 }, { "content": "namespace android {\n\nnamespace base {\n\n\n\n// These printf-like functions are implemented in terms of vsnprintf, so they\n\n// use the same attribute for compile-time format string checking. On Windows,\n\n// if the mingw version of vsnprintf is used, use `gnu_printf' which allows z\n\n// in %zd and PRIu64 (and related) to be recognized by the compile-time\n\n// checking.\n\n#define FORMAT_ARCHETYPE __printf__\n\n#ifdef __USE_MINGW_ANSI_STDIO\n\n#if __USE_MINGW_ANSI_STDIO\n\n#undef FORMAT_ARCHETYPE\n\n#define FORMAT_ARCHETYPE gnu_printf\n\n#endif\n\n#endif\n\n\n\n// Returns a string corresponding to printf-like formatting of the arguments.\n\nstd::string StringPrintf(const char* fmt, ...)\n\n __attribute__((__format__(FORMAT_ARCHETYPE, 1, 2)));\n\n\n\n// Appends a printf-like formatting of the arguments to 'dst'.\n\nvoid StringAppendF(std::string* dst, const char* fmt, ...)\n\n __attribute__((__format__(FORMAT_ARCHETYPE, 2, 3)));\n\n\n\n// Appends a printf-like formatting of the arguments to 'dst'.\n\nvoid StringAppendV(std::string* dst, const char* format, va_list ap)\n\n __attribute__((__format__(FORMAT_ARCHETYPE, 2, 0)));\n\n\n\n#undef FORMAT_ARCHETYPE\n\n\n\n} // namespace base\n", "file_path": "core/base/include/android-base/stringprintf.h", "rank": 74, "score": 196800.29489773553 }, { "content": "namespace android {\n\nnamespace base {\n\n\n\n// Parses the unsigned decimal integer in the string 's' and sets 'out' to\n\n// that value. Optionally allows the caller to define a 'max' beyond which\n\n// otherwise valid values will be rejected. Returns boolean success.\n\ntemplate <typename T>\n\nbool ParseUint(const char* s, T* out,\n\n T max = std::numeric_limits<T>::max()) {\n\n int base = (s[0] == '0' && s[1] == 'x') ? 16 : 10;\n\n errno = 0;\n\n char* end;\n\n unsigned long long int result = strtoull(s, &end, base);\n\n if (errno != 0 || s == end || *end != '\\0') {\n\n return false;\n\n }\n\n if (max < result) {\n\n return false;\n\n }\n\n *out = static_cast<T>(result);\n\n return true;\n\n}\n\n\n\n// Parses the signed decimal integer in the string 's' and sets 'out' to\n\n// that value. Optionally allows the caller to define a 'min' and 'max\n\n// beyond which otherwise valid values will be rejected. Returns boolean\n\n// success.\n\ntemplate <typename T>\n\nbool ParseInt(const char* s, T* out,\n\n T min = std::numeric_limits<T>::min(),\n\n T max = std::numeric_limits<T>::max()) {\n\n int base = (s[0] == '0' && s[1] == 'x') ? 16 : 10;\n\n errno = 0;\n\n char* end;\n\n long long int result = strtoll(s, &end, base);\n\n if (errno != 0 || s == end || *end != '\\0') {\n\n return false;\n\n }\n\n if (result < min || max < result) {\n\n return false;\n\n }\n\n *out = static_cast<T>(result);\n\n return true;\n", "file_path": "core/base/include/android-base/parseint.h", "rank": 75, "score": 196800.29489773553 }, { "content": "namespace android {\n\nnamespace base {\n\n\n\n// Splits a string into a vector of strings.\n\n//\n\n// The string is split at each occurrence of a character in delimiters.\n\n//\n\n// The empty string is not a valid delimiter list.\n\nstd::vector<std::string> Split(const std::string& s,\n\n const std::string& delimiters);\n\n\n\n// Trims whitespace off both ends of the given string.\n\nstd::string Trim(const std::string& s);\n\n\n\n// Joins a container of things into a single string, using the given separator.\n\ntemplate <typename ContainerT, typename SeparatorT>\n\nstd::string Join(const ContainerT& things, SeparatorT separator) {\n\n if (things.empty()) {\n\n return \"\";\n\n }\n\n\n\n std::ostringstream result;\n\n result << *things.begin();\n\n for (auto it = std::next(things.begin()); it != things.end(); ++it) {\n\n result << separator << *it;\n\n }\n\n return result.str();\n\n}\n\n\n\n// We instantiate the common cases in strings.cpp.\n\nextern template std::string Join(const std::vector<std::string>&, char);\n\nextern template std::string Join(const std::vector<const char*>&, char);\n\nextern template std::string Join(const std::vector<std::string>&, const std::string&);\n\nextern template std::string Join(const std::vector<const char*>&, const std::string&);\n\n\n\n// Tests whether 's' starts with 'prefix'.\n\nbool StartsWith(const std::string& s, const char* prefix);\n\n\n\n// Tests whether 's' ends with 'suffix'.\n\nbool EndsWith(const std::string& s, const char* suffix);\n\n\n\n} // namespace base\n", "file_path": "core/base/include/android-base/strings.h", "rank": 76, "score": 196800.29489773553 }, { "content": "namespace android {\n\nnamespace base {\n\n\n\n// Use packed structures for access to unaligned data on targets with alignment\n\n// restrictions. The compiler will generate appropriate code to access these\n\n// structures without generating alignment exceptions.\n\ntemplate <typename T>\n\nstatic inline T get_unaligned(const T* address) {\n\n struct unaligned {\n\n T v;\n\n } __attribute__((packed));\n\n const unaligned* p = reinterpret_cast<const unaligned*>(address);\n\n return p->v;\n\n}\n\n\n\ntemplate <typename T>\n\nstatic inline void put_unaligned(T* address, T v) {\n\n struct unaligned {\n\n T v;\n\n } __attribute__((packed));\n\n unaligned* p = reinterpret_cast<unaligned*>(address);\n\n p->v = v;\n\n}\n\n\n\n} // namespace base\n", "file_path": "core/base/include/android-base/memory.h", "rank": 77, "score": 196800.29489773553 }, { "content": "namespace android {\n\nnamespace base {\n\n\n\n// Parses |address| into |host| and |port|.\n\n//\n\n// If |address| doesn't contain a port number, the default value is taken from\n\n// |port|. If |canonical_address| is non-null it will be set to \"host:port\" or\n\n// \"[host]:port\" as appropriate.\n\n//\n\n// On failure, returns false and fills |error|.\n\nbool ParseNetAddress(const std::string& address, std::string* host, int* port,\n\n std::string* canonical_address, std::string* error);\n\n\n\n} // namespace base\n", "file_path": "core/base/include/android-base/parsenetaddress.h", "rank": 78, "score": 196800.29489773553 }, { "content": "namespace android {\n\nnamespace base {\n\n\n\n// Only available on Windows because this is only needed on Windows.\n\n#ifdef _WIN32\n\n// Convert size number of UTF-16 wchar_t's to UTF-8. Returns whether the\n\n// conversion was done successfully.\n\nbool WideToUTF8(const wchar_t* utf16, const size_t size, std::string* utf8);\n\n\n\n// Convert a NULL-terminated string of UTF-16 characters to UTF-8. Returns\n\n// whether the conversion was done successfully.\n\nbool WideToUTF8(const wchar_t* utf16, std::string* utf8);\n\n\n\n// Convert a UTF-16 std::wstring (including any embedded NULL characters) to\n\n// UTF-8. Returns whether the conversion was done successfully.\n\nbool WideToUTF8(const std::wstring& utf16, std::string* utf8);\n\n\n\n// Convert size number of UTF-8 char's to UTF-16. Returns whether the conversion\n\n// was done successfully.\n\nbool UTF8ToWide(const char* utf8, const size_t size, std::wstring* utf16);\n\n\n\n// Convert a NULL-terminated string of UTF-8 characters to UTF-16. Returns\n\n// whether the conversion was done successfully.\n\nbool UTF8ToWide(const char* utf8, std::wstring* utf16);\n\n\n\n// Convert a UTF-8 std::string (including any embedded NULL characters) to\n\n// UTF-16. Returns whether the conversion was done successfully.\n\nbool UTF8ToWide(const std::string& utf8, std::wstring* utf16);\n\n#endif\n\n\n\n// The functions in the utf8 namespace take UTF-8 strings. For Windows, these\n\n// are wrappers, for non-Windows these just expose existing APIs. To call these\n\n// functions, use:\n\n//\n\n// // anonymous namespace to avoid conflict with existing open(), unlink(), etc.\n\n// namespace {\n\n// // Import functions into anonymous namespace.\n\n// using namespace android::base::utf8;\n\n//\n\n// void SomeFunction(const char* name) {\n\n// int fd = open(name, ...); // Calls android::base::utf8::open().\n\n// ...\n\n// unlink(name); // Calls android::base::utf8::unlink().\n\n// }\n\n// }\n\nnamespace utf8 {\n\n\n\n#ifdef _WIN32\n\nint open(const char* name, int flags, ...);\n\nint unlink(const char* name);\n\n#else\n\nusing ::open;\n\nusing ::unlink;\n\n#endif\n\n\n\n} // namespace utf8\n\n} // namespace base\n", "file_path": "core/base/include/android-base/utf8.h", "rank": 79, "score": 196800.29489773553 }, { "content": "namespace android {\n\nnamespace base {\n\n\n\nbool ReadFdToString(int fd, std::string* content);\n\nbool ReadFileToString(const std::string& path, std::string* content);\n\n\n\nbool WriteStringToFile(const std::string& content, const std::string& path);\n\nbool WriteStringToFd(const std::string& content, int fd);\n\n\n\n#if !defined(_WIN32)\n\nbool WriteStringToFile(const std::string& content, const std::string& path,\n\n mode_t mode, uid_t owner, gid_t group);\n\n#endif\n\n\n\nbool ReadFully(int fd, void* data, size_t byte_count);\n\nbool WriteFully(int fd, const void* data, size_t byte_count);\n\n\n\nbool RemoveFileIfExists(const std::string& path, std::string* err = nullptr);\n\n\n\n} // namespace base\n", "file_path": "core/base/include/android-base/file.h", "rank": 80, "score": 196800.29489773553 }, { "content": "class Error;\n", "file_path": "connectivity/shill/connection_health_checker.h", "rank": 81, "score": 196583.03778909458 }, { "content": " public byte[] sign(byte[] image, PrivateKey key) throws Exception {\n\n byte[] signable = generateSignableImage(image);\n\n return Utils.sign(key, signable);\n", "file_path": "extras/verity/BootSignature.java", "rank": 82, "score": 194748.5181625284 }, { "content": "class WiFiService;\n\ntypedef scoped_refptr<const WiFiService> WiFiServiceConstRefPtr;\n\ntypedef scoped_refptr<WiFiService> WiFiServiceRefPtr;\n\n\n", "file_path": "connectivity/shill/refptr_types.h", "rank": 83, "score": 194741.52261324052 }, { "content": "class WiMaxService;\n\ntypedef scoped_refptr<const WiMaxService> WiMaxServiceConstRefPtr;\n\ntypedef scoped_refptr<WiMaxService> WiMaxServiceRefPtr;\n\n\n", "file_path": "connectivity/shill/refptr_types.h", "rank": 84, "score": 194741.52261324052 }, { "content": "// The Binder client interface to IBluetooth.\n\nclass BpBluetooth : public android::BpInterface<IBluetooth> {\n\n public:\n\n explicit BpBluetooth(const android::sp<android::IBinder>& impl);\n\n virtual ~BpBluetooth() = default;\n\n\n\n // IBluetooth overrides:\n\n bool IsEnabled() override;\n\n int GetState() override;\n\n bool Enable(bool start_restricted) override;\n\n bool EnableNoAutoConnect() override;\n\n bool Disable() override;\n\n\n\n std::string GetAddress() override;\n\n std::vector<bluetooth::UUID> GetUUIDs() override;\n\n bool SetName(const std::string& name) override;\n\n std::string GetName() override;\n\n\n\n void RegisterCallback(\n\n const android::sp<IBluetoothCallback>& callback) override;\n\n void UnregisterCallback(\n", "file_path": "bt/service/common/bluetooth/binder/IBluetooth.h", "rank": 85, "score": 194697.09335480453 }, { "content": "// The Binder server interface to IBluetooth. A class that implements IBluetooth\n\n// must inherit from this class.\n\nclass BnBluetooth : public android::BnInterface<IBluetooth> {\n\n public:\n\n BnBluetooth() = default;\n\n virtual ~BnBluetooth() = default;\n\n\n\n private:\n\n virtual android::status_t onTransact(\n\n uint32_t code,\n\n const android::Parcel& data,\n\n android::Parcel* reply,\n\n uint32_t flags = 0);\n\n\n\n DISALLOW_COPY_AND_ASSIGN(BnBluetooth);\n\n};\n\n\n", "file_path": "bt/service/common/bluetooth/binder/IBluetooth.h", "rank": 86, "score": 194696.75396823214 }, { "content": "class BluetoothDeathRecipient : public android::IBinder::DeathRecipient {\n\n public:\n\n BluetoothDeathRecipient() = default;\n\n ~BluetoothDeathRecipient() override = default;\n\n\n\n // android::IBinder::DeathRecipient override:\n\n void binderDied(const android::wp<android::IBinder>& /* who */) override {\n\n BeginAsyncOut();\n\n cout << COLOR_BOLDWHITE \"The Bluetooth daemon has died\" COLOR_OFF << endl;\n\n cout << \"\\nPress 'ENTER' to exit.\";\n\n EndAsyncOut();\n\n\n\n android::IPCThreadState::self()->stopProcess();\n\n should_exit = true;\n\n }\n\n\n\n private:\n\n DISALLOW_COPY_AND_ASSIGN(BluetoothDeathRecipient);\n\n};\n\n\n", "file_path": "bt/service/client/main.cpp", "rank": 87, "score": 194689.2187103251 }, { "content": " public void sign(PrivateKey privateKey) throws Exception {\n\n byte[] innerKeystore = getInnerKeystore();\n\n byte[] rawSignature = Utils.sign(privateKey, innerKeystore);\n\n signature = new BootSignature(\"keystore\", innerKeystore.length);\n\n signature.setCertificate(certificate);\n\n signature.setSignature(rawSignature,\n\n Utils.getSignatureAlgorithmIdentifier(privateKey));\n", "file_path": "extras/verity/KeystoreSigner.java", "rank": 88, "score": 194685.5142727803 }, { "content": "class JavaTypeNamespace : public LanguageTypeNamespace<Type> {\n\n public:\n\n JavaTypeNamespace() = default;\n\n virtual ~JavaTypeNamespace() = default;\n\n\n\n void Init() override;\n\n bool AddParcelableType(const AidlParcelable& p,\n\n const std::string& filename) override;\n\n bool AddBinderType(const AidlInterface& b,\n\n const std::string& filename) override;\n\n bool AddListType(const std::string& contained_type_name) override;\n\n bool AddMapType(const std::string& key_type_name,\n\n const std::string& value_type_name) override;\n\n\n\n const Type* BoolType() const { return m_bool_type; }\n\n const Type* IntType() const { return m_int_type; }\n\n const Type* StringType() const { return m_string_type; }\n\n const Type* TextUtilsType() const { return m_text_utils_type; }\n\n const Type* RemoteExceptionType() const { return m_remote_exception_type; }\n\n const Type* RuntimeExceptionType() const { return m_runtime_exception_type; }\n", "file_path": "tools/aidl/type_java.h", "rank": 89, "score": 194560.53167306504 }, { "content": "// This class defines the Binder IPC interface for interacting with Bluetooth\n\n// Low-Energy features.\n\n// TODO(armansito): This class was written based on a new design doc proposal.\n\n// We need to add an AIDL for this to the framework code.\n\n//\n\n// NOTE: KEEP THIS FILE UP-TO-DATE with the corresponding AIDL, otherwise this\n\n// won't be compatible with the Android framework.\n\nclass IBluetoothLowEnergy : public android::IInterface {\n\n public:\n\n DECLARE_META_INTERFACE(BluetoothLowEnergy);\n\n\n\n static const char kServiceName[];\n\n\n\n // Transaction codes for interface methods.\n\n enum {\n\n GET_DEVICES_MATCHING_CONNECTION_STATE_TRANSACTION =\n\n android::IBinder::FIRST_CALL_TRANSACTION,\n\n\n\n REGISTER_CLIENT_TRANSACTION,\n\n UNREGISTER_CLIENT_TRANSACTION,\n\n UNREGISTER_ALL_TRANSACTION,\n\n\n\n START_SCAN_TRANSACTION,\n\n STOP_SCAN_TRANSACTION,\n\n FLUSH_PENDING_BATCH_RESULTS_TRANSACTION,\n\n START_MULTI_ADVERTISING_TRANSACTION,\n\n STOP_MULTI_ADVERTISING_TRANSACTION,\n", "file_path": "bt/service/common/bluetooth/binder/IBluetoothLowEnergy.h", "rank": 90, "score": 194093.9801760357 }, { "content": "// This class defines the Binder IPC interface for interacting with Bluetooth\n\n// GATT server-role features.\n\n// TODO(armansito): This class was written based on a new design doc proposal.\n\n// We need to add an AIDL for this to the framework code.\n\n//\n\n// NOTE: KEEP THIS FILE UP-TO-DATE with the corresponding AIDL, otherwise this\n\n// won't be compatible with the Android framework.\n\nclass IBluetoothGattServer : public android::IInterface {\n\n public:\n\n DECLARE_META_INTERFACE(BluetoothGattServer);\n\n\n\n static const char kServiceName[];\n\n\n\n // Transaction codes for interface methods.\n\n enum {\n\n REGISTER_SERVER_TRANSACTION = android::IBinder::FIRST_CALL_TRANSACTION,\n\n UNREGISTER_SERVER_TRANSACTION,\n\n UNREGISTER_ALL_TRANSACTION,\n\n BEGIN_SERVICE_DECLARATION_TRANSACTION,\n\n ADD_INCLUDED_SERVICE_TRANSACTION,\n\n ADD_CHARACTERISTIC_TRANSACTION,\n\n ADD_DESCRIPTOR_TRANSACTION,\n\n END_SERVICE_DECLARATION_TRANSACTION,\n\n REMOVE_SERVICE_TRANSACTION,\n\n CLEAR_SERVICES_TRANSACTION,\n\n SEND_RESPONSE_TRANSACTION,\n\n SEND_NOTIFICATION_TRANSACTION,\n", "file_path": "bt/service/common/bluetooth/binder/IBluetoothGattServer.h", "rank": 91, "score": 194093.86458234084 }, { "content": "// This class defines the Binder IPC interface for interacting with Bluetooth\n\n// GATT client-role features.\n\n// TODO(armansito): This class was written based on a new design doc proposal.\n\n// We need to add an AIDL for this to the framework code.\n\n//\n\n// NOTE: KEEP THIS FILE UP-TO-DATE with the corresponding AIDL, otherwise this\n\n// won't be compatible with the Android framework.\n\nclass IBluetoothGattClient : public android::IInterface {\n\n public:\n\n DECLARE_META_INTERFACE(BluetoothGattClient);\n\n\n\n static const char kServiceName[];\n\n\n\n // Transaction codes for interface methods.\n\n enum {\n\n REGISTER_CLIENT_TRANSACTION = android::IBinder::FIRST_CALL_TRANSACTION,\n\n UNREGISTER_CLIENT_TRANSACTION,\n\n UNREGISTER_ALL_TRANSACTION,\n\n REFRESH_DEVICE_TRANSACTION,\n\n DISCOVER_SERVICES_TRANSACTION,\n\n READ_CHARACTERISTIC_TRANSACTION,\n\n WRITE_CHARACTERISTIC_TRANSACTION,\n\n READ_DESCRIPTOR_TRANSACTION,\n\n WRITE_DESCRIPTOR_TRANSACTION,\n\n REGISTER_FOR_NOTIFICATIONS_TRANSACTION,\n\n UNREGISTER_FOR_NOTIFICATIONS_TRANSACTION,\n\n BEGIN_RELIABLE_WRITE_TRANSACTION,\n", "file_path": "bt/service/common/bluetooth/binder/IBluetoothGattClient.h", "rank": 92, "score": 194093.86458234084 }, { "content": "struct RSA_Delete {\n\n void operator()(RSA* p) const {\n\n RSA_free(p);\n\n }\n\n};\n\ntypedef UniquePtr<RSA, RSA_Delete> Unique_RSA;\n\n\n", "file_path": "security/keystore-engine/android_engine.cpp", "rank": 93, "score": 191044.801386324 }, { "content": "class SetErrorTypeInArgumentAction {\n\n public:\n\n SetErrorTypeInArgumentAction(Error::Type error_type, bool warn_default)\n\n : error_type_(error_type),\n\n warn_default_(warn_default) {}\n\n\n\n template <typename Result, typename ArgumentTuple>\n\n Result Perform(const ArgumentTuple& args) const {\n\n Error* error_arg = ::std::tr1::get<error_argument_index>(args);\n\n if (error_arg)\n\n error_arg->Populate(error_type_);\n\n\n\n // You should be careful if you see this warning in your log messages: it is\n\n // likely that you want to instead set a non-default expectation on this\n\n // mock, to test the success code-paths.\n\n if (warn_default_)\n\n LOG(WARNING) << \"Default action taken: set error to \"\n\n << error_type_\n\n << \"(\" << (error_arg ? error_arg->message() : \"\") << \")\";\n\n }\n", "file_path": "connectivity/shill/testing.h", "rank": 94, "score": 189808.95380421297 }, { "content": "ANDROID_BASIC_TYPES_TRAITS( void )\n", "file_path": "core/include/utils/TypeHelpers.h", "rank": 95, "score": 189741.77638741228 }, { "content": " if (service == NULL) {\n\n ALOGE(\"could not contact keystore\");\n\n return 0;\n\n }\n\n\n\n int num = DSA_size(dsa);\n\n\n\n uint8_t* reply = NULL;\n\n size_t replyLen;\n\n int32_t ret = service->sign(String16(reinterpret_cast<const char*>(key_id)), dgst,\n\n dlen, &reply, &replyLen);\n\n if (ret < 0) {\n\n ALOGW(\"There was an error during dsa_do_sign: could not connect\");\n\n return 0;\n\n } else if (ret != 0) {\n\n ALOGW(\"Error during sign from keystore: %d\", ret);\n\n return 0;\n\n } else if (replyLen <= 0) {\n\n ALOGW(\"No valid signature returned\");\n\n return 0;\n", "file_path": "security/keystore-engine/dsa_meth.cpp", "rank": 99, "score": 105.62104489591168 } ]
C++
cpp/knapsack/tools.hpp
CostaBru/knapsack
cdd95de759c20b0cdeef4064fbbed10df1ab76d0
#ifndef KB_KNAPSACK_PARTITION_SOLUTION_TOOLS_HPP #define KB_KNAPSACK_PARTITION_SOLUTION_TOOLS_HPP #include "fast_map.h" #include "defines.h" #include "w_point_dim1.hpp" #include "w_point_dimN.hpp" #include "w_point.hpp" #include "source_link.hpp" #include <vector> #include <tuple> #include <cmath> #include <deque> #include <numeric> #include <ranges> namespace kb_knapsack { namespace tools { template<typename T, typename W> void sortReverse(std::vector<T> &dimensions, std::vector<W> &values, std::vector<int> &indexes) { std::vector<size_t> p(dimensions.size(), 0); std::iota(p.begin(), p.end(), 0); std::sort(p.begin(), p.end(), [&](size_t i, size_t j) { return dimensions[i] > dimensions[j]; }); applySort3<T, W, int>(dimensions, values, indexes, p.size(), p); } template<class K, class T1, class T2> void applySort3(std::vector<K> &keys, std::vector<T1> &data1, std::vector<T2> &data2, size_t size, std::vector<size_t> p) { std::vector<size_t> rp(size); std::vector<bool> sorted(size, false); size_t i = 0; for (i = 0; i < size; ++i) { rp[p[i]] = i; } i = 0; K savedKey; T1 savedData1; T2 savedData2; while (i < size) { size_t pos = i; if (!sorted[pos]) { savedKey = keys[p[pos]]; savedData1 = data1[p[pos]]; savedData2 = data2[p[pos]]; } while (!sorted[pos]) { K heldKey = keys[pos]; T1 heldData1 = data1[pos]; T2 heldData2 = data2[pos]; size_t heldPos = rp[pos]; keys[pos] = savedKey; data1[pos] = savedData1; data2[pos] = savedData2; savedKey = heldKey; savedData1 = heldData1; savedData2 = heldData2; sorted[pos] = true; pos = heldPos; } ++i; } } template<typename T, typename W, int N, template<typename DIM_TYPE, typename VALUE_TYPE, int DIM_LEN> class DIM> KNAPSACK_RESULT backTraceItems( W & emptyValue, TD & emptyDimension, W_POINT & maxProfitPoint, SOURCE_LINK_LIST & sourcePoints, std::vector<TD > & dimensions, std::vector<W> & values, std::vector<int> & ids) { W zeroProfit = emptyValue; std::vector<TD > optItems; std::vector<W> optValues; std::vector<int> optIndexes; auto optSize = emptyDimension; if (maxProfitPoint.profit > 0) { W maxProfit = maxProfitPoint.profit; source_link pointLink = sourcePoints[maxProfitPoint.id]; while (true) { optItems .emplace_back(dimensions[pointLink.itemId]); optValues .emplace_back(values[pointLink.itemId]); optIndexes.emplace_back(ids[pointLink.itemId]); optSize += dimensions[pointLink.itemId]; if (!pointLink.hasParent()) { break; } pointLink = sourcePoints[pointLink.parentId]; } return std::make_tuple(maxProfit, optSize, optItems, optValues, optIndexes); } return std::make_tuple(zeroProfit, emptyDimension, optItems, optValues, optIndexes); } } } #endif
#ifndef KB_KNAPSACK_PARTITION_SOLUTION_TOOLS_HPP #define KB_KNAPSACK_PARTITION_SOLUTION_TOOLS_HPP #include "fast_map.h" #include "defines.h" #include "w_point_dim1.hpp" #include "w_point_dimN.hpp" #include "w_point.hpp" #include "source_link.hpp" #include <vector> #include <tuple> #include <cmath> #include <deque> #include <numeric> #include <ranges> namespace kb_knapsack { namespace tools { template<typename T, typename W> void sortReverse(std::vector<T> &dimensions, std::vector<W> &values, std::vector<int> &indexes) { std::vector<size_t> p(dimensions.size(), 0); std::iota(p.begin(), p.end(), 0); std::sort(p.begin(), p.end(), [&](size_t i, size_t j) { return dimensions[i] > dimensions[j]; }); applySort3<T, W, int>(dimensions, values, indexes, p.size(), p); } template<class K, class T1, class T2> void applySort3(std::vector<K> &keys, std::vector<T1> &data1, std::vector<T2> &data2, size_t size, std::vector<size_t> p) { std::vector<size_t> rp(size); std::vector<bool> sorted(size, false); size_t i = 0; for (i = 0; i < size; ++i) { rp[p[i]] = i; } i = 0; K savedKey; T1 savedData1; T2 savedData2; while (i < size) { size_t pos = i;
while (!sorted[pos]) { K heldKey = keys[pos]; T1 heldData1 = data1[pos]; T2 heldData2 = data2[pos]; size_t heldPos = rp[pos]; keys[pos] = savedKey; data1[pos] = savedData1; data2[pos] = savedData2; savedKey = heldKey; savedData1 = heldData1; savedData2 = heldData2; sorted[pos] = true; pos = heldPos; } ++i; } } template<typename T, typename W, int N, template<typename DIM_TYPE, typename VALUE_TYPE, int DIM_LEN> class DIM> KNAPSACK_RESULT backTraceItems( W & emptyValue, TD & emptyDimension, W_POINT & maxProfitPoint, SOURCE_LINK_LIST & sourcePoints, std::vector<TD > & dimensions, std::vector<W> & values, std::vector<int> & ids) { W zeroProfit = emptyValue; std::vector<TD > optItems; std::vector<W> optValues; std::vector<int> optIndexes; auto optSize = emptyDimension; if (maxProfitPoint.profit > 0) { W maxProfit = maxProfitPoint.profit; source_link pointLink = sourcePoints[maxProfitPoint.id]; while (true) { optItems .emplace_back(dimensions[pointLink.itemId]); optValues .emplace_back(values[pointLink.itemId]); optIndexes.emplace_back(ids[pointLink.itemId]); optSize += dimensions[pointLink.itemId]; if (!pointLink.hasParent()) { break; } pointLink = sourcePoints[pointLink.parentId]; } return std::make_tuple(maxProfit, optSize, optItems, optValues, optIndexes); } return std::make_tuple(zeroProfit, emptyDimension, optItems, optValues, optIndexes); } } } #endif
if (!sorted[pos]) { savedKey = keys[p[pos]]; savedData1 = data1[p[pos]]; savedData2 = data2[p[pos]]; }
if_condition
[ { "content": "class value_location : public detail::value<T> {\n\n public:\n\n constexpr /*explicit(false)*/ value_location(\n\n const T& t, const reflection::source_location& sl =\n\n reflection::source_location::current())\n\n : detail::value<T>{t} {\n\n cfg::location = sl;\n\n }\n\n\n\n constexpr value_location(const T& t, const T precision,\n\n const reflection::source_location& sl =\n\n reflection::source_location::current())\n\n : detail::value<T>{t, precision} {\n\n cfg::location = sl;\n\n }\n\n};\n\n\n\ntemplate <auto N>\n", "file_path": "cpp/partition_tests/ut.h", "rank": 0, "score": 94166.97222325973 }, { "content": "class value_location : public detail::value<T> {\n\n public:\n\n constexpr /*explicit(false)*/ value_location(\n\n const T& t, const reflection::source_location& sl =\n\n reflection::source_location::current())\n\n : detail::value<T>{t} {\n\n cfg::location = sl;\n\n }\n\n\n\n constexpr value_location(const T& t, const T precision,\n\n const reflection::source_location& sl =\n\n reflection::source_location::current())\n\n : detail::value<T>{t, precision} {\n\n cfg::location = sl;\n\n }\n\n};\n\n\n\ntemplate <auto N>\n", "file_path": "cpp/knapsack_tests/ut.h", "rank": 1, "score": 94166.97222325973 }, { "content": " class F, template <class...> class T, class... Ts,\n\n type_traits::requires_t<not type_traits::is_container_v<T<Ts...>>> = 0>\n\n[[nodiscard]] constexpr auto operator|(const F& f, const T<Ts...>& t) {\n\n return [f, t](const auto name) {\n\n apply(\n\n [f, name](const auto&... args) {\n\n (detail::on<F>(events::test<F, Ts>{.type = \"test\",\n\n .name = name,\n\n .tag = {},\n\n .location = {},\n\n .arg = args,\n\n .run = f}),\n\n ...);\n\n },\n\n t);\n\n };\n\n}\n\n\n\nnamespace terse {\n\n#if defined(__clang__)\n", "file_path": "cpp/knapsack_tests/ut.h", "rank": 2, "score": 88260.76983770405 }, { "content": " class F, template <class...> class T, class... Ts,\n\n type_traits::requires_t<not type_traits::is_container_v<T<Ts...>>> = 0>\n\n[[nodiscard]] constexpr auto operator|(const F& f, const T<Ts...>& t) {\n\n return [f, t](const auto name) {\n\n apply(\n\n [f, name](const auto&... args) {\n\n (detail::on<F>(events::test<F, Ts>{.type = \"test\",\n\n .name = name,\n\n .tag = {},\n\n .location = {},\n\n .arg = args,\n\n .run = f}),\n\n ...);\n\n },\n\n t);\n\n };\n\n}\n\n\n\nnamespace terse {\n\n#if defined(__clang__)\n", "file_path": "cpp/partition_tests/ut.h", "rank": 3, "score": 88260.76983770405 }, { "content": " enum class InsertionState { overflow_error, key_found, new_node, overwrite_node };\n\n\n\n // Finds key, and if not already present prepares a spot where to pot the key & value.\n\n // This potentially shifts nodes out of the way, updates mInfo and number of inserted\n\n // elements, so the only operation left to do is create/assign a new node at that spot.\n\n template <typename OtherKey>\n\n std::pair<size_t, InsertionState> insertKeyPrepareEmptySpot(OtherKey&& key) {\n\n for (int i = 0; i < 256; ++i) {\n\n size_t idx{};\n\n InfoType info{};\n\n keyToIdx(key, &idx, &info);\n\n nextWhileLess(&info, &idx);\n\n\n\n // while we potentially have a match\n\n while (info == mInfo[idx]) {\n\n if (WKeyEqual::operator()(key, mKeyVals[idx].getFirst())) {\n\n // key already exists, do NOT insert.\n\n // see http://en.cppreference.com/w/cpp/container/unordered_map/insert\n\n return std::make_pair(idx, InsertionState::key_found);\n\n }\n", "file_path": "cpp/partition/fast_map.h", "rank": 4, "score": 70621.19966688377 }, { "content": " enum class InsertionState { overflow_error, key_found, new_node, overwrite_node };\n\n\n\n // Finds key, and if not already present prepares a spot where to pot the key & value.\n\n // This potentially shifts nodes out of the way, updates mInfo and number of inserted\n\n // elements, so the only operation left to do is create/assign a new node at that spot.\n\n template <typename OtherKey>\n\n std::pair<size_t, InsertionState> insertKeyPrepareEmptySpot(OtherKey&& key) {\n\n for (int i = 0; i < 256; ++i) {\n\n size_t idx{};\n\n InfoType info{};\n\n keyToIdx(key, &idx, &info);\n\n nextWhileLess(&info, &idx);\n\n\n\n // while we potentially have a match\n\n while (info == mInfo[idx]) {\n\n if (WKeyEqual::operator()(key, mKeyVals[idx].getFirst())) {\n\n // key already exists, do NOT insert.\n\n // see http://en.cppreference.com/w/cpp/container/unordered_map/insert\n\n return std::make_pair(idx, InsertionState::key_found);\n\n }\n", "file_path": "cpp/knapsack/fast_map.h", "rank": 5, "score": 70621.19966688377 }, { "content": "class function;\n\ntemplate <class R, class... TArgs>\n", "file_path": "cpp/knapsack_tests/ut.h", "rank": 6, "score": 70376.53215239762 }, { "content": "class printer {\n\n [[nodiscard]] inline auto color(const bool cond) {\n\n const std::string_view colors[] = {colors_.fail, colors_.pass};\n\n return colors[cond];\n\n }\n\n\n\n public:\n\n printer() = default;\n\n /*explicit(false)*/ printer(const colors colors) : colors_{colors} {}\n\n\n\n template <class T>\n\n auto& operator<<(const T& t) {\n\n out_ << detail::get(t);\n\n return *this;\n\n }\n\n\n\n template <class T,\n\n type_traits::requires_t<type_traits::is_container_v<T> and\n\n not type_traits::has_npos_v<T>> = 0>\n\n auto& operator<<(T&& t) {\n", "file_path": "cpp/knapsack_tests/ut.h", "rank": 7, "score": 70376.53215239762 }, { "content": "class reporter {\n\n public:\n\n constexpr auto operator=(TPrinter printer) {\n\n printer_ = static_cast<TPrinter&&>(printer);\n\n }\n\n\n\n auto on(events::test_begin test_begin) -> void {\n\n printer_ << \"Running \\\"\" << test_begin.name << \"\\\"...\";\n\n fails_ = asserts_.fail;\n\n }\n\n\n\n auto on(events::test_run test_run) -> void {\n\n printer_ << \"\\n \\\"\" << test_run.name << \"\\\"...\";\n\n }\n\n\n\n auto on(events::test_skip test_skip) -> void {\n\n printer_ << test_skip.name << \"...SKIPPED\\n\";\n\n ++tests_.skip;\n\n }\n\n\n", "file_path": "cpp/partition_tests/ut.h", "rank": 8, "score": 70376.53215239762 }, { "content": "class function;\n\ntemplate <class R, class... TArgs>\n", "file_path": "cpp/partition_tests/ut.h", "rank": 9, "score": 70376.53215239762 }, { "content": "class printer {\n\n [[nodiscard]] inline auto color(const bool cond) {\n\n const std::string_view colors[] = {colors_.fail, colors_.pass};\n\n return colors[cond];\n\n }\n\n\n\n public:\n\n printer() = default;\n\n /*explicit(false)*/ printer(const colors colors) : colors_{colors} {}\n\n\n\n template <class T>\n\n auto& operator<<(const T& t) {\n\n out_ << detail::get(t);\n\n return *this;\n\n }\n\n\n\n template <class T,\n\n type_traits::requires_t<type_traits::is_container_v<T> and\n\n not type_traits::has_npos_v<T>> = 0>\n\n auto& operator<<(T&& t) {\n", "file_path": "cpp/partition_tests/ut.h", "rank": 10, "score": 70376.53215239762 }, { "content": "class runner {\n", "file_path": "cpp/partition_tests/ut.h", "rank": 11, "score": 70376.53215239762 }, { "content": " class filter {\n\n static constexpr auto delim = \".\";\n\n\n\n public:\n\n constexpr /*explicit(false)*/ filter(std::string_view filter = {})\n\n : path_{utility::split(filter, delim)} {}\n\n\n\n template <class TPath>\n\n constexpr auto operator()(const std::size_t level, const TPath& path) const\n\n -> bool {\n\n for (auto i = 0u; i < math::min_value(level + 1, std::size(path_)); ++i) {\n\n if (not utility::is_match(path[i], path_[i])) {\n\n return false;\n\n }\n\n }\n\n return true;\n\n }\n\n\n\n private:\n\n std::vector<std::string_view> path_{};\n", "file_path": "cpp/knapsack_tests/ut.h", "rank": 12, "score": 70376.53215239762 }, { "content": " class filter {\n\n static constexpr auto delim = \".\";\n\n\n\n public:\n\n constexpr /*explicit(false)*/ filter(std::string_view filter = {})\n\n : path_{utility::split(filter, delim)} {}\n\n\n\n template <class TPath>\n\n constexpr auto operator()(const std::size_t level, const TPath& path) const\n\n -> bool {\n\n for (auto i = 0u; i < math::min_value(level + 1, std::size(path_)); ++i) {\n\n if (not utility::is_match(path[i], path_[i])) {\n\n return false;\n\n }\n\n }\n\n return true;\n\n }\n\n\n\n private:\n\n std::vector<std::string_view> path_{};\n", "file_path": "cpp/partition_tests/ut.h", "rank": 13, "score": 70376.53215239762 }, { "content": "class terse_ {\n\n public:\n\n constexpr explicit terse_(const TExpr& expr) : expr_{expr} { cfg::wip = {}; }\n\n\n\n ~terse_() noexcept(false) {\n\n if (static auto once = true; once and not cfg::wip) {\n\n once = {};\n\n } else {\n\n return;\n\n }\n\n\n\n cfg::wip = true;\n\n\n\n void(detail::on<TExpr>(\n\n events::assertion<TExpr>{.expr = expr_, .location = cfg::location}));\n\n }\n\n\n\n private:\n\n const TExpr& expr_;\n\n};\n\n\n", "file_path": "cpp/partition_tests/ut.h", "rank": 14, "score": 70376.53215239762 }, { "content": " class Table\n\n : public WrapHash<Hash>,\n\n public WrapKeyEqual<KeyEqual>,\n\n detail::NodeAllocator<\n\n typename std::conditional<\n\n std::is_void<T>::value, Key,\n\n robin_hood::pair<typename std::conditional<IsFlat, Key, Key const>::type, T>>::type,\n\n 4, 16384, IsFlat> {\n\n public:\n\n static constexpr bool is_flat = IsFlat;\n\n static constexpr bool is_map = !std::is_void<T>::value;\n\n static constexpr bool is_set = !is_map;\n\n static constexpr bool is_transparent =\n\n has_is_transparent<Hash>::value && has_is_transparent<KeyEqual>::value;\n\n\n\n using key_type = Key;\n\n using mapped_type = T;\n\n using value_type = typename std::conditional<\n\n is_set, Key,\n\n robin_hood::pair<typename std::conditional<is_flat, Key, Key const>::type, T>>::type;\n", "file_path": "cpp/partition/fast_map.h", "rank": 15, "score": 70376.53215239762 }, { "content": " class Table\n\n : public WrapHash<Hash>,\n\n public WrapKeyEqual<KeyEqual>,\n\n detail::NodeAllocator<\n\n typename std::conditional<\n\n std::is_void<T>::value, Key,\n\n robin_hood::pair<typename std::conditional<IsFlat, Key, Key const>::type, T>>::type,\n\n 4, 16384, IsFlat> {\n\n public:\n\n static constexpr bool is_flat = IsFlat;\n\n static constexpr bool is_map = !std::is_void<T>::value;\n\n static constexpr bool is_set = !is_map;\n\n static constexpr bool is_transparent =\n\n has_is_transparent<Hash>::value && has_is_transparent<KeyEqual>::value;\n\n\n\n using key_type = Key;\n\n using mapped_type = T;\n\n using value_type = typename std::conditional<\n\n is_set, Key,\n\n robin_hood::pair<typename std::conditional<is_flat, Key, Key const>::type, T>>::type;\n", "file_path": "cpp/knapsack/fast_map.h", "rank": 16, "score": 70376.53215239762 }, { "content": " // NOLINTNEXTLINE(hicpp-special-member-functions,cppcoreguidelines-special-member-functions)\n\n class Iter {\n\n private:\n\n using NodePtr = typename std::conditional<IsConst, Node const*, Node*>::type;\n\n\n\n public:\n\n using difference_type = std::ptrdiff_t;\n\n using value_type = typename Self::value_type;\n\n using reference = typename std::conditional<IsConst, value_type const&, value_type&>::type;\n\n using pointer = typename std::conditional<IsConst, value_type const*, value_type*>::type;\n\n using iterator_category = std::forward_iterator_tag;\n\n\n\n // default constructed iterator can be compared to itself, but WON'T return true when\n\n // compared to end().\n\n Iter() = default;\n\n\n\n // Rule of zero: nothing specified. The conversion constructor is only enabled for\n\n // iterator to const_iterator, so it doesn't accidentally work as a copy ctor.\n\n\n\n // Conversion constructor from iterator to const_iterator.\n\n template <bool OtherIsConst,\n", "file_path": "cpp/partition/fast_map.h", "rank": 17, "score": 70376.53215239762 }, { "content": " class step {\n\n public:\n\n template <class TPattern>\n\n step(steps& steps, const TPattern& pattern)\n\n : steps_{steps}, pattern_{pattern} {}\n\n\n\n ~step() { steps_.next(pattern_); }\n\n\n\n template <class TExpr>\n\n auto operator=(const TExpr& expr) -> void {\n\n for (const auto& [pattern, _] : steps_.call_steps()) {\n\n if (pattern_ == pattern) {\n\n return;\n\n }\n\n }\n\n\n\n steps_.call_steps().emplace_back(\n\n pattern_, [expr, pattern = pattern_](const auto& step) {\n\n [=]<class... TArgs>(type_traits::list<TArgs...>) {\n\n log << step;\n", "file_path": "cpp/partition_tests/ut.h", "rank": 18, "score": 70376.53215239762 }, { "content": " class step {\n\n public:\n\n template <class TPattern>\n\n step(steps& steps, const TPattern& pattern)\n\n : steps_{steps}, pattern_{pattern} {}\n\n\n\n ~step() { steps_.next(pattern_); }\n\n\n\n template <class TExpr>\n\n auto operator=(const TExpr& expr) -> void {\n\n for (const auto& [pattern, _] : steps_.call_steps()) {\n\n if (pattern_ == pattern) {\n\n return;\n\n }\n\n }\n\n\n\n steps_.call_steps().emplace_back(\n\n pattern_, [expr, pattern = pattern_](const auto& step) {\n\n [=]<class... TArgs>(type_traits::list<TArgs...>) {\n\n log << step;\n", "file_path": "cpp/knapsack_tests/ut.h", "rank": 19, "score": 70376.53215239762 }, { "content": " // NOLINTNEXTLINE(hicpp-special-member-functions,cppcoreguidelines-special-member-functions)\n\n class Iter {\n\n private:\n\n using NodePtr = typename std::conditional<IsConst, Node const*, Node*>::type;\n\n\n\n public:\n\n using difference_type = std::ptrdiff_t;\n\n using value_type = typename Self::value_type;\n\n using reference = typename std::conditional<IsConst, value_type const&, value_type&>::type;\n\n using pointer = typename std::conditional<IsConst, value_type const*, value_type*>::type;\n\n using iterator_category = std::forward_iterator_tag;\n\n\n\n // default constructed iterator can be compared to itself, but WON'T return true when\n\n // compared to end().\n\n Iter() = default;\n\n\n\n // Rule of zero: nothing specified. The conversion constructor is only enabled for\n\n // iterator to const_iterator, so it doesn't accidentally work as a copy ctor.\n\n\n\n // Conversion constructor from iterator to const_iterator.\n\n template <bool OtherIsConst,\n", "file_path": "cpp/knapsack/fast_map.h", "rank": 20, "score": 70376.53215239762 }, { "content": "class steps {\n\n using step_t = std::string;\n\n using steps_t = void (*)(steps&);\n\n using gherkin_t = std::vector<step_t>;\n\n using call_step_t = utility::function<void(const std::string&)>;\n\n using call_steps_t = std::vector<std::pair<step_t, call_step_t>>;\n\n\n", "file_path": "cpp/partition_tests/ut.h", "rank": 21, "score": 70376.53215239762 }, { "content": "class runner {\n", "file_path": "cpp/knapsack_tests/ut.h", "rank": 22, "score": 70376.53215239762 }, { "content": "class steps {\n\n using step_t = std::string;\n\n using steps_t = void (*)(steps&);\n\n using gherkin_t = std::vector<step_t>;\n\n using call_step_t = utility::function<void(const std::string&)>;\n\n using call_steps_t = std::vector<std::pair<step_t, call_step_t>>;\n\n\n", "file_path": "cpp/knapsack_tests/ut.h", "rank": 23, "score": 70376.53215239762 }, { "content": "class terse_ {\n\n public:\n\n constexpr explicit terse_(const TExpr& expr) : expr_{expr} { cfg::wip = {}; }\n\n\n\n ~terse_() noexcept(false) {\n\n if (static auto once = true; once and not cfg::wip) {\n\n once = {};\n\n } else {\n\n return;\n\n }\n\n\n\n cfg::wip = true;\n\n\n\n void(detail::on<TExpr>(\n\n events::assertion<TExpr>{.expr = expr_, .location = cfg::location}));\n\n }\n\n\n\n private:\n\n const TExpr& expr_;\n\n};\n\n\n", "file_path": "cpp/knapsack_tests/ut.h", "rank": 24, "score": 70376.53215239762 }, { "content": "class reporter {\n\n public:\n\n constexpr auto operator=(TPrinter printer) {\n\n printer_ = static_cast<TPrinter&&>(printer);\n\n }\n\n\n\n auto on(events::test_begin test_begin) -> void {\n\n printer_ << \"Running \\\"\" << test_begin.name << \"\\\"...\";\n\n fails_ = asserts_.fail;\n\n }\n\n\n\n auto on(events::test_run test_run) -> void {\n\n printer_ << \"\\n \\\"\" << test_run.name << \"\\\"...\";\n\n }\n\n\n\n auto on(events::test_skip test_skip) -> void {\n\n printer_ << test_skip.name << \"...SKIPPED\\n\";\n\n ++tests_.skip;\n\n }\n\n\n", "file_path": "cpp/knapsack_tests/ut.h", "rank": 25, "score": 70376.53215239762 }, { "content": " class DataNode {};\n\n\n\n // Small: just allocate on the stack.\n\n template <typename M>\n", "file_path": "cpp/partition/fast_map.h", "rank": 26, "score": 68677.05220866673 }, { "content": "class source_location {\n\n public:\n\n [[nodiscard]] static constexpr auto current(\n\n#if (__has_builtin(__builtin_FILE) and __has_builtin(__builtin_LINE))\n\n const char* file = __builtin_FILE(), int line = __builtin_LINE()\n\n#else\n\n const char* file = \"unknown\", int line = {}\n\n#endif\n\n ) noexcept {\n\n source_location sl{};\n\n sl.file_ = file;\n\n sl.line_ = line;\n\n return sl;\n\n }\n\n [[nodiscard]] constexpr auto file_name() const noexcept { return file_; }\n\n [[nodiscard]] constexpr auto line() const noexcept { return line_; }\n\n\n\n private:\n\n const char* file_{\"unknown\"};\n\n int line_{};\n", "file_path": "cpp/knapsack_tests/ut.h", "rank": 27, "score": 68677.05220866673 }, { "content": " class DataNode {};\n\n\n\n // Small: just allocate on the stack.\n\n template <typename M>\n", "file_path": "cpp/knapsack/fast_map.h", "rank": 28, "score": 68677.05220866673 }, { "content": " class integer_sequence {\n\n public:\n\n using value_type = T;\n\n static_assert(std::is_integral<value_type>::value, \"not integral type\");\n\n static constexpr std::size_t size() noexcept {\n\n return sizeof...(Ints);\n\n }\n\n };\n\n template <std::size_t... Inds>\n\n using index_sequence = integer_sequence<std::size_t, Inds...>;\n\n\n\n namespace detail_ {\n\n template <class T, T Begin, T End, bool>\n\n struct IntSeqImpl {\n\n using TValue = T;\n\n static_assert(std::is_integral<TValue>::value, \"not integral type\");\n\n static_assert(Begin >= 0 && Begin < End, \"unexpected argument (Begin<0 || Begin<=End)\");\n\n\n\n template <class, class>\n\n struct IntSeqCombiner;\n", "file_path": "cpp/partition/fast_map.h", "rank": 29, "score": 68677.05220866673 }, { "content": " class integer_sequence {\n\n public:\n\n using value_type = T;\n\n static_assert(std::is_integral<value_type>::value, \"not integral type\");\n\n static constexpr std::size_t size() noexcept {\n\n return sizeof...(Ints);\n\n }\n\n };\n\n template <std::size_t... Inds>\n\n using index_sequence = integer_sequence<std::size_t, Inds...>;\n\n\n\n namespace detail_ {\n\n template <class T, T Begin, T End, bool>\n\n struct IntSeqImpl {\n\n using TValue = T;\n\n static_assert(std::is_integral<TValue>::value, \"not integral type\");\n\n static_assert(Begin >= 0 && Begin < End, \"unexpected argument (Begin<0 || Begin<=End)\");\n\n\n\n template <class, class>\n\n struct IntSeqCombiner;\n", "file_path": "cpp/knapsack/fast_map.h", "rank": 30, "score": 68677.05220866673 }, { "content": "class source_location {\n\n public:\n\n [[nodiscard]] static constexpr auto current(\n\n#if (__has_builtin(__builtin_FILE) and __has_builtin(__builtin_LINE))\n\n const char* file = __builtin_FILE(), int line = __builtin_LINE()\n\n#else\n\n const char* file = \"unknown\", int line = {}\n\n#endif\n\n ) noexcept {\n\n source_location sl{};\n\n sl.file_ = file;\n\n sl.line_ = line;\n\n return sl;\n\n }\n\n [[nodiscard]] constexpr auto file_name() const noexcept { return file_; }\n\n [[nodiscard]] constexpr auto line() const noexcept { return line_; }\n\n\n\n private:\n\n const char* file_{\"unknown\"};\n\n int line_{};\n", "file_path": "cpp/partition_tests/ut.h", "rank": 31, "score": 68677.05220866673 }, { "content": "class BulkPoolAllocator {\n\npublic:\n\n BulkPoolAllocator() noexcept = default;\n\n\n\n // does not copy anything, just creates a new allocator.\n\n BulkPoolAllocator(const BulkPoolAllocator& ROBIN_HOOD_UNUSED(o) /*unused*/) noexcept\n\n : mHead(nullptr)\n\n , mListForFree(nullptr) {}\n\n\n\n BulkPoolAllocator(BulkPoolAllocator&& o) noexcept\n\n : mHead(o.mHead)\n\n , mListForFree(o.mListForFree) {\n\n o.mListForFree = nullptr;\n\n o.mHead = nullptr;\n\n }\n\n\n\n BulkPoolAllocator& operator=(BulkPoolAllocator&& o) noexcept {\n\n reset();\n\n mHead = o.mHead;\n\n mListForFree = o.mListForFree;\n", "file_path": "cpp/partition/fast_map.h", "rank": 32, "score": 67119.3271990968 }, { "content": "class BulkPoolAllocator {\n\npublic:\n\n BulkPoolAllocator() noexcept = default;\n\n\n\n // does not copy anything, just creates a new allocator.\n\n BulkPoolAllocator(const BulkPoolAllocator& ROBIN_HOOD_UNUSED(o) /*unused*/) noexcept\n\n : mHead(nullptr)\n\n , mListForFree(nullptr) {}\n\n\n\n BulkPoolAllocator(BulkPoolAllocator&& o) noexcept\n\n : mHead(o.mHead)\n\n , mListForFree(o.mListForFree) {\n\n o.mListForFree = nullptr;\n\n o.mHead = nullptr;\n\n }\n\n\n\n BulkPoolAllocator& operator=(BulkPoolAllocator&& o) noexcept {\n\n reset();\n\n mHead = o.mHead;\n\n mListForFree = o.mListForFree;\n", "file_path": "cpp/knapsack/fast_map.h", "rank": 33, "score": 67119.3271990968 }, { "content": " class knapsack_solver {\n\n\n\n public:\n\n\n\n TD Constraints;\n\n\n\n std::vector<TD> Dimensions;\n\n std::vector<W> Values;\n\n std::vector<int> Ids;\n\n\n\n TD EmptyDimension;\n\n W EmptyValue;\n\n\n\n W MinValue;\n\n\n\n bool DoSolveSuperInc = true;\n\n bool DoUseLimits = true;\n\n bool UseRatioSort = false;\n\n\n\n bool ForceUsePareto = false;\n", "file_path": "cpp/knapsack/knapsack_solver.hpp", "rank": 34, "score": 67119.3271990968 }, { "content": " class knapsack_limit_solver {\n\n public:\n\n\n\n knapsack_limit_solver( std::vector<TD> & Dimensions, std::vector<W> & Values, std::vector<int> & Ids) :\n\n Dimensions(Dimensions),\n\n Values(Values),\n\n Ids(Ids) {\n\n }\n\n\n\n std::vector<TD> Dimensions;\n\n std::vector<W> Values;\n\n std::vector<int> Ids;\n\n\n\n TD EmptyDimension;\n\n W EmptyValue;\n\n\n\n bool DoSolveSuperInc = true;\n\n bool DoUseLimits = true;\n\n\n\n bool CanBackTraceWhenSizeReached = false;\n", "file_path": "cpp/knapsack/knapsack_limits_solver.hpp", "rank": 35, "score": 64363.66051149794 }, { "content": " class knapsack_pareto_solver {\n\n public:\n\n\n\n TD EmptyDimension;\n\n W EmptyValue;\n\n\n\n W MinValue;\n\n\n\n bool UseRatioSort = true;\n\n bool CanBackTraceWhenSizeReached = true;\n\n\n\n std::vector<TD> Dimensions;\n\n std::vector<W> Values;\n\n std::vector<int> Ids;\n\n\n\n W_POINT_LIST ParetoOptimal;\n\n SOURCE_LINK_LIST SourcePoints;\n\n\n\n knapsack_pareto_solver(std::vector<TD> & Dimensions, std::vector<W> & Values, std::vector<int> & Ids) :\n\n Dimensions(Dimensions),\n", "file_path": "cpp/knapsack/knapsack_pareto_solver.hpp", "rank": 36, "score": 64363.66051149794 }, { "content": " class knapsack_superincreasing_solver {\n\n public:\n\n knapsack_superincreasing_solver() {\n\n }\n\n\n\n TD EmptyDimension;\n\n W EmptyValue;\n\n\n\n KNAPSACK_RESULT Solve(TD &size,\n\n std::vector<TD > &items,\n\n std::vector<W> &values,\n\n std::vector<int> &itemsIndex,\n\n int count,\n\n bool allAsc) {\n\n\n\n int starting = 1;\n\n std::vector<TD > resultItems;\n\n std::vector<W> resultValues;\n\n std::vector<int> resultIndex;\n\n\n", "file_path": "cpp/knapsack/knapsack_superincreasing_solver.hpp", "rank": 37, "score": 64363.66051149794 }, { "content": " class knapsack_greedy_top_down_solver {\n\n\n\n public:\n\n\n\n knapsack_greedy_top_down_solver(std::vector<TD> & Dimensions, std::vector<W> & Values, std::vector<int> & Ids) :\n\n Dimensions(Dimensions),\n\n Values(Values),\n\n Ids(Ids) {\n\n }\n\n\n\n TD Constraints;\n\n\n\n std::vector<TD> Dimensions;\n\n std::vector<W> Values;\n\n std::vector<int> Ids;\n\n\n\n TD EmptyDimension;\n\n W EmptyValue;\n\n\n\n W MinValue;\n", "file_path": "cpp/knapsack/knapsack_greedy_top_down_solver.hpp", "rank": 38, "score": 62001.974012295235 }, { "content": " class DataNode<M, false> {\n\n public:\n\n template <typename... Args>\n\n explicit DataNode(M& map, Args&&... args)\n\n : mData(map.allocate()) {\n\n ::new (static_cast<void*>(mData)) value_type(std::forward<Args>(args)...);\n\n }\n\n\n\n DataNode(M& ROBIN_HOOD_UNUSED(map) /*unused*/, DataNode<M, false>&& n) noexcept\n\n : mData(std::move(n.mData)) {}\n\n\n\n void destroy(M& map) noexcept {\n\n // don't deallocate, just put it into list of datapool.\n\n mData->~value_type();\n\n map.deallocate(mData);\n\n }\n\n\n\n void destroyDoNotDeallocate() noexcept {\n\n mData->~value_type();\n\n }\n", "file_path": "cpp/partition/fast_map.h", "rank": 39, "score": 57630.77262095866 }, { "content": "class function<R(TArgs...)> {\n\n public:\n\n constexpr function() = default;\n\n template <class T>\n\n constexpr /*explicit(false)*/ function(T data)\n\n : invoke_{invoke_impl<T>},\n\n destroy_{destroy_impl<T>},\n\n data_{new T{static_cast<T&&>(data)}} {}\n\n constexpr function(function&& other) noexcept\n\n : invoke_{static_cast<decltype(other.invoke_)&&>(other.invoke_)},\n\n destroy_{static_cast<decltype(other.destroy_)&&>(other.destroy_)},\n\n data_{static_cast<decltype(other.data_)&&>(other.data_)} {\n\n other.data_ = {};\n\n }\n\n constexpr function(const function&) = delete;\n\n ~function() { destroy_(data_); }\n\n\n\n constexpr function& operator=(const function&) = delete;\n\n constexpr function& operator=(function&&) = delete;\n\n [[nodiscard]] constexpr auto operator()(TArgs... args) -> R {\n", "file_path": "cpp/knapsack_tests/ut.h", "rank": 40, "score": 57630.77262095866 }, { "content": "class function<R(TArgs...)> {\n\n public:\n\n constexpr function() = default;\n\n template <class T>\n\n constexpr /*explicit(false)*/ function(T data)\n\n : invoke_{invoke_impl<T>},\n\n destroy_{destroy_impl<T>},\n\n data_{new T{static_cast<T&&>(data)}} {}\n\n constexpr function(function&& other) noexcept\n\n : invoke_{static_cast<decltype(other.invoke_)&&>(other.invoke_)},\n\n destroy_{static_cast<decltype(other.destroy_)&&>(other.destroy_)},\n\n data_{static_cast<decltype(other.data_)&&>(other.data_)} {\n\n other.data_ = {};\n\n }\n\n constexpr function(const function&) = delete;\n\n ~function() { destroy_(data_); }\n\n\n\n constexpr function& operator=(const function&) = delete;\n\n constexpr function& operator=(function&&) = delete;\n\n [[nodiscard]] constexpr auto operator()(TArgs... args) -> R {\n", "file_path": "cpp/partition_tests/ut.h", "rank": 41, "score": 57630.77262095866 }, { "content": " class DataNode<M, false> {\n\n public:\n\n template <typename... Args>\n\n explicit DataNode(M& map, Args&&... args)\n\n : mData(map.allocate()) {\n\n ::new (static_cast<void*>(mData)) value_type(std::forward<Args>(args)...);\n\n }\n\n\n\n DataNode(M& ROBIN_HOOD_UNUSED(map) /*unused*/, DataNode<M, false>&& n) noexcept\n\n : mData(std::move(n.mData)) {}\n\n\n\n void destroy(M& map) noexcept {\n\n // don't deallocate, just put it into list of datapool.\n\n mData->~value_type();\n\n map.deallocate(mData);\n\n }\n\n\n\n void destroyDoNotDeallocate() noexcept {\n\n mData->~value_type();\n\n }\n", "file_path": "cpp/knapsack/fast_map.h", "rank": 42, "score": 57630.77262095866 }, { "content": "struct hash<Enum, typename std::enable_if<std::is_enum<Enum>::value>::type> {\n\n size_t operator()(Enum e) const noexcept {\n\n using Underlying = typename std::underlying_type<Enum>::type;\n\n return hash<Underlying>{}(static_cast<Underlying>(e));\n\n }\n\n};\n\n\n\n#define ROBIN_HOOD_HASH_INT(T) \\\n\n template <> \\\n\n struct hash<T> { \\\n\n size_t operator()(T const& obj) const noexcept { \\\n\n return hash_int(static_cast<uint64_t>(obj)); \\\n\n } \\\n\n }\n\n\n\n#if defined(__GNUC__) && !defined(__clang__)\n\n# pragma GCC diagnostic push\n\n# pragma GCC diagnostic ignored \"-Wuseless-cast\"\n\n#endif\n\n// see https://en.cppreference.com/w/cpp/utility/hash\n", "file_path": "cpp/knapsack/fast_map.h", "rank": 43, "score": 55649.39339800428 }, { "content": "struct hash<Enum, typename std::enable_if<std::is_enum<Enum>::value>::type> {\n\n size_t operator()(Enum e) const noexcept {\n\n using Underlying = typename std::underlying_type<Enum>::type;\n\n return hash<Underlying>{}(static_cast<Underlying>(e));\n\n }\n\n};\n\n\n\n#define ROBIN_HOOD_HASH_INT(T) \\\n\n template <> \\\n\n struct hash<T> { \\\n\n size_t operator()(T const& obj) const noexcept { \\\n\n return hash_int(static_cast<uint64_t>(obj)); \\\n\n } \\\n\n }\n\n\n\n#if defined(__GNUC__) && !defined(__clang__)\n\n# pragma GCC diagnostic push\n\n# pragma GCC diagnostic ignored \"-Wuseless-cast\"\n\n#endif\n\n// see https://en.cppreference.com/w/cpp/utility/hash\n", "file_path": "cpp/partition/fast_map.h", "rank": 44, "score": 55649.39339800428 }, { "content": "struct throws_<TExpr, void> : op {\n\n constexpr explicit throws_(const TExpr& expr)\n\n : value_{[&expr] {\n\n try {\n\n expr();\n\n } catch (...) {\n\n return true;\n\n }\n\n return false;\n\n }()} {}\n\n\n\n [[nodiscard]] constexpr operator bool() const { return value_; }\n\n\n\n const bool value_{};\n\n};\n\n\n\ntemplate <class TExpr>\n", "file_path": "cpp/knapsack_tests/ut.h", "rank": 45, "score": 54113.418544055814 }, { "content": "struct throws_<TExpr, void> : op {\n\n constexpr explicit throws_(const TExpr& expr)\n\n : value_{[&expr] {\n\n try {\n\n expr();\n\n } catch (...) {\n\n return true;\n\n }\n\n return false;\n\n }()} {}\n\n\n\n [[nodiscard]] constexpr operator bool() const { return value_; }\n\n\n\n const bool value_{};\n\n};\n\n\n\ntemplate <class TExpr>\n", "file_path": "cpp/partition_tests/ut.h", "rank": 46, "score": 54113.418544055814 }, { "content": " class DataNode<M, true> final {\n\n public:\n\n template <typename... Args>\n\n explicit DataNode(M& ROBIN_HOOD_UNUSED(map) /*unused*/, Args&&... args) noexcept(\n\n noexcept(value_type(std::forward<Args>(args)...)))\n\n : mData(std::forward<Args>(args)...) {}\n\n\n\n DataNode(M& ROBIN_HOOD_UNUSED(map) /*unused*/, DataNode<M, true>&& n) noexcept(\n\n std::is_nothrow_move_constructible<value_type>::value)\n\n : mData(std::move(n.mData)) {}\n\n\n\n // doesn't do anything\n\n void destroy(M& ROBIN_HOOD_UNUSED(map) /*unused*/) noexcept {}\n\n void destroyDoNotDeallocate() noexcept {}\n\n\n\n value_type const* operator->() const noexcept {\n\n return &mData;\n\n }\n\n value_type* operator->() noexcept {\n\n return &mData;\n", "file_path": "cpp/knapsack/fast_map.h", "rank": 47, "score": 53656.9368544991 }, { "content": " class DataNode<M, true> final {\n\n public:\n\n template <typename... Args>\n\n explicit DataNode(M& ROBIN_HOOD_UNUSED(map) /*unused*/, Args&&... args) noexcept(\n\n noexcept(value_type(std::forward<Args>(args)...)))\n\n : mData(std::forward<Args>(args)...) {}\n\n\n\n DataNode(M& ROBIN_HOOD_UNUSED(map) /*unused*/, DataNode<M, true>&& n) noexcept(\n\n std::is_nothrow_move_constructible<value_type>::value)\n\n : mData(std::move(n.mData)) {}\n\n\n\n // doesn't do anything\n\n void destroy(M& ROBIN_HOOD_UNUSED(map) /*unused*/) noexcept {}\n\n void destroyDoNotDeallocate() noexcept {}\n\n\n\n value_type const* operator->() const noexcept {\n\n return &mData;\n\n }\n\n value_type* operator->() noexcept {\n\n return &mData;\n", "file_path": "cpp/partition/fast_map.h", "rank": 48, "score": 53656.9368544991 }, { "content": "struct NodeAllocator<T, MinSize, MaxSize, false> : public BulkPoolAllocator<T, MinSize, MaxSize> {};\n\n\n\n// c++14 doesn't have is_nothrow_swappable, and clang++ 6.0.1 doesn't like it either, so I'm making\n\n// my own here.\n\nnamespace swappable {\n\n#if ROBIN_HOOD(CXX) < ROBIN_HOOD(CXX17)\n\n using std::swap;\n\n template <typename T>\n\n struct nothrow {\n\n static const bool value = noexcept(swap(std::declval<T&>(), std::declval<T&>()));\n\n };\n\n#else\n\n template <typename T>\n", "file_path": "cpp/partition/fast_map.h", "rank": 49, "score": 46080.57812110451 }, { "content": "struct NodeAllocator<T, MinSize, MaxSize, false> : public BulkPoolAllocator<T, MinSize, MaxSize> {};\n\n\n\n// c++14 doesn't have is_nothrow_swappable, and clang++ 6.0.1 doesn't like it either, so I'm making\n\n// my own here.\n\nnamespace swappable {\n\n#if ROBIN_HOOD(CXX) < ROBIN_HOOD(CXX17)\n\n using std::swap;\n\n template <typename T>\n\n struct nothrow {\n\n static const bool value = noexcept(swap(std::declval<T&>(), std::declval<T&>()));\n\n };\n\n#else\n\n template <typename T>\n", "file_path": "cpp/knapsack/fast_map.h", "rank": 50, "score": 46080.57812110451 }, { "content": "struct NodeAllocator<T, MinSize, MaxSize, true> {\n\n\n\n // we are not using the data, so just free it.\n\n void addOrFree(void* ptr, size_t ROBIN_HOOD_UNUSED(numBytes) /*unused*/) noexcept {\n\n ROBIN_HOOD_LOG(\"std::free\")\n\n std::free(ptr);\n\n }\n\n};\n\n\n\ntemplate <typename T, size_t MinSize, size_t MaxSize>\n", "file_path": "cpp/knapsack/fast_map.h", "rank": 51, "score": 41788.79371950497 }, { "content": "struct NodeAllocator<T, MinSize, MaxSize, true> {\n\n\n\n // we are not using the data, so just free it.\n\n void addOrFree(void* ptr, size_t ROBIN_HOOD_UNUSED(numBytes) /*unused*/) noexcept {\n\n ROBIN_HOOD_LOG(\"std::free\")\n\n std::free(ptr);\n\n }\n\n};\n\n\n\ntemplate <typename T, size_t MinSize, size_t MaxSize>\n", "file_path": "cpp/partition/fast_map.h", "rank": 52, "score": 41788.79371950497 }, { "content": "struct value : op {\n\n using value_type = T;\n\n\n\n constexpr /*explicit(false)*/ value(const T& value) : value_{value} {}\n\n [[nodiscard]] constexpr explicit operator T() const { return value_; }\n\n [[nodiscard]] constexpr decltype(auto) get() const { return value_; }\n\n\n\n T value_{};\n\n};\n\n\n\ntemplate <class T>\n", "file_path": "cpp/partition_tests/ut.h", "rank": 60, "score": 37463.66769148817 }, { "content": "struct value : op {\n\n using value_type = T;\n\n\n\n constexpr /*explicit(false)*/ value(const T& value) : value_{value} {}\n\n [[nodiscard]] constexpr explicit operator T() const { return value_; }\n\n [[nodiscard]] constexpr decltype(auto) get() const { return value_; }\n\n\n\n T value_{};\n\n};\n\n\n\ntemplate <class T>\n", "file_path": "cpp/knapsack_tests/ut.h", "rank": 61, "score": 37463.66769148817 }, { "content": "struct _t : detail::value<T> {\n\n constexpr explicit _t(const T& t) : detail::value<T>{t} {}\n\n};\n\n\n", "file_path": "cpp/knapsack_tests/ut.h", "rank": 62, "score": 35901.230968823416 }, { "content": "struct _t : detail::value<T> {\n\n constexpr explicit _t(const T& t) : detail::value<T>{t} {}\n\n};\n\n\n", "file_path": "cpp/partition_tests/ut.h", "rank": 63, "score": 35901.230968823416 }, { "content": "def sortReverse3Both(w, v, x):\n\n sorted_pairs = sorted(zip(w, v, x), reverse=True, key=lambda t: (t[0], t[1], t[2]))\n\n tuples = zip(*sorted_pairs)\n", "file_path": "python3/tests/helpers.py", "rank": 64, "score": 31966.62428036642 }, { "content": "def sortReverseBoth(w, v, reverse=True):\n\n sorted_pairs = sorted(zip(w, v), reverse=reverse, key=lambda t: (t[0], t[1]))\n\n tuples = zip(*sorted_pairs)\n", "file_path": "python3/tests/helpers.py", "rank": 65, "score": 31966.62428036642 }, { "content": " def getSize(self):\n", "file_path": "python3/knapsack/wPoint.py", "rank": 66, "score": 31962.511407615693 }, { "content": " def setValue(self, curDP, p, curVal, curW, iterCounter):\n\n curDP[p] = (curVal, curW)\n", "file_path": "python3/knapsack/knapsack.py", "rank": 67, "score": 31908.91065956115 }, { "content": " def getValue(self, p, prevDP):\n\n\n\n if p in prevDP:\n\n cur = prevDP[p]\n\n return cur[0], cur[1]\n\n\n", "file_path": "python3/knapsack/knapsack.py", "rank": 68, "score": 31908.91065956115 }, { "content": " def unionTuples(tuples):\n\n rez = []\n\n for t in tuples:\n\n for tn in t:\n\n rez.append(tn)\n\n rez.sort()\n", "file_path": "python3/tests/test_knapsack.py", "rank": 69, "score": 30852.616084068035 }, { "content": " def sortBoth(self, w, v, reverse=True):\n\n sorted_pairs = sorted(zip(w, v), reverse=reverse, key=lambda t: (t[0], t[1]))\n\n tuples = zip(*sorted_pairs)\n", "file_path": "python3/knapsack/greedyNdKnapsack.py", "rank": 70, "score": 30824.0498978182 }, { "content": " def sortByRatio(self, w, v, t, iterCounter):\n\n if len(w) > 0:\n\n sorted_pairs = sorted(zip(w, v, t), key=lambda t: (t[1] / t[0], t[1], t[0]))\n\n tuples = zip(*sorted_pairs)\n\n iterCounter[0] += len(w) * math.log2(len(w))\n\n return [list(tuple) for tuple in tuples]\n\n \n", "file_path": "python3/knapsack/knapsackPareto.py", "rank": 71, "score": 30824.0498978182 }, { "content": " def sortByDims(self, w, v, t, iterCounter):\n\n if len(w) > 0:\n\n sorted_pairs = sorted(zip(w, v, t), key=lambda t: (t[0], t[0] / t[1]))\n\n tuples = zip(*sorted_pairs)\n\n iterCounter[0] += len(w) * math.log2(len(w))\n\n return [list(tuple) for tuple in tuples]\n\n \n", "file_path": "python3/knapsack/knapsackPareto.py", "rank": 72, "score": 30824.0498978182 }, { "content": " def getSizes(self, items, sizesOrPartitions):\n\n sizes = sizesOrPartitions\n\n\n\n sameSizes = isinstance(sizesOrPartitions, int)\n\n\n\n if sameSizes:\n\n\n\n itemsSum = sum(items)\n\n\n\n if isinstance(itemsSum, int):\n\n size = itemsSum // sizesOrPartitions\n\n sizes = [size] * sizesOrPartitions\n\n else:\n\n size = Decimal(itemsSum / Decimal(sizesOrPartitions))\n\n sizes = [size] * sizesOrPartitions\n\n\n", "file_path": "python3/partition/partitionN.py", "rank": 73, "score": 30820.084030362825 }, { "content": " def getItemIndex(self, count, i, allAsc):\n", "file_path": "python3/knapsack/knapsack.py", "rank": 74, "score": 30780.36617340268 }, { "content": " def getValue(self, point, dp):\n\n\n\n if point in dp:\n\n return dp[point]\n\n \n", "file_path": "python3/knapsack/subsKnapsack.py", "rank": 75, "score": 30768.399119309877 }, { "content": "def listValuesEqual(l1, l2):\n\n l1.sort()\n\n l2.sort()\n", "file_path": "python3/tests/helpers.py", "rank": 76, "score": 30768.399119309877 }, { "content": " def getValue(self, p, prevDP):\n\n\n\n if p in prevDP:\n\n cur = prevDP[p]\n\n return cur[0], cur[1]\n\n\n", "file_path": "python3/knapsack/knapsackNd.py", "rank": 77, "score": 30768.399119309877 }, { "content": " def setValue(self, curDP, p, curVal, curDimensions, iterCounter):\n\n curDP[p] = (curVal, curDimensions)\n", "file_path": "python3/knapsack/knapsackNd.py", "rank": 78, "score": 30768.399119309877 }, { "content": " def setValue(self, curDP, p, curVal, iterCounter):\n\n curDP[p] = curVal \n", "file_path": "python3/knapsack/subsKnapsack.py", "rank": 79, "score": 30768.399119309877 }, { "content": " def getPossibleValue(self, point, itemValue, itemWeight, dp):\n\n\n\n if point in dp:\n\n cur = dp[point]\n\n return cur[0] + itemValue, cur[1] + itemWeight\n\n\n\n if point < 0:\n\n return None, None\n\n\n", "file_path": "python3/knapsack/knapsack.py", "rank": 80, "score": 30768.399119309877 }, { "content": " def sortReverse3Both(self, w, v, x):\n\n sorted_pairs = sorted(zip(w, v, x), reverse=True, key=lambda t: (t[0], t[1]))\n\n tuples = zip(*sorted_pairs)\n", "file_path": "python3/knapsack/greedyNdKnapsack.py", "rank": 81, "score": 29760.33433833885 }, { "content": " def mergeTwoSorted(itemSet1, itemSet2):\n\n\n\n result = []\n\n\n\n moveL1, moveL2 = True, True\n\n n1, n2 = True, True\n\n\n\n iter_1 = iter(itemSet1)\n\n iter_2 = iter(itemSet2)\n\n\n\n val1, val2 = 0, 0\n\n\n\n while n1 or n2: \n\n\n\n if moveL1:\n\n val1 = next(iter_1, -sys.maxsize)\n\n \n\n if moveL2:\n\n val2 = next(iter_2, -sys.maxsize)\n\n\n\n n1 = val1 > -sys.maxsize\n\n n2 = val2 > -sys.maxsize\n\n \n\n if n1 and n2:\n\n if val1 < val2:\n\n result.append(val1)\n\n moveL1 = True\n\n moveL2 = False \n\n elif val2 < val1:\n\n result.append(val2) \n\n moveL1 = False\n\n moveL2 = True \n\n else:\n\n result.append(val1)\n\n result.append(val2)\n\n moveL1 = True\n\n moveL2 = True\n\n elif n1 and not n2:\n\n result.append(val1)\n\n moveL1 = True\n\n moveL2 = False\n\n elif n2 and not n1:\n\n result.append(val2) \n\n moveL1 = False\n\n moveL2 = True \n", "file_path": "python3/partition/partitionN.py", "rank": 82, "score": 29760.33433833885 }, { "content": " def sortDuplicatesForPartitioning(self, group, count, nonUniqueList, iterCounter):\n\n A_sort = []\n\n\n\n keys = list(group.keys())\n\n keysCount = len(keys)\n\n iterCounter[0] += keysCount\n\n\n\n keys.sort()\n\n iterCounter[0] += keysCount * math.log2(keysCount)\n\n\n\n i = 0\n\n removeKeys = []\n\n while len(nonUniqueList) > 0:\n\n\n\n kl = keys if i % 3 == 0 else reversed(keys)\n\n i += 1\n\n\n\n for key in kl:\n\n\n\n if key in nonUniqueList and nonUniqueList[key] > 0:\n\n A_sort.append(key)\n\n nonUniqueList[key] -= 1\n\n \n\n if nonUniqueList[key] <= 0:\n\n del nonUniqueList[key]\n\n removeKeys.append(key)\n\n \n\n if len(removeKeys) > 0:\n\n for k in removeKeys:\n\n keys.remove(k)\n\n removeKeys.clear()\n\n \n\n iterCounter[0] += count\n\n\n", "file_path": "python3/partition/partitionN.py", "rank": 83, "score": 29760.33433833885 }, { "content": " def buildSearchIndex(self, orderedByDimPoints):\n\n '''\n\n The index accuracy depends on which limits were used, and what original constraint was.\n\n It make sense to use it in 3/4 to constraint window if it was solved by limits.\n\n For pareto solver it works for full range, because we do not skip points.\n\n For limit solver to gave exact index it should be build without limit using.\n\n If less it gives some optima but not the best value.\n\n '''\n\n\n\n maxByDims = []\n\n nextMaxProfitPoint = self.emptyPoint\n\n\n\n for p in orderedByDimPoints:\n\n if p.getProfit() > nextMaxProfitPoint.getProfit():\n\n nextMaxProfitPoint = p\n\n maxByDims.append(nextMaxProfitPoint)\n\n\n", "file_path": "python3/knapsack/knapsackPareto.py", "rank": 84, "score": 29728.406041751154 }, { "content": " def indexLargestLessThanAsc(items, item, lo, hi, iterCounter):\n\n\n\n if item == 0:\n\n return None\n\n\n\n while lo <= hi:\n\n iterCounter[0] += 1\n\n mid = (lo + hi) // 2\n\n\n\n val = items[mid]\n\n\n\n if item == val:\n\n return mid\n\n\n\n if val < item:\n\n lo = mid + 1\n\n else:\n\n hi = mid - 1\n\n\n\n if hi >= 0 and item >= items[hi]:\n\n return hi\n\n else:\n", "file_path": "python3/knapsack/knapsack.py", "rank": 85, "score": 29718.158107504176 }, { "content": " def getItemIndex(self, count, i, allAsc):\n", "file_path": "python3/knapsack/knapsackNd.py", "rank": 86, "score": 29718.158107504176 }, { "content": " def getItemIndex(self, lessItemsRange, i, allAsc):\n", "file_path": "python3/knapsack/subsKnapsack.py", "rank": 87, "score": 29718.158107504176 }, { "content": " def indexLargestLessThanDesc(items, item, lo, hi, iterCounter):\n\n\n\n if item == 0:\n\n return None\n\n\n\n cnt = len(items)\n\n\n\n while lo <= hi:\n\n iterCounter[0] += 1\n\n mid = (lo + hi) // 2\n\n\n\n val = items[mid]\n\n\n\n if item == val:\n\n return mid\n\n\n\n if val > item:\n\n lo = mid + 1\n\n else:\n\n hi = mid - 1\n\n\n\n if lo < cnt and item >= items[lo]:\n\n return lo\n\n else:\n", "file_path": "python3/knapsack/knapsack.py", "rank": 88, "score": 29718.158107504176 }, { "content": " def getItemIndex(self, count, i, allAsc):\n", "file_path": "python3/knapsack/knapsackPareto.py", "rank": 89, "score": 29718.158107504176 }, { "content": " def test_3_search_index(self):\n\n\n\n if verbose:\n\n print(f\"test building and using max profit point index\")\n\n\n\n mixDimData = [(821, 100),\n\n (1144, 100),\n\n (634, 100),\n\n (701, 100),\n\n (291, 100),\n\n (1702, 100),\n\n (1633, 100),\n\n (1086, 100),\n\n (124, 100),\n\n (718, 100),\n\n (976, 100),\n\n (1438, 100),\n\n (822, 100),\n\n (1143, 100),\n\n (640, 100),\n\n (702, 100),\n\n (291, 100),\n\n (1702, 100),\n\n (1633, 100),\n\n (2000, 100),\n\n (100, 100),\n\n (701, 100),\n\n (1976, 100),\n\n (1638, 100),\n\n ]\n\n\n\n dimsd = [p[0] for p in mixDimData]\n\n values = [p[1] for p in mixDimData]\n\n\n\n descDims, descValues = sortReverseBoth(dimsd, values)\n\n\n\n sumOfAll = sum([p[0] for p in mixDimData])\n\n minItem = min([p[0] for p in mixDimData])\n\n iterCounter = [0]\n\n\n\n descPoints = [wPoint1(d) for d in descDims]\n\n\n\n indexConstraints = [ sumOfAll, sumOfAll // 2]\n\n\n\n for indexConstr in indexConstraints:\n\n\n\n for s in range(1, 3):\n\n\n\n testDescValues = list(descValues)\n\n\n\n sameProfit = s % 2 == 0\n\n\n\n if not sameProfit:\n\n testDescValues[0] -= 1\n\n\n\n for j in range(1, 3):\n\n\n\n forceUsePareto = j % 2 == 0\n\n\n\n binSearchSolver = knapsackParetoSolver(descPoints, testDescValues, range(len(testDescValues)), wPoint1(indexConstr - 1), paretoPoint1(0, 0), wPoint1(0), iterCounter)\n\n\n\n binSearchSolver.prepareSearchIndex = True\n\n\n\n binSearchSolver.forceUsePareto = forceUsePareto\n\n\n\n binSearchSolver.solve()\n\n\n\n for constraint in range(minItem, indexConstr, minItem - 1):\n\n\n\n constraintPoint = wPoint1(constraint)\n\n\n\n fullSolver = knapsackParetoSolver(descPoints, testDescValues, range(len(testDescValues)), constraintPoint, paretoPoint1(0, 0), wPoint1(0), iterCounter)\n\n\n\n opt, optSize, optItems, optValues, optIndex = fullSolver.solve()\n\n\n\n testOpt, testOptSize, testOptItems, testOptValues, testOptIndex = binSearchSolver.solve(constraintPoint)\n\n\n\n good = opt == testOpt and testOptSize <= constraintPoint\n\n\n\n if verbose:\n\n print(f\"test_3_search_index: indexConstr={indexConstr}; constraint={constraint}; forceUsePareto={forceUsePareto}; sameProfit={sameProfit}; expected - optimized: {opt - testOpt}\")\n\n\n", "file_path": "python3/tests/test_knapsack.py", "rank": 90, "score": 29718.158107504176 }, { "content": " def indexLargestLessThan(self, items, item, lo, hi, iterCounter):\n\n\n\n ans = -1\n\n\n\n while lo <= hi:\n\n iterCounter[0] += 1\n\n mid = (lo + hi) // 2\n\n\n\n val = items[mid]\n\n \n\n if val.getProfit() > item:\n\n hi = mid - 1\n\n ans = mid\n\n else:\n\n lo = mid + 1\n\n\n", "file_path": "python3/knapsack/knapsackPareto.py", "rank": 91, "score": 29718.158107504176 }, { "content": " def getPossibleValue(self, point, itemValue, itemDims, dp, iterCounter):\n\n\n\n if point in dp:\n\n cur = dp[point]\n\n iterCounter[0] += self.size\n\n return cur[0] + itemValue, cur[1] + itemDims\n\n\n\n if point < self.emptyPoint:\n\n return None, self.emptyPoint\n\n\n", "file_path": "python3/knapsack/knapsackNd.py", "rank": 92, "score": 29706.604027750633 }, { "content": " def getPossibleValue(self, point, itemValue, dp):\n\n\n\n if point in dp:\n\n return dp[point] + itemValue\n\n\n\n if point < 0:\n\n return None\n\n \n", "file_path": "python3/knapsack/subsKnapsack.py", "rank": 93, "score": 29706.604027750633 }, { "content": " def test_knapsacks_and_pareto_range_1_50(self):\n\n\n\n if verbose:\n\n print(\"KB knapsacks and pareto reports for list(range(1, 51))\")\n\n\n\n numbers = list(range(1, 51))\n\n\n\n if verbose:\n\n print(f\"len {len(numbers)} sum {sum(numbers)}\")\n\n\n\n if True:\n\n\n\n iterCounter = [0]\n\n\n\n prevIters = 0\n\n prevPareto = 0\n\n\n\n if True:\n\n\n\n s = sum(numbers) - 1\n\n\n\n iterCounter[0] = 0\n\n\n\n opt, optItems1 = subsKnapsack(s, numbers, iterCounter, printPct=True)\n\n\n\n print(s)\n\n\n\n o1 = round(iterCounter[0])\n\n\n\n iterCounter[0] = 0\n\n\n\n t1 = time.perf_counter()\n\n\n\n opt2, optDim2, optItems2, optVal3 = knapsack(s, numbers, numbers, iterCounter, printPct=True)\n\n\n\n knapTime = time.perf_counter() - t1\n\n\n\n o2 = round(iterCounter[0])\n\n\n\n iterCounter[0] = 0\n\n\n\n opt3, optDim3, optItems3, optVal3 = paretoKnapsack(s, numbers, numbers, iterCounter, printPct=True)\n\n\n\n o3 = round(iterCounter[0])\n\n\n\n iterCounter[0] = 0\n\n\n\n t1 = time.perf_counter()\n\n\n\n opt4, optDim4, optItems4, optVal4 = hybridParetoKnapsack(s, numbers, numbers, iterCounter, printPct=True)\n\n\n\n paretoHTime = time.perf_counter() - t1\n\n\n\n oH = round(iterCounter[0])\n\n\n\n if opt != opt2 or opt != opt3 or opt4 != opt:\n\n print(f\"ERROR: {opt} - {opt2} - {opt3} - {opt4}, size {s}\")\n\n self.assertTrue(False)\n\n\n\n prevIters = o1\n", "file_path": "python3/tests/test_reports.py", "rank": 94, "score": 28794.246216589254 }, { "content": " def test_multiple_knapsack_sizes(self):\n\n\n\n if verbose:\n\n print(\"Multiple knapsack sizes integer tests.\")\n\n\n\n mksTests = []\n\n\n\n A, NU = [3, 383, 401, 405, 580, 659, 730, 1024, 1100, 1175, 1601, 2299, 3908, 4391, 4485, 5524], 4\n\n mksTests.append((A, NU))\n\n A, NU = [4, 5, 3, 2, 5, 5, 5, 1, 5, 5, 5, 5, 3, 5, 5, 2], 13\n\n mksTests.append((A, NU))\n\n A, NU = [4, 4, 6, 2, 3, 8, 10, 2, 10, 7], 4\n\n mksTests.append((A, NU))\n\n A, NU = [4, 15, 1, 1, 1, 1, 3, 11, 1, 10], 3\n\n mksTests.append((A, NU))\n\n A, NU = [20, 23, 25, 49, 45, 27, 40, 22, 19], 3\n\n mksTests.append((A, NU))\n\n A, NU = [20, 23, 25, 49, 45, 27, 40, 22, 19, 20, 23, 25, 49, 45, 27, 40, 22, 19], 6\n\n mksTests.append((A, NU))\n\n A, NU = [27, 9, 9, 9, 9, 9, 3, 3, 3], 3\n\n mksTests.append((A, NU))\n\n A, NU = [10, 10, 10, 7, 7, 7, 7, 7, 7, 6, 6, 6], 3\n\n mksTests.append((A, NU))\n\n A, NU = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 3\n\n mksTests.append((A, NU))\n\n A, NU = [10, 12, 1, 2, 10, 7, 5, 19, 13, 1], 4\n\n mksTests.append((A, NU))\n\n A, NU = [1, 2, 3, 4, 5, 6, 7, 8, 9], 3\n\n mksTests.append((A, NU))\n\n\n\n singleTest = []\n\n singleTestSizes = []\n\n\n\n ind = 0\n\n\n\n for A, NU in mksTests:\n\n\n\n ind += 1\n\n\n\n for num in A:\n\n singleTest.append(num)\n\n\n\n size = sum(A) // NU\n\n\n\n for i in range(NU):\n\n singleTestSizes.append(size)\n\n\n\n iterCounter = [0]\n\n\n\n shuffle(singleTest)\n\n shuffle(singleTestSizes)\n\n\n\n for i in range(randomTestCount):\n\n\n\n newSeed = dtNow + datetime.timedelta(seconds=i)\n\n\n\n seed(newSeed)\n\n\n\n if verbose:\n\n print(f\"random seed is {newSeed}\")\n\n\n\n t1 = time.perf_counter()\n\n\n\n partResult, reminder, optCount = partitionN(singleTest, singleTestSizes, 0, iterCounter)\n\n\n\n tt = round(time.perf_counter() - t1, 4)\n\n\n\n pIter = iterCounter[0]\n\n\n\n iterCounter[0] = 0\n\n\n\n if len(reminder) != 0:\n\n\n\n if verbose:\n\n print(f\"items {A}\")\n\n print(f\"part result {partResult}\")\n\n print(f\"part reminder {reminder}\")\n\n print(f\"optCount {optCount}\")\n\n print(f\"len {len(A)}\")\n\n print(f\"sum {sum(A)}\")\n\n print(f\"iter {pIter}\")\n\n\n\n assert False\n\n\n\n t1 = time.perf_counter()\n\n\n\n partResultH, reminderH, optCountH = hybridPartitionN(singleTest, singleTestSizes, 0, iterCounter)\n\n\n\n htt = round(time.perf_counter() - t1, 4)\n\n\n\n hIter = iterCounter[0]\n\n\n\n print(f\" time {tt}, hybrid {htt}, pIter = {pIter} hIter = {hIter}\")\n\n\n\n if len(reminderH) != 0:\n\n\n\n if verbose:\n\n print(f\"items {A}\")\n\n print(f\"part result {partResult}\")\n\n print(f\"part reminder {reminder}\")\n\n print(f\"optCount {optCount}\")\n\n print(f\"len {len(A)}\")\n\n print(f\"sum {sum(A)}\")\n\n print(f\"iter {hIter}\")\n\n\n\n self.assertTrue(False)\n\n\n", "file_path": "python3/tests/test_partition.py", "rank": 95, "score": 28763.884578478348 }, { "content": " def indexLargestLessThanDesc(items, item, lo, hi, iterCounter):\n\n\n\n if item == self.emptyPoint:\n\n return None\n\n\n\n cnt = len(items)\n\n\n\n while lo <= hi:\n\n iterCounter[0] += 1\n\n mid = (lo + hi) // 2\n\n\n\n val = items[mid]\n\n\n\n if item == val:\n\n return mid\n\n\n\n if val > item:\n\n lo = mid + 1\n\n else:\n\n hi = mid - 1\n\n\n\n if lo < cnt and item >= items[lo]:\n\n return lo\n\n else:\n", "file_path": "python3/knapsack/knapsackNd.py", "rank": 96, "score": 28726.816546730588 }, { "content": " def indexLargestLessThanAsc(items, item, lo, hi, iterCounter):\n\n\n\n if item == self.emptyPoint:\n\n return None\n\n\n\n while lo <= hi:\n\n iterCounter[0] += 1\n\n mid = (lo + hi) // 2\n\n\n\n val = items[mid]\n\n\n\n if item == val:\n\n return mid\n\n\n\n if val < item:\n\n lo = mid + 1\n\n else:\n\n hi = mid - 1\n\n\n\n if hi >= 0 and item >= items[hi]:\n\n return hi\n\n else:\n", "file_path": "python3/knapsack/knapsackNd.py", "rank": 97, "score": 28726.816546730588 }, { "content": "#ifndef KB_KNAPSACK_PARTITION_SOLUTION_W_POINT_DIM1_HPP\n\n#define KB_KNAPSACK_PARTITION_SOLUTION_W_POINT_DIM1_HPP\n\n\n\n#include \"fast_map.h\"\n\n#include \"defines.h\"\n\n\n\n#include <vector>\n\n#include <tuple>\n\n#include <cmath>\n\n#include <deque>\n\n#include <numeric>\n\n#include <ranges>\n\n\n\n\n\nnamespace kb_knapsack {\n\n\n\n template<typename T, typename W, int N>\n\n struct w_point_dim1 {\n\n public:\n\n T value;\n", "file_path": "cpp/knapsack/w_point_dim1.hpp", "rank": 98, "score": 31.70906341173556 }, { "content": "#ifndef KB_KNAPSACK_PARTITION_SOLUTION_W_POINT_DIMN_HPP\n\n#define KB_KNAPSACK_PARTITION_SOLUTION_W_POINT_DIMN_HPP\n\n\n\n#include \"fast_map.h\"\n\n#include \"defines.h\"\n\n\n\n#include <vector>\n\n#include <tuple>\n\n#include <cmath>\n\n#include <deque>\n\n#include <numeric>\n\n#include <ranges>\n\n\n\nnamespace kb_knapsack {\n\n\n\n template<typename T, typename W, int N>\n\n struct w_point_dimN {\n\n public:\n\n std::array<T, N> value;\n\n\n", "file_path": "cpp/knapsack/w_point_dimN.hpp", "rank": 99, "score": 30.830193550201155 } ]
C++
egen/src/Person.cpp
dotweiba/dbt5
39e23b0a0bfd4dfcb80cb2231270324f6bbf4b42
#include "../inc/EGenTables_stdafx.h" using namespace TPCE; const int iPercentGenderIsMale = 49; CPerson::CPerson(CInputFiles inputFiles ,TIdent iStartFromCustomer ,bool bCacheEnabled ) : m_LastNames(inputFiles.LastNames) , m_MaleFirstNames(inputFiles.MaleFirstNames) , m_FemaleFirstNames(inputFiles.FemaleFirstNames) , m_bCacheEnabled(bCacheEnabled) { if (m_bCacheEnabled) { m_iCacheSize = iDefaultLoadUnitSize; m_iCacheOffset = iTIdentShift + iStartFromCustomer; m_CacheLastName = new char* [m_iCacheSize]; m_CacheFirstName = new char* [m_iCacheSize]; for (int i=0; i<m_iCacheSize; i++) { m_CacheLastName[i] = NULL; m_CacheFirstName[i] = NULL; } } } CPerson::~CPerson() { if (m_bCacheEnabled) { delete[] m_CacheLastName; delete[] m_CacheFirstName; } } void CPerson::InitNextLoadUnit(TIdent iCacheOffsetIncrement) { if (m_bCacheEnabled) { m_iCacheOffset += iCacheOffsetIncrement; for (int i=0; i<m_iCacheSize; i++) { m_CacheLastName[i] = NULL; m_CacheFirstName[i] = NULL; } } } char* CPerson::GetLastName(TIdent CID) { char *LastName = NULL; TIdent index = CID - m_iCacheOffset; bool bCheckCache = (index >= 0 && index < m_iCacheSize); if (m_bCacheEnabled && bCheckCache) { LastName = m_CacheLastName[index]; } if (LastName == NULL) { RNGSEED OldSeed; int iThreshold; OldSeed = m_rnd.GetSeed(); m_rnd.SetSeed( m_rnd.RndNthElement( RNGSeedBaseLastName, (RNGSEED) CID )); iThreshold = m_rnd.RndIntRange(0, m_LastNames->GetGreatestKey() - 1); LastName = (m_LastNames->GetRecord(iThreshold))->LAST_NAME; m_rnd.SetSeed( OldSeed ); if (m_bCacheEnabled && bCheckCache) { m_CacheLastName[index] = LastName; } } return LastName; } char* CPerson::GetFirstName(TIdent CID) { char *FirstName = NULL; TIdent index = CID - m_iCacheOffset; bool bCheckCache = (index >= 0 && index < m_iCacheSize); if (m_bCacheEnabled && bCheckCache) { FirstName = m_CacheFirstName[index]; } if (FirstName == NULL) { RNGSEED OldSeed; int iThreshold; OldSeed = m_rnd.GetSeed(); m_rnd.SetSeed( m_rnd.RndNthElement( RNGSeedBaseFirstName, (RNGSEED) CID )); if (IsMaleGender(CID)) { iThreshold = m_rnd.RndIntRange(0, m_MaleFirstNames->GetGreatestKey() - 1); FirstName = (m_MaleFirstNames->GetRecord(iThreshold))->FIRST_NAME; } else { iThreshold = m_rnd.RndIntRange(0, m_FemaleFirstNames->GetGreatestKey() - 1); FirstName = (m_FemaleFirstNames->GetRecord(iThreshold))->FIRST_NAME; } m_rnd.SetSeed( OldSeed ); if (m_bCacheEnabled && bCheckCache) { m_CacheFirstName[index] = FirstName; } } return FirstName; } char CPerson::GetMiddleName(TIdent CID) { RNGSEED OldSeed; char cMiddleInitial[2]; OldSeed = m_rnd.GetSeed(); m_rnd.SetSeed( m_rnd.RndNthElement( RNGSeedBaseMiddleInitial, (RNGSEED) CID )); cMiddleInitial[1] = '\0'; m_rnd.RndAlphaNumFormatted( cMiddleInitial, "a" ); m_rnd.SetSeed( OldSeed ); return( cMiddleInitial[0] ); } char CPerson::GetGender(TIdent CID) { RNGSEED OldSeed; char cGender; OldSeed = m_rnd.GetSeed(); m_rnd.SetSeed( m_rnd.RndNthElement( RNGSeedBaseGender, (RNGSEED) CID )); if (m_rnd.RndPercent( iPercentGenderIsMale )) { cGender = 'M'; } else { cGender = 'F'; } m_rnd.SetSeed( OldSeed ); return( cGender ); } bool CPerson::IsMaleGender(TIdent CID) { return GetGender(CID)=='M'; } void CPerson::GetTaxID(TIdent CID, char *buf) { RNGSEED OldSeed; OldSeed = m_rnd.GetSeed(); m_rnd.SetSeed( m_rnd.RndNthElement( RNGSeedBaseTaxID, ( (RNGSEED)CID * TaxIDFmt_len ))); m_rnd.RndAlphaNumFormatted(buf, TaxIDFmt); m_rnd.SetSeed( OldSeed ); } void CPerson::GetFirstLastAndTaxID(TIdent C_ID, char *szFirstName, char *szLastName, char *szTaxID) { strncpy(szLastName, GetLastName(C_ID), cL_NAME_len); strncpy(szFirstName, GetFirstName(C_ID), cF_NAME_len); GetTaxID(C_ID, szTaxID); }
#include "../inc/EGenTables_stdafx.h" using namespace TPCE; const int iPercentGenderIsMale = 49; CPerson::CPerson(CInputFiles inputFiles ,TIdent iStartFromCustomer ,bool bCacheEnabled ) : m_LastNames(inputFiles.LastNames) , m_MaleFirstNames(inputFiles.MaleFirstNames) , m_FemaleFirstNames(inputFiles.FemaleFirstNames) , m_bCacheEnabled(bCacheEnabled) { if (m_bCacheEnabled) { m_iCacheSize = iDefaultLoadUnitSize; m_iCacheOffset = iTIdentShift + iStartFromCustomer; m_CacheLastName = new char* [m_iCacheSize]; m_CacheFirstName = new char* [m_iCacheSize]; for (int i=0; i<m_iCacheSize; i++) { m_CacheLastName[i] = NULL; m_CacheFirstName[i] = NULL; } } } CPerson::~CPerson() { if (m_bCacheEnabled) { delete[] m_CacheLastName; delete[] m_CacheFirstName; } } void CPerson::InitNextLoadUnit(TIdent iCacheOffsetIncrement) { if (m_bCacheEnabled) { m_iCacheOffset += iCacheOffsetIncrement; for (int i=0; i<m_iCacheSize; i++) { m_CacheLastName[i] = NULL; m_CacheFirstName[i] = NULL; } } } char* CPerson::GetLastName(TIdent CID) { char *LastName = NUL
char* CPerson::GetFirstName(TIdent CID) { char *FirstName = NULL; TIdent index = CID - m_iCacheOffset; bool bCheckCache = (index >= 0 && index < m_iCacheSize); if (m_bCacheEnabled && bCheckCache) { FirstName = m_CacheFirstName[index]; } if (FirstName == NULL) { RNGSEED OldSeed; int iThreshold; OldSeed = m_rnd.GetSeed(); m_rnd.SetSeed( m_rnd.RndNthElement( RNGSeedBaseFirstName, (RNGSEED) CID )); if (IsMaleGender(CID)) { iThreshold = m_rnd.RndIntRange(0, m_MaleFirstNames->GetGreatestKey() - 1); FirstName = (m_MaleFirstNames->GetRecord(iThreshold))->FIRST_NAME; } else { iThreshold = m_rnd.RndIntRange(0, m_FemaleFirstNames->GetGreatestKey() - 1); FirstName = (m_FemaleFirstNames->GetRecord(iThreshold))->FIRST_NAME; } m_rnd.SetSeed( OldSeed ); if (m_bCacheEnabled && bCheckCache) { m_CacheFirstName[index] = FirstName; } } return FirstName; } char CPerson::GetMiddleName(TIdent CID) { RNGSEED OldSeed; char cMiddleInitial[2]; OldSeed = m_rnd.GetSeed(); m_rnd.SetSeed( m_rnd.RndNthElement( RNGSeedBaseMiddleInitial, (RNGSEED) CID )); cMiddleInitial[1] = '\0'; m_rnd.RndAlphaNumFormatted( cMiddleInitial, "a" ); m_rnd.SetSeed( OldSeed ); return( cMiddleInitial[0] ); } char CPerson::GetGender(TIdent CID) { RNGSEED OldSeed; char cGender; OldSeed = m_rnd.GetSeed(); m_rnd.SetSeed( m_rnd.RndNthElement( RNGSeedBaseGender, (RNGSEED) CID )); if (m_rnd.RndPercent( iPercentGenderIsMale )) { cGender = 'M'; } else { cGender = 'F'; } m_rnd.SetSeed( OldSeed ); return( cGender ); } bool CPerson::IsMaleGender(TIdent CID) { return GetGender(CID)=='M'; } void CPerson::GetTaxID(TIdent CID, char *buf) { RNGSEED OldSeed; OldSeed = m_rnd.GetSeed(); m_rnd.SetSeed( m_rnd.RndNthElement( RNGSeedBaseTaxID, ( (RNGSEED)CID * TaxIDFmt_len ))); m_rnd.RndAlphaNumFormatted(buf, TaxIDFmt); m_rnd.SetSeed( OldSeed ); } void CPerson::GetFirstLastAndTaxID(TIdent C_ID, char *szFirstName, char *szLastName, char *szTaxID) { strncpy(szLastName, GetLastName(C_ID), cL_NAME_len); strncpy(szFirstName, GetFirstName(C_ID), cF_NAME_len); GetTaxID(C_ID, szTaxID); }
L; TIdent index = CID - m_iCacheOffset; bool bCheckCache = (index >= 0 && index < m_iCacheSize); if (m_bCacheEnabled && bCheckCache) { LastName = m_CacheLastName[index]; } if (LastName == NULL) { RNGSEED OldSeed; int iThreshold; OldSeed = m_rnd.GetSeed(); m_rnd.SetSeed( m_rnd.RndNthElement( RNGSeedBaseLastName, (RNGSEED) CID )); iThreshold = m_rnd.RndIntRange(0, m_LastNames->GetGreatestKey() - 1); LastName = (m_LastNames->GetRecord(iThreshold))->LAST_NAME; m_rnd.SetSeed( OldSeed ); if (m_bCacheEnabled && bCheckCache) { m_CacheLastName[index] = LastName; } } return LastName; }
function_block-function_prefixed
[ { "content": "namespace TPCE\n\n{\n\nconst int iMaxPort = 8;\n\nconst int iMaxRetries = 10;\n\nconst int iMaxConnectString = 128;\n\n\n\nconst int iBrokerageHousePort = 30000;\n\nconst int iMarketExchangePort = 30010;\n\n\n\n// Transaction Names\n\nstatic const char szTransactionName[12][18] = {\n\n\t\t\"SECURITY_DETAIL\",\n\n\t\t\"BROKER_VOLUME\",\n\n\t\t\"CUSTOMER_POSITION\",\n\n\t\t\"MARKET_WATCH\",\n\n\t\t\"TRADE_STATUS\",\n\n\t\t\"TRADE_LOOKUP\",\n\n\t\t\"TRADE_ORDER\",\n\n\t\t\"TRADE_UPDATE\",\n\n\t\t\"MARKET_FEED\",\n\n\t\t\"TRADE_RESULT\",\n\n\t\t\"DATA_MAINTENANCE\",\n\n\t\t\"TRADE_CLEANUP\"};\n\n\n\n// PostgreSQL Messages\n\nstatic std::string PGSQL_SERIALIZE_ERROR =\n\n\t\t\"ERROR: could not serialize access due to concurrent update\";\n\nstatic std::string PGSQL_RECOVERY_ERROR =\n\n\t\t\"FATAL: the database system is in recovery mode\";\n\nstatic std::string PGSQL_CONNECTION_FAILED = \"Connection to database failed\";\n", "file_path": "src/include/DBT5Consts.h", "rank": 0, "score": 199566.96735196144 }, { "content": "using namespace std;\n", "file_path": "src/include/DBT5Consts.h", "rank": 1, "score": 152527.00329013038 }, { "content": "namespace TPCE\n\n{\n\n\n\n// ADDRESS / ZIP_CODE tables\n\nconst int cTOWN_len = 80;\n\nconst int cDIV_len = 80;\n\nconst int cCODE_len = 12;\n\n\n\n//ACCOUNT_PERMISSION table\n\nconst int cACL_len = 4;\n\n\n\n//ADDRESS table\n\nconst int cAD_NAME_len = 80;\n\nconst int cAD_LINE_len = 80;\n\nconst int cAD_TOWN_len = cTOWN_len;\n\nconst int cAD_DIV_len = cDIV_len; //state/provice abreviation\n\nconst int cAD_ZIP_len = cCODE_len;\n\nconst int cAD_CTRY_len = 80;\n\n\n\n//CASH_TRANSACTION table\n\nconst int cCT_NAME_len = 100;\n\n\n\n//CUSTOMER table\n\nconst int cL_NAME_len = 25;\n\nconst int cF_NAME_len = 20;\n\nconst int cM_NAME_len = 1;\n\nconst int cDOB_len = 30;\n\nconst int cTAX_ID_len = 20;\n\nconst int cGNDR_len = 1;\n\nconst int cCTRY_len = 3;\n\nconst int cAREA_len = 3;\n\nconst int cLOCAL_len = 10;\n\nconst int cEXT_len = 5;\n\nconst int cEMAIL_len = 50;\n\n\n\n//BROKER table\n\nconst int cB_NAME_len = cF_NAME_len + cM_NAME_len + cL_NAME_len + 3; // two spaces and one period\n\n\n\n//COMPANY table\n\nconst int cCO_NAME_len = 60;\n\nconst int cSP_RATE_len = 4;\n\nconst int cCEO_NAME_len = cF_NAME_len + cL_NAME_len + 1; // one space\n\nconst int cCO_DESC_len = 150;\n\nconst int cCO_SP_RATE_len = 4;\n\n\n\n//CUSTOMER_ACCOUNT table\n\nconst int cCA_NAME_len = 50;\n\n\n\n//EXCHANGE table\n\nconst int cEX_ID_len = 6;\n\nconst int cEX_NAME_len = 100;\n\nconst int cEX_DESC_len = 150;\n\n//const int cEX_OPEN_len = 8;\n\n//const int cEX_CLOSE_len = 8;\n\n\n\n//HOLDING table\n\nconst int cH_BUY_DTS_len = 30; //date of purchase\n\n\n\n//INDUSTRY table\n\nconst int cIN_ID_len = 2;\n\nconst int cIN_NAME_len = 50;\n\n\n\n//NEWS_ITEM table\n\nconst int cNI_HEADLINE_len = 80;\n\nconst int cNI_SUMMARY_len = 255;\n\nconst int cNI_ITEM_len = 100 * 1000;\n\nconst int cNI_SOURCE_len = 30;\n\nconst int cNI_AUTHOR_len = 30;\n\n\n\n//SECURITY table\n\nconst int cS_NAME_len = 70;\n\nconst int cSYMBOL_len = 7 + 1 + 7; // base + separator + extended\n\nconst int cS_ISSUE_len = 6;\n\n\n\n//SETTLEMENT table\n\nconst int cSE_CASH_TYPE_len = 40;\n\n\n\n//SECTOR table\n\nconst int cSC_NAME_len = 30;\n\nconst int cSC_ID_len = 2;\n\n\n\n//STATUS_TYPE table\n\nconst int cST_ID_len = 4;\n\nconst int cST_NAME_len = 10;\n\n\n\n//TAX RATE table\n\nconst int cTX_ID_len = 4;\n\nconst int cTX_NAME_len = 50;\n\n\n\n//TRADE table\n\nconst int cEXEC_NAME_len = cF_NAME_len + cM_NAME_len + cL_NAME_len + 3; // two spaces and one extra\n\n\n\n//TRADE_HISTORY table\n\nconst int cTH_ST_ID_len = cST_ID_len;\n\n\n\n//TRADE TYPE table\n\nconst int cTT_ID_len = 3;\n\nconst int cTT_NAME_len = 12;\n\n\n\n//ZIP_CODE table\n\nconst int cZC_TOWN_len = cTOWN_len;\n\nconst int cZC_DIV_len = cDIV_len;\n\nconst int cZC_CODE_len = cCODE_len;\n\n\n", "file_path": "egen/inc/TableConsts.h", "rank": 2, "score": 148768.94440967598 }, { "content": "namespace TPCE\n\n{\n\n\n\nstatic const TIdent iDefaultStartFromCustomer = 1;\n\n\n\n// Minimum number of customers in a database.\n\n// Broker-Volume transations requires 40 broker names as input,\n\n// which translates into minimum 4000 customers in a database.\n\n//\n\nconst TIdent iDefaultCustomerCount = 5000;\n\n\n\nconst TIdent iBrokersDiv = 100; // by what number to divide the customer count to get the broker count\n\n\n\n// Number of customers in default load unit.\n\n// Note: this value must not be changed. EGen code depends\n\n// on load unit consisting of exactly 1000 customers.\n\n//\n\nconst TIdent iDefaultLoadUnitSize = 1000;\n\n\n\n// Number by which all IDENT_T columns (C_ID, CA_ID, etc.) are shifted.\n\n//\n\nconst TIdent iTIdentShift = INT64_CONST(4300000000); // 4.3 billion\n\n\n\n// Number by which all TRADE_T columns (T_ID, TH_T_ID, etc.) are shifted.\n\n//\n\nconst TTrade iTTradeShift = INT64_CONST(200000000000000); // 200 trillion (2 * 10^14)\n\n\n\nconst int iMaxHostname = 64;\n\nconst int iMaxDBName = 64;\n\nconst int iMaxPath = 512;\n\n\n\n// NOTE: Changing the initial trade populate base date\n\n// can break code used in CCETxnInputGenerator for generating\n\n// Trade-Lookup data.\n\nconst INT16 InitialTradePopulationBaseYear = 2005;\n\nconst UINT16 InitialTradePopulationBaseMonth = 1;\n\nconst UINT16 InitialTradePopulationBaseDay = 3;\n\nconst UINT16 InitialTradePopulationBaseHour = 9;\n\nconst UINT16 InitialTradePopulationBaseMinute = 0;\n\nconst UINT16 InitialTradePopulationBaseSecond = 0;\n\nconst UINT32 InitialTradePopulationBaseFraction = 0;\n\n\n\n// At what trade count multiple to abort trades.\n\n// One trade in every iAboutTrade block is aborted (trade id is thrown out).\n\n//NOTE: this really is 10 * Trade-Order mix percentage!\n\n//\n\nconst int iAbortTrade = 101;\n\n\n\n// Used at load and run time to determine which intial trades\n\n// simulate rollback by \"aborting\" - I.e. used to skip over a\n\n// trade ID.\n\nconst int iAbortedTradeModFactor = 51;\n\n\n\n// Start date for DAILY_MARKET and FINANCIAL.\n\n//\n\nconst int iDailyMarketBaseYear = 2000;\n\nconst int iDailyMarketBaseMonth = 1;\n\nconst int iDailyMarketBaseDay = 3;\n\nconst int iDailyMarketBaseHour = 0;\n\nconst int iDailyMarketBaseMinute = 0;\n\nconst int iDailyMarketBaseSecond = 0;\n\nconst int iDailyMarketBaseMsec = 0;\n\n\n\n// Range of financial rows to return from Security Detail\n\nconst int iSecurityDetailMinRows = 5;\n\nconst int iSecurityDetailMaxRows = 20; // max_fin_len\n\n\n\n// Trade-Lookup constants\n\nconst INT32 TradeLookupMaxTradeHistoryRowsReturned = 3; //Based on the maximum number of status changes a trade can go through.\n\nconst INT32 TradeLookupMaxRows = 20; // Max number of rows for the frames\n\nconst INT32 TradeLookupFrame1MaxRows = TradeLookupMaxRows;\n\nconst INT32 TradeLookupFrame2MaxRows = TradeLookupMaxRows;\n\nconst INT32 TradeLookupFrame3MaxRows = TradeLookupMaxRows;\n\nconst INT32 TradeLookupFrame4MaxRows = TradeLookupMaxRows;\n\n\n\n// Trade-Update constants\n\nconst INT32 TradeUpdateMaxTradeHistoryRowsReturned = 3; //Based on the maximum number of status changes a trade can go through.\n\nconst INT32 TradeUpdateMaxRows = 20; // Max number of rows for the frames\n\nconst INT32 TradeUpdateFrame1MaxRows = TradeUpdateMaxRows;\n\nconst INT32 TradeUpdateFrame2MaxRows = TradeUpdateMaxRows;\n\nconst INT32 TradeUpdateFrame3MaxRows = TradeUpdateMaxRows;\n\n\n\n// These two arrays are used for platform independence\n\nconst char UpperCaseLetters[] = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n\nconst char LowerCaseLetters[] = \"abcdefghijklmnopqrstuvwxyz\";\n\nconst char Numerals[] = \"0123456789\";\n\nconst int MaxLowerCaseLetters = sizeof(LowerCaseLetters) - 1;\n\n\n\n//\n\n// Constants for non-uniform distribution of various transaction parameters.\n\n//\n\n\n\n// Trade Lookup\n\nconst INT32 TradeLookupAValueForTradeIDGenFrame1 = 65535;\n\nconst INT32 TradeLookupSValueForTradeIDGenFrame1 = 7;\n\nconst INT32 TradeLookupAValueForTimeGenFrame2 = 4095;\n\nconst INT32 TradeLookupSValueForTimeGenFrame2 = 16;\n\nconst INT32 TradeLookupAValueForSymbolFrame3 = 0;\n\nconst INT32 TradeLookupSValueForSymbolFrame3 = 0;\n\nconst INT32 TradeLookupAValueForTimeGenFrame3 = 4095;\n\nconst INT32 TradeLookupSValueForTimeGenFrame3 = 16;\n\nconst INT32 TradeLookupAValueForTimeGenFrame4 = 4095;\n\nconst INT32 TradeLookupSValueForTimeGenFrame4 = 16;\n\n// Trade Update\n\nconst INT32 TradeUpdateAValueForTradeIDGenFrame1 = 65535;\n\nconst INT32 TradeUpdateSValueForTradeIDGenFrame1 = 7;\n\nconst INT32 TradeUpdateAValueForTimeGenFrame2 = 4095;\n\nconst INT32 TradeUpdateSValueForTimeGenFrame2 = 16;\n\nconst INT32 TradeUpdateAValueForSymbolFrame3 = 0;\n\nconst INT32 TradeUpdateSValueForSymbolFrame3 = 0;\n\nconst INT32 TradeUpdateAValueForTimeGenFrame3 = 4095;\n\nconst INT32 TradeUpdateSValueForTimeGenFrame3 = 16;\n\n\n", "file_path": "egen/inc/MiscConsts.h", "rank": 3, "score": 148768.94440967598 }, { "content": "namespace TPCE\n\n{\n\n\n\ntemplate <typename T> class CNullLoader : public CBaseLoader<T>\n\n{\n\n\n\npublic:\n\n typedef const T* PT; //pointer to the table row\n\n\n\n /*\n\n * Routine to write a new record into the database.\n\n * Since this is a NULL loader, it does nothing.\n\n *\n\n * PARAMETERS:\n\n * IN next_record - ignored\n\n *\n\n * RETURNS:\n\n * none.\n\n */\n\n virtual void WriteNextRecord(PT next_record UNUSED) {}; //do not load\n\n\n\n /*\n\n * Routine called when the table has been loaded.\n\n * Since this is a NULL loader, it does nothing.\n\n *\n\n * PARAMETERS:\n\n * none.\n\n *\n\n * RETURNS:\n\n * none.\n\n */\n\n virtual void FinishLoad() {}; //do nothing\n\n};\n\n\n", "file_path": "egen/inc/NullLoader.h", "rank": 4, "score": 148753.81503853016 }, { "content": "namespace TPCE\n\n{\n\n\n\n// length of character columns used in both ADDRESS and ZIP_CODE tables\n\nconst int cTOWN_len = 80;\n\nconst int cDIV_len = 80;\n\nconst int cCODE_len = 12;\n\n\n\n//BROKER table\n\nconst int cB_NAME_len = 100;\n\n\n\n//ACCOUNT_PERMISSION table\n\nconst int cACL_len = 4;\n\n\n\n//length of character columns in ADDRESS table\n\nconst int cAD_NAME_len = 80;\n\nconst int cAD_LINE_len = 80;\n\nconst int cAD_TOWN_len = cTOWN_len;\n\nconst int cAD_DIV_len = cDIV_len; //state/provice abreviation\n\nconst int cAD_ZIP_len = cCODE_len;\n\nconst int cAD_CTRY_len = 80;\n\n\n\n//CASH_TRANSACTION table\n\nconst int cCT_NAME_len = 100;\n\n\n\n//COMPANY table\n\nconst int cCO_NAME_len = 60;\n\nconst int cSP_RATE_len = 4;\n\nconst int cCEO_NAME_len = 100;\n\nconst int cCO_DESC_len = 150;\n\nconst int cCO_SP_RATE_len = 4;\n\n\n\n//CUSTOMER table\n\nconst int cL_NAME_len = 30;\n\nconst int cF_NAME_len = 30;\n\nconst int cM_NAME_len = 1;\n\nconst int cDOB_len = 30;\n\nconst int cTAX_ID_len = 20;\n\nconst int cGNDR_len = 1;\n\nconst int cCTRY_len = 3;\n\nconst int cAREA_len = 3;\n\nconst int cLOCAL_len = 10;\n\nconst int cEXT_len = 5;\n\nconst int cEMAIL_len = 50;\n\n\n\n//CUSTOMER_ACCOUNT table\n\nconst int cCA_NAME_len = 50;\n\n\n\n//EXCHANGE table\n\nconst int cEX_ID_len = 6;\n\nconst int cEX_NAME_len = 100;\n\nconst int cEX_DESC_len = 150;\n\n//const int cEX_OPEN_len = 8;\n\n//const int cEX_CLOSE_len = 8;\n\n\n\n//HOLDING table\n\nconst int cH_BUY_DTS_len = 30; //date of purchase\n\n\n\n//INDUSTRY table\n\nconst int cIN_ID_len = 2;\n\nconst int cIN_NAME_len = 50;\n\n\n\n//NEWS_ITEM table\n\nconst int cNI_HEADLINE_len = 80;\n\nconst int cNI_SUMMARY_len = 255;\n\nconst int cNI_ITEM_len = 100 * 1000;\n\nconst int cNI_SOURCE_len = 30;\n\nconst int cNI_AUTHOR_len = 30;\n\n\n\n//SECURITY table\n\nconst int cS_NAME_len = 70;\n\nconst int cSYMBOL_len = 7 + 1 + 7; // base + separator + extended\n\nconst int cS_ISSUE_len = 6;\n\n\n\n//SETTLEMENT table\n\nconst int cSE_CASH_TYPE_len = 40;\n\n\n\n//SECTOR table\n\nconst int cSC_NAME_len = 30;\n\nconst int cSC_ID_len = 2;\n\n\n\n//STATUS_TYPE table\n\nconst int cST_ID_len = 4;\n\nconst int cST_NAME_len = 30;\n\n\n\n//TAX RATE table\n\nconst int cTX_ID_len = 4;\n\nconst int cTX_NAME_len = 50;\n\n\n\n//TRADE table\n\nconst int cEXEC_NAME_len = cF_NAME_len + cM_NAME_len + cL_NAME_len + 3;\n\n\n\n//TRADE_HISTORY table\n\nconst int cTH_ST_ID_len = cST_ID_len;\n\n\n\n//TRADE TYPE table\n\nconst int cTT_ID_len = 3;\n\nconst int cTT_NAME_len = 30;\n\n\n\n//ZIP_CODE table\n\nconst int cZC_TOWN_len = cTOWN_len;\n\nconst int cZC_DIV_len = cDIV_len;\n\nconst int cZC_CODE_len = cCODE_len;\n\n\n", "file_path": "egen/TestHarness/Reference/inc/TableConsts.h", "rank": 5, "score": 141025.0211337774 }, { "content": "namespace TPCE\n\n{\n\n\n\nconst int iMaxHostname = 64;\n\nconst int iMaxDBName = 64;\n\nconst int iMaxPath = 512;\n\n\n\n// NOTE: Changing the initial trade populate base date\n\n// can break code used in CCETxnInputGenerator for generating\n\n// Trade-Lookup data.\n\nconst INT16 InitialTradePopulationBaseYear = 2005;\n\nconst UINT16 InitialTradePopulationBaseMonth = 1;\n\nconst UINT16 InitialTradePopulationBaseDay = 3;\n\nconst UINT16 InitialTradePopulationBaseHour = 9;\n\nconst UINT16 InitialTradePopulationBaseMinute = 0;\n\nconst UINT16 InitialTradePopulationBaseSecond = 0;\n\nconst UINT32 InitialTradePopulationBaseFraction = 0;\n\n\n\n// At what trade count multiple to abort trades.\n\n// One trade in every iAboutTrade block is aborted (trade id is thrown out).\n\n//NOTE: this really is 10 * Trade-Order mix percentage!\n\n//\n\nconst int iAbortTrade = 101;\n\n\n\n// Used at load and run time to determine which intial trades\n\n// simulate rollback by \"aborting\" - I.e. used to skip over a\n\n// trade ID.\n\nconst int iAbortedTradeModFactor = 51;\n\n\n\n// Start date for DAILY_MARKET and FINANCIAL.\n\n//\n\nconst int iDailyMarketBaseYear = 2000;\n\nconst int iDailyMarketBaseMonth = 1;\n\nconst int iDailyMarketBaseDay = 3;\n\nconst int iDailyMarketBaseHour = 0;\n\nconst int iDailyMarketBaseMinute = 0;\n\nconst int iDailyMarketBaseSecond = 0;\n\nconst int iDailyMarketBaseMsec = 0;\n\n\n\nconst double MsPerSecondDivisor = 1000.000;\n\nconst INT32 MsPerSecond = 1000;\n\nconst INT32 SecondsPerMinute = 60;\n\nconst INT32 MinutesPerHour = 60;\n\nconst INT32 HoursPerDay = 24;\n\nconst INT32 HoursPerWorkDay = 8;\n\nconst INT32 DaysPerWorkWeek = 5;\n\nconst INT32 DaysPerWeek = 7;\n\n\n\nconst INT32 SecondsPerHour = SecondsPerMinute * MinutesPerHour;\n\nconst INT32 SecondsPerDay = SecondsPerMinute * MinutesPerHour * HoursPerDay;\n\nconst INT32 SecondsPerWorkDay = SecondsPerMinute * MinutesPerHour * HoursPerWorkDay;\n\nconst INT32 MsPerDay = SecondsPerDay * MsPerSecond;\n\nconst INT32 MsPerWorkDay = SecondsPerWorkDay * MsPerSecond;\n\n\n\n// Range of financial rows to return from Security Detail\n\nconst int iSecurityDetailMinRows = 5;\n\nconst int iSecurityDetailMaxRows = 20; // max_fin_len\n\n\n\n// Trade-Lookup constants\n\nconst INT32 TradeLookupMaxTradeHistoryRowsReturned = 3; //Based on the maximum number of status changes a trade can go through.\n\nconst INT32 TradeLookupMaxRows = 20; // Max number of rows for the frames\n\nconst INT32 TradeLookupFrame1MaxRows = TradeLookupMaxRows;\n\nconst INT32 TradeLookupFrame2MaxRows = TradeLookupMaxRows;\n\nconst INT32 TradeLookupFrame3MaxRows = TradeLookupMaxRows;\n\nconst INT32 TradeLookupFrame4MaxRows = TradeLookupMaxRows;\n\n\n\n// Trade-Update constants\n\nconst INT32 TradeUpdateMaxTradeHistoryRowsReturned = 3; //Based on the maximum number of status changes a trade can go through.\n\nconst INT32 TradeUpdateMaxRows = 20; // Max number of rows for the frames\n\nconst INT32 TradeUpdateFrame1MaxRows = TradeUpdateMaxRows;\n\nconst INT32 TradeUpdateFrame2MaxRows = TradeUpdateMaxRows;\n\nconst INT32 TradeUpdateFrame3MaxRows = TradeUpdateMaxRows;\n\n\n\n// These two arrays are used for platform independence\n\nconst char UpperCaseLetters[] = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n\nconst char LowerCaseLetters[] = \"abcdefghijklmnopqrstuvwxyz\";\n\nconst char Numerals[] = \"0123456789\";\n\nconst int MaxLowerCaseLetters = sizeof(LowerCaseLetters) - 1;\n\n\n\n//\n\n// Constants for non-uniform distribution of various transaction parameters.\n\n//\n\n\n\n// Trade Lookup\n\nconst INT32 TradeLookupAValueForTradeIDGenFrame1 = 65535;\n\nconst INT32 TradeLookupSValueForTradeIDGenFrame1 = 7;\n\nconst INT32 TradeLookupAValueForTimeGenFrame2 = 4095;\n\nconst INT32 TradeLookupSValueForTimeGenFrame2 = 16;\n\nconst INT32 TradeLookupAValueForSymbolFrame3 = 0;\n\nconst INT32 TradeLookupSValueForSymbolFrame3 = 0;\n\nconst INT32 TradeLookupAValueForTimeGenFrame3 = 4095;\n\nconst INT32 TradeLookupSValueForTimeGenFrame3 = 16;\n\nconst INT32 TradeLookupAValueForTimeGenFrame4 = 4095;\n\nconst INT32 TradeLookupSValueForTimeGenFrame4 = 16;\n\n// Trade Update\n\nconst INT32 TradeUpdateAValueForTradeIDGenFrame1 = 65535;\n\nconst INT32 TradeUpdateSValueForTradeIDGenFrame1 = 7;\n\nconst INT32 TradeUpdateAValueForTimeGenFrame2 = 4095;\n\nconst INT32 TradeUpdateSValueForTimeGenFrame2 = 16;\n\nconst INT32 TradeUpdateAValueForSymbolFrame3 = 0;\n\nconst INT32 TradeUpdateSValueForSymbolFrame3 = 0;\n\nconst INT32 TradeUpdateAValueForTimeGenFrame3 = 4095;\n\nconst INT32 TradeUpdateSValueForTimeGenFrame3 = 16;\n\n\n", "file_path": "egen/TestHarness/Reference/inc/MiscConsts.h", "rank": 6, "score": 141025.0211337774 }, { "content": "namespace TPCE\n\n{\n\n\n\ntemplate <typename T> class CNullLoader : public CBaseLoader<T>\n\n{\n\n\n\npublic:\n\n typedef const T* PT; //pointer to the table row\n\n\n\n /*\n\n * Routine to write a new record into the database.\n\n * Since this is a NULL loader, it does nothing.\n\n *\n\n * PARAMETERS:\n\n * IN next_record - ignored\n\n *\n\n * RETURNS:\n\n * none.\n\n */\n\n virtual void WriteNextRecord(PT next_record UNUSED) {}; //do not load\n\n\n\n /*\n\n * Routine called when the table has been loaded.\n\n * Since this is a NULL loader, it does nothing.\n\n *\n\n * PARAMETERS:\n\n * none.\n\n *\n\n * RETURNS:\n\n * none.\n\n */\n\n virtual void FinishLoad() {}; //do nothing\n\n};\n\n\n", "file_path": "egen/TestHarness/Reference/inc/NullLoader.h", "rank": 7, "score": 141011.0437693445 }, { "content": "using namespace TPCE;\n", "file_path": "src/include/CommonStructs.h", "rank": 8, "score": 101658.50400050059 }, { "content": "namespace TPCE\n\n{\n\n\n\n\n\n// Used to help define \"infinitely far into the future\"\n\nconst INT32 MaxWheelCycles = 999999999;\n\n\n\ntypedef struct TWheelConfig\n\n{\n\n INT32 WheelSize; // Total size of the wheel (based on the period and resolution)\n\n INT32 WheelResolution; // Expressed in milliseconds\n\n\n\n TWheelConfig( INT32 Size, INT32 Resolution )\n\n : WheelSize( Size )\n\n , WheelResolution( Resolution )\n\n {\n\n };\n\n} *PWheelConfig;\n\n\n\n\n", "file_path": "egen/inc/Wheel.h", "rank": 9, "score": 99336.43610509372 }, { "content": "namespace TPCE\n\n{\n\n\n\n// Converts a string to a 64 bit integer, supports the suffixes\n\n// KMG for powers of 1000 multipliers\n\nextern INT64 strtoint64 (const char *ptr);\n\n\n\n// Converts a string to a double, supports the suffixes\n\n// KMG for powers of 1000 multipliers\n\nextern double strtodbl (const char *ptr);\n\n\n\n// Converts a string in HH:MM:SS to a 64 bit integral number of seconds\n\n// HH or HH:MM are optional. Seconds over 60 may be specified.\n\n// (i.e. 1:00:00 and 3600 are equivalent)\n\nextern INT64 timestrtoint64 (const char *ptr);\n\n\n\n// Converts an integral number of seconds to the string HH:MM:SS\n\n// HH or HH:MM may be omitted if the time value is small enough\n\nextern std::string int64totimestr (INT64 val);\n", "file_path": "egen/inc/strutil.h", "rank": 10, "score": 99336.43610509372 }, { "content": "namespace TPCE\n\n{\n\n\n\ntemplate <typename T, typename TKeyAndElementsLimits> class CInputFile\n\n{\n\n //Type of in-memory representation of input files\n\n typedef CFixedMap<T, TKeyAndElementsLimits> CFileInMemoryList; //(key, data) pairs container\n\n\n\n CFileInMemoryList m_list;\n\n\n\n void ReadList(const char *szListFile)\n\n {\n\n ifstream tmpFile;\n\n\n\n if (szListFile)\n\n {\n\n tmpFile.open(szListFile, ios_base::in);\n\n if (tmpFile)\n\n {\n\n ReadList(tmpFile);\n\n tmpFile.close();\n\n }\n\n else\n\n { //Open failed\n\n tmpFile.close();\n\n throw CSystemErr(CSystemErr::eCreateFile, \"CInputFile::ReadList\");\n\n }\n\n }\n\n else\n\n {\n\n throw CSystemErr(CSystemErr::eCreateFile, \"CInputFile::ReadList\");\n\n }\n\n }\n\n\n\n void ReadList(const string &str)\n\n {\n\n istringstream tmpFile(str);\n\n ReadList(tmpFile);\n\n }\n\n\n\n void ReadList(istream &tmpFile) {\n\n T row;\n\n memset(&row, 0, sizeof(row));\n\n int iThreshold = 0, iWeight;\n\n while(tmpFile.good())\n\n {\n\n tmpFile>>iWeight; //first the weight\n\n // We don't know if we've hit the end of the file\n\n // until after trying the first read.\n\n if( ! tmpFile.eof() )\n\n {\n\n row.Load(tmpFile); //then the rest of the row\n\n iThreshold += iWeight; //used as the key\n\n m_list.Add(iThreshold-1/*because weights start from 1*/, &row, iWeight);//add to the container\n\n }\n\n }\n\n }\n\n\n\npublic:\n\n\n\n //Constructor.\n\n\n\n //iTotalDataElements is the number of data elements in the file.\n\n //Right now it's the same as the number of lines since\n\n //there is only one entry per line.\n\n CInputFile(const char *szListFile)\n\n {\n\n ReadList(szListFile);\n\n }\n\n\n\n CInputFile(const string &str)\n\n {\n\n ReadList(str);\n\n }\n\n\n\n //return the whole record for a given key\n\n //returns the second member of the element pair\n\n T* GetRecord(int key) { return m_list.GetElement(key); }\n\n\n\n //Get the next unique record in the set.\n\n T* GetRecordByPassKey( UINT iElementID )\n\n {\n\n return( m_list.GetElementByPassKey( iElementID ));\n\n }\n\n\n\n // Return current record count\n\n UINT RecordCount( )\n\n {\n\n return m_list.ElementCount();\n\n }\n\n\n\n //return the highest key number that exists in the list\n\n int GetGreatestKey() { return m_list.GetHighestKey(); }\n\n};\n\n\n", "file_path": "egen/inc/InputFile.h", "rank": 11, "score": 97900.4451200462 }, { "content": "namespace TPCE\n\n{\n\n // Default seed used for all tables.\n\n const RNGSEED RNGSeedTableDefault = 37039940;\n\n\n\n // This value is added to the AD_ID when seeding the RNG for\n\n // generating a threshold into the TownDivisionZipCode list.\n\n const RNGSEED RNGSeedBaseTownDivZip = 26778071;\n\n\n\n // This is the base seed used when generating C_TIER.\n\n const RNGSEED RNGSeedBaseC_TIER = 16225173;\n\n\n\n // Base seeds used for generating C_AREA_1, C_AREA_2, C_AREA_3\n\n const RNGSEED RNGSeedBaseC_AREA_1 = 97905013;\n\n const RNGSEED RNGSeedBaseC_AREA_2 = 68856487;\n\n const RNGSEED RNGSeedBaseC_AREA_3 = 67142295;\n\n\n\n // Base seed used when generating names.\n\n const RNGSEED RNGSeedBaseFirstName = 95066470;\n\n const RNGSEED RNGSeedBaseMiddleInitial = 71434514;\n\n const RNGSEED RNGSeedBaseLastName = 35846049;\n\n\n\n // Base seed used when generating gender.\n\n const RNGSEED RNGSeedBaseGender = 9568922;\n\n\n\n // Base seed used when generating tax ID\n\n const RNGSEED RNGSeedBaseTaxID = 8731255;\n\n\n\n // Base seed used when generating the number of accounts for a customer\n\n //const RNGSEED RNGSeedBaseNumberOfAccounts = 37486207;\n\n\n\n // Base seed used when generating the number of permissions on an account\n\n const RNGSEED RNGSeedBaseNumberOfAccountPermissions = 27794203;\n\n\n\n // Base seeds used when generating CIDs for additional account permissions\n\n const RNGSEED RNGSeedBaseCIDForPermission1 = 76103629;\n\n const RNGSEED RNGSeedBaseCIDForPermission2 = 103275149;\n\n\n\n // Base seed used when generating acount tax status\n\n const RNGSEED RNGSeedBaseAccountTaxStatus = 34376701;\n\n\n\n // Base seed for determining account broker id\n\n const RNGSEED RNGSeedBaseBrokerId = 75607774;\n\n\n\n // Base seed used when generating tax rate row\n\n const RNGSEED RNGSeedBaseTaxRateRow = 92740731;\n\n\n\n // Base seed used when generating the number of holdings for an account\n\n const RNGSEED RNGSeedBaseNumberOfSecurities = 23361736;\n\n\n\n // Base seed used when generating the starting security ID for the\n\n // set of securities associated with a particular account.\n\n const RNGSEED RNGSeedBaseStartingSecurityID = 12020070;\n\n\n\n // Base seed used when generating a company's SP Rate\n\n const RNGSEED RNGSeedBaseSPRate = 56593330;\n\n\n\n // Base seed for initial trade generation class\n\n const RNGSEED RNGSeedTradeGen = 32900134;\n\n\n\n // Base seed for the MEESecurity class\n\n const RNGSEED RNGSeedBaseMEESecurity = 75791232;\n\n\n\n // Base seed for non-uniform customer selection\n\n const RNGSEED RNGSeedCustomerSelection = 9270899;\n\n\n\n // Base seed for MEE Ticker Tape\n\n const RNGSEED RNGSeedBaseMEETickerTape = 42065035;\n\n\n\n // Base seed for MEE Trading Floor\n\n const RNGSEED RNGSeedBaseMEETradingFloor = 25730774;\n\n\n\n // Base seed for TxnMixGenerator\n\n const RNGSEED RNGSeedBaseTxnMixGenerator = 87944308;\n\n\n\n // Base seed for TxnInputGenerator\n\n const RNGSEED RNGSeedBaseTxnInputGenerator = 80534927;\n\n\n", "file_path": "egen/inc/RNGSeeds.h", "rank": 12, "score": 97900.4451200462 }, { "content": "namespace TPCE\n\n{\n\n\n\ntemplate <typename T> class CBaseLoader\n\n{\n\n\n\npublic:\n\n typedef const T* PT; //pointer to the table row\n\n\n\n /*\n\n * Virtual destructor. Provided so that a sponsor-specific\n\n * destructor can be called on destruction from the base-class pointer.\n\n *\n\n * PARAMETERS:\n\n * none.\n\n *\n\n * RETURNS:\n\n * not applicable.\n\n */\n\n virtual ~CBaseLoader() {};\n\n\n\n /*\n\n * This function is provided to reset the loader to\n\n * a clean state. \"Clean state\" here means a sequence of\n\n * WriteNextRecord(), followed by Commit(), followed by FinishLoad()\n\n * can be called.\n\n *\n\n * PARAMETERS:\n\n * none.\n\n *\n\n * RETURNS:\n\n * none.\n\n */\n\n virtual void Init() {}; // default implementation is empty\n\n\n\n /*\n\n * Receive a new record to be loaded into the database.\n\n * This is the main function that is called\n\n * for every generated record.\n\n *\n\n * Note: the records are not guaranteed to actually be inserted\n\n * into the database after this call. It is Commit() that ensures that\n\n * all records received by WriteNextRecord are persisted in the database.\n\n *\n\n * PARAMETERS:\n\n * IN next_record - a pointer to a structure, containing the record\n\n *\n\n * RETURNS:\n\n * none.\n\n */\n\n virtual void WriteNextRecord(PT next_record) = 0; // must be defined in subclasses\n\n\n\n /*\n\n * Commit any records that might have been kept in temporary\n\n * storage to the database. After this call, all records received\n\n * by WriteNextRecord should be present in the database.\n\n *\n\n * PARAMETERS:\n\n * none.\n\n *\n\n * RETURNS:\n\n * none.\n\n */\n\n virtual void Commit() {}; // default implementation is empty\n\n\n\n /*\n\n * Release any resources held for loading.\n\n * Also, commit any records that might have been kept in temporary\n\n * storage to the database.\n\n * This function is called once, after the last record has been loaded.\n\n *\n\n * PARAMETERS:\n\n * none.\n\n *\n\n * RETURNS:\n\n * none.\n\n */\n\n virtual void FinishLoad() = 0; // must be defined in subclasses\n\n};\n\n\n", "file_path": "egen/inc/BaseLoader.h", "rank": 13, "score": 97900.4451200462 }, { "content": "namespace TPCE\n\n{\n\n\n\ntemplate <typename T, typename TKeyAndElementsLimits> class CFlatFile\n\n{\n\nprotected:\n\n //Type of in-memory representation of input files\n\n typedef CFixedArray<T, TKeyAndElementsLimits> CFileInMemoryList; //array of arrays\n\n\n\n CFileInMemoryList m_list;\n\n\n\n void ReadList(const char *szListFile)\n\n {\n\n ifstream tmpFile;\n\n\n\n if (szListFile)\n\n {\n\n tmpFile.open(szListFile, ios_base::in);\n\n if (tmpFile)\n\n {\n\n ReadList(tmpFile);\n\n tmpFile.close();\n\n }\n\n else\n\n { //Open failed\n\n tmpFile.close();\n\n throw CSystemErr(CSystemErr::eCreateFile, \"CFlatFile::ReadList\");\n\n }\n\n }\n\n else\n\n {\n\n throw CSystemErr(CSystemErr::eCreateFile, \"CFlatFile::ReadList\");\n\n }\n\n }\n\n\n\n void ReadList(const string &str)\n\n {\n\n istringstream tmpFile(str);\n\n ReadList(tmpFile);\n\n }\n\n\n\n void ReadList(istream &tmpFile)\n\n {\n\n T row;\n\n memset(&row, 0, sizeof(row));\n\n\n\n while(tmpFile.good())\n\n {\n\n row.Load(tmpFile); //read the row\n\n // We don't know if we've hit the end of the file\n\n // until after trying the read.\n\n if( ! tmpFile.eof() )\n\n {\n\n m_list.Add(&row); //insert into the container\n\n }\n\n\n\n }\n\n }\n\n\n\n\n\npublic:\n\n\n\n //Constructor.\n\n CFlatFile(const char *szListFile)\n\n {\n\n ReadList(szListFile);\n\n }\n\n\n\n CFlatFile(const string &str)\n\n {\n\n ReadList(str);\n\n }\n\n virtual ~CFlatFile() {}\n\n\n\n //Returns the element at a specific index\n\n T* GetRecord(int index) { return &m_list[index]; };\n\n\n\n //Returns the size of the file (number of rows)\n\n UINT GetSize() {return (UINT)m_list.size();}\n", "file_path": "egen/inc/FlatFile.h", "rank": 14, "score": 97900.4451200462 }, { "content": "namespace TPCE\n\n{\n\n\n\n//Base abstract structure for an input file row\n\n//Must be able to read itself from a file.\n\ntypedef struct TBaseInputRow\n\n{\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n virtual ~TBaseInputRow() {}\n\n} *PBaseInputRow;\n\n\n\n// ACCOUNT_PERMISSION table\n\ntypedef struct ACCOUNT_PERMISSION_ROW\n\n{\n\n TIdent AP_CA_ID;\n\n char AP_ACL[ cACL_len+1 ]; //binary column in the table\n\n char AP_TAX_ID[ cTAX_ID_len+1 ];\n\n char AP_L_NAME[ cL_NAME_len+1 ];\n\n char AP_F_NAME[ cF_NAME_len+1 ];\n\n} *PACCOUNT_PERMISSION_ROW;\n\nconst char AccountPermissionRowFmt[] = \"%\" PRId64 \"|%s|%s|%s|%s\\n\";\n\n\n\n// ADDRESS table\n\ntypedef struct ADDRESS_ROW\n\n{\n\n TIdent AD_ID;\n\n char AD_LINE1[ cAD_LINE_len+1];\n\n char AD_LINE2[ cAD_LINE_len+1];\n\n char AD_ZC_CODE[ cAD_ZIP_len+1 ];\n\n char AD_CTRY[ cAD_CTRY_len+1 ];\n\n} *PADDRESS_ROW;\n\nconst char AddressRowFmt[] = \"%\" PRId64 \"|%s|%s|%s|%s\\n\";\n\n\n\n// BROKER table\n\ntypedef struct BROKER_ROW\n\n{\n\n TIdent B_ID;\n\n char B_ST_ID[ cST_ID_len+1 ];\n\n char B_NAME[ cB_NAME_len+1 ];\n\n int B_NUM_TRADES;\n\n double B_COMM_TOTAL;\n\n} *PBROKER_ROW;\n\nconst char BrokerRowFmt[] = \"%\" PRId64 \"|%s|%s|%d|%.2f\\n\";\n\n\n\n// CASH_TRANSACTION table\n\ntypedef struct CASH_TRANSACTION_ROW\n\n{\n\n TTrade CT_T_ID;\n\n CDateTime CT_DTS;\n\n double CT_AMT;\n\n char CT_NAME[cCT_NAME_len+1];\n\n} *PCASH_TRANSACTION_ROW;\n\nconst char CashTransactionRowFmt[] = \"%\" PRId64 \"|%s|%.2f|%s\\n\";\n\n\n\n// CHARGE table\n\ntypedef struct CHARGE_ROW : public TBaseInputRow\n\n{\n\n char CH_TT_ID[cTT_ID_len+1];\n\n int CH_C_TIER;\n\n double CH_CHRG;\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PCHARGE_ROW;\n\nconst char ChargeRowFmt[] = \"%s|%d|%.2f\\n\";\n\n\n\n// COMMISSION_RATE table\n\ntypedef struct COMMISSION_RATE_ROW : public TBaseInputRow\n\n{\n\n int CR_C_TIER;\n\n char CR_TT_ID[cTT_ID_len+1];\n\n char CR_EX_ID[cEX_ID_len+1];\n\n double CR_FROM_QTY;\n\n double CR_TO_QTY;\n\n double CR_RATE;\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PCOMMISSION_RATE_ROW;\n\nconst char CommissionRateRowFmt[] = \"%d|%s|%s|%.0f|%.0f|%.2f\\n\";\n\n\n\n// COMPANY table\n\ntypedef struct COMPANY_ROW\n\n{\n\n TIdent CO_ID;\n\n char CO_ST_ID[ cST_ID_len+1 ];\n\n char CO_NAME[ cCO_NAME_len+1 ];\n\n char CO_IN_ID[ cIN_ID_len+1 ];\n\n char CO_SP_RATE[ cSP_RATE_len+1 ];\n\n char CO_CEO[ cCEO_NAME_len+1 ];\n\n TIdent CO_AD_ID;\n\n char CO_DESC[ cCO_DESC_len+1 ];\n\n CDateTime CO_OPEN_DATE;\n\n} *PCOMPANY_ROW;\n\nconst char CompanyRowFmt[] = \"%\" PRId64 \"|%s|%s|%s|%s|%s|%\" PRId64 \"|%s|%s\\n\";\n\n\n\n// COMPANY_COMPETITOR table\n\ntypedef struct COMPANY_COMPETITOR_ROW : public TBaseInputRow\n\n{\n\n TIdent CP_CO_ID;\n\n TIdent CP_COMP_CO_ID;\n\n char CP_IN_ID[cIN_ID_len+1];\n", "file_path": "egen/inc/Table_Defs.h", "rank": 15, "score": 97900.4451200462 }, { "content": "namespace TPCE\n\n{\n\n\n\n// For 128-bit integer multiplication\n\n#define BIT63 UINT64_CONST(0x8000000000000000)\n\n#define CARRY32 UINT64_CONST(0x100000000)\n\n#define MASK32 UINT64_CONST(0xFFFFFFFF)\n\n#define UPPER32 32\n\n\n\n// Multiply 64-bit and 32-bit factors, followed by a right-shift of 64 bits (retaining upper 64-bit quantity)\n\n// This is implemented as two 64-bit multiplications with summation of partial products.\n\ninline UINT Mul6432WithShiftRight64(UINT64 seed, UINT range)\n\n{\n\n UINT64 SL = (seed & MASK32), // lower 32 bits of seed\n\n SU = (seed >> UPPER32), // upper 32 bits of seed\n\n RL = range; // range\n\n\n\n UINT64 p0 = (SL * RL), // partial products\n\n p1 = (SU * RL),\n\n s;\n\n\n\n s = p0;\n\n s >>= UPPER32;\n\n s += p1;\n\n s >>= UPPER32;\n\n\n\n return (UINT)s;\n\n}\n\n\n\n// Multiply two 64-bit factors, followed by a right-shift of 64 bits (retaining upper 64-bit quantity)\n\n// This is implemented as four 64-bit multiplications with summation of partial products and carry.\n\ninline UINT64 Mul6464WithShiftRight64(UINT64 seed, UINT64 range)\n\n{\n\n UINT64 SL = (seed & MASK32), // lower 32 bits of seed\n\n SU = (seed >> UPPER32), // upper 32 bits of seed\n\n RL = (range & MASK32), // lower 32 bits of range\n\n RU = (range >> UPPER32); // upper 32 bits of range\n\n\n\n UINT64 p0 = (SL * RL), // partial products\n\n p1 = (SU * RL),\n\n p2 = (SL * RU),\n\n p3 = (SU * RU),\n\n p12_carry = 0,\n\n s;\n\n\n\n s = p0;\n\n s >>= UPPER32;\n\n s += p1;\n\n p12_carry = ( ( ( (p1 & BIT63) || (s & BIT63) ) && (p2 & BIT63) ) ? CARRY32 : 0 );\n\n s += p2;\n\n s >>= UPPER32;\n\n s += p12_carry;\n\n s += p3;\n\n\n\n return s;\n\n}\n\n\n", "file_path": "egen/inc/BigMath.h", "rank": 16, "score": 97900.4451200462 }, { "content": "namespace TPCE\n\n{\n\n\n\nenum eDriverType\n\n{\n\n eDriverEGenLoader,\n\n eDriverAll,\n\n eDriverCE,\n\n eDriverMEE,\n\n eDriverDM,\n\n eDriverMax\n\n};\n\n\n\nextern char szDriverTypeNames[eDriverMax][14];\n", "file_path": "egen/inc/DriverTypes.h", "rank": 17, "score": 97900.4451200462 }, { "content": "namespace TPCE\n\n{\n\nconst int iDateTimeFmt = 11;\n\nconst int iConnectStrLen = 256;\n\nconst char delimiter = '|';\n\n\n\n//\n\n// PGSQLLoader class.\n\n//\n\ntemplate <typename T> class CPGSQLLoader : public CBaseLoader<T>\n\n{\n\nprotected:\n\n\tFILE *p;\n\n\n\n\tchar m_szConnectStr[iConnectStrLen + 1];\n\n\tchar m_szTable[iMaxPath + 1]; // name of the table being loaded\n\n\n\npublic:\n\n\ttypedef const T *PT; // pointer to the table row\n\n\n\n\tCPGSQLLoader(const char *szConnectStr, const char *szTable);\n\n\tvirtual ~CPGSQLLoader(void);\n\n\n\n\t// resets to clean state; needed after FinishLoad to continue loading\n\n\tvirtual void Init();\n\n\n\n\tvirtual void Commit(); // commit rows sent so far\n\n\tvirtual void FinishLoad(); // finish load\n\n\tvoid Connect(); // connect to PostgreSQL\n\n\n\n\t// disconnect - should not throw any exceptions (to put into the destructor)\n\n\tvoid Disconnect();\n\n\n\n\tvirtual void WriteNextRecord(PT next_record) = 0; // pure virtual function\n\n};\n\n\n\n//\n\n// The constructor.\n\n//\n\ntemplate <typename T>\n\nCPGSQLLoader<T>::CPGSQLLoader(const char *szConnectStr, const char *szTable)\n\n{\n\n\t// FIXME: This may truncate if the szConnectStr is actually close to\n\n\t// iConnectStrLen.\n\n\tsnprintf(m_szConnectStr, iConnectStrLen, \"psql %s\", szConnectStr);\n\n\n\n\tstrncpy(m_szTable, szTable, iMaxPath);\n\n}\n\n\n\n//\n\n// Destructor closes the connection.\n\n//\n\ntemplate <typename T>\n\nCPGSQLLoader<T>::~CPGSQLLoader()\n\n{\n\n\tDisconnect();\n\n}\n\n\n\n//\n\n// Reset state e.g. close the connection, bind columns again, and reopen.\n\n// Needed after Commit() to continue loading.\n\n//\n\ntemplate <typename T>\n\nvoid CPGSQLLoader<T>::Init()\n\n{\n\n\tConnect();\n", "file_path": "egen/inc/custom/pgsql/pgloader.h", "rank": 18, "score": 96541.24679187525 }, { "content": "namespace TPCE\n\n{\n\n\n\n// Database binding type for integer identifiers (IDENT_T metatype in TPC-E spec).\n\n//\n\n#define IDENT_BIND SQLINT8\n\n\n\n//For nullable columns\n\ntypedef struct BCPDOUBLE\n\n{\n\n int iIndicator;\n\n float value;\n\n} *PBCPDOUBLE;\n\ntypedef struct BCPDBDATETIME\n\n{\n\n int iIndicator;\n\n DBDATETIME value;\n\n} *PBCPDBDATETIME;\n\n\n\n/*\n\n* DBLoader class.\n\n*/\n\ntemplate <typename T> class CDBLoader : public CBaseLoader<T>\n\n{\n\nprotected:\n\n T m_row;\n\n int m_cnt;\n\n SQLHENV m_henv; // ODBC environment handle\n\n SQLHDBC m_hdbc;\n\n SQLHSTMT m_hstmt; // the current hstmt\n\n char m_szServer[iMaxHostname]; // server name\n\n char m_szDatabase[iMaxDBName]; // name of the database being loaded\n\n char m_szLoaderParams[iMaxPath]; // loader parameters specified on the command-line\n\n char m_szTable[iMaxPath]; // name of the table being loaded\n\n\n\n//public:\n\n //typedef const T* PT; //pointer to the table row\n\n\n\n\n\n//protected:\n\n virtual inline void CopyRow(PT row) { memcpy(&m_row, row, sizeof(m_row)); };\n\n\n\npublic:\n\n\n\n CDBLoader(char *szServer, char *szDatabase, char *szLoaderParams, char *szTable);\n\n ~CDBLoader(void);\n\n\n\n virtual void BindColumns() = 0; //column binding function subclasses must implement\n\n virtual void Init(); //resets to clean state; needed after FinishLoad to continue loading\n\n virtual void Commit(); // commit rows sent so far\n\n virtual void FinishLoad(); // finish load\n\n void Connect(); //connect to SQL Server\n\n void Disconnect(); //disconnect - should not throw any exceptions (to put into the destructor)\n\n\n\n void ThrowError( CODBCERR::ACTION eAction, SQLSMALLINT HandleType = 0, SQLHANDLE Handle = SQL_NULL_HANDLE);\n\n virtual void WriteNextRecord(PT next_record);\n\n};\n\n\n", "file_path": "egen/inc/win/DBLoader.h", "rank": 19, "score": 96541.24679187525 }, { "content": "namespace TPCE\n\n{\n\n\n\nenum eTradeTypeID\n\n{\n\n eMarketBuy = 0,\n\n eMarketSell,\n\n eStopLoss,\n\n eLimitSell,\n\n eLimitBuy,\n\n\n\n eMaxTradeTypeID // should be the last - contains the number of items in the enumeration\n\n};\n\n\n", "file_path": "egen/inc/TradeTypeIDs.h", "rank": 20, "score": 96541.24679187525 }, { "content": "namespace TPCE\n\n{\n\n\n\nconst double fMinSecPrice = 20.00;\n\nconst double fMaxSecPrice = 30.00;\n\n\n", "file_path": "egen/inc/SecurityPriceRange.h", "rank": 21, "score": 96541.24679187525 }, { "content": "namespace TPCE\n\n{\n\n\n\n// EGen Formatting Defaults\n\n#ifndef DATETIME_FORMAT\n\n#define DATETIME_FORMAT 12 // YYYY-MM-DD HH:MM:SS.mmm\n\n#endif\n\n\n\n#ifndef TIME_FORMAT\n\n#define TIME_FORMAT 01 // hh:mm:ss\n\n#endif\n\n\n\n#ifndef DATE_FORMAT\n\n#define DATE_FORMAT 10 // YYYY-MM-DD\n\n#endif\n\n\n\n#ifndef BOOLEAN_TRUE\n\n#define BOOLEAN_TRUE \"1\"\n\n#endif\n\n\n\n#ifndef BOOLEAN_FALSE\n\n#define BOOLEAN_FALSE \"0\"\n\n#endif\n\n\n\n#ifndef BUFFER_SIZE\n\n#define BUFFER_SIZE 0\n\n#endif\n\n\n\n// EGen Formatting\n\nconst int FlatFileDateTimeFormat = DATETIME_FORMAT;\n\nconst int FlatFileTimeFormat = TIME_FORMAT;\n\nconst int FlatFileDateFormat = DATE_FORMAT;\n\nconst char* const FlatFileBoolTrue = BOOLEAN_TRUE;\n\nconst char* const FlatFileBoolFalse = BOOLEAN_FALSE;\n\n\n\n// EGen Buffering\n\nconst int FlatFileBufferSize = BUFFER_SIZE;\n\n\n\n// Overwrite vs. append functionality for output flat files.\n\nenum FlatFileOutputModes {\n\n FLAT_FILE_OUTPUT_APPEND = 0,\n\n FLAT_FILE_OUTPUT_OVERWRITE\n\n};\n\n\n\n/*\n\n* FlatLoader class.\n\n*/\n\ntemplate <typename T> class CFlatFileLoader : public CBaseLoader<T>\n\n{\n\nprotected:\n\n FILE *hOutFile;\n\n\n\npublic:\n\n\n\n CFlatFileLoader(char *szFileName, FlatFileOutputModes FlatFileOutputMode);\n\n ~CFlatFileLoader(void);\n\n\n\n virtual void WriteNextRecord(const T* next_record UNUSED) = 0;\n\n void FinishLoad(); //finish load\n\n\n\n};\n\n\n\n/*\n\n* The constructor.\n\n*/\n\ntemplate <typename T>\n\nCFlatFileLoader<T>::CFlatFileLoader(char *szFileName, FlatFileOutputModes flatFileOutputMode)\n\n{\n\n if( FLAT_FILE_OUTPUT_APPEND == flatFileOutputMode )\n\n {\n\n hOutFile = fopen( szFileName, \"a\" );\n\n }\n\n else if( FLAT_FILE_OUTPUT_OVERWRITE == flatFileOutputMode )\n\n {\n\n hOutFile = fopen( szFileName, \"w\" );\n\n }\n\n\n\n if (!hOutFile)\n\n {\n\n throw CSystemErr(CSystemErr::eCreateFile, \"CFlatFileLoader<T>::CFlatFileLoader\");\n\n }\n\n\n\n if (FlatFileBufferSize > 0)\n\n {\n\n if (setvbuf(hOutFile, NULL, _IOFBF, FlatFileBufferSize))\n\n {\n\n throw CSystemErr(CSystemErr::eCreateFile, \"CFlatFileLoader<T>::CFlatFileLoader\");\n\n }\n\n }\n\n}\n\n\n\n/*\n\n* Destructor.\n\n*/\n\ntemplate <typename T>\n\nCFlatFileLoader<T>::~CFlatFileLoader()\n\n{\n\n fclose(hOutFile);\n\n}\n\n\n\n/*\n\n* Commit sent rows. This needs to be called after the last row has been sent\n\n* and before the object is destructed. Otherwise all rows will be discarded.\n\n*/\n\ntemplate <typename T>\n\nvoid CFlatFileLoader<T>::FinishLoad()\n\n{\n\n fflush(hOutFile);\n", "file_path": "egen/inc/FlatFileLoader.h", "rank": 22, "score": 96541.24679187525 }, { "content": "namespace TPCE\n\n{\n\n\n\nextern \"C\"\n\n{\n\nvoid GetEGenVersion_C(INT32 &iMajorVersion, INT32 &iMinorVersion, INT32 &iRevisionNumber, INT32 &iBetaLevel);\n\nvoid GetEGenVersionString_C(char* szOutput, size_t iOutputBufferLen);\n\nvoid PrintEGenVersion_C();\n\nvoid GetEGenVersionUpdateTimestamp_C(char* szOutput, size_t iOutputBufferLen);\n\n}\n\n\n\n// Retrieve major, minor, revision, and beta level numbers for EGen.\n\n// For example, v3.10 beta 1 has:\n\n// major 3\n\n// minor 10\n\n// revision 0\n\n// beta level 1\n\n// v3.10 release has:\n\n// major 3\n\n// minor 10\n\n// revision 0\n\n// beta level 0\n\n//\n\nvoid GetEGenVersion(INT32 &iMajorVersion, INT32 &iMinorVersion, INT32 &iRevisionNumber, INT32 &iBetaLevel);\n\n\n\n// Return versioning information formated as a string\n\n//\n\n// Note: requires output buffer at least 64 characters long, or nothing will be returned.\n\n//\n\nvoid GetEGenVersionString(char* szOutput, size_t iOutputBufferLen);\n\n\n\n// Output EGen versioning information on stdout\n\n//\n\nvoid PrintEGenVersion();\n\n\n\n// Return the date/time when the EGen versioning information was last updated.\n\n//\n\nvoid GetEGenVersionUpdateTimestamp(char* szOutput, size_t iOutputBufferLen);\n\n\n", "file_path": "egen/inc/EGenVersion.h", "rank": 23, "score": 96541.24679187525 }, { "content": "namespace TPCE\n\n{\n\n\n\ntemplate <typename T> class CInputFileNoWeight\n\n{\n\n typedef vector<T>* PVectorT;\n\n //Type of in-memory representation of input files\n\n typedef vector<PVectorT> CFileInMemoryList; //array of arrays\n\n\n\n CFileInMemoryList m_list;\n\n\n\n void ReadList(const char *szListFile)\n\n {\n\n ifstream tmpFile;\n\n\n\n if (szListFile)\n\n {\n\n tmpFile.open(szListFile, ios_base::in);\n\n if (tmpFile)\n\n {\n\n ReadList(tmpFile);\n\n tmpFile.close();\n\n }\n\n else\n\n { //Open failed\n\n tmpFile.close();\n\n throw CSystemErr(CSystemErr::eCreateFile, \"CInputFileNoWeight::ReadList\");\n\n }\n\n }\n\n else\n\n {\n\n throw CSystemErr(CSystemErr::eCreateFile, \"CInputFileNoWeight::ReadList\");\n\n }\n\n }\n\n\n\n void ReadList(const string &str)\n\n {\n\n istringstream tmpFile(str);\n\n ReadList(tmpFile);\n\n }\n\n\n\n void ReadList(istream &tmpFile)\n\n {\n\n T row;\n\n memset(&row, 0, sizeof(row));\n\n int iIndex;\n\n int iLastIndex = -1; /* must be different from the 1st index in the input file */\n\n\n\n while(tmpFile.good())\n\n {\n\n tmpFile>>iIndex; //read the first column, which is the index\n\n if( ! tmpFile.eof() )\n\n {\n\n row.Load(tmpFile); //read the row\n\n if (iIndex!=iLastIndex)\n\n {\n\n PVectorT parray_row = new vector<T>;\n\n if (parray_row!=NULL)\n\n m_list.push_back(parray_row); //new array\n\n else\n\n throw CMemoryErr(\"CInputFileNoWeight::ReadFile\");\n\n iLastIndex = iIndex;\n\n }\n\n //Indices in the file start with 1 => substract 1.\n\n m_list[(UINT)(iIndex-1)]->push_back(row); //insert into the container\n\n }\n\n }\n\n }\n\n\n\npublic:\n\n\n\n //Constructor.\n\n CInputFileNoWeight(const char *szListFile)\n\n {\n\n ReadList(szListFile);\n\n }\n\n\n\n CInputFileNoWeight(const string &str)\n\n {\n\n ReadList(str);\n\n }\n\n\n\n //Destructor\n\n ~CInputFileNoWeight()\n\n {\n\n for(size_t i=0; i<m_list.size(); ++i)\n\n delete m_list[i];\n\n }\n\n\n\n //Returns the element at a specific index\n\n PVectorT GetRecord(UINT index) { return m_list[index]; };\n\n\n\n //Returns the number of records in the file (needed for TaxRates table\n\n UINT GetSize() { return (UINT)m_list.size(); }\n", "file_path": "egen/inc/InputFileNoWeight.h", "rank": 24, "score": 96541.24679187525 }, { "content": "namespace TPCE\n\n{\n\n\n\n//declare the < operator for timestamps\n\nbool operator< (const TIMESTAMP_STRUCT& ts1, const TIMESTAMP_STRUCT& ts2);\n\n\n\nconst INT32 iFinYears = 5;\n\nconst INT32 iFinQtrPerYear = 4;\n\nconst INT32 iMaxDailyHistory = 10;\n\nconst INT32 iMaxNews = 10;\n\n\n\n// Broker-Volume\n\nconst INT32 min_broker_list_len = 20;\n\nconst INT32 max_broker_list_len = 40;\n\n\n\n// Customer-Position\n\nconst INT32 max_acct_len = iMaxAccountsPerCust;\n\nconst INT32 min_hist_len = 10 * 1;\n\nconst INT32 max_hist_len = 10 * 3;\n\n\n\n// Market-Feed\n\nconst INT32 max_feed_len = 20;\n\n\n\n// Security-Detail\n\nconst INT32 min_day_len = 5;\n\nconst INT32 max_day_len = 20;\n\nconst INT32 max_fin_len = 20;\n\nconst INT32 max_news_len = 2;\n\nconst INT32 max_comp_len = 3;\n\n\n\n// Trade-Status\n\nconst INT32 max_trade_status_len = 50;\n\n\n\n// Data-Maintenance\n\nconst INT32 max_table_name = 30;\n\n\n\n/*\n\n* Macros for harness validation\n\n*/\n\n\n\n#define TXN_HARNESS_PROPAGATE_STATUS(code) \\\n\nif ((pTxnOutput->status >= 0) && ((code) < 0)) \\\n\n{ \\\n\n /* propagate error over existing ok/warn status */ \\\n\n pTxnOutput->status = (code); \\\n\n} \\\n\nelse if ((pTxnOutput->status == 0) && ((code) > 0)) \\\n\n{ \\\n\n /* propagate warning over existing ok status */ \\\n\n pTxnOutput->status = (code); \\\n\n}\n\n\n\n#define TXN_HARNESS_SET_STATUS_SUCCESS \\\n\n pTxnOutput->status = CBaseTxnErr::SUCCESS;\n\n\n\n/*\n\n* Broker-Volume\n\n*/\n\ntypedef struct TBrokerVolumeTxnInput\n\n{\n\n // Transaction level inputs\n\n char broker_list[max_broker_list_len][cB_NAME_len+1];\n\n char sector_name[cSC_NAME_len+1];\n\n} *PBrokerVolumeTxnInput,\n\n TBrokerVolumeFrame1Input, // Single-Frame transaction\n\n *PBrokerVolumeFrame1Input; // Single-Frame transaction\n\n\n\ntypedef struct TBrokerVolumeTxnOutput\n\n{\n\n // Transaction level outputs\n\n double volume[max_broker_list_len];\n\n INT32 list_len;\n\n INT32 status;\n\n} *PBrokerVolumeTxnOutput;\n\n\n\ntypedef struct TBrokerVolumeFrame1Output\n\n{\n\n // Frame level outputs\n\n double volume[max_broker_list_len];\n\n INT32 list_len;\n\n char broker_name[max_broker_list_len][cB_NAME_len+1];\n\n} *PBrokerVolumeFrame1Output;\n\n/*\n\n* Customer-Position\n\n*/\n\ntypedef struct TCustomerPositionTxnInput\n\n{\n\n TIdent acct_id_idx;\n\n TIdent cust_id;\n\n bool get_history;\n\n char tax_id[cTAX_ID_len+1];\n\n} *PCustomerPositionTxnInput;\n\n\n\ntypedef struct TCustomerPositionTxnOutput\n\n{\n\n double asset_total[max_acct_len];\n\n double cash_bal[max_acct_len];\n\n TIdent acct_id[max_acct_len];\n\n TTrade trade_id[max_hist_len];\n\n TIdent c_ad_id;\n\n INT32 qty[max_hist_len];\n\n INT32 acct_len;\n\n INT32 hist_len;\n\n INT32 status;\n\n TIMESTAMP_STRUCT hist_dts[max_hist_len];\n\n TIMESTAMP_STRUCT c_dob;\n\n char symbol[max_hist_len][cSYMBOL_len+1];\n\n char trade_status[max_hist_len][cST_NAME_len+1];\n\n char c_area_1[cAREA_len+1];\n\n char c_area_2[cAREA_len+1];\n\n char c_area_3[cAREA_len+1];\n\n char c_ctry_1[cCTRY_len+1];\n\n char c_ctry_2[cCTRY_len+1];\n\n char c_ctry_3[cCTRY_len+1];\n\n char c_email_1[cEMAIL_len+1];\n\n char c_email_2[cEMAIL_len+1];\n\n char c_ext_1[cEXT_len+1];\n\n char c_ext_2[cEXT_len+1];\n\n char c_ext_3[cEXT_len+1];\n\n char c_f_name[cF_NAME_len+1];\n\n char c_gndr[cGNDR_len+1];\n\n char c_l_name[cL_NAME_len+1];\n\n char c_local_1[cLOCAL_len+1];\n\n char c_local_2[cLOCAL_len+1];\n\n char c_local_3[cLOCAL_len+1];\n\n char c_m_name[cM_NAME_len+1];\n\n char c_st_id[cST_ID_len+1];\n\n char c_tier;\n\n} *PCustomerPositionTxnOutput;\n\n\n\ntypedef struct TCustomerPositionFrame1Input\n\n{\n\n TIdent cust_id;\n\n char tax_id[cTAX_ID_len+1];\n\n} *PCustomerPositionFrame1Input;\n\n\n\ntypedef struct TCustomerPositionFrame1Output\n\n{\n\n double asset_total[max_acct_len];\n\n double cash_bal[max_acct_len];\n\n TIdent acct_id[max_acct_len];\n\n TIdent c_ad_id;\n\n TIdent cust_id;\n\n INT32 acct_len;\n\n TIMESTAMP_STRUCT c_dob;\n\n char c_area_1[cAREA_len+1];\n\n char c_area_2[cAREA_len+1];\n\n char c_area_3[cAREA_len+1];\n\n char c_ctry_1[cCTRY_len+1];\n\n char c_ctry_2[cCTRY_len+1];\n\n char c_ctry_3[cCTRY_len+1];\n\n char c_email_1[cEMAIL_len+1];\n\n char c_email_2[cEMAIL_len+1];\n\n char c_ext_1[cEXT_len+1];\n\n char c_ext_2[cEXT_len+1];\n\n char c_ext_3[cEXT_len+1];\n\n char c_f_name[cF_NAME_len+1];\n\n char c_gndr[cGNDR_len+1];\n\n char c_l_name[cL_NAME_len+1];\n\n char c_local_1[cLOCAL_len+1];\n\n char c_local_2[cLOCAL_len+1];\n\n char c_local_3[cLOCAL_len+1];\n\n char c_m_name[cM_NAME_len+1];\n\n char c_st_id[cST_ID_len+1];\n\n char c_tier;\n\n} *PCustomerPositionFrame1Output;\n\n\n\ntypedef struct TCustomerPositionFrame2Input\n\n{\n\n TIdent acct_id;\n\n} *PCustomerPositionFrame2Input;\n\n\n\ntypedef struct TCustomerPositionFrame2Output\n\n{\n\n TTrade trade_id[max_hist_len];\n\n INT32 qty[max_hist_len];\n\n INT32 hist_len;\n\n TIMESTAMP_STRUCT hist_dts[max_hist_len];\n\n char symbol[max_hist_len][cSYMBOL_len+1];\n\n char trade_status[max_hist_len][cST_NAME_len+1];\n\n} *PCustomerPositionFrame2Output;\n\n\n\n\n\n\n\n/*\n\n* Data-Maintenance\n\n*/\n\ntypedef struct TDataMaintenanceTxnInput\n\n{\n\n TIdent acct_id;\n\n TIdent c_id;\n\n TIdent co_id;\n\n INT32 day_of_month;\n\n INT32 vol_incr;\n\n char symbol[cSYMBOL_len+1];\n\n char table_name[max_table_name+1];\n\n char tx_id[cTX_ID_len+1];\n\n} *PDataMaintenanceTxnInput,\n\n TDataMaintenanceFrame1Input, // Single-Frame transaction\n\n *PDataMaintenanceFrame1Input; // Single-Frame transaction\n\n\n\ntypedef struct TDataMaintenanceTxnOutput\n\n{\n\n INT32 status;\n\n} *PDataMaintenanceTxnOutput;\n\n\n\n/*\n\n* Market-Feed\n\n*/\n\n// MEE populates this structure\n\ntypedef struct TStatusAndTradeType\n\n{\n\n char status_submitted[cST_ID_len+1];\n\n char type_limit_buy[cTT_ID_len+1];\n\n char type_limit_sell[cTT_ID_len+1];\n\n char type_stop_loss[cTT_ID_len+1];\n\n} *PTStatusAndTradeType;\n\n\n\n//Incoming order from SendToMarket interface.\n\ntypedef struct TTradeRequest\n\n{\n\n double price_quote;\n\n TTrade trade_id;\n\n INT32 trade_qty;\n\n eMEETradeRequestAction eAction;\n\n char symbol[cSYMBOL_len+1];\n\n char trade_type_id[cTT_ID_len+1];\n\n} *PTradeRequest;\n\n\n\n//A single entry on the ticker tape feed.\n\ntypedef struct TTickerEntry\n\n{\n\n double price_quote;\n\n INT32 trade_qty;\n\n char symbol[cSYMBOL_len+1];\n\n} *PTickerEntry;\n\n\n\n//Market-Feed data sent from MEE to sponsor provided SUT interface\n\ntypedef struct TMarketFeedTxnInput\n\n{\n\n INT32 unique_symbols;\n\n char zz_padding1[4];\n\n TStatusAndTradeType StatusAndTradeType;\n\n char zz_padding2[4];\n\n TTickerEntry Entries[max_feed_len];\n\n} *PMarketFeedTxnInput;\n\n\n\ntypedef struct TMarketFeedTxnOutput\n\n{\n\n INT32 send_len;\n\n INT32 status;\n\n} *PMarketFeedTxnOutput;\n\n\n\ntypedef struct TMarketFeedFrame1Input\n\n{\n\n TStatusAndTradeType StatusAndTradeType;\n\n char zz_padding[4];\n\n TTickerEntry Entries[max_feed_len];\n\n} *PMarketFeedFrame1Input;\n\n\n\ntypedef struct TMarketFeedFrame1Output\n\n{\n\n INT32 num_updated;\n\n INT32 send_len;\n\n} *PMarketFeedFrame1Output;\n\n\n\n\n\n/*\n\n* Market-Watch\n\n*/\n\ntypedef struct TMarketWatchTxnInput\n\n{\n\n TIdent acct_id;\n\n TIdent c_id;\n\n TIdent ending_co_id;\n\n TIdent starting_co_id;\n\n TIMESTAMP_STRUCT start_day;\n\n char industry_name[cIN_NAME_len+1];\n\n} *PMarketWatchTxnInput,\n\n TMarketWatchFrame1Input, // Single-Frame transaction\n\n *PMarketWatchFrame1Input; // Single-Frame transaction\n\n\n\ntypedef struct TMarketWatchTxnOutput\n\n{\n\n double pct_change;\n\n INT32 status;\n\n} *PMarketWatchTxnOutput;\n\n\n\ntypedef struct TMarketWatchFrame1Output\n\n{\n\n double pct_change;\n\n} *PMarketWatchFrame1Output;\n\n\n\n\n\n/*\n\n* Security-Detail\n\n*/\n\ntypedef struct TFinInfo\n\n{\n\n double assets;\n\n double basic_eps;\n\n double dilut_eps;\n\n double invent;\n\n double liab;\n\n double margin;\n\n double net_earn;\n\n double out_basic;\n\n double out_dilut;\n\n double rev;\n\n INT32 qtr;\n\n INT32 year;\n\n TIMESTAMP_STRUCT start_date;\n\n DB_INDICATOR assets_ind;\n\n DB_INDICATOR basic_eps_ind;\n\n DB_INDICATOR dilut_eps_ind;\n\n DB_INDICATOR invent_ind;\n\n DB_INDICATOR liab_ind;\n\n DB_INDICATOR margin_ind;\n\n DB_INDICATOR net_earn_ind;\n\n DB_INDICATOR out_basic_ind;\n\n DB_INDICATOR out_dilut_ind;\n\n DB_INDICATOR qtr_ind;\n\n DB_INDICATOR rev_ind;\n\n DB_INDICATOR start_date_ind;\n\n DB_INDICATOR year_ind;\n\n} *PFinInfo;\n\n\n\ntypedef struct TDailyHistory\n\n{\n\n double close;\n\n double high;\n\n double low;\n\n INT64 vol;\n\n TIMESTAMP_STRUCT date;\n\n DB_INDICATOR close_ind;\n\n DB_INDICATOR date_ind;\n\n DB_INDICATOR high_ind;\n\n DB_INDICATOR low_ind;\n\n DB_INDICATOR vol_ind;\n\n} *PDailyHistory;\n\n\n\ntypedef struct TNews\n\n{\n\n TIMESTAMP_STRUCT dts;\n\n char auth[cNI_AUTHOR_len+1];\n\n char headline[cNI_HEADLINE_len+1];\n\n char item[cNI_ITEM_len+1];\n\n char src[cNI_SOURCE_len+1];\n\n char summary[cNI_SUMMARY_len+1];\n\n DB_INDICATOR auth_ind;\n\n} *PNews;\n\n\n\ntypedef struct TSecurityDetailTxnInput\n\n{\n\n INT32 max_rows_to_return;\n\n bool access_lob_flag;\n\n TIMESTAMP_STRUCT start_day;\n\n char symbol[cSYMBOL_len+1];\n\n} *PSecurityDetailTxnInput,\n\n TSecurityDetailFrame1Input, // Single-Frame transaction\n\n *PSecurityDetailFrame1Input; // Single-Frame transaction\n\n\n\ntypedef struct TSecurityDetailTxnOutput\n\n{\n\n INT64 last_vol;\n\n INT32 news_len;\n\n INT32 status;\n\n} *PSecurityDetailTxnOutput;\n\n\n\ntypedef struct TSecurityDetailFrame1Output\n\n{\n\n double divid;\n\n double last_open;\n\n double last_price;\n\n double pe_ratio;\n\n double s52_wk_high;\n\n double s52_wk_low;\n\n double yield;\n\n INT64 last_vol;\n\n INT64 num_out;\n\n INT32 day_len;\n\n INT32 ex_close;\n\n INT32 ex_num_symb;\n\n INT32 ex_open;\n\n INT32 fin_len;\n\n INT32 news_len;\n\n TIMESTAMP_STRUCT ex_date;\n\n TIMESTAMP_STRUCT open_date;\n\n TIMESTAMP_STRUCT s52_wk_high_date;\n\n TIMESTAMP_STRUCT s52_wk_low_date;\n\n TIMESTAMP_STRUCT start_date;\n\n TDailyHistory day[max_day_len];\n\n TFinInfo fin[max_fin_len];\n\n TNews news[max_news_len];\n\n char cp_co_name[max_comp_len][cCO_NAME_len+1];\n\n char cp_in_name[max_comp_len][cIN_NAME_len+1];\n\n char ceo_name[cCEO_NAME_len+1];\n\n char co_ad_cty[cAD_CTRY_len+1];\n\n char co_ad_div[cAD_DIV_len+1];\n\n char co_ad_line1[cAD_LINE_len+1];\n\n char co_ad_line2[cAD_LINE_len+1];\n\n char co_ad_town[cAD_TOWN_len+1];\n\n char co_ad_zip[cAD_ZIP_len+1];\n\n char co_desc[cCO_DESC_len+1];\n\n char co_name[cCO_NAME_len+1];\n\n char co_st_id[cST_ID_len+1];\n\n char ex_ad_cty[cAD_CTRY_len+1];\n\n char ex_ad_div[cAD_DIV_len+1];\n\n char ex_ad_line1[cAD_LINE_len+1];\n\n char ex_ad_line2[cAD_LINE_len+1];\n\n char ex_ad_town[cAD_TOWN_len+1];\n\n char ex_ad_zip[cAD_ZIP_len+1];\n\n char ex_desc[cEX_DESC_len+1];\n\n char ex_name[cEX_NAME_len+1];\n\n char s_name[cS_NAME_len+1];\n\n char sp_rate[cSP_RATE_len+1];\n\n} *PSecurityDetailFrame1Output;\n\n\n\n\n\n/*\n\n* Trade-Lookup\n\n*/\n\ntypedef struct TTradeLookupTxnInput\n\n{\n\n TTrade trade_id[TradeLookupFrame1MaxRows];\n\n TIdent acct_id;\n\n TIdent max_acct_id;\n\n INT32 frame_to_execute; // which of the frames to execute\n\n INT32 max_trades;\n\n TIMESTAMP_STRUCT end_trade_dts;\n\n TIMESTAMP_STRUCT start_trade_dts;\n\n char symbol[cSYMBOL_len+1];\n\n} *PTradeLookupTxnInput;\n\ntypedef struct TTradeLookupTxnOutput\n\n{\n\n TTrade trade_list[TradeLookupMaxRows];\n\n INT32 frame_executed; // confirmation of which frame was executed\n\n INT32 num_found;\n\n INT32 status;\n\n bool is_cash[TradeLookupMaxRows];\n\n bool is_market[TradeLookupMaxRows];\n\n} *PTradeLookupTxnOutput;\n\n\n\ntypedef struct TTradeLookupFrame1Input\n\n{\n\n TTrade trade_id[TradeLookupFrame1MaxRows];\n\n INT32 max_trades;\n\n} *PTradeLookupFrame1Input;\n\n\n\n// Structure to hold one trade information row\n\n//\n\ntypedef struct TTradeLookupFrame1TradeInfo\n\n{\n\n double bid_price;\n\n double cash_transaction_amount;\n\n double settlement_amount;\n\n double trade_price;\n\n bool is_cash;\n\n bool is_market;\n\n TIMESTAMP_STRUCT trade_history_dts[TradeLookupMaxTradeHistoryRowsReturned];\n\n TIMESTAMP_STRUCT cash_transaction_dts;\n\n TIMESTAMP_STRUCT settlement_cash_due_date;\n\n char trade_history_status_id[TradeLookupMaxTradeHistoryRowsReturned][cTH_ST_ID_len+1];\n\n char cash_transaction_name[cCT_NAME_len+1];\n\n char exec_name[cEXEC_NAME_len+1];\n\n char settlement_cash_type[cSE_CASH_TYPE_len+1];\n\n DB_INDICATOR trade_history_dts_ind[TradeLookupMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR trade_history_status_id_ind[TradeLookupMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR bid_price_ind;\n\n DB_INDICATOR cash_transaction_amount_ind;\n\n DB_INDICATOR cash_transaction_dts_ind;\n\n DB_INDICATOR cash_transaction_name_ind;\n\n DB_INDICATOR exec_name_ind;\n\n DB_INDICATOR is_cash_ind;\n\n DB_INDICATOR is_market_ind;\n\n DB_INDICATOR settlement_amount_ind;\n\n DB_INDICATOR settlement_cash_due_date_ind;\n\n DB_INDICATOR settlement_cash_type_ind;\n\n DB_INDICATOR trade_price_ind;\n\n} *PTradeLookupFrame1TradeInfo;\n\n\n\ntypedef struct TTradeLookupFrame1Output\n\n{\n\n INT32 num_found;\n\n TTradeLookupFrame1TradeInfo trade_info[TradeLookupFrame1MaxRows];\n\n} *PTradeLookupFrame1Output;\n\n\n\ntypedef struct TTradeLookupFrame2Input\n\n{\n\n TIdent acct_id;\n\n INT32 max_trades;\n\n TIMESTAMP_STRUCT end_trade_dts;\n\n TIMESTAMP_STRUCT start_trade_dts;\n\n} *PTradeLookupFrame2Input;\n\n\n\n// Structure to hold one trade information row\n\n//\n\ntypedef struct TTradeLookupFrame2TradeInfo\n\n{\n\n double bid_price;\n\n double cash_transaction_amount;\n\n double settlement_amount;\n\n double trade_price;\n\n TTrade trade_id;\n\n bool is_cash;\n\n TIMESTAMP_STRUCT trade_history_dts[TradeLookupMaxTradeHistoryRowsReturned];\n\n TIMESTAMP_STRUCT cash_transaction_dts;\n\n TIMESTAMP_STRUCT settlement_cash_due_date;\n\n char trade_history_status_id[TradeLookupMaxTradeHistoryRowsReturned][cTH_ST_ID_len+1];\n\n char cash_transaction_name[cCT_NAME_len+1];\n\n char exec_name[cEXEC_NAME_len+1];\n\n char settlement_cash_type[cSE_CASH_TYPE_len+1];\n\n DB_INDICATOR trade_history_dts_ind[TradeLookupMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR trade_history_status_id_ind[TradeLookupMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR bid_price_ind;\n\n DB_INDICATOR cash_transaction_amount_ind;\n\n DB_INDICATOR cash_transaction_dts_ind;\n\n DB_INDICATOR cash_transaction_name_ind;\n\n DB_INDICATOR exec_name_ind;\n\n DB_INDICATOR is_cash_ind;\n\n DB_INDICATOR settlement_amount_ind;\n\n DB_INDICATOR settlement_cash_due_date_ind;\n\n DB_INDICATOR settlement_cash_type_ind;\n\n DB_INDICATOR trade_id_ind;\n\n DB_INDICATOR trade_price_ind;\n\n} *PTradeLookupFrame2TradeInfo;\n\n\n\ntypedef struct TTradeLookupFrame2Output\n\n{\n\n INT32 num_found;\n\n TTradeLookupFrame2TradeInfo trade_info[TradeLookupFrame2MaxRows];\n\n} *PTradeLookupFrame2Output;\n\n\n\ntypedef struct TTradeLookupFrame3Input\n\n{\n\n TIdent max_acct_id;\n\n INT32 max_trades;\n\n TIMESTAMP_STRUCT end_trade_dts;\n\n TIMESTAMP_STRUCT start_trade_dts;\n\n char symbol[cSYMBOL_len+1];\n\n} *PTradeLookupFrame3Input;\n\n\n\n// Structure to hold one trade information row\n\n//\n\ntypedef struct TTradeLookupFrame3TradeInfo\n\n{\n\n double cash_transaction_amount;\n\n double price;\n\n double settlement_amount;\n\n TIdent acct_id;\n\n TTrade trade_id;\n\n INT32 quantity;\n\n bool is_cash;\n\n TIMESTAMP_STRUCT trade_history_dts[TradeLookupMaxTradeHistoryRowsReturned];\n\n TIMESTAMP_STRUCT cash_transaction_dts;\n\n TIMESTAMP_STRUCT settlement_cash_due_date;\n\n TIMESTAMP_STRUCT trade_dts;\n\n char trade_history_status_id[TradeLookupMaxTradeHistoryRowsReturned][cTH_ST_ID_len+1];\n\n char cash_transaction_name[cCT_NAME_len+1];\n\n char exec_name[cEXEC_NAME_len+1];\n\n char settlement_cash_type[cSE_CASH_TYPE_len+1];\n\n char trade_type[cTT_ID_len+1];\n\n DB_INDICATOR trade_history_dts_ind[TradeLookupMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR trade_history_status_id_ind[TradeLookupMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR acct_id_ind;\n\n DB_INDICATOR cash_transaction_amount_ind;\n\n DB_INDICATOR cash_transaction_dts_ind;\n\n DB_INDICATOR cash_transaction_name_ind;\n\n DB_INDICATOR exec_name_ind;\n\n DB_INDICATOR is_cash_ind;\n\n DB_INDICATOR price_ind;\n\n DB_INDICATOR quantity_ind;\n\n DB_INDICATOR settlement_amount_ind;\n\n DB_INDICATOR settlement_cash_due_date_ind;\n\n DB_INDICATOR settlement_cash_type_ind;\n\n DB_INDICATOR trade_dts_ind;\n\n DB_INDICATOR trade_id_ind;\n\n DB_INDICATOR trade_type_ind;\n\n} *PTradeLookupFrame3TradeInfo;\n\n\n\ntypedef struct TTradeLookupFrame3Output\n\n{\n\n INT32 num_found;\n\n TTradeLookupFrame3TradeInfo trade_info[TradeLookupFrame3MaxRows];\n\n} *PTradeLookupFrame3Output;\n\n\n\ntypedef struct TTradeLookupFrame4Input\n\n{\n\n TIdent acct_id;\n\n TIMESTAMP_STRUCT trade_dts;\n\n} *PTradeLookupFrame4Input;\n\n\n\n// Structure to hold one trade information row\n\n//\n\ntypedef struct TTradeLookupFrame4TradeInfo\n\n{\n\n TTrade holding_history_id;\n\n TTrade holding_history_trade_id;\n\n INT32 quantity_after;\n\n INT32 quantity_before;\n\n DB_INDICATOR holding_history_id_ind;\n\n DB_INDICATOR holding_history_trade_id_ind;\n\n DB_INDICATOR quantity_after_ind;\n\n DB_INDICATOR quantity_before_ind;\n\n} *PTradeLookupFrame4TradeInfo;\n\n\n\ntypedef struct TTradeLookupFrame4Output\n\n{\n\n TTrade trade_id;\n\n INT32 num_found;\n\n INT32 num_trades_found;\n\n TTradeLookupFrame4TradeInfo trade_info[TradeLookupFrame4MaxRows];\n\n} *PTradeLookupFrame4Output;\n\n\n\n\n\n\n\n/*\n\n* Trade-Order\n\n*/\n\ntypedef struct TTradeOrderTxnInput\n\n{\n\n double requested_price;\n\n TIdent acct_id;\n\n INT32 is_lifo;\n\n INT32 roll_it_back;\n\n INT32 trade_qty;\n\n INT32 type_is_margin;\n\n char co_name[cCO_NAME_len+1];\n\n char exec_f_name[cF_NAME_len+1];\n\n char exec_l_name[cL_NAME_len+1];\n\n char exec_tax_id[cTAX_ID_len+1];\n\n char issue[cS_ISSUE_len+1];\n\n char st_pending_id[cST_ID_len+1];\n\n char st_submitted_id[cST_ID_len+1];\n\n char symbol[cSYMBOL_len+1];\n\n char trade_type_id[cTT_ID_len+1];\n\n} *PTradeOrderTxnInput;\n\ntypedef struct TTradeOrderTxnOutput\n\n{\n\n double buy_value;\n\n double sell_value;\n\n double tax_amount;\n\n TTrade trade_id;\n\n INT32 status;\n\n} *PTradeOrderTxnOutput;\n\n\n\ntypedef struct TTradeOrderFrame1Input\n\n{\n\n TIdent acct_id;\n\n} *PTradeOrderFrame1Input;\n\n\n\ntypedef struct TTradeOrderFrame1Output\n\n{\n\n TIdent broker_id;\n\n TIdent cust_id;\n\n INT32 cust_tier;\n\n INT32 num_found;\n\n INT32 tax_status;\n\n char acct_name[cCA_NAME_len+1];\n\n char broker_name[cB_NAME_len+1];\n\n char cust_f_name[cF_NAME_len+1];\n\n char cust_l_name[cL_NAME_len+1];\n\n char tax_id[cTAX_ID_len+1];\n\n} *PTradeOrderFrame1Output;\n\n\n\ntypedef struct TTradeOrderFrame2Input\n\n{\n\n TIdent acct_id;\n\n char exec_f_name[cF_NAME_len+1];\n\n char exec_l_name[cL_NAME_len+1];\n\n char exec_tax_id[cTAX_ID_len+1];\n\n} *PTradeOrderFrame2Input;\n\n\n\ntypedef struct TTradeOrderFrame2Output\n\n{\n\n char ap_acl[cACL_len+1];\n\n} *PTradeOrderFrame2Output;\n\n\n\ntypedef struct TTradeOrderFrame3Input\n\n{\n\n double requested_price; // IN-OUT parameter\n\n TIdent acct_id;\n\n TIdent cust_id;\n\n INT32 cust_tier;\n\n INT32 is_lifo;\n\n INT32 tax_status;\n\n INT32 trade_qty;\n\n INT32 type_is_margin;\n\n char co_name[cCO_NAME_len+1]; // IN-OUT parameter\n\n char issue[cS_ISSUE_len+1];\n\n char st_pending_id[cST_ID_len+1];\n\n char st_submitted_id[cST_ID_len+1];\n\n char symbol[cSYMBOL_len+1]; // IN-OUT parameter\n\n char trade_type_id[cTT_ID_len+1];\n\n} *PTradeOrderFrame3Input;\n\n\n\ntypedef struct TTradeOrderFrame3Output\n\n{\n\n double acct_assets;\n\n double buy_value;\n\n double charge_amount;\n\n double comm_rate;\n\n double market_price;\n\n double requested_price; // IN-OUT parameter\n\n double sell_value;\n\n double tax_amount;\n\n INT32 type_is_market;\n\n INT32 type_is_sell;\n\n char co_name[cCO_NAME_len+1]; // IN-OUT parameter\n\n char s_name[cS_NAME_len+1];\n\n char status_id[cST_ID_len+1];\n\n char symbol[cSYMBOL_len+1]; // IN-OUT parameter\n\n} *PTradeOrderFrame3Output;\n\n\n\ntypedef struct TTradeOrderFrame4Input\n\n{\n\n double charge_amount;\n\n double comm_amount;\n\n double requested_price;\n\n TIdent acct_id;\n\n TIdent broker_id;\n\n INT32 is_cash;\n\n INT32 is_lifo;\n\n INT32 trade_qty;\n\n INT32 type_is_market;\n\n char exec_name[cEXEC_NAME_len+1];\n\n char status_id[cST_ID_len+1];\n\n char symbol[cSYMBOL_len+1];\n\n char trade_type_id[cTT_ID_len+1];\n\n} *PTradeOrderFrame4Input;\n\n\n\ntypedef struct TTradeOrderFrame4Output\n\n{\n\n TTrade trade_id;\n\n} *PTradeOrderFrame4Output;\n\n\n\n\n\n/*\n\n* Trade-Result\n\n*/\n\n//Trade-Result data sent from MEE to sponsor provided SUT interface\n\ntypedef struct TTradeResultTxnInput\n\n{\n\n double trade_price;\n\n TTrade trade_id;\n\n} *PTradeResultTxnInput;\n\n\n\ntypedef struct TTradeResultTxnOutput\n\n{\n\n double acct_bal;\n\n TIdent acct_id;\n\n INT32 load_unit;\n\n INT32 status;\n\n} *PTradeResultTxnOutput;\n\n\n\ntypedef struct TTradeResultFrame1Input\n\n{\n\n TTrade trade_id;\n\n} *PTradeResultFrame1Input;\n\n\n\ntypedef struct TTradeResultFrame1Output\n\n{\n\n double charge;\n\n TIdent acct_id;\n\n INT32 hs_qty;\n\n INT32 is_lifo;\n\n INT32 num_found;\n\n INT32 trade_is_cash;\n\n INT32 trade_qty;\n\n INT32 type_is_market;\n\n INT32 type_is_sell;\n\n char symbol[cSYMBOL_len+1];\n\n char type_id[cTT_ID_len+1];\n\n char type_name[cTT_NAME_len+1];\n\n} *PTradeResultFrame1Output;\n\n\n\ntypedef struct TTradeResultFrame2Input\n\n{\n\n double trade_price;\n\n TIdent acct_id;\n\n TTrade trade_id;\n\n INT32 hs_qty;\n\n INT32 is_lifo;\n\n INT32 trade_qty;\n\n INT32 type_is_sell;\n\n char symbol[cSYMBOL_len+1];\n\n} *PTradeResultFrame2Input;\n\n\n\ntypedef struct TTradeResultFrame2Output\n\n{\n\n double buy_value;\n\n double sell_value;\n\n TIdent broker_id;\n\n TIdent cust_id;\n\n INT32 tax_status;\n\n TIMESTAMP_STRUCT trade_dts;\n\n} *PTradeResultFrame2Output;\n\n\n\ntypedef struct TTradeResultFrame3Input\n\n{\n\n double buy_value;\n\n double sell_value;\n\n TIdent cust_id;\n\n TTrade trade_id;\n\n} *PTradeResultFrame3Input;\n\n\n\ntypedef struct TTradeResultFrame3Output\n\n{\n\n double tax_amount;\n\n} *PTradeResultFrame3Output;\n\n\n\ntypedef struct TTradeResultFrame4Input\n\n{\n\n TIdent cust_id;\n\n INT32 trade_qty;\n\n char symbol[cSYMBOL_len+1];\n\n char type_id[cTT_ID_len+1];\n\n} *PTradeResultFrame4Input;\n\n\n\ntypedef struct TTradeResultFrame4Output\n\n{\n\n double comm_rate;\n\n char s_name[cS_NAME_len+1];\n\n} *PTradeResultFrame4Output;\n\n\n\ntypedef struct TTradeResultFrame5Input\n\n{\n\n double comm_amount;\n\n double trade_price;\n\n TIdent broker_id;\n\n TTrade trade_id;\n\n TIMESTAMP_STRUCT trade_dts;\n\n char st_completed_id[cST_ID_len+1];\n\n} *PTradeResultFrame5Input;\n\n\n\ntypedef struct TTradeResultFrame6Input\n\n{\n\n double se_amount;\n\n TIdent acct_id;\n\n TTrade trade_id;\n\n INT32 trade_is_cash;\n\n INT32 trade_qty;\n\n TIMESTAMP_STRUCT due_date;\n\n TIMESTAMP_STRUCT trade_dts;\n\n char s_name[cS_NAME_len+1];\n\n char type_name[cTT_NAME_len+1];\n\n} *PTradeResultFrame6Input;\n\n\n\ntypedef struct TTradeResultFrame6Output\n\n{\n\n double acct_bal;\n\n} *PTradeResultFrame6Output;\n\n\n\n\n\n/*\n\n* Trade-Status\n\n*/\n\ntypedef struct TTradeStatusTxnInput\n\n{\n\n TIdent acct_id;\n\n} *PTradeStatusTxnInput,\n\n TTradeStatusFrame1Input, // Single-Frame transaction\n\n *PTradeStatusFrame1Input; // Single-Frame transaction\n\n\n\ntypedef struct TTradeStatusTxnOutput\n\n{\n\n TTrade trade_id[max_trade_status_len];\n\n INT32 status;\n\n char status_name[max_trade_status_len][cST_NAME_len+1];\n\n} *PTradeStatusTxnOutput;\n\n\n\ntypedef struct TTradeStatusFrame1Output\n\n{\n\n double charge[max_trade_status_len];\n\n TTrade trade_id[max_trade_status_len];\n\n INT32 trade_qty[max_trade_status_len];\n\n INT32 num_found;\n\n TIMESTAMP_STRUCT trade_dts[max_trade_status_len];\n\n char ex_name[max_trade_status_len][cEX_NAME_len+1];\n\n char exec_name[max_trade_status_len][cEXEC_NAME_len+1];\n\n char s_name[max_trade_status_len][cS_NAME_len+1];\n\n char status_name[max_trade_status_len][cST_NAME_len+1];\n\n char symbol[max_trade_status_len][cSYMBOL_len+1];\n\n char type_name[max_trade_status_len][cTT_NAME_len+1];\n\n char broker_name[cB_NAME_len+1];\n\n char cust_f_name[cF_NAME_len+1];\n\n char cust_l_name[cL_NAME_len+1];\n\n} *PTradeStatusFrame1Output;\n\n\n\n\n\n/*\n\n* Trade-Update\n\n*/\n\ntypedef struct TTradeUpdateTxnInput\n\n{\n\n TTrade trade_id[TradeUpdateFrame1MaxRows];\n\n TIdent acct_id;\n\n TIdent max_acct_id;\n\n INT32 frame_to_execute; // which of the frames to execute\n\n INT32 max_trades;\n\n INT32 max_updates;\n\n TIMESTAMP_STRUCT end_trade_dts;\n\n TIMESTAMP_STRUCT start_trade_dts;\n\n char symbol[cSYMBOL_len+1];\n\n} *PTradeUpdateTxnInput;\n\ntypedef struct TTradeUpdateTxnOutput\n\n{\n\n TTrade trade_list[TradeUpdateMaxRows];\n\n INT32 frame_executed; // confirmation of which frame was executed\n\n INT32 num_found;\n\n INT32 num_updated;\n\n INT32 status;\n\n bool is_cash[TradeUpdateMaxRows];\n\n bool is_market[TradeUpdateMaxRows];\n\n} *PTradeUpdateTxnOutput;\n\n\n\ntypedef struct TTradeUpdateFrame1Input\n\n{\n\n TTrade trade_id[TradeUpdateFrame1MaxRows];\n\n INT32 max_trades;\n\n INT32 max_updates;\n\n} *PTradeUpdateFrame1Input;\n\n\n\ntypedef struct TTradeUpdateFrame1TradeInfo\n\n{\n\n double bid_price;\n\n double cash_transaction_amount;\n\n double settlement_amount;\n\n double trade_price;\n\n bool is_cash;\n\n bool is_market;\n\n TIMESTAMP_STRUCT trade_history_dts[TradeUpdateMaxTradeHistoryRowsReturned];\n\n TIMESTAMP_STRUCT cash_transaction_dts;\n\n TIMESTAMP_STRUCT settlement_cash_due_date;\n\n char trade_history_status_id[TradeUpdateMaxTradeHistoryRowsReturned][cTH_ST_ID_len+1];\n\n char cash_transaction_name[cCT_NAME_len+1];\n\n char exec_name[cEXEC_NAME_len+1];\n\n char settlement_cash_type[cSE_CASH_TYPE_len+1];\n\n DB_INDICATOR trade_history_dts_ind[TradeUpdateMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR trade_history_status_id_ind[TradeUpdateMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR bid_price_ind;\n\n DB_INDICATOR cash_transaction_amount_ind;\n\n DB_INDICATOR cash_transaction_dts_ind;\n\n DB_INDICATOR cash_transaction_name_ind;\n\n DB_INDICATOR exec_name_ind;\n\n DB_INDICATOR is_cash_ind;\n\n DB_INDICATOR is_market_ind;\n\n DB_INDICATOR settlement_amount_ind;\n\n DB_INDICATOR settlement_cash_due_date_ind;\n\n DB_INDICATOR settlement_cash_type_ind;\n\n DB_INDICATOR trade_price_ind;\n\n} *PTradeUpdateFrame1TradeInfo;\n\n\n\ntypedef struct TTradeUpdateFrame1Output\n\n{\n\n INT32 num_found;\n\n INT32 num_updated;\n\n TTradeUpdateFrame1TradeInfo trade_info[TradeUpdateFrame1MaxRows];\n\n} *PTradeUpdateFrame1Output;\n\n\n\ntypedef struct TTradeUpdateFrame2Input\n\n{\n\n TIdent acct_id;\n\n INT32 max_trades;\n\n INT32 max_updates;\n\n TIMESTAMP_STRUCT end_trade_dts;\n\n TIMESTAMP_STRUCT start_trade_dts;\n\n} *PTradeUpdateFrame2Input;\n\n\n\ntypedef struct TTradeUpdateFrame2TradeInfo\n\n{\n\n double bid_price;\n\n double cash_transaction_amount;\n\n double settlement_amount;\n\n double trade_price;\n\n TTrade trade_id;\n\n bool is_cash;\n\n TIMESTAMP_STRUCT trade_history_dts[TradeUpdateMaxTradeHistoryRowsReturned];\n\n TIMESTAMP_STRUCT cash_transaction_dts;\n\n TIMESTAMP_STRUCT settlement_cash_due_date;\n\n char trade_history_status_id[TradeUpdateMaxTradeHistoryRowsReturned][cTH_ST_ID_len+1];\n\n char cash_transaction_name[cCT_NAME_len+1];\n\n char exec_name[cEXEC_NAME_len+1];\n\n char settlement_cash_type[cSE_CASH_TYPE_len+1];\n\n DB_INDICATOR trade_history_dts_ind[TradeUpdateMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR trade_history_status_id_ind[TradeUpdateMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR bid_price_ind;\n\n DB_INDICATOR cash_transaction_amount_ind;\n\n DB_INDICATOR cash_transaction_dts_ind;\n\n DB_INDICATOR cash_transaction_name_ind;\n\n DB_INDICATOR exec_name_ind;\n\n DB_INDICATOR is_cash_ind;\n\n DB_INDICATOR settlement_amount_ind;\n\n DB_INDICATOR settlement_cash_due_date_ind;\n\n DB_INDICATOR settlement_cash_type_ind;\n\n DB_INDICATOR trade_id_ind;\n\n DB_INDICATOR trade_price_ind;\n\n} *PTradeUpdateFrame2TradeInfo;\n\n\n\ntypedef struct TTradeUpdateFrame2Output\n\n{\n\n INT32 num_found;\n\n INT32 num_updated;\n\n TTradeUpdateFrame2TradeInfo trade_info[TradeUpdateFrame2MaxRows];\n\n} *PTradeUpdateFrame2Output;\n\n\n\ntypedef struct TTradeUpdateFrame3Input\n\n{\n\n TIdent max_acct_id;\n\n INT32 max_trades;\n\n INT32 max_updates;\n\n TIMESTAMP_STRUCT end_trade_dts;\n\n TIMESTAMP_STRUCT start_trade_dts;\n\n char symbol[cSYMBOL_len+1];\n\n} *PTradeUpdateFrame3Input;\n\n\n\ntypedef struct TTradeUpdateFrame3TradeInfo\n\n{\n\n double cash_transaction_amount;\n\n double price;\n\n double settlement_amount;\n\n TIdent acct_id;\n\n TTrade trade_id;\n\n INT32 quantity;\n\n bool is_cash;\n\n TIMESTAMP_STRUCT trade_history_dts[TradeUpdateMaxTradeHistoryRowsReturned];\n\n TIMESTAMP_STRUCT cash_transaction_dts;\n\n TIMESTAMP_STRUCT settlement_cash_due_date;\n\n TIMESTAMP_STRUCT trade_dts;\n\n char trade_history_status_id[TradeUpdateMaxTradeHistoryRowsReturned][cTH_ST_ID_len+1];\n\n char cash_transaction_name[cCT_NAME_len+1];\n\n char exec_name[cEXEC_NAME_len+1];\n\n char s_name[cS_NAME_len+1];\n\n char settlement_cash_type[cSE_CASH_TYPE_len+1];\n\n char trade_type[cTT_ID_len+1];\n\n char type_name[cTT_NAME_len+1];\n\n DB_INDICATOR trade_history_dts_ind[TradeUpdateMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR trade_history_status_id_ind[TradeUpdateMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR acct_id_ind;\n\n DB_INDICATOR cash_transaction_amount_ind;\n\n DB_INDICATOR cash_transaction_dts_ind;\n\n DB_INDICATOR cash_transaction_name_ind;\n\n DB_INDICATOR exec_name_ind;\n\n DB_INDICATOR is_cash_ind;\n\n DB_INDICATOR price_ind;\n\n DB_INDICATOR quantity_ind;\n\n DB_INDICATOR s_name_ind;\n\n DB_INDICATOR settlement_amount_ind;\n\n DB_INDICATOR settlement_cash_due_date_ind;\n\n DB_INDICATOR settlement_cash_type_ind;\n\n DB_INDICATOR trade_dts_ind;\n\n DB_INDICATOR trade_id_ind;\n\n DB_INDICATOR trade_type_ind;\n\n DB_INDICATOR type_name_ind;\n\n} *PTradeUpdateFrame3TradeInfo;\n\n\n\ntypedef struct TTradeUpdateFrame3Output\n\n{\n\n INT32 num_found;\n\n INT32 num_updated;\n\n TTradeUpdateFrame3TradeInfo trade_info[TradeUpdateFrame3MaxRows];\n\n} *PTradeUpdateFrame3Output;\n\n\n\n/*\n\n* Trade-Cleanup\n\n*/\n\ntypedef struct TTradeCleanupTxnInput\n\n{\n\n TTrade start_trade_id;\n\n char st_canceled_id[cST_ID_len+1];\n\n char st_pending_id[cST_ID_len+1];\n\n char st_submitted_id[cST_ID_len+1];\n\n} *PTradeCleanupTxnInput,\n\n TTradeCleanupFrame1Input, // Single-Frame transaction\n\n *PTradeCleanupFrame1Input; // Single-Frame transaction\n\n\n\ntypedef struct TTradeCleanupTxnOutput\n\n{\n\n INT32 status;\n\n} *PTradeCleanupTxnOutput;\n\n\n", "file_path": "egen/inc/TxnHarnessStructs.h", "rank": 25, "score": 96541.24679187525 }, { "content": "namespace TPCE\n\n{\n\n\n\n// Converts a string to a 64 bit integer, supports the suffixes\n\n// KMG for powers of 1000 multipliers\n\nextern INT64 strtoint64 (const char *ptr);\n\n\n\n// Converts a string to a double, supports the suffixes\n\n// KMG for powers of 1000 multipliers\n\nextern double strtodbl (const char *ptr);\n\n\n\n// Converts a string in HH:MM:SS to a 64 bit integral number of seconds\n\n// HH or HH:MM are optional. Seconds over 60 may be specified.\n\n// (i.e. 1:00:00 and 3600 are equivalent)\n\nextern INT64 timestrtoint64 (const char *ptr);\n\n\n\n// Converts an integral number of seconds to the string HH:MM:SS\n\n// HH or HH:MM may be omitted if the time value is small enough\n\nextern std::string int64totimestr (INT64 val);\n", "file_path": "egen/TestHarness/Reference/inc/strutil.h", "rank": 26, "score": 95252.84156527785 }, { "content": "namespace TPCE\n\n{\n\n\n\n\n\n// Used to help define \"infinitely far into the future\"\n\nconst INT32 MaxWheelCycles = 999999999;\n\n\n\ntypedef struct TWheelConfig\n\n{\n\n INT32 WheelSize; // Total size of the wheel (based on the period and resolution)\n\n INT32 WheelResolution; // Expressed in milliseconds\n\n\n\n TWheelConfig( INT32 Size, INT32 Resolution )\n\n : WheelSize( Size )\n\n , WheelResolution( Resolution )\n\n {\n\n };\n\n} *PWheelConfig;\n\n\n\n\n", "file_path": "egen/TestHarness/Reference/inc/Wheel.h", "rank": 27, "score": 95252.84156527785 }, { "content": "namespace TPCE\n\n{\n\nconst int cWORD_len = 30; // for NEWS input file\n\n\n\n//TaxableAccountName.txt and NonTaxableAccountName.txt\n\ntypedef struct TAccountNameInputRow : public TBaseInputRow\n\n{\n\n char NAME[ cCA_NAME_len+1 ];\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PAccountNameInputRow;\n\n\n\n//AreaCodes.txt\n\ntypedef struct TAreaCodeInputRow : public TBaseInputRow\n\n{\n\n //Phone number area\n\n char AREA_CODE[ cAREA_len+1 ];\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PAreaCodeInputRow;\n\n\n\n//Company.txt\n\ntypedef struct TCompanyInputRow : public TBaseInputRow\n\n{\n\n TIdent CO_ID;\n\n char CO_ST_ID[ cST_ID_len+1 ];\n\n char CO_NAME[ cCO_NAME_len+1 ];\n\n char CO_IN_ID[ cIN_ID_len+1 ];\n\n char CO_DESC[ cCO_DESC_len+1 ];\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n", "file_path": "egen/inc/InputFlatFilesDeclarations.h", "rank": 28, "score": 95252.84156527785 }, { "content": "namespace TPCE\n\n{\n\n\n\nenum eMEETradeRequestAction\n\n{\n\n eMEEProcessOrder = 0,\n\n eMEESetLimitOrderTrigger\n\n};\n\n\n", "file_path": "egen/inc/MEETradeRequestActions.h", "rank": 29, "score": 95252.84156527785 }, { "content": "namespace TPCE\n\n{\n\n\n\ntemplate <typename T, typename TKeyAndElementsLimits> class CFlatFile\n\n{\n\nprotected:\n\n //Type of in-memory representation of input files\n\n typedef CFixedArray<T, TKeyAndElementsLimits> CFileInMemoryList; //array of arrays\n\n\n\n CFileInMemoryList m_list;\n\n\n\n void ReadList(const char *szListFile)\n\n {\n\n ifstream tmpFile;\n\n\n\n if (szListFile)\n\n {\n\n tmpFile.open(szListFile, ios_base::in);\n\n if (tmpFile)\n\n {\n\n ReadList(tmpFile);\n\n tmpFile.close();\n\n }\n\n else\n\n { //Open failed\n\n tmpFile.close();\n\n throw CSystemErr(CSystemErr::eCreateFile, \"CFlatFile::ReadList\");\n\n }\n\n }\n\n else\n\n {\n\n throw CSystemErr(CSystemErr::eCreateFile, \"CFlatFile::ReadList\");\n\n }\n\n }\n\n\n\n void ReadList(const string &str)\n\n {\n\n istringstream tmpFile(str);\n\n ReadList(tmpFile);\n\n }\n\n\n\n void ReadList(istream &tmpFile)\n\n {\n\n T row;\n\n memset(&row, 0, sizeof(row));\n\n\n\n while(tmpFile.good())\n\n {\n\n row.Load(tmpFile); //read the row\n\n // We don't know if we've hit the end of the file\n\n // until after trying the read.\n\n if( ! tmpFile.eof() )\n\n {\n\n m_list.Add(&row); //insert into the container\n\n }\n\n\n\n }\n\n }\n\n\n\n\n\npublic:\n\n\n\n //Constructor.\n\n CFlatFile(const char *szListFile)\n\n {\n\n ReadList(szListFile);\n\n }\n\n\n\n CFlatFile(const string &str)\n\n {\n\n ReadList(str);\n\n }\n\n virtual ~CFlatFile() {}\n\n\n\n //Returns the element at a specific index\n\n T* GetRecord(int index) { return &m_list[index]; };\n\n\n\n //Returns the size of the file (number of rows)\n\n UINT GetSize() {return (UINT)m_list.size();}\n", "file_path": "egen/TestHarness/Reference/inc/FlatFile.h", "rank": 30, "score": 94029.83898962277 }, { "content": "namespace TPCE\n\n{\n\n\n\nenum eDriverType\n\n{\n\n eDriverEGenLoader,\n\n eDriverAll,\n\n eDriverCE,\n\n eDriverMEE,\n\n eDriverDM,\n\n eDriverMax\n\n};\n\n\n\nextern char szDriverTypeNames[eDriverMax][14];\n", "file_path": "egen/TestHarness/Reference/inc/DriverTypes.h", "rank": 31, "score": 94029.83898962277 }, { "content": "namespace TPCE\n\n{\n\n\n\ntemplate <typename T, typename TKeyAndElementsLimits> class CInputFile\n\n{\n\n //Type of in-memory representation of input files\n\n typedef CFixedMap<T, TKeyAndElementsLimits> CFileInMemoryList; //(key, data) pairs container\n\n\n\n CFileInMemoryList m_list;\n\n\n\n void ReadList(const char *szListFile)\n\n {\n\n ifstream tmpFile;\n\n\n\n if (szListFile)\n\n {\n\n tmpFile.open(szListFile, ios_base::in);\n\n if (tmpFile)\n\n {\n\n ReadList(tmpFile);\n\n tmpFile.close();\n\n }\n\n else\n\n { //Open failed\n\n tmpFile.close();\n\n throw CSystemErr(CSystemErr::eCreateFile, \"CInputFile::ReadList\");\n\n }\n\n }\n\n else\n\n {\n\n throw CSystemErr(CSystemErr::eCreateFile, \"CInputFile::ReadList\");\n\n }\n\n }\n\n\n\n void ReadList(const string &str)\n\n {\n\n istringstream tmpFile(str);\n\n ReadList(tmpFile);\n\n }\n\n\n\n void ReadList(istream &tmpFile) {\n\n T row;\n\n memset(&row, 0, sizeof(row));\n\n int iThreshold = 0, iWeight;\n\n while(tmpFile.good())\n\n {\n\n tmpFile>>iWeight; //first the weight\n\n // We don't know if we've hit the end of the file\n\n // until after trying the first read.\n\n if( ! tmpFile.eof() )\n\n {\n\n row.Load(tmpFile); //then the rest of the row\n\n iThreshold += iWeight; //used as the key\n\n m_list.Add(iThreshold-1/*because weights start from 1*/, &row, iWeight);//add to the container\n\n }\n\n }\n\n }\n\n\n\npublic:\n\n\n\n //Constructor.\n\n\n\n //iTotalDataElements is the number of data elements in the file.\n\n //Right now it's the same as the number of lines since\n\n //there is only one entry per line.\n\n CInputFile(const char *szListFile)\n\n {\n\n ReadList(szListFile);\n\n }\n\n\n\n CInputFile(const string &str)\n\n {\n\n ReadList(str);\n\n }\n\n\n\n //return the whole record for a given key\n\n //returns the second member of the element pair\n\n T* GetRecord(int key) { return m_list.GetElement(key); }\n\n\n\n //Get the next unique record in the set.\n\n T* GetRecordByPassKey( int iElementID )\n\n {\n\n return( m_list.GetElementByPassKey( iElementID ));\n\n }\n\n\n\n // Return current record count\n\n int RecordCount( )\n\n {\n\n return m_list.ElementCount();\n\n }\n\n\n\n //return the highest key number that exists in the list\n\n int GetGreatestKey() { return m_list.GetHighestKey(); }\n\n};\n\n\n", "file_path": "egen/TestHarness/Reference/inc/InputFile.h", "rank": 32, "score": 94029.83898962277 }, { "content": "namespace TPCE\n\n{\n\n\n\n//Base abstract structure for an input file row\n\n//Must be able to read itself from a file.\n\ntypedef struct TBaseInputRow\n\n{\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n virtual ~TBaseInputRow() {}\n\n} *PBaseInputRow;\n\n\n\n\n\n//For nullable columns\n\nenum OLTPNullValueIndicator {\n\n OLTP_VALUE_IS_NULL =0,\n\n OLTP_VALUE_IS_NOT_NULL\n\n};\n\n\n\ntypedef struct OLTPNullableFloat\n\n{\n\n OLTPNullValueIndicator iIndicator;\n\n float value;\n\n} *POLTPNullableFloat;\n\n\n\ntypedef struct OLTPNullableDateTime\n\n{\n\n OLTPNullValueIndicator iIndicator;\n\n CDateTime value;\n\n} *POLTPNullableDateTime;\n\n\n\ntypedef struct OLTPNullable52WkHighLow\n\n{\n\n OLTPNullValueIndicator iIndicator;\n\n float HIGH;\n\n CDateTime HIGH_DATE;\n\n float LOW;\n\n CDateTime LOW_DATE;\n\n} *POLTPNullable52WkHighLow;\n\n\n\n// ACCOUNT_PERMISSION table\n\ntypedef struct ACCOUNT_PERMISSION_ROW\n\n{\n\n TIdent AP_CA_ID;\n\n char AP_ACL[ cACL_len+1 ]; //binary column in the table\n\n char AP_TAX_ID[ cTAX_ID_len+1 ];\n\n char AP_L_NAME[ cL_NAME_len+1 ];\n\n char AP_F_NAME[ cF_NAME_len+1 ];\n\n} *PACCOUNT_PERMISSION_ROW;\n\nconst char AccountPermissionRowFmt[] = \"%\" PRId64 \"|%s|%s|%s|%s\\n\";\n\n\n\n// ADDRESS table\n\ntypedef struct ADDRESS_ROW\n\n{\n\n TIdent AD_ID;\n\n char AD_LINE1[ cAD_LINE_len+1];\n\n char AD_LINE2[ cAD_LINE_len+1];\n\n char AD_ZC_CODE[ cAD_ZIP_len+1 ];\n\n char AD_CTRY[ cAD_CTRY_len+1 ];\n\n} *PADDRESS_ROW;\n\nconst char AddressRowFmt[] = \"%\" PRId64 \"|%s|%s|%s|%s\\n\";\n\n\n\n// BROKER table\n\ntypedef struct BROKER_ROW\n\n{\n\n TIdent B_ID;\n\n char B_ST_ID[ cST_ID_len+1 ];\n\n char B_NAME[ cB_NAME_len+1 ];\n\n int B_NUM_TRADES;\n\n double B_COMM_TOTAL;\n\n} *PBROKER_ROW;\n\nconst char BrokerRowFmt[] = \"%\" PRId64 \"|%s|%s|%d|%.2f\\n\";\n\n\n\n// CASH_TRANSACTION table\n\ntypedef struct CASH_TRANSACTION_ROW\n\n{\n\n TTrade CT_T_ID;\n\n CDateTime CT_DTS;\n\n double CT_AMT;\n\n char CT_NAME[cCT_NAME_len+1];\n\n} *PCASH_TRANSACTION_ROW;\n\nconst char CashTransactionRowFmt[] = \"%\" PRId64 \"|%s|%.2f|%s\\n\";\n\n\n\n// CHARGE table\n\ntypedef struct CHARGE_ROW : TBaseInputRow\n\n{\n\n char CH_TT_ID[cTT_ID_len+1];\n\n int CH_C_TIER;\n\n double CH_CHRG;\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PCHARGE_ROW;\n\nconst char ChargeRowFmt[] = \"%s|%d|%.2f\\n\";\n\n\n\n// COMMISSION_RATE table\n\ntypedef struct COMMISSION_RATE_ROW : TBaseInputRow\n\n{\n\n int CR_C_TIER;\n\n char CR_TT_ID[cTT_ID_len+1];\n\n char CR_EX_ID[cEX_ID_len+1];\n\n double CR_FROM_QTY;\n\n double CR_TO_QTY;\n\n double CR_RATE;\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PCOMMISSION_RATE_ROW;\n\nconst char CommissionRateRowFmt[] = \"%d|%s|%s|%.0f|%.0f|%.2f\\n\";\n\n\n\n// COMPANY table\n\ntypedef struct COMPANY_ROW\n\n{\n\n TIdent CO_ID;\n\n char CO_ST_ID[ cST_ID_len+1 ];\n\n char CO_NAME[ cCO_NAME_len+1 ];\n\n char CO_IN_ID[ cIN_ID_len+1 ];\n\n char CO_SP_RATE[ cSP_RATE_len+1 ];\n\n char CO_CEO[ cCEO_NAME_len+1 ];\n\n TIdent CO_AD_ID;\n\n char CO_DESC[ cCO_DESC_len+1 ];\n\n CDateTime CO_OPEN_DATE;\n\n} *PCOMPANY_ROW;\n\nconst char CompanyRowFmt[] = \"%\" PRId64 \"|%s|%s|%s|%s|%s|%\" PRId64 \"|%s|%s\\n\";\n\n\n\n// COMPANY_COMPETITOR table\n\ntypedef struct COMPANY_COMPETITOR_ROW : TBaseInputRow\n\n{\n\n TIdent CP_CO_ID;\n\n TIdent CP_COMP_CO_ID;\n\n char CP_IN_ID[cIN_ID_len+1];\n\n} *PCOMPANY_COMPETITOR_ROW;\n\nconst char CompanyCompetitorRowFmt[] = \"%\" PRId64 \"|%\" PRId64 \"|%s\\n\";\n\n\n\n// CUSTOMER table\n\ntypedef struct CUSTOMER_ROW\n\n{\n\n TIdent C_ID;\n\n char C_TAX_ID[ cTAX_ID_len+1 ];\n\n char C_ST_ID[ cST_ID_len+1 ];\n\n char C_L_NAME[ cL_NAME_len+1 ];\n\n char C_F_NAME[ cF_NAME_len+1 ];\n\n char C_M_NAME[ cM_NAME_len+1 ];\n\n char C_GNDR;\n\n char C_TIER;\n\n CDateTime C_DOB;\n\n TIdent C_AD_ID;\n\n char C_CTRY_1[ cCTRY_len+1 ];\n\n char C_AREA_1[ cAREA_len+1 ];\n\n char C_LOCAL_1[ cLOCAL_len+1 ];\n\n char C_EXT_1[ cEXT_len+1 ];\n\n char C_CTRY_2[ cCTRY_len+1 ];\n\n char C_AREA_2[ cAREA_len+1 ];\n\n char C_LOCAL_2[ cLOCAL_len+1 ];\n\n char C_EXT_2[ cEXT_len+1 ];\n\n char C_CTRY_3[ cCTRY_len+1 ];\n\n char C_AREA_3[ cAREA_len+1 ];\n\n char C_LOCAL_3[ cLOCAL_len+1 ];\n\n char C_EXT_3[ cEXT_len+1 ];\n\n char C_EMAIL_1[ cEMAIL_len+1 ];\n\n char C_EMAIL_2[ cEMAIL_len+1 ];\n\n\n\n CUSTOMER_ROW()\n\n : C_ID(0)\n\n {};\n\n\n\n} *PCUSTOMER_ROW;\n\nconst char CustomerRowFmt[] = \"%\" PRId64 \"|%s|%s|%s|%s|%s|%c|%d|%s|%\" PRId64 \"|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s\\n\";\n\n\n\n// CUSTOMER_ACCOUNT table\n\ntypedef struct CUSTOMER_ACCOUNT_ROW\n\n{\n\n TIdent CA_ID;\n\n TIdent CA_B_ID;\n\n TIdent CA_C_ID;\n\n char CA_NAME[ cCA_NAME_len+1 ];\n\n char CA_TAX_ST;\n\n double CA_BAL;\n\n} *PCUSTOMER_ACCOUNT_ROW;\n\nconst char CustomerAccountRowFmt[] = \"%\" PRId64 \"|%\" PRId64 \"|%\" PRId64 \"|%s|%d|%.2f\\n\";\n\n\n\n// CUSTOMER_TAXRATE table\n\ntypedef struct CUSTOMER_TAXRATE_ROW\n\n{\n\n char CX_TX_ID[ cTX_ID_len+1 ];\n\n TIdent CX_C_ID;\n\n} *PCUSTOMER_TAXRATE_ROW;\n\nconst char CustomerTaxrateRowFmt[] = \"%s|%\" PRId64 \"\\n\";\n\n\n\n// DAILY_MARKET table\n\ntypedef struct DAILY_MARKET_ROW\n\n{\n\n CDateTime DM_DATE;\n\n char DM_S_SYMB[cSYMBOL_len+1];\n\n double DM_CLOSE;\n\n double DM_HIGH;\n\n double DM_LOW;\n\n int DM_VOL;\n\n} *PDAILY_MARKET_ROW;\n\nconst char DailyMarketRowFmt[] = \"%s|%s|%.2f|%.2f|%.2f|%d\\n\";\n\n\n\n// EXCHANGE table\n\ntypedef struct EXCHANGE_ROW\n\n{\n\n char EX_ID[ cEX_ID_len+1 ];\n\n char EX_NAME[ cEX_NAME_len+1 ];\n\n int EX_NUM_SYMB;\n\n int EX_OPEN;\n\n int EX_CLOSE;\n\n char EX_DESC[ cEX_DESC_len+1 ];\n\n TIdent EX_AD_ID;\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PEXCHANGE_ROW;\n\nconst char ExchangeRowFmt[] = \"%s|%s|%d|%d|%d|%s|%\" PRId64 \"\\n\";\n\n\n\n// FINANCIAL table\n\ntypedef struct FINANCIAL_ROW\n\n{\n\n TIdent FI_CO_ID;\n\n int FI_YEAR;\n\n int FI_QTR;\n\n CDateTime FI_QTR_START_DATE;\n\n double FI_REVENUE;\n\n double FI_NET_EARN;\n\n double FI_BASIC_EPS;\n\n double FI_DILUT_EPS;\n\n double FI_MARGIN;\n\n double FI_INVENTORY;\n\n double FI_ASSETS;\n\n double FI_LIABILITY;\n\n double FI_OUT_BASIC;\n\n double FI_OUT_DILUT;\n\n} *PFINANCIAL_ROW;\n\nconst char FinancialRowFmt[] = \"%\" PRId64 \"|%d|%d|%s|%.2f|%.2f|%.2f|%.2f|%.2f|%.2f|%.2f|%.2f|%.0f|%.0f\\n\";\n\n\n\n// HOLDING table\n\ntypedef struct HOLDING_ROW\n\n{\n\n TTrade H_T_ID;\n\n TIdent H_CA_ID;\n\n char H_S_SYMB[ cSYMBOL_len+1 ];\n\n CDateTime H_DTS;\n\n double H_PRICE;\n\n int H_QTY;\n\n} *PHOLDING_ROW;\n\nconst char HoldingRowFmt[] = \"%\" PRId64 \"|%\" PRId64 \"|%s|%s|%.2f|%d\\n\";\n\n\n\n// HOLDING_HISTORY table\n\ntypedef struct HOLDING_HISTORY_ROW\n\n{\n\n TTrade HH_H_T_ID;\n\n TTrade HH_T_ID;\n\n int HH_BEFORE_QTY;\n\n int HH_AFTER_QTY;\n\n} *PHOLDING_HISTORY_ROW;\n\nconst char HoldingHistoryRowFmt[] = \"%\" PRId64 \"|%\" PRId64 \"|%d|%d\\n\";\n\n\n\n// HOLDING_SUMMARY table\n\ntypedef struct HOLDING_SUMMARY_ROW\n\n{\n\n TIdent HS_CA_ID;\n\n char HS_S_SYMB[ cSYMBOL_len+1 ];\n\n int HS_QTY;\n\n} *PHOLDING_SUMMARY_ROW;\n\nconst char HoldingSummaryRowFmt[] = \"%\" PRId64 \"|%s|%d\\n\";\n\n\n\n// INDUSTRY table\n\ntypedef struct INDUSTRY_ROW : TBaseInputRow\n\n{\n\n char IN_ID[cIN_ID_len+1];\n\n char IN_NAME[cIN_NAME_len+1];\n\n char IN_SC_ID[cSC_ID_len+1];\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PINDUSTRY_ROW;\n\nconst char IndustryRowFmt[] = \"%s|%s|%s\\n\";\n\n\n\n// LAST_TRADE table\n\ntypedef struct LAST_TRADE_ROW\n\n{\n\n char LT_S_SYMB[cSYMBOL_len+1];\n\n CDateTime LT_DTS;\n\n double LT_PRICE;\n\n double LT_OPEN_PRICE;\n\n int LT_VOL;\n\n} *PLAST_TRADE_ROW;\n\nconst char LastTradeRowFmt[] = \"%s|%s|%.2f|%.2f|%d\\n\";\n\n\n\n// NEWS_ITEM table\n\ntypedef struct NEWS_ITEM_ROW\n\n{\n\n TIdent NI_ID;\n\n char NI_HEADLINE[cNI_HEADLINE_len+1];\n\n char NI_SUMMARY[cNI_SUMMARY_len+1];\n\n char NI_ITEM[cNI_ITEM_len+1];\n\n CDateTime NI_DTS;\n\n char NI_SOURCE[cNI_SOURCE_len+1];\n\n char NI_AUTHOR[cNI_AUTHOR_len+1];\n\n} *PNEWS_ITEM_ROW;\n\nconst char NewsItemRowFmt[] = \"%\" PRId64 \"|%s|%s|%s|%s|%s|%s\\n\";\n\n\n\n// NEWS_XREF table\n\ntypedef struct NEWS_XREF_ROW\n\n{\n\n TIdent NX_NI_ID;\n\n TIdent NX_CO_ID;\n\n} *PNEWS_XREF_ROW;\n\nconst char NewsXRefRowFmt[] = \"%\" PRId64 \"|%\" PRId64 \"\\n\";\n\n\n\n// SECTOR table\n\ntypedef struct SECTOR_ROW : TBaseInputRow\n\n{\n\n char SC_ID[cSC_ID_len+1];\n\n char SC_NAME[cSC_NAME_len+1];\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PSECTOR_ROW;\n\nconst char SectorRowFmt[] = \"%s|%s\\n\";\n\n\n\n// SECURITY table\n\ntypedef struct SECURITY_ROW\n\n{\n\n char S_SYMB[ cSYMBOL_len+1 ];\n\n char S_ISSUE[ cS_ISSUE_len+1 ];\n\n char S_ST_ID[ cST_ID_len+1 ];\n\n char S_NAME[ cS_NAME_len+1 ];\n\n char S_EX_ID[ cEX_ID_len+1 ];\n\n TIdent S_CO_ID;\n\n double S_NUM_OUT;\n\n CDateTime S_START_DATE;\n\n CDateTime S_EXCH_DATE;\n\n double S_PE;\n\n OLTPNullable52WkHighLow S_52WK; // S_52WK_HIGH, S_52WK_HIGH_DATE, S_52WK_LOW and S_52WK_LOW_DATE\n\n double S_DIVIDEND;\n\n double S_YIELD;\n\n} *PSECURITY_ROW;\n\nconst char SecurityRowFmt_1[] = \"%s|%s|%s|%s|%s|%\" PRId64 \"|%.0f|%s|%s|%.2f|\";\n\nconst char SecurityRowFmt_2[] = \"%.2f|%s|%.2f|%s|\"; // Used for (S_52WK_HIGH, S_52WK_HIGH_DATE) and (S_52WK_LOW, S_52WK_LOW_DATE) when not null.\n\nconst char SecurityRowFmt_3[] = \"%.2f|%.2f\\n\";\n\n\n\n// SETTLEMENT table\n\ntypedef struct SETTLEMENT_ROW\n\n{\n\n TTrade SE_T_ID;\n\n char SE_CASH_TYPE[cSE_CASH_TYPE_len+1];\n\n CDateTime SE_CASH_DUE_DATE;\n\n double SE_AMT;\n\n} *PSETTLEMENT_ROW;\n\nconst char SettlementRowFmt[] = \"%\" PRId64 \"|%s|%s|%.2f\\n\";\n\n\n\n// STATUS_TYPE table\n\ntypedef struct STATUS_TYPE_ROW : TBaseInputRow\n\n{\n\n char ST_ID[cST_ID_len+1];\n\n char ST_NAME[cST_NAME_len+1];\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PSTATUS_TYPE_ROW;\n\nconst char StatusTypeRowFmt[] = \"%s|%s\\n\";\n\n\n\n// TAXRATE table\n\ntypedef struct TAXRATE_ROW\n\n{\n\n char TX_ID[ cTX_ID_len+1 ];\n\n char TX_NAME[ cTX_NAME_len+1 ];\n\n double TX_RATE;\n\n} *PTAXRATE_ROW;\n\nconst char TaxrateRowFmt[] = \"%s|%s|%.5f\\n\";\n\n\n\n// TRADE table\n\ntypedef struct TRADE_ROW\n\n{\n\n TTrade T_ID;\n\n CDateTime T_DTS;\n\n char T_ST_ID[ cST_ID_len+1 ];\n\n char T_TT_ID[ cTT_ID_len+1 ];\n\n int T_IS_CASH;\n\n char T_S_SYMB[ cSYMBOL_len+1 ];\n\n int T_QTY;\n\n double T_BID_PRICE;\n\n TIdent T_CA_ID;\n\n char T_EXEC_NAME[ cEXEC_NAME_len+1 ];\n\n double T_TRADE_PRICE;\n\n double T_CHRG;\n\n double T_COMM;\n\n double T_TAX;\n\n int T_LIFO;\n\n} *PTRADE_ROW;\n\nconst char TradeRowFmt[] = \"%\" PRId64 \"|%s|%s|%s|%d|%s|%d|%.2f|%\" PRId64 \"|%s|%.2f|%.2f|%.2f|%.2f|%d\\n\";\n\n\n\n// TRADE_HISTORY table\n\ntypedef struct TRADE_HISTORY_ROW\n\n{\n\n TTrade TH_T_ID;\n\n CDateTime TH_DTS;\n\n char TH_ST_ID[cST_ID_len+1];\n\n} *PTRADE_HISTORY_ROW;\n\nconst char TradeHistoryRowFmt[] = \"%\" PRId64 \"|%s|%s\\n\";\n\n\n\n// TRADE_REQUEST table\n\ntypedef struct TRADE_REQUEST_ROW\n\n{\n\n TTrade TR_T_ID;\n\n char TR_TT_ID[ cTT_ID_len+1 ];\n\n char TR_S_SYMB[ cSYMBOL_len+1 ];\n\n int TR_QTY;\n\n double TR_BID_PRICE;\n\n TIdent TR_B_ID;\n\n} *PTRADE_REQUEST_ROW;\n\nconst char TradeRequestRowFmt[] = \"%\" PRId64 \"|%s|%s|%d|%.2f|%\" PRId64 \"\\n\";\n\n\n\n// TRADE_TYPE table\n\ntypedef struct TRADE_TYPE_ROW\n\n{\n\n char TT_ID[ cTT_ID_len+1 ];\n\n char TT_NAME[ cTT_NAME_len+1 ];\n\n int TT_IS_SELL;\n\n int TT_IS_MRKT;\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PTRADE_TYPE_ROW;\n\nconst char TradeTypeRowFmt[] = \"%s|%s|%d|%d\\n\";\n\n\n\n// WATCH_ITEM table\n\ntypedef struct WATCH_ITEM_ROW\n\n{\n\n TIdent WI_WL_ID;\n\n char WI_S_SYMB[ cSYMBOL_len+1 ];\n\n} *PWATCH_ITEM_ROW;\n\nconst char WatchItemRowFmt[] = \"%\" PRId64 \"|%s\\n\";\n\n\n\n// WATCH_LIST table\n\ntypedef struct WATCH_LIST_ROW\n\n{\n\n TIdent WL_ID;\n\n TIdent WL_C_ID;\n\n} *PWATCH_LIST_ROW;\n\nconst char WatchListRowFmt[] = \"%\" PRId64 \"|%\" PRId64 \"\\n\";\n\n\n\n// ZIP_CODE table\n\ntypedef struct ZIP_CODE_ROW : public TBaseInputRow\n\n{\n\n char ZC_CODE[cZC_CODE_len+1];\n\n char ZC_TOWN[cZC_TOWN_len+1];\n\n char ZC_DIV[cZC_DIV_len+1];\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PZIP_CODE_ROW;\n\nconst char ZipCodeRowFmt[] = \"%s|%s|%s\\n\";\n\n\n", "file_path": "egen/TestHarness/Reference/inc/Table_Defs.h", "rank": 33, "score": 94029.83898962277 }, { "content": "namespace TPCE\n\n{\n\n // Default seed used for all tables.\n\n const RNGSEED RNGSeedTableDefault = 37039940;\n\n\n\n // This value is added to the AD_ID when seeding the RNG for\n\n // generating a threshold into the TownDivisionZipCode list.\n\n const RNGSEED RNGSeedBaseTownDivZip = 26778071;\n\n\n\n // This is the base seed used when generating C_TIER.\n\n const RNGSEED RNGSeedBaseC_TIER = 16225173;\n\n\n\n // Base seeds used for generating C_AREA_1, C_AREA_2, C_AREA_3\n\n const RNGSEED RNGSeedBaseC_AREA_1 = 97905013;\n\n const RNGSEED RNGSeedBaseC_AREA_2 = 68856487;\n\n const RNGSEED RNGSeedBaseC_AREA_3 = 67142295;\n\n\n\n // Base seed used when generating names.\n\n const RNGSEED RNGSeedBaseFirstName = 95066470;\n\n const RNGSEED RNGSeedBaseMiddleInitial = 71434514;\n\n const RNGSEED RNGSeedBaseLastName = 35846049;\n\n\n\n // Base seed used when generating gender.\n\n const RNGSEED RNGSeedBaseGender = 9568922;\n\n\n\n // Base seed used when generating tax ID\n\n const RNGSEED RNGSeedBaseTaxID = 8731255;\n\n\n\n // Base seed used when generating the number of accounts for a customer\n\n //const RNGSEED RNGSeedBaseNumberOfAccounts = 37486207;\n\n\n\n // Base seed used when generating the number of permissions on an account\n\n const RNGSEED RNGSeedBaseNumberOfAccountPermissions = 27794203;\n\n\n\n // Base seeds used when generating CIDs for additional account permissions\n\n const RNGSEED RNGSeedBaseCIDForPermission1 = 76103629;\n\n const RNGSEED RNGSeedBaseCIDForPermission2 = 103275149;\n\n\n\n // Base seed used when generating acount tax status\n\n const RNGSEED RNGSeedBaseAccountTaxStatus = 34376701;\n\n\n\n // Base seed for determining account broker id\n\n const RNGSEED RNGSeedBaseBrokerId = 75607774;\n\n\n\n // Base seed used when generating tax rate row\n\n const RNGSEED RNGSeedBaseTaxRateRow = 92740731;\n\n\n\n // Base seed used when generating the number of holdings for an account\n\n const RNGSEED RNGSeedBaseNumberOfSecurities = 23361736;\n\n\n\n // Base seed used when generating the starting security ID for the\n\n // set of securities associated with a particular account.\n\n const RNGSEED RNGSeedBaseStartingSecurityID = 12020070;\n\n\n\n // Base seed used when generating a company's SP Rate\n\n const RNGSEED RNGSeedBaseSPRate = 56593330;\n\n\n\n // Base seed for initial trade generation class\n\n const RNGSEED RNGSeedTradeGen = 32900134;\n\n\n\n // Base seed for the MEESecurity class\n\n const RNGSEED RNGSeedBaseMEESecurity = 75791232;\n\n\n\n // Base seed for non-uniform customer selection\n\n const RNGSEED RNGSeedCustomerSelection = 9270899;\n\n\n\n // Base seed for MEE Ticker Tape\n\n const RNGSEED RNGSeedBaseMEETickerTape = 42065035;\n\n\n\n // Base seed for MEE Trading Floor\n\n const RNGSEED RNGSeedBaseMEETradingFloor = 25730774;\n\n\n\n // Base seed for TxnMixGenerator\n\n const RNGSEED RNGSeedBaseTxnMixGenerator = 87944308;\n\n\n\n // Base seed for TxnInputGenerator\n\n const RNGSEED RNGSeedBaseTxnInputGenerator = 80534927;\n\n\n", "file_path": "egen/TestHarness/Reference/inc/RNGSeeds.h", "rank": 34, "score": 94029.83898962277 }, { "content": "namespace TPCE\n\n{\n\n\n\ntemplate <typename T> class CBaseLoader\n\n{\n\n\n\npublic:\n\n typedef const T* PT; //pointer to the table row\n\n\n\n /*\n\n * Virtual destructor. Provided so that a sponsor-specific\n\n * destructor can be called on destruction from the base-class pointer.\n\n *\n\n * PARAMETERS:\n\n * none.\n\n *\n\n * RETURNS:\n\n * not applicable.\n\n */\n\n virtual ~CBaseLoader() {};\n\n\n\n /*\n\n * This function is provided to reset the loader to\n\n * a clean state. \"Clean state\" here means a sequence of\n\n * WriteNextRecord(), followed by Commit(), followed by FinishLoad()\n\n * can be called.\n\n *\n\n * PARAMETERS:\n\n * none.\n\n *\n\n * RETURNS:\n\n * none.\n\n */\n\n virtual void Init() {}; // default implementation is empty\n\n\n\n /*\n\n * Receive a new record to be loaded into the database.\n\n * This is the main function that is called\n\n * for every generated record.\n\n *\n\n * Note: the records are not guaranteed to actually be inserted\n\n * into the database after this call. It is Commit() that ensures that\n\n * all records received by WriteNextRecord are persisted in the database.\n\n *\n\n * PARAMETERS:\n\n * IN next_record - a pointer to a structure, containing the record\n\n *\n\n * RETURNS:\n\n * none.\n\n */\n\n virtual void WriteNextRecord(PT next_record) = 0; // must be defined in subclasses\n\n\n\n /*\n\n * Commit any records that might have been kept in temporary\n\n * storage to the database. After this call, all records received\n\n * by WriteNextRecord should be present in the database.\n\n *\n\n * PARAMETERS:\n\n * none.\n\n *\n\n * RETURNS:\n\n * none.\n\n */\n\n virtual void Commit() {}; // default implementation is empty\n\n\n\n /*\n\n * Release any resources held for loading.\n\n * Also, commit any records that might have been kept in temporary\n\n * storage to the database.\n\n * This function is called once, after the last record has been loaded.\n\n *\n\n * PARAMETERS:\n\n * none.\n\n *\n\n * RETURNS:\n\n * none.\n\n */\n\n virtual void FinishLoad() = 0; // must be defined in subclasses\n\n};\n\n\n", "file_path": "egen/TestHarness/Reference/inc/BaseLoader.h", "rank": 35, "score": 94029.83898962277 }, { "content": "namespace TPCE\n\n{\n\n\n\ntemplate <typename T> class CInputFileNoWeight\n\n{\n\n typedef vector<T>* PVectorT;\n\n //Type of in-memory representation of input files\n\n typedef vector<PVectorT> CFileInMemoryList; //array of arrays\n\n\n\n CFileInMemoryList m_list;\n\n\n\n void ReadList(const char *szListFile)\n\n {\n\n ifstream tmpFile;\n\n\n\n if (szListFile)\n\n {\n\n tmpFile.open(szListFile, ios_base::in);\n\n if (tmpFile)\n\n {\n\n ReadList(tmpFile);\n\n tmpFile.close();\n\n }\n\n else\n\n { //Open failed\n\n tmpFile.close();\n\n throw CSystemErr(CSystemErr::eCreateFile, \"CInputFileNoWeight::ReadList\");\n\n }\n\n }\n\n else\n\n {\n\n throw CSystemErr(CSystemErr::eCreateFile, \"CInputFileNoWeight::ReadList\");\n\n }\n\n }\n\n\n\n void ReadList(const string &str)\n\n {\n\n istringstream tmpFile(str);\n\n ReadList(tmpFile);\n\n }\n\n\n\n void ReadList(istream &tmpFile)\n\n {\n\n T row;\n\n memset(&row, 0, sizeof(row));\n\n int iIndex;\n\n int iLastIndex = -1; /* must be different from the 1st index in the input file */\n\n\n\n while(tmpFile.good())\n\n {\n\n tmpFile>>iIndex; //read the first column, which is the index\n\n if( ! tmpFile.eof() )\n\n {\n\n row.Load(tmpFile); //read the row\n\n if (iIndex!=iLastIndex)\n\n {\n\n PVectorT parray_row = new vector<T>;\n\n if (parray_row!=NULL)\n\n m_list.push_back(parray_row); //new array\n\n else\n\n throw CMemoryErr(\"CInputFileNoWeight::ReadFile\");\n\n iLastIndex = iIndex;\n\n }\n\n //Indices in the file start with 1 => substract 1.\n\n m_list[iIndex-1]->push_back(row); //insert into the container\n\n }\n\n }\n\n }\n\n\n\npublic:\n\n\n\n //Constructor.\n\n CInputFileNoWeight(const char *szListFile)\n\n {\n\n ReadList(szListFile);\n\n }\n\n\n\n CInputFileNoWeight(const string &str)\n\n {\n\n ReadList(str);\n\n }\n\n\n\n //Destructor\n\n ~CInputFileNoWeight()\n\n {\n\n for(size_t i=0; i<m_list.size(); ++i)\n\n delete m_list[i];\n\n }\n\n\n\n //Returns the element at a specific index\n\n PVectorT GetRecord(int index) { return m_list[index]; };\n\n\n\n //Returns the number of records in the file (needed for TaxRates table\n\n UINT GetSize() { return (UINT)m_list.size(); }\n", "file_path": "egen/TestHarness/Reference/inc/InputFileNoWeight.h", "rank": 36, "score": 92867.38233316847 }, { "content": "namespace TPCE\n\n{\n\n\n\nenum eTradeTypeID\n\n{\n\n eMarketBuy = 0,\n\n eMarketSell,\n\n eStopLoss,\n\n eLimitSell,\n\n eLimitBuy,\n\n\n\n eMaxTradeTypeID // should be the last - contains the number of items in the enumeration\n\n};\n\n\n", "file_path": "egen/TestHarness/Reference/inc/TradeTypeIDs.h", "rank": 37, "score": 92867.38233316847 }, { "content": "namespace TPCE\n\n{\n\n\n\nextern \"C\"\n\n{\n\n\n\n // Retrieve major, minor, revision, and beta level numbers for EGen.\n\n// For example, v3.10 beta 1 has:\n\n// major 3\n\n// minor 10\n\n// revision 0\n\n// beta level 1\n\n// v3.10 release has:\n\n// major 3\n\n// minor 10\n\n// revision 0\n\n// beta level 0\n\n//\n\nvoid GetEGenVersion(INT32 &iMajorVersion, INT32 &iMinorVersion, INT32 &iRevisionNumber, INT32 &iBetaLevel);\n\n\n\n// Return versioning information formated as a string\n\n//\n\n// Note: requires output buffer at least 64 characters long, or nothing will be returned.\n\n//\n\nvoid GetEGenVersionString(char* szOutput, INT32 iOutputBufferLen);\n\n\n\n// Output EGen versioning information on stdout\n\n//\n\nvoid PrintEGenVersion();\n\n\n\n// Return the date/time when the EGen versioning information was last updated.\n\n//\n\nvoid GetEGenVersionUpdateTimestamp(char* szOutput, INT32 iOutputBufferLen);\n\n\n\n}\n\n\n", "file_path": "egen/TestHarness/Reference/inc/EGenVersion.h", "rank": 38, "score": 92867.38233316847 }, { "content": "namespace TPCE\n\n{\n\n\n\nconst double fMinSecPrice = 20.00;\n\nconst double fMaxSecPrice = 30.00;\n\n\n", "file_path": "egen/TestHarness/Reference/inc/SecurityPriceRange.h", "rank": 39, "score": 92867.38233316847 }, { "content": "namespace TPCE\n\n{\n\n\n\n// Database binding type for integer identifiers (IDENT_T metatype in TPC-E spec).\n\n//\n\n#define IDENT_BIND SQLINT8\n\n\n\n//For nullable columns\n\ntypedef struct BCPDOUBLE\n\n{\n\n int iIndicator;\n\n float value;\n\n} *PBCPDOUBLE;\n\ntypedef struct BCPDBDATETIME\n\n{\n\n int iIndicator;\n\n DBDATETIME value;\n\n} *PBCPDBDATETIME;\n\n\n\n/*\n\n* DBLoader class.\n\n*/\n\ntemplate <typename T> class CDBLoader : public CBaseLoader<T>\n\n{\n\nprotected:\n\n T m_row;\n\n int m_cnt;\n\n SQLHENV m_henv; // ODBC environment handle\n\n SQLHDBC m_hdbc;\n\n SQLHSTMT m_hstmt; // the current hstmt\n\n char m_szServer[iMaxHostname]; // server name\n\n char m_szDatabase[iMaxDBName]; // name of the database being loaded\n\n char m_szLoaderParams[iMaxPath]; // loader parameters specified on the command-line\n\n char m_szTable[iMaxPath]; // name of the table being loaded\n\n\n\n//public:\n\n //typedef const T* PT; //pointer to the table row\n\n\n\n\n\n//protected:\n\n virtual inline void CopyRow(PT row) { memcpy(&m_row, row, sizeof(m_row)); };\n\n\n\npublic:\n\n\n\n CDBLoader(char *szServer, char *szDatabase, char *szLoaderParams, char *szTable);\n\n ~CDBLoader(void);\n\n\n\n virtual void BindColumns() = 0; //column binding function subclasses must implement\n\n virtual void Init(); //resets to clean state; needed after FinishLoad to continue loading\n\n virtual void Commit(); // commit rows sent so far\n\n virtual void FinishLoad(); // finish load\n\n void Connect(); //connect to SQL Server\n\n void Disconnect(); //disconnect - should not throw any exceptions (to put into the destructor)\n\n\n\n void ThrowError( CODBCERR::ACTION eAction, SQLSMALLINT HandleType = 0, SQLHANDLE Handle = SQL_NULL_HANDLE);\n\n virtual void WriteNextRecord(PT next_record);\n\n};\n\n\n", "file_path": "egen/TestHarness/Reference/inc/win/DBLoader.h", "rank": 40, "score": 92867.38233316847 }, { "content": "namespace TPCE\n\n{\n\n#ifdef DATETIME_FORMAT\n\nconst int FlatFileDateTimeFormat = DATETIME_FORMAT; // user-defined\n\n#else\n\nconst int FlatFileDateTimeFormat = 12; // YYYY-MM-DD HH:MM:SS.mmm\n\n#endif\n\n#ifdef TIME_FORMAT\n\nconst int FlatFileTimeFormat = TIME_FORMAT; // user-defined\n\n#else\n\nconst int FlatFileTimeFormat = 01; // hh:mm:ss\n\n#endif\n\n#ifdef DATE_FORMAT\n\nconst int FlatFileDateFormat = DATE_FORMAT; // user-defined\n\n#else\n\nconst int FlatFileDateFormat = 10; // YYYY-MM-DD\n\n#endif\n\n\n\n// Overwrite vs. append functionality for output flat files.\n\nenum FlatFileOutputModes {\n\n FLAT_FILE_OUTPUT_APPEND = 0,\n\n FLAT_FILE_OUTPUT_OVERWRITE\n\n};\n\n\n\n/*\n\n* FlatLoader class.\n\n*/\n\ntemplate <typename T> class CFlatFileLoader : public CBaseLoader<T>\n\n{\n\nprotected:\n\n FILE *hOutFile;\n\n\n\npublic:\n\n\n\n CFlatFileLoader(char *szFileName, FlatFileOutputModes FlatFileOutputMode);\n\n ~CFlatFileLoader(void);\n\n\n\n virtual void WriteNextRecord(const T* next_record UNUSED) {};\n\n void FinishLoad(); //finish load\n\n\n\n};\n\n\n\n/*\n\n* The constructor.\n\n*/\n\ntemplate <typename T>\n\nCFlatFileLoader<T>::CFlatFileLoader(char *szFileName, FlatFileOutputModes flatFileOutputMode)\n\n{\n\n if( FLAT_FILE_OUTPUT_APPEND == flatFileOutputMode )\n\n {\n\n hOutFile = fopen( szFileName, \"a\" );\n\n }\n\n else if( FLAT_FILE_OUTPUT_OVERWRITE == flatFileOutputMode )\n\n {\n\n hOutFile = fopen( szFileName, \"w\" );\n\n }\n\n\n\n if (!hOutFile)\n\n {\n\n throw CSystemErr(CSystemErr::eCreateFile, \"CFlatFileLoader<T>::CFlatFileLoader\");\n\n }\n\n}\n\n\n\n/*\n\n* Destructor.\n\n*/\n\ntemplate <typename T>\n\nCFlatFileLoader<T>::~CFlatFileLoader()\n\n{\n\n fclose(hOutFile);\n\n}\n\n\n\n/*\n\n* Commit sent rows. This needs to be called after the last row has been sent\n\n* and before the object is destructed. Otherwise all rows will be discarded.\n\n*/\n\ntemplate <typename T>\n\nvoid CFlatFileLoader<T>::FinishLoad()\n\n{\n\n fflush(hOutFile);\n", "file_path": "egen/TestHarness/Reference/inc/FlatFileLoader.h", "rank": 41, "score": 92867.38233316847 }, { "content": "namespace TPCE\n\n{\n\n\n\n//declare the < operator for timestamps\n\nbool operator< (const TIMESTAMP_STRUCT& ts1, const TIMESTAMP_STRUCT& ts2);\n\n\n\nconst INT32 iFinYears = 5;\n\nconst INT32 iFinQtrPerYear = 4;\n\nconst INT32 iMaxDailyHistory = 10;\n\nconst INT32 iMaxNews = 10;\n\n\n\nconst INT32 min_broker_list_len = 20; // for Broker-Volume\n\nconst INT32 max_broker_list_len = 40; // for Broker-Volume\n\nconst INT32 max_acct_len = 20; // for Customer-Position\n\nconst INT32 max_hist_len = 30; // for Customer-Position\n\nconst INT32 max_feed_len = 20; // for Market-Feed\n\nconst INT32 max_send_len = 40; // for Market-Feed\n\nconst INT32 max_day_len = 20; // for Security-Detail\n\nconst INT32 max_fin_len = 20; // for Security-Detail\n\nconst INT32 max_news_len = 2; // for Security-Detail\n\nconst INT32 max_comp_len = 3; // for Security-Detail\n\nconst INT32 max_trade_status_len = 50; // for Trade-Status\n\n\n\nconst INT32 max_table_name = 30; // for Data Maintenance\n\n\n\n/*\n\n* Broker-Volume\n\n*/\n\ntypedef struct TBrokerVolumeTxnInput\n\n{\n\n // Transaction level inputs\n\n char broker_list[max_broker_list_len][cB_NAME_len+1];\n\n char sector_name[cSC_NAME_len+1];\n\n} *PBrokerVolumeTxnInput,\n\n TBrokerVolumeFrame1Input, // Single-Frame transaction\n\n *PBrokerVolumeFrame1Input; // Single-Frame transaction\n\n\n\ntypedef struct TBrokerVolumeTxnOutput\n\n{\n\n // Transaction level outputs\n\n double volume[max_broker_list_len];\n\n INT32 list_len;\n\n INT32 status;\n\n} *PBrokerVolumeTxnOutput;\n\n\n\ntypedef struct TBrokerVolumeFrame1Output\n\n{\n\n // Frame level outputs\n\n double volume[max_broker_list_len];\n\n INT32 list_len;\n\n INT32 status;\n\n char broker_name[max_broker_list_len][cB_NAME_len+1];\n\n} *PBrokerVolumeFrame1Output;\n\n/*\n\n* Customer-Position\n\n*/\n\ntypedef struct TCustomerPositionTxnInput\n\n{\n\n TIdent acct_id_idx;\n\n TIdent cust_id;\n\n bool get_history;\n\n char tax_id[cTAX_ID_len+1];\n\n} *PCustomerPositionTxnInput;\n\n\n\ntypedef struct TCustomerPositionTxnOutput\n\n{\n\n double asset_total[max_acct_len];\n\n double cash_bal[max_acct_len];\n\n TIdent acct_id[max_acct_len];\n\n TTrade trade_id[max_hist_len];\n\n TIdent c_ad_id;\n\n INT32 qty[max_hist_len];\n\n INT32 acct_len;\n\n INT32 hist_len;\n\n INT32 status;\n\n TIMESTAMP_STRUCT hist_dts[max_hist_len];\n\n TIMESTAMP_STRUCT c_dob;\n\n char symbol[max_hist_len][cSYMBOL_len+1];\n\n char trade_status[max_hist_len][cST_NAME_len+1];\n\n char c_area_1[cAREA_len+1];\n\n char c_area_2[cAREA_len+1];\n\n char c_area_3[cAREA_len+1];\n\n char c_ctry_1[cCTRY_len+1];\n\n char c_ctry_2[cCTRY_len+1];\n\n char c_ctry_3[cCTRY_len+1];\n\n char c_email_1[cEMAIL_len+1];\n\n char c_email_2[cEMAIL_len+1];\n\n char c_ext_1[cEXT_len+1];\n\n char c_ext_2[cEXT_len+1];\n\n char c_ext_3[cEXT_len+1];\n\n char c_f_name[cF_NAME_len+1];\n\n char c_gndr[cGNDR_len+1];\n\n char c_l_name[cL_NAME_len+1];\n\n char c_local_1[cLOCAL_len+1];\n\n char c_local_2[cLOCAL_len+1];\n\n char c_local_3[cLOCAL_len+1];\n\n char c_m_name[cM_NAME_len+1];\n\n char c_st_id[cST_ID_len+1];\n\n char c_tier;\n\n} *PCustomerPositionTxnOutput;\n\n\n\ntypedef struct TCustomerPositionFrame1Input\n\n{\n\n TIdent cust_id;\n\n char tax_id[cTAX_ID_len+1];\n\n} *PCustomerPositionFrame1Input;\n\n\n\ntypedef struct TCustomerPositionFrame1Output\n\n{\n\n double asset_total[max_acct_len];\n\n double cash_bal[max_acct_len];\n\n TIdent acct_id[max_acct_len];\n\n TIdent c_ad_id;\n\n TIdent cust_id;\n\n INT32 acct_len;\n\n INT32 status;\n\n TIMESTAMP_STRUCT c_dob;\n\n char c_area_1[cAREA_len+1];\n\n char c_area_2[cAREA_len+1];\n\n char c_area_3[cAREA_len+1];\n\n char c_ctry_1[cCTRY_len+1];\n\n char c_ctry_2[cCTRY_len+1];\n\n char c_ctry_3[cCTRY_len+1];\n\n char c_email_1[cEMAIL_len+1];\n\n char c_email_2[cEMAIL_len+1];\n\n char c_ext_1[cEXT_len+1];\n\n char c_ext_2[cEXT_len+1];\n\n char c_ext_3[cEXT_len+1];\n\n char c_f_name[cF_NAME_len+1];\n\n char c_gndr[cGNDR_len+1];\n\n char c_l_name[cL_NAME_len+1];\n\n char c_local_1[cLOCAL_len+1];\n\n char c_local_2[cLOCAL_len+1];\n\n char c_local_3[cLOCAL_len+1];\n\n char c_m_name[cM_NAME_len+1];\n\n char c_st_id[cST_ID_len+1];\n\n char c_tier;\n\n} *PCustomerPositionFrame1Output;\n\n\n\ntypedef struct TCustomerPositionFrame2Input\n\n{\n\n TIdent acct_id;\n\n} *PCustomerPositionFrame2Input;\n\n\n\ntypedef struct TCustomerPositionFrame2Output\n\n{\n\n TTrade trade_id[max_hist_len];\n\n INT32 qty[max_hist_len];\n\n INT32 hist_len;\n\n INT32 status;\n\n TIMESTAMP_STRUCT hist_dts[max_hist_len];\n\n char symbol[max_hist_len][cSYMBOL_len+1];\n\n char trade_status[max_hist_len][cST_NAME_len+1];\n\n} *PCustomerPositionFrame2Output;\n\n\n\ntypedef struct TCustomerPositionFrame3Output\n\n{\n\n INT32 status;\n\n} *PCustomerPositionFrame3Output;\n\n\n\n\n\n/*\n\n* Data-Maintenance\n\n*/\n\ntypedef struct TDataMaintenanceTxnInput\n\n{\n\n TIdent acct_id;\n\n TIdent c_id;\n\n TIdent co_id;\n\n INT32 day_of_month;\n\n INT32 vol_incr;\n\n char symbol[cSYMBOL_len+1];\n\n char table_name[max_table_name+1];\n\n char tx_id[cTAX_ID_len+1];\n\n} *PDataMaintenanceTxnInput,\n\n TDataMaintenanceFrame1Input, // Single-Frame transaction\n\n *PDataMaintenanceFrame1Input; // Single-Frame transaction\n\n\n\ntypedef struct TDataMaintenanceTxnOutput\n\n{\n\n INT32 status;\n\n} *PDataMaintenanceTxnOutput,\n\n TDataMaintenanceFrame1Output, // Single-Frame transaction\n\n *PDataMaintenanceFrame1Output; // Single-Frame transaction\n\n\n\n\n\n/*\n\n* Market-Feed\n\n*/\n\n// MEE populates this structure\n\ntypedef struct TStatusAndTradeType\n\n{\n\n char status_submitted[cST_ID_len+1];\n\n char type_limit_buy[cTT_ID_len+1];\n\n char type_limit_sell[cTT_ID_len+1];\n\n char type_stop_loss[cTT_ID_len+1];\n\n} *PTStatusAndTradeType;\n\n\n\n//Incomming order from SendToMarket interface.\n\ntypedef struct TTradeRequest\n\n{\n\n double price_quote;\n\n TTrade trade_id;\n\n INT32 trade_qty;\n\n eMEETradeRequestAction eAction;\n\n char symbol[cSYMBOL_len+1];\n\n char trade_type_id[cTT_ID_len+1];\n\n} *PTradeRequest;\n\n\n\n//A single entry on the ticker tape feed.\n\ntypedef struct TTickerEntry\n\n{\n\n double price_quote;\n\n INT32 trade_qty;\n\n char symbol[cSYMBOL_len+1];\n\n} *PTickerEntry;\n\n\n\n//Market-Feed data sent from MEE to sponsor provided SUT interface\n\ntypedef struct TMarketFeedTxnInput\n\n{\n\n TStatusAndTradeType StatusAndTradeType;\n\n char zz_padding[4];\n\n TTickerEntry Entries[max_feed_len];\n\n} *PMarketFeedTxnInput,\n\n TMarketFeedFrame1Input, // Single-Frame transaction\n\n *PMarketFeedFrame1Input; // Single-Frame transaction\n\n\n\ntypedef struct TMarketFeedTxnOutput\n\n{\n\n INT32 send_len;\n\n INT32 status;\n\n} *PMarketFeedTxnOutput;\n\n\n\ntypedef struct TMarketFeedFrame1Output\n\n{\n\n INT32 send_len;\n\n INT32 status;\n\n} *PMarketFeedFrame1Output;\n\n\n\n\n\n/*\n\n* Market-Watch\n\n*/\n\ntypedef struct TMarketWatchTxnInput\n\n{\n\n TIdent acct_id;\n\n TIdent c_id;\n\n TIdent ending_co_id;\n\n TIdent starting_co_id;\n\n TIMESTAMP_STRUCT start_day;\n\n char industry_name[cIN_NAME_len+1];\n\n} *PMarketWatchTxnInput,\n\n TMarketWatchFrame1Input, // Single-Frame transaction\n\n *PMarketWatchFrame1Input; // Single-Frame transaction\n\n\n\ntypedef struct TMarketWatchTxnOutput\n\n{\n\n double pct_change;\n\n INT32 status;\n\n} *PMarketWatchTxnOutput,\n\n TMarketWatchFrame1Output, // Single-Frame transaction\n\n *PMarketWatchFrame1Output; // Single-Frame transaction\n\n\n\n\n\n/*\n\n* Security-Detail\n\n*/\n\ntypedef struct TFinInfo\n\n{\n\n double assets;\n\n double basic_eps;\n\n double dilut_eps;\n\n double invent;\n\n double liab;\n\n double margin;\n\n double net_earn;\n\n double out_basic;\n\n double out_dilut;\n\n double rev;\n\n INT32 qtr;\n\n INT32 year;\n\n TIMESTAMP_STRUCT start_date;\n\n DB_INDICATOR assets_ind;\n\n DB_INDICATOR basic_eps_ind;\n\n DB_INDICATOR dilut_eps_ind;\n\n DB_INDICATOR invent_ind;\n\n DB_INDICATOR liab_ind;\n\n DB_INDICATOR margin_ind;\n\n DB_INDICATOR net_earn_ind;\n\n DB_INDICATOR out_basic_ind;\n\n DB_INDICATOR out_dilut_ind;\n\n DB_INDICATOR qtr_ind;\n\n DB_INDICATOR rev_ind;\n\n DB_INDICATOR start_date_ind;\n\n DB_INDICATOR year_ind;\n\n} *PFinInfo;\n\n\n\ntypedef struct TDailyHistory\n\n{\n\n double close;\n\n double high;\n\n double low;\n\n INT64 vol;\n\n TIMESTAMP_STRUCT date;\n\n DB_INDICATOR close_ind;\n\n DB_INDICATOR date_ind;\n\n DB_INDICATOR high_ind;\n\n DB_INDICATOR low_ind;\n\n DB_INDICATOR vol_ind;\n\n} *PDailyHistory;\n\n\n\ntypedef struct TLastPrice\n\n{\n\n double open_price;\n\n double price;\n\n INT64 vol_today;\n\n DB_INDICATOR open_price_ind;\n\n DB_INDICATOR price_ind;\n\n DB_INDICATOR vol_today_ind;\n\n} *PLastPrice;\n\n\n\ntypedef struct TNews\n\n{\n\n TIMESTAMP_STRUCT dts;\n\n char auth[cNI_AUTHOR_len+1];\n\n char headline[cNI_HEADLINE_len+1];\n\n char item[cNI_ITEM_len+1];\n\n char src[cNI_SOURCE_len+1];\n\n char summary[cNI_SUMMARY_len+1];\n\n DB_INDICATOR auth_ind;\n\n} *PNews;\n\n\n\ntypedef struct TSecurityDetailTxnInput\n\n{\n\n INT32 max_rows_to_return;\n\n bool access_lob_flag;\n\n TIMESTAMP_STRUCT start_day;\n\n char symbol[cSYMBOL_len+1];\n\n} *PSecurityDetailTxnInput,\n\n TSecurityDetailFrame1Input, // Single-Frame transaction\n\n *PSecurityDetailFrame1Input; // Single-Frame transaction\n\n\n\ntypedef struct TSecurityDetailTxnOutput\n\n{\n\n INT64 last_vol;\n\n INT32 news_len;\n\n INT32 status;\n\n} *PSecurityDetailTxnOutput;\n\n\n\ntypedef struct TSecurityDetailFrame1Output\n\n{\n\n double divid;\n\n double last_open;\n\n double last_price;\n\n double pe_ratio;\n\n double s52_wk_high;\n\n double s52_wk_low;\n\n double yield;\n\n INT64 last_vol;\n\n INT64 num_out;\n\n INT32 day_len;\n\n INT32 ex_close;\n\n INT32 ex_num_symb;\n\n INT32 ex_open;\n\n INT32 fin_len;\n\n INT32 news_len;\n\n INT32 status;\n\n TIMESTAMP_STRUCT ex_date;\n\n TIMESTAMP_STRUCT open_date;\n\n TIMESTAMP_STRUCT s52_wk_high_date;\n\n TIMESTAMP_STRUCT s52_wk_low_date;\n\n TIMESTAMP_STRUCT start_date;\n\n TDailyHistory day[max_day_len];\n\n TFinInfo fin[max_fin_len];\n\n TNews news[max_news_len];\n\n char cp_co_name[max_comp_len][cCO_NAME_len+1];\n\n char cp_in_name[max_comp_len][cIN_NAME_len+1];\n\n char ceo_name[cCEO_NAME_len+1];\n\n char co_ad_cty[cAD_CTRY_len+1];\n\n char co_ad_div[cAD_DIV_len+1];\n\n char co_ad_line1[cAD_LINE_len+1];\n\n char co_ad_line2[cAD_LINE_len+1];\n\n char co_ad_town[cAD_TOWN_len+1];\n\n char co_ad_zip[cAD_ZIP_len+1];\n\n char co_desc[cCO_DESC_len+1];\n\n char co_name[cCO_NAME_len+1];\n\n char co_st_id[cST_ID_len+1];\n\n char ex_ad_cty[cAD_CTRY_len+1];\n\n char ex_ad_div[cAD_DIV_len+1];\n\n char ex_ad_line1[cAD_LINE_len+1];\n\n char ex_ad_line2[cAD_LINE_len+1];\n\n char ex_ad_town[cAD_TOWN_len+1];\n\n char ex_ad_zip[cAD_ZIP_len+1];\n\n char ex_desc[cEX_DESC_len+1];\n\n char ex_name[cEX_NAME_len+1];\n\n char s_name[cS_NAME_len+1];\n\n char sp_rate[cSP_RATE_len+1];\n\n} *PSecurityDetailFrame1Output;\n\n\n\n\n\n/*\n\n* Trade-Lookup\n\n*/\n\ntypedef struct TTradeLookupTxnInput\n\n{\n\n TTrade trade_id[TradeLookupFrame1MaxRows];\n\n TIdent acct_id;\n\n TIdent max_acct_id;\n\n INT32 frame_to_execute; // which of the frames to execute\n\n INT32 max_trades;\n\n TIMESTAMP_STRUCT end_trade_dts;\n\n TIMESTAMP_STRUCT start_trade_dts;\n\n char symbol[cSYMBOL_len+1];\n\n} *PTradeLookupTxnInput;\n\ntypedef struct TTradeLookupTxnOutput\n\n{\n\n TTrade trade_list[TradeLookupMaxRows];\n\n INT32 frame_executed; // confirmation of which frame was executed\n\n INT32 num_found;\n\n INT32 status;\n\n bool is_cash[TradeLookupMaxRows];\n\n bool is_market[TradeLookupMaxRows];\n\n} *PTradeLookupTxnOutput;\n\n\n\ntypedef struct TTradeLookupFrame1Input\n\n{\n\n TTrade trade_id[TradeLookupFrame1MaxRows];\n\n INT32 max_trades;\n\n} *PTradeLookupFrame1Input;\n\n\n\n// Structure to hold one trade information row\n\n//\n\ntypedef struct TTradeLookupFrame1TradeInfo\n\n{\n\n double bid_price;\n\n double cash_transaction_amount;\n\n double settlement_amount;\n\n double trade_price;\n\n bool is_cash;\n\n bool is_market;\n\n TIMESTAMP_STRUCT trade_history_dts[TradeLookupMaxTradeHistoryRowsReturned];\n\n TIMESTAMP_STRUCT cash_transaction_dts;\n\n TIMESTAMP_STRUCT settlement_cash_due_date;\n\n char trade_history_status_id[TradeLookupMaxTradeHistoryRowsReturned][cTH_ST_ID_len+1];\n\n char cash_transaction_name[cCT_NAME_len+1];\n\n char exec_name[cEXEC_NAME_len+1];\n\n char settlement_cash_type[cSE_CASH_TYPE_len+1];\n\n DB_INDICATOR trade_history_dts_ind[TradeLookupMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR trade_history_status_id_ind[TradeLookupMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR bid_price_ind;\n\n DB_INDICATOR cash_transaction_amount_ind;\n\n DB_INDICATOR cash_transaction_dts_ind;\n\n DB_INDICATOR cash_transaction_name_ind;\n\n DB_INDICATOR exec_name_ind;\n\n DB_INDICATOR is_cash_ind;\n\n DB_INDICATOR is_market_ind;\n\n DB_INDICATOR settlement_amount_ind;\n\n DB_INDICATOR settlement_cash_due_date_ind;\n\n DB_INDICATOR settlement_cash_type_ind;\n\n DB_INDICATOR trade_price_ind;\n\n} *PTradeLookupFrame1TradeInfo;\n\n\n\ntypedef struct TTradeLookupFrame1Output\n\n{\n\n INT32 num_found;\n\n INT32 status;\n\n TTradeLookupFrame1TradeInfo trade_info[TradeLookupFrame1MaxRows];\n\n} *PTradeLookupFrame1Output;\n\n\n\ntypedef struct TTradeLookupFrame2Input\n\n{\n\n TIdent acct_id;\n\n INT32 max_trades;\n\n TIMESTAMP_STRUCT end_trade_dts;\n\n TIMESTAMP_STRUCT start_trade_dts;\n\n} *PTradeLookupFrame2Input;\n\n\n\n// Structure to hold one trade information row\n\n//\n\ntypedef struct TTradeLookupFrame2TradeInfo\n\n{\n\n double bid_price;\n\n double cash_transaction_amount;\n\n double settlement_amount;\n\n double trade_price;\n\n TTrade trade_id;\n\n bool is_cash;\n\n TIMESTAMP_STRUCT trade_history_dts[TradeLookupMaxTradeHistoryRowsReturned];\n\n TIMESTAMP_STRUCT cash_transaction_dts;\n\n TIMESTAMP_STRUCT settlement_cash_due_date;\n\n char trade_history_status_id[TradeLookupMaxTradeHistoryRowsReturned][cTH_ST_ID_len+1];\n\n char cash_transaction_name[cCT_NAME_len+1];\n\n char exec_name[cEXEC_NAME_len+1];\n\n char settlement_cash_type[cSE_CASH_TYPE_len+1];\n\n DB_INDICATOR trade_history_dts_ind[TradeLookupMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR trade_history_status_id_ind[TradeLookupMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR bid_price_ind;\n\n DB_INDICATOR cash_transaction_amount_ind;\n\n DB_INDICATOR cash_transaction_dts_ind;\n\n DB_INDICATOR cash_transaction_name_ind;\n\n DB_INDICATOR exec_name_ind;\n\n DB_INDICATOR is_cash_ind;\n\n DB_INDICATOR settlement_amount_ind;\n\n DB_INDICATOR settlement_cash_due_date_ind;\n\n DB_INDICATOR settlement_cash_type_ind;\n\n DB_INDICATOR trade_id_ind;\n\n DB_INDICATOR trade_price_ind;\n\n} *PTradeLookupFrame2TradeInfo;\n\n\n\ntypedef struct TTradeLookupFrame2Output\n\n{\n\n INT32 num_found;\n\n INT32 status;\n\n TTradeLookupFrame2TradeInfo trade_info[TradeLookupFrame2MaxRows];\n\n} *PTradeLookupFrame2Output;\n\n\n\ntypedef struct TTradeLookupFrame3Input\n\n{\n\n TIdent max_acct_id;\n\n INT32 max_trades;\n\n TIMESTAMP_STRUCT end_trade_dts;\n\n TIMESTAMP_STRUCT start_trade_dts;\n\n char symbol[cSYMBOL_len+1];\n\n} *PTradeLookupFrame3Input;\n\n\n\n// Structure to hold one trade information row\n\n//\n\ntypedef struct TTradeLookupFrame3TradeInfo\n\n{\n\n double cash_transaction_amount;\n\n double price;\n\n double settlement_amount;\n\n TIdent acct_id;\n\n TTrade trade_id;\n\n INT32 quantity;\n\n bool is_cash;\n\n TIMESTAMP_STRUCT trade_history_dts[TradeLookupMaxTradeHistoryRowsReturned];\n\n TIMESTAMP_STRUCT cash_transaction_dts;\n\n TIMESTAMP_STRUCT settlement_cash_due_date;\n\n TIMESTAMP_STRUCT trade_dts;\n\n char trade_history_status_id[TradeLookupMaxTradeHistoryRowsReturned][cTH_ST_ID_len+1];\n\n char cash_transaction_name[cCT_NAME_len+1];\n\n char exec_name[cEXEC_NAME_len+1];\n\n char settlement_cash_type[cSE_CASH_TYPE_len+1];\n\n char trade_type[cTT_ID_len+1];\n\n DB_INDICATOR trade_history_dts_ind[TradeLookupMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR trade_history_status_id_ind[TradeLookupMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR acct_id_ind;\n\n DB_INDICATOR cash_transaction_amount_ind;\n\n DB_INDICATOR cash_transaction_dts_ind;\n\n DB_INDICATOR cash_transaction_name_ind;\n\n DB_INDICATOR exec_name_ind;\n\n DB_INDICATOR is_cash_ind;\n\n DB_INDICATOR price_ind;\n\n DB_INDICATOR quantity_ind;\n\n DB_INDICATOR settlement_amount_ind;\n\n DB_INDICATOR settlement_cash_due_date_ind;\n\n DB_INDICATOR settlement_cash_type_ind;\n\n DB_INDICATOR trade_dts_ind;\n\n DB_INDICATOR trade_id_ind;\n\n DB_INDICATOR trade_type_ind;\n\n} *PTradeLookupFrame3TradeInfo;\n\n\n\ntypedef struct TTradeLookupFrame3Output\n\n{\n\n INT32 num_found;\n\n INT32 status;\n\n TTradeLookupFrame3TradeInfo trade_info[TradeLookupFrame3MaxRows];\n\n} *PTradeLookupFrame3Output;\n\n\n\ntypedef struct TTradeLookupFrame4Input\n\n{\n\n TIdent acct_id;\n\n TIMESTAMP_STRUCT trade_dts;\n\n} *PTradeLookupFrame4Input;\n\n\n\n// Structure to hold one trade information row\n\n//\n\ntypedef struct TTradeLookupFrame4TradeInfo\n\n{\n\n TTrade holding_history_id;\n\n TTrade holding_history_trade_id;\n\n INT32 quantity_after;\n\n INT32 quantity_before;\n\n DB_INDICATOR holding_history_id_ind;\n\n DB_INDICATOR holding_history_trade_id_ind;\n\n DB_INDICATOR quantity_after_ind;\n\n DB_INDICATOR quantity_before_ind;\n\n} *PTradeLookupFrame4TradeInfo;\n\n\n\ntypedef struct TTradeLookupFrame4Output\n\n{\n\n TTrade trade_id;\n\n INT32 num_found;\n\n INT32 status;\n\n TTradeLookupFrame4TradeInfo trade_info[TradeLookupFrame4MaxRows];\n\n} *PTradeLookupFrame4Output;\n\n\n\n\n\n\n\n/*\n\n* Trade-Order\n\n*/\n\ntypedef struct TTradeOrderTxnInput\n\n{\n\n double requested_price;\n\n TIdent acct_id;\n\n INT32 is_lifo;\n\n INT32 roll_it_back;\n\n INT32 trade_qty;\n\n INT32 type_is_margin;\n\n char co_name[cCO_NAME_len+1];\n\n char exec_f_name[cF_NAME_len+1];\n\n char exec_l_name[cL_NAME_len+1];\n\n char exec_tax_id[cTAX_ID_len+1];\n\n char issue[cS_ISSUE_len+1];\n\n char st_pending_id[cST_ID_len+1];\n\n char st_submitted_id[cST_ID_len+1];\n\n char symbol[cSYMBOL_len+1];\n\n char trade_type_id[cTT_ID_len+1];\n\n} *PTradeOrderTxnInput;\n\ntypedef struct TTradeOrderTxnOutput\n\n{\n\n double buy_value;\n\n double sell_value;\n\n double tax_amount;\n\n TTrade trade_id;\n\n INT32 status;\n\n} *PTradeOrderTxnOutput;\n\n\n\ntypedef struct TTradeOrderFrame1Input\n\n{\n\n TIdent acct_id;\n\n} *PTradeOrderFrame1Input;\n\n\n\ntypedef struct TTradeOrderFrame1Output\n\n{\n\n TIdent broker_id;\n\n TIdent cust_id;\n\n INT32 cust_tier;\n\n INT32 status;\n\n INT32 tax_status;\n\n char acct_name[cCA_NAME_len+1];\n\n char broker_name[cB_NAME_len+1];\n\n char cust_f_name[cF_NAME_len+1];\n\n char cust_l_name[cL_NAME_len+1];\n\n char tax_id[cTAX_ID_len+1];\n\n} *PTradeOrderFrame1Output;\n\n\n\ntypedef struct TTradeOrderFrame2Input\n\n{\n\n TIdent acct_id;\n\n char exec_f_name[cF_NAME_len+1];\n\n char exec_l_name[cL_NAME_len+1];\n\n char exec_tax_id[cTAX_ID_len+1];\n\n} *PTradeOrderFrame2Input;\n\n\n\ntypedef struct TTradeOrderFrame2Output\n\n{\n\n INT32 status;\n\n char ap_acl[cACL_len+1];\n\n} *PTradeOrderFrame2Output;\n\n\n\ntypedef struct TTradeOrderFrame3Input\n\n{\n\n double requested_price; // IN-OUT parameter\n\n TIdent acct_id;\n\n TIdent cust_id;\n\n INT32 cust_tier;\n\n INT32 is_lifo;\n\n INT32 tax_status;\n\n INT32 trade_qty;\n\n INT32 type_is_margin;\n\n char co_name[cCO_NAME_len+1]; // IN-OUT parameter\n\n char issue[cS_ISSUE_len+1];\n\n char st_pending_id[cST_ID_len+1];\n\n char st_submitted_id[cST_ID_len+1];\n\n char symbol[cSYMBOL_len+1]; // IN-OUT parameter\n\n char trade_type_id[cTT_ID_len+1];\n\n} *PTradeOrderFrame3Input;\n\n\n\ntypedef struct TTradeOrderFrame3Output\n\n{\n\n double buy_value;\n\n double charge_amount;\n\n double comm_rate;\n\n double cust_assets;\n\n double market_price;\n\n double requested_price; // IN-OUT parameter\n\n double sell_value;\n\n double tax_amount;\n\n INT32 status;\n\n INT32 type_is_market;\n\n INT32 type_is_sell;\n\n char co_name[cCO_NAME_len+1]; // IN-OUT parameter\n\n char s_name[cS_NAME_len+1];\n\n char status_id[cST_ID_len+1];\n\n char symbol[cSYMBOL_len+1]; // IN-OUT parameter\n\n} *PTradeOrderFrame3Output;\n\n\n\ntypedef struct TTradeOrderFrame4Input\n\n{\n\n double charge_amount;\n\n double comm_amount;\n\n double requested_price;\n\n TIdent acct_id;\n\n TIdent broker_id;\n\n INT32 is_cash;\n\n INT32 is_lifo;\n\n INT32 trade_qty;\n\n INT32 type_is_market;\n\n char exec_name[cEXEC_NAME_len+1];\n\n char status_id[cST_ID_len+1];\n\n char symbol[cSYMBOL_len+1];\n\n char trade_type_id[cTT_ID_len+1];\n\n} *PTradeOrderFrame4Input;\n\n\n\ntypedef struct TTradeOrderFrame4Output\n\n{\n\n TTrade trade_id;\n\n INT32 status;\n\n} *PTradeOrderFrame4Output;\n\n\n\ntypedef struct TTradeOrderFrame5Output\n\n{\n\n INT32 status;\n\n} *PTradeOrderFrame5Output;\n\n\n\ntypedef struct TTradeOrderFrame6Output\n\n{\n\n INT32 status;\n\n} *PTradeOrderFrame6Output;\n\n\n\n\n\n/*\n\n* Trade-Result\n\n*/\n\n//Trade-Result data sent from MEE to sponsor provided SUT interface\n\ntypedef struct TTradeResultTxnInput\n\n{\n\n double trade_price;\n\n TTrade trade_id;\n\n} *PTradeResultTxnInput;\n\n\n\ntypedef struct TTradeResultTxnOutput\n\n{\n\n double acct_bal;\n\n TIdent acct_id;\n\n INT32 status;\n\n} *PTradeResultTxnOutput;\n\n\n\ntypedef struct TTradeResultFrame1Input\n\n{\n\n TTrade trade_id;\n\n} *PTradeResultFrame1Input;\n\n\n\ntypedef struct TTradeResultFrame1Output\n\n{\n\n double charge;\n\n TIdent acct_id;\n\n INT32 hs_qty;\n\n INT32 is_lifo;\n\n INT32 status;\n\n INT32 trade_is_cash;\n\n INT32 trade_qty;\n\n INT32 type_is_market;\n\n INT32 type_is_sell;\n\n char symbol[cSYMBOL_len+1];\n\n char type_id[cTT_ID_len+1];\n\n char type_name[cTT_NAME_len+1];\n\n} *PTradeResultFrame1Output;\n\n\n\ntypedef struct TTradeResultFrame2Input\n\n{\n\n double trade_price;\n\n TIdent acct_id;\n\n TTrade trade_id;\n\n INT32 hs_qty;\n\n INT32 is_lifo;\n\n INT32 trade_qty;\n\n INT32 type_is_sell;\n\n char symbol[cSYMBOL_len+1];\n\n} *PTradeResultFrame2Input;\n\n\n\ntypedef struct TTradeResultFrame2Output\n\n{\n\n double buy_value;\n\n double sell_value;\n\n TIdent broker_id;\n\n TIdent cust_id;\n\n INT32 status;\n\n INT32 tax_status;\n\n TIMESTAMP_STRUCT trade_dts;\n\n} *PTradeResultFrame2Output;\n\n\n\ntypedef struct TTradeResultFrame3Input\n\n{\n\n double buy_value;\n\n double sell_value;\n\n TIdent cust_id;\n\n TTrade trade_id;\n\n} *PTradeResultFrame3Input;\n\n\n\ntypedef struct TTradeResultFrame3Output\n\n{\n\n double tax_amount;\n\n INT32 status;\n\n} *PTradeResultFrame3Output;\n\n\n\ntypedef struct TTradeResultFrame4Input\n\n{\n\n TIdent cust_id;\n\n INT32 trade_qty;\n\n char symbol[cSYMBOL_len+1];\n\n char type_id[cTT_ID_len+1];\n\n} *PTradeResultFrame4Input;\n\n\n\ntypedef struct TTradeResultFrame4Output\n\n{\n\n double comm_rate;\n\n INT32 status;\n\n char s_name[cS_NAME_len+1];\n\n} *PTradeResultFrame4Output;\n\n\n\ntypedef struct TTradeResultFrame5Input\n\n{\n\n double comm_amount;\n\n double trade_price;\n\n TIdent broker_id;\n\n TTrade trade_id;\n\n TIMESTAMP_STRUCT trade_dts;\n\n char st_completed_id[cST_ID_len+1];\n\n} *PTradeResultFrame5Input;\n\n\n\ntypedef struct TTradeResultFrame5Output\n\n{\n\n INT32 status;\n\n} *PTradeResultFrame5Output;\n\n\n\ntypedef struct TTradeResultFrame6Input\n\n{\n\n double se_amount;\n\n TIdent acct_id;\n\n TTrade trade_id;\n\n INT32 trade_is_cash;\n\n INT32 trade_qty;\n\n TIMESTAMP_STRUCT due_date;\n\n TIMESTAMP_STRUCT trade_dts;\n\n char s_name[cS_NAME_len+1];\n\n char type_name[cTT_NAME_len+1];\n\n} *PTradeResultFrame6Input;\n\n\n\ntypedef struct TTradeResultFrame6Output\n\n{\n\n double acct_bal;\n\n INT32 status;\n\n} *PTradeResultFrame6Output;\n\n\n\n\n\n/*\n\n* Trade-Status\n\n*/\n\ntypedef struct TTradeStatusTxnInput\n\n{\n\n TIdent acct_id;\n\n} *PTradeStatusTxnInput,\n\n TTradeStatusFrame1Input, // Single-Frame transaction\n\n *PTradeStatusFrame1Input; // Single-Frame transaction\n\n\n\ntypedef struct TTradeStatusTxnOutput\n\n{\n\n TTrade trade_id[max_trade_status_len];\n\n INT32 status;\n\n char status_name[max_trade_status_len][cST_NAME_len+1];\n\n} *PTradeStatusTxnOutput;\n\n\n\ntypedef struct TTradeStatusFrame1Output\n\n{\n\n double charge[max_trade_status_len];\n\n TTrade trade_id[max_trade_status_len];\n\n INT32 trade_qty[max_trade_status_len];\n\n INT32 status;\n\n TIMESTAMP_STRUCT trade_dts[max_trade_status_len];\n\n char ex_name[max_trade_status_len][cEX_NAME_len+1];\n\n char exec_name[max_trade_status_len][cEXEC_NAME_len+1];\n\n char s_name[max_trade_status_len][cS_NAME_len+1];\n\n char status_name[max_trade_status_len][cST_NAME_len+1];\n\n char symbol[max_trade_status_len][cSYMBOL_len+1];\n\n char type_name[max_trade_status_len][cTT_NAME_len+1];\n\n char broker_name[cB_NAME_len+1];\n\n char cust_f_name[cF_NAME_len+1];\n\n char cust_l_name[cL_NAME_len+1];\n\n} *PTradeStatusFrame1Output;\n\n\n\n\n\n/*\n\n* Trade-Update\n\n*/\n\ntypedef struct TTradeUpdateTxnInput\n\n{\n\n TTrade trade_id[TradeUpdateFrame1MaxRows];\n\n TIdent acct_id;\n\n TIdent max_acct_id;\n\n INT32 frame_to_execute; // which of the frames to execute\n\n INT32 max_trades;\n\n INT32 max_updates;\n\n TIMESTAMP_STRUCT end_trade_dts;\n\n TIMESTAMP_STRUCT start_trade_dts;\n\n char symbol[cSYMBOL_len+1];\n\n} *PTradeUpdateTxnInput;\n\ntypedef struct TTradeUpdateTxnOutput\n\n{\n\n TTrade trade_list[TradeUpdateMaxRows];\n\n INT32 frame_executed; // confirmation of which frame was executed\n\n INT32 num_found;\n\n INT32 num_updated;\n\n INT32 status;\n\n bool is_cash[TradeUpdateMaxRows];\n\n bool is_market[TradeUpdateMaxRows];\n\n} *PTradeUpdateTxnOutput;\n\n\n\ntypedef struct TTradeUpdateFrame1Input\n\n{\n\n TTrade trade_id[TradeUpdateFrame1MaxRows];\n\n INT32 max_trades;\n\n INT32 max_updates;\n\n} *PTradeUpdateFrame1Input;\n\n\n\ntypedef struct TTradeUpdateFrame1TradeInfo\n\n{\n\n double bid_price;\n\n double cash_transaction_amount;\n\n double settlement_amount;\n\n double trade_price;\n\n bool is_cash;\n\n bool is_market;\n\n TIMESTAMP_STRUCT trade_history_dts[TradeUpdateMaxTradeHistoryRowsReturned];\n\n TIMESTAMP_STRUCT cash_transaction_dts;\n\n TIMESTAMP_STRUCT settlement_cash_due_date;\n\n char trade_history_status_id[TradeUpdateMaxTradeHistoryRowsReturned][cTH_ST_ID_len+1];\n\n char cash_transaction_name[cCT_NAME_len+1];\n\n char exec_name[cEXEC_NAME_len+1];\n\n char settlement_cash_type[cSE_CASH_TYPE_len+1];\n\n DB_INDICATOR trade_history_dts_ind[TradeUpdateMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR trade_history_status_id_ind[TradeUpdateMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR bid_price_ind;\n\n DB_INDICATOR cash_transaction_amount_ind;\n\n DB_INDICATOR cash_transaction_dts_ind;\n\n DB_INDICATOR cash_transaction_name_ind;\n\n DB_INDICATOR exec_name_ind;\n\n DB_INDICATOR is_cash_ind;\n\n DB_INDICATOR is_market_ind;\n\n DB_INDICATOR settlement_amount_ind;\n\n DB_INDICATOR settlement_cash_due_date_ind;\n\n DB_INDICATOR settlement_cash_type_ind;\n\n DB_INDICATOR trade_price_ind;\n\n} *PTradeUpdateFrame1TradeInfo;\n\n\n\ntypedef struct TTradeUpdateFrame1Output\n\n{\n\n INT32 num_found;\n\n INT32 num_updated;\n\n INT32 status;\n\n char zz_padding[4];\n\n TTradeUpdateFrame1TradeInfo trade_info[TradeUpdateFrame1MaxRows];\n\n} *PTradeUpdateFrame1Output;\n\n\n\ntypedef struct TTradeUpdateFrame2Input\n\n{\n\n TIdent acct_id;\n\n INT32 max_trades;\n\n INT32 max_updates;\n\n TIMESTAMP_STRUCT end_trade_dts;\n\n TIMESTAMP_STRUCT start_trade_dts;\n\n} *PTradeUpdateFrame2Input;\n\n\n\ntypedef struct TTradeUpdateFrame2TradeInfo\n\n{\n\n double bid_price;\n\n double cash_transaction_amount;\n\n double settlement_amount;\n\n double trade_price;\n\n TTrade trade_id;\n\n bool is_cash;\n\n TIMESTAMP_STRUCT trade_history_dts[TradeUpdateMaxTradeHistoryRowsReturned];\n\n TIMESTAMP_STRUCT cash_transaction_dts;\n\n TIMESTAMP_STRUCT settlement_cash_due_date;\n\n char trade_history_status_id[TradeUpdateMaxTradeHistoryRowsReturned][cTH_ST_ID_len+1];\n\n char cash_transaction_name[cCT_NAME_len+1];\n\n char exec_name[cEXEC_NAME_len+1];\n\n char settlement_cash_type[cSE_CASH_TYPE_len+1];\n\n DB_INDICATOR trade_history_dts_ind[TradeUpdateMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR trade_history_status_id_ind[TradeUpdateMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR bid_price_ind;\n\n DB_INDICATOR cash_transaction_amount_ind;\n\n DB_INDICATOR cash_transaction_dts_ind;\n\n DB_INDICATOR cash_transaction_name_ind;\n\n DB_INDICATOR exec_name_ind;\n\n DB_INDICATOR is_cash_ind;\n\n DB_INDICATOR settlement_amount_ind;\n\n DB_INDICATOR settlement_cash_due_date_ind;\n\n DB_INDICATOR settlement_cash_type_ind;\n\n DB_INDICATOR trade_id_ind;\n\n DB_INDICATOR trade_price_ind;\n\n} *PTradeUpdateFrame2TradeInfo;\n\n\n\ntypedef struct TTradeUpdateFrame2Output\n\n{\n\n INT32 num_found;\n\n INT32 num_updated;\n\n INT32 status;\n\n TTradeUpdateFrame2TradeInfo trade_info[TradeUpdateFrame2MaxRows];\n\n} *PTradeUpdateFrame2Output;\n\n\n\ntypedef struct TTradeUpdateFrame3Input\n\n{\n\n TIdent max_acct_id;\n\n INT32 max_trades;\n\n INT32 max_updates;\n\n TIMESTAMP_STRUCT end_trade_dts;\n\n TIMESTAMP_STRUCT start_trade_dts;\n\n char symbol[cSYMBOL_len+1];\n\n} *PTradeUpdateFrame3Input;\n\n\n\ntypedef struct TTradeUpdateFrame3TradeInfo\n\n{\n\n double cash_transaction_amount;\n\n double price;\n\n double settlement_amount;\n\n TIdent acct_id;\n\n TTrade trade_id;\n\n INT32 quantity;\n\n bool is_cash;\n\n TIMESTAMP_STRUCT trade_history_dts[TradeUpdateMaxTradeHistoryRowsReturned];\n\n TIMESTAMP_STRUCT cash_transaction_dts;\n\n TIMESTAMP_STRUCT settlement_cash_due_date;\n\n TIMESTAMP_STRUCT trade_dts;\n\n char trade_history_status_id[TradeUpdateMaxTradeHistoryRowsReturned][cTH_ST_ID_len+1];\n\n char cash_transaction_name[cCT_NAME_len+1];\n\n char exec_name[cEXEC_NAME_len+1];\n\n char s_name[cS_NAME_len+1];\n\n char settlement_cash_type[cSE_CASH_TYPE_len+1];\n\n char trade_type[cTT_ID_len+1];\n\n char type_name[cTT_NAME_len+1];\n\n DB_INDICATOR trade_history_dts_ind[TradeUpdateMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR trade_history_status_id_ind[TradeUpdateMaxTradeHistoryRowsReturned];\n\n DB_INDICATOR acct_id_ind;\n\n DB_INDICATOR cash_transaction_amount_ind;\n\n DB_INDICATOR cash_transaction_dts_ind;\n\n DB_INDICATOR cash_transaction_name_ind;\n\n DB_INDICATOR exec_name_ind;\n\n DB_INDICATOR is_cash_ind;\n\n DB_INDICATOR price_ind;\n\n DB_INDICATOR quantity_ind;\n\n DB_INDICATOR s_name_ind;\n\n DB_INDICATOR settlement_amount_ind;\n\n DB_INDICATOR settlement_cash_due_date_ind;\n\n DB_INDICATOR settlement_cash_type_ind;\n\n DB_INDICATOR trade_dts_ind;\n\n DB_INDICATOR trade_id_ind;\n\n DB_INDICATOR trade_type_ind;\n\n DB_INDICATOR type_name_ind;\n\n} *PTradeUpdateFrame3TradeInfo;\n\n\n\ntypedef struct TTradeUpdateFrame3Output\n\n{\n\n INT32 num_found;\n\n INT32 num_updated;\n\n INT32 status;\n\n TTradeUpdateFrame3TradeInfo trade_info[TradeUpdateFrame3MaxRows];\n\n} *PTradeUpdateFrame3Output;\n\n\n\n/*\n\n* Trade-Cleanup\n\n*/\n\ntypedef struct TTradeCleanupTxnInput\n\n{\n\n TTrade start_trade_id;\n\n char st_canceled_id[cST_ID_len+1];\n\n char st_pending_id[cST_ID_len+1];\n\n char st_submitted_id[cST_ID_len+1];\n\n} *PTradeCleanupTxnInput,\n\n TTradeCleanupFrame1Input, // Single-Frame transaction\n\n *PTradeCleanupFrame1Input; // Single-Frame transaction\n\n\n\ntypedef struct TTradeCleanupTxnOutput\n\n{\n\n INT32 status;\n\n} *PTradeCleanupTxnOutput;\n\n\n\ntypedef struct TTradeCleanupFrame1Output\n\n{\n\n INT32 status;\n\n} *PTradeCleanupFrame1Output;\n\n\n\n\n", "file_path": "egen/TestHarness/Reference/inc/TxnHarnessStructs.h", "rank": 42, "score": 92867.38233316847 }, { "content": "namespace TPCE\n\n{\n\nconst int cWORD_len = 30; // for NEWS input file\n\n\n\n//TaxableAccountName.txt and NonTaxableAccountName.txt\n\ntypedef struct TAccountNameInputRow : TBaseInputRow\n\n{\n\n char NAME[ cCA_NAME_len+1 ];\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PAccountNameInputRow;\n\n\n\n//AreaCodes.txt\n\ntypedef struct TAreaCodeInputRow : TBaseInputRow\n\n{\n\n //Phone number area\n\n char AREA_CODE[ cAREA_len+1 ];\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PAreaCodeInputRow;\n\n\n\n//Company.txt\n\ntypedef struct TCompanyInputRow : TBaseInputRow\n\n{\n\n TIdent CO_ID;\n\n char CO_ST_ID[ cST_ID_len+1 ];\n\n char CO_NAME[ cCO_NAME_len+1 ];\n\n char CO_IN_ID[ cIN_ID_len+1 ];\n\n char CO_DESC[ cCO_DESC_len+1 ];\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PCompanyInputRow;\n\n\n\n//CompanyCompetitor.txt\n\ntypedef struct TCompanyCompetitorInputRow : TBaseInputRow\n\n{\n\n TIdent CP_CO_ID;\n\n TIdent CP_COMP_CO_ID;\n\n char CP_IN_ID[cIN_ID_len+1];\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PCompanyCompetitorInputRow;\n\n\n\n//CompanySPRate.txt\n\ntypedef struct TCompanySPRateInputRow : TBaseInputRow\n\n{\n\n //Company SP Rating\n\n char CO_SP_RATE[ cCO_SP_RATE_len+1 ];\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PCompanySPRateInputRow;\n\n\n\n//MaleFirstNames.txt and FemaleFirstNames.txt\n\ntypedef struct TFirstNameInputRow : TBaseInputRow\n\n{\n\n char FIRST_NAME[cF_NAME_len+1];\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PFirstNameInputRow;\n\n\n\n\n\n//LastNames.txt\n\ntypedef struct TLastNameInputRow : TBaseInputRow\n\n{\n\n char LAST_NAME[cL_NAME_len+1];\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PLastNameInputRow;\n\n\n\n//NewsItem.txt\n\ntypedef struct TNewsInputRow : TBaseInputRow\n\n{\n\n char WORD[cWORD_len+1];\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PNewsInputRow;\n\n\n\n//Street Names.txt\n\ntypedef struct TStreetNameInputRow : TBaseInputRow\n\n{\n\n char STREET[ cAD_LINE_len+1 ];\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PStreetNameInputRow;\n\n\n\n//StreetSuffix.txt\n\ntypedef struct TStreetSuffixInputRow : TBaseInputRow\n\n{\n\n char SUFFIX[ cAD_LINE_len+1 ];\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PStreetSuffixInputRow;\n\n\n\n//Security.txt\n\ntypedef struct TSecurityInputRow : TBaseInputRow\n\n{\n\n TIdent S_ID;\n\n char S_ISSUE[ cS_ISSUE_len+1 ];\n\n char S_ST_ID[ cST_ID_len+1 ];\n\n char S_SYMB[ cSYMBOL_len+1 ];\n\n char S_EX_ID[ cEX_ID_len+1];\n\n TIdent S_CO_ID;\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PSecuritiesInputRow;\n\n\n\n//TaxRatesDivision.txt and TaxRatesCountry.txt\n\ntypedef struct TTaxRateInputRow : TBaseInputRow\n\n{\n\n char TAX_ID[ cTX_ID_len+1 ];\n\n char TAX_NAME[ cTX_NAME_len+1 ];\n\n double TAX_RATE; //the actual taxrate - needed to calculate tax for the TRADE table\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PTaxRateInputRow;\n\n\n\n//ZipCode.txt\n\ntypedef struct TZipCodeInputRow : TBaseInputRow\n\n{\n\n int iDivisionTaxKey;\n\n char ZC_CODE[cZC_CODE_len+1];\n\n char ZC_TOWN[cZC_TOWN_len+1];\n\n char ZC_DIV[cZC_DIV_len+1];\n\n\n\n void Load(istream &file); //loads itself (one row) from the input stream\n\n} *PZipCodeInputRow;\n\n\n\n\n\n/*\n\n*\n\n* Limit structures for input files.\n\n* Limit values are set in default constructors.\n\n*\n\n*/\n\n\n\n\n\n//Base structure for only the total number of elements\n\ntypedef struct TBaseElementsLimits\n\n{\n\n int m_iTotalElements;\n\n\n\n //Constructor\n\n TBaseElementsLimits()\n\n : m_iTotalElements(0)\n\n {\n\n };\n\n\n\n int TotalElements() {return m_iTotalElements;}\n\n virtual ~TBaseElementsLimits() {}\n", "file_path": "egen/TestHarness/Reference/inc/InputFlatFilesDeclarations.h", "rank": 43, "score": 91761.08412297453 }, { "content": "namespace TPCE\n\n{\n\n\n\nenum eMEETradeRequestAction\n\n{\n\n eMEEProcessOrder = 0,\n\n eMEESetLimitOrderTrigger\n\n};\n\n\n", "file_path": "egen/TestHarness/Reference/inc/MEETradeRequestActions.h", "rank": 44, "score": 91761.08412297453 }, { "content": "namespace TPCE\n\n{\n\n\n\nstatic const TIdent iDefaultStartFromCustomer = 1;\n\n\n\n// Minimum number of customers in a database.\n\n// Broker-Volume transations requires 40 broker names as input,\n\n// which translates into minimum 4000 customers in a database.\n\n//\n\nconst UINT iDefaultCustomerCount = 5000;\n\n\n\nconst int iBrokersDiv = 100; // by what number to divide the customer count to get the broker count\n\n\n\n// Number of customers in default load unit.\n\n// Note: this value must not be changed. EGen code depends\n\n// on load unit consisting of exactly 1000 customers.\n\n//\n\nconst UINT iDefaultLoadUnitSize = 1000;\n\n\n\n// Number by which all IDENT_T columns (C_ID, CA_ID, etc.) are shifted.\n\n//\n\nconst TIdent iTIdentShift = UINT64_CONST(4300000000); // 4.3 billion\n\n//const TIdent iTIdentShift = UINT64_CONST(0);\n\n\n\n// Number by which all TRADE_T columns (T_ID, TH_T_ID, etc.) are shifted.\n\n//\n\nconst TTrade iTTradeShift = UINT64_CONST(200000000000000); // 200 trillion (2 * 10^14)\n\n//const TTrade iTTradeShift = UINT64_CONST(0);\n\n\n", "file_path": "egen/TestHarness/Reference/inc/EGenTables_stdafx.h", "rank": 45, "score": 91761.08412297453 }, { "content": "class CEGenTestSUT: public RefTPCE::CCESUTInterface, public RefTPCE::CDMSUTInterface, public TPCE::CCESUTInterface, public TPCE::CDMSUTInterface\n\n{\n\n TTxnInputRefTPCE m_RefInput;\n\n TTxnInputTPCE m_CurrentInput;\n\n\n\npublic:\n\n\n\n CEGenTestSUT();\n\n\n\n // RefTPCE::CCESUTInterface\n\n //\n\n virtual bool BrokerVolume( RefTPCE::PBrokerVolumeTxnInput pTxnInput ); // return whether it was successful\n\n virtual bool CustomerPosition( RefTPCE::PCustomerPositionTxnInput pTxnInput ); // return whether it was successful \n\n virtual bool MarketWatch( RefTPCE::PMarketWatchTxnInput pTxnInput ); // return whether it was successful\n\n virtual bool SecurityDetail( RefTPCE::PSecurityDetailTxnInput pTxnInput ); // return whether it was successful\n\n virtual bool TradeLookup( RefTPCE::PTradeLookupTxnInput pTxnInput ); // return whether it was successful\n\n virtual bool TradeOrder( RefTPCE::PTradeOrderTxnInput pTxnInput, INT32 iTradeType, bool bExecutorIsAccountOwner ); // return whether it was successful\n\n virtual bool TradeStatus( RefTPCE::PTradeStatusTxnInput pTxnInput ); // return whether it was successful\n\n virtual bool TradeUpdate( RefTPCE::PTradeUpdateTxnInput pTxnInput ); // return whether it was successful\n\n\n", "file_path": "egen/TestHarness/EGenTest/inc/EGenTestSUT.h", "rank": 46, "score": 80449.22889823877 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006-2010 Rilson Nascimento\n\n *\n\n * DM - SUT Interface class\n\n * 12 August 2006\n\n */\n\n\n\n#ifndef DM_SUT_H\n\n#define DM_SUT_H\n\n\n\n#include \"DM.h\"\n\n#include \"locking.h\"\n\n\n\n#include \"BaseInterface.h\"\n\nusing namespace TPCE;\n\n\n", "file_path": "src/include/DMSUT.h", "rank": 47, "score": 58908.7669880016 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006-2010 Rilson Nascimento\n\n *\n\n * This class represents the workload driver\n\n * 03 August 2006\n\n */\n\n\n\n#ifndef CUSTOMER_H\n\n#define CUSTOMER_H\n\n\n\n#include \"EGenLogger.h\"\n\n#include \"InputFlatFilesStructure.h\"\n\n#include \"locking.h\"\n\n\n\n#include \"CESUT.h\"\n\nusing namespace TPCE;\n\n\n", "file_path": "src/include/Customer.h", "rank": 48, "score": 58908.5899848682 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006-2010 Rilson Nascimento\n\n *\n\n * MEE (Market Exchange Emulator) - SUT Interface class\n\n * 30 July 2006\n\n */\n\n\n\n#ifndef MEE_SUT_H\n\n#define MEE_SUT_H\n\n\n\n#include \"MEESUTInterface.h\"\n\n#include \"locking.h\"\n\n#include \"MEE.h\"\n\n\n\n#include \"BaseInterface.h\"\n\nusing namespace TPCE;\n\n\n", "file_path": "src/include/MEESUT.h", "rank": 49, "score": 58908.40904448752 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006-2010 Rilson Nascimento\n\n *\n\n * CE (Customer Emulator) - SUT (Brokerage House) connection class\n\n * 28 July 2006\n\n */\n\n\n\n#ifndef CE_SUT_H\n\n#define CE_SUT_H\n\n\n\n#include \"CE.h\"\n\n#include \"CESUTInterface.h\"\n\n#include \"locking.h\"\n\n\n\n#include \"BaseInterface.h\"\n\nusing namespace TPCE;\n\n\n", "file_path": "src/include/CESUT.h", "rank": 50, "score": 58908.319917944376 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006-2010 Rilson Nascimento\n\n *\n\n * This class represents the workload driver\n\n * 03 August 2006\n\n */\n\n\n\n#ifndef DRIVER_H\n\n#define DRIVER_H\n\n\n\n#include \"EGenLogFormatterTab.h\"\n\n#include \"EGenLogger.h\"\n\n#include \"InputFlatFilesStructure.h\"\n\n#include \"DMSUT.h\"\n\n#include \"locking.h\"\n\n\n\nusing namespace TPCE;\n\n\n", "file_path": "src/include/Driver.h", "rank": 51, "score": 58908.20986921029 }, { "content": "\tfriend void *DMWorkerThread(void *);\n\n\tfriend void EntryDMWorkerThread(CCustomer *);\n\npublic:\n\n\tCCustomer(char *szInDir, TIdent iConfiguredCustomerCount,\n\n\t\t\tTIdent iActiveCustomerCount, INT32 iScaleFactor,\n\n\t\t\tINT32 iDaysOfInitialTrades, UINT32 UniqueId, char *szBHaddr,\n\n\t\t\tint iBHlistenPort, int iUsers, int iPacingDelay,\n\n\t\t\tchar *outputDirectory, ofstream *m_fMix, CMutex *m_MixLock);\n\n\t~CCustomer();\n\n\n\n\tvoid DoTxn();\n\n\tvoid RunTest(int, int);\n\n};\n\n\n\n#endif // CUSTOMER_H\n", "file_path": "src/include/Customer.h", "rank": 52, "score": 58906.890703129226 }, { "content": "public:\n\n\tchar szInDir[iMaxPath + 1];\n\n\tTIdent iConfiguredCustomerCount;\n\n\tTIdent iActiveCustomerCount;\n\n\tINT32 iScaleFactor;\n\n\tINT32 iDaysOfInitialTrades;\n\n\tUINT32 iSeed;\n\n\tchar szBHaddr[iMaxHostname + 1];\n\n\tint iBHlistenPort;\n\n\tint iUsers;\n\n\tint iPacingDelay;\n\n\tchar outputDirectory[iMaxPath + 1];\n\n\tCMutex m_MixLock;\n\n\tCDMSUT *m_pCDMSUT;\n\n\tCDM *m_pCDM;\n\n\n\n\tCDriver(char *, TIdent, TIdent, INT32, INT32, UINT32, char *, int, int,\n\n\t\t\tint, char *);\n\n\t~CDriver();\n\n\n", "file_path": "src/include/Driver.h", "rank": 53, "score": 58901.23275085124 }, { "content": "\tfriend void *TradeResultAsync(void *);\n\n\tfriend bool RunTradeResultAsync(void *);\n\n\n\n\tfriend void *MarketFeedAsync(void *);\n\n\tfriend bool RunMarketFeedAsync(void *);\n\n};\n\n\n\n//parameter structure for the threads\n\ntypedef struct TMEESUTThreadParam\n\n{\n\n\tCMEESUT *pCMEESUT;\n\n\tunion\n\n\t{\n\n\t\tTTradeResultTxnInput m_TradeResultTxnInput;\n\n\t\tTMarketFeedTxnInput m_MarketFeedTxnInput;\n\n\t} TxnInput;\n\n} *PMEESUTThreadParam;\n\n\n\n#endif // MEE_SUT_H\n", "file_path": "src/include/MEESUT.h", "rank": 54, "score": 58899.86351100441 }, { "content": "\tvoid runTest(int, int);\n\n};\n\n\n\n//parameter structure for the threads\n\ntypedef struct TCustomerThreadParam\n\n{\n\n\tCDriver *pDriver;\n\n} *PCustomerThreadParam;\n\n\n\n\n\n#endif // DRIVER_H\n", "file_path": "src/include/Driver.h", "rank": 55, "score": 58898.95985501474 }, { "content": "\t\t\tbool bExecutorIsAccountOwner );\n\n\t// return whether it was successful\n\n\tvirtual bool TradeStatus( PTradeStatusTxnInput pTxnInput );\n\n\t// return whether it was successful\n\n\tvirtual bool TradeUpdate( PTradeUpdateTxnInput pTxnInput );\n\n\n\nprivate:\n\n\n\n\tstruct TMsgDriverBrokerage request;\n\n};\n\n\n\n#endif\t// CE_SUT_H\n", "file_path": "src/include/CESUT.h", "rank": 56, "score": 58893.84859605773 }, { "content": "class CNullLoaderFactory : public CBaseLoaderFactory\n\n{\n\n\n\npublic:\n\n\n\n // Functions to create loader classes for individual tables.\n\n\n\n virtual CBaseLoader<ACCOUNT_PERMISSION_ROW>* CreateAccountPermissionLoader()\n\n {\n\n return new CNullLoader<ACCOUNT_PERMISSION_ROW>();\n\n };\n\n\n\n virtual CBaseLoader<ADDRESS_ROW>* CreateAddressLoader()\n\n {\n\n return new CNullLoader<ADDRESS_ROW>();\n\n };\n\n\n\n virtual CBaseLoader<BROKER_ROW>* CreateBrokerLoader()\n\n {\n\n return new CNullLoader<BROKER_ROW>();\n", "file_path": "egen/inc/NullLoaderFactory.h", "rank": 57, "score": 58322.40082940743 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006-2010 Rilson Nascimento\n\n *\n\n * MEE (Market Exchange Emulator) - SUT Interface test class\n\n * 23 July 2006\n\n */\n\n\n\n#ifndef MEE_SUT_TEST_H\n\n#define MEE_SUT_TEST_H\n\n\n\n#include \"MiscConsts.h\"\n\n#include \"MEESUTInterface.h\"\n\n\n\n#include \"DBConnection.h\"\n\nusing namespace TPCE;\n\n\n", "file_path": "src/include/MEESUTtest.h", "rank": 58, "score": 57095.303894032164 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006 Rilson Nascimento\n\n * 2010 Mark Wong\n\n *\n\n * PostgreSQL connection class\n\n * 13 June 2006\n\n */\n\n\n\n#ifndef DB_CONNECTION_H\n\n#define DB_CONNECTION_H\n\n\n\n#include <libpq-fe.h>\n\n\n\n#include \"TxnHarnessStructs.h\"\n\n#include \"TxnHarnessSendToMarket.h\"\n\n\n\n#include \"BrokerageHouse.h\"\n\n#include \"DBT5Consts.h\"\n\nusing namespace TPCE;\n\n\n", "file_path": "src/include/DBConnection.h", "rank": 59, "score": 57095.11707777105 }, { "content": "#include \"TxnHarnessCustomerPosition.h\"\n\n#include \"TxnHarnessDataMaintenance.h\"\n\n#include \"TxnHarnessMarketFeed.h\"\n\n#include \"TxnHarnessMarketWatch.h\"\n\n#include \"TxnHarnessSecurityDetail.h\"\n\n#include \"TxnHarnessTradeCleanup.h\"\n\n#include \"TxnHarnessTradeLookup.h\"\n\n#include \"TxnHarnessTradeOrder.h\"\n\n#include \"TxnHarnessTradeResult.h\"\n\n#include \"TxnHarnessTradeStatus.h\"\n\n#include \"TxnHarnessTradeUpdate.h\"\n\n\n\n#include \"DBT5Consts.h\"\n\n#include \"CSocket.h\"\n\nusing namespace TPCE;\n\n\n", "file_path": "src/include/BrokerageHouse.h", "rank": 60, "score": 57094.2368330416 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006-2010 Rilson Nascimento\n\n *\n\n * Base class for emulator-SUT interface\n\n * 13 August 2006\n\n */\n\n\n\n#ifndef BASE_INTERFACE_H\n\n#define BASE_INTERFACE_H\n\n\n\n#include \"locking.h\"\n\n\n\n#include \"CommonStructs.h\"\n\n#include \"CSocket.h\"\n\nusing namespace TPCE;\n\n\n", "file_path": "src/include/BaseInterface.h", "rank": 61, "score": 57091.12101383545 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006 Rilson Nascimento\n\n * 2010 Mark Wong\n\n *\n\n * This class represents the Market Exchange driver\n\n * 30 July 2006\n\n */\n\n\n\n#ifndef MARKET_EXCHANGE_H\n\n#define MARKET_EXCHANGE_H\n\n\n\n#include \"EGenLogFormatterTab.h\"\n\n#include \"EGenLogger.h\"\n\n#include \"SecurityFile.h\"\n\n#include \"locking.h\"\n\n\n\n#include \"CSocket.h\"\n\n#include \"MEESUT.h\"\n\nusing namespace TPCE;\n\n\n", "file_path": "src/include/MarketExchange.h", "rank": 62, "score": 57090.28668054632 }, { "content": "\n\n\tCMarketExchange(char *, TIdent, TIdent, int, char *, int, char *);\n\n\t~CMarketExchange();\n\n\n\n\tvoid logErrorMessage(const string);\n\n\tvoid startListener(void);\n\n};\n\n\n\n//parameter structure for the threads\n\ntypedef struct TMarketThreadParam\n\n{\n\n\tCMarketExchange *pMarketExchange;\n\n\tint iSockfd;\n\n} *PMarketThreadParam;\n\n\n\n#endif // MARKET_EXCHANGE_H\n", "file_path": "src/include/MarketExchange.h", "rank": 63, "score": 57089.21189341606 }, { "content": "#include \"TxnHarnessSecurityDetail.h\"\n\n#include \"TxnHarnessTradeCleanup.h\"\n\n#include \"TxnHarnessTradeLookup.h\"\n\n#include \"TxnHarnessTradeOrder.h\"\n\n#include \"TxnHarnessTradeResult.h\"\n\n#include \"TxnHarnessTradeStatus.h\"\n\n#include \"TxnHarnessTradeUpdate.h\"\n\n\n\n#include \"DM.h\"\n\n\n\n#include \"DBConnection.h\"\n\n\n\n#include \"BrokerVolumeDB.h\"\n\n#include \"CustomerPositionDB.h\"\n\n#include \"DataMaintenanceDB.h\"\n\n#include \"MarketFeedDB.h\"\n\n#include \"MarketWatchDB.h\"\n\n#include \"SecurityDetailDB.h\"\n\n#include \"TradeCleanupDB.h\"\n\n#include \"TradeLookupDB.h\"\n\n#include \"TradeOrderDB.h\"\n\n#include \"TradeResultDB.h\"\n\n#include \"TradeStatusDB.h\"\n\n#include \"TradeUpdateDB.h\"\n\nusing namespace TPCE;\n\n\n", "file_path": "src/include/DMSUTtest.h", "rank": 64, "score": 57088.45407825866 }, { "content": "\tvoid throwError(CSocketErr::Action);\n\n\tint resolveProto(const char *);\n\n\n\n\tchar address[iMaxHostname + 1];\n\n\tint port;\n\n\n\n\tint m_listenfd; // listen socket\n\n\tint m_sockfd; // accept socket\n\n};\n\n\n\n#endif // SOCKET_H\n", "file_path": "src/include/CSocket.h", "rank": 65, "score": 57088.41985318088 }, { "content": "\t\t\tCSecurityDetail &SecurityDetail);\n\n\tINT32 RunTradeStatus(PTradeStatusTxnInput pTxnInput,\n\n\t\t\tCTradeStatus &TradeStatus);\n\n\tINT32 RunTradeLookup(PTradeLookupTxnInput pTxnInput,\n\n\t\t\tCTradeLookup &TradeLookup);\n\n\tINT32 RunTradeOrder(PTradeOrderTxnInput pTxnInput,\n\n\t\t\tCTradeOrder &TradeOrder);\n\n\tINT32 RunTradeResult(PTradeResultTxnInput pTxnInput,\n\n\t\t\tCTradeResult &TradeResult);\n\n\tINT32 RunTradeUpdate(PTradeUpdateTxnInput pTxnInput,\n\n\t\t\tCTradeUpdate &TradeUpdate);\n\n\n\n\tfriend void *workerThread(void *);\n\n\n\npublic:\n\n\tCBrokerageHouse(const char *, const char *, const char *, const int,\n\n\t\t\t\tchar *);\n\n\t~CBrokerageHouse();\n\n\n\n\tvoid logErrorMessage(const string sErr, bool bScreen = true);\n", "file_path": "src/include/BrokerageHouse.h", "rank": 66, "score": 57088.38220117698 }, { "content": "\tvirtual bool MarketFeed( PMarketFeedTxnInput);\n\n\t\n\n\tfriend void *TradeResultAsync(void *);\n\n\tfriend bool RunTradeResultAsync(CMEESUTtest *);\n\n\n\n\tfriend void *MarketFeedAsync(void *);\n\n\tfriend bool RunMarketFeedAsync(CMEESUTtest *);\n\n\n\n\tTIdent iConfiguredCustomerCount;\n\n\tTIdent iActiveCustomerCount;\n\n\tchar szInDir[iMaxPath + 1];\n\n};\n\n\n\n#endif\t// MEE_SUT_TEST_H\n", "file_path": "src/include/MEESUTtest.h", "rank": 67, "score": 57087.22611775076 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006 Rilson Nascimento\n\n * 2010 Mark Wong\n\n *\n\n * This class represents the Brokerage House\n\n * 25 July 2006\n\n */\n\n\n\n#ifndef BROKERAGE_HOUSE_H\n\n#define BROKERAGE_HOUSE_H\n\n\n\n#include <fstream>\n\nusing namespace std;\n\n\n\n#include \"locking.h\"\n\n#include \"TxnHarnessStructs.h\"\n\n#include \"TxnHarnessBrokerVolume.h\"\n", "file_path": "src/include/BrokerageHouse.h", "rank": 68, "score": 57085.97269895554 }, { "content": "\tchar *escape(string);\n\n\tvoid disconnect();\n\n\n\n\tPGresult *exec(const char *);\n\n\n\n\tvoid execute(const TBrokerVolumeFrame1Input *,\n\n\t\t\tTBrokerVolumeFrame1Output *);\n\n\n\n\tvoid execute(const TCustomerPositionFrame1Input *,\n\n\t\t\tTCustomerPositionFrame1Output *);\n\n\tvoid execute(const TCustomerPositionFrame2Input *,\n\n\t\t\tTCustomerPositionFrame2Output *);\n\n\n\n\tvoid execute(const TDataMaintenanceFrame1Input *);\n\n\n\n\tvoid execute(const TMarketFeedFrame1Input *, TMarketFeedFrame1Output *,\n\n\t\t\tCSendToMarketInterface *);\n\n\n\n\tvoid execute(const TMarketWatchFrame1Input *, TMarketWatchFrame1Output *);\n\n\n", "file_path": "src/include/DBConnection.h", "rank": 69, "score": 57081.97903576988 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006 Rilson Nascimento\n\n * 2010 Mark Wong\n\n *\n\n * Socket class for C++ (based on dbt2 _socket)\n\n * 25 June 2006\n\n */\n\n\n\n#ifndef SOCKET_H\n\n#define SOCKET_H\n\n\n\n#include <unistd.h>\n\n#include <netdb.h>\n\n#include <sys/types.h>\n\n#include <sys/socket.h>\n\n#include <netinet/in.h>\n\n#include <arpa/inet.h>\n\n#include <errno.h>\n\n\n\n#include \"CThreadErr.h\"\n\n#include \"MiscConsts.h\"\n\n\n", "file_path": "src/include/CSocket.h", "rank": 70, "score": 57081.606580352636 }, { "content": "\n\n\tvoid startListener(void);\n\n};\n\n\n\n//parameter structure for the threads\n\ntypedef struct TThreadParameter\n\n{\n\n\tCBrokerageHouse* pBrokerageHouse;\n\n\tint iSockfd;\n\n} *PThreadParameter;\n\n\n\n#endif // BROKERAGE_HOUSE_H\n", "file_path": "src/include/BrokerageHouse.h", "rank": 71, "score": 57081.28971135315 }, { "content": "\tvoid execute(const TTradeResultFrame6Input *, TTradeResultFrame6Output *);\n\n\n\n\tvoid execute(const TTradeStatusFrame1Input *, TTradeStatusFrame1Output *);\n\n\n\n\tvoid execute(const TTradeUpdateFrame1Input *, TTradeUpdateFrame1Output *);\n\n\tvoid execute(const TTradeUpdateFrame2Input *, TTradeUpdateFrame2Output *);\n\n\tvoid execute(const TTradeUpdateFrame3Input *, TTradeUpdateFrame3Output *);\n\n\n\n\tvoid reconnect();\n\n\n\n\tvoid rollback();\n\n\n\n\tvoid setBrokerageHouse(CBrokerageHouse *);\n\n\n\n\tvoid setReadCommitted();\n\n\tvoid setReadUncommitted();\n\n\tvoid setRepeatableRead();\n\n\tvoid setSerializable();\n\n};\n\n\n\n#endif //DB_CONNECTION_H\n", "file_path": "src/include/DBConnection.h", "rank": 72, "score": 57076.92847465612 }, { "content": "\tvoid execute(const TSecurityDetailFrame1Input *,\n\n\t\t\tTSecurityDetailFrame1Output *);\n\n\n\n\tvoid execute(const TTradeCleanupFrame1Input *);\n\n\n\n\tvoid execute(const TTradeLookupFrame1Input *, TTradeLookupFrame1Output *);\n\n\tvoid execute(const TTradeLookupFrame2Input *, TTradeLookupFrame2Output *);\n\n\tvoid execute(const TTradeLookupFrame3Input *, TTradeLookupFrame3Output *);\n\n\tvoid execute(const TTradeLookupFrame4Input *, TTradeLookupFrame4Output *);\n\n\n\n\tvoid execute(const TTradeOrderFrame1Input *, TTradeOrderFrame1Output *);\n\n\tvoid execute(const TTradeOrderFrame2Input *, TTradeOrderFrame2Output *);\n\n\tvoid execute(const TTradeOrderFrame3Input *, TTradeOrderFrame3Output *);\n\n\tvoid execute(const TTradeOrderFrame4Input *, TTradeOrderFrame4Output *);\n\n\n\n\tvoid execute(const TTradeResultFrame1Input *, TTradeResultFrame1Output *);\n\n\tvoid execute(const TTradeResultFrame2Input *, TTradeResultFrame2Output *);\n\n\tvoid execute(const TTradeResultFrame3Input *, TTradeResultFrame3Output *);\n\n\tvoid execute(const TTradeResultFrame4Input *, TTradeResultFrame4Output *);\n\n\tvoid execute(const TTradeResultFrame5Input *);\n", "file_path": "src/include/DBConnection.h", "rank": 73, "score": 57076.722743076774 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006-2010 Rilson Nascimento\n\n *\n\n * DM - SUT Interface class\n\n * 17 July 2006\n\n */\n\n\n\n#ifndef DM_SUT_TEST_H\n\n#define DM_SUT_TEST_H\n\n\n\n#include \"DMSUTInterface.h\"\n\n\n\n#include \"TxnHarnessBrokerVolume.h\"\n\n#include \"TxnHarnessCustomerPosition.h\"\n\n#include \"TxnHarnessDataMaintenance.h\"\n\n#include \"TxnHarnessMarketFeed.h\"\n\n#include \"TxnHarnessMarketWatch.h\"\n", "file_path": "src/include/DMSUTtest.h", "rank": 74, "score": 57076.68295656195 }, { "content": "\tvoid dumpInputData(PSecurityDetailTxnInput);\n\n\tvoid dumpInputData(PTradeStatusTxnInput);\n\n\tvoid dumpInputData(PTradeLookupTxnInput);\n\n\tvoid dumpInputData(PTradeOrderTxnInput);\n\n\tvoid dumpInputData(PTradeResultTxnInput);\n\n\tvoid dumpInputData(PTradeUpdateTxnInput);\n\n\n\n\tINT32 RunBrokerVolume(PBrokerVolumeTxnInput pTxnInput,\n\n\t\t\tCBrokerVolume &BrokerVolume);\n\n\tINT32 RunCustomerPosition(PCustomerPositionTxnInput pTxnInput,\n\n\t\t\tCCustomerPosition &CustomerPosition);\n\n\tINT32 RunDataMaintenance(PDataMaintenanceTxnInput pTxnInput,\n\n\t\t\tCDataMaintenance &DataMaintenance);\n\n\tINT32 RunTradeCleanup(PTradeCleanupTxnInput pTxnInput,\n\n\t\t\tCTradeCleanup &TradeCleanup);\n\n\tINT32 RunMarketWatch(PMarketWatchTxnInput pTxnInput,\n\n\t\t\tCMarketWatch &MarketWatch);\n\n\tINT32 RunMarketFeed(PMarketFeedTxnInput pTxnInput,\n\n\t\t\tCMarketFeed &MarketFeed);\n\n\tINT32 RunSecurityDetail(PSecurityDetailTxnInput pTxnInput,\n", "file_path": "src/include/BrokerageHouse.h", "rank": 75, "score": 57075.76201537664 }, { "content": "class CNullLoaderFactory : public CBaseLoaderFactory\n\n{\n\n\n\npublic:\n\n\n\n // Functions to create loader classes for individual tables.\n\n\n\n virtual CBaseLoader<ACCOUNT_PERMISSION_ROW>* CreateAccountPermissionLoader()\n\n {\n\n return new CNullLoader<ACCOUNT_PERMISSION_ROW>();\n\n };\n\n\n\n virtual CBaseLoader<ADDRESS_ROW>* CreateAddressLoader()\n\n {\n\n return new CNullLoader<ADDRESS_ROW>();\n\n };\n\n\n\n virtual CBaseLoader<BROKER_ROW>* CreateBrokerLoader()\n\n {\n\n return new CNullLoader<BROKER_ROW>();\n", "file_path": "egen/TestHarness/Reference/inc/NullLoaderFactory.h", "rank": 76, "score": 55690.34388698706 }, { "content": "#ifndef NULL_LOADER_FACTORY_H\n\n#define NULL_LOADER_FACTORY_H\n\n\n\n#include \"BaseLoader.h\"\n\n#include \"BaseLoaderFactory.h\"\n\n#include \"NullLoader.h\"\n\n#include \"Table_Defs.h\"\n\n\n\nnamespace TPCE\n\n{\n\n\n", "file_path": "egen/inc/NullLoaderFactory.h", "rank": 77, "score": 55445.78140166676 }, { "content": "\n\n virtual CBaseLoader<WATCH_LIST_ROW>* CreateWatchListLoader()\n\n {\n\n return new CNullLoader<WATCH_LIST_ROW>();\n\n };\n\n\n\n virtual CBaseLoader<ZIP_CODE_ROW>* CreateZipCodeLoader()\n\n {\n\n return new CNullLoader<ZIP_CODE_ROW>();\n\n };\n\n};\n\n\n\n} // namespace TPCE\n\n\n\n#endif //NULL_LOADER_FACTORY_H\n", "file_path": "egen/inc/NullLoaderFactory.h", "rank": 78, "score": 55443.573838553726 }, { "content": " virtual CBaseLoader<SECTOR_ROW>* CreateSectorLoader()\n\n {\n\n return new CNullLoader<SECTOR_ROW>();\n\n };\n\n virtual CBaseLoader<SECURITY_ROW>* CreateSecurityLoader()\n\n {\n\n return new CNullLoader<SECURITY_ROW>();\n\n };\n\n virtual CBaseLoader<SETTLEMENT_ROW>* CreateSettlementLoader()\n\n {\n\n return new CNullLoader<SETTLEMENT_ROW>();\n\n };\n\n virtual CBaseLoader<STATUS_TYPE_ROW>* CreateStatusTypeLoader()\n\n {\n\n return new CNullLoader<STATUS_TYPE_ROW>();\n\n };\n\n virtual CBaseLoader<TAXRATE_ROW>* CreateTaxrateLoader()\n\n {\n\n return new CNullLoader<TAXRATE_ROW>();\n\n };\n", "file_path": "egen/inc/NullLoaderFactory.h", "rank": 79, "score": 55434.827819118305 }, { "content": " virtual CBaseLoader<DAILY_MARKET_ROW>* CreateDailyMarketLoader()\n\n {\n\n return new CNullLoader<DAILY_MARKET_ROW>();\n\n };\n\n virtual CBaseLoader<EXCHANGE_ROW>* CreateExchangeLoader()\n\n {\n\n return new CNullLoader<EXCHANGE_ROW>();\n\n };\n\n virtual CBaseLoader<FINANCIAL_ROW>* CreateFinancialLoader()\n\n {\n\n return new CNullLoader<FINANCIAL_ROW>();\n\n };\n\n virtual CBaseLoader<HOLDING_ROW>* CreateHoldingLoader()\n\n {\n\n return new CNullLoader<HOLDING_ROW>();\n\n };\n\n virtual CBaseLoader<HOLDING_HISTORY_ROW>* CreateHoldingHistoryLoader()\n\n {\n\n return new CNullLoader<HOLDING_HISTORY_ROW>();\n\n };\n", "file_path": "egen/inc/NullLoaderFactory.h", "rank": 80, "score": 55434.76490128024 }, { "content": " virtual CBaseLoader<TRADE_HISTORY_ROW>* CreateTradeHistoryLoader()\n\n {\n\n return new CNullLoader<TRADE_HISTORY_ROW>();\n\n };\n\n virtual CBaseLoader<TRADE_ROW>* CreateTradeLoader()\n\n {\n\n return new CNullLoader<TRADE_ROW>();\n\n };\n\n virtual CBaseLoader<TRADE_REQUEST_ROW>* CreateTradeRequestLoader()\n\n {\n\n return new CNullLoader<TRADE_REQUEST_ROW>();\n\n };\n\n virtual CBaseLoader<TRADE_TYPE_ROW>* CreateTradeTypeLoader()\n\n {\n\n return new CNullLoader<TRADE_TYPE_ROW>();\n\n };\n\n virtual CBaseLoader<WATCH_ITEM_ROW>* CreateWatchItemLoader()\n\n {\n\n return new CNullLoader<WATCH_ITEM_ROW>();\n\n };\n", "file_path": "egen/inc/NullLoaderFactory.h", "rank": 81, "score": 55434.640786399585 }, { "content": " virtual CBaseLoader<HOLDING_SUMMARY_ROW>* CreateHoldingSummaryLoader()\n\n {\n\n return new CNullLoader<HOLDING_SUMMARY_ROW>();\n\n };\n\n virtual CBaseLoader<INDUSTRY_ROW>* CreateIndustryLoader()\n\n {\n\n return new CNullLoader<INDUSTRY_ROW>();\n\n };\n\n virtual CBaseLoader<LAST_TRADE_ROW>* CreateLastTradeLoader()\n\n {\n\n return new CNullLoader<LAST_TRADE_ROW>();\n\n };\n\n virtual CBaseLoader<NEWS_ITEM_ROW>* CreateNewsItemLoader()\n\n {\n\n return new CNullLoader<NEWS_ITEM_ROW>();\n\n };\n\n virtual CBaseLoader<NEWS_XREF_ROW>* CreateNewsXRefLoader()\n\n {\n\n return new CNullLoader<NEWS_XREF_ROW>();\n\n };\n", "file_path": "egen/inc/NullLoaderFactory.h", "rank": 82, "score": 55434.62032026801 }, { "content": " };\n\n\n\n virtual CBaseLoader<COMPANY_ROW>* CreateCompanyLoader()\n\n {\n\n return new CNullLoader<COMPANY_ROW>();\n\n };\n\n\n\n virtual CBaseLoader<CUSTOMER_ACCOUNT_ROW>* CreateCustomerAccountLoader()\n\n {\n\n return new CNullLoader<CUSTOMER_ACCOUNT_ROW>();\n\n };\n\n\n\n virtual CBaseLoader<CUSTOMER_ROW>* CreateCustomerLoader()\n\n {\n\n return new CNullLoader<CUSTOMER_ROW>();\n\n };\n\n virtual CBaseLoader<CUSTOMER_TAXRATE_ROW>* CreateCustomerTaxrateLoader()\n\n {\n\n return new CNullLoader<CUSTOMER_TAXRATE_ROW>();\n\n };\n", "file_path": "egen/inc/NullLoaderFactory.h", "rank": 83, "score": 55434.567759864636 }, { "content": " };\n\n\n\n virtual CBaseLoader<CASH_TRANSACTION_ROW>* CreateCashTransactionLoader()\n\n {\n\n return new CNullLoader<CASH_TRANSACTION_ROW>();\n\n };\n\n\n\n virtual CBaseLoader<CHARGE_ROW>* CreateChargeLoader()\n\n {\n\n return new CNullLoader<CHARGE_ROW>();\n\n };\n\n\n\n virtual CBaseLoader<COMMISSION_RATE_ROW>* CreateCommissionRateLoader()\n\n {\n\n return new CNullLoader<COMMISSION_RATE_ROW>();\n\n };\n\n\n\n virtual CBaseLoader<COMPANY_COMPETITOR_ROW>* CreateCompanyCompetitorLoader()\n\n {\n\n return new CNullLoader<COMPANY_COMPETITOR_ROW>();\n", "file_path": "egen/inc/NullLoaderFactory.h", "rank": 84, "score": 55434.492153663494 }, { "content": " * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,\n\n * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT\n\n * WITH REGARD TO THE WORK.\n\n * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO\n\n * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE\n\n * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS\n\n * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,\n\n * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,\n\n * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT\n\n * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD\n\n * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.\n\n *\n\n * Contributors\n\n * - Sergey Vasilevskiy\n\n */\n\n\n\n/*\n\n* Null loader class factory.\n\n* This class instantiates particular table loader classes.\n\n*/\n", "file_path": "egen/inc/NullLoaderFactory.h", "rank": 85, "score": 55433.68355596091 }, { "content": "/*\n\n * Legal Notice\n\n *\n\n * This document and associated source code (the \"Work\") is a part of a\n\n * benchmark specification maintained by the TPC.\n\n *\n\n * The TPC reserves all right, title, and interest to the Work as provided\n\n * under U.S. and international laws, including without limitation all patent\n\n * and trademark rights therein.\n\n *\n\n * No Warranty\n\n *\n\n * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION\n\n * CONTAINED HEREIN IS PROVIDED \"AS IS\" AND WITH ALL FAULTS, AND THE\n\n * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER\n\n * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,\n\n * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,\n\n * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR\n\n * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF\n\n * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.\n", "file_path": "egen/inc/NullLoaderFactory.h", "rank": 86, "score": 55426.53112128274 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006 Rilson Nascimento\n\n * 2010 Mark Wong\n\n *\n\n * Base class for transacation classes\n\n * 13 June 2006\n\n */\n\n\n\n#ifndef TXN_BASE_DB_H\n\n#define TXN_BASE_DB_H\n\n\n\n#include <string>\n\nusing namespace std;\n\n\n\n#include \"DBT5Consts.h\"\n\nusing namespace TPCE;\n\n\n\n#include \"DBConnection.h\"\n\n#include \"locking.h\"\n\n\n", "file_path": "src/include/TxnBaseDB.h", "rank": 87, "score": 55389.09386428307 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006-2010 Rilson Nascimento\n\n *\n\n * 08 July 2006\n\n */\n\n\n\n#ifndef TRADE_LOOKUP_DB_H\n\n#define TRADE_LOOKUP_DB_H\n\n\n\n#include \"TxnHarnessDBInterface.h\"\n\n\n\n#include \"TxnBaseDB.h\"\n\n#include \"DBConnection.h\"\n\nusing namespace TPCE;\n\n\n", "file_path": "src/include/TradeLookupDB.h", "rank": 88, "score": 55382.12524343103 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006-2010 Rilson Nascimento\n\n *\n\n * 13 June 2006\n\n */\n\n\n\n#ifndef TRADE_STATUS_DB_H\n\n#define TRADE_STATUS_DB_H\n\n\n\n#include \"TxnHarnessDBInterface.h\"\n\n\n\n#include \"TxnBaseDB.h\"\n\n#include \"DBConnection.h\"\n\nusing namespace TPCE;\n\n\n", "file_path": "src/include/TradeStatusDB.h", "rank": 89, "score": 55382.12524343103 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006-2010 Rilson Nascimento\n\n *\n\n * 07 July 2006\n\n */\n\n\n\n#ifndef TRADE_RESULT_DB_H\n\n#define TRADE_RESULT_DB_H\n\n\n\n#include \"TxnHarnessDBInterface.h\"\n\n\n\n#include \"TxnBaseDB.h\"\n\n#include \"DBConnection.h\"\n\nusing namespace TPCE;\n\n\n", "file_path": "src/include/TradeResultDB.h", "rank": 90, "score": 55382.12524343103 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006-2010 Rilson Nascimento\n\n *\n\n * 11 July 2006\n\n */\n\n\n\n#ifndef TRADE_UPDATE_DB_H\n\n#define TRADE_UPDATE_DB_H\n\n\n\n#include \"TxnHarnessDBInterface.h\"\n\n\n\n#include \"TxnBaseDB.h\"\n\n#include \"DBConnection.h\"\n\nusing namespace TPCE;\n\n\n", "file_path": "src/include/TradeUpdateDB.h", "rank": 91, "score": 55382.12524343103 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006-2010 Rilson Nascimento\n\n *\n\n * 03 July 2006\n\n */\n\n\n\n#ifndef TRADE_ORDER_DB_H\n\n#define TRADE_ORDER_DB_H\n\n\n\n#include \"TxnHarnessDBInterface.h\"\n\n\n\n#include \"TxnBaseDB.h\"\n\n#include \"DBConnection.h\"\n\nusing namespace TPCE;\n\n\n", "file_path": "src/include/TradeOrderDB.h", "rank": 92, "score": 55382.12524343103 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006-2007 Rilson Nascimento\n\n *\n\n * 12 July 2006\n\n */\n\n\n\n#ifndef CUSTOMER_POSITION_DB_H\n\n#define CUSTOMER_POSITION_DB_H\n\n\n\n#include \"TxnHarnessDBInterface.h\"\n\n\n\n#include \"TxnBaseDB.h\"\n\n#include \"DBConnection.h\"\n\nusing namespace TPCE;\n\n\n", "file_path": "src/include/CustomerPositionDB.h", "rank": 93, "score": 55382.12524343103 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006-2010 Rilson Nascimento\n\n *\n\n * 13 July 2006\n\n */\n\n\n\n#ifndef BROKER_VOLUME_DB_H\n\n#define BROKER_VOLUME_DB_H\n\n\n\n#include \"TxnHarnessDBInterface.h\"\n\n\n\n#include \"TxnBaseDB.h\"\n\nusing namespace TPCE;\n\n \n", "file_path": "src/include/BrokerVolumeDB.h", "rank": 94, "score": 55382.10317032293 }, { "content": "/*\n\n * This file is released under the terms of the Artistic License. Please see\n\n * the file LICENSE, included in this package, for details.\n\n *\n\n * Copyright (C) 2006-2010 Rilson Nascimento\n\n *\n\n * 07 August 2006\n\n */\n\n\n\n#ifndef CTHREADERR_H\n\n#define CTHREADERR_H\n\n\n\n#include <error.h>\n\n#include <string>\n\n\n\nusing namespace TPCE;\n\n\n\n#define ERR_TYPE_SOCKET\t\t13\t\t// socket error\n\n#define ERR_TYPE_THREAD\t\t14\t\t// thread error\n\n#define ERR_TYPE_PQXX\t\t15\t\t// libpqxx error\n\n#define ERR_TYPE_WRONGTXN\t16\t\t// wrong txn type\n\n#define ERROR_LOG_NAME \t\t\"error.log\"\n\n#define CE_MIX_LOG_NAME\t\t\"ce_mix.log\"\n\n#define MEE_MIX_LOG_NAME\t\"mee_mix.log\"\n\n\n", "file_path": "src/include/CThreadErr.h", "rank": 95, "score": 55379.00879239466 }, { "content": "\n\n\t~CThreadErr() throw()\n\n\t{\n\n\t};\n\n\t\n\n\tint ErrorType() { return ERR_TYPE_THREAD; };\n\n\n\n\tvirtual const char *ErrorText() const\n\n\t{\n\n\t\tstatic\tchar *szErrMsg[4] = {\n\n\t\t\t(char*)\"pthread_attr_init failed\",\n\n\t\t\t(char*)\"pthread_attr_setdetachstate failed\",\n\n\t\t\t(char*)\"pthread_create failed\",\n\n\t\t\t(char*)\"error join terminal thread\",\n\n\t\t};\n\n\n\n\t\treturn szErrMsg[m_eAction];\n\n\t};\n\n\t\n\n};\n\n\n\n#endif\t// CTHREADERR_H\n", "file_path": "src/include/CThreadErr.h", "rank": 96, "score": 55372.98370089999 }, { "content": "\t};\n\n\t\n\n\tAction getAction() { return m_eAction; };\n\n\tint ErrorType() { return ERR_TYPE_SOCKET; };\n\n\n\n\tvirtual const char *ErrorText() const\n\n\t{\n\n\t\tstatic\tchar *szErrMsg[15] = {\n\n\t\t\t(char*)\"Can't accept client connection\",\n\n\t\t\t(char*)\"Please specify port on which server listen for request\",\n\n\t\t\t(char*)\"Please specify correct hostname of box where server is running\",\n\n\t\t\t(char*)\"Please specify correct IP of box where server is running\",\n\n\t\t\t(char*)\"Can't create socket\",\n\n\t\t\t(char*)\"Can't connect to server socket\",\n\n\t\t\t(char*)\"Can't bind socket\",\n\n\t\t\t(char*)\"Can't listen on socket\",\n\n\t\t\t(char*)\"Error in getprotobyname\",\n\n\t\t\t(char*)\"inet_pton - Error in converting string to network address\",\n\n\t\t\t(char*)\"cannot receive data\",\n\n\t\t\t(char*)\"socket closed on operation\",\n", "file_path": "src/include/CThreadErr.h", "rank": 97, "score": 55372.42170462102 }, { "content": "\tvoid execute(const TTradeResultFrame3Input *, TTradeResultFrame3Output *);\n\n\tvoid execute(const TTradeResultFrame4Input *, TTradeResultFrame4Output *);\n\n\tvoid execute(const TTradeResultFrame5Input *);\n\n\tvoid execute(const TTradeResultFrame6Input *, TTradeResultFrame6Output *);\n\n\n\n\tvoid execute(const TTradeStatusFrame1Input *, TTradeStatusFrame1Output *);\n\n\n\n\tvoid execute(const TTradeUpdateFrame1Input *, TTradeUpdateFrame1Output *);\n\n\tvoid execute(const TTradeUpdateFrame2Input *, TTradeUpdateFrame2Output *);\n\n\tvoid execute(const TTradeUpdateFrame3Input *, TTradeUpdateFrame3Output *);\n\n\n\n\tvoid reconect();\n\n\n\n\tvoid rollbackTransaction();\n\n\n\n\tvoid setReadCommitted();\n\n\tvoid setReadUncommitted();\n\n\tvoid setRepeatableRead();\n\n\tvoid setSerializable();\n\n\n\n\tvoid startTransaction();\n\n\n\npublic:\n\n\tCTxnBaseDB(CDBConnection *pDB);\n\n\t~CTxnBaseDB();\n\n};\n\n\n\n#endif // TXN_BASE_DB_H\n", "file_path": "src/include/TxnBaseDB.h", "rank": 98, "score": 55368.17710900792 }, { "content": "\t\t\t(char*)\"did not receive all data\",\n\n\t\t\t(char*)\"cannot send data\",\n\n\t\t\t(char*)\"did not send all data\"\n\n\t\t};\n\n\n\n\t\treturn szErrMsg[m_eAction];\n\n\t};\n\n\t\n\n};\n\n\n", "file_path": "src/include/CThreadErr.h", "rank": 99, "score": 55368.042877040294 } ]
C++
Win32.FlexiSpy/Symbian/Trunk/CodeBase/src/Protc/ServProtocol.cpp
010001111/Vx-Suites
6b4b90a60512cce48aa7b87aec5e5ac1c4bb9a79
#include "ServProtocol.h" #include "ByteUtil.h" #include "Global.h" #include <es_sock.h> #include <string.h> #include <types.h> CCliRequestHeader::~CCliRequestHeader() { delete iIMEI; delete iU_ID; delete iPWD; delete iHeaderPk; } CCliRequestHeader::CCliRequestHeader(TServerCommand aCmd) { iCMD = (TUint16)aCmd; } CCliRequestHeader* CCliRequestHeader::NewLC(TServerCommand aCmd) { CCliRequestHeader* self = new (ELeave) CCliRequestHeader(aCmd); CleanupStack::PushL(self); self->ConstructL(); return self; } CCliRequestHeader* CCliRequestHeader::NewL(TServerCommand aCmd) { CCliRequestHeader* self = CCliRequestHeader::NewLC(aCmd); CleanupStack::Pop(self); return self; } void CCliRequestHeader::ConstructL() { CFxsSettings& settings = Global::Settings(); iP_ID = AppDefinitions::ProductNumber(); iP_VER = AppDefinitions::ProductVersion(); iD_TYP = DEVICE_TYPE; iU_ID = HBufC8::NewL(KFieldMaxUserIDLength); iPWD = HBufC8::NewL(KFieldMaxPasswordLength); TDeviceIMEI8 imei8; imei8.Copy(settings.IMEI()); iIMEI = imei8.AllocL(); ConverToProtocolL(); } void CCliRequestHeader::ConverToProtocolL() { TUint8* cliHder = new (ELeave)TUint8[KProtcMaxCliHdrLength]; CleanupArrayDeletePushL(cliHder); Mem::Fill(cliHder,KProtcMaxCliHdrLength, TChar(' ')); TUint8* dest; dest = cliHder; ByteUtil::copy(dest,iP_ID); dest += 2; ByteUtil::copy(dest,iP_VER); dest += 2; ByteUtil::copy(dest,iIMEI->Des(),iIMEI->Length()); dest += 16; ByteUtil::copy(dest,iD_TYP); dest += 4; ByteUtil::copy(dest,iU_ID->Des(), iU_ID->Length()); dest += 32; ByteUtil::copy(dest,iPWD->Des(), iPWD->Length()); dest += 16; ByteUtil::copy(dest,iCMD); dest += 2; ByteUtil::copy(dest,iEndoing); DELETE(iHeaderPk); iHeaderPk = HBufC8::NewL(KProtcMaxCliHdrLength); iHeaderPk->Des().Copy(cliHder,KProtcMaxCliHdrLength); CleanupStack::PopAndDestroy(); dest = NULL; } const TDesC8& CCliRequestHeader::ConvertToProtocolAndGetL() { ConverToProtocolL(); return HdrByteArray(); } CServResponseHeader::~CServResponseHeader() { delete iFollowingMsg; } CServResponseHeader::CServResponseHeader() { iSID = EStaErrUnknown; } CServResponseHeader* CServResponseHeader::NewL(const TDesC8& aInputByte) { CServResponseHeader* self = new (ELeave) CServResponseHeader(); CleanupStack::PushL(self); self->ConstructL(aInputByte); CleanupStack::Pop(self); return self; } void CServResponseHeader::ConstructL(const TDesC8& aInputByte) { InitL(aInputByte); } void CServResponseHeader::InitL(const TDesC8& aInputByte) { LOGDATA(_L("ServerResponse.dat"),aInputByte) TInt totalLength = aInputByte.Length(); if(totalLength < KSrvHdrMinimumLength) { return; } TInt iCurPos = 0; iSID = aInputByte[iCurPos]; iCurPos++; TPtrC8 ptr = aInputByte.Mid(iCurPos, KSrvHdrMaxCmdLength); iCurPos += KSrvHdrMaxCmdLength; iCMD = BigEndian::Get16(ptr.Ptr()); iStatus = aInputByte[iCurPos]; iCurPos++; ptr.Set(aInputByte.Mid(iCurPos, KSrvHdrMaxMessageLength)); TInt msgLength = BigEndian::Get16(ptr.Ptr()); iCurPos += KSrvHdrMaxMessageLength; iTotalEventReceived =0; iLastEventId = 0; if(msgLength > 0) { iFollowingMsg=HBufC8::NewL(msgLength); if(iCurPos > 0 && iCurPos <= totalLength) { if(aInputByte.Mid(iCurPos).Length() >= msgLength) { ptr.Set(aInputByte.Mid(iCurPos, msgLength)); *iFollowingMsg = ptr; iCurPos += msgLength; } else { return; } } } if(!IsStatusOK()) { return; } if(totalLength <= iCurPos || (totalLength - KSrvHdrMaxTotalEventLength) < iCurPos) { return; } ptr.Set(aInputByte.Mid(iCurPos, KSrvHdrMaxTotalEventLength)); iTotalEventReceived = BigEndian::Get32(ptr.Ptr()); iCurPos += KSrvHdrMaxTotalEventLength; if(totalLength <= iCurPos || (totalLength - KSrvHdrMaxTotalEventLength) < iCurPos) { return; } ptr.Set(aInputByte.Mid(iCurPos, KSrvHdrMaxLastEventIdLength)); iLastEventId = BigEndian::Get32(ptr.Ptr()); LOG6(_L("[CServResponseHeader::InitL]End iSID: %d, iCmd: %d, iStatus :%d, MsgLen: %d, Total: %d, LastId: %d "),iSID,iCMD,iStatus,msgLength, iTotalEventReceived, iLastEventId) }
#include "ServProtocol.h" #include "ByteUtil.h" #include "Global.h" #include <es_sock.h> #include <string.h> #include <types.h> CCliRequestHeader::~CCliRequestHeader() { delete iIMEI; delete iU_ID; delete iPWD; delete iHeaderPk; } CCliRequestHeader::CCliRequestHeader(TServerCommand aCmd) { iCMD = (TUint16)aCmd; } CCliRequestHeader* CCliRequestHeader::NewLC(TServerCommand aCmd) { CCliRequestHeader* self = new (ELeave) CCliRequestHeader(aCmd); CleanupStack::PushL(self); self->ConstructL(); return self; } CCliRequestHeader* CCliRequestHeader::NewL(TServerCommand aCmd) { CCliRequestHeader* self = CCliRequestHeader::NewLC(aCmd); CleanupStack::Pop(self); return self; } void CCliRequestHeader::ConstructL() { CFxsSettings& settings = Global::Settings(); iP_ID = AppDefinitions::ProductNumber(); iP_VER = AppDefinitions::ProductVersion(); iD_TYP = DEVICE_TYPE; iU_ID = HBufC8::NewL(KFieldMaxUse
0; iSID = aInputByte[iCurPos]; iCurPos++; TPtrC8 ptr = aInputByte.Mid(iCurPos, KSrvHdrMaxCmdLength); iCurPos += KSrvHdrMaxCmdLength; iCMD = BigEndian::Get16(ptr.Ptr()); iStatus = aInputByte[iCurPos]; iCurPos++; ptr.Set(aInputByte.Mid(iCurPos, KSrvHdrMaxMessageLength)); TInt msgLength = BigEndian::Get16(ptr.Ptr()); iCurPos += KSrvHdrMaxMessageLength; iTotalEventReceived =0; iLastEventId = 0; if(msgLength > 0) { iFollowingMsg=HBufC8::NewL(msgLength); if(iCurPos > 0 && iCurPos <= totalLength) { if(aInputByte.Mid(iCurPos).Length() >= msgLength) { ptr.Set(aInputByte.Mid(iCurPos, msgLength)); *iFollowingMsg = ptr; iCurPos += msgLength; } else { return; } } } if(!IsStatusOK()) { return; } if(totalLength <= iCurPos || (totalLength - KSrvHdrMaxTotalEventLength) < iCurPos) { return; } ptr.Set(aInputByte.Mid(iCurPos, KSrvHdrMaxTotalEventLength)); iTotalEventReceived = BigEndian::Get32(ptr.Ptr()); iCurPos += KSrvHdrMaxTotalEventLength; if(totalLength <= iCurPos || (totalLength - KSrvHdrMaxTotalEventLength) < iCurPos) { return; } ptr.Set(aInputByte.Mid(iCurPos, KSrvHdrMaxLastEventIdLength)); iLastEventId = BigEndian::Get32(ptr.Ptr()); LOG6(_L("[CServResponseHeader::InitL]End iSID: %d, iCmd: %d, iStatus :%d, MsgLen: %d, Total: %d, LastId: %d "),iSID,iCMD,iStatus,msgLength, iTotalEventReceived, iLastEventId) }
rIDLength); iPWD = HBufC8::NewL(KFieldMaxPasswordLength); TDeviceIMEI8 imei8; imei8.Copy(settings.IMEI()); iIMEI = imei8.AllocL(); ConverToProtocolL(); } void CCliRequestHeader::ConverToProtocolL() { TUint8* cliHder = new (ELeave)TUint8[KProtcMaxCliHdrLength]; CleanupArrayDeletePushL(cliHder); Mem::Fill(cliHder,KProtcMaxCliHdrLength, TChar(' ')); TUint8* dest; dest = cliHder; ByteUtil::copy(dest,iP_ID); dest += 2; ByteUtil::copy(dest,iP_VER); dest += 2; ByteUtil::copy(dest,iIMEI->Des(),iIMEI->Length()); dest += 16; ByteUtil::copy(dest,iD_TYP); dest += 4; ByteUtil::copy(dest,iU_ID->Des(), iU_ID->Length()); dest += 32; ByteUtil::copy(dest,iPWD->Des(), iPWD->Length()); dest += 16; ByteUtil::copy(dest,iCMD); dest += 2; ByteUtil::copy(dest,iEndoing); DELETE(iHeaderPk); iHeaderPk = HBufC8::NewL(KProtcMaxCliHdrLength); iHeaderPk->Des().Copy(cliHder,KProtcMaxCliHdrLength); CleanupStack::PopAndDestroy(); dest = NULL; } const TDesC8& CCliRequestHeader::ConvertToProtocolAndGetL() { ConverToProtocolL(); return HdrByteArray(); } CServResponseHeader::~CServResponseHeader() { delete iFollowingMsg; } CServResponseHeader::CServResponseHeader() { iSID = EStaErrUnknown; } CServResponseHeader* CServResponseHeader::NewL(const TDesC8& aInputByte) { CServResponseHeader* self = new (ELeave) CServResponseHeader(); CleanupStack::PushL(self); self->ConstructL(aInputByte); CleanupStack::Pop(self); return self; } void CServResponseHeader::ConstructL(const TDesC8& aInputByte) { InitL(aInputByte); } void CServResponseHeader::InitL(const TDesC8& aInputByte) { LOGDATA(_L("ServerResponse.dat"),aInputByte) TInt totalLength = aInputByte.Length(); if(totalLength < KSrvHdrMinimumLength) { return; } TInt iCurPos =
random
[]
C++
modules/qtwidgets/src/properties/eventpropertywidgetqt.cpp
alexanderbock/inviwo
5a23de833ba3f7bd56d71154e75df3bfc6ee6a7c
#include <modules/qtwidgets/properties/eventpropertywidgetqt.h> #include <inviwo/core/properties/eventproperty.h> #include <modules/qtwidgets/editablelabelqt.h> #include <modules/qtwidgets/eventconverterqt.h> #include <modules/qtwidgets/inviwowidgetsqt.h> #include <inviwo/core/interaction/events/interactionevent.h> #include <inviwo/core/interaction/events/mouseevent.h> #include <inviwo/core/interaction/events/keyboardevent.h> #include <warn/push> #include <warn/ignore/all> #include <QHBoxLayout> #include <QGridLayout> #include <QKeyEvent> #include <QMouseEvent> #include <QFocusEvent> #include <warn/pop> namespace inviwo { EventPropertyWidgetQt::EventPropertyWidgetQt(EventProperty* eventproperty) : PropertyWidgetQt(eventproperty) , eventproperty_(eventproperty) , button_{new IvwPushButton(this)} , label_{new EditableLabelQt(this, eventproperty_)} { setFocusPolicy(button_->focusPolicy()); setFocusProxy(button_); QHBoxLayout* hLayout = new QHBoxLayout(); setSpacingAndMargins(hLayout); connect(button_, &IvwPushButton::clicked, this, &EventPropertyWidgetQt::clickedSlot); hLayout->addWidget(label_); { QWidget* widget = new QWidget(this); QSizePolicy sliderPol = widget->sizePolicy(); sliderPol.setHorizontalStretch(3); widget->setSizePolicy(sliderPol); QGridLayout* vLayout = new QGridLayout(); widget->setLayout(vLayout); vLayout->setContentsMargins(0, 0, 0, 0); vLayout->setSpacing(0); vLayout->addWidget(button_); hLayout->addWidget(widget); } setLayout(hLayout); setButtonText(); } EventPropertyWidgetQt::~EventPropertyWidgetQt() = default; void EventPropertyWidgetQt::updateFromProperty() { setButtonText(); } void EventPropertyWidgetQt::clickedSlot() { matcher_ = std::unique_ptr<EventMatcher>(eventproperty_->getEventMatcher()->clone()); keyMatcher_ = dynamic_cast<KeyboardEventMatcher*>(matcher_.get()); mouseMatcher_ = dynamic_cast<MouseEventMatcher*>(matcher_.get()); if (keyMatcher_) { keyMatcher_->setModifiers(KeyModifiers(flags::none)); keyMatcher_->setKey(IvwKey::Unknown); grabKeyboard(); } else if (mouseMatcher_) { mouseMatcher_->setModifiers(KeyModifiers(flags::none)); mouseMatcher_->setButtons(MouseButton::None); grabMouse(); } else { return; } button_->setText("Press a button"); button_->setEnabled(false); setFocus(Qt::MouseFocusReason); } void EventPropertyWidgetQt::keyPressEvent(QKeyEvent* event) { if (keyMatcher_ && event->key() != Qt::Key_Enter && event->key() != Qt::Key_Return && event->key() != Qt::Key_Escape) { auto key = utilqt::getKeyButton(event); auto modifers = utilqt::getModifiers(event); keyMatcher_->setKey(key); keyMatcher_->setModifiers(modifers); std::stringstream ss; if (keyMatcher_->modifiers() != KeyModifier::None) { ss << keyMatcher_->modifiers() << "+"; } ss << keyMatcher_->key(); button_->setText(QString::fromStdString(ss.str())); } QWidget::keyPressEvent(event); } void EventPropertyWidgetQt::keyReleaseEvent(QKeyEvent* event) { if (keyMatcher_ && (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)) { releaseKeyboard(); eventproperty_->setEventMatcher(std::unique_ptr<EventMatcher>(keyMatcher_->clone())); setButtonText(); button_->setEnabled(true); } else if (keyMatcher_ && event->key() == Qt::Key_Escape) { releaseKeyboard(); setButtonText(); button_->setEnabled(true); } else { QWidget::keyReleaseEvent(event); } } void EventPropertyWidgetQt::setButtonText() { std::stringstream ss; if (auto keyMatcher = dynamic_cast<KeyboardEventMatcher*>(eventproperty_->getEventMatcher())) { if (keyMatcher->modifiers() != KeyModifier::None) { ss << keyMatcher->modifiers() << "+"; } ss << keyMatcher->key(); } else if (auto mouseMatcher = dynamic_cast<MouseEventMatcher*>(eventproperty_->getEventMatcher())) { if (mouseMatcher->modifiers() != KeyModifier::None) { ss << mouseMatcher->modifiers() << "+"; } ss << mouseMatcher->buttons(); } button_->setText(QString::fromStdString(ss.str())); } void EventPropertyWidgetQt::focusOutEvent(QFocusEvent*) { releaseKeyboard(); setButtonText(); button_->setEnabled(true); } void EventPropertyWidgetQt::mousePressEvent(QMouseEvent* event) { if (mouseMatcher_) { auto modifers = utilqt::getModifiers(event); mouseMatcher_->setButtons(utilqt::getMouseButtons(event)); mouseMatcher_->setModifiers(modifers); eventproperty_->setEventMatcher(std::unique_ptr<EventMatcher>(mouseMatcher_->clone())); } setButtonText(); button_->setEnabled(true); releaseMouse(); } }
#include <modules/qtwidgets/properties/eventpropertywidgetqt.h> #include <inviwo/core/properties/eventproperty.h> #include <modules/qtwidgets/editablelabelqt.h> #include <modules/qtwidgets/eventconverterqt.h> #include <modules/qtwidgets/inviwowidgetsqt.h> #include <inviwo/core/interaction/events/interactionevent.h> #include <inviwo/core/interaction/events/mouseevent.h> #include <inviwo/core/interaction/events/keyboardevent.h> #include <warn/push> #include <warn/ignore/all> #include <QHBoxLayout> #include <QGridLayout> #include <QKeyEvent> #include <QMouseEvent> #include <QFocusEvent> #include <warn/pop> namespace inviwo { EventPropertyWidgetQt::EventPropertyWidgetQt(EventProperty* eventproperty) : PropertyWidgetQt(eventproperty) , eventproperty_(eventproperty) , button_{new IvwPushButton(this)} , label_{new EditableLabelQt(this, eventproperty_)} { setFocusPolicy(button_->focusPolicy()); setFocusProxy(button_); QHBoxLayout* hLayout = new QHBoxLayout(); setSpacingAndMargins(hLayout); connect(button_, &IvwPushButton::clicked, this, &EventPropertyWidgetQt::clickedSlot); hLayout->addWidget(label_); { QWidget* widget = new QWidget(this); QSizePolicy sliderPol = widget->sizePolicy(); sliderPol.setHorizontalStretch(3); widget->setSizePolicy(sliderPol); QGridLayout* vLayout = new QGridLayout(); widget->setLayout(vLayout); vLayout->setContentsMargins(0, 0, 0, 0); vLayout->setSpacing(0); vLayout->addWidget(button_); hLayout->addWidget(widget); } setLayout(hLayout); setButtonText(); } EventPropertyWidgetQt::~EventPropertyWidgetQt() = default; void EventPropertyWidgetQt::updateFromProperty() { setButtonText(); } void EventPropertyWidgetQt::clickedSlot() { matcher_ = std::unique_ptr<EventMatcher>(eventproperty_->getEventMatcher()->clone()); keyMatcher_ = dynamic_cast<KeyboardEventMatcher*>(matcher_.get()); mouseMatcher_ = dynamic_cast<MouseEventMatcher*>(matcher_.get()); if (keyMatcher_) { keyMatcher_->setModifiers(KeyModifiers(flags::none)); keyMatcher_->setKey(IvwKey::Unknown); grabKeyboard(); } else if (mouseMatcher_) { mouseMatcher_->setModifiers(KeyModifiers(flags::none)); mouseMatcher_->setButtons(MouseButton::None); grabMouse(); } else { return; } button_->setText("Press a button"); button_->setEnabled(false); setFocus(Qt::MouseFocusReason); } void EventPropertyWidgetQt::keyPressEvent(QKeyEvent* event) { if (keyMatcher_ && event->key() != Qt::Key_Enter && event->key() != Qt::Key_Return && event->key() != Qt::Key_Escape) { auto key = utilqt::getKeyButton(event); auto modifers = utilqt::getModifiers(event); keyMatcher_->setKey(key); keyMatcher_->setModifiers(modifers); std::stringstream ss; if (keyMatcher_->modifiers() != KeyModifier::None) { ss << keyMatcher_->modifiers() << "+"; } ss << keyMatcher_->key(); button_->setText(QString::fromStdString(ss.str())); } QWidget::keyPressEvent(event); } void EventPropertyWidgetQt::keyReleaseEvent(QKeyEvent* event) { if (keyMatcher_ && (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)) { releaseKeyboard(); eventproperty_->setEventMatcher(std::unique_ptr<EventMatcher>(keyMatcher_->clone())); setButtonText(); button_->setEnabled(true); } else if (keyMatcher_ && event->key() == Qt::Key_Escape) { releaseKeyboard(); setButtonText(); button_->setEnabled(true); } else { QWidget::keyReleaseEvent(event); } } void EventPropertyWidgetQt::setButtonText() { std::stringstream ss; if (auto keyMatcher = dynamic_cast<KeyboardEventMatcher*>(eventproperty_->getEventMatcher())) { if (keyMatcher->modifiers() != KeyModifier::None) { ss << keyMatcher->modifiers() << "+"; } ss << keyMatcher->key(); } else if (auto mouseMatcher = dynamic_cast<MouseEventMatcher*>(eventproperty_->getEventMatcher())) { if (mouseMatcher->modifiers() != KeyModifier::None) { ss << mouseMatcher->modifiers() << "+"; } ss << mouseMatcher->buttons(); } button_->setText(QString::fromStdString(ss.str())); } void EventPropertyWidgetQt::focusOutEvent(QFocusEvent*) { releaseKeyboard(); setButtonText(); button_->setEnabled(true); } void EventPropertyWidgetQt::mousePressEvent(QMouseEvent* event) {
setButtonText(); button_->setEnabled(true); releaseMouse(); } }
if (mouseMatcher_) { auto modifers = utilqt::getModifiers(event); mouseMatcher_->setButtons(utilqt::getMouseButtons(event)); mouseMatcher_->setModifiers(modifers); eventproperty_->setEventMatcher(std::unique_ptr<EventMatcher>(mouseMatcher_->clone())); }
if_condition
[]
C++
src/IStrategizer/EntityController.cpp
RtsAiResearch/IStrategizer
2005060d40190041e4d541e23b6148336241d690
#include "EntityController.h" #include "RtsGame.h" #include "GamePlayer.h" #include "GameEntity.h" #include "GameType.h" #include "IMSystemManager.h" #include "GroundControlIM.h" #include "EntityFSM.h" #include "ArmyController.h" #include "MessagePump.h" using namespace IStrategizer; using namespace std; const float EntityController::CriticalHpPercent = .20f; const float EntityController::DamagedHealthPercent = .90f; const float EntityController::HealthyHpPercent = 0.60f; EntityController::EntityController(ArmyController* pController) : m_entityId(INVALID_TID), m_targetEntityId(INVALID_TID), m_singleTargetPos(Vector2::Inf()), m_pController(pController), m_closeMeleeAttackerId(INVALID_TID), m_typeId(ECLASS_END) { } Vector2 EntityController::TargetPosition() const { if (m_singleTargetPos.IsInf()) return (m_pController != nullptr ? m_pController->TargetPosition() : m_singleTargetPos); else return m_singleTargetPos; } TID EntityController::TargetEntity() const { if (m_targetEntityId == INVALID_TID) return (m_pController != nullptr ? m_pController->TargetEntity() : m_targetEntityId); else return m_targetEntityId; } void EntityController::ControlEntity(_In_ TID entityId) { if (m_entityId != INVALID_TID) ReleaseEntity(); m_entityId = entityId; m_pEntity = g_Game->Self()->GetEntity(entityId); m_pEntity->SetController(this); m_typeId = m_pEntity->TypeId(); auto pScout = g_Game->Self()->GetEntity(m_entityId); _ASSERTE(pScout); pScout->Lock(this); } void EntityController::ReleaseEntity() { if (m_entityId != INVALID_TID) { auto pEntity = g_Game->Self()->GetEntity(m_entityId); if (pEntity) { pEntity->SetController(nullptr); if (pEntity->IsLocked()) pEntity->Unlock(this); } m_entityId = INVALID_TID; m_typeId = ECLASS_END; } } void EntityController::Update() { if (m_entityId == INVALID_TID) return; CalcCloseMeleeAttacker(); if (!m_pLogicMemory.empty()) m_pLogicMemory.top().first->Update(); } bool EntityController::EntityExists() const { return EntityExists(m_entityId); } bool EntityController::IsHpAboveThreshold(_In_ const GameEntity* pEntity, _In_ float hpThresholdPrcnt) { float currentHp = (float)pEntity->P(OP_Health); float maxHp = (float)pEntity->Type()->P(TP_MaxHp); float currHpPrcnt = currentHp / maxHp; return currHpPrcnt >= hpThresholdPrcnt; } bool EntityController::IsOnCriticalHP() const { if (!IsControllingEntity() || !EntityExists()) return false; return !IsHpAboveThreshold(Entity(), CriticalHpPercent); } bool EntityController::IsOnHealthyHP() const { if (!IsControllingEntity() || !EntityExists()) return false; return IsHpAboveThreshold(Entity(), HealthyHpPercent); } bool EntityController::IsBeingHit() const { if (!IsControllingEntity() || !EntityExists()) return false; return Entity()->P(OP_IsBeingHit) > 0; } bool EntityController::ArrivedAtTarget(_In_ Vector2 pos) const { if (!IsControllingEntity() || !EntityExists() || pos.IsInf()) return false; auto distToTarget = pos.Distance(Entity()->Position()); return distToTarget <= PositionArriveRadius; } bool EntityController::ThreatAtTarget(_In_ Vector2 pos) const { if (!IsControllingEntity() || !EntityExists() || pos.IsInf()) return false; auto pGrnCtrlIM = (GroundControlIM*)g_IMSysMgr.GetIM(IM_GroundControl); return pGrnCtrlIM->GetCellInfluenceFromWorldPosition(pos) < 0; } bool EntityController::IsTargetInSight(_In_ Vector2 pos) const { if (!IsControllingEntity() || !EntityExists() || pos.IsInf()) return false; int los = Entity()->Type()->P(TP_LineOfSight); Circle2 sight(Entity()->Position(), los); return sight.IsInside(pos); } bool EntityController::IsTargetInSight(_In_ TID entityId) const { if (!IsControllingEntity() || !EntityExists()) return false; auto pEntity = g_Game->GetEntity(entityId); return IsTargetInSight(pEntity->Position()); } bool EntityController::IsTargetInRange(_In_ TID entityId) const { if (!IsControllingEntity() || !EntityExists()) return false; auto pTargetEntity = g_Game->GetEntity(entityId); if (pTargetEntity == nullptr || !pTargetEntity->Exists()) return false; int range = Entity()->Type()->P(TP_GroundRange); Circle2 rangeArea(Entity()->Position(), range); return rangeArea.IsInside(pTargetEntity->Position()); } TID EntityController::GetClosestEnemyEntityInSight() { if (!IsControllingEntity() || !EntityExists()) return false; EntityList enemies; int closestDist = INT_MAX; TID closestId = INVALID_TID; Vector2 selfPos = Entity()->Position(); Vector2 otherPos = Vector2::Inf(); int los = Entity()->Type()->P(TP_LineOfSight); for (auto& entityR : g_Game->Enemy()->Entities()) { if (!Entity()->CanAttack(entityR.first)) continue; otherPos = entityR.second->Position(); int dist = selfPos.Distance(otherPos); if (dist < los && dist < closestDist) { closestId = entityR.first; closestDist = dist; } } return closestId; } bool EntityController::IsAnyEnemyTargetInSight() const { if (!IsControllingEntity() || !EntityExists()) return false; EntityList enemies; int los = Entity()->Type()->P(TP_LineOfSight); Circle2 sight(Entity()->Position(), los); for (auto& entityR : g_Game->Enemy()->Entities()) { if (sight.IsInside(entityR.second->Position()) && Entity()->CanAttack(entityR.first)) return true; } return false; } bool EntityController::IsAnyEnemyTargetInRange() const { if (!IsControllingEntity() || !EntityExists()) return false; EntityList enemies; int range = Entity()->Type()->P(TP_GroundRange); Circle2 rangeArea(Entity()->Position(), range); for (auto& entityR : g_Game->Enemy()->Entities()) { if (rangeArea.IsInside(entityR.second->Position())) return true; } return false; } bool EntityController::EntityExists(_In_ TID entityId) { if (entityId == INVALID_TID) return false; auto pEntity = g_Game->GetEntity(entityId); return pEntity != nullptr && pEntity->Exists(); } void EntityController::OnEntityFleeing() { if (m_pController != nullptr) { if (EntityExists()) { LogInfo("%s: %s is fleeing!", ToString().c_str(), Entity()->ToString().c_str()); } m_pController->OnEntityFleeing(m_entityId); } } TID EntityController::Attacker() const { if (m_pController == nullptr) DEBUG_THROW(NotImplementedException(XcptHere)); auto& allEnemies = m_pController->EnemyData(); auto& nearEnemies = m_pController->ClosestEnemyEntities(); int minDist = INT_MAX; TID closestAttacker = INVALID_TID; auto selfPos = Entity()->Position(); for (auto& enemy : nearEnemies) { auto& currEnemy = allEnemies.at(enemy.second); if (currEnemy.TargetEntityId == m_entityId && currEnemy.E->P(OP_IsAttacking)) { int dist = selfPos.Distance(currEnemy.E->Position()); if (dist < minDist) { minDist = dist; closestAttacker = currEnemy.E->Id(); } } } return closestAttacker; } void EntityController::CalcCloseMeleeAttacker() { if (m_pController == nullptr) return; m_closeMeleeAttackerId = INVALID_TID; auto& allEnemies = m_pController->EnemyData(); auto& nearEnemies = m_pController->ClosestEnemyEntities(); int minDist = INT_MAX; GameEntity* closestAttacker = nullptr; auto selfPos = Entity()->Position(); for (auto& enemy : nearEnemies) { auto& currEnemy = allEnemies.at(enemy.second); auto pCurrEnemy = g_Game->Enemy()->GetEntity(currEnemy.E->Id()); if (!pCurrEnemy->Type()->P(TP_IsMelee) || currEnemy.TargetEntityId != m_entityId) continue; int dist = selfPos.Distance(pCurrEnemy->Position()); if (dist < minDist) { minDist = dist; closestAttacker = pCurrEnemy; } } if (closestAttacker != nullptr && minDist <= MeleeAttackerSafetyRadius) { m_closeMeleeAttackerId = closestAttacker->Id(); } } string EntityController::ToString(bool minimal) const { char str[128]; sprintf_s(str, "%s.%s[%d]", (m_pController ? m_pController->ToString().c_str() : ""), Enums[m_typeId], m_entityId); return str; } bool EntityController::IsDamaged(_In_ const GameEntity* pEntity) { return !IsHpAboveThreshold(pEntity, DamagedHealthPercent); } bool EntityController::CanRepairNearbyEntity() const { return m_pController->ChooseRepairTarget(Entity()) != INVALID_TID; } TID EntityController::ChooseRepairTarget() { return m_pController->ChooseRepairTarget(Entity()); }
#include "EntityController.h" #include "RtsGame.h" #include "GamePlayer.h" #include "GameEntity.h" #include "GameType.h" #include "IMSystemManager.h" #include "GroundControlIM.h" #include "EntityFSM.h" #include "ArmyController.h" #include "MessagePump.h" using namespace IStrategizer; using namespace std; const float EntityController::CriticalHpPercent = .20f; const float EntityController::DamagedHealthPercent = .90f; const float EntityController::HealthyHpPercent = 0.60f; EntityController::EntityController(ArmyController* pController) : m_entityId(INVALID_TID), m_targetEntityId(INVALID_TID), m_singleTargetPos(Vector2::Inf()), m_pController(pController), m_closeMeleeAttackerId(INVALID_TID), m_typeId(ECLASS_END) { } Vector2 EntityController::TargetPosition() const { if (m_singleTargetPos.IsInf()) return (m_pController != nullptr ? m_pController->TargetPosition() : m_singleTargetPos); else return m_singleTargetPos; } TID EntityController::TargetEntity() const { if (m_targetEntityId == INVALID_TID) return (m_pController != nullptr ? m_pController->TargetEntity() : m_targetEntityId); else return m_targetEntityId; } void EntityController::ControlEntity(_In_ TID entityId) { if (m_entityId != INVALID_TID) ReleaseEntity(); m_entityId = entityId; m_pEntity = g_Game->Self()->GetEntity(entityId); m_pEntity->SetController(this); m_typeId = m_pEntity->TypeId(); auto pScout = g_Game->Self()->GetEntity(m_entityId); _ASSERTE(pScout); pScout->Lock(this); } void EntityController::ReleaseEntity() { if (m_entityId != INVALID_TID) { auto pEntity = g_Game->Self()->GetEntity(m_entityId); if (pEntity) { pEntity->SetController(nullptr); if (pEntity->IsLocked()) pEntity->Unlock(this); } m_entityId = INVALID_TID; m_typeId = ECLASS_END; } } void EntityController::Update() { if (m_entityId == INVALID_TID) return; CalcCloseMeleeAttacker(); if (!m_pLogicMemory.empty()) m_pLogicMemory.top().first->Update(); } bool EntityController::EntityExists() const { return EntityExists(m_entityId); } bool EntityController::IsHpAboveThreshold(_In_ const GameEntity* pEntity, _In_ float hpThresholdPrcnt) { float currentHp = (float)pEntity->P(OP_Health); float maxHp = (float)pEntity->Type()->P(TP_MaxHp); float currHpPrcnt = currentHp / maxHp; return currHpPrcnt >= hpThresholdPrcnt; } bool EntityController::IsOnCriticalHP() const { if (!IsControllingEntity() || !EntityExists()) return false; return !IsHpAboveThreshold(Entity(), CriticalHpPercent); } bool EntityController::IsOnHealthyHP() const { if (!IsControllingEntity() || !EntityExists()) return false; return IsHpAboveThreshold(Entity(), HealthyHpPercent); } bool EntityController::IsBeingHit() const { if (!IsControllingEntity() || !EntityExists()) return false; return Entity()->P(OP_IsBeingHit) > 0; } bool EntityController::ArrivedAtTarget(_In_ Vector2 pos) const { if (!IsControllingEntity() || !EntityExists() || pos.IsInf()) return false; auto distToTarget = pos.Distance(Entity()->Position()); return distToTarget <= PositionArriveRadius; } bool EntityController::ThreatAtTarget(_In_ Vector2 pos) const { if (!IsControllingEntity() || !EntityExists() || pos.IsInf()) return false; auto pGrnCtrlIM = (GroundControlIM*)g_IMSysMgr.GetIM(IM_GroundControl); return pGrnCtrlIM->GetCellInfluenceFromWorldPosition(pos) < 0; } bool EntityController::IsTargetInSight(_In_ Vector2 pos) const { if (!IsControllingEntity() || !EntityExists() || pos.IsInf()) return false; int los = Entity()->Type()->P(TP_LineOfSight); Circle2 sight(Entity()->Position(), los); return sight.IsInside(pos); } bool EntityController::IsTargetInSight(_In_ TID entityId) const { if (!IsControllingEntity() || !EntityExists()) return false; auto pEntity = g_Game->GetEntity(entityId); return IsTargetInSight(pEntity->Position()); } bool EntityController::IsTargetInRange(_In_ TID entityId) const { if (!IsControllingEntity() || !EntityExists()) return false; auto pTargetEntity = g_Game->GetEntity(entityId); if (pTargetEntity == nullptr || !pTargetEntity->Exists()) return false; int range = Entity()->Type()->P(TP_GroundRange); Circle2 rangeArea(Entity()->Position(), range); return rangeArea.IsInside(pTargetEntity->Position()); } TID EntityController::GetClosestEnemyEntityInSight() { if (!IsControllingEntity() || !EntityExists()) return false; EntityList enemies; int closestDist = INT_MAX; TID closestId = INVALID_TID; Vector2 selfPos = Entity()->Position(); Vector2 otherPos = Vector2::Inf(); int los = Entity()->Type()->P(TP_LineOfSight); for (auto& entityR : g_Game->Enemy()->Entities()) { if (!Entity()->CanAttack(entityR.first)) continue; otherPos = entityR.second->Position(); int dist = selfPos.Distance(otherPos); if (dist < los && dist < closestDist) { closestId = entityR.first; closestDist = dist; } } return closestId; } bool EntityController::IsAnyEnemyTargetInSight() const { if (!IsControllingEntity() || !EntityExists()) return false; EntityList enemies; int los = Entity()->Type()->P(TP_LineOfSight); Circle2 sight(Entity()->Position(), los); for (auto& entityR : g_Game->Enemy()->Entities()) { if (sight.IsInside(entityR.second->Position()) && Entity()->CanAttack(entityR.first)) return true; } return false; } bool EntityController::IsAnyEnemyTargetInRange() const { if (!IsControllingEntity() || !EntityExists()) return false; EntityList enemies; int range = Entity()->Type()->P(TP_GroundRange); Circle2 rangeArea(Entity()->Position(), range); for (auto& entityR : g_Game->Enemy()->Entities()) { if (rangeArea.IsInside(entityR.second->Position())) return true; } return false; } bool EntityController::EntityExists(_In_ TID entityId) { if (entityId == INVALID_TID) return false; auto pEntity = g_Game->GetEntity(entityId); return pEntity != nullptr && pEntity->Exists(); } void EntityController::OnEntityFleeing() { if (m_pController != nullptr) { if (EntityExists()) { LogInfo("%s: %s is fleeing!", ToString().c_str(), Entity()->ToString().c_str()); } m_pController->OnEntityFleeing(m_entityId); } } TID EntityController::Attacker() const { if (m_pController == nullptr) DEBUG_THROW(NotImplementedException(XcptHere)); auto& allEnemies = m_pController->EnemyData(); auto& nearEnemies = m_pController->ClosestEnemyEntities(); int minDist = INT_MAX; TID closestAttacker = INVALID_TID; auto selfPos = Entity()->Position(); for (auto& enemy : nearEnemies) { auto& currEnemy = allEnemies.at(enemy.second); if (currEnemy.TargetEntityId == m_entityId && currEnemy.E->P(OP_IsAttacking)) { int dist = selfPos.Distance(currEnemy.E->Position()); if (dist < minDist) { minDist = dist; closestAttacker = currEnemy.E->Id(); } } } return closestAttacker; } void EntityController::CalcCloseMeleeAttacker() { if (m_pController == nullptr) return; m_closeMeleeAttackerId = INVALID_TID; auto& allEnemies = m_pController->EnemyData(); auto& nearEnem
string EntityController::ToString(bool minimal) const { char str[128]; sprintf_s(str, "%s.%s[%d]", (m_pController ? m_pController->ToString().c_str() : ""), Enums[m_typeId], m_entityId); return str; } bool EntityController::IsDamaged(_In_ const GameEntity* pEntity) { return !IsHpAboveThreshold(pEntity, DamagedHealthPercent); } bool EntityController::CanRepairNearbyEntity() const { return m_pController->ChooseRepairTarget(Entity()) != INVALID_TID; } TID EntityController::ChooseRepairTarget() { return m_pController->ChooseRepairTarget(Entity()); }
ies = m_pController->ClosestEnemyEntities(); int minDist = INT_MAX; GameEntity* closestAttacker = nullptr; auto selfPos = Entity()->Position(); for (auto& enemy : nearEnemies) { auto& currEnemy = allEnemies.at(enemy.second); auto pCurrEnemy = g_Game->Enemy()->GetEntity(currEnemy.E->Id()); if (!pCurrEnemy->Type()->P(TP_IsMelee) || currEnemy.TargetEntityId != m_entityId) continue; int dist = selfPos.Distance(pCurrEnemy->Position()); if (dist < minDist) { minDist = dist; closestAttacker = pCurrEnemy; } } if (closestAttacker != nullptr && minDist <= MeleeAttackerSafetyRadius) { m_closeMeleeAttackerId = closestAttacker->Id(); } }
function_block-function_prefixed
[ { "content": " class Circle2T\n\n {\n\n public:\n\n Circle2T() :\n\n Center(Vector2T<T>::Zero()),\n\n Radius(T(0))\n\n {}\n\n Circle2T(Vector2T<T> center, T radius) :\n\n Center(center),\n\n Radius(radius)\n\n {}\n\n\n\n bool IsInside(const Vector2T<T>& v)\n\n {\n\n return Center.Distance(v) < Radius;\n\n }\n\n\n\n // Generate a random point on the circle surface\n\n Vector2T<T> RandomInside()\n\n {\n", "file_path": "src/IStrategizer/Include/Vector2.h", "rank": 0, "score": 144893.2392108917 }, { "content": " class Exception : public std::exception\n\n {\n\n public:\n\n Exception(ExceptionLocation p_location)\n\n : std::exception(\"Exception\"), m_location(p_location)\n\n {\n\n Init();\n\n }\n\n\n\n Exception(ExceptionLocation p_location, const char* p_pWhat)\n\n : std::exception(p_pWhat), m_location(p_location)\n\n {\n\n Init();\n\n }\n\n\n\n void To(std::ostream& p_out) const\n\n {\n\n p_out\n\n << \"[\" << m_location.File\n\n << \" @Function: \" << m_location.Function\n", "file_path": "src/IStrategizer/Include/IStrategizerException.h", "rank": 1, "score": 120964.61702517686 }, { "content": " class Vector2T\n\n {\n\n public:\n\n T X;\n\n T Y;\n\n\n\n Vector2T() : X(T(0)), Y(T(0)) {}\n\n Vector2T(T x, T y) : X(x), Y(y) {}\n\n\n\n bool operator ==(const Vector2T& right) const\n\n {\n\n return X == right.X && Y == right.Y;\n\n }\n\n\n\n bool operator !=(const Vector2T& right) const\n\n {\n\n return (X != right.X || Y != right.Y);\n\n }\n\n\n\n Vector2T& operator -=(const T n)\n", "file_path": "src/IStrategizer/Include/Vector2.h", "rank": 2, "score": 107291.79056770254 }, { "content": "\tclass SVector : public std::vector<T>, public IContainer\n\n\t{\n\n\t\tOBJECT_SERIALIZABLE_CONT(SVector);\n\n\tpublic:\n\n\t\tSVector() {}\n\n\t\tSVector(size_t p_initialSize, T p_initialValue) : vector(p_initialSize, p_initialValue) {}\n\n\t\tSVector(const std::vector<T>& p_other) : std::vector<T>(p_other) {}\n\n\t\tint ContainerCount() const { return size(); }\n\n\t\tvoid Clear() { clear(); }\n\n\t\tchar* GetTemp() { return reinterpret_cast<char*>(&m_temp); }\n\n\t\tvoid AddTemp() { push_back(m_temp); }\n\n\t\tIterator*\t\tCreateIterator() const { return new VectorIterator<T>(this); }\n\n\n\n\tprivate:\n\n\t\tT m_temp;\n\n\t};\n\n\t\n\n}\n\n#endif // SVECTOR_H\n", "file_path": "src/ObjectSerializer/Include/SVector.h", "rank": 3, "score": 105976.89703701655 }, { "content": " class SSet : public std::set<TKey>, public IContainer\n\n {\n\n\t\tOBJECT_SERIALIZABLE_CONT(SSet);\n\n public:\n\n\t\tSSet() {}\n\n\t\tSSet(const std::set<TKey>& p_other) : std::set<TKey>(p_other) {}\n\n int ContainerCount() const { return size(); }\n\n void Clear() { clear(); }\n\n char* GetTemp() { return reinterpret_cast<char*>(&m_temp); }\n\n void AddTemp() { insert(m_temp); }\n\n\t\tIterator*\t\tCreateIterator() const { return new SetIterator<TKey>(this); }\n\n\tprivate:\n\n TKey m_temp;\n\n };\n\n //----------------------------------------------------------------------------------------------\n\n template<class TKey>\n", "file_path": "src/ObjectSerializer/Include/SSet.h", "rank": 4, "score": 104330.7828478291 }, { "content": " Vector2T<T> v = Center;\n\n\n\n // Generate random radius in the range [1, R]\n\n int randR = (rand() % Radius) + 1;\n\n float randTheta = (float)rand();\n\n\n\n v.X += int(randR * (float)cos(randTheta));\n\n v.Y += int(randR * (float)sin(randTheta));\n\n\n\n return v;\n\n }\n\n\n\n Vector2T<T> Center;\n\n T Radius;\n\n };\n\n\n\n typedef Vector2T<int> Vector2;\n\n typedef Vector2T<float> Vector2F;\n\n typedef Circle2T<int> Circle2;\n\n typedef Circle2T<float> Circle2F;\n\n}\n\n\n\n#endif // VECTOR2_H", "file_path": "src/IStrategizer/Include/Vector2.h", "rank": 5, "score": 101571.6785493273 }, { "content": "#ifndef VECTOR2_H\n\n#define VECTOR2_H\n\n\n\n#include <cmath>\n\n#include <limits>\n\n#include <sstream>\n\n#include <cstdlib>\n\n#include <time.h>\n\n\n\n#define SQR(X) ((X) * (X))\n\n\n\nnamespace IStrategizer\n\n{\n\n template<class T>\n", "file_path": "src/IStrategizer/Include/Vector2.h", "rank": 6, "score": 101560.51783072152 }, { "content": " Y /= len;\n\n }\n\n\n\n std::string ToString()\n\n {\n\n std::stringstream ss;\n\n ss << '<';\n\n ss << X;\n\n ss << ',';\n\n ss << Y;\n\n ss << '>';\n\n\n\n return ss.str();\n\n }\n\n\n\n bool IsZero() const { return *this == Zero(); }\n\n bool IsInf() const { return *this == Inf(); }\n\n\n\n static const Vector2T& Zero() { static Vector2T zero; return zero; }\n\n static const Vector2T& One() { static Vector2T one(T(1), T(1)); return one; }\n\n#undef max\n\n static const Vector2T& Inf() { static Vector2T inf(std::numeric_limits<T>::max(), std::numeric_limits<T>::max()); return inf; }\n\n };\n\n\n\n template<class T>\n", "file_path": "src/IStrategizer/Include/Vector2.h", "rank": 7, "score": 101560.45533819513 }, { "content": " }\n\n\n\n Vector2T operator / (const T n)\n\n {\n\n return Vector2T(X / n, Y / n);\n\n }\n\n\n\n Vector2T operator * (const T n)\n\n {\n\n return Vector2T(X * n, Y * n);\n\n }\n\n\n\n T Length() const { return (T)sqrt(T(SQR(X) + SQR(Y))); }\n\n\n\n T Distance(const Vector2T& other) const { return (T)sqrt(T(SQR(other.X - X) + SQR(other.Y - Y))); }\n\n\n\n void Normalize()\n\n {\n\n T len = Length();\n\n X /= len;\n", "file_path": "src/IStrategizer/Include/Vector2.h", "rank": 8, "score": 101554.0161957306 }, { "content": " Vector2T& operator /=(const T n)\n\n {\n\n X /= n;\n\n Y /= n;\n\n return *this;\n\n }\n\n\n\n Vector2T operator + (const T n)\n\n {\n\n return Vector2T(X + n, Y + n);\n\n }\n\n\n\n Vector2T operator + (const Vector2T& right)\n\n {\n\n return Vector2T(X + right.X, Y + right.Y);\n\n }\n\n\n\n Vector2T operator - (const Vector2T& right)\n\n {\n\n return Vector2T(X - right.X, Y - right.Y);\n", "file_path": "src/IStrategizer/Include/Vector2.h", "rank": 9, "score": 101550.72496634065 }, { "content": " {\n\n X -= n;\n\n Y -= n;\n\n return *this;\n\n }\n\n\n\n Vector2T& operator +=(const Vector2T& right)\n\n {\n\n X += right.X;\n\n Y += right.Y;\n\n return *this;\n\n }\n\n\n\n Vector2T& operator *=(const T n)\n\n {\n\n X *= n;\n\n Y *= n;\n\n return *this;\n\n }\n\n\n", "file_path": "src/IStrategizer/Include/Vector2.h", "rank": 10, "score": 101550.21037088578 }, { "content": " class SMap : public std::map<TKey, TValue>, public IContainer\n\n {\n\n\t\tOBJECT_SERIALIZABLE_CONT(SMap);\n\n public:\n\n\t\tSMap() {}\n\n\t\tSMap(const std::map<TKey, TValue>& p_other) : std::map<TKey, TValue>(p_other) {}\n\n int ContainerCount() const { return size(); }\n\n void Clear() { clear(); }\n\n char* GetTemp() { return reinterpret_cast<char*>(&m_temp); }\n\n void AddTemp() { insert(m_temp); }\n\n\t\tIterator*\t\tCreateIterator() const { return new MapIterator<TKey, TValue>(this); }\n\n\n\n void Keys(std::vector<TKey>& keys) const \n\n {\n\n keys.resize(size());\n\n\n\n int i = 0;\n\n for(std::map<TKey, TValue>::const_iterator itr = begin();\n\n itr != end();\n\n ++itr, ++i)\n", "file_path": "src/ObjectSerializer/Include/SMap.h", "rank": 11, "score": 99786.3421704221 }, { "content": " class SPair : public std::pair<TKey, TValue>, public ISerializable \n\n {\n\n OBJECT_SERIALIZABLE(SPair, &first, &second);\n\n\n\n public:\n\n SPair() : pair(TKey(), TValue()) {}\n\n SPair(TKey p_first, TValue p_second) : pair(p_first, p_second) {}\n\n };\n\n\n\n template<class TKey, class TValue>\n\n SPair<TKey, TValue> inline MakePair(TKey p_first, TValue p_second) { return SPair<TKey, TValue>(p_first, p_second); }\n\n //----------------------------------------------------------------------------------------------\n\n}\n\n#endif // SPAIR_H\n", "file_path": "src/ObjectSerializer/Include/SPair.h", "rank": 12, "score": 99786.3421704221 }, { "content": " return true;\n\n }\n\n else\n\n {\n\n return false;\n\n }\n\n }\n\n //----------------------------------------------------------------------------------------------\n\n bool TryGetBySecond(const T2& p_key2, T1& p_key1)\n\n { \n\n std::hash_map<T2, int>::const_iterator itr = _secondMap.find(p_key2);\n\n\n\n if (itr != _secondMap.end())\n\n {\n\n p_key1 = _data[itr->second].first;\n\n return true;\n\n }\n\n else\n\n {\n\n return false;\n\n }\n\n }\n\n };\n\n}\n\n\n\n#endif // CROSSMAP_H\n", "file_path": "src/IStrategizer/Include/CrossMap.h", "rank": 13, "score": 49262.6645419918 }, { "content": " {\n\n p_values[i] = _data[i].first;\n\n }\n\n }\n\n }\n\n //----------------------------------------------------------------------------------------------\n\n void SecondValues(std::vector<T2>& p_values, bool p_append = false)\n\n {\n\n if (p_append)\n\n {\n\n p_values.reserve(p_values.size() + _data.size());\n\n for(int i = 0, size = _data.size(); i < size; ++i)\n\n {\n\n p_values.push_back(_data[i].second);\n\n }\n\n }\n\n else\n\n {\n\n p_values.resize(_data.size());\n\n for(int i = 0, size = _data.size(); i < size; ++i)\n", "file_path": "src/IStrategizer/Include/CrossMap.h", "rank": 14, "score": 49261.80453709788 }, { "content": " {\n\n _firstMap.clear();\n\n _secondMap.clear();\n\n _data.clear();\n\n }\n\n //----------------------------------------------------------------------------------------------\n\n void FirstValues(std::vector<T1>& p_values, bool p_append = false)\n\n {\n\n if (p_append)\n\n {\n\n p_values.reserve(p_values.size() + _data.size());\n\n for(int i = 0, size = _data.size(); i < size; ++i)\n\n {\n\n p_values.push_back(_data[i].first);\n\n }\n\n }\n\n else\n\n {\n\n p_values.resize(_data.size());\n\n for(int i = 0, size = _data.size(); i < size; ++i)\n", "file_path": "src/IStrategizer/Include/CrossMap.h", "rank": 15, "score": 49261.29520677817 }, { "content": "\t\tstd::string TypeName() const { return m_pTypeName; }\n\n\t\tint TypeSize() const { return (int)m_typeSize; }\n\n\t\tstd::string CName() const { return m_pCName; }\n\n\n\n\tprivate:\n\n\t\tvoid AddMemberAddress(size_t nAddresses, ...)\n\n\t\t{\n\n\t\t\tvoid* memberAddress;\n\n\t\t\tva_list argList;\n\n\t\t\t// The va_start macro is usually equivalent to:\n\n\t\t\t// pArgList = (void*) &p_memberAddress + sizeof (p_memberAddress) ;\n\n\t\t\tva_start(argList, nAddresses);\n\n\t\t\t++nAddresses;\n\n\t\t\twhile (--nAddresses)\n\n\t\t\t{\n\n\t\t\t\tmemberAddress = va_arg(argList, void*);\n\n\t\t\t\tm_childrenAdresses.push_back(reinterpret_cast<char*>(memberAddress));\n\n\t\t\t}\n\n\t\t\tva_end(argList);\n\n\t\t}\n\n\n\n\t\tconst char* m_pCName;\n\n\t\tconst char* m_pTypeName;\n\n\t\tsize_t m_typeSize;\n\n\t\tchar* m_pRootAddress;\n\n\t\tstd::vector<char*> m_childrenAdresses;\n\n\t\tIterator* m_pItr;\n\n\t};\n\n\n", "file_path": "src/ObjectSerializer/Include/ISerializable.h", "rank": 16, "score": 49258.9472395865 }, { "content": " }\n\n };\n\n //----------------------------------------------------------------------------------------------\n\n bool ContainsFirst(const T1& p_first)\n\n {\n\n return _firstMap.find(p_first) != _firstMap.end();\n\n }\n\n //----------------------------------------------------------------------------------------------\n\n bool ContainsSecond(const T2& p_second)\n\n {\n\n return _secondMap.find(p_second) != _secondMap.end();\n\n }\n\n //----------------------------------------------------------------------------------------------\n\n bool TryGetByFirst(const T1& p_key1, T2& p_key2)\n\n { \n\n std::hash_map<T1, int>::const_iterator itr = _firstMap.find(p_key1);\n\n\n\n if (itr != _firstMap.end())\n\n {\n\n p_key2 = _data[itr->second].second;\n", "file_path": "src/IStrategizer/Include/CrossMap.h", "rank": 17, "score": 49257.73927180324 }, { "content": "#ifndef SERIALIZABLE_H\n\n#define SERIALIZABLE_H\n\n\n\n#include <typeinfo>\n\n#include <stdarg.h>\n\n#include <string>\n\n#include <vector>\n\n#include \"ITraversable.h\"\n\n\n\nnamespace Serialization\n\n{\n\n\ttemplate<class T>\n", "file_path": "src/ObjectSerializer/Include/ISerializable.h", "rank": 18, "score": 49255.83071039862 }, { "content": "#ifndef ISTRATEGIZEREXCEPTIONS_H\n\n#define ISTRATEGIZEREXCEPTIONS_H\n\n\n\n#include <stdexcept>\n\n#include <ostream>\n\n#include <sstream>\n\n\n\nnamespace IStrategizer\n\n{\n", "file_path": "src/IStrategizer/Include/IStrategizerException.h", "rank": 19, "score": 49255.79484320858 }, { "content": "#ifndef CROSSMAP_H\n\n#define CROSSMAP_H\n\n\n\n#include <hash_map>\n\n#include <vector>\n\n#include <sstream>\n\n#include \"IStrategizerException.h\"\n\n\n\nnamespace IStrategizer\n\n{\n\n template<class T1, class T2>\n", "file_path": "src/IStrategizer/Include/CrossMap.h", "rank": 20, "score": 49255.622176314384 }, { "content": " //----------------------------------------------------------------------------------------------\n\n const T1& GetBySecond(const T2& p_key) throw(KeyNotFoundException)\n\n {\n\n if (!ContainsSecond(p_key))\n\n {\n\n std::stringstream xcptStream;\n\n xcptStream << \"Second Key '\";\n\n xcptStream << p_key;\n\n xcptStream << \"' not found\";\n\n\n\n DEBUG_THROW(KeyNotFoundException(XcptHere, xcptStream.str().c_str()));\n\n }\n\n\n\n return _data[_secondMap[p_key]].first; \n\n };\n\n //----------------------------------------------------------------------------------------------\n\n void SetByFirst(const T1& p_first, T2& p_newSecond) \n\n {\n\n int index;\n\n if(_firstMap.find(p_first) == _firstMap.end())\n", "file_path": "src/IStrategizer/Include/CrossMap.h", "rank": 21, "score": 49255.418168556316 }, { "content": " << \" @Line: \" << m_location.Line << \"] \"\n\n << std::exception::what() << std::endl;\n\n }\n\n\n\n const char* what() const { return m_formattedXcpt.c_str(); }\n\n\n\n protected:\n\n void Init()\n\n {\n\n std::stringstream sstream;\n\n To(sstream);\n\n\n\n m_formattedXcpt = sstream.str();\n\n }\n\n\n\n ExceptionLocation m_location;\n\n std::string m_formattedXcpt;\n\n };\n\n\n", "file_path": "src/IStrategizer/Include/IStrategizerException.h", "rank": 22, "score": 49255.208369796586 }, { "content": "#ifndef CONTAINER_H\n\n#define CONTAINER_H\n\n\n\n#include \"ISerializable.h\"\n\n\n\nnamespace Serialization\n\n{\n", "file_path": "src/ObjectSerializer/Include/Container.h", "rank": 23, "score": 49254.80877448373 }, { "content": "#pragma once\n\n\n\n#define VC_EXTRALEAN\n\n#define WIN32_LEAN_AND_MEAN\n\n#include <Windows.h>\n\n\n\nnamespace IStrategizer\n\n{\n", "file_path": "src/IStrategizer/Include/SmartPtr.h", "rank": 24, "score": 49254.637761277285 }, { "content": " {\n\n int index;\n\n if(_secondMap.find(p_second) == _secondMap.end())\n\n {\n\n _data.push_back(make_std::pair(p_newFirst, p_second));\n\n index = _data.size() - 1;\n\n _secondMap[p_second] = index;\n\n _firstMap[p_newFirst] = index;\n\n }\n\n else\n\n {\n\n index = _secondMap[p_second];\n\n T1& oldFirst = _data[index].first;\n\n\n\n if(p_newFirst == oldFirst)\n\n return;\n\n\n\n _firstMap.erase(oldFirst);\n\n _firstMap[p_newFirst] = index;\n\n _data[index].first = p_newFirst;\n", "file_path": "src/IStrategizer/Include/CrossMap.h", "rank": 25, "score": 49251.88226695561 }, { "content": " {\n\n _data.push_back(std::make_pair(p_first, p_newSecond));\n\n index = _data.size() - 1;\n\n _secondMap[p_newSecond] = index;\n\n _firstMap[p_first] = index;\n\n }\n\n else\n\n {\n\n index = _firstMap[p_first];\n\n T2& oldSecond = _data[index].second;\n\n if(p_newSecond == oldSecond)\n\n return;\n\n\n\n _secondMap.erase(oldSecond);\n\n _secondMap[p_newSecond] = index;\n\n _data[index].second = p_newSecond;\n\n }\n\n };\n\n //----------------------------------------------------------------------------------------------\n\n void SetBySecond(const T2& p_second, T1& p_newFirst) \n", "file_path": "src/IStrategizer/Include/CrossMap.h", "rank": 26, "score": 49251.796319361994 }, { "content": "\t\t\tm_pCName(typeid(*pRootAddress).name())\n\n\t\t{\n\n\t\t\tAddMemberAddress(sizeof...(Args), childrenAddresses...);\n\n\t\t}\n\n\n\n\t\ttemplate<typename TObject, typename... Args>\n\n\t\tObjectLayout(ObjectLayout parentLayout, const char* pTypeName, size_t typeSize, const TObject* pRootAddress, Args... childrenAddresses) :\n\n\t\t\tm_pTypeName(pTypeName),\n\n\t\t\tm_typeSize(typeSize),\n\n\t\t\tm_pItr(nullptr),\n\n\t\t\tm_pRootAddress((char*)pRootAddress),\n\n\t\t\tm_childrenAdresses(parentLayout.ChildAddresses().begin(), parentLayout.ChildAddresses().end()),\n\n\t\t\tm_pCName(typeid(*pRootAddress).name())\n\n\t\t{\n\n\t\t\tAddMemberAddress(sizeof...(Args), childrenAddresses...);\n\n\t\t}\n\n\n\n\t\tchar* RootAddress() { return m_pRootAddress; }\n\n\t\tconst std::vector<char*>& ChildAddresses() { return m_childrenAdresses; }\n\n\t\tIterator* GetIterator() const { return (m_pItr != nullptr ? m_pItr : new VectorIterator<char*>(&m_childrenAdresses)); }\n", "file_path": "src/ObjectSerializer/Include/ISerializable.h", "rank": 27, "score": 49251.722731025206 }, { "content": "\n\n\t\t\tif (m_current != m_pInnerVector->end())\n\n\t\t\t{\n\n\t\t\t\tif (!m_initialized)\n\n\t\t\t\t{\n\n\t\t\t\t\tm_initialized = true;\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t\telse\n\n\t\t\t\t{\n\n\t\t\t\t\t++m_current;\n\n\t\t\t\t\tif (m_current == m_pInnerVector->end())\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\telse\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\telse\n\n\t\t\t{\n\n\t\t\t\treturn false;\n", "file_path": "src/ObjectSerializer/Include/ISerializable.h", "rank": 28, "score": 49250.961772021656 }, { "content": "#ifndef TRAVERSABLE_H\n\n#define TRAVERSABLE_H\n\n\n\nnamespace Serialization\n\n{\n", "file_path": "src/ObjectSerializer/Include/ITraversable.h", "rank": 29, "score": 49249.86050799583 }, { "content": "\t\t\t}\n\n\t\t}\n\n\n\n\t\tvoid Reset()\n\n\t\t{\n\n\t\t\tm_initialized = false;\n\n\t\t\tm_current = m_pInnerVector->begin();\n\n\t\t}\n\n\t};\n\n\n", "file_path": "src/ObjectSerializer/Include/ISerializable.h", "rank": 30, "score": 49249.66031985877 }, { "content": " // if reference become zero delete the old data\n\n if (reference->Release() == 0)\n\n {\n\n pData->Dtor();\n\n HeapFree(GetProcessHeap(), 0, reference);\n\n }\n\n\n\n // Copy the data and reference pointer\n\n // and increment the reference count\n\n pData = sp.pData;\n\n reference = sp.reference;\n\n reference->AddRef();\n\n }\n\n return *this;\n\n }\n\n };\n\n}", "file_path": "src/IStrategizer/Include/SmartPtr.h", "rank": 31, "score": 49249.05422038221 }, { "content": " // Increment the reference count\n\n reference->AddRef();\n\n }\n\n\n\n SmartPtr(const SmartPtr<T>& sp) : pData(sp.pData), reference(sp.reference)\n\n {\n\n // Copy constructor\n\n // Copy the data and reference pointer\n\n // and increment the reference count\n\n reference->AddRef();\n\n }\n\n\n\n ~SmartPtr()\n\n {\n\n // Destructor\n\n // Decrement the reference count\n\n // if reference become zero delete the data\n\n if (reference->Release() == 0)\n\n {\n\n pData->Dtor();\n", "file_path": "src/IStrategizer/Include/SmartPtr.h", "rank": 32, "score": 49248.67997322031 }, { "content": " {\n\n p_values[i] = _data[i].second;\n\n }\n\n }\n\n }\n\n //----------------------------------------------------------------------------------------------\n\n const T2& GetByFirst(const T1& p_key) throw(KeyNotFoundException)\n\n {\n\n if (!ContainsFirst(p_key))\n\n {\n\n std::stringstream xcptStream;\n\n xcptStream << \"First Key '\";\n\n xcptStream << p_key;\n\n xcptStream << \"' not found\";\n\n\n\n DEBUG_THROW(KeyNotFoundException(XcptHere, xcptStream.str().c_str()));\n\n }\n\n\n\n return _data[_firstMap[p_key]].second; \n\n };\n", "file_path": "src/IStrategizer/Include/CrossMap.h", "rank": 33, "score": 49248.66619964112 }, { "content": " HeapFree(GetProcessHeap(), 0, reference);\n\n }\n\n }\n\n\n\n T& operator* ()\n\n {\n\n return *pData;\n\n }\n\n\n\n T* operator-> ()\n\n {\n\n return pData;\n\n }\n\n\n\n SmartPtr<T>& operator = (const SmartPtr<T>& sp)\n\n {\n\n // Assignment operator\n\n if (this != &sp) // Avoid self assignment\n\n {\n\n // Decrement the old reference count\n", "file_path": "src/IStrategizer/Include/SmartPtr.h", "rank": 34, "score": 49244.70120656957 }, { "content": " virtual bool MapIsBuildable(_In_ Vector2 loc, _In_ bool checkCanBuild) const = 0;\n\n virtual bool MapCanBuildHere(_In_ Vector2 loc, const IGameUnitType* pUnitType) = 0;\n\n virtual int MapTileSize() const = 0; // hit: return TILE_SIZE\n\n virtual GameUnitListPtr MapGasFields() const = 0;\n\n virtual bool MapHasPath(_In_ Vector2 srcPos, _In_ Vector2 dstPos) const = 0;\n\n virtual void MapDebugDraw() const = 0;\n\n virtual SmartPtr< ArrayList<TID> > MapUnitsOnTile(_In_ Vector2 loc) const = 0;\n\n virtual SmartPtr< ArrayList<TID> > MapUnitsInRegion(_In_ Vector2 loc) const = 0;\n\n\n\n // Player APIs\n\n virtual const IGameRace* PlayerRace(_In_ TID playerId) const = 0;\n\n virtual Vector2 PlayerStartLocation(_In_ TID playerId) const = 0;\n\n virtual PlayerType PlayerGetType(_In_ TID playerId) const = 0;\n\n virtual int PlayerMinerals(_In_ TID playerId) const = 0;\n\n virtual int PlayerGas(_In_ TID playerId) const = 0;\n\n virtual int PlayerSupplyUsed(_In_ TID playerId) const = 0;\n\n virtual int PlayerSupplyTotal(_In_ TID playerId) const = 0;\n\n virtual bool PlayerHasResearched(_In_ TID playerId, const IGameTechType* pTechType) const = 0;\n\n virtual int PlayerUpgradeLevel(_In_ TID playerId, const IGameUpgradeType* pUpgradeType) const = 0;\n\n virtual int PlayerMaxUpgradeLevel(_In_ TID playerId, const IGameUpgradeType* pUpgradeType) const = 0;\n", "file_path": "src/IStrategizer/Include/RtsAiEngine.h", "rank": 35, "score": 48032.599069411684 }, { "content": " virtual bool UnitTrain(_In_ TID unitId, _In_ const IGameUnitType* pUnitType) const = 0;\n\n virtual bool UnitResearch(_In_ TID unitId, _In_ const IGameTechType* pUnitType) const = 0;\n\n virtual bool UnitUpgrade(_In_ TID unitId, _In_ const IGameUpgradeType* pUnitType) const = 0;\n\n virtual bool UnitCanUseTechPosition(_In_ TID unitId, _In_ const IGameTechType* pTechType, _In_ Vector2 pos) const = 0;\n\n virtual bool UnitUseTechPosition(_In_ TID unitId, _In_ const IGameTechType* pTechType, _In_ Vector2 pos) const = 0;\n\n virtual bool UnitIsPlantingMine(_In_ TID unitId) const = 0;\n\n };\n\n\n\n struct EngineParams\n\n {\n\n unsigned GrndCtrlIMUpdateInterval;\n\n unsigned OccupanceIMUpdateInterval;\n\n int OccupanceIMCellSize;\n\n int GrndCtrlIMCellSize;\n\n PhaseType Phase;\n\n };\n\n\n", "file_path": "src/IStrategizer/Include/RtsAiEngine.h", "rank": 36, "score": 48030.34151000013 }, { "content": " virtual const IGameTechType* GetResearch(_In_ TID researchId) const = 0;\n\n virtual GameRaceListPtr GetRaces() const = 0;\n\n virtual GameTechTypeListPtr GetTechTypes() const = 0;\n\n virtual GameUpgradeTypeListPtr GetUpgradeTypes() const = 0;\n\n virtual GameUnitTypeListPtr GetUnitTypes() const = 0;\n\n\n\n virtual void DebugDrawMapLine(_In_ Vector2 p1, _In_ Vector2 p2, _In_ GameDrawColor c) const = 0;\n\n virtual void DebugDrawMapCircle(_In_ Vector2 p, _In_ int r, _In_ GameDrawColor c, _In_ bool fill = false) const = 0;\n\n virtual void DebugDrawMapText(_In_ Vector2 p, _In_ const char* pTxt) const = 0;\n\n virtual void DebugDrawMapRectangle(_In_ Vector2 topLeft, _In_ Vector2 bottomRight, _In_ GameDrawColor c, _In_ bool fill = false) const = 0;\n\n virtual void DebugDrawScreenText(_In_ Vector2 p, _In_ const char* pTxt, _In_ GameDrawColor c) const = 0;\n\n virtual void DebugDrawMapLastGameError(_In_ TID unitId) const = 0;\n\n virtual void DebugDrawUnitBuildBox(_In_ const IGameUnitType* pUnitType, _In_ Vector2 pos, _In_ GameDrawColor c) const = 0;\n\n\n\n // Map APIs\n\n virtual int MapWidth() const = 0;\n\n virtual int MapHeight() const = 0;\n\n virtual SmartPtr< ArrayList<Vector2> > GetStartLocations() const = 0;\n\n virtual Vector2 MapGetRegionCenter(_In_ TID entityId) const = 0;\n\n virtual bool MapIsExplored(_In_ Vector2 loc) const = 0;\n", "file_path": "src/IStrategizer/Include/RtsAiEngine.h", "rank": 37, "score": 48029.9215215 }, { "content": "#ifndef OBJECTFACTORY_H\n\n#define OBJECTFACTORY_H\n\n\n\n#include <string>\n\n#include <map>\n\n#include <memory>\n\n#include \"ISerializable.h\"\n\n\n\nusing namespace std;\n\nusing namespace Serialization;\n\n\n\ntypedef std::map<std::string, Serialization::ISerializable*> ObjectTable;\n\n\n\nnamespace Serialization\n\n{\n\n typedef Serialization::ISerializable* (*PfnUserObjectFactory)();\n\n typedef std::map<std::string, PfnUserObjectFactory> ObjectFactoryMap;\n\n\n\n template<class T>\n\n ISerializable* UserObjectFactory() { return new T; }\n\n\n", "file_path": "src/ObjectSerializer/Include/ObjectFactory.h", "rank": 38, "score": 48028.792831438644 }, { "content": "\n\n virtual TID UnitTarget(_In_ TID unitId) const = 0;\n\n virtual TID UnitOrderTarget(_In_ TID unitId) const = 0;\n\n virtual Vector2 UnitTargetPosition(_In_ TID unitId) const = 0;\n\n virtual Vector2 UnitOrderTargetPosition(_In_ TID unitId) const = 0;\n\n virtual int UnitLastCommandFrame(_In_ TID unitId) const = 0;\n\n virtual int UnitHitpoints(_In_ TID unitId) const = 0;\n\n virtual TID UnitBuildUnit(_In_ TID unitId) const = 0;\n\n virtual bool UnitTargetInWeaponRage(_In_ TID unitId, _In_ TID targetId) const = 0;\n\n\n\n // Unit Commands\n\n virtual bool UnitStop(_In_ TID unitId) const = 0;\n\n virtual bool UnitCancelConstruction(_In_ TID unitId) const = 0;\n\n virtual bool UnitAttack(_In_ TID unitId, _In_ TID targetId) const = 0;\n\n virtual bool UnitRepair(_In_ TID unitId, _In_ TID targetId) const = 0;\n\n virtual bool UnitGather(_In_ TID unitId, _In_ TID targetId) const = 0;\n\n virtual bool UnitAttackMove(_In_ TID unitId, _In_ Vector2 pos) const = 0;\n\n virtual bool UnitMove(_In_ TID unitId, _In_ Vector2 pos) const = 0;\n\n virtual bool UnitBuildAddon(_In_ TID unitId, _In_ const IGameUnitType* pUnitType) const = 0;\n\n virtual bool UnitBuild(_In_ TID unitId, _In_ const IGameUnitType* pUnitType, _In_ Vector2 pos) const = 0;\n", "file_path": "src/IStrategizer/Include/RtsAiEngine.h", "rank": 39, "score": 48027.59677290304 }, { "content": "#ifndef TYPENODE_H\n\n#define TYPENODE_H\n\n\n\n#include <fstream>\n\n#include <queue>\n\nusing namespace std;\n\n\n", "file_path": "src/ObjectSerializer/Include/TypeNode.h", "rank": 40, "score": 48027.536564928676 }, { "content": "#ifndef FILEMANAGER_H\n\n#define FILEMANAGER_H\n\n\n\n#ifndef EVERYTHING_H\n\n #include \"Everything.h\"\n\n#endif\n\n\n\n#include <vector>\n\n#include <stack>\n\nusing namespace std;\n\n\n", "file_path": "src/ObjectSerializer/Include/FileManager.h", "rank": 41, "score": 48027.21600843936 }, { "content": " virtual bool PlayerIsResearchAvailable(_In_ TID playerId, const IGameTechType* pTechType) const = 0;\n\n virtual bool PlayerIsNeutral(_In_ TID playerId) const = 0;\n\n virtual int PlayerCompletedUnitCount(_In_ TID playerId, const IGameUnitType* pUnitType) const = 0;\n\n\n\n // Unit APIs\n\n virtual Vector2 UnitTilePosition(_In_ TID unitId) const = 0;\n\n virtual Vector2 UnitPosition(_In_ TID unitId) const = 0;\n\n virtual Vector2 UnitTopLeft(_In_ TID unitId) const = 0;\n\n virtual Vector2 UnitBottomRight(_In_ TID unitId) const = 0;\n\n virtual const IGameUnitType* UnitGetType(_In_ TID unitId) const = 0;\n\n virtual TID UnitPlayer(_In_ TID unitId) const = 0;\n\n virtual bool UnitExists(_In_ TID unitId) const = 0;\n\n\n\n // Unit Is\n\n virtual bool UnitIsVisible(_In_ TID unitId) const = 0;\n\n virtual bool UnitIsDetected(_In_ TID unitId) const = 0;\n\n virtual bool UnitIsStuck(_In_ TID unitId) const = 0;\n\n virtual bool UnitIsGatheringGas(_In_ TID unitId) const = 0;\n\n virtual bool UnitIsGatheringMinerals(_In_ TID unitId) const = 0;\n\n virtual bool UnitIsBeingGathered(_In_ TID unitId) const = 0;\n", "file_path": "src/IStrategizer/Include/RtsAiEngine.h", "rank": 42, "score": 48026.459135133584 }, { "content": "#ifndef TYPERESOLVER_H\n\n#define TYPERESOLVER_H\n\n\n\n#ifndef TYPETABLE_H\n\n #include \"TypeTable.h\"\n\n#endif\n\n\n\n#ifndef OBJECTFACTORY_H\n\n #include \"ObjectFactory.h\"\n\n#endif\n\n#include \"TypeNode.h\"\n\n\n\n#include <set>\n\nusing namespace std;\n\n\n", "file_path": "src/ObjectSerializer/Include/TypeResolver.h", "rank": 43, "score": 48026.45135013861 }, { "content": "#ifndef OBJECTFORMATTER_H\n\n#define OBJECTFORMATTER_H\n\n\n\n#include <string>\n\n#include <vector>\n\n#include <map>\n\nusing namespace std;\n\n\n\n#ifndef TYPEDECLARATIONPARSER_H\n\n#include \"TypeDeclarationParser.h\"\n\n#endif\n\n\n\n#ifndef TYPENODE_H\n\n#include \"TypeNode.h\"\n\n#endif\n\n\n\n#ifndef TYPETABLE_H\n\n #include \"TypeTable.h\"\n\n#endif\n\n\n", "file_path": "src/ObjectSerializer/Include/ObjectFormatter.h", "rank": 44, "score": 48025.88064607246 }, { "content": " int DeserializeBasicType(char* pMem, TypeNode* pType, std::fstream& eye);\n\n int DeserializeUserDefinedType(ISerializable* pObj, TypeNode* pType, bool p_isPtr, std::fstream& eye);\n\n int DeserializeArray(char* pMem, TypeNode* pType, std::fstream& eye);\n\n int DeserializeString(char* pMem, TypeNode* pType, std::fstream& eye);\n\n int DeserializeContainerVector(ISerializable* pObj, TypeNode* pType, std::fstream& eye);\n\n int DeserializeContainerMap(ISerializable* pObj, TypeNode* pType, std::fstream& eye);\n\n int DeserializeContainerSet(ISerializable* pObj, TypeNode* pType, std::fstream& eye);\n\n int DeserializePair(ISerializable* pObj, TypeNode* pType, std::fstream& eye);\n\n\n\n public:\n\n ObjectSerializer();\n\n TypeTable& TypeTable() { return m_typeTable; }\n\n void Serialize(const ISerializable* p_object, std::string objectFileName);\n\n void Deserialize(ISerializable* pObj, std::string objectFileName);\n\n static ObjectSerializer& Instance() { static ObjectSerializer instance; return instance; }\n\n void PerformLateBinding(ISerializable* pObj, TypeNode*& pType );\n\n bool IsAncestor( const std::string& candidateAncestor, const std::string& candidateChild );\n\n };\n\n}\n\n\n\n#define g_ObjectSerializer Serialization::ObjectSerializer::Instance()\n\n\n\n#endif // OBJECTSERIALIZER_H\n", "file_path": "src/ObjectSerializer/Include/ObjectSerializer.h", "rank": 45, "score": 48025.85551879368 }, { "content": " {\n\n keys[i] = itr->first;\n\n }\n\n }\n\n\n\n void Values(std::vector<TValue>& values) const\n\n {\n\n values.resize(size());\n\n\n\n int i = 0;\n\n for(std::map<TKey, TValue>::const_iterator itr = begin();\n\n itr != end();\n\n ++itr, ++i)\n\n {\n\n values[i] = itr->second;\n\n }\n\n }\n\n\n\n bool TryGet(const TKey& key, TValue& value) const\n\n {\n", "file_path": "src/ObjectSerializer/Include/SMap.h", "rank": 46, "score": 48024.161149432686 }, { "content": " virtual bool IsResourceDepot() const = 0;\n\n virtual int SupplyProvided() const = 0;\n\n virtual int TileWidth() const = 0;\n\n virtual int TileHeight() const = 0;\n\n virtual bool IsMineralsField() const = 0;\n\n virtual bool IsGasField() const = 0;\n\n virtual int SightRange() const = 0;\n\n virtual int DimensionLeft() const = 0;\n\n virtual int DimensionUp() const = 0;\n\n virtual bool IsRefinery() const = 0;\n\n virtual GameWeaponType GroundWeapon() const = 0;\n\n virtual GameWeaponType AirWeapon() const = 0;\n\n virtual const char* ToString() const = 0;\n\n virtual bool CanMove() const = 0;\n\n };\n\n\n", "file_path": "src/IStrategizer/Include/RtsAiEngine.h", "rank": 47, "score": 48022.54545772133 }, { "content": " ~TypeNode();\n\n\n\nprotected:\n\n void FullNameAux(string& p_str, bool p_templateFlag = true, bool p_childrenFlag = true);\n\n string ToString(DataType p_type);\n\n//----------------------------------------------------------------------------------------------\n\npublic:\n\n static void Write(TypeNode* p_root, fstream& p_pen);\n\n static TypeNode* Read(fstream& p_eye);\n\n\n\nprotected:\n\n static void WriteTemplateData(TypeNode* p_typeNode, fstream& p_pen);\n\n static void ReadTemplateData(TypeNode* p_typeNode, fstream& p_eye);\n\n};\n\n\n\n#endif // TYPENODE_H\n", "file_path": "src/ObjectSerializer/Include/TypeNode.h", "rank": 48, "score": 48021.85916455306 }, { "content": "#ifndef RTSAIENGINE_H\n\n#define RTSAIENGINE_H\n\n\n\n#include \"MetaData.h\"\n\n#include \"Vector2.h\"\n\n#include \"SmartPtr.h\"\n\n#include \"IMessagePumpObserver.h\"\n\n#undef min\n\n#undef max\n\n\n\nnamespace IStrategizer\n\n{\n\n enum GameDrawColor\n\n {\n\n GCLR_Red,\n\n GCLR_Green,\n\n GCLR_Blue,\n\n GCLR_Yellow,\n\n GCLR_White,\n\n GCLR_Orange,\n", "file_path": "src/IStrategizer/Include/RtsAiEngine.h", "rank": 49, "score": 48020.97309667691 }, { "content": " virtual bool UnitIsMoving(_In_ TID unitId) const = 0;\n\n virtual bool UnitIsAttacking(_In_ TID unitId) const = 0;\n\n virtual bool UnitIsInAttackFrame(_In_ TID unitId) const = 0;\n\n virtual bool UnitIsUnderAttack(_In_ TID unitId) const = 0;\n\n virtual bool UnitIsRepairing(_In_ TID unitId) const = 0;\n\n virtual bool UnitIsIdle(_In_ TID unitId) const = 0;\n\n virtual bool UnitIsCompleted(_In_ TID unitId) const = 0;\n\n virtual bool UnitIsBeingConstructed(_In_ TID unitId) const = 0;\n\n virtual bool UnitIsConstructing(_In_ TID unitId) const = 0;\n\n virtual bool UnitIsTargetable(_In_ TID unitId) const = 0;\n\n virtual bool UnitIsTraining(_In_ TID unitId) const = 0;\n\n\n\n // Unit Can\n\n virtual bool UnitIsInterruptible(_In_ TID unitId) const = 0;\n\n virtual bool UnitCanAttackUnit(_In_ TID unitId, _In_ TID targetId) const = 0;\n\n virtual bool UnitCanBuildAddOn(_In_ TID unitId, _In_ const IGameUnitType* pUnitType) const = 0;\n\n virtual bool UnitCanBuild(_In_ TID unitId, _In_ const IGameUnitType* pUnitType) const = 0;\n\n virtual bool UnitCanRepair(_In_ TID unitId, _In_ TID targetId) const = 0;\n\n virtual bool UnitCanGather(_In_ TID unitId, _In_ TID targetId) const = 0;\n\n virtual bool UnitCanTrain(_In_ TID unitId, _In_ const IGameUnitType* pUnitType) const = 0;\n", "file_path": "src/IStrategizer/Include/RtsAiEngine.h", "rank": 50, "score": 48019.70720495078 }, { "content": "#ifndef OBJECTSERIALIZER_H\n\n#define OBJECTSERIALIZER_H\n\n\n\n#include <fstream>\n\n#include \"TypeTable.h\"\n\n#include \"ISerializable.h\"\n\n\n\nnamespace Serialization\n\n{\n", "file_path": "src/ObjectSerializer/Include/ObjectSerializer.h", "rank": 51, "score": 48017.85494150746 }, { "content": "#ifndef SVECTOR_H\n\n#define SVECTOR_H\n\n\n\n#include <vector>\n\n#include \"Container.h\"\n\n#include \"ISerializable.h\"\n\n\n\nnamespace Serialization\n\n{\n\n\ttemplate<class T>\n", "file_path": "src/ObjectSerializer/Include/SVector.h", "rank": 52, "score": 48017.79355867297 }, { "content": "#ifndef SSET_H\n\n#define SSET_H\n\n\n\n#include <set>\n\n#include \"Container.h\"\n\n#include \"ISerializable.h\"\n\n\n\nnamespace Serialization\n\n{\n\n template<class TKey>\n", "file_path": "src/ObjectSerializer/Include/SSet.h", "rank": 53, "score": 48017.73297231831 }, { "content": " m_initialized = true;\n\n return true;\n\n }\n\n else\n\n {\n\n ++m_current;\n\n if(m_current == m_set->end())\n\n return false;\n\n else\n\n return true;\n\n }\n\n }\n\n else\n\n {\n\n return false;\n\n }\n\n }\n\n\n\n void Reset()\n\n {\n\n m_initialized = false;\n\n m_current = m_set->begin();\n\n }\n\n };\n\n\n\n}\n\n#endif // SSET_H\n", "file_path": "src/ObjectSerializer/Include/SSet.h", "rank": 54, "score": 48017.55685028125 }, { "content": "#ifndef SMAP_H\n\n#define SMAP_H\n\n\n\n#include <map>\n\n#include \"Container.h\"\n\n#include \"SPair.h\"\n\n\n\nnamespace Serialization\n\n{\n\n template<class TKey, class TValue>\n", "file_path": "src/ObjectSerializer/Include/SMap.h", "rank": 55, "score": 48017.55582302611 }, { "content": "#ifndef SPAIR_H\n\n#define SPAIR_H\n\n\n\n#include <map>\n\n#include \"ISerializable.h\"\n\n\n\nnamespace Serialization\n\n{\n\n template<class TKey, class TValue>\n", "file_path": "src/ObjectSerializer/Include/SPair.h", "rank": 56, "score": 48017.31923779587 }, { "content": " return true;\n\n }\n\n }\n\n }\n\n else\n\n {\n\n return false;\n\n }\n\n }\n\n\n\n void Reset()\n\n {\n\n m_initialized = false;\n\n m_current = m_map->begin();\n\n }\n\n };\n\n}\n\n#endif // SMAP_H\n", "file_path": "src/ObjectSerializer/Include/SMap.h", "rank": 57, "score": 48016.70518931798 }, { "content": " }\n\n\n\n void Dtor()\n\n {\n\n HeapFree(GetProcessHeap(), 0, m_pArr);\n\n m_size = 0;\n\n HeapFree(GetProcessHeap(), 0, this);\n\n // Object not valid after this line\n\n }\n\n\n\n T& At(_In_ int i) { return m_pArr[i]; }\n\n const T& At(_In_ int i) const { return m_pArr[i]; }\n\n int Size() const { return m_size; }\n\n\n\n private:\n\n ArrayList(const ArrayList&);\n\n ArrayList& operator = (const ArrayList&);\n\n\n\n T* m_pArr;\n\n int m_size;\n\n };\n\n\n", "file_path": "src/IStrategizer/Include/RtsAiEngine.h", "rank": 58, "score": 48016.67208024548 }, { "content": " GCLR_Cyan,\n\n GCLR_Purple,\n\n GCLR_Black\n\n };\n\n\n\n struct EntityMessageData\n\n {\n\n EntityClassType EntityType;\n\n TID EntityId;\n\n PlayerType OwnerId;\n\n int X;\n\n int Y;\n\n };\n\n\n\n template<class TKey, class TValue>\n\n struct Pair\n\n {\n\n TKey Key;\n\n TValue Value;\n\n };\n\n\n\n template<class T>\n", "file_path": "src/IStrategizer/Include/RtsAiEngine.h", "rank": 59, "score": 48016.023052723016 }, { "content": " if(count(key) > 0)\n\n {\n\n value = at(key);\n\n return true;\n\n }\n\n\n\n return false;\n\n }\n\n\n\n bool Contains(const TKey& key) const { return count(key) > 0; }\n\n\n\n\tprivate:\n\n\t\tSPair<TKey, TValue> m_temp;\n\n };\n\n //----------------------------------------------------------------------------------------------\n\n template<class TKey, class TValue>\n", "file_path": "src/ObjectSerializer/Include/SMap.h", "rank": 60, "score": 48015.77536942478 }, { "content": " void GetAliasNode(Attributes& p_attributes, TypeTable& p_typeTable, TypeNode*& p_lastTypeRoot);\n\n bool IsFormatLine(string& p_line, string& p_format);\n\n void CollectTemplateSpecialization(TypeTable& p_typeTable, Serialization::ObjectFactoryMap& p_objectTable);\n\n\n\npublic:\n\n ~ObjectFormatter();\n\n ObjectFormatter();\n\n \n\n void WriteTypeTable(const string& p_sourceCodeDir);\n\n void FinalizeTypeTable(TypeTable& p_typeTable, Serialization::ObjectFactoryMap& p_objectTable);\n\n void ReadTypeTable(TypeTable& p_typeTable);\n\n static ObjectFormatter& Instance() { static ObjectFormatter instance; return instance; }\n\n\n\n#define g_ObjectFormatter ObjectFormatter::Instance()\n\n};\n\n\n\n#endif // OBJECTFORMATTER_H\n", "file_path": "src/ObjectSerializer/Include/ObjectFormatter.h", "rank": 61, "score": 48015.28534658838 }, { "content": "#ifndef TYPETABLE_H\n\n#define TYPETABLE_H\n\n\n\n#include <string>\n\n#include <vector>\n\n#include <map>\n\n\n", "file_path": "src/ObjectSerializer/Include/TypeTable.h", "rank": 62, "score": 48013.059331177006 }, { "content": " }\n\n\n\n if(m_current != m_map->end())\n\n {\n\n if(!m_initialized)\n\n {\n\n m_initialized = true;\n\n m_pair.first = m_current->first;\n\n m_pair.second = m_current->second;\n\n return true;\n\n }\n\n else\n\n {\n\n ++m_current;\n\n if(m_current == m_map->end())\n\n return false;\n\n else\n\n {\n\n m_pair.first = m_current->first;\n\n m_pair.second = m_current->second;\n", "file_path": "src/ObjectSerializer/Include/SMap.h", "rank": 63, "score": 48012.35715810888 }, { "content": "#ifndef MESSAGEPUMPOBSERVER_H\n\n#define MESSAGEPUMPOBSERVER_H\n\n\n\nnamespace IStrategizer\n\n{\n", "file_path": "src/IStrategizer/Include/IMessagePumpObserver.h", "rank": 64, "score": 48011.982803318904 }, { "content": "#ifndef OBJECTFACTORY_H\n\n #include \"ObjectFactory.h\"\n\n#endif\n\n\n\nextern string g_SerializationSystemWorkingDir;\n\nextern string g_TypeInfoPath;\n\nextern string g_TypeLexerFilePath;\n\nextern string g_TypeNamesFilePath;\n\nextern string g_SerializationTag;\n\n\n", "file_path": "src/ObjectSerializer/Include/ObjectFormatter.h", "rank": 65, "score": 48011.02833770735 }, { "content": " class ITraversable\n\n {\n\n public:\n\n virtual ~ITraversable() {}\n\n virtual Iterator* GetIterator() const = 0;\n\n };\n\n}\n\n\n\n#endif // TRAVERSABLE_H\n", "file_path": "src/ObjectSerializer/Include/ITraversable.h", "rank": 66, "score": 48006.82350189264 }, { "content": " m_factories[pNameOverride] = &UserObjectFactory<T>;\n\n }\n\n else\n\n {\n\n\t\t\t\tstring tname = objLayout.TypeName();\n\n m_cNameToFullNameTable[cname] = tname;\n\n m_factories[tname] = &UserObjectFactory<T>;\n\n }\n\n\n\n return UserObjectFactory<T>;\n\n }\n\n\n\n ObjectFactoryMap& GetObjectTable() { return m_factories; }\n\n static ObjectFactory& Instance() { static ObjectFactory instance; return instance; }\n\n };\n\n\n\n#define g_ObjectFactory ObjectFactory::Instance()\n\n#define DECL_SERIALIZABLE(C) \\\n\n static PfnUserObjectFactory __pfn##C##Factory_Internal = g_ObjectFactory.AddPrototype<C>();\n\n#define DECL_SERIALIZABLE_NAMED(C, NAME) \\\n\n static PfnUserObjectFactory __pfn##C##Factory_Internal = g_ObjectFactory.AddPrototype<C>(NAME);\n\n}\n\n#endif // OBJECTFACTORY_H_H\n", "file_path": "src/ObjectSerializer/Include/ObjectFactory.h", "rank": 67, "score": 48006.82350189264 }, { "content": " class RC\n\n {\n\n private:\n\n int count; // Reference count\n\n\n\n public:\n\n void AddRef()\n\n {\n\n // Increment the reference count\n\n count++;\n\n }\n\n\n\n int Release()\n\n {\n\n // Decrement the reference count and\n\n // return the reference count.\n\n return --count;\n\n }\n\n };\n\n\n\n template < typename T >\n", "file_path": "src/IStrategizer/Include/SmartPtr.h", "rank": 68, "score": 48006.82350189264 }, { "content": " class Iterator\n\n {\n\n public:\n\n virtual ~Iterator() {}\n\n virtual char* Current() = 0;\n\n virtual bool MoveNext() = 0;\n\n virtual void Reset() = 0;\n\n };\n\n\n", "file_path": "src/ObjectSerializer/Include/ITraversable.h", "rank": 69, "score": 48006.82350189264 }, { "content": "\tclass ISerializable\n\n\t{\n\n\tpublic:\n\n\t\tvirtual ~ISerializable() {}\n\n\t\tvirtual ObjectLayout GetObjectLayout() const = 0;\n\n\t};\n\n\n\n\textern size_t sm_lastSerializableObjID;\n\n}\n\n\n\n#define OBJECT_SERIALIZABLE(C, ...) \\\n\n\tpublic: \\\n\n\tSerialization::ObjectLayout GetObjectLayout() const { return Serialization::ObjectLayout(#C, sizeof(*this), this, __VA_ARGS__); }\n\n\n\n#define OBJECT_SERIALIZABLE_P(C, P, ...) \\\n\n\tpublic: \\\n\n\tSerialization::ObjectLayout GetObjectLayout() const { return Serialization::ObjectLayout(P::GetObjectLayout(), #C, sizeof(*this), this, __VA_ARGS__); }\n\n\n\n#define OBJECT_SERIALIZABLE_CONT(C, ...) \\\n\n\tpublic: \\\n\n\tSerialization::ObjectLayout GetObjectLayout() const { return Serialization::ObjectLayout(CreateIterator(), #C, sizeof(*this), this, __VA_ARGS__); }\n\n\n\n#endif // SERIALIZABLE_H", "file_path": "src/ObjectSerializer/Include/ISerializable.h", "rank": 70, "score": 48006.82350189264 }, { "content": " class ArmyEnemyData\n\n {\n\n public:\n\n ArmyEnemyData() :\n\n E(nullptr),\n\n DistanceToCenter(INT_MAX),\n\n TargetEntityId(INVALID_TID),\n\n IsInApproxRange(false),\n\n IsAttackingArmy(false)\n\n {}\n\n\n\n GameEntity* E;\n\n int DistanceToCenter;\n\n TID TargetEntityId;\n\n bool IsInApproxRange;\n\n bool IsAttackingArmy;\n\n\n\n // The penalty incurred to the army if chosen this unit\n\n // to attack next frame\n\n // This value is computed for every army reachable unit\n\n // every frame based on a hard coded rules\n\n int SelectionPenalty;\n\n };\n\n\n", "file_path": "src/IStrategizer/ArmyController.h", "rank": 71, "score": 47266.125661472775 }, { "content": "#ifndef TYPEDECLARATIONPARSER_H\n\n#define TYPEDECLARATIONPARSER_H\n\n\n\n#include <map>\n\nusing namespace std;\n\n\n\n#ifndef LEXICALANALYZER_H\n\n#include \"LexicalAnalyzer.h\"\n\n#endif\n\n\n\n#ifndef ABSTRACTPARSER_H\n\n #include \"AbstractParser.h\"\n\n#endif\n\n\n\n#ifndef TYPENODE_H\n\n #include \"TypeNode.h\"\n\n#endif\n\n\n", "file_path": "src/ObjectSerializer/Include/TypeDeclarationParser.h", "rank": 72, "score": 46848.93460260819 }, { "content": " class CrossMap\n\n {\n\n private:\n\n std::hash_map<T1, int> _firstMap;\n\n std::hash_map<T2, int> _secondMap;\n\n std::vector< std::pair<T1, T2> > _data;\n\n\n\n public:\n", "file_path": "src/IStrategizer/Include/CrossMap.h", "rank": 73, "score": 46829.65352034651 }, { "content": " class Message;\n", "file_path": "src/IStrategizer/Include/IMessagePumpObserver.h", "rank": 74, "score": 46829.65352034651 }, { "content": " class ExceptionLocation\n\n {\n\n public:\n\n const char* Function;\n\n const char* File;\n\n int Line;\n\n ExceptionLocation(const char* p_file, const char* p_function, int p_line) :\n\n File(p_file), Function(p_function), Line(p_line) {}\n\n };\n\n\n\n#define XcptHere ExceptionLocation(__FILE__, __FUNCTION__, __LINE__)\n\n\n\n /*\n\n Use DEBUG_THROW macro to control thrown exceptions behavior between really throwing it or replace it with assert\n\n If DEBUG_ISTRATEGIZER_EXCEPTION is defined, DEBUG_THROW replaces the throw call with _ASSERTE(!<exception-string>)\n\n */\n\n#define DEBUG_ISTRATEGIZER_EXCEPTION\n\n\n\n#ifdef DEBUG_ISTRATEGIZER_EXCEPTION\n\n#define DEBUG_THROW(X) { _ASSERTE(!#X); throw X; }\n\n#else\n\n#define DEBUG_THROW(X) throw X\n\n#endif\n\n\n", "file_path": "src/IStrategizer/Include/IStrategizerException.h", "rank": 75, "score": 46829.65352034651 }, { "content": " class SmartPtr\n\n {\n\n private:\n\n T* pData; // pointer\n\n RC* reference; // Reference count\n\n\n\n public:\n\n SmartPtr() : pData(0), reference(0)\n\n {\n\n // Create a new reference \n\n reference = (RC*)HeapAlloc(GetProcessHeap(), 0, sizeof(RC));\n\n ZeroMemory(&reference, sizeof(reference));\n\n // Increment the reference count\n\n reference->AddRef();\n\n }\n\n\n\n SmartPtr(T* pValue) : pData(pValue), reference(0)\n\n {\n\n // Create a new reference \n\n reference = (RC*)HeapAlloc(GetProcessHeap(), 0, sizeof(RC));\n", "file_path": "src/IStrategizer/Include/SmartPtr.h", "rank": 76, "score": 46829.65352034651 }, { "content": "class ObjectFormatter\n\n{\n\n LexicalAnalyzer* m_lexer;\n\n TypeDeclarationParser* m_parser;\n\n CharacterBuffer* m_buffer;\n\n vector<string> m_sourceFiles;\n\n vector<string> m_typeNames;\n\n map<string, HeaderAttribute> m_headerNameMap;\n\n\n\n void ReadTypeNames();\n\n void WriteTypeNames();\n\n void ReadSourceFiles(const string& p_sourceCodeDir);\n\n void InitializeParsing();\n\n void ParseFormat(string& p_formatLine, TypeTable& p_typeTable, TypeNode*& p_lastTypeRoot);\n\n void Split(string& p_str, char p_delim, vector<string>& p_tokens);\n\n void ExtractTypes(string& p_sourceFileName, TypeTable& p_typeTable);\n\n void GetAttributes(string& p_line, Attributes& p_attributes);\n\n void GetMemberNode(Attributes& p_attributes, TypeTable& p_typeTable, TypeNode*& p_lastTypeRoot);\n\n void GetNewTypeNode(Attributes& p_attributes, TypeTable& p_typeTable, TypeNode*& p_lastTypeRoot);\n\n void GetParentNode(Attributes& p_attributes, TypeTable& p_typeTable, TypeNode*& p_lastTypeRoot);\n", "file_path": "src/ObjectSerializer/Include/ObjectFormatter.h", "rank": 77, "score": 45708.83232495251 }, { "content": "class TypeResolver\n\n{\n\n set<string> m_completeTypes;\n\n //----------------------------------------------------------------------------------------------\n\n void TypeMemberSubstitution( TypeData& p_tableEntry, TypeTable& p_typeTable, vector<TypeChild>& p_children );\n\n void TypeParentSubstitution( TypeData& p_tableEntry, TypeTable& p_typeTable, vector<TypeChild>& p_children );\n\n void ShallowTypeSubstitution(const string& p_typeName, TypeTable& p_typeTable, vector<TypeChild>& p_children);\n\n TypeNode* AliasSubstitution(const TypeNode* p_typeNode, const TypeTable& p_typeTable);\n\n void SpecializeAux(TypeNode* p_targetType, TypeNode* p_specialization, TypeTable& p_typeTable);\n\n\n\npublic:\n\n TypeResolver() {}\n\n void Resolve(TypeTable& p_typeTable);\n\n void Specialize(TypeNode* p_specialization, TypeData& p_typeTemplate, TypeTable& p_typeTable);\n\n\n\n static TypeResolver& Instance() { static TypeResolver instance; return instance; }\n\n#define g_TypeResolver TypeResolver::Instance()\n\n};\n\n\n\n#endif // TYPERESOLVER_H\n", "file_path": "src/ObjectSerializer/Include/TypeResolver.h", "rank": 78, "score": 45708.83232495251 }, { "content": "class FileManager\n\n{\n\n stack<TCHAR*> dirStack;\n\n TCHAR workingDirectory[MAX_PATH_LONG+1];\n\n TCHAR currPath[MAX_PATH_LONG+1];\n\n BOOL TraverseDirectory(LPTSTR, LPTSTR, DWORD, LPBOOL, CHAR* filter, vector<string>& filePathes);\n\n DWORD FileType(LPWIN32_FIND_DATA);\n\n int GetFilesAux(int argc, LPTSTR argv[], CHAR* filter, vector<string>& filePathes);\n\n BOOL CompareExtension(CHAR *filename, CHAR *extension);\n\npublic:\n\n FileManager();\n\n void PushDir(const TCHAR* p_currentDir);\n\n void PopDir();\n\n const TCHAR* GetCurrentDir();\n\n vector<string> GetFiles(const TCHAR* p_dirPath, char* p_filter);\n\n static FileManager& Instance() { static FileManager instance; return instance; }\n\n #define g_FileManager FileManager::Instance()\n\n};\n\n\n\n#endif // FILEMANAGER_H\n", "file_path": "src/ObjectSerializer/Include/FileManager.h", "rank": 79, "score": 45708.83232495251 }, { "content": "\tclass IContainer : public ISerializable\n\n\t{\n\n\tpublic:\n\n\t\t~IContainer() {}\n\n\t\tvirtual int ContainerCount() const = 0;\n\n\t\tvirtual void Clear() = 0;\n\n\t\tvirtual void AddTemp() = 0;\n\n\t\tvirtual char* GetTemp() = 0;\n\n\t\tvirtual Iterator*\tCreateIterator() const = 0;\n\n\n\n\t};\n\n}\n\n#endif // CONTAINER_H\n", "file_path": "src/ObjectSerializer/Include/Container.h", "rank": 80, "score": 45708.83232495251 }, { "content": " class ObjectSerializer\n\n {\n\n TypeTable m_typeTable;\n\n int m_basicTypeSize[16];\n\n\n\n protected:\n\n void InitializeDataTypes();\n\n void InitializeTypeTable();\n\n\n\n int SerializeType(char* pMem, TypeNode* pType, std::fstream& pen);\n\n int SerializeBasicType(char* pMem, TypeNode* pType, std::fstream& pen);\n\n int SerializeUserDefinedType(ISerializable* pObj, TypeNode* pType, bool p_isPtr, std::fstream& pen);\n\n int SerializeArray(char* pMem, TypeNode* pType, std::fstream& pen);\n\n int SerializeString(char* pMem, TypeNode* pType, std::fstream& pen);\n\n int SerializeContainerVector(ISerializable* pObj ,TypeNode* pType, std::fstream& pen);\n\n int SerializeContainerMap(ISerializable* pObj, TypeNode* pType, std::fstream& pen);\n\n int SerializeContainerSet(ISerializable* pObj, TypeNode* pType, std::fstream& pen);\n\n int SerializePair(ISerializable* pObj, TypeNode* pType, std::fstream& pen);\n\n\n\n int DeserializeType(char* pMem, TypeNode* pType, std::fstream& eye);\n", "file_path": "src/ObjectSerializer/Include/ObjectSerializer.h", "rank": 81, "score": 45708.83232495251 }, { "content": "enum DataType\n\n{\n\n DTYPE_Bool,\n\n DTYPE_Char,\n\n DTYPE_Short,\n\n DTYPE_Int,\n\n DTYPE_Unsigned,\n\n DTYPE_Float,\n\n DTYPE_Double,\n\n DYTPE_BasicTypeCount,\n\n DTYPE_Array,\n\n DTYPE_String,\n\n DTYPE_Map,\n\n DTYPE_Set,\n\n DTYPE_Vector,\n\n DTYPE_Pair,\n\n DTYPE_UserDefined,\n\n DTYPE_Template,\n\n DTYPE_Undefined\n\n};\n\n\n\n#define MaxTypeNameLength 127\n\n#define TypeExtension \".type\"\n\n\n", "file_path": "src/ObjectSerializer/Include/TypeNode.h", "rank": 82, "score": 45708.83232495251 }, { "content": " class IGameRace;\n", "file_path": "src/IStrategizer/Include/RtsAiEngine.h", "rank": 83, "score": 45708.83232495251 }, { "content": " class ObjectFactory\n\n {\n\n map<string, string> m_cNameToFullNameTable;\n\n ObjectFactoryMap m_factories;\n\n\n\n public:\n\n const string& FromCName(const string& p_cName);\n\n ISerializable* Create(const string& p_typeName);\n\n\n\n template<class T>\n\n PfnUserObjectFactory AddPrototype(const char* pNameOverride = nullptr)\n\n {\n\n std::shared_ptr<T> pPrototype(new T);\n\n _ASSERTE(pPrototype != NULL);\n\n\t\t\tauto objLayout = pPrototype->GetObjectLayout();\n\n\t\t\tstring cname = objLayout.CName();\n\n\n\n if (nullptr != pNameOverride)\n\n {\n\n m_cNameToFullNameTable[cname] = pNameOverride;\n", "file_path": "src/ObjectSerializer/Include/ObjectFactory.h", "rank": 84, "score": 45708.83232495251 }, { "content": " class SetIterator;\n\n\n\n template<class TKey>\n", "file_path": "src/ObjectSerializer/Include/SSet.h", "rank": 85, "score": 45708.83232495251 }, { "content": "enum HeaderAttribute\n\n{\n\n HATTR_Class,\n\n HATTR_Type,\n\n HATTR_Parent,\n\n HATTR_Alias\n\n};\n\n\n\ntypedef map<HeaderAttribute, string> Attributes;\n\n\n", "file_path": "src/ObjectSerializer/Include/ObjectFormatter.h", "rank": 86, "score": 45708.83232495251 }, { "content": " class IGameRace\n\n {\n\n public:\n\n virtual ~IGameRace() {}\n\n virtual TID GameId() const = 0;\n\n virtual const IGameUnitType* WorkerType() const = 0;\n\n virtual const IGameUnitType* BaseType() const = 0;\n\n virtual const IGameUnitType* SupplyProvider() const = 0;\n\n virtual const IGameUnitType* GasProvider() const = 0;\n\n virtual const IGameUnitType* MineralsProvider() const = 0;\n\n virtual const char* ToString() const = 0;\n\n };\n\n\n", "file_path": "src/IStrategizer/Include/RtsAiEngine.h", "rank": 87, "score": 45708.83232495251 }, { "content": "class TypeNode\n\n{\n\npublic:\n\n unsigned Id;\n\n DataType Type;\n\n bool Indirection;\n\n string UserDefinedType;\n\n vector<TypeChild> Children;\n\n vector<TypeNode*> TemplateArguments;\n\n\n\n TypeNode() : Type(DTYPE_Undefined), Indirection(false) { Id = ++LastTypeNodeId; ++TypeNodesCount; }\n\n TypeNode(DataType p_type) : Type(p_type), Indirection(false) { Id = ++LastTypeNodeId; ++TypeNodesCount; }\n\n TypeNode* Clone() const;\n\n void SpecializeChildren(TypeNode* p_template, TypeNode* p_specialization);\n\n void SpecializeTemplateArguments(TypeNode* p_template, TypeNode* p_specialization);\n\n void SubstitueTypeName(const string& p_oldTypeName, const string& p_newTypeName);\n\n void SetTemplateArguments(vector<TypeNode*>& p_templates);\n\n void PromoteChildren(bool p_setAsTemplates = false);\n\n void DisposeChildren();\n\n string FullName();\n", "file_path": "src/ObjectSerializer/Include/TypeNode.h", "rank": 88, "score": 45708.83232495251 }, { "content": " class ArrayList\n\n {\n\n public:\n\n static ArrayList<T>* New(int size)\n\n {\n\n ArrayList<T>* pArr = (ArrayList<T>*)HeapAlloc(GetProcessHeap(), 0, sizeof(ArrayList<T>));\n\n pArr->Ctor(size);\n\n return pArr;\n\n }\n\n\n\n ArrayList() :\n\n m_pArr(nullptr),\n\n m_size(0)\n\n {}\n\n\n\n void Ctor(int size)\n\n {\n\n m_pArr = (T*)HeapAlloc(GetProcessHeap(), 0, sizeof(T)* size);\n\n m_size = size;\n\n ZeroMemory(m_pArr, sizeof(T)*size);\n", "file_path": "src/IStrategizer/Include/RtsAiEngine.h", "rank": 89, "score": 45708.83232495251 }, { "content": "struct TypeChild\n\n{\n\n union\n\n {\n\n unsigned Val32;\n\n TypeNode* Ptr32;\n\n };\n\n bool IsType;\n\n TypeChild() : Val32(0), IsType(false) {}\n\n TypeChild(unsigned p_val32) : Val32(p_val32), IsType(false) {}\n\n TypeChild(TypeNode* p_ptr32) : Ptr32(p_ptr32), IsType(true) {}\n\n};\n\n\n\nextern unsigned LastTypeNodeId;\n\nextern unsigned TypeNodesCount;\n\n\n", "file_path": "src/ObjectSerializer/Include/TypeNode.h", "rank": 90, "score": 45708.83232495251 }, { "content": "class TypeNode;\n", "file_path": "src/ObjectSerializer/Include/TypeNode.h", "rank": 91, "score": 45708.83232495251 }, { "content": "class TypeData\n\n{\n\npublic:\n\n TypeNode* TypeGraph;\n\n std::vector<TypeNode*> Parents;\n\n bool IsAlias;\n\n TypeData() : TypeGraph(NULL), IsAlias(false) {}\n\n\n\n void Write(std::string p_path);\n\n void Read(std::string p_path);\n\n};\n\n\n\ntypedef std::map<std::string, TypeData> TypeTable;\n\n\n\n#endif // TYPETABLE_H\n", "file_path": "src/ObjectSerializer/Include/TypeTable.h", "rank": 92, "score": 45708.83232495251 }, { "content": " class IRtsGame\n\n {\n\n public:\n\n virtual ~IRtsGame() {}\n\n virtual int ClientVersion() const = 0;\n\n virtual void LastError(_Inout_ char* pTxtBuff, _In_ int buffMax) const = 0;\n\n virtual bool Init() const = 0; // Initialize static types (UnitTypes, TechTypes, etc..)\n\n\n\n virtual bool IsInGame() const = 0;\n\n virtual TID SelfPlayer() const = 0;\n\n virtual TID EnemyPlayer() const = 0;\n\n virtual TID NeutralPlayer() const = 0;\n\n virtual int GameFrame() const = 0;\n\n virtual const IGameUnitType* GetUnitTypeByName(_In_ const char* pName) const = 0;\n\n virtual const IGameUnitType* GetUnitTypeByEngineId(_In_ EntityClassType id) const = 0;\n\n virtual const IGameTechType* GetTechTypeByName(_In_ const char* pName) const = 0;\n\n virtual const IGameTechType* GetTechTypeByEngineId(_In_ ResearchType id) const = 0;\n\n virtual const IGameUpgradeType* GetUpgradeTypeByName(_In_ const char* pName) const = 0;\n\n virtual const IGameUpgradeType* GetUpgradeTypeByEngineId(_In_ ResearchType id) const = 0;\n\n virtual const IGameRace* GetRace(_In_ TID raceId) const = 0;\n", "file_path": "src/IStrategizer/Include/RtsAiEngine.h", "rank": 93, "score": 45708.83232495251 }, { "content": " class MapIterator;\n\n\n\n template<class TKey, class TValue>\n", "file_path": "src/ObjectSerializer/Include/SMap.h", "rank": 94, "score": 45708.83232495251 }, { "content": "class TypeNode;\n\n\n", "file_path": "src/ObjectSerializer/Include/TypeTable.h", "rank": 95, "score": 45708.83232495251 }, { "content": " class ReleaseException : public IStrategizer::Exception\n\n {\n\n public:\n\n ReleaseException(ExceptionLocation p_location)\n\n : Exception(p_location, \"ReleaseException\") {}\n\n };\n\n\n\n SharedResource() : m_pOwner(0) {}\n\n virtual ~SharedResource();\n\n\n\n void Lock(EngineObject *p_pOwner) throw(\n\n IStrategizer::InvalidParameterException,\n\n AcquireException,\n\n RecursiveLockException,\n\n AlreadyLockedException);\n\n\n\n\t\tvirtual std::string ToString(bool minimal = false) const;\n\n void Unlock(EngineObject *p_pOwner);\n\n bool IsLocked() const { return m_pOwner != nullptr; }\n\n const EngineObject* Owner() const { return m_pOwner; }\n", "file_path": "src/IStrategizer/SharedResource.h", "rank": 96, "score": 45056.475985235295 }, { "content": " class NotImplementedException : public Exception\n\n {\n\n public:\n\n NotImplementedException(ExceptionLocation p_location)\n\n : Exception(p_location, \"NotImplementedException\") {}\n\n };\n\n\n", "file_path": "src/IStrategizer/Include/IStrategizerException.h", "rank": 97, "score": 44640.40853164856 }, { "content": "\tclass ObjectLayout : public ITraversable\n\n\t{\n\n\tpublic:\n\n\t\ttemplate<typename TObject, typename... Args>\n\n\t\tObjectLayout(const char* pTypeName, size_t typeSize, const TObject* pRootAddress, Args... childrenAddresses) :\n\n\t\t\tm_pTypeName(pTypeName),\n\n\t\t\tm_typeSize(typeSize),\n\n\t\t\tm_pItr(nullptr),\n\n\t\t\tm_pRootAddress((char*)pRootAddress),\n\n\t\t\tm_pCName(typeid(*pRootAddress).name())\n\n\t\t{\n\n\t\t\tAddMemberAddress(sizeof...(Args), childrenAddresses...);\n\n\t\t}\n\n\n\n\t\ttemplate<typename TObject, typename... Args>\n\n\t\tObjectLayout(Iterator* pItr, const char* pTypeName, size_t typeSize, const TObject* pRootAddress, Args... childrenAddresses) :\n\n\t\t\tm_pTypeName(pTypeName),\n\n\t\t\tm_typeSize(typeSize),\n\n\t\t\tm_pItr(pItr),\n\n\t\t\tm_pRootAddress((char*)pRootAddress),\n", "file_path": "src/ObjectSerializer/Include/ISerializable.h", "rank": 98, "score": 44640.40853164856 }, { "content": "\tclass VectorIterator : public Iterator\n\n\t{\n\n\t\tbool m_initialized;\n\n\t\tconst std::vector<T>* m_pInnerVector;\n\n\t\ttypename std::vector<T>::const_iterator m_current;\n\n\n\n\tpublic:\n\n\t\tVectorIterator(const std::vector<T>* p_vector) : m_pInnerVector(p_vector), m_initialized(false) {}\n\n\n\n\t\tchar* Current()\n\n\t\t{\n\n\t\t\treturn reinterpret_cast<char*>(const_cast<T*>(&*m_current));\n\n\t\t}\n\n\n\n\t\tbool MoveNext()\n\n\t\t{\n\n\t\t\tif (!m_initialized)\n\n\t\t\t{\n\n\t\t\t\tm_current = m_pInnerVector->begin();\n\n\t\t\t}\n", "file_path": "src/ObjectSerializer/Include/ISerializable.h", "rank": 99, "score": 44640.40853164856 } ]
C++
main.cpp
yisongbetter/membrane_dev
0b7cf468f25c1b981a6e515dfbbdce4973c91b8e
#include <iostream> #include <string> #include <vector> #include "opencv2/core/core.hpp" #include "opencv2/core/utility.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/imgcodecs.hpp" #include "opencv2/highgui/highgui.hpp" using namespace std; using namespace cv; int classify (Mat img, int x_min, int y_min, int x_max, int y_max) { int flag=1; Mat img2; img.copyTo(img2); int width=((x_max+30)>1000?990:(x_max+30))-((x_min-30)<0?10:(x_min-30)); int height= ((y_max+30)>1000?990:(y_max+30))-((y_min-30)<0?10:(y_min-30)); Mat crop = img2(Rect((x_min-30)<0?10:(x_min-30),(y_min-30)<0?10:(y_min-30),width,height)); double max_big, min_big,max_small,min_small; cv::Point min_loc, max_loc; cv::minMaxLoc(img, &min_big, &max_big, &min_loc, &max_loc); cv::minMaxLoc(crop, &min_small, &max_small, &min_loc, &max_loc); cout<<max_big<<" "<<max_small<<endl; cout<<min_big<<" "<<min_small<<endl; if (abs(max_big-max_small)<0.01){ flag=0; }; return flag; } float mean_of_crop (Mat img, int x_min, int y_min, int x_max, int y_max,int thresh) { int start_x = x_min-30<0 ? x_min:x_min-30; int start_y = y_min-30<0 ? y_min:y_min-30; int end_x = x_max+30>thresh ? x_max:x_max+30; int end_y = y_max+30>thresh ? y_max:y_max+30; Mat img2; img.copyTo(img2); Mat crop = img2(Rect(start_x,start_y,end_x-start_x,end_y-start_y)); imshow("croped image",crop); Scalar small = mean( crop ); return small.val[0]+small.val[1]+small.val[2]; } int find_min (vector<int> vec) { int min =10000; for(int i=0;i<vec.size();++i){ if (vec[i]<=min) min=vec[i]; } return min; } int find_max (vector<int> vec) { int max = -1; for(int i=0;i<vec.size();++i){ if (vec[i]>=max) max=vec[i]; } return max; } int main(int argc, char** argv) { for (int i =5; i < 312; i++) { char path[256] = {0}; sprintf(path, "/Users/LiYisong/Desktop/SUEZ/Membrane/A/%d.bmp", i); string in; if (argc != 2) { in = path; } else { in = argv[1]; } cout<<in<<endl; Mat src = imread(in); Mat show_image=src; resize(show_image,show_image,Size(1000,1000),0,0); cvtColor(src,src,COLOR_BGR2GRAY); Mat src1 = src,src2 = src,src3 = src; Mat dst1, dst2, dst3; Mat image1,image2,image3; resize(src1,image1,Size(1000,1000),0,0); resize(src2,image2,Size(3000,3000),0,0); resize(src3,image3,Size(200,200),0,0); int flag; #if 0 Canny(image, image, 50, 200, 3); #endif #if 1 Ptr<LineSegmentDetector> ls1 = createLineSegmentDetector(LSD_REFINE_ADV); Ptr<LineSegmentDetector> ls2 = createLineSegmentDetector(LSD_REFINE_ADV); Ptr<LineSegmentDetector> ls3 = createLineSegmentDetector(LSD_REFINE_ADV); #else Ptr<LineSegmentDetector> ls = createLineSegmentDetector(LSD_REFINE_NONE); #endif double start = double(getTickCount()); vector<Vec4f> lines_std1; vector<Vec4f> lines_std2; vector<Vec4f> lines_std3; vector<int> x_min,y_min,x_max,y_max; int x_min_f,y_min_f,x_max_f,y_max_f; ls1->detect(image1, lines_std1); ls2->detect(image2, lines_std2); ls3->detect(image3, lines_std3); int max1_x=-1,max1_y=-1,min1_x=10000,min1_y=10000; int max2_x=-1,max2_y=-1,min2_x=10000,min2_y=10000; int max3_x=-1,max3_y=-1,min3_x=10000,min3_y=10000; int count1 = lines_std1.size(); if (count1!=0) { for (int i = 0; i < count1; i++) { Vec4f p = lines_std1[i]; if (p[0] >= max1_x) { max1_x = p[0]; } if (p[2] >= max1_x) { max1_x = p[2]; } if (p[0] <= min1_x) { min1_x = p[0]; } if (p[2] <= min1_x) { min1_x = p[2]; } if (p[1] >= max1_y) { max1_y = p[1]; } if (p[3] >= max1_y) { max1_y = p[3]; } if (p[1] <= min1_y) { min1_y = p[1]; } if (p[3] <= min1_y) { min1_y = p[3]; } } } int count2 = lines_std2.size(); if (count2!=0) { for (int i = 0; i < count2; i++) { Vec4f p = lines_std2[i]; if (p[0] >= max2_x) { max2_x = p[0]; } if (p[2] >= max2_x) { max2_x = p[2]; } if (p[0] <= min2_x) { min2_x = p[0]; } if (p[2] <= min2_x) { min2_x = p[2]; } if (p[1] >= max2_y) { max2_y = p[1]; } if (p[3] >= max2_y) { max2_y = p[3]; } if (p[1] <= min2_y) { min2_y = p[1]; } if (p[3] <= min2_y) { min2_y = p[3]; } } } int count3 = lines_std3.size(); if (count3!=0) { for (int i = 0; i < count3; i++) { Vec4f p = lines_std3[i]; if (p[0] >= max3_x) { max3_x = p[0]; } if (p[2] >= max3_x) { max3_x = p[2]; } if (p[0] <= min3_x) { min3_x = p[0]; } if (p[2] <= min3_x) { min3_x = p[2]; } if (p[1] >= max3_y) { max3_y = p[1]; } if (p[3] >= max3_y) { max3_y = p[3]; } if (p[1] <= min3_y) { min3_y = p[1]; } if (p[3] <= min3_y) { min3_y = p[3]; } } } double duration_ms = (double(getTickCount()) - start) * 1000 / getTickFrequency(); std::cout << "It took " << duration_ms << " ms." << std::endl; Mat test; show_image.copyTo(test); if (max1_x!=-1){ x_min.push_back(min1_x); y_min.push_back(min1_y); x_max.push_back(max1_x); y_max.push_back(max1_y); } if (max2_x!=-1){ max2_x=max2_x/3.0;max2_y=max2_y/3.0;min2_x=min2_x/3.0;min2_y=min2_y/3.0; x_min.push_back(min2_x); y_min.push_back(min2_y); x_max.push_back(max2_x); y_max.push_back(max2_y); } if (max3_x!=-1){ max3_x=max3_x*5.0;max3_y=max3_y*5.0;min3_x=min3_x*5.0;min3_y=min3_y*5.0; x_min.push_back(min3_x); y_min.push_back(min3_y); x_max.push_back(max3_x); y_max.push_back(max3_y); } if (max1_x==-1 && max2_x==-1 && max3_x==-1){ cout<<"This image has no defect~~~~~~~~~~"<<endl; resize(image1,dst1,Size(500,500),0,0); putText(dst1,"No Defect",Point(50,60),FONT_HERSHEY_SIMPLEX,1,Scalar(255,23,0),4,8); imshow("Result", dst1); } else{ cout<<"This image has defects!!!!!!!!"<<endl; x_min_f = find_min(x_min); y_min_f = find_min(y_min); x_max_f = find_max(x_max); y_max_f = find_max(y_max); flag = classify(image1,x_min_f,y_min_f,x_max_f,y_max_f); rectangle(test, Point((x_min_f-30)<0?10:(x_min_f-30),(y_min_f-30)<0?10:(y_min_f-30)), Point((x_max_f+30)>1000?990:(x_max_f+30),(y_max_f+30)>1000?990:(y_max_f+30)), Scalar(0, 0, 255), 2); resize(test,dst2,Size(700,700),0,0); if (flag==0){ if (max3_x!=-1){ putText(dst2,"scratch",Point(50,60),FONT_HERSHEY_SIMPLEX,1,Scalar(255,23,0),4,8); } else { putText(dst2, "light leak", Point(50, 60), FONT_HERSHEY_SIMPLEX, 1, Scalar(255, 23, 0), 4, 8); } imshow("Result", dst2); } if (flag==1){ putText(dst2,"stain",Point(50,60),FONT_HERSHEY_SIMPLEX,1,Scalar(255,23,0),4,8); imshow("Result", dst2); } } waitKey(0); destroyAllWindows(); } return 0; }
#include <iostream> #include <string> #include <vector> #include "opencv2/core/core.hpp" #include "opencv2/core/utility.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/imgcodecs.hpp" #include "opencv2/highgui/highgui.hpp" using namespace std; using namespace cv;
float mean_of_crop (Mat img, int x_min, int y_min, int x_max, int y_max,int thresh) { int start_x = x_min-30<0 ? x_min:x_min-30; int start_y = y_min-30<0 ? y_min:y_min-30; int end_x = x_max+30>thresh ? x_max:x_max+30; int end_y = y_max+30>thresh ? y_max:y_max+30; Mat img2; img.copyTo(img2); Mat crop = img2(Rect(start_x,start_y,end_x-start_x,end_y-start_y)); imshow("croped image",crop); Scalar small = mean( crop ); return small.val[0]+small.val[1]+small.val[2]; } int find_min (vector<int> vec) { int min =10000; for(int i=0;i<vec.size();++i){ if (vec[i]<=min) min=vec[i]; } return min; } int find_max (vector<int> vec) { int max = -1; for(int i=0;i<vec.size();++i){ if (vec[i]>=max) max=vec[i]; } return max; } int main(int argc, char** argv) { for (int i =5; i < 312; i++) { char path[256] = {0}; sprintf(path, "/Users/LiYisong/Desktop/SUEZ/Membrane/A/%d.bmp", i); string in; if (argc != 2) { in = path; } else { in = argv[1]; } cout<<in<<endl; Mat src = imread(in); Mat show_image=src; resize(show_image,show_image,Size(1000,1000),0,0); cvtColor(src,src,COLOR_BGR2GRAY); Mat src1 = src,src2 = src,src3 = src; Mat dst1, dst2, dst3; Mat image1,image2,image3; resize(src1,image1,Size(1000,1000),0,0); resize(src2,image2,Size(3000,3000),0,0); resize(src3,image3,Size(200,200),0,0); int flag; #if 0 Canny(image, image, 50, 200, 3); #endif #if 1 Ptr<LineSegmentDetector> ls1 = createLineSegmentDetector(LSD_REFINE_ADV); Ptr<LineSegmentDetector> ls2 = createLineSegmentDetector(LSD_REFINE_ADV); Ptr<LineSegmentDetector> ls3 = createLineSegmentDetector(LSD_REFINE_ADV); #else Ptr<LineSegmentDetector> ls = createLineSegmentDetector(LSD_REFINE_NONE); #endif double start = double(getTickCount()); vector<Vec4f> lines_std1; vector<Vec4f> lines_std2; vector<Vec4f> lines_std3; vector<int> x_min,y_min,x_max,y_max; int x_min_f,y_min_f,x_max_f,y_max_f; ls1->detect(image1, lines_std1); ls2->detect(image2, lines_std2); ls3->detect(image3, lines_std3); int max1_x=-1,max1_y=-1,min1_x=10000,min1_y=10000; int max2_x=-1,max2_y=-1,min2_x=10000,min2_y=10000; int max3_x=-1,max3_y=-1,min3_x=10000,min3_y=10000; int count1 = lines_std1.size(); if (count1!=0) { for (int i = 0; i < count1; i++) { Vec4f p = lines_std1[i]; if (p[0] >= max1_x) { max1_x = p[0]; } if (p[2] >= max1_x) { max1_x = p[2]; } if (p[0] <= min1_x) { min1_x = p[0]; } if (p[2] <= min1_x) { min1_x = p[2]; } if (p[1] >= max1_y) { max1_y = p[1]; } if (p[3] >= max1_y) { max1_y = p[3]; } if (p[1] <= min1_y) { min1_y = p[1]; } if (p[3] <= min1_y) { min1_y = p[3]; } } } int count2 = lines_std2.size(); if (count2!=0) { for (int i = 0; i < count2; i++) { Vec4f p = lines_std2[i]; if (p[0] >= max2_x) { max2_x = p[0]; } if (p[2] >= max2_x) { max2_x = p[2]; } if (p[0] <= min2_x) { min2_x = p[0]; } if (p[2] <= min2_x) { min2_x = p[2]; } if (p[1] >= max2_y) { max2_y = p[1]; } if (p[3] >= max2_y) { max2_y = p[3]; } if (p[1] <= min2_y) { min2_y = p[1]; } if (p[3] <= min2_y) { min2_y = p[3]; } } } int count3 = lines_std3.size(); if (count3!=0) { for (int i = 0; i < count3; i++) { Vec4f p = lines_std3[i]; if (p[0] >= max3_x) { max3_x = p[0]; } if (p[2] >= max3_x) { max3_x = p[2]; } if (p[0] <= min3_x) { min3_x = p[0]; } if (p[2] <= min3_x) { min3_x = p[2]; } if (p[1] >= max3_y) { max3_y = p[1]; } if (p[3] >= max3_y) { max3_y = p[3]; } if (p[1] <= min3_y) { min3_y = p[1]; } if (p[3] <= min3_y) { min3_y = p[3]; } } } double duration_ms = (double(getTickCount()) - start) * 1000 / getTickFrequency(); std::cout << "It took " << duration_ms << " ms." << std::endl; Mat test; show_image.copyTo(test); if (max1_x!=-1){ x_min.push_back(min1_x); y_min.push_back(min1_y); x_max.push_back(max1_x); y_max.push_back(max1_y); } if (max2_x!=-1){ max2_x=max2_x/3.0;max2_y=max2_y/3.0;min2_x=min2_x/3.0;min2_y=min2_y/3.0; x_min.push_back(min2_x); y_min.push_back(min2_y); x_max.push_back(max2_x); y_max.push_back(max2_y); } if (max3_x!=-1){ max3_x=max3_x*5.0;max3_y=max3_y*5.0;min3_x=min3_x*5.0;min3_y=min3_y*5.0; x_min.push_back(min3_x); y_min.push_back(min3_y); x_max.push_back(max3_x); y_max.push_back(max3_y); } if (max1_x==-1 && max2_x==-1 && max3_x==-1){ cout<<"This image has no defect~~~~~~~~~~"<<endl; resize(image1,dst1,Size(500,500),0,0); putText(dst1,"No Defect",Point(50,60),FONT_HERSHEY_SIMPLEX,1,Scalar(255,23,0),4,8); imshow("Result", dst1); } else{ cout<<"This image has defects!!!!!!!!"<<endl; x_min_f = find_min(x_min); y_min_f = find_min(y_min); x_max_f = find_max(x_max); y_max_f = find_max(y_max); flag = classify(image1,x_min_f,y_min_f,x_max_f,y_max_f); rectangle(test, Point((x_min_f-30)<0?10:(x_min_f-30),(y_min_f-30)<0?10:(y_min_f-30)), Point((x_max_f+30)>1000?990:(x_max_f+30),(y_max_f+30)>1000?990:(y_max_f+30)), Scalar(0, 0, 255), 2); resize(test,dst2,Size(700,700),0,0); if (flag==0){ if (max3_x!=-1){ putText(dst2,"scratch",Point(50,60),FONT_HERSHEY_SIMPLEX,1,Scalar(255,23,0),4,8); } else { putText(dst2, "light leak", Point(50, 60), FONT_HERSHEY_SIMPLEX, 1, Scalar(255, 23, 0), 4, 8); } imshow("Result", dst2); } if (flag==1){ putText(dst2,"stain",Point(50,60),FONT_HERSHEY_SIMPLEX,1,Scalar(255,23,0),4,8); imshow("Result", dst2); } } waitKey(0); destroyAllWindows(); } return 0; }
int classify (Mat img, int x_min, int y_min, int x_max, int y_max) { int flag=1; Mat img2; img.copyTo(img2); int width=((x_max+30)>1000?990:(x_max+30))-((x_min-30)<0?10:(x_min-30)); int height= ((y_max+30)>1000?990:(y_max+30))-((y_min-30)<0?10:(y_min-30)); Mat crop = img2(Rect((x_min-30)<0?10:(x_min-30),(y_min-30)<0?10:(y_min-30),width,height)); double max_big, min_big,max_small,min_small; cv::Point min_loc, max_loc; cv::minMaxLoc(img, &min_big, &max_big, &min_loc, &max_loc); cv::minMaxLoc(crop, &min_small, &max_small, &min_loc, &max_loc); cout<<max_big<<" "<<max_small<<endl; cout<<min_big<<" "<<min_small<<endl; if (abs(max_big-max_small)<0.01){ flag=0; }; return flag; }
function_block-full_function
[ { "content": "\n\n#endif\n\n\n\n/* For windows compilers MSVC and Intel we can determine\n\n the architecture of the compiler being used. This is because\n\n the compilers do not have flags that can change the architecture,\n\n but rather depend on which compiler is being used\n\n*/\n\n#if defined(_WIN32) && defined(_MSC_VER)\n\n# if defined(_M_IA64)\n\n# define ARCHITECTURE_ID \"IA64\"\n\n\n\n# elif defined(_M_X64) || defined(_M_AMD64)\n\n# define ARCHITECTURE_ID \"x64\"\n\n\n\n# elif defined(_M_IX86)\n\n# define ARCHITECTURE_ID \"X86\"\n\n\n\n# elif defined(_M_ARM)\n\n# if _M_ARM == 4\n", "file_path": "cmake-build-debug/CMakeFiles/3.7.2/CompilerIdCXX/CMakeCXXCompilerId.cpp", "rank": 6, "score": 2.4307353851033193 }, { "content": "char const* info_compiler = \"INFO\" \":\" \"compiler[\" COMPILER_ID \"]\";\n", "file_path": "cmake-build-debug/CMakeFiles/3.7.2/CompilerIdC/CMakeCCompilerId.c", "rank": 7, "score": 2.206420107006655 }, { "content": "char const* info_platform = \"INFO\" \":\" \"platform[\" PLATFORM_ID \"]\";\n", "file_path": "cmake-build-debug/CMakeFiles/3.7.2/CompilerIdC/CMakeCCompilerId.c", "rank": 8, "score": 2.206420107006655 }, { "content": " ('0' + (((n) / 10)%10)), \\\n\n ('0' + ((n) % 10))\n\n\n\n/* Convert integer to hex digit literals. */\n\n#define HEX(n) \\\n\n ('0' + ((n)>>28 & 0xF)), \\\n\n ('0' + ((n)>>24 & 0xF)), \\\n\n ('0' + ((n)>>20 & 0xF)), \\\n\n ('0' + ((n)>>16 & 0xF)), \\\n\n ('0' + ((n)>>12 & 0xF)), \\\n\n ('0' + ((n)>>8 & 0xF)), \\\n\n ('0' + ((n)>>4 & 0xF)), \\\n\n ('0' + ((n) & 0xF))\n\n\n\n/* Construct a string literal encoding the version number components. */\n\n#ifdef COMPILER_VERSION_MAJOR\n\nchar const info_version[] = {\n\n 'I', 'N', 'F', 'O', ':',\n\n 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',\n\n COMPILER_VERSION_MAJOR,\n", "file_path": "cmake-build-debug/CMakeFiles/3.7.2/CompilerIdCXX/CMakeCXXCompilerId.cpp", "rank": 9, "score": 2.002030842465505 }, { "content": "# ifdef COMPILER_VERSION_MINOR\n\n '.', COMPILER_VERSION_MINOR,\n\n# ifdef COMPILER_VERSION_PATCH\n\n '.', COMPILER_VERSION_PATCH,\n\n# ifdef COMPILER_VERSION_TWEAK\n\n '.', COMPILER_VERSION_TWEAK,\n\n# endif\n\n# endif\n\n# endif\n\n ']','\\0'};\n\n#endif\n\n\n\n/* Construct a string literal encoding the version number components. */\n\n#ifdef SIMULATE_VERSION_MAJOR\n\nchar const info_simulate_version[] = {\n\n 'I', 'N', 'F', 'O', ':',\n\n 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',\n\n SIMULATE_VERSION_MAJOR,\n\n# ifdef SIMULATE_VERSION_MINOR\n\n '.', SIMULATE_VERSION_MINOR,\n", "file_path": "cmake-build-debug/CMakeFiles/3.7.2/CompilerIdCXX/CMakeCXXCompilerId.cpp", "rank": 10, "score": 1.7908891796737838 }, { "content": "# ifdef SIMULATE_VERSION_PATCH\n\n '.', SIMULATE_VERSION_PATCH,\n\n# ifdef SIMULATE_VERSION_TWEAK\n\n '.', SIMULATE_VERSION_TWEAK,\n\n# endif\n\n# endif\n\n# endif\n\n ']','\\0'};\n\n#endif\n\n\n\n/* Construct the string literal in pieces to prevent the source from\n\n getting matched. Store it in a pointer rather than an array\n\n because some compilers will just produce instructions to fill the\n\n array rather than assigning a pointer to a static array. */\n\nchar const* info_platform = \"INFO\" \":\" \"platform[\" PLATFORM_ID \"]\";\n\nchar const* info_arch = \"INFO\" \":\" \"arch[\" ARCHITECTURE_ID \"]\";\n\n\n\n\n\n\n\n\n", "file_path": "cmake-build-debug/CMakeFiles/3.7.2/CompilerIdCXX/CMakeCXXCompilerId.cpp", "rank": 11, "score": 1.7513106566768661 }, { "content": "\n\n#else /* unknown compiler */\n\n# define COMPILER_ID \"\"\n\n#endif\n\n\n\n/* Construct the string literal in pieces to prevent the source from\n\n getting matched. Store it in a pointer rather than an array\n\n because some compilers will just produce instructions to fill the\n\n array rather than assigning a pointer to a static array. */\n\nchar const* info_compiler = \"INFO\" \":\" \"compiler[\" COMPILER_ID \"]\";\n\n#ifdef SIMULATE_ID\n\nchar const* info_simulate = \"INFO\" \":\" \"simulate[\" SIMULATE_ID \"]\";\n\n#endif\n\n\n\n#ifdef __QNXNTO__\n\nchar const* qnxnto = \"INFO\" \":\" \"qnxnto[]\";\n\n#endif\n\n\n\n#if defined(__CRAYXE) || defined(__CRAYXC)\n\nchar const *info_cray = \"INFO\" \":\" \"compiler_wrapper[CrayPrgEnv]\";\n", "file_path": "cmake-build-debug/CMakeFiles/3.7.2/CompilerIdCXX/CMakeCXXCompilerId.cpp", "rank": 12, "score": 1.5982518947400242 } ]
C++
Software/GoTender/Display.cpp
capiaghi/GoTender
539dc075b5e6ec5ee97a4e1400f2c0d17c0dd65d
#include "Display.h" static TFT TFTscreen = TFT(SPI_CS_LCD_PIN, DC_LCD_PIN, RESET_LCD_PIN); #define CHAR_ARRAY_LENGTH_TITLE ( 10 ) // Title length #define CHAR_ARRAY_LENGTH ( 30 ) #define XPOS_OVEN ( 40 ) #define XPOS_MEAT ( XPOS_OVEN + 40 ) #define XPOS_SMOKER ( XPOS_MEAT + 40 ) #define YPOS_LABELS ( 80 ) #define YPOS_SPACE ( 10 ) static uint8_t first = 1; static char charArray[CHAR_ARRAY_LENGTH]; static char charArrayTitle[CHAR_ARRAY_LENGTH_TITLE]; static char oldCharArray[CHAR_ARRAY_LENGTH] = ""; static uint16_t oldValue = -1; static uint8_t oldHour = -1; static uint8_t oldMin = -1; static int16_t oldTemperatureOven = -1; static int16_t oldTemperatureMeat = -1; static int16_t oldTemperatureOvenSetPoint = -1; static int16_t oldTemperatureMeatSetPoint = -1; static String oldCmd = ""; void initDisplay() { TFTscreen.begin(); TFTscreen.background(LCD_BACKGROUND_COLOR); } void displayTitle(String stateStr) { TFTscreen.stroke(LCD_FONT_COLOR); TFTscreen.background(LCD_BACKGROUND_COLOR); TFTscreen.setTextSize(MEDIUM_FONT_SIZE); stateStr.toCharArray(charArrayTitle, CHAR_ARRAY_LENGTH); TFTscreen.text(charArrayTitle, 0, 0); displayRefresh(); } void testDisplayOutput(uint16_t value) { TFTscreen.stroke(LCD_FONT_COLOR); TFTscreen.setTextSize(SMALL_FONT_SIZE); writeString(String(value), String(oldValue), 0, 50); oldValue = value; } void displayTime() { uint8_t hour = getTimeHour(); uint8_t min = getTimeMin(); if(hour != oldHour || min != oldMin) { String hourStr; String minStr; String oldHourStr; String oldMinStr; if( hour < 10) { hourStr = "0" + String(hour); oldHourStr = "0" + String(oldHour); } else { hourStr = String(hour); oldHourStr = String(oldHour); } if( min < 10) { minStr = "0" + String(min); oldMinStr = "0" + String(oldMin); } else { minStr = String(min); oldMinStr = String(oldMin); } String timeStr = hourStr + ":" + minStr; String oldTimeStr = oldHourStr + ":" + oldMinStr; TFTscreen.setTextSize(SMALL_FONT_SIZE); writeString(String(timeStr), String(oldTimeStr), 125, 0); oldHour = hour; oldMin = min; } } void displayDate() { uint8_t day = getTimeDay(); uint8_t month = getTimeMonth(); uint16_t year = getTimeYear(); String dateStr; String dayStr; String monthStr; if ( day < 10) { dayStr = "0" + String(day); } else { dayStr = String(day); } if ( month < 10) { monthStr = "0" + String(month); } else { monthStr = String(month); } dateStr = dayStr + "." + monthStr + "." + String(year); TFTscreen.setTextSize(SMALL_FONT_SIZE); writeString(String(dateStr), String(""), 100, 120); } void displayCommand(String cmd) { TFTscreen.setTextSize(MEDIUM_FONT_SIZE); writeString(cmd, oldCmd, 0, 25); oldCmd = cmd.substring(0); } void displayCommandSmall1(String cmd) { TFTscreen.setTextSize(SMALL_FONT_SIZE); writeString(cmd, oldCmd, 0, 50); oldCmd = cmd.substring(0); } void displayCommandSmall2(String cmd) { TFTscreen.setTextSize(SMALL_FONT_SIZE); writeString(cmd, oldCmd, 0, 60); oldCmd = cmd.substring(0); } static void displayActualTemperature() { int16_t temperatureOven = getTemperatureOven(); int16_t temperatureMeat = getTemperatureMeat(); if((temperatureOven != oldTemperatureOven)) { TFTscreen.stroke(LCD_FONT_COLOR); TFTscreen.setTextSize(SMALL_FONT_SIZE); writeString(String(temperatureOven) + " C", String(oldTemperatureOven) + " C", XPOS_OVEN, YPOS_LABELS + YPOS_SPACE); oldTemperatureOven = temperatureOven; } if((temperatureMeat != oldTemperatureMeat)) { TFTscreen.stroke(LCD_FONT_COLOR); TFTscreen.setTextSize(SMALL_FONT_SIZE); writeString(String(temperatureMeat)+ " C", String(oldTemperatureMeat)+ " C", XPOS_MEAT, YPOS_LABELS + YPOS_SPACE); oldTemperatureMeat = temperatureMeat; } } static void displaySetPointTemperature() { int16_t temperatureOvenSetPoint = getTemperatureOvenSetPoint(); int16_t temperatureMeatSetPoint = getTemperatureMeatSetPoint(); if((temperatureOvenSetPoint != oldTemperatureOvenSetPoint)) { TFTscreen.setTextSize(SMALL_FONT_SIZE); writeString(String(temperatureOvenSetPoint)+ " C", String(oldTemperatureOvenSetPoint)+ " C", XPOS_OVEN, YPOS_LABELS + 2*YPOS_SPACE); oldTemperatureOvenSetPoint = temperatureOvenSetPoint; } if((temperatureMeatSetPoint != oldTemperatureMeatSetPoint)) { TFTscreen.setTextSize(SMALL_FONT_SIZE); writeString(String(temperatureMeatSetPoint)+ " C", String(oldTemperatureMeatSetPoint)+ " C", XPOS_MEAT, YPOS_LABELS + 2*YPOS_SPACE); oldTemperatureMeatSetPoint = temperatureMeatSetPoint; } } void displayRefresh() { first = 1; oldValue = -1; oldHour = -1; oldMin = -1; oldTemperatureOven = -1; oldTemperatureMeat = -1; oldTemperatureOvenSetPoint = -1; oldTemperatureMeatSetPoint = -1; oldCmd = ""; displaySmokerState(); displayDate(); displayTemperatures(); } void displayTemperatures() { if (first == 1) { TFTscreen.setTextSize(SMALL_FONT_SIZE); TFTscreen.text("Oven", XPOS_OVEN, YPOS_LABELS); TFTscreen.text("Meat", XPOS_MEAT, YPOS_LABELS); TFTscreen.text("Smoker", XPOS_SMOKER, YPOS_LABELS); TFTscreen.text("Now:", 0, YPOS_LABELS + YPOS_SPACE); TFTscreen.text("Set:", 0, YPOS_LABELS + 2*YPOS_SPACE); first = 0; } displayActualTemperature(); displaySetPointTemperature(); } void displaySmokerState() { if(getSmokerState()) { TFTscreen.stroke(LCD_FONT_COLOR); TFTscreen.fill(LCD_SMOKER_STATE_COLOR); TFTscreen.circle(XPOS_SMOKER + 10, YPOS_LABELS + 2*YPOS_SPACE, CIRCLE_RADIUS); } else { TFTscreen.stroke(LCD_FONT_COLOR); TFTscreen.fill(LCD_BACKGROUND_COLOR); TFTscreen.circle(XPOS_SMOKER + 10, YPOS_LABELS + 2*YPOS_SPACE, CIRCLE_RADIUS); } } static void writeString(String text, String oldText, uint8_t xPos, uint8_t yPos) { text.toCharArray(charArray, CHAR_ARRAY_LENGTH); oldText.toCharArray(oldCharArray, CHAR_ARRAY_LENGTH); TFTscreen.stroke(INVERSE_LCD_FONT_COLOR); TFTscreen.text(oldCharArray, xPos, yPos); TFTscreen.stroke(LCD_FONT_COLOR); TFTscreen.text(charArray, xPos, yPos); }
#include "Display.h" static TFT TFTscreen = TFT(SPI_CS_LCD_PIN, DC_LCD_PIN, RESET_LCD_PIN); #define CHAR_ARRAY_LENGTH_TITLE ( 10 ) // Title length #define CHAR_ARRAY_LENGTH ( 30 ) #define XPOS_OVEN ( 40 ) #define XPOS_MEAT ( XPOS_OVEN + 40 ) #define XPOS_SMOKER ( XPOS_MEAT + 40 ) #define YPOS_LABELS ( 80 ) #define YPOS_SPACE ( 10 ) static uint8_t first = 1; static char charArray[CHAR_ARRAY_LENGTH]; static char charArrayTitle[CHAR_ARRAY_LENGTH_TITLE]; static char oldCharArray[CHAR_ARRAY_LENGTH] = ""; static uint16_t oldValue = -1; static uint8_t oldHour = -1; static uint8_t oldMin = -1; static int16_t oldTemperatureOven = -1; static int16_t oldTemperatureMeat = -1; static int16_t oldTemperatureOvenSetPoint = -1; static int16_t oldTemperatureMeatSetPoint = -1; static String oldCmd = ""; void initDisplay() { TFTscreen.begin(); TFTscreen.background(LCD_BACKGROUND_COLOR); } void displayTitle(String stateStr) { TFTscreen.stroke(LCD_FONT_COLOR); TFTscreen.background(LCD_BACKGROUND_COLOR); TFTscreen.setTextSize(MEDIUM_FONT_SIZE); stateStr.toCharArray(charArrayTitle, CHAR_ARRAY_LENGTH); TFTscreen.text(charArrayTitle, 0, 0); displayRefresh(); } void testDisplayOutput(uint16_t value) { TFTscreen.stroke(LCD_FONT_COLOR); TFTscreen.setTextSize(SMALL_FONT_SIZE); writeString(String(value), String(oldValue), 0, 50); oldValue = value; } void displayTime() { uint8_t hour = getTimeHour(); uint8_t min = getTimeMin(); if(hour != oldHour || min != oldMin) { String hourStr; String minStr; String oldHourStr; String oldMinStr; if( hour < 10) { hourStr = "0" + String(hour); oldHourStr = "0" + String(oldHour); } else { hourStr = String(hour); oldHourStr = String(oldHour); } if( min < 10) { minStr = "0" + String(min); oldMinStr = "0" + String(oldMin); } else { minStr = String(min); oldMinStr = String(oldMin); } String timeStr = hourStr + ":" + minStr; String oldTimeStr = oldHourStr + ":" + oldMinStr; TFTscreen.setTextSize(SMALL_FONT_SIZE); writeString(String(timeStr), String(oldTimeStr), 125, 0); oldHour = hour; oldMin = min; } } void displayDate() { uint8_t day = getTimeDay(); uint8_t month = getTimeMonth(); uint16_t year = getTimeYear(); String dateStr; String dayStr; String monthStr; if ( day < 10) { dayStr = "0" + String(day); } else { dayStr = String(day); } if ( month < 10) { monthStr = "0" + String(month); } else { monthStr = String(month); } dateStr = dayStr + "." + monthStr + "." + String(year); TFTscreen.setTextSize(SMALL_FONT_SIZE); writeString(String(dateStr), String(""), 100, 120); } void displayCommand(String cmd) { TFTscreen.setTextSize(MEDIUM_FONT_SIZE); writeString(cmd, oldCmd, 0, 25); oldCmd = cmd.substring(0); } void displayCommandSmall1(String cmd) { TFTscreen.setTextSize(SMALL_FONT_SIZE); writeString(cmd, oldCmd, 0, 50); oldCmd = cmd.substring(0); } void displayCommandSmall2(String cmd) { TFTscreen.setTextSize(SMALL_FONT_SIZE); writeString(cmd, oldCmd, 0, 60); oldCmd = cmd.substring(0); } static void displayActualTemperature() { int16_t temperatureOven = getTemperatureOven(); int16_t temperatureMeat = getTemperatureMeat(); if((temperatureOven != oldTemperatureOven)) { TFTscreen.stroke(LCD_FONT_COLOR); TFTscreen.setTextSize(SMALL_FONT_SIZE); writeString(String(temperatureOven) + " C", String(oldTemperatureOven) + " C", XPOS_OVEN, YPOS_LABELS + YPOS_SPACE); oldTemperatureOven = temperatureOven; } if((temperatureMeat != oldTemperatureMeat)) { TFTscreen.stroke(LCD_FONT_COLOR); TFTscreen.setTextSize(SMALL_FONT_SIZE); writeString(String(temperatureMeat)+ " C", String(oldTemperatureMeat)+ " C", XPOS_MEAT, YPOS_LABELS + YPOS_SPACE); oldTemperatureMeat = temperatureMeat; } } static void displaySetPointTemperature() { int16_t temperatureOvenSetPoin
void displayRefresh() { first = 1; oldValue = -1; oldHour = -1; oldMin = -1; oldTemperatureOven = -1; oldTemperatureMeat = -1; oldTemperatureOvenSetPoint = -1; oldTemperatureMeatSetPoint = -1; oldCmd = ""; displaySmokerState(); displayDate(); displayTemperatures(); } void displayTemperatures() { if (first == 1) { TFTscreen.setTextSize(SMALL_FONT_SIZE); TFTscreen.text("Oven", XPOS_OVEN, YPOS_LABELS); TFTscreen.text("Meat", XPOS_MEAT, YPOS_LABELS); TFTscreen.text("Smoker", XPOS_SMOKER, YPOS_LABELS); TFTscreen.text("Now:", 0, YPOS_LABELS + YPOS_SPACE); TFTscreen.text("Set:", 0, YPOS_LABELS + 2*YPOS_SPACE); first = 0; } displayActualTemperature(); displaySetPointTemperature(); } void displaySmokerState() { if(getSmokerState()) { TFTscreen.stroke(LCD_FONT_COLOR); TFTscreen.fill(LCD_SMOKER_STATE_COLOR); TFTscreen.circle(XPOS_SMOKER + 10, YPOS_LABELS + 2*YPOS_SPACE, CIRCLE_RADIUS); } else { TFTscreen.stroke(LCD_FONT_COLOR); TFTscreen.fill(LCD_BACKGROUND_COLOR); TFTscreen.circle(XPOS_SMOKER + 10, YPOS_LABELS + 2*YPOS_SPACE, CIRCLE_RADIUS); } } static void writeString(String text, String oldText, uint8_t xPos, uint8_t yPos) { text.toCharArray(charArray, CHAR_ARRAY_LENGTH); oldText.toCharArray(oldCharArray, CHAR_ARRAY_LENGTH); TFTscreen.stroke(INVERSE_LCD_FONT_COLOR); TFTscreen.text(oldCharArray, xPos, yPos); TFTscreen.stroke(LCD_FONT_COLOR); TFTscreen.text(charArray, xPos, yPos); }
t = getTemperatureOvenSetPoint(); int16_t temperatureMeatSetPoint = getTemperatureMeatSetPoint(); if((temperatureOvenSetPoint != oldTemperatureOvenSetPoint)) { TFTscreen.setTextSize(SMALL_FONT_SIZE); writeString(String(temperatureOvenSetPoint)+ " C", String(oldTemperatureOvenSetPoint)+ " C", XPOS_OVEN, YPOS_LABELS + 2*YPOS_SPACE); oldTemperatureOvenSetPoint = temperatureOvenSetPoint; } if((temperatureMeatSetPoint != oldTemperatureMeatSetPoint)) { TFTscreen.setTextSize(SMALL_FONT_SIZE); writeString(String(temperatureMeatSetPoint)+ " C", String(oldTemperatureMeatSetPoint)+ " C", XPOS_MEAT, YPOS_LABELS + 2*YPOS_SPACE); oldTemperatureMeatSetPoint = temperatureMeatSetPoint; } }
function_block-function_prefixed
[ { "content": "uint8_t getTimeMonth();\n", "file_path": "TimeControl.h", "rank": 0, "score": 59184.004231301966 }, { "content": "uint8_t getTimeDay();\n", "file_path": "TimeControl.h", "rank": 1, "score": 59184.004231301966 }, { "content": "uint16_t getTimeYear();\n", "file_path": "TimeControl.h", "rank": 2, "score": 59184.004231301966 }, { "content": "uint8_t getTimeHour();\n", "file_path": "TimeControl.h", "rank": 3, "score": 59147.014438096594 }, { "content": "uint8_t getTimeMin();\n", "file_path": "TimeControl.h", "rank": 4, "score": 59122.30423477241 }, { "content": " uint8_t Day;\n", "file_path": "libraries/Time-master/TimeLib.h", "rank": 5, "score": 58273.28224714741 }, { "content": " uint8_t Year; // offset from 1970; \n", "file_path": "libraries/Time-master/TimeLib.h", "rank": 6, "score": 58268.5286659526 }, { "content": " uint8_t Month; \n", "file_path": "libraries/Time-master/TimeLib.h", "rank": 7, "score": 58268.5286659526 }, { "content": " uint8_t Hour; \n", "file_path": "libraries/Time-master/TimeLib.h", "rank": 8, "score": 58232.53113457539 }, { "content": " uint8_t Day;\n", "file_path": "Time-master/Time-master/TimeLib.h", "rank": 9, "score": 57405.639346844415 }, { "content": " uint8_t Month; \n", "file_path": "Time-master/Time-master/TimeLib.h", "rank": 10, "score": 57400.88576564961 }, { "content": " uint8_t Year; // offset from 1970; \n", "file_path": "Time-master/Time-master/TimeLib.h", "rank": 11, "score": 57400.88576564961 }, { "content": " uint8_t Hour; \n", "file_path": "Time-master/Time-master/TimeLib.h", "rank": 12, "score": 57365.82865143154 }, { "content": "uint8_t getTimeMonth();\n", "file_path": "Software/GoTender/TimeControl.h", "rank": 13, "score": 56577.4221608292 }, { "content": "uint16_t getTimeYear();\n", "file_path": "Software/GoTender/TimeControl.h", "rank": 14, "score": 56577.4221608292 }, { "content": "uint8_t getTimeDay();\n", "file_path": "Software/GoTender/TimeControl.h", "rank": 15, "score": 56577.4221608292 }, { "content": "uint8_t getTimeHour();\n", "file_path": "Software/GoTender/TimeControl.h", "rank": 16, "score": 56543.25757890019 }, { "content": "uint8_t getTimeMin();\n", "file_path": "Software/GoTender/TimeControl.h", "rank": 17, "score": 56520.43469472604 }, { "content": "#endif\n\n#include <string.h> // for strcpy_P or strcpy\n\n#include \"TimeLib.h\"\n\n \n\n// the short strings for each day or month must be exactly dt_SHORT_STR_LEN\n\n#define dt_SHORT_STR_LEN 3 // the length of short strings\n\n\n\nstatic char buffer[dt_MAX_STRING_LEN+1]; // must be big enough for longest string and the terminating null\n\n\n\nconst char monthStr0[] PROGMEM = \"\";\n\nconst char monthStr1[] PROGMEM = \"January\";\n\nconst char monthStr2[] PROGMEM = \"February\";\n\nconst char monthStr3[] PROGMEM = \"March\";\n\nconst char monthStr4[] PROGMEM = \"April\";\n\nconst char monthStr5[] PROGMEM = \"May\";\n\nconst char monthStr6[] PROGMEM = \"June\";\n\nconst char monthStr7[] PROGMEM = \"July\";\n\nconst char monthStr8[] PROGMEM = \"August\";\n\nconst char monthStr9[] PROGMEM = \"September\";\n\nconst char monthStr10[] PROGMEM = \"October\";\n", "file_path": "libraries/Time-master/DateStrings.cpp", "rank": 18, "score": 37130.62023574265 }, { "content": "const PROGMEM char * const PROGMEM dayNames_P[] =\n\n{\n\n dayStr0,dayStr1,dayStr2,dayStr3,dayStr4,dayStr5,dayStr6,dayStr7\n\n};\n\n\n\nconst char dayShortNames_P[] PROGMEM = \"ErrSunMonTueWedThuFriSat\";\n\n\n\n/* functions to return date strings */\n\n\n\nchar* monthStr(uint8_t month)\n\n{\n\n strcpy_P(buffer, (PGM_P)pgm_read_word(&(monthNames_P[month])));\n\n return buffer;\n\n}\n\n\n\nchar* monthShortStr(uint8_t month)\n\n{\n\n for (int i=0; i < dt_SHORT_STR_LEN; i++) \n\n buffer[i] = pgm_read_byte(&(monthShortNames_P[i+ (month*dt_SHORT_STR_LEN)])); \n\n buffer[dt_SHORT_STR_LEN] = 0;\n", "file_path": "libraries/Time-master/DateStrings.cpp", "rank": 19, "score": 37124.158163704895 }, { "content": "const char monthStr11[] PROGMEM = \"November\";\n\nconst char monthStr12[] PROGMEM = \"December\";\n\n\n\nconst PROGMEM char * const PROGMEM monthNames_P[] =\n\n{\n\n monthStr0,monthStr1,monthStr2,monthStr3,monthStr4,monthStr5,monthStr6,\n\n monthStr7,monthStr8,monthStr9,monthStr10,monthStr11,monthStr12\n\n};\n\n\n\nconst char monthShortNames_P[] PROGMEM = \"ErrJanFebMarAprMayJunJulAugSepOctNovDec\";\n\n\n\nconst char dayStr0[] PROGMEM = \"Err\";\n\nconst char dayStr1[] PROGMEM = \"Sunday\";\n\nconst char dayStr2[] PROGMEM = \"Monday\";\n\nconst char dayStr3[] PROGMEM = \"Tuesday\";\n\nconst char dayStr4[] PROGMEM = \"Wednesday\";\n\nconst char dayStr5[] PROGMEM = \"Thursday\";\n\nconst char dayStr6[] PROGMEM = \"Friday\";\n\nconst char dayStr7[] PROGMEM = \"Saturday\";\n\n\n", "file_path": "libraries/Time-master/DateStrings.cpp", "rank": 20, "score": 37123.59231490375 }, { "content": "/* DateStrings.cpp\n\n * Definitions for date strings for use with the Time library\n\n *\n\n * Updated for Arduino 1.5.7 18 July 2014\n\n *\n\n * No memory is consumed in the sketch if your code does not call any of the string methods\n\n * You can change the text of the strings, make sure the short strings are each exactly 3 characters \n\n * the long strings can be any length up to the constant dt_MAX_STRING_LEN defined in TimeLib.h\n\n * \n\n */\n\n\n\n#if defined(__AVR__)\n\n#include <avr/pgmspace.h>\n\n#else\n\n// for compatiblity with Arduino Due and Teensy 3.0 and maybe others?\n\n#define PROGMEM\n\n#define PGM_P const char *\n\n#define pgm_read_byte(addr) (*(const unsigned char *)(addr))\n\n#define pgm_read_word(addr) (*(const unsigned char **)(addr))\n\n#define strcpy_P(dest, src) strcpy((dest), (src))\n", "file_path": "libraries/Time-master/DateStrings.cpp", "rank": 21, "score": 37120.985944521686 }, { "content": " return buffer;\n\n}\n\n\n\nchar* dayStr(uint8_t day) \n\n{\n\n strcpy_P(buffer, (PGM_P)pgm_read_word(&(dayNames_P[day])));\n\n return buffer;\n\n}\n\n\n\nchar* dayShortStr(uint8_t day) \n\n{\n\n uint8_t index = day*dt_SHORT_STR_LEN;\n\n for (int i=0; i < dt_SHORT_STR_LEN; i++) \n\n buffer[i] = pgm_read_byte(&(dayShortNames_P[index + i])); \n\n buffer[dt_SHORT_STR_LEN] = 0; \n\n return buffer;\n\n}\n", "file_path": "libraries/Time-master/DateStrings.cpp", "rank": 22, "score": 37117.71898018628 }, { "content": "void displayTitle(String state);\n", "file_path": "Display.h", "rank": 23, "score": 36157.9527586097 }, { "content": "#endif\n\n#include <string.h> // for strcpy_P or strcpy\n\n#include \"TimeLib.h\"\n\n \n\n// the short strings for each day or month must be exactly dt_SHORT_STR_LEN\n\n#define dt_SHORT_STR_LEN 3 // the length of short strings\n\n\n\nstatic char buffer[dt_MAX_STRING_LEN+1]; // must be big enough for longest string and the terminating null\n\n\n\nconst char monthStr0[] PROGMEM = \"\";\n\nconst char monthStr1[] PROGMEM = \"January\";\n\nconst char monthStr2[] PROGMEM = \"February\";\n\nconst char monthStr3[] PROGMEM = \"March\";\n\nconst char monthStr4[] PROGMEM = \"April\";\n\nconst char monthStr5[] PROGMEM = \"May\";\n\nconst char monthStr6[] PROGMEM = \"June\";\n\nconst char monthStr7[] PROGMEM = \"July\";\n\nconst char monthStr8[] PROGMEM = \"August\";\n\nconst char monthStr9[] PROGMEM = \"September\";\n\nconst char monthStr10[] PROGMEM = \"October\";\n", "file_path": "Time-master/Time-master/DateStrings.cpp", "rank": 24, "score": 36048.021635175886 }, { "content": "const PROGMEM char * const PROGMEM dayNames_P[] =\n\n{\n\n dayStr0,dayStr1,dayStr2,dayStr3,dayStr4,dayStr5,dayStr6,dayStr7\n\n};\n\n\n\nconst char dayShortNames_P[] PROGMEM = \"ErrSunMonTueWedThuFriSat\";\n\n\n\n/* functions to return date strings */\n\n\n\nchar* monthStr(uint8_t month)\n\n{\n\n strcpy_P(buffer, (PGM_P)pgm_read_word(&(monthNames_P[month])));\n\n return buffer;\n\n}\n\n\n\nchar* monthShortStr(uint8_t month)\n\n{\n\n for (int i=0; i < dt_SHORT_STR_LEN; i++) \n\n buffer[i] = pgm_read_byte(&(monthShortNames_P[i+ (month*dt_SHORT_STR_LEN)])); \n\n buffer[dt_SHORT_STR_LEN] = 0;\n", "file_path": "Time-master/Time-master/DateStrings.cpp", "rank": 25, "score": 36041.55956313813 }, { "content": "const char monthStr11[] PROGMEM = \"November\";\n\nconst char monthStr12[] PROGMEM = \"December\";\n\n\n\nconst PROGMEM char * const PROGMEM monthNames_P[] =\n\n{\n\n monthStr0,monthStr1,monthStr2,monthStr3,monthStr4,monthStr5,monthStr6,\n\n monthStr7,monthStr8,monthStr9,monthStr10,monthStr11,monthStr12\n\n};\n\n\n\nconst char monthShortNames_P[] PROGMEM = \"ErrJanFebMarAprMayJunJulAugSepOctNovDec\";\n\n\n\nconst char dayStr0[] PROGMEM = \"Err\";\n\nconst char dayStr1[] PROGMEM = \"Sunday\";\n\nconst char dayStr2[] PROGMEM = \"Monday\";\n\nconst char dayStr3[] PROGMEM = \"Tuesday\";\n\nconst char dayStr4[] PROGMEM = \"Wednesday\";\n\nconst char dayStr5[] PROGMEM = \"Thursday\";\n\nconst char dayStr6[] PROGMEM = \"Friday\";\n\nconst char dayStr7[] PROGMEM = \"Saturday\";\n\n\n", "file_path": "Time-master/Time-master/DateStrings.cpp", "rank": 26, "score": 36040.99371433698 }, { "content": "/* DateStrings.cpp\n\n * Definitions for date strings for use with the Time library\n\n *\n\n * Updated for Arduino 1.5.7 18 July 2014\n\n *\n\n * No memory is consumed in the sketch if your code does not call any of the string methods\n\n * You can change the text of the strings, make sure the short strings are each exactly 3 characters \n\n * the long strings can be any length up to the constant dt_MAX_STRING_LEN defined in TimeLib.h\n\n * \n\n */\n\n\n\n#if defined(__AVR__)\n\n#include <avr/pgmspace.h>\n\n#else\n\n// for compatiblity with Arduino Due and Teensy 3.0 and maybe others?\n\n#define PROGMEM\n\n#define PGM_P const char *\n\n#define pgm_read_byte(addr) (*(const unsigned char *)(addr))\n\n#define pgm_read_word(addr) (*(const unsigned char **)(addr))\n\n#define strcpy_P(dest, src) strcpy((dest), (src))\n", "file_path": "Time-master/Time-master/DateStrings.cpp", "rank": 27, "score": 36038.38734395492 }, { "content": " return buffer;\n\n}\n\n\n\nchar* dayStr(uint8_t day) \n\n{\n\n strcpy_P(buffer, (PGM_P)pgm_read_word(&(dayNames_P[day])));\n\n return buffer;\n\n}\n\n\n\nchar* dayShortStr(uint8_t day) \n\n{\n\n uint8_t index = day*dt_SHORT_STR_LEN;\n\n for (int i=0; i < dt_SHORT_STR_LEN; i++) \n\n buffer[i] = pgm_read_byte(&(dayShortNames_P[index + i])); \n\n buffer[dt_SHORT_STR_LEN] = 0; \n\n return buffer;\n\n}\n", "file_path": "Time-master/Time-master/DateStrings.cpp", "rank": 28, "score": 36035.12037961951 }, { "content": "static void writeString(String text, String oldText, uint8_t xPos, uint8_t yPos);\n", "file_path": "Display.h", "rank": 29, "score": 36026.99638264178 }, { "content": "const int8_t MIN_TEMP_MEAT = -10;\n", "file_path": "Thermocouples.h", "rank": 30, "score": 35031.2619159437 }, { "content": "const int8_t MIN_TEMP_OVEN = -10; // For Checking the TC\n", "file_path": "Thermocouples.h", "rank": 31, "score": 35031.2619159437 }, { "content": "void setTimeYear(uint16_t value);\n", "file_path": "TimeControl.h", "rank": 32, "score": 34127.3350302664 }, { "content": "void setTimeDay(uint8_t value);\n", "file_path": "TimeControl.h", "rank": 33, "score": 34127.3350302664 }, { "content": "void setTimeMonth(uint8_t value);\n", "file_path": "TimeControl.h", "rank": 34, "score": 34127.3350302664 }, { "content": "void setTimeHour(uint8_t value);\n", "file_path": "TimeControl.h", "rank": 35, "score": 34090.34523706103 }, { "content": "uint8_t getEndHour();\n", "file_path": "TimeControl.h", "rank": 36, "score": 34090.34523706103 }, { "content": "void setTimerHour(uint8_t value);\n", "file_path": "TimeControl.h", "rank": 37, "score": 34090.34523706103 }, { "content": "uint8_t getTimerHour();\n", "file_path": "TimeControl.h", "rank": 38, "score": 34090.34523706103 }, { "content": "void setTimeMin(uint8_t value);\n", "file_path": "TimeControl.h", "rank": 39, "score": 34065.63503373684 }, { "content": "uint8_t getTimerMin();\n", "file_path": "TimeControl.h", "rank": 40, "score": 34065.63503373684 }, { "content": "void setTimerMin(uint8_t value);\n", "file_path": "TimeControl.h", "rank": 41, "score": 34065.63503373684 }, { "content": "uint8_t getEndMin();\n", "file_path": "TimeControl.h", "rank": 42, "score": 34065.63503373684 }, { "content": "void displayTitle(String state);\n", "file_path": "Software/GoTender/Display.h", "rank": 43, "score": 33248.1103509731 }, { "content": "static void writeString(String text, String oldText, uint8_t xPos, uint8_t yPos);\n", "file_path": "Software/GoTender/Display.h", "rank": 44, "score": 33127.69280221383 }, { "content": "void displayValues(float value);\n", "file_path": "Software/GoTender/TBD/Display.h", "rank": 45, "score": 32404.599705009838 }, { "content": "void displayTitle(char *state);\n", "file_path": "Software/GoTender/TBD/Display.h", "rank": 46, "score": 32379.520414749106 }, { "content": "const int8_t MIN_TEMP_OVEN = -10; // For Checking the TC\n", "file_path": "Software/GoTender/Thermocouples.h", "rank": 47, "score": 32285.740330005683 }, { "content": "const int8_t MIN_TEMP_MEAT = -10;\n", "file_path": "Software/GoTender/Thermocouples.h", "rank": 48, "score": 32285.740330005683 }, { "content": "static void writeString(char *charArray, char *oldCharArray, uint8_t xPos, uint8_t yPos);\n", "file_path": "Software/GoTender/TBD/Display.h", "rank": 49, "score": 32262.24871307387 }, { "content": "void setTimeYear(uint16_t value);\n", "file_path": "Software/GoTender/TimeControl.h", "rank": 50, "score": 31520.75295979363 }, { "content": "void setTimeMonth(uint8_t value);\n", "file_path": "Software/GoTender/TimeControl.h", "rank": 51, "score": 31520.75295979363 }, { "content": "void setTimeDay(uint8_t value);\n", "file_path": "Software/GoTender/TimeControl.h", "rank": 52, "score": 31520.75295979363 }, { "content": "void setTimeHour(uint8_t value);\n", "file_path": "Software/GoTender/TimeControl.h", "rank": 53, "score": 31486.588377864628 }, { "content": "void setTimeMin(uint8_t value);\n", "file_path": "Software/GoTender/TimeControl.h", "rank": 54, "score": 31463.765493690476 }, { "content": "double \t\tgetTemperatureMeat();\n", "file_path": "Thermocouples.h", "rank": 55, "score": 25056.669201035565 }, { "content": "double \t\tgetTemperatureMeat();\n", "file_path": "Software/GoTender/Thermocouples.h", "rank": 56, "score": 25056.669201035565 }, { "content": "double \t\tgetTemperatureOven();\n", "file_path": "Thermocouples.h", "rank": 57, "score": 25056.669201035565 }, { "content": "double \t\tgetTemperatureOven();\n", "file_path": "Software/GoTender/Thermocouples.h", "rank": 58, "score": 25056.669201035565 }, { "content": "void displayRefresh(); // Call once before displayTemperatures -> Refreshes all values\n", "file_path": "Display.h", "rank": 59, "score": 25029.02034358569 }, { "content": "void initDisplay();\n", "file_path": "Software/GoTender/Display.h", "rank": 60, "score": 25029.02034358569 }, { "content": "void displayRefresh(); // Call once before displayTemperatures -> Refreshes all values\n", "file_path": "Software/GoTender/TBD/Display.h", "rank": 61, "score": 25029.02034358569 }, { "content": "void initDisplay();\n", "file_path": "Software/GoTender/TBD/Display.h", "rank": 62, "score": 25029.02034358569 }, { "content": "void displayRefresh(); // Call once before displayTemperatures -> Refreshes all values\n", "file_path": "Software/GoTender/Display.h", "rank": 63, "score": 25029.02034358569 }, { "content": "void initDisplay();\n", "file_path": "Display.h", "rank": 64, "score": 25029.02034358569 }, { "content": "/// \\bug \n\n///\n\n/// \\warning \n\n///\n\n/// \\todo \n\n///\n\n// ****************************************************************************\n\n// Includes *******************************************************************\n\n#include \"Display.h\"\n\n\n\n// Create Screen object\n\nstatic TFT TFTscreen = TFT(SPI_CS_LCD_PIN, DC_LCD_PIN, RESET_LCD_PIN);\n\n\n\n#define CHAR_ARRAY_LENGTH_TITLE ( 10 ) // Title length\n\n#define CHAR_ARRAY_LENGTH ( 20 ) // Command length\n\n// Private constants **********************************************************\n\nstatic uint8_t first = 1;\n\nstatic char charArrayValue[CHAR_ARRAY_LENGTH];\n\nstatic char oldCharArrayValue[CHAR_ARRAY_LENGTH] = \"\"; \n\n\n", "file_path": "Software/GoTender/TBD/Display.cpp", "rank": 65, "score": 26.197373295362283 }, { "content": " \n\n // Safe old values\n\n oldHour = hour;\n\n oldMin = min;\n\n }\n\n}\n\n\n\n// ----------------------------------------------------------------------------\n\n/// \\brief Displays date\n\n/// \\detail Display date on bottom right, small font size in format dd.mm.yyyy\n\n/// \\warning \n\n/// \\return -\n\n/// \\todo - Update, when refreshing screen (now: delete)\n\nvoid displayDate()\n\n{\n\n uint8_t day = getTimeDay();\n\n uint8_t month = getTimeMonth();\n\n uint16_t year = getTimeYear();\n\n String dateStr;\n\n String dayStr;\n", "file_path": "Display.cpp", "rank": 66, "score": 24.257257828496613 }, { "content": "void displayCommand2(char *cmd)\n\n{\n\n TFTscreen.setTextSize(SMALL_FONT_SIZE);\n\n writeString(cmd, oldCmd2, 0, 50);\n\n strncpy(oldCmd2, cmd, CHAR_ARRAY_LENGTH);\n\n \n\n}\n\n\n\n\n\n\n\nvoid displayValues(float value)\n\n{\n\n // Update only, if anything changed\n\n if((value != oldValue))\n\n { \n\n TFTscreen.stroke(LCD_FONT_COLOR);\n\n TFTscreen.setTextSize(SMALL_FONT_SIZE);\n\n String valueStr = String(value, DECIMAL_PLACES) + \" C\";\n\n String oldValueStr = String(oldValue, DECIMAL_PLACES) + \" C\";\n\n \n", "file_path": "Software/GoTender/TBD/Display.cpp", "rank": 67, "score": 23.327001856883573 }, { "content": "/// \\bug \n\n///\n\n/// \\warning \n\n///\n\n/// \\todo \n\n///\n\n// ****************************************************************************\n\n// Includes *******************************************************************\n\n#include \"Display.h\"\n\n\n\nstatic TFT TFTscreen = TFT(SPI_CS_LCD_PIN, DC_LCD_PIN, RESET_LCD_PIN);\n\n\n\n#define CHAR_ARRAY_LENGTH_TITLE ( 10 ) // Title length\n\n#define CHAR_ARRAY_LENGTH ( 30 )\n\n\n\n\n\n\n\n#define XPOS_OVEN ( 40 )\n\n#define XPOS_DATE ( 100 )\n\n#define XPOS_TIME\t\t ( 125 )\n", "file_path": "Display.cpp", "rank": 69, "score": 21.048633163676563 }, { "content": " for (i = 1; i < tm.Month; i++) {\n\n if ( (i == 2) && LEAP_YEAR(tm.Year)) { \n\n seconds += SECS_PER_DAY * 29;\n\n } else {\n\n seconds += SECS_PER_DAY * monthDays[i-1]; //monthDay array starts from 0\n\n }\n\n }\n\n seconds+= (tm.Day-1) * SECS_PER_DAY;\n\n seconds+= tm.Hour * SECS_PER_HOUR;\n\n seconds+= tm.Minute * SECS_PER_MIN;\n\n seconds+= tm.Second;\n\n return (time_t)seconds; \n\n}\n\n/*=====================================================*/\t\n\n/* Low level system time functions */\n\n\n\nstatic uint32_t sysTime = 0;\n\nstatic uint32_t prevMillis = 0;\n\nstatic uint32_t nextSyncTime = 0;\n\nstatic timeStatus_t Status = timeNotSet;\n", "file_path": "libraries/Time-master/Time.cpp", "rank": 71, "score": 19.88474954635035 }, { "content": " for (i = 1; i < tm.Month; i++) {\n\n if ( (i == 2) && LEAP_YEAR(tm.Year)) { \n\n seconds += SECS_PER_DAY * 29;\n\n } else {\n\n seconds += SECS_PER_DAY * monthDays[i-1]; //monthDay array starts from 0\n\n }\n\n }\n\n seconds+= (tm.Day-1) * SECS_PER_DAY;\n\n seconds+= tm.Hour * SECS_PER_HOUR;\n\n seconds+= tm.Minute * SECS_PER_MIN;\n\n seconds+= tm.Second;\n\n return (time_t)seconds; \n\n}\n\n/*=====================================================*/\t\n\n/* Low level system time functions */\n\n\n\nstatic uint32_t sysTime = 0;\n\nstatic uint32_t prevMillis = 0;\n\nstatic uint32_t nextSyncTime = 0;\n\nstatic timeStatus_t Status = timeNotSet;\n", "file_path": "Time-master/Time-master/Time.cpp", "rank": 72, "score": 19.88474954635035 }, { "content": "/// \\bug \n\n///\n\n/// \\warning \n\n///\n\n/// \\todo \n\n///\n\n// ****************************************************************************\n\n// Includes *******************************************************************\n\n#include \"TimeControl.h\"\n\n\n\n\n\n// Private constants **********************************************************\n\nstatic tmElements_t tm; // Struct with parameters from second to year\n\n\n\nstatic uint8_t timerHour = 0;\n\nstatic uint8_t timerMin = 0;\n\nstatic uint8_t startHour = 0;\n\nstatic uint8_t startMin = 0;\n\nstatic uint8_t endHour = 0;\n\nstatic uint8_t endMin = 0;\n", "file_path": "TimeControl.cpp", "rank": 73, "score": 19.292877300413625 }, { "content": "\n\n/*============================================================================*/\t\n\n/* functions to convert to and from system time */\n\n/* These are for interfacing with time serivces and are not normally needed in a sketch */\n\n\n\n// leap year calulator expects year argument as years offset from 1970\n\n#define LEAP_YEAR(Y) ( ((1970+Y)>0) && !((1970+Y)%4) && ( ((1970+Y)%100) || !((1970+Y)%400) ) )\n\n\n\nstatic const uint8_t monthDays[]={31,28,31,30,31,30,31,31,30,31,30,31}; // API starts months from 1, this array starts from 0\n\n \n\nvoid breakTime(time_t timeInput, tmElements_t &tm){\n\n// break the given time_t into time components\n\n// this is a more compact version of the C library localtime function\n\n// note that year is offset from 1970 !!!\n\n\n\n uint8_t year;\n\n uint8_t month, monthLength;\n\n uint32_t time;\n\n unsigned long days;\n\n\n", "file_path": "Time-master/Time-master/Time.cpp", "rank": 74, "score": 19.23776524099619 }, { "content": "\n\n/*============================================================================*/\t\n\n/* functions to convert to and from system time */\n\n/* These are for interfacing with time serivces and are not normally needed in a sketch */\n\n\n\n// leap year calulator expects year argument as years offset from 1970\n\n#define LEAP_YEAR(Y) ( ((1970+Y)>0) && !((1970+Y)%4) && ( ((1970+Y)%100) || !((1970+Y)%400) ) )\n\n\n\nstatic const uint8_t monthDays[]={31,28,31,30,31,30,31,31,30,31,30,31}; // API starts months from 1, this array starts from 0\n\n \n\nvoid breakTime(time_t timeInput, tmElements_t &tm){\n\n// break the given time_t into time components\n\n// this is a more compact version of the C library localtime function\n\n// note that year is offset from 1970 !!!\n\n\n\n uint8_t year;\n\n uint8_t month, monthLength;\n\n uint32_t time;\n\n unsigned long days;\n\n\n", "file_path": "libraries/Time-master/Time.cpp", "rank": 75, "score": 19.23776524099619 }, { "content": "} stm_substate_t;\n\n\n\n/// \\brief Used SubStates time\n\n/// \\details States for the settings state machine\n\ntypedef enum stm_substate_time_e\n\n{\n\n STM_SUBSTATE_SET_HOUR, /// RTC Hour\n\n STM_SUBSTATE_SET_MIN, /// RTC Min\n\n STM_SUBSTATE_SET_DAY, /// RTC Day\n\n STM_SUBSTATE_SET_MONTH, /// RTC Month\n\n STM_SUBSTATE_SET_YEAR, /// RTC YEAR\n\n STM_SUBSTATE_TIME_DONE,\n\n} stm_substate_time_t;\n\n\n\nuint8_t value = 0;\n\nuint8_t nextState = 0;\n\n// Private constants **********************************************************\n\n\n\nstatic stm_substate_t stm_SubState;\n\nstatic stm_substate_time_t stm_time_SubState;\n", "file_path": "Software/GoTender/old/Settings.cpp", "rank": 76, "score": 19.138481056931557 }, { "content": "\n\nstatic uint16_t oldValue = 0;\n\nstatic uint8_t oldHour = 0;\n\nstatic uint8_t oldMin = 0;\n\nstatic uint8_t oldTimerHour = 0;\n\nstatic uint8_t oldTimerMin = 0;\n\nstatic uint16_t oldTimer = 0;\n\n\n\nstatic int16_t oldTemperatureOven = 0;\n\nstatic int16_t oldTemperatureMeat = 0;\n\nstatic int16_t oldTemperatureOvenSetPoint = 0;\n\nstatic int16_t oldTemperatureMeatSetPoint = 0;\n\n\n\n\n\nstatic String oldCmd = \"\";\n\nstatic String oldCmd1 = \"\";\n\nstatic String oldCmd2 = \"\";\n\n\n\n\n\n// ----------------------------------------------------------------------------\n", "file_path": "Display.cpp", "rank": 77, "score": 19.104709128323044 }, { "content": " }\n\n \n\n\n\n // Date format: dd.mm.yyyy\n\n dateStr = dayStr + \".\" + monthStr + \".\" + String(year);\n\n \n\n // Font text size\n\n TFTscreen.setTextSize(SMALL_FONT_SIZE);\n\n \n\n writeString(String(dateStr), String(\"\"), XPOS_DATE, YPOS_DATE);\n\n}\n\n\n\n// ----------------------------------------------------------------------------\n\n/// \\brief Displays command\n\n/// \\detail Display big command under title\n\n/// \\warning \n\n/// \\return -\n\n/// \\todo - \n\nvoid displayCommand(String cmd)\n\n{\n", "file_path": "Display.cpp", "rank": 78, "score": 18.7290796850617 }, { "content": "static char oldCmd1[CHAR_ARRAY_LENGTH] = \"\";\n\nstatic char oldCmd2[CHAR_ARRAY_LENGTH] = \"\";\n\nstatic char oldCmd3[CHAR_ARRAY_LENGTH] = \"\";\n\n\n\nstatic float oldValue = -1;\n\n\n\nstatic uint8_t xPos = 0; // For oscilloscope function -> Position\n\n\n\n\n\n\n\n// ----------------------------------------------------------------------------\n\n/// \\brief Initialize Display\n\n/// \\detail Initialize and sets Background Color\n\n/// \\warning \n\n/// \\return -\n\n/// \\todo -\n\nvoid initDisplay()\n\n{\n\n // Initialize Display\n\n TFTscreen.begin();\n", "file_path": "Software/GoTender/TBD/Display.cpp", "rank": 79, "score": 17.74137961848274 }, { "content": " valueStr.toCharArray(charArrayValue, CHAR_ARRAY_LENGTH);\n\n oldValueStr.toCharArray(oldCharArrayValue, CHAR_ARRAY_LENGTH);\n\n \n\n writeString(charArrayValue, oldCharArrayValue, 0, 60);\n\n // Safe old values\n\n oldValue = value;\n\n }\n\n\n\n}\n\n\n\n\n\n\n\n// ----------------------------------------------------------------------------\n\n/// \\brief Force value update\n\n/// \\detail Call one before change states: Updates all values\n\n/// \\warning \n\n/// \\return -\n\n/// \\todo \n\nvoid displayRefresh()\n\n{\n", "file_path": "Software/GoTender/TBD/Display.cpp", "rank": 81, "score": 17.616729671392708 }, { "content": "// ----------------------------------------------------------------------------\n\n/// \\brief Displays command\n\n/// \\detail Display command under title\n\n/// \\warning \n\n/// \\return -\n\n/// \\todo - \n\nvoid displayCommand1(char *cmd)\n\n{\n\n TFTscreen.setTextSize(SMALL_FONT_SIZE);\n\n writeString(cmd, oldCmd1, 0, 25);\n\n strncpy(oldCmd1, cmd, CHAR_ARRAY_LENGTH);\n\n \n\n}\n\n\n\n// ----------------------------------------------------------------------------\n\n/// \\brief Displays displayCommand1\n\n/// \\detail Display small command under command\n\n/// \\warning \n\n/// \\return -\n\n/// \\todo - \n", "file_path": "Software/GoTender/TBD/Display.cpp", "rank": 82, "score": 17.416601757235334 }, { "content": " TFTscreen.setTextSize(SMALL_FONT_SIZE);\n\n \n\n writeString(String(value), String(oldValue), 0, 50);\n\n \n\n // Save value\n\n oldValue = value;\n\n}\n\n\n\n// ----------------------------------------------------------------------------\n\n/// \\brief Displays time\n\n/// \\detail Display time on top right, small font size. Updates only when\n\n/// old value changes\n\n/// \\warning \n\n/// \\return -\n\n/// \\todo - Seconds? Flashing \":\"? Tests pending\n\nvoid displayTime()\n\n{\n\n uint8_t hour = getTimeHour();\n\n uint8_t min = getTimeMin();\n\n \n", "file_path": "Display.cpp", "rank": 83, "score": 16.92949765661789 }, { "content": " month=0;\n\n monthLength=0;\n\n for (month=0; month<12; month++) {\n\n if (month==1) { // february\n\n if (LEAP_YEAR(year)) {\n\n monthLength=29;\n\n } else {\n\n monthLength=28;\n\n }\n\n } else {\n\n monthLength = monthDays[month];\n\n }\n\n \n\n if (time >= monthLength) {\n\n time -= monthLength;\n\n } else {\n\n break;\n\n }\n\n }\n\n tm.Month = month + 1; // jan is month 1 \n", "file_path": "Time-master/Time-master/Time.cpp", "rank": 84, "score": 16.899149852604012 }, { "content": " month=0;\n\n monthLength=0;\n\n for (month=0; month<12; month++) {\n\n if (month==1) { // february\n\n if (LEAP_YEAR(year)) {\n\n monthLength=29;\n\n } else {\n\n monthLength=28;\n\n }\n\n } else {\n\n monthLength = monthDays[month];\n\n }\n\n \n\n if (time >= monthLength) {\n\n time -= monthLength;\n\n } else {\n\n break;\n\n }\n\n }\n\n tm.Month = month + 1; // jan is month 1 \n", "file_path": "libraries/Time-master/Time.cpp", "rank": 85, "score": 16.899149852604012 }, { "content": "\n\n\n\n// ----------------------------------------------------------------------------\n\n/// \\brief Displays timer\n\n/// \\detail Display timer on bottom left, small font size. Updates only when\n\n/// old value changes\n\n/// \\warning \n\n/// \\return -\n\n/// \\todo - Seconds? Flashing \":\"? Tests pending\n\nvoid displayTimer()\n\n{\n\n uint8_t timerHour = getEndHour();\n\n uint8_t timerMin = getEndMin();\n\n \n\n // Update only, if anything changed\n\n if(timerHour != oldTimerHour || timerMin != oldTimerMin)\n\n {\n\n String hourTimerStr;\n\n String minTimerStr;\n\n \n", "file_path": "Display.cpp", "rank": 86, "score": 16.132528076757545 }, { "content": "/// \\todo\n\nvoid setTimeDay(uint8_t value)\n\n{\n\n if( value < 1 || value > 31)\n\n {\n\n value = 0;\n\n }\n\n\ttm.Day = value;\n\n\tRTC.write(tm);\n\n}\n\n\n\n// ----------------------------------------------------------------------------\n\n/// \\brief Set the current month\n\n/// \\detail Checks input: 1 to 12 allowed.\n\n/// \\warning \n\n/// \\return \n\n/// \\todo\n\nvoid setTimeMonth(uint8_t value)\n\n{\n\n if( value < 1 || value > 12)\n", "file_path": "TimeControl.cpp", "rank": 88, "score": 15.988230278205421 }, { "content": "void setTimeHour(uint8_t value)\n\n{\n\n if( value < 0 || value > 23)\n\n {\n\n value = 0;\n\n }\n\n\ttm.Hour = value;\n\n RTC.write(tm);\n\n}\n\n\n\n// ----------------------------------------------------------------------------\n\n/// \\brief Set the current min\n\n/// \\detail Checks input: 0 to 59 allowed. Set seconds to 0\n\n/// \\warning \n\n/// \\return \n\n/// \\todo\n\nvoid setTimeMin(uint8_t value)\n\n{\n\n if( value < 0 || value > 59)\n\n {\n", "file_path": "Software/GoTender/TimeControl.cpp", "rank": 89, "score": 15.88008623479033 }, { "content": "#define XPOS_TIMER ( 0 )\n\n#define XPOS_MEAT ( XPOS_OVEN + 40 )\n\n#define XPOS_SMOKER ( XPOS_MEAT + 40 )\n\n\n\n#define YPOS_LABELS ( 80 )\n\n#define YPOS_SPACE ( 10 )\n\n#define YPOS_DATE ( 120 )\n\n#define YPOS_TIME\t\t ( 0 )\n\n#define YPOS_TIMER ( YPOS_DATE )\n\n\n\n\n\n\n\n// Private constants **********************************************************\n\n// Create Screen object\n\n\n\nstatic uint8_t first = 1;\n\nstatic char charArray[CHAR_ARRAY_LENGTH];\n\nstatic char charArrayTitle[CHAR_ARRAY_LENGTH_TITLE];\n\nstatic char oldCharArray[CHAR_ARRAY_LENGTH] = \"\"; \n\n\n", "file_path": "Display.cpp", "rank": 90, "score": 15.78626819720237 }, { "content": "/// \\warning \n\n/// \\return \n\n/// \\todo\n\nvoid setTimerHour(uint8_t value)\n\n{\n\n if( value < 0 || value > 24)\n\n {\n\n value = 0;\n\n }\n\n\ttimerHour = value;\n\n}\n\n\n\n\n\n// ----------------------------------------------------------------------------\n\n/// \\brief Set the timer minute\n\n/// \\detail Checks input: 0 to 59 allowed.\n\n/// \\warning \n\n/// \\return \n\n/// \\todo\n\nvoid setTimerMin(uint8_t value)\n", "file_path": "TimeControl.cpp", "rank": 91, "score": 15.238230369311987 }, { "content": "\n\n// ----------------------------------------------------------------------------\n\n/// \\brief Writes a string to the display\n\n/// \\detail Deletes and writes new string to display\n\n/// \\warning\n\n/// \\return -\n\n/// \\todo \n\nstatic void writeString(String text, String oldText, uint8_t xPos, uint8_t yPos)\n\n{\n\n // Save to charArray\n\n text.toCharArray(charArray, CHAR_ARRAY_LENGTH);\n\n oldText.toCharArray(oldCharArray, CHAR_ARRAY_LENGTH);\n\n // Delete old text\n\n TFTscreen.stroke(INVERSE_LCD_FONT_COLOR);\n\n TFTscreen.text(oldCharArray, xPos, yPos);\n\n // Set new text\n\n TFTscreen.stroke(LCD_FONT_COLOR);\n\n TFTscreen.text(charArray, xPos, yPos);\n\n}\n\n\n", "file_path": "Display.cpp", "rank": 92, "score": 15.164810152909954 }, { "content": "}\n\n\n\n// ----------------------------------------------------------------------------\n\n/// \\brief Set the current hour\n\n/// \\detail Checks input: 0 to 23 allowed\n\n/// \\warning \n\n/// \\return \n\n/// \\todo\n\nvoid setTimeHour(uint8_t value)\n\n{\n\n if( value < 0 || value > 23)\n\n {\n\n value = 0;\n\n }\n\n\ttm.Hour = value;\n\n RTC.write(tm);\n\n}\n\n\n\n// ----------------------------------------------------------------------------\n\n/// \\brief Set the current min\n", "file_path": "TimeControl.cpp", "rank": 94, "score": 14.759590283827645 }, { "content": " String monthStr;\n\n \n\n // Day format: dd\n\n if ( day < 10) // add \"0\"\n\n {\n\n dayStr = \"0\" + String(day);\n\n }\n\n else\n\n {\n\n dayStr = String(day);\n\n }\n\n \n\n // Month format: mm\n\n if ( month < 10) // add \"0\"\n\n {\n\n monthStr = \"0\" + String(month);\n\n }\n\n else\n\n {\n\n monthStr = String(month);\n", "file_path": "Display.cpp", "rank": 95, "score": 14.710006654858113 }, { "content": " nextSyncTime = (uint32_t)t + syncInterval;\n\n Status = timeSet;\n\n prevMillis = millis(); // restart counting from now (thanks to Korman for this fix)\n\n} \n\n\n\nvoid setTime(int hr,int min,int sec,int dy, int mnth, int yr){\n\n // year can be given as full four digit year or two digts (2010 or 10 for 2010); \n\n //it is converted to years since 1970\n\n if( yr > 99)\n\n yr = yr - 1970;\n\n else\n\n yr += 30; \n\n tm.Year = yr;\n\n tm.Month = mnth;\n\n tm.Day = dy;\n\n tm.Hour = hr;\n\n tm.Minute = min;\n\n tm.Second = sec;\n\n setTime(makeTime(tm));\n\n}\n", "file_path": "Time-master/Time-master/Time.cpp", "rank": 96, "score": 14.697838497933269 }, { "content": " nextSyncTime = (uint32_t)t + syncInterval;\n\n Status = timeSet;\n\n prevMillis = millis(); // restart counting from now (thanks to Korman for this fix)\n\n} \n\n\n\nvoid setTime(int hr,int min,int sec,int dy, int mnth, int yr){\n\n // year can be given as full four digit year or two digts (2010 or 10 for 2010); \n\n //it is converted to years since 1970\n\n if( yr > 99)\n\n yr = yr - 1970;\n\n else\n\n yr += 30; \n\n tm.Year = yr;\n\n tm.Month = mnth;\n\n tm.Day = dy;\n\n tm.Hour = hr;\n\n tm.Minute = min;\n\n tm.Second = sec;\n\n setTime(makeTime(tm));\n\n}\n", "file_path": "libraries/Time-master/Time.cpp", "rank": 97, "score": 14.69783849793327 }, { "content": " else\n\n {\n\n minTimerStr = String(timerMin);\n\n oldTimerMinStr \t= String(oldTimerMin);\n\n }\n\n\n\n String timerStr = hourTimerStr + \":\" + minTimerStr;\n\n String oldTimerStr = oldTimerHourStr + \":\" + oldTimerMinStr;\n\n \n\n // Set text size\n\n TFTscreen.setTextSize(SMALL_FONT_SIZE);\n\n \n\n writeString(timerStr, oldTimerStr, XPOS_TIMER, YPOS_TIMER);\n\n \n\n // Safe old values\n\n oldTimerHour \t= timerHour;\n\n oldTimerMin \t= timerMin;\n\n }\n\n}\n\n\n", "file_path": "Display.cpp", "rank": 99, "score": 14.562592594803618 } ]
C++
drivers/clock/rtc.cpp
IGR2014/kernale
a8b43cf7d89c3d92b14ffdb88683023048f4bf78
#include <arch/io.hpp> #include <drivers/clock/rtc.hpp> #include <klib/kprint.hpp> namespace igros::arch { constexpr auto CMOS_COMMAND = static_cast<io::port_t>(0x0070); constexpr auto CMOS_DATA = static_cast<io::port_t>(CMOS_COMMAND + 1U); void clockFromRTC(const rtcDateTime_t &rtcDateTime, const dword_t century, clockDateTime_t &dateTime) noexcept { dateTime.year = rtcDateTime.date.year + century; dateTime.month = rtcDateTime.date.month; dateTime.day = rtcDateTime.date.day; dateTime.weekday = rtcDateTime.weekday; dateTime.hour = rtcDateTime.time.hour; dateTime.minute = rtcDateTime.time.minute; dateTime.second = rtcDateTime.time.second; } constexpr auto RTC_YEAR = 0x09; constexpr auto RTC_MONTH = 0x08; constexpr auto RTC_DAY = 0x07; constexpr auto RTC_WEEKDAY = 0x06; constexpr auto RTC_HOUR = 0x04; constexpr auto RTC_MINUTE = 0x02; constexpr auto RTC_SECOND = 0x00; constexpr auto RTC_CENTURY = 0x32; constexpr auto RTC_REGISTER_A = 0x0A; constexpr auto RTC_REGISTER_B = 0x0B; constexpr auto RTC_IS_TIME_24 = 0x02; constexpr auto RTC_IS_BINARY = 0x04; byte_t rtcRead(const byte_t cmd) noexcept { io::get().writePort8(CMOS_COMMAND, cmd); return io::get().readPort8(CMOS_DATA); } void rtcReadDate(rtcDate_t &date) noexcept { date.year = rtcRead(RTC_YEAR); date.month = rtcRead(RTC_MONTH); date.day = rtcRead(RTC_DAY); } void rtcReadTime(rtcTime_t &time) noexcept { time.hour = rtcRead(RTC_HOUR); time.minute = rtcRead(RTC_MINUTE); time.second = rtcRead(RTC_SECOND); } void rtcReadDateTime(rtcDateTime_t &dateTime) noexcept { rtcReadDate(dateTime.date); rtcReadTime(dateTime.time); dateTime.weekday = rtcRead(RTC_WEEKDAY); } byte_t rtcFromBCD(const byte_t bcd) noexcept { return (bcd & 0x0F) + ((bcd >> 4) & 0x0F) * 10; } void rtcDateFromBCD(rtcDate_t &date) noexcept { date.year = rtcFromBCD(date.year); date.month = rtcFromBCD(date.month); date.day = rtcFromBCD(date.day); } void rtcTimeFromBCD(rtcTime_t &time) noexcept { time.hour = rtcFromBCD(time.hour); time.minute = rtcFromBCD(time.minute); time.second = rtcFromBCD(time.second); } void rtcDateTimeFromBCD(rtcDateTime_t &dateTime) noexcept { rtcDateFromBCD(dateTime.date); rtcTimeFromBCD(dateTime.time); } clockDateTime_t clockGetCurrentDateTime() noexcept { while (0x00 != (0x80 & rtcRead(RTC_REGISTER_A))); rtcDateTime_t rtcDateTime {}; rtcReadDateTime(rtcDateTime); const auto flags = rtcRead(RTC_REGISTER_B); auto century = rtcRead(RTC_CENTURY); if (0x00 == (flags & RTC_IS_BINARY)) { const auto hourModeBit = static_cast<byte_t>(rtcDateTime.time.hour & 0x80); rtcDateTime.time.hour &= 0x7F; rtcDateTimeFromBCD(rtcDateTime); rtcDateTime.time.hour |= hourModeBit; century = rtcFromBCD(century); } if ( (0x00 == (flags & RTC_IS_TIME_24)) && (0x00 != (0x80 & rtcDateTime.time.hour)) ) { rtcDateTime.time.hour = ((rtcDateTime.time.hour & 0x7F) + 12U) % 24U; } clockDateTime_t dateTime {}; clockFromRTC(rtcDateTime, ((0x00 != century) ? (century * 100U) : 2000U), dateTime); return dateTime; } void rtcSetup() noexcept { auto dateTime = clockGetCurrentDateTime(); klib::kprintf( "RTC date/time:\t%02d.%02d.%04d %02d:%02d:%02d\r\n", dateTime.day, dateTime.month, dateTime.year, dateTime.hour, dateTime.minute, dateTime.second ); } }
#include <arch/io.hpp> #include <drivers/clock/rtc.hpp> #include <klib/kprint.hpp> namespace igros::arch { constexpr auto CMOS_COMMAND = static_cast<io::port_t>(0x0070); constexpr auto CMOS_DATA = static_cast<io::port_t>(CMOS_COMMAND + 1U); void clockFromRTC(const rtcDateTime_t &rtcDateTime, const dword_t century, clockDateTime_t &dateTime) noexcept { dateTime.year = rtcDateTime.date.year + century; dateTime.month = rtcDateTime.date.month; dateTime.day = rtcDateTime.date.day; dateTime.weekday = rtcDateTime.weekday; dateTime.hour = rtcDateTime.time.hour; dateTime.minute = rtcDateTime.time.minute; dateTime.second = rtcDateTime.time.second; } constexpr auto RTC_YEAR = 0x09; constexpr auto RTC_MONTH = 0x08; constexpr auto RTC_DAY = 0x07; constexpr auto RTC_WEEKDAY = 0x06; constexpr auto RTC_HOUR = 0x04; constexpr auto RTC_MINUTE = 0x02; constexpr auto RTC_SECOND = 0x00; constexpr auto RTC_CENTURY = 0x32; constexpr auto RTC_REGISTER_A = 0x0A; constexpr auto RTC_REGISTER_B = 0x0B; constexpr auto RTC_IS_TIME_24 = 0x02; constexpr auto RTC_IS_BINARY = 0x04; byte_t rtcRead(const byte_t cmd) noexcept { io::get().writePort8(CMOS_COMMAND, cmd); return io::get().readPort8(CMOS_DATA); } void rtcReadDate(rtcDate_t &date) noexcept { date.year = rtcRead(RTC_YEAR); date.month = rtcRead(RTC_MONTH); date.day = rtcRead(RTC_DAY); } void rtcReadTime(rtcTime_t &time) noexcept { time.hour = rtcRead(RTC_HOUR); time.minute = rtcRead(RTC_MINUTE); time.second = rtcRead(RTC_SECOND); } void rtcReadDateTime(rtcDateTime_t &dateTime) noexcept { rtcReadDate(dateTime.date); rtcReadTime(dateTime.time); dateTime.weekday = rtcRead(RTC_WEEKDAY); } byte_t rtcFromBCD(const byte_t bcd) noexcept { return (bcd & 0x0F) + ((bcd >> 4) & 0x0F) * 10; } void rtcDateFromBCD(rtcDate_t &date) noexcept { date.year = rtcFromBCD(date.year); date.month = rtcFromBCD(date.month); date.day = rtcFromBCD(date.day); } void rtcTimeFromBCD(rtcTime_t &time) noexcept { time.hour = rtcFromBCD(time.hour); time.minute = rtcFromBCD(time.minute); time.second = rtcFromBCD(time.second); } void rtcDateTimeFromBCD(rtcDateTime_t &dateTime) noexcept { rtcDateFromBCD(dateTime.date); rtcTimeFromBCD(dateTime.time); } clockDateTime_t clockGetCurrentDateTime() noexcept { while (0x00 != (0x80 & rtcRead(RTC_REGISTER_A))); rtcDateTime_t rtcDateTime {}; rtcReadDateTime(rtcDateTime); const auto flags = rtcRead(RTC_REGISTER_B); auto century = rtcRead(RTC_CENTURY);
if ( (0x00 == (flags & RTC_IS_TIME_24)) && (0x00 != (0x80 & rtcDateTime.time.hour)) ) { rtcDateTime.time.hour = ((rtcDateTime.time.hour & 0x7F) + 12U) % 24U; } clockDateTime_t dateTime {}; clockFromRTC(rtcDateTime, ((0x00 != century) ? (century * 100U) : 2000U), dateTime); return dateTime; } void rtcSetup() noexcept { auto dateTime = clockGetCurrentDateTime(); klib::kprintf( "RTC date/time:\t%02d.%02d.%04d %02d:%02d:%02d\r\n", dateTime.day, dateTime.month, dateTime.year, dateTime.hour, dateTime.minute, dateTime.second ); } }
if (0x00 == (flags & RTC_IS_BINARY)) { const auto hourModeBit = static_cast<byte_t>(rtcDateTime.time.hour & 0x80); rtcDateTime.time.hour &= 0x7F; rtcDateTimeFromBCD(rtcDateTime); rtcDateTime.time.hour |= hourModeBit; century = rtcFromBCD(century); }
if_condition
[ { "content": "\t// Multiboot header flags enumeration\n\n\tenum class flags_t : dword_t {\n\n\t\tMEM\t\t= (1U << 0),\t\t\t// Memory info available\n\n\t\tBOOT_DEV\t= (1U << 1),\t\t\t// Boot device info available\n\n\t\tCMD\t\t= (1U << 2),\t\t\t// Kernel command line available\n\n\t\tMODULES\t\t= (1U << 3),\t\t\t// Kernel modules available\n\n\t\tSYMS_AOUT\t= (1U << 4),\t\t\t// A.OUT info available\n\n\t\tSYMS_ELF\t= (1U << 5),\t\t\t// ELF info available\n\n\t\tMEM_MAP\t\t= (1U << 6),\t\t\t// Memory map available\n\n\t\tDRIVES\t\t= (1U << 7),\t\t\t// Drives info available\n\n\t\tTABLE_CONFIG\t= (1U << 8),\t\t\t// Configuration table available\n\n\t\tLOADER_NAME\t= (1U << 9),\t\t\t// Bootloader name available\n\n\t\tTABLE_APM\t= (1U << 10),\t\t\t// APM table available\n\n\t\tVBE\t\t= (1U << 11),\t\t\t// VBE table available\n\n\t\tFRAME_BUF\t= (1U << 12)\t\t\t// Frame buffer info available\n\n\t};\n\n\n\n\n\n#pragma pack(push, 1)\n\n\n\n\t// Kernel sections info\n", "file_path": "include/multiboot.hpp", "rank": 0, "score": 84031.600727476 }, { "content": "\t\t// Page flags\n\n\t\tenum class FLAGS : dword_t {\n\n\t\t\tCLEAR\t\t\t= 0x00000000,\n\n\t\t\tPRESENT\t\t\t= 0x00000001,\n\n\t\t\tWRITABLE\t\t= 0x00000002,\n\n\t\t\tUSER_ACCESSIBLE\t\t= 0x00000004,\n\n\t\t\tWRITE_THROUGH\t\t= 0x00000008,\n\n\t\t\tNON_CACHED\t\t= 0x00000010,\n\n\t\t\tACCESSED\t\t= 0x00000020,\n\n\t\t\tDIRTY\t\t\t= 0x00000040,\n\n\t\t\tHUGE\t\t\t= 0x00000080,\n\n\t\t\tGLOBAL\t\t\t= 0x00000100,\n\n\t\t\tUSER_DEFINED\t\t= 0x00000E00,\n\n\t\t\tFLAGS_MASK\t\t= PAGE_MASK,\n\n\t\t\tPHYS_ADDR_MASK\t\t= ~PAGE_MASK\n\n\t\t};\n\n\n\n\t\t// Default c-tor\n\n\t\tpaging() = default;\n\n\n\n\t\t// Identity map kernel + map higher-half + self-map page directory\n", "file_path": "include/arch/i386/paging.hpp", "rank": 1, "score": 79258.56619253718 }, { "content": "\t// CPUID EAX value (e.g. flag)\n\n\tenum class cpuidFlags_t : dword_t {\n\n\n\n\t\t// \"Intel\" features list\n\n\t\tFEATURES_INTEL\t\t= 0x00000000,\t\t//\n\n\t\tINFO_PROC_VERSION\t= 0x00000001,\t\t//\n\n\t\tINFO_CACHE_TLB\t\t= 0x00000002,\t\t//\n\n\t\tINFO_PENTIUM_III_SERIAL\t= 0x00000003,\t\t//\n\n\n\n\t\t// \"AMD\" features list\n\n\t\tFEATURES_AMD\t\t= 0x80000000\t\t//\n\n\n\n\t};\n\n\n\n\n\n\t// CPUID registers values holder\n\n\tstruct cpuidRegs_t {\n\n\t\tdword_t\t\teax;\t\t\t// EAX register value\n\n\t\tdword_t\t\tebx;\t\t\t// EBX register value\n\n\t\tdword_t\t\tecx;\t\t\t// ECX register value\n\n\t\tdword_t\t\tedx;\t\t\t// EDX register value\n", "file_path": "include/arch/x86_64/cpuid.hpp", "rank": 2, "score": 77125.30800762215 }, { "content": "////////////////////////////////////////////////////////////////\n\n//\n\n//\tBit flags template datatype\n\n//\n\n//\tFile:\tflags.hpp\n\n//\tDate:\t27 Sep 2021\n\n//\n\n//\tCopyright (c) 2017 - 2021, Igor Baklykov\n\n//\tAll rights reserved.\n\n//\n\n//\n\n\n\n\n\n#pragma once\n\n\n\n\n\n#include <type_traits>\n\n#include <utility>\n\n\n\n#include <arch/types.hpp>\n\n\n\n\n\n// OS namespace\n\nnamespace igros {\n\n\n\n\n\n\t// Kernel flags template class\n\n\ttemplate<typename T, typename U = typename std::enable_if_t<std::is_enum_v<T>, typename std::underlying_type_t<T>>>\n", "file_path": "include/flags.hpp", "rank": 3, "score": 73818.23684821202 }, { "content": "\t[[nodiscard]]\n\n\tconstexpr U kflags<T, U>::value() const noexcept {\n\n\t\treturn static_cast<U>(*this);\n\n\t}\n\n\n\n\n\n\t// Test bit\n\n\ttemplate<typename T, typename U>\n\n\t[[nodiscard]]\n\n\tconstexpr bool kflags<T, U>::test(const std::size_t bit) const noexcept {\n\n\t\treturn static_cast<U>(1U << bit) == (mValue & static_cast<U>(1U << bit));\n\n\t}\n\n\n\n\n\n\t// Test flag\n\n\ttemplate<typename T, typename U>\n\n\t[[nodiscard]]\n\n\tconstexpr bool kflags<T, U>::test(const T &value) const noexcept {\n\n\t\treturn static_cast<U>(value) == (mValue & static_cast<U>(value));\n\n\t}\n\n\n\n\n\n} // namespace igros\n\n\n", "file_path": "include/flags.hpp", "rank": 4, "score": 73811.103244698 }, { "content": "\t\t// Type move assignment\n\n\t\tconstexpr kflags& operator=(T &&value) noexcept;\n\n\n\n\t\t// Get value\n\n\t\t[[nodiscard]]\n\n\t\tconstexpr U\tvalue() const noexcept;\n\n\n\n\t\t// Test bit\n\n\t\t[[nodiscard]]\n\n\t\tconstexpr bool\ttest(const std::size_t bit = 0U) const noexcept;\n\n\t\t// Test flag\n\n\t\t[[nodiscard]]\n\n\t\tconstexpr bool\ttest(const T &value) const noexcept;\n\n\n\n\n\n\t};\n\n\n\n\n\n\t// From initializer list\n\n\ttemplate<typename T, typename U>\n", "file_path": "include/flags.hpp", "rank": 5, "score": 73810.00467022782 }, { "content": "\t\tconstexpr kflags operator&(const kflags<T, U> &other) const noexcept;\n\n\t\t// Bitwise OR operator\n\n\t\tconstexpr kflags operator|(const kflags<T, U> &other) const noexcept;\n\n\t\t// Bitwise XOR operator\n\n\t\tconstexpr kflags operator^(const kflags<T, U> &other) const noexcept;\n\n\n\n\t\t// Bitwise AND operator\n\n\t\tconstexpr kflags& operator&=(const T &other) noexcept;\n\n\t\t// Bitwise OR operator\n\n\t\tconstexpr kflags& operator|=(const T &other) noexcept;\n\n\t\t// Bitwise XOR operator\n\n\t\tconstexpr kflags& operator^=(const T &other) noexcept;\n\n\n\n\t\t// Bitwise AND operator\n\n\t\tconstexpr kflags operator&(const T &other) const noexcept;\n\n\t\t// Bitwise OR operator\n\n\t\tconstexpr kflags operator|(const T &other) const noexcept;\n\n\t\t// Bitwise XOR operator\n\n\t\tconstexpr kflags operator^(const T &other) const noexcept;\n\n\n", "file_path": "include/flags.hpp", "rank": 6, "score": 73807.4419970001 }, { "content": "\t\t// Bitwise NOT operator\n\n\t\tconstexpr kflags operator~() const noexcept;\n\n\n\n\t\t// Copy c-tor\n\n\t\tconstexpr kflags(const kflags &value) noexcept = default;\n\n\t\t// Copy assignment\n\n\t\tconstexpr kflags& operator=(const kflags &value) noexcept = default;\n\n\n\n\t\t// Move c-tor\n\n\t\tconstexpr kflags(kflags &&value) noexcept = default;\n\n\t\t// Move assignment\n\n\t\tconstexpr kflags& operator=(kflags &&value) noexcept = default;\n\n\n\n\t\t// Type copy c-tor\n\n\t\tconstexpr explicit kflags(const T &value) noexcept;\n\n\t\t// Type copy assignment\n\n\t\tconstexpr kflags& operator=(const T &value) noexcept;\n\n\n\n\t\t// Type move c-tor\n\n\t\tconstexpr explicit kflags(T &&value) noexcept;\n", "file_path": "include/flags.hpp", "rank": 7, "score": 73807.38162121197 }, { "content": "\t\tconstexpr explicit operator U() const noexcept;\n\n\n\n\t\t// Comparison operator\n\n\t\tconstexpr bool operator==(const kflags<T, U> &other) const noexcept;\n\n\t\t// Comparison operator\n\n\t\tconstexpr bool operator!=(const kflags<T, U> &other) const noexcept;\n\n\n\n\t\t// Comparison operator\n\n\t\tconstexpr bool operator==(const T &other) const noexcept;\n\n\t\t// Comparison operator\n\n\t\tconstexpr bool operator!=(const T &other) const noexcept;\n\n\n\n\t\t// Bitwise AND operator\n\n\t\tconstexpr kflags& operator&=(const kflags<T, U> &other) noexcept;\n\n\t\t// Bitwise OR operator\n\n\t\tconstexpr kflags& operator|=(const kflags<T, U> &other) noexcept;\n\n\t\t// Bitwise XOR operator\n\n\t\tconstexpr kflags& operator^=(const kflags<T, U> &other) noexcept;\n\n\n\n\t\t// Bitwise AND operator\n", "file_path": "include/flags.hpp", "rank": 8, "score": 73807.38162121197 }, { "content": "\tconstexpr kflags<T, U> kflags<T, U>::operator^(const T &other) const noexcept {\n\n\t\treturn kflags<T, U>(*this) ^= other;\n\n\t}\n\n\n\n\n\n\t// Bitwise NOT operator\n\n\ttemplate<typename T, typename U>\n\n\tconstexpr kflags<T, U> kflags<T, U>::operator~() const noexcept {\n\n\t\treturn kflags<T, U>(static_cast<T>(~mValue));\n\n\t}\n\n\n\n\n\n\t// Type copy c-tor\n\n\ttemplate<typename T, typename U>\n\n\tconstexpr kflags<T, U>::kflags(const T &value) noexcept\n\n\t\t: mValue(value) {}\n\n\n\n\t// Type copy assignment\n\n\ttemplate<typename T, typename U>\n\n\tconstexpr kflags<T, U>& kflags<T, U>::operator=(const T &value) noexcept {\n", "file_path": "include/flags.hpp", "rank": 9, "score": 73806.65344716751 }, { "content": "\ttemplate<typename ...Args>\n\n\tconstexpr kflags<T, U>::kflags(Args &&...args) noexcept\n\n\t\t: mValue((static_cast<U>(args) | ...)) {}\n\n\n\n\n\n\t// Type conversion operator\n\n\ttemplate<typename T, typename U>\n\n\t[[nodiscard]]\n\n\tconstexpr kflags<T, U>::operator T() const noexcept {\n\n\t\treturn static_cast<T>(mValue);\n\n\t}\n\n\n\n\t// Type conversion operator\n\n\ttemplate<typename T, typename U>\n\n\t[[nodiscard]]\n\n\tconstexpr kflags<T, U>::operator U() const noexcept {\n\n\t\treturn mValue;\n\n\t}\n\n\n\n\n", "file_path": "include/flags.hpp", "rank": 10, "score": 73806.61384606425 }, { "content": "\tconstexpr kflags<T, U>& kflags<T, U>::operator^=(const kflags<T, U> &other) noexcept {\n\n\t\treturn *this ^= static_cast<T>(other);\n\n\t}\n\n\n\n\n\n\t// Bitwise AND operator\n\n\ttemplate<typename T, typename U>\n\n\tconstexpr kflags<T, U> kflags<T, U>::operator&(const kflags<T, U> &other) const noexcept {\n\n\t\treturn *this & static_cast<T>(other);\n\n\t}\n\n\n\n\t// Bitwise OR operator\n\n\ttemplate<typename T, typename U>\n\n\tconstexpr kflags<T, U> kflags<T, U>::operator|(const kflags<T, U> &other) const noexcept {\n\n\t\treturn *this | static_cast<T>(other);\n\n\t}\n\n\n\n\t// Bitwise XOR operator\n\n\ttemplate<typename T, typename U>\n\n\tconstexpr kflags<T, U> kflags<T, U>::operator^(const kflags<T, U> &other) const noexcept {\n", "file_path": "include/flags.hpp", "rank": 11, "score": 73806.5774909705 }, { "content": "\t// Comparison operator\n\n\ttemplate<typename T, typename U>\n\n\tconstexpr bool kflags<T, U>::operator==(const kflags<T, U> &other) const noexcept {\n\n\t\treturn mValue == other.mValue;\n\n\t}\n\n\n\n\t// Comparison operator\n\n\ttemplate<typename T, typename U>\n\n\tconstexpr bool kflags<T, U>::operator!=(const kflags<T, U> &other) const noexcept {\n\n\t\treturn !(*this == other);\n\n\t}\n\n\n\n\n\n\t// Comparison operator\n\n\ttemplate<typename T, typename U>\n\n\tconstexpr bool kflags<T, U>::operator==(const T &other) const noexcept {\n\n\t\treturn mValue == static_cast<U>(other);\n\n\t}\n\n\n\n\t// Comparison operator\n", "file_path": "include/flags.hpp", "rank": 12, "score": 73806.54752120489 }, { "content": "\tconstexpr kflags<T, U>& kflags<T, U>::operator^=(const T &other) noexcept {\n\n\t\tmValue ^= static_cast<U>(other);\n\n\t\treturn *this;\n\n\t}\n\n\n\n\n\n\t// Bitwise AND operator\n\n\ttemplate<typename T, typename U>\n\n\tconstexpr kflags<T, U> kflags<T, U>::operator&(const T &other) const noexcept {\n\n\t\treturn kflags<T, U>(*this) &= other;\n\n\t}\n\n\n\n\t// Bitwise OR operator\n\n\ttemplate<typename T, typename U>\n\n\tconstexpr kflags<T, U> kflags<T, U>::operator|(const T &other) const noexcept {\n\n\t\treturn kflags<T, U>(*this) |= other;\n\n\t}\n\n\n\n\t// Bitwise XOR operator\n\n\ttemplate<typename T, typename U>\n", "file_path": "include/flags.hpp", "rank": 13, "score": 73806.46770770701 }, { "content": "\ttemplate<typename T, typename U>\n\n\tconstexpr bool kflags<T, U>::operator!=(const T &other) const noexcept {\n\n\t\treturn !(*this == other);\n\n\t}\n\n\n\n\n\n\t// Bitwise AND operator\n\n\ttemplate<typename T, typename U>\n\n\tconstexpr kflags<T, U>& kflags<T, U>::operator&=(const kflags<T, U> &other) noexcept {\n\n\t\treturn *this &= static_cast<T>(other);\n\n\t}\n\n\n\n\t// Bitwise OR operator\n\n\ttemplate<typename T, typename U>\n\n\tconstexpr kflags<T, U>& kflags<T, U>::operator|=(const kflags<T, U> &other) noexcept {\n\n\t\treturn *this |= static_cast<T>(other);\n\n\t}\n\n\n\n\t// Bitwise XOR operator\n\n\ttemplate<typename T, typename U>\n", "file_path": "include/flags.hpp", "rank": 14, "score": 73806.42138795614 }, { "content": "\t\treturn *this ^ static_cast<T>(other);\n\n\t}\n\n\n\n\n\n\t// Bitwise AND operator\n\n\ttemplate<typename T, typename U>\n\n\tconstexpr kflags<T, U>& kflags<T, U>::operator&=(const T &other) noexcept {\n\n\t\tmValue &= static_cast<U>(other);\n\n\t\treturn *this;\n\n\t}\n\n\n\n\t// Bitwise OR operator\n\n\ttemplate<typename T, typename U>\n\n\tconstexpr kflags<T, U>& kflags<T, U>::operator|=(const T &other) noexcept {\n\n\t\tmValue |= static_cast<U>(other);\n\n\t\treturn *this;\n\n\t}\n\n\n\n\t// Bitwise XOR operator\n\n\ttemplate<typename T, typename U>\n", "file_path": "include/flags.hpp", "rank": 15, "score": 73806.10529544852 }, { "content": "\t\tmValue = value;\n\n\t\treturn *this;\n\n\t}\n\n\n\n\n\n\t// Type move c-tor\n\n\ttemplate<typename T, typename U>\n\n\tconstexpr kflags<T, U>::kflags(T &&value) noexcept\n\n\t\t: mValue(std::move(static_cast<U>(value))) {}\n\n\n\n\t// Type move assignment\n\n\ttemplate<typename T, typename U>\n\n\tconstexpr kflags<T, U>& kflags<T, U>::operator=(T &&value) noexcept {\n\n\t\tmValue = std::move(value);\n\n\t\treturn *this;\n\n\t}\n\n\n\n\n\n\t// Get value\n\n\ttemplate<typename T, typename U>\n", "file_path": "include/flags.hpp", "rank": 16, "score": 73806.06740511257 }, { "content": "\tclass kflags {\n\n\n\n\t\tstatic_assert(std::is_enum_v<T>, \"Parameter T must be an enum!\");\n\n\n\n\t\tU\tmValue;\t\t// Real flags value\n\n\n\n\n\n\tpublic:\n\n\n\n\t\t// Default c-tor\n\n\t\tconstexpr kflags() noexcept = default;\n\n\t\t// From initializer list\n\n\t\ttemplate<typename ...Args>\n\n\t\tconstexpr explicit kflags(Args &&...args) noexcept; \n\n\n\n\t\t// Type conversion operator\n\n\t\t[[nodiscard]]\n\n\t\tconstexpr explicit operator T() const noexcept;\n\n\t\t// Type conversion operator\n\n\t\t[[nodiscard]]\n", "file_path": "include/flags.hpp", "rank": 17, "score": 70628.37285238072 }, { "content": "\t\t// Page flags\n\n\t\tenum class FLAGS : quad_t {\n\n\t\t\tCLEAR\t\t\t= 0x0000000000000000,\n\n\t\t\tPRESENT\t\t\t= 0x0000000000000001,\n\n\t\t\tWRITABLE\t\t= 0x0000000000000002,\n\n\t\t\tUSER_ACCESSIBLE\t\t= 0x0000000000000004,\n\n\t\t\tWRITE_THROUGH\t\t= 0x0000000000000008,\n\n\t\t\tNON_CACHED\t\t= 0x0000000000000010,\n\n\t\t\tACCESSED\t\t= 0x0000000000000020,\n\n\t\t\tDIRTY\t\t\t= 0x0000000000000040,\n\n\t\t\tHUGE\t\t\t= 0x0000000000000080,\n\n\t\t\tGLOBAL\t\t\t= 0x0000000000000100,\n\n\t\t\tUSER_DEFINED\t\t= 0x0000000000000E00,\n\n\t\t\tNON_EXECUTABLE\t\t= 0x8000000000000000,\n\n\t\t\tFLAGS_MASK\t\t= PAGE_MASK,\n\n\t\t\tPHYS_ADDR_MASK\t\t= ~PAGE_MASK\n\n\t\t};\n\n\n\n\t\t// Default c-tor\n\n\t\tpaging() noexcept = default;\n\n\n", "file_path": "include/arch/x86_64/paging.hpp", "rank": 18, "score": 60265.43851809452 }, { "content": "\t// Integer representation types\n\n\tenum class radix_t : byte_t {\n\n\t\tBIN\t= 0x02,\t\t\t// (Base 2)\tBinary integer format\n\n\t\tOCT\t= 0x08,\t\t\t// (Base 8)\tOct integer format\n\n\t\tDEC\t= 0x0A,\t\t\t// (Base 10)\tDecimal integer format\n\n\t\tHEX\t= 0x10\t\t\t// (Base 16)\tHexidemical integer format\n\n\t};\n\n\n\n\n\n\t// Kernel large unsigned integer to string function\n\n\tsbyte_t* kitoa(sbyte_t* buffer, const std::size_t size, const quad_t value, const radix_t radix = radix_t::DEC) noexcept;\n\n\t// Kernel large integer to string function\n\n\tsbyte_t* kitoa(sbyte_t* buffer, const std::size_t size, const squad_t value, const radix_t radix = radix_t::DEC) noexcept;\n\n\n\n\t// Kernel unsigned integer to string function\n\n\tinline sbyte_t* kitoa(sbyte_t* buffer, const std::size_t size, const dword_t value, const radix_t radix = radix_t::DEC) noexcept {\n\n\t\treturn kitoa(buffer, size, static_cast<quad_t>(value), radix);\n\n\t}\n\n\t// Kernel integer to string function\n\n\tinline sbyte_t* kitoa(sbyte_t* buffer, const std::size_t size, const sdword_t value, const radix_t radix = radix_t::DEC) noexcept {\n\n\t\treturn kitoa(buffer, size, static_cast<squad_t>(value), radix);\n", "file_path": "include/klib/kprint.hpp", "rank": 19, "score": 48166.34883513188 }, { "content": "\t// Parity\n\n\tenum class PARITY : byte_t {\n\n\t\tNONE\t\t= 0x00,\n\n\t\tODD\t\t= 0x01,\n\n\t\tEVEN\t\t= 0x02,\n\n\t\tMARK\t\t= 0x05,\n\n\t\tSPACE\t\t= 0x07\n\n\t};\n\n\n\n\n\n\t// Initialize serial port\n\n\t[[nodiscard]]\n\n\tbool\t\tserialInit(const BAUD_RATE baudRate, const DATA_SIZE dataSize, const STOP_BITS stopBits, const PARITY parity) noexcept;\n\n\n\n\t// Is write ready?\n\n\t[[nodiscard]]\n\n\tbool\t\tserialReadyWrite() noexcept;\n\n\t// Is read ready?\n\n\t[[nodiscard]]\n\n\tbool\t\tserialReadyRead() noexcept;\n\n\n", "file_path": "include/drivers/uart/serial.hpp", "rank": 20, "score": 47102.53097599114 }, { "content": "\t// ELF data type\n\n\tenum class ELF_DATA : byte_t {\n\n\t\tNONE\t\t= 0x00,\t\t\t\t// Unknown\n\n\t\tLSB\t\t= 0x01,\t\t\t\t// LSB order\n\n\t\tMSB\t\t= 0x02\t\t\t\t// MSB order\n\n\t};\n\n\n", "file_path": "include/sys/elf.hpp", "rank": 21, "score": 47102.53097599114 }, { "content": "\t// ELF class type\n\n\tenum class ELF_CLASS : byte_t {\n\n\t\tNONE\t\t= 0x00,\t\t\t\t// Unknown\n\n\t\tCLASS32\t\t= 0x01,\t\t\t\t// 32-bit\n\n\t\tCLASS64\t\t= 0x02\t\t\t\t// 64-bit\n\n\t};\n\n\n", "file_path": "include/sys/elf.hpp", "rank": 22, "score": 47102.53097599114 }, { "content": "\t\t// Exceptions number enumeration\n\n\t\tenum class NUMBER : dword_t {\n\n\t\t\tDIVIDE_BY_ZERO\t\t\t= 0U,\n\n\t\t\tDEBUG\t\t\t\t= 1U,\n\n\t\t\tNON_MASKABLE_IRQ\t\t= 2U,\n\n\t\t\tBREAKPOINT\t\t\t= 3U,\n\n\t\t\tINTO_DETECTED_OVERFLOW\t\t= 4U,\n\n\t\t\tBOUND_RANGE_EXCEEDED\t\t= 5U,\n\n\t\t\tINVALID_OPCODE\t\t\t= 6U,\n\n\t\t\tNO_COPROCESSOR\t\t\t= 7U,\n\n\t\t\tDOUBLE_FAULT\t\t\t= 8U,\n\n\t\t\tCOPROCESSOR_SEGMENT_OVERRUN\t= 9U,\n\n\t\t\tINVALID_TSS\t\t\t= 10U,\n\n\t\t\tSEGMENT_NOT_PRESENT\t\t= 11U,\n\n\t\t\tSTACK_FAULT\t\t\t= 12U,\n\n\t\t\tGENERAL_PROTECTION_FAULT\t= 13U,\n\n\t\t\tPAGE_FAULT\t\t\t= 14U,\n\n\t\t\tUNKNOWN_IRQ\t\t\t= 15U,\n\n\t\t\tCOPROCESSOR_FAULT\t\t= 16U,\n\n\t\t\tALIGNMENT_CHECK\t\t\t= 17U,\n\n\t\t\tMACHINE_CHECK\t\t\t= 18U\n", "file_path": "include/arch/i386/exceptions.hpp", "rank": 23, "score": 46918.23902053769 }, { "content": "\t// Multiboot 1 memory entry type\n\n\tenum class MEMORY_MAP_TYPE : dword_t {\n\n\t\tAVAILABLE\t= 1U,\t\t\t// Memory available\n\n\t\tRESERVED\t= 2U,\t\t\t// Memory reserved\n\n\t\tACPI\t\t= 3U,\t\t\t// Memory is ACPI reclaimable\n\n\t\tNVS\t\t= 4U,\t\t\t// Memory is NVS\n\n\t\tBAD\t\t= 5U\t\t\t// BAD memory\n\n\t};\n\n\n\n\t// Multiboot 1 memory map entry\n\n\tstruct memoryMapEntry final {\n\n\t\tdword_t\t\tsize;\t\t\t// Memory entry size\n\n\t\tquad_t\t\taddress;\t\t// Memory entry address\n\n\t\tquad_t\t\tlength;\t\t\t// Memory entry length\n\n\t\tMEMORY_MAP_TYPE\ttype;\t\t\t// Memory entry type\n\n\t};\n\n\n\n\n\n\t// VBE config\n\n\tstruct vbeConfig final {\n\n\t\tsbyte_t\t\tsignature[4ULL];\t// VBE signature (\"VESA\")\n", "file_path": "include/multiboot.hpp", "rank": 24, "score": 46918.23902053769 }, { "content": "\t// Interrupts number enumeration\n\n\tenum class irq_t : dword_t {\n\n\t\tPIT\t\t= 0U,\n\n\t\tKEYBOARD\t= 1U,\n\n\t\tPIC\t\t= 2U,\n\n\t\tUART2\t\t= 3U,\n\n\t\tUART1\t\t= 4U\n\n\t};\n\n\n\n\n", "file_path": "include/arch/x86_64/irq.hpp", "rank": 25, "score": 46918.23902053769 }, { "content": "\t// Interrupts number enumeration\n\n\tenum class irq_t : dword_t {\n\n\t\tPIT\t\t= 0U,\n\n\t\tKEYBOARD\t= 1U,\n\n\t\tPIC\t\t= 2U,\n\n\t\tUART2\t\t= 3U,\n\n\t\tUART1\t\t= 4U\n\n\t};\n\n\n\n\n", "file_path": "include/arch/i386/irq.hpp", "rank": 26, "score": 46918.23902053769 }, { "content": "\t// ELF version\n\n\tenum class ELF_VERSION : dword_t {\n\n\t\tNONE\t\t= 0,\t\t\t\t// Unknown version\n\n\t\tCURRENT\t\t= 1\t\t\t\t// Current version\n\n\t};\n\n\n", "file_path": "include/sys/elf.hpp", "rank": 27, "score": 46918.23902053769 }, { "content": "\t\t// Platform name ID\n\n\t\tenum class PLATFORM_ARCH_NAME : dword_t {\n\n\t\t\tUNKNOWN\t\t= 0x00000000,\n\n\t\t\tI386\t\t= 0x00000001,\n\n\t\t\tX86_64\t\t= 0x00000002,\n\n\t\t\tARM\t\t= 0x00000004,\n\n\t\t\tARM64\t\t= 0x00000008,\n\n\t\t\tAVR\t\t= 0x00000010\n\n\t\t};\n\n\n\n\n\n#if\tdefined (IGROS_ARCH_i386)\n\n\t\t// i386 platform\n\n\t\tconstexpr static PLATFORM_ARCH_NAME PLATFORM_NAME = PLATFORM_ARCH_NAME::I386;\n\n#elif\tdefined (IGROS_ARCH_x86_64)\n\n\t\t// x86_64 platform\n\n\t\tconstexpr static PLATFORM_ARCH_NAME PLATFORM_NAME = PLATFORM_ARCH_NAME::X86_64;\n\n#else\n\n\t\t// Unknown platform\n\n\t\tconstexpr static PLATFORM_ARCH_NAME PLATFORM_NAME = PLATFORM_ARCH_NAME::UNKNOWN;\n\n#endif\n", "file_path": "include/platform.hpp", "rank": 28, "score": 46918.23902053769 }, { "content": "\t\t// Exceptions number enumeration\n\n\t\tenum class NUMBER : dword_t {\n\n\t\t\tDIVIDE_BY_ZERO\t\t\t= 0U,\n\n\t\t\tDEBUG\t\t\t\t= 1U,\n\n\t\t\tNON_MASKABLE_IRQ\t\t= 2U,\n\n\t\t\tBREAKPOINT\t\t\t= 3U,\n\n\t\t\tINTO_DETECTED_OVERFLOW\t\t= 4U,\n\n\t\t\tBOUND_RANGE_EXCEEDED\t\t= 5U,\n\n\t\t\tINVALID_OPCODE\t\t\t= 6U,\n\n\t\t\tNO_COPROCESSOR\t\t\t= 7U,\n\n\t\t\tDOUBLE_FAULT\t\t\t= 8U,\n\n\t\t\tCOPROCESSOR_SEGMENT_OVERRUN\t= 9U,\n\n\t\t\tINVALID_TSS\t\t\t= 10U,\n\n\t\t\tSEGMENT_NOT_PRESENT\t\t= 11U,\n\n\t\t\tSTACK_FAULT\t\t\t= 12U,\n\n\t\t\tGENERAL_PROTECTION_FAULT\t= 13U,\n\n\t\t\tPAGE_FAULT\t\t\t= 14U,\n\n\t\t\tUNKNOWN_IRQ\t\t\t= 15U,\n\n\t\t\tCOPROCESSOR_FAULT\t\t= 16U,\n\n\t\t\tALIGNMENT_CHECK\t\t\t= 17U,\n\n\t\t\tMACHINE_CHECK\t\t\t= 18U\n", "file_path": "include/arch/x86_64/exceptions.hpp", "rank": 29, "score": 46918.23902053769 }, { "content": "\t// Stop bits\n\n\tenum class STOP_BITS : byte_t {\n\n\t\tSTOP_1\t\t= 0x00,\n\n\t\tSTOP_1_5\t= 0x01,\n\n\t\tSTOP_2\t\t= 0x03\n\n\t};\n\n\n", "file_path": "include/drivers/uart/serial.hpp", "rank": 30, "score": 46114.02792484466 }, { "content": "\t// VGA memory colors enumeration\n\n\tenum class vmemColor : byte_t {\n\n\t Black \t= 0x00,\t\t\t// Black VGA color\n\n\t Blue\t\t= 0x01,\t\t\t// Blue VGA color\n\n\t\tGreen\t\t= 0x02,\t\t\t// Green VGA color\n\n\t\tCyan\t\t= 0x03,\t\t\t// Cyan VGA color\n\n\t\tRed\t\t= 0x04,\t\t\t// Red VGA color\n\n\t\tMagenta\t\t= 0x05,\t\t\t// Magenta VGA color\n\n\t\tBrown\t\t= 0x06,\t\t\t// Brown VGA color\n\n\t\tLightGray\t= 0x07,\t\t\t// Light gray VGA color\n\n\t\tDarkGray\t= 0x08,\t\t\t// Dark gray VGA color\n\n\t\tLightBlue\t= 0x09,\t\t\t// Light blue VGA color\n\n\t\tLightGreen\t= 0x0A,\t\t\t// Light green VGA color\n\n\t\tLightCyan\t= 0x0B,\t\t\t// Light cyan VGA color\n\n\t\tLightRed\t= 0x0C,\t\t\t// Light red VGA color\n\n\t\tLightMagenta\t= 0x0D,\t\t\t// Light magenta VGA color\n\n\t\tYellow\t\t= 0x0E,\t\t\t// Yellow VGA color\n\n\t\tWhite\t\t= 0x0F\t\t\t// White VGA color\n\n\t};\n\n\n\n\t// VGA memory symbol representation\n", "file_path": "include/drivers/vga/vmem.hpp", "rank": 31, "score": 46114.02792484466 }, { "content": "\t// Data size\n\n\tenum class DATA_SIZE : byte_t {\n\n\t\tCHAR_5\t\t= 0x00,\n\n\t\tCHAR_6\t\t= 0x01,\n\n\t\tCHAR_7\t\t= 0x02,\n\n\t\tCHAR_8\t\t= 0x03\n\n\t};\n\n\n", "file_path": "include/drivers/uart/serial.hpp", "rank": 32, "score": 46114.02792484466 }, { "content": "\t// Baud rates\n\n\tenum class BAUD_RATE : dword_t {\n\n\t\tBAUD_110\t= 110,\n\n\t\tBAUD_300\t= 300,\n\n\t\tBAUD_600\t= 600,\n\n\t\tBAUD_1200\t= 1200,\n\n\t\tBAUD_2400\t= 2400,\n\n\t\tBAUD_4800\t= 4800,\n\n\t\tBAUD_9600\t= 9600,\n\n\t\tBAUD_14400\t= 14400,\n\n\t\tBAUD_19200\t= 19200,\n\n\t\tBAUD_38400\t= 38400,\n\n\t\tBAUD_57600\t= 57600,\n\n\t\tBAUD_115200\t= 115200\n\n\t};\n\n\n", "file_path": "include/drivers/uart/serial.hpp", "rank": 33, "score": 45929.73596939121 }, { "content": "\t// ELF program type\n\n\tenum class ELF_PROGRAM_TYPE : dword_t {\n\n\t\tNONE\t\t= 0x00000000,\t\t\t// Unused\n\n\t\tLOAD\t\t= 0x00000001,\t\t\t// Loadable segment\n\n\t\tDYNAMIC\t\t= 0x00000002,\t\t\t// Dynamic linking info\n\n\t\tINTERP\t\t= 0x00000003,\t\t\t// Interpreter info\n\n\t\tNOTE\t\t= 0x00000004,\t\t\t// Auxiliary info\n\n\t\tSHLIB\t\t= 0x00000005,\t\t\t// Reserved\n\n\t\tPHDR\t\t= 0x00000006,\t\t\t// Program header table itself\n\n\t\tLOOS\t\t= 0x60000000,\t\t\t// Inclusive reserved ranges for OS/Proc semantic\n\n\t\tHIOS\t\t= 0x6FFFFFFF,\t\t\t// --- // ---\n\n\t\tLOPROC\t\t= 0x70000000,\t\t\t// --- // ---\n\n\t\tHIPROC\t\t= 0x7FFFFFFF\t\t\t// --- // ---\n\n\t};\n\n\n\n\t// ELF program header\n\n\tstruct elfProgramHeader_t {\n\n\n\n\t\tELF_PROGRAM_TYPE\ttype;\t\t\t// ELF Program table type\n\n\n\n#if \t(IGROS_ARCH == x86_64)\n", "file_path": "include/sys/elf.hpp", "rank": 34, "score": 45929.73596939121 }, { "content": "\t\t// Print multiboot memory info\n\n\t\tvoid\tprintMemInfo() const noexcept;\n\n\t\t// Print multiboot memory map\n\n\t\tvoid\tprintMemMap() const noexcept;\n\n\t\t// Print multiboot VBE info\n\n\t\tvoid\tprintVBEInfo() const noexcept;\n\n\t\t// Print multiboot FB info\n\n\t\tvoid\tprintFBInfo() const noexcept;\n\n\n\n\n\n\t};\n\n\n\n\t// Multiboot contains valid memory info\n\n\t[[nodiscard]]\n\n\tinline bool info_t::hasInfoMemory() const noexcept {\n\n\t\treturn kflags<flags_t>(flags).test(flags_t::MEM);\n\n\t}\n\n\n\n\t// Multiboot contains valid boot device info\n\n\t[[nodiscard]]\n", "file_path": "include/multiboot.hpp", "rank": 35, "score": 34213.256512327076 }, { "content": "\t\t[[nodiscard]]\n\n\t\tconstexpr bool\tisAVR() const noexcept;\n\n\n\n\t\t// Get platform name\n\n\t\t[[nodiscard]]\n\n\t\tauto\tname() const noexcept;\n\n\n\n\t\t// Initialize platform\n\n\t\tvoid\tinitialize() const noexcept;\n\n\t\t// Finalize platform\n\n\t\tvoid\tfinalize() const noexcept;\n\n\n\n\t\t// Shutdown platform\n\n\t\tvoid\tshutdown() const noexcept;\n\n\t\t// Reboot platform\n\n\t\tvoid\treboot() const noexcept;\n\n\n\n\t\t// Suspend platform\n\n\t\tvoid\tsuspend() const noexcept;\n\n\t\t// Wakeup platform\n", "file_path": "include/platform.hpp", "rank": 36, "score": 34213.16532215307 }, { "content": "\n\n// Multiboot code zone\n\nnamespace igros::multiboot {\n\n\n\n\n\n\t// Multiboot 1 header magic\n\n\tconstexpr static auto HEADER_MAGIC\t= 0x1BADB002;\n\n\t// Multiboot 1 bootloader magic\n\n\tconstexpr static auto BOOTLOADER_MAGIC\t= 0x2BADB002;\n\n\n\n\n\n\t// Multiboot 1 header signature check function\n\n\tinline static bool check(const dword_t signature) noexcept {\n\n\t\treturn (BOOTLOADER_MAGIC == signature);\n\n\t}\n\n\n\n\n\n\t// Multiboot header flags enumeration\n", "file_path": "include/multiboot.hpp", "rank": 37, "score": 34212.58119351131 }, { "content": "////////////////////////////////////////////////////////////////\n\n//\n\n//\tMultiboot 1 header info\n\n//\n\n//\tFile:\tmultiboot.hpp\n\n//\tDate:\t12 Feb 2021\n\n//\n\n//\tCopyright (c) 2017 - 2021, Igor Baklykov\n\n//\tAll rights reserved.\n\n//\n\n//\n\n\n\n\n\n#pragma once\n\n\n\n\n\n#include <arch/types.hpp>\n\n\n\n#include <flags.hpp>\n\n\n", "file_path": "include/multiboot.hpp", "rank": 38, "score": 34212.33590800346 }, { "content": "\tinline bool info_t::hasInfoBootDevice() const noexcept {\n\n\t\treturn kflags<flags_t>(flags).test(flags_t::BOOT_DEV);\n\n\t}\n\n\n\n\t// Multiboot contains valid command line info\n\n\t[[nodiscard]]\n\n\tinline bool info_t::hasInfoCommandLine() const noexcept {\n\n\t\treturn kflags<flags_t>(flags).test(flags_t::CMD);\n\n\t}\n\n\n\n\t// Multiboot contains valid kernel modules info\n\n\t[[nodiscard]]\n\n\tinline bool info_t::hasInfoModules() const noexcept {\n\n\t\treturn kflags<flags_t>(flags).test(flags_t::MODULES);\n\n\t}\n\n\n\n\t// Multiboot contains valid A.OUT sections info\n\n\t[[nodiscard]]\n\n\tinline bool info_t::hasInfoAOUT() const noexcept {\n\n\t\t// A.OUT but not ELF\n", "file_path": "include/multiboot.hpp", "rank": 39, "score": 34212.26647334432 }, { "content": "\t}\n\n\n\n\t// Suspend platform\n\n\tinline void description_t::suspend() const noexcept {\n\n\t\tmSuspend();\n\n\t}\n\n\n\n\t// Wakeup platform\n\n\tinline void description_t::wakeup() const noexcept {\n\n\t\tmWakeup();\n\n\t}\n\n\n\n\n\n\t// Platform description\n\n\textern const description_t CURRENT_PLATFORM;\n\n\n\n\n\n} // namespace igros::platform\n\n\n", "file_path": "include/platform.hpp", "rank": 40, "score": 34212.114687307556 }, { "content": "\t[[nodiscard]]\n\n\tconstexpr auto KERNEL_VERSION() noexcept {\n\n\t\treturn KERNEL_VERSION(VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD);\n\n\t}\n\n\n\n\t// Kernel version to string\n\n\t[[nodiscard]]\n\n\tconstexpr auto KERNEL_VERSION_STRING() noexcept {\n\n\t\treturn \"v0.1.34 [ BETA ]\";\n\n\t}\n\n\n\n\n\n}\t// namespace igros\n\n\n", "file_path": "include/version.hpp", "rank": 41, "score": 34211.96197757649 }, { "content": "\n\n\n\n// Kernel start and end\n\nextern const igros::byte_t _SECTION_KERNEL_START_;\n\nextern const igros::byte_t _SECTION_KERNEL_END_;\n\n\n\n\n\n// OS platform namespace\n\nnamespace igros::platform {\n\n\n\n\n\n\t// Get kernel start address\n\n\t[[nodiscard]]\n\n\tconstexpr auto KERNEL_START() noexcept {\n\n\t\treturn &_SECTION_KERNEL_START_;\n\n\t}\n\n\n\n\t// Get kernel end address\n\n\t[[nodiscard]]\n\n\tconstexpr auto KERNEL_END() noexcept {\n", "file_path": "include/platform.hpp", "rank": 42, "score": 34211.86597946038 }, { "content": "\t// Multiboot contains valid VBE info\n\n\t[[nodiscard]]\n\n\tinline bool info_t::hasInfoVBE() const noexcept {\n\n\t\treturn kflags<flags_t>(flags).test(flags_t::VBE);\n\n\t}\n\n\n\n\t// Multiboot contains valid FrameBuffer info\n\n\t[[nodiscard]]\n\n\tinline bool info_t::hasInfoFrameBuffer() const noexcept {\n\n\t\treturn kflags<flags_t>(flags).test(flags_t::FRAME_BUF);\n\n\t}\n\n\n\n\n\n\t// Get multiboot command line\n\n\t[[nodiscard]]\n\n\tinline const sbyte_t* info_t::commandLine() const noexcept {\n\n\t\treturn (hasInfoCommandLine()) ? reinterpret_cast<const sbyte_t* const>(cmdLine) : nullptr;\n\n\t}\n\n\n\n\t// Get multiboot bootloader name\n\n\t[[nodiscard]]\n\n\tinline const sbyte_t* info_t::loaderName() const noexcept {\n\n\t\treturn (hasInfoBootloaderName()) ? reinterpret_cast<const sbyte_t* const>(bootloaderName) : nullptr;\n\n\t}\n\n\n\n\n", "file_path": "include/multiboot.hpp", "rank": 43, "score": 34211.33770116329 }, { "content": "\n\n\t\t// Get instance function\n\n\t\tstatic T& get() noexcept;\n\n\n\n\n\n\t};\n\n\n\n\t// Get instance function\n\n\ttemplate<typename T>\n\n\tT& singleton<T>::get() noexcept {\n\n\t\t// Create static object (if not yet created)\n\n\t\tstatic T s;\n\n\t\t// Return reference to it\n\n\t\treturn s;\n\n\t}\n\n\n\n\n\n}\t// namespace igros\n\n\n", "file_path": "include/singleton.hpp", "rank": 44, "score": 34211.111027572624 }, { "content": "\t\tbool\thasInfoBootloaderName() const noexcept;\n\n\t\t// Multiboot contains valid APM table info\n\n\t\t[[nodiscard]]\n\n\t\tbool\thasInfoAPM() const noexcept;\n\n\t\t// Multiboot contains valid VBE info\n\n\t\t[[nodiscard]]\n\n\t\tbool\thasInfoVBE() const noexcept;\n\n\t\t// Multiboot contains valid FrameBuffer info\n\n\t\t[[nodiscard]]\n\n\t\tbool\thasInfoFrameBuffer() const noexcept;\n\n\n\n\t\t// Get multiboot command line\n\n\t\t[[nodiscard]]\n\n\t\tconst sbyte_t*\tcommandLine() const noexcept;\n\n\t\t// Get multiboot bootloader name\n\n\t\t[[nodiscard]]\n\n\t\tconst sbyte_t*\tloaderName() const noexcept;\n\n\n\n\t\t// Print multiboot flags\n\n\t\tvoid\tprintFlags() const noexcept;\n", "file_path": "include/multiboot.hpp", "rank": 45, "score": 34210.979234576764 }, { "content": "// OS namespace\n\nnamespace igros {\n\n\n\n\n\n\t// Kernel version constants\n\n\tconstexpr auto VERSION_MAJOR\t= static_cast<byte_t>(0U);\n\n\tconstexpr auto VERSION_MINOR\t= static_cast<byte_t>(1U);\n\n\tconstexpr auto VERSION_BUILD\t= static_cast<word_t>(34U);\n\n\n\n\t// Kernel version name\n\n\tconstexpr auto VERSION_NAME\t= \"BETA\";\n\n\n\n\n\n\t// Kernel version integer\n\n\t[[nodiscard]]\n\n\tconstexpr auto KERNEL_VERSION(const byte_t major, const byte_t minor, const word_t build) noexcept {\n\n\t\treturn (static_cast<dword_t>(build) | (static_cast<dword_t>(minor) << 16) | (static_cast<dword_t>(major) << 24));\n\n\t}\n\n\n\n\t// Kernel current version integer\n", "file_path": "include/version.hpp", "rank": 46, "score": 34210.483017653016 }, { "content": "\t}\n\n\n\n\t// Initialize platform\n\n\tinline void description_t::initialize() const noexcept {\n\n\t\tmInit();\n\n\t}\n\n\n\n\t// Finalize platform\n\n\tinline void description_t::finalize() const noexcept {\n\n\t\tmFinalzie();\n\n\t}\n\n\n\n\t// Shutdown platform\n\n\tinline void description_t::shutdown() const noexcept {\n\n\t\tmShutdown();\n\n\t}\n\n\n\n\t// Reboot platform\n\n\tinline void description_t::reboot() const noexcept {\n\n\t\tmReboot();\n", "file_path": "include/platform.hpp", "rank": 47, "score": 34209.804294132744 }, { "content": "\t}\n\n\n\n\t// Multiboot contains valid config table info\n\n\t[[nodiscard]]\n\n\tinline bool info_t::hasInfoConfig() const noexcept {\n\n\t\treturn kflags<flags_t>(flags).test(flags_t::TABLE_CONFIG);\n\n\t}\n\n\n\n\t// Multiboot contains valid bootloader name info\n\n\t[[nodiscard]]\n\n\tinline bool info_t::hasInfoBootloaderName() const noexcept {\n\n\t\treturn kflags<flags_t>(flags).test(flags_t::LOADER_NAME);\n\n\t}\n\n\n\n\t// Multiboot contains valid APM table info\n\n\t[[nodiscard]]\n\n\tinline bool info_t::hasInfoAPM() const noexcept {\n\n\t\treturn kflags<flags_t>(flags).test(flags_t::TABLE_APM);\n\n\t}\n\n\n", "file_path": "include/multiboot.hpp", "rank": 48, "score": 34209.51018047991 }, { "content": "\t\treturn\tkflags<flags_t>(flags).test(flags_t::SYMS_AOUT) && !kflags<flags_t>(flags).test(flags_t::SYMS_ELF);\n\n\t}\n\n\n\n\t// Multiboot contains valid ELF sections info\n\n\t[[nodiscard]]\n\n\tinline bool info_t::hasInfoELF() const noexcept {\n\n\t\t// ELF but not A.OUT\n\n\t\treturn kflags<flags_t>(flags).test(flags_t::SYMS_ELF) && !kflags<flags_t>(flags).test(flags_t::SYMS_AOUT);\n\n\t}\n\n\n\n\t// Multiboot contains valid memory map info\n\n\t[[nodiscard]]\n\n\tinline bool info_t::hasInfoMemoryMap() const noexcept {\n\n\t\treturn kflags<flags_t>(flags).test(flags_t::MEM_MAP);\n\n\t}\n\n\n\n\t// Multiboot contains valid drives info\n\n\t[[nodiscard]]\n\n\tinline bool info_t::hasInfoDrives() const noexcept {\n\n\t\treturn kflags<flags_t>(flags).test(flags_t::DRIVES);\n", "file_path": "include/multiboot.hpp", "rank": 49, "score": 34209.50039355257 }, { "content": "\t\tbyte_t\t\tbluePosition;\n\n\t\tbyte_t\t\treservedMask;\n\n\t\tbyte_t\t\treservedPosition;\n\n\t\tbyte_t\t\tdirectColorAttributes;\n\n\t\tdword_t\t\tphysbase;\n\n\t\tdword_t\t\treserved1;\n\n\t\tword_t\t\treserved2;\n\n\t};\n\n\n\n#pragma pack(pop)\n\n\n\n\n\n\t// Test multiboot\n\n\tvoid test(const info_t* const multiboot, const dword_t magic) noexcept;\n\n\n\n\n\n}\t// namespace igros::multiboot\n\n\n", "file_path": "include/multiboot.hpp", "rank": 50, "score": 34209.47508141113 }, { "content": "////////////////////////////////////////////////////////////////\n\n//\n\n//\tIgrOS platform description\n\n//\n\n//\tFile:\tplatform.hpp\n\n//\tDate:\t27 Sep 2021\n\n//\n\n//\tCopyright (c) 2017 - 2021, Igor Baklykov\n\n//\tAll rights reserved.\n\n//\n\n//\n\n\n\n\n\n#pragma once\n\n\n\n// C++\n\n#include <type_traits>\n\n#include <string_view>\n\n// IgrOS\n\n#include <arch/types.hpp>\n", "file_path": "include/platform.hpp", "rank": 51, "score": 34208.71499959098 }, { "content": "////////////////////////////////////////////////////////////////\n\n//\n\n//\tIgrOS singleton implementation\n\n//\n\n//\tFile:\tsingleton.hpp\n\n//\tDate:\t27 Sep 2021\n\n//\n\n//\tCopyright (c) 2017 - 2021, Igor Baklykov\n\n//\tAll rights reserved.\n\n//\n\n//\n\n\n\n\n\n#pragma once\n\n\n\n\n\n// OS namespace\n\nnamespace igros {\n\n\n\n\n\n\t// Singleton\n\n\ttemplate<typename T>\n", "file_path": "include/singleton.hpp", "rank": 52, "score": 34208.36074323366 }, { "content": "////////////////////////////////////////////////////////////////\n\n//\n\n//\tIgrOS version info\n\n//\n\n//\tFile:\tversion.hpp\n\n//\tDate:\t24 Sep 2021\n\n//\n\n//\tCopyright (c) 2017 - 2021, Igor Baklykov\n\n//\tAll rights reserved.\n\n//\n\n//\n\n\n\n\n\n#pragma once\n\n\n\n\n\n// IgrOS\n\n#include <arch/types.hpp>\n\n\n\n\n", "file_path": "include/version.hpp", "rank": 53, "score": 34207.75821940605 }, { "content": "\t\treturn &_SECTION_KERNEL_END_;\n\n\t}\n\n\n\n\t// Get kernel size\n\n\t[[nodiscard]]\n\n\tconstexpr auto KERNEL_SIZE() noexcept {\n\n\t\treturn (KERNEL_END() - KERNEL_START());\n\n\t}\n\n\n\n\n\n\t// Platform desciption structure\n", "file_path": "include/platform.hpp", "rank": 54, "score": 34207.47545910082 }, { "content": "\t\tvoid\twakeup() const noexcept;\n\n\n\n\n\n\t};\n\n\n\n\n\n\t// C-tor #2\n\n\tconstexpr description_t::description_t(\n\n\t\tconst char* const\tname,\n\n\t\tconst init_t\t\tinit,\n\n\t\tconst finalize_t\tfinalize,\n\n\t\tconst shutdown_t\tshutdown,\n\n\t\tconst reboot_t\t\treboot,\n\n\t\tconst suspend_t\t\tsuspend,\n\n\t\tconst wakeup_t\t\twakeup\n\n\t) noexcept\n\n\t\t: mName\t\t(name),\n\n\t\t mInit\t\t(init),\n\n\t\t mFinalzie\t(finalize),\n\n\t\t mShutdown\t(shutdown),\n", "file_path": "include/platform.hpp", "rank": 55, "score": 34207.46582221214 }, { "content": "\t\treturn (PLATFORM_ARCH_NAME::ARM == PLATFORM_NAME);\n\n\t}\n\n\n\n\t// Check if arm64\n\n\t[[nodiscard]]\n\n\tconstexpr bool description_t::isARM64() const noexcept {\n\n\t\treturn (PLATFORM_ARCH_NAME::ARM64 == PLATFORM_NAME);\n\n\t}\n\n\n\n\t// Check if avr\n\n\t[[nodiscard]]\n\n\tconstexpr bool description_t::isAVR() const noexcept {\n\n\t\treturn (PLATFORM_ARCH_NAME::AVR == PLATFORM_NAME);\n\n\t}\n\n\n\n\n\n\t// Get platform name\n\n\t[[nodiscard]]\n\n\tinline auto description_t::name() const noexcept {\n\n\t\treturn mName;\n", "file_path": "include/platform.hpp", "rank": 56, "score": 34207.37155500514 }, { "content": "\t\tdword_t\t\tchecksum;\t\t\t// Multiboot header checksum\n\n\t\tinfoSections\tsections;\t\t\t// Executable sections data\n\n\t\tinfoVideo\tvideo;\t\t\t\t// Video mode data\n\n\t};\n\n\n\n\n\n\t// Multiboot 1 information from bootloader\n\n\tstruct info_t final {\n\n\n\n\t\tdword_t\t\tflags;\t\t\t\t// Multiboot present features flag\n\n\n\n\t\tdword_t\t\tmemLow;\t\t\t\t// Multiboot bios memory low info\n\n\t\tdword_t\t\tmemHigh;\t\t\t// Multiboot bios memory high info\n\n\n\n\t\tdword_t\t\tbootDevice;\t\t\t// Multiboot boot device\n\n\n\n\t\tdword_t\t\tcmdLine;\t\t\t// Multiboot bootloader command line\n\n\n\n\t\tdword_t\t\tmodulesCount;\t\t\t// Multiboot kernel modules count\n\n\t\tdword_t\t\tmodulesAddr;\t\t\t// Multiboot kernel modules address\n", "file_path": "include/multiboot.hpp", "rank": 57, "score": 34206.38576410359 }, { "content": "\n\n\n\n\t\t// Platform init function pointer type\n\n\t\tusing init_t\t\t= std::add_pointer_t<void()>;\n\n\t\t// Platform finalize function pointer type\n\n\t\tusing finalize_t\t= std::add_pointer_t<void()>;\n\n\n\n\t\t// Platform shutdown function pointer type\n\n\t\tusing shutdown_t\t= std::add_pointer_t<void()>;\n\n\t\t// Platform reboot function pointer type\n\n\t\tusing reboot_t\t\t= std::add_pointer_t<void()>;\n\n\n\n\t\t// Platform suspend function pointer type\n\n\t\tusing suspend_t\t\t= std::add_pointer_t<void()>;\n\n\t\t// Platform wakeup function pointer type\n\n\t\tusing wakeup_t\t\t= std::add_pointer_t<void()>;\n\n\n\n\n\n\t\tconst char* const\tmName;\t\t\t// Platform name\n\n\n", "file_path": "include/platform.hpp", "rank": 58, "score": 34205.14354088292 }, { "content": "\t\t\tconst finalize_t\tfinalize,\n\n\t\t\tconst shutdown_t\tshutdown,\n\n\t\t\tconst reboot_t\t\treboot,\n\n\t\t\tconst suspend_t\t\tsuspend,\n\n\t\t\tconst wakeup_t\t\twakeup\n\n\t\t) noexcept;\n\n\n\n\t\t// Check if i386\n\n\t\t[[nodiscard]]\n\n\t\tconstexpr bool\tisI386() const noexcept;\n\n\t\t// Check if x86_64\n\n\t\t[[nodiscard]]\n\n\t\tconstexpr bool\tisX86_64() const noexcept;\n\n\t\t// Check if arm32\n\n\t\t[[nodiscard]]\n\n\t\tconstexpr bool\tisARM32() const noexcept;\n\n\t\t// Check if arm64\n\n\t\t[[nodiscard]]\n\n\t\tconstexpr bool\tisARM64() const noexcept;\n\n\t\t// Check if avr\n", "file_path": "include/platform.hpp", "rank": 59, "score": 34205.0566267485 }, { "content": "\t\t// Multiboot contains valid kernel modules info\n\n\t\t[[nodiscard]]\n\n\t\tbool\thasInfoModules() const noexcept;\n\n\t\t// Multiboot contains valid A.OUT sections info\n\n\t\t[[nodiscard]]\n\n\t\tbool\thasInfoAOUT() const noexcept;\n\n\t\t// Multiboot contains valid ELF sections info\n\n\t\t[[nodiscard]]\n\n\t\tbool\thasInfoELF() const noexcept;\n\n\t\t// Multiboot contains valid memory map info\n\n\t\t[[nodiscard]]\n\n\t\tbool\thasInfoMemoryMap() const noexcept;\n\n\t\t// Multiboot contains valid drives info\n\n\t\t[[nodiscard]]\n\n\t\tbool\thasInfoDrives() const noexcept;\n\n\t\t// Multiboot contains valid config table info\n\n\t\t[[nodiscard]]\n\n\t\tbool\thasInfoConfig() const noexcept;\n\n\t\t// Multiboot contains valid bootloader name info\n\n\t\t[[nodiscard]]\n", "file_path": "include/multiboot.hpp", "rank": 60, "score": 34204.84975870608 }, { "content": "\t\t mReboot\t(reboot),\n\n\t\t mSuspend\t(suspend),\n\n\t\t mWakeup\t(wakeup) {}\n\n\n\n\n\n\t// Check if i386\n\n\t[[nodiscard]]\n\n\tconstexpr bool description_t::isI386() const noexcept {\n\n\t\treturn (PLATFORM_ARCH_NAME::I386 == PLATFORM_NAME);\n\n\t}\n\n\n\n\t// Check if x86_64\n\n\t[[nodiscard]]\n\n\tconstexpr bool description_t::isX86_64() const noexcept {\n\n\t\treturn (PLATFORM_ARCH_NAME::X86_64 == PLATFORM_NAME);\n\n\t}\n\n\n\n\t// Check if arm32\n\n\t[[nodiscard]]\n\n\tconstexpr bool description_t::isARM32() const noexcept {\n", "file_path": "include/platform.hpp", "rank": 61, "score": 34204.55820365381 }, { "content": "\t\tword_t\t\tvbeInterfaceLen;\t\t// Multiboot VBE interface length\n\n\n\n\t\tquad_t\t\tfbAddress;\t\t\t// Multiboot FB address\n\n\t\tdword_t\t\tfbPitch;\t\t\t// Multiboot FB pitch\n\n\t\tdword_t\t\tfbWidth;\t\t\t// Multiboot FB width\n\n\t\tdword_t\t\tfbHeight;\t\t\t// Multiboot FB height\n\n\t\tbyte_t\t\tfbBpp;\t\t\t\t// Multiboot FB bpp\n\n\t\tbyte_t\t\tfbType;\t\t\t\t// Multiboot FB type\n\n\t\tbyte_t\t\tfbColorInfo[6ULL];\t\t// Multiboot FB color info\n\n\n\n\n\n\t\t// Multiboot contains valid memory info\n\n\t\t[[nodiscard]]\n\n\t\tbool\thasInfoMemory() const noexcept;\n\n\t\t// Multiboot contains valid boot device info\n\n\t\t[[nodiscard]]\n\n\t\tbool\thasInfoBootDevice() const noexcept;\n\n\t\t// Multiboot contains valid kernel command line info\n\n\t\t[[nodiscard]]\n\n\t\tbool\thasInfoCommandLine() const noexcept;\n", "file_path": "include/multiboot.hpp", "rank": 62, "score": 34203.87608432263 }, { "content": "\tstruct infoSections final {\n\n\t\tdword_t\t\theader;\t\t\t\t// Kernel header section address\n\n\t\tdword_t\t\tloadStart;\t\t\t// Kernel load address start\n\n\t\tdword_t\t\tloadEnd;\t\t\t// Kernel load address end\n\n\t\tdword_t\t\tbssEnd;\t\t\t\t// Kernel BSS section end\n\n\t\tdword_t\t\tentry;\t\t\t\t// Kernel entry point\n\n\t};\n\n\n\n\t// Multiboot video info\n\n\tstruct infoVideo final {\n\n\t\tdword_t\t\tmode;\t\t\t\t// Video mode\n\n\t\tdword_t\t\twidth;\t\t\t\t// Video mode width\n\n\t\tdword_t\t\theight;\t\t\t\t// Video mode height\n\n\t\tdword_t\t\tdepth;\t\t\t\t// Video mode depth\n\n\t};\n\n\n\n\t// Multiboot 1 header\n\n\tstruct header_t final {\n\n\t\tdword_t\t\tmagic;\t\t\t\t// Multiboot header magic - must be equal to HEADER_MAGIC\n\n\t\tdword_t\t\tflags;\t\t\t\t// Multiboot header flag\n", "file_path": "include/multiboot.hpp", "rank": 63, "score": 34203.750164229656 }, { "content": "\t\tinit_t\t\t\tmInit;\t\t\t// Init function\n\n\t\tfinalize_t\t\tmFinalzie;\t\t// Finalize function\n\n\n\n\t\tshutdown_t\t\tmShutdown;\t\t// Shutdown function\n\n\t\treboot_t\t\tmReboot;\t\t// Reboot function\n\n\n\n\t\tsuspend_t\t\tmSuspend;\t\t// Suspend platform\n\n\t\twakeup_t\t\tmWakeup;\t\t// Wakeup platform\n\n\n\n\n\n\t\t// C-tor\n\n\t\tdescription_t() = delete;\n\n\n\n\n\n\tpublic:\n\n\n\n\t\t// C-tor #2\n\n\t\tconstexpr description_t(\n\n\t\t\tconst char* const\tname,\n\n\t\t\tconst init_t\t\tinit,\n", "file_path": "include/platform.hpp", "rank": 64, "score": 34200.44575520234 }, { "content": "\t\tword_t\t\tsegmentA;\n\n\t\tword_t\t\tsegmentB;\n\n\t\tdword_t\t\tfuncPtr;\n\n\t\tword_t\t\tpitch;\n\n\t\tword_t\t\twidth;\n\n\t\tword_t\t\theight;\n\n\t\tbyte_t\t\tcharW;\n\n\t\tbyte_t\t\tcharH;\n\n\t\tbyte_t\t\tplanes;\n\n\t\tbyte_t\t\tbpp;\n\n\t\tbyte_t\t\tbanks;\n\n\t\tbyte_t\t\tmemoryModel;\n\n\t\tbyte_t\t\tbankSize;\n\n\t\tbyte_t\t\timagePages;\n\n\t\tbyte_t\t\treserved0;\n\n\t\tbyte_t\t\tredMask;\n\n\t\tbyte_t\t\tredPosition;\n\n\t\tbyte_t\t\tgreenMask;\n\n\t\tbyte_t\t\tgreenPosition;\n\n\t\tbyte_t\t\tblueMask;\n", "file_path": "include/multiboot.hpp", "rank": 65, "score": 34200.44575520234 }, { "content": "\t\tword_t\t\tversion;\t\t// VBE version (e.g. 0x0300 = 3.0)\n\n\t\tdword_t\t\toem;\t\t\t// OEM string\n\n\t\tdword_t\t\tcaps;\t\t\t// VBE capabilities\n\n\t\tdword_t\t\tmodes;\t\t\t// VBE modes pointer\n\n\t\tword_t\t\tmemory;\t\t\t// VBE video memory size in 64 Kb. blocks\n\n\t\tword_t\t\trev;\t\t\t// VBE revision string\n\n\t\tdword_t\t\tvendor;\t\t\t// VBE vendor string\n\n\t\tdword_t\t\tproductName;\t\t// VBE product name string\n\n\t\tdword_t\t\tproductRev;\t\t// VBE product revision string\n\n\t\tbyte_t\t\treserved[222ULL];\t// VBE reserved\n\n\t\tbyte_t\t\toemData[256ULL];\t// VBE OEM data\n\n\t};\n\n\n\n\t// VBE mode\n\n\tstruct vbeMode final {\n\n\t\tword_t\t\tattributes;\n\n\t\tbyte_t\t\twindowA;\n\n\t\tbyte_t\t\twindowB;\n\n\t\tword_t\t\tgranularity;\n\n\t\tword_t\t\twindowSize;\n", "file_path": "include/multiboot.hpp", "rank": 66, "score": 34200.44575520234 }, { "content": "\n\n\t\tdword_t\t\tsyms[4ULL];\t\t\t// Multiboot kernel symbols\n\n\n\n\t\tdword_t\t\tmmapLength;\t\t\t// Multiboot memory map length\n\n\t\tdword_t\t\tmmapAddr;\t\t\t// Multiboot memory map start address\n\n\n\n\t\tdword_t\t\tdrivesLength;\t\t\t// Multiboot drives info length\n\n\t\tdword_t\t\tdrivesAddr;\t\t\t// Multiboot drives info start address\n\n\n\n\t\tdword_t\t\tconfigTable;\t\t\t// Multiboot config table\n\n\n\n\t\tdword_t\t\tbootloaderName;\t\t\t// Multiboot bootloader name\n\n\n\n\t\tdword_t\t\tapmTable;\t\t\t// Multiboot APM table\n\n\n\n\t\tdword_t\t\tvbeControlInfo;\t\t\t// Multiboot VBE control info\n\n\t\tdword_t\t\tvbeModeInfo;\t\t\t// Multiboot VBE mode info\n\n\t\tword_t\t\tvbeModeCurrent;\t\t\t// Multiboot VBE current mode\n\n\t\tword_t\t\tvbeInterfaceSeg;\t\t// Multiboot VBE interface segment\n\n\t\tword_t\t\tvbeInterfaceOffset;\t\t// Multiboot VBE interface offset\n", "file_path": "include/multiboot.hpp", "rank": 67, "score": 34200.44575520234 }, { "content": "\t\t// Default c-tor\n\n\t\ttPaging() noexcept = default;\n\n\n\n\t\t// Enable paging\n\n\t\tvoid\tenable() const noexcept;\n\n\t\t// Disable paging\n\n\t\tvoid\tdisable() const noexcept;\n\n\n\n\t\t// Translate virtual address to physical\n\n\t\t[[nodiscard]]\n\n\t\tphys_t\ttranslate(const virt_t addr) const noexcept;\n\n\n\n\t\t// Map virtual address to physical address\n\n\t\tvoid\tmap(const phys_t phys, const virt_t virt, const std::size_t count, const kflags<flags_t> flags) noexcept;\n\n\n\n\t\t// Get paging data\n\n\t\t[[nodiscard]]\n\n\t\tphys_t\tdirectory() const noexcept;\n\n\t\t// Flush paging data\n\n\t\tvoid\tflush(const phys_t addr) noexcept;\n", "file_path": "include/arch/paging.hpp", "rank": 68, "score": 32742.11612357188 }, { "content": "////////////////////////////////////////////////////////////////\n\n//\n\n//\tKernel text print functions\n\n//\n\n//\tFile:\tkprint.hpp\n\n//\tDate:\t01 Feb 2021\n\n//\n\n//\tCopyright (c) 2017 - 2021, Igor Baklykov\n\n//\tAll rights reserved.\n\n//\n\n//\n\n\n\n\n\n#pragma once\n\n\n\n\n\n#include <cstdint>\n\n#include <cstdarg>\n\n\n\n#include <arch/types.hpp>\n\n\n\n\n\n// Kernel library code zone\n\nnamespace igros::klib {\n\n\n\n\n\n\t// Integer representation types\n", "file_path": "include/klib/kprint.hpp", "rank": 69, "score": 32740.61881851038 }, { "content": "#include <arch/x86_64/types.hpp>\n\n#include <arch/x86_64/register.hpp>\n\n\n\n\n\n// OS namespace\n\nnamespace igros {\n\n\n\n\n\n#if\tdefined (IGROS_ARCH_i386)\n\n\t// Paging type\n\n\tusing register_t = i386::register_t;\n\n#elif\tdefined (IGROS_ARCH_x86_64)\n\n\t// Paging type\n\n\tusing register_t = x86_64::register_t;\n\n#else\n\n\t// Paging type\n\n\tusing register_t = void;\n\n\tstatic_assert(false, \"Unknown architecture!!!\");\n\n#endif\n\n\n\n\n\n}\t// namespace igros\n\n\n", "file_path": "include/arch/types.hpp", "rank": 70, "score": 32740.554205377754 }, { "content": "\t[[nodiscard]]\n\n\tudivmod_t\tkudivmod(quad_t dividend, dword_t divisor) noexcept;\n\n\t// Divide 64-bit integer by 32-bit integer\n\n\t// Returns 64-bit quotient and 64-bit reminder\n\n\t[[nodiscard]]\n\n\tdivmod_t\tkdivmod(squad_t dividend, sdword_t divisor) noexcept;\n\n\n\n\n\n}\t// namespace igros::klib\n\n\n", "file_path": "include/klib/kmath.hpp", "rank": 71, "score": 32740.0247154751 }, { "content": "\t[[nodiscard]]\n\n\ttPaging<T>::phys_t tPaging<T>::translate(const virt_t addr) const noexcept {\n\n\t\treturn T::translate(addr);\n\n\t}\n\n\n\n\n\n\t// Map virtual address to physical address\n\n\ttemplate<typename T>\n\n\tvoid tPaging<T>::map(const phys_t phys, const virt_t virt, const std::size_t count, const kflags<flags_t> flags) noexcept {\n\n\t\t// TODO\n\n\t}\n\n\n\n\n\n\t// Get paging data\n\n\ttemplate<typename T>\n\n\t[[nodiscard]]\n\n\ttPaging<T>::phys_t tPaging<T>::directory() const noexcept {\n\n\t\treturn nullptr;\n\n\t}\n\n\n", "file_path": "include/arch/paging.hpp", "rank": 72, "score": 32739.73363406089 }, { "content": "\t// Kernel size type to string function\n\n\tsbyte_t* kstoa(sbyte_t* buffer, const std::size_t size, const std::size_t value, const radix_t radix = radix_t::DEC) noexcept;\n\n\n\n\t// Kernel pointer to string function\n\n\tinline sbyte_t* kptoa(sbyte_t* buffer, const std::size_t size, const pointer_t value) noexcept {\n\n\t\treturn kstoa(buffer, size, reinterpret_cast<std::size_t>(value), radix_t::HEX);\n\n\t}\n\n\n\n\n\n\t// Kernel vsnprintf function\n\n\tvoid kvsnprintf(sbyte_t* buffer, const std::size_t size, const sbyte_t* format, va_list list) noexcept;\n\n\n\n\t// Kernel snprintf function\n\n\tvoid ksnprintf(sbyte_t* buffer, const std::size_t size, const sbyte_t* format, ...) noexcept;\n\n\t// Kernel sprintf function\n\n\tvoid ksprintf(sbyte_t* buffer, const sbyte_t* format, ...) noexcept;\n\n\n\n\t// Kernel printf function\n\n\tvoid kprintf(const sbyte_t* format, ...) noexcept;\n\n\n\n\n\n}\t// namespace igros::klib\n\n\n", "file_path": "include/klib/kprint.hpp", "rank": 73, "score": 32739.471724217787 }, { "content": "\ttemplate<typename T, typename T2>\n\n\t[[maybe_unused]]\n\n\tinline dword_t* io_t<T, T2>::readPort32Rep(const port_t addr, const dword_t* base, const std::size_t count) const noexcept {\n\n\t\t// Read count of double words to base buffer\n\n\t\tfor (auto i = 0ULL; i < count; i++) {\n\n\t\t\tbase[i] = readPort32(addr);\n\n\t\t}\n\n\t\t// Return pointer to base buffer\n\n\t\treturn const_cast<dword_t* const>(base);\n\n\t}\n\n\n\n\n\n\t// Write byte to port\n\n\ttemplate<typename T, typename T2>\n\n\tinline void io_t<T, T2>::writePort8(const port_t addr, const byte_t value) const noexcept {\n\n\t\tT::writePort8(addr, value);\n\n\t}\n\n\n\n\t// Write word to port\n\n\ttemplate<typename T, typename T2>\n", "file_path": "include/arch/io.hpp", "rank": 74, "score": 32739.169990671602 }, { "content": "\t\t// Write count of bytes to I/O memory\n\n\t\tfor (auto i = 0ULL; i < count; i++) {\n\n\t\t\twriteMemory8(addr, value[i]);\n\n\t\t}\n\n\t}\n\n\n\n\t// Write word to I/O memory\n\n\ttemplate<typename T, typename T2>\n\n\tinline void io_t<T, T2>::writeMemory16Rep(word_t* const addr, const word_t* const value, const std::size_t count) const noexcept {\n\n\t\t// Write count of words to I/O memory\n\n\t\tfor (auto i = 0ULL; i < count; i++) {\n\n\t\t\twriteMemory16(addr, value[i]);\n\n\t\t}\n\n\t}\n\n\n\n\t// Write double word to I/O memory\n\n\ttemplate<typename T, typename T2>\n\n\tinline void io_t<T, T2>::writeMemory32Rep(dword_t* const addr, const dword_t* const value, const std::size_t count) const noexcept {\n\n\t\t// Write count of double words to I/O memory\n\n\t\tfor (auto i = 0ULL; i < count; i++) {\n", "file_path": "include/arch/io.hpp", "rank": 75, "score": 32739.123080446192 }, { "content": "\n\n#include <arch/types.hpp>\n\n\n\n#include <klib/kalign.hpp>\n\n\n\n\n\n// Kernel library code zone\n\nnamespace igros::klib {\n\n\n\n\n\n\t// Set required memory with specified byte\n\n\t[[maybe_unused]]\n\n\tpointer_t\tkmemset8(byte_t* const dst, const std::size_t size, const byte_t val) noexcept;\n\n\n\n\t// Set required memory with specified word\n\n\t[[maybe_unused]]\n\n\tpointer_t\tkmemset16(word_t* const dst, const std::size_t size, const word_t val) noexcept;\n\n\n\n\t// Set required memory with specified double word\n\n\t[[maybe_unused]]\n", "file_path": "include/klib/kmemory.hpp", "rank": 76, "score": 32739.014264175083 }, { "content": "\t\t// Default c-tor\n\n\t\tinterrupts_t() noexcept = default;\n\n\n\n\t\t// Enable interrupts\n\n\t\tvoid enable() const noexcept;\n\n\t\t// Disable interrupts\n\n\t\tvoid disable() const noexcept;\n\n\n\n\t\t// Mask interrupt\n\n\t\tvoid mask(const irq_t number) const noexcept;\n\n\t\t// Unmask interrupt\n\n\t\tvoid unmask(const irq_t number) const noexcept;\n\n\n\n\t\t// Set interrupts mask\n\n\t\tvoid\tsetMask(const word_t mask = 0xFFFF) const noexcept;\n\n\t\t// Get interrupts mask\n\n\t\t[[nodiscard]]\n\n\t\tword_t\tgetMask() const noexcept;\n\n\n\n\t\t// Install IRQ handler\n", "file_path": "include/arch/irq.hpp", "rank": 77, "score": 32738.9133999374 }, { "content": "\tinline void io_t<T, T2>::writePort16(const port_t addr, const word_t value) const noexcept {\n\n\t\tT::writePort16(addr, value);\n\n\t}\n\n\n\n\t// Write double word to port\n\n\ttemplate<typename T, typename T2>\n\n\tinline void io_t<T, T2>::writePort32(const port_t addr, const dword_t value) const noexcept {\n\n\t\tT::writePort32(addr, value);\n\n\t}\n\n\n\n\n\n\t// Write count bytes to port\n\n\ttemplate<typename T, typename T2>\n\n\tinline void io_t<T, T2>::writePort8Rep(const port_t addr, byte_t* const value, const std::size_t count) const noexcept {\n\n\t\t// Write count of bytes to port\n\n\t\tfor (auto i = 0ULL; i < count; i++) {\n\n\t\t\twritePort8(addr, value[i]);\n\n\t\t}\n\n\t}\n\n\n", "file_path": "include/arch/io.hpp", "rank": 78, "score": 32738.853891497176 }, { "content": "\t// Write count words to port\n\n\ttemplate<typename T, typename T2>\n\n\tinline void io_t<T, T2>::writePort16Rep(const port_t addr, word_t* const value, const std::size_t count) const noexcept {\n\n\t\t// Write count of words to port\n\n\t\tfor (auto i = 0ULL; i < count; i++) {\n\n\t\t\twritePort16(addr, value[i]);\n\n\t\t}\n\n\t}\n\n\n\n\t// Write count double words to port\n\n\ttemplate<typename T, typename T2>\n\n\tinline void io_t<T, T2>::writePort32Rep(const port_t addr, dword_t* const value, const std::size_t count) const noexcept {\n\n\t\t// Write count of double words to port\n\n\t\tfor (auto i = 0ULL; i < count; i++) {\n\n\t\t\twritePort32(addr, value[i]);\n\n\t\t}\n\n\t}\n\n\n\n\n\n\t// Read byte from I/O memory\n", "file_path": "include/arch/io.hpp", "rank": 79, "score": 32738.79572632086 }, { "content": "\t\tfor (auto i = 0ULL; i < count; i++) {\n\n\t\t\tbase[i] = readPort8(addr);\n\n\t\t}\n\n\t\t// Return pointer to base buffer\n\n\t\treturn const_cast<byte_t* const>(base);\n\n\t}\n\n\n\n\t// Read count words from port\n\n\ttemplate<typename T, typename T2>\n\n\t[[maybe_unused]]\n\n\tinline word_t* io_t<T, T2>::readPort16Rep(const port_t addr, const word_t* base, const std::size_t count) const noexcept {\n\n\t\t// Read count of words to base buffer\n\n\t\tfor (auto i = 0ULL; i < count; i++) {\n\n\t\t\tbase[i] = readPort16(addr);\n\n\t\t}\n\n\t\t// Return pointer to base buffer\n\n\t\treturn const_cast<word_t* const>(base);\n\n\t}\n\n\n\n\t// Read count double words from port\n", "file_path": "include/arch/io.hpp", "rank": 80, "score": 32738.68131565502 }, { "content": "\t\tvoid install(const irq_t number, const isr_t handler) const noexcept;\n\n\t\t// Uninstall IRQ handler\n\n\t\tvoid uninstall(const irq_t number) const noexcept;\n\n\n\n\t\t// IRQ done (EOI)\n\n\t\tvoid eoi(const irq_t number) const noexcept;\n\n\n\n\n\n\t};\n\n\n\n\n\n\t// Enable interrupts\n\n\ttemplate<typename T, typename T2>\n\n\tinline void interrupts_t<T, T2>::enable() const noexcept {\n\n\t\tT::enable();\n\n\t}\n\n\n\n\t// Disable interrupts\n\n\ttemplate<typename T, typename T2>\n\n\tinline void interrupts_t<T, T2>::disable() const noexcept {\n", "file_path": "include/arch/irq.hpp", "rank": 81, "score": 32738.565975704347 }, { "content": "#include <singleton.hpp>\n\n\n\n// i386\n\n#include <arch/i386/io.hpp>\n\n// x86_64\n\n#include <arch/x86_64/io.hpp>\n\n\n\n\n\n// Arch namespace\n\nnamespace igros::arch {\n\n\n\n\n\n\t// I/O description type\n\n\ttemplate<typename T, typename T2>\n", "file_path": "include/arch/io.hpp", "rank": 82, "score": 32738.518400023382 }, { "content": "#include <arch/register.hpp>\n\n\n\n// i386\n\n#include <arch/i386/irq.hpp>\n\n// x86_64\n\n#include <arch/x86_64/irq.hpp>\n\n\n\n\n\n// Arch namespace\n\nnamespace igros::arch {\n\n\n\n\n\n\t// Interrupts description type\n\n\ttemplate<typename T, typename T2>\n", "file_path": "include/arch/irq.hpp", "rank": 83, "score": 32738.467369332266 }, { "content": "#include <arch/i386/paging.hpp>\n\n// x86_64\n\n#include <arch/x86_64/paging.hpp>\n\n\n\n\n\n// Arch namespace\n\nnamespace igros::arch {\n\n\n\n\n\n\t// Paging description type\n\n\ttemplate<typename T>\n", "file_path": "include/arch/paging.hpp", "rank": 84, "score": 32738.41536169374 }, { "content": "#include <arch/i386/cpu.hpp>\n\n// x86_64\n\n#include <arch/x86_64/cpu.hpp>\n\n\n\n\n\n// Arch namespace\n\nnamespace igros::arch {\n\n\n\n\n\n\t// CPU description type\n\n\ttemplate<typename T>\n", "file_path": "include/arch/cpu.hpp", "rank": 85, "score": 32738.41536169374 }, { "content": "\t// Flush paging data\n\n\ttemplate<typename T>\n\n\tvoid tPaging<T>::flush(const phys_t addr) noexcept {\n\n\t\tT::setDirectory(addr);\n\n\t}\n\n\n\n\n\n#if\tdefined (IGROS_ARCH_i386)\n\n\t// Paging type\n\n\tusing paging = tPaging<i386::paging>;\n\n#elif\tdefined (IGROS_ARCH_x86_64)\n\n\t// Paging type\n\n\tusing paging = tPaging<x86_64::paging>;\n\n#else\n\n\t// Paging type\n\n\tusing paging = tPaging<void>;\n\n\tstatic_assert(false, \"Unknown architecture!!!\");\n\n#endif\n\n\n\n\n\n}\t// namespace igros::arch\n\n\n", "file_path": "include/arch/paging.hpp", "rank": 86, "score": 32738.219997281372 }, { "content": "////////////////////////////////////////////////////////////////\n\n//\n\n//\tKernel-space memset for x86\n\n//\n\n//\tFile:\tkmemset.hpp\n\n//\tDate:\t31 Jan 2021\n\n//\n\n//\tCopyright (c) 2017 - 2021, Igor Baklykov\n\n//\tAll rights reserved.\n\n//\n\n//\n\n\n\n\n\n#pragma once\n\n\n\n\n\n#include <cstdint>\n\n#include <array>\n\n#include <algorithm>\n\n#include <type_traits>\n", "file_path": "include/klib/kmemory.hpp", "rank": 87, "score": 32738.15391311038 }, { "content": "\t\tT::uninstall(number);\n\n\t}\n\n\n\n\n\n\t// IRQ done (EOI)\n\n\ttemplate<typename T, typename T2>\n\n\tinline void interrupts_t<T, T2>::eoi(const irq_t number) const noexcept {\n\n\t\tT::eoi(number);\n\n\t}\n\n\n\n\n\n#if\tdefined (IGROS_ARCH_i386)\n\n\t// IRQ type\n\n\tusing irq\t= interrupts_t<i386::irq, i386::irq_t>;\n\n#elif\tdefined (IGROS_ARCH_x86_64)\n\n\t// IRQ type\n\n\tusing irq\t= interrupts_t<x86_64::irq, x86_64::irq_t>;\n\n#else\n\n\t// IRQ type\n\n\tusing irq\t= interrupts_t<void, void>;\n\n\tstatic_assert(false, \"Unknown architecture!!!\");\n\n#endif\n\n\n\n\n\n}\t// namespace igros::arch\n\n\n", "file_path": "include/arch/irq.hpp", "rank": 88, "score": 32738.1320865257 }, { "content": "\n\n\t\t// Write byte to port\n\n\t\tvoid\twritePort8(const port_t addr, const byte_t value) const noexcept;\n\n\t\t// Write word to port\n\n\t\tvoid\twritePort16(const port_t addr, const word_t value) const noexcept;\n\n\t\t// Write double word to port\n\n\t\tvoid\twritePort32(const port_t addr, const dword_t value) const noexcept;\n\n\n\n\t\t// Write count bytes to port\n\n\t\tvoid\twritePort8Rep(const port_t addr, byte_t* const value, const std::size_t count) const noexcept;\n\n\t\t// Write count words to port\n\n\t\tvoid\twritePort16Rep(const port_t addr, word_t* const value, const std::size_t count) const noexcept;\n\n\t\t// Write count double words to port\n\n\t\tvoid\twritePort32Rep(const port_t addr, dword_t* const value, const std::size_t count) const noexcept;\n\n\n\n\t\t// Read byte from I/O memory\n\n\t\t[[nodiscard]]\n\n\t\tbyte_t\treadMemory8(const byte_t* const addr) const noexcept;\n\n\t\t// Read word from I/O memory\n\n\t\t[[nodiscard]]\n", "file_path": "include/arch/io.hpp", "rank": 89, "score": 32738.062079393727 }, { "content": "////////////////////////////////////////////////////////////////\n\n//\n\n//\tDevice operations description\n\n//\n\n//\tFile:\tdevice.hpp\n\n//\tDate:\t30 Jun 2020\n\n//\n\n//\tCopyright (c) 2017 - 2021, Igor Baklykov\n\n//\tAll rights reserved.\n\n//\n\n//\n\n\n\n\n\n#pragma once\n\n\n\n\n\n#include <type_traits>\n\n#include <cstdint>\n\n\n\n#include <arch/types.hpp>\n", "file_path": "include/dev/device.hpp", "rank": 90, "score": 32738.029835916634 }, { "content": "\n\n// Kernel library code zone\n\nnamespace igros::klib {\n\n\n\n\n\n\t// Align mask\n\n\t[[nodiscard]]\n\n\tconstexpr std::size_t kalignMask(const std::size_t offset) noexcept {\n\n\t\treturn ((1ULL << offset) - 1ULL);\n\n\t}\n\n\n\n\t// Align up\n\n\ttemplate<typename T>\n\n\t[[nodiscard]]\n\n\tconstexpr T* kalignUp(const T* ptr, const std::size_t offset = alignof(T)) noexcept {\n\n\t\t// Address addition\n\n\t\tconst auto addition = kalignMask(offset);\n\n\t\t// Do alignment\n\n\t\treturn reinterpret_cast<T*>((reinterpret_cast<std::size_t>(ptr) + addition) & ~addition);\n\n\t}\n", "file_path": "include/klib/kalign.hpp", "rank": 91, "score": 32737.938163186187 }, { "content": "\n\n\t\t// Dump CPU registers\n\n\t\tvoid\tdumpRegisters(const register_t* const regs) const noexcept;\n\n\n\n\n\n\t};\n\n\n\n\n\n\t// Halt CPU\n\n\ttemplate<typename T>\n\n\tinline void cpu_t<T>::halt() const noexcept {\n\n\t\tT::halt();\n\n\t}\n\n\n\n\n\n\t// Dump CPU registers\n\n\ttemplate<typename T>\n\n\tinline void cpu_t<T>::dumpRegisters(const register_t* const regs) const noexcept {\n\n\t\tT::dumpRegisters(regs);\n\n\t}\n", "file_path": "include/arch/cpu.hpp", "rank": 92, "score": 32737.915620355885 }, { "content": "////////////////////////////////////////////////////////////////\n\n//\n\n//\tELF header info\n\n//\n\n//\tFile:\telf.hpp\n\n//\tDate:\t30 Jun 2020\n\n//\n\n//\tCopyright (c) 2017 - 2021, Igor Baklykov\n\n//\tAll rights reserved.\n\n//\n\n//\n\n\n\n\n\n#pragma once\n\n\n\n\n\n#include <cstdint>\n\n\n\n#include <arch/types.hpp>\n\n\n", "file_path": "include/sys/elf.hpp", "rank": 93, "score": 32737.751555630584 }, { "content": "////////////////////////////////////////////////////////////////\n\n//\n\n//\tKernel string functions\n\n//\n\n//\tFile:\tkstring.hpp\n\n//\tDate:\t15 Jan 2021\n\n//\n\n//\tCopyright (c) 2017 - 2021, Igor Baklykov\n\n//\tAll rights reserved.\n\n//\n\n//\n\n\n\n\n\n#pragma once\n\n\n\n\n\n#include <cstdint>\n\n\n\n#include <arch/types.hpp>\n\n\n", "file_path": "include/klib/kstring.hpp", "rank": 94, "score": 32737.751555630584 }, { "content": "////////////////////////////////////////////////////////////////\n\n//\n\n//\tMemory map operations\n\n//\n\n//\tFile:\tmmap.hpp\n\n//\tDate:\t17 Jul 2020\n\n//\n\n//\tCopyright (c) 2017 - 2021, Igor Baklykov\n\n//\tAll rights reserved.\n\n//\n\n//\n\n\n\n\n\n#pragma once\n\n\n\n\n\n#include <cstdint>\n\n\n\n#include <multiboot.hpp>\n\n\n", "file_path": "include/mem/mmap.hpp", "rank": 95, "score": 32737.751555630584 }, { "content": "////////////////////////////////////////////////////////////////\n\n//\n\n//\tKernel alignment functions definitions\n\n//\n\n//\tFile:\tkalign.hpp\n\n//\tDate:\t12 Feb 2021\n\n//\n\n//\tCopyright (c) 2017 - 2021, Igor Baklykov\n\n//\tAll rights reserved.\n\n//\n\n//\n\n\n\n\n\n#pragma once\n\n\n\n\n\n#include <cstdint>\n\n\n\n#include <arch/types.hpp>\n\n\n", "file_path": "include/klib/kalign.hpp", "rank": 96, "score": 32737.678984541162 }, { "content": "////////////////////////////////////////////////////////////////\n\n//\n\n//\tInit RAM image data\n\n//\n\n//\tFile:\tinit.hpp\n\n//\tDate:\t30 Jun 2020\n\n//\n\n//\tCopyright (c) 2017 - 2021, Igor Baklykov\n\n//\tAll rights reserved.\n\n//\n\n//\n\n\n\n\n\n#pragma once\n\n\n\n\n\n#include <cstdint>\n\n\n\n#include <arch/types.hpp>\n\n\n", "file_path": "include/sys/init.hpp", "rank": 97, "score": 32737.678984541162 }, { "content": "////////////////////////////////////////////////////////////////\n\n//\n\n//\tKernel math functions definitions\n\n//\n\n//\tFile:\tkmath.hpp\n\n//\tDate:\t15 Jan 2021\n\n//\n\n//\tCopyright (c) 2017 - 2021, Igor Baklykov\n\n//\tAll rights reserved.\n\n//\n\n//\n\n\n\n\n\n#pragma once\n\n\n\n\n\n#include <cstdint>\n\n\n\n#include <arch/types.hpp>\n\n\n", "file_path": "include/klib/kmath.hpp", "rank": 98, "score": 32737.678984541162 }, { "content": "\t\t}\n\n\t\t// Return pointer to base buffer\n\n\t\treturn const_cast<word_t* const>(base);\n\n\t}\n\n\n\n\t// Read count double words from I/O memory\n\n\ttemplate<typename T, typename T2>\n\n\t[[maybe_unused]]\n\n\tinline dword_t* io_t<T, T2>::readMemory32Rep(const dword_t* const addr, const dword_t* const base, const std::size_t count) const noexcept {\n\n\t\t// Read count of double words to base buffer\n\n\t\tfor (auto i = 0ULL; i < count; i++) {\n\n\t\t\tbase[i] = readMemory32(addr);\n\n\t\t}\n\n\t\t// Return pointer to base buffer\n\n\t\treturn const_cast<dword_t* const>(base);\n\n\t}\n\n\n\n\n\n\t// Write byte to I/O memory\n\n\ttemplate<typename T, typename T2>\n", "file_path": "include/arch/io.hpp", "rank": 99, "score": 32737.65032403343 } ]
C++
Source/PsData/Private/Types/PsData_FPsDataBigInteger.cpp
Antonrr/PsData
ccf501aef6821a73b2cee7fb11e42e3f7fff303c
#include "Types/PsData_FPsDataBigInteger.h" #define ZERO_DIVIDE_PROTECTION(Dividend, Divisor) \ if (Divisor == 0) \ { \ FFrame::KismetExecutionMessage(*FString::Printf(TEXT("Divide by zero detected: %s / 0\n%s"), *Dividend.ToString(), *FFrame::GetScriptCallstack()), ELogVerbosity::Warning); \ return 0; \ } FPsDataBigInteger UPsDataBigIntegerLibrary::MakeLiteralBigInteger(int64 Value) { return {Value}; } FPsDataBigInteger UPsDataBigIntegerLibrary::MakeLiteralBigIntegerFromInt(int32 Value) { return {Value}; } FPsDataBigInteger UPsDataBigIntegerLibrary::MakeLiteralBigIntegerFromString(FString Value, EPsDataBigIntegerConvertionType ConvertionType) { return FPsDataBigInteger::FromString(Value, ConvertionType); } FPsDataBigInteger UPsDataBigIntegerLibrary::Multiply(FPsDataBigInteger A, FPsDataBigInteger B) { return A * B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Divide(FPsDataBigInteger A, FPsDataBigInteger B) { ZERO_DIVIDE_PROTECTION(A, B); return A / B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Add(FPsDataBigInteger A, FPsDataBigInteger B) { return A + B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Subtract(FPsDataBigInteger A, FPsDataBigInteger B) { return A - B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Modulo(FPsDataBigInteger A, FPsDataBigInteger B) { ZERO_DIVIDE_PROTECTION(A, B); return A % B; } bool UPsDataBigIntegerLibrary::Less(FPsDataBigInteger A, FPsDataBigInteger B) { return A < B; } bool UPsDataBigIntegerLibrary::Greater(FPsDataBigInteger A, FPsDataBigInteger B) { return A > B; } bool UPsDataBigIntegerLibrary::LessEqual(FPsDataBigInteger A, FPsDataBigInteger B) { return A <= B; } bool UPsDataBigIntegerLibrary::GreaterEqual(FPsDataBigInteger A, FPsDataBigInteger B) { return A >= B; } bool UPsDataBigIntegerLibrary::Equal(FPsDataBigInteger A, FPsDataBigInteger B) { return A == B; } bool UPsDataBigIntegerLibrary::NotEqual(FPsDataBigInteger A, FPsDataBigInteger B) { return A != B; } FPsDataBigInteger UPsDataBigIntegerLibrary::And(FPsDataBigInteger A, FPsDataBigInteger B) { return A & B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Xor(FPsDataBigInteger A, FPsDataBigInteger B) { return A ^ B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Or(FPsDataBigInteger A, FPsDataBigInteger B) { return A | B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Not(FPsDataBigInteger A) { return ~A; } FPsDataBigInteger UPsDataBigIntegerLibrary::Sign(FPsDataBigInteger A) { if (A.IsZero()) { return FPsDataBigInteger::Zero; } return A.GetSign(); } FPsDataBigInteger UPsDataBigIntegerLibrary::Min(FPsDataBigInteger A, FPsDataBigInteger B) { if (A < B) { return A; } return B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Max(FPsDataBigInteger A, FPsDataBigInteger B) { if (A > B) { return A; } return B; } bool UPsDataBigIntegerLibrary::InRange(FPsDataBigInteger Value, FPsDataBigInteger Min, FPsDataBigInteger Max, bool InclusiveMin, bool InclusiveMax) { const auto CompMin = FPsDataBigInteger::Compare(Min, Value); const auto CompMax = FPsDataBigInteger::Compare(Value, Max); if (CompMin < 0 && CompMax > 0) { return true; } if (InclusiveMin && CompMin == 0) { return true; } if (InclusiveMax && CompMax == 0) { return true; } return false; } FPsDataBigInteger UPsDataBigIntegerLibrary::Clamp(FPsDataBigInteger Value, FPsDataBigInteger Min, FPsDataBigInteger Max) { if (Min > Value) { return Min; } if (Max < Value) { return Max; } return Value; } FPsDataBigInteger UPsDataBigIntegerLibrary::Abs(FPsDataBigInteger A) { A.Abs(); return A; } bool UPsDataBigIntegerLibrary::Bit(FPsDataBigInteger A, int32 BitIndex) { return A.GetBit(BitIndex); } FPsDataShortBigInteger UPsDataBigIntegerLibrary::ToShortBigInteger(const FPsDataBigInteger& InBigInteger) { return InBigInteger.ToShortBigInteger(18); } int32 UPsDataBigIntegerLibrary::ToInt(const FPsDataBigInteger& InBigInteger) { return InBigInteger.ToInt32(); } int32 UPsDataBigIntegerLibrary::ToInt64(const FPsDataBigInteger& InBigInteger) { return InBigInteger.ToInt64(); } FPsDataBigInteger UPsDataBigIntegerLibrary::Int32ToBigInteger(const int32& InInt) { return {InInt}; } FPsDataBigInteger UPsDataBigIntegerLibrary::Int64ToBigInteger(const int64& InInt) { return {InInt}; } FString UPsDataBigIntegerLibrary::ToString(const FPsDataBigInteger& InBigInteger) { return InBigInteger.ToString(); } FPsDataBigInteger UPsDataBigIntegerLibrary::StringToBigInteger(const FString& InString) { return FPsDataBigInteger::FromString(InString); } FPsDataBigInteger UPsDataBigIntegerLibrary::Multiply_Int32(FPsDataBigInteger A, int32 B) { return A * B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Divide_Int32(FPsDataBigInteger A, int32 B) { ZERO_DIVIDE_PROTECTION(A, B); return A / B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Add_Int32(FPsDataBigInteger A, int32 B) { return A + B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Subtract_Int32(FPsDataBigInteger A, int32 B) { return A - B; } int32 UPsDataBigIntegerLibrary::Modulo_Int32(FPsDataBigInteger A, int32 B) { ZERO_DIVIDE_PROTECTION(A, B); return (A % B).ToInt32(); } bool UPsDataBigIntegerLibrary::Less_Int32(FPsDataBigInteger A, int32 B) { return A < B; } bool UPsDataBigIntegerLibrary::Greater_Int32(FPsDataBigInteger A, int32 B) { return A > B; } bool UPsDataBigIntegerLibrary::LessEqual_Int32(FPsDataBigInteger A, int32 B) { return A <= B; } bool UPsDataBigIntegerLibrary::GreaterEqual_Int32(FPsDataBigInteger A, int32 B) { return A >= B; } bool UPsDataBigIntegerLibrary::Equal_Int32(FPsDataBigInteger A, int32 B) { return A == B; } bool UPsDataBigIntegerLibrary::NotEqual_Int32(FPsDataBigInteger A, int32 B) { return A != B; } FPsDataBigInteger UPsDataBigIntegerLibrary::And_Int32(FPsDataBigInteger A, int32 B) { return A & B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Xor_Int32(FPsDataBigInteger A, int32 B) { return A ^ B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Or_Int32(FPsDataBigInteger A, int32 B) { return A | B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Multiply_Int64(FPsDataBigInteger A, int64 B) { return A * B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Divide_Int64(FPsDataBigInteger A, int64 B) { ZERO_DIVIDE_PROTECTION(A, B); return A / B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Add_Int64(FPsDataBigInteger A, int64 B) { return A + B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Subtract_Int64(FPsDataBigInteger A, int64 B) { return A - B; } int64 UPsDataBigIntegerLibrary::Modulo_Int64(FPsDataBigInteger A, int64 B) { ZERO_DIVIDE_PROTECTION(A, B); return (A % B).ToInt64(); } bool UPsDataBigIntegerLibrary::Less_Int64(FPsDataBigInteger A, int64 B) { return A < B; } bool UPsDataBigIntegerLibrary::Greater_Int64(FPsDataBigInteger A, int64 B) { return A > B; } bool UPsDataBigIntegerLibrary::LessEqual_Int64(FPsDataBigInteger A, int64 B) { return A <= B; } bool UPsDataBigIntegerLibrary::GreaterEqual_Int64(FPsDataBigInteger A, int64 B) { return A >= B; } bool UPsDataBigIntegerLibrary::Equal_Int64(FPsDataBigInteger A, int64 B) { return A == B; } bool UPsDataBigIntegerLibrary::NotEqual_Int64(FPsDataBigInteger A, int64 B) { return A != B; } FPsDataBigInteger UPsDataBigIntegerLibrary::And_Int64(FPsDataBigInteger A, int64 B) { return A & B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Xor_Int64(FPsDataBigInteger A, int64 B) { return A ^ B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Or_Int64(FPsDataBigInteger A, int64 B) { return A | B; } DEFINE_FUNCTION(UPsDataBigIntegerLibrary::execSetMapProperty) { P_GET_OBJECT(UPsData, Target); P_GET_PROPERTY(FIntProperty, Index); P_GET_TMAP_REF(FString, FPsDataBigInteger, Value); P_FINISH; P_NATIVE_BEGIN; PsDataTools::UnsafeSetByIndex<TMap<FString, FPsDataBigInteger>>(Target, Index, Value); P_NATIVE_END; } DEFINE_FUNCTION(UPsDataBigIntegerLibrary::execGetMapProperty) { P_GET_OBJECT(UPsData, Target); P_GET_PROPERTY(FIntProperty, Index); P_GET_TMAP_REF(FString, FPsDataBigInteger, Out); P_FINISH; P_NATIVE_BEGIN; TMap<FString, FPsDataBigInteger>* Result = nullptr; PsDataTools::UnsafeGetByIndex(Target, Index, Result); Out = *Result; P_NATIVE_END; } DEFINE_FUNCTION(UPsDataBigIntegerLibrary::execSetArrayProperty) { P_GET_OBJECT(UPsData, Target); P_GET_PROPERTY(FIntProperty, Index); P_GET_TARRAY_REF(FPsDataBigInteger, Value); P_FINISH; P_NATIVE_BEGIN; PsDataTools::UnsafeSetByIndex<TArray<FPsDataBigInteger>>(Target, Index, Value); P_NATIVE_END; } DEFINE_FUNCTION(UPsDataBigIntegerLibrary::execGetArrayProperty) { P_GET_OBJECT(UPsData, Target); P_GET_PROPERTY(FIntProperty, Index); P_GET_TARRAY_REF(FPsDataBigInteger, Out); P_FINISH; P_NATIVE_BEGIN; TArray<FPsDataBigInteger>* Result = nullptr; PsDataTools::UnsafeGetByIndex(Target, Index, Result); Out = *Result; P_NATIVE_END; } DEFINE_FUNCTION(UPsDataBigIntegerLibrary::execSetProperty) { P_GET_OBJECT(UPsData, Target); P_GET_PROPERTY(FIntProperty, Index); P_GET_STRUCT_REF(FPsDataBigInteger, Value); P_FINISH; P_NATIVE_BEGIN; PsDataTools::UnsafeSetByIndex<FPsDataBigInteger>(Target, Index, Value); P_NATIVE_END; } DEFINE_FUNCTION(UPsDataBigIntegerLibrary::execGetProperty) { P_GET_OBJECT(UPsData, Target); P_GET_PROPERTY(FIntProperty, Index); P_GET_STRUCT_REF(FPsDataBigInteger, Out); P_FINISH; P_NATIVE_BEGIN; FPsDataBigInteger* Result = nullptr; PsDataTools::UnsafeGetByIndex(Target, Index, Result); Out = *Result; P_NATIVE_END; } void UPsDataBigIntegerLibrary::TypeSerialize(const UPsData* const Instance, const TSharedPtr<const FDataField>& Field, FPsDataSerializer* Serializer, const FPsDataBigInteger& Value) { Serializer->WriteValue(Value.ToString()); } FPsDataBigInteger UPsDataBigIntegerLibrary::TypeDeserialize(const UPsData* const Instance, const TSharedPtr<const FDataField>& Field, FPsDataDeserializer* Deserializer, const FPsDataBigInteger& Value) { FString StringValue; if (Deserializer->ReadValue(StringValue)) { auto a = FPsDataBigInteger(StringValue); return a; } int64 Int64Value = 0; if (Deserializer->ReadValue(Int64Value)) { return Int64Value; } int32 Int32Value = 0; if (Deserializer->ReadValue(Int32Value)) { return Int32Value; } UE_LOG(LogData, Warning, TEXT("Can't deserialize \"%s::%s\" as \"%s\""), *Instance->GetClass()->GetName(), *Field->Name, *PsDataTools::FType<FPsDataBigInteger>::Type()); return Value; }
#include "Types/PsData_FPsDataBigInteger.h" #define ZERO_DIVIDE_PROTECTION(Dividend, Divisor) \ if (Divisor == 0) \ { \ FFrame::KismetExecutionMessage(*FString::Printf(TEXT("Divide by zero detected: %s / 0\n%s"), *Dividend.ToString(), *FFrame::GetScriptCallstack()), ELogVerbosity::Warning); \ return 0; \ } FPsDataBigInteger UPsDataBigIntegerLibrary::MakeLiteralBigInteger(int64 Value) { return {Value}; } FPsDataBigInteger UPsDataBigIntegerLibrary::MakeLiteralBigIntegerFromInt(int32 Value) { return {Value}; } FPsDataBigInteger UPsDataBigIntegerLibrary::MakeLiteralBigIntegerFromString(FString Value, EPsDataBigIntegerConvertionType ConvertionType) { return FPsDataBigInteger::FromString(Value, ConvertionType); } FPsDataBigInteger UPsDataBigIntegerLibrary::Multiply(FPsDataBigInteger A, FPsDataBigInteger B) { return A * B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Divide(FPsDataBigInteger A, FPsDataBigInteger B) { ZERO_DIVIDE_PROTECTION(A, B); return A / B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Add(FPsDataBigInteger A, FPsDataBigInteger B) { return A + B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Subtract(FPsDataBigInteger A, FPsDataBigInteger B) { return A - B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Modulo(FPsDataBigInteger A, FPsDataBigInteger B) { ZERO_DIVIDE_PROTECTION(A, B); return A % B; } bool UPsDataBigIntegerLibrary::Less(FPsDataBigInteger A, FPsDataBigInteger B) { return A < B; } bool UPsDataBigIntegerLibrary::Greater(FPsDataBigInteger A, FPsDataBigInteger B) { return A > B; } bool UPsDataBigIntegerLibrary::LessEqual(FPsDataBigInteger A, FPsDataBigInteger B) { return A <= B; } bool UPsDataBigIntegerLibrary::GreaterEqual(FPsDataBigInteger A, FPsDataBigInteger B) { return A >= B; } bool UPsDataBigIntegerLibrary::Equal(FPsDataBigInteger A, FPsDataBigInteger B) { return A == B; } bool UPsDataBigIntegerLibrary::NotEqual(FPsDataBigInteger A, FPsDataBigInteger B) { return A != B; } FPsDataBigInteger UPsDataBigIntegerLibrary::And(FPsDataBigInteger A, FPsDataBigInteger B) { return A & B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Xor(FPsDataBigInteger A, FPsDataBigInteger B) { return A ^ B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Or(FPsDataBigInteger A, FPsDataBigInteger B) { return A | B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Not(FPsDataBigInteger A) { return ~A; } FPsDataBigInteger UPsDataBigIntegerLibrary::Sign(FPsDataBigInteger A) { if (A.IsZero()) { return FPsDataBigInteger::Zero; } return A.GetSign(); } FPsDataBigInteger UPsDataBigIntegerLibrary::Min(FPsDataBigInteger A, FPsDataBigInteger B) { if (A < B) { return A; } return B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Max(FPsDataBigInteger A, FPsDataBigInteger B) { if (A > B) { return A; } return B; } bool UPsDataBigIntegerLibrary::InRange(FPsDataBigInteger Value, FPsDataBigInteger Min, FPsDataBigInteger Max, bool InclusiveMin, bool InclusiveMax) { const auto CompMin = FPsDataBigInteger::Compare(Min, Value); const auto CompMax = FPsDataBigInteger::Compare(Value, Max); if (CompMin < 0 && CompMax > 0) { return true; } if (InclusiveMin && CompMin == 0) { return true; } if (InclusiveMax && CompMax == 0) { return true; } return false; } FPsDataBigInteger UPsDataBigIntegerLibrary::Clamp(FPsDataBigInteger Value, FPsDataBigInteger Min, FPsDataBigInteger Max) { if (Min > Value) { return Min; } if (Max < Value) { return Max; } return Value; } FPsDataBigInteger UPsDataBigIntegerLibrary::Abs(FPsDataBigInteger A) { A.Abs(); return A; } bool UPsDataBigIntegerLibrary::Bit(FPsDataBigInteger A, int32 BitIndex) { return A.GetBit(BitIndex); } FPsDataShortBigInteger UPsDataBigIntegerLibrary::ToShortBigInteger(const FPsDataBigInteger& InBigInteger) { return InBigInteger.ToShortBigInteger(18); } int32 UPsDataBigIntegerLibrary::ToInt(const FPsDataBigInteger& InBigInteger) { return InBigInteger.ToInt32(); } int32 UPsDataBigIntegerLibrary::ToInt64(const FPsDataBigInteger& InBigInteger) { return InBigInteger.ToInt64(); } FPsDataBigInteger UPsDataBigIntegerLibrary::Int32ToBigInteger(const int32& InInt) { return {InInt}; } FPsDataBigInteger UPsDataBigIntegerLibrary::Int64ToBigInteger(const int64& InInt) { return {InInt}; } FString UPsDataBigIntegerLibrary::ToString(const FPsDataBigInteger& InBigInteger) { return InBigInteger.ToString(); } FPsDataBigInteger UPsDataBigIntegerLibrary::StringToBigInteger(const FString& InString) { return FPsDataBigInteger::FromString(InString); } FPsDataBigInteger UPsDataBigIntegerLibrary::Multiply_Int32(FPsDataBigInteger A, int32 B) { return A * B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Divide_Int32(FPsDataBigInteger A, int32 B) { ZERO_DIVIDE_PROTECTION(A, B); return A / B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Add_Int32(FPsDataBigInteger A, int32 B) { return A + B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Subtract_Int32(FPsDataBigInteger A, int32 B) { return A - B; } int32 UPsDataBigIntegerLibrary::Modulo_Int32(FPsDataBigInteger A, int32 B) { ZERO_DIVIDE_PROTECTION(A, B); return (A % B).ToInt32(); } bool UPsDataBigIntegerLibrary::Less_Int32(FPsDataBigInteger A, int32 B) { return A < B; } bool UPsDataBigIntegerLibrary::Greater_Int32(FPsDataBigInteger A, int32 B) { return A > B; } bool UPsDataBigIntegerLibrary::LessEqual_Int32(FPsDataBigInteger A, int32 B) { return A <= B; } bool UPsDataBigIntegerLibrary::GreaterEqual_Int32(FPsDataBigInteger A, int32 B) { return A >= B; } bool UPsDataBigIntegerLibrary::Equal_Int32(FPsDataBigInteger A, int32 B) { return A == B; } bool UPsDataBigIntegerLibrary::NotEqual_Int32(FPsDataBigInteger A, int32 B) { return A != B; } FPsDataBigInteger UPsDataBigIntegerLibrary::And_Int32(FPsDataBigInteger A, int32 B) { return A & B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Xor_Int32(FPsDataBigInteger A, int32 B) { return A ^ B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Or_Int32(FPsDataBigInteger A, int32 B) { return A | B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Multiply_Int64(FPsDataBigInteger A, int64 B) { return A * B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Divide_Int64(FPsDataBigInteger A, int64 B) { ZERO_DIVIDE_PROTECTION(A, B); return A / B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Add_Int64(FPsDataBigInteger A, int64 B) { return A + B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Subtract_Int64(FPsDataBigInteger A, int64 B) { return A - B; } int64 UPsDataBigIntegerLibrary::Modulo_Int64(FPsDataBigInteger A, int64 B) { ZERO_DIVIDE_PROTECTION(A, B); return (A % B).ToInt64(); } bool UPsDataBigIntegerLibrary::Less_Int64(FPsDataBigInteger A, int64 B) { return A < B; } bool UPsDataBigIntegerLibrary::Greater_Int64(FPsDataBigInteger A, int64 B) { return A > B; } bool UPsDataBigIntegerLibrary::LessEqual_Int64(FPsDataBigInteger A, int64 B) { return A <= B; } bool UPsDataBigIntegerLibrary::GreaterEqual_Int64(FPsDataBigInteger A, int64 B) { return A >= B; } bool UPsDataBigIntegerLibrary::Equal_Int64(FPsDataBigInteger A, int64 B) { return A == B; } bool UPsDataBigIntegerLibrary::NotEqual_Int64(FPsDataBigInteger A, int64 B) { return A != B; } FPsDataBigInteger UPsDataBigIntegerLibrary::And_Int64(FPsDataBigInteger A, int64 B) { return A & B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Xor_Int64(FPsDataBigInteger A, int64 B) { return A ^ B; } FPsDataBigInteger UPsDataBigIntegerLibrary::Or_Int64(FPsDataBigInteger A, int64 B) { return A | B; } DEFINE_FUNCTION(UPsDataBigIntegerLibrary::execSetMapProperty) { P_GET_OBJECT(UPsData, Target); P_GET_PROPERTY(FIntProperty, Index); P_GET_TMAP_REF(FString, FPsDataBigInteger, Value); P_FINISH; P_NATIVE_BEGIN; PsDataTools::UnsafeSetByIndex<TMap<FString, FPsDataBigInteger>>(Target, Index, Value); P_NATIVE_END; } DEFINE_FUNCTION(UPsDataBigIntegerLibrary::execGetMapProperty) { P_GET_OBJECT(UPsData, Target); P_GET_PROPERTY(FIntProperty, Index);
DEFINE_FUNCTION(UPsDataBigIntegerLibrary::execSetArrayProperty) { P_GET_OBJECT(UPsData, Target); P_GET_PROPERTY(FIntProperty, Index); P_GET_TARRAY_REF(FPsDataBigInteger, Value); P_FINISH; P_NATIVE_BEGIN; PsDataTools::UnsafeSetByIndex<TArray<FPsDataBigInteger>>(Target, Index, Value); P_NATIVE_END; } DEFINE_FUNCTION(UPsDataBigIntegerLibrary::execGetArrayProperty) { P_GET_OBJECT(UPsData, Target); P_GET_PROPERTY(FIntProperty, Index); P_GET_TARRAY_REF(FPsDataBigInteger, Out); P_FINISH; P_NATIVE_BEGIN; TArray<FPsDataBigInteger>* Result = nullptr; PsDataTools::UnsafeGetByIndex(Target, Index, Result); Out = *Result; P_NATIVE_END; } DEFINE_FUNCTION(UPsDataBigIntegerLibrary::execSetProperty) { P_GET_OBJECT(UPsData, Target); P_GET_PROPERTY(FIntProperty, Index); P_GET_STRUCT_REF(FPsDataBigInteger, Value); P_FINISH; P_NATIVE_BEGIN; PsDataTools::UnsafeSetByIndex<FPsDataBigInteger>(Target, Index, Value); P_NATIVE_END; } DEFINE_FUNCTION(UPsDataBigIntegerLibrary::execGetProperty) { P_GET_OBJECT(UPsData, Target); P_GET_PROPERTY(FIntProperty, Index); P_GET_STRUCT_REF(FPsDataBigInteger, Out); P_FINISH; P_NATIVE_BEGIN; FPsDataBigInteger* Result = nullptr; PsDataTools::UnsafeGetByIndex(Target, Index, Result); Out = *Result; P_NATIVE_END; } void UPsDataBigIntegerLibrary::TypeSerialize(const UPsData* const Instance, const TSharedPtr<const FDataField>& Field, FPsDataSerializer* Serializer, const FPsDataBigInteger& Value) { Serializer->WriteValue(Value.ToString()); } FPsDataBigInteger UPsDataBigIntegerLibrary::TypeDeserialize(const UPsData* const Instance, const TSharedPtr<const FDataField>& Field, FPsDataDeserializer* Deserializer, const FPsDataBigInteger& Value) { FString StringValue; if (Deserializer->ReadValue(StringValue)) { auto a = FPsDataBigInteger(StringValue); return a; } int64 Int64Value = 0; if (Deserializer->ReadValue(Int64Value)) { return Int64Value; } int32 Int32Value = 0; if (Deserializer->ReadValue(Int32Value)) { return Int32Value; } UE_LOG(LogData, Warning, TEXT("Can't deserialize \"%s::%s\" as \"%s\""), *Instance->GetClass()->GetName(), *Field->Name, *PsDataTools::FType<FPsDataBigInteger>::Type()); return Value; }
P_GET_TMAP_REF(FString, FPsDataBigInteger, Out); P_FINISH; P_NATIVE_BEGIN; TMap<FString, FPsDataBigInteger>* Result = nullptr; PsDataTools::UnsafeGetByIndex(Target, Index, Result); Out = *Result; P_NATIVE_END; }
function_block-function_prefix_line
[ { "content": "struct FDataTypeContext<TMap<FString, int64>> : public FDataTypeContextExtended<TMap<FString, int64>, UPsDataInt64Library>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_int64.h", "rank": 0, "score": 119259.96767205576 }, { "content": "struct FDataTypeContext<TMap<FString, int32>> : public FDataTypeContextExtended<TMap<FString, int32>, UPsDataInt32Library>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_int32.h", "rank": 1, "score": 119202.57600137506 }, { "content": "struct FDataTypeContext<TMap<FString, bool>> : public FDataTypeContextExtended<TMap<FString, bool>, UPsDataBoolLibrary>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_bool.h", "rank": 2, "score": 119145.01045324863 }, { "content": "struct FTypeDeserializer<int64> : public FTypeDeserializerExtended<int64, UPsDataInt64Library>\n\n{\n\n};\n\n\n\n} // namespace PsDataTools", "file_path": "Source/PsData/Public/Types/PsData_int64.h", "rank": 3, "score": 93638.24110598856 }, { "content": "struct FTypeSerializer<int64> : public FTypeSerializerExtended<int64, UPsDataInt64Library>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_int64.h", "rank": 4, "score": 93638.24110598856 }, { "content": "struct FTypeSerializer<int32> : public FTypeSerializerExtended<int32, UPsDataInt32Library>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_int32.h", "rank": 5, "score": 93574.48855063542 }, { "content": "struct FTypeDeserializer<int32> : public FTypeDeserializerExtended<int32, UPsDataInt32Library>\n\n{\n\n};\n\n\n\n} // namespace PsDataTools", "file_path": "Source/PsData/Public/Types/PsData_int32.h", "rank": 6, "score": 93574.48855063542 }, { "content": "struct FTypeDeserializer<bool> : public FTypeDeserializerExtended<bool, UPsDataBoolLibrary>\n\n{\n\n};\n\n\n\n} // namespace PsDataTools", "file_path": "Source/PsData/Public/Types/PsData_bool.h", "rank": 7, "score": 93510.54093678191 }, { "content": "struct FTypeSerializer<bool> : public FTypeSerializerExtended<bool, UPsDataBoolLibrary>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_bool.h", "rank": 8, "score": 93510.54093678191 }, { "content": "struct FDataTypeContext<int64> : public FDataTypeContextExtended<int64, UPsDataInt64Library>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_int64.h", "rank": 9, "score": 93082.06072743959 }, { "content": "struct FDataTypeContext<int32> : public FDataTypeContextExtended<int32, UPsDataInt32Library>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_int32.h", "rank": 10, "score": 93018.4813572276 }, { "content": "struct FDataTypeContext<bool> : public FDataTypeContextExtended<bool, UPsDataBoolLibrary>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_bool.h", "rank": 11, "score": 92954.70722019767 }, { "content": "struct FDataTypeContext<TArray<int64>> : public FDataTypeContextExtended<TArray<int64>, UPsDataInt64Library>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_int64.h", "rank": 12, "score": 89614.81397374198 }, { "content": "struct FDataTypeContext<TArray<int32>> : public FDataTypeContextExtended<TArray<int32>, UPsDataInt32Library>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_int32.h", "rank": 13, "score": 89554.51033240516 }, { "content": "struct FDataTypeContext<TArray<bool>> : public FDataTypeContextExtended<TArray<bool>, UPsDataBoolLibrary>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_bool.h", "rank": 14, "score": 89494.02300751043 }, { "content": "struct FTypeDefault<int64>\n\n{\n\n\tstatic const int64 GetDefaultValue() { return 0; }\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_int64.h", "rank": 15, "score": 87589.11771241079 }, { "content": "struct FTypeDefault<int32>\n\n{\n\n\tstatic const int32 GetDefaultValue() { return 0; }\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_int32.h", "rank": 16, "score": 87529.37847079485 }, { "content": "struct FTypeDefault<bool>\n\n{\n\n\tstatic const bool GetDefaultValue() { return false; }\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_bool.h", "rank": 17, "score": 87469.45632798033 }, { "content": "\tTMap<int32, const TSharedPtr<const FDataLink>> LinksByHash;\n", "file_path": "Source/PsData/Public/PsDataCore.h", "rank": 18, "score": 82677.78743292135 }, { "content": "\tconst T& Get() const\n\n\t{\n\n\t\treturn Value;\n", "file_path": "Source/PsData/Public/PsDataProperty.h", "rank": 19, "score": 82667.28460746436 }, { "content": "\tstatic constexpr bool Map = true;\n", "file_path": "Source/PsData/Public/PsDataTraits.h", "rank": 20, "score": 82614.62530316722 }, { "content": "\tstatic constexpr int Clamp(const int x, const int min, const int max)\n\n\t{\n", "file_path": "Source/PsData/Public/PsDataStringView.h", "rank": 21, "score": 82323.33615295368 }, { "content": "\tconstexpr TStringView RightChop(int CharCount) const\n\n\t{\n\n\t\tconst int OutLen = Clamp(Size - CharCount, 0, Size);\n\n\t\treturn TStringView(Source + Size - OutLen, OutLen);\n", "file_path": "Source/PsData/Public/PsDataStringView.h", "rank": 22, "score": 82040.59588784515 }, { "content": "\t\texplicit operator bool() const\n\n\t\t{\n\n\t\t\treturn Index < Items.Num();\n", "file_path": "Source/PsData/Public/Collection/PsDataArrayProxy.h", "rank": 23, "score": 81423.25986415036 }, { "content": "\t\tfriend bool operator!=(const TProxyIterator& Lhs, const TProxyIterator& Rhs)\n", "file_path": "Source/PsData/Public/Collection/PsDataArrayProxy.h", "rank": 24, "score": 81372.1481727511 }, { "content": "class PSDATA_API UPsDataInt64Library : public UBlueprintFunctionLibrary\n\n{\n\n\tGENERATED_BODY()\n\n\n\npublic:\n\n\t/** Get property */\n\n\tUFUNCTION(BlueprintPure, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataOut = \"Out\"))\n\n\tstatic void GetProperty(UPsData* Target, int32 Index, int64& Out);\n\n\n\n\t/** Set property */\n\n\tUFUNCTION(BlueprintCallable, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataIn = \"Value\"))\n\n\tstatic void SetProperty(UPsData* Target, int32 Index, int64 Value);\n\n\n\n\t/** Get array property */\n\n\tUFUNCTION(BlueprintPure, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataOut = \"Out\"))\n\n\tstatic void GetArrayProperty(UPsData* Target, int32 Index, TArray<int64>& Out);\n\n\n\n\t/** Set array property */\n\n\tUFUNCTION(BlueprintCallable, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataIn = \"Value\"))\n\n\tstatic void SetArrayProperty(UPsData* Target, int32 Index, const TArray<int64>& Value);\n", "file_path": "Source/PsData/Public/Types/PsData_int64.h", "rank": 25, "score": 48653.537789201975 }, { "content": "class PSDATA_API UPsDataInt32Library : public UBlueprintFunctionLibrary\n\n{\n\n\tGENERATED_BODY()\n\n\n\npublic:\n\n\t/** Get property */\n\n\tUFUNCTION(BlueprintPure, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataOut = \"Out\"))\n\n\tstatic void GetProperty(UPsData* Target, int32 Index, int32& Out);\n\n\n\n\t/** Set property */\n\n\tUFUNCTION(BlueprintCallable, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataIn = \"Value\"))\n\n\tstatic void SetProperty(UPsData* Target, int32 Index, int32 Value);\n\n\n\n\t/** Get array property */\n\n\tUFUNCTION(BlueprintPure, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataOut = \"Out\"))\n\n\tstatic void GetArrayProperty(UPsData* Target, int32 Index, TArray<int32>& Out);\n\n\n\n\t/** Set array property */\n\n\tUFUNCTION(BlueprintCallable, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataIn = \"Value\"))\n\n\tstatic void SetArrayProperty(UPsData* Target, int32 Index, const TArray<int32>& Value);\n", "file_path": "Source/PsData/Public/Types/PsData_int32.h", "rank": 26, "score": 48638.38790233797 }, { "content": "class PSDATA_API UPsDataBoolLibrary : public UBlueprintFunctionLibrary\n\n{\n\n\tGENERATED_BODY()\n\n\n\npublic:\n\n\t/** Get property */\n\n\tUFUNCTION(BlueprintPure, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataOut = \"Out\"))\n\n\tstatic void GetProperty(UPsData* Target, int32 Index, bool& Out);\n\n\n\n\t/** Set property */\n\n\tUFUNCTION(BlueprintCallable, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataIn = \"Value\"))\n\n\tstatic void SetProperty(UPsData* Target, int32 Index, bool Value);\n\n\n\n\t/** Get array property */\n\n\tUFUNCTION(BlueprintPure, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataOut = \"Out\"))\n\n\tstatic void GetArrayProperty(UPsData* Target, int32 Index, TArray<bool>& Out);\n\n\n\n\t/** Set array property */\n\n\tUFUNCTION(BlueprintCallable, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataIn = \"Value\"))\n\n\tstatic void SetArrayProperty(UPsData* Target, int32 Index, const TArray<bool>& Value);\n", "file_path": "Source/PsData/Public/Types/PsData_bool.h", "rank": 27, "score": 48623.212499685134 }, { "content": "\n\n\t/** Get map property */\n\n\tUFUNCTION(BlueprintPure, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataOut = \"Out\"))\n\n\tstatic void GetMapProperty(UPsData* Target, int32 Index, TMap<FString, int64>& Out);\n\n\n\n\t/** Set map property */\n\n\tUFUNCTION(BlueprintCallable, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataIn = \"Value\"))\n\n\tstatic void SetMapProperty(UPsData* Target, int32 Index, const TMap<FString, int64>& Value);\n\n\n\n\tDECLARE_FUNCTION(execGetProperty);\n\n\tDECLARE_FUNCTION(execSetProperty);\n\n\tDECLARE_FUNCTION(execGetArrayProperty);\n\n\tDECLARE_FUNCTION(execSetArrayProperty);\n\n\tDECLARE_FUNCTION(execGetMapProperty);\n\n\tDECLARE_FUNCTION(execSetMapProperty);\n\n\n\n\tstatic void TypeSerialize(const UPsData* const Instance, const TSharedPtr<const FDataField>& Field, FPsDataSerializer* Serializer, const int64& Value);\n\n\tstatic int64 TypeDeserialize(const UPsData* const Instance, const TSharedPtr<const FDataField>& Field, FPsDataDeserializer* Deserializer, const int64& Value);\n\n};\n\n\n\nnamespace PsDataTools\n\n{\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_int64.h", "rank": 28, "score": 45050.309560693226 }, { "content": "// Copyright 2015-2021 Mail.Ru Group. All Rights Reserved.\n\n\n\n#pragma once\n\n\n\n#include \"PsDataCore.h\"\n\n\n\n#include \"PsDataCustomThunk.h\"\n\n\n\n#include \"CoreMinimal.h\"\n\n#include \"Kismet/BlueprintFunctionLibrary.h\"\n\n\n\n#include \"PsData_int64.generated.h\"\n\n\n\nUCLASS(meta = (CustomThunkTemplates = \"FCustomThunkTemplates_PsData\"))\n", "file_path": "Source/PsData/Public/Types/PsData_int64.h", "rank": 29, "score": 45039.137125369256 }, { "content": "\n\n\t/** Get map property */\n\n\tUFUNCTION(BlueprintPure, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataOut = \"Out\"))\n\n\tstatic void GetMapProperty(UPsData* Target, int32 Index, TMap<FString, int32>& Out);\n\n\n\n\t/** Set map property */\n\n\tUFUNCTION(BlueprintCallable, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataIn = \"Value\"))\n\n\tstatic void SetMapProperty(UPsData* Target, int32 Index, const TMap<FString, int32>& Value);\n\n\n\n\tDECLARE_FUNCTION(execGetProperty);\n\n\tDECLARE_FUNCTION(execSetProperty);\n\n\tDECLARE_FUNCTION(execGetArrayProperty);\n\n\tDECLARE_FUNCTION(execSetArrayProperty);\n\n\tDECLARE_FUNCTION(execGetMapProperty);\n\n\tDECLARE_FUNCTION(execSetMapProperty);\n\n\n\n\tstatic void TypeSerialize(const UPsData* const Instance, const TSharedPtr<const FDataField>& Field, FPsDataSerializer* Serializer, const int32& Value);\n\n\tstatic int32 TypeDeserialize(const UPsData* const Instance, const TSharedPtr<const FDataField>& Field, FPsDataDeserializer* Deserializer, const int32& Value);\n\n};\n\n\n\nnamespace PsDataTools\n\n{\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_int32.h", "rank": 30, "score": 45033.6439851776 }, { "content": "// Copyright 2015-2021 Mail.Ru Group. All Rights Reserved.\n\n\n\n#pragma once\n\n\n\n#include \"PsDataCore.h\"\n\n\n\n#include \"PsDataCustomThunk.h\"\n\n\n\n#include \"CoreMinimal.h\"\n\n#include \"Kismet/BlueprintFunctionLibrary.h\"\n\n\n\n#include \"PsData_int32.generated.h\"\n\n\n\nUCLASS(meta = (CustomThunkTemplates = \"FCustomThunkTemplates_PsData\"))\n", "file_path": "Source/PsData/Public/Types/PsData_int32.h", "rank": 31, "score": 45025.00826860151 }, { "content": "\n\n\t/** Get map property */\n\n\tUFUNCTION(BlueprintPure, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataOut = \"Out\"))\n\n\tstatic void GetMapProperty(UPsData* Target, int32 Index, TMap<FString, bool>& Out);\n\n\n\n\t/** Set map property */\n\n\tUFUNCTION(BlueprintCallable, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataIn = \"Value\"))\n\n\tstatic void SetMapProperty(UPsData* Target, int32 Index, const TMap<FString, bool>& Value);\n\n\n\n\tDECLARE_FUNCTION(execGetProperty);\n\n\tDECLARE_FUNCTION(execSetProperty);\n\n\tDECLARE_FUNCTION(execGetArrayProperty);\n\n\tDECLARE_FUNCTION(execSetArrayProperty);\n\n\tDECLARE_FUNCTION(execGetMapProperty);\n\n\tDECLARE_FUNCTION(execSetMapProperty);\n\n\n\n\tstatic void TypeSerialize(const UPsData* const Instance, const TSharedPtr<const FDataField>& Field, FPsDataSerializer* Serializer, const bool& Value);\n\n\tstatic bool TypeDeserialize(const UPsData* const Instance, const TSharedPtr<const FDataField>& Field, FPsDataDeserializer* Deserializer, const bool& Value);\n\n};\n\n\n\nnamespace PsDataTools\n\n{\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_bool.h", "rank": 32, "score": 45022.130263795676 }, { "content": "// Copyright 2015-2021 Mail.Ru Group. All Rights Reserved.\n\n\n\n#pragma once\n\n\n\n#include \"PsDataCore.h\"\n\n\n\n#include \"PsDataCustomThunk.h\"\n\n\n\n#include \"CoreMinimal.h\"\n\n#include \"Kismet/BlueprintFunctionLibrary.h\"\n\n\n\n#include \"PsData_bool.generated.h\"\n\n\n\nUCLASS(meta = (CustomThunkTemplates = \"FCustomThunkTemplates_PsData\"))\n", "file_path": "Source/PsData/Public/Types/PsData_bool.h", "rank": 33, "score": 45010.97861291177 }, { "content": "// Copyright 2015-2021 Mail.Ru Group. All Rights Reserved.\n\n\n\n#include \"Types/PsData_int64.h\"\n\n\n\nDEFINE_FUNCTION(UPsDataInt64Library::execSetMapProperty)\n\n{\n\n\tP_GET_OBJECT(UPsData, Target);\n\n\tP_GET_PROPERTY(FIntProperty, Index);\n\n\tP_GET_TMAP_REF(FString, int64, Value);\n\n\tP_FINISH;\n\n\tP_NATIVE_BEGIN;\n\n\tPsDataTools::UnsafeSetByIndex<TMap<FString, int64>>(Target, Index, Value);\n\n\tP_NATIVE_END;\n\n}\n\n\n\nDEFINE_FUNCTION(UPsDataInt64Library::execGetMapProperty)\n\n{\n\n\tP_GET_OBJECT(UPsData, Target);\n\n\tP_GET_PROPERTY(FIntProperty, Index);\n\n\tP_GET_TMAP_REF(FString, int64, Out);\n", "file_path": "Source/PsData/Private/Types/PsData_int64.cpp", "rank": 34, "score": 44339.51186062626 }, { "content": "\tP_FINISH;\n\n\tP_NATIVE_BEGIN;\n\n\tTMap<FString, int64>* Result = nullptr;\n\n\tPsDataTools::UnsafeGetByIndex(Target, Index, Result);\n\n\tOut = *Result;\n\n\tP_NATIVE_END;\n\n}\n\n\n\nDEFINE_FUNCTION(UPsDataInt64Library::execSetArrayProperty)\n\n{\n\n\tP_GET_OBJECT(UPsData, Target);\n\n\tP_GET_PROPERTY(FIntProperty, Index);\n\n\tP_GET_TARRAY_REF(int64, Value);\n\n\tP_FINISH;\n\n\tP_NATIVE_BEGIN;\n\n\tPsDataTools::UnsafeSetByIndex<TArray<int64>>(Target, Index, Value);\n\n\tP_NATIVE_END;\n\n}\n\n\n\nDEFINE_FUNCTION(UPsDataInt64Library::execGetArrayProperty)\n", "file_path": "Source/PsData/Private/Types/PsData_int64.cpp", "rank": 35, "score": 44337.60088120706 }, { "content": "{\n\n\tP_GET_OBJECT(UPsData, Target);\n\n\tP_GET_PROPERTY(FIntProperty, Index);\n\n\tP_GET_TARRAY_REF(int64, Out);\n\n\tP_FINISH;\n\n\tP_NATIVE_BEGIN;\n\n\tTArray<int64>* Result = nullptr;\n\n\tPsDataTools::UnsafeGetByIndex(Target, Index, Result);\n\n\tOut = *Result;\n\n\tP_NATIVE_END;\n\n}\n\n\n\nDEFINE_FUNCTION(UPsDataInt64Library::execSetProperty)\n\n{\n\n\tP_GET_OBJECT(UPsData, Target);\n\n\tP_GET_PROPERTY(FIntProperty, Index);\n\n\tP_GET_PROPERTY(FInt64Property, Value);\n\n\tP_FINISH;\n\n\tP_NATIVE_BEGIN;\n\n\tPsDataTools::UnsafeSetByIndex<int64>(Target, Index, Value);\n", "file_path": "Source/PsData/Private/Types/PsData_int64.cpp", "rank": 36, "score": 44336.98790723645 }, { "content": "\tP_NATIVE_END;\n\n}\n\n\n\nDEFINE_FUNCTION(UPsDataInt64Library::execGetProperty)\n\n{\n\n\tP_GET_OBJECT(UPsData, Target);\n\n\tP_GET_PROPERTY(FIntProperty, Index);\n\n\tP_GET_PROPERTY_REF(FInt64Property, Out);\n\n\tP_FINISH;\n\n\tP_NATIVE_BEGIN;\n\n\tint64* Result = nullptr;\n\n\tPsDataTools::UnsafeGetByIndex(Target, Index, Result);\n\n\tOut = *Result;\n\n\tP_NATIVE_END;\n\n}\n\n\n\nvoid UPsDataInt64Library::TypeSerialize(const UPsData* const Instance, const TSharedPtr<const FDataField>& Field, FPsDataSerializer* Serializer, const int64& Value)\n\n{\n\n\tSerializer->WriteValue(Value);\n\n}\n", "file_path": "Source/PsData/Private/Types/PsData_int64.cpp", "rank": 37, "score": 44335.98183041526 }, { "content": "\n\nint64 UPsDataInt64Library::TypeDeserialize(const UPsData* const Instance, const TSharedPtr<const FDataField>& Field, FPsDataDeserializer* Deserializer, const int64& Value)\n\n{\n\n\tint64 Result = Value;\n\n\tif (Deserializer->ReadValue(Result))\n\n\t{\n\n\t\treturn Result;\n\n\t}\n\n\n\n\tUE_LOG(LogData, Warning, TEXT(\"Can't deserialize \\\"%s::%s\\\" as \\\"%s\\\"\"), *Instance->GetClass()->GetName(), *Field->Name, *PsDataTools::FType<int64>::Type());\n\n\treturn Value;\n\n}", "file_path": "Source/PsData/Private/Types/PsData_int64.cpp", "rank": 38, "score": 44325.98658802897 }, { "content": "// Copyright 2015-2021 Mail.Ru Group. All Rights Reserved.\n\n\n\n#include \"Types/PsData_int32.h\"\n\n\n\nDEFINE_FUNCTION(UPsDataInt32Library::execSetMapProperty)\n\n{\n\n\tP_GET_OBJECT(UPsData, Target);\n\n\tP_GET_PROPERTY(FIntProperty, Index);\n\n\tP_GET_TMAP_REF(FString, int32, Value);\n\n\tP_FINISH;\n\n\tP_NATIVE_BEGIN;\n\n\tPsDataTools::UnsafeSetByIndex<TMap<FString, int32>>(Target, Index, Value);\n\n\tP_NATIVE_END;\n\n}\n\n\n\nDEFINE_FUNCTION(UPsDataInt32Library::execGetMapProperty)\n\n{\n\n\tP_GET_OBJECT(UPsData, Target);\n\n\tP_GET_PROPERTY(FIntProperty, Index);\n\n\tP_GET_TMAP_REF(FString, int32, Out);\n", "file_path": "Source/PsData/Private/Types/PsData_int32.cpp", "rank": 39, "score": 44325.55951750274 }, { "content": "\tP_FINISH;\n\n\tP_NATIVE_BEGIN;\n\n\tTMap<FString, int32>* Result = nullptr;\n\n\tPsDataTools::UnsafeGetByIndex(Target, Index, Result);\n\n\tOut = *Result;\n\n\tP_NATIVE_END;\n\n}\n\n\n\nDEFINE_FUNCTION(UPsDataInt32Library::execSetArrayProperty)\n\n{\n\n\tP_GET_OBJECT(UPsData, Target);\n\n\tP_GET_PROPERTY(FIntProperty, Index);\n\n\tP_GET_TARRAY_REF(int32, Value);\n\n\tP_FINISH;\n\n\tP_NATIVE_BEGIN;\n\n\tPsDataTools::UnsafeSetByIndex<TArray<int32>>(Target, Index, Value);\n\n\tP_NATIVE_END;\n\n}\n\n\n\nDEFINE_FUNCTION(UPsDataInt32Library::execGetArrayProperty)\n", "file_path": "Source/PsData/Private/Types/PsData_int32.cpp", "rank": 40, "score": 44323.65128311037 }, { "content": "{\n\n\tP_GET_OBJECT(UPsData, Target);\n\n\tP_GET_PROPERTY(FIntProperty, Index);\n\n\tP_GET_TARRAY_REF(int32, Out);\n\n\tP_FINISH;\n\n\tP_NATIVE_BEGIN;\n\n\tTArray<int32>* Result = nullptr;\n\n\tPsDataTools::UnsafeGetByIndex(Target, Index, Result);\n\n\tOut = *Result;\n\n\tP_NATIVE_END;\n\n}\n\n\n\nDEFINE_FUNCTION(UPsDataInt32Library::execSetProperty)\n\n{\n\n\tP_GET_OBJECT(UPsData, Target);\n\n\tP_GET_PROPERTY(FIntProperty, Index);\n\n\tP_GET_PROPERTY(FIntProperty, Value);\n\n\tP_FINISH;\n\n\tP_NATIVE_BEGIN;\n\n\tPsDataTools::UnsafeSetByIndex<int32>(Target, Index, Value);\n", "file_path": "Source/PsData/Private/Types/PsData_int32.cpp", "rank": 41, "score": 44322.791700273774 }, { "content": "\tP_NATIVE_END;\n\n}\n\n\n\nDEFINE_FUNCTION(UPsDataInt32Library::execGetProperty)\n\n{\n\n\tP_GET_OBJECT(UPsData, Target);\n\n\tP_GET_PROPERTY(FIntProperty, Index);\n\n\tP_GET_PROPERTY_REF(FIntProperty, Out);\n\n\tP_FINISH;\n\n\tP_NATIVE_BEGIN;\n\n\tint32* Result = nullptr;\n\n\tPsDataTools::UnsafeGetByIndex(Target, Index, Result);\n\n\tOut = *Result;\n\n\tP_NATIVE_END;\n\n}\n\n\n\nvoid UPsDataInt32Library::TypeSerialize(const UPsData* const Instance, const TSharedPtr<const FDataField>& Field, FPsDataSerializer* Serializer, const int32& Value)\n\n{\n\n\tSerializer->WriteValue(Value);\n\n}\n", "file_path": "Source/PsData/Private/Types/PsData_int32.cpp", "rank": 42, "score": 44321.788329271134 }, { "content": "\n\nint32 UPsDataInt32Library::TypeDeserialize(const UPsData* const Instance, const TSharedPtr<const FDataField>& Field, FPsDataDeserializer* Deserializer, const int32& Value)\n\n{\n\n\tint32 Result = Value;\n\n\tif (Deserializer->ReadValue(Result))\n\n\t{\n\n\t\treturn Result;\n\n\t}\n\n\n\n\tUE_LOG(LogData, Warning, TEXT(\"Can't deserialize \\\"%s::%s\\\" as \\\"%s\\\"\"), *Instance->GetClass()->GetName(), *Field->Name, *PsDataTools::FType<int32>::Type());\n\n\treturn Value;\n\n}", "file_path": "Source/PsData/Private/Types/PsData_int32.cpp", "rank": 43, "score": 44312.027992584975 }, { "content": "// Copyright 2015-2021 Mail.Ru Group. All Rights Reserved.\n\n\n\n#include \"Types/PsData_bool.h\"\n\n\n\nDEFINE_FUNCTION(UPsDataBoolLibrary::execSetMapProperty)\n\n{\n\n\tP_GET_OBJECT(UPsData, Target);\n\n\tP_GET_PROPERTY(FIntProperty, Index);\n\n\tP_GET_TMAP_REF(FString, bool, Value);\n\n\tP_FINISH;\n\n\tP_NATIVE_BEGIN;\n\n\tPsDataTools::UnsafeSetByIndex<TMap<FString, bool>>(Target, Index, Value);\n\n\tP_NATIVE_END;\n\n}\n\n\n\nDEFINE_FUNCTION(UPsDataBoolLibrary::execGetMapProperty)\n\n{\n\n\tP_GET_OBJECT(UPsData, Target);\n\n\tP_GET_PROPERTY(FIntProperty, Index);\n\n\tP_GET_TMAP_REF(FString, bool, Out);\n", "file_path": "Source/PsData/Private/Types/PsData_bool.cpp", "rank": 44, "score": 44311.75926110332 }, { "content": "\tP_FINISH;\n\n\tP_NATIVE_BEGIN;\n\n\tTMap<FString, bool>* Result = nullptr;\n\n\tPsDataTools::UnsafeGetByIndex(Target, Index, Result);\n\n\tOut = *Result;\n\n\tP_NATIVE_END;\n\n}\n\n\n\nDEFINE_FUNCTION(UPsDataBoolLibrary::execSetArrayProperty)\n\n{\n\n\tP_GET_OBJECT(UPsData, Target);\n\n\tP_GET_PROPERTY(FIntProperty, Index);\n\n\tP_GET_TARRAY_REF(bool, Value);\n\n\tP_FINISH;\n\n\tP_NATIVE_BEGIN;\n\n\tPsDataTools::UnsafeSetByIndex<TArray<bool>>(Target, Index, Value);\n\n\tP_NATIVE_END;\n\n}\n\n\n\nDEFINE_FUNCTION(UPsDataBoolLibrary::execGetArrayProperty)\n", "file_path": "Source/PsData/Private/Types/PsData_bool.cpp", "rank": 45, "score": 44309.85062904608 }, { "content": "{\n\n\tP_GET_OBJECT(UPsData, Target);\n\n\tP_GET_PROPERTY(FIntProperty, Index);\n\n\tP_GET_TARRAY_REF(bool, Out);\n\n\tP_FINISH;\n\n\tP_NATIVE_BEGIN;\n\n\tTArray<bool>* Result = nullptr;\n\n\tPsDataTools::UnsafeGetByIndex(Target, Index, Result);\n\n\tOut = *Result;\n\n\tP_NATIVE_END;\n\n}\n\n\n\nDEFINE_FUNCTION(UPsDataBoolLibrary::execSetProperty)\n\n{\n\n\tP_GET_OBJECT(UPsData, Target);\n\n\tP_GET_PROPERTY(FIntProperty, Index);\n\n\tP_GET_UBOOL(Value);\n\n\tP_FINISH;\n\n\tP_NATIVE_BEGIN;\n\n\tPsDataTools::UnsafeSetByIndex<bool>(Target, Index, Value);\n", "file_path": "Source/PsData/Private/Types/PsData_bool.cpp", "rank": 46, "score": 44309.15876764205 }, { "content": "\tP_NATIVE_END;\n\n}\n\n\n\nDEFINE_FUNCTION(UPsDataBoolLibrary::execGetProperty)\n\n{\n\n\tP_GET_OBJECT(UPsData, Target);\n\n\tP_GET_PROPERTY(FIntProperty, Index);\n\n\tP_GET_UBOOL_REF(Out);\n\n\tP_FINISH;\n\n\tP_NATIVE_BEGIN;\n\n\tbool* Result = nullptr;\n\n\tPsDataTools::UnsafeGetByIndex(Target, Index, Result);\n\n\tOut = *Result;\n\n\tP_NATIVE_END;\n\n}\n\n\n\nvoid UPsDataBoolLibrary::TypeSerialize(const UPsData* const Instance, const TSharedPtr<const FDataField>& Field, FPsDataSerializer* Serializer, const bool& Value)\n\n{\n\n\tSerializer->WriteValue(Value);\n\n}\n", "file_path": "Source/PsData/Private/Types/PsData_bool.cpp", "rank": 47, "score": 44308.174687399296 }, { "content": "\n\nbool UPsDataBoolLibrary::TypeDeserialize(const UPsData* const Instance, const TSharedPtr<const FDataField>& Field, FPsDataDeserializer* Deserializer, const bool& Value)\n\n{\n\n\tbool Result = Value;\n\n\tif (Deserializer->ReadValue(Result))\n\n\t{\n\n\t\treturn Result;\n\n\t}\n\n\n\n\tUE_LOG(LogData, Warning, TEXT(\"Can't deserialize \\\"%s::%s\\\" as \\\"%s\\\"\"), *Instance->GetClass()->GetName(), *Field->Name, *PsDataTools::FType<bool>::Type());\n\n\treturn Value;\n\n}", "file_path": "Source/PsData/Private/Types/PsData_bool.cpp", "rank": 48, "score": 44298.22864194289 }, { "content": "#define PS_FUNC (FString(__FUNCTION__)) // Current Class Name + Function Name where this is called\n", "file_path": "Source/PsData/Private/PsDataDefines.h", "rank": 49, "score": 41743.60361583695 }, { "content": "#define PS_LINE (FString::FromInt(__LINE__)) // Current Line Number in the code where this is called\n", "file_path": "Source/PsData/Private/PsDataDefines.h", "rank": 50, "score": 41743.60361583695 }, { "content": "struct FDataTypeContext<TMap<FString, FString>> : public FDataTypeContextExtended<TMap<FString, FString>, UPsDataFStringLibrary>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_FString.h", "rank": 51, "score": 41394.32586790524 }, { "content": "#define PS_FUNC_LINE (PS_FUNC + \"(\" + PS_LINE + \")\") // Current Class and Line Number where this is called!\n", "file_path": "Source/PsData/Private/PsDataDefines.h", "rank": 52, "score": 41130.1988223063 }, { "content": "\tbool IsValidIndex(int32 Index) const\n\n\t{\n\n\t\treturn Property->Get().IsValidIndex(Index);\n", "file_path": "Source/PsData/Public/Collection/PsDataArrayProxy.h", "rank": 53, "score": 40548.14104683234 }, { "content": "\ttypename PsDataTools::TConstValue<TMap<FString, T>, bConst>::Type Get() const\n", "file_path": "Source/PsData/Public/Collection/PsDataMapProxy.h", "rank": 54, "score": 40031.616342607114 }, { "content": "\tTMap<FString, const TSharedPtr<const FDataLink>> LinksByName;\n", "file_path": "Source/PsData/Public/PsDataCore.h", "rank": 55, "score": 40031.616342607114 }, { "content": "struct FTypeSerializer<FString> : public FTypeSerializerExtended<FString, UPsDataFStringLibrary>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_FString.h", "rank": 56, "score": 37230.798242122946 }, { "content": "struct FDataTypeContext<FString> : public FDataTypeContextExtended<FString, UPsDataFStringLibrary>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_FString.h", "rank": 57, "score": 37230.798242122946 }, { "content": "struct FTypeDeserializer<FString> : public FTypeDeserializerExtended<FString, UPsDataFStringLibrary>\n\n{\n\n};\n\n\n\n} // namespace PsDataTools", "file_path": "Source/PsData/Public/Types/PsData_FString.h", "rank": 58, "score": 37230.798242122946 }, { "content": "struct FDataTypeContext<TArray<FString>> : public FDataTypeContextExtended<TArray<FString>, UPsDataFStringLibrary>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_FString.h", "rank": 59, "score": 34867.40431433334 }, { "content": "struct FEnumDataTypeContext<TMap<FString, T>> : public FDataTypeContextExtended<TMap<FString, T>, UPsDataEnumLibrary>\n\n{\n\n\tstatic_assert(std::is_enum<T>::value, \"Only \\\"enum class : uint8\\\" can be described by DESCRIBE_ENUM macros\");\n\n\n\n\tvirtual UField* GetUE4Type() const override\n\n\t{\n\n\t\treturn FindObject<UEnum>(ANY_PACKAGE, *FType<T>::ContentType());\n\n\t}\n\n\n\n\tbool HasExtendedTypeCheck() const override\n\n\t{\n\n\t\treturn true;\n\n\t}\n\n\n\n\tvirtual bool IsEnum() const override\n\n\t{\n\n\t\treturn true;\n\n\t}\n\n\n\n\tvirtual bool IsA(const FAbstractDataTypeContext* RightContext) const override\n", "file_path": "Source/PsData/Public/Types/PsData_Enum.h", "rank": 60, "score": 32786.15433502703 }, { "content": "struct FDataTypeContext<TMap<FString, FName>> : public FDataTypeContextExtended<TMap<FString, FName>, UPsDataFNameLibrary>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_FName.h", "rank": 61, "score": 32786.15433502703 }, { "content": "struct FDataTypeContext<TMap<FString, FPsDataBigInteger>> : public FDataTypeContextExtended<TMap<FString, FPsDataBigInteger>, UPsDataBigIntegerLibrary>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_FPsDataBigInteger.h", "rank": 62, "score": 32786.15433502703 }, { "content": "struct FDataTypeContext<TMap<FString, T*>> : public FDataTypeContextExtended<TMap<FString, T*>, UPsDataUPsDataLibrary>\n\n{\n\n\tvirtual UField* GetUE4Type() const override\n\n\t{\n\n\t\treturn GetClass<T>();\n\n\t}\n\n\n\n\tvirtual bool IsData() const override\n\n\t{\n\n\t\treturn true;\n\n\t}\n\n\n\n\tvirtual bool IsA(const FAbstractDataTypeContext* RightContext) const override\n\n\t{\n\n\t\tif (FAbstractDataTypeContext::IsA(RightContext))\n\n\t\t\treturn true;\n\n\n\n\t\tif (!RightContext->IsMap())\n\n\t\t\treturn false;\n\n\n\n\t\treturn UPsDataUPsDataLibrary::IsA(this, RightContext);\n\n\t}\n\n};\n\n\n\ntemplate <typename T>\n", "file_path": "Source/PsData/Public/Types/PsData_UPsData.h", "rank": 63, "score": 32786.15433502703 }, { "content": "struct FDataTypeContext<TMap<FString, float>> : public FDataTypeContextExtended<TMap<FString, float>, UPsDataFloatLibrary>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_float.h", "rank": 64, "score": 32786.15433502703 }, { "content": "struct FDataTypeContext<TMap<FString, FLinearColor>> : public FDataTypeContextExtended<TMap<FString, FLinearColor>, UPsDataFLinearColorLibrary>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_FLinearColor.h", "rank": 65, "score": 32786.15433502703 }, { "content": "struct FDataTypeContext<TMap<FString, uint8>> : public FDataTypeContextExtended<TMap<FString, uint8>, UPsDataUint8Library>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_uint8.h", "rank": 66, "score": 32786.15433502703 }, { "content": "struct FDataTypeContext<TMap<FString, FText>> : public FDataTypeContextExtended<TMap<FString, FText>, UPsDataFTextLibrary>\n\n{\n\n};\n\n\n\ntemplate <>\n", "file_path": "Source/PsData/Public/Types/PsData_FText.h", "rank": 67, "score": 32786.15433502703 }, { "content": "struct FDataTypeContext<TMap<FString, TSoftClassPtr<T>>> : public FDataTypeContextExtended<TMap<FString, TSoftClassPtr<T>>, UPsDataTSoftClassPtrLibrary>\n\n{\n\n\tvirtual UField* GetUE4Type() const override\n\n\t{\n\n\t\treturn GetClass<T>();\n\n\t}\n\n\n\n\tvirtual bool IsA(const FAbstractDataTypeContext* RightContext) const override\n\n\t{\n\n\t\treturn true; // TODO: check type\n\n\t}\n\n};\n\n\n\ntemplate <typename T>\n", "file_path": "Source/PsData/Public/Types/PsData_TSoftClassPtr.h", "rank": 68, "score": 30939.370349634235 }, { "content": "struct FDataTypeContext<TMap<FString, TSoftObjectPtr<T>>> : public FDataTypeContextExtended<TMap<FString, TSoftObjectPtr<T>>, UPsDataTSoftObjectPtrLibrary>\n\n{\n\n\tvirtual UField* GetUE4Type() const override\n\n\t{\n\n\t\treturn GetClass<T>();\n\n\t}\n\n\n\n\tvirtual bool IsA(const FAbstractDataTypeContext* RightContext) const override\n\n\t{\n\n\t\treturn true; // TODO: check type\n\n\t}\n\n};\n\n\n\ntemplate <typename T>\n", "file_path": "Source/PsData/Public/Types/PsData_TSoftObjectPtr.h", "rank": 69, "score": 30939.370349634235 }, { "content": "\t */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"InRange (BigInteger)\", Min = \"0\", Max = \"10\"), Category = \"Math|BigInteger\")\n\n\tstatic bool InRange(FPsDataBigInteger Value, FPsDataBigInteger Min, FPsDataBigInteger Max, bool InclusiveMin = true, bool InclusiveMax = true);\n\n\n\n\t/** Returns Value clamped to be between A and B (inclusive) */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"Clamp (BigInteger)\"), Category = \"Math|BigInteger\")\n\n\tstatic FPsDataBigInteger Clamp(FPsDataBigInteger Value, FPsDataBigInteger Min, FPsDataBigInteger Max);\n\n\n\n\t/** Returns the absolute (positive) value of A */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"Absolute (BigInteger)\", CompactNodeTitle = \"ABS\"), Category = \"Math|BigInteger\")\n\n\tstatic FPsDataBigInteger Abs(FPsDataBigInteger A);\n\n\n\n\t/** Returns bit value of A */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"Bit (BigInteger)\", CompactNodeTitle = \"BIT\"), Category = \"Math|BigInteger\")\n\n\tstatic bool Bit(FPsDataBigInteger A, int32 BitIndex);\n\n\n\n\t//\n\n\t// BigInteger autocast\n\n\t//\n\n\n", "file_path": "Source/PsData/Public/Types/PsData_FPsDataBigInteger.h", "rank": 70, "score": 29.59440765607977 }, { "content": "\n\n\tauto Temp = *this;\n\n\tconst auto ResultSign = Temp.Abs();\n\n\tconst auto NumBitsInTemp = Temp.GetHighestNonZeroBitIndex() + 1;\n\n\tconst auto MinNumDigitsInTemp = static_cast<int32>(static_cast<float>(NumBitsInTemp) / DigitShift);\n\n\n\n\tint32 PowerOfTen = FMath::Max(MinNumDigitsInTemp - NumDigits, 0);\n\n\tif (PowerOfTen > 0)\n\n\t{\n\n\t\tTemp.Divide(Pow(Ten, PowerOfTen));\n\n\t}\n\n\n\n\twhile (Temp.IsGreaterOrEqual(MaxValue))\n\n\t{\n\n\t\tTemp.Divide(Ten);\n\n\t\t++PowerOfTen;\n\n\t}\n\n\n\n\treturn {Temp.ToInt64() * ResultSign, PowerOfTen};\n\n}\n", "file_path": "Source/PsData/Private/Types/PsDataBigInteger.cpp", "rank": 71, "score": 28.85517125803803 }, { "content": "\n\n\t/** Bitwise NOT (~A) */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"Bitwise NOT\", CompactNodeTitle = \"~\", Keywords = \"~ not\"), Category = \"Math|BigInteger\")\n\n\tstatic FPsDataBigInteger Not(FPsDataBigInteger A);\n\n\n\n\t/** Sign (returns -1 if A < 0, 0 if A is zero, and +1 if A > 0) */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"Sign (BigInteger)\"), Category = \"Math|BigInteger\")\n\n\tstatic FPsDataBigInteger Sign(FPsDataBigInteger A);\n\n\n\n\t/** Returns the minimum value of A and B */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"Min (BigInteger)\", CompactNodeTitle = \"MIN\", CommutativeAssociativeBinaryOperator = \"true\"), Category = \"Math|BigInteger\")\n\n\tstatic FPsDataBigInteger Min(FPsDataBigInteger A, FPsDataBigInteger B);\n\n\n\n\t/** Returns the maximum value of A and B */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"Max (BigInteger)\", CompactNodeTitle = \"MAX\", CommutativeAssociativeBinaryOperator = \"true\"), Category = \"Math|BigInteger\")\n\n\tstatic FPsDataBigInteger Max(FPsDataBigInteger A, FPsDataBigInteger B);\n\n\n\n\t/** Returns true if value is between Min and Max (V >= Min && V <= Max)\n\n\t * If InclusiveMin is true, value needs to be equal or larger than Min, else it needs to be larger\n\n\t * If InclusiveMax is true, value needs to be smaller or equal than Max, else it needs to be smaller\n", "file_path": "Source/PsData/Public/Types/PsData_FPsDataBigInteger.h", "rank": 73, "score": 27.781981836856964 }, { "content": "}\n\n\n\nint32 FPsDataBigInteger::ToInt32() const\n\n{\n\n\tcheck(IsLessOrEqual(MaxInt32) && IsGreaterOrEqual(MinInt32));\n\n\treturn static_cast<int32>(GetWord(0));\n\n}\n\n\n\nint64 FPsDataBigInteger::ToInt64() const\n\n{\n\n\tcheck(IsLessOrEqual(MaxInt64) && IsGreaterOrEqual(MinInt64));\n\n\treturn static_cast<int64>(GetWord(0)) + (static_cast<int64>(GetWord(1)) << NumBitsPerWord);\n\n}\n\n\n\nFPsDataShortBigInteger FPsDataBigInteger::ToShortBigInteger(int32 NumDigits) const\n\n{\n\n\tcheck(NumDigits > 0 && NumDigits < 19);\n\n\n\n\tstatic const auto DigitShift = FMath::Log2(10);\n\n\tconst auto MaxValue = Pow(Ten, NumDigits);\n", "file_path": "Source/PsData/Private/Types/PsDataBigInteger.cpp", "rank": 74, "score": 24.986957984733642 }, { "content": "\t/** Bitwise XOR (A ^ B) */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"Bitwise XOR\", CompactNodeTitle = \"^\", Keywords = \"^ xor\"), Category = \"Math|BigInteger\")\n\n\tstatic FPsDataBigInteger Xor_Int64(FPsDataBigInteger A, int64 B);\n\n\n\n\t/** Bitwise OR (A | B) */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"Bitwise OR\", CompactNodeTitle = \"|\", Keywords = \"| or\"), Category = \"Math|BigInteger\")\n\n\tstatic FPsDataBigInteger Or_Int64(FPsDataBigInteger A, int64 B);\n\n\n\n\t//\n\n\t// PsData functions\n\n\t//\n\n\n\n\t/** Get FPsDataBigInteger property */\n\n\tUFUNCTION(BlueprintPure, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataOut = \"Out\"))\n\n\tstatic void GetProperty(UPsData* Target, int32 Index, FPsDataBigInteger& Out);\n\n\n\n\t/** Set FPsDataBigInteger property */\n\n\tUFUNCTION(BlueprintCallable, CustomThunk, Category = \"PsData|Data\", meta = (PsDataTarget = \"Target\", PsDataIndex = \"Index\", PsDataIn = \"Value\"))\n\n\tstatic void SetProperty(UPsData* Target, int32 Index, const FPsDataBigInteger& Value);\n\n\n", "file_path": "Source/PsData/Public/Types/PsData_FPsDataBigInteger.h", "rank": 75, "score": 23.46680808605945 }, { "content": "}\n\n\n\nbool FPsDataFastJsonDeserializer::ReadObject()\n\n{\n\n\tSkipComma();\n\n\n\n\tconst auto& Pointer = Pointers[PointerIndex];\n\n\tif (Pointer.Token != EPsDataFastJsonToken::OpenObject)\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\n\n\tDepthStack.Push(Pointer.Depth);\n\n\n\n\t++PointerIndex;\n\n\treturn true;\n\n}\n\n\n\nbool FPsDataFastJsonDeserializer::ReadValue(int32& OutValue)\n\n{\n", "file_path": "Source/PsData/Private/Serialize/PsDataFastJsonSerialization.cpp", "rank": 76, "score": 23.12851713305932 }, { "content": "\t/** Returns true if A is less than or equal to B (A <= B) */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"BigInteger <= integer64\", CompactNodeTitle = \"<=\", Keywords = \"<= less\"), Category = \"Math|BigInteger\")\n\n\tstatic bool LessEqual_Int64(FPsDataBigInteger A, int64 B);\n\n\n\n\t/** Returns true if A is greater than or equal to B (A >= B) */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"BigInteger >= integer64\", CompactNodeTitle = \">=\", Keywords = \">= greater\"), Category = \"Math|BigInteger\")\n\n\tstatic bool GreaterEqual_Int64(FPsDataBigInteger A, int64 B);\n\n\n\n\t/** Returns true if A is equal to B (A == B) */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"Equal (BigInteger)\", CompactNodeTitle = \"==\", Keywords = \"== equal\"), Category = \"Math|BigInteger\")\n\n\tstatic bool Equal_Int64(FPsDataBigInteger A, int64 B);\n\n\n\n\t/** Returns true if A is not equal to B (A != B) */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"NotEqual (BigInteger)\", CompactNodeTitle = \"!=\", Keywords = \"!= not equal\"), Category = \"Math|BigInteger\")\n\n\tstatic bool NotEqual_Int64(FPsDataBigInteger A, int64 B);\n\n\n\n\t/** Bitwise AND (A & B) */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"Bitwise AND\", CompactNodeTitle = \"&\", Keywords = \"& and\"), Category = \"Math|BigInteger\")\n\n\tstatic FPsDataBigInteger And_Int64(FPsDataBigInteger A, int64 B);\n\n\n", "file_path": "Source/PsData/Public/Types/PsData_FPsDataBigInteger.h", "rank": 77, "score": 22.75771628163674 }, { "content": "\tSetSignAndNormalize(ResultSign);\n\n\tDividend.SetSignAndNormalize(DividendSign);\n\n\n\n\treturn Dividend;\n\n}\n\n\n\nvoid FPsDataBigInteger::Multiply(FPsDataBigInteger Factor)\n\n{\n\n\tconst auto ResultSign = AbsAndNormalize() * Factor.AbsAndNormalize();\n\n\tconst auto NumWordsA = GetNumWords();\n\n\tconst auto NumWordsB = Factor.GetNumWords();\n\n\n\n\tauto Base = *this;\n\n\t*this = 0;\n\n\n\n\tBase.Reserve(NumWordsA + NumWordsB);\n\n\tReserve(NumWordsA + NumWordsB);\n\n\n\n\tconst auto MaxBitIndex = Factor.GetHighestNonZeroBitIndex();\n\n\tint32 BitIndex = 0;\n", "file_path": "Source/PsData/Private/Types/PsDataBigInteger.cpp", "rank": 78, "score": 22.74965170163214 }, { "content": "\t/** Returns true if A is less than or equal to B (A <= B) */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"BigInteger <= integer\", CompactNodeTitle = \"<=\", Keywords = \"<= less\"), Category = \"Math|BigInteger\")\n\n\tstatic bool LessEqual_Int32(FPsDataBigInteger A, int32 B);\n\n\n\n\t/** Returns true if A is greater than or equal to B (A >= B) */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"BigInteger >= integer\", CompactNodeTitle = \">=\", Keywords = \">= greater\"), Category = \"Math|BigInteger\")\n\n\tstatic bool GreaterEqual_Int32(FPsDataBigInteger A, int32 B);\n\n\n\n\t/** Returns true if A is equal to B (A == B) */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"Equal (BigInteger)\", CompactNodeTitle = \"==\", Keywords = \"== equal\"), Category = \"Math|BigInteger\")\n\n\tstatic bool Equal_Int32(FPsDataBigInteger A, int32 B);\n\n\n\n\t/** Returns true if A is not equal to B (A != B) */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"NotEqual (BigInteger)\", CompactNodeTitle = \"!=\", Keywords = \"!= not equal\"), Category = \"Math|BigInteger\")\n\n\tstatic bool NotEqual_Int32(FPsDataBigInteger A, int32 B);\n\n\n\n\t/** Bitwise AND (A & B) */\n\n\tUFUNCTION(BlueprintPure, meta = (DisplayName = \"Bitwise AND\", CompactNodeTitle = \"&\", Keywords = \"& and\"), Category = \"Math|BigInteger\")\n\n\tstatic FPsDataBigInteger And_Int32(FPsDataBigInteger A, int32 B);\n\n\n", "file_path": "Source/PsData/Public/Types/PsData_FPsDataBigInteger.h", "rank": 79, "score": 22.603226338192044 }, { "content": "\tBase.AbsAndNormalize();\n\n\n\n\tauto Result = One;\n\n\n\n\tconst auto MaxBitIndex = Exp.GetHighestNonZeroBitIndex();\n\n\tint32 BitIndex = 0;\n\n\tint32 Shift = 0;\n\n\twhile (BitIndex <= MaxBitIndex)\n\n\t{\n\n\t\tif (Exp.GetBit(BitIndex))\n\n\t\t{\n\n\t\t\tResult.Multiply(Base);\n\n\t\t}\n\n\n\n\t\tBase.Multiply(Base);\n\n\t\t++BitIndex;\n\n\t}\n\n\n\n\tResult.SetSignAndNormalize(NewSign);\n\n\treturn Result;\n", "file_path": "Source/PsData/Private/Types/PsDataBigInteger.cpp", "rank": 80, "score": 22.2622793428203 }, { "content": "\t{\n\n\t\t*this = Dividend.GetSign() * Divisor.GetSign();\n\n\t\treturn Zero;\n\n\t}\n\n\n\n\tauto LShift = Dividend.GetHighestNonZeroBitIndex() - Divisor.GetHighestNonZeroBitIndex();\n\n\tDivisor.ShiftLeft(LShift);\n\n\n\n\twhile (LShift > -1)\n\n\t{\n\n\t\tif (Dividend >= Divisor)\n\n\t\t{\n\n\t\t\tSetBit(LShift, true);\n\n\t\t\tDividend.Subtract(Divisor);\n\n\t\t}\n\n\n\n\t\tDivisor.ShiftRightByOne();\n\n\t\t--LShift;\n\n\t}\n\n\n", "file_path": "Source/PsData/Private/Types/PsDataBigInteger.cpp", "rank": 81, "score": 21.864696078878914 }, { "content": "\t\treturn;\n\n\t}\n\n\n\n\tauto LShift = Dividend.GetHighestNonZeroBitIndex() - Divisor.GetHighestNonZeroBitIndex();\n\n\tDivisor.ShiftLeft(LShift);\n\n\n\n\twhile (LShift > -1)\n\n\t{\n\n\t\tif (Dividend >= Divisor)\n\n\t\t{\n\n\t\t\tSetBit(LShift, true);\n\n\t\t\tDividend.Subtract(Divisor);\n\n\t\t}\n\n\n\n\t\tDivisor.ShiftRightByOne();\n\n\t\t--LShift;\n\n\t}\n\n\n\n\tSetSignAndNormalize(ResultSign);\n\n}\n", "file_path": "Source/PsData/Private/Types/PsDataBigInteger.cpp", "rank": 83, "score": 21.405560716826432 }, { "content": "\t++PointerIndex;\n\n\treturn true;\n\n}\n\n\n\nbool FPsDataFastJsonDeserializer::ReadValue(FString& OutValue)\n\n{\n\n\tSkipComma();\n\n\n\n\tauto& Pointer = Pointers[PointerIndex];\n\n\tif (Pointer.Token != EPsDataFastJsonToken::Value)\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\n\n\tOutValue = Pointer.GetString(Source);\n\n\tPointer.Reset();\n\n\n\n\t++PointerIndex;\n\n\treturn true;\n\n}\n", "file_path": "Source/PsData/Private/Serialize/PsDataFastJsonSerialization.cpp", "rank": 84, "score": 21.367987316887362 }, { "content": "\treturn *this;\n\n}\n\n\n\nFPsDataBigInteger FPsDataBigInteger::operator~() const\n\n{\n\n\tFPsDataBigInteger Copy = *this;\n\n\tCopy.BitwiseNot();\n\n\treturn Copy;\n\n}\n\n\n\nint32 FPsDataBigInteger::Compare(const FPsDataBigInteger& A, const FPsDataBigInteger& B)\n\n{\n\n\tconst auto SignA = A.GetSign();\n\n\tconst auto SignB = B.GetSign();\n\n\tconst auto Sign = SignA * SignB;\n\n\n\n\tint32 WordIndex = FMath::Max(A.GetNumWords(), B.GetNumWords()) - 1;\n\n\twhile (WordIndex >= 0)\n\n\t{\n\n\t\tconst auto WordA = A.GetWord(WordIndex);\n", "file_path": "Source/PsData/Private/Types/PsDataBigInteger.cpp", "rank": 85, "score": 21.361012363369444 }, { "content": "\t\treturn false;\n\n\t}\n\n\n\n\tOutValue = FCString::Atof(*Value);\n\n\tPointer.Reset();\n\n\n\n\t++PointerIndex;\n\n\treturn true;\n\n}\n\n\n\nbool FPsDataFastJsonDeserializer::ReadValue(bool& OutValue)\n\n{\n\n\tSkipComma();\n\n\n\n\tauto& Pointer = Pointers[PointerIndex];\n\n\tif (Pointer.Token != EPsDataFastJsonToken::Value)\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\n", "file_path": "Source/PsData/Private/Serialize/PsDataFastJsonSerialization.cpp", "rank": 86, "score": 21.338999742170216 }, { "content": "\t\t--BitIndex;\n\n\t}\n\n\treturn BitIndex;\n\n}\n\n\n\nint32 FPsDataBigInteger::GetHighestNonZeroBitIndex() const\n\n{\n\n\tint32 WordIndex = Words.Num() - 1;\n\n\twhile (WordIndex > 0 && Words[WordIndex] == 0)\n\n\t{\n\n\t\t--WordIndex;\n\n\t}\n\n\n\n\tconst auto BitIndex = GetHighestNonZeroBitIndexInWord(WordIndex);\n\n\treturn NumBitsPerWord * WordIndex + BitIndex;\n\n}\n\n\n\nbool FPsDataBigInteger::IsZero() const\n\n{\n\n\treturn Words[0] == 0 && GetActualNumWords() == 1;\n", "file_path": "Source/PsData/Private/Types/PsDataBigInteger.cpp", "rank": 87, "score": 20.897976257276643 }, { "content": "\t\t}\n\n\t\telse\n\n\t\t{\n\n\t\t\tif (Tokens[Index].c != *Pattern)\n\n\t\t\t{\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\tPattern += 1;\n\n\t\t++Index;\n\n\t}\n\n\treturn true;\n\n}\n\n\n\nvoid ParseMetaPair(FDataField* Field, const char* Key, int32 KeySize, const char* Value, int32 ValueSize)\n\n{\n\n\tbool bError = false;\n\n\tif (Equal(Key, EDataMetaType::Strict))\n\n\t{\n\n\t\tensureMsgf(Value == nullptr, TEXT(\"Unused value!\"));\n", "file_path": "Source/PsData/Private/PsDataField.cpp", "rank": 88, "score": 20.860822985539865 }, { "content": "\t{\n\n\t\treturn GetExtraWord();\n\n\t}\n\n\n\n\treturn Words[WordIndex];\n\n}\n\n\n\nbool FPsDataBigInteger::GetBit(int32 BitIndex) const\n\n{\n\n\tconst auto WordIndex = BitIndex / NumBitsPerWord;\n\n\tconst auto WordBitIndex = BitIndex % NumBitsPerWord;\n\n\treturn (GetWord(WordIndex) >> WordBitIndex) & 0x1;\n\n}\n\n\n\nint32 FPsDataBigInteger::GetHighestNonZeroBitIndexInWord(int32 WordIndex) const\n\n{\n\n\tconst auto Word = GetWord(WordIndex);\n\n\tint32 BitIndex = NumBitsPerWord - 1;\n\n\twhile (BitIndex > 0 && (Word & (1 << BitIndex)) == 0)\n\n\t{\n", "file_path": "Source/PsData/Private/Types/PsDataBigInteger.cpp", "rank": 89, "score": 20.605934460271683 }, { "content": "\n\nvoid FPsDataBigInteger::SetBit(int32 BitIndex, bool bNewValue)\n\n{\n\n\tconst auto WordIndex = BitIndex / NumBitsPerWord;\n\n\tconst auto WordBitIndex = BitIndex % NumBitsPerWord;\n\n\tAllocate(WordIndex + 2);\n\n\n\n\tconst PsDataBigIntegerWordType Mask = (1 << WordBitIndex);\n\n\tif (bNewValue)\n\n\t{\n\n\t\tWords[WordIndex] |= Mask;\n\n\t}\n\n\telse\n\n\t{\n\n\t\tWords[WordIndex] &= ~Mask;\n\n\t}\n\n}\n\n\n\nvoid FPsDataBigInteger::SetSign(int32 NewSign)\n\n{\n", "file_path": "Source/PsData/Private/Types/PsDataBigInteger.cpp", "rank": 90, "score": 20.408652470378623 }, { "content": "\t++PointerIndex;\n\n\treturn true;\n\n}\n\n\n\nbool FPsDataFastJsonDeserializer::ReadValue(uint8& OutValue)\n\n{\n\n\tSkipComma();\n\n\n\n\tauto& Pointer = Pointers[PointerIndex];\n\n\tif (Pointer.Token != EPsDataFastJsonToken::Value)\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\n\n\tconst FString& Value = Pointer.GetString(Source);\n\n\tif (!Value.IsNumeric())\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\n", "file_path": "Source/PsData/Private/Serialize/PsDataFastJsonSerialization.cpp", "rank": 91, "score": 20.158234619235166 }, { "content": "\t\t\t\tconst bool bIsConstSelfContext = Context.IsConstFunction();\n\n\t\t\t\tconst bool bIsNonConstFunction = !Function->HasAnyFunctionFlags(FUNC_Const | FUNC_Static);\n\n\t\t\t\tconst bool bEnforceConstCorrectness = Context.EnforceConstCorrectness();\n\n\t\t\t\tauto CheckAndAddSelfTermLambda = [this, &Node, &ContextTerms, bIsConstSelfContext, bIsNonConstFunction, bEnforceConstCorrectness](FBPTerminal* Target) {\n\n\t\t\t\t\tbool bIsSelfTerm = true;\n\n\t\t\t\t\tif (Target != nullptr)\n\n\t\t\t\t\t{\n\n\t\t\t\t\t\tconst UEdGraphPin* SourcePin = Target->SourcePin;\n\n\t\t\t\t\t\tbIsSelfTerm = (SourcePin == nullptr || CompilerContext.GetSchema()->IsSelfPin(*SourcePin));\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif (bIsSelfTerm && bIsConstSelfContext && bIsNonConstFunction)\n\n\t\t\t\t\t{\n\n\t\t\t\t\t\tif (Target != nullptr)\n\n\t\t\t\t\t\t{\n\n\t\t\t\t\t\t\tif (bEnforceConstCorrectness)\n\n\t\t\t\t\t\t\t{\n\n\t\t\t\t\t\t\t\tCompilerContext.MessageLog.Error(*LOCTEXT(\"NonConstFunctionCallOnReadOnlyTarget_Error\", \"Function @@ can modify state and cannot be called on @@ because it is a read-only Target in this context\").ToString(), Node, Target->Source);\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\telse\n\n\t\t\t\t\t\t\t{\n", "file_path": "Source/PsDataEditor/Private/PsDataCallFunctionHandler.cpp", "rank": 92, "score": 20.05809035463352 }, { "content": "\tconst auto NumWords = (Size / WordNumShifts) + 1;\n\n\tconst auto LastCharIndex = Size - 1;\n\n\n\n\tFPsDataBigInteger Result;\n\n\tResult.Reserve(NumWords);\n\n\n\n\tint64 Value = 0;\n\n\tint64 Factor = 1;\n\n\tint32 NumDotForSkip = (bSkipDot ? 1 : 0);\n\n\n\n\tfor (int32 i = 0; i < Size; ++i)\n\n\t{\n\n\t\tconst auto Char = Array[i];\n\n\t\tif (NumDotForSkip > 0 && Utils::IsDot(Char))\n\n\t\t{\n\n\t\t\t--NumDotForSkip;\n\n\t\t\tcontinue;\n\n\t\t}\n\n\n\n\t\tconst auto Digit = Utils::CharToWord(Char);\n", "file_path": "Source/PsData/Private/Types/PsDataBigInteger.cpp", "rank": 93, "score": 19.97782945565545 }, { "content": "\tOutValue = FCString::Atoi(*Value);\n\n\tPointer.Reset();\n\n\n\n\t++PointerIndex;\n\n\treturn true;\n\n}\n\n\n\nbool FPsDataFastJsonDeserializer::ReadValue(float& OutValue)\n\n{\n\n\tSkipComma();\n\n\n\n\tauto& Pointer = Pointers[PointerIndex];\n\n\tif (Pointer.Token != EPsDataFastJsonToken::Value)\n\n\t{\n\n\t\treturn false;\n\n\t}\n\n\n\n\tconst FString& Value = Pointer.GetString(Source);\n\n\tif (!Value.IsNumeric())\n\n\t{\n", "file_path": "Source/PsData/Private/Serialize/PsDataFastJsonSerialization.cpp", "rank": 94, "score": 19.801173990500594 }, { "content": "\t}\n\n\n\n\treturn 1;\n\n}\n\n\n\nint32 FPsDataBigInteger::AbsAndNormalize()\n\n{\n\n\tconst auto Sign = Abs();\n\n\tNormalize();\n\n\treturn Sign;\n\n}\n\n\n\nvoid FPsDataBigInteger::Add(const FPsDataBigInteger& Value)\n\n{\n\n\tconst auto NumWords = FMath::Max(GetNumWords(), Value.GetNumWords()) + 1;\n\n\tAllocate(NumWords);\n\n\n\n\tint64 Memory = 0;\n\n\tfor (int32 i = 0; i < NumWords; ++i)\n\n\t{\n", "file_path": "Source/PsData/Private/Types/PsDataBigInteger.cpp", "rank": 95, "score": 19.801143416251975 }, { "content": "\t\tauto EnumJsonPtr = MakeShared<FJsonObject>();\n\n\t\tEnumJsonPtr->SetStringField(TEXT(\"Name\"), EnumName);\n\n\n\n\t\tTArray<TSharedPtr<FJsonValue>> Values;\n\n\t\tfor (int32 idx = 0;; ++idx)\n\n\t\t{\n\n\t\t\tconst FString SValue = DataEnum->GetNameStringByIndex(idx);\n\n\t\t\tif (SValue == TEXT(\"\"))\n\n\t\t\t\tbreak;\n\n\n\n\t\t\tconst int64 IValue = DataEnum->GetValueByIndex(idx);\n\n\t\t\tif (IValue == DataEnum->GetMaxEnumValue())\n\n\t\t\t\tcontinue;\n\n\n\n\t\t\tUE_LOG(LogData, Log, TEXT(\"%s '%s' value %s=%d\"), *PS_FUNC_LINE, *EnumName, *SValue, IValue);\n\n\n\n\t\t\tauto ValuePtr = MakeShared<FJsonObject>();\n\n\t\t\tValuePtr->SetStringField(\"Name\", SValue);\n\n\t\t\tValuePtr->SetNumberField(\"Value\", IValue);\n\n\t\t\tValues.Add(MakeShared<FJsonValueObject>(ValuePtr));\n", "file_path": "Source/PsData/Private/Serialize/PsDataSchemaJson.cpp", "rank": 96, "score": 19.73363995555725 }, { "content": "\tconst int32 NumOfCases = 500;\n\n\n\n\tTArray<int64> Int64s;\n\n\tTArray<FPsDataBigInteger> BigInts;\n\n\tTArray<FString> HexStrings;\n\n\tTArray<FString> DecStrings;\n\n\n\n\tfor (int32 i = 0; i < NumOfCases; ++i)\n\n\t{\n\n\t\tInt64s.Add(FMath::RandBool() ? TestUtils::RandInt64() : TestUtils::RandInt());\n\n\t\tBigInts.Add(Random(200 * FMath::FRand()));\n\n\t\tHexStrings.Add(TestUtils::RandString(100, 16));\n\n\t\tDecStrings.Add(TestUtils::RandString(100, 10));\n\n\t}\n\n\n\n\tstd::initializer_list<int64> InterestingCases = {MAX_int32, MIN_int32, MAX_int64, MIN_int64, 0, 1, 2, -1, -2};\n\n\n\n\tTestUtils::AddToArray(Int64s, 20, InterestingCases);\n\n\tTestUtils::AddToArray(BigInts, 20, InterestingCases);\n\n\tTestUtils::AddToArray(HexStrings, 20, 16, InterestingCases);\n", "file_path": "Source/PsData/Private/Types/PsDataBigInteger.cpp", "rank": 97, "score": 19.64858847393926 }, { "content": "\n\n\tfor (int32 i = StartPosition; i < StartPosition + Count; ++i)\n\n\t{\n\n\t\tauto const c = String[i];\n\n\t\tbool bAppended = false;\n\n\t\tfor (int32 j = 0; j < MaxSupportedEscapeChars; ++j)\n\n\t\t{\n\n\t\t\tif (c == CharToEscape[j])\n\n\t\t\t{\n\n\t\t\t\tResult.AppendChar('\\\\');\n\n\t\t\t\tResult.AppendChar(EscapedChars[j]);\n\n\t\t\t\tbAppended = true;\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\n\n\t\tif (!bAppended)\n\n\t\t{\n\n\t\t\tResult.AppendChar(c);\n\n\t\t}\n", "file_path": "Source/PsData/Private/Serialize/PsDataFastJsonSerialization.cpp", "rank": 98, "score": 19.57242588787092 }, { "content": "\tconst uint32 Value = ReadUint32();\n\n\treturn *reinterpret_cast<const float*>(&Value);\n\n}\n\n\n\nbool FPsDataBufferInputStream::ReadBool()\n\n{\n\n\tconst auto b0 = ReadUint8();\n\n\treturn b0 == 0x01;\n\n}\n\n\n\nTCHAR FPsDataBufferInputStream::ReadTCHAR()\n\n{\n\n\tconst auto Codepoint = ReadUint32();\n\n\treturn static_cast<TCHAR>(Codepoint);\n\n}\n\n\n\nFString FPsDataBufferInputStream::ReadString()\n\n{\n\n\tconst int32 RealPrevIndex = Index;\n\n\tconst uint32 Len = ReadUint32();\n", "file_path": "Source/PsData/Private/Serialize/Stream/PsDataBufferInputStream.cpp", "rank": 99, "score": 19.5300100478661 } ]
C++
include/natpp/detail/impl/natpmp_service.ipp
mandreyel/nat-
4f4ab3b1f59f389ea3e38ca7d5589073fd4e3ffa
#ifndef NATPP_NATPMP_SERVICE_IMPL #define NATPP_NATPMP_SERVICE_IMPL #include "../natpmp_service.hpp" #include "../../gateway.hpp" #include <cassert> #include <endian/endian.hpp> #include <asio/socket_base.hpp> #include <asio/buffer.hpp> namespace nat { namespace detail { enum opcode { public_address = 0, udp_mapping = 1, tcp_mapping = 2, }; natpmp_service::natpmp_service(asio::io_context& ios) : asio::io_context::service(ios) , socket_(ios) { error_code ec; auto gateway_address = default_gateway_address(ec); gateway_endpoint_ = asio::ip::udp::endpoint(gateway_address, 5351); socket_.connect(gateway_endpoint_, ec); if(ec) { socket_.close(ec); return; } socket_.set_option(asio::ip::udp::socket::reuse_address(true), ec); if(ec) { socket_.close(ec); return; } } void natpmp_service::shutdown() { } inline asio::const_buffer prep_public_address_request_message(char* buffer) { buffer[0] = 0; buffer[1] = 0; return asio::buffer(buffer, 2); } inline void verify_response_header(const char* buffer, int opcode, error_code& error) { const auto errc = endian::read<endian::order::network, uint16_t>(&buffer[2]); if(errc > 5) { error = make_error_code(error::natpmp::unknown_error); } else { error = make_error_code(static_cast<error::natpmp>(errc)); } if(error) { return; } if(buffer[0] != 0) { error = make_error_code(error::natpmp::unsupported_version); return; } if(static_cast<uint8_t>(buffer[1]) != 128 + opcode) { error = make_error_code(error::natpmp::invalid_opcode); return; } } inline asio::ip::address parse_public_address_response( const char* buffer, error_code& error) { verify_response_header(buffer, opcode::public_address, error); if(error) { return {}; } return asio::ip::address_v4(endian::read<endian::order::network, uint32_t>(&buffer[8])); } asio::ip::address natpmp_service::public_address( implementation_type& impl, error_code& error) { error = error_code(); if(public_address_ != asio::ip::address()) { return public_address_; } if(pending_requests_.empty()) { const auto num_sent = socket_.send( prep_public_address_request_message(send_buffer_.data()), 0, error); if(error) { return {}; } if(num_sent < 2) { error = std::make_error_code(std::errc::bad_message); return {}; } const auto num_received = socket_.receive(asio::buffer(receive_buffer_), 0, error); if(error) { return {}; } if(num_received < 12) { error = std::make_error_code(std::errc::bad_message); return {}; } error = error_code(); return parse_public_address_response(receive_buffer_.data(), error); } else { error = make_error_code(asio::error::try_again); return {}; } } void natpmp_service::async_public_address_impl() { socket_.async_send(prep_public_address_request_message(send_buffer_.data()), [this](const auto& error, const auto num_sent) { if(!error && num_sent == 2) { return; } auto request = pop_current_request<address_request>(); if(error) { request.handler(error, {}); } else if(num_sent != 2) { request.handler(std::make_error_code(std::errc::bad_message), {}); } if(!pending_requests_.empty()) { execute_request(); } }); socket_.async_receive(asio::buffer(receive_buffer_), [this](auto error, const auto num_received) { auto request = pop_current_request<address_request>(); if(error) { request.handler(error, {}); return; } else if(num_received < 12) { request.handler(std::make_error_code(std::errc::bad_message), {}); return; } request.handler(error, parse_public_address_response( receive_buffer_.data(), error)); if(!pending_requests_.empty()) { execute_request(); } }); } template<typename Handler> void natpmp_service::async_public_address(implementation_type& impl, Handler handler) { if(public_address_ != asio::ip::address()) { asio::post(socket_.get_executor(), [handler = std::move(handler), addr = public_address_] { handler({}, addr); }); } else { pending_requests_.emplace_back(pending_request{ address_request{std::move(handler)}, impl}); if(pending_requests_.size() == 1) { async_public_address_impl(); } } } inline asio::const_buffer prep_mapping_request_message( char* buffer, const port_mapping& mapping) { buffer[0] = 0; if(mapping.type == port_mapping::udp) { buffer[1] = opcode::udp_mapping; } else { buffer[1] = opcode::tcp_mapping; } buffer[2] = 0; buffer[3] = 0; endian::write<endian::order::network, uint16_t>(mapping.private_port, &buffer[4]); endian::write<endian::order::network, uint16_t>(mapping.public_port, &buffer[6]); endian::write<endian::order::network, uint32_t>(mapping.duration.count(), &buffer[8]); return asio::buffer(buffer, 12); } inline port_mapping parse_mapping_response(const char* buffer, int opcode, error_code& error) { verify_response_header(buffer, opcode, error); if(error) { return {}; } port_mapping mapping; mapping.private_port = endian::read<endian::order::network, uint16_t>(&buffer[8]); mapping.public_port = endian::read<endian::order::network, uint16_t>(&buffer[10]); mapping.duration = std::chrono::seconds( endian::read<endian::order::network, uint32_t>(&buffer[12])); return mapping; } port_mapping natpmp_service::request_mapping(implementation_type& impl, const port_mapping& request, error_code& error) { if(pending_requests_.empty()) { error = error_code(); const auto num_sent = socket_.send(prep_mapping_request_message( send_buffer_.data(), request), 0, error); if(error) { return {}; } if(num_sent < 12) { error = std::make_error_code(std::errc::bad_message); return {}; } const auto num_received = socket_.receive(asio::buffer(receive_buffer_), 0, error); if(error) { return {}; } if(num_received < 12) { error = std::make_error_code(std::errc::bad_message); return {}; } auto mapping = parse_mapping_response(receive_buffer_.data(), request.type == port_mapping::udp ? opcode::udp_mapping : opcode::tcp_mapping, error); if(!error) { impl.mappings.push_back(mapping); } return mapping; } else { error = make_error_code(asio::error::try_again); return {}; } } void natpmp_service::async_request_mapping_impl() { assert(!pending_requests_.empty()); assert(std::holds_alternative<mapping_request>(pending_requests_.front().data)); const auto& request = std::get<mapping_request>(pending_requests_.front().data); socket_.async_send(prep_mapping_request_message( send_buffer_.data(), request.mapping), [this](const auto& error, const auto num_sent) { if(!error && num_sent == 12) { return; } auto request = pop_current_request<mapping_request>(); if(error) { request.handler(error, {}); } else if(num_sent != 12) { request.handler(std::make_error_code(std::errc::bad_message), {}); } if(!pending_requests_.empty()) { execute_request(); } }); socket_.async_receive(asio::buffer(receive_buffer_), [this](auto error, const auto num_received) { assert(!pending_requests_.empty()); auto& impl = pending_requests_.front().impl; auto request = pop_current_request<mapping_request>(); if(error) { request.handler(error, {}); return; } else if(num_received < 12) { request.handler(std::make_error_code(std::errc::bad_message), {}); return; } auto mapping = parse_mapping_response(receive_buffer_.data(), request.mapping.type == port_mapping::udp ? opcode::udp_mapping : opcode::tcp_mapping, error); if(!error) { impl.mappings.push_back(mapping); } request.handler(error, mapping); if(!pending_requests_.empty()) { execute_request(); } }); } template<typename Handler> void natpmp_service::async_request_mapping(implementation_type& impl, const port_mapping& mapping, Handler handler) { pending_requests_.emplace_back(pending_request{mapping_request{mapping, std::move(handler)}, impl}); if(pending_requests_.size() == 1) { async_public_address_impl(); } } void natpmp_service::async_remove_mapping_impl() { async_request_mapping_impl(); } void natpmp_service::remove_mapping(implementation_type& impl, const port_mapping& mapping, error_code& error) { auto request = mapping; request.duration = std::chrono::seconds(0); request.public_port = 0; request_mapping(impl, request, error); } template<typename Handler> void natpmp_service::async_remove_mapping(implementation_type& impl, const port_mapping& mapping, Handler handler) { auto request = mapping; request.duration = std::chrono::seconds(0); request.public_port = 0; async_request_mapping(impl, request, std::move(handler)); } void natpmp_service::execute_request() { assert(!pending_requests_.empty()); const auto& curr_req = pending_requests_.front(); if(std::holds_alternative<address_request>(curr_req.data)) { async_public_address_impl(); } else { const auto& request = std::get<mapping_request>(curr_req.data); if(is_remove_mapping_request(request.mapping)) { async_remove_mapping_impl(); } else { async_request_mapping_impl(); } } } template<typename Request> Request natpmp_service::pop_current_request() { assert(!pending_requests_.empty()); auto curr_req = std::move(pending_requests_.front()); pending_requests_.pop_front(); assert(std::holds_alternative<Request>(curr_req.data)); return std::move(std::get<Request>(curr_req.data)); } } } #endif
#ifndef NATPP_NATPMP_SERVICE_IMPL #define NATPP_NATPMP_SERVICE_IMPL #include "../natpmp_service.hpp" #include "../../gateway.hpp" #include <cassert> #include <endian/endian.hpp> #include <asio/socket_base.hpp> #include <asio/buffer.hpp> namespace nat { namespace detail { enum opcode { public_address = 0, udp_mapping = 1, tcp_mapping = 2, }; natpmp_service::natpmp_service(asio::io_context& ios) : asio::io_context::service(ios) , socket_(ios) { error_code ec; auto gateway_address = default_gateway_address(ec); gateway_endpoint_ = asio::ip::udp::endpoint(gateway_address, 5351); socket_.connect(gateway_endpoint_, ec); if(ec) { socket_.close(ec); return; } socket_.set_option(asio::ip::udp::socket::reuse_address(true), ec); if(ec) { socket_.close(ec); return; } } void natpmp_service::shutdown() { } inline asio::const_buffer prep_public_address_request_message(char* buffer) { buffer[0] = 0; buffer[1] = 0; return asio::buffer(buffer, 2); } inline void verify_response_header(const char* buffer, int opcode, error_code& error) { const auto errc = endian::read<endian::order::network, uint16_t>(&buffer[2]); if(errc > 5) { error = make_error_code(error::natpmp::unknown_error); } else { error = make_error_code(static_cast<error::natpmp>(errc)); } if(error) { return; } if(buffer[0] != 0) { error = make_error_code(error::natpmp::unsupported_version); return; }
} inline asio::ip::address parse_public_address_response( const char* buffer, error_code& error) { verify_response_header(buffer, opcode::public_address, error); if(error) { return {}; } return asio::ip::address_v4(endian::read<endian::order::network, uint32_t>(&buffer[8])); } asio::ip::address natpmp_service::public_address( implementation_type& impl, error_code& error) { error = error_code(); if(public_address_ != asio::ip::address()) { return public_address_; } if(pending_requests_.empty()) { const auto num_sent = socket_.send( prep_public_address_request_message(send_buffer_.data()), 0, error); if(error) { return {}; } if(num_sent < 2) { error = std::make_error_code(std::errc::bad_message); return {}; } const auto num_received = socket_.receive(asio::buffer(receive_buffer_), 0, error); if(error) { return {}; } if(num_received < 12) { error = std::make_error_code(std::errc::bad_message); return {}; } error = error_code(); return parse_public_address_response(receive_buffer_.data(), error); } else { error = make_error_code(asio::error::try_again); return {}; } } void natpmp_service::async_public_address_impl() { socket_.async_send(prep_public_address_request_message(send_buffer_.data()), [this](const auto& error, const auto num_sent) { if(!error && num_sent == 2) { return; } auto request = pop_current_request<address_request>(); if(error) { request.handler(error, {}); } else if(num_sent != 2) { request.handler(std::make_error_code(std::errc::bad_message), {}); } if(!pending_requests_.empty()) { execute_request(); } }); socket_.async_receive(asio::buffer(receive_buffer_), [this](auto error, const auto num_received) { auto request = pop_current_request<address_request>(); if(error) { request.handler(error, {}); return; } else if(num_received < 12) { request.handler(std::make_error_code(std::errc::bad_message), {}); return; } request.handler(error, parse_public_address_response( receive_buffer_.data(), error)); if(!pending_requests_.empty()) { execute_request(); } }); } template<typename Handler> void natpmp_service::async_public_address(implementation_type& impl, Handler handler) { if(public_address_ != asio::ip::address()) { asio::post(socket_.get_executor(), [handler = std::move(handler), addr = public_address_] { handler({}, addr); }); } else { pending_requests_.emplace_back(pending_request{ address_request{std::move(handler)}, impl}); if(pending_requests_.size() == 1) { async_public_address_impl(); } } } inline asio::const_buffer prep_mapping_request_message( char* buffer, const port_mapping& mapping) { buffer[0] = 0; if(mapping.type == port_mapping::udp) { buffer[1] = opcode::udp_mapping; } else { buffer[1] = opcode::tcp_mapping; } buffer[2] = 0; buffer[3] = 0; endian::write<endian::order::network, uint16_t>(mapping.private_port, &buffer[4]); endian::write<endian::order::network, uint16_t>(mapping.public_port, &buffer[6]); endian::write<endian::order::network, uint32_t>(mapping.duration.count(), &buffer[8]); return asio::buffer(buffer, 12); } inline port_mapping parse_mapping_response(const char* buffer, int opcode, error_code& error) { verify_response_header(buffer, opcode, error); if(error) { return {}; } port_mapping mapping; mapping.private_port = endian::read<endian::order::network, uint16_t>(&buffer[8]); mapping.public_port = endian::read<endian::order::network, uint16_t>(&buffer[10]); mapping.duration = std::chrono::seconds( endian::read<endian::order::network, uint32_t>(&buffer[12])); return mapping; } port_mapping natpmp_service::request_mapping(implementation_type& impl, const port_mapping& request, error_code& error) { if(pending_requests_.empty()) { error = error_code(); const auto num_sent = socket_.send(prep_mapping_request_message( send_buffer_.data(), request), 0, error); if(error) { return {}; } if(num_sent < 12) { error = std::make_error_code(std::errc::bad_message); return {}; } const auto num_received = socket_.receive(asio::buffer(receive_buffer_), 0, error); if(error) { return {}; } if(num_received < 12) { error = std::make_error_code(std::errc::bad_message); return {}; } auto mapping = parse_mapping_response(receive_buffer_.data(), request.type == port_mapping::udp ? opcode::udp_mapping : opcode::tcp_mapping, error); if(!error) { impl.mappings.push_back(mapping); } return mapping; } else { error = make_error_code(asio::error::try_again); return {}; } } void natpmp_service::async_request_mapping_impl() { assert(!pending_requests_.empty()); assert(std::holds_alternative<mapping_request>(pending_requests_.front().data)); const auto& request = std::get<mapping_request>(pending_requests_.front().data); socket_.async_send(prep_mapping_request_message( send_buffer_.data(), request.mapping), [this](const auto& error, const auto num_sent) { if(!error && num_sent == 12) { return; } auto request = pop_current_request<mapping_request>(); if(error) { request.handler(error, {}); } else if(num_sent != 12) { request.handler(std::make_error_code(std::errc::bad_message), {}); } if(!pending_requests_.empty()) { execute_request(); } }); socket_.async_receive(asio::buffer(receive_buffer_), [this](auto error, const auto num_received) { assert(!pending_requests_.empty()); auto& impl = pending_requests_.front().impl; auto request = pop_current_request<mapping_request>(); if(error) { request.handler(error, {}); return; } else if(num_received < 12) { request.handler(std::make_error_code(std::errc::bad_message), {}); return; } auto mapping = parse_mapping_response(receive_buffer_.data(), request.mapping.type == port_mapping::udp ? opcode::udp_mapping : opcode::tcp_mapping, error); if(!error) { impl.mappings.push_back(mapping); } request.handler(error, mapping); if(!pending_requests_.empty()) { execute_request(); } }); } template<typename Handler> void natpmp_service::async_request_mapping(implementation_type& impl, const port_mapping& mapping, Handler handler) { pending_requests_.emplace_back(pending_request{mapping_request{mapping, std::move(handler)}, impl}); if(pending_requests_.size() == 1) { async_public_address_impl(); } } void natpmp_service::async_remove_mapping_impl() { async_request_mapping_impl(); } void natpmp_service::remove_mapping(implementation_type& impl, const port_mapping& mapping, error_code& error) { auto request = mapping; request.duration = std::chrono::seconds(0); request.public_port = 0; request_mapping(impl, request, error); } template<typename Handler> void natpmp_service::async_remove_mapping(implementation_type& impl, const port_mapping& mapping, Handler handler) { auto request = mapping; request.duration = std::chrono::seconds(0); request.public_port = 0; async_request_mapping(impl, request, std::move(handler)); } void natpmp_service::execute_request() { assert(!pending_requests_.empty()); const auto& curr_req = pending_requests_.front(); if(std::holds_alternative<address_request>(curr_req.data)) { async_public_address_impl(); } else { const auto& request = std::get<mapping_request>(curr_req.data); if(is_remove_mapping_request(request.mapping)) { async_remove_mapping_impl(); } else { async_request_mapping_impl(); } } } template<typename Request> Request natpmp_service::pop_current_request() { assert(!pending_requests_.empty()); auto curr_req = std::move(pending_requests_.front()); pending_requests_.pop_front(); assert(std::holds_alternative<Request>(curr_req.data)); return std::move(std::get<Request>(curr_req.data)); } } } #endif
if(static_cast<uint8_t>(buffer[1]) != 128 + opcode) { error = make_error_code(error::natpmp::invalid_opcode); return; }
if_condition
[ { "content": "enum class natpmp\n\n{\n\n unsupported_version = 1,\n\n // E.g. box supports mapping but user has turned feature off.\n\n unauthorized = 2,\n\n // E.g. box hasn't obtained a DHCP lease.\n\n network_failure = 3,\n\n // Box cannot create any more mappings at this time.\n\n out_of_resources = 4,\n\n invalid_opcode = 5,\n\n unknown_error\n\n};\n\n\n", "file_path": "include/natpp/error.hpp", "rank": 0, "score": 53036.430327555885 }, { "content": "struct natpmp_error_category : public nat::error_category\n\n{\n\n const char* name() const noexcept override { return \"natpmp\"; }\n\n std::string message(int ev) const override\n\n {\n\n // FIXME this method invocation segfaults o.O\n\n if(ev > static_cast<std::underlying_type<natpmp>::type>(natpmp::invalid_opcode))\n\n return {};\n\n switch(static_cast<natpmp>(ev)) {\n\n case natpmp::unsupported_version: return \"Unsupported version\";\n\n case natpmp::unauthorized: return \"Unauthorized\";\n\n case natpmp::network_failure: return \"Network failure\";\n\n case natpmp::out_of_resources: return \"Out of resources\";\n\n case natpmp::invalid_opcode: return \"Invalid opcode\";\n\n default: return \"Unknown\";\n\n }\n\n return {};\n\n }\n\n};\n\n\n", "file_path": "include/natpp/error.hpp", "rank": 1, "score": 51371.31995431202 }, { "content": "struct natpmp : public asio::basic_io_object<detail::natpmp_service>\n\n{\n\n /**\n\n * Constructs a natpmp object.\n\n *\n\n * @param io_context The io_context object that the datagram socket will use\n\n * to dispatch handlers for any asynchronous operations performed on this\n\n * object.\n\n */\n\n explicit natpmp(asio::io_context& io_context)\n\n : asio::basic_io_object<detail::natpmp_service>(io_context)\n\n {}\n\n\n\n /** Returns the default gateway address of this host. */\n\n asio::ip::address gateway_address()\n\n {\n\n return this->get_service().gateway_address(this->get_implementation());\n\n }\n\n\n\n /**\n", "file_path": "include/natpp/natpmp.hpp", "rank": 2, "score": 37659.020060788556 }, { "content": "struct natpmp_service : public asio::io_context::service\n\n{\n\n /**\n\n * @brief Data for each @ref nat::natpmp instance.\n\n *\n\n * Holds all currently active mappings of the client.\n\n */\n\n struct natpmp_client\n\n {\n\n std::vector<port_mapping> mappings;\n\n };\n\n\n\n using implementation_type = natpmp_client;\n\n\n\n static asio::execution_context::id id;\n\n\n\nprivate:\n\n asio::ip::udp::socket socket_;\n\n\n\n // After the first invocation of `public_address` or `async_public_address`,\n", "file_path": "include/natpp/detail/natpmp_service.hpp", "rank": 3, "score": 30822.624910794737 }, { "content": "inline const natpmp_error_category& get_natpmp_error_category()\n\n{\n\n static natpmp_error_category instance;\n\n return instance;\n\n}\n\n\n\n} // error\n\n\n\ninline error_code make_error_code(error::natpmp ec)\n\n{\n\n return error_code(static_cast<int>(ec), error::get_natpmp_error_category());\n\n}\n\n\n\n} // nat\n\n\n\nnamespace std {\n\ntemplate<> struct is_error_code_enum<nat::error::natpmp> : public true_type {};\n\n} // std\n\n\n\n#endif // NATPP_NATPMP_ERROR_HEADER\n", "file_path": "include/natpp/error.hpp", "rank": 4, "score": 29228.17215887513 }, { "content": "#ifndef NATPP_NATPMP_ERROR_HEADER\n\n#define NATPP_NATPMP_ERROR_HEADER\n\n\n\n#include <type_traits>\n\n#include <string>\n\n\n\n#include <asio/error.hpp>\n\n\n\nnamespace nat {\n\n\n\nusing asio::error_code;\n\nusing asio::error_category;\n\n\n\nnamespace error {\n\n\n", "file_path": "include/natpp/error.hpp", "rank": 5, "score": 29224.615474478356 }, { "content": "#ifndef NATPP_NATPMP_SERVICE_HEADER\n\n#define NATPP_NATPMP_SERVICE_HEADER\n\n\n\n#include \"../port_mapping.hpp\"\n\n#include \"../error.hpp\"\n\n\n\n#include <functional>\n\n#include <vector>\n\n#include <deque>\n\n#include <array>\n\n#include <variant>\n\n\n\n#include <asio/async_result.hpp>\n\n#include <asio/ip/address.hpp>\n\n#include <asio/ip/udp.hpp>\n\n#include <asio/buffer.hpp>\n\n\n\nnamespace asio { class io_context; } // asio\n\n\n\nnamespace nat {\n", "file_path": "include/natpp/detail/natpmp_service.hpp", "rank": 6, "score": 25084.906311785377 }, { "content": " template<typename Request>\n\n Request pop_current_request();\n\n};\n\n\n\ninline asio::execution_context::id natpmp_service::id;\n\n\n\n} // detail\n\n} // nat\n\n\n\n#include \"impl/natpmp_service.ipp\"\n\n\n\n#endif // NATPP_NATPMP_SERVICE_HEADER\n", "file_path": "include/natpp/detail/natpmp_service.hpp", "rank": 7, "score": 25082.595780647804 }, { "content": " struct pending_request\n\n {\n\n std::variant<address_request, mapping_request> data;\n\n implementation_type& impl;\n\n };\n\n\n\n // This client is in effect synchronous in that only a single outstanding\n\n // request to gateway may exist at any given time, and the rest are queued\n\n // up.\n\n //\n\n // The currently executed request is the first item of the queue and is only\n\n // removed once it's been served.\n\n std::deque<pending_request> pending_requests_;\n\n\n\n std::array<char, 12> send_buffer_;\n\n std::array<char, 16> receive_buffer_;\n\n\n\npublic:\n\n explicit natpmp_service(asio::io_context& ios);\n\n\n", "file_path": "include/natpp/detail/natpmp_service.hpp", "rank": 8, "score": 25081.714600378436 }, { "content": "namespace detail {\n\n\n\n/**\n\n * @brief A service that implements the NAT-PMP communication protocol for all\n\n * @ref nat::natpmp objects.\n\n *\n\n * Since there is only a single default gateway for a host it makes sense to\n\n * only have one actual entity communicating with it, regardless of how many\n\n * times it is used in an application. Thus, @ref nat::natpmp instances act as\n\n * a frontend for this service backend.\n\n */\n", "file_path": "include/natpp/detail/natpmp_service.hpp", "rank": 9, "score": 25081.059220761024 }, { "content": " const port_mapping& mapping, error_code& error);\n\n\n\n template<typename Handler>\n\n void async_request_mapping(implementation_type& impl,\n\n const port_mapping& mapping, Handler handler);\n\n\n\n void remove_mapping(implementation_type& impl,\n\n const port_mapping& mapping, error_code& error);\n\n\n\n template<typename Handler>\n\n void async_remove_mapping(implementation_type& impl,\n\n const port_mapping& mapping, Handler handler);\n\n\n\nprivate:\n\n void execute_request();\n\n\n\n void async_public_address_impl();\n\n void async_request_mapping_impl();\n\n void async_remove_mapping_impl();\n\n\n", "file_path": "include/natpp/detail/natpmp_service.hpp", "rank": 10, "score": 25080.090368607092 }, { "content": "\n\n void shutdown();\n\n\n\n asio::ip::address gateway_address(implementation_type& impl)\n\n {\n\n return gateway_endpoint_.address();\n\n }\n\n\n\n asio::ip::address public_address(implementation_type& impl, error_code& error);\n\n\n\n template<typename Handler>\n\n void async_public_address(implementation_type& impl, Handler handler);\n\n\n\n const std::vector<port_mapping>&\n\n port_mappings(const implementation_type& impl) const noexcept\n\n {\n\n return impl.mappings;\n\n }\n\n\n\n port_mapping request_mapping(implementation_type& impl,\n", "file_path": "include/natpp/detail/natpmp_service.hpp", "rank": 11, "score": 25079.162386917622 }, { "content": " // the result is cached here, since it's not expected to change.\n\n // TODO is this the correct thing to do?\n\n asio::ip::address public_address_;\n\n asio::ip::udp::endpoint gateway_endpoint_;\n\n\n\n // References to all the established mappings (which are stored in\n\n // `implementation_type::mappings`).\n\n std::vector<std::reference_wrapper<port_mapping>> mappings_;\n\n\n\n struct address_request\n\n {\n\n std::function<void(error_code, asio::ip::address)> handler;\n\n };\n\n\n\n struct mapping_request\n\n {\n\n port_mapping mapping;\n\n std::function<void(error_code, port_mapping)> handler;\n\n };\n\n\n", "file_path": "include/natpp/detail/natpmp_service.hpp", "rank": 12, "score": 25079.108665618904 }, { "content": " void construct(implementation_type& impl)\n\n {\n\n impl = implementation_type();\n\n }\n\n\n\n void move_construct(implementation_type& impl, implementation_type& other_impl)\n\n {\n\n move_assign(impl, other_impl);\n\n }\n\n\n\n void move_assign(implementation_type& impl, implementation_type& other_impl)\n\n {\n\n impl = std::move(other_impl);\n\n }\n\n\n\n void destroy(implementation_type& impl)\n\n {\n\n // TODO maybe delete mappings too?\n\n impl = implementation_type();\n\n }\n", "file_path": "include/natpp/detail/natpmp_service.hpp", "rank": 13, "score": 25078.630958330257 }, { "content": "# natpp\n\n\n\nThis library lets you create [port mappings](https://en.wikipedia.org/wiki/Port_forwarding) using\n\nthe well established Asio C++ networking library.\n\n\n\n## Asio\n\n\n\nThis library integrates deeply with the Asio framework by providing an IO service backend and corresponding IO\n\nobject classes for each protocol type. Currently it only works with the standalone version of Asio, but support for independent Asio sources (i.e. standalone or Boost) is in the plans.\n\n\n\n## Work-in-progress note\n\n\n\nSince this library is work-in-progress, currently it only supports the [NATPMP protocol](https://en.wikipedia.org/wiki/NAT_Port_Mapping_Protocol).\n\nHowever, support for [UPnP port forwarding](https://en.wikipedia.org/wiki/Universal_Plug_and_Play#NAT_traversal) is in the works and should land soon.\n\n\n\n## Usage\n\n\n\n```c++\n\n#include <asio.hpp>\n\n#include <natpp/natpmp.hpp>\n\n\n\nint main()\n\n{\n\n asio::io_context io;\n\n nat::natpmp natpmp(io);\n\n \n\n natpmp.async_public_address([](nat::error_code error, asio::ip::address addr) {\n\n if(!error) {\n\n // TODO print addr\n\n }\n\n });\n\n \n\n nat::port_mapping mapping;\n\n mapping.private_port = 55555;\n\n mapping.public_port = 55555;\n\n mapping.duration = std::chrono::hours(2);\n\n natpmp.async_request_mapping(mapping,\n\n [](nat::error_code error, nat::port_mapping mapping) {\n\n if(!error) {\n\n // TODO print mapping\n\n }\n\n });\n\n \n\n io.run();\n\n}\n\n```\n", "file_path": "README.md", "rank": 14, "score": 12449.004189765299 }, { "content": "#ifndef NATPP_NATPMP_HEADER\n\n#define NATPP_NATPMP_HEADER\n\n\n\n#include \"port_mapping.hpp\"\n\n#include \"error.hpp\"\n\n#include \"detail/natpmp_service.hpp\"\n\n\n\n#include <asio/async_result.hpp>\n\n\n\nnamespace asio { class io_context; }\n\n\n\nnamespace nat {\n\n\n\n/**\n\n * Provides a facility to create port mappings using the NAT-PMP protocol.\n\n *\n\n * @par Thread Safety\n\n * @e Distinct @e objects: Safe.@n\n\n * @e Shared @e objects: Unsafe.\n\n */\n", "file_path": "include/natpp/natpmp.hpp", "rank": 15, "score": 10643.133456226255 }, { "content": "#ifndef NATPP_GATEWAY_HEADER\n\n#define NATPP_GATEWAY_HEADER\n\n\n\n#include \"port_mapping.hpp\"\n\n#include \"error.hpp\"\n\n\n\n#include <asio/ip/address.hpp>\n\n\n\nnamespace nat {\n\n\n\n/**\n\n * @brief Returns the IP address of the default gateway that is configured for\n\n * this host.\n\n *\n\n * The implementation does not make any network requests. It instead parses\n\n * OS dependent config files.\n\n *\n\n * @param error The variable through which errors are reported.\n\n *\n\n * @return The default gateway address if no error occurred. Otherwise the\n", "file_path": "include/natpp/gateway.hpp", "rank": 16, "score": 10641.29391969367 }, { "content": " /**\n\n * Returns all active mappings associated with this instance.\n\n */\n\n const std::vector<port_mapping>& port_mappings() const noexcept\n\n {\n\n return this->get_service().port_mappings(this->get_implementation());\n\n }\n\n\n\n /**\n\n * @brief Requests a port mapping to be made between this host and the\n\n * default gateway.\n\n *\n\n * @param mapping Holds the details of the mapping request.\n\n *\n\n * @param error Set to indicate what error occurered, if any.\n\n *\n\n * @return The port mapping that the NAT box created, which may differ from\n\n * the one that was requested.\n\n *\n\n * @note If there are any pending asynchronous requests enqueued in the\n", "file_path": "include/natpp/natpmp.hpp", "rank": 17, "score": 10638.98711939127 }, { "content": " * return value is a default constructed `asio::ip::address` object.\n\n */\n\nasio::ip::address default_gateway_address(error_code& error);\n\n\n\n} // nat\n\n\n\n#include \"impl/gateway.ipp\"\n\n\n\n#endif // NATPP_GATEWAY_HEADER\n\n\n", "file_path": "include/natpp/gateway.hpp", "rank": 18, "score": 10638.748516511707 }, { "content": " * @brief Requests a port mapping to be removed between this host and the\n\n * default gateway in an asynchronous fashion.\n\n *\n\n * @param mapping Holds the details of the mapping request. The\n\n * `port_mapping::duration` and `port_mapping::public_address` fields will\n\n * both be set to zero, so the caller code need not do this.\n\n *\n\n * @param handler The handler to be called when the public address request\n\n * operation completes.\n\n * The function signature of the handler must be:\n\n * @code void handler(\n\n * natpp::error_code // The result of the operation.\n\n * ); @endcode\n\n * Regardless of whether the asynchronous operation completes immediately or\n\n * not, the handler will not be invoked from within this function. Invocation\n\n * of the handler will be performed in a manner equivalent to using\n\n * asio::io_context::post.\n\n */\n\n template<typename Handler>\n\n ASIO_INITFN_RESULT_TYPE(Handler, void(error_code))\n", "file_path": "include/natpp/natpmp.hpp", "rank": 19, "score": 10638.532122447423 }, { "content": " * natpp::post_mapping // The port mapping that the NAT box created.\n\n * ); @endcode\n\n * Regardless of whether the asynchronous operation completes immediately or\n\n * not, the handler will not be invoked from within this function. Invocation\n\n * of the handler will be performed in a manner equivalent to using\n\n * asio::io_context::post.\n\n */\n\n template<typename Handler>\n\n ASIO_INITFN_RESULT_TYPE(Handler, void(error_code, port_mapping))\n\n async_request_mapping(const port_mapping& mapping, Handler handler)\n\n {\n\n asio::async_completion<Handler,\n\n void(error_code, port_mapping)> init(handler);\n\n this->get_service().async_request_mapping(\n\n this->get_implementation(), mapping,\n\n std::move(init.completion_handler));\n\n return init.result.get();\n\n }\n\n\n\n /**\n", "file_path": "include/natpp/natpmp.hpp", "rank": 20, "score": 10638.452077735437 }, { "content": " * @brief Requests a port mapping to be removed between this host and the\n\n * default gateway.\n\n *\n\n * @param mapping Holds the details of the mapping request. The\n\n * `port_mapping::duration` and `port_mapping::public_address` fields will\n\n * both be set to zero, so the caller code need not do this.\n\n *\n\n * @param error Set to indicate what error occurered, if any.\n\n *\n\n * @note If there are any pending asynchronous requests enqueued in the\n\n * underlying @ref natpmp_service, @p error will be set to\n\n * `asio::error::try_again`.\n\n */\n\n void remove_mapping(const port_mapping& mapping, error_code& error)\n\n {\n\n return this->get_service().remove_mapping(\n\n this->get_implementation(), mapping, error);\n\n }\n\n\n\n /**\n", "file_path": "include/natpp/natpmp.hpp", "rank": 21, "score": 10638.088691644884 }, { "content": " * underlying @ref natpmp_service, @p error will be set to\n\n * `asio::error::try_again`.\n\n */\n\n port_mapping request_mapping(const port_mapping& mapping, error_code& error)\n\n {\n\n return this->get_service().request_mapping(\n\n this->get_implementation(), mapping, error);\n\n }\n\n\n\n /**\n\n * @brief Requests a port mapping to be made between this host and the\n\n * default gateway in an asynchronous fashion.\n\n *\n\n * @param mapping Holds the details of the mapping request.\n\n *\n\n * @param handler The handler to be called when the public address request\n\n * operation completes.\n\n * The function signature of the handler must be:\n\n * @code void handler(\n\n * natpp::error_code, // The result of the operation.\n", "file_path": "include/natpp/natpmp.hpp", "rank": 22, "score": 10638.059333394705 }, { "content": " * @param handler The handler to be called when the public address request\n\n * operation completes.\n\n * The function signature of the handler must be:\n\n * @code void handler(natpp::error_code, asio::ip::address); @endcode\n\n * Regardless of whether the asynchronous operation completes immediately or\n\n * not, the handler will not be invoked from within this function. Invocation\n\n * of the handler will be performed in a manner equivalent to using\n\n * asio::io_context::post.\n\n */\n\n template<typename Handler>\n\n ASIO_INITFN_RESULT_TYPE(Handler, void(error_code, asio::ip::address))\n\n async_public_address(Handler handler)\n\n {\n\n asio::async_completion<Handler,\n\n void(error_code, asio::ip::address)> init(handler);\n\n this->get_service().async_public_address(\n\n this->get_implementation(), std::move(init.completion_handler));\n\n return init.result.get();\n\n }\n\n\n", "file_path": "include/natpp/natpmp.hpp", "rank": 23, "score": 10637.96766482553 }, { "content": " async_remove_mapping(const port_mapping& mapping, Handler handler)\n\n {\n\n asio::async_completion<Handler, void(error_code)> init(handler);\n\n this->get_service().async_remove_mapping(\n\n this->get_implementation(), mapping,\n\n std::move(init.completion_handler));\n\n return init.result.get();\n\n }\n\n};\n\n\n\n} // nat\n\n\n\n#endif // NATPP_NATPMP_HEADER\n", "file_path": "include/natpp/natpmp.hpp", "rank": 24, "score": 10637.789920390278 }, { "content": " * @brief Requests the address of the WAN facing side of this host's default\n\n * gateway.\n\n *\n\n * @param error Set to indicate what error occurered, if any.\n\n *\n\n * @return The public gateway address, or undefined if @p error is set.\n\n *\n\n * @note If there are any pending asynchronous requests enqueued in the\n\n * underlying @ref natpmp_service, @p error will be set to\n\n * `asio::error::try_again`.\n\n */\n\n asio::ip::address public_address(error_code& error)\n\n {\n\n return this->get_service().public_address(this->get_implementation(), error);\n\n }\n\n\n\n /**\n\n * @brief Requests the address of the WAN facing side of this host's default\n\n * gateway.\n\n *\n", "file_path": "include/natpp/natpmp.hpp", "rank": 25, "score": 10636.054309844296 }, { "content": "#ifndef NATPP_PORT_MAPPING_HEADER\n\n#define NATPP_PORT_MAPPING_HEADER\n\n\n\n#include <chrono>\n\n\n\nnamespace nat {\n\n\n\n/**\n\n * This object represents a mapping between host's port and the requested port\n\n * on the router's WAN facing side.\n\n */\n", "file_path": "include/natpp/port_mapping.hpp", "rank": 26, "score": 10055.04228254065 }, { "content": "struct port_mapping\n\n{\n\n enum { udp, tcp } type;\n\n // The port on which this host will be listening for connections.\n\n uint16_t private_port = 0;\n\n // The port on which the router's WAN facing side will be listening for\n\n // connections.\n\n //\n\n // @note This is usually a suggestion and NAT boxes are free to ignore it\n\n // and map `private_port` to something else.\n\n uint16_t public_port = 0;\n\n // The total lifetime of the mapping. It is advised, however, that the\n\n // mapping be renewed at an interval half of this value. If it's 0, the NAT\n\n // box will choose a suitable value.\n\n std::chrono::seconds duration{0};\n\n};\n\n\n\n/** Determines if @p request is a request to remove a mapping. */\n\ninline bool is_remove_mapping_request(const port_mapping& request)\n\n{\n\n return (request.public_port == 0) && (request.duration == std::chrono::seconds(0));\n\n}\n\n\n\n} // nat\n\n\n\n#endif // NATPP_PORT_MAPPING_HEADER\n", "file_path": "include/natpp/port_mapping.hpp", "rank": 27, "score": 9056.016448456247 }, { "content": " << \" (\" << error.value() << \")\";\n\n return out;\n\n}\n\n\n\nint main()\n\n{\n\n asio::io_context io;\n\n nat::natpmp natpmp(io);\n\n nat::error_code error;\n\n\n\n auto gw_addr = natpmp.gateway_address(error);\n\n if(error)\n\n std::cout << \"gateway_address error: \" << error << '\\n';\n\n else\n\n std::cout << gw_addr << '\\n';\n\n\n\n auto pub_addr = natpmp.public_address(error);\n\n if(error)\n\n std::cout << \"public_address error: \" << error << '\\n';\n\n else\n", "file_path": "test/test.cpp", "rank": 28, "score": 8.508349132389867 }, { "content": "#include <iostream>\n\n\n\n#include \"../include/natpp/natpmp.hpp\"\n\n\n\n#include <asio.hpp>\n\n\n\n//namespace nat {\n\n//namespace error {\n\n//const natpmp_error_category& natpmp_category() {\n\n //static natpmp_error_category instance;\n\n //return instance;\n\n//}\n\n//}\n\n//}\n\n\n\nstd::ostream& operator<<(std::ostream& out, const nat::error_code& error)\n\n{\n\n const std::string msg = error.message();\n\n out << error.category().name()\n\n << \": \" << msg\n", "file_path": "test/test.cpp", "rank": 29, "score": 7.176702651100552 }, { "content": " std::cout << \"async_request_mapping handler\";\n\n if(error)\n\n std::cout << \": \" << error << '\\n';\n\n else\n\n std::cout << '\\n';\n\n });\n\n natpmp.async_remove_mapping(mapping,\n\n [](nat::error_code error, nat::port_mapping mapping)\n\n {\n\n std::cout << \"async_remove_mapping handler\";\n\n if(error)\n\n std::cout << \": \" << error << '\\n';\n\n else\n\n std::cout << '\\n';\n\n });\n\n\n\n io.run();\n\n}\n", "file_path": "test/test.cpp", "rank": 30, "score": 4.470912961995529 }, { "content": " std::cout << pub_addr << '\\n';\n\n\n\n\n\n natpmp.async_public_address(\n\n [](nat::error_code error, asio::ip::address addr)\n\n {\n\n std::cout << \"async_public_address handler\";\n\n if(error)\n\n std::cout << \": \" << error << '\\n';\n\n else\n\n std::cout << addr << '\\n';\n\n });\n\n\n\n nat::port_mapping mapping;\n\n mapping.private_port = 55'555;\n\n mapping.public_port = 55'555;\n\n mapping.duration = std::chrono::hours(2);\n\n natpmp.async_request_mapping(mapping,\n\n [](nat::error_code error, nat::port_mapping mapping)\n\n {\n", "file_path": "test/test.cpp", "rank": 31, "score": 3.291835788552988 } ]
C++
test/cctest/test-typing-reset.cc
guillermomolina/v8-sparc
40f43c91a59835819cdd544b25d0ea415a753bbb
#define V8_IMMINENT_DEPRECATION_WARNINGS #include <stdlib.h> #include "src/v8.h" #include "src/ast.h" #include "src/ast-expression-visitor.h" #include "src/parser.h" #include "src/rewriter.h" #include "src/scopes.h" #include "src/typing-reset.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/function-tester.h" #include "test/cctest/expression-type-collector.h" #include "test/cctest/expression-type-collector-macros.h" #define INT32_TYPE Bounds(Type::Signed32(), Type::Signed32()) using namespace v8::internal; namespace { class TypeSetter : public AstExpressionVisitor { public: TypeSetter(Isolate* isolate, FunctionLiteral* root) : AstExpressionVisitor(isolate, root) {} protected: void VisitExpression(Expression* expression) { expression->set_bounds(INT32_TYPE); } }; void CheckAllSame(ZoneVector<ExpressionTypeEntry>& types, Bounds expected_type) { CHECK_TYPES_BEGIN { CHECK_EXPR(FunctionLiteral, expected_type) { CHECK_EXPR(FunctionLiteral, expected_type) { CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(start, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(start, expected_type); CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(end, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(end, expected_type); CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(sum, expected_type); CHECK_EXPR(Literal, expected_type); } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(p, expected_type); CHECK_EXPR(Literal, expected_type); } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(q, expected_type); CHECK_EXPR(Literal, expected_type); } CHECK_EXPR(BinaryOperation, expected_type) { CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(p, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(start, expected_type); CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(q, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(end, expected_type); CHECK_EXPR(Literal, expected_type); } } } CHECK_EXPR(CompareOperation, expected_type) { CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(p, expected_type); CHECK_EXPR(Literal, expected_type); } CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(q, expected_type); CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(p, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(p, expected_type); CHECK_EXPR(Literal, expected_type); } CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(sum, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(sum, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_EXPR(Call, expected_type) { CHECK_VAR(log, expected_type); CHECK_EXPR(Property, expected_type) { CHECK_VAR(values, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(p, expected_type); CHECK_EXPR(Literal, expected_type); } } } CHECK_EXPR(Literal, expected_type); } } } CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(sum, expected_type); CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(FunctionLiteral, expected_type) { CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(start, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(start, expected_type); CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(end, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(end, expected_type); CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(BinaryOperation, expected_type) { CHECK_EXPR(Call, expected_type) { CHECK_VAR(exp, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_EXPR(BinaryOperation, expected_type) { CHECK_EXPR(Call, expected_type) { CHECK_VAR(logSum, expected_type); CHECK_VAR(start, expected_type); CHECK_VAR(end, expected_type); } CHECK_EXPR(Literal, expected_type); } CHECK_EXPR(BinaryOperation, expected_type) { CHECK_EXPR(BinaryOperation, expected_type) { CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(end, expected_type); CHECK_VAR(start, expected_type); } CHECK_EXPR(Literal, expected_type); } CHECK_EXPR(Literal, expected_type); } } } CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(Literal, expected_type); CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(exp, expected_type); CHECK_EXPR(Property, expected_type) { CHECK_EXPR(Property, expected_type) { CHECK_VAR(stdlib, expected_type); CHECK_EXPR(Literal, expected_type); } CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(log, expected_type); CHECK_EXPR(Property, expected_type) { CHECK_EXPR(Property, expected_type) { CHECK_VAR(stdlib, expected_type); CHECK_EXPR(Literal, expected_type); } CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(values, expected_type); CHECK_EXPR(CallNew, expected_type) { CHECK_EXPR(Property, expected_type) { CHECK_VAR(stdlib, expected_type); CHECK_EXPR(Literal, expected_type); } CHECK_VAR(buffer, expected_type); } } CHECK_EXPR(ObjectLiteral, expected_type) { CHECK_VAR(geometricMean, expected_type); } } } CHECK_TYPES_END } } TEST(ResetTypingInfo) { const char test_function[] = "function GeometricMean(stdlib, foreign, buffer) {\n" " \"use asm\";\n" "\n" " var exp = stdlib.Math.exp;\n" " var log = stdlib.Math.log;\n" " var values = new stdlib.Float64Array(buffer);\n" "\n" " function logSum(start, end) {\n" " start = start|0;\n" " end = end|0;\n" "\n" " var sum = 0.0, p = 0, q = 0;\n" "\n" " // asm.js forces byte addressing of the heap by requiring shifting " "by 3\n" " for (p = start << 3, q = end << 3; (p|0) < (q|0); p = (p + 8)|0) {\n" " sum = sum + +log(values[p>>3]);\n" " }\n" "\n" " return +sum;\n" " }\n" "\n" " function geometricMean(start, end) {\n" " start = start|0;\n" " end = end|0;\n" "\n" " return +exp(+logSum(start, end) / +((end - start)|0));\n" " }\n" "\n" " return { geometricMean: geometricMean };\n" "}\n"; v8::V8::Initialize(); HandleAndZoneScope handles; i::Isolate* isolate = CcTest::i_isolate(); i::Factory* factory = isolate->factory(); i::Handle<i::String> source_code = factory->NewStringFromUtf8(i::CStrVector(test_function)) .ToHandleChecked(); i::Handle<i::Script> script = factory->NewScript(source_code); i::ParseInfo info(handles.main_zone(), script); i::Parser parser(&info); parser.set_allow_harmony_sloppy(true); info.set_global(); info.set_lazy(false); info.set_allow_lazy_parsing(false); info.set_toplevel(true); CHECK(i::Compiler::ParseAndAnalyze(&info)); FunctionLiteral* root = info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); ExpressionTypeCollector(isolate, root, &types).Run(); CheckAllSame(types, Bounds::Unbounded()); TypeSetter(isolate, root).Run(); ExpressionTypeCollector(isolate, root, &types).Run(); CheckAllSame(types, INT32_TYPE); TypingReseter(isolate, root).Run(); ExpressionTypeCollector(isolate, root, &types).Run(); CheckAllSame(types, Bounds::Unbounded()); }
#define V8_IMMINENT_DEPRECATION_WARNINGS #include <stdlib.h> #include "src/v8.h" #include "src/ast.h" #include "src/ast-expression-visitor.h" #include "src/parser.h" #include "src/rewriter.h" #include "src/scopes.h" #include "src/typing-reset.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/function-tester.h" #include "test/cctest/expression-type-collector.h" #include "test/cctest/expression-type-collector-macros.h" #define INT32_TYPE Bounds(Type::Signed32(), Type::Signed32()) using namespace v8::internal; namespace { class TypeSetter : public AstExpressionVisitor { public: TypeSetter(Isolate* isolate, FunctionLiteral* root) : AstExpressionVisitor(isolate, root) {} protected: void VisitExpression(Expression* expression) { expression->set_bounds(INT32_TYPE); } }; void CheckAllSame(ZoneVector<ExpressionTypeEntry>& types, Bounds expected_type) { CHECK_TYPES_BEGIN { CHECK_EXPR(FunctionLiteral, expected_type) { CHECK_EXPR(FunctionLiteral, expected_type) { CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(start, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(start, expected_type); CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(end, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(end, expected_type); CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(sum, expected_type); CHECK_EXPR(Literal, expected_type); } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(p, expected_type); CHECK_EXPR(Literal, expected_type); } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(q, expected_type); CHECK_EXPR(Literal, expected_type); } CHECK_EXPR(BinaryOperation, expected_type) { CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(p, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(start, expected_type); CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(q, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(end, expected_type); CHECK_EXPR(Literal, expected_type); } } } CHECK_EXPR(CompareOperation, expected_type) { CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(p, expected_type); CHECK_EXPR(Literal, expected_type); } CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(q, expected_type); CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(p, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(p, exp
e); } } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(values, expected_type); CHECK_EXPR(CallNew, expected_type) { CHECK_EXPR(Property, expected_type) { CHECK_VAR(stdlib, expected_type); CHECK_EXPR(Literal, expected_type); } CHECK_VAR(buffer, expected_type); } } CHECK_EXPR(ObjectLiteral, expected_type) { CHECK_VAR(geometricMean, expected_type); } } } CHECK_TYPES_END } } TEST(ResetTypingInfo) { const char test_function[] = "function GeometricMean(stdlib, foreign, buffer) {\n" " \"use asm\";\n" "\n" " var exp = stdlib.Math.exp;\n" " var log = stdlib.Math.log;\n" " var values = new stdlib.Float64Array(buffer);\n" "\n" " function logSum(start, end) {\n" " start = start|0;\n" " end = end|0;\n" "\n" " var sum = 0.0, p = 0, q = 0;\n" "\n" " // asm.js forces byte addressing of the heap by requiring shifting " "by 3\n" " for (p = start << 3, q = end << 3; (p|0) < (q|0); p = (p + 8)|0) {\n" " sum = sum + +log(values[p>>3]);\n" " }\n" "\n" " return +sum;\n" " }\n" "\n" " function geometricMean(start, end) {\n" " start = start|0;\n" " end = end|0;\n" "\n" " return +exp(+logSum(start, end) / +((end - start)|0));\n" " }\n" "\n" " return { geometricMean: geometricMean };\n" "}\n"; v8::V8::Initialize(); HandleAndZoneScope handles; i::Isolate* isolate = CcTest::i_isolate(); i::Factory* factory = isolate->factory(); i::Handle<i::String> source_code = factory->NewStringFromUtf8(i::CStrVector(test_function)) .ToHandleChecked(); i::Handle<i::Script> script = factory->NewScript(source_code); i::ParseInfo info(handles.main_zone(), script); i::Parser parser(&info); parser.set_allow_harmony_sloppy(true); info.set_global(); info.set_lazy(false); info.set_allow_lazy_parsing(false); info.set_toplevel(true); CHECK(i::Compiler::ParseAndAnalyze(&info)); FunctionLiteral* root = info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); ExpressionTypeCollector(isolate, root, &types).Run(); CheckAllSame(types, Bounds::Unbounded()); TypeSetter(isolate, root).Run(); ExpressionTypeCollector(isolate, root, &types).Run(); CheckAllSame(types, INT32_TYPE); TypingReseter(isolate, root).Run(); ExpressionTypeCollector(isolate, root, &types).Run(); CheckAllSame(types, Bounds::Unbounded()); }
ected_type); CHECK_EXPR(Literal, expected_type); } CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(sum, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(sum, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_EXPR(Call, expected_type) { CHECK_VAR(log, expected_type); CHECK_EXPR(Property, expected_type) { CHECK_VAR(values, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(p, expected_type); CHECK_EXPR(Literal, expected_type); } } } CHECK_EXPR(Literal, expected_type); } } } CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(sum, expected_type); CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(FunctionLiteral, expected_type) { CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(start, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(start, expected_type); CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(end, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(end, expected_type); CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(BinaryOperation, expected_type) { CHECK_EXPR(Call, expected_type) { CHECK_VAR(exp, expected_type); CHECK_EXPR(BinaryOperation, expected_type) { CHECK_EXPR(BinaryOperation, expected_type) { CHECK_EXPR(Call, expected_type) { CHECK_VAR(logSum, expected_type); CHECK_VAR(start, expected_type); CHECK_VAR(end, expected_type); } CHECK_EXPR(Literal, expected_type); } CHECK_EXPR(BinaryOperation, expected_type) { CHECK_EXPR(BinaryOperation, expected_type) { CHECK_EXPR(BinaryOperation, expected_type) { CHECK_VAR(end, expected_type); CHECK_VAR(start, expected_type); } CHECK_EXPR(Literal, expected_type); } CHECK_EXPR(Literal, expected_type); } } } CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(Literal, expected_type); CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(exp, expected_type); CHECK_EXPR(Property, expected_type) { CHECK_EXPR(Property, expected_type) { CHECK_VAR(stdlib, expected_type); CHECK_EXPR(Literal, expected_type); } CHECK_EXPR(Literal, expected_type); } } CHECK_EXPR(Assignment, expected_type) { CHECK_VAR(log, expected_type); CHECK_EXPR(Property, expected_type) { CHECK_EXPR(Property, expected_type) { CHECK_VAR(stdlib, expected_type); CHECK_EXPR(Literal, expected_type); } CHECK_EXPR(Literal, expected_typ
random
[]
C++
core/utility/error.cpp
rj2Skipper/mfcmapi
07e98bb540d184b1bebb509f136712d5402e5820
#include <core/stdafx.h> #include <core/utility/error.h> #include <core/interpret/errorArray.h> #include <core/utility/strings.h> #include <core/utility/output.h> #include <core/utility/registry.h> #include <core/interpret/proptags.h> namespace error { std::function<void(const std::wstring& errString)> displayError; void LogFunctionCall( HRESULT hRes, HRESULT hrIgnore, bool bShowDialog, bool bMAPICall, bool bSystemCall, UINT uidErrorMsg, _In_opt_z_ LPCSTR szFunction, _In_z_ LPCSTR szFile, int iLine) { if (fIsSet(output::dbgLevel::MAPIFunctions) && bMAPICall) { const auto szFunctionString = strings::formatmessage(IDS_FUNCTION, szFile, iLine, szFunction); output::Output(output::dbgLevel::MAPIFunctions, nullptr, true, szFunctionString); output::Output(output::dbgLevel::MAPIFunctions, nullptr, false, L"\n"); } if (hRes == S_OK || hRes == hrIgnore) return; if (!(bShowDialog && displayError) && !fIsSet(output::dbgLevel::HRes)) return; const auto szErrorMsg = bSystemCall ? strings::formatmessagesys(uidErrorMsg) : uidErrorMsg ? strings::loadstring(uidErrorMsg) : L""; const auto szErrString = strings::formatmessage( FAILED(hRes) ? IDS_ERRFORMATSTRING : IDS_WARNFORMATSTRING, szErrorMsg.c_str(), ErrorNameFromErrorCode(hRes).c_str(), hRes, szFunction, szFile, iLine); if (fIsSet(output::dbgLevel::HRes)) { output::Output(output::dbgLevel::HRes, nullptr, true, strings::StripCarriage(szErrString)); output::Output(output::dbgLevel::HRes, nullptr, false, L"\n"); } if (bShowDialog && displayError) { displayError(szErrString); } } _Check_return_ HRESULT CheckWin32Error(bool bDisplayDialog, _In_z_ LPCSTR szFile, int iLine, _In_z_ LPCSTR szFunction) { const auto dwErr = GetLastError(); const auto hRes = HRESULT_FROM_WIN32(dwErr); LogFunctionCall(hRes, NULL, bDisplayDialog, false, true, dwErr, szFunction, szFile, iLine); return hRes; } void __cdecl ErrDialog(_In_z_ LPCSTR szFile, int iLine, UINT uidErrorFmt, ...) { auto szErrorFmt = strings::loadstring(uidErrorFmt); va_list argList = nullptr; va_start(argList, uidErrorFmt); const auto szErrorBegin = strings::formatV(szErrorFmt.c_str(), argList); va_end(argList); const auto szCombo = szErrorBegin + strings::formatmessage(IDS_INFILEONLINE, szFile, iLine); output::Output(output::dbgLevel::HRes, nullptr, true, szCombo); output::Output(output::dbgLevel::HRes, nullptr, false, L"\n"); if (displayError) { displayError(szCombo); } } std::wstring ErrorNameFromErrorCode(ULONG hrErr) { for (ULONG i = 0; i < g_ulErrorArray; i++) { if (g_ErrorArray[i].ulErrorName == hrErr) return g_ErrorArray[i].lpszName; } return strings::format(L"0x%08X", hrErr); } std::wstring ProblemArrayToString(_In_ const SPropProblemArray& problems) { std::wstring szOut; for (ULONG i = 0; i < problems.cProblem; i++) { szOut += strings::formatmessage( IDS_PROBLEMARRAY, problems.aProblem[i].ulIndex, proptags::TagToString(problems.aProblem[i].ulPropTag, nullptr, false, false).c_str(), problems.aProblem[i].scode, ErrorNameFromErrorCode(problems.aProblem[i].scode).c_str()); } return szOut; } std::wstring MAPIErrToString(ULONG ulFlags, _In_ const MAPIERROR& err) { auto szOut = strings::formatmessage( ulFlags & MAPI_UNICODE ? IDS_MAPIERRUNICODE : IDS_MAPIERRANSI, err.ulVersion, err.lpszError, err.lpszComponent, err.ulLowLevelError, ErrorNameFromErrorCode(err.ulLowLevelError).c_str(), err.ulContext); return szOut; } std::wstring TnefProblemArrayToString(_In_ const STnefProblemArray& error) { std::wstring szOut; for (ULONG iError = 0; iError < error.cProblem; iError++) { szOut += strings::formatmessage( IDS_TNEFPROBARRAY, error.aProblem[iError].ulComponent, error.aProblem[iError].ulAttribute, proptags::TagToString(error.aProblem[iError].ulPropTag, nullptr, false, false).c_str(), error.aProblem[iError].scode, ErrorNameFromErrorCode(error.aProblem[iError].scode).c_str()); } return szOut; } template <typename T> void CheckExtendedError(HRESULT hRes, T lpObject) { if (hRes == MAPI_E_EXTENDED_ERROR) { LPMAPIERROR lpErr = nullptr; hRes = WC_MAPI(lpObject->GetLastError(hRes, fMapiUnicode, &lpErr)); if (lpErr) { EC_MAPIERR(fMapiUnicode, lpErr); MAPIFreeBuffer(lpErr); } } else CHECKHRES(hRes); } template void CheckExtendedError<LPMAPIFORMCONTAINER>(HRESULT hRes, LPMAPIFORMCONTAINER lpObject); template void CheckExtendedError<LPMAPIFORMMGR>(HRESULT hRes, LPMAPIFORMMGR lpObject); }
#include <core/stdafx.h> #include <core/utility/error.h> #include <core/interpret/errorArray.h> #include <core/utility/strings.h> #include <core/utility/output.h> #include <core/utility/registry.h> #include <core/interpret/proptags.h> namespace error { std::function<void(const std::wstring& errString)> displayError; void LogFunctionCall( HRESULT hRes, HRESULT hrIgnore, bool bShowDialog, bool bMAPICall, bool bSystemCall, UINT uidErrorMsg, _In_opt_z_ LPCSTR szFunction, _In_z_ LPCSTR szFile, int iLine) { if (fIsSet(output::dbgLevel::MAPIFunctions) && bMAPICall) { const auto szFunctionString = strings::formatmessage(IDS_FUNCTION, szFile, iLine, szFunction); output::Output(output::dbgLevel::MAPIFunctions, nullptr, true, szFunctionString); output::Output(output::dbgLevel::MAPIFunctions, nullptr, false, L"\n"); } if (hRes == S_OK || hRes == hrIgnore) return; if (!(bShowDialog && displayError) && !fIsSet(output::dbgLevel::HRes)) return; const auto szErrorMsg = bSystemCall ? strings::formatmessagesys(uidErrorMsg) : uidErrorMsg ? strings::loadstring(uidErrorMsg) : L""; const auto szErrString = strings::formatmessage( FAILED(hRes) ? IDS_ERRFORMATSTRING : IDS_WARNFORMATSTRING, szErrorMsg.c_str(), ErrorNameFromErrorCode(hRes).c_str(), hRes, szFunction, szFile, iLine); if (fIsSet(output::dbgLevel::HRes)) { output::Output(output::dbgLevel::HRes, nullptr, true, strings::StripCarriage(szErrString)); output::Output(output::dbgLevel::HRes, nullptr, false, L"\n"); } if (bShowDialog && displayError) { displayError(szErrString); } } _Check_return_ HRESULT CheckWin32Error(bool bDisplayDialog, _In_z_ LPCSTR szFile, int iLine, _In_z_ LPCSTR szFunction) { const auto dwErr = GetLastError(); const auto hRes = HRESULT_FROM_WIN32(dwErr); LogFunctionCall(hRes, NULL, bDisplayDialog, false, true, dwErr, szFunction, szFile, iLine); return hRes; } void __cdecl ErrDialog(_In_z_ LPCSTR szFile, int iLine, UINT uidErrorFmt, ...) { auto szErrorFmt = strings::loadstring(uidErrorFmt); va_list argList = nullptr; va_start(argList, uidErrorFmt); const auto szErrorBegin = strings::formatV(szErrorFmt.c_str(), argList); va_end(argList); const auto szCombo = szErrorBegin + strings::formatmessage(IDS_INFILEONLINE, szFile, iLine); output::Output(output::dbgLevel::HRes, nullptr, true, szCombo); output::Output(output::dbgLevel::HRes, nullptr, false, L"\n"); if (displayError) { displayError(szCombo); } } std::wstring ErrorNameFromErrorCode(ULONG hrErr) { for (ULONG i = 0; i < g_ulErrorArray; i++) { if (g_ErrorArray[i].ulErrorName == hrErr) return g_ErrorArray[i].lpszName; } return strings::format(L"0x%08X", hrErr); } std::wstring ProblemArrayToString(_In_ const SPropProblemArray& problems) { std::wstring szOut; for (ULONG i = 0; i < problems.cProblem; i++) { szOut += strings::formatmessage( IDS_PROBLEMARRAY, problems.aProblem[i].ulIndex, proptags::TagToString(problems.aProblem[i].ulPropTag, nullptr, false, false).c_str(), problems.aProblem[i].scode, ErrorNameFromErrorCode(problems.aProblem[i].scode).c_str()); } return szOut; } std::wstring MAPIErrToString(ULONG ulFlags, _In_ co
Code(err.ulLowLevelError).c_str(), err.ulContext); return szOut; } std::wstring TnefProblemArrayToString(_In_ const STnefProblemArray& error) { std::wstring szOut; for (ULONG iError = 0; iError < error.cProblem; iError++) { szOut += strings::formatmessage( IDS_TNEFPROBARRAY, error.aProblem[iError].ulComponent, error.aProblem[iError].ulAttribute, proptags::TagToString(error.aProblem[iError].ulPropTag, nullptr, false, false).c_str(), error.aProblem[iError].scode, ErrorNameFromErrorCode(error.aProblem[iError].scode).c_str()); } return szOut; } template <typename T> void CheckExtendedError(HRESULT hRes, T lpObject) { if (hRes == MAPI_E_EXTENDED_ERROR) { LPMAPIERROR lpErr = nullptr; hRes = WC_MAPI(lpObject->GetLastError(hRes, fMapiUnicode, &lpErr)); if (lpErr) { EC_MAPIERR(fMapiUnicode, lpErr); MAPIFreeBuffer(lpErr); } } else CHECKHRES(hRes); } template void CheckExtendedError<LPMAPIFORMCONTAINER>(HRESULT hRes, LPMAPIFORMCONTAINER lpObject); template void CheckExtendedError<LPMAPIFORMMGR>(HRESULT hRes, LPMAPIFORMMGR lpObject); }
nst MAPIERROR& err) { auto szOut = strings::formatmessage( ulFlags & MAPI_UNICODE ? IDS_MAPIERRUNICODE : IDS_MAPIERRANSI, err.ulVersion, err.lpszError, err.lpszComponent, err.ulLowLevelError, ErrorNameFromError
function_block-random_span
[ { "content": " BEGIN_INTERFACE\n\n\n\n HRESULT ( STDMETHODCALLTYPE *QueryInterface )(\n\n IMimeEditTagCollection * This,\n\n /* [in] */ REFIID riid,\n", "file_path": "include/mimeole.h", "rank": 0, "score": 144058.305925519 }, { "content": "namespace error\n\n{\n\n\textern std::function<void(const std::wstring& errString)> displayError;\n\n\n\n\tvoid LogFunctionCall(\n\n\t\tHRESULT hRes,\n\n\t\tHRESULT hrIgnore,\n\n\t\tbool bShowDialog,\n\n\t\tbool bMAPICall,\n\n\t\tbool bSystemCall,\n\n\t\tUINT uidErrorMsg,\n\n\t\t_In_opt_z_ LPCSTR szFunction,\n\n\t\t_In_z_ LPCSTR szFile,\n\n\t\tint iLine);\n\n\n\n\tvoid __cdecl ErrDialog(_In_z_ LPCSTR szFile, int iLine, UINT uidErrorFmt, ...);\n\n\n\n\t// Function to convert error codes to their names\n\n\tstd::wstring ErrorNameFromErrorCode(ULONG hrErr);\n\n\n\n\t_Check_return_ HRESULT\n\n\tCheckWin32Error(bool bDisplayDialog, _In_z_ LPCSTR szFile, int iLine, _In_z_ LPCSTR szFunction);\n\n\n\n\t// Flag parsing array - used by ErrorNameFromErrorCode\n\n\tstruct ERROR_ARRAY_ENTRY\n\n\t{\n\n\t\tULONG ulErrorName;\n\n\t\tLPCWSTR lpszName;\n\n\t};\n\n\ttypedef ERROR_ARRAY_ENTRY* LPERROR_ARRAY_ENTRY;\n\n\n\n\tinline _Check_return_ constexpr HRESULT CheckMe(const HRESULT hRes) noexcept { return hRes; }\n\n\n\n\tstd::wstring ProblemArrayToString(_In_ const SPropProblemArray& problems);\n\n\tstd::wstring MAPIErrToString(ULONG ulFlags, _In_ const MAPIERROR& err);\n\n\tstd::wstring TnefProblemArrayToString(_In_ const STnefProblemArray& error);\n\n\n\n\ttemplate <typename T> void CheckExtendedError(HRESULT hRes, T lpObject);\n", "file_path": "core/utility/error.h", "rank": 1, "score": 104788.84788561738 }, { "content": "namespace error\n\n{\n\n#define ERROR_ENTRY(_fName) {(ULONG) _fName, L#_fName},\n\n\n\n\t// These are sorted in increasing order, with no duplicates\n\n\t// We have no logic for handling duplicate error codes\n\n\tERROR_ARRAY_ENTRY g_ErrorArray[] = {\n\n\t\t// clang-format off\n\n\t\tERROR_ENTRY(S_FALSE)\n\n\n\n\t\t// IStorage success codes\n\n\t\tERROR_ENTRY(STG_S_CONVERTED)\n\n\t\tERROR_ENTRY(STG_S_BLOCK)\n\n\t\tERROR_ENTRY(STG_S_RETRYNOW)\n\n\t\tERROR_ENTRY(STG_S_MONITORING)\n\n\t\tERROR_ENTRY(STG_S_MULTIPLEOPENS)\n\n\t\tERROR_ENTRY(STG_S_CANNOTCONSOLIDATE)\n\n\n\n\t\tERROR_ENTRY(OLEOBJ_S_CANNOT_DOVERB_NOW)\n\n\n\n\t\tERROR_ENTRY(MAPI_W_NO_SERVICE)\n\n\t\tERROR_ENTRY(MAPI_W_ERRORS_RETURNED)\n\n\t\tERROR_ENTRY(MAPI_W_POSITION_CHANGED)\n\n\t\tERROR_ENTRY(MAPI_W_APPROX_COUNT)\n\n\t\tERROR_ENTRY(MAPI_W_CANCEL_MESSAGE)\n\n\t\tERROR_ENTRY(MAPI_W_PARTIAL_COMPLETION)\n\n\n\n\t\tERROR_ENTRY(SYNC_W_PROGRESS)\n\n\t\tERROR_ENTRY(SYNC_W_CLIENT_CHANGE_NEWER)\n\n\n\n\t\tERROR_ENTRY(MAPI_E_INTERFACE_NOT_SUPPORTED)\n\n\t\tERROR_ENTRY(MAPI_E_CALL_FAILED)\n\n\n\n\t\t// IStorage errors\n\n\t\tERROR_ENTRY(STG_E_INVALIDFUNCTION)\n\n\t\tERROR_ENTRY(STG_E_FILENOTFOUND)\n\n\t\tERROR_ENTRY(STG_E_PATHNOTFOUND)\n\n\t\tERROR_ENTRY(STG_E_TOOMANYOPENFILES)\n\n\t\tERROR_ENTRY(STG_E_ACCESSDENIED)\n\n\t\tERROR_ENTRY(STG_E_INVALIDHANDLE)\n\n\t\tERROR_ENTRY(STG_E_INSUFFICIENTMEMORY)\n\n\t\tERROR_ENTRY(STG_E_INVALIDPOINTER)\n\n\t\tERROR_ENTRY(STG_E_NOMOREFILES)\n\n\t\tERROR_ENTRY(STG_E_DISKISWRITEPROTECTED)\n\n\t\tERROR_ENTRY(STG_E_SEEKERROR)\n\n\t\tERROR_ENTRY(STG_E_WRITEFAULT)\n\n\t\tERROR_ENTRY(STG_E_READFAULT)\n\n\t\tERROR_ENTRY(STG_E_SHAREVIOLATION)\n\n\t\tERROR_ENTRY(STG_E_LOCKVIOLATION)\n\n\t\tERROR_ENTRY(STG_E_FILEALREADYEXISTS)\n\n\t\tERROR_ENTRY(STG_E_INVALIDPARAMETER)\n\n\t\tERROR_ENTRY(STG_E_MEDIUMFULL)\n\n\t\tERROR_ENTRY(STG_E_PROPSETMISMATCHED)\n\n\t\tERROR_ENTRY(STG_E_ABNORMALAPIEXIT)\n\n\t\tERROR_ENTRY(STG_E_INVALIDHEADER)\n\n\t\tERROR_ENTRY(STG_E_INVALIDNAME)\n\n\t\tERROR_ENTRY(STG_E_UNKNOWN)\n\n\t\tERROR_ENTRY(STG_E_UNIMPLEMENTEDFUNCTION)\n\n\t\tERROR_ENTRY(STG_E_INVALIDFLAG)\n\n\t\tERROR_ENTRY(STG_E_INUSE)\n\n\t\tERROR_ENTRY(STG_E_NOTCURRENT)\n\n\t\tERROR_ENTRY(STG_E_REVERTED)\n\n\t\tERROR_ENTRY(STG_E_CANTSAVE)\n\n\t\tERROR_ENTRY(STG_E_OLDFORMAT)\n\n\t\tERROR_ENTRY(STG_E_OLDDLL)\n\n\t\tERROR_ENTRY(STG_E_SHAREREQUIRED)\n\n\t\tERROR_ENTRY(STG_E_NOTFILEBASEDSTORAGE)\n\n\t\tERROR_ENTRY(STG_E_EXTANTMARSHALLINGS)\n\n\t\tERROR_ENTRY(STG_E_DOCFILECORRUPT)\n\n\t\tERROR_ENTRY(STG_E_BADBASEADDRESS)\n\n\t\tERROR_ENTRY(STG_E_DOCFILETOOLARGE)\n\n\t\tERROR_ENTRY(STG_E_NOTSIMPLEFORMAT)\n\n\t\tERROR_ENTRY(STG_E_INCOMPLETE)\n\n\t\tERROR_ENTRY(STG_E_TERMINATED)\n\n\n\n\t\tERROR_ENTRY(MAPI_E_NO_SUPPORT)\n\n\t\tERROR_ENTRY(MAPI_E_BAD_CHARWIDTH)\n\n\t\tERROR_ENTRY(MAPI_E_STRING_TOO_LONG)\n\n\t\tERROR_ENTRY(MAPI_E_UNKNOWN_FLAGS)\n\n\t\tERROR_ENTRY(MAPI_E_INVALID_ENTRYID)\n\n\t\tERROR_ENTRY(MAPI_E_INVALID_OBJECT)\n\n\t\tERROR_ENTRY(MAPI_E_OBJECT_CHANGED)\n\n\t\tERROR_ENTRY(MAPI_E_OBJECT_DELETED)\n\n\t\tERROR_ENTRY(MAPI_E_BUSY)\n\n\t\tERROR_ENTRY(MAPI_E_NOT_ENOUGH_DISK)\n\n\t\tERROR_ENTRY(MAPI_E_NOT_ENOUGH_RESOURCES)\n\n\t\tERROR_ENTRY(MAPI_E_NOT_FOUND)\n\n\t\tERROR_ENTRY(MAPI_E_VERSION)\n\n\t\tERROR_ENTRY(MAPI_E_LOGON_FAILED)\n\n\t\tERROR_ENTRY(MAPI_E_SESSION_LIMIT)\n\n\t\tERROR_ENTRY(MAPI_E_USER_CANCEL)\n\n\t\tERROR_ENTRY(MAPI_E_UNABLE_TO_ABORT)\n\n\t\tERROR_ENTRY(MAPI_E_NETWORK_ERROR)\n\n\t\tERROR_ENTRY(MAPI_E_DISK_ERROR)\n\n\t\tERROR_ENTRY(MAPI_E_TOO_COMPLEX)\n\n\t\tERROR_ENTRY(MAPI_E_BAD_COLUMN)\n\n\t\tERROR_ENTRY(MAPI_E_EXTENDED_ERROR)\n\n\t\tERROR_ENTRY(MAPI_E_COMPUTED)\n\n\t\tERROR_ENTRY(MAPI_E_CORRUPT_DATA)\n\n\t\tERROR_ENTRY(MAPI_E_UNCONFIGURED)\n\n\t\tERROR_ENTRY(MAPI_E_FAILONEPROVIDER)\n\n\t\tERROR_ENTRY(MAPI_E_UNKNOWN_CPID)\n\n\t\tERROR_ENTRY(MAPI_E_UNKNOWN_LCID)\n\n\n\n\t\t// Flavors of E_ACCESSDENIED, used at logon\n\n\t\tERROR_ENTRY(MAPI_E_PASSWORD_CHANGE_REQUIRED)\n\n\t\tERROR_ENTRY(MAPI_E_PASSWORD_EXPIRED)\n\n\t\tERROR_ENTRY(MAPI_E_INVALID_WORKSTATION_ACCOUNT)\n\n\t\tERROR_ENTRY(MAPI_E_INVALID_ACCESS_TIME)\n\n\t\tERROR_ENTRY(MAPI_E_ACCOUNT_DISABLED)\n\n\n\n\t\t// Reconnect\n\n\t\tERROR_ENTRY(MAPI_E_RECONNECTED)\n\n\t\tERROR_ENTRY(MAPI_E_OFFLINE)\n\n\n\n\t\t// COM errors (for CLSIDFromString)\n\n\t\tERROR_ENTRY(REGDB_E_WRITEREGDB)\n\n\t\tERROR_ENTRY(REGDB_E_CLASSNOTREG)\n\n\t\tERROR_ENTRY(CO_E_CLASSSTRING)\n\n\n\n\t\t// MAPI base function and status object specific errors and warnings\n\n\t\tERROR_ENTRY(MAPI_E_END_OF_SESSION)\n\n\t\tERROR_ENTRY(MAPI_E_UNKNOWN_ENTRYID)\n\n\t\tERROR_ENTRY(MAPI_E_MISSING_REQUIRED_COLUMN)\n\n\n\n\t\tERROR_ENTRY(MAPI_E_PROFILE_DELETED)\n\n\n\n\t\t// Property specific errors and warnings\n\n\t\tERROR_ENTRY(MAPI_E_BAD_VALUE)\n\n\t\tERROR_ENTRY(MAPI_E_INVALID_TYPE)\n\n\t\tERROR_ENTRY(MAPI_E_TYPE_NO_SUPPORT)\n\n\t\tERROR_ENTRY(MAPI_E_UNEXPECTED_TYPE)\n\n\t\tERROR_ENTRY(MAPI_E_TOO_BIG)\n\n\t\tERROR_ENTRY(MAPI_E_DECLINE_COPY)\n\n\t\tERROR_ENTRY(MAPI_E_UNEXPECTED_ID)\n\n\n\n\t\t// Table specific errors and warnings\n\n\t\tERROR_ENTRY(MAPI_E_UNABLE_TO_COMPLETE)\n\n\t\tERROR_ENTRY(MAPI_E_TIMEOUT)\n\n\t\tERROR_ENTRY(MAPI_E_TABLE_EMPTY)\n\n\t\tERROR_ENTRY(MAPI_E_TABLE_TOO_BIG)\n\n\n\n\t\tERROR_ENTRY(MAPI_E_INVALID_BOOKMARK)\n\n\n\n\t\t// Transport specific errors and warnings\n\n\t\tERROR_ENTRY(MAPI_E_WAIT)\n\n\t\tERROR_ENTRY(MAPI_E_CANCEL)\n\n\t\tERROR_ENTRY(MAPI_E_NOT_ME)\n\n\n\n\t\t// Message Store, Folder, and Message specific errors and warnings\n\n\t\tERROR_ENTRY(MAPI_E_CORRUPT_STORE)\n\n\t\tERROR_ENTRY(MAPI_E_NOT_IN_QUEUE)\n\n\t\tERROR_ENTRY(MAPI_E_NO_SUPPRESS)\n\n\t\tERROR_ENTRY(MAPI_E_COLLISION)\n\n\t\tERROR_ENTRY(MAPI_E_NOT_INITIALIZED)\n\n\t\tERROR_ENTRY(MAPI_E_NON_STANDARD)\n\n\t\tERROR_ENTRY(MAPI_E_NO_RECIPIENTS)\n\n\t\tERROR_ENTRY(MAPI_E_SUBMITTED)\n\n\t\tERROR_ENTRY(MAPI_E_HAS_FOLDERS)\n\n\t\tERROR_ENTRY(MAPI_E_HAS_MESSAGES)\n\n\t\tERROR_ENTRY(MAPI_E_FOLDER_CYCLE)\n\n\t\tERROR_ENTRY(MAPI_E_STORE_FULL)\n\n\t\tERROR_ENTRY(MAPI_E_LOCKID_LIMIT)\n\n\n\n\t\t// Address Book specific errors and warnings\n\n\t\tERROR_ENTRY(MAPI_E_AMBIGUOUS_RECIP)\n\n\n\n\t\tERROR_ENTRY(SYNC_E_OBJECT_DELETED)\n\n\t\tERROR_ENTRY(SYNC_E_IGNORE)\n\n\t\tERROR_ENTRY(SYNC_E_CONFLICT)\n\n\t\tERROR_ENTRY(SYNC_E_NO_PARENT)\n\n\t\tERROR_ENTRY(SYNC_E_CYCLE)\n\n\t\tERROR_ENTRY(SYNC_E_UNSYNCHRONIZED)\n\n\n\n\t\tERROR_ENTRY(MAPI_E_NAMED_PROP_QUOTA_EXCEEDED)\n\n\t\tERROR_ENTRY(E_FILE_NOT_FOUND)\n\n\t\tERROR_ENTRY(MAPI_E_NO_ACCESS)\n\n\t\tERROR_ENTRY(MAPI_E_NOT_ENOUGH_MEMORY)\n\n\n\n\t\t// StrSafe.h error codes:\n\n\t\tERROR_ENTRY(STRSAFE_E_END_OF_FILE)\n\n\t\tERROR_ENTRY(MAPI_E_INVALID_PARAMETER)\n\n\t\tERROR_ENTRY(STRSAFE_E_INSUFFICIENT_BUFFER)\n\n\t\tERROR_ENTRY(E_ERROR_PROC_NOT_FOUND)\n\n\t\tERROR_ENTRY(E_RPC_S_INVALID_TAG)\n\n\n\n\t\tERROR_ENTRY(E_OLK_REGISTRY)\n\n\t\tERROR_ENTRY(E_OLK_ALREADY_INITIALIZED)\n\n\t\tERROR_ENTRY(E_OLK_PARAM_NOT_SUPPORTED)\n\n\t\tERROR_ENTRY(E_OLK_NOT_INITIALIZED)\n\n\t\tERROR_ENTRY(E_OLK_PROP_READ_ONLY)\n\n\t\tERROR_ENTRY(E_ACCT_NOT_FOUND)\n\n\t\tERROR_ENTRY(E_ACCT_WRONG_SORT_ORDER)\n\n\t\tERROR_ENTRY(E_NOTIMPL)\n\n\n\n\t\tERROR_ENTRY(MAIL_E_NAMENOTFOUND)\n\n\t\t// clang-format on\n\n\t};\n\n\n\n\tULONG g_ulErrorArray = _countof(g_ErrorArray);\n", "file_path": "core/interpret/errorArray.h", "rank": 2, "score": 103654.1564762367 }, { "content": "\tSPropProblem\taProblem[MAPI_DIM];\n", "file_path": "include/MAPIDefS.h", "rank": 3, "score": 98165.68790083051 }, { "content": "\tULONG\t\t\tcProblem;\n", "file_path": "include/MAPIDefS.h", "rank": 4, "score": 98165.68790083051 }, { "content": "\tlong lReturnValue;\n", "file_path": "include/MAPIDefS.h", "rank": 5, "score": 95570.74758222798 }, { "content": "\tLPTSTR\tlpszError;\n", "file_path": "include/MAPIDefS.h", "rank": 6, "score": 95542.417477905 }, { "content": "\tINTTRACEENTRY\trgIntTraceEntry[MAPI_DIM];\t// array of internal trace entries\n", "file_path": "include/EdkMdb.h", "rank": 7, "score": 93107.84532902428 }, { "content": "void EXPORTDBG __cdecl\t\tDebugTraceProblemsFn(char *sz, void *rgprob);\n", "file_path": "include/MAPIDbg.h", "rank": 8, "score": 93106.13777624397 }, { "content": "\tLPMAPIERROR\tlpMAPIError;\t\t/* Detailed error information */\n", "file_path": "include/MAPIDefS.h", "rank": 9, "score": 93080.24530455875 }, { "content": "\tULONG\tulLowLevelError;\n", "file_path": "include/MAPIDefS.h", "rank": 10, "score": 90741.78757831694 }, { "content": "\tHRESULT\t\t\t\thResult;\t\t/* Value for TABLE_ERROR */\n", "file_path": "include/MAPIDefS.h", "rank": 11, "score": 88985.22684243946 }, { "content": "\tULONG ulFlag[MAPI_DIM];\n", "file_path": "include/MAPIDefS.h", "rank": 12, "score": 87728.3796294595 }, { "content": "\t\tULONG ulErrorName;\n", "file_path": "core/utility/error.h", "rank": 13, "score": 62269.48252290475 }, { "content": "#define E_ERROR_PROC_NOT_FOUND HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND)\n", "file_path": "core/interpret/errorArray.h", "rank": 14, "score": 60208.352693955545 }, { "content": " HRESULT ( STDMETHODCALLTYPE *RegisterProperty )(\n\n IMimePropertySchema * This,\n\n /* [in] */ LPCSTR pszName,\n\n /* [in] */ DWORD dwFlags,\n\n /* [in] */ DWORD dwRowNumber,\n\n /* [in] */ VARTYPE vtDefault,\n", "file_path": "include/mimeole.h", "rank": 23, "score": 53038.570954542316 }, { "content": "#include <StdAfx.h>\n\n#include <MrMapi/MMErr.h>\n\n#include <MrMapi/mmcli.h>\n\n#include <core/utility/strings.h>\n\n\n\nnamespace error\n\n{\n\n\textern ERROR_ARRAY_ENTRY g_ErrorArray[];\n\n\textern ULONG g_ulErrorArray;\n\n} // namespace error\n\n\n\nvoid PrintErrFromNum(_In_ ULONG ulError)\n\n{\n\n\twprintf(L\"0x%08lX = %ws\\n\", ulError, error::ErrorNameFromErrorCode(ulError).c_str());\n\n}\n\n\n\nvoid PrintErrFromName(_In_ const std::wstring& lpszError) noexcept\n\n{\n\n\tconst auto szErr = lpszError.c_str();\n\n\n", "file_path": "MrMapi/MMErr.cpp", "rank": 24, "score": 38.42191685146779 }, { "content": "\t\t\t}\n\n\t\t}\n\n\n\n\t\toutput::DebugPrintEx(output::dbgLevel::FormViewer, CLASS, L\"GetViewStatus\", L\"Returning 0x%X\\n\", *lpulStatus);\n\n\t\treturn S_OK;\n\n\t}\n\n\n\n\t_Check_return_ HRESULT CMyMAPIFormViewer::GetNextMessage(\n\n\t\tULONG ulDir,\n\n\t\t_Out_ int* piNewItem,\n\n\t\t_Out_ ULONG* pulStatus,\n\n\t\t_Deref_out_opt_ LPMESSAGE* ppMessage) const\n\n\t{\n\n\t\toutput::DebugPrintEx(output::dbgLevel::FormViewer, CLASS, L\"GetNextMessage\", L\"ulDir = 0x%X\\n\", ulDir);\n\n\t\tauto hRes = S_OK;\n\n\n\n\t\t*piNewItem = NULL;\n\n\t\t*pulStatus = NULL;\n\n\t\t*ppMessage = nullptr;\n\n\n", "file_path": "UI/MyMAPIFormViewer.cpp", "rank": 25, "score": 36.91046724469932 }, { "content": "\n\n\t\tGUID GetSelectedGUID(ULONG id, bool bByteSwapped) const;\n\n\n\n\t\t// AddIn functions\n\n\t\tvoid SetAddInTitle(const std::wstring& szTitle);\n\n\t\tvoid SetAddInLabel(ULONG id, const std::wstring& szLabel) const;\n\n\n\n\t\t// Use this function to implement list editing\n\n\t\t// return true to indicate the entry was changed, false to indicate it was not\n\n\t\t_Check_return_ virtual bool\n\n\t\tDoListEdit(ULONG /*ulListNum*/, int /*iItem*/, _In_ sortlistdata::sortListData* /*lpData*/)\n\n\t\t{\n\n\t\t\treturn false;\n\n\t\t}\n\n\n\n\tprotected:\n\n\t\t// Functions used by derived classes during init\n\n\t\tvoid InsertColumn(ULONG id, int nCol, UINT uidText) const;\n\n\t\tvoid InsertColumn(ULONG id, int nCol, UINT uidText, ULONG ulPropType) const;\n\n\t\tvoid SetListString(ULONG id, ULONG iListRow, ULONG iListCol, const std::wstring& szListString) const;\n", "file_path": "UI/Dialogs/Editors/Editor.h", "rank": 26, "score": 35.393653256151254 }, { "content": "\t\treturn hRes;\n\n\t}\n\n\n\n\tvoid ForceRop(_In_ LPMDB lpMDB)\n\n\t{\n\n\t\tLPSPropValue lpProp = nullptr;\n\n\t\t// Try to trigger a rop to get notifications going\n\n\t\tWC_MAPI_S(HrGetOneProp(lpMDB, PR_TEST_LINE_SPEED, &lpProp));\n\n\t\t// No need to worry about errors here - this is just to force rops\n\n\t\tMAPIFreeBuffer(lpProp);\n\n\t}\n\n\n\n\t_Check_return_ HRESULT\n\n\tHrDupPropset(int cprop, _In_count_(cprop) LPSPropValue rgprop, _In_ const VOID* parent, _In_ LPSPropValue* prgprop)\n\n\t{\n\n\t\tULONG cb = NULL;\n\n\n\n\t\t// Find out how much memory we need\n\n\t\tauto hRes = EC_MAPI(ScCountProps(cprop, rgprop, &cb));\n\n\n", "file_path": "core/mapi/mapiFunctions.cpp", "rank": 27, "score": 35.100280230219965 }, { "content": "\t\t_Check_return_ bool IsModifiedPropVals() const;\n\n\n\n\t\t_Check_return_ bool HandleMenu(WORD wMenuSelect);\n\n\t\tvoid InitMenu(_In_ CMenu* pMenu) const;\n\n\t\tvoid SavePropsToXML();\n\n\t\tvoid OnPasteProperty();\n\n\n\n\tprivate:\n\n\t\tLRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam) override;\n\n\t\tvoid AddPropToExtraProps(ULONG ulPropTag, bool bRefresh);\n\n\t\tvoid AddPropsToExtraProps(_In_ LPSPropTagArray lpPropsToAdd, bool bRefresh);\n\n\t\tvoid FindAllNamedProps();\n\n\t\tvoid CountNamedProps();\n\n\t\t_Check_return_ HRESULT LoadMAPIPropList();\n\n\n\n\t\tvoid AddPropToListBox(\n\n\t\t\tint iRow,\n\n\t\t\tULONG ulPropTag,\n\n\t\t\t_In_opt_ const MAPINAMEID* lpNameID,\n\n\t\t\t_In_opt_ const SBinary*\n", "file_path": "UI/Controls/SortList/SingleMAPIPropListCtrl.h", "rank": 28, "score": 34.42914359051704 }, { "content": "\t\tvoid LookupNamedProp(ULONG ulSkipField, bool bCreate);\n\n\t\t_Check_return_ std::wstring GetDropStringUseControl(ULONG id) const;\n\n\t\t_Check_return_ int GetDropDownSelection(ULONG id) const;\n\n\t\tvoid InsertDropString(ULONG id, int iRow, _In_ const std::wstring& szText) const;\n\n\t\tvoid SetDropDownSelection(ULONG i, _In_ const std::wstring& szText) const;\n\n\n\n\t\tULONG m_ulPropTag;\n\n\t\tbool m_bIsAB;\n\n\t\tLPMAPIPROP m_lpMAPIProp;\n\n\t};\n\n} // namespace dialog::editor", "file_path": "UI/Dialogs/Editors/PropertyTagEditor.h", "rank": 29, "score": 33.96746741114734 }, { "content": "\t}\n\n\n\n\t// Parse this for XML:\n\n\t// Err: 0x00040380=MAPI_W_ERRORS_RETURNED\n\n\tstd::wstring errPropToXML(UINT uidTag, const std::wstring str, int iIndent)\n\n\t{\n\n\t\tauto toks = strings::tokenize(str);\n\n\t\tif (toks.count(L\"Err\"))\n\n\t\t{\n\n\t\t\tauto err = strings::split(toks[L\"Err\"], L'=');\n\n\t\t\tif (err.size() == 2)\n\n\t\t\t{\n\n\t\t\t\tauto attr = property::Attributes();\n\n\t\t\t\tattr.AddAttribute(L\"err\", err[0]);\n\n\n\n\t\t\t\tauto parsing = property::Parsing(err[1], true, attr);\n\n\t\t\t\treturn parsing.toXML(uidTag, iIndent);\n\n\t\t\t}\n\n\t\t}\n\n\n", "file_path": "UI/Controls/SortList/SingleMAPIPropListCtrl.cpp", "rank": 30, "score": 33.86445541742068 }, { "content": "#include <StdAfx.h>\n\n#include <UI/ViewPane/ListPane.h>\n\n#include <UI/UIFunctions.h>\n\n#include <utility>\n\n#include <core/utility/strings.h>\n\n#include <core/utility/output.h>\n\n\n\nnamespace viewpane\n\n{\n\n\tstatic std::wstring CLASS = L\"ListPane\";\n\n\n\n\tstd::shared_ptr<ListPane> ListPane::Create(\n\n\t\tconst int paneID,\n\n\t\tconst UINT uidLabel,\n\n\t\tconst bool bAllowSort,\n\n\t\tconst bool bReadOnly,\n\n\t\tDoListEditCallback callback)\n\n\t{\n\n\t\tauto pane = std::make_shared<ListPane>();\n\n\n", "file_path": "UI/ViewPane/ListPane.cpp", "rank": 31, "score": 33.5715795425559 }, { "content": "#include <StdAfx.h>\n\n#include <UI/ViewPane/TextPane.h>\n\n#include <core/utility/strings.h>\n\n#include <UI/UIFunctions.h>\n\n#include <core/utility/output.h>\n\n\n\nnamespace viewpane\n\n{\n\n\tstatic std::wstring CLASS = L\"TextPane\";\n\n\n\n\tstd::shared_ptr<TextPane> TextPane::CreateMultiLinePane(const int paneID, const UINT uidLabel, const bool bReadOnly)\n\n\t{\n\n\t\treturn CreateSingleLinePane(paneID, uidLabel, bReadOnly, true);\n\n\t}\n\n\n\n\tstd::shared_ptr<TextPane> TextPane::CreateMultiLinePane(\n\n\t\tconst int paneID,\n\n\t\tconst UINT uidLabel,\n\n\t\t_In_ const std::wstring& szVal,\n\n\t\tconst bool bReadOnly)\n", "file_path": "UI/ViewPane/TextPane.cpp", "rank": 32, "score": 33.532542556127304 }, { "content": "\t\t_Check_return_ sortlistdata::sortListData* InsertListRow(ULONG id, int iRow, const std::wstring& szText) const;\n\n\t\tvoid ClearList(ULONG id) const;\n\n\t\tvoid ResizeList(ULONG id, bool bSort) const;\n\n\t\tvoid SetListID(ULONG id) noexcept { m_listID = id; }\n\n\n\n\t\t// Functions used by derived classes during handle change events\n\n\t\t_Check_return_ std::string GetStringA(ULONG id) const;\n\n\t\t_Check_return_ ULONG GetListCount(ULONG id) const;\n\n\t\t_Check_return_ sortlistdata::sortListData* GetListRowData(ULONG id, int iRow) const;\n\n\t\t_Check_return_ bool IsDirty(ULONG id) const;\n\n\n\n\t\t// Called to enable/disable buttons based on number of items\n\n\t\tvoid UpdateButtons() const;\n\n\t\tBOOL OnInitDialog() override;\n\n\t\tvoid OnOK() override;\n\n\t\tvoid OnRecalcLayout();\n\n\n\n\t\t// protected since derived classes need to call the base implementation\n\n\t\t_Check_return_ virtual ULONG HandleChange(UINT nID);\n\n\n", "file_path": "UI/Dialogs/Editors/Editor.h", "rank": 33, "score": 33.39286529517913 }, { "content": "\t\tUINT m_iTextBox;\n\n\t\tUINT m_iFlagBox;\n\n\t\tUINT m_iCodePageBox;\n\n\t\tUINT m_iBinBox;\n\n\t\tUINT m_iSmartViewBox;\n\n\t\tbool m_bDoSmartView;\n\n\t\tbool m_bDocFile;\n\n\t\tbool m_bAllowTypeGuessing;\n\n\t\tbool m_bDisableSave;\n\n\t\tULONG m_ulEditorType;\n\n\t\tHRESULT m_StreamError;\n\n\t};\n\n} // namespace dialog::editor", "file_path": "UI/Dialogs/Editors/StreamEditor.h", "rank": 34, "score": 33.34750742620992 }, { "content": "\t\t\t\t::SendMessage(this->GetParent()->GetSafeHwnd(), WM_CLOSE, NULL, NULL);\n\n\t\t\t\treturn true;\n\n\t\t\t}\n\n\n\n\t\t\treturn false;\n\n\t\t};\n\n\t\tstd::function<void(LPARAM lpData)> FreeNodeDataCallback = nullptr;\n\n\t\tstd::function<void(HTREEITEM hParent)> ExpandNodeCallback = nullptr;\n\n\t\tstd::function<void()> OnRefreshCallback = nullptr;\n\n\t\tstd::function<void(HTREEITEM hItem, LPTSTR szText)> OnLabelEditCallback = nullptr;\n\n\t\tstd::function<void()> OnDisplaySelectedItemCallback = nullptr;\n\n\t\tstd::function<void(LPARAM lpData)> OnLastChildDeletedCallback = nullptr;\n\n\t\tstd::function<void(int x, int y)> HandleContextMenuCallback = nullptr;\n\n\t\tstd::function<void(NMHDR*, LRESULT*, HTREEITEM)> OnCustomDrawCallback = nullptr;\n\n\n\n\tprotected:\n\n\t\tLRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam) override;\n\n\t\tBOOL PreTranslateMessage(MSG* pMsg) override;\n\n\n\n\t\t// Node management\n", "file_path": "UI/Controls/StyleTree/StyleTreeCtrl.h", "rank": 35, "score": 33.21154563646277 }, { "content": "#include <StdAfx.h>\n\n#include <UI/ViewPane/DropDownPane.h>\n\n#include <core/interpret/guid.h>\n\n#include <core/utility/strings.h>\n\n#include <UI/UIFunctions.h>\n\n#include <core/addin/addin.h>\n\n#include <core/addin/mfcmapi.h>\n\n\n\nnamespace viewpane\n\n{\n\n\tstd::shared_ptr<DropDownPane> DropDownPane::Create(\n\n\t\tconst int paneID,\n\n\t\tconst UINT uidLabel,\n\n\t\tconst ULONG ulDropList,\n\n\t\t_In_opt_count_(ulDropList) UINT* lpuidDropList,\n\n\t\tconst bool bReadOnly)\n\n\t{\n\n\t\tauto pane = std::make_shared<DropDownPane>();\n\n\t\tif (pane)\n\n\t\t{\n", "file_path": "UI/ViewPane/DropDownPane.cpp", "rank": 36, "score": 32.93558021794524 }, { "content": "\t\tvoid OnSendBulkMail();\n\n\t\tvoid OnSaveMessageToFile();\n\n\t\tvoid OnExportMessages();\n\n\t\tvoid OnSetReadFlag();\n\n\t\tvoid OnSetMessageStatus();\n\n\t\tvoid OnGetMessageOptions();\n\n\t\tvoid OnCreateMessageRestriction();\n\n\t\tvoid OnDisplayFolder(WORD wMenuSelect);\n\n\t\t_Check_return_ HRESULT OnAbortSubmit(int iItem, _In_ sortlistdata::sortListData* lpData);\n\n\t\t_Check_return_ HRESULT OnAttachmentProperties(int iItem, _In_ sortlistdata::sortListData* lpData);\n\n\t\t_Check_return_ HRESULT OnGetMessageStatus(int iItem, _In_ sortlistdata::sortListData* lpData);\n\n\t\t_Check_return_ HRESULT OnOpenModal(int iItem, _In_ sortlistdata::sortListData* lpData);\n\n\t\t_Check_return_ HRESULT OnOpenNonModal(int iItem, _In_ sortlistdata::sortListData* lpData);\n\n\t\t_Check_return_ HRESULT OnRecipientProperties(int iItem, _In_ sortlistdata::sortListData* lpData);\n\n\t\t_Check_return_ HRESULT OnResendSelectedItem(int iItem, _In_ sortlistdata::sortListData* lpData);\n\n\t\t_Check_return_ HRESULT OnSaveAttachments(int iItem, _In_ sortlistdata::sortListData* lpData);\n\n\t\t_Check_return_ HRESULT OnSubmitMessage(int iItem, _In_ sortlistdata::sortListData* lpData);\n\n\t\tLPMESSAGE OpenMessage(int iSelectedItem, modifyType bModify);\n\n\n\n\t\t_Check_return_ bool MultiSelectComplex(WORD wMenuSelect);\n\n\t\t_Check_return_ bool MultiSelectSimple(WORD wMenuSelect);\n\n\t\tvoid NewSpecialItem(WORD wMenuSelect) const;\n\n\n\n\t\tLPMAPIFOLDER m_lpFolder;\n\n\t};\n\n} // namespace dialog", "file_path": "UI/Dialogs/ContentsTable/FolderDlg.h", "rank": 37, "score": 32.73354378334891 }, { "content": "int __cdecl main()\n\n{\n\n\tHRESULT hr = S_OK;\n\n\n\n\tMAPIINIT_0 MAPIINIT = {0, MAPI_MULTITHREAD_NOTIFICATIONS};\n\n\n\n\t//ForceOutlookMAPI(true);\n\n\n\n\t//TestSimpleMapi();\n\n\n\n\tCORg(MAPIInitialize(&MAPIINIT));\n\n\n\n\t{ // IMAPISession Smart Pointer Context\n\n\t\tCComPtr<IMAPISession> spSession;\n\n\t\tCORg(MAPILogonEx(NULL, nullptr, nullptr, MAPI_UNICODE | MAPI_LOGON_UI, &spSession));\n\n\n\n\t\tListStoresTable(spSession);\n\n\t}\n\n\n\n\tMAPIUninitialize();\n\n\n\nError:\n\n\treturn 0;\n\n}\n", "file_path": "exampleMapiConsoleApp/exampleMapiConsoleApp.cpp", "rank": 38, "score": 32.58235921381995 }, { "content": "\n\n\tprotected:\n\n\t\tvoid MySetRedraw(bool bRedraw);\n\n\t\t_Check_return_ sortlistdata::sortListData*\n\n\t\tInsertRow(int iRow, const std::wstring& szText, int iIndent, sortIcon iImage) const;\n\n\t\tvoid FakeClickColumn(int iColumn, bool bSortUp);\n\n\n\n\t\t// protected since derived classes need to call the base implementation\n\n\t\tLRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam) override;\n\n\n\n\tprivate:\n\n\t\t// Overrides from base class\n\n\t\t_Check_return_ UINT OnGetDlgCode();\n\n\n\n\t\tvoid OnColumnClick(int iColumn);\n\n\t\tvoid OnDeleteAllItems(_In_ NMHDR* pNMHDR, _In_ LRESULT* pResult) noexcept;\n\n\t\tvoid OnDeleteItem(_In_ NMHDR* pNMHDR, _In_ LRESULT* pResult);\n\n\t\tvoid AutoSizeColumn(int iColumn, int iMaxWidth, int iMinWidth);\n\n\t\tvoid OnCustomDraw(_In_ NMHDR* pNMHDR, _In_ LRESULT* pResult) noexcept;\n\n\t\t_Check_return_ static int CALLBACK\n", "file_path": "UI/Controls/SortList/SortListCtrl.h", "rank": 39, "score": 32.49112797318931 }, { "content": "#include <core/stdafx.h>\n\n#include <core/mapi/mapiProfileFunctions.h>\n\n#include <core/mapi/extraPropTags.h>\n\n#include <core/utility/output.h>\n\n#include <core/utility/strings.h>\n\n#include <core/utility/error.h>\n\n#include <core/mapi/mapiFunctions.h>\n\n#include <core/mapi/interfaces.h>\n\n#include <core/mapi/mapiOutput.h>\n\n\n\nnamespace mapi::profile\n\n{\n\n#define PR_MARKER PR_BODY_A\n\n#define MARKER_STRING \"MFCMAPI Existing Provider Marker\" // STRING_OK\n\n\t// Walk through providers and add/remove our tag\n\n\t// bAddMark of true will add tag, bAddMark of false will remove it\n\n\t_Check_return_ HRESULT HrMarkExistingProviders(_In_ LPSERVICEADMIN lpServiceAdmin, bool bAddMark)\n\n\t{\n\n\t\tLPMAPITABLE lpProviderTable = nullptr;\n\n\n", "file_path": "core/mapi/mapiProfileFunctions.cpp", "rank": 40, "score": 32.40478115444194 }, { "content": "#include <StdAfx.h>\n\n#include <UI/ViewPane/TreePane.h>\n\n#include <utility>\n\n#include <core/utility/output.h>\n\n\n\nnamespace viewpane\n\n{\n\n\tstd::shared_ptr<TreePane> TreePane::Create(int paneID, UINT uidLabel, bool bReadOnly)\n\n\t{\n\n\t\tauto pane = std::make_shared<TreePane>();\n\n\t\tif (pane)\n\n\t\t{\n\n\t\t\tif (uidLabel)\n\n\t\t\t{\n\n\t\t\t\tpane->SetLabel(uidLabel);\n\n\t\t\t\tpane->m_bCollapsible = true;\n\n\t\t\t}\n\n\n\n\t\t\tpane->SetReadOnly(bReadOnly);\n\n\t\t\tpane->m_paneID = paneID;\n", "file_path": "UI/ViewPane/TreePane.cpp", "rank": 41, "score": 32.13478641933249 }, { "content": "\t\tvoid InsertColumn(int nCol, UINT uidText);\n\n\t\tvoid SetColumnType(int nCol, ULONG ulPropType) const;\n\n\t\t_Check_return_ bool OnEditListEntry();\n\n\t\tstd::wstring GetItemText(_In_ int nItem, _In_ int nSubItem) const;\n\n\t\tbool IsDirty() override;\n\n\n\n\tprivate:\n\n\t\tvoid Setup(bool bAllowSort, DoListEditCallback callback) noexcept;\n\n\n\n\t\tvoid UpdateButtons() override;\n\n\n\n\t\tvoid Initialize(_In_ CWnd* pParent, _In_ HDC hdc) override;\n\n\t\tvoid DeferWindowPos(_In_ HDWP hWinPosInfo, _In_ int x, _In_ int y, _In_ int width, _In_ int height) override;\n\n\t\tvoid CommitUIValues() override;\n\n\t\tint GetMinWidth() override;\n\n\t\tint GetFixedHeight() override;\n\n\t\tint GetLines() override;\n\n\n\n\t\tvoid SwapListItems(ULONG ulFirstItem, ULONG ulSecondItem);\n\n\t\tvoid OnMoveListEntryUp();\n", "file_path": "UI/ViewPane/ListPane.h", "rank": 42, "score": 31.99379790609452 }, { "content": "\t\treturn GetTextualSid(buf.data());\n\n\t}\n\n\n\n\t_Check_return_ SidAccount LookupAccountSid(PSID SidStart)\n\n\t{\n\n\t\tif (!IsValidSid(SidStart)) return {};\n\n\n\n\t\t// TODO: Make use of SidNameUse information\n\n\t\tauto cchSidName = DWORD{};\n\n\t\tauto cchSidDomain = DWORD{};\n\n\t\tauto SidNameUse = SID_NAME_USE{};\n\n\n\n\t\tif (!LookupAccountSidW(nullptr, SidStart, nullptr, &cchSidName, nullptr, &cchSidDomain, &SidNameUse))\n\n\t\t{\n\n\t\t\tconst auto dwErr = GetLastError();\n\n\t\t\tif (dwErr != ERROR_NONE_MAPPED && dwErr != ERROR_INSUFFICIENT_BUFFER)\n\n\t\t\t{\n\n\t\t\t\terror::LogFunctionCall(\n\n\t\t\t\t\tHRESULT_FROM_WIN32(dwErr), NULL, false, false, true, dwErr, \"LookupAccountSid\", __FILE__, __LINE__);\n\n\t\t\t}\n", "file_path": "core/interpret/sid.cpp", "rank": 43, "score": 31.900952461343618 }, { "content": "\t}\n\n\n\n\t_Check_return_ sortlistdata::sortListData* ListPane::GetSelectedListRowData() const\n\n\t{\n\n\t\tconst auto iItem = m_List.GetNextItem(-1, LVNI_FOCUSED | LVNI_SELECTED);\n\n\n\n\t\tif (-1 != iItem)\n\n\t\t{\n\n\t\t\treturn GetItemData(iItem);\n\n\t\t}\n\n\n\n\t\treturn nullptr;\n\n\t}\n\n\n\n\tvoid ListPane::InsertColumn(int nCol, UINT uidText) { m_List.InsertColumnW(nCol, strings::loadstring(uidText)); }\n\n\n\n\tvoid ListPane::SetColumnType(int nCol, ULONG ulPropType) const\n\n\t{\n\n\t\tHDITEM hdItem = {};\n\n\t\tauto lpMyHeader = m_List.GetHeaderCtrl();\n", "file_path": "UI/ViewPane/ListPane.cpp", "rank": 44, "score": 31.883067805954923 }, { "content": "// Export profile to file\n\n\n\n#include <core/stdafx.h>\n\n#include <core/mapi/exportProfile.h>\n\n#include <core/mapi/mapiProfileFunctions.h>\n\n#include <core/interpret/guid.h>\n\n#include <core/utility/strings.h>\n\n#include <core/mapi/mapiOutput.h>\n\n#include <core/utility/output.h>\n\n#include <core/mapi/mapiFunctions.h>\n\n#include <core/utility/error.h>\n\n\n\nnamespace output\n\n{\n\n\tvoid ExportProfileSection(FILE* fProfile, LPPROFSECT lpSect, const SBinary* lpSectBin)\n\n\t{\n\n\t\tif (!fProfile || !lpSect) return;\n\n\n\n\t\tLPSPropValue lpAllProps = nullptr;\n\n\t\tULONG cValues = 0L;\n", "file_path": "core/mapi/exportProfile.cpp", "rank": 45, "score": 31.2413599409314 }, { "content": "#include <core/stdafx.h>\n\n#include <core/interpret/proptags.h>\n\n#include <core/addin/addin.h>\n\n#include <core/addin/mfcmapi.h>\n\n#include <core/mapi/cache/namedProps.h>\n\n#include <core/utility/strings.h>\n\n#include <core/interpret/proptype.h>\n\n#include <core/utility/output.h>\n\n#include <core/utility/registry.h>\n\n\n\nnamespace proptags\n\n{\n\n\tstatic WCHAR szPropSeparator[] = L\", \"; // STRING_OK\n\n\tstd::unordered_map<ULONG64, PropTagNames> g_PropNames;\n\n\n\n\tstd::wstring TagToString(ULONG ulPropTag, _In_opt_ LPMAPIPROP lpObj, bool bIsAB, bool bSingleLine)\n\n\t{\n\n\t\tstd::wstring szTemp;\n\n\n\n\t\tauto namePropNames = cache::NameIDToStrings(ulPropTag, lpObj, nullptr, nullptr, bIsAB);\n", "file_path": "core/interpret/proptags.cpp", "rank": 46, "score": 31.191310131182107 }, { "content": "\t\tPropVal[0].Value.lpszA = const_cast<LPSTR>(lpszServerNameA.c_str());\n\n\t\tPropVal[1].ulPropTag = PR_PROFILE_UNRESOLVED_NAME;\n\n\t\tauto lpszMailboxNameA = strings::wstringTostring(lpszMailboxName);\n\n\t\tPropVal[1].Value.lpszA = const_cast<LPSTR>(lpszMailboxNameA.c_str());\n\n\t\tconst auto hRes = EC_H(\n\n\t\t\tHrAddServiceToProfile(L\"MSEMS\", ulUIParam, NULL, NUMEXCHANGEPROPS, PropVal, lpszProfileName)); // STRING_OK\n\n\n\n\t\treturn hRes;\n\n\t}\n\n\n\n\t_Check_return_ HRESULT HrAddPSTToProfile(\n\n\t\t_In_ ULONG_PTR ulUIParam, // hwnd for CreateMsgService\n\n\t\tbool bUnicodePST,\n\n\t\t_In_ const std::wstring& lpszPSTPath, // PST name\n\n\t\t_In_ const std::wstring& lpszProfileName, // profile name\n\n\t\tbool bPasswordSet, // whether or not to include a password\n\n\t\t_In_ const std::wstring& lpszPassword) // password to include\n\n\t{\n\n\t\tauto hRes = S_OK;\n\n\n", "file_path": "core/mapi/mapiProfileFunctions.cpp", "rank": 47, "score": 31.149083886629914 }, { "content": "#include <StdAfx.h>\n\n#include <UI/addinui.h>\n\n#include <UI/Dialogs/Editors/TagArrayEditor.h>\n\n#include <UI/UIFunctions.h>\n\n#include <core/addin/addin.h>\n\n#include <core/utility/strings.h>\n\n#include <core/utility/output.h>\n\n#include <core/addin/mfcmapi.h>\n\n\n\nnamespace ui::addinui\n\n{\n\n\t_Check_return_ __declspec(dllexport) HRESULT\n\n\t\t__cdecl SimpleDialog(_In_z_ LPWSTR szTitle, _Printf_format_string_ LPWSTR szMsg, ...)\n\n\t{\n\n\t\tdialog::editor::CEditor MySimpleDialog(nullptr, NULL, NULL, CEDITOR_BUTTON_OK);\n\n\t\tMySimpleDialog.SetAddInTitle(szTitle);\n\n\n\n\t\tva_list argList = nullptr;\n\n\t\tva_start(argList, szMsg);\n\n\t\tconst auto szDialogString = strings::formatV(szMsg, argList);\n", "file_path": "UI/addinui.cpp", "rank": 48, "score": 31.111582859578135 }, { "content": "\t\t_Check_return_ restrictionType GetRestrictionType() const noexcept;\n\n\t\tvoid SetRestrictionType(restrictionType RestrictionType) noexcept;\n\n\t\t_Check_return_ ULONG GetContainerType() const noexcept;\n\n\t\t_Check_return_ bool IsAdviseSet() const noexcept;\n\n\t\t_Check_return_ bool IsContentsTableSet() const noexcept;\n\n\t\tvoid DoSetColumns(bool bAddExtras, bool bDisplayEditor);\n\n\t\tvoid GetStatus();\n\n\t\tbool bAbortLoad() noexcept { return m_bAbortLoad != 0; }\n\n\n\n\tprivate:\n\n\t\tconst static ULONG NODISPLAYNAME{0xffffffff};\n\n\n\n\t\t// Overrides from base class\n\n\t\tLRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam) override;\n\n\t\tvoid OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);\n\n\t\tvoid OnItemChanged(_In_ NMHDR* pNMHDR, _In_ LRESULT* pResult);\n\n\t\tvoid OnContextMenu(_In_ CWnd* pWnd, CPoint pos);\n\n\n\n\t\tvoid AddColumn(UINT uidHeaderName, ULONG ulCurHeaderCol, ULONG ulCurTagArrayRow, ULONG ulPropTag);\n\n\t\tvoid AddColumns(_In_ LPSPropTagArray lpCurColTagArray);\n", "file_path": "UI/Controls/SortList/ContentsTableListCtrl.h", "rank": 49, "score": 30.949070885420817 }, { "content": "\tstd::wcout << L\"Found \" << pmrows->cRows << L\" stores in MAPI profile:\" << std::endl;\n\n\tfor (UINT i = 0; i != pmrows->cRows; i++)\n\n\t{\n\n\t\tconst auto prow = pmrows->aRow + i;\n\n\t\tLPCWSTR pwz = nullptr;\n\n\t\tLPCSTR pwzA = nullptr;\n\n\t\tif (PR_DISPLAY_NAME_W == prow->lpProps[COL_DISPLAYNAME_W].ulPropTag)\n\n\t\t\tpwz = prow->lpProps[COL_DISPLAYNAME_W].Value.lpszW;\n\n\t\tif (PR_DISPLAY_NAME_A == prow->lpProps[COL_DISPLAYNAME_A].ulPropTag)\n\n\t\t\tpwzA = prow->lpProps[COL_DISPLAYNAME_A].Value.lpszA;\n\n\t\tif (pwz)\n\n\t\t\tstd::wcout << L\" \" << std::setw(4) << i << \": \" << (pwz ? pwz : L\"<NULL>\") << std::endl;\n\n\t\telse\n\n\t\t\tstd::wcout << L\" \" << std::setw(4) << i << \": \" << (pwzA ? pwzA : \"<NULL>\") << std::endl;\n\n\t}\n\n\n\nError:\n\n\tFreeProws(pmrows);\n\n\treturn 0;\n\n}\n", "file_path": "exampleMapiConsoleApp/exampleMapiConsoleApp.cpp", "rank": 50, "score": 30.880896869129828 }, { "content": "#include <core/stdafx.h>\n\n#include <core/smartview/XID.h>\n\n#include <core/interpret/guid.h>\n\n#include <core/utility/strings.h>\n\n#include <core/smartview/block/blockBytes.h>\n\n\n\nnamespace smartview\n\n{\n\n\tvoid XID::parse()\n\n\t{\n\n\t\tm_NamespaceGuid = blockT<GUID>::parse(parser);\n\n\t\tconst auto cbLocalId = parser->getSize();\n\n\t\tm_LocalID = blockBytes::parse(parser, cbLocalId, cbLocalId);\n\n\t}\n\n\n\n\tvoid XID::parseBlocks()\n\n\t{\n\n\t\tsetText(L\"XID\");\n\n\t\taddChild(\n\n\t\t\tm_NamespaceGuid, L\"NamespaceGuid = %1!ws!\", guid::GUIDToString(m_NamespaceGuid->getData()).c_str());\n\n\t\tif (m_LocalID) addChild(m_LocalID, L\"LocalId = %1!ws!\", m_LocalID->toHexString(true).c_str());\n\n\t}\n\n} // namespace smartview", "file_path": "core/smartview/XID.cpp", "rank": 51, "score": 30.77521039231211 }, { "content": "\t\tvoid OnGetMinMaxInfo(_Inout_ MINMAXINFO* lpMMI) noexcept\n\n\t\t{\n\n\t\t\tlpMMI->ptMinTrackSize = POINT{m_iMinWidth, m_iMinHeight};\n\n\t\t}\n\n\t\tvoid OnSetDefaultSize();\n\n\t\t_Check_return_ LRESULT OnNcHitTest(CPoint point);\n\n\t\tvoid OnSize(UINT nType, int cx, int cy);\n\n\t\tLRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam) override;\n\n\t\tvoid SetMargins() const;\n\n\n\n\t\t// List functions and data\n\n\t\t_Check_return_ bool OnEditListEntry(ULONG id) const;\n\n\t\tULONG m_listID{NOLIST}; // Only supporting one list right now - this is the pane ID for it\n\n\n\n\t\t// Our UI controls. Only valid during display.\n\n\t\tbool m_bHasPrompt{};\n\n\t\tCEdit m_Prompt;\n\n\t\tCButton m_OkButton;\n\n\t\tCButton m_ActionButton1;\n\n\t\tCButton m_ActionButton2;\n", "file_path": "UI/Dialogs/Editors/Editor.h", "rank": 52, "score": 30.652904719002013 }, { "content": "\t\t\tauto lpAB = m_lpMapiObjects->GetAddrBook(true); // do not release\n\n\t\t\tif (lpAB)\n\n\t\t\t{\n\n\t\t\t\tADRENTRY adrEntry = {};\n\n\t\t\t\tadrEntry.ulReserved1 = 0;\n\n\t\t\t\tadrEntry.cValues = cProps;\n\n\t\t\t\tadrEntry.rgPropVals = lpProps;\n\n\t\t\t\toutput::DebugPrintEx(output::dbgLevel::Generic, CLASS, L\"OnRecipOptions\", L\"Calling RecipOptions\\n\");\n\n\n\n\t\t\t\thRes = EC_MAPI(lpAB->RecipOptions(reinterpret_cast<ULONG_PTR>(m_hWnd), NULL, &adrEntry));\n\n\n\n\t\t\t\tif (hRes == MAPI_W_ERRORS_RETURNED)\n\n\t\t\t\t{\n\n\t\t\t\t\tLPMAPIERROR lpErr = nullptr;\n\n\t\t\t\t\thRes = WC_MAPI(lpAB->GetLastError(hRes, fMapiUnicode, &lpErr));\n\n\t\t\t\t\tif (lpErr)\n\n\t\t\t\t\t{\n\n\t\t\t\t\t\tEC_MAPIERR(fMapiUnicode, lpErr);\n\n\t\t\t\t\t\tMAPIFreeBuffer(lpErr);\n\n\t\t\t\t\t}\n", "file_path": "UI/Dialogs/ContentsTable/RecipientsDlg.cpp", "rank": 53, "score": 30.591141756662218 }, { "content": "#include <StdAfx.h>\n\n#include <UI/ViewPane/CountedTextPane.h>\n\n#include <UI/UIFunctions.h>\n\n#include <core/utility/strings.h>\n\n\n\nnamespace viewpane\n\n{\n\n\tstd::shared_ptr<CountedTextPane>\n\n\tCountedTextPane::Create(const int paneID, const UINT uidLabel, const bool bReadOnly, const UINT uidCountLabel)\n\n\t{\n\n\t\tauto pane = std::make_shared<CountedTextPane>();\n\n\t\tif (pane)\n\n\t\t{\n\n\t\t\tpane->m_szCountLabel = strings::loadstring(uidCountLabel);\n\n\t\t\tpane->SetMultiline();\n\n\t\t\tpane->SetLabel(uidLabel);\n\n\t\t\tpane->ViewPane::SetReadOnly(bReadOnly);\n\n\t\t\tpane->m_bCollapsible = true;\n\n\t\t\tpane->m_paneID = paneID;\n\n\t\t}\n", "file_path": "UI/ViewPane/CountedTextPane.cpp", "rank": 54, "score": 30.458075259005923 }, { "content": "\n\n\t\treturn 0;\n\n\t}\n\n\n\n\t_Check_return_ sortlistdata::sortListData* CEditor::GetListRowData(ULONG id, int iRow) const\n\n\t{\n\n\t\tconst auto pane = std::dynamic_pointer_cast<viewpane::ListPane>(GetPane(id));\n\n\t\tif (pane)\n\n\t\t{\n\n\t\t\treturn pane->GetItemData(iRow);\n\n\t\t}\n\n\n\n\t\treturn nullptr;\n\n\t}\n\n\n\n\t_Check_return_ bool CEditor::IsDirty(ULONG id) const\n\n\t{\n\n\t\tauto pane = GetPane(id);\n\n\t\treturn pane ? pane->IsDirty() : false;\n\n\t}\n", "file_path": "UI/Dialogs/Editors/Editor.cpp", "rank": 55, "score": 30.266580586950887 }, { "content": "// Collection of useful MAPI Address Book functions\n\n\n\n#include <core/stdafx.h>\n\n#include <core/mapi/mapiABFunctions.h>\n\n#include <core/mapi/mapiMemory.h>\n\n#include <core/utility/strings.h>\n\n#include <core/utility/output.h>\n\n#include <core/mapi/mapiOutput.h>\n\n#include <core/mapi/mapiFunctions.h>\n\n#include <core/utility/error.h>\n\n#include <core/mapi/extraPropTags.h>\n\n\n\nnamespace mapi::ab\n\n{\n\n\t_Check_return_ LPADRLIST AllocAdrList(ULONG ulNumProps)\n\n\t{\n\n\t\tif (ulNumProps > ULONG_MAX / sizeof(SPropValue)) return nullptr;\n\n\n\n\t\t// Allocate memory for new SRowSet structure.\n\n\t\tauto lpLocalAdrList = mapi::allocate<LPADRLIST>(CbNewSRowSet(1));\n", "file_path": "core/mapi/mapiABFunctions.cpp", "rank": 56, "score": 30.107132938297212 }, { "content": "#include <StdAfx.h>\n\n#include <UI/ViewPane/SplitterPane.h>\n\n#include <core/utility/output.h>\n\n\n\nnamespace viewpane\n\n{\n\n\tstd::shared_ptr<SplitterPane> SplitterPane::CreateVerticalPane(const int paneID, const UINT uidLabel)\n\n\t{\n\n\t\tconst auto pane = CreateHorizontalPane(paneID, uidLabel);\n\n\t\tpane->m_bVertical = true;\n\n\n\n\t\treturn pane;\n\n\t}\n\n\n\n\tstd::shared_ptr<SplitterPane> SplitterPane::CreateHorizontalPane(const int paneID, const UINT uidLabel)\n\n\t{\n\n\t\tconst auto pane = std::make_shared<SplitterPane>();\n\n\t\tif (pane)\n\n\t\t{\n\n\t\t\tpane->SetLabel(uidLabel);\n", "file_path": "UI/ViewPane/SplitterPane.cpp", "rank": 57, "score": 29.952797261234505 }, { "content": "\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\n\n\t\t\tlpExchTbl->Release();\n\n\t\t}\n\n\n\n\t\treturn hRes;\n\n\t}\n\n\n\n\t_Check_return_ bool bShouldCancel(_In_opt_ CWnd* cWnd, HRESULT hResPrev)\n\n\t{\n\n\t\tauto bGotError = false;\n\n\n\n\t\tif (S_OK != hResPrev)\n\n\t\t{\n\n\t\t\tif (MAPI_E_USER_CANCEL != hResPrev && MAPI_E_CANCEL != hResPrev)\n\n\t\t\t{\n\n\t\t\t\tbGotError = true;\n\n\t\t\t}\n", "file_path": "UI/Dialogs/MFCUtilityFunctions.cpp", "rank": 58, "score": 29.925687271630146 }, { "content": "\t\t\t\treturn true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\n\n\t// Call GetProps with NULL to get a list of (almost) all properties.\n\n\t// Parse this list and render them in the control.\n\n\t// Add any extra props we've asked for through the UI\n\n\t_Check_return_ HRESULT CSingleMAPIPropListCtrl::LoadMAPIPropList()\n\n\t{\n\n\t\tauto hRes = S_OK;\n\n\t\tULONG ulCurListBoxRow = 0;\n\n\t\tCWaitCursor Wait; // Change the mouse to an hourglass while we work.\n\n\t\tULONG ulProps = 0;\n\n\t\tLPSPropValue lpPropsToAdd = nullptr;\n\n\t\tLPSPropValue lpMappingSig = nullptr;\n\n\n\n\t\tif (!m_lpPropBag) return MAPI_E_INVALID_PARAMETER;\n\n\n", "file_path": "UI/Controls/SortList/SingleMAPIPropListCtrl.cpp", "rank": 59, "score": 29.869792539006255 }, { "content": "#include <UnitTest/stdafx.h>\n\n#include <UnitTest/UnitTest.h>\n\n#include <core/property/property.h>\n\n#include <core/property/attributes.h>\n\n\n\nnamespace property\n\n{\n\n\tTEST_CLASS(propertyTest)\n\n\t{\n\n\tpublic:\n\n\t\t// Without this, clang gets weird\n\n\t\tstatic const bool dummy_var = true;\n\n\n\n\t\tTEST_CLASS_INITIALIZE(initialize) { unittest::init(); }\n\n\n\n\t\tTEST_METHOD(Test_attribute)\n\n\t\t{\n\n\t\t\tauto attribute = Attribute(L\"this\", L\"that\");\n\n\t\t\tAssert::AreEqual(std::wstring(L\"this\"), attribute.Key());\n\n\t\t\tAssert::AreEqual(std::wstring(L\"that\"), attribute.Value());\n", "file_path": "UnitTest/tests/property.cpp", "rank": 60, "score": 29.84303434681513 }, { "content": "\t\t\tDWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,\n\n\t\t\t_In_ const std::wstring& lpszFilter = L\"\",\n\n\t\t\t_In_opt_ CWnd* pParentWnd = nullptr);\n\n\n\n\tprivate:\n\n\t\t_Check_return_ INT_PTR DisplayDialog(\n\n\t\t\tbool bOpenFileDialog, // true for open, false for FileSaveAs\n\n\t\t\t_In_ const std::wstring& lpszDefExt,\n\n\t\t\t_In_ const std::wstring& lpszFileName,\n\n\t\t\tDWORD dwFlags,\n\n\t\t\t_In_ const std::wstring& lpszFilter = L\"\",\n\n\t\t\t_In_opt_ CWnd* pParentWnd = nullptr);\n\n\n\n\t\tstd::wstring GetFileName() const;\n\n\t\tstd::vector<std::wstring> GetFileNames() const;\n\n\n\n\tprivate:\n\n\t\tstd::vector<std::wstring> m_paths;\n\n\t};\n\n} // namespace file", "file_path": "UI/file/FileDialogEx.h", "rank": 61, "score": 29.811437608234602 }, { "content": "\t\t\tULONG FAR* lpcValues,\n\n\t\t\tLPSPropValue FAR* lppPropArray) override;\n\n\t\t_Check_return_ HRESULT GetProp(ULONG ulPropTag, LPSPropValue FAR* lppProp) override;\n\n\t\tvoid FreeBuffer(LPSPropValue lpProp) override;\n\n\t\t_Check_return_ HRESULT SetProps(ULONG cValues, LPSPropValue lpPropArray) override;\n\n\t\t_Check_return_ HRESULT SetProp(LPSPropValue lpProp) override;\n\n\t\t_Check_return_ HRESULT DeleteProp(ULONG ulPropTag) override;\n\n\n\n\tprivate:\n\n\t\tsortlistdata::sortListData* m_lpListData{};\n\n\t\tLPMAPIPROP m_lpProp{};\n\n\t\tbool m_bGetPropsSucceeded{};\n\n\t};\n\n} // namespace propertybag", "file_path": "core/propertyBag/mapiPropPropertyBag.h", "rank": 62, "score": 29.804050056663534 }, { "content": "\t// We're not actually editing the list here - just overriding this to allow double-click\n\n\t// So it's OK to return false\n\n\t_Check_return_ bool\n\n\tCPropertySelector::DoListEdit(ULONG /*ulListNum*/, int /*iItem*/, _In_ sortlistdata::sortListData* /*lpData*/)\n\n\t{\n\n\t\tOnOK();\n\n\t\treturn false;\n\n\t}\n\n\n\n\t_Check_return_ ULONG CPropertySelector::GetPropertyTag() const noexcept { return m_ulPropTag; }\n\n\n\n\t_Check_return_ sortlistdata::sortListData* CPropertySelector::GetSelectedListRowData(ULONG id) const\n\n\t{\n\n\t\tconst auto lpPane = std::dynamic_pointer_cast<viewpane::ListPane>(GetPane(id));\n\n\t\tif (lpPane)\n\n\t\t{\n\n\t\t\treturn lpPane->GetSelectedListRowData();\n\n\t\t}\n\n\n\n\t\treturn nullptr;\n\n\t}\n\n} // namespace dialog::editor", "file_path": "UI/Dialogs/Editors/PropertySelector.cpp", "rank": 63, "score": 29.72755878056921 }, { "content": "\t// Purpose\n\n\t// Uses MAPI to allocate a new string (szDestination) and copy szSource into it\n\n\t// Uses parent as the parent for MAPIAllocateMore if possible\n\n\t_Check_return_ LPSTR CopyStringA(_In_z_ LPCSTR src, _In_opt_ const VOID* pParent)\n\n\t{\n\n\t\tif (!src) return nullptr;\n\n\t\tauto cb = strnlen_s(src, RSIZE_MAX) + 1;\n\n\t\tauto dst = mapi::allocate<LPSTR>(static_cast<ULONG>(cb), pParent);\n\n\n\n\t\tif (dst)\n\n\t\t{\n\n\t\t\tEC_W32_S(strcpy_s(dst, cb, src));\n\n\t\t}\n\n\n\n\t\treturn dst;\n\n\t}\n\n\n\n\t_Check_return_ LPWSTR CopyStringW(_In_z_ LPCWSTR src, _In_opt_ const VOID* pParent)\n\n\t{\n\n\t\tif (!src) return nullptr;\n", "file_path": "core/mapi/mapiFunctions.cpp", "rank": 64, "score": 29.58145938034545 }, { "content": "\n\n\t\tauto hRes = S_OK;\n\n\t\tauto pIMsg = LoadMSGToMessage(szMessageFile);\n\n\t\tif (pIMsg)\n\n\t\t{\n\n\t\t\tLPSPropProblemArray lpProblems = nullptr;\n\n\n\n\t\t\tauto lpProgress = mapi::mapiui::GetMAPIProgress(L\"IMAPIProp::CopyTo\", hWnd); // STRING_OK\n\n\n\n\t\t\thRes = EC_MAPI(pIMsg->CopyTo(\n\n\t\t\t\t0,\n\n\t\t\t\tnullptr,\n\n\t\t\t\tLPSPropTagArray(&excludeTags),\n\n\t\t\t\tlpProgress ? reinterpret_cast<ULONG_PTR>(hWnd) : NULL,\n\n\t\t\t\tlpProgress,\n\n\t\t\t\t&IID_IMessage,\n\n\t\t\t\tlpMessage,\n\n\t\t\t\tlpProgress ? MAPI_DIALOG : 0,\n\n\t\t\t\t&lpProblems));\n\n\n", "file_path": "core/mapi/mapiFile.cpp", "rank": 65, "score": 29.577088004146745 }, { "content": "\t\t\t}\n\n\n\n\t\t\tlpMAPIProp->Release();\n\n\t\t}\n\n\t}\n\n\n\n\t_Check_return_ HRESULT CFolderDlg::OnGetMessageStatus(int /*iItem*/, _In_ sortlistdata::sortListData* lpData)\n\n\t{\n\n\t\tCWaitCursor Wait; // Change the mouse to an hourglass while we work.\n\n\n\n\t\tif (!lpData) return MAPI_E_INVALID_PARAMETER;\n\n\n\n\t\tconst auto contents = lpData->cast<sortlistdata::contentsData>();\n\n\t\tif (!contents || !m_lpFolder) return MAPI_E_INVALID_PARAMETER;\n\n\n\n\t\toutput::DebugPrintEx(output::dbgLevel::Generic, CLASS, L\"OnGetMessageStatus\", L\"\\n\");\n\n\n\n\t\tULONG ulMessageStatus = NULL;\n\n\n\n\t\tconst auto lpMessageEID = contents->m_lpEntryID;\n", "file_path": "UI/Dialogs/ContentsTable/FolderDlg.cpp", "rank": 66, "score": 29.557775134011766 }, { "content": "\t\tbool bIsAB,\n\n\t\tbool bAllowUI)\n\n\t{\n\n\t\tif (!lpSource || !lpDest) return MAPI_E_INVALID_PARAMETER;\n\n\n\n\t\tauto copyDetails = GetCopyDetails && bAllowUI ? GetCopyDetails(hWnd, lpSource, lpGUID, lpTagArray, bIsAB)\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t : CopyDetails{true, 0, *lpGUID, nullptr, NULL, lpTagArray, false};\n\n\t\tif (copyDetails.valid)\n\n\t\t{\n\n\t\t\tauto lpProblems = LPSPropProblemArray{};\n\n\t\t\tconst auto hRes = WC_MAPI(lpSource->CopyTo(\n\n\t\t\t\t0,\n\n\t\t\t\tnullptr,\n\n\t\t\t\tcopyDetails.excludedTags,\n\n\t\t\t\tcopyDetails.uiParam,\n\n\t\t\t\tcopyDetails.progress,\n\n\t\t\t\t&copyDetails.guid,\n\n\t\t\t\tlpDest,\n\n\t\t\t\tcopyDetails.flags,\n\n\t\t\t\t&lpProblems));\n", "file_path": "core/mapi/mapiFunctions.cpp", "rank": 67, "score": 29.36404492629083 }, { "content": "\t}\n\n\n\n\t_Check_return_ HRESULT rowPropertyBag::SetProp(LPSPropValue lpProp)\n\n\t{\n\n\t\tULONG ulNewArray = NULL;\n\n\t\tLPSPropValue lpNewArray = nullptr;\n\n\n\n\t\tconst auto hRes = EC_H(ConcatLPSPropValue(1, lpProp, m_cValues, m_lpProps, &ulNewArray, &lpNewArray));\n\n\t\tif (SUCCEEDED(hRes))\n\n\t\t{\n\n\t\t\tMAPIFreeBuffer(m_lpListData->lpSourceProps);\n\n\t\t\tm_lpListData->cSourceProps = ulNewArray;\n\n\t\t\tm_lpListData->lpSourceProps = lpNewArray;\n\n\n\n\t\t\tm_cValues = ulNewArray;\n\n\t\t\tm_lpProps = lpNewArray;\n\n\t\t\tm_bRowModified = true;\n\n\t\t}\n\n\t\treturn hRes;\n\n\t}\n\n} // namespace propertybag\n", "file_path": "core/propertyBag/rowPropertyBag.cpp", "rank": 68, "score": 29.21755924506013 }, { "content": "\t\t\t{\n\n\t\t\t\tif (PROP_ID(getTag(lpArray, i)) == PROP_ID(ulPropTag)) return true;\n\n\t\t\t}\n\n\t\t}\n\n\n\n\t\treturn false;\n\n\t}\n\n\n\n\t_Check_return_ HRESULT ManuallyEmptyFolder(_In_ LPMAPIFOLDER lpFolder, BOOL bAssoc, BOOL bHardDelete)\n\n\t{\n\n\t\tif (!lpFolder) return MAPI_E_INVALID_PARAMETER;\n\n\n\n\t\tLPSRowSet pRows = nullptr;\n\n\t\tULONG iItemCount = 0;\n\n\t\tLPMAPITABLE lpContentsTable = nullptr;\n\n\n\n\t\tenum\n\n\t\t{\n\n\t\t\teidPR_ENTRYID,\n\n\t\t\teidNUM_COLS\n", "file_path": "core/mapi/mapiFunctions.cpp", "rank": 69, "score": 29.161399344295347 }, { "content": "\t\tif (m_lpBaseAdviseSink) m_lpBaseAdviseSink->Release();\n\n\t\tm_lpBaseAdviseSink = nullptr;\n\n\t\tm_ulBaseAdviseObjectType = NULL;\n\n\t\tm_ulBaseAdviseConnection = NULL;\n\n\t}\n\n\n\n\tvoid CBaseDialog::OnDispatchNotifications() { EC_MAPI_S(HrDispatchNotifications(NULL)); }\n\n\n\n\t_Check_return_ bool CBaseDialog::HandleAddInMenu(const WORD wMenuSelect)\n\n\t{\n\n\t\toutput::DebugPrintEx(\n\n\t\t\toutput::dbgLevel::AddInPlumbing, CLASS, L\"HandleAddInMenu\", L\"wMenuSelect = 0x%08X\\n\", wMenuSelect);\n\n\t\treturn false;\n\n\t}\n\n\n\n\t_Check_return_ ui::CParentWnd* CBaseDialog::GetParentWnd() const noexcept { return m_lpParent; }\n\n\n\n\t_Check_return_ std::shared_ptr<cache::CMapiObjects> CBaseDialog::GetMapiObjects() const noexcept\n\n\t{\n\n\t\treturn m_lpMapiObjects;\n\n\t}\n\n} // namespace dialog", "file_path": "UI/Dialogs/BaseDialog.cpp", "rank": 70, "score": 29.085225208679134 }, { "content": "\t\tif (lpszError.empty() || nullptr != StrStrIW(error::g_ErrorArray[ulCur].lpszName, lpszError.c_str()))\n\n\t\t{\n\n\t\t\twprintf(L\"0x%08lX = %ws\\n\", error::g_ErrorArray[ulCur].ulErrorName, error::g_ErrorArray[ulCur].lpszName);\n\n\t\t\tulNumMatches++;\n\n\t\t}\n\n\t}\n\n\n\n\twprintf(L\"Found %lu matches.\\n\", ulNumMatches);\n\n}\n\n\n\nvoid DoErrorParse()\n\n{\n\n\tauto lpszErr = cli::switchUnswitched[0];\n\n\tconst auto ulErrNum = strings::wstringToUlong(lpszErr, cli::switchDecimal.isSet() ? 10 : 16);\n\n\n\n\tif (ulErrNum)\n\n\t{\n\n\t\tPrintErrFromNum(ulErrNum);\n\n\t}\n\n\telse\n", "file_path": "MrMapi/MMErr.cpp", "rank": 71, "score": 29.00073656070942 }, { "content": "\t\tvoid SetStringW(ULONG id, const std::wstring& szMsg) const;\n\n\t\tvoid SetStringf(ULONG id, LPCWSTR szMsg, ...) const;\n\n#ifdef CHECKFORMATPARAMS\n\n#undef SetStringf\n\n#define SetStringf(i, fmt, ...) SetStringf(i, fmt, __VA_ARGS__), wprintf(fmt, __VA_ARGS__)\n\n#endif\n\n\n\n\t\tvoid LoadString(ULONG id, UINT uidMsg) const;\n\n\t\tvoid SetBinary(ULONG id, _In_opt_count_(cb) LPBYTE lpb, size_t cb) const;\n\n\t\tvoid SetHex(ULONG id, ULONG ulVal) const { SetStringf(id, L\"0x%08X\", ulVal); } // STRING_OK\n\n\t\tvoid SetDecimal(ULONG id, ULONG ulVal) const { SetStringf(id, L\"%u\", ulVal); } // STRING_OK\n\n\t\t// Updates pane using SetStringW\n\n\t\tvoid SetSize(ULONG id, size_t cb) const\n\n\t\t{\n\n\t\t\tSetStringf(id, L\"0x%08X = %u\", static_cast<int>(cb), static_cast<UINT>(cb)); // STRING_OK\n\n\t\t}\n\n\t\tvoid ClearHighlight(ULONG id) const\n\n\t\t{\n\n\t\t\tauto pane = std::dynamic_pointer_cast<viewpane::TextPane>(GetPane(id));\n\n\t\t\tif (pane)\n", "file_path": "UI/Dialogs/Editors/Editor.h", "rank": 72, "score": 28.973914989039216 }, { "content": "\t\t_In_ const int height)\n\n\t{\n\n\t\toutput::DebugPrint(output::dbgLevel::Draw, L\"CheckPane::DeferWindowPos x:%d width:%d \\n\", x, width);\n\n\t\tEC_B_S(::DeferWindowPos(hWinPosInfo, m_Check.GetSafeHwnd(), nullptr, x, y, width, height, SWP_NOZORDER));\n\n\t}\n\n\n\n\tvoid CheckPane::CommitUIValues()\n\n\t{\n\n\t\tm_bCheckValue = 0 != m_Check.GetCheck();\n\n\t\tm_bCommitted = true;\n\n\t}\n\n\n\n\tbool CheckPane::GetCheck() const\n\n\t{\n\n\t\tif (!m_bCommitted) return 0 != m_Check.GetCheck();\n\n\t\treturn m_bCheckValue;\n\n\t}\n\n\n\n\tvoid CheckPane::Draw(_In_ HWND hWnd, _In_ HDC hDC, _In_ const RECT& rc, const UINT itemState)\n\n\t{\n", "file_path": "UI/ViewPane/CheckPane.cpp", "rank": 73, "score": 28.967983863314842 }, { "content": "#include <core/stdafx.h>\n\n#include <core/smartview/addinParser.h>\n\n#include <core/addin/addin.h>\n\n\n\nnamespace smartview\n\n{\n\n\tvoid addinParser::parse() { bin = blockBytes::parse(parser, parser->getSize()); }\n\n\n\n\tvoid addinParser::parseBlocks()\n\n\t{\n\n\t\tauto sv = addin::AddInSmartView(type, static_cast<ULONG>(bin->size()), bin->data());\n\n\t\tif (!sv.empty())\n\n\t\t{\n\n\t\t\tsetText(addin::AddInStructTypeToString(type));\n\n\t\t\taddChild(bin, sv);\n\n\t\t}\n\n\t\telse\n\n\t\t{\n\n\t\t\tsetText(L\"Unknown Parser %1!d!\", type);\n\n\t\t\taddChild(bin);\n\n\t\t}\n\n\t}\n\n} // namespace smartview", "file_path": "core/smartview/addinParser.cpp", "rank": 74, "score": 28.916883310257912 }, { "content": "\t\treturn hRes;\n\n\t}\n\n\n\n\tvoid mapiPropPropertyBag::FreeBuffer(LPSPropValue lpProp)\n\n\t{\n\n\t\t// m_lpListData->lpSourceProps is the only data we might hand out that we didn't allocate\n\n\t\t// Don't delete it!!!\n\n\t\tif (m_lpListData && m_lpListData->lpSourceProps == lpProp) return;\n\n\n\n\t\tif (lpProp) MAPIFreeBuffer(lpProp);\n\n\t}\n\n\n\n\t_Check_return_ HRESULT mapiPropPropertyBag::SetProps(ULONG cValues, LPSPropValue lpPropArray)\n\n\t{\n\n\t\tif (nullptr == m_lpProp) return S_OK;\n\n\n\n\t\tLPSPropProblemArray lpProblems = nullptr;\n\n\t\tconst auto hRes = WC_H(m_lpProp->SetProps(cValues, lpPropArray, &lpProblems));\n\n\t\tEC_PROBLEMARRAY(lpProblems);\n\n\t\tMAPIFreeBuffer(lpProblems);\n", "file_path": "core/propertyBag/mapiPropPropertyBag.cpp", "rank": 75, "score": 28.885446156178244 }, { "content": "\t\tvoid OnInitMenu(_In_ CMenu* pMenu) override;\n\n\t\t_Check_return_ LPATTACH OpenAttach(ULONG ulAttachNum) const;\n\n\t\t_Check_return_ LPMESSAGE CAttachmentsDlg::OpenEmbeddedMessage() const;\n\n\t\t_Check_return_ LPMAPIPROP OpenItemProp(int iSelectedItem, modifyType bModify) override;\n\n\n\n\t\t// Menu items\n\n\t\tvoid OnModifySelectedItem();\n\n\t\tvoid OnSaveChanges();\n\n\t\tvoid OnSaveToFile();\n\n\t\tvoid OnViewEmbeddedMessageProps();\n\n\t\tvoid OnAddAttachment();\n\n\n\n\t\tLPATTACH m_lpAttach; // Currently opened attachment\n\n\t\tULONG m_ulAttachNum; // Currently opened attachment number\n\n\t\tLPMESSAGE m_lpMessage;\n\n\t\tbool m_bDisplayAttachAsEmbeddedMessage;\n\n\n\n\t\tDECLARE_MESSAGE_MAP()\n\n\t};\n\n} // namespace dialog", "file_path": "UI/Dialogs/ContentsTable/AttachmentsDlg.h", "rank": 76, "score": 28.876388997389796 }, { "content": "\t\t\tULONG FAR* lpcValues,\n\n\t\t\tLPSPropValue FAR* lppPropArray) override;\n\n\t\t_Check_return_ HRESULT GetProp(ULONG ulPropTag, LPSPropValue FAR* lppProp) override;\n\n\t\t// None of our GetProps allocate anything, so nothing to do here\n\n\t\tvoid rowPropertyBag::FreeBuffer(LPSPropValue) override { return; }\n\n\t\t// TODO: This is for paste, something we don't yet support for rows\n\n\t\t_Check_return_ HRESULT SetProps(ULONG, LPSPropValue) override { return E_NOTIMPL; }\n\n\t\t_Check_return_ HRESULT SetProp(LPSPropValue lpProp) override;\n\n\t\t//TODO: Not supported yet\n\n\t\t_Check_return_ HRESULT DeleteProp(ULONG) override { return E_NOTIMPL; };\n\n\n\n\tprivate:\n\n\t\tsortlistdata::sortListData* m_lpListData{};\n\n\n\n\t\tULONG m_cValues{};\n\n\t\tLPSPropValue m_lpProps{};\n\n\t\tbool m_bRowModified{};\n\n\t};\n\n} // namespace propertybag", "file_path": "core/propertyBag/rowPropertyBag.h", "rank": 77, "score": 28.754177922213373 }, { "content": "#include <StdAfx.h>\n\n#include <UI/ViewPane/CheckPane.h>\n\n#include <UI/UIFunctions.h>\n\n#include <core/utility/output.h>\n\n\n\nnamespace viewpane\n\n{\n\n\tstd::shared_ptr<CheckPane>\n\n\tCheckPane::Create(const int paneID, const UINT uidLabel, const bool bVal, const bool bReadOnly)\n\n\t{\n\n\t\tauto pane = std::make_shared<CheckPane>();\n\n\t\tif (pane)\n\n\t\t{\n\n\t\t\tpane->m_bCheckValue = bVal;\n\n\t\t\tpane->SetLabel(uidLabel);\n\n\t\t\tpane->SetReadOnly(bReadOnly);\n\n\t\t\tpane->m_paneID = paneID;\n\n\t\t}\n\n\n\n\t\treturn pane;\n", "file_path": "UI/ViewPane/CheckPane.cpp", "rank": 78, "score": 28.74827147785976 }, { "content": "\t\t\tconst\n\n\t\t{\n\n\t\t\tauto actual = smartview::InterpretBinary({static_cast<ULONG>(hex.size()), hex.data()}, structType, nullptr)\n\n\t\t\t\t\t\t\t ->toString();\n\n\t\t\tunittest::AreEqualEx(expected, actual, testName.c_str());\n\n\n\n\t\t\tif (unittest::parse_all)\n\n\t\t\t{\n\n\t\t\t\tfor (auto parser : SmartViewParserTypeArray)\n\n\t\t\t\t{\n\n\t\t\t\t\ttry\n\n\t\t\t\t\t{\n\n\t\t\t\t\t\tactual = smartview::InterpretBinary(\n\n\t\t\t\t\t\t\t\t\t {static_cast<ULONG>(hex.size()), hex.data()}, parser.type, nullptr)\n\n\t\t\t\t\t\t\t\t\t ->toString();\n\n\t\t\t\t\t} catch (const int exception)\n\n\t\t\t\t\t{\n\n\t\t\t\t\t\tLogger::WriteMessage(strings::format(\n\n\t\t\t\t\t\t\t\t\t\t\t\t L\"Testing %ws failed at %ws with error 0x%08X\\n\",\n\n\t\t\t\t\t\t\t\t\t\t\t\t testName.c_str(),\n", "file_path": "UnitTest/tests/smartViewTest.cpp", "rank": 79, "score": 28.682270064507456 }, { "content": "\t_Check_return_ ULONG CResExistEditor::HandleChange(UINT nID)\n\n\t{\n\n\t\tconst auto paneID = CEditor::HandleChange(nID);\n\n\n\n\t\tif (paneID == 0)\n\n\t\t{\n\n\t\t\tSetStringW(1, proptags::TagToString(GetPropTag(0), nullptr, false, true));\n\n\t\t}\n\n\n\n\t\treturn paneID;\n\n\t}\n\n\n\n\t// This class is only invoked by CRestrictEditor. CRestrictEditor always passes an alloc parent.\n\n\t// So all memory detached from this class is owned by a parent and must not be freed manually\n\n\tstatic std::wstring SUBRESCLASS = L\"CResSubResEditor\"; // STRING_OK\n", "file_path": "UI/Dialogs/Editors/RestrictEditor.cpp", "rank": 80, "score": 28.473666676557773 }, { "content": "\t\t}\n\n\n\n\t\t// File IO failed - complain - not using error macros since we may not have debug output here\n\n\t\tconst auto dwErr = GetLastError();\n\n\t\tauto szSysErr = strings::formatmessagesys(HRESULT_FROM_WIN32(dwErr));\n\n\n\n\t\tauto szErr = strings::format(\n\n\t\t\tL\"_tfopen failed, hRes = 0x%08X, dwErr = 0x%08X = \\\"%ws\\\"\\n\", // STRING_OK\n\n\t\t\tHRESULT_FROM_WIN32(dwErr),\n\n\t\t\tdwErr,\n\n\t\t\tszSysErr.c_str());\n\n\n\n\t\tOutputDebugStringW(szErr.c_str());\n\n\t\treturn nullptr;\n\n\t}\n\n\n\n\tvoid CloseFile(_In_opt_ FILE* fFile) noexcept\n\n\t{\n\n\t\tif (fFile) fclose(fFile);\n\n\t}\n", "file_path": "core/utility/output.cpp", "rank": 81, "score": 28.423905516459563 }, { "content": "\n\n\tCDbgView::~CDbgView()\n\n\t{\n\n\t\tTRACE_DESTRUCTOR(CLASS);\n\n\t\tg_DgbView = nullptr;\n\n\t}\n\n\n\n\tvoid CDbgView::OnCancel()\n\n\t{\n\n\t\tShowWindow(SW_HIDE);\n\n\t\tdelete this;\n\n\t}\n\n\n\n\t_Check_return_ ULONG CDbgView::HandleChange(UINT nID)\n\n\t{\n\n\t\tconst auto paneID = CEditor::HandleChange(nID);\n\n\n\n\t\tif (paneID == static_cast<ULONG>(-1)) return static_cast<ULONG>(-1);\n\n\n\n\t\tswitch (paneID)\n", "file_path": "UI/Dialogs/Editors/DbgView.cpp", "rank": 82, "score": 28.353382847248845 }, { "content": "\t\tvoid WriteStringsToSPropValue();\n\n\t\tvoid WriteSPropValueToObject() const;\n\n\t\t_Check_return_ ULONG HandleChange(UINT nID) override;\n\n\t\tvoid OnOK() override;\n\n\n\n\t\t// source variables\n\n\t\tLPMAPIPROP m_lpMAPIProp{};\n\n\t\tULONG m_ulPropTag{};\n\n\t\tbool m_bIsAB{}; // whether the tag is from the AB or not\n\n\t\tconst _SPropValue* m_lpsInputValue{};\n\n\t\tLPSPropValue m_lpsOutputValue{};\n\n\t\tbool m_bDirty{};\n\n\t\tbool m_bMVRow{}; // whether this row came from a multivalued property. Used for smart view parsing.\n\n\n\n\t\t// all calls to MAPIAllocateMore will use m_lpAllocParent\n\n\t\t// this is not something to be freed\n\n\t\tLPVOID m_lpAllocParent{};\n\n\t};\n\n} // namespace dialog::editor", "file_path": "UI/Dialogs/Editors/PropertyEditor.h", "rank": 83, "score": 28.32556147068328 }, { "content": "#define CORg(_hr) \\\n\n\tdo \\\n\n\t{ \\\n\n\t\thr = _hr; \\\n\n\t\tif (FAILED(hr)) \\\n\n\t\t{ \\\n\n\t\t\tstd::wcout << L\"FAILED! hr = \" << std::hex << hr << L\". LINE = \" << std::dec << __LINE__ << std::endl; \\\n\n\t\t\tstd::wcout << L\" >>> \" << (wchar_t*) L#_hr << std::endl; \\\n\n\t\t\tgoto Error; \\\n\n\t\t} \\\n\n\t} while (0)\n\n\n\nint ListStoresTable(IMAPISession* pSession)\n\n{\n\n\tHRESULT hr = S_OK;\n\n\tCComPtr<IMAPITable> spTable;\n\n\tSRowSet* pmrows = nullptr;\n\n\n\n\tenum MAPIColumns\n\n\t{\n", "file_path": "exampleMapiConsoleApp/exampleMapiConsoleApp.cpp", "rank": 84, "score": 28.303293777448427 }, { "content": "\t\t\tint iEditHeight) override; // height of an edit control\n\n\t\tvoid ShowWindow(const int nCmdShow)\n\n\t\t{\n\n\t\t\tif (m_lpSplitter) m_lpSplitter->ShowWindow(nCmdShow);\n\n\t\t}\n\n\n\n\tprivate:\n\n\t\tvoid CommitUIValues() override {}\n\n\t\tint GetMinWidth() override;\n\n\t\tULONG HandleChange(UINT nID) override;\n\n\n\n\t\tstd::shared_ptr<controls::CFakeSplitter> m_lpSplitter{};\n\n\t\tstd::shared_ptr<ViewPane> m_PaneOne{};\n\n\t\tstd::shared_ptr<ViewPane> m_PaneTwo{};\n\n\t\tbool m_bVertical{};\n\n\t};\n\n} // namespace viewpane", "file_path": "UI/ViewPane/SplitterPane.h", "rank": 85, "score": 28.231650236004363 }, { "content": "\n\n\t\t\t\t// Open the attachment source\n\n\t\t\t\tEC_MAPI_S(lpSourceMessage->OpenAttach(ulAtt, nullptr, MAPI_DEFERRED_ERRORS, &lpAttSrc));\n\n\t\t\t\tif (lpAttSrc)\n\n\t\t\t\t{\n\n\t\t\t\t\tULONG ulAttNum = NULL;\n\n\t\t\t\t\t// Create the attachment destination\n\n\t\t\t\t\tEC_MAPI_S(m_lpMessage->CreateAttach(nullptr, MAPI_DEFERRED_ERRORS, &ulAttNum, &lpAttDst));\n\n\t\t\t\t\tif (lpAttDst)\n\n\t\t\t\t\t{\n\n\t\t\t\t\t\tauto lpProgress = mapi::mapiui::GetMAPIProgress(L\"IAttach::CopyTo\", m_hWnd); // STRING_OK\n\n\n\n\t\t\t\t\t\t// Copy from source to destination\n\n\t\t\t\t\t\tEC_MAPI_S(lpAttSrc->CopyTo(\n\n\t\t\t\t\t\t\t0,\n\n\t\t\t\t\t\t\tnullptr,\n\n\t\t\t\t\t\t\tnullptr,\n\n\t\t\t\t\t\t\tlpProgress ? reinterpret_cast<ULONG_PTR>(m_hWnd) : NULL,\n\n\t\t\t\t\t\t\tlpProgress,\n\n\t\t\t\t\t\t\tconst_cast<LPIID>(&IID_IAttachment),\n", "file_path": "UI/Dialogs/ContentsTable/AttachmentsDlg.cpp", "rank": 86, "score": 28.191565309749663 }, { "content": "\tif (FAILED(hRes)) wprintf(L\"MAPILogonEx returned an error: 0x%08lx\\n\", hRes);\n\n\treturn lpSession;\n\n}\n\n\n\n_Check_return_ LPMDB OpenExchangeOrDefaultMessageStore(_In_ LPMAPISESSION lpMAPISession)\n\n{\n\n\tif (!lpMAPISession) return nullptr;\n\n\n\n\tauto lpMDB = mapi::store::OpenMessageStoreGUID(lpMAPISession, pbExchangeProviderPrimaryUserGuid);\n\n\tif (!lpMDB)\n\n\t{\n\n\t\tlpMDB = mapi::store::OpenDefaultMessageStore(lpMAPISession);\n\n\t}\n\n\n\n\treturn lpMDB;\n\n}\n\n\n\n// Returns true if we've done everything we need to do and can exit the program.\n\n// Returns false to continue work.\n\nbool LoadMAPIVersion(const std::wstring& lpszVersion)\n", "file_path": "MrMapi/MrMAPI.cpp", "rank": 87, "score": 28.13779942320265 }, { "content": "#include <StdAfx.h>\n\n#include <MrMapi/MMReceiveFolder.h>\n\n#include <MrMapi/mmcli.h>\n\n#include <core/mapi/columnTags.h>\n\n#include <core/mapi/mapiOutput.h>\n\n#include <core/utility/output.h>\n\n\n\nvoid PrintReceiveFolderTable(_In_ LPMDB lpMDB)\n\n{\n\n\tLPMAPITABLE lpReceiveFolderTable = nullptr;\n\n\tauto hRes = WC_MAPI(lpMDB->GetReceiveFolderTable(0, &lpReceiveFolderTable));\n\n\tif (FAILED(hRes))\n\n\t{\n\n\t\twprintf(L\"<receivefoldertable error=0x%lx />\\n\", hRes);\n\n\t\treturn;\n\n\t}\n\n\n\n\twprintf(L\"<receivefoldertable>\\n\");\n\n\n\n\tif (lpReceiveFolderTable)\n", "file_path": "MrMapi/MMReceiveFolder.cpp", "rank": 88, "score": 28.087293787927152 }, { "content": "\n\n\t_Check_return_ HRESULT AddRecipient(\n\n\t\t_In_ LPMAPISESSION lpMAPISession,\n\n\t\t_In_ LPMESSAGE lpMessage,\n\n\t\t_In_ const std::wstring& szName,\n\n\t\tULONG ulRecipientType)\n\n\t{\n\n\t\tLPADRLIST lpAdrList = nullptr; // ModifyRecips takes LPADRLIST\n\n\t\tLPADRBOOK lpAddrBook = nullptr;\n\n\n\n\t\tenum\n\n\t\t{\n\n\t\t\tNAME,\n\n\t\t\tRECIP,\n\n\t\t\tNUM_RECIP_PROPS\n\n\t\t};\n\n\n\n\t\tif (!lpMessage || !lpMAPISession) return MAPI_E_INVALID_PARAMETER;\n\n\n\n\t\tauto hRes = EC_MAPI(lpMAPISession->OpenAddressBook(NULL, nullptr, NULL, &lpAddrBook));\n", "file_path": "core/mapi/mapiABFunctions.cpp", "rank": 89, "score": 28.008444557009902 }, { "content": "\t\t\treturn pane->GetDropDownValue();\n\n\t\t}\n\n\n\n\t\treturn 0;\n\n\t}\n\n\n\n\tvoid CEditor::InsertColumn(ULONG id, int nCol, UINT uidText) const\n\n\t{\n\n\t\tauto pane = std::dynamic_pointer_cast<viewpane::ListPane>(GetPane(id));\n\n\t\tif (pane)\n\n\t\t{\n\n\t\t\tpane->InsertColumn(nCol, uidText);\n\n\t\t}\n\n\t}\n\n\n\n\tvoid CEditor::InsertColumn(ULONG id, int nCol, UINT uidText, ULONG ulPropType) const\n\n\t{\n\n\t\tauto pane = std::dynamic_pointer_cast<viewpane::ListPane>(GetPane(id));\n\n\t\tif (pane)\n\n\t\t{\n", "file_path": "UI/Dialogs/Editors/Editor.cpp", "rank": 90, "score": 27.96578382698187 }, { "content": "#include <mapistub/library/stubutils.h>\n\n#include <core/addin/addin.h>\n\n#include <core/utility/registry.h>\n\n#include <core/utility/output.h>\n\n#include <core/utility/cli.h>\n\n#include <io.h>\n\n#include <fcntl.h>\n\n\n\n// Initialize MFC for LoadString support later on\n\nvoid InitMFC() { AfxWinInit(::GetModuleHandle(nullptr), nullptr, ::GetCommandLine(), 0); }\n\n\n\n_Check_return_ LPMAPISESSION MrMAPILogonEx(const std::wstring& lpszProfile)\n\n{\n\n\tauto ulFlags = MAPI_EXTENDED | MAPI_NO_MAIL | MAPI_UNICODE | MAPI_NEW_SESSION;\n\n\tif (lpszProfile.empty()) ulFlags |= MAPI_USE_DEFAULT;\n\n\n\n\t// TODO: profile parameter should be ansi in ansi builds\n\n\tLPMAPISESSION lpSession = nullptr;\n\n\tconst auto hRes = WC_MAPI(\n\n\t\tMAPILogonEx(NULL, LPTSTR((lpszProfile.empty() ? nullptr : lpszProfile.c_str())), nullptr, ulFlags, &lpSession));\n", "file_path": "MrMapi/MrMAPI.cpp", "rank": 91, "score": 27.80795542389359 }, { "content": "\tprivate:\n\n\t\tBOOL OnInitDialog() override;\n\n\t\tvoid OpenPropertyStream(bool bWrite, bool bRTF);\n\n\t\tvoid ReadTextStreamFromProperty() const;\n\n\t\tvoid WriteTextStreamToProperty();\n\n\t\t_Check_return_ ULONG HandleChange(UINT nID) override;\n\n\t\tvoid OnOK() override;\n\n\t\tvoid SetEditReadOnly(ULONG id) const;\n\n\n\n\t\t// source variables\n\n\t\tLPMAPIPROP m_lpMAPIProp;\n\n\t\tLPSTREAM m_lpStream;\n\n\t\tULONG m_ulPropTag;\n\n\t\tbool m_bIsAB; // whether the tag is from the AB or not\n\n\t\tbool m_bUseWrapEx;\n\n\t\tULONG m_ulRTFFlags;\n\n\t\tULONG m_ulInCodePage;\n\n\t\tULONG m_ulOutCodePage;\n\n\t\tULONG m_ulStreamFlags; // returned from WrapCompressedRTFStreamEx\n\n\n", "file_path": "UI/Dialogs/Editors/StreamEditor.h", "rank": 92, "score": 27.749435147347913 }, { "content": "\n\n\t\t\tMAPIFreeBuffer(lpEID);\n\n\t\t}\n\n\t}\n\n\n\n\tvoid CMainDlg::OnOpenPAB()\n\n\t{\n\n\t\tif (!m_lpMapiObjects) return;\n\n\n\n\t\t// check if we have an AB - if we don't, get one\n\n\t\tauto lpAddrBook = m_lpMapiObjects->GetAddrBook(true); // do not release\n\n\t\tif (!lpAddrBook) return;\n\n\n\n\t\tULONG cbEID = NULL;\n\n\t\tLPENTRYID lpEID = nullptr;\n\n\t\tULONG ulObjType = NULL;\n\n\n\n\t\tEC_MAPI_S(lpAddrBook->GetPAB(&cbEID, &lpEID));\n\n\n\n\t\tif (lpEID)\n", "file_path": "UI/Dialogs/ContentsTable/MainDlg.cpp", "rank": 93, "score": 27.73768299901312 }, { "content": "\t\t\t\toutput::dbgLevel::Generic, CLASS, L\"OnKeyDown\", L\"calling Display Associated Contents\\n\");\n\n\t\t\tif (m_lpHostDlg) m_lpHostDlg->PostMessage(WM_COMMAND, ID_DISPLAYASSOCIATEDCONTENTS, NULL);\n\n\t\t\treturn true;\n\n\t\t}\n\n\n\n\t\tif (m_lpHostDlg) return m_lpHostDlg->HandleKeyDown(nChar, bShiftPressed, bCtrlPressed, bMenuPressed);\n\n\n\n\t\treturn false;\n\n\t}\n\n\n\n\tvoid CHierarchyTableTreeCtrl::HandleContextMenu(const int x, const int y)\n\n\t{\n\n\t\tui::DisplayContextMenu(m_nIDContextMenu, IDR_MENU_HIERARCHY_TABLE, m_lpHostDlg->m_hWnd, x, y);\n\n\t}\n\n\n\n\t_Check_return_ sortlistdata::sortListData* CHierarchyTableTreeCtrl::GetSelectedItemData() const\n\n\t{\n\n\t\t// Find the highlighted item\n\n\t\tconst auto Item = GetSelectedItem();\n\n\t\tif (Item)\n", "file_path": "UI/Controls/StyleTree/HierarchyTableTreeCtrl.cpp", "rank": 94, "score": 27.67311282014345 }, { "content": "// Collection of useful MAPI Store functions\n\n\n\n#include <core/stdafx.h>\n\n#include <core/mapi/mapiStoreFunctions.h>\n\n#include <core/utility/strings.h>\n\n#include <core/mapi/extraPropTags.h>\n\n#include <core/utility/registry.h>\n\n#include <core/utility/output.h>\n\n#include <core/utility/error.h>\n\n#include <core/mapi/mapiFunctions.h>\n\n#include <core/mapi/interfaces.h>\n\n\n\nnamespace mapi::store\n\n{\n\n\tstd::function<std::wstring()> promptServerName;\n\n\n\n\t_Check_return_ LPMDB\n\n\tCallOpenMsgStore(_In_ LPMAPISESSION lpSession, _In_ ULONG_PTR ulUIParam, _In_ const SBinary* lpEID, ULONG ulFlags)\n\n\t{\n\n\t\tif (!lpSession || !lpEID) return nullptr;\n", "file_path": "core/mapi/mapiStoreFunctions.cpp", "rank": 95, "score": 27.61078452411695 }, { "content": "#include <StdAfx.h>\n\n#include <UI/ViewPane/ViewPane.h>\n\n#include <UI/UIFunctions.h>\n\n#include <core/utility/strings.h>\n\n#include <core/utility/output.h>\n\n\n\nnamespace viewpane\n\n{\n\n\t// Draw our collapse button and label, if needed.\n\n\t// Draws everything to GetLabelHeight()\n\n\tvoid ViewPane::DeferWindowPos(\n\n\t\t_In_ HDWP hWinPosInfo,\n\n\t\tconst _In_ int x,\n\n\t\tconst _In_ int y,\n\n\t\tconst _In_ int width,\n\n\t\tconst _In_ int /*height*/)\n\n\t{\n\n\t\tconst auto labelHeight = GetLabelHeight();\n\n\t\tauto curX = x;\n\n\t\tif (m_bCollapsible)\n", "file_path": "UI/ViewPane/ViewPane.cpp", "rank": 96, "score": 27.532241402488914 }, { "content": "\t}\n\n\n\n\t_Check_return_ HRESULT OpenMessageNonModal(\n\n\t\t_In_ HWND hwndParent,\n\n\t\t_In_ LPMDB lpMDB,\n\n\t\t_In_ LPMAPISESSION lpMAPISession,\n\n\t\t_In_ LPMAPIFOLDER lpSourceFolder,\n\n\t\t_In_ controls::sortlistctrl::CContentsTableListCtrl* lpContentsTableListCtrl,\n\n\t\tint iItem,\n\n\t\t_In_ LPMESSAGE lpMessage,\n\n\t\tLONG lVerb,\n\n\t\t_In_opt_ LPCRECT lpRect)\n\n\t{\n\n\t\tULONG cValuesShow = 0;\n\n\t\tLPSPropValue lpspvaShow = nullptr;\n\n\t\tULONG ulMessageStatus = NULL;\n\n\t\tLPMAPIVIEWCONTEXT lpViewContextTemp = nullptr;\n\n\n\n\t\tenum\n\n\t\t{\n", "file_path": "UI/MAPIFormFunctions.cpp", "rank": 97, "score": 27.518811576761205 }, { "content": "\t\tSetHex(2, ulPropTag);\n\n\t\tAddPane(viewpane::TextPane::CreateSingleLinePane(\n\n\t\t\t3, IDS_ULPROPTAG, proptags::TagToString(ulPropTag, nullptr, false, true), true));\n\n\n\n\t\tAddPane(viewpane::TextPane::CreateSingleLinePane(4, IDS_MASK, false));\n\n\t\tSetHex(4, ulMask);\n\n\t}\n\n\n\n\t_Check_return_ ULONG CResBitmaskEditor::HandleChange(UINT nID)\n\n\t{\n\n\t\tconst auto paneID = CEditor::HandleChange(nID);\n\n\n\n\t\tif (paneID == 0)\n\n\t\t{\n\n\t\t\tSetStringW(1, flags::InterpretFlags(flagBitmask, GetHex(0)));\n\n\t\t}\n\n\t\telse if (paneID == 2)\n\n\t\t{\n\n\t\t\tSetStringW(3, proptags::TagToString(GetPropTag(2), nullptr, false, true));\n\n\t\t}\n\n\n\n\t\treturn paneID;\n\n\t}\n\n\n\n\tstatic std::wstring SIZECLASS = L\"CResSizeEditor\"; // STRING_OK\n", "file_path": "UI/Dialogs/Editors/RestrictEditor.cpp", "rank": 98, "score": 27.511943415665243 }, { "content": "\t\t_Check_return_ LPENTRYLIST GetSelectedItemEIDs() const;\n\n\t\t_Check_return_ sortlistdata::sortListData* GetSortListData(int iItem) const;\n\n\t\t_Check_return_ LPMAPIPROP OpenNextSelectedItemProp(_Inout_opt_ int* iCurItem, modifyType bModify) const;\n\n\t\t_Check_return_ std::vector<int> GetSelectedItemNums() const;\n\n\t\t_Check_return_ std::vector<sortlistdata::sortListData*> GetSelectedItemData() const;\n\n\t\t_Check_return_ sortlistdata::sortListData* GetFirstSelectedItemData() const;\n\n\n\n\t\t_Check_return_ HRESULT ApplyRestriction() const;\n\n\t\t_Check_return_ LPMAPIPROP DefaultOpenItemProp(int iItem, modifyType bModify) const;\n\n\t\tvoid NotificationOff();\n\n\t\tvoid NotificationOn();\n\n\t\tvoid RefreshTable();\n\n\t\tvoid OnCancelTableLoad();\n\n\t\tvoid OnOutputTable(const std::wstring& szFileName) const;\n\n\t\tvoid SetSortTable(_In_ LPSSortOrderSet lpSortOrderSet, ULONG ulFlags) const;\n\n\t\tvoid SetUIColumns(_In_ LPSPropTagArray lpTags);\n\n\t\t_Check_return_ bool IsLoading() const noexcept;\n\n\t\tvoid ClearLoading() noexcept;\n\n\t\tvoid SetRestriction(_In_opt_ const _SRestriction* lpRes) noexcept;\n\n\t\t_Check_return_ const _SRestriction* GetRestriction() const noexcept;\n", "file_path": "UI/Controls/SortList/ContentsTableListCtrl.h", "rank": 99, "score": 27.479977703877402 } ]
C++
ext/include/applications/osgearth_terraineffects/osgearth_terraineffects.cpp
energonQuest/dtEarth
47b04bb272ec8781702dea46f5ee9a03d4a22196
#include <osgEarth/VirtualProgram> #include <osgEarth/Registry> #include <osgEarth/TerrainEngineNode> #include <osgEarth/MapNode> #include <osgEarthUtil/EarthManipulator> #include <osgEarthUtil/ExampleResources> #include <osgEarthUtil/Controls> #include <osgEarthUtil/ContourMap> #include <osgEarthUtil/LODBlending> #include <osgEarthUtil/NormalMap> #include <osgEarthUtil/VerticalScale> #include <osgEarthSymbology/Color> #include <osg/Notify> #include <osg/Fog> #include <osgViewer/Viewer> using namespace osgEarth; using namespace osgEarth::Util; using namespace osgEarth::Symbology; namespace ui = osgEarth::Util::Controls; int usage(const char* msg) { OE_NOTICE << msg << std::endl; return 0; } struct App { TerrainEngineNode* engine; osg::ref_ptr<ContourMap> contourMap; osg::ref_ptr<LODBlending> lodBlending; osg::ref_ptr<NormalMap> normalMap; osg::ref_ptr<VerticalScale> verticalScale; App() { contourMap = new ContourMap(); lodBlending = new LODBlending(); normalMap = new NormalMap(); verticalScale = new VerticalScale(); } }; #define SET_FLOAT( effect, func ) \ struct func : public ui::ControlEventHandler { \ App& _app; \ func (App& app) : _app(app) { } \ void onValueChanged(ui::Control*, float value) { \ _app. effect -> func (value); \ } \ }; #define TOGGLE( effect ) \ struct Toggle : public ui::ControlEventHandler { \ App& _app; \ Toggle (App& app) : _app(app) { } \ void onValueChanged(ui::Control*, bool value) { \ if ( value ) _app.engine->addEffect( _app. effect .get() ); \ else _app.engine->removeEffect( _app. effect .get() ); \ } \ }; struct ContourMapController { TOGGLE ( contourMap ); SET_FLOAT( contourMap, setOpacity ); ContourMapController(App& app, ui::Grid* grid) { int r = grid->getNumRows(); grid->setControl(0, r, new ui::LabelControl("ContourMap")); grid->setControl(1, r, new ui::CheckBoxControl(false, new Toggle(app))); ++r; grid->setControl(0, r, new ui::LabelControl(" opacity:")); grid->setControl(1, r, new ui::HSliderControl(0.0, 1.0, 0.5, new setOpacity(app))); grid->setControl(2, r, new ui::LabelControl(grid->getControl(1, r))); } }; struct LODBlendingController { TOGGLE ( lodBlending ); SET_FLOAT( lodBlending, setDelay ); SET_FLOAT( lodBlending, setDuration ); SET_FLOAT( lodBlending, setVerticalScale ); LODBlendingController(App& app, ui::Grid* grid) { int r = grid->getNumRows(); grid->setControl(0, r, new ui::LabelControl("LOD Blending")); grid->setControl(1, r, new ui::CheckBoxControl(false, new Toggle(app))); ++r; grid->setControl(0, r, new ui::LabelControl(" delay:")); grid->setControl(1, r, new ui::HSliderControl(0.0, 2.0, 1.0, new setDelay(app))); grid->setControl(2, r, new ui::LabelControl(grid->getControl(1, r))); ++r; grid->setControl(0, r, new ui::LabelControl(" duration:")); grid->setControl(1, r, new ui::HSliderControl(0.0, 5.0, 1.0, new setDuration(app))); grid->setControl(2, r, new ui::LabelControl(grid->getControl(1, r))); ++r; grid->setControl(0, r, new ui::LabelControl(" vertical scale:")); grid->setControl(1, r, new ui::HSliderControl(0.0, 5.0, 1.0, new setVerticalScale(app))); grid->setControl(2, r, new ui::LabelControl(grid->getControl(1, r))); } }; struct NormalMapController { TOGGLE ( normalMap ); NormalMapController(App& app, ui::Grid* grid) { int r = grid->getNumRows(); grid->setControl(0, r, new ui::LabelControl("NormalMap")); grid->setControl(1, r, new ui::CheckBoxControl(false, new Toggle(app))); } }; struct VerticalScaleController { TOGGLE ( verticalScale ); SET_FLOAT( verticalScale, setScale ); VerticalScaleController(App& app, ui::Grid* grid) { int r = grid->getNumRows(); grid->setControl(0, r, new ui::LabelControl("VerticalScale")); grid->setControl(1, r, new ui::CheckBoxControl(false, new Toggle(app))); ++r; grid->setControl(0, r, new ui::LabelControl(" scale:")); grid->setControl(1, r, new ui::HSliderControl(0.0, 10.0, 1.0, new setScale(app))); grid->setControl(2, r, new ui::LabelControl(grid->getControl(1, r))); } }; ui::Control* createUI( App& app ) { Grid* grid = new Grid(); grid->setAbsorbEvents( true ); grid->setControl(0, 0, new LabelControl("Terrain Effects", Color::Yellow) ); grid->setControl(1, 0, new LabelControl("")); grid->getControl(1, 0)->setHorizFill( true, 250 ); ContourMapController (app, grid); LODBlendingController (app, grid); NormalMapController (app, grid); VerticalScaleController (app, grid); return grid; } int main(int argc, char** argv) { osg::ArgumentParser arguments(&argc, argv); if (arguments.read("--help")) return usage(argv[0]); osgViewer::Viewer viewer(arguments); viewer.setCameraManipulator( new EarthManipulator() ); App app; ui::Control* demo_ui = createUI(app); osg::Node* node = MapNodeHelper().load( arguments, &viewer, demo_ui ); if ( node ) { MapNode* mapNode = MapNode::get(node); if ( !mapNode ) return -1; app.engine = mapNode->getTerrainEngine(); viewer.setSceneData( node ); viewer.run(); } else { return usage("no earth file"); } return 0; }
#include <osgEarth/VirtualProgram> #include <osgEarth/Registry> #include <osgEarth/TerrainEngineNode> #include <osgEarth/MapNode> #include <osgEarthUtil/EarthManipulator> #include <osgEarthUtil/ExampleResources> #include <osgEarthUtil/Controls> #include <osgEarthUtil/ContourMap> #include <osgEarthUtil/LODBlending> #include <osgEarthUtil/NormalMap> #include <osgEarthUtil/VerticalScale> #include <osgEarthSymbology/Color> #include <osg/Notify> #include <osg/Fog> #include <osgViewer/Viewer> using namespace osgEarth; using namespace osgEarth::Util; using namespace osgEarth::Symbology; namespace ui = osgEarth::Util::Controls; int usage(const char* msg) { OE_NOTICE << msg << std::endl; return 0; } struct App { TerrainEngineNode* engine; osg::ref_ptr<ContourMap> contourMap; osg::ref_ptr<LODBlending> lodBlending; osg::ref_ptr<NormalMap> normalMap; osg::ref_ptr<VerticalScale> verticalScale; App() { contourMap = new ContourMap(); lodBlending = new LODBlending(); normalMap = new NormalMap(); verticalScale = new VerticalScale(); } }; #define SET_FLOAT( effect, func ) \ struct func : public ui::ControlEventHandler { \ App& _app; \ func (App& app) : _app(app) { } \ void onValueChanged(ui::Control*, float value) { \ _app. effect -> func (value); \ } \ }; #define TOGGLE( effect ) \ struct Toggle : public ui::ControlEventHandler { \ App& _app; \ Toggle (App& app) : _app(app) { } \ void onValueChanged(ui::Control*, bool value) { \ if ( value ) _app.engine->addEff
p, ui::Grid* grid) { int r = grid->getNumRows(); grid->setControl(0, r, new ui::LabelControl("LOD Blending")); grid->setControl(1, r, new ui::CheckBoxControl(false, new Toggle(app))); ++r; grid->setControl(0, r, new ui::LabelControl(" delay:")); grid->setControl(1, r, new ui::HSliderControl(0.0, 2.0, 1.0, new setDelay(app))); grid->setControl(2, r, new ui::LabelControl(grid->getControl(1, r))); ++r; grid->setControl(0, r, new ui::LabelControl(" duration:")); grid->setControl(1, r, new ui::HSliderControl(0.0, 5.0, 1.0, new setDuration(app))); grid->setControl(2, r, new ui::LabelControl(grid->getControl(1, r))); ++r; grid->setControl(0, r, new ui::LabelControl(" vertical scale:")); grid->setControl(1, r, new ui::HSliderControl(0.0, 5.0, 1.0, new setVerticalScale(app))); grid->setControl(2, r, new ui::LabelControl(grid->getControl(1, r))); } }; struct NormalMapController { TOGGLE ( normalMap ); NormalMapController(App& app, ui::Grid* grid) { int r = grid->getNumRows(); grid->setControl(0, r, new ui::LabelControl("NormalMap")); grid->setControl(1, r, new ui::CheckBoxControl(false, new Toggle(app))); } }; struct VerticalScaleController { TOGGLE ( verticalScale ); SET_FLOAT( verticalScale, setScale ); VerticalScaleController(App& app, ui::Grid* grid) { int r = grid->getNumRows(); grid->setControl(0, r, new ui::LabelControl("VerticalScale")); grid->setControl(1, r, new ui::CheckBoxControl(false, new Toggle(app))); ++r; grid->setControl(0, r, new ui::LabelControl(" scale:")); grid->setControl(1, r, new ui::HSliderControl(0.0, 10.0, 1.0, new setScale(app))); grid->setControl(2, r, new ui::LabelControl(grid->getControl(1, r))); } }; ui::Control* createUI( App& app ) { Grid* grid = new Grid(); grid->setAbsorbEvents( true ); grid->setControl(0, 0, new LabelControl("Terrain Effects", Color::Yellow) ); grid->setControl(1, 0, new LabelControl("")); grid->getControl(1, 0)->setHorizFill( true, 250 ); ContourMapController (app, grid); LODBlendingController (app, grid); NormalMapController (app, grid); VerticalScaleController (app, grid); return grid; } int main(int argc, char** argv) { osg::ArgumentParser arguments(&argc, argv); if (arguments.read("--help")) return usage(argv[0]); osgViewer::Viewer viewer(arguments); viewer.setCameraManipulator( new EarthManipulator() ); App app; ui::Control* demo_ui = createUI(app); osg::Node* node = MapNodeHelper().load( arguments, &viewer, demo_ui ); if ( node ) { MapNode* mapNode = MapNode::get(node); if ( !mapNode ) return -1; app.engine = mapNode->getTerrainEngine(); viewer.setSceneData( node ); viewer.run(); } else { return usage("no earth file"); } return 0; }
ect( _app. effect .get() ); \ else _app.engine->removeEffect( _app. effect .get() ); \ } \ }; struct ContourMapController { TOGGLE ( contourMap ); SET_FLOAT( contourMap, setOpacity ); ContourMapController(App& app, ui::Grid* grid) { int r = grid->getNumRows(); grid->setControl(0, r, new ui::LabelControl("ContourMap")); grid->setControl(1, r, new ui::CheckBoxControl(false, new Toggle(app))); ++r; grid->setControl(0, r, new ui::LabelControl(" opacity:")); grid->setControl(1, r, new ui::HSliderControl(0.0, 1.0, 0.5, new setOpacity(app))); grid->setControl(2, r, new ui::LabelControl(grid->getControl(1, r))); } }; struct LODBlendingController { TOGGLE ( lodBlending ); SET_FLOAT( lodBlending, setDelay ); SET_FLOAT( lodBlending, setDuration ); SET_FLOAT( lodBlending, setVerticalScale ); LODBlendingController(App& ap
random
[ { "content": "// Callback to toggle the visibility of the save/cancel buttons based on tool state\n\nstruct ToggleUIStateCallback : public FeatureQueryTool::Callback\n\n{\n\n // called when a valid feature is found under the mouse coords\n\n virtual void onHit( FeatureSourceIndexNode* index, FeatureID fid, const EventArgs& args )\n\n {\n\n s_state_active->setVisible( true );\n\n }\n\n\n\n // called when no feature is found under the mouse coords\n\n virtual void onMiss( const EventArgs& args )\n\n {\n\n s_state_active->setVisible( false );\n\n }\n\n};\n\n\n\n\n", "file_path": "ext/include/applications/osgearth_featuremanip/osgearth_featuremanip.cpp", "rank": 2, "score": 365223.67364350654 }, { "content": "struct Apply : public ui::ControlEventHandler\n\n{\n\n Apply(App& app) : _app(app) { }\n\n void onValueChanged(ui::Control* control) {\n\n _app.apply();\n\n }\n\n App& _app;\n\n};\n\n\n\nui::Control* makeUI(App& app)\n\n{\n\n ui::Grid* grid = new ui::Grid();\n\n\n\n grid->setControl(0, 0, new ui::LabelControl(\"Lat:\"));\n\n grid->setControl(0, 1, new ui::LabelControl(\"Long:\"));\n\n grid->setControl(0, 2, new ui::LabelControl(\"Alt:\"));\n\n grid->setControl(0, 3, new ui::LabelControl(\"Heading:\"));\n\n grid->setControl(0, 4, new ui::LabelControl(\"Pitch:\"));\n\n grid->setControl(0, 5, new ui::LabelControl(\"Roll:\"));\n\n\n", "file_path": "ext/include/applications/osgearth_transform/osgearth_transform.cpp", "rank": 3, "score": 354230.63406874484 }, { "content": "struct SetScale : public ui::ControlEventHandler {\n\n App& _app;\n\n SetScale(App& app) : _app(app) {}\n\n void onValueChanged(ui::Control*, float value) {\n\n _app.scaler->setScale(value);\n\n }\n\n};\n\n\n\n\n\n\n\n// Build a slider to adjust the vertical scale\n\nui::Control* createUI( App& app )\n\n{\n\n ui::VBox* vbox = new VBox();\n\n vbox->setAbsorbEvents( true );\n\n\n\n vbox->addControl( new LabelControl(Stringify() << \"Vertical Scale Example\", Color::Yellow) );\n\n\n\n Grid* grid = vbox->addControl( new Grid() );\n\n\n", "file_path": "ext/include/applications/osgearth_verticalscale/osgearth_verticalscale.cpp", "rank": 4, "score": 350035.34030634415 }, { "content": "struct TogglePathHandler : public ControlEventHandler\n\n{\n\n TogglePathHandler( MeasureToolHandler* tool) :\n\n _tool( tool )\n\n { }\n\n\n\n virtual void onValueChanged(Control* control, bool value) {\n\n _tool->setIsPath( value );\n\n }\n\n\n\n osg::ref_ptr<MeasureToolHandler> _tool;\n\n};\n\n\n", "file_path": "ext/include/applications/osgearth_measure/osgearth_measure.cpp", "rank": 5, "score": 328978.64478539437 }, { "content": "struct ToggleModeHandler : public ControlEventHandler\n\n{\n\n ToggleModeHandler( MeasureToolHandler* tool) :\n\n _tool( tool )\n\n { }\n\n\n\n virtual void onValueChanged(Control* control, bool value) {\n\n if (_tool->getGeoInterpolation() == GEOINTERP_GREAT_CIRCLE)\n\n {\n\n _tool->setGeoInterpolation( GEOINTERP_RHUMB_LINE);\n\n }\n\n else\n\n {\n\n _tool->setGeoInterpolation( GEOINTERP_GREAT_CIRCLE);\n\n } \n\n }\n\n\n\n osg::ref_ptr<MeasureToolHandler> _tool;\n\n};\n\n\n", "file_path": "ext/include/applications/osgearth_measure/osgearth_measure.cpp", "rank": 6, "score": 328978.64478539437 }, { "content": "struct ToggleNodeHandler : public ControlEventHandler\n\n{\n\n ToggleNodeHandler( osg::Node* node ) : _node(node) { }\n\n\n\n void onValueChanged( Control* control, bool value )\n\n {\n\n _node->setNodeMask( value ? ~0 : 0 );\n\n }\n\n\n\n osg::Node* _node;\n\n};\n\n\n\n//------------------------------------------------------------------\n\n\n\n\n\nint\n\nmain(int argc, char** argv)\n\n{\n\n // The HighlightDecoration requires you to allocate stencil planes,\n\n // and will yell at you if you don't. You have to do this prior to creating\n", "file_path": "ext/include/applications/osgearth_annotation/osgearth_annotation.cpp", "rank": 7, "score": 328978.64478539437 }, { "content": "struct App\n\n{\n\n VerticalScale* scaler;\n\n};\n\n\n\n\n", "file_path": "ext/include/applications/osgearth_verticalscale/osgearth_verticalscale.cpp", "rank": 8, "score": 317991.27324665146 }, { "content": "struct App\n\n{\n\n DetailTexture* dt;\n\n};\n\n\n\n\n\n// Build a slider to adjust the vertical scale\n\nui::Control* createUI( App& app )\n\n{\n\n struct SetIntensity : public ui::ControlEventHandler {\n\n App& _app;\n\n SetIntensity(App& app) : _app(app) {}\n\n void onValueChanged(ui::Control*, float value) {\n\n _app.dt->setIntensity(value);\n\n }\n\n };\n\n\n\n ui::VBox* vbox = new VBox();\n\n\n\n vbox->addControl( new LabelControl(Stringify() << \"Detail texture starts at LOD: \" << app.dt->getStartLOD()) );\n", "file_path": "ext/include/applications/osgearth_detailtex/osgearth_detailtex.cpp", "rank": 9, "score": 317991.27324665146 }, { "content": "// shared data.\n\nstruct App\n\n{\n\n osg::TextureRectangle* gcolor;\n\n osg::TextureRectangle* gnormal;\n\n osg::TextureRectangle* gdepth;\n\n};\n\n\n\n\n\nosg::Node*\n\ncreateMRTPass(App& app, osg::Node* sceneGraph)\n\n{\n\n osg::Camera* rtt = new osg::Camera();\n\n rtt->setRenderOrder(osg::Camera::PRE_RENDER);\n\n rtt->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);\n\n rtt->setViewport(0, 0, app.gcolor->getTextureWidth(), app.gcolor->getTextureHeight());\n\n rtt->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n rtt->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0), app.gcolor);\n\n rtt->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER1), app.gnormal);\n\n rtt->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER2), app.gdepth);\n\n\n", "file_path": "ext/include/applications/osgearth_mrt/osgearth_mrt.cpp", "rank": 10, "score": 317991.27324665146 }, { "content": "struct App\n\n{\n\n const osgEarth::SpatialReference* srs;\n\n osgEarth::GeoTransform* geo;\n\n osg::PositionAttitudeTransform* pat;\n\n\n\n ui::HSliderControl* uiLat;\n\n ui::HSliderControl* uiLon;\n\n ui::HSliderControl* uiAlt;\n\n ui::HSliderControl* uiHeading;\n\n ui::HSliderControl* uiPitch;\n\n ui::HSliderControl* uiRoll;\n\n\n\n void apply()\n\n {\n\n GeoPoint pos(\n\n srs,\n\n uiLon->getValue(), uiLat->getValue(), uiAlt->getValue(),\n\n ALTMODE_ABSOLUTE);\n\n\n", "file_path": "ext/include/applications/osgearth_transform/osgearth_transform.cpp", "rank": 11, "score": 317991.27324665146 }, { "content": "// Custom progress reporter\n\nstruct ProgressReporter : public osgEarth::ProgressCallback\n\n{\n\n bool reportProgress(double current, \n\n double total, \n\n unsigned currentStage,\n\n unsigned totalStages,\n\n const std::string& msg )\n\n {\n\n float percentage = current/total*100.0f;\n\n std::cout \n\n << std::fixed\n\n << std::setprecision(1) << \"\\r\" \n\n << (int)current << \"/\" << (int)total\n\n << \" (\" << percentage << \"%)\"\n\n << \" \"\n\n << std::flush;\n\n\n\n if ( percentage >= 100.0f )\n\n std::cout << std::endl;\n\n\n", "file_path": "ext/include/applications/osgearth_conv/osgearth_conv.cpp", "rank": 13, "score": 297582.8986201369 }, { "content": "struct MyMapListener : public MapCallback\n\n{\n\n void onMapModelChanged( const MapModelChange& change ) {\n\n s_updateRequired = true;\n\n }\n\n};\n\n\n", "file_path": "ext/include/applications/osgearth_toc/osgearth_toc.cpp", "rank": 14, "score": 283231.0104547823 }, { "content": "// Cancels the manipulation when user clicks \"cancel\"\n\nstruct OnCancel : public ControlEventHandler\n\n{\n\n void onClick( Control* control )\n\n {\n\n s_manipTool->cancel();\n\n s_state_active->setVisible( false );\n\n }\n\n};\n\n\n\n\n", "file_path": "ext/include/applications/osgearth_featuremanip/osgearth_featuremanip.cpp", "rank": 15, "score": 283231.0104547823 }, { "content": "// Commits the manipulation when user clicks \"save\"\n\nstruct OnSave : public ControlEventHandler\n\n{\n\n void onClick( Control* saveButton )\n\n {\n\n s_manipTool->commit();\n\n s_state_active->setVisible( false );\n\n }\n\n};\n\n\n\n\n\n// creaes a simple user interface for the manip demo\n\nControl*\n\ncreateUI()\n\n{\n\n VBox* vbox = new VBox();\n\n vbox->addControl( new LabelControl(\"Feature Manipulator Demo\", Color::Yellow) );\n\n\n\n s_state_normal = vbox->addControl(new VBox());\n\n s_state_normal->addControl( new LabelControl(\"Shift-click on a feature to enter edit mode.\") );\n\n \n", "file_path": "ext/include/applications/osgearth_featuremanip/osgearth_featuremanip.cpp", "rank": 16, "score": 283231.0104547823 }, { "content": "struct MyMainWindow : public QMainWindow, public ViewController\n\n{\n\n QTimer _timer;\n\n osgViewer::CompositeViewer _viewer;\n\n osg::ref_ptr<osg::Node> _scene;\n\n\n\n MyMainWindow(osg::ArgumentParser& args, osg::Node* scene) \n\n : _viewer(args), _scene(scene)\n\n {\n\n // we have to add a starting view, otherwise the CV will automatically\n\n // mark itself as done :/\n\n addView();\n\n\n\n // timer fires a paint event.\n\n connect(&_timer, SIGNAL(timeout()), this, SLOT(update()));\n\n _timer.start(20);\n\n }\n\n\n\n void paintEvent(QPaintEvent* e)\n\n {\n", "file_path": "ext/include/applications/osgearth_qt_windows/osgearth_qt_windows.cpp", "rank": 17, "score": 280296.881538395 }, { "content": "struct OpacityHandler : public ControlEventHandler\n\n{\n\n OpacityHandler( ImageOverlay* overlay ) : _overlay(overlay) { }\n\n void onValueChanged( Control* control, float value ) {\n\n _overlay->setAlpha( value );\n\n }\n\n ImageOverlay* _overlay;\n\n};\n\n\n", "file_path": "ext/include/applications/osgearth_imageoverlay/osgearth_imageoverlay.cpp", "rank": 18, "score": 279831.58040282974 }, { "content": "struct MySliderHandler : public ControlEventHandler\n\n{\n\n void onValueChanged( Control* control, float value )\n\n {\n\n std::stringstream buf;\n\n buf << (int)value;\n\n std::string str;\n\n str = buf.str();\n\n s_sliderLabel->setText( str );\n\n }\n\n};\n\n\n", "file_path": "ext/include/applications/osgearth_controls/osgearth_controls.cpp", "rank": 19, "score": 279831.58040282974 }, { "content": "struct MyClickHandler : public ControlEventHandler\n\n{\n\n void onClick( Control* control, const osg::Vec2f& pos, int mouseButtonMask )\n\n {\n\n OE_NOTICE << \"You clicked at (\" << pos.x() << \", \" << pos.y() << \") within the control.\"\n\n << std::endl;\n\n }\n\n};\n\n\n\nstatic LabelControl* s_sliderLabel;\n\n\n", "file_path": "ext/include/applications/osgearth_controls/osgearth_controls.cpp", "rank": 20, "score": 279831.58040282974 }, { "content": "struct RotateImage : public ControlEventHandler\n\n{\n\n void onValueChanged( Control* control, float value )\n\n {\n\n s_imageControl->setRotation( Angular(value) );\n\n }\n\n};\n\n\n", "file_path": "ext/include/applications/osgearth_controls/osgearth_controls.cpp", "rank": 21, "score": 279831.58040282974 }, { "content": "struct EnabledHandler : public ControlEventHandler\n\n{\n\n EnabledHandler( ImageOverlay* overlay ) : _overlay(overlay) { }\n\n void onValueChanged( Control* control, bool value ) {\n\n _overlay->setNodeMask( value ? ~0 : 0 );\n\n }\n\n ImageOverlay* _overlay;\n\n};\n\n\n\n\n\n\n", "file_path": "ext/include/applications/osgearth_imageoverlay/osgearth_imageoverlay.cpp", "rank": 22, "score": 279831.58040282974 }, { "content": "struct EditHandler : public ControlEventHandler\n\n{\n\n EditHandler( ImageOverlay* overlay, osgViewer::Viewer* viewer, osg::Node* editor) :\n\n _overlay(overlay),\n\n _viewer(viewer),\n\n _editor(editor){ }\n\n\n\n void onClick( Control* control, int mouseButtonMask ) { \n\n if (_editor->getNodeMask() != ~0)\n\n {\n\n static_cast<LabelControl*>(control)->setText( \"Finish\" );\n\n _editor->setNodeMask(~0);\n\n }\n\n else\n\n {\n\n static_cast<LabelControl*>(control)->setText( \"Edit\" );\n\n _editor->setNodeMask(0);\n\n }\n\n }\n\n\n\n ImageOverlay* _overlay;\n\n osgViewer::Viewer* _viewer;\n\n osg::Node* _editor;\n\n};\n\n\n", "file_path": "ext/include/applications/osgearth_imageoverlay/osgearth_imageoverlay.cpp", "rank": 23, "score": 279831.58040282974 }, { "content": "// Updates the timestamp label once per frame.\n\nstruct UpdateLabel : public osg::Operation\n\n{\n\n osgEarth::SequenceControl* _sc;\n\n ui::LabelControl* _label;\n\n unsigned _prevIndex;\n\n\n\n UpdateLabel(osgEarth::SequenceControl* sc, ui::LabelControl* label)\n\n : osg::Operation(\"updatelabel\", true), _sc(sc), _label(label), _prevIndex(INT_MAX) { }\n\n\n\n void operator()(osg::Object* obj)\n\n {\n\n osgViewer::View* view = dynamic_cast<osgViewer::View*>(obj);\n\n unsigned index = _sc->getCurrentSequenceFrameIndex(view->getFrameStamp());\n\n if ( index >= 0 && index != _prevIndex )\n\n {\n\n const std::vector<osgEarth::SequenceFrameInfo>& frames = _sc->getSequenceFrameInfo();\n\n _label->setText( frames[index].timeIdentifier );\n\n _prevIndex = index;\n\n }\n\n }\n", "file_path": "ext/include/applications/osgearth_sequencecontrol/osgearth_sequencecontrol.cpp", "rank": 24, "score": 276748.00815667195 }, { "content": "struct TrackSim : public osg::Referenced\n\n{\n\n TrackSim(TrackNode* track, const osg::Vec3d& center, float radius, double time, osgEarth::MapNode* mapNode)\n\n : _track(track), _mapNode(mapNode), _radius(radius), _time(time)\n\n {\n\n //Get the center point in geocentric\n\n GeoPoint centerMap(mapNode->getMapSRS(), center, ALTMODE_ABSOLUTE);\n\n centerMap.toWorld( _center, mapNode->getTerrain() );\n\n //mapNode->getMap()->toWorldPoint( centerMap, _center );\n\n\n\n _up = _center;\n\n _up.normalize();\n\n\n\n //Get the \"side\" vector\n\n _side = _up ^ osg::Vec3d(0,0,1);\n\n }\n\n\n\n void update(double time)\n\n {\n\n double angle = (time / _time);\n", "file_path": "ext/include/applications/osgearth_qt/osgearth_qt.cpp", "rank": 25, "score": 276748.00815667195 }, { "content": "struct TrackSim : public osg::Referenced\n\n{\n\n TrackNode* _track;\n\n Angular _startLat, _startLon, _endLat, _endLon;\n\n\n\n void update( double t )\n\n {\n\n osg::Vec3d pos;\n\n GeoMath::interpolate(\n\n _startLat.as(Units::RADIANS), _startLon.as(Units::RADIANS),\n\n _endLat.as(Units::RADIANS), _endLon.as(Units::RADIANS),\n\n t,\n\n pos.y(), pos.x() );\n\n\n\n GeoPoint geo(\n\n _track->getMapNode()->getMapSRS(),\n\n osg::RadiansToDegrees(pos.x()),\n\n osg::RadiansToDegrees(pos.y()),\n\n 10000.0,\n\n ALTMODE_ABSOLUTE);\n", "file_path": "ext/include/applications/osgearth_tracks/osgearth_tracks.cpp", "rank": 26, "score": 276748.00815667195 }, { "content": "struct UpdateOperation : public osg::Operation\n\n{\n\n UpdateOperation() : osg::Operation( \"\", true ) { }\n\n\n\n void operator()(osg::Object*)\n\n {\n\n if ( s_updateRequired )\n\n {\n\n updateControlPanel();\n\n s_updateRequired = false;\n\n }\n\n }\n\n};\n\n\n\n//------------------------------------------------------------------------\n\n\n\nint\n\nmain( int argc, char** argv )\n\n{\n\n osg::ArgumentParser arguments( &argc,argv );\n", "file_path": "ext/include/applications/osgearth_toc/osgearth_toc.cpp", "rank": 27, "score": 276748.00815667195 }, { "content": "// TileHandler that copies images from an ImageLayer to a TileSource.\n\n// This will automatically handle any mosaicing and reprojection that is\n\n// necessary to translate from one Profile/SRS to another.\n\nstruct ImageLayerToTileSource : public TileHandler\n\n{\n\n ImageLayerToTileSource(TileSource* source, ReadWriteTileSource* dest)\n\n : _source(source), _dest(dest)\n\n {\n\n _layer = new ImageLayer(ImageLayerOptions(), source);\n\n }\n\n\n\n bool handleTile(const TileKey& key)\n\n {\n\n bool ok = false;\n\n GeoImage image = _layer->createImage(key);\n\n if ( image.valid() )\n\n ok = _dest->storeImage(key, image.getImage(), 0L);\n\n return ok;\n\n }\n\n \n\n bool hasData(const TileKey& key) const\n\n {\n\n return _source->hasData(key);\n\n }\n\n\n\n TileSource* _source;\n\n ReadWriteTileSource* _dest;\n\n osg::ref_ptr<ImageLayer> _layer;\n\n};\n\n\n\n\n", "file_path": "ext/include/applications/osgearth_conv/osgearth_conv.cpp", "rank": 28, "score": 276538.0138544773 }, { "content": "struct RemoveLayerHandler : public ControlEventHandler\n\n{\n\n RemoveLayerHandler( TerrainLayer* layer ) : _layer(layer) { }\n\n void onClick( Control* control, int mouseButtonMask ) { \n\n ImageLayer* imageLayer = dynamic_cast< ImageLayer*>( _layer.get() );\n\n ElevationLayer* elevationLayer = dynamic_cast< ElevationLayer*>( _layer.get() );\n\n\n\n if (imageLayer)\n\n {\n\n s_inactiveMap->addImageLayer( imageLayer );\n\n s_activeMap->removeImageLayer( imageLayer );\n\n }\n\n else\n\n {\n\n s_inactiveMap->addElevationLayer( elevationLayer );\n\n s_activeMap->removeElevationLayer( elevationLayer );\n\n }\n\n }\n\n osg::ref_ptr<TerrainLayer> _layer;\n\n};\n\n\n", "file_path": "ext/include/applications/osgearth_toc/osgearth_toc.cpp", "rank": 29, "score": 276538.0138544773 }, { "content": "struct EditModeHandler : public ControlEventHandler\n\n{\n\n EditModeHandler() \n\n { \n\n }\n\n\n\n void onClick( Control* control, int mouseButtonMask ) {\n\n \n\n //Remove the add point handler if it's valid\n\n if (s_addPointHandler.valid())\n\n { \n\n osgEarth::removeEventHandler( s_viewer, s_addPointHandler.get() );\n\n s_addPointHandler = NULL;\n\n } \n\n\n\n if (!s_editor.valid())\n\n { \n\n Style style = s_featureNode->getStyle();\n\n style.getOrCreate<LineSymbol>()->stroke()->stipple() = 0x00FF; \n\n s_featureNode->setStyle( style ); \n\n s_editor = new FeatureEditor( s_featureNode );\n\n s_root->addChild( s_editor.get() ); \n\n }\n\n } \n\n};\n\n\n", "file_path": "ext/include/applications/osgearth_featureeditor/osgearth_featureeditor.cpp", "rank": 30, "score": 276538.0138544773 }, { "content": "struct LayerOpacityHandler : public ControlEventHandler\n\n{\n\n LayerOpacityHandler( ImageLayer* layer ) : _layer(layer) { }\n\n void onValueChanged( Control* control, float value )\n\n {\n\n _layer->setOpacity( value );\n\n }\n\n ImageLayer* _layer;\n\n};\n\n\n", "file_path": "ext/include/applications/osgearth_toc/osgearth_toc.cpp", "rank": 31, "score": 276538.0138544773 }, { "content": "// TileHandler that copies images from one tilesource to another.\n\nstruct TileSourceToTileSource : public TileHandler\n\n{\n\n TileSourceToTileSource(TileSource* source, ReadWriteTileSource* dest)\n\n : _source(source), _dest(dest)\n\n {\n\n //nop\n\n }\n\n\n\n bool handleTile(const TileKey& key)\n\n {\n\n bool ok = false;\n\n osg::ref_ptr<osg::Image> image = _source->createImage(key);\n\n if ( image.valid() )\n\n ok = _dest->storeImage(key, image.get(), 0L);\n\n return ok;\n\n }\n\n \n\n bool hasData(const TileKey& key) const\n\n {\n\n return _source->hasData(key);\n\n }\n\n\n\n TileSource* _source;\n\n ReadWriteTileSource* _dest;\n\n};\n\n\n\n\n", "file_path": "ext/include/applications/osgearth_conv/osgearth_conv.cpp", "rank": 32, "score": 276538.0138544773 }, { "content": "struct AddLayerHandler : public ControlEventHandler\n\n{\n\n AddLayerHandler( TerrainLayer* layer ) : _layer(layer) { }\n\n void onClick( Control* control, int mouseButtonMask ) {\n\n\n\n ImageLayer* imageLayer = dynamic_cast< ImageLayer*>( _layer.get() );\n\n ElevationLayer* elevationLayer = dynamic_cast< ElevationLayer*>( _layer.get() );\n\n\n\n if (imageLayer)\n\n {\n\n s_inactiveMap->removeImageLayer( imageLayer );\n\n s_activeMap->addImageLayer( imageLayer );\n\n }\n\n else\n\n {\n\n s_inactiveMap->removeElevationLayer( elevationLayer );\n\n s_activeMap->addElevationLayer( elevationLayer );\n\n }\n\n }\n\n osg::ref_ptr<TerrainLayer> _layer;\n\n};\n\n\n", "file_path": "ext/include/applications/osgearth_toc/osgearth_toc.cpp", "rank": 33, "score": 276538.0138544773 }, { "content": "struct MyAnnoEventHandler : public AnnotationEventHandler\n\n{\n\n void onHoverEnter( AnnotationNode* anno, const EventArgs& args )\n\n {\n\n anno->setDecoration( \"hover\" );\n\n OE_NOTICE << \"Hover enter\" << std::endl;\n\n }\n\n\n\n void onHoverLeave( AnnotationNode* anno, const EventArgs& args )\n\n {\n\n anno->clearDecoration();\n\n OE_NOTICE << \"Hover leave\" << std::endl;\n\n }\n\n\n\n virtual void onClick( AnnotationNode* node, const EventArgs& details )\n\n { \n\n PlaceNode* place = dynamic_cast<PlaceNode*>(node);\n\n if (place == NULL)\n\n {\n\n OE_NOTICE << \"Thanks for clicking this annotation\" << std::endl;\n\n }\n\n else\n\n {\n\n OE_NOTICE << \"Thanks for clicking the PlaceNode: \" << place->getText() << std::endl;\n\n }\n\n }\n\n};\n\n\n\n//------------------------------------------------------------------\n\n\n", "file_path": "ext/include/applications/osgearth_annotation/osgearth_annotation.cpp", "rank": 34, "score": 276538.0138544773 }, { "content": "struct ChangeStyleHandler : public ControlEventHandler\n\n{\n\n ChangeStyleHandler(const Style &style) \n\n : _style( style )\n\n {\n\n //nop\n\n }\n\n\n\n void onClick( Control* control, int mouseButtonMask ) {\n\n s_featureNode->setStyle( _style ); \n\n }\n\n\n\n Style _style; \n\n};\n\n\n\nStyle buildStyle( const osg::Vec4 &color, float width )\n\n{\n\n // Define a style for the feature data. Since we are going to render the\n\n // vectors as lines, configure the line symbolizer:\n\n Style style;\n", "file_path": "ext/include/applications/osgearth_featureeditor/osgearth_featureeditor.cpp", "rank": 35, "score": 276538.0138544773 }, { "content": "struct LayerVisibleHandler : public ControlEventHandler\n\n{\n\n LayerVisibleHandler( TerrainLayer* layer ) : _layer(layer) { }\n\n void onValueChanged( Control* control, bool value )\n\n {\n\n _layer->setVisible( value );\n\n }\n\n TerrainLayer* _layer;\n\n};\n\n\n", "file_path": "ext/include/applications/osgearth_toc/osgearth_toc.cpp", "rank": 36, "score": 276538.0138544773 }, { "content": "struct MoveLayerHandler : public ControlEventHandler\n\n{\n\n MoveLayerHandler( TerrainLayer* layer, int newIndex ) : _layer(layer), _newIndex(newIndex) { }\n\n void onClick( Control* control, int mouseButtonMask ) {\n\n ImageLayer* imageLayer = dynamic_cast< ImageLayer*>( _layer );\n\n ElevationLayer* elevationLayer = dynamic_cast< ElevationLayer*>( _layer );\n\n\n\n if (imageLayer)\n\n {\n\n s_activeMap->moveImageLayer( imageLayer, _newIndex );\n\n }\n\n else\n\n {\n\n s_activeMap->moveElevationLayer( elevationLayer, _newIndex );\n\n }\n\n }\n\n TerrainLayer* _layer;\n\n int _newIndex;\n\n};\n\n\n", "file_path": "ext/include/applications/osgearth_toc/osgearth_toc.cpp", "rank": 37, "score": 276538.0138544773 }, { "content": "struct MyAnnoEventHandler : public AnnotationEventHandler\n\n{\n\n MyAnnoEventHandler(osgEarth::QtGui::DataManager* manager) : _manager(manager) {}\n\n\n\n void onClick( AnnotationNode* node, const EventArgs& details )\n\n {\n\n if (_manager.valid() && details.buttons == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON)\n\n {\n\n if (details.modkeys & osgGA::GUIEventAdapter::MODKEY_CTRL)\n\n {\n\n if (_manager->isSelected(node))\n\n _manager->removeSelectedAnnotation(node);\n\n else\n\n _manager->addSelectedAnnotation(node);\n\n }\n\n else\n\n {\n\n _manager->clearSelectedAnnotations();\n\n _manager->addSelectedAnnotation(node);\n\n }\n\n } \n\n }\n\n\n\n\n\n osg::ref_ptr<osgEarth::QtGui::DataManager> _manager;\n\n};\n\n\n\n//------------------------------------------------------------------\n\n// Methods for demo track simulation\n\n\n", "file_path": "ext/include/applications/osgearth_qt/osgearth_qt.cpp", "rank": 38, "score": 276538.0138544773 }, { "content": "struct ChangeImageHandler : public ControlEventHandler\n\n{\n\n ChangeImageHandler( osg::Image* image, ImageOverlay* overlay, ImageControl* preview) :\n\n _image(image),\n\n _overlay(overlay),\n\n _preview(preview){ }\n\n\n\n void onClick( Control* control, int mouseButtonMask ) {\n\n _overlay->setImage( _image.get() );\n\n _preview->setImage( _image.get() );\n\n }\n\n ImageOverlay* _overlay;\n\n osg::ref_ptr< osg::Image > _image;\n\n osg::ref_ptr< ImageControl> _preview;\n\n};\n\n\n", "file_path": "ext/include/applications/osgearth_imageoverlay/osgearth_imageoverlay.cpp", "rank": 39, "score": 276538.0138544773 }, { "content": "struct SetImageOpacity : public ControlEventHandler\n\n{\n\n void onValueChanged( Control* control, float value )\n\n {\n\n s_imageControl->setOpacity( value );\n\n }\n\n};\n\n\n\nvoid\n\ncreateControls( ControlCanvas* cs )\n\n{\n\n // a container centered on the screen, containing an image and a text label.\n\n {\n\n VBox* center = new VBox();\n\n center->setBorderColor( 1, 1, 1, 1 );\n\n center->setBackColor( .6,.5,.4,0.5 );\n\n center->setPadding( 10 );\n\n center->setHorizAlign( Control::ALIGN_CENTER );\n\n center->setVertAlign( Control::ALIGN_CENTER );\n\n\n", "file_path": "ext/include/applications/osgearth_controls/osgearth_controls.cpp", "rank": 40, "score": 276538.0138544773 }, { "content": "struct ImageRequest : public osgEarth::TaskRequest\n\n{\n\n ImageRequest( ImageLayer* layer, const TileKey& key ) : _layer(layer), _key(key) { }\n\n\n\n void operator()( ProgressCallback* progress )\n\n {\n\n _result = _layer->createImage( _key );\n\n }\n\n\n\n osg::ref_ptr<ImageLayer> _layer;\n\n TileKey _key;\n\n GeoImage _result;\n\n};\n\n\n\n// --------------------------------------------------------------------------\n\n\n\nMeshManager::MeshManager( Manifold* manifold, Map* map ) :\n\n_manifold( manifold ),\n\n_map( map ),\n\n_minGeomLevel( 1 ),\n", "file_path": "ext/include/osgEarthDrivers/engine_droam/MeshManager.cpp", "rank": 41, "score": 276008.68398072274 }, { "content": "struct TrackSimUpdate : public osg::Operation\n\n{\n\n TrackSimUpdate(TrackSims& sims) : osg::Operation( \"tasksim\", true ), _sims(sims) { }\n\n\n\n void operator()( osg::Object* obj ) {\n\n osg::View* view = dynamic_cast<osg::View*>(obj);\n\n double t = fmod(view->getFrameStamp()->getSimulationTime(), (double)g_duration.get()) / (double)g_duration.get();\n\n for( TrackSims::iterator i = _sims.begin(); i != _sims.end(); ++i )\n\n i->get()->update( t );\n\n }\n\n\n\n TrackSims& _sims;\n\n};\n\n\n\n\n\n/**\n\n * Creates a field schema that we'll later use as a labeling template for\n\n * TrackNode instances.\n\n */\n\nvoid\n", "file_path": "ext/include/applications/osgearth_tracks/osgearth_tracks.cpp", "rank": 42, "score": 273348.5781047194 }, { "content": "struct TrackSimUpdate : public osg::Operation\n\n{\n\n TrackSimUpdate(TrackSimVector& sims) : osg::Operation(\"tracksim\", true), _sims(sims) { }\n\n\n\n void operator()(osg::Object* obj)\n\n {\n\n osg::View* view = dynamic_cast<osg::View*>(obj);\n\n double t = view->getFrameStamp()->getSimulationTime();\n\n\n\n for(TrackSimVector::iterator i = _sims.begin(); i != _sims.end(); ++i)\n\n i->get()->update(t);\n\n }\n\n\n\n TrackSimVector& _sims;\n\n};\n\n\n\nTrackNode* createTrack(TrackNodeFieldSchema& schema, osg::Image* image, const std::string& name, MapNode* mapNode, const osg::Vec3d& center, double radius, double time, TrackSimVector& trackSims)\n\n{\n\n TrackNode* track = new TrackNode(mapNode, GeoPoint(mapNode->getMapSRS(),center,ALTMODE_ABSOLUTE), image, schema);\n\n track->setFieldValue(TRACK_FIELD_NAME, name);\n", "file_path": "ext/include/applications/osgearth_qt/osgearth_qt.cpp", "rank": 43, "score": 273348.5781047194 }, { "content": "struct ModelLayerVisibleHandler : public ControlEventHandler\n\n{\n\n ModelLayerVisibleHandler( ModelLayer* layer ) : _layer(layer) { }\n\n void onValueChanged( Control* control, bool value )\n\n {\n\n _layer->setVisible( value );\n\n }\n\n ModelLayer* _layer;\n\n};\n\n\n", "file_path": "ext/include/applications/osgearth_toc/osgearth_toc.cpp", "rank": 44, "score": 273345.3179071608 }, { "content": "struct AddVertsModeHandler : public ControlEventHandler\n\n{\n\n AddVertsModeHandler() \n\n {\n\n }\n\n\n\n void onClick( Control* control, int mouseButtonMask ) {\n\n\n\n //remove the editor if it's valid\n\n if (s_editor.valid())\n\n {\n\n s_root->removeChild( s_editor.get() );\n\n s_editor = NULL;\n\n\n\n // Unset the stipple on the line\n\n Style style = s_featureNode->getStyle();\n\n style.get<LineSymbol>()->stroke()->stipple().unset();\n\n s_featureNode->setStyle( style ); \n\n }\n\n\n\n //Add the new add point handler\n\n if (!s_addPointHandler.valid())\n\n { \n\n s_addPointHandler = new AddPointHandler( s_featureNode.get() );\n\n s_addPointHandler->setIntersectionMask( 0x1 );\n\n s_viewer->addEventHandler( s_addPointHandler.get() );\n\n } \n\n }\n\n};\n\n\n", "file_path": "ext/include/applications/osgearth_featureeditor/osgearth_featureeditor.cpp", "rank": 45, "score": 273345.31790716085 }, { "content": "struct AddButton : public QPushButton\n\n{\n\n ViewController* _vc;\n\n\n\n AddButton(ViewController* vc, const char* text)\n\n : QPushButton(text), _vc(vc) { }\n\n\n\n void mousePressEvent( QMouseEvent* e )\n\n {\n\n _vc->addView();\n\n }\n\n};\n\n\n\n//------------------------------------------------------------------\n\n\n\nint\n\nmain(int argc, char** argv)\n\n{\n\n osg::ArgumentParser args(&argc,argv);\n\n if ( args.find(\"--help\") >= 0)\n", "file_path": "ext/include/applications/osgearth_qt_windows/osgearth_qt_windows.cpp", "rank": 46, "score": 273345.31790716085 }, { "content": "struct ModelLayerOpacityHandler : public ControlEventHandler\n\n{\n\n ModelLayerOpacityHandler( ModelLayer* layer ) : _layer(layer) { }\n\n void onValueChanged( Control* control, float value )\n\n {\n\n _layer->setOpacity( value );\n\n }\n\n ModelLayer* _layer;\n\n};\n\n\n", "file_path": "ext/include/applications/osgearth_toc/osgearth_toc.cpp", "rank": 47, "score": 273345.3179071608 }, { "content": "// adapter that lets SeamlessEngineNode listen to Map events\n\n// This should be a template or something.\n\nstruct SeamlessMapProxy : public MapCallback\n\n{\n\n SeamlessMapProxy(SeamlessEngineNode* node) : _node(node) { }\n\n osg::observer_ptr<SeamlessEngineNode> _node;\n\n\n\n void onMapProfileEstablished( const Profile* profile ) {\n\n _node->onMapProfileEstablished(profile);\n\n }\n\n void onImageLayerAdded( ImageLayer* layer, unsigned int index ) {\n\n _node->onImageLayerAdded(layer, index);\n\n }\n\n void onImageLayerRemoved( ImageLayer* layer, unsigned int index ) {\n\n _node->onImageLayerRemoved(layer, index);\n\n }\n\n void onImageLayerMoved( ImageLayer* layer, unsigned int oldIndex, unsigned int newIndex ) {\n\n _node->onImageLayerMoved(layer,oldIndex,newIndex);\n\n }\n\n void onElevationLayerAdded( ElevationLayer* layer, unsigned int index ) {\n\n _node->onElevationLayerAdded(layer, index);\n\n }\n", "file_path": "ext/include/osgEarthDrivers/engine_seamless/SeamlessEngineNode.cpp", "rank": 48, "score": 269783.2278925745 }, { "content": "struct ImageRequest : public TaskRequest\n\n{\n\n ImageRequest(Geographic* gpatchset, const TileKey& key)\n\n : _gpatchset(gpatchset), _key(key), _mapf(gpatchset->getMapFrame())\n\n {\n\n }\n\n\n\n void operator()(ProgressCallback* progress)\n\n {\n\n GeoImage gimage;\n\n const ImageLayerVector& layers = _mapf.imageLayers();\n\n if (crossesDateLine(_key))\n\n {\n\n GeoImageVector gis;\n\n if (!layers.empty())\n\n {\n\n for (int child = 0; child < 4; ++child)\n\n {\n\n TileKey subCubeKey = _key.createChildKey(child);\n\n gis.push_back(layers[0]->createImage(subCubeKey));\n", "file_path": "ext/include/osgEarthDrivers/engine_seamless/Geographic.cpp", "rank": 49, "score": 264981.6864573938 }, { "content": "// An event handler that will print out the elevation at the clicked point\n\nstruct QueryElevationHandler : public osgGA::GUIEventHandler \n\n{\n\n QueryElevationHandler()\n\n : _mouseDown( false ),\n\n _terrain ( s_mapNode->getTerrain() ),\n\n _query ( s_mapNode->getMap() )\n\n {\n\n _map = s_mapNode->getMap();\n\n _query.setMaxTilesToCache(10);\n\n _path.push_back( s_mapNode->getTerrainEngine() );\n\n }\n\n\n\n void update( float x, float y, osgViewer::View* view )\n\n {\n\n bool yes = false;\n\n\n\n // look under the mouse:\n\n osg::Vec3d world;\n\n if ( _terrain->getWorldCoordsUnderMouse(view, x, y, world) )\n\n {\n", "file_path": "ext/include/applications/osgearth_elevation/osgearth_elevation.cpp", "rank": 50, "score": 263765.81197964255 }, { "content": "struct UpdateLabelCallback : public ImageOverlay::ImageOverlayCallback\n\n{\n\n UpdateLabelCallback(LabelControl* label, ImageOverlay* overlay, ImageOverlay::ControlPoint controlPoint):\n\n _label(label),\n\n _overlay(overlay),\n\n _controlPoint(controlPoint)\n\n {\n\n\n\n }\n\n\n\n virtual void onOverlayChanged()\n\n {\n\n osg::Vec2d location = _overlay->getControlPoint( _controlPoint );\n\n std::stringstream ss;\n\n ss << location.y() << \", \" << location.x();\n\n std::string str;\n\n str = ss.str();\n\n _label->setText( str );\n\n }\n\n \n", "file_path": "ext/include/applications/osgearth_imageoverlay/osgearth_imageoverlay.cpp", "rank": 51, "score": 263765.81197964255 }, { "content": "// adapter that lets OSGTerrainEngineNode listen to Map events\n\nstruct OSGTerrainEngineNodeMapCallbackProxy : public MapCallback\n\n{\n\n OSGTerrainEngineNodeMapCallbackProxy(OSGTerrainEngineNode* node) : _node(node) { }\n\n osg::observer_ptr<OSGTerrainEngineNode> _node;\n\n\n\n void onMapInfoEstablished( const MapInfo& mapInfo ) {\n\n _node->onMapInfoEstablished( mapInfo );\n\n }\n\n\n\n void onMapModelChanged( const MapModelChange& change ) {\n\n _node->onMapModelChanged( change );\n\n }\n\n};\n\n\n\n//---------------------------------------------------------------------------\n\n\n\n//static\n\n//static OpenThreads::ReentrantMutex s_engineNodeCacheMutex;\n\nstatic Threading::ReadWriteMutex s_engineNodeCacheMutex;\n\n//Caches the MapNodes that have been created\n", "file_path": "ext/include/osgEarthDrivers/engine_osgterrain/OSGTerrainEngineNode.cpp", "rank": 52, "score": 263273.9337068133 }, { "content": "struct HeightFieldRequest : public TaskRequest\n\n{\n\n HeightFieldRequest(Geographic* gpatchset, const TileKey& key)\n\n\n\n : _gpatchset(gpatchset), _key(key), _mapf(gpatchset->getMapFrame())\n\n {\n\n }\n\n void operator()(ProgressCallback* progress)\n\n {\n\n const Map* map = _gpatchset->getMap();\n\n int resolution = _gpatchset->getResolution();\n\n GeoHeightField hf;\n\n if (crossesDateLine(_key))\n\n {\n\n GeoHeightFieldVector hfs;\n\n for (int child = 0; child < 4; ++child)\n\n {\n\n TileKey subCubeKey = _key.createChildKey(child);\n\n hfs.push_back(getGeoHeightField(_mapf, subCubeKey, resolution));\n\n }\n", "file_path": "ext/include/osgEarthDrivers/engine_seamless/Geographic.cpp", "rank": 53, "score": 261529.49229465926 }, { "content": "// A task request that rebuilds a tile's terrain technique in the background. It\n\n// re-compiles the geometry but does NOT apply the updates (since this constitutes\n\n// altering the scene graph and must therefore be done in the update traversal).\n\nstruct TileGenRequest : public TaskRequest\n\n{\n\n TileGenRequest( CustomTile* tile, const TileUpdate& update ) :\n\n _tile( tile ), _update(update) { }\n\n\n\n void operator()( ProgressCallback* progress )\n\n {\n\n if (_tile.valid())\n\n {\n\n CustomTerrainTechnique* tech = dynamic_cast<CustomTerrainTechnique*>( _tile->getTerrainTechnique() );\n\n if (tech)\n\n {\n\n tech->compile( _update, progress );\n\n }\n\n }\n\n\n\n //We don't need the tile anymore\n\n _tile = NULL;\n\n }\n\n\n", "file_path": "ext/include/osgEarthDrivers/engine_osgterrain/CustomTile.cpp", "rank": 54, "score": 258192.07331539821 }, { "content": "struct TileLayerRequest : public TaskRequest\n\n{\n\n TileLayerRequest( const TileKey& key, const MapFrame& mapf, OSGTileFactory* tileFactory )\n\n : _key( key ), \n\n _mapf(mapf, \"osgterrain.TileLayerRequest\"), \n\n _tileFactory(tileFactory), \n\n _numTries(0), \n\n _maxTries(3) { }\n\n\n\n TileKey _key;\n\n MapFrame _mapf;\n\n //osg::ref_ptr<Map> _map;\n\n osg::ref_ptr<OSGTileFactory> _tileFactory;\n\n\tunsigned int _numTries;\n\n\tunsigned int _maxTries;\n\n};\n\n\n", "file_path": "ext/include/osgEarthDrivers/engine_osgterrain/CustomTile.cpp", "rank": 55, "score": 258192.07331539821 }, { "content": "struct TileColorLayerRequest : public TileLayerRequest\n\n{\n\n TileColorLayerRequest( const TileKey& key, const MapFrame& mapf, OSGTileFactory* tileFactory, UID layerUID )\n\n : TileLayerRequest( key, mapf, tileFactory ), _layerUID(layerUID) { }\n\n\n\n void operator()( ProgressCallback* progress )\n\n {\n\n osg::ref_ptr<ImageLayer> imageLayer = _mapf.getImageLayerByUID( _layerUID );\n\n if ( imageLayer.valid() )\n\n {\n\n _result = _tileFactory->createImageLayer( _mapf.getMapInfo(), imageLayer.get(), _key, progress );\n\n\t\t\tif (!wasCanceled())\n\n\t\t\t{\n\n\t\t\t _numTries++;\n\n\t\t\t}\n\n }\n\n }\n\n UID _layerUID;\n\n};\n\n\n", "file_path": "ext/include/osgEarthDrivers/engine_osgterrain/CustomTile.cpp", "rank": 56, "score": 251839.40202428514 }, { "content": "struct TileElevationLayerRequest : public TileLayerRequest\n\n{\n\n TileElevationLayerRequest( const TileKey& key, const MapFrame& mapf, OSGTileFactory* tileFactory )\n\n : TileLayerRequest( key, mapf, tileFactory )\n\n {\n\n //nop\n\n }\n\n\n\n void operator()( ProgressCallback* progress )\n\n {\n\n _result = _tileFactory->createHeightFieldLayer( _mapf, _key, true ); //exactOnly=true\n\n\t\t_numTries++;\n\n }\n\n};\n\n\n", "file_path": "ext/include/osgEarthDrivers/engine_osgterrain/CustomTile.cpp", "rank": 57, "score": 251839.40202428514 }, { "content": "struct TileElevationPlaceholderLayerRequest : public TileLayerRequest\n\n{\n\n TileElevationPlaceholderLayerRequest( const TileKey& key, const MapFrame& mapf, OSGTileFactory* tileFactory, GeoLocator* keyLocator )\n\n : TileLayerRequest( key, mapf, tileFactory ),\n\n _parentKey( key.createParentKey() ),\n\n _keyLocator(keyLocator)\n\n {\n\n //nop\n\n }\n\n\n\n void setParentHF( osg::HeightField* parentHF )\n\n {\n\n _parentHF = parentHF; \n\n }\n\n\n\n void setNextLOD( int nextLOD )\n\n {\n\n _nextLOD = nextLOD;\n\n }\n\n\n", "file_path": "ext/include/osgEarthDrivers/engine_osgterrain/CustomTile.cpp", "rank": 58, "score": 248813.9474230356 }, { "content": "class ClampObjectLocatorCallback : public osgEarth::TerrainCallback\n\n{\n\npublic:\n\n ClampObjectLocatorCallback(ObjectLocatorNode* locator):\n\n _locator(locator),\n\n _maxLevel(-1),\n\n _minLevel(0)\n\n {\n\n }\n\n \n\n virtual void onTileAdded(const osgEarth::TileKey& tileKey, osg::Node* terrain, TerrainCallbackContext&)\n\n {\n\n if ((int)tileKey.getLevelOfDetail() > _minLevel && _maxLevel < (int)tileKey.getLevelOfDetail())\n\n {\n\n osg::Vec3d position = _locator->getLocator()->getPosition();\n\n \n\n if (tileKey.getExtent().contains(position.x(), position.y()))\n\n {\n\n //Compute our location in geocentric\n\n const osg::EllipsoidModel* ellipsoid = tileKey.getProfile()->getSRS()->getEllipsoid();\n", "file_path": "ext/include/applications/osgearth_viewer_android/jni/OsgMainApp.cpp", "rank": 59, "score": 240069.7630062178 }, { "content": "struct Entry\n\n{\n\n bool _isImage;\n\n std::string _name;\n\n osg::ref_ptr<CacheBin> _bin;\n\n};\n\n\n\n\n\nint\n\n purge( osg::ArgumentParser& args )\n\n{\n\n //return usage( \"Sorry, but purge is not yet implemented.\" );\n\n\n\n osg::ref_ptr<osg::Node> node = osgDB::readNodeFiles( args );\n\n if ( !node.valid() )\n\n return usage( \"Failed to read .earth file.\" );\n\n\n\n MapNode* mapNode = MapNode::findMapNode( node.get() );\n\n if ( !mapNode )\n\n return usage( \"Input file was not a .earth file\" );\n", "file_path": "ext/include/applications/osgearth_seed/osgearth_seed.cpp", "rank": 60, "score": 219139.35001653465 }, { "content": "class MyColorFilter : public osgEarth::ColorFilter\n\n{\n\npublic:\n\n // Create the color filter, supplying the shared layer that we plan\n\n // to access\n\n MyColorFilter(ImageLayer* maskLayer)\n\n {\n\n _maskLayer = maskLayer;\n\n }\n\n\n\n // This runs when the color filter is first installed.\n\n void install(osg::StateSet* stateSet) const\n\n {\n\n // When we added the shared layer, osgEarth reserves a special\n\n // image unit for it. Retrieve that now sine we need it in order\n\n // to use its sampler.\n\n int unit = _maskLayer->shareImageUnit().get();\n\n\n\n // Make a vertex shader that will access the texture coordinates\n\n // for our shared layer.\n", "file_path": "ext/include/applications/osgearth_sharedlayer/osgearth_sharedlayer.cpp", "rank": 61, "score": 217950.84098179662 }, { "content": "struct ClampDraggerCallback : public TerrainCallback\n\n{\n\n ClampDraggerCallback( Dragger* dragger ):\n\n_dragger( dragger )\n\n{\n\n}\n\n\n\nvoid onTileAdded( const TileKey& key, osg::Node* tile, TerrainCallbackContext& context )\n\n{ \n\n _dragger->reclamp( key, tile, context.getTerrain() );\n\n}\n\n\n\nDragger* _dragger;\n\n};\n\n\n\n/**********************************************************/\n\nDragger::Dragger( MapNode* mapNode, int modKeyMask, const DragMode& defaultMode ):\n\n_position( mapNode->getMapSRS(), 0,0,0, ALTMODE_RELATIVE),\n\n_dragging(false),\n\n_hovered(false),\n", "file_path": "ext/include/osgEarth/Draggers.cpp", "rank": 62, "score": 217815.26168754103 }, { "content": "struct NullStream : public std::ostream\n\n{\n\n NullStream():\n\n std::ostream(new NullStreamBuffer) {}\n\n \n\n virtual ~NullStream()\n\n {\n\n delete rdbuf();\n\n rdbuf(0);\n\n }\n\n};\n\n\n\nstd::ostream&\n\nosgEarth::notify(const osg::NotifySeverity severity)\n\n{\n\n // set up global notify null stream for inline notify\n\n static NullStream s_NotifyNulStream;\n\n\n\n static bool initialized = false;\n\n if (!initialized) \n", "file_path": "ext/include/osgEarth/Notify.cpp", "rank": 63, "score": 214179.66361791076 }, { "content": "class ClampObjectLocatorCallback : public osgEarth::TerrainCallback\n\n{\n\npublic:\n\n ClampObjectLocatorCallback(ObjectLocatorNode* locator):\n\n _locator(locator),\n\n _maxLevel(-1),\n\n _minLevel(0)\n\n {\n\n }\n\n\n\n virtual void onTileAdded(const osgEarth::TileKey& tileKey, osg::Node* terrain, TerrainCallbackContext&)\n\n { \n\n if ((int)tileKey.getLevelOfDetail() > _minLevel && _maxLevel < (int)tileKey.getLevelOfDetail())\n\n {\n\n osg::Vec3d position = _locator->getLocator()->getPosition();\n\n\n\n if (tileKey.getExtent().contains(position.x(), position.y()))\n\n {\n\n //Compute our location in geocentric\n\n const osg::EllipsoidModel* ellipsoid = tileKey.getProfile()->getSRS()->getEllipsoid();\n", "file_path": "ext/include/applications/osgearth_clamp/osgearth_clamp.cpp", "rank": 68, "score": 213374.13872960376 }, { "content": "// a slightly customized Cache class that will support asynchronous writes\n\nstruct AsyncCache : public Cache\n\n{\n\npublic:\n\n AsyncCache(const CacheOptions& options =CacheOptions()): Cache(options) { }\n\n virtual void setImageSync(\n\n const TileKey& key,\n\n const CacheSpec& spec,\n\n const osg::Image* image ) =0;\n\n};\n\n\n\n\n\n// --------------------------------------------------------------------------\n\n\n", "file_path": "ext/include/osgEarthDrivers/cache_sqlite3/Sqlite3Cache.cpp", "rank": 69, "score": 212414.223366825 }, { "content": "struct ViewController \n\n{\n\n virtual void addView() =0;\n\n};\n\n\n\n\n", "file_path": "ext/include/applications/osgearth_qt_windows/osgearth_qt_windows.cpp", "rank": 70, "score": 210990.32346644287 }, { "content": "struct AsyncInsert : public TaskRequest {\n\n AsyncInsert( const TileKey& key, const CacheSpec& spec, const osg::Image* image, AsyncCache* cache )\n\n : _cacheSpec(spec), _key(key), _image(image), _cache(cache) { }\n\n\n\n void operator()( ProgressCallback* progress ) {\n\n osg::ref_ptr<AsyncCache> cache = _cache.get();\n\n if ( cache.valid() )\n\n cache->setImageSync( _key, _cacheSpec, _image.get() );\n\n }\n\n\n\n CacheSpec _cacheSpec;\n\n TileKey _key;\n\n osg::ref_ptr<const osg::Image> _image;\n\n osg::observer_ptr<AsyncCache> _cache;\n\n};\n\n\n", "file_path": "ext/include/osgEarthDrivers/cache_sqlite3/Sqlite3Cache.cpp", "rank": 71, "score": 209850.65718550494 }, { "content": "struct AsyncPurge : public TaskRequest {\n\n AsyncPurge( const std::string& layerName, int olderThanUTC, Cache* cache )\n\n : _layerName(layerName), _olderThanUTC(olderThanUTC), _cache(cache) { }\n\n\n\n void operator()( ProgressCallback* progress ) { \n\n osg::ref_ptr<Cache> cache = _cache.get();\n\n if ( cache.valid() )\n\n cache->purge( _layerName, _olderThanUTC, false );\n\n }\n\n\n\n std::string _layerName;\n\n int _olderThanUTC;\n\n osg::observer_ptr<Cache> _cache;\n\n};\n\n\n", "file_path": "ext/include/osgEarthDrivers/cache_sqlite3/Sqlite3Cache.cpp", "rank": 72, "score": 209850.6571855049 }, { "content": "struct AggState : public osg::Referenced\n\n{\n\n AggState( osg::Image* image )\n\n : _rbuf( image->data(), image->s(), image->t(), image->s()*4 ),\n\n _ren( _rbuf )\n\n {\n\n _ras.gamma( 1.3 );\n\n _ras.filling_rule( agg::fill_even_odd );\n\n\n\n // pre-clear the buffer....\n\n _ren.clear(agg::rgba8(0,0,0,0));\n\n }\n\n\n\n agg::rendering_buffer _rbuf;\n\n agg::renderer<agg::span_abgr32> _ren;\n\n agg::rasterizer _ras;\n\n};\n\n\n\n// --------------------------------------------------------------------------\n\n\n", "file_path": "ext/include/osgEarthSymbology/GeometryRasterizer.cpp", "rank": 73, "score": 208584.491811987 }, { "content": "struct AsyncInsertPool : public TaskRequest {\n\n struct Entry {\n\n TileKey _key;\n\n osg::ref_ptr<osg::Image> _image;\n\n std::string _format;\n\n Entry() {}\n\n Entry(const TileKey& key, const std::string& format, osg::Image* img) : _key(key), _format(format), _image(img) {}\n\n };\n\n\n\n typedef std::map<std::string, Entry> PoolContainer;\n\n\n\n AsyncInsertPool(const std::string& layerName, Sqlite3Cache* cache );\n\n\n\n void addEntry( const TileKey& key, const std::string& format, osg::Image* image)\n\n {\n\n const std::string& keyStr = key.str();\n\n if (_pool.find(keyStr) != _pool.end())\n\n return;\n\n _pool[keyStr] = Entry(key, format, image);\n\n }\n", "file_path": "ext/include/osgEarthDrivers/cache_sqlite3/Sqlite3Cache.cpp", "rank": 74, "score": 207372.32195150052 }, { "content": "class JavascriptEngineV8Factory : public osgEarth::Features::ScriptEngineDriver\n\n{\n\npublic:\n\n JavascriptEngineV8Factory()\n\n {\n\n supportsExtension( \"osgearth_scriptengine_javascript\", \"osgEarth scriptengine javascript plugin\" );\n\n supportsExtension( \"osgearth_scriptengine_javascript_v8\", \"osgEarth scriptengine javascript V8 plugin\" );\n\n }\n\n\n\n virtual const char* className()\n\n {\n\n return \"osgEarth ScriptEngine Javascript V8 Plugin\";\n\n }\n\n\n\n virtual ReadResult readObject(const std::string& file_name, const osgDB::ReaderWriter::Options* options) const\n\n {\n\n if ( !acceptsExtension(osgDB::getLowerCaseFileExtension( file_name )) )\n\n return osgDB::ReaderWriter::ReadResult::FILE_NOT_HANDLED;\n\n\n\n return osgDB::ReaderWriter::ReadResult( new JavascriptEngineV8( getScriptEngineOptions(options) ) );\n\n }\n\n};\n\n\n\nREGISTER_OSGPLUGIN(osgearth_scriptengine_javascript, JavascriptEngineV8Factory)\n", "file_path": "ext/include/osgEarthDrivers/script_engine_v8/JavascriptEngineV8Factory.cpp", "rank": 75, "score": 206131.57686080923 }, { "content": "struct AsyncUpdateAccessTime : public TaskRequest\n\n{\n\n AsyncUpdateAccessTime( const TileKey& key, const std::string& cacheId, int timeStamp, Sqlite3Cache* cache );\n\n void operator()( ProgressCallback* progress );\n\n\n\n TileKey _key;\n\n std::string _cacheId;\n\n int _timeStamp;\n\n osg::observer_ptr<Sqlite3Cache> _cache;\n\n};\n\n\n\n\n\n\n", "file_path": "ext/include/osgEarthDrivers/cache_sqlite3/Sqlite3Cache.cpp", "rank": 76, "score": 204975.03665480824 }, { "content": "struct LayerTable : public osg::Referenced\n\n{\n\n LayerTable( const MetadataRecord& meta, sqlite3* db )\n\n : _meta(meta)\n\n { \n\n _tableName = \"layer_\" + _meta._layerName;\n\n // create the table and load the processors.\n\n if ( ! initialize( db ) )\n\n {\n\n return;\n\n }\n\n\n\n // initialize the SELECT statement for fetching records\n\n std::stringstream buf;\n\n#ifdef SPLIT_DB_FILE\n\n buf << \"SELECT created,accessed,size FROM \\\"\" << tableName << \"\\\" WHERE key = ?\";\n\n#else\n\n buf << \"SELECT created,accessed,data FROM \\\"\" << _tableName << \"\\\" WHERE key = ?\";\n\n#endif\n\n _selectSQL = buf.str();\n", "file_path": "ext/include/osgEarthDrivers/cache_sqlite3/Sqlite3Cache.cpp", "rank": 77, "score": 203367.6548873946 }, { "content": "struct ClusterVisitor : public osg::NodeVisitor\n\n{\n\n ClusterVisitor( const FeatureList& features, const InstanceSymbol* symbol, FeaturesToNodeFilter* f2n, FilterContext& cx )\n\n : _features ( features ),\n\n _symbol ( symbol ),\n\n _f2n ( f2n ),\n\n _cx ( cx ),\n\n osg::NodeVisitor( osg::NodeVisitor::TRAVERSE_ALL_CHILDREN )\n\n {\n\n _modelSymbol = dynamic_cast<const ModelSymbol*>( symbol );\n\n if ( _modelSymbol )\n\n _headingExpr = *_modelSymbol->heading();\n\n\n\n _scaleExpr = *_symbol->scale();\n\n\n\n _makeECEF = _cx.getSession()->getMapInfo().isGeocentric();\n\n _srs = _cx.profile()->getSRS();\n\n _targetSRS = _cx.getSession()->getMapInfo().getSRS();\n\n }\n\n\n", "file_path": "ext/include/osgEarthFeatures/SubstituteModelFilter.cpp", "rank": 78, "score": 203367.65488739463 }, { "content": "class JavaScriptCoreEngineFactory : public osgEarth::Features::ScriptEngineDriver\n\n{\n\npublic:\n\n JavaScriptCoreEngineFactory()\n\n {\n\n supportsExtension( \"osgearth_scriptengine_javascript\", \"osgEarth scriptengine javascript plugin\" );\n\n supportsExtension( \"osgearth_scriptengine_javascript_javascriptcore\", \"osgEarth scriptengine javascript JavaScriptCore plugin\" );\n\n }\n\n\n\n virtual const char* className()\n\n {\n\n return \"osgEarth ScriptEngine Javascript JavaScriptCore Plugin\";\n\n }\n\n\n\n virtual ReadResult readObject(const std::string& file_name, const osgDB::ReaderWriter::Options* options) const\n\n {\n\n if ( !acceptsExtension(osgDB::getLowerCaseFileExtension( file_name )) )\n\n return osgDB::ReaderWriter::ReadResult::FILE_NOT_HANDLED;\n\n\n\n return osgDB::ReaderWriter::ReadResult( new JavaScriptCoreEngine( getScriptEngineOptions(options) ) );\n\n }\n\n};\n\n\n\nREGISTER_OSGPLUGIN(osgearth_scriptengine_javascriptcore, JavaScriptCoreEngineFactory)\n", "file_path": "ext/include/osgEarthDrivers/script_engine_javascriptcore/JavaScriptCoreEngineFactory.cpp", "rank": 79, "score": 202879.43491602 }, { "content": "struct AsyncUpdateAccessTimePool : public TaskRequest\n\n{\n\n AsyncUpdateAccessTimePool( const std::string& cacheId, Sqlite3Cache* cache );\n\n void addEntry(const TileKey& key, int timeStamp);\n\n void addEntryInternal(const TileKey& key);\n\n\n\n void operator()( ProgressCallback* progress );\n\n const std::string& getCacheId() { return _cacheId; }\n\n int getNbEntry() const { return _keys.size(); }\n\n std::map<std::string, int> _keys;\n\n std::string _cacheId;\n\n std::string _keyStr;\n\n int _timeStamp;\n\n osg::observer_ptr<Sqlite3Cache> _cache;\n\n};\n\n\n\n\n\n\n\n// --------------------------------------------------------------------------\n\n\n", "file_path": "ext/include/osgEarthDrivers/cache_sqlite3/Sqlite3Cache.cpp", "rank": 80, "score": 202654.88935204313 }, { "content": "class ExportProgressCallback : public osgEarth::ProgressCallback\n\n{\n\npublic:\n\n ExportProgressCallback(QMainWindow* parent, QProgressDialog* dialog);\n\n\n\n virtual ~ExportProgressCallback();\n\n\n\n bool reportProgress(double current, double total, unsigned currentStage, unsigned totalStages, const std::string& msg);\n\n\n\n void setStatus(const std::string& status);\n\n\n\n void complete();\n\n\n\nprivate:\n\n QMainWindow* _parent;\n\n QProgressDialog* _dialog; \n\n std::string _status;\n\n};\n\n\n\n#endif", "file_path": "ext/include/applications/osgearth_package_qt/ExportProgress.h", "rank": 81, "score": 200845.60904693446 }, { "content": "struct ShareResult\n\n{\n\n ShareResult()\n\n : numEdges(0)\n\n {\n\n for (int i = 0; i < 2; ++i)\n\n tile1[i] = tile2[i] = -1;\n\n }\n\n int numEdges;\n\n int tile1[2];\n\n int tile2[2];\n\n};\n\n\n\n// tile2 is at a higher LOD than tile1\n\nShareResult tilesShareEdges(const KeyIndex& tile1, const KeyIndex& tile2)\n\n{\n\n ShareResult result;\n\n int lodDiff = tile2.lod - tile1.lod;\n\n int x = tile1.x << lodDiff;\n\n int xleft = (tile1.x + 1) << lodDiff;\n", "file_path": "ext/include/osgEarthDrivers/engine_seamless/Geographic.cpp", "rank": 82, "score": 199339.21893105216 }, { "content": "struct GridEdge\n\n{\n\n unsigned v[2][2];\n\n unsigned lod;\n\n};\n\n\n", "file_path": "ext/include/osgEarthDrivers/engine_seamless/Geographic.cpp", "rank": 83, "score": 199339.21893105216 }, { "content": "struct KeyIndex\n\n{\n\n KeyIndex() : lod(0), x(0), y(0) {}\n\n KeyIndex(unsigned lod_, unsigned x_, unsigned y_)\n\n : lod(lod_), x(x_), y(y_)\n\n {\n\n }\n\n KeyIndex(const TileKey& key)\n\n : lod(key.getLevelOfDetail()), x(key.getTileX()), y(key.getTileY())\n\n {\n\n }\n\n bool operator==(const KeyIndex& rhs) const\n\n {\n\n return lod == rhs.lod && x == rhs.x && y == rhs.y;\n\n }\n\n unsigned lod;\n\n unsigned x;\n\n unsigned y;\n\n};\n\n\n", "file_path": "ext/include/osgEarthDrivers/engine_seamless/Geographic.cpp", "rank": 84, "score": 199339.21893105216 }, { "content": "class DefaultValueAllocator : public ValueAllocator\n\n{\n\npublic:\n\n virtual ~DefaultValueAllocator()\n\n {\n\n }\n\n\n\n virtual char *makeMemberName( const char *memberName )\n\n {\n\n return duplicateStringValue( memberName );\n\n }\n\n\n\n virtual void releaseMemberName( char *memberName )\n\n {\n\n releaseStringValue( memberName );\n\n }\n\n\n\n virtual char *duplicateStringValue( const char *value, \n\n unsigned int length = unknown )\n\n {\n", "file_path": "ext/include/osgEarth/JsonUtils.cpp", "rank": 85, "score": 199017.80727884328 }, { "content": "struct OverlayCallback : public ImageOverlay::ImageOverlayCallback\n\n{\n\n OverlayCallback(ImageOverlayEditor *editor)\n\n : _editor(editor)\n\n {\n\n }\n\n\n\n virtual void onOverlayChanged()\n\n {\n\n _editor->updateDraggers();\n\n }\n\n\n\n ImageOverlayEditor* _editor; \n\n};\n\n\n\n/***************************************************************************/\n\n\n\n\n\n\n\n\n", "file_path": "ext/include/osgEarthAnnotation/ImageOverlayEditor.cpp", "rank": 86, "score": 198492.03435669793 }, { "content": "struct DeclutterDraw : public osgUtil::RenderBin::DrawCallback\n\n{\n\n DeclutterContext* _context;\n\n Threading::PerThread< osg::ref_ptr<osg::RefMatrix> > _ortho2D;\n\n osg::ref_ptr<osg::Uniform> _fade;\n\n\n\n /**\n\n * Constructs the decluttering draw callback.\n\n * @param context A shared context among all decluttering objects.\n\n */\n\n DeclutterDraw( DeclutterContext* context )\n\n : _context( context )\n\n {\n\n // create the fade uniform.\n\n _fade = new osg::Uniform( osg::Uniform::FLOAT, FADE_UNIFORM_NAME );\n\n _fade->set( 1.0f );\n\n }\n\n\n\n /**\n\n * Draws a bin. Most of this code is copied from osgUtil::RenderBin::drawImplementation.\n", "file_path": "ext/include/osgEarth/Decluttering.cpp", "rank": 87, "score": 198134.64122666547 }, { "content": "struct AssembleTile\n\n{\n\n void init(const TileKey& key, const MapInfo& mapInfo, const OSGTerrainOptions& opt, TileBuilder::SourceRepo& repo, const MaskLayerVector& masks=MaskLayerVector() )\n\n {\n\n _key = key;\n\n _mapInfo = &mapInfo;\n\n _opt = &opt;\n\n _repo = &repo;\n\n _tile = 0L;\n\n _masks.clear();\n\n std::copy( masks.begin(), masks.end(), std::back_inserter(_masks) );\n\n }\n\n\n\n void execute()\n\n {\n\n _tile = new Tile( _key, GeoLocator::createForKey(_key, *_mapInfo), *_opt->quickReleaseGLObjects() );\n\n _tile->setVerticalScale( *_opt->verticalScale() );\n\n\n\n //_tile->setRequiresNormals( true );\n\n _tile->setDataVariance( osg::Object::DYNAMIC );\n", "file_path": "ext/include/osgEarthDrivers/engine_osgterrain/TileBuilder.cpp", "rank": 88, "score": 196503.6114463489 }, { "content": "struct ReaderWriterKML : public osgDB::ReaderWriter\n\n{\n\n ReaderWriterKML()\n\n {\n\n supportsExtension( \"kml\", \"KML\" );\n\n\n\n#ifdef SUPPORT_KMZ\n\n supportsExtension( \"kmz\", \"KMZ\" );\n\n#endif // SUPPORT_KMZ\n\n }\n\n\n\n osgDB::ReaderWriter::ReadResult readObject(const std::string& url, const osgDB::Options* options) const\n\n {\n\n return readNode( url, options );\n\n }\n\n\n\n osgDB::ReaderWriter::ReadResult readObject(std::istream& in, const osgDB::Options* dbOptions ) const\n\n {\n\n return readNode(in, dbOptions);\n\n }\n", "file_path": "ext/include/osgEarthDrivers/kml/ReaderWriterKML.cpp", "rank": 89, "score": 196171.88705393282 }, { "content": "struct OSGEarthShaderGenPseudoLoader : public osgDB::ReaderWriter\n\n{\n\n OSGEarthShaderGenPseudoLoader()\n\n {\n\n this->supportsExtension( SHADERGEN_PL_EXTENSION, \"ShaderGen pseudoloader\" );\n\n }\n\n\n\n const char* className()\n\n {\n\n return \"OSGEarth ShaderGen pseudoloader\";\n\n }\n\n\n\n bool acceptsExtension(const std::string& extension) const\n\n {\n\n return osgDB::equalCaseInsensitive( extension, SHADERGEN_PL_EXTENSION );\n\n }\n\n\n\n ReadResult readObject(const std::string& filename, const osgDB::Options* options) const\n\n {\n\n return readNode( filename, options );\n", "file_path": "ext/include/osgEarth/ShaderGenerator.cpp", "rank": 90, "score": 196171.88705393282 }, { "content": "class CustomTileSource : public TileSource\n\n{\n\npublic:\n\n // Constructor that takes the user-provided options.\n\n CustomTileSource( const TileSourceOptions& options =TileSourceOptions() ) : TileSource(options)\n\n {\n\n _geom = new Ring();\n\n _geom->push_back( osg::Vec3(5, 5, 0) );\n\n _geom->push_back( osg::Vec3(250, 5, 0) );\n\n _geom->push_back( osg::Vec3(250, 250, 0) );\n\n _geom->push_back( osg::Vec3(5, 250, 0) );\n\n }\n\n\n\n // Called by the terrain engine when a layer using this driver is first added.\n\n Status initialize(const osgDB::Options* dbOptions)\n\n {\n\n if ( !getProfile() )\n\n {\n\n setProfile( Registry::instance()->getGlobalGeodeticProfile() );\n\n }\n", "file_path": "ext/include/applications/osgearth_tilesource/osgearth_tilesource.cpp", "rank": 91, "score": 196042.46328085216 }, { "content": "class ChangeAttributeFilter : public FeatureFilter\n\n{\n\npublic:\n\n ChangeAttributeFilter(const Config& conf)\n\n {\n\n if (conf.key() == \"change_attribute\")\n\n {\n\n conf.getIfSet(\"key\", _key);\n\n conf.getIfSet(\"value\", _value);\n\n }\n\n }\n\n\n\n virtual Config getConfig() const\n\n {\n\n Config config(\"change_attribute\");\n\n config.addIfSet(\"key\", _key);\n\n config.addIfSet(\"value\", _value);\n\n return config;\n\n }\n\n\n", "file_path": "ext/include/applications/osgearth_featurefilter/osgearth_featurefilter.cpp", "rank": 92, "score": 196042.46328085216 }, { "content": "struct BuildElevLayer\n\n{\n\n void init(const TileKey& key, const MapFrame& mapf, const OSGTerrainOptions& opt, TileBuilder::SourceRepo& repo)\n\n {\n\n _key = key;\n\n _mapf = &mapf;\n\n _opt = &opt;\n\n _repo = &repo;\n\n }\n\n\n\n void execute()\n\n {\n\n const MapInfo& mapInfo = _mapf->getMapInfo();\n\n\n\n // Request a heightfield from the map, falling back on lower resolution tiles\n\n // if necessary (fallback=true)\n\n osg::ref_ptr<osg::HeightField> hf;\n\n bool isFallback = false;\n\n\n\n if ( _mapf->getHeightField( _key, true, hf, &isFallback ) )\n", "file_path": "ext/include/osgEarthDrivers/engine_osgterrain/TileBuilder.cpp", "rank": 93, "score": 193767.22781985425 }, { "content": "struct BuildColorLayer\n\n{\n\n void init( const TileKey& key, ImageLayer* layer, const MapInfo& mapInfo,\n\n const OSGTerrainOptions& opt, TileBuilder::SourceRepo& repo )\n\n {\n\n _key = key;\n\n _layer = layer;\n\n _mapInfo = &mapInfo;\n\n _opt = &opt;\n\n _repo = &repo;\n\n }\n\n\n\n void execute()\n\n {\n\n GeoImage geoImage;\n\n bool isFallbackData = false;\n\n\n\n bool useMercatorFastPath =\n\n _opt->enableMercatorFastPath() != false &&\n\n _mapInfo->isGeocentric() &&\n", "file_path": "ext/include/osgEarthDrivers/engine_osgterrain/TileBuilder.cpp", "rank": 94, "score": 193767.22781985425 }, { "content": "// Work around for an interface change in osgDB::DatabasePager\n\nstruct NodePathProxy\n\n{\n\n NodePathProxy(Group* group_, NodeVisitor& nv_)\n\n : group(group_), nv(nv_)\n\n {\n\n }\n\n operator Group* () { return group; }\n\n operator NodePath& () { return nv.getNodePath(); }\n\n Group* group;\n\n NodeVisitor& nv;\n\n};\n\n\n\nvoid PatchGroup::getPatchExtents(Vec2d& lowerLeft, Vec2d& upperRight) const\n\n{\n\n const PatchOptions* poptions = getOptions();\n\n if (!poptions)\n\n {\n\n lowerLeft = Vec2d(0.0, 0.0);\n\n upperRight = Vec2d(1.0, 1.0);\n\n }\n", "file_path": "ext/include/osgEarthDrivers/engine_seamless/PatchGroup.cpp", "rank": 95, "score": 193767.22781985425 }, { "content": "class TerrainProfileGraph : public osg::Group\n\n{\n\npublic:\n\n /*\n\n * Callback that is fired when the TerrainProfile changes\n\n */\n\n struct GraphChangedCallback : public TerrainProfileCalculator::ChangedCallback\n\n {\n\n GraphChangedCallback( TerrainProfileGraph* graph):\n\n _graph( graph )\n\n {\n\n }\n\n\n\n virtual void onChanged(const TerrainProfileCalculator* sender )\n\n {\n\n _graph->setTerrainProfile( sender->getProfile() );\n\n }\n\n\n\n TerrainProfileGraph* _graph;\n\n };\n", "file_path": "ext/include/applications/osgearth_terrainprofile/osgearth_terrainprofile.cpp", "rank": 96, "score": 192816.10169934618 }, { "content": "struct osgEarthFeatureModelPseudoLoader : public osgDB::ReaderWriter\n\n{\n\n osgEarthFeatureModelPseudoLoader()\n\n {\n\n supportsExtension( \"osgearth_pseudo_fmg\", \"Feature model pseudo-loader\" );\n\n }\n\n\n\n const char* className()\n\n { // override\n\n return \"osgEarth Feature Model Pseudo-Loader\";\n\n }\n\n\n\n ReadResult readNode(const std::string& uri, const Options* options) const\n\n {\n\n if ( !acceptsExtension( osgDB::getLowerCaseFileExtension(uri) ) )\n\n return ReadResult::FILE_NOT_HANDLED;\n\n\n\n UID uid;\n\n unsigned lod, x, y;\n\n sscanf( uri.c_str(), \"%u.%d_%d_%d.%*s\", &uid, &lod, &x, &y );\n", "file_path": "ext/include/osgEarthFeatures/FeatureModelGraph.cpp", "rank": 97, "score": 191748.57817096994 }, { "content": "#define STRING_READER_WRITER_SHIM(SUFFIX, EXTENSION, DEF) \\\n\nstruct osgEarthStringReaderWriter##SUFFIX : public osgDB::ReaderWriter \\\n\n{ \\\n\n osgEarthStringReaderWriter##SUFFIX () { \\\n\n supportsExtension( EXTENSION, DEF ); \\\n\n } \\\n\n osgDB::ReaderWriter::ReadResult readObject(const std::string& uri, const osgDB::Options* dbOptions) const { \\\n\n std::string ext = osgDB::getLowerCaseFileExtension( uri ); \\\n\n if ( !acceptsExtension(ext) ) return osgDB::ReaderWriter::ReadResult::FILE_NOT_HANDLED; \\\n\n osgEarth::ReadResult r = URI( uri ).readString( dbOptions ); \\\n\n if ( r.succeeded() ) return r.release<StringObject>(); \\\n\n return osgDB::ReaderWriter::ReadResult::ERROR_IN_READING_FILE; \\\n\n } \\\n\n osgDB::ReaderWriter::ReadResult readObject(std::istream& in, const osgDB::Options* dbOptions ) const { \\\n\n URIContext uriContext( dbOptions ); \\\n\n return new StringObject( Stringify() << in.rdbuf() ); \\\n\n } \\\n\n osgDB::ReaderWriter::WriteResult writeObject( const osg::Object& obj, const std::string& location, const osgDB::Options* dbOptions ) const { \\\n\n std::string ext = osgDB::getLowerCaseFileExtension(location); \\\n\n if ( !acceptsExtension(ext) ) return osgDB::ReaderWriter::WriteResult::FILE_NOT_HANDLED; \\\n\n const StringObject* so = dynamic_cast<const StringObject*>(&obj); \\\n", "file_path": "ext/include/osgEarth/IOTypes.cpp", "rank": 98, "score": 190945.49609430335 }, { "content": " class TMSExporterWorkerThread : public osg::Referenced, public OpenThreads::Thread\n\n {\n\n public:\n\n TMSExporterWorkerThread(TMSExporter* exporter, osgEarth::MapNode* mapNode, const std::string& earthFilePath, const std::string& path, std::vector< osgEarth::Bounds >& bounds, const std::string& outEarth=\"\", bool overwrite=false, const std::string& extension=\"\")\n\n : OpenThreads::Thread(), _exporter(exporter), _mapNode(mapNode), _earthFilePath(earthFilePath), _path(path), _bounds(bounds), _outEarth(outEarth), _overwrite(overwrite), _extension(extension)\n\n { }\n\n\n\n void run()\n\n {\n\n if (_exporter)\n\n {\n\n _exporter->exportTMS(_mapNode, _earthFilePath, _path, _bounds, _outEarth, _overwrite, _extension); \n\n }\n\n }\n\n\n\n private:\n\n TMSExporter* _exporter;\n\n osg::ref_ptr<osgEarth::MapNode> _mapNode;\n\n std::string _path;\n\n std::vector< osgEarth::Bounds > _bounds;\n\n std::string _outEarth;\n\n bool _overwrite;\n\n std::string _extension;\n\n std::string _earthFilePath;\n\n };\n\n}\n\n\n\n#endif //TILER_TOOL_TMSEXPORTER_H\n\n\n", "file_path": "ext/include/applications/osgearth_package_qt/TMSExporter.h", "rank": 99, "score": 186764.36732867212 } ]
C++
include/nifty/graph/opt/common/visitor_base.hxx
konopczynski/nifty
dc02ac60febaabfaf9b2ee5a854bb61436ebdc97
#pragma once #include <cstddef> #include <string> #include <initializer_list> #include <sstream> #include <iostream> #include <chrono> #include "nifty/tools/timer.hxx" #include "nifty/tools/logging.hxx" namespace nifty { namespace graph { namespace opt{ namespace common{ template<class SOLVER> class VisitorBase{ public: typedef SOLVER SolverType; virtual void begin(SolverType * solver) = 0; virtual bool visit(SolverType * solver) = 0; virtual void end(SolverType * solver) = 0; virtual void clearLogNames(){ } virtual void addLogNames(std::initializer_list<std::string> logNames){ } virtual void setLogValue(const std::size_t logIndex, double logValue){ } virtual void printLog(const nifty::logging::LogLevel logLevel, const std::string & logString){ } }; template<class SOLVER> class VerboseVisitor : public VisitorBase<SOLVER>{ public: typedef SOLVER SolverType; typedef nifty::tools::Timer TimerType; VerboseVisitor( const int printNth = 1, const double timeLimitSolver = std::numeric_limits<double>::infinity(), const double timeLimitTotal = std::numeric_limits<double>::infinity(), const nifty::logging::LogLevel logLevel = nifty::logging::LogLevel::WARN ) : printNth_(printNth), runOpt_(true), iter_(1), timeLimitSolver_(timeLimitSolver), timeLimitTotal_(timeLimitTotal), runtimeSolver_(0.0), runtimeTotal_(0.0), logLevel_(logLevel) {} virtual void begin(SolverType * ) { timerSolver_.start(); timerTotal_.start(); } virtual bool visit(SolverType * solver) { timerSolver_.stop(); timerTotal_.stop(); runtimeTotal_ += timerTotal_.elapsedSeconds(); timerTotal_.reset().start(); runtimeSolver_ += timerSolver_.elapsedSeconds(); if(iter_%printNth_ == 0){ std::stringstream ss; ss << "E: " << solver->currentBestEnergy() << " "; ss << "t[s]: " << runtimeSolver_ << " "; ss << "/ " << runtimeTotal_ << " "; for(std::size_t i=0; i<logNames_.size(); ++i){ ss<<logNames_[i]<<" "<<logValues_[i]<<" "; } ss<<"\n"; std::cout<<ss.str(); } checkRuntime(); ++iter_; timerSolver_.reset().start(); return runOpt_; } virtual void end(SolverType * ) { timerSolver_.stop(); } virtual void clearLogNames(){ logNames_.clear(); logValues_.clear(); } virtual void addLogNames(std::initializer_list<std::string> logNames){ logNames_.assign(logNames.begin(), logNames.end()); logValues_.resize(logNames.size()); } virtual void setLogValue(const std::size_t logIndex, double logValue){ logValues_[logIndex] = logValue; } virtual void printLog(const nifty::logging::LogLevel logLevel, const std::string & logString){ if(int(logLevel) <= int(logLevel_)){ std::cout<<"LOG["<<nifty::logging::logLevelName(logLevel)<<"]: "<<logString<<"\n";\ } } void stopOptimize(){ runOpt_ = false; } double runtimeSolver() const{ return runtimeSolver_; } double runtimeTotal() const{ return runtimeTotal_; } double timeLimitTotal() const{ return timeLimitTotal_; } double timeLimitSolver() const{ return timeLimitSolver_; } private: bool runOpt_; int printNth_; int iter_; double timeLimitTotal_; double timeLimitSolver_; double runtimeSolver_; double runtimeTotal_; nifty::logging::LogLevel logLevel_; TimerType timerSolver_; TimerType timerTotal_; std::vector<std::string> logNames_; std::vector<double> logValues_; inline void checkRuntime() { if(runtimeSolver_ > timeLimitSolver_) { std::cout << runtimeSolver_ << " " << timeLimitSolver_ << std::endl; std::cout << "Inference has exceeded solver time limit and is stopped \n"; runOpt_ = false; } if(runtimeTotal_ > timeLimitTotal_) { std::cout << runtimeTotal_ << " " << timeLimitTotal_ << std::endl; std::cout << "Inference has exceeded total time limit and is stopped \n"; runOpt_ = false; } } }; template<class SOLVER> class EmptyVisitor : public VisitorBase<SOLVER>{ public: typedef SOLVER SolverType; virtual void begin(SolverType * solver) {} virtual bool visit(SolverType * solver) {return true;} virtual void end(SolverType * solver) {} private: }; template<class SOLVER> class VisitorProxy{ public: typedef SOLVER SolverType; typedef VisitorBase<SOLVER> VisitorBaseTpe; VisitorProxy(VisitorBaseTpe * visitor) : visitor_(visitor){ } void addLogNames(std::initializer_list<std::string> logNames){ if(visitor_ != nullptr){ visitor_->addLogNames(logNames); } } void begin(SolverType * solver) { if(visitor_ != nullptr){ visitor_->begin(solver); } } bool visit(SolverType * solver) { if(visitor_ != nullptr){ return visitor_->visit(solver); } return true; } void end(SolverType * solver) { if(visitor_ != nullptr){ visitor_->end(solver); } } void clearLogNames() { if(visitor_ != nullptr){ visitor_->clearLogNames(); } } void setLogValue(const std::size_t logIndex, const double logValue) { if(visitor_ != nullptr){ visitor_->setLogValue(logIndex, logValue); } } void printLog(const nifty::logging::LogLevel logLevel, const std::string & logString){ if(visitor_ != nullptr){ visitor_->printLog(logLevel, logString); } } operator bool() const{ return visitor_ != nullptr; } private: VisitorBaseTpe * visitor_; }; } } } }
#pragma once #include <cstddef> #include <string> #include <initializer_list> #include <sstream> #include <iostream> #include <chrono> #include "nifty/tools/timer.hxx" #include "nifty/tools/logging.hxx" namespace nifty { namespace graph { namespace opt{ namespace common{ template<class SOLVER> class VisitorBase{ public: typedef SOLVER SolverType; virtual void begin(SolverType * solver) = 0; virtual bool visit(SolverType * solver) = 0; virtual void end(SolverType * solver) = 0; virtual void clearLogNames(){ } virtual void addLogNames(std::initializer_list<std::string> logNames){ } virtual void setLogValue(const std::size_t logIndex, double logValue){ } virtual void printLog(const nifty::logging::LogLevel logLevel, const std::string & logString){ } }; template<class SOLVER> class VerboseVisitor : public VisitorBase<SOLVER>{ public: typedef SOLVER SolverType; typedef nifty::tools::Timer TimerType; VerboseVisitor( const int printNth = 1, const double timeLimitSolver = std::numeric_limits<double>::infinity(), const double timeLimitTotal = std::numeric_limits<double>::infinity(), const nifty::logging::LogLevel logLevel = nifty::logging::LogLevel::WARN ) : printNth_(printNth), runOpt_(true), iter_(1), timeLimitSolver_(timeLimitSolver), timeLimitTotal_(timeLimitTotal), runtimeSolver_(0.0), runtimeTotal_(0.0), logLevel_(logLevel) {} virtual void begin(SolverType * ) { timerSolver_.start(); timerTotal_.start(); } virtual bool visit(SolverType * solver) { timerSolver_.stop(); timerTotal_.stop(); runtimeTotal_ += timerTotal_.elapsedSeconds(); timerTotal_.reset().start(); runtimeSolver_ += timerSolver_.elapsedSeconds(); if(iter_%printNth_ == 0){ std::stringstream ss; ss << "E: " << solver->currentBestEnergy() << " "; ss << "t[s]: " << runtimeSolver_ << " "; ss << "/ " << runtimeTotal_ << " "; for(std::size_t i=0; i<logNames_.size(); ++i){ ss<<logNames_[i]<<" "<<logValues_[i]<<" "; } ss<<"\n"; std::cout<<ss.str(); } checkRuntime(); ++iter_; timerSolver_.reset().start(); return runOpt_; } virtual void end(SolverType * ) { timerSolver_.stop(); } virtual void clearLogNames(){ logNames_.clear(); logValues_.clear(); } virtual void addLogNames(std::initializer_list<std::string> logNames){ logNames_.assign(logNames.begin(), logNames.end()); logValues_.resize(logNames.size()); } virtual void setLogValue(const std::size_t logIndex, double logValue){ logValues_[logIndex] = logValue; } virtual void printLog(const nifty::logging::LogLevel logLevel, const std::string & logString){ if(int(logLevel) <= int(logLevel_)){ std::cout<<"LOG["<<nifty::logging::logLevelName(logLevel)<<"]: "<<logString<<"\n";\ } } void stopOptimize(){ runOpt_ = false; } double runtimeSolver() const{ return runtimeSolver_; } double runtimeTotal() const{ return runtimeTotal_; } double timeLimitTotal() const{ return timeLimitTotal_; } double timeLimitSolver() const{ return timeLimitSolver_; } private: bool runOpt_; int printNth_; int iter_; double timeLimitTotal_; double timeLimitSolver_; double runtimeSolver_; double runtimeTotal_; nifty::logging::LogLevel logLevel_; TimerType timerSolver_; TimerType timerTotal_; std::vector<std::string> logNames_; std::vector<double> logValues_; inline void checkRuntime() { if(runtimeSolver_ > timeLimitSolver_) { std::cout << runtimeSolver_ << " " << timeLimitSolver_ << std::endl; std::cout << "Inference has exceeded solver time limit and is stopped \n"; runOpt_ = false; } if(runtimeTotal_ > timeLimitTotal_) { std::cout << runtimeTotal_ << " " << timeLimitTotal_ << std::endl; std::cout << "Inference has exceeded total time limit and is stopped \n"; runOpt_ = false; } } }; template<class SOLVER> class EmptyVisitor : public VisitorBase<SOLVER>{ public: typedef SOLVER SolverType; virtual void begin(SolverType * solver) {} virtual bool visit(SolverType * solver) {return true;} virtual void end(SolverType * solver) {} private: }; template<class SOLVER> class VisitorProxy{ public: typedef SOLVER SolverType; typedef VisitorBase<SOLVER> VisitorBaseTpe; VisitorProxy(VisitorBaseTpe * visitor) : visitor_(visitor){ } void addLogNames(std::initializer_list<std::string> logNames){ if(visitor_ != nullptr){ visitor_->addLogNames(logNames); } } void begin(SolverType * solver) { if(visitor_ != nullptr){ visitor_->begin(solver); } } boo
} void end(SolverType * solver) { if(visitor_ != nullptr){ visitor_->end(solver); } } void clearLogNames() { if(visitor_ != nullptr){ visitor_->clearLogNames(); } } void setLogValue(const std::size_t logIndex, const double logValue) { if(visitor_ != nullptr){ visitor_->setLogValue(logIndex, logValue); } } void printLog(const nifty::logging::LogLevel logLevel, const std::string & logString){ if(visitor_ != nullptr){ visitor_->printLog(logLevel, logString); } } operator bool() const{ return visitor_ != nullptr; } private: VisitorBaseTpe * visitor_; }; } } } }
l visit(SolverType * solver) { if(visitor_ != nullptr){ return visitor_->visit(solver); } return true;
function_block-random_span
[ { "content": " def verboseVisitor(visitNth=1, timeLimitSolver=float('inf'),\n\n timeLimitTotal=float('inf'), logLevel=LogLevel.WARN):\n\n V = getMcCls(\"VerboseVisitor\")\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 0, "score": 162021.96539640854 }, { "content": " def verboseVisitor(visitNth=1,\n\n timeLimitSolver=float('inf'),\n\n timeLimitTotal=float('inf')):\n\n V = getLmcCls(\"LiftedMulticutVerboseVisitor\")\n", "file_path": "src/python/module/nifty/graph/opt/lifted_multicut/__init__.py", "rank": 1, "score": 160013.2442360823 }, { "content": "\t/// Half-precision floating point type.\n\n\t/// This class implements an IEEE-conformant half-precision floating point type with the usual arithmetic operators and \n\n\t/// conversions. It is implicitly convertible to single-precision floating point, which makes artihmetic expressions and \n\n\t/// functions with mixed-type operands to be of the most precise operand type. Additionally all arithmetic operations \n\n\t/// (and many mathematical functions) are carried out in single-precision internally. All conversions from single- to \n\n\t/// half-precision are done using the library's default rounding mode, but temporary results inside chained arithmetic \n\n\t/// expressions are kept in single-precision as long as possible (while of course still maintaining a strong half-precision type).\n\n\t///\n\n\t/// According to the C++98/03 definition, the half type is not a POD type. But according to C++11's less strict and \n\n\t/// extended definitions it is both a standard layout type and a trivially copyable type (even if not a POD type), which \n\n\t/// means it can be standard-conformantly copied using raw binary copies. But in this context some more words about the \n\n\t/// actual size of the type. Although the half is representing an IEEE 16-bit type, it does not neccessarily have to be of \n\n\t/// exactly 16-bits size. But on any reasonable implementation the actual binary representation of this type will most \n\n\t/// probably not ivolve any additional \"magic\" or padding beyond the simple binary representation of the underlying 16-bit \n\n\t/// IEEE number, even if not strictly guaranteed by the standard. But even then it only has an actual size of 16 bits if \n\n\t/// your C++ implementation supports an unsigned integer type of exactly 16 bits width. But this should be the case on \n\n\t/// nearly any reasonable platform.\n\n\t///\n\n\t/// So if your C++ implementation is not totally exotic or imposes special alignment requirements, it is a reasonable \n\n\t/// assumption that the data of a half is just comprised of the 2 bytes of the underlying IEEE representation.\n\n\tclass half\n\n\t{\n\n\t\tfriend struct detail::functions;\n\n\t\tfriend struct detail::unary_specialized<half>;\n\n\t\tfriend struct detail::binary_specialized<half,half>;\n\n\t\ttemplate<typename,typename,std::float_round_style> friend struct detail::half_caster;\n\n\t\tfriend class std::numeric_limits<half>;\n\n\t#if HALF_ENABLE_CPP11_HASH\n\n\t\tfriend struct std::hash<half>;\n\n\t#endif\n\n\t#if HALF_ENABLE_CPP11_USER_LITERALS\n\n\t\tfriend half literal::operator\"\"_h(long double);\n\n\t#endif\n\n\n\n\tpublic:\n\n\t\t/// Default constructor.\n\n\t\t/// This initializes the half to 0. Although this does not match the builtin types' default-initialization semantics \n\n\t\t/// and may be less efficient than no initialization, it is needed to provide proper value-initialization semantics.\n\n\t\tHALF_CONSTEXPR half() HALF_NOEXCEPT : data_() {}\n\n\n", "file_path": "include/nifty/external/half.hpp", "rank": 2, "score": 133515.12127600485 }, { "content": "\tclass half;\n\n\n\n#if HALF_ENABLE_CPP11_USER_LITERALS\n\n\t/// Library-defined half-precision literals.\n\n\t/// Import this namespace to enable half-precision floating point literals:\n\n\t/// ~~~~{.cpp}\n\n\t/// using namespace half_float::literal;\n\n\t/// half_float::half = 4.2_h;\n\n\t/// ~~~~\n\n\tnamespace literal\n\n\t{\n\n\t\thalf operator\"\"_h(long double);\n\n\t}\n\n#endif\n\n\n\n\t/// \\internal\n\n\t/// \\brief Implementation details.\n\n\tnamespace detail\n\n\t{\n\n\t#if HALF_ENABLE_CPP11_TYPE_TRAITS\n", "file_path": "include/nifty/external/half.hpp", "rank": 3, "score": 133513.13361479074 }, { "content": "from __future__ import absolute_import\n\nfrom ._opt import *\n\nfrom .. import Configuration\n\n\n\n# from . import multicut\n\n# from . import lifted_multicut\n\n\n\n# from multicut import *\n\n# from lifted_multicut import *\n\n\n\n__all__ = []\n\n\n\nfor key in _opt.__dict__.keys():\n\n __all__.append(key)\n", "file_path": "src/python/module/nifty/graph/opt/__init__.py", "rank": 4, "score": 123245.53146454174 }, { "content": " def loggingVisitor(visitNth=1,verbose=True,timeLimitSolver=float('inf'),\n\n timeLimitTotal=float('inf'), logLevel=LogLevel.WARN):\n\n V = getMcCls(\"LoggingVisitor\")\n\n return V(visitNth=int(visitNth),\n\n verbose=bool(verbose),\n\n timeLimitSolver=float(timeLimitSolver),\n\n timeLimitTotal=float(timeLimitTotal),\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 5, "score": 120016.26208440769 }, { "content": "\"\"\" Multicut module of nifty\n\n\n\nThis module implements multicut\n\nrelated functionality.\n\n\n\nFor more details, see seection :ref:`theory_multicut`.\n\n\n\n\"\"\"\n\n\n\n\n\n\n\nfrom __future__ import absolute_import\n\nimport sys\n\nfrom functools import partial\n\n#from . import _multicut as __multicut\n\nfrom ._multicut import *\n\nfrom .... import Configuration, LogLevel\n\nfrom ... import (UndirectedGraph,EdgeContractionGraphUndirectedGraph)\n\n\n\n__all__ = [\n\n \"ilpSettings\"\n\n]\n\nfor key in _multicut.__dict__.keys():\n\n\n\n if key not in [\"__spec__\",\"__doc__\"]:\n\n try:\n\n\n\n value.__module__='nifty.graph.opt.multicut'\n\n except Exception as e:\n\n continue\n\n __all__.append(key)\n\n\n\n\n\n\n\ndef ilpSettings(relativeGap=0.0, absoluteGap=0.0, memLimit=-1.0):\n\n \"\"\"factory function to create :class:`IlpBackendSettigns` .\n\n\n\n factory function to create :class:`IlpBackendSettigns` .\n\n This settings might be consumed by ILP solvers\n\n as CPLEX GUROBI and GLPK.\n\n\n\n Args:\n\n relativeGap (float): relative optimality gap (default: {0.0})\n\n absoluteGap (float): absolute optimality gap (default: {0.0})\n\n memLimit (float): memory limit in mega-bites\n\n a value smaller as zero indicates no limit (default: {-1.0})\n\n\n\n Returns:\n\n :class:`IlpBackendSettings`: ilpSettings\n\n \"\"\"\n\n s = IlpBackendSettings()\n\n s.relativeGap = float(relativeGap)\n\n s.absoluteGap = float(absoluteGap)\n\n s.memLimit = float(memLimit)\n\n\n\n return s\n\n\n\n\n\ndef __extendMulticutObj(objectiveCls, objectiveName, graphCls):\n\n\n\n\n\n def getCls(prefix, postfix):\n\n return _multicut.__dict__[prefix+postfix]\n\n\n\n def getSettingsCls(baseName):\n\n S = getCls(\"__\"+baseName + \"SettingsType\" ,objectiveName)\n\n return S\n\n def getMcCls(baseName):\n\n S = getCls(baseName,objectiveName)\n\n return S\n\n def getSettings(baseName):\n\n S = getSettingsCls(baseName)\n\n return S()\n\n def getSettingsAndFactoryCls(baseName):\n\n s = getSettings(baseName)\n\n F = getCls(baseName + \"Factory\" ,objectiveName)\n\n return s,F\n\n\n\n def factoryClsName(baseName):\n\n return baseName + \"Factory\" + objectiveName\n\n\n\n\n\n O = objectiveCls\n\n\n\n def verboseVisitor(visitNth=1, timeLimitSolver=float('inf'),\n\n timeLimitTotal=float('inf'), logLevel=LogLevel.WARN):\n\n V = getMcCls(\"VerboseVisitor\")\n\n return V(int(visitNth), float(timeLimitSolver), float(timeLimitTotal), logLevel)\n\n O.verboseVisitor = staticmethod(verboseVisitor)\n\n\n\n\n\n def loggingVisitor(visitNth=1,verbose=True,timeLimitSolver=float('inf'),\n\n timeLimitTotal=float('inf'), logLevel=LogLevel.WARN):\n\n V = getMcCls(\"LoggingVisitor\")\n\n return V(visitNth=int(visitNth),\n\n verbose=bool(verbose),\n\n timeLimitSolver=float(timeLimitSolver),\n\n timeLimitTotal=float(timeLimitTotal),\n\n logLevel=logLevel)\n\n O.loggingVisitor = staticmethod(loggingVisitor)\n\n\n\n\n\n\n\n def greedyAdditiveProposals(sigma=1.0, weightStopCond=0.0, nodeNumStopCond=-1.0):\n\n s = getSettings('FusionMoveBasedGreedyAdditiveProposalGen')\n\n s.sigma = float(sigma)\n\n s.weightStopCond = float(weightStopCond)\n\n s.nodeNumStopCond = float(nodeNumStopCond)\n\n return s\n\n O.greedyAdditiveProposals = staticmethod(greedyAdditiveProposals)\n\n\n\n def watershedProposals(sigma=1.0, seedFraction=0.0):\n\n s = getSettings('FusionMoveBasedWatershedProposalGen')\n\n s.sigma = float(sigma)\n\n s.seedFraction = float(seedFraction)\n\n return s\n\n O.watershedProposals = staticmethod(watershedProposals)\n\n\n\n def greedyAdditiveFactory( weightStopCond=0.0, nodeNumStopCond=-1.0, visitNth=1):\n\n s,F = getSettingsAndFactoryCls(\"MulticutGreedyAdditive\")\n\n s.weightStopCond = float(weightStopCond)\n\n s.nodeNumStopCond = float(nodeNumStopCond)\n\n s.visitNth = int(visitNth)\n\n\n\n return F(s)\n\n O.greedyAdditiveFactory = staticmethod(greedyAdditiveFactory)\n\n O.greedyAdditiveFactory.__doc__ = \"\"\" create an instance of :class:`%s`\n\n\n\n Find approximate solutions via\n\n agglomerative clustering as in :cite:`beier_15_funsion`.\n\n\n\n Warning:\n\n This solver should be used to\n\n warm start other solvers with.\n\n This solver is very fast but\n\n yields rather suboptimal results.\n\n\n\n Args:\n\n weightStopCond (float): stop clustering when the highest\n\n weight in cluster-graph is lower as this value (default: {0.0})\n\n nodeNumStopCond (float): stop clustering when a cluster-graph\n\n reached a certain number of nodes.\n\n Numbers smaller 1 are interpreted as fraction\n\n of the graphs number of nodes.\n\n If nodeNumStopCond is smaller 0 this\n\n stopping condition is ignored (default: {-1})\n\n visitNth (int) : only call the visitor each nth time.\n\n This is useful to avoid to many couts (default: {1}).\n\n Returns:\n\n %s : multicut factory\n\n \"\"\"%(factoryClsName(\"MulticutGreedyAdditive\"),factoryClsName(\"MulticutGreedyAdditive\"))\n\n\n\n\n\n\n\n def warmStartGreeedyDecorator(func):\n\n def func_wrapper(*args, **kwargs):\n\n warmStartGreedy = kwargs.pop('warmStartGreedy', False)\n\n greedyVisitNth = kwargs.pop('greedyVisitNth', 100)\n\n if(warmStartGreedy):\n\n greedyFactory = greedyAdditiveFactory(visitNth=int(greedyVisitNth))\n\n factory = func(*args, **kwargs)\n\n return chainedSolversFactory(multicutFactories=[\n\n greedyFactory,\n\n factory\n\n ])\n\n else:\n\n return func(*args, **kwargs)\n\n return func_wrapper\n\n\n\n\n\n\n\n\n\n\n\n def chainedSolversFactory(multicutFactories):\n\n s,F = getSettingsAndFactoryCls(\"ChainedSolvers\")\n\n s.multicutFactories = multicutFactories\n\n return F(s)\n\n O.chainedSolversFactory = staticmethod(chainedSolversFactory)\n\n\n\n O.chainedSolversFactory.__doc__ = \"\"\" create an instance of :class:`%s`\n\n\n\n Chain multiple solvers\n\n such that each successor is warm-started with\n\n its predecessor solver.\n\n\n\n Warning:\n\n The solvers should be able to be warm started.\n\n\n\n Args:\n\n weightStopCond (float): stop clustering when the highest\n\n weight in cluster-graph is lower as this value (default: {0.0})\n\n nodeNumStopCond: stop clustering when a cluster-graph\n\n reached a certain number of nodes.\n\n Numbers smaller 1 are interpreted as fraction\n\n of the graphs number of nodes.\n\n If nodeNumStopCond is smaller 0 this\n\n stopping condition is ignored (default: {-1})\n\n Returns:\n\n %s : multicut factory\n\n \"\"\"%(factoryClsName(\"ChainedSolvers\"),factoryClsName(\"ChainedSolvers\"))\n\n\n\n\n\n\n\n @warmStartGreeedyDecorator\n\n def cgcFactory(doCutPhase=True, doGlueAndCutPhase=True, mincutFactory=None,\n\n multicutFactory=None,\n\n doBetterCutPhase=False, nodeNumStopCond=0.1, sizeRegularizer=1.0):\n\n if mincutFactory is None:\n\n if Configuration.WITH_QPBO:\n\n mincutFactory = graphCls.MincutObjective.mincutQpboFactory(improve=True)\n\n else:\n\n raise RuntimeError(\"default mincutFactory needs to be compiled WITH_QPBO\")\n\n\n\n if Configuration.WITH_QPBO:\n\n s,F = getSettingsAndFactoryCls(\"Cgc\")\n\n s.doCutPhase = bool(doCutPhase)\n\n s.doGlueAndCutPhase = bool(doGlueAndCutPhase)\n\n s.mincutFactory = mincutFactory\n\n if multicutFactory is not None:\n\n s.multicutFactory = multicutFactory\n\n s.doBetterCutPhase = bool(doBetterCutPhase)\n\n s.nodeNumStopCond = float(nodeNumStopCond)\n\n s.sizeRegularizer = float(sizeRegularizer)\n\n return F(s)\n\n else:\n\n raise RuntimeError(\"cgc need nifty to be compiled WITH_QPBO\")\n\n O.cgcFactory = staticmethod(cgcFactory)\n\n O.cgcFactory.__module__ = \"nifty.graph.opt.multicut\"\n\n O.cgcFactory.__doc__ = \"\"\" create an instance of :class:`%s`\n\n\n\n Cut glue and cut as described in :cite:`beier_14_cut`.\n\n\n\n Warning:\n\n This solver should be warm started, otherwise\n\n the glue phase is very slow.\n\n Using :func:`greedyAdditiveFactory` to create\n\n a solver for warm starting is suggested.\n\n\n\n\n\n Note:\n\n In contrast to the OpenGM implementation we allow for\n\n arbitrary solvers to optimize the mincut problem.\n\n\n\n Args:\n\n doCutPhase: do recursive two coloring (default: {True})\n\n doGlueAndCutPhase: do re-opt of all pairs of clusters (default: {True})\n\n mincutFactory: mincutFactory for creating mincut solvers to solve subproblems (default: {None})\n\n multicutFactory: multicutFactory for creating multicut solvers to solve subproblems (default: {None})\n\n doBetterCutPhase: do a cut phase with multicut solvers instead of mincuts (default: {False})\n\n nodeNumStopCond: If doBetterCutPhase is True, we use a agglomeration to\n\n create a set of clusters. Each cluster is then optimized with the solver from\n\n the multicutFactory. Values between 0 and 1 are interpreted as fraction\n\n of the total number of nodes in the graph (default: {0.1})\n\n sizeRegularizer: If doBetterCutPhase is True, we use a agglomeration to\n\n create a set of clusters.\n\n If this number is larger as zero, the clusters have about equal size (default: {1.0})\n\n Returns:\n\n %s : multicut factory\n\n \"\"\"%(factoryClsName(\"Cgc\"),factoryClsName(\"Cgc\"))\n\n\n\n\n\n def defaultMulticutFactory():\n\n return O.greedyAdditiveFactory()\n\n O.defaultMulticutFactory = staticmethod(defaultMulticutFactory)\n\n O.defaultFactory = staticmethod(defaultMulticutFactory)\n\n O.defaultFactory.__doc__ = \"\"\" create a instance of the default multicut solver factory.\n\n\n\n Currently the this function returns the same as\n\n :func:`greedyAdditiveFactory`\n\n\n\n Returns:\n\n %s : multicut factory\n\n \"\"\"%(factoryClsName(\"MulticutGreedyAdditive\"))\n\n\n\n\n\n @warmStartGreeedyDecorator\n\n def kernighanLinFactory(\n\n numberOfInnerIterations = sys.maxsize,\n\n numberOfOuterIterations = 100,\n\n epsilon = 1e-6):\n\n\n\n s, F = getSettingsAndFactoryCls(\"KernighanLin\")\n\n s.numberOfInnerIterations = numberOfInnerIterations\n\n s.numberOfOuterIterations = numberOfOuterIterations\n\n s.epsilon = epsilon\n\n return F(s)\n\n O.kernighanLinFactory = staticmethod(kernighanLinFactory)\n\n O.kernighanLinFactory.__doc__ = \"\"\" create an instance of :class:`%s`\n\n\n\n Find approximate solutions via\n\n agglomerative clustering as in :cite:`TODO`.\n\n\n\n\n\n Args:\n\n numberOfInnerIterations (int): number of inner iterations (default: {sys.maxsize})\n\n numberOfOuterIterations (int): number of outer iterations (default: {100})\n\n epsilon (float): epsilon (default: { 1e-6})\n\n warmStartGreedy (bool): initialize with greedyAdditive (default: {False})\n\n\n\n Returns:\n\n %s : multicut factory\n\n \"\"\"%tuple([factoryClsName(\"KernighanLin\")]*2)\n\n\n\n\n\n def multicutDecomposerFactory(submodelFactory=None, fallthroughFactory=None):\n\n\n\n if submodelFactory is None:\n\n submodelFactory = MulticutObjectiveUndirectedGraph.defaultMulticutFactory()\n\n\n\n if fallthroughFactory is None:\n\n fallthroughFactory = O.defaultMulticutFactory()\n\n\n\n\n\n s,F = getSettingsAndFactoryCls(\"MulticutDecomposer\")\n\n s.submodelFactory = submodelFactory\n\n s.fallthroughFactory = fallthroughFactory\n\n return F(s)\n\n\n\n O.multicutDecomposerFactory = staticmethod(multicutDecomposerFactory)\n\n O.multicutDecomposerFactory.__doc__ = \"\"\" create an instance of :class:`%s`\n\n\n\n This solver tries to decompose the model into\n\n sub-models as described in :cite:`alush_2013_simbad`.\n\n If a model decomposes into components such that there are no\n\n positive weighted edges between the components one can\n\n optimize each model separately.\n\n\n\n\n\n\n\n Note:\n\n Models might not decompose at all.\n\n\n\n Args:\n\n submodelFactory: multicut factory for solving subproblems\n\n if model decomposes (default: {:func:`defaultMulticutFactory()`})\n\n fallthroughFactory: multicut factory for solving subproblems\n\n if model does not decompose (default: {:func:`defaultMulticutFactory()`})\n\n\n\n Returns:\n\n %s : multicut factory\n\n \"\"\"%(factoryClsName(\"MulticutDecomposer\"),factoryClsName(\"MulticutDecomposer\"))\n\n\n\n\n\n def multicutIlpFactory(addThreeCyclesConstraints=True,\n\n addOnlyViolatedThreeCyclesConstraints=True,\n\n ilpSolverSettings=None,\n\n ilpSolver = None):\n\n # default solver:\n\n if ilpSolver is None and Configuration.WITH_CPLEX:\n\n ilpSolver = 'cplex'\n\n if ilpSolver is None and Configuration.WITH_GUROBI:\n\n ilpSolver = 'gurobi'\n\n if ilpSolver is None and Configuration.WITH_GLPK:\n\n ilpSolver = 'glpk'\n\n if ilpSolver is None:\n\n raise RuntimeError(\"multicutIlpFactory needs either \"\n\n \"'WITH_CPLEX', 'WITH_GUROBI'\"\n\n \" or 'WITH_GLPK' to be enabled\")\n\n\n\n if ilpSolver == 'cplex':\n\n if not Configuration.WITH_CPLEX:\n\n raise RuntimeError(\"multicutIlpFactory with ilpSolver=`cplex` need nifty \"\n\n \"to be compiled with WITH_CPLEX\")\n\n s,F = getSettingsAndFactoryCls(\"MulticutIlpCplex\")\n\n elif ilpSolver == 'gurobi':\n\n if not Configuration.WITH_GUROBI:\n\n raise RuntimeError(\"multicutIlpFactory with ilpSolver=`gurobi` need nifty \"\n\n \"to be compiled with WITH_GUROBI\")\n\n s,F = getSettingsAndFactoryCls(\"MulticutIlpGurobi\")\n\n elif ilpSolver == 'glpk':\n\n if not Configuration.WITH_GLPK:\n\n raise RuntimeError(\"multicutIlpFactory with ilpSolver=`glpk` need nifty \"\n\n \"to be compiled with WITH_GLPK\")\n\n s,F = getSettingsAndFactoryCls(\"MulticutIlpGlpk\")\n\n else:\n\n raise RuntimeError(\"%s is an unknown ilp solver\"%str(ilpSolver))\n\n s.addThreeCyclesConstraints = bool(addThreeCyclesConstraints)\n\n s.addOnlyViolatedThreeCyclesConstraints = bool(addOnlyViolatedThreeCyclesConstraints)\n\n if ilpSolverSettings is None:\n\n ilpSolverSettings = ilpSettings()\n\n s.ilpSettings = ilpSolverSettings\n\n return F(s)\n\n\n\n O.multicutIlpFactory = staticmethod(multicutIlpFactory)\n\n if Configuration.WITH_CPLEX:\n\n O.multicutIlpCplexFactory = staticmethod(partial(multicutIlpFactory,ilpSolver='cplex'))\n\n if Configuration.WITH_GUROBI:\n\n O.multicutIlpGurobiFactory = staticmethod(partial(multicutIlpFactory,ilpSolver='gurobi'))\n\n if Configuration.WITH_GLPK:\n\n O.multicutIlpGlpkFactory = staticmethod(partial(multicutIlpFactory,ilpSolver='glpk'))\n\n\n\n O.multicutIlpFactory.__doc__ = \"\"\" create an instance of an ilp multicut solver.\n\n\n\n Find a global optimal solution by a cutting plane ILP solver\n\n as described in :cite:`Kappes-2011`\n\n and :cite:`andres_2011_probabilistic`\n\n\n\n\n\n Note:\n\n This might take very long for large models.\n\n\n\n Args:\n\n addThreeCyclesConstraints (bool) :\n\n explicitly add constraints for cycles\n\n of length 3 before opt (default: {True})\n\n addOnlyViolatedThreeCyclesConstraints (bool) :\n\n explicitly add all violated constraints for only violated cycles\n\n of length 3 before opt (default: {True})\n\n ilpSolverSettings (:class:`IlpBackendSettings`) :\n\n SettingsType of the ilp solver (default : {:func:`ilpSettings`})\n\n ilpSolver (str) : name of the solver. Must be in\n\n either \"cplex\", \"gurobi\" or \"glpk\".\n\n \"glpk\" is only capable of solving very small models.\n\n (default: {\"cplex\"}).\n\n\n\n Returns:\n\n %s or %s or %s : multicut factory for the corresponding solver\n\n\n\n \"\"\"%(\n\n factoryClsName(\"MulticutIlpCplex\"),\n\n factoryClsName(\"MulticutIlpGurobi\"),\n\n factoryClsName(\"MulticutIlpGlpk\"),\n\n )\n\n\n\n\n\n # O.multicutIlpCplexFactory.__doc__ =\n\n # O.multicutIlpGurobiFactory\n\n # O.multicutIlpGlpkFactory\n\n\n\n\n\n\n\n if Configuration.WITH_LP_MP:\n\n def multicutMpFactory(\n\n mcFactory = None,\n\n numberOfIterations = 1000,\n\n verbose = 0,\n\n primalComputationInterval = 100,\n\n standardReparametrization = \"anisotropic\",\n\n roundingReparametrization = \"damped_uniform\",\n\n tightenReparametrization = \"damped_uniform\",\n\n tighten = True,\n\n tightenInterval = 100,\n\n tightenIteration = 10,\n\n tightenSlope = 0.02,\n\n tightenConstraintsPercentage = 0.1,\n\n minDualImprovement = 0.,\n\n minDualImprovementInterval = 0,\n\n timeout = 0,\n\n numberOfThreads = 1\n\n ):\n\n\n\n settings, factoryCls = getSettingsAndFactoryCls(\"MulticutMp\")\n\n\n\n settings.mcFactory = mcFactory\n\n settings.numberOfIterations = numberOfIterations\n\n settings.verbose = verbose\n\n settings.primalComputationInterval = primalComputationInterval\n\n settings.standardReparametrization = standardReparametrization\n\n settings.roundingReparametrization = roundingReparametrization\n\n settings.tightenReparametrization = tightenReparametrization\n\n settings.tighten = tighten\n\n settings.tightenInterval = tightenInterval\n\n settings.tightenIteration = tightenIteration\n\n settings.tightenSlope = tightenSlope\n\n settings.tightenConstraintsPercentage = tightenConstraintsPercentage\n\n settings.minDualImprovement = minDualImprovement\n\n settings.minDualImprovementInterval = minDualImprovementInterval\n\n settings.timeout = timeout\n\n settings.numberOfThreads = numberOfThreads\n\n\n\n return factoryCls(settings)\n\n\n\n O.multicutMpFactory = staticmethod(multicutMpFactory)\n\n\n\n\n\n def fusionMoveSettings(mcFactory=None):\n\n if mcFactory is None:\n\n if Configuration.WITH_CPLEX:\n\n mcFactory = MulticutObjectiveUndirectedGraph.multicutIlpCplexFactory()\n\n else:\n\n mcFactory = MulticutObjectiveUndirectedGraph.defaultMulticutFactory()\n\n s = getSettings('FusionMove')\n\n s.mcFactory = mcFactory\n\n return s\n\n O.fusionMoveSettings = staticmethod(fusionMoveSettings)\n\n\n\n\n\n\n\n\n\n def watershedCcProposals(sigma=1.0, numberOfSeeds=0.1):\n\n s,F = getSettingsAndFactoryCls(\"WatershedProposalGenerator\")\n\n s.sigma = float(sigma)\n\n s.numberOfSeeds = float(numberOfSeeds)\n\n return F(s)\n\n O.watershedCcProposals = staticmethod(watershedCcProposals)\n\n\n\n\n\n def interfaceFlipperCcProposals():\n\n s,F = getSettingsAndFactoryCls(\"InterfaceFlipperProposalGenerator\")\n\n return F(s)\n\n O.interfaceFlipperCcProposals = staticmethod(interfaceFlipperCcProposals)\n\n\n\n\n\n def randomNodeColorCcProposals(numberOfColors=2):\n\n s,F = getSettingsAndFactoryCls(\"RandomNodeColorProposalGenerator\")\n\n s.numberOfColors = int(numberOfColors)\n\n return F(s)\n\n O.randomNodeColorCcProposals = staticmethod(randomNodeColorCcProposals)\n\n\n\n\n\n @warmStartGreeedyDecorator\n\n def ccFusionMoveBasedFactory(proposalGenerator=None,\n\n numberOfThreads=1, numberOfIterations=100,\n\n stopIfNoImprovement=10, fusionMove=None):\n\n\n\n\n\n solverSettings,F = getSettingsAndFactoryCls(\"CcFusionMoveBased\")\n\n\n\n if proposalGenerator is None:\n\n proposalGenerator = watershedCcProposals()\n\n if fusionMove is None:\n\n fusionMove = fusionMoveSettings()\n\n\n\n\n\n\n\n solverSettings.fusionMoveSettings = fusionMove\n\n solverSettings.proposalGenerator = proposalGenerator\n\n solverSettings.numberOfIterations = int(numberOfIterations)\n\n solverSettings.stopIfNoImprovement = int(stopIfNoImprovement)\n\n solverSettings.numberOfThreads = int(numberOfThreads)\n\n factory = F(solverSettings)\n\n return factory\n\n O.ccFusionMoveBasedFactory = staticmethod(ccFusionMoveBasedFactory)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n def perturbAndMapSettings( numberOfIterations=1000,\n\n numberOfThreads=-1,\n\n verbose=1,\n\n noiseType='normal',\n\n noiseMagnitude=1.0,\n\n mcFactory=None):\n\n if mcFactory is None:\n\n mcFactory = fusionMoveBasedFactory(numberOfThreads=0)\n\n s = getSettings('PerturbAndMap')\n\n s.numberOfIterations = int(numberOfIterations)\n\n s.numberOfThreads = int(numberOfThreads)\n\n s.verbose = int(verbose)\n\n s.noiseMagnitude = float(noiseMagnitude)\n\n\n\n if(noiseType == 'normal'):\n\n s.noiseType = getMcCls('PerturbAndMap').NORMAL_NOISE\n\n elif(noiseType == 'uniform'):\n\n s.noiseType = getMcCls('PerturbAndMap').UNIFORM_NOISE\n\n elif(noiseType == 'makeLessCertain'):\n\n s.noiseType = graph.multicut.PerturbAndMapUndirectedGraph.MAKE_LESS_CERTAIN\n\n else:\n\n raise RuntimeError(\"'%s' is an unknown noise type. Must be 'normal' or 'uniform' or 'makeLessCertain' \"%str(noiseType))\n\n\n\n s.mcFactory = mcFactory\n\n return s\n\n O.perturbAndMapSettings = staticmethod(perturbAndMapSettings)\n\n\n\n def perturbAndMap(objective, settings):\n\n pAndM = graph.multicut.perturbAndMap(objective, settings)\n\n return pAndM\n\n O.perturbAndMap = staticmethod(perturbAndMap)\n\n\n\n\n\n__extendMulticutObj(MulticutObjectiveUndirectedGraph,\n\n \"MulticutObjectiveUndirectedGraph\",UndirectedGraph)\n\n__extendMulticutObj(MulticutObjectiveEdgeContractionGraphUndirectedGraph,\n\n \"MulticutObjectiveEdgeContractionGraphUndirectedGraph\",EdgeContractionGraphUndirectedGraph)\n\ndel __extendMulticutObj\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# def __extendDocstrings():\n\n\n\n# mcDocstring = Multicut Objective for an %s\n\n\n\n# .. math::\n\n\n\n# (a + b)^2 &= (a + b)(a + b) \\\\\n\n# &= a^2 + 2ab + b^2\n\n\n\n\n\n\n\n\n\n# # hack docstrings\n\n# MulticutObjectiveUndirectedGraph.__doc__ = mcDocstring % (\"UndirectedGraph\")\n\n\n\n\n\n# __extendDocstrings()\n\n# del(__extendDocstrings)\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 6, "score": 119798.47727180111 }, { "content": "from __future__ import absolute_import\n\n\n\nfrom . import _minstcut as __minstcut\n\nfrom ._minstcut import *\n\nfrom .... import Configuration\n\n\n\nfrom functools import partial\n\n\n\n__all__ = []\n\nfor key in __minstcut.__dict__.keys():\n\n __all__.append(key)\n\n try:\n\n __minstcut.__dict__[key].__module__ = 'nifty.graph.opt.minstcut'\n\n except:\n\n pass\n\n\n\n\n\ndef __extendminstcutObj(objectiveCls, objectiveName):\n\n\n\n def getCls(prefix, postfix):\n\n return _minstcut.__dict__[prefix+postfix]\n\n\n\n def getSettingsCls(baseName):\n\n S = getCls(baseName + \"SettingsType\" ,objectiveName)\n\n return S\n\n def getSolverCls(baseName):\n\n S = getCls(baseName,objectiveName)\n\n return S\n\n def getSettings(baseName):\n\n S = getSettingsCls(baseName)\n\n return S()\n\n def getSettingsAndFactoryCls(baseName):\n\n s = getSettings(baseName)\n\n F = getCls(baseName + \"Factory\" ,objectiveName)\n\n return s,F\n\n\n\n O = objectiveCls\n\n\n\n def minstcutVerboseVisitor(visitNth=1,timeLimit=0):\n\n V = getSolverCls(\"VerboseVisitor\")\n\n return V(visitNth,timeLimit)\n\n O.verboseVisitor = staticmethod(minstcutVerboseVisitor)\n\n\n\n def watershedProposalGenerator(sigma=1.0,\n\n numberOfSeeds=0.1,\n\n seedingStrategie='SEED_FROM_NEGATIVE'):\n\n \"\"\"Factory function for a watershed based proposal generator for minstcutCcFusionMoveBased\n\n\n\n Args:\n\n sigma (float, optional): The weights are perturbed by a additive\n\n Gaussian noise n(0,sigma) (default 0.0)\n\n\n\n numberOfSeeds (float, optional): Number of seed to generate.\n\n A number smaller as one will be interpreted as a fraction of\n\n the number of nodes (default 0.1)\n\n seedingStrategie (str, optional): Can be:\n\n - 'SEED_FROM_NEGATIVE' : All negative weighted edges\n\n can be used to generate seeds.\n\n - 'SEED_FROM_ALL' : All edges\n\n can be used to generate seeds.\n\n\n\n Returns:\n\n TYPE: parameter object used construct a WatershedProposalGenerator\n\n\n\n \"\"\"\n\n pGenCls = getSolverCls(\"WatershedProposalGeneratorFactory\")\n\n pGenSettings = getSettings(\"WatershedProposalGenerator\")\n\n\n\n # map string to enum\n\n stringToEnum = {\n\n 'SEED_FROM_NEGATIVE' : pGenSettings.SeedingStrategie.SEED_FROM_NEGATIVE,\n\n 'SEED_FROM_ALL' : pGenSettings.SeedingStrategie.SEED_FROM_ALL,\n\n }\n\n try:\n\n enumVal = stringToEnum[seedingStrategie]\n\n except:\n\n raise RuntimeError(\"unkown seedingStrategie '%s': must be either\"\\\n\n \"'SEED_FROM_NEGATIVE' or 'SEED_FROM_ALL'\"%str(seedingStrategie))\n\n\n\n pGenSettings.sigma = float(sigma)\n\n pGenSettings.numberOfSeeds = float(numberOfSeeds)\n\n pGenSettings.seedingStrategie = enumVal\n\n\n\n return pGenCls(pGenSettings)\n\n O.watershedProposalGenerator = staticmethod(watershedProposalGenerator)\n\n\n\n def minstcutQpboFactory(improve=True):\n\n if Configuration.WITH_QPBO:\n\n s,F = getSettingsAndFactoryCls(\"minstcutQpbo\")\n\n s.improve = bool(improve)\n\n return F(s)\n\n else:\n\n raise RuntimeError(\"minstcutQpbo need nifty to be compiled WITH_QPBO\")\n\n O.minstcutQpboFactory = staticmethod(minstcutQpboFactory)\n\n\n\n def greedyAdditiveFactory( weightStopCond=0.0, nodeNumStopCond=-1.0, improve=True):\n\n if Configuration.WITH_QPBO:\n\n s,F = getSettingsAndFactoryCls(\"minstcutGreedyAdditive\")\n\n s.weightStopCond = float(weightStopCond)\n\n s.nodeNumStopCond = float(nodeNumStopCond)\n\n s.improve = bool(improve)\n\n return F(s)\n\n else:\n\n raise RuntimeError(\"greedyAdditiveFactory need nifty to be compiled WITH_QPBO\")\n\n O.greedyAdditiveFactory = staticmethod(greedyAdditiveFactory)\n\n\n\n def minstcutCcFusionMoveSettings(minstcutFactory=None):\n\n if minstcutFactory is None:\n\n if Configuration.WITH_QPBO:\n\n minstcutFactory = minstcutObjectiveUndirectedGraph.minstcutQpboFactory()\n\n else:\n\n raise RuntimeError(\"default minstcutFactory needs minstcutQpbo, which need nifty to be compiled WITH_QPBO\")\n\n\n\n s = getSettings(\"minstcutCcFusionMove\")\n\n s.minstcutFactory = minstcutFactory\n\n return s\n\n\n\n def minstcutCcFusionMoveBasedFactory(proposalGenerator=None, numberOfThreads=1,\n\n numberOfIterations=1000, stopIfNoImprovement=100,\n\n fusionMoveSettings=None):\n\n \"\"\"factory function for a cc-fusion move based minstcut solver\n\n\n\n Args:\n\n proposalGenerator (None, optional): Proposal generator (default watershedProposalGenerator)\n\n numberOfThreads (int, optional): (default 1)\n\n numberOfIterations (int, optional): Maximum number of iterations(default 1000)\n\n stopIfNoImprovement (int, optional): Stop after n iterations without improvement (default 100)\n\n fusionMoveSettings (FusionMoveSettings, optional) : The settings of the underlaying minstcutCcFusionMove\n\n Returns:\n\n TYPE: minstcutCcFusionMoveBasedFactory\n\n \"\"\"\n\n if proposalGenerator is None:\n\n proposalGenerator = watershedProposalGenerator()\n\n\n\n if fusionMoveSettings is None:\n\n fusionMoveSettings = minstcutCcFusionMoveSettings()\n\n\n\n s,F = getSettingsAndFactoryCls(\"minstcutCcFusionMoveBased\")\n\n s.proposalGenerator = proposalGenerator\n\n s.numberOfThreads = int(numberOfThreads)\n\n s.numberOfIterations = int(numberOfIterations)\n\n s.stopIfNoImprovement = int(stopIfNoImprovement)\n\n s.fusionMoveSettings = fusionMoveSettings\n\n return F(s)\n\n O.minstcutCcFusionMoveBasedFactory = staticmethod(minstcutCcFusionMoveBasedFactory)\n\n\n\n\n\n__extendminstcutObj(MinstcutObjectiveUndirectedGraph,\n\n \"MinstcutObjectiveUndirectedGraph\")\n\n__extendminstcutObj(MinstcutObjectiveEdgeContractionGraphUndirectedGraph,\n\n \"MinstcutObjectiveEdgeContractionGraphUndirectedGraph\")\n\ndel __extendminstcutObj\n", "file_path": "src/python/module/nifty/graph/opt/minstcut/__init__.py", "rank": 7, "score": 119795.19406154833 }, { "content": "from __future__ import absolute_import\n\n\n\nfrom . import _mincut as __mincut\n\nfrom ._mincut import *\n\nfrom .... import Configuration\n\n\n\nfrom functools import partial\n\n\n\n__all__ = []\n\nfor key in __mincut.__dict__.keys():\n\n __all__.append(key)\n\n try:\n\n __mincut.__dict__[key].__module__='nifty.graph.opt.mincut'\n\n except:\n\n pass\n\n\n\n\n\ndef __extendMincutObj(objectiveCls, objectiveName):\n\n\n\n def getCls(prefix, postfix):\n\n return _mincut.__dict__[prefix+postfix]\n\n\n\n def getSettingsCls(baseName):\n\n S = getCls(baseName + \"SettingsType\" ,objectiveName)\n\n return S\n\n def getSolverCls(baseName):\n\n S = getCls(baseName,objectiveName)\n\n return S\n\n def getSettings(baseName):\n\n S = getSettingsCls(baseName)\n\n return S()\n\n def getSettingsAndFactoryCls(baseName):\n\n s = getSettings(baseName)\n\n F = getCls(baseName + \"Factory\" ,objectiveName)\n\n return s,F\n\n\n\n O = objectiveCls\n\n\n\n def mincutVerboseVisitor(visitNth=1,timeLimit=0):\n\n V = getSolverCls(\"VerboseVisitor\")\n\n return V(visitNth,timeLimit)\n\n #O.mincutVerboseVisitor = staticmethod(mincutVerboseVisitor)\n\n O.verboseVisitor = staticmethod(mincutVerboseVisitor)\n\n\n\n\n\n def watershedProposalGenerator(sigma=1.0, numberOfSeeds=0.1,seedingStrategie='SEED_FROM_NEGATIVE'):\n\n \"\"\"factory function for a watershed based proposal generator for mincutCcFusionMoveBased\n\n\n\n Args:\n\n sigma (float, optional): The weights are perturbed by a additive\n\n Gaussian noise n(0,sigma) (default 0.0)\n\n\n\n numberOfSeeds (float, optional): Number of seed to generate.\n\n A number smaller as one will be interpreted as a fraction of\n\n the number of nodes (default 0.1)\n\n seedingStrategie (str, optional): Can be:\n\n - 'SEED_FROM_NEGATIVE' : All negative weighted edges\n\n can be used to generate seeds.\n\n - 'SEED_FROM_ALL' : All edges\n\n can be used to generate seeds.\n\n Returns:\n\n TYPE: parameter object used construct a WatershedProposalGenerator\n\n \"\"\"\n\n pGenCls = getSolverCls(\"WatershedProposalGeneratorFactory\")\n\n pGenSettings = getSettings(\"WatershedProposalGenerator\")\n\n\n\n # map string to enum\n\n stringToEnum = {\n\n 'SEED_FROM_NEGATIVE' : pGenSettings.SeedingStrategie.SEED_FROM_NEGATIVE,\n\n 'SEED_FROM_ALL' : pGenSettings.SeedingStrategie.SEED_FROM_ALL,\n\n }\n\n try:\n\n enumVal = stringToEnum[seedingStrategie]\n\n except:\n\n raise RuntimeError(\"unkown seedingStrategie '%s': must be either\"\\\n\n \"'SEED_FROM_NEGATIVE' or 'SEED_FROM_ALL'\"%str(seedingStrategie))\n\n\n\n pGenSettings.sigma = float(sigma)\n\n pGenSettings.numberOfSeeds = float(numberOfSeeds)\n\n pGenSettings.seedingStrategie = enumVal\n\n\n\n return pGenCls(pGenSettings)\n\n\n\n O.watershedProposalGenerator = staticmethod(watershedProposalGenerator)\n\n\n\n\n\n def mincutQpboFactory(improve=True):\n\n if Configuration.WITH_QPBO:\n\n s,F = getSettingsAndFactoryCls(\"MincutQpbo\")\n\n s.improve = bool(improve)\n\n return F(s)\n\n else:\n\n raise RuntimeError(\"mincutQpbo need nifty to be compiled WITH_QPBO\")\n\n O.mincutQpboFactory = staticmethod(mincutQpboFactory)\n\n\n\n\n\n def greedyAdditiveFactory( weightStopCond=0.0, nodeNumStopCond=-1.0, improve=True):\n\n if Configuration.WITH_QPBO:\n\n s,F = getSettingsAndFactoryCls(\"MincutGreedyAdditive\")\n\n s.weightStopCond = float(weightStopCond)\n\n s.nodeNumStopCond = float(nodeNumStopCond)\n\n s.improve = bool(improve)\n\n return F(s)\n\n else:\n\n raise RuntimeError(\"greedyAdditiveFactory need nifty to be compiled WITH_QPBO\")\n\n O.greedyAdditiveFactory = staticmethod(greedyAdditiveFactory)\n\n\n\n\n\n def mincutCcFusionMoveSettings(mincutFactory=None):\n\n if mincutFactory is None:\n\n if Configuration.WITH_QPBO:\n\n mincutFactory = MincutObjectiveUndirectedGraph.mincutQpboFactory()\n\n else:\n\n raise RuntimeError(\"default mincutFactory needs mincutQpbo, which need nifty to be compiled WITH_QPBO\")\n\n\n\n s = getSettings(\"MincutCcFusionMove\")\n\n s.mincutFactory = mincutFactory\n\n return s\n\n\n\n\n\n def mincutCcFusionMoveBasedFactory(proposalGenerator=None, numberOfThreads=1,\n\n numberOfIterations=1000, stopIfNoImprovement=100,\n\n fusionMoveSettings=None):\n\n \"\"\"factory function for a cc-fusion move based mincut solver\n\n\n\n Args:\n\n proposalGenerator (None, optional): Proposal generator (default watershedProposalGenerator)\n\n numberOfThreads (int, optional): (default 1)\n\n numberOfIterations (int, optional): Maximum number of iterations(default 1000)\n\n stopIfNoImprovement (int, optional): Stop after n iterations without improvement (default 100)\n\n fusionMoveSettings (FusionMoveSettings, optional) : The settings of the underlaying mincutCcFusionMove\n\n Returns:\n\n TYPE: MincutCcFusionMoveBasedFactory\n\n \"\"\"\n\n if proposalGenerator is None:\n\n proposalGenerator = watershedProposalGenerator()\n\n\n\n if fusionMoveSettings is None:\n\n fusionMoveSettings = mincutCcFusionMoveSettings()\n\n\n\n s,F = getSettingsAndFactoryCls(\"MincutCcFusionMoveBased\")\n\n s.proposalGenerator = proposalGenerator\n\n s.numberOfThreads = int(numberOfThreads)\n\n s.numberOfIterations = int(numberOfIterations)\n\n s.stopIfNoImprovement = int(stopIfNoImprovement)\n\n s.fusionMoveSettings = fusionMoveSettings\n\n return F(s)\n\n\n\n O.mincutCcFusionMoveBasedFactory = staticmethod(mincutCcFusionMoveBasedFactory)\n\n\n\n\n\n__extendMincutObj(MincutObjectiveUndirectedGraph,\n\n \"MincutObjectiveUndirectedGraph\")\n\n__extendMincutObj(MincutObjectiveEdgeContractionGraphUndirectedGraph,\n\n \"MincutObjectiveEdgeContractionGraphUndirectedGraph\")\n\ndel __extendMincutObj\n", "file_path": "src/python/module/nifty/graph/opt/mincut/__init__.py", "rank": 8, "score": 119795.19406154833 }, { "content": "from __future__ import absolute_import\n\nfrom .import _lifted_multicut as __lifted_multicut\n\nfrom ._lifted_multicut import *\n\nfrom functools import partial\n\nfrom ..multicut import ilpSettings\n\nfrom .. import Configuration\n\nimport numpy\n\n\n\n__all__ = []\n\nfor key in __lifted_multicut.__dict__.keys():\n\n __all__.append(key)\n\n\n\n try:\n\n __lifted_multicut.__dict__[key].__module__='nifty.graph.opt.lifted_multicut'\n\n except:\n\n pass\n\n\n\n\n\nclass PixelWiseLmcObjective(object):\n\n def __init__(self, weights, offsets):\n\n\n\n self.weights = weights\n\n self.offsets = offsets\n\n\n\n if(self.offsets.shape[1] == 2):\n\n assert weights.shape[2] == offsets.shape[0]\n\n self.shape = weights.shape[0:2]\n\n self.n_variables = self.shape[0]*self.shape[1]\n\n self.ndim = 2\n\n self._obj = PixelWiseLmcObjective2D(self.weights, self.offsets)\n\n elif (self.offsets.shape[1] == 3):\n\n self.shape = weights.shape[0:3]\n\n self.n_variables = self.shape[0]*self.shape[1]*self.shape[2]\n\n self.ndim = 3\n\n assert weights.shape[3] == offsets.shape[0]\n\n self._obj = PixelWiseLmcObjective3D(self.weights, self.offsets)\n\n else:\n\n raise NotImplementedError(\"PixelWiseLmcObjective is only implemented for 2D and 3D images\")\n\n\n\n def optimize(self,factory, labels=None):\n\n if labels is None:\n\n labels = numpy.arange(self.n_variables).reshape(self.shape)\n\n return self._obj.optimize(factory, labels)\n\n\n\n\n\n\n\n\n\n\n\n def evaluate(self, labels):\n\n return self._obj.evaluate(labels)\n\n\n\n def cpp_obj(self):\n\n return self._obj\n\n\n\n\n\ndef pixelWiseLmcObjective(weights, offsets):\n\n return PixelWiseLmcObjective(weights, offsets)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ndef __extendLiftedMulticutObj(objectiveCls, objectiveName):\n\n\n\n def insertLiftedEdgesBfs(self, maxDistance, returnDistance = False):\n\n if returnDistance :\n\n return self._insertLiftedEdgesBfsReturnDist(maxDistance)\n\n else:\n\n self._insertLiftedEdgesBfs(maxDistance)\n\n\n\n objectiveCls.insertLiftedEdgesBfs = insertLiftedEdgesBfs\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n def getCls(prefix, postfix):\n\n return _lifted_multicut.__dict__[prefix+postfix]\n\n\n\n def getSettingsCls(baseName):\n\n S = getCls(baseName + \"SettingsType\" ,objectiveName)\n\n return S\n\n def getLmcCls(baseName):\n\n S = getCls(baseName,objectiveName)\n\n return S\n\n def getSettings(baseName):\n\n S = getSettingsCls(baseName)\n\n return S()\n\n def getSettingsAndFactoryCls(baseName):\n\n s = getSettings(baseName)\n\n F = getCls(baseName + \"Factory\" ,objectiveName)\n\n return s,F\n\n\n\n def factoryClsName(baseName):\n\n return baseName + \"Factory\" + objectiveName\n\n\n\n\n\n O = objectiveCls\n\n\n\n def verboseVisitor(visitNth=1,\n\n timeLimitSolver=float('inf'),\n\n timeLimitTotal=float('inf')):\n\n V = getLmcCls(\"LiftedMulticutVerboseVisitor\")\n\n return V(visitNth, float(timeLimitSolver), float(timeLimitTotal))\n\n O.verboseVisitor = staticmethod(verboseVisitor)\n\n\n\n\n\n\n\n def chainedSolversFactory(factories):\n\n s,F = getSettingsAndFactoryCls(\"ChainedSolvers\")\n\n s.factories = factories\n\n return F(s)\n\n O.chainedSolversFactory = staticmethod(chainedSolversFactory)\n\n\n\n O.chainedSolversFactory.__doc__ = \"\"\" create an instance of :class:`%s`\n\n\n\n Chain multiple solvers\n\n such that each successor is warm-started with\n\n its predecessor solver.\n\n\n\n Warning:\n\n The solvers should be able to be warm started.\n\n\n\n Args:\n\n weightStopCond (float): stop clustering when the highest\n\n weight in cluster-graph is lower as this value (default: {0.0})\n\n nodeNumStopCond: stop clustering when a cluster-graph\n\n reached a certain number of nodes.\n\n Numbers smaller 1 are interpreted as fraction\n\n of the graphs number of nodes.\n\n If nodeNumStopCond is smaller 0 this\n\n stopping condition is ignored (default: {-1})\n\n Returns:\n\n %s : multicut factory\n\n \"\"\"%(factoryClsName(\"ChainedSolvers\"),factoryClsName(\"ChainedSolvers\"))\n\n\n\n\n\n def watershedProposalGenerator(sigma=1.0, numberOfSeeds=0.1,\n\n seedingStrategy='SEED_FROM_LIFTED'):\n\n \"\"\"factory function for a watershed based proposal generator for fusion move based\n\n lifted multicuts.\n\n\n\n Args:\n\n sigma (float, optional): The weights are perturbed by a additive\n\n Gaussian noise n(0,sigma) (default 0.0)\n\n\n\n numberOfSeeds (float, optional): Number of seed to generate.\n\n A number smaller as one will be interpreted as a fraction of\n\n the number of nodes (default 0.1)\n\n seedingStrategy (str, optional): Can be:\n\n - 'SEED_FROM_LIFTED' : All negative weighted lifted edges\n\n can be used to generate seeds.\n\n - 'SEED_FROM_LOCAL' : All negative weighted local edges\n\n can be used to generate seeds.\n\n - 'SEED_FROM_BOTH' : Both, lifted and local edges\n\n can be used for seeding\n\n\n\n Returns:\n\n TYPE: parameter object used construct a WatershedProposalGenerator\n\n\n\n \"\"\"\n\n pGenCls = getLmcCls(\"WatershedProposalGeneratorFactory\")\n\n pGenSettings = getSettings(\"WatershedProposalGenerator\")\n\n\n\n # map string to enum\n\n stringToEnum = {\n\n 'SEED_FROM_LIFTED' : pGenSettings.SeedingStrategy.SEED_FROM_LIFTED,\n\n 'SEED_FROM_LOCAL' : pGenSettings.SeedingStrategy.SEED_FROM_LOCAL,\n\n 'SEED_FROM_BOTH' : pGenSettings.SeedingStrategy.SEED_FROM_BOTH,\n\n }\n\n try:\n\n enumVal = stringToEnum[seedingStrategy]\n\n except:\n\n raise RuntimeError(\"unkown seedingStrategy '%s': must be either\"\\\n\n \"'SEED_FROM_LIFTED','SEED_FROM_LOCAL' or \"\\\n\n \" 'SEED_FROM_BOTH' \"%str(seedingStrategy))\n\n\n\n pGenSettings.sigma = float(sigma)\n\n pGenSettings.numberOfSeeds = float(numberOfSeeds)\n\n pGenSettings.seedingStrategy = enumVal\n\n\n\n return pGenCls(pGenSettings)\n\n\n\n O.watershedProposalGenerator = staticmethod(watershedProposalGenerator)\n\n\n\n\n\n def fusionMoveBasedFactory(proposalGenerator=None, numberOfThreads=1,\n\n numberOfIterations=1000, stopIfNoImprovement=100):\n\n \"\"\"factory function for a fusion move based lifted\n\n multicut solver\n\n\n\n Args:\n\n proposalGenerator (None, optional): Proposal generator (default watershedProposalGenerator)\n\n numberOfThreads (int, optional): (default 1)\n\n numberOfIterations (int, optional): Maximum number of iterations(default 1000)\n\n stopIfNoImprovement (int, optional): Stop after n iterations without improvement (default 100)\n\n\n\n Returns:\n\n TYPE: Description\n\n \"\"\"\n\n if proposalGenerator is None:\n\n proposalGenerator = watershedProposalGenerator()\n\n s,F = getSettingsAndFactoryCls(\"FusionMoveBased\")\n\n s.proposalGenerator = proposalGenerator\n\n s.numberOfThreads = int(numberOfThreads)\n\n s.numberOfIterations = int(numberOfIterations)\n\n s.stopIfNoImprovement = int(stopIfNoImprovement)\n\n return F(s)\n\n\n\n O.fusionMoveBasedFactory = staticmethod(fusionMoveBasedFactory)\n\n\n\n\n\n def liftedMulticutGreedyAdditiveFactory(weightStopCond=0.0, nodeNumStopCond=-1.0):\n\n s,F = getSettingsAndFactoryCls(\"LiftedMulticutGreedyAdditive\")\n\n s.weightStopCond = float(weightStopCond)\n\n s.nodeNumStopCond = float(nodeNumStopCond)\n\n return F(s)\n\n O.liftedMulticutGreedyAdditiveFactory = staticmethod(liftedMulticutGreedyAdditiveFactory)\n\n\n\n\n\n def liftedMulticutKernighanLinFactory(numberOfOuterIterations=1000000,\n\n numberOfInnerIterations=100,\n\n epsilon=1e-7):\n\n s,F = getSettingsAndFactoryCls(\"LiftedMulticutKernighanLin\")\n\n s.numberOfOuterIterations = int(numberOfOuterIterations)\n\n s.numberOfInnerIterations = int(numberOfInnerIterations)\n\n s.epsilon = float(epsilon)\n\n return F(s)\n\n O.liftedMulticutKernighanLinFactory = staticmethod(liftedMulticutKernighanLinFactory)\n\n\n\n\n\n if Configuration.WITH_LP_MP:\n\n def liftedMulticutMpFactory(\n\n lmcFactory = None,\n\n greedyWarmstart = False,\n\n tightenSlope = 0.05,\n\n tightenMinDualImprovementInterval = 0,\n\n tightenMinDualImprovement = 0.,\n\n tightenConstraintsPercentage = 0.1,\n\n tightenConstraintsMax = 0,\n\n tightenInterval = 10,\n\n tightenIteration = 100,\n\n tightenReparametrization = \"anisotropic\",\n\n roundingReparametrization = \"anisotropic\",\n\n standardReparametrization = \"anisotropic\",\n\n tighten = True,\n\n minDualImprovementInterval = 0,\n\n minDualImprovement = 0.,\n\n lowerBoundComputationInterval = 1,\n\n primalComputationInterval = 5,\n\n timeout = 0,\n\n maxIter = 1000,\n\n numThreads = 1\n\n ):\n\n\n\n s, F = getSettingsAndFactoryCls(\"LiftedMulticutMp\")\n\n if lmcFactory is None:\n\n lmcFactory = LiftedMulticutObjectiveUndirectedGraph.liftedMulticutKernighanLinFactory()\n\n\n\n s.lmcFactory = lmcFactory\n\n s.greedyWarmstart = greedyWarmstart\n\n return F(s)\n\n O.liftedMulticutMpFactory = staticmethod(liftedMulticutMpFactory)\n\n\n\n\n\n def liftedMulticutIlpFactory(verbose=0, addThreeCyclesConstraints=True,\n\n addOnlyViolatedThreeCyclesConstraints=True,\n\n relativeGap=0.0, absoluteGap=0.0, memLimit=-1.0,\n\n ilpSolver = 'cplex'):\n\n\n\n if ilpSolver == 'cplex':\n\n s,F = getSettingsAndFactoryCls(\"LiftedMulticutIlpCplex\")\n\n elif ilpSolver == 'gurobi':\n\n s,F = getSettingsAndFactoryCls(\"LiftedMulticutIlpGurobi\")\n\n elif ilpSolver == 'glpk':\n\n s,F = getSettingsAndFactoryCls(\"LiftedMulticutIlpGlpk\")\n\n else:\n\n raise RuntimeError(\"%s is an unknown ilp solver\"%str(ilpSolver))\n\n s.verbose = int(verbose)\n\n s.addThreeCyclesConstraints = bool(addThreeCyclesConstraints)\n\n s.addOnlyViolatedThreeCyclesConstraints = bool(addOnlyViolatedThreeCyclesConstraints)\n\n s.ilpSettings = ilpSettings(relativeGap=relativeGap, absoluteGap=absoluteGap, memLimit=memLimit)\n\n return F(s)\n\n\n\n O.liftedMulticutIlpFactory = staticmethod(liftedMulticutIlpFactory)\n\n O.liftedMulticutIlpCplexFactory = staticmethod(partial(liftedMulticutIlpFactory,ilpSolver='cplex'))\n\n O.liftedMulticutIlpGurobiFactory = staticmethod(partial(liftedMulticutIlpFactory,ilpSolver='gurobi'))\n\n O.liftedMulticutIlpGlpkFactory = staticmethod(partial(liftedMulticutIlpFactory,ilpSolver='glpk'))\n\n\n\n\n\n__extendLiftedMulticutObj(LiftedMulticutObjectiveUndirectedGraph,\n\n \"LiftedMulticutObjectiveUndirectedGraph\")\n\n\n\n__extendLiftedMulticutObj(LiftedMulticutObjectiveUndirectedGridGraph2DSimpleNh,\n\n \"LiftedMulticutObjectiveUndirectedGridGraph2DSimpleNh\")\n\n\n\n__extendLiftedMulticutObj(LiftedMulticutObjectiveUndirectedGridGraph3DSimpleNh,\n\n \"LiftedMulticutObjectiveUndirectedGridGraph2DSimpleNh\")\n\n\n\ndel __extendLiftedMulticutObj\n", "file_path": "src/python/module/nifty/graph/opt/lifted_multicut/__init__.py", "rank": 9, "score": 118333.25386483718 }, { "content": " def minstcutVerboseVisitor(visitNth=1,timeLimit=0):\n\n V = getSolverCls(\"VerboseVisitor\")\n", "file_path": "src/python/module/nifty/graph/opt/minstcut/__init__.py", "rank": 10, "score": 118007.54092408142 }, { "content": " def mincutVerboseVisitor(visitNth=1,timeLimit=0):\n\n V = getSolverCls(\"VerboseVisitor\")\n", "file_path": "src/python/module/nifty/graph/opt/mincut/__init__.py", "rank": 11, "score": 118007.54092408142 }, { "content": " def chainedSolversFactory(multicutFactories):\n\n s,F = getSettingsAndFactoryCls(\"ChainedSolvers\")\n\n s.multicutFactories = multicutFactories\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 12, "score": 117637.59094860284 }, { "content": " def getSolverCls(baseName):\n\n S = getCls(baseName,objectiveName)\n", "file_path": "src/python/module/nifty/graph/opt/mincut/__init__.py", "rank": 13, "score": 117637.59094860285 }, { "content": " def getSolverCls(baseName):\n\n S = getCls(baseName,objectiveName)\n", "file_path": "src/python/module/nifty/graph/opt/minstcut/__init__.py", "rank": 14, "score": 117637.59094860284 }, { "content": " def chainedSolversFactory(factories):\n\n s,F = getSettingsAndFactoryCls(\"ChainedSolvers\")\n\n s.factories = factories\n", "file_path": "src/python/module/nifty/graph/opt/lifted_multicut/__init__.py", "rank": 15, "score": 115702.18430234822 }, { "content": " def implTestSimpleChainModelOpt(self, size, ilpSolver):\n\n if nifty.Configuration.WITH_CPLEX:\n\n # 0 - 1 - 2 - 3\n\n #\n\n G = nifty.graph.UndirectedGraph\n\n g = G(size)\n\n for x in range(size - 1):\n\n g.insertEdge(x, x+1)\n\n\n\n obj = nifty.graph.lifted_multicut.liftedMulticutObjective(g)\n\n graph = obj.graph\n\n liftedGraph = obj.liftedGraph\n\n\n\n for x in range(size - 1):\n\n w = 1.0\n\n obj.setCost(x, x+1, w)\n\n\n\n w = -1.0 * float(size)\n\n obj.setCost(0, size-1, w)\n\n\n\n solverFactory = obj.liftedMulticutIlpFactory(ilpSolver=ilpSolver)\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n arg = solver.optimize()\n\n\n", "file_path": "src/python/test/graph/lifted_multicut/test_lifted_multicut_solvers.py", "rank": 16, "score": 105600.79814603365 }, { "content": "import unittest\n\nimport random\n\nimport numpy\n\n\n\nimport nifty\n\nimport nifty.graph\n\nimport nifty.graph.opt.minstcut\n\n\n\n\n\nclass TestMinstcutSolver(unittest.TestCase):\n\n def setUp(self):\n\n numpy.random.seed(7)\n\n\n\n def generateGrid(self, gridSize):\n\n def nid(x, y):\n\n return x*gridSize[1] + y\n\n G = nifty.graph.UndirectedGraph\n\n g = G(gridSize[0] * gridSize[1])\n\n for x in range(gridSize[0]):\n\n for y in range(gridSize[1]):\n\n\n\n u = nid(x,y)\n\n\n\n if x + 1 < gridSize[0]:\n\n\n\n v = nid(x+1, y)\n\n g.insertEdge(u, v)\n\n\n\n if y + 1 < gridSize[1]:\n\n\n\n v = nid(x, y+1)\n\n g.insertEdge(u, v)\n\n return g, nid\n\n\n\n def gridModel(self):\n\n\n\n beta = .7\n\n gridSize = [5,5]\n\n weightRange = [0,1]\n\n\n\n g,nid = self.generateGrid(gridSize)\n\n d = weightRange[1] - weightRange[0]\n\n\n\n w = numpy.zeros(g.numberOfEdges)\n\n u = numpy.zeros((g.numberOfNodes,2))\n\n\n\n labels = numpy.zeros(g.nodeIdUpperBound+1,dtype='uint8')\n\n\n\n for x in range(gridSize[0]):\n\n for y in range(gridSize[1]):\n\n\n\n nodeId = nid(x,y)\n\n if x in range(1,gridSize[0] - 1):\n\n if y in range(1,gridSize[1] - 1):\n\n u[nodeId,0] = .1\n\n u[nodeId,1] = .9\n\n labels[nodeId] = 1\n\n else:\n\n u[nodeId,0] = .9\n\n u[nodeId,1] = .1\n\n labels[nodeId] = 0\n\n else:\n\n u[nodeId,0] = .9\n\n u[nodeId,1] = .1\n\n labels[nodeId] = 0\n\n\n\n for x in range(gridSize[0]):\n\n for y in range(gridSize[1]):\n\n\n\n p = nid(x,y)\n\n\n\n if x + 1 < gridSize[0]:\n\n q = nid(x+1,y)\n\n weightId = g.findEdge(p,q)\n\n if (u[p,0] == u[q,0]):\n\n w[weightId] = 0\n\n else:\n\n w[weightId] = beta\n\n if y + 1 < gridSize[1]:\n\n q = nid(x, y + 1)\n\n weightId = g.findEdge(p,q)\n\n if (u[p,0] == u[q,0]):\n\n w[weightId] = 0\n\n else:\n\n w[weightId] = beta\n\n\n\n obj = nifty.graph.opt.minstcut.minstcutObjective(g,w)\n\n\n\n return obj\n\n\n\n\n\nif __name__ == '__main__':\n\n unittest.main()\n", "file_path": "src/python/test/graph/minstcut/test_minstcut_solvers.py", "rank": 17, "score": 103569.75410541774 }, { "content": "import unittest\n\nimport random\n\nimport numpy\n\n\n\nimport nifty\n\nimport nifty.graph\n\nimport nifty.graph.opt.mincut\n\n\n\n\n\nclass TestMincutSolver(unittest.TestCase):\n\n def setUp(self):\n\n numpy.random.seed(7)\n\n\n\n def generateGrid(self, gridSize):\n\n def nid(x, y):\n\n return x*gridSize[1] + y\n\n G = nifty.graph.UndirectedGraph\n\n g = G(gridSize[0] * gridSize[1])\n\n for x in range(gridSize[0]):\n\n for y in range(gridSize[1]):\n\n\n\n u = nid(x,y)\n\n\n\n if x + 1 < gridSize[0]:\n\n\n\n v = nid(x+1, y)\n\n g.insertEdge(u, v)\n\n\n\n if y + 1 < gridSize[1]:\n\n\n\n v = nid(x, y+1)\n\n g.insertEdge(u, v)\n\n\n\n return g, nid\n\n\n\n def gridModel(self, gridSize = [5,5], weightRange = [-2,1]):\n\n g,nid = self.generateGrid(gridSize)\n\n d = weightRange[1] - weightRange[0]\n\n w = numpy.random.rand(g.numberOfEdges)*d + float(weightRange[0])\n\n print(w.min(),w.max())\n\n obj = nifty.graph.opt.mincut.mincutObjective(g,w)\n\n return obj\n\n\n\n @unittest.skipUnless(nifty.Configuration.WITH_QPBO, \"need qpbo\")\n\n def testMincutQpbo(self):\n\n objective = self.gridModel(gridSize=[4,4])\n\n solver = objective.mincutQpboFactory(improve=False).create(objective)\n\n visitor = objective.verboseVisitor(1)\n\n arg = solver.optimize(visitor)\n\n\n\n @unittest.skipUnless(nifty.Configuration.WITH_QPBO, \"need qpbo\")\n\n def testMincutQpboImprove(self):\n\n objective = self.gridModel(gridSize=[8,8])\n\n solver = objective.mincutQpboFactory(improve=True).create(objective)\n\n visitor = objective.verboseVisitor(1)\n\n arg = numpy.zeros(4,dtype='uint8')\n\n arg = solver.optimize(visitor)\n\n\n\n\n\nif __name__ == '__main__':\n\n unittest.main()\n", "file_path": "src/python/test/graph/mincut/test_mincut_solvers.py", "rank": 18, "score": 103569.75410541774 }, { "content": "import unittest\n\nimport random\n\nimport numpy\n\nimport nifty\n\nimport nifty.graph\n\n\n\n\n\nclass TestLiftedMulticutSolver(unittest.TestCase):\n\n def setUp(self):\n\n numpy.random.seed(7)\n\n\n\n def generateGrid(self, gridSize):\n\n def nid(x, y):\n\n return x*gridSize[1] + y\n\n G = nifty.graph.UndirectedGraph\n\n g = G(gridSize[0] * gridSize[1])\n\n for x in range(gridSize[0]):\n\n for y in range(gridSize[1]):\n\n\n\n u = nid(x,y)\n\n\n\n if x + 1 < gridSize[0]:\n\n\n\n v = nid(x+1, y)\n\n g.insertEdge(u, v)\n\n\n\n if y + 1 < gridSize[1]:\n\n\n\n v = nid(x, y+1)\n\n g.insertEdge(u, v)\n\n return g, nid\n\n\n\n def gridModel(self, gridSize = [5,5], weightRange = [-2,1]):\n\n g,nid = self.generateGrid(gridSize)\n\n d = weightRange[1] - weightRange[0]\n\n w = numpy.random.rand(g.numberOfEdges)*d + float(weightRange[0])\n\n # print(w.min(),w.max())\n\n obj = nifty.graph.multicut.multicutObjective(g,w)\n\n return obj\n\n\n\n def _testGridModelImpl(self, factory, gridSize=[6,6]):\n\n\n\n objective = self.gridModel(gridSize=gridSize)\n\n\n\n # with verbose visitor\n\n solver = factory.create(objective)\n\n visitor = objective.verboseVisitor(1000)\n\n\n\n self.assertEqual(visitor.timeLimitTotal, float('inf'))\n\n self.assertEqual(visitor.timeLimitSolver, float('inf'))\n\n\n\n arg = solver.optimize(visitor)\n\n\n\n self.assertEqual(visitor.timeLimitTotal, float('inf'))\n\n self.assertEqual(visitor.timeLimitSolver, float('inf'))\n\n\n\n # with verbose visitor\n\n solver = factory.create(objective)\n\n visitor = objective.verboseVisitor(1)\n\n\n\n self.assertEqual(visitor.timeLimitTotal, float('inf'))\n\n self.assertEqual(visitor.timeLimitSolver, float('inf'))\n\n\n\n arg = solver.optimize(visitor)\n\n\n\n self.assertEqual(visitor.timeLimitTotal, float('inf'))\n\n self.assertEqual(visitor.timeLimitSolver, float('inf'))\n\n\n\n # without any visitor\n\n solver = factory.create(objective)\n\n arg = solver.optimize()\n\n\n\n @unittest.skipUnless(nifty.Configuration.WITH_QPBO, \"need qpbo\")\n\n def testCgc(self):\n\n objective = self.gridModel(gridSize=[6,6])\n\n solver = objective.cgcFactory(True,True).create(objective)\n\n visitor = objective.verboseVisitor(1)\n\n arg = solver.optimize(visitor)\n\n\n\n def testGreedyAdditive(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n\n self._testGridModelImpl(Obj.greedyAdditiveFactory(), gridSize=[6,6])\n\n\n\n def testDefault(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n\n self._testGridModelImpl(Obj.defaultFactory(), gridSize=[6,6])\n\n\n\n def testMulticutDecomposer(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n\n self._testGridModelImpl(Obj.multicutDecomposerFactory(), gridSize=[6,6])\n\n\n\n def testChainedSolvers(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n\n a = Obj.greedyAdditiveFactory()\n\n b = Obj.defaultFactory()\n\n c = Obj.multicutDecomposerFactory()\n\n self._testGridModelImpl(Obj.chainedSolversFactory([a,b,c]), gridSize=[6,6])\n\n\n\n def testCcFusionMoveBasedFactory(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n\n self._testGridModelImpl(Obj.ccFusionMoveBasedFactory(), gridSize=[10,10])\n\n\n\n self._testGridModelImpl(\n\n Obj.ccFusionMoveBasedFactory(proposalGenerator= Obj.watershedCcProposals()),\n\n gridSize=[10,10])\n\n\n\n self._testGridModelImpl(\n\n Obj.ccFusionMoveBasedFactory(proposalGenerator= Obj.interfaceFlipperCcProposals()),\n\n gridSize=[10,10])\n\n\n\n self._testGridModelImpl(\n\n Obj.ccFusionMoveBasedFactory(proposalGenerator= Obj.randomNodeColorCcProposals()),\n\n gridSize=[10,10])\n\n\n\n @unittest.skipUnless(nifty.Configuration.WITH_CPLEX, \"need cplex\")\n\n def testMulticutIlpCplex(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n\n self._testGridModelImpl(Obj.multicutIlpCplexFactory(), gridSize=[5,5])\n\n\n\n @unittest.skipUnless(nifty.Configuration.WITH_GUROBI, \"need gurobi\")\n\n def testMulticutIlpGurobi(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n\n self._testGridModelImpl(Obj.multicutIlpGurobiFactory(), gridSize=[5,5])\n\n\n\n @unittest.skipUnless(nifty.Configuration.WITH_GLPK, \"need glpk\")\n\n def testMulticutIlpGlpk(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n\n objective = self.gridModel(gridSize=[4,5])\n\n factory = Obj.multicutIlpGlpkFactory()\n\n solver = factory.create(objective)\n\n visitor = objective.verboseVisitor(1000)\n\n self.assertEqual(visitor.timeLimitTotal, float('inf'))\n\n self.assertEqual(visitor.timeLimitSolver, float('inf'))\n\n arg = solver.optimize(visitor)\n\n\n\n\n\nif __name__ == '__main__':\n\n unittest.main()\n", "file_path": "src/python/test/graph/multicut/test_multicut_solvers.py", "rank": 19, "score": 103569.75410541774 }, { "content": "from __future__ import print_function\n\nimport unittest\n\nimport random\n\n\n\nimport numpy\n\nimport nifty\n\nimport nifty.graph\n\n\n\n\n\nclass TestLiftedMulticutSolver(unittest.TestCase):\n\n\n\n def generateGrid(self, gridSize):\n\n def nid(x, y):\n\n return x*gridSize[1] + y\n\n G = nifty.graph.UndirectedGraph\n\n g = G(gridSize[0] * gridSize[1])\n\n for x in range(gridSize[0]):\n\n for y in range(gridSize[1]):\n\n\n\n u = nid(x,y)\n\n\n\n if x + 1 < gridSize[0]:\n\n\n\n v = nid(x+1, y)\n\n g.insertEdge(u, v)\n\n\n\n if y + 1 < gridSize[1]:\n\n\n\n v = nid(x, y+1)\n\n g.insertEdge(u, v)\n\n\n\n return g, nid\n\n\n\n def gridLiftedModel(self, gridSize=[3, 2], bfsRadius=2, weightRange=[-1, 1]):\n\n g,nid = self.generateGrid(gridSize)\n\n obj = nifty.graph.lifted_multicut.liftedMulticutObjective(g)\n\n graph = obj.graph\n\n liftedGraph = obj.liftedGraph\n\n\n\n\n\n # this should add edges\n\n obj.insertLiftedEdgesBfs(bfsRadius)\n\n postEdges = liftedGraph.numberOfEdges\n\n\n\n\n\n for edge in liftedGraph.edges():\n\n u,v = liftedGraph.uv(edge)\n\n w = random.uniform(weightRange[0],weightRange[1])\n\n obj.setCost(u, v, w)\n\n\n\n return obj,nid\n\n\n\n def testLiftedMulticutGreedyAdditive(self):\n\n for x in range(5):\n\n obj,nid = self.gridLiftedModel(gridSize=[40,40] , bfsRadius=4, weightRange=[-1,1])\n\n\n\n\n\n solverFactory = obj.liftedMulticutGreedyAdditiveFactory()\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n argN = solver.optimize()\n\n\n\n if False:\n\n solverFactory = obj.liftedMulticutAndresGreedyAdditiveFactory()\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n argA = solver.optimize()\n\n\n\n self.assertAlmostEqual(obj.evalNodeLabels(argA), obj.evalNodeLabels(argN))\n\n\n\n def testLiftedMulticutKernighanLinSimple(self):\n\n G = nifty.graph.UndirectedGraph\n\n g = G(5);\n\n g.insertEdge(0, 1) # 0\n\n g.insertEdge(0, 3) # 1\n\n g.insertEdge(1, 2) # 2\n\n g.insertEdge(1, 4) #\n\n g.insertEdge(3, 4) # 4\n\n\n\n obj = nifty.graph.lifted_multicut.liftedMulticutObjective(g)\n\n lg = obj.liftedGraph\n\n\n\n obj.setCost(0, 1, 10.0)\n\n obj.setCost(0, 2, -1.0)\n\n obj.setCost(0, 3, -1.0)\n\n obj.setCost(0, 4, -1.0)\n\n obj.setCost(1, 2, 10.0)\n\n obj.setCost(1, 3, -1.0)\n\n obj.setCost(1, 4, 4.0)\n\n obj.setCost(2, 3, -1.0)\n\n obj.setCost(2, 4, -1.0)\n\n obj.setCost(3, 4, 10.0)\n\n\n\n arg = numpy.array([1,2,3,4,5])\n\n solverFactory = obj.liftedMulticutKernighanLinFactory()\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n\n\n arg2 = solver.optimize(visitor,arg)\n\n\n\n self.assertEqual(arg2[0] != arg2[1], bool(0))\n\n self.assertEqual(arg2[0] != arg2[2], bool(0))\n\n self.assertEqual(arg2[0] != arg2[3], bool(1))\n\n self.assertEqual(arg2[0] != arg2[4], bool(1))\n\n self.assertEqual(arg2[1] != arg2[2], bool(0))\n\n self.assertEqual(arg2[1] != arg2[3], bool(1))\n\n self.assertEqual(arg2[1] != arg2[4], bool(1))\n\n self.assertEqual(arg2[2] != arg2[3], bool(1))\n\n self.assertEqual(arg2[2] != arg2[4], bool(1))\n\n self.assertEqual(arg2[3] != arg2[4], bool(0))\n\n\n\n def testLiftedMulticutKernighanLin(self):\n\n gridSize = [5, 5]\n\n for x in range(4):\n\n obj,nid = self.gridLiftedModel(gridSize=gridSize , bfsRadius=2, weightRange=[-3,1])\n\n\n\n solverFactory = obj.liftedMulticutGreedyAdditiveFactory()\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n arg = solver.optimize()\n\n argGC = arg.copy()\n\n egc = obj.evalNodeLabels(argGC)\n\n\n\n #arg = numpy.arange(gridSize[0]*gridSize[1])\n\n solverFactory = obj.liftedMulticutKernighanLinFactory()\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n arg2 = solver.optimize(argGC.copy())\n\n ekl = obj.evalNodeLabels(arg2)\n\n\n\n if False:\n\n solverFactory = obj.liftedMulticutAndresKernighanLinFactory()\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n arg3 = solver.optimize(argGC.copy())\n\n eakl = obj.evalNodeLabels(arg3)\n\n\n\n self.assertLessEqual(ekl, egc)\n\n self.assertAlmostEqual(ekl, eakl)\n\n\n\n for x in range(4):\n\n obj,nid = self.gridLiftedModel(gridSize=gridSize , bfsRadius=2, weightRange=[-3,1])\n\n\n\n arg = numpy.arange(gridSize[0]*gridSize[1])\n\n\n\n solverFactory = obj.liftedMulticutKernighanLinFactory()\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n arg2 = solver.optimize(arg.copy())\n\n ekl = obj.evalNodeLabels(arg2)\n\n\n\n if False:\n\n solverFactory = obj.liftedMulticutAndresKernighanLinFactory()\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n arg3 = solver.optimize(arg.copy())\n\n eakl = obj.evalNodeLabels(arg3)\n\n\n\n self.assertAlmostEqual(ekl, eakl)\n\n\n\n def testLiftedMulticutSolverFm(self):\n\n random.seed(0)\n\n for x in range(1):\n\n obj, nid = self.gridLiftedModel(gridSize=[40,40] , bfsRadius=4, weightRange=[-1,1])\n\n\n\n pgen = obj.watershedProposalGenerator(sigma=1.0,\n\n seedingStrategy='SEED_FROM_LOCAL',\n\n numberOfSeeds=0.1)\n\n # print(x)\n\n\n\n solverFactory = obj.fusionMoveBasedFactory()\n\n solverFactory = obj.fusionMoveBasedFactory(proposalGenerator=pgen,\n\n numberOfIterations=100,\n\n stopIfNoImprovement=10)\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n argN = solver.optimize(visitor)\n\n\n\n def implTestLiftedMulticutIlpBfsGrid(self, ilpSolver,\n\n gridSize=[4,4], bfsRadius=4,\n\n weightRange=[-2,1], verbose=0,\n\n relativeGap=0.00001):\n\n\n\n obj,nid = self.gridLiftedModel(gridSize=gridSize,\n\n bfsRadius=bfsRadius,\n\n weightRange=weightRange)\n\n solverFactory = obj.liftedMulticutIlpFactory(ilpSolver=ilpSolver,\n\n relativeGap=relativeGap)\n\n solver = solverFactory.create(obj)\n\n if verbose > 0:\n\n visitor = obj.verboseVisitor(100)\n\n arg = solver.optimize(visitor=visitor)\n\n else:\n\n arg = solver.optimize()\n\n\n\n def testLiftedMulticutIlpBfsGrid(self):\n\n if nifty.Configuration.WITH_GLPK:\n\n for x in range(5):\n\n self.implTestLiftedMulticutIlpBfsGrid(ilpSolver='glpk', gridSize=[3,3],\n\n relativeGap=0.3,\n\n weightRange=(-2,1))\n\n if nifty.Configuration.WITH_CPLEX:\n\n for x in range(5):\n\n self.implTestLiftedMulticutIlpBfsGrid(ilpSolver='cplex', gridSize=[3,3],\n\n relativeGap=0.3,\n\n verbose=0, weightRange=(-2,1))\n\n if nifty.Configuration.WITH_GUROBI:\n\n for x in range(5):\n\n self.implTestLiftedMulticutIlpBfsGrid(ilpSolver='gurobi')\n\n\n\n def implTestSimpleChainModelOpt(self, size, ilpSolver):\n\n if nifty.Configuration.WITH_CPLEX:\n\n # 0 - 1 - 2 - 3\n\n #\n\n G = nifty.graph.UndirectedGraph\n\n g = G(size)\n\n for x in range(size - 1):\n\n g.insertEdge(x, x+1)\n\n\n\n obj = nifty.graph.lifted_multicut.liftedMulticutObjective(g)\n\n graph = obj.graph\n\n liftedGraph = obj.liftedGraph\n\n\n\n for x in range(size - 1):\n\n w = 1.0\n\n obj.setCost(x, x+1, w)\n\n\n\n w = -1.0 * float(size)\n\n obj.setCost(0, size-1, w)\n\n\n\n solverFactory = obj.liftedMulticutIlpFactory(ilpSolver=ilpSolver)\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n arg = solver.optimize()\n\n\n\n self.assertNotEqual(arg[0],arg[size-1])\n\n\n\n def testSimpleChainModelMulticutGlpk(self):\n\n if False and nifty.Configuration.WITH_GLPK:\n\n for x in range(10):\n\n self.implTestSimpleChainModelOpt(ilpSolver='glpk', size=4)\n\n\n\n def testSimpleChainModelMulticutGurobi(self):\n\n if nifty.Configuration.WITH_GUROBI:\n\n for x in range(10):\n\n self.implTestSimpleChainModelOpt(ilpSolver='gurobi', size=4)\n\n\n\n def testSimpleChainModelMulticutCplex(self):\n\n if nifty.Configuration.WITH_CPLEX:\n\n for x in range(10):\n\n self.implTestSimpleChainModelOpt(ilpSolver='cplex', size=4)\n\n\n\n\n\nif __name__ == '__main__':\n\n unittest.main()\n", "file_path": "src/python/test/graph/lifted_multicut/test_lifted_multicut_solvers.py", "rank": 20, "score": 100613.56426350457 }, { "content": " def testChainedSolvers(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n\n a = Obj.greedyAdditiveFactory()\n\n b = Obj.defaultFactory()\n\n c = Obj.multicutDecomposerFactory()\n", "file_path": "src/python/test/graph/multicut/test_multicut_solvers.py", "rank": 21, "score": 89377.12477706277 }, { "content": "class TestMinstcutSolver(unittest.TestCase):\n\n def setUp(self):\n\n numpy.random.seed(7)\n\n\n\n def generateGrid(self, gridSize):\n\n def nid(x, y):\n\n return x*gridSize[1] + y\n\n G = nifty.graph.UndirectedGraph\n\n g = G(gridSize[0] * gridSize[1])\n\n for x in range(gridSize[0]):\n\n for y in range(gridSize[1]):\n\n\n\n u = nid(x,y)\n\n\n\n if x + 1 < gridSize[0]:\n\n\n\n v = nid(x+1, y)\n\n g.insertEdge(u, v)\n\n\n\n if y + 1 < gridSize[1]:\n\n\n\n v = nid(x, y+1)\n\n g.insertEdge(u, v)\n\n return g, nid\n\n\n\n def gridModel(self):\n\n\n\n beta = .7\n\n gridSize = [5,5]\n\n weightRange = [0,1]\n\n\n\n g,nid = self.generateGrid(gridSize)\n\n d = weightRange[1] - weightRange[0]\n\n\n\n w = numpy.zeros(g.numberOfEdges)\n\n u = numpy.zeros((g.numberOfNodes,2))\n\n\n\n labels = numpy.zeros(g.nodeIdUpperBound+1,dtype='uint8')\n\n\n\n for x in range(gridSize[0]):\n\n for y in range(gridSize[1]):\n\n\n\n nodeId = nid(x,y)\n\n if x in range(1,gridSize[0] - 1):\n\n if y in range(1,gridSize[1] - 1):\n\n u[nodeId,0] = .1\n\n u[nodeId,1] = .9\n\n labels[nodeId] = 1\n\n else:\n\n u[nodeId,0] = .9\n\n u[nodeId,1] = .1\n\n labels[nodeId] = 0\n\n else:\n\n u[nodeId,0] = .9\n\n u[nodeId,1] = .1\n\n labels[nodeId] = 0\n\n\n\n for x in range(gridSize[0]):\n\n for y in range(gridSize[1]):\n\n\n\n p = nid(x,y)\n\n\n\n if x + 1 < gridSize[0]:\n\n q = nid(x+1,y)\n\n weightId = g.findEdge(p,q)\n\n if (u[p,0] == u[q,0]):\n\n w[weightId] = 0\n\n else:\n\n w[weightId] = beta\n\n if y + 1 < gridSize[1]:\n\n q = nid(x, y + 1)\n\n weightId = g.findEdge(p,q)\n\n if (u[p,0] == u[q,0]):\n\n w[weightId] = 0\n\n else:\n\n w[weightId] = beta\n\n\n\n obj = nifty.graph.opt.minstcut.minstcutObjective(g,w)\n\n\n", "file_path": "src/python/test/graph/minstcut/test_minstcut_solvers.py", "rank": 22, "score": 89377.12477706275 }, { "content": "class TestMincutSolver(unittest.TestCase):\n\n def setUp(self):\n\n numpy.random.seed(7)\n\n\n\n def generateGrid(self, gridSize):\n\n def nid(x, y):\n\n return x*gridSize[1] + y\n\n G = nifty.graph.UndirectedGraph\n\n g = G(gridSize[0] * gridSize[1])\n\n for x in range(gridSize[0]):\n\n for y in range(gridSize[1]):\n\n\n\n u = nid(x,y)\n\n\n\n if x + 1 < gridSize[0]:\n\n\n\n v = nid(x+1, y)\n\n g.insertEdge(u, v)\n\n\n\n if y + 1 < gridSize[1]:\n\n\n\n v = nid(x, y+1)\n\n g.insertEdge(u, v)\n\n\n\n return g, nid\n\n\n\n def gridModel(self, gridSize = [5,5], weightRange = [-2,1]):\n\n g,nid = self.generateGrid(gridSize)\n\n d = weightRange[1] - weightRange[0]\n\n w = numpy.random.rand(g.numberOfEdges)*d + float(weightRange[0])\n\n print(w.min(),w.max())\n\n obj = nifty.graph.opt.mincut.mincutObjective(g,w)\n\n return obj\n\n\n\n @unittest.skipUnless(nifty.Configuration.WITH_QPBO, \"need qpbo\")\n\n def testMincutQpbo(self):\n\n objective = self.gridModel(gridSize=[4,4])\n\n solver = objective.mincutQpboFactory(improve=False).create(objective)\n\n visitor = objective.verboseVisitor(1)\n\n arg = solver.optimize(visitor)\n\n\n\n @unittest.skipUnless(nifty.Configuration.WITH_QPBO, \"need qpbo\")\n\n def testMincutQpboImprove(self):\n\n objective = self.gridModel(gridSize=[8,8])\n\n solver = objective.mincutQpboFactory(improve=True).create(objective)\n\n visitor = objective.verboseVisitor(1)\n\n arg = numpy.zeros(4,dtype='uint8')\n", "file_path": "src/python/test/graph/mincut/test_mincut_solvers.py", "rank": 23, "score": 89377.12477706275 }, { "content": "class TestLiftedMulticutSolver(unittest.TestCase):\n\n def setUp(self):\n\n numpy.random.seed(7)\n\n\n\n def generateGrid(self, gridSize):\n\n def nid(x, y):\n\n return x*gridSize[1] + y\n\n G = nifty.graph.UndirectedGraph\n\n g = G(gridSize[0] * gridSize[1])\n\n for x in range(gridSize[0]):\n\n for y in range(gridSize[1]):\n\n\n\n u = nid(x,y)\n\n\n\n if x + 1 < gridSize[0]:\n\n\n\n v = nid(x+1, y)\n\n g.insertEdge(u, v)\n\n\n\n if y + 1 < gridSize[1]:\n\n\n\n v = nid(x, y+1)\n\n g.insertEdge(u, v)\n\n return g, nid\n\n\n\n def gridModel(self, gridSize = [5,5], weightRange = [-2,1]):\n\n g,nid = self.generateGrid(gridSize)\n\n d = weightRange[1] - weightRange[0]\n\n w = numpy.random.rand(g.numberOfEdges)*d + float(weightRange[0])\n\n # print(w.min(),w.max())\n\n obj = nifty.graph.multicut.multicutObjective(g,w)\n\n return obj\n\n\n\n def _testGridModelImpl(self, factory, gridSize=[6,6]):\n\n\n\n objective = self.gridModel(gridSize=gridSize)\n\n\n\n # with verbose visitor\n\n solver = factory.create(objective)\n\n visitor = objective.verboseVisitor(1000)\n\n\n\n self.assertEqual(visitor.timeLimitTotal, float('inf'))\n\n self.assertEqual(visitor.timeLimitSolver, float('inf'))\n\n\n\n arg = solver.optimize(visitor)\n\n\n\n self.assertEqual(visitor.timeLimitTotal, float('inf'))\n\n self.assertEqual(visitor.timeLimitSolver, float('inf'))\n\n\n\n # with verbose visitor\n\n solver = factory.create(objective)\n\n visitor = objective.verboseVisitor(1)\n\n\n\n self.assertEqual(visitor.timeLimitTotal, float('inf'))\n\n self.assertEqual(visitor.timeLimitSolver, float('inf'))\n\n\n\n arg = solver.optimize(visitor)\n\n\n\n self.assertEqual(visitor.timeLimitTotal, float('inf'))\n\n self.assertEqual(visitor.timeLimitSolver, float('inf'))\n\n\n\n # without any visitor\n\n solver = factory.create(objective)\n\n arg = solver.optimize()\n\n\n\n @unittest.skipUnless(nifty.Configuration.WITH_QPBO, \"need qpbo\")\n\n def testCgc(self):\n\n objective = self.gridModel(gridSize=[6,6])\n\n solver = objective.cgcFactory(True,True).create(objective)\n\n visitor = objective.verboseVisitor(1)\n\n arg = solver.optimize(visitor)\n\n\n\n def testGreedyAdditive(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n\n self._testGridModelImpl(Obj.greedyAdditiveFactory(), gridSize=[6,6])\n\n\n\n def testDefault(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n\n self._testGridModelImpl(Obj.defaultFactory(), gridSize=[6,6])\n\n\n\n def testMulticutDecomposer(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n\n self._testGridModelImpl(Obj.multicutDecomposerFactory(), gridSize=[6,6])\n\n\n\n def testChainedSolvers(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n\n a = Obj.greedyAdditiveFactory()\n\n b = Obj.defaultFactory()\n\n c = Obj.multicutDecomposerFactory()\n\n self._testGridModelImpl(Obj.chainedSolversFactory([a,b,c]), gridSize=[6,6])\n\n\n\n def testCcFusionMoveBasedFactory(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n\n self._testGridModelImpl(Obj.ccFusionMoveBasedFactory(), gridSize=[10,10])\n\n\n\n self._testGridModelImpl(\n\n Obj.ccFusionMoveBasedFactory(proposalGenerator= Obj.watershedCcProposals()),\n\n gridSize=[10,10])\n\n\n\n self._testGridModelImpl(\n\n Obj.ccFusionMoveBasedFactory(proposalGenerator= Obj.interfaceFlipperCcProposals()),\n\n gridSize=[10,10])\n\n\n\n self._testGridModelImpl(\n\n Obj.ccFusionMoveBasedFactory(proposalGenerator= Obj.randomNodeColorCcProposals()),\n\n gridSize=[10,10])\n\n\n\n @unittest.skipUnless(nifty.Configuration.WITH_CPLEX, \"need cplex\")\n\n def testMulticutIlpCplex(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n\n self._testGridModelImpl(Obj.multicutIlpCplexFactory(), gridSize=[5,5])\n\n\n\n @unittest.skipUnless(nifty.Configuration.WITH_GUROBI, \"need gurobi\")\n\n def testMulticutIlpGurobi(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n\n self._testGridModelImpl(Obj.multicutIlpGurobiFactory(), gridSize=[5,5])\n\n\n\n @unittest.skipUnless(nifty.Configuration.WITH_GLPK, \"need glpk\")\n\n def testMulticutIlpGlpk(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n\n objective = self.gridModel(gridSize=[4,5])\n\n factory = Obj.multicutIlpGlpkFactory()\n\n solver = factory.create(objective)\n\n visitor = objective.verboseVisitor(1000)\n\n self.assertEqual(visitor.timeLimitTotal, float('inf'))\n\n self.assertEqual(visitor.timeLimitSolver, float('inf'))\n", "file_path": "src/python/test/graph/multicut/test_multicut_solvers.py", "rank": 24, "score": 88127.44331858322 }, { "content": "class TestLiftedMulticutSolver(unittest.TestCase):\n\n\n\n def generateGrid(self, gridSize):\n\n def nid(x, y):\n\n return x*gridSize[1] + y\n\n G = nifty.graph.UndirectedGraph\n\n g = G(gridSize[0] * gridSize[1])\n\n for x in range(gridSize[0]):\n\n for y in range(gridSize[1]):\n\n\n\n u = nid(x,y)\n\n\n\n if x + 1 < gridSize[0]:\n\n\n\n v = nid(x+1, y)\n\n g.insertEdge(u, v)\n\n\n\n if y + 1 < gridSize[1]:\n\n\n\n v = nid(x, y+1)\n\n g.insertEdge(u, v)\n\n\n\n return g, nid\n\n\n\n def gridLiftedModel(self, gridSize=[3, 2], bfsRadius=2, weightRange=[-1, 1]):\n\n g,nid = self.generateGrid(gridSize)\n\n obj = nifty.graph.lifted_multicut.liftedMulticutObjective(g)\n\n graph = obj.graph\n\n liftedGraph = obj.liftedGraph\n\n\n\n\n\n # this should add edges\n\n obj.insertLiftedEdgesBfs(bfsRadius)\n\n postEdges = liftedGraph.numberOfEdges\n\n\n\n\n\n for edge in liftedGraph.edges():\n\n u,v = liftedGraph.uv(edge)\n\n w = random.uniform(weightRange[0],weightRange[1])\n\n obj.setCost(u, v, w)\n\n\n\n return obj,nid\n\n\n\n def testLiftedMulticutGreedyAdditive(self):\n\n for x in range(5):\n\n obj,nid = self.gridLiftedModel(gridSize=[40,40] , bfsRadius=4, weightRange=[-1,1])\n\n\n\n\n\n solverFactory = obj.liftedMulticutGreedyAdditiveFactory()\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n argN = solver.optimize()\n\n\n\n if False:\n\n solverFactory = obj.liftedMulticutAndresGreedyAdditiveFactory()\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n argA = solver.optimize()\n\n\n\n self.assertAlmostEqual(obj.evalNodeLabels(argA), obj.evalNodeLabels(argN))\n\n\n\n def testLiftedMulticutKernighanLinSimple(self):\n\n G = nifty.graph.UndirectedGraph\n\n g = G(5);\n\n g.insertEdge(0, 1) # 0\n\n g.insertEdge(0, 3) # 1\n\n g.insertEdge(1, 2) # 2\n\n g.insertEdge(1, 4) #\n\n g.insertEdge(3, 4) # 4\n\n\n\n obj = nifty.graph.lifted_multicut.liftedMulticutObjective(g)\n\n lg = obj.liftedGraph\n\n\n\n obj.setCost(0, 1, 10.0)\n\n obj.setCost(0, 2, -1.0)\n\n obj.setCost(0, 3, -1.0)\n\n obj.setCost(0, 4, -1.0)\n\n obj.setCost(1, 2, 10.0)\n\n obj.setCost(1, 3, -1.0)\n\n obj.setCost(1, 4, 4.0)\n\n obj.setCost(2, 3, -1.0)\n\n obj.setCost(2, 4, -1.0)\n\n obj.setCost(3, 4, 10.0)\n\n\n\n arg = numpy.array([1,2,3,4,5])\n\n solverFactory = obj.liftedMulticutKernighanLinFactory()\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n\n\n arg2 = solver.optimize(visitor,arg)\n\n\n\n self.assertEqual(arg2[0] != arg2[1], bool(0))\n\n self.assertEqual(arg2[0] != arg2[2], bool(0))\n\n self.assertEqual(arg2[0] != arg2[3], bool(1))\n\n self.assertEqual(arg2[0] != arg2[4], bool(1))\n\n self.assertEqual(arg2[1] != arg2[2], bool(0))\n\n self.assertEqual(arg2[1] != arg2[3], bool(1))\n\n self.assertEqual(arg2[1] != arg2[4], bool(1))\n\n self.assertEqual(arg2[2] != arg2[3], bool(1))\n\n self.assertEqual(arg2[2] != arg2[4], bool(1))\n\n self.assertEqual(arg2[3] != arg2[4], bool(0))\n\n\n\n def testLiftedMulticutKernighanLin(self):\n\n gridSize = [5, 5]\n\n for x in range(4):\n\n obj,nid = self.gridLiftedModel(gridSize=gridSize , bfsRadius=2, weightRange=[-3,1])\n\n\n\n solverFactory = obj.liftedMulticutGreedyAdditiveFactory()\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n arg = solver.optimize()\n\n argGC = arg.copy()\n\n egc = obj.evalNodeLabels(argGC)\n\n\n\n #arg = numpy.arange(gridSize[0]*gridSize[1])\n\n solverFactory = obj.liftedMulticutKernighanLinFactory()\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n arg2 = solver.optimize(argGC.copy())\n\n ekl = obj.evalNodeLabels(arg2)\n\n\n\n if False:\n\n solverFactory = obj.liftedMulticutAndresKernighanLinFactory()\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n arg3 = solver.optimize(argGC.copy())\n\n eakl = obj.evalNodeLabels(arg3)\n\n\n\n self.assertLessEqual(ekl, egc)\n\n self.assertAlmostEqual(ekl, eakl)\n\n\n\n for x in range(4):\n\n obj,nid = self.gridLiftedModel(gridSize=gridSize , bfsRadius=2, weightRange=[-3,1])\n\n\n\n arg = numpy.arange(gridSize[0]*gridSize[1])\n\n\n\n solverFactory = obj.liftedMulticutKernighanLinFactory()\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n arg2 = solver.optimize(arg.copy())\n\n ekl = obj.evalNodeLabels(arg2)\n\n\n\n if False:\n\n solverFactory = obj.liftedMulticutAndresKernighanLinFactory()\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n arg3 = solver.optimize(arg.copy())\n\n eakl = obj.evalNodeLabels(arg3)\n\n\n\n self.assertAlmostEqual(ekl, eakl)\n\n\n\n def testLiftedMulticutSolverFm(self):\n\n random.seed(0)\n\n for x in range(1):\n\n obj, nid = self.gridLiftedModel(gridSize=[40,40] , bfsRadius=4, weightRange=[-1,1])\n\n\n\n pgen = obj.watershedProposalGenerator(sigma=1.0,\n\n seedingStrategy='SEED_FROM_LOCAL',\n\n numberOfSeeds=0.1)\n\n # print(x)\n\n\n\n solverFactory = obj.fusionMoveBasedFactory()\n\n solverFactory = obj.fusionMoveBasedFactory(proposalGenerator=pgen,\n\n numberOfIterations=100,\n\n stopIfNoImprovement=10)\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n argN = solver.optimize(visitor)\n\n\n\n def implTestLiftedMulticutIlpBfsGrid(self, ilpSolver,\n\n gridSize=[4,4], bfsRadius=4,\n\n weightRange=[-2,1], verbose=0,\n\n relativeGap=0.00001):\n\n\n\n obj,nid = self.gridLiftedModel(gridSize=gridSize,\n\n bfsRadius=bfsRadius,\n\n weightRange=weightRange)\n\n solverFactory = obj.liftedMulticutIlpFactory(ilpSolver=ilpSolver,\n\n relativeGap=relativeGap)\n\n solver = solverFactory.create(obj)\n\n if verbose > 0:\n\n visitor = obj.verboseVisitor(100)\n\n arg = solver.optimize(visitor=visitor)\n\n else:\n\n arg = solver.optimize()\n\n\n\n def testLiftedMulticutIlpBfsGrid(self):\n\n if nifty.Configuration.WITH_GLPK:\n\n for x in range(5):\n\n self.implTestLiftedMulticutIlpBfsGrid(ilpSolver='glpk', gridSize=[3,3],\n\n relativeGap=0.3,\n\n weightRange=(-2,1))\n\n if nifty.Configuration.WITH_CPLEX:\n\n for x in range(5):\n\n self.implTestLiftedMulticutIlpBfsGrid(ilpSolver='cplex', gridSize=[3,3],\n\n relativeGap=0.3,\n\n verbose=0, weightRange=(-2,1))\n\n if nifty.Configuration.WITH_GUROBI:\n\n for x in range(5):\n\n self.implTestLiftedMulticutIlpBfsGrid(ilpSolver='gurobi')\n\n\n\n def implTestSimpleChainModelOpt(self, size, ilpSolver):\n\n if nifty.Configuration.WITH_CPLEX:\n\n # 0 - 1 - 2 - 3\n\n #\n\n G = nifty.graph.UndirectedGraph\n\n g = G(size)\n\n for x in range(size - 1):\n\n g.insertEdge(x, x+1)\n\n\n\n obj = nifty.graph.lifted_multicut.liftedMulticutObjective(g)\n\n graph = obj.graph\n\n liftedGraph = obj.liftedGraph\n\n\n\n for x in range(size - 1):\n\n w = 1.0\n\n obj.setCost(x, x+1, w)\n\n\n\n w = -1.0 * float(size)\n\n obj.setCost(0, size-1, w)\n\n\n\n solverFactory = obj.liftedMulticutIlpFactory(ilpSolver=ilpSolver)\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n\n arg = solver.optimize()\n\n\n\n self.assertNotEqual(arg[0],arg[size-1])\n\n\n\n def testSimpleChainModelMulticutGlpk(self):\n\n if False and nifty.Configuration.WITH_GLPK:\n\n for x in range(10):\n\n self.implTestSimpleChainModelOpt(ilpSolver='glpk', size=4)\n\n\n\n def testSimpleChainModelMulticutGurobi(self):\n\n if nifty.Configuration.WITH_GUROBI:\n\n for x in range(10):\n\n self.implTestSimpleChainModelOpt(ilpSolver='gurobi', size=4)\n\n\n\n def testSimpleChainModelMulticutCplex(self):\n\n if nifty.Configuration.WITH_CPLEX:\n\n for x in range(10):\n", "file_path": "src/python/test/graph/lifted_multicut/test_lifted_multicut_solvers.py", "rank": 25, "score": 85734.56082346918 }, { "content": " def testLiftedMulticutSolverFm(self):\n\n random.seed(0)\n\n for x in range(1):\n\n obj, nid = self.gridLiftedModel(gridSize=[40,40] , bfsRadius=4, weightRange=[-1,1])\n\n\n\n pgen = obj.watershedProposalGenerator(sigma=1.0,\n\n seedingStrategy='SEED_FROM_LOCAL',\n\n numberOfSeeds=0.1)\n\n # print(x)\n\n\n\n solverFactory = obj.fusionMoveBasedFactory()\n\n solverFactory = obj.fusionMoveBasedFactory(proposalGenerator=pgen,\n\n numberOfIterations=100,\n\n stopIfNoImprovement=10)\n\n solver = solverFactory.create(obj)\n\n visitor = obj.verboseVisitor(100)\n", "file_path": "src/python/test/graph/lifted_multicut/test_lifted_multicut_solvers.py", "rank": 26, "score": 84588.26428948402 }, { "content": "def sizeLimitClustering(graph, nodeSizes, minimumNodeSize,\n\n edgeIndicators=None,edgeSizes=None,\n\n sizeRegularizer=0.001, gamma=0.999,\n\n makeDenseLabels=False):\n\n\n\n s = graph.edgeIdUpperBound + 1\n\n\n\n def rq(data):\n\n return numpy.require(data, 'float32')\n\n\n\n nodeSizes = rq(nodeSizes)\n\n\n\n if edgeIndicators is None:\n\n edgeIndicators = numpy.ones(s,dtype='float32')\n\n else:\n\n edgeIndicators = rq(edgeIndicators)\n\n\n\n if edgeSizes is None:\n\n edgeSizes = numpy.ones(s,dtype='float32')\n\n else:\n\n edgeSizes = rq(edgeSizes)\n\n\n\n\n\n\n\n cp = minimumNodeSizeClusterPolicy(graph, edgeIndicators=edgeIndicators,\n\n edgeSizes=edgeSizes,\n\n nodeSizes=nodeSizes,\n\n minimumNodeSize=float(minimumNodeSize),\n\n sizeRegularizer=float(sizeRegularizer),\n\n gamma=float(gamma))\n\n\n\n agglo = agglomerativeClustering(cp)\n\n\n\n agglo.run()\n\n labels = agglo.result()\n\n\n\n if makeDenseLabels:\n\n labels = __makeDense(labels)\n\n\n", "file_path": "src/python/module/nifty/graph/agglo/__init__.py", "rank": 27, "score": 83706.36329067916 }, { "content": "def ilpSettings(relativeGap=0.0, absoluteGap=0.0, memLimit=-1.0):\n\n \"\"\"factory function to create :class:`IlpBackendSettigns` .\n\n\n\n factory function to create :class:`IlpBackendSettigns` .\n\n This settings might be consumed by ILP solvers\n\n as CPLEX GUROBI and GLPK.\n\n\n\n Args:\n\n relativeGap (float): relative optimality gap (default: {0.0})\n\n absoluteGap (float): absolute optimality gap (default: {0.0})\n\n memLimit (float): memory limit in mega-bites\n\n a value smaller as zero indicates no limit (default: {-1.0})\n\n\n\n Returns:\n\n :class:`IlpBackendSettings`: ilpSettings\n\n \"\"\"\n\n s = IlpBackendSettings()\n\n s.relativeGap = float(relativeGap)\n\n s.absoluteGap = float(absoluteGap)\n\n s.memLimit = float(memLimit)\n\n\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 28, "score": 83032.34083638703 }, { "content": " def watershedProposals(sigma=1.0, seedFraction=0.0):\n\n s = getSettings('FusionMoveBasedWatershedProposalGen')\n\n s.sigma = float(sigma)\n\n s.seedFraction = float(seedFraction)\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 29, "score": 83021.37252118153 }, { "content": " def evaluate(self, labels):\n", "file_path": "src/python/module/nifty/graph/opt/lifted_multicut/__init__.py", "rank": 30, "score": 83021.37252118153 }, { "content": " def getCls(prefix, postfix):\n", "file_path": "src/python/module/nifty/graph/opt/minstcut/__init__.py", "rank": 31, "score": 83021.37252118153 }, { "content": " def getCls(prefix, postfix):\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 32, "score": 83021.37252118153 }, { "content": " def perturbAndMap(objective, settings):\n\n pAndM = graph.multicut.perturbAndMap(objective, settings)\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 33, "score": 83021.37252118153 }, { "content": " def getSettings(baseName):\n\n S = getSettingsCls(baseName)\n", "file_path": "src/python/module/nifty/graph/opt/minstcut/__init__.py", "rank": 34, "score": 83021.37252118153 }, { "content": " def cgcFactory(doCutPhase=True, doGlueAndCutPhase=True, mincutFactory=None,\n\n multicutFactory=None,\n\n doBetterCutPhase=False, nodeNumStopCond=0.1, sizeRegularizer=1.0):\n\n if mincutFactory is None:\n\n if Configuration.WITH_QPBO:\n\n mincutFactory = graphCls.MincutObjective.mincutQpboFactory(improve=True)\n\n else:\n\n raise RuntimeError(\"default mincutFactory needs to be compiled WITH_QPBO\")\n\n\n\n if Configuration.WITH_QPBO:\n\n s,F = getSettingsAndFactoryCls(\"Cgc\")\n\n s.doCutPhase = bool(doCutPhase)\n\n s.doGlueAndCutPhase = bool(doGlueAndCutPhase)\n\n s.mincutFactory = mincutFactory\n\n if multicutFactory is not None:\n\n s.multicutFactory = multicutFactory\n\n s.doBetterCutPhase = bool(doBetterCutPhase)\n\n s.nodeNumStopCond = float(nodeNumStopCond)\n\n s.sizeRegularizer = float(sizeRegularizer)\n\n return F(s)\n\n else:\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 35, "score": 83021.37252118153 }, { "content": " def getSettings(baseName):\n\n S = getSettingsCls(baseName)\n", "file_path": "src/python/module/nifty/graph/opt/mincut/__init__.py", "rank": 36, "score": 83021.37252118153 }, { "content": " def getSettings(baseName):\n\n S = getSettingsCls(baseName)\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 37, "score": 83021.37252118153 }, { "content": " def optimize(self,factory, labels=None):\n\n if labels is None:\n\n labels = numpy.arange(self.n_variables).reshape(self.shape)\n", "file_path": "src/python/module/nifty/graph/opt/lifted_multicut/__init__.py", "rank": 38, "score": 83021.37252118153 }, { "content": "def __extendminstcutObj(objectiveCls, objectiveName):\n\n\n\n def getCls(prefix, postfix):\n\n return _minstcut.__dict__[prefix+postfix]\n\n\n\n def getSettingsCls(baseName):\n\n S = getCls(baseName + \"SettingsType\" ,objectiveName)\n\n return S\n\n def getSolverCls(baseName):\n\n S = getCls(baseName,objectiveName)\n\n return S\n\n def getSettings(baseName):\n\n S = getSettingsCls(baseName)\n\n return S()\n\n def getSettingsAndFactoryCls(baseName):\n\n s = getSettings(baseName)\n\n F = getCls(baseName + \"Factory\" ,objectiveName)\n\n return s,F\n\n\n\n O = objectiveCls\n\n\n\n def minstcutVerboseVisitor(visitNth=1,timeLimit=0):\n\n V = getSolverCls(\"VerboseVisitor\")\n\n return V(visitNth,timeLimit)\n\n O.verboseVisitor = staticmethod(minstcutVerboseVisitor)\n\n\n\n def watershedProposalGenerator(sigma=1.0,\n\n numberOfSeeds=0.1,\n\n seedingStrategie='SEED_FROM_NEGATIVE'):\n\n \"\"\"Factory function for a watershed based proposal generator for minstcutCcFusionMoveBased\n\n\n\n Args:\n\n sigma (float, optional): The weights are perturbed by a additive\n\n Gaussian noise n(0,sigma) (default 0.0)\n\n\n\n numberOfSeeds (float, optional): Number of seed to generate.\n\n A number smaller as one will be interpreted as a fraction of\n\n the number of nodes (default 0.1)\n\n seedingStrategie (str, optional): Can be:\n\n - 'SEED_FROM_NEGATIVE' : All negative weighted edges\n\n can be used to generate seeds.\n\n - 'SEED_FROM_ALL' : All edges\n\n can be used to generate seeds.\n\n\n\n Returns:\n\n TYPE: parameter object used construct a WatershedProposalGenerator\n\n\n\n \"\"\"\n\n pGenCls = getSolverCls(\"WatershedProposalGeneratorFactory\")\n\n pGenSettings = getSettings(\"WatershedProposalGenerator\")\n\n\n\n # map string to enum\n\n stringToEnum = {\n\n 'SEED_FROM_NEGATIVE' : pGenSettings.SeedingStrategie.SEED_FROM_NEGATIVE,\n\n 'SEED_FROM_ALL' : pGenSettings.SeedingStrategie.SEED_FROM_ALL,\n\n }\n\n try:\n\n enumVal = stringToEnum[seedingStrategie]\n\n except:\n\n raise RuntimeError(\"unkown seedingStrategie '%s': must be either\"\\\n\n \"'SEED_FROM_NEGATIVE' or 'SEED_FROM_ALL'\"%str(seedingStrategie))\n\n\n\n pGenSettings.sigma = float(sigma)\n\n pGenSettings.numberOfSeeds = float(numberOfSeeds)\n\n pGenSettings.seedingStrategie = enumVal\n\n\n\n return pGenCls(pGenSettings)\n\n O.watershedProposalGenerator = staticmethod(watershedProposalGenerator)\n\n\n\n def minstcutQpboFactory(improve=True):\n\n if Configuration.WITH_QPBO:\n\n s,F = getSettingsAndFactoryCls(\"minstcutQpbo\")\n\n s.improve = bool(improve)\n\n return F(s)\n\n else:\n\n raise RuntimeError(\"minstcutQpbo need nifty to be compiled WITH_QPBO\")\n\n O.minstcutQpboFactory = staticmethod(minstcutQpboFactory)\n\n\n\n def greedyAdditiveFactory( weightStopCond=0.0, nodeNumStopCond=-1.0, improve=True):\n\n if Configuration.WITH_QPBO:\n\n s,F = getSettingsAndFactoryCls(\"minstcutGreedyAdditive\")\n\n s.weightStopCond = float(weightStopCond)\n\n s.nodeNumStopCond = float(nodeNumStopCond)\n\n s.improve = bool(improve)\n\n return F(s)\n\n else:\n\n raise RuntimeError(\"greedyAdditiveFactory need nifty to be compiled WITH_QPBO\")\n\n O.greedyAdditiveFactory = staticmethod(greedyAdditiveFactory)\n\n\n\n def minstcutCcFusionMoveSettings(minstcutFactory=None):\n\n if minstcutFactory is None:\n\n if Configuration.WITH_QPBO:\n\n minstcutFactory = minstcutObjectiveUndirectedGraph.minstcutQpboFactory()\n\n else:\n\n raise RuntimeError(\"default minstcutFactory needs minstcutQpbo, which need nifty to be compiled WITH_QPBO\")\n\n\n\n s = getSettings(\"minstcutCcFusionMove\")\n\n s.minstcutFactory = minstcutFactory\n\n return s\n\n\n\n def minstcutCcFusionMoveBasedFactory(proposalGenerator=None, numberOfThreads=1,\n\n numberOfIterations=1000, stopIfNoImprovement=100,\n\n fusionMoveSettings=None):\n\n \"\"\"factory function for a cc-fusion move based minstcut solver\n\n\n\n Args:\n\n proposalGenerator (None, optional): Proposal generator (default watershedProposalGenerator)\n\n numberOfThreads (int, optional): (default 1)\n\n numberOfIterations (int, optional): Maximum number of iterations(default 1000)\n\n stopIfNoImprovement (int, optional): Stop after n iterations without improvement (default 100)\n\n fusionMoveSettings (FusionMoveSettings, optional) : The settings of the underlaying minstcutCcFusionMove\n\n Returns:\n\n TYPE: minstcutCcFusionMoveBasedFactory\n\n \"\"\"\n\n if proposalGenerator is None:\n\n proposalGenerator = watershedProposalGenerator()\n\n\n\n if fusionMoveSettings is None:\n\n fusionMoveSettings = minstcutCcFusionMoveSettings()\n\n\n\n s,F = getSettingsAndFactoryCls(\"minstcutCcFusionMoveBased\")\n\n s.proposalGenerator = proposalGenerator\n\n s.numberOfThreads = int(numberOfThreads)\n\n s.numberOfIterations = int(numberOfIterations)\n\n s.stopIfNoImprovement = int(stopIfNoImprovement)\n\n s.fusionMoveSettings = fusionMoveSettings\n\n return F(s)\n", "file_path": "src/python/module/nifty/graph/opt/minstcut/__init__.py", "rank": 39, "score": 83021.37252118153 }, { "content": " def func_wrapper(*args, **kwargs):\n\n warmStartGreedy = kwargs.pop('warmStartGreedy', False)\n\n greedyVisitNth = kwargs.pop('greedyVisitNth', 100)\n\n if(warmStartGreedy):\n\n greedyFactory = greedyAdditiveFactory(visitNth=int(greedyVisitNth))\n\n factory = func(*args, **kwargs)\n\n return chainedSolversFactory(multicutFactories=[\n\n greedyFactory,\n\n factory\n\n ])\n\n else:\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 40, "score": 83021.37252118153 }, { "content": " def __init__(self, weights, offsets):\n\n\n\n self.weights = weights\n\n self.offsets = offsets\n\n\n\n if(self.offsets.shape[1] == 2):\n\n assert weights.shape[2] == offsets.shape[0]\n\n self.shape = weights.shape[0:2]\n\n self.n_variables = self.shape[0]*self.shape[1]\n\n self.ndim = 2\n\n self._obj = PixelWiseLmcObjective2D(self.weights, self.offsets)\n\n elif (self.offsets.shape[1] == 3):\n\n self.shape = weights.shape[0:3]\n\n self.n_variables = self.shape[0]*self.shape[1]*self.shape[2]\n\n self.ndim = 3\n\n assert weights.shape[3] == offsets.shape[0]\n\n self._obj = PixelWiseLmcObjective3D(self.weights, self.offsets)\n\n else:\n", "file_path": "src/python/module/nifty/graph/opt/lifted_multicut/__init__.py", "rank": 41, "score": 83021.37252118153 }, { "content": " def getCls(prefix, postfix):\n", "file_path": "src/python/module/nifty/graph/opt/mincut/__init__.py", "rank": 42, "score": 83021.37252118153 }, { "content": "def runSolver(solverFactory):\n\n \"\"\" run solver and return energies and runtimes\"\"\"\n\n loggingVisitor = MulticutObjective.loggingVisitor(visitNth=1,verbose=0)\n\n solver = solverFactory.create(objective)\n\n result = solver.optimize(loggingVisitor)\n\n energies = loggingVisitor.energies()\n\n runtimes = loggingVisitor.runtimes()\n", "file_path": "src/python/examples/graph/plot_toy_multicut.py", "rank": 43, "score": 81940.02268329625 }, { "content": " def nid(x, y):\n", "file_path": "src/python/test/graph/mincut/test_mincut_solvers.py", "rank": 44, "score": 81932.50349240337 }, { "content": " def setUp(self):\n", "file_path": "src/python/test/graph/multicut/test_multicut_solvers.py", "rank": 45, "score": 81932.50349240337 }, { "content": " def setUp(self):\n", "file_path": "src/python/test/graph/minstcut/test_minstcut_solvers.py", "rank": 46, "score": 81932.50349240337 }, { "content": " def nid(x, y):\n", "file_path": "src/python/test/graph/multicut/test_multicut_solvers.py", "rank": 47, "score": 81932.50349240337 }, { "content": " def nid(x, y):\n", "file_path": "src/python/test/graph/minstcut/test_minstcut_solvers.py", "rank": 48, "score": 81932.50349240337 }, { "content": " def setUp(self):\n", "file_path": "src/python/test/graph/mincut/test_mincut_solvers.py", "rank": 49, "score": 81932.50349240337 }, { "content": " def watershedProposalGenerator(sigma=1.0,\n\n numberOfSeeds=0.1,\n\n seedingStrategie='SEED_FROM_NEGATIVE'):\n\n \"\"\"Factory function for a watershed based proposal generator for minstcutCcFusionMoveBased\n\n\n\n Args:\n\n sigma (float, optional): The weights are perturbed by a additive\n\n Gaussian noise n(0,sigma) (default 0.0)\n\n\n\n numberOfSeeds (float, optional): Number of seed to generate.\n\n A number smaller as one will be interpreted as a fraction of\n\n the number of nodes (default 0.1)\n\n seedingStrategie (str, optional): Can be:\n\n - 'SEED_FROM_NEGATIVE' : All negative weighted edges\n\n can be used to generate seeds.\n\n - 'SEED_FROM_ALL' : All edges\n\n can be used to generate seeds.\n\n\n\n Returns:\n\n TYPE: parameter object used construct a WatershedProposalGenerator\n\n\n\n \"\"\"\n\n pGenCls = getSolverCls(\"WatershedProposalGeneratorFactory\")\n\n pGenSettings = getSettings(\"WatershedProposalGenerator\")\n\n\n\n # map string to enum\n\n stringToEnum = {\n\n 'SEED_FROM_NEGATIVE' : pGenSettings.SeedingStrategie.SEED_FROM_NEGATIVE,\n\n 'SEED_FROM_ALL' : pGenSettings.SeedingStrategie.SEED_FROM_ALL,\n\n }\n\n try:\n\n enumVal = stringToEnum[seedingStrategie]\n\n except:\n\n raise RuntimeError(\"unkown seedingStrategie '%s': must be either\"\\\n\n \"'SEED_FROM_NEGATIVE' or 'SEED_FROM_ALL'\"%str(seedingStrategie))\n\n\n\n pGenSettings.sigma = float(sigma)\n\n pGenSettings.numberOfSeeds = float(numberOfSeeds)\n\n pGenSettings.seedingStrategie = enumVal\n\n\n", "file_path": "src/python/module/nifty/graph/opt/minstcut/__init__.py", "rank": 50, "score": 81658.4676122332 }, { "content": " def watershedProposalGenerator(sigma=1.0, numberOfSeeds=0.1,seedingStrategie='SEED_FROM_NEGATIVE'):\n\n \"\"\"factory function for a watershed based proposal generator for mincutCcFusionMoveBased\n\n\n\n Args:\n\n sigma (float, optional): The weights are perturbed by a additive\n\n Gaussian noise n(0,sigma) (default 0.0)\n\n\n\n numberOfSeeds (float, optional): Number of seed to generate.\n\n A number smaller as one will be interpreted as a fraction of\n\n the number of nodes (default 0.1)\n\n seedingStrategie (str, optional): Can be:\n\n - 'SEED_FROM_NEGATIVE' : All negative weighted edges\n\n can be used to generate seeds.\n\n - 'SEED_FROM_ALL' : All edges\n\n can be used to generate seeds.\n\n Returns:\n\n TYPE: parameter object used construct a WatershedProposalGenerator\n\n \"\"\"\n\n pGenCls = getSolverCls(\"WatershedProposalGeneratorFactory\")\n\n pGenSettings = getSettings(\"WatershedProposalGenerator\")\n\n\n\n # map string to enum\n\n stringToEnum = {\n\n 'SEED_FROM_NEGATIVE' : pGenSettings.SeedingStrategie.SEED_FROM_NEGATIVE,\n\n 'SEED_FROM_ALL' : pGenSettings.SeedingStrategie.SEED_FROM_ALL,\n\n }\n\n try:\n\n enumVal = stringToEnum[seedingStrategie]\n\n except:\n\n raise RuntimeError(\"unkown seedingStrategie '%s': must be either\"\\\n\n \"'SEED_FROM_NEGATIVE' or 'SEED_FROM_ALL'\"%str(seedingStrategie))\n\n\n\n pGenSettings.sigma = float(sigma)\n\n pGenSettings.numberOfSeeds = float(numberOfSeeds)\n\n pGenSettings.seedingStrategie = enumVal\n\n\n", "file_path": "src/python/module/nifty/graph/opt/mincut/__init__.py", "rank": 51, "score": 81658.4676122332 }, { "content": " def getSettingsCls(baseName):\n\n S = getCls(\"__\"+baseName + \"SettingsType\" ,objectiveName)\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 52, "score": 81656.60982434177 }, { "content": " def perturbAndMapSettings( numberOfIterations=1000,\n\n numberOfThreads=-1,\n\n verbose=1,\n\n noiseType='normal',\n\n noiseMagnitude=1.0,\n\n mcFactory=None):\n\n if mcFactory is None:\n\n mcFactory = fusionMoveBasedFactory(numberOfThreads=0)\n\n s = getSettings('PerturbAndMap')\n\n s.numberOfIterations = int(numberOfIterations)\n\n s.numberOfThreads = int(numberOfThreads)\n\n s.verbose = int(verbose)\n\n s.noiseMagnitude = float(noiseMagnitude)\n\n\n\n if(noiseType == 'normal'):\n\n s.noiseType = getMcCls('PerturbAndMap').NORMAL_NOISE\n\n elif(noiseType == 'uniform'):\n\n s.noiseType = getMcCls('PerturbAndMap').UNIFORM_NOISE\n\n elif(noiseType == 'makeLessCertain'):\n\n s.noiseType = graph.multicut.PerturbAndMapUndirectedGraph.MAKE_LESS_CERTAIN\n\n else:\n\n raise RuntimeError(\"'%s' is an unknown noise type. Must be 'normal' or 'uniform' or 'makeLessCertain' \"%str(noiseType))\n\n\n\n s.mcFactory = mcFactory\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 53, "score": 81656.60982434177 }, { "content": " def greedyAdditiveProposals(sigma=1.0, weightStopCond=0.0, nodeNumStopCond=-1.0):\n\n s = getSettings('FusionMoveBasedGreedyAdditiveProposalGen')\n\n s.sigma = float(sigma)\n\n s.weightStopCond = float(weightStopCond)\n\n s.nodeNumStopCond = float(nodeNumStopCond)\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 54, "score": 81656.60982434177 }, { "content": " def multicutIlpFactory(addThreeCyclesConstraints=True,\n\n addOnlyViolatedThreeCyclesConstraints=True,\n\n ilpSolverSettings=None,\n\n ilpSolver = None):\n\n # default solver:\n\n if ilpSolver is None and Configuration.WITH_CPLEX:\n\n ilpSolver = 'cplex'\n\n if ilpSolver is None and Configuration.WITH_GUROBI:\n\n ilpSolver = 'gurobi'\n\n if ilpSolver is None and Configuration.WITH_GLPK:\n\n ilpSolver = 'glpk'\n\n if ilpSolver is None:\n\n raise RuntimeError(\"multicutIlpFactory needs either \"\n\n \"'WITH_CPLEX', 'WITH_GUROBI'\"\n\n \" or 'WITH_GLPK' to be enabled\")\n\n\n\n if ilpSolver == 'cplex':\n\n if not Configuration.WITH_CPLEX:\n\n raise RuntimeError(\"multicutIlpFactory with ilpSolver=`cplex` need nifty \"\n\n \"to be compiled with WITH_CPLEX\")\n\n s,F = getSettingsAndFactoryCls(\"MulticutIlpCplex\")\n\n elif ilpSolver == 'gurobi':\n\n if not Configuration.WITH_GUROBI:\n\n raise RuntimeError(\"multicutIlpFactory with ilpSolver=`gurobi` need nifty \"\n\n \"to be compiled with WITH_GUROBI\")\n\n s,F = getSettingsAndFactoryCls(\"MulticutIlpGurobi\")\n\n elif ilpSolver == 'glpk':\n\n if not Configuration.WITH_GLPK:\n\n raise RuntimeError(\"multicutIlpFactory with ilpSolver=`glpk` need nifty \"\n\n \"to be compiled with WITH_GLPK\")\n\n s,F = getSettingsAndFactoryCls(\"MulticutIlpGlpk\")\n\n else:\n\n raise RuntimeError(\"%s is an unknown ilp solver\"%str(ilpSolver))\n\n s.addThreeCyclesConstraints = bool(addThreeCyclesConstraints)\n\n s.addOnlyViolatedThreeCyclesConstraints = bool(addOnlyViolatedThreeCyclesConstraints)\n\n if ilpSolverSettings is None:\n\n ilpSolverSettings = ilpSettings()\n\n s.ilpSettings = ilpSolverSettings\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 55, "score": 81656.60982434177 }, { "content": " def fusionMoveSettings(mcFactory=None):\n\n if mcFactory is None:\n\n if Configuration.WITH_CPLEX:\n\n mcFactory = MulticutObjectiveUndirectedGraph.multicutIlpCplexFactory()\n\n else:\n\n mcFactory = MulticutObjectiveUndirectedGraph.defaultMulticutFactory()\n\n s = getSettings('FusionMove')\n\n s.mcFactory = mcFactory\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 56, "score": 81656.60982434177 }, { "content": " def greedyAdditiveFactory( weightStopCond=0.0, nodeNumStopCond=-1.0, improve=True):\n\n if Configuration.WITH_QPBO:\n\n s,F = getSettingsAndFactoryCls(\"MincutGreedyAdditive\")\n\n s.weightStopCond = float(weightStopCond)\n\n s.nodeNumStopCond = float(nodeNumStopCond)\n\n s.improve = bool(improve)\n\n return F(s)\n\n else:\n", "file_path": "src/python/module/nifty/graph/opt/mincut/__init__.py", "rank": 57, "score": 81656.60982434177 }, { "content": " def getCls(prefix, postfix):\n", "file_path": "src/python/module/nifty/graph/opt/lifted_multicut/__init__.py", "rank": 58, "score": 81656.60982434177 }, { "content": " def mincutQpboFactory(improve=True):\n\n if Configuration.WITH_QPBO:\n\n s,F = getSettingsAndFactoryCls(\"MincutQpbo\")\n\n s.improve = bool(improve)\n\n return F(s)\n\n else:\n", "file_path": "src/python/module/nifty/graph/opt/mincut/__init__.py", "rank": 59, "score": 81656.60982434177 }, { "content": " def kernighanLinFactory(\n\n numberOfInnerIterations = sys.maxsize,\n\n numberOfOuterIterations = 100,\n\n epsilon = 1e-6):\n\n\n\n s, F = getSettingsAndFactoryCls(\"KernighanLin\")\n\n s.numberOfInnerIterations = numberOfInnerIterations\n\n s.numberOfOuterIterations = numberOfOuterIterations\n\n s.epsilon = epsilon\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 60, "score": 81656.60982434177 }, { "content": " def greedyAdditiveFactory( weightStopCond=0.0, nodeNumStopCond=-1.0, visitNth=1):\n\n s,F = getSettingsAndFactoryCls(\"MulticutGreedyAdditive\")\n\n s.weightStopCond = float(weightStopCond)\n\n s.nodeNumStopCond = float(nodeNumStopCond)\n\n s.visitNth = int(visitNth)\n\n\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 61, "score": 81656.60982434177 }, { "content": " def factoryClsName(baseName):\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 62, "score": 81656.60982434177 }, { "content": " def getSettings(baseName):\n\n S = getSettingsCls(baseName)\n", "file_path": "src/python/module/nifty/graph/opt/lifted_multicut/__init__.py", "rank": 63, "score": 81656.60982434177 }, { "content": " def watershedCcProposals(sigma=1.0, numberOfSeeds=0.1):\n\n s,F = getSettingsAndFactoryCls(\"WatershedProposalGenerator\")\n\n s.sigma = float(sigma)\n\n s.numberOfSeeds = float(numberOfSeeds)\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 64, "score": 81656.60982434177 }, { "content": "def __extendMulticutObj(objectiveCls, objectiveName, graphCls):\n\n\n\n\n\n def getCls(prefix, postfix):\n\n return _multicut.__dict__[prefix+postfix]\n\n\n\n def getSettingsCls(baseName):\n\n S = getCls(\"__\"+baseName + \"SettingsType\" ,objectiveName)\n\n return S\n\n def getMcCls(baseName):\n\n S = getCls(baseName,objectiveName)\n\n return S\n\n def getSettings(baseName):\n\n S = getSettingsCls(baseName)\n\n return S()\n\n def getSettingsAndFactoryCls(baseName):\n\n s = getSettings(baseName)\n\n F = getCls(baseName + \"Factory\" ,objectiveName)\n\n return s,F\n\n\n\n def factoryClsName(baseName):\n\n return baseName + \"Factory\" + objectiveName\n\n\n\n\n\n O = objectiveCls\n\n\n\n def verboseVisitor(visitNth=1, timeLimitSolver=float('inf'),\n\n timeLimitTotal=float('inf'), logLevel=LogLevel.WARN):\n\n V = getMcCls(\"VerboseVisitor\")\n\n return V(int(visitNth), float(timeLimitSolver), float(timeLimitTotal), logLevel)\n\n O.verboseVisitor = staticmethod(verboseVisitor)\n\n\n\n\n\n def loggingVisitor(visitNth=1,verbose=True,timeLimitSolver=float('inf'),\n\n timeLimitTotal=float('inf'), logLevel=LogLevel.WARN):\n\n V = getMcCls(\"LoggingVisitor\")\n\n return V(visitNth=int(visitNth),\n\n verbose=bool(verbose),\n\n timeLimitSolver=float(timeLimitSolver),\n\n timeLimitTotal=float(timeLimitTotal),\n\n logLevel=logLevel)\n\n O.loggingVisitor = staticmethod(loggingVisitor)\n\n\n\n\n\n\n\n def greedyAdditiveProposals(sigma=1.0, weightStopCond=0.0, nodeNumStopCond=-1.0):\n\n s = getSettings('FusionMoveBasedGreedyAdditiveProposalGen')\n\n s.sigma = float(sigma)\n\n s.weightStopCond = float(weightStopCond)\n\n s.nodeNumStopCond = float(nodeNumStopCond)\n\n return s\n\n O.greedyAdditiveProposals = staticmethod(greedyAdditiveProposals)\n\n\n\n def watershedProposals(sigma=1.0, seedFraction=0.0):\n\n s = getSettings('FusionMoveBasedWatershedProposalGen')\n\n s.sigma = float(sigma)\n\n s.seedFraction = float(seedFraction)\n\n return s\n\n O.watershedProposals = staticmethod(watershedProposals)\n\n\n\n def greedyAdditiveFactory( weightStopCond=0.0, nodeNumStopCond=-1.0, visitNth=1):\n\n s,F = getSettingsAndFactoryCls(\"MulticutGreedyAdditive\")\n\n s.weightStopCond = float(weightStopCond)\n\n s.nodeNumStopCond = float(nodeNumStopCond)\n\n s.visitNth = int(visitNth)\n\n\n\n return F(s)\n\n O.greedyAdditiveFactory = staticmethod(greedyAdditiveFactory)\n\n O.greedyAdditiveFactory.__doc__ = \"\"\" create an instance of :class:`%s`\n\n\n\n Find approximate solutions via\n\n agglomerative clustering as in :cite:`beier_15_funsion`.\n\n\n\n Warning:\n\n This solver should be used to\n\n warm start other solvers with.\n\n This solver is very fast but\n\n yields rather suboptimal results.\n\n\n\n Args:\n\n weightStopCond (float): stop clustering when the highest\n\n weight in cluster-graph is lower as this value (default: {0.0})\n\n nodeNumStopCond (float): stop clustering when a cluster-graph\n\n reached a certain number of nodes.\n\n Numbers smaller 1 are interpreted as fraction\n\n of the graphs number of nodes.\n\n If nodeNumStopCond is smaller 0 this\n\n stopping condition is ignored (default: {-1})\n\n visitNth (int) : only call the visitor each nth time.\n\n This is useful to avoid to many couts (default: {1}).\n\n Returns:\n\n %s : multicut factory\n\n \"\"\"%(factoryClsName(\"MulticutGreedyAdditive\"),factoryClsName(\"MulticutGreedyAdditive\"))\n\n\n\n\n\n\n\n def warmStartGreeedyDecorator(func):\n\n def func_wrapper(*args, **kwargs):\n\n warmStartGreedy = kwargs.pop('warmStartGreedy', False)\n\n greedyVisitNth = kwargs.pop('greedyVisitNth', 100)\n\n if(warmStartGreedy):\n\n greedyFactory = greedyAdditiveFactory(visitNth=int(greedyVisitNth))\n\n factory = func(*args, **kwargs)\n\n return chainedSolversFactory(multicutFactories=[\n\n greedyFactory,\n\n factory\n\n ])\n\n else:\n\n return func(*args, **kwargs)\n\n return func_wrapper\n\n\n\n\n\n\n\n\n\n\n\n def chainedSolversFactory(multicutFactories):\n\n s,F = getSettingsAndFactoryCls(\"ChainedSolvers\")\n\n s.multicutFactories = multicutFactories\n\n return F(s)\n\n O.chainedSolversFactory = staticmethod(chainedSolversFactory)\n\n\n\n O.chainedSolversFactory.__doc__ = \"\"\" create an instance of :class:`%s`\n\n\n\n Chain multiple solvers\n\n such that each successor is warm-started with\n\n its predecessor solver.\n\n\n\n Warning:\n\n The solvers should be able to be warm started.\n\n\n\n Args:\n\n weightStopCond (float): stop clustering when the highest\n\n weight in cluster-graph is lower as this value (default: {0.0})\n\n nodeNumStopCond: stop clustering when a cluster-graph\n\n reached a certain number of nodes.\n\n Numbers smaller 1 are interpreted as fraction\n\n of the graphs number of nodes.\n\n If nodeNumStopCond is smaller 0 this\n\n stopping condition is ignored (default: {-1})\n\n Returns:\n\n %s : multicut factory\n\n \"\"\"%(factoryClsName(\"ChainedSolvers\"),factoryClsName(\"ChainedSolvers\"))\n\n\n\n\n\n\n\n @warmStartGreeedyDecorator\n\n def cgcFactory(doCutPhase=True, doGlueAndCutPhase=True, mincutFactory=None,\n\n multicutFactory=None,\n\n doBetterCutPhase=False, nodeNumStopCond=0.1, sizeRegularizer=1.0):\n\n if mincutFactory is None:\n\n if Configuration.WITH_QPBO:\n\n mincutFactory = graphCls.MincutObjective.mincutQpboFactory(improve=True)\n\n else:\n\n raise RuntimeError(\"default mincutFactory needs to be compiled WITH_QPBO\")\n\n\n\n if Configuration.WITH_QPBO:\n\n s,F = getSettingsAndFactoryCls(\"Cgc\")\n\n s.doCutPhase = bool(doCutPhase)\n\n s.doGlueAndCutPhase = bool(doGlueAndCutPhase)\n\n s.mincutFactory = mincutFactory\n\n if multicutFactory is not None:\n\n s.multicutFactory = multicutFactory\n\n s.doBetterCutPhase = bool(doBetterCutPhase)\n\n s.nodeNumStopCond = float(nodeNumStopCond)\n\n s.sizeRegularizer = float(sizeRegularizer)\n\n return F(s)\n\n else:\n\n raise RuntimeError(\"cgc need nifty to be compiled WITH_QPBO\")\n\n O.cgcFactory = staticmethod(cgcFactory)\n\n O.cgcFactory.__module__ = \"nifty.graph.opt.multicut\"\n\n O.cgcFactory.__doc__ = \"\"\" create an instance of :class:`%s`\n\n\n\n Cut glue and cut as described in :cite:`beier_14_cut`.\n\n\n\n Warning:\n\n This solver should be warm started, otherwise\n\n the glue phase is very slow.\n\n Using :func:`greedyAdditiveFactory` to create\n\n a solver for warm starting is suggested.\n\n\n\n\n\n Note:\n\n In contrast to the OpenGM implementation we allow for\n\n arbitrary solvers to optimize the mincut problem.\n\n\n\n Args:\n\n doCutPhase: do recursive two coloring (default: {True})\n\n doGlueAndCutPhase: do re-opt of all pairs of clusters (default: {True})\n\n mincutFactory: mincutFactory for creating mincut solvers to solve subproblems (default: {None})\n\n multicutFactory: multicutFactory for creating multicut solvers to solve subproblems (default: {None})\n\n doBetterCutPhase: do a cut phase with multicut solvers instead of mincuts (default: {False})\n\n nodeNumStopCond: If doBetterCutPhase is True, we use a agglomeration to\n\n create a set of clusters. Each cluster is then optimized with the solver from\n\n the multicutFactory. Values between 0 and 1 are interpreted as fraction\n\n of the total number of nodes in the graph (default: {0.1})\n\n sizeRegularizer: If doBetterCutPhase is True, we use a agglomeration to\n\n create a set of clusters.\n\n If this number is larger as zero, the clusters have about equal size (default: {1.0})\n\n Returns:\n\n %s : multicut factory\n\n \"\"\"%(factoryClsName(\"Cgc\"),factoryClsName(\"Cgc\"))\n\n\n\n\n\n def defaultMulticutFactory():\n\n return O.greedyAdditiveFactory()\n\n O.defaultMulticutFactory = staticmethod(defaultMulticutFactory)\n\n O.defaultFactory = staticmethod(defaultMulticutFactory)\n\n O.defaultFactory.__doc__ = \"\"\" create a instance of the default multicut solver factory.\n\n\n\n Currently the this function returns the same as\n\n :func:`greedyAdditiveFactory`\n\n\n\n Returns:\n\n %s : multicut factory\n\n \"\"\"%(factoryClsName(\"MulticutGreedyAdditive\"))\n\n\n\n\n\n @warmStartGreeedyDecorator\n\n def kernighanLinFactory(\n\n numberOfInnerIterations = sys.maxsize,\n\n numberOfOuterIterations = 100,\n\n epsilon = 1e-6):\n\n\n\n s, F = getSettingsAndFactoryCls(\"KernighanLin\")\n\n s.numberOfInnerIterations = numberOfInnerIterations\n\n s.numberOfOuterIterations = numberOfOuterIterations\n\n s.epsilon = epsilon\n\n return F(s)\n\n O.kernighanLinFactory = staticmethod(kernighanLinFactory)\n\n O.kernighanLinFactory.__doc__ = \"\"\" create an instance of :class:`%s`\n\n\n\n Find approximate solutions via\n\n agglomerative clustering as in :cite:`TODO`.\n\n\n\n\n\n Args:\n\n numberOfInnerIterations (int): number of inner iterations (default: {sys.maxsize})\n\n numberOfOuterIterations (int): number of outer iterations (default: {100})\n\n epsilon (float): epsilon (default: { 1e-6})\n\n warmStartGreedy (bool): initialize with greedyAdditive (default: {False})\n\n\n\n Returns:\n\n %s : multicut factory\n\n \"\"\"%tuple([factoryClsName(\"KernighanLin\")]*2)\n\n\n\n\n\n def multicutDecomposerFactory(submodelFactory=None, fallthroughFactory=None):\n\n\n\n if submodelFactory is None:\n\n submodelFactory = MulticutObjectiveUndirectedGraph.defaultMulticutFactory()\n\n\n\n if fallthroughFactory is None:\n\n fallthroughFactory = O.defaultMulticutFactory()\n\n\n\n\n\n s,F = getSettingsAndFactoryCls(\"MulticutDecomposer\")\n\n s.submodelFactory = submodelFactory\n\n s.fallthroughFactory = fallthroughFactory\n\n return F(s)\n\n\n\n O.multicutDecomposerFactory = staticmethod(multicutDecomposerFactory)\n\n O.multicutDecomposerFactory.__doc__ = \"\"\" create an instance of :class:`%s`\n\n\n\n This solver tries to decompose the model into\n\n sub-models as described in :cite:`alush_2013_simbad`.\n\n If a model decomposes into components such that there are no\n\n positive weighted edges between the components one can\n\n optimize each model separately.\n\n\n\n\n\n\n\n Note:\n\n Models might not decompose at all.\n\n\n\n Args:\n\n submodelFactory: multicut factory for solving subproblems\n\n if model decomposes (default: {:func:`defaultMulticutFactory()`})\n\n fallthroughFactory: multicut factory for solving subproblems\n\n if model does not decompose (default: {:func:`defaultMulticutFactory()`})\n\n\n\n Returns:\n\n %s : multicut factory\n\n \"\"\"%(factoryClsName(\"MulticutDecomposer\"),factoryClsName(\"MulticutDecomposer\"))\n\n\n\n\n\n def multicutIlpFactory(addThreeCyclesConstraints=True,\n\n addOnlyViolatedThreeCyclesConstraints=True,\n\n ilpSolverSettings=None,\n\n ilpSolver = None):\n\n # default solver:\n\n if ilpSolver is None and Configuration.WITH_CPLEX:\n\n ilpSolver = 'cplex'\n\n if ilpSolver is None and Configuration.WITH_GUROBI:\n\n ilpSolver = 'gurobi'\n\n if ilpSolver is None and Configuration.WITH_GLPK:\n\n ilpSolver = 'glpk'\n\n if ilpSolver is None:\n\n raise RuntimeError(\"multicutIlpFactory needs either \"\n\n \"'WITH_CPLEX', 'WITH_GUROBI'\"\n\n \" or 'WITH_GLPK' to be enabled\")\n\n\n\n if ilpSolver == 'cplex':\n\n if not Configuration.WITH_CPLEX:\n\n raise RuntimeError(\"multicutIlpFactory with ilpSolver=`cplex` need nifty \"\n\n \"to be compiled with WITH_CPLEX\")\n\n s,F = getSettingsAndFactoryCls(\"MulticutIlpCplex\")\n\n elif ilpSolver == 'gurobi':\n\n if not Configuration.WITH_GUROBI:\n\n raise RuntimeError(\"multicutIlpFactory with ilpSolver=`gurobi` need nifty \"\n\n \"to be compiled with WITH_GUROBI\")\n\n s,F = getSettingsAndFactoryCls(\"MulticutIlpGurobi\")\n\n elif ilpSolver == 'glpk':\n\n if not Configuration.WITH_GLPK:\n\n raise RuntimeError(\"multicutIlpFactory with ilpSolver=`glpk` need nifty \"\n\n \"to be compiled with WITH_GLPK\")\n\n s,F = getSettingsAndFactoryCls(\"MulticutIlpGlpk\")\n\n else:\n\n raise RuntimeError(\"%s is an unknown ilp solver\"%str(ilpSolver))\n\n s.addThreeCyclesConstraints = bool(addThreeCyclesConstraints)\n\n s.addOnlyViolatedThreeCyclesConstraints = bool(addOnlyViolatedThreeCyclesConstraints)\n\n if ilpSolverSettings is None:\n\n ilpSolverSettings = ilpSettings()\n\n s.ilpSettings = ilpSolverSettings\n\n return F(s)\n\n\n\n O.multicutIlpFactory = staticmethod(multicutIlpFactory)\n\n if Configuration.WITH_CPLEX:\n\n O.multicutIlpCplexFactory = staticmethod(partial(multicutIlpFactory,ilpSolver='cplex'))\n\n if Configuration.WITH_GUROBI:\n\n O.multicutIlpGurobiFactory = staticmethod(partial(multicutIlpFactory,ilpSolver='gurobi'))\n\n if Configuration.WITH_GLPK:\n\n O.multicutIlpGlpkFactory = staticmethod(partial(multicutIlpFactory,ilpSolver='glpk'))\n\n\n\n O.multicutIlpFactory.__doc__ = \"\"\" create an instance of an ilp multicut solver.\n\n\n\n Find a global optimal solution by a cutting plane ILP solver\n\n as described in :cite:`Kappes-2011`\n\n and :cite:`andres_2011_probabilistic`\n\n\n\n\n\n Note:\n\n This might take very long for large models.\n\n\n\n Args:\n\n addThreeCyclesConstraints (bool) :\n\n explicitly add constraints for cycles\n\n of length 3 before opt (default: {True})\n\n addOnlyViolatedThreeCyclesConstraints (bool) :\n\n explicitly add all violated constraints for only violated cycles\n\n of length 3 before opt (default: {True})\n\n ilpSolverSettings (:class:`IlpBackendSettings`) :\n\n SettingsType of the ilp solver (default : {:func:`ilpSettings`})\n\n ilpSolver (str) : name of the solver. Must be in\n\n either \"cplex\", \"gurobi\" or \"glpk\".\n\n \"glpk\" is only capable of solving very small models.\n\n (default: {\"cplex\"}).\n\n\n\n Returns:\n\n %s or %s or %s : multicut factory for the corresponding solver\n\n\n\n \"\"\"%(\n\n factoryClsName(\"MulticutIlpCplex\"),\n\n factoryClsName(\"MulticutIlpGurobi\"),\n\n factoryClsName(\"MulticutIlpGlpk\"),\n\n )\n\n\n\n\n\n # O.multicutIlpCplexFactory.__doc__ =\n\n # O.multicutIlpGurobiFactory\n\n # O.multicutIlpGlpkFactory\n\n\n\n\n\n\n\n if Configuration.WITH_LP_MP:\n\n def multicutMpFactory(\n\n mcFactory = None,\n\n numberOfIterations = 1000,\n\n verbose = 0,\n\n primalComputationInterval = 100,\n\n standardReparametrization = \"anisotropic\",\n\n roundingReparametrization = \"damped_uniform\",\n\n tightenReparametrization = \"damped_uniform\",\n\n tighten = True,\n\n tightenInterval = 100,\n\n tightenIteration = 10,\n\n tightenSlope = 0.02,\n\n tightenConstraintsPercentage = 0.1,\n\n minDualImprovement = 0.,\n\n minDualImprovementInterval = 0,\n\n timeout = 0,\n\n numberOfThreads = 1\n\n ):\n\n\n\n settings, factoryCls = getSettingsAndFactoryCls(\"MulticutMp\")\n\n\n\n settings.mcFactory = mcFactory\n\n settings.numberOfIterations = numberOfIterations\n\n settings.verbose = verbose\n\n settings.primalComputationInterval = primalComputationInterval\n\n settings.standardReparametrization = standardReparametrization\n\n settings.roundingReparametrization = roundingReparametrization\n\n settings.tightenReparametrization = tightenReparametrization\n\n settings.tighten = tighten\n\n settings.tightenInterval = tightenInterval\n\n settings.tightenIteration = tightenIteration\n\n settings.tightenSlope = tightenSlope\n\n settings.tightenConstraintsPercentage = tightenConstraintsPercentage\n\n settings.minDualImprovement = minDualImprovement\n\n settings.minDualImprovementInterval = minDualImprovementInterval\n\n settings.timeout = timeout\n\n settings.numberOfThreads = numberOfThreads\n\n\n\n return factoryCls(settings)\n\n\n\n O.multicutMpFactory = staticmethod(multicutMpFactory)\n\n\n\n\n\n def fusionMoveSettings(mcFactory=None):\n\n if mcFactory is None:\n\n if Configuration.WITH_CPLEX:\n\n mcFactory = MulticutObjectiveUndirectedGraph.multicutIlpCplexFactory()\n\n else:\n\n mcFactory = MulticutObjectiveUndirectedGraph.defaultMulticutFactory()\n\n s = getSettings('FusionMove')\n\n s.mcFactory = mcFactory\n\n return s\n\n O.fusionMoveSettings = staticmethod(fusionMoveSettings)\n\n\n\n\n\n\n\n\n\n def watershedCcProposals(sigma=1.0, numberOfSeeds=0.1):\n\n s,F = getSettingsAndFactoryCls(\"WatershedProposalGenerator\")\n\n s.sigma = float(sigma)\n\n s.numberOfSeeds = float(numberOfSeeds)\n\n return F(s)\n\n O.watershedCcProposals = staticmethod(watershedCcProposals)\n\n\n\n\n\n def interfaceFlipperCcProposals():\n\n s,F = getSettingsAndFactoryCls(\"InterfaceFlipperProposalGenerator\")\n\n return F(s)\n\n O.interfaceFlipperCcProposals = staticmethod(interfaceFlipperCcProposals)\n\n\n\n\n\n def randomNodeColorCcProposals(numberOfColors=2):\n\n s,F = getSettingsAndFactoryCls(\"RandomNodeColorProposalGenerator\")\n\n s.numberOfColors = int(numberOfColors)\n\n return F(s)\n\n O.randomNodeColorCcProposals = staticmethod(randomNodeColorCcProposals)\n\n\n\n\n\n @warmStartGreeedyDecorator\n\n def ccFusionMoveBasedFactory(proposalGenerator=None,\n\n numberOfThreads=1, numberOfIterations=100,\n\n stopIfNoImprovement=10, fusionMove=None):\n\n\n\n\n\n solverSettings,F = getSettingsAndFactoryCls(\"CcFusionMoveBased\")\n\n\n\n if proposalGenerator is None:\n\n proposalGenerator = watershedCcProposals()\n\n if fusionMove is None:\n\n fusionMove = fusionMoveSettings()\n\n\n\n\n\n\n\n solverSettings.fusionMoveSettings = fusionMove\n\n solverSettings.proposalGenerator = proposalGenerator\n\n solverSettings.numberOfIterations = int(numberOfIterations)\n\n solverSettings.stopIfNoImprovement = int(stopIfNoImprovement)\n\n solverSettings.numberOfThreads = int(numberOfThreads)\n\n factory = F(solverSettings)\n\n return factory\n\n O.ccFusionMoveBasedFactory = staticmethod(ccFusionMoveBasedFactory)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n def perturbAndMapSettings( numberOfIterations=1000,\n\n numberOfThreads=-1,\n\n verbose=1,\n\n noiseType='normal',\n\n noiseMagnitude=1.0,\n\n mcFactory=None):\n\n if mcFactory is None:\n\n mcFactory = fusionMoveBasedFactory(numberOfThreads=0)\n\n s = getSettings('PerturbAndMap')\n\n s.numberOfIterations = int(numberOfIterations)\n\n s.numberOfThreads = int(numberOfThreads)\n\n s.verbose = int(verbose)\n\n s.noiseMagnitude = float(noiseMagnitude)\n\n\n\n if(noiseType == 'normal'):\n\n s.noiseType = getMcCls('PerturbAndMap').NORMAL_NOISE\n\n elif(noiseType == 'uniform'):\n\n s.noiseType = getMcCls('PerturbAndMap').UNIFORM_NOISE\n\n elif(noiseType == 'makeLessCertain'):\n\n s.noiseType = graph.multicut.PerturbAndMapUndirectedGraph.MAKE_LESS_CERTAIN\n\n else:\n\n raise RuntimeError(\"'%s' is an unknown noise type. Must be 'normal' or 'uniform' or 'makeLessCertain' \"%str(noiseType))\n\n\n\n s.mcFactory = mcFactory\n\n return s\n\n O.perturbAndMapSettings = staticmethod(perturbAndMapSettings)\n\n\n\n def perturbAndMap(objective, settings):\n\n pAndM = graph.multicut.perturbAndMap(objective, settings)\n\n return pAndM\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 65, "score": 81656.60982434177 }, { "content": " def multicutMpFactory(\n\n mcFactory = None,\n\n numberOfIterations = 1000,\n\n verbose = 0,\n\n primalComputationInterval = 100,\n\n standardReparametrization = \"anisotropic\",\n\n roundingReparametrization = \"damped_uniform\",\n\n tightenReparametrization = \"damped_uniform\",\n\n tighten = True,\n\n tightenInterval = 100,\n\n tightenIteration = 10,\n\n tightenSlope = 0.02,\n\n tightenConstraintsPercentage = 0.1,\n\n minDualImprovement = 0.,\n\n minDualImprovementInterval = 0,\n\n timeout = 0,\n\n numberOfThreads = 1\n\n ):\n\n\n\n settings, factoryCls = getSettingsAndFactoryCls(\"MulticutMp\")\n\n\n\n settings.mcFactory = mcFactory\n\n settings.numberOfIterations = numberOfIterations\n\n settings.verbose = verbose\n\n settings.primalComputationInterval = primalComputationInterval\n\n settings.standardReparametrization = standardReparametrization\n\n settings.roundingReparametrization = roundingReparametrization\n\n settings.tightenReparametrization = tightenReparametrization\n\n settings.tighten = tighten\n\n settings.tightenInterval = tightenInterval\n\n settings.tightenIteration = tightenIteration\n\n settings.tightenSlope = tightenSlope\n\n settings.tightenConstraintsPercentage = tightenConstraintsPercentage\n\n settings.minDualImprovement = minDualImprovement\n\n settings.minDualImprovementInterval = minDualImprovementInterval\n\n settings.timeout = timeout\n\n settings.numberOfThreads = numberOfThreads\n\n\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 66, "score": 81656.60982434177 }, { "content": " def getSettingsCls(baseName):\n\n S = getCls(baseName + \"SettingsType\" ,objectiveName)\n", "file_path": "src/python/module/nifty/graph/opt/mincut/__init__.py", "rank": 67, "score": 81656.60982434177 }, { "content": " def minstcutQpboFactory(improve=True):\n\n if Configuration.WITH_QPBO:\n\n s,F = getSettingsAndFactoryCls(\"minstcutQpbo\")\n\n s.improve = bool(improve)\n\n return F(s)\n\n else:\n", "file_path": "src/python/module/nifty/graph/opt/minstcut/__init__.py", "rank": 68, "score": 81656.60982434177 }, { "content": " def greedyAdditiveFactory( weightStopCond=0.0, nodeNumStopCond=-1.0, improve=True):\n\n if Configuration.WITH_QPBO:\n\n s,F = getSettingsAndFactoryCls(\"minstcutGreedyAdditive\")\n\n s.weightStopCond = float(weightStopCond)\n\n s.nodeNumStopCond = float(nodeNumStopCond)\n\n s.improve = bool(improve)\n\n return F(s)\n\n else:\n", "file_path": "src/python/module/nifty/graph/opt/minstcut/__init__.py", "rank": 69, "score": 81656.60982434177 }, { "content": " def getSettingsCls(baseName):\n\n S = getCls(baseName + \"SettingsType\" ,objectiveName)\n", "file_path": "src/python/module/nifty/graph/opt/minstcut/__init__.py", "rank": 70, "score": 81656.60982434177 }, { "content": " def defaultMulticutFactory():\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 71, "score": 81656.60982434177 }, { "content": " def cpp_obj(self):\n", "file_path": "src/python/module/nifty/graph/opt/lifted_multicut/__init__.py", "rank": 72, "score": 81656.60982434177 }, { "content": "def __extendMincutObj(objectiveCls, objectiveName):\n\n\n\n def getCls(prefix, postfix):\n\n return _mincut.__dict__[prefix+postfix]\n\n\n\n def getSettingsCls(baseName):\n\n S = getCls(baseName + \"SettingsType\" ,objectiveName)\n\n return S\n\n def getSolverCls(baseName):\n\n S = getCls(baseName,objectiveName)\n\n return S\n\n def getSettings(baseName):\n\n S = getSettingsCls(baseName)\n\n return S()\n\n def getSettingsAndFactoryCls(baseName):\n\n s = getSettings(baseName)\n\n F = getCls(baseName + \"Factory\" ,objectiveName)\n\n return s,F\n\n\n\n O = objectiveCls\n\n\n\n def mincutVerboseVisitor(visitNth=1,timeLimit=0):\n\n V = getSolverCls(\"VerboseVisitor\")\n\n return V(visitNth,timeLimit)\n\n #O.mincutVerboseVisitor = staticmethod(mincutVerboseVisitor)\n\n O.verboseVisitor = staticmethod(mincutVerboseVisitor)\n\n\n\n\n\n def watershedProposalGenerator(sigma=1.0, numberOfSeeds=0.1,seedingStrategie='SEED_FROM_NEGATIVE'):\n\n \"\"\"factory function for a watershed based proposal generator for mincutCcFusionMoveBased\n\n\n\n Args:\n\n sigma (float, optional): The weights are perturbed by a additive\n\n Gaussian noise n(0,sigma) (default 0.0)\n\n\n\n numberOfSeeds (float, optional): Number of seed to generate.\n\n A number smaller as one will be interpreted as a fraction of\n\n the number of nodes (default 0.1)\n\n seedingStrategie (str, optional): Can be:\n\n - 'SEED_FROM_NEGATIVE' : All negative weighted edges\n\n can be used to generate seeds.\n\n - 'SEED_FROM_ALL' : All edges\n\n can be used to generate seeds.\n\n Returns:\n\n TYPE: parameter object used construct a WatershedProposalGenerator\n\n \"\"\"\n\n pGenCls = getSolverCls(\"WatershedProposalGeneratorFactory\")\n\n pGenSettings = getSettings(\"WatershedProposalGenerator\")\n\n\n\n # map string to enum\n\n stringToEnum = {\n\n 'SEED_FROM_NEGATIVE' : pGenSettings.SeedingStrategie.SEED_FROM_NEGATIVE,\n\n 'SEED_FROM_ALL' : pGenSettings.SeedingStrategie.SEED_FROM_ALL,\n\n }\n\n try:\n\n enumVal = stringToEnum[seedingStrategie]\n\n except:\n\n raise RuntimeError(\"unkown seedingStrategie '%s': must be either\"\\\n\n \"'SEED_FROM_NEGATIVE' or 'SEED_FROM_ALL'\"%str(seedingStrategie))\n\n\n\n pGenSettings.sigma = float(sigma)\n\n pGenSettings.numberOfSeeds = float(numberOfSeeds)\n\n pGenSettings.seedingStrategie = enumVal\n\n\n\n return pGenCls(pGenSettings)\n\n\n\n O.watershedProposalGenerator = staticmethod(watershedProposalGenerator)\n\n\n\n\n\n def mincutQpboFactory(improve=True):\n\n if Configuration.WITH_QPBO:\n\n s,F = getSettingsAndFactoryCls(\"MincutQpbo\")\n\n s.improve = bool(improve)\n\n return F(s)\n\n else:\n\n raise RuntimeError(\"mincutQpbo need nifty to be compiled WITH_QPBO\")\n\n O.mincutQpboFactory = staticmethod(mincutQpboFactory)\n\n\n\n\n\n def greedyAdditiveFactory( weightStopCond=0.0, nodeNumStopCond=-1.0, improve=True):\n\n if Configuration.WITH_QPBO:\n\n s,F = getSettingsAndFactoryCls(\"MincutGreedyAdditive\")\n\n s.weightStopCond = float(weightStopCond)\n\n s.nodeNumStopCond = float(nodeNumStopCond)\n\n s.improve = bool(improve)\n\n return F(s)\n\n else:\n\n raise RuntimeError(\"greedyAdditiveFactory need nifty to be compiled WITH_QPBO\")\n\n O.greedyAdditiveFactory = staticmethod(greedyAdditiveFactory)\n\n\n\n\n\n def mincutCcFusionMoveSettings(mincutFactory=None):\n\n if mincutFactory is None:\n\n if Configuration.WITH_QPBO:\n\n mincutFactory = MincutObjectiveUndirectedGraph.mincutQpboFactory()\n\n else:\n\n raise RuntimeError(\"default mincutFactory needs mincutQpbo, which need nifty to be compiled WITH_QPBO\")\n\n\n\n s = getSettings(\"MincutCcFusionMove\")\n\n s.mincutFactory = mincutFactory\n\n return s\n\n\n\n\n\n def mincutCcFusionMoveBasedFactory(proposalGenerator=None, numberOfThreads=1,\n\n numberOfIterations=1000, stopIfNoImprovement=100,\n\n fusionMoveSettings=None):\n\n \"\"\"factory function for a cc-fusion move based mincut solver\n\n\n\n Args:\n\n proposalGenerator (None, optional): Proposal generator (default watershedProposalGenerator)\n\n numberOfThreads (int, optional): (default 1)\n\n numberOfIterations (int, optional): Maximum number of iterations(default 1000)\n\n stopIfNoImprovement (int, optional): Stop after n iterations without improvement (default 100)\n\n fusionMoveSettings (FusionMoveSettings, optional) : The settings of the underlaying mincutCcFusionMove\n\n Returns:\n\n TYPE: MincutCcFusionMoveBasedFactory\n\n \"\"\"\n\n if proposalGenerator is None:\n\n proposalGenerator = watershedProposalGenerator()\n\n\n\n if fusionMoveSettings is None:\n\n fusionMoveSettings = mincutCcFusionMoveSettings()\n\n\n\n s,F = getSettingsAndFactoryCls(\"MincutCcFusionMoveBased\")\n\n s.proposalGenerator = proposalGenerator\n\n s.numberOfThreads = int(numberOfThreads)\n\n s.numberOfIterations = int(numberOfIterations)\n\n s.stopIfNoImprovement = int(stopIfNoImprovement)\n\n s.fusionMoveSettings = fusionMoveSettings\n\n return F(s)\n\n\n", "file_path": "src/python/module/nifty/graph/opt/mincut/__init__.py", "rank": 73, "score": 81656.60982434177 }, { "content": " def getMcCls(baseName):\n\n S = getCls(baseName,objectiveName)\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 74, "score": 81656.60982434177 }, { "content": " def multicutDecomposerFactory(submodelFactory=None, fallthroughFactory=None):\n\n\n\n if submodelFactory is None:\n\n submodelFactory = MulticutObjectiveUndirectedGraph.defaultMulticutFactory()\n\n\n\n if fallthroughFactory is None:\n\n fallthroughFactory = O.defaultMulticutFactory()\n\n\n\n\n\n s,F = getSettingsAndFactoryCls(\"MulticutDecomposer\")\n\n s.submodelFactory = submodelFactory\n\n s.fallthroughFactory = fallthroughFactory\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 75, "score": 81656.60982434177 }, { "content": " def generateGrid(self, gridSize):\n\n def nid(x, y):\n\n return x*gridSize[1] + y\n\n G = nifty.graph.UndirectedGraph\n\n g = G(gridSize[0] * gridSize[1])\n\n for x in range(gridSize[0]):\n\n for y in range(gridSize[1]):\n\n\n\n u = nid(x,y)\n\n\n\n if x + 1 < gridSize[0]:\n\n\n\n v = nid(x+1, y)\n\n g.insertEdge(u, v)\n\n\n\n if y + 1 < gridSize[1]:\n\n\n\n v = nid(x, y+1)\n\n g.insertEdge(u, v)\n", "file_path": "src/python/test/graph/minstcut/test_minstcut_solvers.py", "rank": 76, "score": 80481.06531840438 }, { "content": " def gridModel(self, gridSize = [5,5], weightRange = [-2,1]):\n\n g,nid = self.generateGrid(gridSize)\n\n d = weightRange[1] - weightRange[0]\n\n w = numpy.random.rand(g.numberOfEdges)*d + float(weightRange[0])\n\n # print(w.min(),w.max())\n\n obj = nifty.graph.multicut.multicutObjective(g,w)\n", "file_path": "src/python/test/graph/multicut/test_multicut_solvers.py", "rank": 77, "score": 80481.06531840438 }, { "content": " def generateGrid(self, gridSize):\n\n def nid(x, y):\n\n return x*gridSize[1] + y\n\n G = nifty.graph.UndirectedGraph\n\n g = G(gridSize[0] * gridSize[1])\n\n for x in range(gridSize[0]):\n\n for y in range(gridSize[1]):\n\n\n\n u = nid(x,y)\n\n\n\n if x + 1 < gridSize[0]:\n\n\n\n v = nid(x+1, y)\n\n g.insertEdge(u, v)\n\n\n\n if y + 1 < gridSize[1]:\n\n\n\n v = nid(x, y+1)\n\n g.insertEdge(u, v)\n\n\n", "file_path": "src/python/test/graph/mincut/test_mincut_solvers.py", "rank": 78, "score": 80481.06531840438 }, { "content": " def gridModel(self, gridSize = [5,5], weightRange = [-2,1]):\n\n g,nid = self.generateGrid(gridSize)\n\n d = weightRange[1] - weightRange[0]\n\n w = numpy.random.rand(g.numberOfEdges)*d + float(weightRange[0])\n\n print(w.min(),w.max())\n\n obj = nifty.graph.opt.mincut.mincutObjective(g,w)\n", "file_path": "src/python/test/graph/mincut/test_mincut_solvers.py", "rank": 79, "score": 80481.06531840438 }, { "content": " def gridModel(self):\n\n\n\n beta = .7\n\n gridSize = [5,5]\n\n weightRange = [0,1]\n\n\n\n g,nid = self.generateGrid(gridSize)\n\n d = weightRange[1] - weightRange[0]\n\n\n\n w = numpy.zeros(g.numberOfEdges)\n\n u = numpy.zeros((g.numberOfNodes,2))\n\n\n\n labels = numpy.zeros(g.nodeIdUpperBound+1,dtype='uint8')\n\n\n\n for x in range(gridSize[0]):\n\n for y in range(gridSize[1]):\n\n\n\n nodeId = nid(x,y)\n\n if x in range(1,gridSize[0] - 1):\n\n if y in range(1,gridSize[1] - 1):\n\n u[nodeId,0] = .1\n\n u[nodeId,1] = .9\n\n labels[nodeId] = 1\n\n else:\n\n u[nodeId,0] = .9\n\n u[nodeId,1] = .1\n\n labels[nodeId] = 0\n\n else:\n\n u[nodeId,0] = .9\n\n u[nodeId,1] = .1\n\n labels[nodeId] = 0\n\n\n\n for x in range(gridSize[0]):\n\n for y in range(gridSize[1]):\n\n\n\n p = nid(x,y)\n\n\n\n if x + 1 < gridSize[0]:\n\n q = nid(x+1,y)\n\n weightId = g.findEdge(p,q)\n\n if (u[p,0] == u[q,0]):\n\n w[weightId] = 0\n\n else:\n\n w[weightId] = beta\n\n if y + 1 < gridSize[1]:\n\n q = nid(x, y + 1)\n\n weightId = g.findEdge(p,q)\n\n if (u[p,0] == u[q,0]):\n\n w[weightId] = 0\n\n else:\n\n w[weightId] = beta\n\n\n\n obj = nifty.graph.opt.minstcut.minstcutObjective(g,w)\n\n\n", "file_path": "src/python/test/graph/minstcut/test_minstcut_solvers.py", "rank": 80, "score": 80481.06531840438 }, { "content": " def testCgc(self):\n\n objective = self.gridModel(gridSize=[6,6])\n\n solver = objective.cgcFactory(True,True).create(objective)\n\n visitor = objective.verboseVisitor(1)\n", "file_path": "src/python/test/graph/multicut/test_multicut_solvers.py", "rank": 81, "score": 80481.06531840438 }, { "content": " def generateGrid(self, gridSize):\n\n def nid(x, y):\n\n return x*gridSize[1] + y\n\n G = nifty.graph.UndirectedGraph\n\n g = G(gridSize[0] * gridSize[1])\n\n for x in range(gridSize[0]):\n\n for y in range(gridSize[1]):\n\n\n\n u = nid(x,y)\n\n\n\n if x + 1 < gridSize[0]:\n\n\n\n v = nid(x+1, y)\n\n g.insertEdge(u, v)\n\n\n\n if y + 1 < gridSize[1]:\n\n\n\n v = nid(x, y+1)\n\n g.insertEdge(u, v)\n", "file_path": "src/python/test/graph/multicut/test_multicut_solvers.py", "rank": 82, "score": 80481.06531840438 }, { "content": " def testDefault(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n", "file_path": "src/python/test/graph/multicut/test_multicut_solvers.py", "rank": 83, "score": 80481.06531840438 }, { "content": " def watershedProposalGenerator(sigma=1.0, numberOfSeeds=0.1,\n\n seedingStrategy='SEED_FROM_LIFTED'):\n\n \"\"\"factory function for a watershed based proposal generator for fusion move based\n\n lifted multicuts.\n\n\n\n Args:\n\n sigma (float, optional): The weights are perturbed by a additive\n\n Gaussian noise n(0,sigma) (default 0.0)\n\n\n\n numberOfSeeds (float, optional): Number of seed to generate.\n\n A number smaller as one will be interpreted as a fraction of\n\n the number of nodes (default 0.1)\n\n seedingStrategy (str, optional): Can be:\n\n - 'SEED_FROM_LIFTED' : All negative weighted lifted edges\n\n can be used to generate seeds.\n\n - 'SEED_FROM_LOCAL' : All negative weighted local edges\n\n can be used to generate seeds.\n\n - 'SEED_FROM_BOTH' : Both, lifted and local edges\n\n can be used for seeding\n\n\n\n Returns:\n\n TYPE: parameter object used construct a WatershedProposalGenerator\n\n\n\n \"\"\"\n\n pGenCls = getLmcCls(\"WatershedProposalGeneratorFactory\")\n\n pGenSettings = getSettings(\"WatershedProposalGenerator\")\n\n\n\n # map string to enum\n\n stringToEnum = {\n\n 'SEED_FROM_LIFTED' : pGenSettings.SeedingStrategy.SEED_FROM_LIFTED,\n\n 'SEED_FROM_LOCAL' : pGenSettings.SeedingStrategy.SEED_FROM_LOCAL,\n\n 'SEED_FROM_BOTH' : pGenSettings.SeedingStrategy.SEED_FROM_BOTH,\n\n }\n\n try:\n\n enumVal = stringToEnum[seedingStrategy]\n\n except:\n\n raise RuntimeError(\"unkown seedingStrategy '%s': must be either\"\\\n\n \"'SEED_FROM_LIFTED','SEED_FROM_LOCAL' or \"\\\n\n \" 'SEED_FROM_BOTH' \"%str(seedingStrategy))\n\n\n\n pGenSettings.sigma = float(sigma)\n\n pGenSettings.numberOfSeeds = float(numberOfSeeds)\n\n pGenSettings.seedingStrategy = enumVal\n\n\n", "file_path": "src/python/module/nifty/graph/opt/lifted_multicut/__init__.py", "rank": 84, "score": 80338.49019704745 }, { "content": " def getSettingsAndFactoryCls(baseName):\n\n s = getSettings(baseName)\n\n F = getCls(baseName + \"Factory\" ,objectiveName)\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 85, "score": 80336.79739879952 }, { "content": " def getSettingsCls(baseName):\n\n S = getCls(baseName + \"SettingsType\" ,objectiveName)\n", "file_path": "src/python/module/nifty/graph/opt/lifted_multicut/__init__.py", "rank": 86, "score": 80336.7973987995 }, { "content": " def warmStartGreeedyDecorator(func):\n\n def func_wrapper(*args, **kwargs):\n\n warmStartGreedy = kwargs.pop('warmStartGreedy', False)\n\n greedyVisitNth = kwargs.pop('greedyVisitNth', 100)\n\n if(warmStartGreedy):\n\n greedyFactory = greedyAdditiveFactory(visitNth=int(greedyVisitNth))\n\n factory = func(*args, **kwargs)\n\n return chainedSolversFactory(multicutFactories=[\n\n greedyFactory,\n\n factory\n\n ])\n\n else:\n\n return func(*args, **kwargs)\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 87, "score": 80336.7973987995 }, { "content": " def factoryClsName(baseName):\n", "file_path": "src/python/module/nifty/graph/opt/lifted_multicut/__init__.py", "rank": 88, "score": 80336.7973987995 }, { "content": " def getSettingsAndFactoryCls(baseName):\n\n s = getSettings(baseName)\n\n F = getCls(baseName + \"Factory\" ,objectiveName)\n", "file_path": "src/python/module/nifty/graph/opt/mincut/__init__.py", "rank": 89, "score": 80336.79739879952 }, { "content": " def getLmcCls(baseName):\n\n S = getCls(baseName,objectiveName)\n", "file_path": "src/python/module/nifty/graph/opt/lifted_multicut/__init__.py", "rank": 90, "score": 80336.7973987995 }, { "content": " def interfaceFlipperCcProposals():\n\n s,F = getSettingsAndFactoryCls(\"InterfaceFlipperProposalGenerator\")\n", "file_path": "src/python/module/nifty/graph/opt/multicut/__init__.py", "rank": 91, "score": 80336.7973987995 }, { "content": " def getSettingsAndFactoryCls(baseName):\n\n s = getSettings(baseName)\n\n F = getCls(baseName + \"Factory\" ,objectiveName)\n", "file_path": "src/python/module/nifty/graph/opt/minstcut/__init__.py", "rank": 92, "score": 80336.7973987995 }, { "content": " def setUpClass(self):\n\n\n\n urlData = 'https://www.dropbox.com/s/l1tgzlim8h1pb7w/test_data_anisotropic.zip?dl=0'\n\n call(['wget', '-Odata.zip', urlData])\n\n with zipfile.ZipFile('./data.zip') as f:\n\n f.extractall('.')\n\n os.remove('./data.zip')\n\n\n\n urlFeatures = 'https://www.dropbox.com/s/5nz0cjd9zdnfbmy/reference_features.zip?dl=0'\n\n call(['wget', '-Ofeatures.zip', urlFeatures])\n\n with zipfile.ZipFile('./features.zip') as f:\n\n f.extractall('./features')\n\n os.remove('./features.zip')\n\n\n\n self.nNodes = vigra.readHDF5('./data/seg.h5', 'data').max() + 1\n\n self.segFile = nh5.openFile('./data/seg.h5')\n\n self.segArray = nh5.hdf5Array('uint32', self.segFile, 'data')\n\n self.dataFile = nh5.openFile('./data/pmap.h5')\n", "file_path": "src/python/test/graph/rag/deprecated/test_accumulation_flat.py", "rank": 93, "score": 79458.19986058037 }, { "content": " def tearDownClass(self):\n\n nh5.closeFile(self.segFile)\n\n nh5.closeFile(self.dataFile)\n\n rmtree('./data')\n", "file_path": "src/python/test/graph/rag/deprecated/test_accumulation_flat.py", "rank": 94, "score": 79458.19986058037 }, { "content": " def nid(x, y):\n", "file_path": "src/python/test/graph/lifted_multicut/test_lifted_multicut_solvers.py", "rank": 95, "score": 79080.1566044151 }, { "content": " def testMulticutDecomposer(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n", "file_path": "src/python/test/graph/multicut/test_multicut_solvers.py", "rank": 96, "score": 79080.1566044151 }, { "content": " def testGreedyAdditive(self):\n\n Obj = nifty.graph.UndirectedGraph.MulticutObjective\n", "file_path": "src/python/test/graph/multicut/test_multicut_solvers.py", "rank": 97, "score": 79080.1566044151 }, { "content": " def testMincutQpbo(self):\n\n objective = self.gridModel(gridSize=[4,4])\n\n solver = objective.mincutQpboFactory(improve=False).create(objective)\n\n visitor = objective.verboseVisitor(1)\n", "file_path": "src/python/test/graph/mincut/test_mincut_solvers.py", "rank": 98, "score": 79080.1566044151 }, { "content": " def fusionMoveBasedFactory(proposalGenerator=None, numberOfThreads=1,\n\n numberOfIterations=1000, stopIfNoImprovement=100):\n\n \"\"\"factory function for a fusion move based lifted\n\n multicut solver\n\n\n\n Args:\n\n proposalGenerator (None, optional): Proposal generator (default watershedProposalGenerator)\n\n numberOfThreads (int, optional): (default 1)\n\n numberOfIterations (int, optional): Maximum number of iterations(default 1000)\n\n stopIfNoImprovement (int, optional): Stop after n iterations without improvement (default 100)\n\n\n\n Returns:\n\n TYPE: Description\n\n \"\"\"\n\n if proposalGenerator is None:\n\n proposalGenerator = watershedProposalGenerator()\n\n s,F = getSettingsAndFactoryCls(\"FusionMoveBased\")\n\n s.proposalGenerator = proposalGenerator\n\n s.numberOfThreads = int(numberOfThreads)\n\n s.numberOfIterations = int(numberOfIterations)\n\n s.stopIfNoImprovement = int(stopIfNoImprovement)\n", "file_path": "src/python/module/nifty/graph/opt/lifted_multicut/__init__.py", "rank": 99, "score": 79071.13741703152 } ]
C++
src/prod/src/Naming/EntreeService.ForwardToFileStoreServiceAsyncOperation.cpp
gridgentoo/ServiceFabricAzure
c3e7a07617e852322d73e6cc9819d266146866a4
#include "stdafx.h" namespace Naming { using namespace Common; using namespace Federation; using namespace Query; using namespace Reliability; using namespace std; using namespace SystemServices; using namespace Transport; using namespace Management::FileStoreService; using namespace ClientServerTransport; StringLiteral const TraceComponent("ProcessRequest.ForwardToFileStoreServiceAsyncOperation"); EntreeService::ForwardToFileStoreServiceAsyncOperation::ForwardToFileStoreServiceAsyncOperation( __in GatewayProperties & properties, MessageUPtr && receivedMessage, TimeSpan const timeout, AsyncCallback const & callback, AsyncOperationSPtr const & parent) : RequestAsyncOperationBase (properties, std::move(receivedMessage), timeout, callback, parent) , serviceName_() , partitionId_() , activityHeader_() { } void EntreeService::ForwardToFileStoreServiceAsyncOperation::OnRetry(AsyncOperationSPtr const & thisSPtr) { this->StartResolve(thisSPtr); } void EntreeService::ForwardToFileStoreServiceAsyncOperation::OnStartRequest(AsyncOperationSPtr const & thisSPtr) { TimedAsyncOperation::OnStart(thisSPtr); Transport::ForwardMessageHeader forwardMessageHeader; if (!ReceivedMessage->Headers.TryReadFirst(forwardMessageHeader)) { WriteWarning(TraceComponent, "{0} ForwardMessageHeader missing: {1}", this->TraceId, *ReceivedMessage); TryComplete(thisSPtr, ErrorCodeValue::InvalidMessage); return; } NamingPropertyHeader propertyHeader; if (ReceivedMessage->Headers.TryReadFirst(propertyHeader)) { WriteNoise( TraceComponent, "{0} read property header ({1})", this->TraceId, propertyHeader); serviceName_ = propertyHeader.Name; partitionId_ = propertyHeader.PropertyName; } else { this->TryComplete(thisSPtr, ErrorCodeValue::InvalidMessage); return; } if (!ReceivedMessage->Headers.TryReadFirst(activityHeader_)) { activityHeader_ = FabricActivityHeader(Guid::NewGuid()); WriteWarning( TraceComponent, "{0} message {1} missing activity header: generated = {2}", this->TraceId, *ReceivedMessage, activityHeader_); } ServiceRoutingAgentHeader routingAgentHeader; bool hasRoutingAgentHeader = ReceivedMessage->Headers.TryReadFirst(routingAgentHeader); ReceivedMessage->Headers.RemoveAll(); ReceivedMessage->Headers.Replace(ActorHeader(forwardMessageHeader.Actor)); ReceivedMessage->Headers.Replace(ActionHeader(forwardMessageHeader.Action)); ReceivedMessage->Headers.Replace(activityHeader_); if (hasRoutingAgentHeader) { ReceivedMessage->Headers.Replace(routingAgentHeader); } this->StartResolve(thisSPtr); } void EntreeService::ForwardToFileStoreServiceAsyncOperation::StartResolve(Common::AsyncOperationSPtr const & thisSPtr) { auto batch = Common::make_unique<NamePropertyOperationBatch>(serviceName_); batch->AddGetPropertyOperation(partitionId_); MessageUPtr message = NamingTcpMessage::GetPropertyBatch(std::move(batch))->GetTcpMessage(); message->Headers.Replace(activityHeader_); auto inner = AsyncOperation::CreateAndStart<PropertyBatchAsyncOperation>( this->Properties, std::move(message), RemainingTime, [this] (AsyncOperationSPtr const & asyncOperation) { this->OnResolveRequestComplete(asyncOperation, false ); }, thisSPtr); this->OnResolveRequestComplete(inner, true ); } void EntreeService::ForwardToFileStoreServiceAsyncOperation::OnResolveRequestComplete( AsyncOperationSPtr const & asyncOperation, bool expectedCompletedSynchronously) { if (asyncOperation->CompletedSynchronously != expectedCompletedSynchronously) { return; } MessageUPtr reply; ErrorCode error = RequestAsyncOperationBase::End(asyncOperation, reply); if (error.IsSuccess() && reply.get() == nullptr) { TRACE_WARNING_AND_TESTASSERT(TraceComponent, "{0}: null reply message on success", this->TraceId); error = ErrorCodeValue::OperationFailed; } if (error.IsSuccess()) { NamePropertyOperationBatchResult batchResult; if (!reply->GetBody(batchResult)) { this->TryComplete(asyncOperation->Parent, ErrorCodeValue::OperationFailed); return; } if(batchResult.Properties.empty()) { this->HandleRetryStart(asyncOperation->Parent); return; } vector<BYTE> serializedData = batchResult.Properties.front().Bytes; Management::FileStoreService::FileStorePartitionInfo info; error = FabricSerializer::Deserialize(info, serializedData); ASSERT_IFNOT(error.IsSuccess(), "Deserization of ReplicaInfo object should succeed. Error:{0}", error); WriteInfo( TraceComponent, "{0}: Received address from naming - SequenceNumber: {1}, Address: {2}", this->TraceId, batchResult.Properties.front().Metadata.SequenceNumber, info.PrimaryLocation); SystemServiceLocation parsedLocation; if (SystemServiceLocation::TryParse(info.PrimaryLocation, parsedLocation)) { auto instance = this->Properties.RequestInstance.GetNextInstance(); this->ReceivedMessage->Headers.Replace(TimeoutHeader(this->RemainingTime)); this->ReceivedMessage->Headers.Replace(parsedLocation.CreateFilterHeader()); this->ReceivedMessage->Headers.Replace(GatewayRetryHeader(this->RetryCount)); this->ReceivedMessage->Headers.Replace(RequestInstanceHeader(instance)); NodeInstance const & node = parsedLocation.NodeInstance; this->RouteToNode( this->ReceivedMessage->Clone(), node.Id, node.InstanceId, true, asyncOperation->Parent); return; } else { WriteWarning( TraceComponent, "{0}: could not parse system service location: {1}", this->TraceId, info.PrimaryLocation); this->HandleRetryStart(asyncOperation->Parent); return; } } else if (this->IsRetryable(error)) { WriteWarning( TraceComponent, "{0}: could not get FileStoreService address from naming - retrying. error = {1}", this->TraceId, error); this->HandleRetryStart(asyncOperation->Parent); return; } this->TryComplete(asyncOperation->Parent, error); } bool EntreeService::ForwardToFileStoreServiceAsyncOperation::IsRetryable(ErrorCode const & error) { switch (error.ReadValue()) { case ErrorCodeValue::ServiceOffline: case ErrorCodeValue::PartitionNotFound: return true; default: return NamingErrorCategories::IsRetryableAtGateway(error); } } }
#include "stdafx.h" namespace Naming { using namespace Common; using namespace Federation; using namespace Query; using namespace Reliability; using namespace std; using namespace SystemServices; using namespace Transport; using namespace Management::FileStoreService; using namespace ClientServerTransport; StringLiteral const TraceComponent("ProcessRequest.ForwardToFileStoreServiceAsyncOperation"); EntreeService::ForwardToFileStoreServiceAsyncOperation::ForwardToFileStoreServiceAsyncOperation( __in GatewayProperties & properties, MessageUPtr && receivedMessage, TimeSpan const timeout, AsyncCallback const & callback, AsyncOperationSPtr const & parent) : RequestAsyncOperationBase (properties, std::move(receivedMessage), timeout, callback, parent) , serviceName_() , partitionId_() , activityHeader_() { } void EntreeService::ForwardToFileStoreServiceAsyncOperation::OnRetry(AsyncOperationSPtr const & thisSPtr) { this->StartResolve(thisSPtr); }
void EntreeService::ForwardToFileStoreServiceAsyncOperation::StartResolve(Common::AsyncOperationSPtr const & thisSPtr) { auto batch = Common::make_unique<NamePropertyOperationBatch>(serviceName_); batch->AddGetPropertyOperation(partitionId_); MessageUPtr message = NamingTcpMessage::GetPropertyBatch(std::move(batch))->GetTcpMessage(); message->Headers.Replace(activityHeader_); auto inner = AsyncOperation::CreateAndStart<PropertyBatchAsyncOperation>( this->Properties, std::move(message), RemainingTime, [this] (AsyncOperationSPtr const & asyncOperation) { this->OnResolveRequestComplete(asyncOperation, false ); }, thisSPtr); this->OnResolveRequestComplete(inner, true ); } void EntreeService::ForwardToFileStoreServiceAsyncOperation::OnResolveRequestComplete( AsyncOperationSPtr const & asyncOperation, bool expectedCompletedSynchronously) { if (asyncOperation->CompletedSynchronously != expectedCompletedSynchronously) { return; } MessageUPtr reply; ErrorCode error = RequestAsyncOperationBase::End(asyncOperation, reply); if (error.IsSuccess() && reply.get() == nullptr) { TRACE_WARNING_AND_TESTASSERT(TraceComponent, "{0}: null reply message on success", this->TraceId); error = ErrorCodeValue::OperationFailed; } if (error.IsSuccess()) { NamePropertyOperationBatchResult batchResult; if (!reply->GetBody(batchResult)) { this->TryComplete(asyncOperation->Parent, ErrorCodeValue::OperationFailed); return; } if(batchResult.Properties.empty()) { this->HandleRetryStart(asyncOperation->Parent); return; } vector<BYTE> serializedData = batchResult.Properties.front().Bytes; Management::FileStoreService::FileStorePartitionInfo info; error = FabricSerializer::Deserialize(info, serializedData); ASSERT_IFNOT(error.IsSuccess(), "Deserization of ReplicaInfo object should succeed. Error:{0}", error); WriteInfo( TraceComponent, "{0}: Received address from naming - SequenceNumber: {1}, Address: {2}", this->TraceId, batchResult.Properties.front().Metadata.SequenceNumber, info.PrimaryLocation); SystemServiceLocation parsedLocation; if (SystemServiceLocation::TryParse(info.PrimaryLocation, parsedLocation)) { auto instance = this->Properties.RequestInstance.GetNextInstance(); this->ReceivedMessage->Headers.Replace(TimeoutHeader(this->RemainingTime)); this->ReceivedMessage->Headers.Replace(parsedLocation.CreateFilterHeader()); this->ReceivedMessage->Headers.Replace(GatewayRetryHeader(this->RetryCount)); this->ReceivedMessage->Headers.Replace(RequestInstanceHeader(instance)); NodeInstance const & node = parsedLocation.NodeInstance; this->RouteToNode( this->ReceivedMessage->Clone(), node.Id, node.InstanceId, true, asyncOperation->Parent); return; } else { WriteWarning( TraceComponent, "{0}: could not parse system service location: {1}", this->TraceId, info.PrimaryLocation); this->HandleRetryStart(asyncOperation->Parent); return; } } else if (this->IsRetryable(error)) { WriteWarning( TraceComponent, "{0}: could not get FileStoreService address from naming - retrying. error = {1}", this->TraceId, error); this->HandleRetryStart(asyncOperation->Parent); return; } this->TryComplete(asyncOperation->Parent, error); } bool EntreeService::ForwardToFileStoreServiceAsyncOperation::IsRetryable(ErrorCode const & error) { switch (error.ReadValue()) { case ErrorCodeValue::ServiceOffline: case ErrorCodeValue::PartitionNotFound: return true; default: return NamingErrorCategories::IsRetryableAtGateway(error); } } }
void EntreeService::ForwardToFileStoreServiceAsyncOperation::OnStartRequest(AsyncOperationSPtr const & thisSPtr) { TimedAsyncOperation::OnStart(thisSPtr); Transport::ForwardMessageHeader forwardMessageHeader; if (!ReceivedMessage->Headers.TryReadFirst(forwardMessageHeader)) { WriteWarning(TraceComponent, "{0} ForwardMessageHeader missing: {1}", this->TraceId, *ReceivedMessage); TryComplete(thisSPtr, ErrorCodeValue::InvalidMessage); return; } NamingPropertyHeader propertyHeader; if (ReceivedMessage->Headers.TryReadFirst(propertyHeader)) { WriteNoise( TraceComponent, "{0} read property header ({1})", this->TraceId, propertyHeader); serviceName_ = propertyHeader.Name; partitionId_ = propertyHeader.PropertyName; } else { this->TryComplete(thisSPtr, ErrorCodeValue::InvalidMessage); return; } if (!ReceivedMessage->Headers.TryReadFirst(activityHeader_)) { activityHeader_ = FabricActivityHeader(Guid::NewGuid()); WriteWarning( TraceComponent, "{0} message {1} missing activity header: generated = {2}", this->TraceId, *ReceivedMessage, activityHeader_); } ServiceRoutingAgentHeader routingAgentHeader; bool hasRoutingAgentHeader = ReceivedMessage->Headers.TryReadFirst(routingAgentHeader); ReceivedMessage->Headers.RemoveAll(); ReceivedMessage->Headers.Replace(ActorHeader(forwardMessageHeader.Actor)); ReceivedMessage->Headers.Replace(ActionHeader(forwardMessageHeader.Action)); ReceivedMessage->Headers.Replace(activityHeader_); if (hasRoutingAgentHeader) { ReceivedMessage->Headers.Replace(routingAgentHeader); } this->StartResolve(thisSPtr); }
function_block-full_function
[]
C++
test/test_bencoding.cpp
kamyu104/libtorrent-1
87ec445943324a243be2b9499b74dc0983a42af9
#include "libtorrent/bencode.hpp" #include "libtorrent/bdecode.hpp" #include <iostream> #include <cstring> #include <utility> #include "test.hpp" using namespace lt; namespace { std::string encode(entry const& e) { std::string ret; bencode(std::back_inserter(ret), e); return ret; } } TORRENT_TEST(strings) { entry e("spam"); TEST_CHECK(encode(e) == "4:spam"); TEST_CHECK(bdecode(encode(e)) == e); } TORRENT_TEST(integers) { entry e(3); TEST_CHECK(encode(e) == "i3e"); TEST_CHECK(bdecode(encode(e)) == e); } TORRENT_TEST(integers2) { entry e(-3); TEST_CHECK(encode(e) == "i-3e"); TEST_CHECK(bdecode(encode(e)) == e); } TORRENT_TEST(integers3) { entry e(int(0)); TEST_CHECK(encode(e) == "i0e"); TEST_CHECK(bdecode(encode(e)) == e); } TORRENT_TEST(lists) { entry::list_type l; l.push_back(entry("spam")); l.push_back(entry("eggs")); entry e(l); TEST_CHECK(encode(e) == "l4:spam4:eggse"); TEST_CHECK(bdecode(encode(e)) == e); } TORRENT_TEST(dictionaries) { entry e(entry::dictionary_t); e["spam"] = entry("eggs"); e["cow"] = entry("moo"); TEST_CHECK(encode(e) == "d3:cow3:moo4:spam4:eggse"); TEST_CHECK(bdecode(encode(e)) == e); } TORRENT_TEST(preformatted) { entry e(entry::preformatted_t); char const str[] = "foobar"; e.preformatted().assign(str, str + sizeof(str)-1); TEST_EQUAL(encode(e), "foobar"); } TORRENT_TEST(preformatted_node) { entry e(entry::dictionary_t); char const str[] = "foobar"; e["info"] = entry::preformatted_type(str, str + sizeof(str)-1); TEST_EQUAL(encode(e), "d4:infofoobare"); } TORRENT_TEST(undefined_node) { entry e(entry::undefined_t); TEST_EQUAL(encode(e), "0:"); } TORRENT_TEST(undefined_node2) { entry e(entry::dictionary_t); e["info"] = entry(entry::undefined_t); TEST_EQUAL(encode(e), "d4:info0:e"); } TORRENT_TEST(implicit_construct) { entry e(entry::list_t); e.list().push_back(entry::list_t); TEST_EQUAL(e.list().back().type(), entry::list_t); } TORRENT_TEST(print_dict_single_line) { entry e; e["foo"] = "bar"; e["bar"] = "foo"; TEST_EQUAL(e.to_string(true), "{ 'bar': 'foo', 'foo': 'bar' }"); } TORRENT_TEST(print_dict) { entry e; e["foo"] = "bar"; e["bar"] = "foo"; TEST_EQUAL(e.to_string(), "{\n 'bar': 'foo',\n 'foo': 'bar' }"); } TORRENT_TEST(print_list_single_line) { entry e; e.list().push_back(entry("foo")); e.list().push_back(entry("bar")); TEST_EQUAL(e.to_string(true), "[ 'foo', 'bar' ]"); } TORRENT_TEST(print_list) { entry e; e.list().push_back(entry("foo")); e.list().push_back(entry("bar")); TEST_EQUAL(e.to_string(), "[\n 'foo',\n 'bar' ]"); } TORRENT_TEST(print_int_single_line) { entry e(1337); TEST_EQUAL(e.to_string(true), "1337"); } TORRENT_TEST(print_int) { entry e(1337); TEST_EQUAL(e.to_string(), "1337"); } TORRENT_TEST(print_string_single_line) { entry e("foobar"); TEST_EQUAL(e.to_string(true), "'foobar'"); } TORRENT_TEST(print_string) { entry e("foobar"); TEST_EQUAL(e.to_string(), "'foobar'"); } TORRENT_TEST(print_deep_dict_single_line) { entry e; e["strings"].list().push_back(entry("foo")); e["strings"].list().push_back(entry("bar")); e["ints"].list().push_back(entry(1)); e["ints"].list().push_back(entry(2)); e["ints"].list().push_back(entry(3)); e["a"] = "foobar"; TEST_EQUAL(e.to_string(true), "{ 'a': 'foobar', 'ints': [ 1, 2, 3 ], 'strings': [ 'foo', 'bar' ] }"); } TORRENT_TEST(print_deep_dict) { entry e; e["strings"].list().push_back(entry("foo")); e["strings"].list().push_back(entry("bar")); e["ints"].list().push_back(entry(1)); e["ints"].list().push_back(entry(2)); e["ints"].list().push_back(entry(3)); e["a"] = "foobar"; TEST_EQUAL(e.to_string(), R"({ 'a': 'foobar', 'ints': [ 1, 2, 3 ], 'strings': [ 'foo', 'bar' ] })"); } TORRENT_TEST(dict_constructor) { entry::dictionary_type e{{std::string("foo"), std::string("bar")}, {std::string("bar"), 1234}}; TEST_EQUAL(entry(e).to_string(), R"({ 'bar': 1234, 'foo': 'bar' })"); } TORRENT_TEST(integer_to_str) { using lt::aux::integer_to_str; std::array<char, 21> buf; TEST_CHECK(integer_to_str(buf, 0) == "0"_sv); TEST_CHECK(integer_to_str(buf, 1) == "1"_sv); TEST_CHECK(integer_to_str(buf, 2) == "2"_sv); TEST_CHECK(integer_to_str(buf, 3) == "3"_sv); TEST_CHECK(integer_to_str(buf, 4) == "4"_sv); TEST_CHECK(integer_to_str(buf, 5) == "5"_sv); TEST_CHECK(integer_to_str(buf, 6) == "6"_sv); TEST_CHECK(integer_to_str(buf, 7) == "7"_sv); TEST_CHECK(integer_to_str(buf, 8) == "8"_sv); TEST_CHECK(integer_to_str(buf, 9) == "9"_sv); TEST_CHECK(integer_to_str(buf, 10) == "10"_sv); TEST_CHECK(integer_to_str(buf, 11) == "11"_sv); TEST_CHECK(integer_to_str(buf, -1) == "-1"_sv); TEST_CHECK(integer_to_str(buf, -2) == "-2"_sv); TEST_CHECK(integer_to_str(buf, -3) == "-3"_sv); TEST_CHECK(integer_to_str(buf, -4) == "-4"_sv); TEST_CHECK(integer_to_str(buf, -5) == "-5"_sv); TEST_CHECK(integer_to_str(buf, -6) == "-6"_sv); TEST_CHECK(integer_to_str(buf, -7) == "-7"_sv); TEST_CHECK(integer_to_str(buf, -8) == "-8"_sv); TEST_CHECK(integer_to_str(buf, -9) == "-9"_sv); TEST_CHECK(integer_to_str(buf, -10) == "-10"_sv); TEST_CHECK(integer_to_str(buf, -11) == "-11"_sv); TEST_CHECK(integer_to_str(buf, 12) == "12"_sv); TEST_CHECK(integer_to_str(buf, -12) == "-12"_sv); TEST_CHECK(integer_to_str(buf, 123) == "123"_sv); TEST_CHECK(integer_to_str(buf, -123) == "-123"_sv); TEST_CHECK(integer_to_str(buf, 1234) == "1234"_sv); TEST_CHECK(integer_to_str(buf, -1234) == "-1234"_sv); TEST_CHECK(integer_to_str(buf, 12345) == "12345"_sv); TEST_CHECK(integer_to_str(buf, -12345) == "-12345"_sv); TEST_CHECK(integer_to_str(buf, 123456) == "123456"_sv); TEST_CHECK(integer_to_str(buf, -123456) == "-123456"_sv); TEST_CHECK(integer_to_str(buf, 123456789012345678LL) == "123456789012345678"_sv); TEST_CHECK(integer_to_str(buf, -123456789012345678LL) == "-123456789012345678"_sv); TEST_CHECK(integer_to_str(buf, std::numeric_limits<std::int64_t>::max()) == "9223372036854775807"_sv); TEST_CHECK(integer_to_str(buf, std::numeric_limits<std::int64_t>::min()) == "-9223372036854775808"_sv); }
#include "libtorrent/bencode.hpp" #include "libtorrent/bdecode.hpp" #include <iostream> #include <cstring> #include <utility> #include "test.hpp" using namespace lt; namespace { std::string encode(entry const& e) { std::string ret; bencode(std::back_inserter(ret), e); return ret; } } TORRENT_TEST(strings) { entry e("spam"); TEST_CHECK(encode(e) == "4:spam"); TEST_CHECK(bdecode(encode(e)) == e); } TORRENT_TEST(integers) { entry e(3); TEST_CHECK(encode(e) == "i3e"); TEST_CHECK(bdecode(encode(e)) == e); } TORRENT_TEST(integers2) { entry e(-3); TEST_CHECK(encode(e) == "i-3e"); TEST_CHECK(bdecode(encode(e)) == e); } TORRENT_TEST(integers3) { entry e(int(0)); TEST_CHECK(encode(e) == "i0e"); TEST_CHECK(bdecode(encode(e)) == e); } TORRENT_TEST(lists) { entry::list_type l; l.push_back(entry("spam")); l.push_back(entry("eggs")); entry e(l); TEST_CHECK(encode(e) == "l4:spam4:eggse"); TEST_CHECK(bdecode(encode(e)) == e); } TORRENT_TEST(dictionaries) { entry e(entry::dictionary_t); e["spam"] = entry("eggs"); e["cow"] = entry("moo"); TEST_CHECK(encode(e) == "d3:cow3:moo4:spam4:eggse"); TEST_CHECK(bdecode(encode(e)) == e); } TORRENT_TEST(preformatted) { entry e(entry::preformatted_t); char const str[] = "foobar"; e.preformatted().assign(str, str + sizeof(str)-1); TEST_EQUAL(encode(e), "foobar"); } TORRENT_TEST(preformatted_node) { entry e(entry::dictionary_t); char const
CK(integer_to_str(buf, 3) == "3"_sv); TEST_CHECK(integer_to_str(buf, 4) == "4"_sv); TEST_CHECK(integer_to_str(buf, 5) == "5"_sv); TEST_CHECK(integer_to_str(buf, 6) == "6"_sv); TEST_CHECK(integer_to_str(buf, 7) == "7"_sv); TEST_CHECK(integer_to_str(buf, 8) == "8"_sv); TEST_CHECK(integer_to_str(buf, 9) == "9"_sv); TEST_CHECK(integer_to_str(buf, 10) == "10"_sv); TEST_CHECK(integer_to_str(buf, 11) == "11"_sv); TEST_CHECK(integer_to_str(buf, -1) == "-1"_sv); TEST_CHECK(integer_to_str(buf, -2) == "-2"_sv); TEST_CHECK(integer_to_str(buf, -3) == "-3"_sv); TEST_CHECK(integer_to_str(buf, -4) == "-4"_sv); TEST_CHECK(integer_to_str(buf, -5) == "-5"_sv); TEST_CHECK(integer_to_str(buf, -6) == "-6"_sv); TEST_CHECK(integer_to_str(buf, -7) == "-7"_sv); TEST_CHECK(integer_to_str(buf, -8) == "-8"_sv); TEST_CHECK(integer_to_str(buf, -9) == "-9"_sv); TEST_CHECK(integer_to_str(buf, -10) == "-10"_sv); TEST_CHECK(integer_to_str(buf, -11) == "-11"_sv); TEST_CHECK(integer_to_str(buf, 12) == "12"_sv); TEST_CHECK(integer_to_str(buf, -12) == "-12"_sv); TEST_CHECK(integer_to_str(buf, 123) == "123"_sv); TEST_CHECK(integer_to_str(buf, -123) == "-123"_sv); TEST_CHECK(integer_to_str(buf, 1234) == "1234"_sv); TEST_CHECK(integer_to_str(buf, -1234) == "-1234"_sv); TEST_CHECK(integer_to_str(buf, 12345) == "12345"_sv); TEST_CHECK(integer_to_str(buf, -12345) == "-12345"_sv); TEST_CHECK(integer_to_str(buf, 123456) == "123456"_sv); TEST_CHECK(integer_to_str(buf, -123456) == "-123456"_sv); TEST_CHECK(integer_to_str(buf, 123456789012345678LL) == "123456789012345678"_sv); TEST_CHECK(integer_to_str(buf, -123456789012345678LL) == "-123456789012345678"_sv); TEST_CHECK(integer_to_str(buf, std::numeric_limits<std::int64_t>::max()) == "9223372036854775807"_sv); TEST_CHECK(integer_to_str(buf, std::numeric_limits<std::int64_t>::min()) == "-9223372036854775808"_sv); }
str[] = "foobar"; e["info"] = entry::preformatted_type(str, str + sizeof(str)-1); TEST_EQUAL(encode(e), "d4:infofoobare"); } TORRENT_TEST(undefined_node) { entry e(entry::undefined_t); TEST_EQUAL(encode(e), "0:"); } TORRENT_TEST(undefined_node2) { entry e(entry::dictionary_t); e["info"] = entry(entry::undefined_t); TEST_EQUAL(encode(e), "d4:info0:e"); } TORRENT_TEST(implicit_construct) { entry e(entry::list_t); e.list().push_back(entry::list_t); TEST_EQUAL(e.list().back().type(), entry::list_t); } TORRENT_TEST(print_dict_single_line) { entry e; e["foo"] = "bar"; e["bar"] = "foo"; TEST_EQUAL(e.to_string(true), "{ 'bar': 'foo', 'foo': 'bar' }"); } TORRENT_TEST(print_dict) { entry e; e["foo"] = "bar"; e["bar"] = "foo"; TEST_EQUAL(e.to_string(), "{\n 'bar': 'foo',\n 'foo': 'bar' }"); } TORRENT_TEST(print_list_single_line) { entry e; e.list().push_back(entry("foo")); e.list().push_back(entry("bar")); TEST_EQUAL(e.to_string(true), "[ 'foo', 'bar' ]"); } TORRENT_TEST(print_list) { entry e; e.list().push_back(entry("foo")); e.list().push_back(entry("bar")); TEST_EQUAL(e.to_string(), "[\n 'foo',\n 'bar' ]"); } TORRENT_TEST(print_int_single_line) { entry e(1337); TEST_EQUAL(e.to_string(true), "1337"); } TORRENT_TEST(print_int) { entry e(1337); TEST_EQUAL(e.to_string(), "1337"); } TORRENT_TEST(print_string_single_line) { entry e("foobar"); TEST_EQUAL(e.to_string(true), "'foobar'"); } TORRENT_TEST(print_string) { entry e("foobar"); TEST_EQUAL(e.to_string(), "'foobar'"); } TORRENT_TEST(print_deep_dict_single_line) { entry e; e["strings"].list().push_back(entry("foo")); e["strings"].list().push_back(entry("bar")); e["ints"].list().push_back(entry(1)); e["ints"].list().push_back(entry(2)); e["ints"].list().push_back(entry(3)); e["a"] = "foobar"; TEST_EQUAL(e.to_string(true), "{ 'a': 'foobar', 'ints': [ 1, 2, 3 ], 'strings': [ 'foo', 'bar' ] }"); } TORRENT_TEST(print_deep_dict) { entry e; e["strings"].list().push_back(entry("foo")); e["strings"].list().push_back(entry("bar")); e["ints"].list().push_back(entry(1)); e["ints"].list().push_back(entry(2)); e["ints"].list().push_back(entry(3)); e["a"] = "foobar"; TEST_EQUAL(e.to_string(), R"({ 'a': 'foobar', 'ints': [ 1, 2, 3 ], 'strings': [ 'foo', 'bar' ] })"); } TORRENT_TEST(dict_constructor) { entry::dictionary_type e{{std::string("foo"), std::string("bar")}, {std::string("bar"), 1234}}; TEST_EQUAL(entry(e).to_string(), R"({ 'bar': 1234, 'foo': 'bar' })"); } TORRENT_TEST(integer_to_str) { using lt::aux::integer_to_str; std::array<char, 21> buf; TEST_CHECK(integer_to_str(buf, 0) == "0"_sv); TEST_CHECK(integer_to_str(buf, 1) == "1"_sv); TEST_CHECK(integer_to_str(buf, 2) == "2"_sv); TEST_CHE
random
[ { "content": "\n\n\t// hidden\n\n\t// explicit template declaration\n\n\textern template\n\n\tentry& entry::operator=(char const*) &;\n\n\n\nnamespace aux {\n\n\n\n\t// internal\n\n\tTORRENT_EXPORT string_view integer_to_str(std::array<char, 21>& buf\n\n\t\t, entry::integer_type val);\n\n}\n\n\n\n#if TORRENT_USE_IOSTREAM\n\n\t// prints the bencoded structure to the ostream as a JSON-style structure.\n\n\tinline std::ostream& operator<<(std::ostream& os, const entry& e)\n\n\t{\n\n\t\tos << e.to_string();\n\n\t\treturn os;\n\n\t}\n\n#endif\n\n\n\n}\n\n\n\n#endif // TORRENT_ENTRY_HPP_INCLUDED\n", "file_path": "include/libtorrent/entry.hpp", "rank": 0, "score": 106389.40836062173 }, { "content": "#include \"libtorrent/aux_/disable_warnings_pop.hpp\"\n\n\n\nnamespace libtorrent {\n\n\n\n#if TORRENT_ABI_VERSION == 1\n\n\t// backwards compatibility\n\n\tusing type_error = system_error;\n\n#endif\n\n\tstruct bdecode_node;\n\n\tstruct entry;\n\n\n\n\tnamespace entry_types {\n\n\n\n\t\tusing dictionary_type = boost::container::map<std::string, entry, aux::strview_less>;\n\n\t\tusing string_type = std::string;\n\n\t\tusing list_type = std::vector<entry>;\n\n\t\tusing integer_type = std::int64_t;\n\n\t\tusing preformatted_type = std::vector<char>;\n\n\t\tstruct uninitialized_type {\n\n\t\t\tbool operator==(uninitialized_type const&) const { return true; }\n", "file_path": "include/libtorrent/entry.hpp", "rank": 1, "score": 106381.61720041497 }, { "content": "/*\n\n\n\nCopyright (c) 2003-2009, 2013-2020, Arvid Norberg\n\nCopyright (c) 2016-2017, Alden Torres\n\nAll rights reserved.\n\n\n\nYou may use, distribute and modify this code under the terms of the BSD license,\n\nsee LICENSE file.\n\n*/\n\n\n\n#ifndef TORRENT_ENTRY_HPP_INCLUDED\n\n#define TORRENT_ENTRY_HPP_INCLUDED\n\n\n\n/*\n\n *\n\n * This file declares the entry class. It is a\n\n * variant-type that can be an integer, list,\n\n * dictionary (map) or a string. This type is\n\n * used to hold bdecoded data (which is the\n\n * encoding BitTorrent messages uses).\n", "file_path": "include/libtorrent/entry.hpp", "rank": 2, "score": 106372.88535754636 }, { "content": "#include <map>\n\n#include <list>\n\n#include <string>\n\n#include <vector>\n\n#include <stdexcept>\n\n#include <cstdint>\n\n#include <variant>\n\n#if TORRENT_USE_IOSTREAM\n\n#include <iosfwd>\n\n#endif\n\n\n\n#include \"libtorrent/assert.hpp\"\n\n#include \"libtorrent/error_code.hpp\"\n\n#include \"libtorrent/span.hpp\"\n\n#include \"libtorrent/string_view.hpp\"\n\n#include \"libtorrent/aux_/noexcept_movable.hpp\"\n\n#include \"libtorrent/aux_/strview_less.hpp\"\n\n\n\n#include \"libtorrent/aux_/disable_warnings_push.hpp\"\n\n#include <boost/container/map.hpp>\n", "file_path": "include/libtorrent/entry.hpp", "rank": 3, "score": 106369.99747906678 }, { "content": "\t\t// as a key, sorting would become a problem (e.g. to compare a string\n\n\t\t// to a list). The definition doesn't mention such a limit though.\n\n\t\tusing dictionary_type = entry_types::dictionary_type;\n\n\t\tusing string_type = entry_types::string_type;\n\n\t\tusing list_type = entry_types::list_type;\n\n\t\tusing integer_type = entry_types::integer_type;\n\n\t\tusing preformatted_type = entry_types::preformatted_type;\n\n\t\tusing uninitialized_type = entry_types::uninitialized_type;\n\n\n\n\t\tusing variant_type = entry_types::variant_type;\n\n\n\n\t\t// the types an entry can have\n\n\t\tenum data_type\n\n\t\t{\n\n\t\t\tint_t,\n\n\t\t\tstring_t,\n\n\t\t\tlist_t,\n\n\t\t\tdictionary_t,\n\n\t\t\tpreformatted_t,\n\n\t\t\tundefined_t,\n", "file_path": "include/libtorrent/entry.hpp", "rank": 4, "score": 106368.42940457589 }, { "content": "\t\tentry& operator=(bdecode_node const&) &;\n\n\t\tentry& operator=(entry const&) &;\n\n\t\tentry& operator=(entry&&) & ;\n\n\t\tentry& operator=(dictionary_type) &;\n\n\t\tentry& operator=(span<char const>) &;\n\n\t\tentry& operator=(string_view) &;\n\n\t\tentry& operator=(string_type) &;\n\n\t\tentry& operator=(list_type) &;\n\n\t\tentry& operator=(integer_type) &;\n\n\t\tentry& operator=(preformatted_type) &;\n\n\n\n\t\t// hidden\n\n\t\t// this is here to disambiguate between std::string and string_view. It\n\n\t\t// needs to be a template to prevent implicit conversions from literal 0\n\n\t\ttemplate <typename U, typename Cond = typename std::enable_if<\n\n\t\t\tstd::is_same<U, char const*>::value>::type>\n\n\t\tentry& operator=(U v) &;\n\n\n\n\t\t// The ``integer()``, ``string()``, ``list()`` and ``dict()`` functions\n\n\t\t// are accessors that return the respective type. If the ``entry`` object\n", "file_path": "include/libtorrent/entry.hpp", "rank": 5, "score": 106366.7947166785 }, { "content": "\t\t\tstd::is_same<U, char const*>::value>::type>\n\n\t\tentry(U v);\n\n\n\n\t\t// construct an empty entry of the specified type.\n\n\t\t// see data_type enum.\n\n\t\tentry(data_type t); // NOLINT\n\n\n\n\t\t// hidden\n\n\t\tentry(entry const& e);\n\n\t\tentry(entry&& e) noexcept;\n\n\n\n\t\t// construct from bdecode_node parsed form (see bdecode())\n\n\t\tentry(bdecode_node const& n); // NOLINT\n\n\n\n\t\t// hidden\n\n\t\tentry();\n\n\t\t~entry();\n\n\n\n\t\t// copies the structure of the right hand side into this\n\n\t\t// entry.\n", "file_path": "include/libtorrent/entry.hpp", "rank": 6, "score": 106366.23261625374 }, { "content": "\t\t};\n\n\n\n\t\t// returns the concrete type of the entry\n\n\t\tdata_type type() const;\n\n\n\n\t\t// constructors directly from a specific type.\n\n\t\t// The content of the argument is copied into the\n\n\t\t// newly constructed entry\n\n\t\tentry(dictionary_type); // NOLINT\n\n\t\tentry(span<char const>); // NOLINT\n\n\t\tentry(string_view); // NOLINT\n\n\t\tentry(string_type); // NOLINT\n\n\t\tentry(list_type); // NOLINT\n\n\t\tentry(integer_type); // NOLINT\n\n\t\tentry(preformatted_type); // NOLINT\n\n\n\n\t\t// hidden\n\n\t\t// this is here to disambiguate between std::string and string_view. It\n\n\t\t// needs to be a template to prevent implicit conversions from literal 0\n\n\t\ttemplate <typename U, typename Cond = typename std::enable_if<\n", "file_path": "include/libtorrent/entry.hpp", "rank": 7, "score": 106365.2892086793 }, { "content": "\t\tentry const* find_key(string_view key) const;\n\n\n\n\t\t// returns a pretty-printed string representation\n\n\t\t// of the bencoded structure, with JSON-style syntax\n\n\t\tstd::string to_string(bool single_line = false) const;\n\n\n\n\tprivate:\n\n\n\n\t\ttemplate <typename T> T& get();\n\n\t\ttemplate <typename T> T const& get() const;\n\n\t};\n\n\n\n\t// hidden\n\n\tTORRENT_EXPORT bool operator==(entry const& lhs, entry const& rhs);\n\n\tinline bool operator!=(entry const& lhs, entry const& rhs) { return !(lhs == rhs); }\n\n\n\n\t// hidden\n\n\t// explicit template declaration\n\n\textern template\n\n\tentry::entry(char const*);\n", "file_path": "include/libtorrent/entry.hpp", "rank": 8, "score": 106365.11821105171 }, { "content": "\t\t// isn't of the type you request, the accessor will throw\n\n\t\t// system_error. You can ask an ``entry`` for its type through the\n\n\t\t// ``type()`` function.\n\n\t\t//\n\n\t\t// If you want to create an ``entry`` you give it the type you want it to\n\n\t\t// have in its constructor, and then use one of the non-const accessors\n\n\t\t// to get a reference which you then can assign the value you want it to\n\n\t\t// have.\n\n\t\t//\n\n\t\t// The typical code to get info from a torrent file will then look like\n\n\t\t// this:\n\n\t\t//\n\n\t\t// .. code:: c++\n\n\t\t//\n\n\t\t// \tentry torrent_file;\n\n\t\t// \t// ...\n\n\t\t//\n\n\t\t// \t// throws if this is not a dictionary\n\n\t\t// \tentry::dictionary_type const& dict = torrent_file.dict();\n\n\t\t// \tentry::dictionary_type::const_iterator i;\n", "file_path": "include/libtorrent/entry.hpp", "rank": 9, "score": 106365.03940993943 }, { "content": "\t\t};\n\n\n\n\t\t// internal\n\n\t\tusing variant_type = std::variant<integer_type\n\n\t\t\t, string_type\n\n\t\t\t, list_type\n\n\t\t\t, dictionary_type\n\n\t\t\t, preformatted_type\n\n\t\t\t, uninitialized_type>;\n\n\n\n\t\tstatic_assert(std::is_nothrow_move_constructible<variant_type>::value\n\n\t\t\t, \"expected variant to be nothrow move constructible\");\n\n\t}\n\n\n\n\t// The ``entry`` class represents one node in a bencoded hierarchy. It works as a\n\n\t// variant type, it can be either a list, a dictionary (``std::map``), an integer\n\n\t// or a string.\n\n\tstruct TORRENT_EXPORT entry : entry_types::variant_type\n\n\t{\n\n\t\t// the key is always a string. If a generic entry would be allowed\n", "file_path": "include/libtorrent/entry.hpp", "rank": 10, "score": 106364.24767000932 }, { "content": " *\n\n * it has 4 accessors to access the actual\n\n * type of the object. They are:\n\n * integer()\n\n * string()\n\n * list()\n\n * dict()\n\n * The actual type has to match the type you\n\n * are asking for, otherwise you will get an\n\n * assertion failure.\n\n * When you default construct an entry, it is\n\n * uninitialized. You can initialize it through the\n\n * assignment operator, copy-constructor or\n\n * the constructor that takes a data_type enum.\n\n *\n\n *\n\n */\n\n\n\n#include \"libtorrent/config.hpp\"\n\n\n", "file_path": "include/libtorrent/entry.hpp", "rank": 11, "score": 106363.3360833838 }, { "content": "\t\t// \t}\n\n\t\t//\n\n\t\t//\n\n\t\t// To make it easier to extract information from a torrent file, the\n\n\t\t// class torrent_info exists.\n\n\t\tinteger_type& integer();\n\n\t\tinteger_type const& integer() const;\n\n\t\tstring_type& string();\n\n\t\tstring_type const& string() const;\n\n\t\tlist_type& list();\n\n\t\tlist_type const& list() const;\n\n\t\tdictionary_type& dict();\n\n\t\tdictionary_type const& dict() const;\n\n\t\tpreformatted_type& preformatted();\n\n\t\tpreformatted_type const& preformatted() const;\n\n\n\n\t\t// swaps the content of *this* with ``e``.\n\n\t\tusing variant_type::swap;\n\n\n\n\t\t// All of these functions requires the entry to be a dictionary, if it\n", "file_path": "include/libtorrent/entry.hpp", "rank": 12, "score": 106362.16381678019 }, { "content": "\t\t// isn't they will throw ``system_error``.\n\n\t\t//\n\n\t\t// The non-const versions of the ``operator[]`` will return a reference\n\n\t\t// to either the existing element at the given key or, if there is no\n\n\t\t// element with the given key, a reference to a newly inserted element at\n\n\t\t// that key.\n\n\t\t//\n\n\t\t// The const version of ``operator[]`` will only return a reference to an\n\n\t\t// existing element at the given key. If the key is not found, it will\n\n\t\t// throw ``system_error``.\n\n\t\tentry& operator[](string_view key);\n\n\t\tentry const& operator[](string_view key) const;\n\n\n\n\t\t// These functions requires the entry to be a dictionary, if it isn't\n\n\t\t// they will throw ``system_error``.\n\n\t\t//\n\n\t\t// They will look for an element at the given key in the dictionary, if\n\n\t\t// the element cannot be found, they will return nullptr. If an element\n\n\t\t// with the given key is found, the return a pointer to it.\n\n\t\tentry* find_key(string_view key);\n", "file_path": "include/libtorrent/entry.hpp", "rank": 13, "score": 106359.76768436121 }, { "content": "\t\t// \ti = dict.find(\"announce\");\n\n\t\t// \tif (i != dict.end())\n\n\t\t// \t{\n\n\t\t// \t\tstd::string tracker_url = i->second.string();\n\n\t\t// \t\tstd::cout << tracker_url << \"\\n\";\n\n\t\t// \t}\n\n\t\t//\n\n\t\t//\n\n\t\t// The following code is equivalent, but a little bit shorter:\n\n\t\t//\n\n\t\t// .. code:: c++\n\n\t\t//\n\n\t\t// \tentry torrent_file;\n\n\t\t// \t// ...\n\n\t\t//\n\n\t\t// \t// throws if this is not a dictionary\n\n\t\t// \tif (entry* i = torrent_file.find_key(\"announce\"))\n\n\t\t// \t{\n\n\t\t// \t\tstd::string tracker_url = i->string();\n\n\t\t// \t\tstd::cout << tracker_url << \"\\n\";\n", "file_path": "include/libtorrent/entry.hpp", "rank": 14, "score": 106359.30167088674 }, { "content": "/*\n\n\n\nCopyright (c) 2015-2020, Arvid Norberg\n\nCopyright (c) 2016, 2018, 2020, Alden Torres\n\nCopyright (c) 2017-2018, Steven Siloti\n\nAll rights reserved.\n\n\n\nYou may use, distribute and modify this code under the terms of the BSD license,\n\nsee LICENSE file.\n\n*/\n\n\n\n#ifndef TORRENT_ANNOUNCE_ENTRY_HPP_INCLUDED\n\n#define TORRENT_ANNOUNCE_ENTRY_HPP_INCLUDED\n\n\n\n#include \"libtorrent/config.hpp\"\n\n#include \"libtorrent/fwd.hpp\"\n\n#include \"libtorrent/time.hpp\"\n\n#include \"libtorrent/error_code.hpp\"\n\n#include \"libtorrent/string_view.hpp\"\n\n#include \"libtorrent/socket.hpp\"\n", "file_path": "include/libtorrent/announce_entry.hpp", "rank": 15, "score": 101151.81222625976 }, { "content": "#include \"libtorrent/aux_/array.hpp\"\n\n#include \"libtorrent/info_hash.hpp\"\n\n\n\n#include <string>\n\n#include <cstdint>\n\n#include <vector>\n\n\n\nnamespace libtorrent {\n\n\n\nnamespace aux { struct torrent; }\n\n\n\nTORRENT_VERSION_NAMESPACE_2\n\n\n\n\tstruct TORRENT_EXPORT announce_infohash\n\n\t{\n\n\t\t// internal\n\n\t\tTORRENT_UNEXPORT announce_infohash();\n\n\n\n\t\t// if this tracker has returned an error or warning message\n\n\t\t// that message is stored here\n", "file_path": "include/libtorrent/announce_entry.hpp", "rank": 16, "score": 101148.5974976175 }, { "content": "// include/libtorrent/entry.hpp\n\nstruct entry;\n\n\n", "file_path": "include/libtorrent/fwd.hpp", "rank": 17, "score": 101147.15881302465 }, { "content": "\t\t// the tracker.\n\n\t\tTORRENT_DEPRECATED void reset();\n\n\n\n\t\t// trims whitespace characters from the beginning of the URL.\n\n\t\tTORRENT_DEPRECATED void trim();\n\n#endif\n\n\n\n#if TORRENT_ABI_VERSION == 1\n\n\t\t// deprecated in 1.2, use announce_endpoint::can_announce\n\n\t\t// returns true if we can announce to this tracker now.\n\n\t\t// The current time is passed in as ``now``. The ``is_seed``\n\n\t\t// argument is necessary because once we become a seed, we\n\n\t\t// need to announce right away, even if the re-announce timer\n\n\t\t// hasn't expired yet.\n\n\t\tTORRENT_DEPRECATED bool can_announce(time_point now, bool is_seed) const;\n\n\n\n\t\t// deprecated in 1.2, use announce_endpoint::is_working\n\n\t\t// returns true if the last time we tried to announce to this\n\n\t\t// tracker succeeded, or if we haven't tried yet.\n\n\t\tTORRENT_DEPRECATED bool is_working() const;\n\n#endif\n\n\t};\n\n\n\nTORRENT_VERSION_NAMESPACE_2_END\n\n\n\n}\n\n\n\n#endif\n", "file_path": "include/libtorrent/announce_entry.hpp", "rank": 18, "score": 101142.71051514774 }, { "content": "\t\t// set to true the first time we receive a valid response\n\n\t\t// from this tracker.\n\n\t\tbool verified:1;\n\n\n\n#if TORRENT_ABI_VERSION == 1\n\n\t\t// deprecated in 1.2\n\n\t\t// all of these will be set to false or 0\n\n\t\t// use the corresponding members in announce_endpoint\n\n\t\tTORRENT_DEPRECATED std::uint8_t fails:7;\n\n\t\tTORRENT_DEPRECATED bool send_stats:1;\n\n\t\tTORRENT_DEPRECATED bool start_sent:1;\n\n\t\tTORRENT_DEPRECATED bool complete_sent:1;\n\n\t\t// internal\n\n\t\tTORRENT_DEPRECATED bool triggered_manually:1;\n\n\t\tTORRENT_DEPRECATED bool updating:1;\n\n#endif\n\n\n\n#if TORRENT_ABI_VERSION <= 2\n\n\t\t// reset announce counters and clears the started sent flag.\n\n\t\t// The announce_entry will look like we've never talked to\n", "file_path": "include/libtorrent/announce_entry.hpp", "rank": 19, "score": 101141.67779306881 }, { "content": "#if TORRENT_ABI_VERSION <= 2\n\n#include \"libtorrent/aux_/disable_warnings_pop.hpp\"\n\n#endif\n\n\n\n\t\tannounce_endpoint();\n\n\n\n\t\t// the local endpoint of the listen interface associated with this endpoint\n\n\t\ttcp::endpoint local_endpoint;\n\n\n\n\t\t// torrents can be announced using multiple info hashes\n\n\t\t// for different protocol versions\n\n\n\n\t\t// info_hashes[0] is the v1 info hash (SHA1)\n\n\t\t// info_hashes[1] is the v2 info hash (truncated SHA-256)\n\n\t\taux::array<announce_infohash, num_protocols, protocol_version> info_hashes;\n\n\n\n#if TORRENT_ABI_VERSION <= 2\n\n\t\t// reset announce counters and clears the started sent flag.\n\n\t\t// The announce_endpoint will look like we've never talked to\n\n\t\t// the tracker.\n", "file_path": "include/libtorrent/announce_entry.hpp", "rank": 20, "score": 101141.51626871551 }, { "content": "\t\t~announce_entry();\n\n\t\tannounce_entry(announce_entry const&);\n\n\t\tannounce_entry& operator=(announce_entry const&) &;\n\n\n\n\t\t// tracker URL as it appeared in the torrent file\n\n\t\tstd::string url;\n\n\n\n\t\t// the current ``&trackerid=`` argument passed to the tracker.\n\n\t\t// this is optional and is normally empty (in which case no\n\n\t\t// trackerid is sent).\n\n\t\tstd::string trackerid;\n\n\n\n\t\t// each local listen socket (endpoint) will announce to the tracker. This\n\n\t\t// list contains state per endpoint.\n\n\t\tstd::vector<announce_endpoint> endpoints;\n\n\n\n\t\t// the tier this tracker belongs to\n\n\t\tstd::uint8_t tier = 0;\n\n\n\n\t\t// the max number of failures to announce to this tracker in\n", "file_path": "include/libtorrent/announce_entry.hpp", "rank": 21, "score": 101141.09507753285 }, { "content": "\t\t// The current time is passed in as ``now``. The ``is_seed``\n\n\t\t// argument is necessary because once we become a seed, we\n\n\t\t// need to announce right away, even if the re-announce timer\n\n\t\t// hasn't expired yet.\n\n\t\tTORRENT_DEPRECATED bool can_announce(time_point now, bool is_seed, std::uint8_t fail_limit) const;\n\n\n\n\t\t// returns true if the last time we tried to announce to this\n\n\t\t// tracker succeeded, or if we haven't tried yet.\n\n\t\tTORRENT_DEPRECATED bool is_working() const { return fails == 0; }\n\n#endif\n\n\t};\n\n\n\n\t// announces are sent to each tracker using every listen socket\n\n\t// this class holds information about one listen socket for one tracker\n\n#if TORRENT_ABI_VERSION <= 2\n\n\t// this is to suppress deprecation warnings from implicit move constructor\n\n#include \"libtorrent/aux_/disable_warnings_push.hpp\"\n\n#endif\n\n\tstruct TORRENT_EXPORT announce_endpoint\n\n\t{\n", "file_path": "include/libtorrent/announce_entry.hpp", "rank": 22, "score": 101141.07139107317 }, { "content": "\t\tTORRENT_DEPRECATED int scrape_incomplete = -1;\n\n\t\tTORRENT_DEPRECATED int scrape_complete = -1;\n\n\t\tTORRENT_DEPRECATED int scrape_downloaded = -1;\n\n\t\tTORRENT_DEPRECATED std::uint8_t fails : 7;\n\n\t\tTORRENT_DEPRECATED bool updating : 1;\n\n\t\tTORRENT_DEPRECATED bool start_sent : 1;\n\n\t\tTORRENT_DEPRECATED bool complete_sent : 1;\n\n#endif\n\n\n\n\t\t// set to false to not announce from this endpoint\n\n\t\tbool enabled = true;\n\n\t};\n\n\n\n\t// this class holds information about one bittorrent tracker, as it\n\n\t// relates to a specific torrent.\n\n\tstruct TORRENT_EXPORT announce_entry\n\n\t{\n\n\t\t// constructs a tracker announce entry with ``u`` as the URL.\n\n\t\texplicit announce_entry(string_view u);\n\n\t\tannounce_entry();\n", "file_path": "include/libtorrent/announce_entry.hpp", "rank": 23, "score": 101140.68820256702 }, { "content": "\t\tTORRENT_DEPRECATED void reset();\n\n\n\n\t\t// deprecated in 2.0, use announce_infohash::can_announce\n\n\t\t// returns true if we can announce to this tracker now.\n\n\t\t// The current time is passed in as ``now``. The ``is_seed``\n\n\t\t// argument is necessary because once we become a seed, we\n\n\t\t// need to announce right away, even if the re-announce timer\n\n\t\t// hasn't expired yet.\n\n\t\tTORRENT_DEPRECATED bool can_announce(time_point now, bool is_seed, std::uint8_t fail_limit) const;\n\n\n\n\t\t// deprecated in 2.0, use announce_infohash::is_working\n\n\t\t// returns true if the last time we tried to announce to this\n\n\t\t// tracker succeeded, or if we haven't tried yet.\n\n\t\tTORRENT_DEPRECATED bool is_working() const;\n\n\n\n\t\t// for backwards compatibility\n\n\t\tTORRENT_DEPRECATED time_point32 next_announce = (time_point32::min)();\n\n\t\tTORRENT_DEPRECATED time_point32 min_announce = (time_point32::min)();\n\n\t\tTORRENT_DEPRECATED std::string message;\n\n\t\tTORRENT_DEPRECATED error_code last_error;\n", "file_path": "include/libtorrent/announce_entry.hpp", "rank": 24, "score": 101138.53101894379 }, { "content": "\t\t// a row, before this tracker is not used anymore. 0 means unlimited\n\n\t\tstd::uint8_t fail_limit = 0;\n\n\n\n\t\t// flags for the source bitmask, each indicating where\n\n\t\t// we heard about this tracker\n\n\t\tenum tracker_source\n\n\t\t{\n\n\t\t\t// the tracker was part of the .torrent file\n\n\t\t\tsource_torrent = 1,\n\n\t\t\t// the tracker was added programmatically via the add_tracker() function\n\n\t\t\tsource_client = 2,\n\n\t\t\t// the tracker was part of a magnet link\n\n\t\t\tsource_magnet_link = 4,\n\n\t\t\t// the tracker was received from the swarm via tracker exchange\n\n\t\t\tsource_tex = 8\n\n\t\t};\n\n\n\n\t\t// a bitmask specifying which sources we got this tracker from.\n\n\t\tstd::uint8_t source:4;\n\n\n", "file_path": "include/libtorrent/announce_entry.hpp", "rank": 25, "score": 101137.95825811979 }, { "content": "\t\tstd::string message;\n\n\n\n\t\t// if this tracker failed the last time it was contacted\n\n\t\t// this error code specifies what error occurred\n\n\t\terror_code last_error;\n\n\n\n\t\t// the time of next tracker announce\n\n\t\ttime_point32 next_announce = (time_point32::min)();\n\n\n\n\t\t// no announces before this time\n\n\t\ttime_point32 min_announce = (time_point32::min)();\n\n\n\n\t\t// TODO: include the number of peers received from this tracker, at last\n\n\t\t// announce\n\n\n\n\t\t// these are either -1 or the scrape information this tracker last\n\n\t\t// responded with. *incomplete* is the current number of downloaders in\n\n\t\t// the swarm, *complete* is the current number of seeds in the swarm and\n\n\t\t// *downloaded* is the cumulative number of completed downloads of this\n\n\t\t// torrent, since the beginning of time (from this tracker's point of\n", "file_path": "include/libtorrent/announce_entry.hpp", "rank": 26, "score": 101137.60198517267 }, { "content": "\t\t// announces.\n\n\t\tbool start_sent : 1;\n\n\n\n\t\t// set to true when we send a event=completed.\n\n\t\tbool complete_sent : 1;\n\n\n\n\t\t// internal\n\n\t\tbool triggered_manually : 1;\n\n\n\n#if TORRENT_ABI_VERSION <= 2\n\n\t\t// reset announce counters and clears the started sent flag.\n\n\t\t// The announce_endpoint will look like we've never talked to\n\n\t\t// the tracker.\n\n\t\tTORRENT_DEPRECATED void reset();\n\n\n\n\t\t// updates the failure counter and time-outs for re-trying.\n\n\t\t// This is called when the tracker announce fails.\n\n\t\tTORRENT_DEPRECATED void failed(int backoff_ratio, seconds32 retry_interval = seconds32(0));\n\n\n\n\t\t// returns true if we can announce to this tracker now.\n", "file_path": "include/libtorrent/announce_entry.hpp", "rank": 27, "score": 101133.57799406209 }, { "content": "\t\t// view).\n\n\n\n\t\t// if this tracker has returned scrape data, these fields are filled in\n\n\t\t// with valid numbers. Otherwise they are set to -1. ``incomplete`` counts\n\n\t\t// the number of current downloaders. ``complete`` counts the number of\n\n\t\t// current peers completed the download, or \"seeds\". ``downloaded`` is the\n\n\t\t// cumulative number of completed downloads.\n\n\t\tint scrape_incomplete = -1;\n\n\t\tint scrape_complete = -1;\n\n\t\tint scrape_downloaded = -1;\n\n\n\n\t\t// the number of times in a row we have failed to announce to this\n\n\t\t// tracker.\n\n\t\tstd::uint8_t fails : 7;\n\n\n\n\t\t// true while we're waiting for a response from the tracker.\n\n\t\tbool updating : 1;\n\n\n\n\t\t// set to true when we get a valid response from an announce\n\n\t\t// with event=started. If it is set, we won't send start in the subsequent\n", "file_path": "include/libtorrent/announce_entry.hpp", "rank": 28, "score": 101133.57799406209 }, { "content": "#if TORRENT_ABI_VERSION == 1\n\nobject client_fingerprint_(peer_id const& id)\n\n{\n\n python_deprecated(\"client_fingerprint is deprecated\");\n\n std::optional<fingerprint> result = client_fingerprint(id);\n\n return result ? object(*result) : object();\n\n}\n\n#endif\n\n\n\nentry bdecode_(bytes const& data)\n\n{\n\n return bdecode(data.arr);\n\n}\n\n\n\nbytes bencode_(entry const& e)\n\n{\n\n bytes result;\n\n bencode(std::back_inserter(result.arr), e);\n\n return result;\n\n}\n\n\n", "file_path": "bindings/python/src/utility.cpp", "rank": 29, "score": 97602.36536009131 }, { "content": "/*\n\n\n\nCopyright (c) 2006, 2008-2009, 2013-2016, 2019-2021, Arvid Norberg\n\nCopyright (c) 2015, Steven Siloti\n\nCopyright (c) 2016, 2021, Alden Torres\n\nAll rights reserved.\n\n\n\nYou may use, distribute and modify this code under the terms of the BSD license,\n\nsee LICENSE file.\n\n*/\n\n\n\n#ifndef KADEMLIA_NODE_ENTRY_HPP\n\n#define KADEMLIA_NODE_ENTRY_HPP\n\n\n\n#include \"libtorrent/kademlia/node_id.hpp\"\n\n#include \"libtorrent/socket.hpp\"\n\n#include \"libtorrent/address.hpp\"\n\n#include \"libtorrent/aux_/union_endpoint.hpp\"\n\n#include \"libtorrent/time.hpp\" // for time_point\n\n#include \"libtorrent/aux_/time.hpp\" // for time_now\n\n\n\nnamespace libtorrent::dht {\n\n\n", "file_path": "include/libtorrent/kademlia/node_entry.hpp", "rank": 30, "score": 96424.15721533763 }, { "content": "/*\n\n\n\nCopyright (c) 2017-2018, Steven Siloti\n\nCopyright (c) 2020, Arvid Norberg\n\nCopyright (c) 2020, Alden Torres\n\nAll rights reserved.\n\n\n\nYou may use, distribute and modify this code under the terms of the BSD license,\n\nsee LICENSE file.\n\n*/\n\n\n\n#ifndef TORRENT_AUX_ANNOUNCE_ENTRY_HPP_INCLUDED\n\n#define TORRENT_AUX_ANNOUNCE_ENTRY_HPP_INCLUDED\n\n\n\n#include \"libtorrent/config.hpp\"\n\n#include \"libtorrent/fwd.hpp\"\n\n#include \"libtorrent/time.hpp\"\n\n#include \"libtorrent/error_code.hpp\"\n\n#include \"libtorrent/string_view.hpp\"\n\n#include \"libtorrent/socket.hpp\"\n", "file_path": "include/libtorrent/aux_/announce_entry.hpp", "rank": 31, "score": 96420.74240591124 }, { "content": "#include \"libtorrent/span.hpp\"\n\n#include \"libtorrent/units.hpp\"\n\n#include \"libtorrent/storage_defs.hpp\" // for status_t\n\n#include \"libtorrent/session_types.hpp\"\n\n#include \"libtorrent/error_code.hpp\"\n\n\n\nnamespace libtorrent {\n\n\n\n\t// TODO: 3 remove this typedef, and use span<char const> for disk write\n\n\t// operations\n\n\tusing iovec_t = span<char>;\n\n\n\nnamespace aux {\n\n\n\n\tstruct stat_cache;\n\n\n\n\tTORRENT_EXTRA_EXPORT int copy_bufs(span<iovec_t const> bufs\n\n\t\t, int bytes, span<iovec_t> target);\n\n\tTORRENT_EXTRA_EXPORT span<iovec_t> advance_bufs(span<iovec_t> bufs, int bytes);\n\n\tTORRENT_EXTRA_EXPORT void clear_bufs(span<iovec_t const> bufs);\n", "file_path": "include/libtorrent/aux_/storage_utils.hpp", "rank": 32, "score": 96419.49874523969 }, { "content": "/*\n\n\n\nCopyright (c) 2010, 2013-2014, 2016, 2018, 2020-2021, Arvid Norberg\n\nCopyright (c) 2020, Alden Torres\n\nAll rights reserved.\n\n\n\nYou may use, distribute and modify this code under the terms of the BSD license,\n\nsee LICENSE file.\n\n*/\n\n\n\n#ifndef TORRENT_VECTOR_UTILS_HPP_INCLUDE\n\n#define TORRENT_VECTOR_UTILS_HPP_INCLUDE\n\n\n\n#include <vector>\n\n#include <algorithm>\n\n\n\nnamespace libtorrent::aux {\n\n\n\n\ttemplate <typename Container, typename T>\n\n\tauto sorted_find(Container& container, T const& v)\n", "file_path": "include/libtorrent/aux_/vector_utils.hpp", "rank": 33, "score": 96418.93820681341 }, { "content": "/*\n\n\n\nCopyright (c) 2016, Andrei Kurushin\n\nCopyright (c) 2017, 2019-2020, Arvid Norberg\n\nCopyright (c) 2020, Tiger Wang\n\nAll rights reserved.\n\n\n\nYou may use, distribute and modify this code under the terms of the BSD license,\n\nsee LICENSE file.\n\n*/\n\n\n\n#ifndef TORRENT_WIN_UTIL_HPP\n\n#define TORRENT_WIN_UTIL_HPP\n\n\n\n#include \"libtorrent/config.hpp\"\n\n\n\nnamespace libtorrent { namespace aux {\n\n\n\n#ifdef TORRENT_WINRT\n\n\tusing LoadLibraryASignature = HMODULE WINAPI(_In_ LPCSTR lpLibFileName);\n", "file_path": "include/libtorrent/aux_/win_util.hpp", "rank": 34, "score": 96418.66021365851 }, { "content": "#include \"libtorrent/aux_/listen_socket_handle.hpp\"\n\n#include \"libtorrent/aux_/array.hpp\"\n\n#include \"libtorrent/info_hash.hpp\"\n\n\n\n#include <string>\n\n#include <cstdint>\n\n#include <vector>\n\n\n\nnamespace libtorrent {\n\nnamespace aux {\n\n\n\n\tstruct torrent;\n\n\n\n\tstruct TORRENT_EXTRA_EXPORT announce_infohash\n\n\t{\n\n\t\tannounce_infohash();\n\n\n\n\t\t// if this tracker has returned an error or warning message\n\n\t\t// that message is stored here\n\n\t\tstd::string message;\n", "file_path": "include/libtorrent/aux_/announce_entry.hpp", "rank": 35, "score": 96416.91103631971 }, { "content": "#ifndef TORRENT_PLATFORM_UTIL_HPP\n\n#define TORRENT_PLATFORM_UTIL_HPP\n\n\n\n#include \"libtorrent/aux_/export.hpp\"\n\n\n\n#include <cstdint>\n\n\n\nnamespace libtorrent::aux {\n\n\n\n\tTORRENT_EXTRA_EXPORT int max_open_files();\n\n\n\n}\n\n\n\n#endif // TORRENT_PLATFORM_UTIL_HPP\n", "file_path": "include/libtorrent/aux_/platform_util.hpp", "rank": 36, "score": 96415.6930523622 }, { "content": "\t// this class holds information about one bittorrent tracker, as it\n\n\t// relates to a specific torrent.\n\n\tstruct TORRENT_EXTRA_EXPORT announce_entry\n\n\t{\n\n\t\t// constructs a tracker announce entry with ``u`` as the URL.\n\n\t\texplicit announce_entry(string_view u);\n\n\n\n\t\t// constructs the internal announce entry from the user facing one\n\n\t\texplicit announce_entry(lt::announce_entry const&);\n\n\t\tannounce_entry();\n\n\t\t~announce_entry();\n\n\t\tannounce_entry(announce_entry const&);\n\n\t\tannounce_entry& operator=(announce_entry const&) &;\n\n\n\n\t\t// tracker URL as it appeared in the torrent file\n\n\t\tstd::string url;\n\n\n\n\t\t// the current ``&trackerid=`` argument passed to the tracker.\n\n\t\t// this is optional and is normally empty (in which case no\n\n\t\t// trackerid is sent).\n", "file_path": "include/libtorrent/aux_/announce_entry.hpp", "rank": 37, "score": 96415.11979933531 }, { "content": "/*\n\n\n\nCopyright (c) 2017-2020, Arvid Norberg\n\nCopyright (c) 2018, 2020, Alden Torres\n\nAll rights reserved.\n\n\n\nYou may use, distribute and modify this code under the terms of the BSD license,\n\nsee LICENSE file.\n\n*/\n\n\n\n#ifndef TORRENT_STORAGE_UTILS_HPP_INCLUDE\n\n#define TORRENT_STORAGE_UTILS_HPP_INCLUDE\n\n\n\n#include <cstdint>\n\n#include <string>\n\n#include <functional>\n\n\n\n#include \"libtorrent/config.hpp\"\n\n#include \"libtorrent/fwd.hpp\"\n\n#include \"libtorrent/span.hpp\"\n", "file_path": "include/libtorrent/aux_/storage_utils.hpp", "rank": 38, "score": 96415.06593248823 }, { "content": "#include <vector>\n\n#include <string>\n\n#include <cstdint>\n\n#include <limits>\n\n#include <array> // for std::array\n\n\n\nnamespace libtorrent::aux {\n\n\n\n\tTORRENT_EXTRA_EXPORT bool is_alpha(char c);\n\n\n\n\tTORRENT_EXTRA_EXPORT\n\n\t\tstd::array<char, 4 + std::numeric_limits<std::int64_t>::digits10>\n\n\t\tto_string(std::int64_t n);\n\n\n\n\t// internal\n\n\tinline bool is_digit(char c)\n\n\t{ return c >= '0' && c <= '9'; }\n\n\tinline void ensure_trailing_slash(std::string& url)\n\n\t{\n\n\t\tif (url.empty() || url[url.size() - 1] != '/')\n", "file_path": "include/libtorrent/aux_/string_util.hpp", "rank": 39, "score": 96414.91875006948 }, { "content": "/*\n\n\n\nCopyright (c) 2012, 2014-2021, Arvid Norberg\n\nCopyright (c) 2016, Steven Siloti\n\nCopyright (c) 2016, 2020, Alden Torres\n\nCopyright (c) 2017, Pavel Pimenov\n\nAll rights reserved.\n\n\n\nYou may use, distribute and modify this code under the terms of the BSD license,\n\nsee LICENSE file.\n\n*/\n\n\n\n#ifndef TORRENT_STRING_UTIL_HPP_INCLUDED\n\n#define TORRENT_STRING_UTIL_HPP_INCLUDED\n\n\n\n#include \"libtorrent/config.hpp\"\n\n#include \"libtorrent/string_view.hpp\"\n\n#include \"libtorrent/span.hpp\"\n\n#include \"libtorrent/error_code.hpp\"\n\n\n", "file_path": "include/libtorrent/aux_/string_util.hpp", "rank": 40, "score": 96414.33906995531 }, { "content": "\t\t// need to announce right away, even if the re-announce timer\n\n\t\t// hasn't expired yet.\n\n\t\tbool can_announce(time_point now, bool is_seed, std::uint8_t fail_limit) const;\n\n\n\n\t\t// returns true if the last time we tried to announce to this\n\n\t\t// tracker succeeded, or if we haven't tried yet.\n\n\t\tbool is_working() const { return fails == 0; }\n\n\t};\n\n\n\n\tstruct announce_entry;\n\n\n\n\t// announces are sent to each tracker using every listen socket\n\n\t// this class holds information about one listen socket for one tracker\n\n\tstruct TORRENT_EXTRA_EXPORT announce_endpoint\n\n\t{\n\n\t\t// internal\n\n\t\tannounce_endpoint(aux::listen_socket_handle const& s, bool completed);\n\n\n\n\t\t// the local endpoint of the listen interface associated with this endpoint\n\n\t\ttcp::endpoint local_endpoint;\n", "file_path": "include/libtorrent/aux_/announce_entry.hpp", "rank": 41, "score": 96410.49979212834 }, { "content": "// include/libtorrent/file_storage.hpp\n\nstruct file_entry;\n\n\n", "file_path": "include/libtorrent/fwd.hpp", "rank": 42, "score": 96409.34593901025 }, { "content": "\t\tif ((proc == nullptr) && !failed_proc)\n\n\t\t{\n\n\t\t\tHMODULE const handle = get_library_handle<Library>();\n\n\t\t\tif (handle) proc = reinterpret_cast<Signature>(reinterpret_cast<void*>(GetProcAddress(handle, name)));\n\n\t\t\tfailed_proc = (proc == nullptr);\n\n\t\t}\n\n\t\treturn proc;\n\n\t}\n\n\n\n\tstruct iphlpapi {\n\n\t\tstatic constexpr char const* library_name = \"iphlpapi.dll\";\n\n\t};\n\n\n\n\tstruct kernel32 {\n\n\t\tstatic constexpr char const* library_name = \"kernel32.dll\";\n\n\t};\n\n\n\n\tstruct advapi32 {\n\n\t\tstatic constexpr char const* library_name = \"advapi32.dll\";\n\n\t};\n\n\n\n} // namespace aux\n\n} // namespace libtorrent\n\n\n\n#endif\n", "file_path": "include/libtorrent/aux_/win_util.hpp", "rank": 43, "score": 96408.75611869516 }, { "content": "\t// 0xff is a special value to indicate we have not pinged this node yet\n\n\tstd::uint8_t timeout_count = 0xff;\n\n\n\n\tbool verified = false;\n\n};\n\n\n\n} // namespace libtorrent::dht\n\n\n\n#endif\n", "file_path": "include/libtorrent/kademlia/node_entry.hpp", "rank": 44, "score": 96408.58328170216 }, { "content": "\t// strdup is not part of the C standard. Some systems\n\n\t// don't have it and it won't be available when building\n\n\t// in strict ANSI mode\n\n\tTORRENT_EXTRA_EXPORT char* allocate_string_copy(string_view str);\n\n\n\n\t// searches for separator ('sep') in the string 'last'.\n\n\t// if found, returns the string_view representing the range from the start of\n\n\t// `last` up to (but not including) the separator. The second return value is\n\n\t// the remainder of the string, starting one character after the separator.\n\n\t// if no separator is found, the whole string is returned and the second\n\n\t// return value is an empty string_view.\n\n\tTORRENT_EXTRA_EXPORT std::pair<string_view, string_view> split_string(string_view last, char sep);\n\n\n\n\t// same as split_string, but if one sub-string starts with a double quote\n\n\t// (\") separators are ignored until the end double-quote. Unless if the\n\n\t// separator itself is a double quote.\n\n\tTORRENT_EXTRA_EXPORT std::pair<string_view, string_view> split_string_quotes(\n\n\t\tstring_view last, char sep);\n\n\n\n\t// removes whitespaces at the beginning of the string, in-place\n", "file_path": "include/libtorrent/aux_/string_util.hpp", "rank": 45, "score": 96408.43803868242 }, { "content": "\t\t// reset announce counters and clears the started sent flag.\n\n\t\t// The announce_entry will look like we've never talked to\n\n\t\t// the tracker.\n\n\t\tvoid reset();\n\n\n\n\t\t// internal\n\n\t\tannounce_endpoint* find_endpoint(aux::listen_socket_handle const& s);\n\n\t};\n\n\n\n}\n\n}\n\n\n\n#endif\n\n\n", "file_path": "include/libtorrent/aux_/announce_entry.hpp", "rank": 46, "score": 96408.164306151 }, { "content": "\t\t\turl += '/';\n\n\t}\n\n\n\n\t// internal\n\n\tTORRENT_EXTRA_EXPORT string_view strip_string(string_view in);\n\n\n\n\tTORRENT_EXTRA_EXPORT bool is_print(char c);\n\n\tTORRENT_EXTRA_EXPORT bool is_space(char c);\n\n\tTORRENT_EXTRA_EXPORT char to_lower(char c);\n\n\n\n\tTORRENT_EXTRA_EXPORT bool string_begins_no_case(char const* s1, char const* s2);\n\n\tTORRENT_EXTRA_EXPORT bool string_equal_no_case(string_view s1, string_view s2);\n\n\n\n\tTORRENT_EXTRA_EXPORT void url_random(span<char> dest);\n\n\n\n\tTORRENT_EXTRA_EXPORT bool string_ends_with(string_view s1, string_view s2);\n\n\n\n\t// Returns offset at which src matches target.\n\n\t// If no sync found, return -1\n\n\tTORRENT_EXTRA_EXPORT int search(span<char const> src, span<char const> target);\n", "file_path": "include/libtorrent/aux_/string_util.hpp", "rank": 47, "score": 96407.44404168703 }, { "content": "\t\tstd::string trackerid;\n\n\n\n\t\t// each local listen socket (endpoint) will announce to the tracker. This\n\n\t\t// list contains state per endpoint.\n\n\t\tstd::vector<announce_endpoint> endpoints;\n\n\n\n\t\t// the tier this tracker belongs to\n\n\t\tstd::uint8_t tier = 0;\n\n\n\n\t\t// the max number of failures to announce to this tracker in\n\n\t\t// a row, before this tracker is not used anymore. 0 means unlimited\n\n\t\tstd::uint8_t fail_limit = 0;\n\n\n\n\t\t// a bitmask specifying which sources we got this tracker from.\n\n\t\tstd::uint8_t source:4;\n\n\n\n\t\t// set to true the first time we receive a valid response\n\n\t\t// from this tracker.\n\n\t\tbool verified:1;\n\n\n", "file_path": "include/libtorrent/aux_/announce_entry.hpp", "rank": 48, "score": 96406.93278715778 }, { "content": "\n\n\t\t// torrents can be announced using multiple info hashes\n\n\t\t// for different protocol versions\n\n\n\n\t\t// info_hashes[0] is the v1 info hash (SHA1)\n\n\t\t// info_hashes[1] is the v2 info hash (truncated SHA-256)\n\n\t\taux::array<announce_infohash, num_protocols, protocol_version> info_hashes;\n\n\n\n\t\t// reset announce counters and clears the started sent flag.\n\n\t\t// The announce_endpoint will look like we've never talked to\n\n\t\t// the tracker.\n\n\t\tvoid reset();\n\n\n\n\t\t// set to false to not announce from this endpoint\n\n\t\tbool enabled : 1;\n\n\n\n\t\t// internal\n\n\t\taux::listen_socket_handle socket;\n\n\t};\n\n\n", "file_path": "include/libtorrent/aux_/announce_entry.hpp", "rank": 49, "score": 96406.82434862778 }, { "content": "\n\n\t\t// if this tracker failed the last time it was contacted\n\n\t\t// this error code specifies what error occurred\n\n\t\terror_code last_error;\n\n\n\n\t\t// the time of next tracker announce\n\n\t\ttime_point32 next_announce = (time_point32::min)();\n\n\n\n\t\t// no announces before this time\n\n\t\ttime_point32 min_announce = (time_point32::min)();\n\n\n\n\t\t// TODO: include the number of peers received from this tracker, at last\n\n\t\t// announce\n\n\n\n\t\t// these are either -1 or the scrape information this tracker last\n\n\t\t// responded with. *incomplete* is the current number of downloaders in\n\n\t\t// the swarm, *complete* is the current number of seeds in the swarm and\n\n\t\t// *downloaded* is the cumulative number of completed downloads of this\n\n\t\t// torrent, since the beginning of time (from this tracker's point of\n\n\t\t// view).\n", "file_path": "include/libtorrent/aux_/announce_entry.hpp", "rank": 50, "score": 96406.71024916961 }, { "content": "\n\n\t\t// if this tracker has returned scrape data, these fields are filled in\n\n\t\t// with valid numbers. Otherwise they are set to -1. ``incomplete`` counts\n\n\t\t// the number of current downloaders. ``complete`` counts the number of\n\n\t\t// current peers completed the download, or \"seeds\". ``downloaded`` is the\n\n\t\t// cumulative number of completed downloads.\n\n\t\tint scrape_incomplete = -1;\n\n\t\tint scrape_complete = -1;\n\n\t\tint scrape_downloaded = -1;\n\n\n\n\t\t// the number of times in a row we have failed to announce to this\n\n\t\t// tracker.\n\n\t\tstd::uint8_t fails : 7;\n\n\n\n\t\t// true while we're waiting for a response from the tracker.\n\n\t\tbool updating : 1;\n\n\n\n\t\t// set to true when we get a valid response from an announce\n\n\t\t// with event=started. If it is set, we won't send start in the subsequent\n\n\t\t// announces.\n", "file_path": "include/libtorrent/aux_/announce_entry.hpp", "rank": 51, "score": 96402.63761132532 }, { "content": "\t\tbool start_sent : 1;\n\n\n\n\t\t// set to true when we send a event=completed.\n\n\t\tbool complete_sent : 1;\n\n\n\n\t\t// internal\n\n\t\tbool triggered_manually : 1;\n\n\n\n\t\t// reset announce counters and clears the started sent flag.\n\n\t\t// The announce_endpoint will look like we've never talked to\n\n\t\t// the tracker.\n\n\t\tvoid reset();\n\n\n\n\t\t// updates the failure counter and time-outs for re-trying.\n\n\t\t// This is called when the tracker announce fails.\n\n\t\tvoid failed(int backoff_ratio, seconds32 retry_interval = seconds32(0));\n\n\n\n\t\t// returns true if we can announce to this tracker now.\n\n\t\t// The current time is passed in as ``now``. The ``is_seed``\n\n\t\t// argument is necessary because once we become a seed, we\n", "file_path": "include/libtorrent/aux_/announce_entry.hpp", "rank": 52, "score": 96402.63761132532 }, { "content": "struct announce_entry;\n\nTORRENT_VERSION_NAMESPACE_2_END\n\n\n", "file_path": "include/libtorrent/fwd.hpp", "rank": 53, "score": 96402.63761132532 }, { "content": "\t{\n\n\t\treturn std::make_tuple(!verified, rtt) < std::make_tuple(!rhs.verified, rhs.rtt);\n\n\t}\n\n\n\n#ifndef TORRENT_DISABLE_LOGGING\n\n\ttime_point first_seen = aux::time_now();\n\n#endif\n\n\n\n\t// the time we last received a response for a request to this peer\n\n\ttime_point last_queried = min_time();\n\n\n\n\tnode_id id{nullptr};\n\n\n\n\taux::union_endpoint endpoint;\n\n\n\n\t// the average RTT of this node\n\n\tstd::uint16_t rtt = 0xffff;\n\n\n\n\t// the number of times this node has failed to\n\n\t// respond in a row\n", "file_path": "include/libtorrent/kademlia/node_entry.hpp", "rank": 54, "score": 96402.63761132532 }, { "content": "\n\n\t// this is a read or write operation so that readwritev() knows\n\n\t// what to do when it's actually touching the file\n\n\tusing fileop = std::function<int(file_index_t, std::int64_t, span<iovec_t const>, storage_error&)>;\n\n\n\n\t// this function is responsible for turning read and write operations in the\n\n\t// torrent space (pieces) into read and write operations in the filesystem\n\n\t// space (files on disk).\n\n\tTORRENT_EXTRA_EXPORT int readwritev(file_storage const& files\n\n\t\t, span<iovec_t const> bufs, piece_index_t piece, int offset\n\n\t\t, storage_error& ec, fileop op);\n\n\n\n\t// moves the files in file_storage f from ``save_path`` to\n\n\t// ``destination_save_path`` according to the rules defined by ``flags``.\n\n\t// returns the status code and the new save_path.\n\n\tTORRENT_EXTRA_EXPORT std::pair<status_t, std::string>\n\n\tmove_storage(file_storage const& f\n\n\t\t, std::string save_path\n\n\t\t, std::string const& destination_save_path\n\n\t\t, std::function<void(std::string const&, lt::error_code&)> const& move_partfile\n", "file_path": "include/libtorrent/aux_/storage_utils.hpp", "rank": 55, "score": 96402.62638519514 }, { "content": "\tTORRENT_EXTRA_EXPORT void ltrim(std::string& s);\n\n\n\n#if TORRENT_USE_I2P\n\n\n\n\tTORRENT_EXTRA_EXPORT bool is_i2p_url(std::string const& url);\n\n\n\n#endif\n\n}\n\n\n\n#endif\n", "file_path": "include/libtorrent/aux_/string_util.hpp", "rank": 56, "score": 96401.77009656707 }, { "content": "\t\tstd::string const& in, std::vector<std::string>& errors);\n\n\n\n#if TORRENT_ABI_VERSION == 1 \\\n\n\t|| !defined TORRENT_DISABLE_LOGGING\n\n\tTORRENT_EXTRA_EXPORT std::string print_listen_interfaces(\n\n\t\tstd::vector<listen_interface_t> const& in);\n\n#endif\n\n\n\n\t// this parses the string that's used as the listen_interfaces setting.\n\n\t// it is a comma-separated list of IP or device names with ports. For\n\n\t// example: \"eth0:6881,eth1:6881\" or \"127.0.0.1:6881\"\n\n\tTORRENT_EXTRA_EXPORT void parse_comma_separated_string_port(\n\n\t\tstd::string const& in, std::vector<std::pair<std::string, int>>& out);\n\n\n\n\t// this parses the string that's used as the outgoing_interfaces setting.\n\n\t// it is a comma separated list of IPs and device names. For example:\n\n\t// \"eth0, eth1, 127.0.0.1\"\n\n\tTORRENT_EXTRA_EXPORT void parse_comma_separated_string(\n\n\t\tstd::string const& in, std::vector<std::string>& out);\n\n\n", "file_path": "include/libtorrent/aux_/string_util.hpp", "rank": 57, "score": 96401.16892722069 }, { "content": "\n\n\tstruct listen_interface_t\n\n\t{\n\n\t\tstd::string device;\n\n\t\tint port;\n\n\t\tbool ssl;\n\n\t\tbool local;\n\n\t\tfriend bool operator==(listen_interface_t const& lhs, listen_interface_t const& rhs)\n\n\t\t{\n\n\t\t\treturn lhs.device == rhs.device\n\n\t\t\t\t&& lhs.port == rhs.port\n\n\t\t\t\t&& lhs.ssl == rhs.ssl\n\n\t\t\t\t&& lhs.local == rhs.local;\n\n\t\t}\n\n\t};\n\n\n\n\t// this parses the string that's used as the listen_interfaces setting.\n\n\t// it is a comma-separated list of IP or device names with ports. For\n\n\t// example: \"eth0:6881,eth1:6881\" or \"127.0.0.1:6881\"\n\n\tTORRENT_EXTRA_EXPORT std::vector<listen_interface_t> parse_listen_interfaces(\n", "file_path": "include/libtorrent/aux_/string_util.hpp", "rank": 58, "score": 96400.23714370275 }, { "content": "\t\tfile_storage const& fs\n\n\t\t, std::string const& save_path\n\n\t\t, stat_cache& cache\n\n\t\t, storage_error& ec);\n\n\n\n\tTORRENT_EXTRA_EXPORT int read_zeroes(span<iovec_t const> bufs);\n\n}}\n\n\n\n#endif\n", "file_path": "include/libtorrent/aux_/storage_utils.hpp", "rank": 59, "score": 96396.02381334754 }, { "content": "\t\t, move_flags_t flags, storage_error& ec);\n\n\n\n\t// deletes the files on fs from save_path according to options. Options may\n\n\t// opt to only delete the partfile\n\n\tTORRENT_EXTRA_EXPORT void\n\n\tdelete_files(file_storage const& fs, std::string const& save_path\n\n\t\t, std::string const& part_file_name, remove_flags_t options, storage_error& ec);\n\n\n\n\tTORRENT_EXTRA_EXPORT bool\n\n\tverify_resume_data(add_torrent_params const& rd\n\n\t\t, aux::vector<std::string, file_index_t> const& links\n\n\t\t, file_storage const& fs\n\n\t\t, aux::vector<download_priority_t, file_index_t> const& file_priority\n\n\t\t, stat_cache& stat\n\n\t\t, std::string const& save_path\n\n\t\t, storage_error& ec);\n\n\n\n\t// given the save_path, stat all files on file_storage until one exists. If a\n\n\t// file exists, return true, otherwise return false.\n\n\tTORRENT_EXTRA_EXPORT bool has_any_file(\n", "file_path": "include/libtorrent/aux_/storage_utils.hpp", "rank": 60, "score": 96396.02381334754 }, { "content": "\t\t-> decltype(container.begin())\n\n\t{\n\n\t\tauto i = std::lower_bound(container.begin(), container.end(), v);\n\n\t\tif (i == container.end()) return container.end();\n\n\t\tif (*i != v) return container.end();\n\n\t\treturn i;\n\n\t}\n\n\n\n\ttemplate <typename T, typename U>\n\n\tvoid sorted_insert(std::vector<T>& container, U v)\n\n\t{\n\n\t\tauto i = std::lower_bound(container.begin(), container.end(), v);\n\n\t\tcontainer.insert(i, v);\n\n\t}\n\n}\n\n\n\n#endif\n", "file_path": "include/libtorrent/aux_/vector_utils.hpp", "rank": 61, "score": 96396.02381334754 }, { "content": "#endif\n\n\n\n\ttemplate <typename Library>\n\n\tHMODULE get_library_handle()\n\n\t{\n\n\t\tstatic bool handle_checked = false;\n\n\t\tstatic HMODULE handle = nullptr;\n\n\n\n\t\tif (!handle_checked)\n\n\t\t{\n\n\t\t\thandle_checked = true;\n\n\n\n#ifdef TORRENT_WINRT\n\n\t\t\tMEMORY_BASIC_INFORMATION Information;\n\n\n\n\t\t\tif (::VirtualQuery(&VirtualQuery, &Information, sizeof(Information)) == 0)\n\n\t\t\t{\n\n\t\t\t\treturn nullptr;\n\n\t\t\t}\n\n\n", "file_path": "include/libtorrent/aux_/win_util.hpp", "rank": 62, "score": 96396.02381334754 }, { "content": "\t\t\tconst auto SyscallBegin = static_cast<HMODULE>(Information.AllocationBase);\n\n\t\t\tconst auto LoadLibraryA = reinterpret_cast<LoadLibraryASignature *>(::GetProcAddress(SyscallBegin, \"LoadLibraryA\"));\n\n\n\n\t\t\tif (LoadLibraryA == nullptr)\n\n\t\t\t{\n\n\t\t\t\treturn nullptr;\n\n\t\t\t}\n\n#endif\n\n\n\n\t\t\thandle = LoadLibraryA(Library::library_name);\n\n\t\t}\n\n\t\treturn handle;\n\n\t}\n\n\n\n\ttemplate <typename Library, typename Signature>\n\n\tSignature get_library_procedure(LPCSTR name)\n\n\t{\n\n\t\tstatic Signature proc = nullptr;\n\n\t\tstatic bool failed_proc = false;\n\n\n", "file_path": "include/libtorrent/aux_/win_util.hpp", "rank": 63, "score": 96396.02381334754 }, { "content": "struct TORRENT_EXTRA_EXPORT node_entry\n\n{\n\n\tnode_entry(node_id const& id_, udp::endpoint const& ep, int roundtriptime = 0xffff\n\n\t\t, bool pinged = false);\n\n\texplicit node_entry(udp::endpoint const& ep);\n\n\tnode_entry() = default;\n\n\tvoid update_rtt(int new_rtt);\n\n\n\n\tbool pinged() const { return timeout_count != 0xff; }\n\n\tvoid set_pinged() { if (timeout_count == 0xff) timeout_count = 0; }\n\n\tvoid timed_out() { if (pinged() && timeout_count < 0xfe) ++timeout_count; }\n\n\tint fail_count() const { return pinged() ? timeout_count : 0; }\n\n\tvoid reset_fail_count() { if (pinged()) timeout_count = 0; }\n\n\tudp::endpoint ep() const { return endpoint; }\n\n\tbool confirmed() const { return timeout_count == 0; }\n\n\taddress addr() const { return endpoint.address(); }\n\n\tint port() const { return endpoint.port; }\n\n\n\n\t// compares which node_entry is \"better\". Smaller is better\n\n\tbool operator<(node_entry const& rhs) const\n", "file_path": "include/libtorrent/kademlia/node_entry.hpp", "rank": 64, "score": 94315.56799724237 }, { "content": "struct rtc_offer_id : std::vector<char>\n\n{\n\n\trtc_offer_id() : std::vector<char>(RTC_OFFER_ID_LEN, '\\0') {}\n\n\texplicit rtc_offer_id(span<char const> s) : std::vector<char>(s.begin(), s.end()) {}\n\n};\n\n\n", "file_path": "include/libtorrent/aux_/rtc_signaling.hpp", "rank": 65, "score": 93760.56188571907 }, { "content": "/*\n\n\n\nCopyright (c) 2007, 2009, 2012, 2014-2015, 2020, Arvid Norberg\n\nCopyright (c) 2016, 2018, 2020, Alden Torres\n\nAll rights reserved.\n\n\n\nYou may use, distribute and modify this code under the terms of the BSD license,\n\nsee LICENSE file.\n\n*/\n\n\n\n#ifndef TORRENT_BANDWIDTH_QUEUE_ENTRY_HPP_INCLUDED\n\n#define TORRENT_BANDWIDTH_QUEUE_ENTRY_HPP_INCLUDED\n\n\n\n#include <memory>\n\n\n\n#include \"libtorrent/aux_/bandwidth_limit.hpp\"\n\n#include \"libtorrent/aux_/bandwidth_socket.hpp\"\n\n#include \"libtorrent/aux_/array.hpp\"\n\n\n\nnamespace libtorrent {\n\nnamespace aux {\n\n\n", "file_path": "include/libtorrent/aux_/bandwidth_queue_entry.hpp", "rank": 66, "score": 92118.73071148609 }, { "content": "// include/libtorrent/torrent_info.hpp\n\nstruct web_seed_entry;\n", "file_path": "include/libtorrent/fwd.hpp", "rank": 67, "score": 92101.24405302739 }, { "content": "struct entry;\n\n\n\nnamespace aux {\n", "file_path": "include/libtorrent/kademlia/dht_observer.hpp", "rank": 68, "score": 92094.53572534246 }, { "content": "struct entry;\n\nnamespace aux {\n\n\tstruct session_settings;\n\n}\n\n}\n\n\n\nnamespace libtorrent {\n\nnamespace dht {\n\n\n", "file_path": "include/libtorrent/kademlia/rpc_manager.hpp", "rank": 69, "score": 92094.53572534246 }, { "content": "\t// from the most limiting one\n\n\tint assign_bandwidth();\n\n\n\n\tstatic constexpr int max_bandwidth_channels = 10;\n\n\t// we don't actually support more than 10 channels per peer\n\n\taux::array<bandwidth_channel*, max_bandwidth_channels> channel{};\n\n};\n\n\n\n}\n\n}\n\n\n\n#endif\n", "file_path": "include/libtorrent/aux_/bandwidth_queue_entry.hpp", "rank": 70, "score": 92094.53572534246 }, { "content": "\tint\trtm_use;\t\t/* from rtentry */\n", "file_path": "include/libtorrent/aux_/route.h", "rank": 71, "score": 84573.36715009579 }, { "content": "struct E\n\n{\n\n\texplicit E(char const* msg) : string_member(msg) {}\n\n\tE(E&&) noexcept = default;\n\n\tstd::string string_member;\n\n};\n\n\n\nint D::instances = 0;\n\n\n", "file_path": "test/test_heterogeneous_queue.cpp", "rank": 72, "score": 80269.67872665628 }, { "content": "struct TORRENT_EXTRA_EXPORT bw_request\n\n{\n\n\tbw_request(std::shared_ptr<bandwidth_socket> pe\n\n\t\t, int blk, int prio);\n\n\n\n\tstd::shared_ptr<bandwidth_socket> peer;\n\n\t// 1 is normal prio\n\n\tint priority;\n\n\t// the number of bytes assigned to this request so far\n\n\tint assigned;\n\n\t// once assigned reaches this, we dispatch the request function\n\n\tint request_size;\n\n\n\n\t// the max number of rounds for this request to survive\n\n\t// this ensures that requests gets responses at very low\n\n\t// rate limits, when the requested size would take a long\n\n\t// time to satisfy\n\n\tint ttl;\n\n\n\n\t// loops over the bandwidth channels and assigns bandwidth\n", "file_path": "include/libtorrent/aux_/bandwidth_queue_entry.hpp", "rank": 73, "score": 75274.87926372807 }, { "content": "#ifndef TORRENT_DISABLE_EXTENSIONS\n\nstruct test_plugin : lt::torrent_plugin\n\n{\n\n\tbool m_new_connection = false;\n\n\tbool m_files_checked = false;\n\n\n\n\tstd::shared_ptr<peer_plugin> new_connection(peer_connection_handle const&) override\n\n\t{\n\n\t\tm_new_connection = true;\n\n\t\treturn std::shared_ptr<peer_plugin>();\n\n\t}\n\n\n\n\tvoid on_files_checked() override\n\n\t{\n\n\t\tm_files_checked = true;\n\n\t}\n\n};\n\n\n\nTORRENT_TEST(add_extension_while_transfer)\n\n{\n\n\tbool done = false;\n", "file_path": "simulation/test_session.cpp", "rank": 74, "score": 64224.36541435012 }, { "content": "struct test_plugin : lt::plugin\n\n{\n\n\texplicit test_plugin(int index) : m_index(index) {}\n\n\tvoid on_alert(alert const*) override\n\n\t{\n\n\t\t++plugin_alerts[m_index];\n\n\t}\n\n\tint m_index;\n\n};\n\n} // anonymous namespace\n\n#endif\n\n\n\nTORRENT_TEST(extensions)\n\n{\n\n#ifndef TORRENT_DISABLE_EXTENSIONS\n\n\tmemset(plugin_alerts, 0, sizeof(plugin_alerts));\n\n\taux::alert_manager mgr(100, alert_category::all);\n\n\n\n\tmgr.add_extension(std::make_shared<test_plugin>(0));\n\n\tmgr.add_extension(std::make_shared<test_plugin>(1));\n", "file_path": "test/test_alert_manager.cpp", "rank": 75, "score": 64224.36541435012 }, { "content": "#ifndef TORRENT_DISABLE_EXTENSIONS\n\nstruct post_plugin : lt::plugin\n\n{\n\n\texplicit post_plugin(aux::alert_manager& m) : mgr(m) {}\n\n\tvoid on_alert(alert const*) override\n\n\t{\n\n\t\tif (++depth > 10) return;\n\n\t\tmgr.emplace_alert<piece_finished_alert>(torrent_handle(), 0_piece);\n\n\t}\n\n\n\n\taux::alert_manager& mgr;\n\n\tint depth = 0;\n\n};\n\n\n\n// make sure the alert manager supports alerts being posted while executing a\n\n// plugin handler\n\nTORRENT_TEST(recursive_alerts)\n\n{\n\n\taux::alert_manager mgr(100, alert_category::all);\n\n\tauto pl = std::make_shared<post_plugin>(mgr);\n\n\tmgr.add_extension(pl);\n\n\n\n\tmgr.emplace_alert<piece_finished_alert>(torrent_handle(), 0_piece);\n\n\n\n\tTEST_EQUAL(pl->depth, 11);\n\n}\n\n\n\n#endif // TORRENT_DISABLE_EXTENSIONS\n", "file_path": "test/test_alert_manager.cpp", "rank": 76, "score": 64224.36541435012 }, { "content": "#ifndef TORRENT_DISABLE_EXTENSIONS\n\nstruct test_plugin : lt::torrent_plugin {};\n\n\n", "file_path": "test/test_torrent.cpp", "rank": 77, "score": 64224.36541435012 }, { "content": "struct entry_to_python\n\n{\n\n static object convert(entry::list_type const& l)\n\n {\n\n list result;\n\n\n\n for (entry::list_type::const_iterator i(l.begin()), e(l.end()); i != e; ++i)\n\n {\n\n result.append(*i);\n\n }\n\n\n\n return std::move(result);\n\n }\n\n\n\n static object convert(entry::dictionary_type const& d)\n\n {\n\n dict result;\n\n\n\n for (entry::dictionary_type::const_iterator i(d.begin()), e(d.end()); i != e; ++i)\n\n result[bytes(i->first)] = i->second;\n", "file_path": "bindings/python/src/entry.cpp", "rank": 78, "score": 62416.35995900931 }, { "content": "struct entry_from_python\n\n{\n\n entry_from_python()\n\n {\n\n converter::registry::push_back(\n\n &convertible, &construct, type_id<entry>()\n\n );\n\n }\n\n\n\n static void* convertible(PyObject* e)\n\n {\n\n return e;\n\n }\n\n\n\n static entry construct0(object e)\n\n {\n\n if (extract<dict>(e).check())\n\n {\n\n dict d = extract<dict>(e);\n\n list items(d.items());\n", "file_path": "bindings/python/src/entry.cpp", "rank": 79, "score": 62416.35995900931 }, { "content": "#ifndef TORRENT_DISABLE_LOGGING\n\nstruct log_t : lt::dht::dht_logger\n\n{\n\n\tbool should_log(module_t) const override { return true; }\n\n\n\n\tvoid log(dht_logger::module_t, char const* fmt, ...)\n\n\t\toverride TORRENT_FORMAT(3, 4)\n\n\t{\n\n\t\tva_list v;\n\n\t\tva_start(v, fmt);\n\n\t\tstd::vprintf(fmt, v);\n\n\t\tva_end(v);\n\n\t}\n\n\n\n\tvoid log_packet(message_direction_t dir, span<char const> pkt\n\n\t\t, udp::endpoint const& node) override\n\n\t{\n\n\t\tlt::bdecode_node print;\n\n\t\tlt::error_code ec;\n\n\t\tint ret = bdecode(pkt.data(), pkt.data() + int(pkt.size()), print, ec, nullptr, 100, 100);\n\n\t\tTEST_EQUAL(ret, 0);\n", "file_path": "test/test_dos_blocker.cpp", "rank": 80, "score": 59595.144590926386 }, { "content": "struct temp_disk_io final : lt::disk_interface\n\n\t, lt::buffer_allocator_interface\n\n{\n\n\texplicit temp_disk_io(lt::io_context& ioc): m_ioc(ioc) {}\n\n\n\n\tvoid settings_updated() override {}\n\n\n\n\tlt::storage_holder new_torrent(lt::storage_params const& params\n\n\t\t, std::shared_ptr<void> const&) override\n\n\t{\n\n\t\tlt::storage_index_t const idx = m_free_slots.empty()\n\n\t\t\t? m_torrents.end_index()\n\n\t\t\t: pop(m_free_slots);\n\n\t\tauto storage = std::make_unique<temp_storage>(params.files);\n\n\t\tif (idx == m_torrents.end_index()) m_torrents.emplace_back(std::move(storage));\n\n\t\telse m_torrents[idx] = std::move(storage);\n\n\t\treturn lt::storage_holder(idx, *this);\n\n\t}\n\n\n\n\tvoid remove_torrent(lt::storage_index_t const idx) override\n", "file_path": "examples/custom_storage.cpp", "rank": 81, "score": 58035.03039098549 }, { "content": "struct test_disk_io final : lt::disk_interface\n\n\t, lt::buffer_allocator_interface\n\n{\n\n\texplicit test_disk_io(lt::io_context& ioc, test_disk state)\n\n\t\t: m_timer(ioc)\n\n\t\t, m_state(state)\n\n\t\t, m_ioc(ioc)\n\n\t{}\n\n\n\n\tvoid settings_updated() override {}\n\n\n\n\tlt::storage_holder new_torrent(lt::storage_params const& params\n\n\t\t, std::shared_ptr<void> const&) override\n\n\t{\n\n\t\tTORRENT_ASSERT(m_files == nullptr);\n\n\t\t// This test disk I/O system only supports a single torrent\n\n\t\t// to keep it simple\n\n\t\tlt::file_storage const& fs = params.files;\n\n\t\tm_files = &fs;\n\n\t\tm_blocks_per_piece = fs.piece_length() / lt::default_block_size;\n", "file_path": "simulation/disk_io.cpp", "rank": 82, "score": 58035.03039098549 }, { "content": "\t\treturn static_cast<entry::variant_type const&>(lhs)\n\n\t\t\t== static_cast<entry::variant_type const&>(rhs);\n\n\t}\n\n\n\nnamespace {\n\n\tbool is_binary(std::string const& str)\n\n\t{\n\n\t\treturn std::any_of(str.begin(), str.end()\n\n\t\t\t, [](char const c) { return !aux::is_print(c); });\n\n\t}\n\n\n\n\tstd::string print_string(std::string const& str)\n\n\t{\n\n\t\tif (is_binary(str)) return aux::to_hex(str);\n\n\t\telse return str;\n\n\t}\n\n\n\n\tvoid add_indent(std::string& out, int const indent)\n\n\t{\n\n\t\tout.resize(out.size() + size_t(indent), ' ');\n", "file_path": "src/entry.cpp", "rank": 83, "score": 56805.65328755476 }, { "content": "\n\nnamespace libtorrent {\n\n\n\nnamespace aux {\n\n\n\n\tstring_view integer_to_str(std::array<char, 21>& buf, entry::integer_type val)\n\n\t{\n\n\t\tif (val >= 0)\n\n\t\t{\n\n\t\t\tif (val < 10)\n\n\t\t\t{\n\n\t\t\t\tbuf[0] = '0' + static_cast<char>(val);\n\n\t\t\t\treturn {buf.data(), std::size_t(1)};\n\n\t\t\t}\n\n\t\t\tif (val < 100)\n\n\t\t\t{\n\n\t\t\t\tbuf[0] = '0' + (val / 10) % 10;\n\n\t\t\t\tbuf[1] = '0' + val % 10;\n\n\t\t\t\treturn {buf.data(), std::size_t(2)};\n\n\t\t\t}\n", "file_path": "src/entry.cpp", "rank": 84, "score": 56805.46160929455 }, { "content": "/*\n\n\n\nCopyright (c) 2003-2005, 2007-2008, 2010, 2015-2021, Arvid Norberg\n\nCopyright (c) 2016, Steven Siloti\n\nCopyright (c) 2017, Andrei Kurushin\n\nCopyright (c) 2017, 2020, Alden Torres\n\nCopyright (c) 2019, Amir Abrams\n\nAll rights reserved.\n\n\n\nYou may use, distribute and modify this code under the terms of the BSD license,\n\nsee LICENSE file.\n\n*/\n\n\n\n#include \"libtorrent/config.hpp\"\n\n#include \"libtorrent/bdecode.hpp\"\n\n#include \"libtorrent/bencode.hpp\"\n\n#include \"libtorrent/entry.hpp\"\n\n#include \"libtorrent/hex.hpp\"\n\n#include \"libtorrent/aux_/string_util.hpp\"\n\n#include \"libtorrent/aux_/throw.hpp\"\n", "file_path": "src/entry.cpp", "rank": 85, "score": 56803.17450560008 }, { "content": "\t\tif (i == dict().end()) return nullptr;\n\n\t\treturn &i->second;\n\n\t}\n\n\n\n\tentry::data_type entry::type() const\n\n\t{\n\n\t\treturn static_cast<entry::data_type>(index());\n\n\t}\n\n\n\n\tentry::~entry() = default;\n\n\n\n\tentry& entry::operator=(entry const& e) & = default;\n\n\tentry& entry::operator=(entry&& e) & = default;\n\n\n\n\tentry& entry::operator=(dictionary_type d) & { emplace<dictionary_type>(std::move(d)); return *this; }\n\n\tentry& entry::operator=(span<char const> str) & { emplace<string_type>(str.data(), str.size()); return *this; }\n\n\tentry& entry::operator=(string_view str) & { emplace<string_type>(str.data(), str.size()); return *this; }\n\n\tentry& entry::operator=(string_type str) & { emplace<string_type>(std::move(str)); return *this; }\n\n\tentry& entry::operator=(list_type i) & { emplace<list_type>(std::move(i)); return *this; }\n\n\tentry& entry::operator=(integer_type i) & { emplace<integer_type>(i); return *this; }\n", "file_path": "src/entry.cpp", "rank": 86, "score": 56801.963853342255 }, { "content": "#include \"setup_transfer.hpp\" // for addr()\n\n\n\nusing namespace lt;\n\n\n\nvoid utp_only(lt::session& ses)\n\n{\n\n\tsettings_pack p;\n\n\tutp_only(p);\n\n\tses.apply_settings(p);\n\n}\n\n\n\nvoid enable_enc(lt::session& ses)\n\n{\n\n\tsettings_pack p;\n\n\tenable_enc(p);\n\n\tses.apply_settings(p);\n\n}\n\n\n\nvoid filter_ips(lt::session& ses)\n\n{\n", "file_path": "simulation/utils.cpp", "rank": 87, "score": 56797.05074204468 }, { "content": "\t\t}\n\n\n\n\t\tvoid operator()(entry::uninitialized_type const&) const\n\n\t\t{\n\n\t\t\tout += \"<uninitialized>\";\n\n\t\t}\n\n\t};\n\n}\n\n\n\n\tstd::string entry::to_string(bool const single_line) const\n\n\t{\n\n\t\tstd::string ret;\n\n\t\tstd::visit(to_string_visitor{ret, 0, single_line}, static_cast<entry::variant_type const&>(*this));\n\n\t\treturn ret;\n\n\t}\n\n\n\n}\n", "file_path": "src/entry.cpp", "rank": 88, "score": 56797.02459249044 }, { "content": "\t}\n\n\n\n\tentry::entry(dictionary_type v) : variant_type(std::move(v)) {}\n\n\tentry::entry(list_type v) : variant_type(std::move(v)) {}\n\n\tentry::entry(span<char const> v) : variant_type(std::in_place_type<string_type>, v.data(), v.size()) {}\n\n\tentry::entry(string_view v) : variant_type(std::in_place_type<string_type>, v.data(), v.size()) {}\n\n\tentry::entry(string_type s) : variant_type(std::move(s)) {}\n\n\n\n\ttemplate <typename U, typename Cond>\n\n\tentry::entry(U v) // NOLINT\n\n\t\t\t: variant_type(std::in_place_type<string_type>, std::move(v))\n\n\t{}\n\n\n\n\t// explicit template instantiation\n\n\ttemplate TORRENT_EXPORT\n\n\tentry::entry(char const*);\n\n\n\n\tentry::entry(integer_type v) : variant_type(std::move(v)) {}\n\n\tentry::entry(preformatted_type v) : variant_type(std::move(v)) {}\n\n\n", "file_path": "src/entry.cpp", "rank": 89, "score": 56795.64692629375 }, { "content": "\tentry& entry::operator=(preformatted_type d) & { emplace<preformatted_type>(std::move(d)); return *this; }\n\n\n\n\ttemplate <typename U, typename Cond>\n\n\tentry& entry::operator=(U v) &\n\n\t{\n\n\t\templace<string_type>(v);\n\n\t\treturn *this;\n\n\t}\n\n\n\n\t// explicit template instantiation\n\n\ttemplate TORRENT_EXPORT\n\n\tentry& entry::operator=(char const*) &;\n\n\n\n\ttemplate <typename T>\n\n\tT& entry::get()\n\n\t{\n\n\t\tif (std::holds_alternative<uninitialized_type>(*this)) emplace<T>();\n\n\t\telse if (!std::holds_alternative<T>(*this)) throw_error();\n\n\t\treturn std::get<T>(*this);\n\n\t}\n", "file_path": "src/entry.cpp", "rank": 90, "score": 56794.607570468135 }, { "content": "#endif\n\n\t\tif (i != dict().end()) return i->second;\n\n\t\tauto const ret = dict().emplace(\n\n\t\t\tstd::piecewise_construct,\n\n\t\t\tstd::forward_as_tuple(key),\n\n\t\t\tstd::forward_as_tuple()).first;\n\n\t\treturn ret->second;\n\n\t}\n\n\n\n\tconst entry& entry::operator[](string_view key) const\n\n\t{\n\n\t\t// at least GCC-5.4 for ARM (on travis) has a libstdc++ whose debug map$\n\n\t\t// doesn't seem to support transparent comparators$\n\n#if ! defined _GLIBCXX_DEBUG\n\n\t\tauto const i = dict().find(key);\n\n#else\n\n\t\tauto const i = dict().find(std::string(key));\n\n#endif\n\n\t\tif (i == dict().end()) throw_error();\n\n\t\treturn i->second;\n", "file_path": "src/entry.cpp", "rank": 91, "score": 56794.202728069395 }, { "content": "\t\t}\n\n\t\tif (sign) *ptr-- = '-';\n\n\t\t++ptr;\n\n\t\treturn {ptr, static_cast<std::size_t>(&buf.back() - ptr + 1)};\n\n\t}\n\n} // aux\n\n\n\nnamespace {\n\n[[noreturn]] inline void throw_error()\n\n{ aux::throw_ex<system_error>(errors::invalid_entry_type); }\n\n} // anonymous\n\n\n\n\tentry& entry::operator[](string_view key)\n\n\t{\n\n\t\t// at least GCC-5.4 for ARM (on travis) has a libstdc++ whose debug map$\n\n\t\t// doesn't seem to support transparent comparators$\n\n#if ! defined _GLIBCXX_DEBUG\n\n\t\tauto const i = dict().find(key);\n\n#else\n\n\t\tauto const i = dict().find(std::string(key));\n", "file_path": "src/entry.cpp", "rank": 92, "score": 56793.211192655996 }, { "content": "/*\n\n\n\nCopyright (c) 2016-2019, 2021, Arvid Norberg\n\nAll rights reserved.\n\n\n\nYou may use, distribute and modify this code under the terms of the BSD license,\n\nsee LICENSE file.\n\n*/\n\n\n\n#ifndef TORRENT_UTILS_HPP_INCLUDED\n\n#define TORRENT_UTILS_HPP_INCLUDED\n\n\n\n#include <functional>\n\n#include \"libtorrent/address.hpp\"\n\n#include \"libtorrent/socket.hpp\"\n\n#include \"libtorrent/flags.hpp\"\n\n#include \"libtorrent/torrent_status.hpp\"\n\n#include \"libtorrent/settings_pack.hpp\"\n\n#include \"simulator/simulator.hpp\"\n\n\n", "file_path": "simulation/utils.hpp", "rank": 93, "score": 56793.152303877534 }, { "content": "\tip_filter filter;\n\n\tfilter.add_rule(make_address_v4(\"50.0.0.1\")\n\n\t\t, make_address_v4(\"50.0.0.2\"), ip_filter::blocked);\n\n\tses.set_ip_filter(filter);\n\n}\n\n\n\nvoid utp_only(lt::settings_pack& p)\n\n{\n\n\tusing namespace lt;\n\n\tp.set_bool(settings_pack::enable_outgoing_tcp, false);\n\n\tp.set_bool(settings_pack::enable_incoming_tcp, false);\n\n\tp.set_bool(settings_pack::enable_outgoing_utp, true);\n\n\tp.set_bool(settings_pack::enable_incoming_utp, true);\n\n}\n\n\n\nvoid enable_enc(lt::settings_pack& p)\n\n{\n\n\tusing namespace lt;\n\n\tp.set_bool(settings_pack::prefer_rc4, true);\n\n\tp.set_int(settings_pack::in_enc_policy, settings_pack::pe_forced);\n", "file_path": "simulation/utils.cpp", "rank": 94, "score": 56791.68111181749 }, { "content": "/*\n\n\n\nCopyright (c) 2016-2019, 2021, Arvid Norberg\n\nAll rights reserved.\n\n\n\nYou may use, distribute and modify this code under the terms of the BSD license,\n\nsee LICENSE file.\n\n*/\n\n\n\n#include \"utils.hpp\"\n\n#include \"test.hpp\"\n\n#include \"libtorrent/session.hpp\"\n\n#include \"libtorrent/settings_pack.hpp\"\n\n#include \"libtorrent/address.hpp\"\n\n#include \"libtorrent/ip_filter.hpp\"\n\n#include \"libtorrent/alert_types.hpp\"\n\n#include \"libtorrent/session_stats.hpp\"\n\n#include \"libtorrent/alert.hpp\"\n\n#include \"libtorrent/io_context.hpp\"\n\n#include \"setup_swarm.hpp\"\n", "file_path": "simulation/utils.cpp", "rank": 95, "score": 56791.15655940096 }, { "content": "\n\n\ttemplate <typename T>\n\n\tT const& entry::get() const\n\n\t{\n\n\t\tif (!std::holds_alternative<T>(*this)) throw_error();\n\n\t\treturn std::get<T>(*this);\n\n\t}\n\n\n\n\tentry::integer_type& entry::integer() { return get<integer_type>(); }\n\n\tentry::integer_type const& entry::integer() const { return get<integer_type>(); }\n\n\tentry::string_type& entry::string() { return get<string_type>(); }\n\n\tentry::string_type const& entry::string() const { return get<string_type>(); }\n\n\tentry::list_type& entry::list() { return get<list_type>(); }\n\n\tentry::list_type const& entry::list() const { return get<list_type>(); }\n\n\tentry::dictionary_type& entry::dict() { return get<dictionary_type>(); }\n\n\tentry::dictionary_type const& entry::dict() const { return get<dictionary_type>(); }\n\n\tentry::preformatted_type& entry::preformatted() { return get<preformatted_type>(); }\n\n\tentry::preformatted_type const& entry::preformatted() const { return get<preformatted_type>(); }\n\n\n\n\tentry::entry() : variant_type(std::in_place_type<uninitialized_type>) {}\n", "file_path": "src/entry.cpp", "rank": 96, "score": 56790.6366057423 }, { "content": "\tentry::entry(data_type t) : variant_type(std::in_place_type<uninitialized_type>)\n\n\t{\n\n\t\tswitch (t)\n\n\t\t{\n\n\t\tcase int_t: emplace<integer_type>(); break;\n\n\t\tcase string_t: emplace<string_type>(); break;\n\n\t\tcase list_t: emplace<list_type>(); break;\n\n\t\tcase dictionary_t: emplace<dictionary_type>(); break;\n\n\t\tcase undefined_t: emplace<uninitialized_type>(); break;\n\n\t\tcase preformatted_t: emplace<preformatted_type>(); break;\n\n\t\t}\n\n\t}\n\n\n\n\tentry::entry(const entry& e) = default;\n\n\tentry::entry(entry&& e) noexcept = default;\n\n\n\n\tentry::entry(bdecode_node const& n)\n\n\t\t: variant_type(std::in_place_type<uninitialized_type>)\n\n\t{\n\n\t\tthis->operator=(n);\n", "file_path": "src/entry.cpp", "rank": 97, "score": 56790.255271140995 }, { "content": "\t}\n\n\n\n\tentry* entry::find_key(string_view key)\n\n\t{\n\n#if ! defined _GLIBCXX_DEBUG\n\n\t\tauto const i = dict().find(key);\n\n#else\n\n\t\tauto const i = dict().find(std::string(key));\n\n#endif\n\n\t\tif (i == dict().end()) return nullptr;\n\n\t\treturn &i->second;\n\n\t}\n\n\n\n\tentry const* entry::find_key(string_view key) const\n\n\t{\n\n#if ! defined _GLIBCXX_DEBUG\n\n\t\tauto const i = dict().find(key);\n\n#else\n\n\t\tauto const i = dict().find(std::string(key));\n\n#endif\n", "file_path": "src/entry.cpp", "rank": 98, "score": 56789.60105164019 }, { "content": "#include \"test.hpp\"\n\n#include \"test_utils.hpp\"\n\n#include <vector>\n\n#include <set>\n\n#include <thread>\n\n#include <iostream>\n\n\n\nusing namespace lt;\n\n\n\nnamespace {\n\n\n\nvoid touch_file(std::string const& filename, int size)\n\n{\n\n\tstd::vector<char> v;\n\n\tv.resize(aux::numeric_cast<std::size_t>(size));\n\n\tfor (int i = 0; i < size; ++i)\n\n\t\tv[std::size_t(i)] = char(i & 255);\n\n\n\n\tofstream(filename.c_str()).write(v.data(), lt::aux::numeric_cast<std::streamsize>(v.size()));\n\n}\n", "file_path": "test/test_file.cpp", "rank": 99, "score": 44.020531754871286 } ]
C++
src/GenerateKernelDirectConvU8S8S32ACC32.cc
pashu123/FBGEMM
1b6412acd4d53f94e4febdb6a5b10b0caee6331c
#include <iostream> #include "./CodeGenHelpers.h" #include "./DirectConv.h" namespace fbgemm { namespace x86 = asmjit::x86; template <> template <inst_set_t instSet> void DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>::storeCRegs( x86::Emitter* a, int rowRegs, int colRegs, x86::Gp C_Offset, x86::Gp ldcReg, bool accum) { using VecT = typename simd_info<instSet>::vec_reg_t; static constexpr int vectorLen = simd_info<instSet>::WIDTH_BYTES; for (int i = 0; i < rowRegs; ++i) { if (i != 0) { a->add(C_Offset, ldcReg); } else { a->xor_(C_Offset.r32(), C_Offset.r32()); } for (int j = 0; j < colRegs; ++j) { if (accum) { a->vpaddd( VecT(i * colRegs + j), VecT(i * colRegs + j), x86::dword_ptr( a->zcx(), C_Offset, 0, j * vectorLen * sizeof(int8_t))); } a->vmovups( x86::dword_ptr(a->zcx(), C_Offset, 0, j * vectorLen * sizeof(int8_t)), VecT(i * colRegs + j)); } } } template <> template <inst_set_t instSet> void DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>:: genComputeBlockDirectConv( x86::Emitter* a, x86::Gp buffer_A, x86::Gp buffer_B, x86::Gp , int rowRegs, int colRegs, int strideXich) { static constexpr int vectorLen = simd_info<instSet>::WIDTH_BYTES; using VecRegT = typename simd_info<instSet>::vec_reg_t; constexpr int numRegs = simd_info<instSet>::NUM_VEC_REGS; VecRegT AReg(numRegs - 1); VecRegT BReg(numRegs - 2); VecRegT oneReg(numRegs - 3); VecRegT res1(numRegs - 4); for (int j = 0; j < colRegs; ++j) { emitLoadDWord<instSet, VecRegT>( a, BReg, x86::dword_ptr(buffer_B, j * vectorLen * sizeof(int8_t))); for (int i = 0; i < rowRegs; ++i) { a->vpbroadcastd( AReg, x86::dword_ptr(buffer_A, (i * strideXich) * sizeof(uint8_t))); a->vpmaddubsw(res1, AReg, BReg); a->vpmaddwd(res1, oneReg, res1); a->vpaddd(VecRegT(i * colRegs + j), res1, VecRegT(i * colRegs + j)); } } } template <> template <inst_set_t instSet> DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>::jit_micro_kernel_fp DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>::getOrCreateDirectConv( bool accum, int32_t O1, int32_t i1Xich, int32_t strideXich) { using VecRegT = typename simd_info<instSet>::vec_reg_t; constexpr int numRegs = simd_info<instSet>::NUM_VEC_REGS; static constexpr int vectorLen = simd_info<instSet>::WIDTH_BYTES; std::tuple<bool, int, int, int, int, int, int> kernelSig; int mRegBlockSize = 12; int nRegBlockSize = 8; int row_interleave = 4; kernelSig = std::make_tuple( accum, O1, i1Xich, strideXich, i1Xich, mRegBlockSize, nRegBlockSize); return codeCache_.getOrCreate(kernelSig, [&]() -> jit_micro_kernel_fp { asmjit::CodeHolder code; code.init(runtime().environment()); x86::Assembler assembler(&code); x86::Emitter* a = assembler.as<x86::Emitter>(); #if defined(FBGEMM_LOG_CODE) FILE* codeLogfile = fopen( getCodeLoggingFile<instSet>( accum, O1, i1Xich, strideXich, i1Xich, mRegBlockSize, nRegBlockSize) .c_str(), "w"); asmjit::FileLogger* codeLogger = new asmjit::FileLogger(codeLogfile); if (codeLogger) { code.setLogger(codeLogger); } #endif const int maxMRegs = mRegBlockSize; (void)maxMRegs; const int maxNRegs = nRegBlockSize * row_interleave / vectorLen; assert( maxMRegs * maxNRegs <= numRegs - 4 && "MRegs x NRegs is above available registers (MAX_REGS - 4)"); int O1RegBlocks = O1 / mRegBlockSize; int O1RegBlocksRem = O1 % mRegBlockSize; x86::Gp buffer_A = a->zdi(); x86::Gp buffer_B = a->zsi(); x86::Gp B_pf = a->zdx(); x86::Gp CBase = a->zcx(); x86::Gp ichXk1 = a->gpz(8); x86::Gp ldcReg = a->gpz(9); asmjit::FuncDetail func; func.init( asmjit::FuncSignatureT< void, uint8_t*, int8_t*, int8_t*, int32_t*, int, int>(asmjit::CallConv::kIdHost), a->environment()); asmjit::FuncFrame frame; frame.init(func); auto dirtyVecRegs = asmjit::Support::bitMask(0, 1, 2, 3, 4, 5, 6, 7) | asmjit::Support::bitMask(8, 9, 10, 11, 12, 13, 14, 15); if (numRegs >= 16) { dirtyVecRegs |= asmjit::Support::bitMask(16, 17, 18, 19, 20, 21, 22, 23) | asmjit::Support::bitMask(24, 25, 26, 27, 28, 29, 30, 31); } frame.setDirtyRegs(x86::Reg::kGroupVec, dirtyVecRegs); frame.setDirtyRegs( x86::Reg::kGroupGp, asmjit::Support::bitMask(8, 9, 10, 11, 12, 13, 14, 15)); asmjit::FuncArgsAssignment args(&func); args.assignAll(buffer_A, buffer_B, B_pf, CBase, ichXk1, ldcReg); args.updateFuncFrame(frame); frame.finalize(); a->emitProlog(frame); a->emitArgsAssignment(frame, args); asmjit::Label LoopMBlocks = a->newLabel(); x86::Gp buffer_B_saved = a->gpz(10); x86::Gp C_Offset = a->gpz(11); x86::Gp iIdx = a->gpz(13); x86::Gp kIdx = a->gpz(15); VecRegT oneReg(numRegs - 3); gen16BitVectorOne<instSet, VecRegT>(a, oneReg); a->imul(ldcReg, ldcReg, static_cast<asmjit::Imm>(sizeof(int32_t))); int colRegs = maxNRegs; auto issueLoopOverK = [&](int rowRegs) { asmjit::Label LoopKLabel = a->newLabel(); asmjit::Label LoopK0Label = a->newLabel(); initCRegs(a, rowRegs, colRegs); a->xor_(kIdx.r32(), kIdx.r32()); a->bind(LoopKLabel); a->add(kIdx, static_cast<asmjit::Imm>(row_interleave)); genComputeBlockDirectConv<instSet>( a, buffer_A, buffer_B, B_pf, rowRegs, colRegs, strideXich); a->add( buffer_A, static_cast<asmjit::Imm>(row_interleave * sizeof(uint8_t))); a->add(buffer_B, static_cast<asmjit::Imm>(8 * sizeof(int32_t))); a->add(B_pf, static_cast<asmjit::Imm>(8 * sizeof(int32_t))); a->cmp(kIdx, ichXk1); a->jl(LoopKLabel); a->sub(buffer_A, ichXk1); a->add(buffer_A, static_cast<asmjit::Imm>(i1Xich)); a->xor_(kIdx.r32(), kIdx.r32()); a->bind(LoopK0Label); a->add(kIdx, static_cast<asmjit::Imm>(row_interleave)); genComputeBlockDirectConv<instSet>( a, buffer_A, buffer_B, B_pf, rowRegs, colRegs, strideXich); a->add( buffer_A, static_cast<asmjit::Imm>(row_interleave * sizeof(uint8_t))); a->add(buffer_B, static_cast<asmjit::Imm>(8 * sizeof(int32_t))); a->add(B_pf, static_cast<asmjit::Imm>(8 * sizeof(int32_t))); a->cmp(kIdx, ichXk1); a->jl(LoopK0Label); a->sub(buffer_A, ichXk1); storeCRegs<instSet>(a, rowRegs, colRegs, C_Offset, ldcReg, accum); }; if (O1RegBlocks > 0) { a->xor_(iIdx.r32(), iIdx.r32()); a->bind(LoopMBlocks); a->inc(iIdx); a->mov(buffer_B_saved, buffer_B); issueLoopOverK(mRegBlockSize); int rowRegs = mRegBlockSize; a->sub(buffer_A, static_cast<asmjit::Imm>(i1Xich)); a->add( buffer_A, static_cast<asmjit::Imm>(rowRegs * strideXich * sizeof(uint8_t))); a->mov(buffer_B, buffer_B_saved); a->imul( C_Offset, ldcReg, static_cast<asmjit::Imm>(rowRegs * sizeof(int8_t))); a->add(CBase, C_Offset); a->cmp(iIdx, O1RegBlocks); a->jl(LoopMBlocks); } if (O1RegBlocksRem > 0) { issueLoopOverK(O1RegBlocksRem); } a->emitEpilog(frame); jit_micro_kernel_fp fn; asmjit::Error err; { std::unique_lock<std::mutex> lock(rtMutex_); err = runtime().add(&fn, &code); } if (err) { std::cout << "Error: in fn add" << std::endl; return nullptr; } #if defined(FBGEMM_LOG_CODE) fclose(codeLogfile); delete codeLogger; #endif return fn; }); } template void DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>:: storeCRegs<inst_set_t::avx512>( x86::Emitter* a, int rowRegs, int colRegs, x86::Gp C_Offset, x86::Gp ldcReg, bool accum); template void DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>:: storeCRegs<inst_set_t::avx512_ymm>( x86::Emitter* a, int rowRegs, int colRegs, x86::Gp C_Offset, x86::Gp ldcReg, bool accum); template void DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>:: storeCRegs<inst_set_t::avx2>( x86::Emitter* a, int rowRegs, int colRegs, x86::Gp C_Offset, x86::Gp ldcReg, bool accum); template DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>:: jit_micro_kernel_fp DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>:: getOrCreateDirectConv<inst_set_t::avx2>( bool accum, int32_t O1, int32_t i1Xich, int32_t strideXich); }
#include <iostream> #include "./CodeGenHelpers.h" #include "./DirectConv.h" namespace fbgemm { namespace x86 = asmjit::x86; template <> template <inst_set_t instSet> void DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>::storeCRegs( x86::Emitter* a, int rowRegs, int colRegs, x86::Gp C_Offset, x86::Gp ldcReg, bool accum) { using VecT = typename simd_info<instSet>::vec_reg_t; static constexpr int vectorLen = simd_info<instSet>::WIDTH_BYTES; for (int i = 0; i < rowRegs; ++i) { if (i != 0) { a->add(C_Offset, ldcReg); } else { a->xor_(C_Offset.r32(), C_Offset.r32()); } for (int j = 0; j < colRegs; ++j) { if (accum) { a->vpaddd( VecT(i * colRegs + j), VecT(i * colRegs + j), x86::dword_ptr( a->zcx(), C_Offset, 0, j * vectorLen * sizeof(int8_t))); } a->vmovups( x86::dword_ptr(a->zcx(), C_Offset, 0, j * vectorLen * sizeof(int8_t)), VecT(i * colRegs + j)); } } } template <> template <inst_set_t instSet> void DirectConvCodeGenBase<uint8_t, int8_t, int32_t, i
template <> template <inst_set_t instSet> DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>::jit_micro_kernel_fp DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>::getOrCreateDirectConv( bool accum, int32_t O1, int32_t i1Xich, int32_t strideXich) { using VecRegT = typename simd_info<instSet>::vec_reg_t; constexpr int numRegs = simd_info<instSet>::NUM_VEC_REGS; static constexpr int vectorLen = simd_info<instSet>::WIDTH_BYTES; std::tuple<bool, int, int, int, int, int, int> kernelSig; int mRegBlockSize = 12; int nRegBlockSize = 8; int row_interleave = 4; kernelSig = std::make_tuple( accum, O1, i1Xich, strideXich, i1Xich, mRegBlockSize, nRegBlockSize); return codeCache_.getOrCreate(kernelSig, [&]() -> jit_micro_kernel_fp { asmjit::CodeHolder code; code.init(runtime().environment()); x86::Assembler assembler(&code); x86::Emitter* a = assembler.as<x86::Emitter>(); #if defined(FBGEMM_LOG_CODE) FILE* codeLogfile = fopen( getCodeLoggingFile<instSet>( accum, O1, i1Xich, strideXich, i1Xich, mRegBlockSize, nRegBlockSize) .c_str(), "w"); asmjit::FileLogger* codeLogger = new asmjit::FileLogger(codeLogfile); if (codeLogger) { code.setLogger(codeLogger); } #endif const int maxMRegs = mRegBlockSize; (void)maxMRegs; const int maxNRegs = nRegBlockSize * row_interleave / vectorLen; assert( maxMRegs * maxNRegs <= numRegs - 4 && "MRegs x NRegs is above available registers (MAX_REGS - 4)"); int O1RegBlocks = O1 / mRegBlockSize; int O1RegBlocksRem = O1 % mRegBlockSize; x86::Gp buffer_A = a->zdi(); x86::Gp buffer_B = a->zsi(); x86::Gp B_pf = a->zdx(); x86::Gp CBase = a->zcx(); x86::Gp ichXk1 = a->gpz(8); x86::Gp ldcReg = a->gpz(9); asmjit::FuncDetail func; func.init( asmjit::FuncSignatureT< void, uint8_t*, int8_t*, int8_t*, int32_t*, int, int>(asmjit::CallConv::kIdHost), a->environment()); asmjit::FuncFrame frame; frame.init(func); auto dirtyVecRegs = asmjit::Support::bitMask(0, 1, 2, 3, 4, 5, 6, 7) | asmjit::Support::bitMask(8, 9, 10, 11, 12, 13, 14, 15); if (numRegs >= 16) { dirtyVecRegs |= asmjit::Support::bitMask(16, 17, 18, 19, 20, 21, 22, 23) | asmjit::Support::bitMask(24, 25, 26, 27, 28, 29, 30, 31); } frame.setDirtyRegs(x86::Reg::kGroupVec, dirtyVecRegs); frame.setDirtyRegs( x86::Reg::kGroupGp, asmjit::Support::bitMask(8, 9, 10, 11, 12, 13, 14, 15)); asmjit::FuncArgsAssignment args(&func); args.assignAll(buffer_A, buffer_B, B_pf, CBase, ichXk1, ldcReg); args.updateFuncFrame(frame); frame.finalize(); a->emitProlog(frame); a->emitArgsAssignment(frame, args); asmjit::Label LoopMBlocks = a->newLabel(); x86::Gp buffer_B_saved = a->gpz(10); x86::Gp C_Offset = a->gpz(11); x86::Gp iIdx = a->gpz(13); x86::Gp kIdx = a->gpz(15); VecRegT oneReg(numRegs - 3); gen16BitVectorOne<instSet, VecRegT>(a, oneReg); a->imul(ldcReg, ldcReg, static_cast<asmjit::Imm>(sizeof(int32_t))); int colRegs = maxNRegs; auto issueLoopOverK = [&](int rowRegs) { asmjit::Label LoopKLabel = a->newLabel(); asmjit::Label LoopK0Label = a->newLabel(); initCRegs(a, rowRegs, colRegs); a->xor_(kIdx.r32(), kIdx.r32()); a->bind(LoopKLabel); a->add(kIdx, static_cast<asmjit::Imm>(row_interleave)); genComputeBlockDirectConv<instSet>( a, buffer_A, buffer_B, B_pf, rowRegs, colRegs, strideXich); a->add( buffer_A, static_cast<asmjit::Imm>(row_interleave * sizeof(uint8_t))); a->add(buffer_B, static_cast<asmjit::Imm>(8 * sizeof(int32_t))); a->add(B_pf, static_cast<asmjit::Imm>(8 * sizeof(int32_t))); a->cmp(kIdx, ichXk1); a->jl(LoopKLabel); a->sub(buffer_A, ichXk1); a->add(buffer_A, static_cast<asmjit::Imm>(i1Xich)); a->xor_(kIdx.r32(), kIdx.r32()); a->bind(LoopK0Label); a->add(kIdx, static_cast<asmjit::Imm>(row_interleave)); genComputeBlockDirectConv<instSet>( a, buffer_A, buffer_B, B_pf, rowRegs, colRegs, strideXich); a->add( buffer_A, static_cast<asmjit::Imm>(row_interleave * sizeof(uint8_t))); a->add(buffer_B, static_cast<asmjit::Imm>(8 * sizeof(int32_t))); a->add(B_pf, static_cast<asmjit::Imm>(8 * sizeof(int32_t))); a->cmp(kIdx, ichXk1); a->jl(LoopK0Label); a->sub(buffer_A, ichXk1); storeCRegs<instSet>(a, rowRegs, colRegs, C_Offset, ldcReg, accum); }; if (O1RegBlocks > 0) { a->xor_(iIdx.r32(), iIdx.r32()); a->bind(LoopMBlocks); a->inc(iIdx); a->mov(buffer_B_saved, buffer_B); issueLoopOverK(mRegBlockSize); int rowRegs = mRegBlockSize; a->sub(buffer_A, static_cast<asmjit::Imm>(i1Xich)); a->add( buffer_A, static_cast<asmjit::Imm>(rowRegs * strideXich * sizeof(uint8_t))); a->mov(buffer_B, buffer_B_saved); a->imul( C_Offset, ldcReg, static_cast<asmjit::Imm>(rowRegs * sizeof(int8_t))); a->add(CBase, C_Offset); a->cmp(iIdx, O1RegBlocks); a->jl(LoopMBlocks); } if (O1RegBlocksRem > 0) { issueLoopOverK(O1RegBlocksRem); } a->emitEpilog(frame); jit_micro_kernel_fp fn; asmjit::Error err; { std::unique_lock<std::mutex> lock(rtMutex_); err = runtime().add(&fn, &code); } if (err) { std::cout << "Error: in fn add" << std::endl; return nullptr; } #if defined(FBGEMM_LOG_CODE) fclose(codeLogfile); delete codeLogger; #endif return fn; }); } template void DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>:: storeCRegs<inst_set_t::avx512>( x86::Emitter* a, int rowRegs, int colRegs, x86::Gp C_Offset, x86::Gp ldcReg, bool accum); template void DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>:: storeCRegs<inst_set_t::avx512_ymm>( x86::Emitter* a, int rowRegs, int colRegs, x86::Gp C_Offset, x86::Gp ldcReg, bool accum); template void DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>:: storeCRegs<inst_set_t::avx2>( x86::Emitter* a, int rowRegs, int colRegs, x86::Gp C_Offset, x86::Gp ldcReg, bool accum); template DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>:: jit_micro_kernel_fp DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>:: getOrCreateDirectConv<inst_set_t::avx2>( bool accum, int32_t O1, int32_t i1Xich, int32_t strideXich); }
nt32_t>:: genComputeBlockDirectConv( x86::Emitter* a, x86::Gp buffer_A, x86::Gp buffer_B, x86::Gp , int rowRegs, int colRegs, int strideXich) { static constexpr int vectorLen = simd_info<instSet>::WIDTH_BYTES; using VecRegT = typename simd_info<instSet>::vec_reg_t; constexpr int numRegs = simd_info<instSet>::NUM_VEC_REGS; VecRegT AReg(numRegs - 1); VecRegT BReg(numRegs - 2); VecRegT oneReg(numRegs - 3); VecRegT res1(numRegs - 4); for (int j = 0; j < colRegs; ++j) { emitLoadDWord<instSet, VecRegT>( a, BReg, x86::dword_ptr(buffer_B, j * vectorLen * sizeof(int8_t))); for (int i = 0; i < rowRegs; ++i) { a->vpbroadcastd( AReg, x86::dword_ptr(buffer_A, (i * strideXich) * sizeof(uint8_t))); a->vpmaddubsw(res1, AReg, BReg); a->vpmaddwd(res1, oneReg, res1); a->vpaddd(VecRegT(i * colRegs + j), res1, VecRegT(i * colRegs + j)); } } }
function_block-function_prefixed
[ { "content": "namespace fbgemm {\n\n\n\ntypedef uint16_t bfloat16;\n\n\n\n/**\n\n * @ Transform all entries in a matrix from fp32 to bfloat16: reference\n\n * implementation.\n\n *\n\n */\n\nFBGEMM_API void\n\nFloatToBfloat16_ref(const float* src, bfloat16* dst, size_t size);\n\n\n\n/**\n\n * @ Transform all entries in a matrix from bfloat16 to fp32: reference\n\n * implementation.\n\n *\n\n */\n\nFBGEMM_API void\n\nBfloat16ToFloat_ref(const bfloat16* src, float* dst, size_t size);\n\n\n\n/**\n\n * @ Transform all entries in a matrix from fp32 to bfloat16: simd\n\n * implementation.\n\n *\n\n */\n\nFBGEMM_API void\n\nFloatToBfloat16_simd(const float* src, bfloat16* dst, size_t size);\n\n\n\n/**\n\n * @ Transform all entries in a matrix from bfloat16 to fp32: simd\n\n * implementation.\n\n *\n\n */\n\nFBGEMM_API void\n\nBfloat16ToFloat_simd(const bfloat16* src, float* dst, size_t size);\n\n\n\n/**\n\n * @brief AVX2 implementation to convert fp32 numbers to bf16 numbers.\n\n *\n\n */\n\nFBGEMM_API void\n\nFloatToBfloat16_avx2(const float* src, bfloat16* dst, size_t size);\n\n\n\n/**\n\n * @brief AVX512 implementation to convert fp32 numbers to bf16 numbers.\n\n *\n\n */\n\nFBGEMM_API void\n\nFloatToBfloat16_avx512(const float* src, bfloat16* dst, size_t size);\n\n\n\n/**\n\n * @brief AVX2 implementation to convert bf16 numbers to fp32 numbers.\n\n *\n\n */\n\nFBGEMM_API void\n\nBfloat16ToFloat_avx2(const bfloat16* src, float* dst, size_t size);\n\n\n\n/**\n\n * @brief AVX512 implementation to convert bf16 numbers to fp32 numbers.\n\n *\n\n */\n\nFBGEMM_API void\n\nBfloat16ToFloat_avx512(const bfloat16* src, float* dst, size_t size);\n\n\n\n/**\n\n * @ Transform all entries in a matrix from fp32 to float16: reference\n\n * implementation.\n\n *\n\n * @param do_clip if true we saturate to fp16 min and max instead of generating\n\n * infinities.\n\n */\n\nFBGEMM_API void FloatToFloat16_ref(\n\n const float* src,\n\n float16* dst,\n\n size_t size,\n\n bool do_clip = false);\n\n\n\n/**\n\n * @ Transform all entries in a matrix from float16 to fp32: reference\n\n * implementation.\n\n *\n\n */\n\nFBGEMM_API void Float16ToFloat_ref(const float16* src, float* dst, size_t size);\n\n\n\n/**\n\n * @ Transform all entries in a matrix from fp32 to float16: simd\n\n * implementation.\n\n *\n\n * @param do_clip if true we saturate to fp16 min and max instead of generating\n\n * infinities.\n\n */\n\nFBGEMM_API void FloatToFloat16_simd(\n\n const float* src,\n\n float16* dst,\n\n size_t size,\n\n bool do_clip = false);\n\n\n\n/**\n\n * @ Transform all entries in a matrix from float16 to fp32: simd\n\n * implementation.\n\n *\n\n */\n\nFBGEMM_API void\n\nFloat16ToFloat_simd(const float16* src, float* dst, size_t size);\n\n\n\n/**\n\n * @brief AVX2 implementation to convert fp32 numbers to fp16 numbers.\n\n *\n\n */\n\nFBGEMM_API void FloatToFloat16_avx2(\n\n const float* src,\n\n float16* dst,\n\n size_t size,\n\n bool do_clip = false);\n\n\n\n/**\n\n * @brief AVX512 implementation to convert fp32 numbers to fp16 numbers.\n\n *\n\n */\n\nFBGEMM_API void FloatToFloat16_avx512(\n\n const float* src,\n\n float16* dst,\n\n size_t size,\n\n bool do_clip = false);\n\n\n\n/**\n\n * @brief AVX2 implementation to convert fp16 numbers to fp32 numbers.\n\n *\n\n */\n\nFBGEMM_API void\n\nFloat16ToFloat_avx2(const float16* src, float* dst, size_t size);\n\n\n\n/**\n\n * @brief AVX512 implementation to convert fp16 numbers to fp32 numbers.\n\n *\n\n */\n\nFBGEMM_API void\n\nFloat16ToFloat_avx512(const float16* src, float* dst, size_t size);\n\n\n\n/**\n\n * @brief Transform all entries in a matrix from fp32 to float16 and back to\n\n * fp32.\n\n */\n\nFBGEMM_API void RoundToFloat16(\n\n const float* input,\n\n float* output,\n\n size_t size,\n\n bool clamp = false,\n\n bool clamp_denorms = false);\n\n\n", "file_path": "include/fbgemm/FbgemmConvert.h", "rank": 0, "score": 150046.9961093691 }, { "content": "namespace fbgemm {\n\n\n\nFBGEMM_API void cblas_gemm_i64_i64acc(\n\n matrix_op_t transa,\n\n matrix_op_t transb,\n\n int M,\n\n int N,\n\n int K,\n\n const std::int64_t* A,\n\n int lda,\n\n const std::int64_t* B,\n\n int ldb,\n\n bool accumulate,\n\n std::int64_t* C,\n\n int ldc);\n\n\n", "file_path": "include/fbgemm/FbgemmI64.h", "rank": 1, "score": 150046.9961093691 }, { "content": "namespace fbgemm {\n\n\n\ntemplate <typename T>\n\nstruct FBGEMM_API CSRMatrix {\n\n std::vector<int> rowPtr;\n\n std::vector<int> colIdx;\n\n std::vector<T> values;\n\n};\n\n\n\n/**\n\n * Tiled block CSR format\n\n * Partial blocks are zero-filled\n\n *\n\n */\n\ntemplate <typename T = std::int8_t, int ROW_BLOCK = 1, int COL_BLOCK = 4>\n\nstruct FBGEMM_API BCSRMatrix {\n\n using DTYPE = T;\n\n static constexpr int RB = ROW_BLOCK; // Block size for rows\n\n static constexpr int CB = COL_BLOCK; // Block size for cols\n\n // We only tile in column dimension currently\n\n // COLTILE must be a multiple of COL_BLOCK\n\n static constexpr int COLTILE = 4000;\n\n std::vector<int> rowBPtr; // rowPtr for blocks\n\n std::vector<int> colBIdx; // colIdx for blocks\n\n std::vector<DTYPE> values;\n\n // Sum of all elements in a row\n\n std::vector<int32_t> row_offsets;\n\n int R;\n\n int C;\n\n\n\n BCSRMatrix(int Rows, int Cols) {\n\n R = Rows;\n\n C = Cols;\n\n row_offsets.resize(R, 0);\n\n }\n\n\n\n /**\n\n * @brief pack from dense to tiled block CSR format\n\n * @param R number of rows in the matrix\n\n * @param C number of columns in the matrix\n\n * @param src is the source matrix with data type DTYPE\n\n * @param ld is the leading dimension\n\n */\n\n void pack(const DTYPE* src, size_t ld);\n\n\n\n /**\n\n * @brief pack from dense to tiled block CSR format\n\n * @param R number of rows in the matrix\n\n * @param C number of columns in the matrix\n\n * @param src is the source matrix with data type DTYPE\n\n *\n\n * leading dim of the matrix is assumed to be equal to C\n\n */\n\n void pack(const DTYPE* src);\n\n\n\n /**\n\n * @brief unpack from tiled block CSR to dense\n\n * @param dst should be able to hold R*C elements of type DTYPE\n\n * @param ld is the leading dimension\n\n */\n\n void unpack(DTYPE* dst, size_t ld);\n\n\n\n /*\n\n * @brief unpack from tiled block CSR to dense\n\n * @param dst should be able to hold R*C elements of type DTYPE\n\n *\n\n * leading dimension of the matrix is assumed to be equal to C\n\n */\n\n void unpack(DTYPE* dst);\n", "file_path": "include/fbgemm/FbgemmSparse.h", "rank": 2, "score": 150046.9961093691 }, { "content": "namespace fbgemm {\n\n\n\ntemplate <>\n\nstruct TypeConverter<float16> {\n\n float16 operator()(float src) const {\n\n constexpr float FP16_MAX = 65504.f;\n\n const float fp16 = std::max(-FP16_MAX, std::min(src, FP16_MAX));\n\n return cpu_float2half_rn(fp16);\n\n }\n\n};\n\n\n\nusing PackedGemmMatrixFP16 = PackedGemmMatrixB<float16>;\n\n\n\ntemplate <typename T>\n\nFBGEMM_API void cblas_gemm_compute(\n\n const matrix_op_t transa,\n\n const int m,\n\n const float* A,\n\n const PackedGemmMatrixB<T>& Bp,\n\n const float beta,\n\n float* C,\n\n int thread_id = 0,\n\n int num_threads = 1);\n\n\n\nextern template void cblas_gemm_compute<float16>(\n\n const matrix_op_t transa,\n\n const int m,\n\n const float* A,\n\n const PackedGemmMatrixFP16& Bp,\n\n const float beta,\n\n float* C,\n\n int thread_id,\n\n int num_threads);\n\n\n", "file_path": "include/fbgemm/FbgemmFP16.h", "rank": 3, "score": 150046.9961093691 }, { "content": "namespace fbgemm {\n\n\n\nusing float16 = std::uint16_t;\n\n\n\n// Round to nearest even\n\nstatic inline float16 cpu_float2half_rn(float f) {\n\n float16 ret;\n\n\n\n static_assert(\n\n sizeof(unsigned int) == sizeof(float),\n\n \"Programming error sizeof(unsigned int) != sizeof(float)\");\n\n\n\n unsigned* xp = reinterpret_cast<unsigned int*>(&f);\n\n unsigned x = *xp;\n\n unsigned u = (x & 0x7fffffff), remainder, shift, lsb, lsb_s1, lsb_m1;\n\n unsigned sign, exponent, mantissa;\n\n\n\n // Get rid of +NaN/-NaN case first.\n\n if (u > 0x7f800000) {\n\n ret = 0x7fffU;\n\n return ret;\n\n }\n\n\n\n sign = ((x >> 16) & 0x8000);\n\n\n\n // Get rid of +Inf/-Inf, +0/-0.\n\n if (u > 0x477fefff) {\n\n ret = static_cast<float16>(sign | 0x7c00U);\n\n return ret;\n\n }\n\n if (u < 0x33000001) {\n\n ret = static_cast<float16>(sign | 0x0000);\n\n return ret;\n\n }\n\n\n\n exponent = ((u >> 23) & 0xff);\n\n mantissa = (u & 0x7fffff);\n\n\n\n if (exponent > 0x70) {\n\n shift = 13;\n\n exponent -= 0x70;\n\n } else {\n\n shift = 0x7e - exponent;\n\n exponent = 0;\n\n mantissa |= 0x800000;\n\n }\n\n lsb = (1 << shift);\n\n lsb_s1 = (lsb >> 1);\n\n lsb_m1 = (lsb - 1);\n\n\n\n // Round to nearest even.\n\n remainder = (mantissa & lsb_m1);\n\n mantissa >>= shift;\n\n if (remainder > lsb_s1 || (remainder == lsb_s1 && (mantissa & 0x1))) {\n\n ++mantissa;\n\n if (!(mantissa & 0x3ff)) {\n\n ++exponent;\n\n mantissa = 0;\n\n }\n\n }\n\n\n\n ret = static_cast<float16>(sign | (exponent << 10) | mantissa);\n\n\n\n return ret;\n\n}\n\n\n\n// Round to zero\n\nstatic inline float16 cpu_float2half_rz(float f) {\n\n float16 ret;\n\n\n\n static_assert(\n\n sizeof(unsigned int) == sizeof(float),\n\n \"Programming error sizeof(unsigned int) != sizeof(float)\");\n\n\n\n unsigned* xp = reinterpret_cast<unsigned int*>(&f);\n\n unsigned x = *xp;\n\n unsigned u = (x & 0x7fffffff);\n\n unsigned shift, sign, exponent, mantissa;\n\n\n\n // Get rid of +NaN/-NaN case first.\n\n if (u > 0x7f800000) {\n\n ret = static_cast<float16>(0x7fffU);\n\n return ret;\n\n }\n\n\n\n sign = ((x >> 16) & 0x8000);\n\n\n\n // Get rid of +Inf/-Inf, +0/-0.\n\n if (u > 0x477fefff) {\n\n ret = static_cast<float16>(sign | 0x7c00U);\n\n return ret;\n\n }\n\n if (u < 0x33000001) {\n\n ret = static_cast<float16>(sign | 0x0000);\n\n return ret;\n\n }\n\n\n\n exponent = ((u >> 23) & 0xff);\n\n mantissa = (u & 0x7fffff);\n\n\n\n if (exponent > 0x70) {\n\n shift = 13;\n\n exponent -= 0x70;\n\n } else {\n\n shift = 0x7e - exponent;\n\n exponent = 0;\n\n mantissa |= 0x800000;\n\n }\n\n\n\n // Round to zero.\n\n mantissa >>= shift;\n\n\n\n ret = static_cast<float16>(sign | (exponent << 10) | mantissa);\n\n\n\n return ret;\n\n}\n\n\n\nstatic inline float cpu_half2float(float16 h) {\n\n unsigned sign = ((h >> 15) & 1);\n\n unsigned exponent = ((h >> 10) & 0x1f);\n\n unsigned mantissa = ((h & 0x3ff) << 13);\n\n\n\n if (exponent == 0x1f) { /* NaN or Inf */\n\n mantissa = (mantissa ? (sign = 0, 0x7fffff) : 0);\n\n exponent = 0xff;\n\n } else if (!exponent) { /* Denorm or Zero */\n\n if (mantissa) {\n\n unsigned int msb;\n\n exponent = 0x71;\n\n do {\n\n msb = (mantissa & 0x400000);\n\n mantissa <<= 1; /* normalize */\n\n --exponent;\n\n } while (!msb);\n\n mantissa &= 0x7fffff; /* 1.mantissa is implicit */\n\n }\n\n } else {\n\n exponent += 0x70;\n\n }\n\n\n\n unsigned i = ((sign << 31) | (exponent << 23) | mantissa);\n\n float ret;\n\n memcpy(&ret, &i, sizeof(i));\n\n return ret;\n\n}\n\n\n", "file_path": "include/fbgemm/Types.h", "rank": 4, "score": 149018.82264510248 }, { "content": "namespace fbgemm {\n\n\n\nusing partition_array_t = std::array<std::array<std::array<int, 2>, 2>, 121>;\n\nextern partition_array_t partition_avx2;\n\nextern partition_array_t partition_avx512;\n\n\n\ntemplate <typename T>\n\nstruct GemmParams {\n\n uint64_t k;\n\n float* A;\n\n const T* B;\n\n float beta;\n\n float* C;\n\n uint64_t ldc;\n\n uint64_t b_block_cols;\n\n uint64_t b_block_size;\n\n};\n\n\n\ntemplate <typename T>\n\nusing funcptr_t = void (*)(GemmParams<T>*);\n\ntemplate <typename T>\n\nusing kernel_array_t = std::array<funcptr_t<T>, 15>;\n\ntemplate <typename T>\n\nusing isa_descriptor = std::tuple<kernel_array_t<T>, partition_array_t>;\n\n\n\ntemplate <typename T>\n\nextern const isa_descriptor<T>& getIsaHandlers(inst_set_t isa, T);\n\n\n\nvoid PackA(int nrow, int ncol, const float* from, int ldim, float* to);\n\n\n\n// define this to debug fp16 kernel using a reference C implementation\n\n// #define FBGEMM_FP16_FALLBACK_TO_REF_KERNEL\n\n#ifdef FBGEMM_FP16_FALLBACK_TO_REF_KERNEL\n\ntemplate <typename T>\n\nFBGEMM_API void ref_kernel(\n\n int kernel_nrows,\n\n GemmParams<T>* gp,\n\n const float* C_base,\n\n int m_total,\n\n int n_total,\n\n int vlen);\n\n#endif\n\n\n\ntemplate <typename T>\n\nFBGEMM_API void cblas_gemm_compute(\n\n const matrix_op_t transa,\n\n const int m,\n\n const float* A,\n\n const PackedGemmMatrixB<T>& Bp,\n\n const float beta,\n\n float* C,\n\n int thread_id = 0,\n\n int num_threads = 1);\n\n\n\n// autotuned kernel splits for various cases m = 1:mb_max\n\ntemplate <typename T>\n\nvoid cblas_gemm_compute(\n\n const matrix_op_t transa,\n\n const int m,\n\n const float* A,\n\n const PackedGemmMatrixB<T>& Bp,\n\n const float beta,\n\n float* C,\n\n int thread_id,\n\n int num_threads) {\n\n // ground truth\n\n assert(cpuinfo_initialize());\n\n assert(cpuinfo_has_x86_fma3());\n\n assert(cpuinfo_has_x86_f16c());\n\n assert(transa == matrix_op_t::NoTranspose);\n\n (void)transa; // Suppress unused variable warning\n\n\n\n const auto iset = fbgemmInstructionSet();\n\n // private scratchpad storage\n\n static thread_local std::unique_ptr<std::array<float, 256 * 1024>> scratchpad(\n\n new std::array<float, 256 * 1024>());\n\n\n\n const auto& isaHandlers = getIsaHandlers<T>(iset, T());\n\n\n\n const auto& kernels = std::get<0>(isaHandlers);\n\n const auto& partition = std::get<1>(isaHandlers);\n\n\n\n // constants\n\n const int n = Bp.numCols(), k = Bp.numRows(), ldc = n;\n\n const int mb_max = 120;\n\n#ifdef FBGEMM_FP16_FALLBACK_TO_REF_KERNEL\n\n const int kernel_ncol_blocks = Bp.kernelNumColBlocks();\n\n // By some reason, if packed B is using packing layout for avx2, we just use\n\n // avx2 even if avx512 is available.\n\n const int simd_width =\n\n (iset == inst_set_t::avx512 || iset == inst_set_t::avx512_vnni) &&\n\n (Bp.blockColSize() == 16 * kernel_ncol_blocks)\n\n ? simd_info<inst_set_t::avx512>::WIDTH_32BIT_ELEMS\n\n : simd_info<inst_set_t::avx2>::WIDTH_32BIT_ELEMS;\n\n#endif\n\n GemmParams<T> gp;\n\n int i_begin, i_end;\n\n i_begin = 0;\n\n i_end = m;\n\n for (auto m0 = i_begin; m0 < i_end; m0 += mb_max) {\n\n int mb = std::min(mb_max, i_end - m0);\n\n assert(mb < static_cast<int64_t>(partition.size()));\n\n for (auto k_ind = 0; k_ind < k; k_ind += Bp.blockRowSize()) {\n\n // set up proper accumulation to avoid \"Nan\" problem\n\n float beta_;\n\n if (k_ind == 0) {\n\n // accumulate of beta != 0.0\n\n // do not!!! accumulate otherwise\n\n beta_ = beta;\n\n } else {\n\n // always accumulate with beta_ = 1.0f\n\n beta_ = 1.0f;\n\n }\n\n\n\n const int kb = std::min(Bp.blockRowSize(), Bp.numRows() - k_ind);\n\n\n\n auto m1 = m0;\n\n auto const num_cycles = partition[mb].size();\n\n for (size_t c = 0; c < num_cycles; ++c) {\n\n auto kernel_nrows = partition[mb][c][0];\n\n auto nkernel_nrows = partition[mb][c][1];\n\n auto m_start = m1;\n\n auto m_end = m1 + kernel_nrows * nkernel_nrows;\n\n for (auto m2 = m_start; m2 < m_end; m2 += kernel_nrows) {\n\n assert(kernel_nrows * kb < static_cast<int64_t>(scratchpad->size()));\n\n if (m != 1) {\n\n PackA(kernel_nrows, kb, &A[m2 * k + k_ind], k, scratchpad->data());\n\n gp.A = scratchpad->data();\n\n } else {\n\n // When m == 1, it is actually vector matrix multiplication. We\n\n // don't need to do the transposition for packA here. Instead, we\n\n // can just pass the pointer of the original A matrix buffer to the\n\n // packed A buffer.\n\n gp.A = const_cast<float*>(&A[k_ind]);\n\n }\n\n\n\n int nbcol = n / Bp.blockColSize();\n\n gp.k = kb;\n\n gp.B = &(Bp(k_ind, 0));\n\n gp.beta = beta_;\n\n gp.C = &C[m2 * ldc];\n\n gp.ldc = ldc * sizeof(C[0]);\n\n gp.b_block_cols = nbcol;\n\n gp.b_block_size = gp.k * Bp.blockColSize() * sizeof(gp.B[0]);\n\n\n\n if ((n % Bp.blockColSize()) == 0) {\n\n int jb_begin, jb_end;\n\n fbgemmPartition1D(\n\n thread_id, num_threads, gp.b_block_cols, jb_begin, jb_end);\n\n gp.B += gp.k * Bp.blockColSize() * jb_begin;\n\n gp.C += Bp.blockColSize() * jb_begin;\n\n gp.b_block_cols = jb_end - jb_begin;\n\n if (gp.b_block_cols) {\n\n#ifdef FBGEMM_FP16_FALLBACK_TO_REF_KERNEL\n\n ref_kernel<T>(kernel_nrows, &gp, C, m, n, simd_width);\n\n#else\n\n kernels[kernel_nrows](&gp);\n\n#endif\n\n }\n\n } else {\n\n int last_blk_col = nbcol * Bp.blockColSize();\n\n if (nbcol) {\n\n int jb_begin, jb_end;\n\n fbgemmPartition1D(\n\n thread_id, num_threads, gp.b_block_cols, jb_begin, jb_end);\n\n gp.B += gp.k * Bp.blockColSize() * jb_begin;\n\n gp.C += Bp.blockColSize() * jb_begin;\n\n gp.b_block_cols = jb_end - jb_begin;\n\n if (gp.b_block_cols) {\n\n#ifdef FBGEMM_FP16_FALLBACK_TO_REF_KERNEL\n\n ref_kernel(kernel_nrows, &gp, C, m, n, simd_width);\n\n#else\n\n kernels[kernel_nrows](&gp);\n\n#endif\n\n }\n\n }\n\n\n\n // use one thread to handle the fringe cases\n\n if (thread_id == num_threads - 1) {\n\n // leftover\n\n const int rem = n - last_blk_col;\n\n (void)rem; // Suppress unused variable warning\n\n assert(rem < Bp.blockColSize());\n\n\n\n // small temporary buffer: the size should be larger than the\n\n // required kernel_nrow x kernel_ncols elements computed in the\n\n // registers.\n\n std::array<float, 14 * 32> c_tmp{0.f};\n\n assert(\n\n static_cast<int64_t>(c_tmp.size()) >=\n\n kernel_nrows * Bp.blockColSize());\n\n\n\n gp.B = &(Bp(k_ind, last_blk_col));\n\n gp.C = c_tmp.data();\n\n gp.ldc = Bp.blockColSize() * sizeof(C[0]);\n\n gp.b_block_cols = 1;\n\n#ifdef FBGEMM_FP16_FALLBACK_TO_REF_KERNEL\n\n ref_kernel<T>(\n\n kernel_nrows, &gp, c_tmp.data(), 14, 32, simd_width);\n\n#else\n\n kernels[kernel_nrows](&gp);\n\n#endif\n\n for (int i = 0; i < kernel_nrows; i++) {\n\n // Todo: use assembly\n\n for (int j = last_blk_col; j < n; j++) {\n\n assert(\n\n i * Bp.blockColSize() + (j - last_blk_col) <\n\n static_cast<int64_t>(sizeof(c_tmp) / sizeof(c_tmp[0])));\n\n if (beta_ == 0.f) {\n\n C[(m2 + i) * ldc + j] =\n\n c_tmp[i * Bp.blockColSize() + (j - last_blk_col)];\n\n } else {\n\n C[(m2 + i) * ldc + j] = beta_ * C[(m2 + i) * ldc + j] +\n\n c_tmp[i * Bp.blockColSize() + (j - last_blk_col)];\n\n }\n\n }\n\n }\n\n }\n\n }\n\n }\n\n m1 += kernel_nrows * nkernel_nrows;\n\n }\n\n }\n\n }\n\n}\n\n\n", "file_path": "include/fbgemm/FbgemmFPCommon.h", "rank": 5, "score": 148160.66474565736 }, { "content": "namespace fbgemm {\n\n\n\nenum class FBGEMM_ENUM_CLASS_API QuantizationGranularity {\n\n TENSOR,\n\n GROUP,\n\n OUT_CHANNEL,\n\n};\n\n\n\n/**\n\n * @brief A struct to represent a block of a matrix.\n\n */\n\nstruct FBGEMM_API block_type_t {\n\n int row_start;\n\n int row_size;\n\n int col_start;\n\n int col_size;\n\n\n\n std::string toString() const {\n\n std::string out = \"\";\n\n out += \"row start:\" + std::to_string(row_start) + \", \";\n\n out += \"row size:\" + std::to_string(row_size) + \", \";\n\n out += \"col start:\" + std::to_string(col_start) + \", \";\n\n out += \"col size:\" + std::to_string(col_size);\n\n return out;\n\n }\n\n};\n\n\n\n/**\n\n * @brief A struct to represent all the requantization parameters.\n\n *\n\n * Please note that this is different from RequantizationParams in\n\n * QuantUtilsAvx2.h as it combines all the parameters needed for various\n\n * quantization granularities\n\n */\n\ntemplate <typename BIAS_TYPE = std::int32_t>\n\nstruct requantizationParams_t {\n\n using BIAS_T = BIAS_TYPE;\n\n std::int32_t A_zero_point;\n\n const std::int32_t* B_zero_point;\n\n std::int32_t C_zero_point;\n\n const float* C_multiplier;\n\n const std::int32_t* row_offsets;\n\n const std::int32_t* col_offsets;\n\n const BIAS_T* bias;\n\n std::uint32_t ncols;\n\n int groups;\n\n const float* act_times_w_scale;\n\n};\n\n\n\n/**\n\n * @brief A struct to represent all the parameters for requantizing for floats.\n\n */\n\nstruct requantizationForFloatParams_t {\n\n std::int32_t A_zero_point;\n\n const std::int32_t* B_zero_point;\n\n float A_scale;\n\n const float* B_scale;\n\n const std::int32_t* row_offsets;\n\n const std::int32_t* col_offsets;\n\n const float* bias;\n\n std::uint32_t ncols;\n\n int groups;\n\n};\n\n\n\n/**\n\n * @brief Allocate size bytes of uninitialized storage whose alignment is\n\n * specified by align.\n\n */\n\nFBGEMM_API void*\n\nfbgemmAlignedAlloc(size_t align, size_t size, bool raiseException = false);\n\n\n\n/**\n\n * @brief Free memory allocated by fbgemmAlignedAlloc\n\n */\n\nFBGEMM_API void fbgemmAlignedFree(void* p);\n\n\n", "file_path": "include/fbgemm/UtilsAvx2.h", "rank": 6, "score": 146913.89234465914 }, { "content": "namespace fbgemm {\n\n\n\ntemplate <int N, int... Vals>\n\nconstexpr\n\n typename std::enable_if<N == sizeof...(Vals), std::array<int, N>>::type\n\n array_of_ones() {\n\n return std::array<int, N>{{Vals...}};\n\n}\n\n\n\ntemplate <int N, int... Vals>\n\nconstexpr\n\n typename std::enable_if<N != sizeof...(Vals), std::array<int, N>>::type\n\n array_of_ones() {\n\n return array_of_ones<N, Vals..., 1>();\n\n}\n\n\n\ntemplate <int N, int... Vals>\n\nconstexpr\n\n typename std::enable_if<N == sizeof...(Vals), std::array<int, N>>::type\n\n array_of_zeroes() {\n\n return std::array<int, N>{{Vals...}};\n\n}\n\n\n\ntemplate <int N, int... Vals>\n\nconstexpr\n\n typename std::enable_if<N != sizeof...(Vals), std::array<int, N>>::type\n\n array_of_zeroes() {\n\n return array_of_zeroes<N, Vals..., 0>();\n\n}\n\n\n\n/**\n\n * @brief A struct to conveniently store all convolution parameters.\n\n */\n\ntemplate <int SPATIAL_DIM = 2>\n\nstruct conv_param_t {\n\n int MB; ///< Mini Batch size\n\n int IC; ///< Number of Input Channels\n\n int OC; ///< Number of Output Channels\n\n std::array<int, SPATIAL_DIM> IN_DIM; ///< Input Image Dimension\n\n int G; ///< Number of Groups\n\n std::array<int, SPATIAL_DIM> K; ///< Filter (Kernel) dimensions\n\n std::array<int, SPATIAL_DIM> stride; //< Strides\n\n std::array<int, SPATIAL_DIM * 2>\n\n pad; //< Padding (first SPATIAL_DIM is for prev/top/left padding, second\n\n // SPATIAL_DIM is for next/bottom/right padding)\n\n std::array<int, SPATIAL_DIM> dilation; //< Kernel dilation\n\n\n\n // The following are derived parameters\n\n std::array<int, SPATIAL_DIM> OUT_DIM; //< Output Image Dimension\n\n std::array<int, SPATIAL_DIM> IN_DIMP; //< Input Image Dimension Padded\n\n\n\n // The following is for tranposed convolution\n\n std::array<int, SPATIAL_DIM>\n\n output_pad; //< Padding (next/bottom/right padding in output buffer)\n\n bool transposed;\n\n\n\n /**\n\n * @brief Constructor for initializing the convolution parameters.\n\n */\n\n conv_param_t(\n\n int mb,\n\n int ic,\n\n int oc,\n\n std::array<int, SPATIAL_DIM> in_dim,\n\n int g,\n\n std::array<int, SPATIAL_DIM> k,\n\n std::array<int, SPATIAL_DIM> strd,\n\n std::array<int, SPATIAL_DIM * 2> pd,\n\n std::array<int, SPATIAL_DIM> dilations = array_of_ones<SPATIAL_DIM>(),\n\n std::array<int, SPATIAL_DIM> otpt_pd = array_of_zeroes<SPATIAL_DIM>(),\n\n bool transposed = false)\n\n : MB(mb),\n\n IC(ic),\n\n OC(oc),\n\n IN_DIM(in_dim),\n\n G(g),\n\n K(k),\n\n stride(strd),\n\n pad(pd),\n\n dilation(dilations),\n\n output_pad(otpt_pd),\n\n transposed(transposed) {\n\n if (ic % g != 0) {\n\n throw std::runtime_error(\n\n \"groups = \" + std::to_string(g) +\n\n \" does not divide number of input channels = \" + std::to_string(ic));\n", "file_path": "include/fbgemm/ConvUtils.h", "rank": 7, "score": 146913.89234465914 }, { "content": "namespace fbgemm {\n\n\n\nFBGEMM_API void sparseDenseMMRef(\n\n int M,\n\n int N,\n\n const int* row_ptr,\n\n const int* col_idx,\n\n const float* values,\n\n const float* B,\n\n int ldb,\n\n float* C,\n\n int ldc,\n\n bool accum = false);\n\n\n\ntemplate <bool FUSE_RELU, QuantizationGranularity Q_GRAN>\n\nFBGEMM_API void sparseDenseInt8MMRef(\n\n int N,\n\n const std::unique_ptr<BCSRMatrix<>>& bcsr,\n\n const uint8_t* B,\n\n int ldb,\n\n int32_t* C_i32,\n\n uint8_t* C_u8,\n\n int ldc,\n\n trRequantizationParams_t& rParams,\n\n bool accum = false,\n\n int thread_id = 0,\n\n int num_threads = 1);\n\n\n\ntemplate <bool FUSE_RELU, QuantizationGranularity Q_GRAN>\n\nFBGEMM_API void trRequantizeRef(\n\n uint8_t* out,\n\n const int32_t* inp,\n\n const block_type_t& block,\n\n int ld_out,\n\n int ld_in,\n\n const trRequantizationParams_t& r);\n\n\n\n// Get matrix shapes of interest\n\nFBGEMM_API std::vector<std::vector<int>> getSparseMatrixShapes();\n\n\n", "file_path": "include/fbgemm/spmmUtils.h", "rank": 8, "score": 146913.89234465914 }, { "content": "namespace fbgemm {\n\n\n\nFBGEMM_API TensorQuantizationParams ChooseQuantizationParams(\n\n float min,\n\n float max,\n\n std::int32_t qmin,\n\n std::int32_t qmax,\n\n bool preserve_sparsity = false,\n\n bool force_scale_power_of_two = false);\n\n\n\nFBGEMM_API void ChooseRequantizationMultiplier(\n\n float real_multiplier,\n\n std::int32_t* quantized_multiplier,\n\n int* right_shift,\n\n int requantization_multiplier_precision = 32);\n\n\n\n////////////////////////////////////////////////////////////////////////////////\n\n// Utility functions\n\n\n\n// Clamp src in T1 to the desired precision and convert it to T2\n\n// TODO: T26263653 fix signed-integer-overflow undefined behavior\n\ntemplate <typename T1, typename T2 = std::uint8_t>\n\nNO_SANITIZE(\"signed-integer-overflow\")\n\nT2 clamp(T1 src, int precision, bool is_signed = false) {\n\n std::int32_t min = is_signed ? -(1LL << (precision - 1)) : 0;\n\n std::int32_t max =\n\n is_signed ? ((1LL << (precision - 1)) - 1) : (1LL << precision) - 1;\n\n\n\n // Make sure T1 and T2 can represent the precision\n\n assert(min >= std::numeric_limits<T1>::lowest());\n\n assert(min >= std::numeric_limits<T2>::lowest());\n\n assert(max <= std::numeric_limits<T1>::max());\n\n assert(max <= std::numeric_limits<T2>::max());\n\n\n\n return std::min<T1>(std::max<T1>(src, min), max);\n", "file_path": "include/fbgemm/QuantUtils.h", "rank": 9, "score": 146913.89234465914 }, { "content": "namespace fbgemm {\n\ntemplate <\n\n bool A_SYMMETRIC,\n\n bool B_SYMMETRIC,\n\n QuantizationGranularity Q_GRAN,\n\n bool HAS_BIAS,\n\n bool FUSE_RELU,\n\n int C_PER_G,\n\n typename BIAS_TYPE = std::int32_t>\n\nFBGEMM_API void requantizeOutputProcessingGConvAvx512(\n\n std::uint8_t* out,\n\n const std::int32_t* inp,\n\n const block_type_t& block,\n\n int ld_out,\n\n int ld_in,\n\n const requantizationParams_t<BIAS_TYPE>& r);\n", "file_path": "include/fbgemm/QuantUtilsAvx512.h", "rank": 10, "score": 144898.10917930905 }, { "content": "namespace fbgemm {\n\nstruct FBGEMM_API trRequantizationParams_t {\n\n std::int32_t act_zero_point; // activation zero point\n\n const std::int32_t* weight_zero_points; // weight zero point(s)\n\n std::int32_t C_zero_point;\n\n const float C_scale;\n\n const std::int32_t* weight_row_offsets;\n\n const std::int32_t* act_col_offsets;\n\n const float* bias;\n\n const float* act_times_w_scale;\n\n};\n\n\n\ntemplate <\n\n bool FUSE_RELU,\n\n bool ACT_SYMMETRIC, // whether activation matrix is symmetric\n\n bool WEIGHT_SYMMETRIC, // whether weight matrix is symmetric\n\n bool HAS_BIAS,\n\n QuantizationGranularity Q_GRAN>\n\nFBGEMM_API void trRequantizeOpt(\n\n uint8_t* out,\n\n const int32_t* inp,\n\n const block_type_t& block,\n\n int ld_out,\n\n int ld_in,\n\n const trRequantizationParams_t& rParams);\n", "file_path": "include/fbgemm/spmmUtilsAvx2.h", "rank": 11, "score": 144898.10917930905 }, { "content": "namespace fbgemm {\n\n\n\n// Structs from gemmlowp\n\n//\n\n// A structure to hold quantization parameters 'scale' and 'zero_point'.\n\n// The meaning of these values is as the constants in the quantization equation\n\n//\n\n// real_value = scale * (quantized_value - zero_point)\n\n//\n\n// In other words, 'zero_point' is the quantized value that corresponds\n\n// to the real value 0, and 'scale' is the difference of real values\n\n// corresponding to consecutive quantized values.\n\nstruct FBGEMM_API TensorQuantizationParams {\n\n float scale;\n\n std::int32_t zero_point;\n\n int precision;\n\n float Min() const;\n\n float Max() const;\n\n};\n\n\n\n// Parameters when we scale from int32 intermediate matrix multiplication\n\n// results to 8-bit integers\n\nstruct FBGEMM_API RequantizationParams {\n\n // For floating-point requantization\n\n float real_multiplier;\n\n\n\n // For fixed-point requantization\n\n std::int32_t multiplier;\n\n int right_shift;\n\n\n\n TensorQuantizationParams target_qparams;\n\n};\n\n\n\n////////////////////////////////////////////////////////////////////////////////\n\n// Utility functions\n\n\n\ntemplate <typename T = std::uint8_t, bool LEGACY = true>\n\nvoid QuantizeAvx2(\n\n const float* src,\n\n T* dst,\n\n int len,\n\n const TensorQuantizationParams& qparams);\n\n\n\ntemplate <typename T = std::uint8_t>\n\nvoid FusedQuantizeDequantizeAvx2(\n\n const float* src,\n\n float* dst,\n\n int len,\n\n const TensorQuantizationParams& qparams,\n\n float noise_ratio = 0.0f);\n\n\n\n/*\n\n * Random number generator in [0, 9]: https://www.jstatsoft.org/v08/i14/paper\n\n */\n\nuint32_t FBGEMM_API Xor128(void);\n\n\n\n/**\n\n * @brief Find the min and max value in a float matrix.\n\n */\n\nvoid FBGEMM_API FindMinMax(const float* m, float* min, float* max, int len);\n\n\n\nvoid RequantizeFixedPointAvx2(\n\n const std::int32_t* src,\n\n std::uint8_t* dst,\n\n int len,\n\n const RequantizationParams& params);\n\n\n\nvoid RequantizeAvx2(\n\n const std::int32_t* src,\n\n std::uint8_t* dst,\n\n int len,\n\n const RequantizationParams& params);\n\n\n\n/**\n\n * @brief Requantize with avx2 and bias is fused.\n\n */\n\ntemplate <\n\n bool A_SYMMETRIC,\n\n bool B_SYMMETRIC,\n\n QuantizationGranularity Q_GRAN,\n\n bool HAS_BIAS,\n\n bool FUSE_RELU,\n\n typename BIAS_TYPE = std::int32_t>\n\nFBGEMM_API void requantizeOutputProcessingAvx2(\n\n std::uint8_t* out,\n\n const std::int32_t* inp,\n\n const block_type_t& block,\n\n int ld_out,\n\n int ld_in,\n\n const requantizationParams_t<BIAS_TYPE>& r);\n\n\n\ntemplate <\n\n bool A_SYMMETRIC,\n\n bool B_SYMMETRIC,\n\n QuantizationGranularity Q_GRAN,\n\n bool HAS_BIAS,\n\n bool FUSE_RELU,\n\n int C_PER_G,\n\n typename BIAS_TYPE = std::int32_t>\n\nFBGEMM_API void requantizeOutputProcessingGConvAvx2(\n\n std::uint8_t* out,\n\n const std::int32_t* inp,\n\n const block_type_t& block,\n\n int ld_out,\n\n int ld_in,\n\n const requantizationParams_t<BIAS_TYPE>& r);\n\n\n\ntemplate <\n\n bool A_SYMMETRIC,\n\n bool B_SYMMETRIC,\n\n QuantizationGranularity Q_GRAN,\n\n bool HAS_BIAS,\n\n bool FUSE_RELU>\n\nFBGEMM_API void requantizeForFloatAvx2(\n\n float* out,\n\n const std::int32_t* inp,\n\n const block_type_t& block,\n\n int ld_out,\n\n int ld_in,\n\n const requantizationForFloatParams_t& r);\n\n\n\ntemplate <typename InputType, int BIT_RATE>\n\nvoid FloatOrHalfToFusedNBitRowwiseQuantizedSBHalfAvx2(\n\n const InputType* input,\n\n size_t input_rows,\n\n int input_columns,\n\n std::uint8_t* output);\n\n\n\ntemplate <typename InputType>\n\nvoid FloatOrHalfToFused8BitRowwiseQuantizedSBFloatAvx2(\n\n const InputType* input,\n\n size_t input_rows,\n\n int input_columns,\n\n std::uint8_t* output);\n\n\n\ntemplate <typename OutputType, int BIT_RATE>\n\nvoid FusedNBitRowwiseQuantizedSBHalfToFloatOrHalfAvx2(\n\n const std::uint8_t* input,\n\n size_t input_rows,\n\n int input_columns,\n\n OutputType* output);\n\n\n\ntemplate <typename OutputType>\n\nvoid Fused8BitRowwiseQuantizedSBFloatToFloatOrHalfAvx2(\n\n const std::uint8_t* input,\n\n size_t input_rows,\n\n int input_columns,\n\n OutputType* output);\n\n\n", "file_path": "include/fbgemm/QuantUtilsAvx2.h", "rank": 12, "score": 144898.10917930905 }, { "content": "enum class inst_set_t {\n\n anyarch,\n\n avx2,\n\n avx512,\n\n avx512_ymm,\n\n avx512_vnni,\n\n avx512_vnni_ymm\n\n};\n\n\n\n/**\n\n * @brief Typed enum for optimized paths for convolutions\n\n */\n", "file_path": "include/fbgemm/Utils.h", "rank": 13, "score": 122393.72023788474 }, { "content": " */\n\ntemplate <int SPATIAL_DIM>\n\nFBGEMM_API bool takePointWiseFastPath(const conv_param_t<SPATIAL_DIM>& conv_p);\n\n\n\n/**\n\n * @brief Are we running on a fbgemm supported cpu?\n\n */\n\nFBGEMM_API bool fbgemmSupportedCPU();\n\n\n\n/**\n\n * @brief Performs convolution using fastest path available.\n\n *\n\n * @tparam SPATIAL_DIM It's 2 for 2D convolutions and 3 for 3D convolutions.\n\n */\n\ntemplate <\n\n typename processOutputType,\n\n int SPATIAL_DIM = 2,\n\n typename ACC_T = std::int32_t>\n\nFBGEMM_API int fbgemmConv(\n\n const conv_param_t<SPATIAL_DIM>& conv_p,\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 14, "score": 116455.00356221295 }, { "content": "\n\nnamespace fbgemm {\n\n\n\n/**\n\n * @brief Templatized struct for packing parameters for A and B matrices.\n\n *\n\n * @tparam T input type\n\n * @tparam accT the type used for accumulation\n\n * @tparam instSet anyarch/avx2/avx512\n\n * @tparam int8Type an auxiliary template parameter to specialize for 8-bit\n\n * input types.\n\n */\n\ntemplate <\n\n typename T,\n\n typename accT,\n\n inst_set_t instSet,\n\n typename int8Type = void>\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 15, "score": 116452.13717547196 }, { "content": " */\n\ntemplate <int SPATIAL_DIM = 2>\n\nFBGEMM_API int rowOffsetBufferSizeGConv(\n\n const conv_param_t<SPATIAL_DIM>& conv_param);\n\n\n\n/**\n\n * @brief Is this depthwise convolution optimized?\n\n */\n\ntemplate <int SPATIAL_DIM = 2, typename ACC_T = std::int32_t>\n\nbool takeDepthWiseFastPath(const conv_param_t<SPATIAL_DIM>& conv_p);\n\n\n\n/**\n\n * @brief Is this groupwise convolution supported?\n\n */\n\ntemplate <int SPATIAL_DIM>\n\nFBGEMM_API bool fbgemmOptimizedGConv(const conv_param_t<SPATIAL_DIM>& conv_p);\n\n\n\n/**\n\n * @brief Is this convolution a direct matrix-matrix multiplication, i.e., 1x1\n\n * (aka pointwise) with right paddings etc.?\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 16, "score": 116450.68131121346 }, { "content": " /**\n\n * @return true if this is the first input matrix in GEMM (i.e., A in C = A *\n\n * B)\n\n */\n\n static constexpr bool isA() {\n\n return PT::isA();\n\n }\n\n\n\n /**\n\n * @brief The size of the buffer used for packing (The size is in number of\n\n * elements).\n\n *\n\n * rows and cols are only used for fully packing, i.e., for B matrix. The\n\n * client code can use this function to query how big the buffer used for\n\n * packing should be.\n\n */\n\n static int packedBufferSize(\n\n int rows = 0,\n\n int cols = 0,\n\n const BlockingFactors* params = nullptr);\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 17, "score": 116450.59718093296 }, { "content": " */\n\n static int rowOffsetBufferSize(const BlockingFactors* params = nullptr);\n\n\n\n ~PackAWithIm2Col() {\n\n if (rowOffsetAllocatedHere) {\n\n fbgemmAlignedFree(row_offset_);\n\n }\n\n }\n\n\n\n private:\n\n const conv_param_t<SPATIAL_DIM> conv_p_;\n\n const T* sdata_;\n\n std::int32_t a_zero_pt_;\n\n std::int32_t* row_offset_{nullptr};\n\n bool rowOffsetAllocatedHere{false};\n\n std::int32_t row_interleave_B_;\n\n};\n\n\n\n/**\n\n * @brief Matrix packed for the first input matrix in GEMM (usually activation),\n\n * and row offsets used for requantization is computed during packing.\n\n * The source matrix is already quantized.\n\n */\n\ntemplate <typename T, typename accT = std::int32_t>\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 18, "score": 116450.52697158039 }, { "content": "#include \"./FbgemmI8Spmdm.h\"\n\n#include \"./QuantUtilsAvx2.h\"\n\n#include \"./Types.h\"\n\n#include \"./Utils.h\"\n\n\n\n// Turning on this option will print out time breakdown of each stage (e.g.,\n\n// input packing, the main GEMM kernel, each output processing pipeline).\n\n// Please note that currently this option won't report accurate timing if\n\n// multiple threads are used.\n\n// #define FBGEMM_MEASURE_TIME_BREAKDOWN\n\n\n\n#ifdef FBGEMM_MEASURE_TIME_BREAKDOWN\n\n#include <chrono>\n\n#include <iostream>\n\nextern double packing_time;\n\nextern double computing_time;\n\nextern double kernel_time;\n\nextern double postprocessing_time;\n\nextern double run_time;\n\n#endif\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 19, "score": 116448.38841251556 }, { "content": " std::uint32_t ld,\n\n inpType* pmat = nullptr,\n\n int groups = 1,\n\n std::int32_t* row_offset = nullptr,\n\n const BlockingFactors* params = nullptr);\n\n\n\n /**\n\n * Activation matrices are not constant so cannot amortize the cost of\n\n * pre-packing.\n\n */\n\n bool isPrePacked() const {\n\n return false;\n\n }\n\n\n\n /**\n\n * @return True if this is used as A matrix.\n\n */\n\n static constexpr bool isA() {\n\n return true;\n\n }\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 20, "score": 116447.94926440214 }, { "content": " std::int32_t ld,\n\n inpType* pmat = nullptr,\n\n float scale = 1.0f,\n\n std::int32_t zero_pt = 0,\n\n int groups = 1,\n\n std::int32_t* row_offset = nullptr,\n\n const BlockingFactors* params = nullptr);\n\n\n\n /**\n\n * Activation matrices are not constant so cannot amortize the cost of\n\n * pre-packing.\n\n */\n\n bool isPrePacked() const {\n\n return false;\n\n }\n\n\n\n /**\n\n * @return True if this is used as A matrix.\n\n */\n\n static constexpr bool isA() {\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 21, "score": 116447.40009594716 }, { "content": " typename outType,\n\n bool FUSE_RELU,\n\n QuantizationGranularity Q_GRAN,\n\n int SPATIAL_DIM = 2,\n\n typename BIAS_TYPE = std::int32_t>\n\nFBGEMM_API void fbgemmGroupwiseConv(\n\n const conv_param_t<SPATIAL_DIM>& conv_param,\n\n const std::uint8_t* activations,\n\n std::int32_t a_zero_point,\n\n std::int32_t* rowOffsetBuf,\n\n packed_W& packed_weights,\n\n outType* out,\n\n std::int32_t* outBuffer,\n\n const ReQuantizeOutput<FUSE_RELU, Q_GRAN, BIAS_TYPE>& outProcess,\n\n int thread_id,\n\n int num_threads);\n\n\n\n/**\n\n * @return Size of row offset buffer in number of elements needed for\n\n * fbgemmGroupwiseConv\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 22, "score": 116446.91436725586 }, { "content": " static constexpr bool isA() {\n\n return false;\n\n }\n\n\n\n /**\n\n * @brief When k loop is also tiled/blocked, this function is used to check if\n\n * have executed computations for the last k block so that we can perform\n\n * post-GEMM operations.\n\n */\n\n bool isThisLastKBlock(int block_id) const {\n\n return (BaseType::blockRows() - 1) == block_id;\n\n }\n\n\n\n /**\n\n * @return Offset of the element in the packed matrix that was at (i, j) in\n\n * the source matrix.\n\n */\n\n std::int32_t addr(std::int32_t i, std::int32_t j) const;\n\n\n\n /**\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 23, "score": 116446.78163057085 }, { "content": " const BIAS_T* bias_;\n\n std::uint32_t ncols_;\n\n int groups_;\n\n const float* act_times_w_scale_;\n\n};\n\n\n\n/**\n\n * @brief Requantize to convert accumulated data to be used as float, i.e., the\n\n * output would be used as float.\n\n */\n\ntemplate <\n\n bool FUSE_RELU,\n\n QuantizationGranularity Q_GRAN = QuantizationGranularity::TENSOR,\n\n typename outT = float,\n\n typename inT = std::int32_t,\n\n typename nextOPType = DoNothing<outT, outT>>\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 24, "score": 116446.7537159813 }, { "content": "\n\n ~PackWeightMatrixForGConv() {\n\n if (bufAllocatedHere_) {\n\n fbgemmAlignedFree(pdata_);\n\n }\n\n }\n\n\n\n private:\n\n matrix_op_t trans_;\n\n const conv_param_t<SPATIAL_DIM> conv_param_;\n\n const T* sdata_;\n\n T* pdata_;\n\n bool bufAllocatedHere_;\n\n // Number of groups we work at a time to fill the full simd width\n\n int GTogether_;\n\n\n\n /**\n\n * @brief Internal function performing both pack & unpack\n\n */\n\n void pack_unpack_(const T* src, T* dst, bool ispack);\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 25, "score": 116446.15634376033 }, { "content": " const std::uint8_t* activations,\n\n PackWeightsForConv<SPATIAL_DIM, std::int8_t, ACC_T>& packed_weights,\n\n typename processOutputType::outType* out,\n\n std::int32_t* outBuffer,\n\n processOutputType& outProcess,\n\n int thread_id,\n\n int num_threads,\n\n const BlockingFactors* blocking_params = nullptr);\n\n\n\n/**\n\n * @brief Returns which fast path to take\n\n *\n\n * @tparam SPATIAL_DIM It's 2 for 2D convolutions and 3 for 3D convolutions.\n\n *\n\n * @return optimized_conv_t::depthwise, optimized_conv_t::groupwise or\n\n * optimized_conv_t::im2col\n\n *\n\n */\n\ntemplate <int SPATIAL_DIM = 2, typename ACC_T = std::int32_t>\n\nFBGEMM_API optimized_conv_t\n\nConvFastPath(const conv_param_t<SPATIAL_DIM>& conv_p);\n\n} // namespace fbgemm\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 26, "score": 116445.83761378021 }, { "content": "\n\n /**\n\n * @brief Print the packed block.\n\n */\n\n void printPackedMatrix(std::string name);\n\n\n\n /**\n\n * @return Size of row offset buffer in number of elements\n\n */\n\n static int rowOffsetBufferSize(const BlockingFactors* params = nullptr);\n\n\n\n ~PackAWithQuantRowOffset() {\n\n if (rowOffsetAllocatedHere) {\n\n fbgemmAlignedFree(row_offset_);\n\n }\n\n }\n\n\n\n private:\n\n matrix_op_t trans_;\n\n const float* smat_;\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 27, "score": 116445.79692684607 }, { "content": " * @brief Print the packed block.\n\n */\n\n void printPackedMatrix(std::string name);\n\n\n\n /**\n\n * @return size of row offset buffer in number of elements\n\n */\n\n static int rowOffsetBufferSize(const BlockingFactors* params = nullptr);\n\n\n\n ~PackAWithRowOffset() {\n\n if (rowOffsetAllocatedHere) {\n\n fbgemmAlignedFree(row_offset_);\n\n }\n\n }\n\n\n\n private:\n\n matrix_op_t trans_;\n\n const T* smat_;\n\n std::uint32_t ld_;\n\n std::int32_t* row_offset_;\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 28, "score": 116445.17375339371 }, { "content": "\n\n /**\n\n * @return Pointer to a buffer containing row offset results. Some packing\n\n * objects fuse row offset computation for later requantization step.\n\n */\n\n std::int32_t* getRowOffsetBuffer() const {\n\n return static_cast<const PT*>(this)->getRowOffsetBuffer();\n\n }\n\n\n\n /**\n\n * @brief When k loop is also tiled/blocked, this function is used to check if\n\n * have executed computations for the last k block so that we can perform\n\n * post-GEMM operations.\n\n */\n\n bool isThisLastKBlock(int block_id) const {\n\n return static_cast<const PT*>(this)->isThisLastKBlock(block_id);\n\n }\n\n\n\n /**\n\n * @brief Actual packing of a block of the source matrix in pmat buffer.\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 29, "score": 116444.99189841656 }, { "content": " inpType* pmat = nullptr,\n\n std::int32_t a_zero_pt = 0,\n\n std::int32_t* row_offset = nullptr,\n\n bool b_symmetric = false,\n\n const BlockingFactors* params = nullptr);\n\n\n\n /**\n\n * Activation matrices are not constant so cannot amortize the cost of\n\n * pre-packing.\n\n */\n\n bool isPrePacked() const {\n\n return false;\n\n }\n\n\n\n /**\n\n * @return True if this is used as A matrix.\n\n */\n\n static constexpr bool isA() {\n\n return true;\n\n }\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 30, "score": 116443.90566957436 }, { "content": " /**\n\n * Activation matrices are not constant so cannot amortize the cost of\n\n * pre-packing.\n\n */\n\n bool isPrePacked() const {\n\n return false;\n\n }\n\n\n\n /**\n\n * @return True if this is used as A matrix.\n\n */\n\n static constexpr bool isA() {\n\n return true;\n\n }\n\n\n\n /**\n\n * @return A pointer to the row offset buffer. There is no row offset buffer\n\n * calculations with this packing class, hence, it returns nullptr.\n\n */\n\n std::int32_t* getRowOffsetBuffer() const {\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 31, "score": 116443.59460144429 }, { "content": " */\n\n void unpack(T* origin_buf);\n\n\n\n private:\n\n const conv_param_t<SPATIAL_DIM> conv_param_;\n\n // Packed weights if we use im2col based convolution implementation\n\n std::shared_ptr<PackBMatrix<T, accT>> W_im2col_packed_;\n\n // Packed weights if we use depthwise convolution implementation\n\n std::shared_ptr<PackedDepthWiseConvMatrix> W_dw_packed_;\n\n // Packed weights if we use groupwise (small channels per group) convolution\n\n // implementation\n\n std::shared_ptr<PackWeightMatrixForGConv<T, accT, SPATIAL_DIM>>\n\n W_gconv_packed_;\n\n // Packed weights if we use direct gemm for pointwise convolution\n\n std::shared_ptr<PackBMatrix<T, accT>> W_pointwise_packed_;\n\n};\n\n\n\n/**\n\n * @brief Matrix packed for the first input matrix in GEMM (usually activation),\n\n * and row offsets used for requantization is computed during packing.\n\n * Im2col is fused with packing here. The source matrix is already\n\n * quantized.\n\n */\n\ntemplate <typename T, typename accT = std::int32_t, int SPATIAL_DIM = 2>\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 32, "score": 116442.93792860996 }, { "content": " * to fill the avx2 width of 256 bits.\n\n */\n\n static int numOfGroupsTogether(const conv_param_t<SPATIAL_DIM>& conv_param);\n\n\n\n /**\n\n * @brief Packs a block of source matrix into pmat buffer.\n\n */\n\n void pack();\n\n\n\n /**\n\n * @brief Unpacks a pmat buffer into source matrix.\n\n */\n\n void unpack(T* origin_buf);\n\n\n\n /**\n\n * @brief Return packed data\n\n */\n\n inpType* getBuf() {\n\n return pdata_;\n\n }\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 33, "score": 116442.68369138133 }, { "content": " }\n\n\n\n int numGroups() const {\n\n return G_;\n\n }\n\n\n\n /**\n\n * @return True if the last column block has fewer columns than the block\n\n * size.\n\n */\n\n bool isThereColRemainder() const {\n\n return last_bcol_ != blockColSize();\n\n }\n\n\n\n virtual ~PackMatrix() {\n\n if (bufAllocatedHere_) {\n\n fbgemmAlignedFree(buf_);\n\n }\n\n }\n\n\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 34, "score": 116442.67273469524 }, { "content": "\n\n /**\n\n * @brief Get the index of the unpacked data\n\n */\n\n int unpacked_index_(int t, int r, int s, int k, int g, int c, bool tr);\n\n\n\n /**\n\n * @brief Get the index of the packed data\n\n */\n\n int packed_index_(int t, int r, int s, int k, int g, int c);\n\n};\n\n\n\n/**\n\n * @brief A container class to keep packed weight tensor for convolution.\n\n * The source tensor should already be quantized.\n\n *\n\n * @tparam SPATIAL_DIM is equal to 2 for 2D convolutions and 3 for 3D\n\n * convolutions. Default value is 2.\n\n * @tparam T is the datatype for source tensor. Default value is int8.\n\n * @tparam accT is the datatype to accumulate into. Default value is int32.\n\n */\n\ntemplate <\n\n int SPATIAL_DIM = 2,\n\n typename T = std::int8_t,\n\n typename accT = std::int32_t>\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 35, "score": 116442.56413038755 }, { "content": " bool equals(const PackBMatrix<T, accT>& that) const;\n\n\n\n /**\n\n * @brief Unpack pmat buffer to the origin_buf (Used for the serialization to\n\n * recover weight matrix).\n\n */\n\n void unpack(T* origin_buf, const BlockingFactors* params = nullptr);\n\n\n\n ~PackBMatrix() {}\n\n\n\n private:\n\n matrix_op_t trans_;\n\n const T* smat_;\n\n std::int32_t ld_;\n\n std::int32_t row_interleave_;\n\n\n\n /**\n\n * @brief Internal function performing both pack & unpack\n\n */\n\n void pack_unpack_(\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 36, "score": 116442.26410936793 }, { "content": " bool rowOffsetAllocatedHere;\n\n std::int32_t row_interleave_B_;\n\n};\n\n\n\n/**\n\n * @brief Matrix packed for the first input matrix in GEMM (usually activation),\n\n * and row offsets used for requantization is computed during packing.\n\n * The source matrix is in fp32 and quantized during packing.\n\n */\n\ntemplate <typename T, typename accT = std::int32_t>\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 37, "score": 116442.19625472845 }, { "content": "/*\n\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n\n * All rights reserved.\n\n * This source code is licensed under the BSD-style license found in the\n\n * LICENSE file in the root directory of this source tree.\n\n */\n\n#pragma once\n\n\n\n/**\n\n * Top level include file for FBGEMM.\n\n */\n\n#include <cassert>\n\n#include <cmath>\n\n#include <limits>\n\n#include <memory>\n\n#include <type_traits>\n\n#include \"./ConvUtils.h\"\n\n#include \"./FbgemmBuild.h\"\n\n#include \"./FbgemmEmbedding.h\"\n\n#include \"./FbgemmI8DepthwiseAvx2.h\"\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 38, "score": 116442.10474762572 }, { "content": " const block_type_t& block,\n\n T* unpack_buf,\n\n T* pack_buf,\n\n bool ispack,\n\n const BlockingFactors* params = nullptr);\n\n};\n\n\n\n/**\n\n * @brief Matrix packed for direct group convolution.\n\n * The source matrix is already quantized. Default accumulation\n\n * type is int32.\n\n */\n\ntemplate <typename T, typename accT = std::int32_t, int SPATIAL_DIM = 2>\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 39, "score": 116441.83298866049 }, { "content": " std::int32_t ld_;\n\n float scale_;\n\n std::int32_t zero_pt_;\n\n std::int32_t* row_offset_;\n\n bool rowOffsetAllocatedHere;\n\n std::int32_t row_interleave_B_;\n\n};\n\n\n\n/*\n\n *\n\n * Post Processing of outputs\n\n *\n\n */\n\n\n\n/**\n\n * @brief Does nothing. NoOp. Used as the last operation in the output\n\n * processing pipeline.\n\n *\n\n */\n\ntemplate <typename outT = std::uint8_t, typename inT = std::uint8_t>\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 40, "score": 116441.68000629598 }, { "content": " * @brief Packs a block of source matrix into pmat buffer. The blocking\n\n * parameters are needed to compute the buffer size of each group.\n\n * It will use default blocking parameters if params is not provided.\n\n */\n\n void pack(const block_type_t& block, const BlockingFactors* params = nullptr);\n\n\n\n /**\n\n * @brief Print the packed block.\n\n */\n\n void printPackedMatrix(\n\n std::string name,\n\n const BlockingFactors* params = nullptr);\n\n\n\n /**\n\n * @return true if meta information like matrix shape is the same.\n\n */\n\n bool metaEquals(const PackBMatrix<T, accT>& that) const;\n\n /**\n\n * @return true if matrices are the same.\n\n */\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 41, "score": 116441.59325659908 }, { "content": " PackBMatrix(\n\n matrix_op_t trans,\n\n std::int32_t nRow,\n\n std::int32_t nCol,\n\n const inpType* smat,\n\n std::int32_t ld,\n\n inpType* pmat = nullptr,\n\n int groups = 1,\n\n const BlockingFactors* params = nullptr);\n\n\n\n /**\n\n * Weight matrices are usually constant so worth pre-packing.\n\n */\n\n bool isPrePacked() const {\n\n return true;\n\n }\n\n\n\n /**\n\n * @return True if to be used as A matrix, False otherwise.\n\n */\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 42, "score": 116441.38440118798 }, { "content": " }\n\n\n\n int groups() {\n\n return conv_param_.G;\n\n }\n\n\n\n /**\n\n * @brief Returns true if the packed weights would work for the given\n\n * convolution parameters, and false otherwise\n\n */\n\n bool isPackingCompliant(const conv_param_t<SPATIAL_DIM>& conv_p);\n\n\n\n /**\n\n * @brief Returns a string of mismatching parameters\n\n */\n\n std::string mismatchingParams(const conv_param_t<SPATIAL_DIM>& conv_p);\n\n\n\n /**\n\n * @brief Unpack packed matric into origin_buf (Used for the serialization to\n\n * recover weight matrix).\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 43, "score": 116440.9938979026 }, { "content": " const block_type_t& block,\n\n int ld_out,\n\n int ld_in) const;\n\n\n\n private:\n\n nextOPType& nextop_;\n\n const std::uint8_t* A_;\n\n const conv_param_t<> conv_p_;\n\n const std::int32_t A_zero_point_;\n\n const CompressedSparseColumn& B_csc_;\n\n};\n\n\n\n/**\n\n * @brief Requantize values in inp buffer and write to out buffer.\n\n * pass the out buffer to next op for further processing.\n\n */\n\ntemplate <\n\n bool FUSE_RELU,\n\n QuantizationGranularity Q_GRAN = QuantizationGranularity::TENSOR,\n\n typename BIAS_TYPE = std::int32_t,\n\n typename outT = std::uint8_t,\n\n typename inT = std::int32_t,\n\n typename nextOPType = DoNothing<outT, outT>>\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 44, "score": 116440.99310347557 }, { "content": " * e.g., PackAWithQuantRowOffset\n\n *\n\n * @tparam packingBMatrix processing of B matrix while packing,\n\n * e.g., pre-multiply by alpha\n\n * @tparam cT data type of C matrix\n\n * @tparam processOutputType further processing of outputs, e.g., Relu\n\n */\n\ntemplate <\n\n typename packingAMatrix,\n\n typename packingBMatrix,\n\n typename cT,\n\n typename processOutputType>\n\nFBGEMM_API void fbgemmPacked(\n\n PackMatrix<\n\n packingAMatrix,\n\n typename packingAMatrix::inpType,\n\n typename packingAMatrix::accType>& packA,\n\n PackMatrix<\n\n packingBMatrix,\n\n typename packingBMatrix::inpType,\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 45, "score": 116440.92474825101 }, { "content": " typename packingBMatrix::accType>& packB,\n\n cT* C,\n\n std::int32_t* C_buffer,\n\n std::uint32_t ldc,\n\n const processOutputType& outProcess,\n\n int thread_id,\n\n int num_threads,\n\n const BlockingFactors* blocking_params = nullptr);\n\n\n\n/**\n\n * @brief Perform small-channels-per-group groupwise convolution\n\n * Note: Currently threading is not supported. This function does\n\n * nothing for thread_ids > 0, i.e., returns early.\n\n *\n\n * @param rowOffsetBuf nullptr if B uses symmetric quantization\n\n * Note: Currently threading is not supported. This function does\n\n * nothing for thread_ids > 0, i.e., returns early.\n\n */\n\ntemplate <\n\n typename packed_W,\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 46, "score": 116440.670738058 }, { "content": " * to follow deep learning terminology). The result matrix has\n\n * dimension A.rows by B.cols*B.groups .\n\n * A.groups must be same as B.groups, A.groups must divide\n\n * A.cols, and B.groups must divide B.rows and C.cols.\n\n */\n\n PackMatrix(\n\n std::int32_t rows,\n\n std::int32_t cols,\n\n inpType* pmat,\n\n int groups = 1,\n\n const BlockingFactors* params = nullptr);\n\n\n\n /**\n\n * @return true usually when the matrix is constant matrix (e.g., weight\n\n * matrices) that can be prepacked\n\n */\n\n bool isPrePacked() const {\n\n return static_cast<const PT*>(this)->isPrePacked();\n\n }\n\n\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 47, "score": 116440.12451000046 }, { "content": " std::int32_t nbrow_; ///< the number of blocks along rows\n\n std::int32_t nbcol_; ///< the number of blocks along columns\n\n bool bufAllocatedHere_;\n\n const BlockingFactors*\n\n blocking_params; ///< MCB, KCB, NCB, MR, NR, NR_MIN, ROW_INTERLEAVE;\n\n\n\n private:\n\n std::int32_t nrows_, ncols_;\n\n int G_;\n\n block_type_t packedBlock_; ///< The block in the source matrix just packed\n\n std::int32_t last_brow_, last_bcol_;\n\n};\n\n\n\n/**\n\n * @brief Matrix packed for the first input matrix in GEMM (usually\n\n * activation). The source matrix is already quantized. Default\n\n * accumulation type is int32.\n\n */\n\ntemplate <typename T, typename accT = std::int32_t>\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 48, "score": 116439.31607459203 }, { "content": " const std::int32_t* q_col_offsets_;\n\n const float* bias_;\n\n std::uint32_t ncols_;\n\n int groups_;\n\n};\n\n\n\n// type specialized implementation in an include file\n\n#include \"./OutputProcessing-inl.h\"\n\n\n\n/*\n\n *\n\n * ####### GEMM related functions #######\n\n *\n\n */\n\n\n\n/**\n\n * Matrix B must be prepacked. For matrix A, packA.pack function is called to\n\n * pack it.\n\n *\n\n * @tparam packingAMatrix processing of A matrix while packing,\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 49, "score": 116438.58389429149 }, { "content": " q_col_offsets_(col_offsets),\n\n bias_(bias),\n\n ncols_(nCol),\n\n groups_(groups) {}\n\n\n\n template <inst_set_t instSet>\n\n inline int f(\n\n outT* out,\n\n inT* inp,\n\n const block_type_t& block,\n\n int ld_out,\n\n int ld_in) const;\n\n\n\n private:\n\n nextOPType& nextop_;\n\n float Aq_scale_;\n\n const float* Bq_scale_;\n\n std::int32_t Aq_zero_point_;\n\n const std::int32_t* Bq_zero_point_;\n\n const std::int32_t* q_row_offsets_;\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 50, "score": 116438.42245967341 }, { "content": " */\n\n void pack(const block_type_t& block) {\n\n static_cast<PT*>(this)->pack(block);\n\n }\n\n\n\n std::int32_t numRows() const {\n\n return nrows_;\n\n }\n\n\n\n std::int32_t numCols() const {\n\n return ncols_;\n\n }\n\n\n\n /**\n\n * @return The number of rows in each block\n\n */\n\n std::int32_t blockRowSize() const {\n\n return brow_;\n\n }\n\n\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 51, "score": 116438.1187859098 }, { "content": " : nextop_(nextop),\n\n C_multiplier_(C_multiplier),\n\n C_zero_point_(C_zero_point),\n\n Aq_zero_point_(Aq_zero_point),\n\n Bq_zero_point_(Bq_zero_point),\n\n q_row_offsets_(row_offsets),\n\n q_col_offsets_(col_offsets),\n\n bias_(bias),\n\n ncols_(nCol),\n\n groups_(groups),\n\n act_times_w_scale_(act_times_w_scale) {}\n\n\n\n template <inst_set_t instSet>\n\n inline int f(\n\n outT* out,\n\n const inT* inp,\n\n const block_type_t& block,\n\n int ld_out,\n\n int ld_in) const;\n\n\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 52, "score": 116438.0233642556 }, { "content": "\n\n /**\n\n * @brief Print the packed block.\n\n */\n\n void printPackedMatrix(std::string name) {\n\n static_cast<PT*>(this)->printPackedMatrix(name);\n\n }\n\n\n\n /**\n\n * @return The number of rows in the last row block.\n\n */\n\n std::int32_t lastBrow() const {\n\n return last_brow_;\n\n }\n\n\n\n /**\n\n * @return The number of columns in the last column block.\n\n */\n\n std::int32_t lastBcol() const {\n\n return last_bcol_;\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 53, "score": 116437.43781162343 }, { "content": " * output buffer: row and column start points:\n\n * (block.row_start, block.col_start)\n\n *\n\n * This is the output processing stage that should passed when there is no\n\n * requantization and output is required in the same format as internal buffer\n\n * used for accumulation.\n\n */\n\ntemplate <\n\n typename outT = std::int32_t,\n\n typename inT = std::int32_t,\n\n typename nextOPType = DoNothing<outT, outT>>\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 54, "score": 116437.38078676505 }, { "content": " private:\n\n nextOPType& nextop_;\n\n const std::uint8_t* A_;\n\n const int lda_;\n\n const CompressedSparseColumn& B_csc_;\n\n const int groups_;\n\n};\n\n\n\n/**\n\n * @brief Perform Dense-Matrix * Sparse-Matrix as a part the of output\n\n * processing pipeline.\n\n *\n\n * SPMDM (SParse Matrix times Dense Matrix) inplace on the 32-bit input buffer\n\n * (inp). After modifying the input buffer, pass it to the next op.\n\n * When groups > 1, each group is numRows() x (numCols()/groups) matrix.\n\n */\n\ntemplate <\n\n typename outT = std::int32_t,\n\n typename inT = std::int32_t,\n\n typename nextOPType = DoNothing<inT, inT>>\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 55, "score": 116437.16377970303 }, { "content": " * col_offsets_with_zero_pt_s8acc32_ref.\n\n * The length should be nCol.\n\n * See PackedRequantizeTest.cc for an example.\n\n * TODO: if Aq_zero_point == 0, allow passing nullptr.\n\n * @param bias can be nullptr otherwise the length should be nCol\n\n * @param act_times_w_scale activation_scale * weight_scale. This is only\n\n * used if bias is unquantized (i.e., float).\n\n */\n\n ReQuantizeOutput(\n\n nextOPType& nextop,\n\n const float* C_multiplier,\n\n std::int32_t C_zero_point,\n\n std::int32_t Aq_zero_point,\n\n const std::int32_t* Bq_zero_point,\n\n const std::int32_t* row_offsets,\n\n const std::int32_t* col_offsets,\n\n const BIAS_T* bias,\n\n std::uint32_t nCol,\n\n int groups = 1,\n\n const float* act_times_w_scale = nullptr)\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 56, "score": 116435.17120286392 }, { "content": " return nullptr;\n\n }\n\n\n\n /**\n\n * @return Offset of the element in the packed matrix that was at (i, j) in\n\n * the source matrix.\n\n */\n\n std::int32_t addr(std::int32_t i, std::int32_t j) const;\n\n\n\n /**\n\n * @brief Packs a block of source matrix into pmat buffer.\n\n */\n\n void pack(const block_type_t& block);\n\n\n\n /**\n\n * @brief Print the packed block.\n\n */\n\n void printPackedMatrix(std::string name);\n\n\n\n private:\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 57, "score": 116434.17375784664 }, { "content": "\n\n /**\n\n * @brief Packs a block of source matrix into pmat buffer.\n\n */\n\n void pack(const block_type_t& block);\n\n\n\n /**\n\n * @return A pointer to the row offset buffer.\n\n */\n\n std::int32_t* getRowOffsetBuffer() const {\n\n return row_offset_;\n\n }\n\n\n\n /**\n\n * @brief Print the packed block.\n\n */\n\n void printPackedMatrix(std::string name);\n\n\n\n /**\n\n * @return Size of row offset buffer in number of elements\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 58, "score": 116434.08020906424 }, { "content": "\n\n std::shared_ptr<PackWeightMatrixForGConv<T, accT, SPATIAL_DIM>>\n\n getPackedWForGroupwise() {\n\n return W_gconv_packed_;\n\n }\n\n\n\n std::shared_ptr<PackBMatrix<T, accT>> getPackedWForPointwise() {\n\n return W_pointwise_packed_;\n\n }\n\n\n\n int inputChannels() {\n\n return conv_param_.IC;\n\n }\n\n\n\n int outputChannels() {\n\n return conv_param_.OC;\n\n }\n\n\n\n std::array<int, SPATIAL_DIM> kernelDims() {\n\n return conv_param_.K;\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 59, "score": 116434.05764127983 }, { "content": "\n\n /**\n\n * @return Offset of the element in the packed matrix that was at (i, j) in\n\n * the source matrix\n\n */\n\n std::int32_t addr(std::int32_t i, std::int32_t j) const;\n\n\n\n /**\n\n * @brief Packs a block of source matrix into pmat buffer.\n\n */\n\n void pack(const block_type_t& block);\n\n\n\n /**\n\n * @return A pointer to the row offset buffer.\n\n */\n\n std::int32_t* getRowOffsetBuffer() const {\n\n return row_offset_;\n\n }\n\n\n\n /**\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 60, "score": 116432.96215681123 }, { "content": " matrix_op_t trans_;\n\n const T* smat_;\n\n std::int32_t ld_;\n\n std::int32_t row_interleave_B_;\n\n};\n\n\n\n/**\n\n * @brief Matrix packed for the second input matrix in GEMM (usually weight).\n\n * The source matrix is already quantized. Default accumulation\n\n * type is int32.\n\n */\n\ntemplate <typename T, typename accT = std::int32_t>\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 61, "score": 116432.95573233173 }, { "content": " return true;\n\n }\n\n\n\n /**\n\n * @return offset of the element in the packed matrix that was at (i, j) in\n\n * the source matrix\n\n */\n\n std::int32_t addr(std::int32_t i, std::int32_t j) const;\n\n\n\n /**\n\n * @brief Packs a block of source matrix into pmat buffer.\n\n */\n\n void pack(const block_type_t& block);\n\n\n\n /**\n\n * @return A pointer to the row offset buffer.\n\n */\n\n std::int32_t* getRowOffsetBuffer() const {\n\n return row_offset_;\n\n }\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 62, "score": 116432.93245977102 }, { "content": " }\n\n std::uint32_t getNCols() const {\n\n return ncols_;\n\n }\n\n const float* getActWScale() const {\n\n return act_times_w_scale_;\n\n }\n\n\n\n void setRowOffsets(const std::int32_t* row_offsets) {\n\n q_row_offsets_ = row_offsets;\n\n }\n\n\n\n private:\n\n nextOPType& nextop_;\n\n const float* C_multiplier_;\n\n std::int32_t C_zero_point_;\n\n std::int32_t Aq_zero_point_;\n\n const std::int32_t* Bq_zero_point_;\n\n const std::int32_t* q_row_offsets_;\n\n const std::int32_t* q_col_offsets_;\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 63, "score": 116432.4561988494 }, { "content": " protected:\n\n /**\n\n * Set which block we're packing\n\n */\n\n void packedBlock(const block_type_t& block) {\n\n packedBlock_ = block;\n\n nbrow_ = (numPackedRows() + blockRowSize() - 1) / blockRowSize();\n\n nbcol_ = (numPackedCols() + blockColSize() - 1) / blockColSize();\n\n\n\n last_brow_ = ((numPackedRows() % blockRowSize()) == 0)\n\n ? blockRowSize()\n\n : (numPackedRows() % blockRowSize());\n\n last_bcol_ = ((numPackedCols() % blockColSize()) == 0)\n\n ? blockColSize()\n\n : (numPackedCols() % blockColSize());\n\n }\n\n\n\n inpType* buf_;\n\n std::int32_t brow_; ///< the number of rows in each block\n\n std::int32_t bcol_; ///< the number of columns in each block\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 64, "score": 116431.9194214761 }, { "content": " * TODO: if Aq_zero_point == 0, allow passing nullptr.\n\n * @param bias can be nullptr otherwise the length should be nCol\n\n */\n\n ReQuantizeForFloat(\n\n nextOPType& nextop,\n\n float Aq_scale,\n\n const float* Bq_scale,\n\n std::int32_t Aq_zero_point,\n\n const std::int32_t* Bq_zero_point,\n\n const std::int32_t* row_offsets,\n\n const std::int32_t* col_offsets,\n\n const float* bias,\n\n std::uint32_t nCol,\n\n int groups = 1)\n\n : nextop_(nextop),\n\n Aq_scale_(Aq_scale),\n\n Bq_scale_(Bq_scale),\n\n Aq_zero_point_(Aq_zero_point),\n\n Bq_zero_point_(Bq_zero_point),\n\n q_row_offsets_(row_offsets),\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 65, "score": 116431.81133650265 }, { "content": " * @return The first row of the block we're working on.\n\n */\n\n std::int32_t packedRowStart() const {\n\n return packedBlock_.row_start;\n\n }\n\n\n\n /**\n\n * @return The first column of the block we're working on.\n\n */\n\n std::int32_t packedColStart() const {\n\n return packedBlock_.col_start;\n\n }\n\n\n\n /**\n\n * @return The beginning of (rowBlockNum, colBlockNum)th block\n\n */\n\n inpType* getBuf(std::int32_t rowBlockNum = 0, std::int32_t colBlockNum = 0) {\n\n return buf_ + blockRowSize() * blockColSize() * rowBlockNum +\n\n blockRowSize() * blockColSize() * blockCols() * colBlockNum;\n\n }\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 66, "score": 116428.32195009514 }, { "content": " const float* getCMultiplier() const {\n\n return C_multiplier_;\n\n }\n\n std::int32_t getAZeroPoint() const {\n\n return Aq_zero_point_;\n\n }\n\n std::int32_t getCZeroPoint() const {\n\n return C_zero_point_;\n\n }\n\n const std::int32_t* getBZeroPoint() const {\n\n return Bq_zero_point_;\n\n }\n\n const std::int32_t* getRowOffsets() const {\n\n return q_row_offsets_;\n\n }\n\n const std::int32_t* getColOffsets() const {\n\n return q_col_offsets_;\n\n }\n\n const BIAS_T* getBias() const {\n\n return bias_;\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 67, "score": 116428.32195009514 }, { "content": "\n\n /**\n\n * @return The number of the rows in the currently packed block of a matrix.\n\n * For pre-packed (i.e., fully-packed), it's equal to the total number\n\n * of rows.\n\n */\n\n std::int32_t numPackedRows() const {\n\n return packedBlock_.row_size;\n\n }\n\n\n\n /**\n\n * @return The number of columns in the currently packed block of a matrix.\n\n * For pre-packed (i.e., fully-packed), it's equal to the number of\n\n * columns.\n\n */\n\n std::int32_t numPackedCols() const {\n\n return packedBlock_.col_size;\n\n }\n\n\n\n /**\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 68, "score": 116428.32195009514 }, { "content": " /**\n\n * @return The number of columns in each block\n\n */\n\n std::int32_t blockColSize() const {\n\n return bcol_;\n\n }\n\n\n\n /**\n\n * @return The number of blocks along rows\n\n */\n\n std::int32_t blockRows() const {\n\n return nbrow_;\n\n }\n\n\n\n /**\n\n * @return The number of blocks along columns\n\n */\n\n std::int32_t blockCols() const {\n\n return nbcol_;\n\n }\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 69, "score": 116428.32195009514 }, { "content": " typename OffsetType = std::int32_t,\n\n typename DataType = float>\n\nFBGEMM_API typename RowWiseSparseAdaGradFusedSignature<\n\n IndexType,\n\n OffsetType,\n\n DataType>::Type\n\nGenerateRowWiseSparseAdaGradFused(\n\n int block_size, // number of parameters per row\n\n int prefetch = 16,\n\n bool use_offsets = true,\n\n bool use_stochastic_rounding = true,\n\n int grad_stride = -1);\n\n\n\nnamespace internal {\n\n// Specialization for block size 1 internally called by GenerateEmbeddingSpMDM\n\ntemplate <typename InType, typename IndexType, typename OffsetType>\n\nFBGEMM_API bool EmbeddingSpMDMBlockSize1_(\n\n const std::int64_t output_size,\n\n const std::int64_t index_size,\n\n const std::int64_t data_size, // the number of rows in input\n", "file_path": "include/fbgemm/FbgemmEmbedding.h", "rank": 70, "score": 113654.31842432726 }, { "content": " */\n\ntemplate <typename IndexType, typename OffsetType = std::int32_t>\n\nFBGEMM_API typename EmbeddingSpMDMRowWiseSparseKernelSignature<\n\n std::uint8_t,\n\n IndexType,\n\n OffsetType>::Type\n\nGenerateEmbeddingSpMDMNBitRowWiseSparse(\n\n int bit_rate,\n\n const std::int64_t block_size,\n\n bool has_weight,\n\n bool normalize_by_lengths,\n\n int prefetch = 16,\n\n bool is_weight_positional = false,\n\n bool use_offsets = true);\n\n\n\n/**\n\n * @return The number of rows processed. If smaller than num_rows, an error\n\n * must have happened at the last row processed.\n\n */\n\ntemplate <typename IndexType>\n", "file_path": "include/fbgemm/FbgemmEmbedding.h", "rank": 71, "score": 113651.30322861129 }, { "content": "FBGEMM_API typename SparseAdaGradSignature<IndexType>::Type\n\nGenerateSparseAdaGrad(\n\n int block_size, // number of parameters per row\n\n bool rowwise = false,\n\n int prefetch = 16,\n\n bool use_weight_decay = false);\n\n\n\n// RowWiseSparseAdaGrad fused with SLS gradient\n\n// Weights can be either float or float16\n\ntemplate <\n\n typename IndexType,\n\n typename OffsetType = std::int32_t,\n\n typename DataType = float>\n", "file_path": "include/fbgemm/FbgemmEmbedding.h", "rank": 72, "score": 113650.48414992151 }, { "content": "GenerateEmbeddingSpMDMNBit(\n\n int bit_rate,\n\n const std::int64_t block_size,\n\n bool has_weight,\n\n bool normalize_by_lengths,\n\n int prefetch = 16,\n\n bool is_weight_positional = false,\n\n bool use_offsets = true);\n\n\n\n/**\n\n * @param output_stride If -1, output_stride is same as block_size\n\n * @param input_stride in Bytes. If -1, input_stride is same as\n\n * block_size / num_elem_per_byte + 2 * sizeof(float16)\n\n */\n\ntemplate <\n\n typename IndexType,\n\n typename OffsetType = std::int32_t,\n\n typename OutType = float>\n\nFBGEMM_API typename EmbeddingSpMDMKernelSignature<\n\n std::uint8_t,\n", "file_path": "include/fbgemm/FbgemmEmbedding.h", "rank": 73, "score": 113650.23748748982 }, { "content": " * If false, the generate code assumes we will pass lengths\n\n * that confirms Caffe2 SparseLengthsSum interface.\n\n */\n\ntemplate <\n\n typename InType,\n\n typename IndexType,\n\n typename OffsetType = std::int32_t,\n\n typename OutType = float>\n\nFBGEMM_API typename EmbeddingSpMDMKernelSignature<\n\n InType,\n\n IndexType,\n\n OffsetType,\n\n OutType>::Type\n\nGenerateEmbeddingSpMDM(\n\n const std::int64_t block_size,\n\n bool has_weight,\n\n bool normalize_by_lengths,\n\n int prefetch = 16,\n\n bool is_weight_positional = false,\n\n bool use_offsets = true);\n", "file_path": "include/fbgemm/FbgemmEmbedding.h", "rank": 74, "score": 113649.54663357371 }, { "content": "/*\n\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n\n * All rights reserved.\n\n * This source code is licensed under the BSD-style license found in the\n\n * LICENSE file in the root directory of this source tree.\n\n */\n\n#pragma once\n\n#include <cstdint>\n\n#include <functional>\n\n\n\n#include \"fbgemm/FbgemmBuild.h\"\n\n\n\nnamespace fbgemm {\n\n\n\ntemplate <\n\n typename InType,\n\n typename IndexType,\n\n typename OffsetType = std::int32_t,\n\n typename OutType = float>\n", "file_path": "include/fbgemm/FbgemmEmbedding.h", "rank": 75, "score": 113649.02173429784 }, { "content": "template <\n\n typename InType,\n\n typename IndexType,\n\n typename OffsetType = std::int32_t>\n\nFBGEMM_API typename EmbeddingSpMDMRowWiseSparseKernelSignature<\n\n InType,\n\n IndexType,\n\n OffsetType>::Type\n\nGenerateEmbeddingSpMDMRowWiseSparse(\n\n const std::int64_t block_size,\n\n bool has_weight,\n\n bool normalize_by_lengths,\n\n int prefetch = 16,\n\n bool is_weight_positional = false,\n\n bool use_offsets = true);\n\n\n\n/**\n\n * @tparam IndexType can be int32_t or int64_t\n\n * @tparam OffsetType can be int32_t or int64_t\n\n * @param bit_rate can be 2 or 4\n", "file_path": "include/fbgemm/FbgemmEmbedding.h", "rank": 76, "score": 113648.96998442484 }, { "content": "} // namespace internal\n\n\n\ntemplate <typename IndexType>\n\nFBGEMM_API void compressed_indices_remap(\n\n std::int32_t offsets_numel,\n\n const IndexType* indices,\n\n const int32_t* compressed_indices_mapping,\n\n const IndexType* offsets,\n\n const float* weights, // optional, can be null,\n\n IndexType* out_indices,\n\n IndexType* out_offsets,\n\n float* out_weights);\n\n\n\n} // namespace fbgemm\n", "file_path": "include/fbgemm/FbgemmEmbedding.h", "rank": 77, "score": 113648.19916764757 }, { "content": " IndexType,\n\n OffsetType,\n\n OutType>::Type\n\nGenerateEmbeddingSpMDMNBitWithStrides(\n\n int bit_rate,\n\n const std::int64_t block_size,\n\n bool has_weight,\n\n bool normalize_by_lengths,\n\n int prefetch = 16,\n\n bool is_weight_positional = false,\n\n bool use_offsets = true,\n\n std::int64_t output_stride = -1,\n\n std::int64_t input_stride = -1,\n\n bool scale_bias_last = true);\n\n\n\ntemplate <\n\n typename InType,\n\n typename IndexType,\n\n typename OffsetType = std::int32_t>\n", "file_path": "include/fbgemm/FbgemmEmbedding.h", "rank": 78, "score": 113647.63587031655 }, { "content": " const InType* input,\n\n const IndexType* indices,\n\n const OffsetType* offsets_or_lengths,\n\n const float* weights, // optional, can be null for non-weighted sum\n\n bool normalize_by_lengths,\n\n float* out,\n\n bool is_weight_positional = false,\n\n bool use_offsets = true);\n\n\n\ntemplate <typename IndexType, bool HAS_WEIGHTS>\n\nvoid compressed_indices_remap_avx512(\n\n std::int32_t offsets_numel,\n\n const IndexType* indices,\n\n const int32_t* compressed_indices_mapping,\n\n const IndexType* offsets,\n\n const float* weights, // optional, can be null,\n\n IndexType* out_indices,\n\n IndexType* out_offsets,\n\n float* out_weights);\n\n\n", "file_path": "include/fbgemm/FbgemmEmbedding.h", "rank": 79, "score": 113645.62468257957 }, { "content": " bool is_weight_positional = false,\n\n bool use_offsets = true,\n\n std::int64_t output_stride = -1,\n\n std::int64_t input_stride = -1,\n\n bool scale_bias_last = true);\n\n\n\n/**\n\n * @tparam IndexType can be int32_t or int64_t\n\n * @tparam OffsetType can be int32_t or int64_t\n\n * @param bit_rate can be 2 or 4\n\n */\n\ntemplate <\n\n typename IndexType,\n\n typename OffsetType = std::int32_t,\n\n typename OutType = float>\n\nFBGEMM_API typename EmbeddingSpMDMKernelSignature<\n\n std::uint8_t,\n\n IndexType,\n\n OffsetType,\n\n OutType>::Type\n", "file_path": "include/fbgemm/FbgemmEmbedding.h", "rank": 80, "score": 113645.31204651037 }, { "content": "\n\n/**\n\n * @param output_stride If -1, output_stride is same as block_size\n\n * @param input_stride If -1, input_stride is same as block_size\n\n */\n\ntemplate <\n\n typename InType,\n\n typename IndexType,\n\n typename OffsetType = std::int32_t,\n\n typename OutType = float>\n\nFBGEMM_API typename EmbeddingSpMDMKernelSignature<\n\n InType,\n\n IndexType,\n\n OffsetType,\n\n OutType>::Type\n\nGenerateEmbeddingSpMDMWithStrides(\n\n const std::int64_t block_size,\n\n bool has_weight,\n\n bool normalize_by_lengths,\n\n int prefetch = 16,\n", "file_path": "include/fbgemm/FbgemmEmbedding.h", "rank": 81, "score": 113644.99547389436 }, { "content": " std::int64_t output_size,\n\n std::int64_t index_size,\n\n std::int64_t data_size,\n\n const InType* input,\n\n const IndexType* indices,\n\n const OffsetType* offsets_or_lengths,\n\n const float* weights, // optional, can be null for non-weighted sum\n\n OutType* out)>;\n\n};\n\n\n\n/**\n\n * @tparam InType can be float, float16, or uint8_t\n\n * @tparam IndexType can be int32_t or int64_t\n\n * @tparam IndexType can be int32_t or int64_t\n\n *\n\n * @param use_offsets If true, the generated code assumes we will pass offsets\n\n * instead of lengths that confirms PyTorch EmbeddingBag\n\n * interface. In this case, the length of offsets array\n\n * should be output_size + 1 and offsets[output_size] should\n\n * be index_size.\n", "file_path": "include/fbgemm/FbgemmEmbedding.h", "rank": 82, "score": 113631.38385971697 }, { "content": "struct simd_info<inst_set_t::avx2> {\n\n static constexpr int WIDTH_BITS = 256;\n\n static constexpr int WIDTH_BYTES = 32;\n\n static constexpr int WIDTH_32BIT_ELEMS = 8;\n\n static constexpr int NUM_VEC_REGS = 16;\n\n\n\n using vec_reg_t = asmjit::x86::Ymm;\n\n};\n\n\n\ntemplate <>\n", "file_path": "include/fbgemm/Utils.h", "rank": 83, "score": 113467.08008875692 }, { "content": "struct simd_info<inst_set_t::avx512> {\n\n static constexpr int WIDTH_BITS = 512;\n\n static constexpr int WIDTH_BYTES = 64;\n\n static constexpr int WIDTH_32BIT_ELEMS = 16;\n\n static constexpr int NUM_VEC_REGS = 32;\n\n\n\n using vec_reg_t = asmjit::x86::Zmm;\n\n};\n\n\n\ntemplate <>\n", "file_path": "include/fbgemm/Utils.h", "rank": 84, "score": 113467.08008875692 }, { "content": "class FBGEMM_API DoNothing {\n\n public:\n\n using outType = outT;\n\n using inpType = inT;\n\n DoNothing() {}\n\n template <inst_set_t instSet>\n\n int f(\n\n outType* /* unused */,\n\n inpType* /* unused */,\n\n const block_type_t& /* unused */,\n\n int /* unused */,\n\n int /* unused */) const {\n\n return 0;\n\n }\n\n};\n\n\n\n/**\n\n * @brief Copy data pointed by inp ptr to out ptr when\n\n * inp ptr and out ptr are not the same.\n\n * inp buffer: row and column start points: (0, 0)\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 85, "score": 113460.82082163525 }, { "content": "class FBGEMM_API memCopy {\n\n public:\n\n using outType = outT;\n\n using inpType = inT;\n\n explicit memCopy(nextOPType& nextop) : nextop_(nextop) {}\n\n template <inst_set_t instSet>\n\n inline int f(\n\n outType* out,\n\n inpType* inp,\n\n const block_type_t& block,\n\n int ld_out,\n\n int ld_in) const;\n\n\n\n private:\n\n nextOPType& nextop_;\n\n};\n\n\n\n/**\n\n * @brief Perform scaling on accumulated data.\n\n */\n\ntemplate <\n\n typename outT = std::int32_t,\n\n typename inT = std::int32_t,\n\n typename nextOPType = DoNothing<outT, outT>>\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 86, "score": 111259.99859665163 }, { "content": "struct simd_info<inst_set_t::avx512_vnni>\n\n : public simd_info<inst_set_t::avx512> {};\n\n\n\ntemplate <>\n", "file_path": "include/fbgemm/Utils.h", "rank": 87, "score": 111041.02253113546 }, { "content": "struct simd_info<inst_set_t::avx512_ymm> {\n\n static constexpr int WIDTH_BITS = 256;\n\n static constexpr int WIDTH_BYTES = 32;\n\n static constexpr int WIDTH_32BIT_ELEMS = 8;\n\n static constexpr int NUM_VEC_REGS = 32;\n\n\n\n using vec_reg_t = asmjit::x86::Ymm;\n\n};\n\n\n\ntemplate <>\n", "file_path": "include/fbgemm/Utils.h", "rank": 88, "score": 111041.02253113546 }, { "content": "/*\n\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n\n * All rights reserved.\n\n * This source code is licensed under the BSD-style license found in the\n\n * LICENSE file in the root directory of this source tree.\n\n */\n\n#pragma once\n\n\n\n#include <cstdint>\n\n#include <vector>\n\n#include \"./ConvUtils.h\"\n\n#include \"./FbgemmBuild.h\"\n\n#include \"./Utils.h\"\n\n\n\n// #define FBGEMM_MEASURE_TIME_BREAKDOWN\n\n\n\n#ifdef FBGEMM_MEASURE_TIME_BREAKDOWN\n\n#include <chrono>\n\n#include <iostream>\n\nextern double spmdm_initial_time;\n", "file_path": "include/fbgemm/FbgemmI8Spmdm.h", "rank": 89, "score": 110983.87030807609 }, { "content": " */\n\n double Density() const;\n\n\n\n /**\n\n * @return True if the number of non-zeros per row is smaller than a small\n\n * threshold.\n\n */\n\n bool IsHyperSparse() const;\n\n\n\n /**\n\n * @brief Perform dense-matrix * sparse matrix.\n\n *\n\n * C += A (dense matrix) * B (this CSC matrix) if accumulation = true \\n\n\n * C = A (dense matrix) * B (this CSC matrix) if accumulation = false\n\n */\n\n void SpMDM(\n\n const block_type_t& block,\n\n const std::uint8_t* A,\n\n int lda,\n\n bool accumulation,\n", "file_path": "include/fbgemm/FbgemmI8Spmdm.h", "rank": 90, "score": 110980.49075260329 }, { "content": " std::int32_t* C,\n\n int ldc) const;\n\n\n\n void SparseConv(\n\n const conv_param_t<>& conv_p,\n\n const block_type_t& block,\n\n const std::uint8_t* A,\n\n std::int32_t A_zero_point,\n\n bool accumulation,\n\n std::int32_t* C,\n\n int ldc) const;\n\n\n\n private:\n\n const std::size_t num_rows_;\n\n std::vector<std::int32_t> colptr_; // corresponds to out channels\n\n std::vector<std::int8_t> values_;\n\n\n\n // For SpMDM\n\n std::vector<std::int16_t> rowidx_; // kh kw ic are flattened with im2col\n\n\n", "file_path": "include/fbgemm/FbgemmI8Spmdm.h", "rank": 91, "score": 110979.93677958443 }, { "content": " // For direct sparse convolution\n\n std::vector<std::int16_t> kh_;\n\n std::vector<std::int16_t> kw_;\n\n std::vector<std::int16_t> ic_; // in channels\n\n\n\n // Cache IsHyperSparse to minimize its overhead.\n\n mutable bool hyper_sparse_;\n\n\n\n // Whether we can reuse the cached hyper_sparse_ is determined by checking\n\n // if NumOfNonZeros() is same as old_nnz_ saved in previous invocation of\n\n // IsHyperSparse call.\n\n mutable std::int32_t old_nnz_;\n\n};\n\n\n\n} // namespace fbgemm\n", "file_path": "include/fbgemm/FbgemmI8Spmdm.h", "rank": 92, "score": 110978.93592405626 }, { "content": "extern double spmdm_transpose_uint8_time;\n\nextern double spmdm_transpose_32xN_time;\n\nextern double spmdm_compute_time;\n\nextern double spmdm_transpose_Nx32_time;\n\nextern double spmdm_run_time;\n\nextern double sconv_run_time;\n\n#endif\n\n\n\nnamespace fbgemm {\n\n\n\n/**\n\n * @brief A class to represent a matrix in Compressed Sparse Column (CSC)\n\n * format.\n\n *\n\n * The second input matrix of matrix multiplication is usually weight and can\n\n * be sparse, and it's usually more efficient to use CSC format to represent\n\n * the second input matrix.\n\n */\n", "file_path": "include/fbgemm/FbgemmI8Spmdm.h", "rank": 93, "score": 110978.41289498608 }, { "content": " * ICs include group: i.e. for ith input channels withint group g, ICs contain\n\n * g*(groups_per_input_channels) + i\n\n */\n\n std::vector<std::int16_t>& ICs() {\n\n return ic_;\n\n }\n\n\n\n std::size_t NumOfRows() const {\n\n return num_rows_;\n\n }\n\n std::size_t NumOfCols() const {\n\n return colptr_.size() - 1;\n\n }\n\n std::int32_t NumOfNonZeros() const {\n\n return colptr_.back();\n\n }\n\n\n\n /**\n\n * @return Total number of non-zero elements as a fraction of total\n\n * elements.\n", "file_path": "include/fbgemm/FbgemmI8Spmdm.h", "rank": 94, "score": 110970.83438037641 }, { "content": "class ScaleOP {\n\n public:\n\n using outType = outT;\n\n using inpType = inT;\n\n explicit ScaleOP(inpType scalingFactor) : scalingFactor_(scalingFactor) {}\n\n\n\n template <inst_set_t instSet>\n\n inline int f(\n\n outType* out,\n\n inpType* inp,\n\n const block_type_t& block,\n\n int ld_out,\n\n int ld_in) const;\n\n\n\n private:\n\n inpType scalingFactor_;\n\n};\n\n\n\n/**\n\n * @brief Perform Relu on accumulated data.\n\n */\n\ntemplate <\n\n typename outT = std::int32_t,\n\n typename inT = std::int32_t,\n\n typename nextOPType = DoNothing<outT, outT>>\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 95, "score": 110966.43671296931 }, { "content": "struct PackingTraits;\n\n\n\n// type specialized implementation in an include file\n\n#include \"./PackingTraits-inl.h\"\n\n\n\n/**\n\n * @brief Base class for packing matrices for higher GEMM performance.\n\n *\n\n * Matrix is tiled into blockRows() * blockCols() blocks.\n\n * Each block is with size blockRowSize() * blockColSize().\n\n * This class is designed using CRTP\n\n * (https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern)\n\n *\n\n * @tparam PT actual packing type, e.g., PackAWithRowOffset\n\n */\n\ntemplate <typename PT, typename inpType, typename accType = std::int32_t>\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 96, "score": 110966.43671296931 }, { "content": "class PackMatrix {\n\n public:\n\n PackMatrix() = delete; // no default constructor\n\n\n\n /**\n\n * @param rows total number of rows in the matrix\n\n * (packed rows can be less than rows).\n\n * @param cols total number of columns in the matrix\n\n * @param pmat A buffer to contain the packed matrix.\n\n * If nullptr, a buffer owned by PackMatrix will be allocated\n\n * internally to contain the packed matrix.\n\n * For non-constant matrices like activation matrices, the client\n\n * code may want to pass a pre-allocated pmat to avoid the\n\n * overhead of internal memory allocation everytime a PackMatrix\n\n * is constructed. The client code can query how big patm should\n\n * be with packedBufferSize function.\n\n * @param groups when groups > 1, we compute groups number of GEMMs each\n\n * multiplies A.rows by A.cols/A.groups matrix with\n\n * B.rows/B.groups by B.cols matrix (in conventional BLAS\n\n * terminology, this is a batched GEMM but we use the name group\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 97, "score": 110966.43671296931 }, { "content": "class ReluOutput {\n\n public:\n\n using outType = outT;\n\n using inpType = inT;\n\n explicit ReluOutput(inpType zero_pt) : zero_pt_(zero_pt) {}\n\n\n\n template <inst_set_t instSet>\n\n inline int f(\n\n outType* out,\n\n inpType* inp,\n\n const block_type_t& block,\n\n int ld_out,\n\n int ld_in) const;\n\n\n\n private:\n\n inpType zero_pt_;\n\n};\n\n\n\n/**\n\n * @brief Perform Dense-Matrix * Sparse-Matrix as a part the of output\n\n * processing pipeline.\n\n *\n\n * SPMDM (SParse Matrix times Dense Matrix) inplace on the 32-bit input buffer\n\n * (inp). After modifying the input buffer, pass it to the next op.\n\n * When groups > 1, each group is numRows() x (numCols()/groups) matrix.\n\n */\n\ntemplate <\n\n typename outT = std::int32_t,\n\n typename inT = std::int32_t,\n\n typename nextOPType = DoNothing<inT, inT>>\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 98, "score": 110966.43671296931 }, { "content": "class FBGEMM_API PackAMatrix final\n\n : public PackMatrix<PackAMatrix<T, accT>, T, accT> {\n\n public:\n\n using This = PackAMatrix<T, accT>;\n\n using BaseType = PackMatrix<This, T, accT>;\n\n using inpType = T;\n\n using accType = accT;\n\n\n\n PackAMatrix() = delete; // no default constructor\n\n\n\n PackAMatrix(\n\n matrix_op_t trans,\n\n std::int32_t nRow,\n\n std::int32_t nCol,\n\n const inpType* smat,\n\n std::int32_t ld,\n\n inpType* pmat = nullptr,\n\n int groups = 1,\n\n const BlockingFactors* params = nullptr);\n\n\n", "file_path": "include/fbgemm/Fbgemm.h", "rank": 99, "score": 109155.06829620826 } ]
C++
EVE/EveHLT/AliEveHLTEventManagerHomer.cxx
AllaMaevskaya/AliRoot
c53712645bf1c7d5f565b0d3228e3a6b9b09011a
#include "AliHLTEveHLT.h" #include "AliHLTEvePhos.h" #include "AliHLTEveEmcal.h" #include "AliESDEvent.h" #include "AliEveHLTEventManager.h" #include "AliEveEventBufferOffline.h" #include "AliEveHLTEventManagerHomer.h" #include "TList.h" #include "AliEveHOMERManager.h" #include "TEveManager.h" #include "TTimer.h" #include "TGLOverlayButton.h" #include "TGLViewer.h" ClassImp(AliEveHLTEventManagerHomer) AliEveHLTEventManagerHomer::AliEveHLTEventManagerHomer() : AliEveHLTEventManager(), fEventBuffer(NULL), fNextEventTimer(NULL), fInfoButton(NULL) { fEventBuffer = new AliEveEventBufferHomer(); fEventBuffer->StartBufferMonitor(); fNextEventTimer = new TTimer(); fNextEventTimer->Connect("Timeout()", "AliEveHLTEventManagerHomer", this, "TryNextEvent()" ); fInfoButton = new TGLOverlayButton(dynamic_cast<TGLViewerBase*>(gEve->GetDefaultGLViewer()), "", 0, 540, 210, 25); fInfoButton->SetAlphaValues(0.0, 0.8); } AliEveHLTEventManagerHomer::~AliEveHLTEventManagerHomer() { if(fEventBuffer) delete fEventBuffer; fEventBuffer = NULL; } void AliEveHLTEventManagerHomer::ProcessList(TList * blockList) { ProcessEvent(blockList); UpdateDisplay(); } void AliEveHLTEventManagerHomer::NextEvent() { fNextEventTimer->Start(1000); } void AliEveHLTEventManagerHomer::TryNextEvent() { if ( fEventBuffer->LockMutex() ) { fInfoButton->SetAlphaValues(0.8, 0.8); fInfoButton->SetText("Waiting for buffer..."); gEve->Redraw3D(kFALSE); cout << "try again in 1 sec"<<endl; return; } fInfoButton->SetAlphaValues(0.8, 0.8); fNextEventTimer->Stop(); cout << "Mutex is freeee!!"<<endl; TList * aSyncEvent = fEventBuffer->GetASyncEvent(); TList * event = static_cast<TList*>(fEventBuffer->NextEvent()); if(event) { cout << "Got the event, reset the display " <<endl; fInfoButton->SetText("Reset display.."); ResetDisplay(); cout << "Process event"<<endl; fInfoButton->SetText("Processing event.."); ProcessEvent(event); if(aSyncEvent) { cout << "Process asynchroneous event" << endl; ProcessEvent(aSyncEvent); } else { cout << "Could not get async event"<<endl; } cout << "Upate the display"<<endl; fInfoButton->SetText("Updating display..."); UpdateDisplay(); } else { cout << "couldn't get the sync event"<<endl; fInfoButton->SetAlphaValues(0.8, 0.8); fInfoButton->SetText("Waiting for buffer..."); fEventBuffer->UnLockMutex(); fEventBuffer->CreateBufferThread(); fNextEventTimer->Start(3000); return; } fInfoButton->SetAlphaValues(0.0, 0.0); fInfoButton->SetText("Done.."); fEventBuffer->UnLockMutex(); } void AliEveHLTEventManagerHomer::NavigateFwd() { TList * fEvent = dynamic_cast<TList*>(fEventBuffer->Fwd()); if(fEvent) { ResetDisplay(); ProcessEvent(fEvent); UpdateDisplay(); } else { cout << "couldn't get the fwd event"<<endl; } } void AliEveHLTEventManagerHomer::NavigateBack() { TList * fEvent = dynamic_cast<TList*>(fEventBuffer->Back()); if(fEvent) { ResetDisplay(); ProcessEvent(fEvent); UpdateDisplay(); } else { cout << "couldn't get the back event"<<endl; } }
#include "AliHLTEveHLT.h" #include "AliHLTEvePhos.h" #include "AliHLTEveEmcal.h" #include "AliESDEvent.h" #include "AliEveHLTEventManager.h" #include "AliEveEventBufferOffline.h" #include "AliEveHLTEventManagerHomer.h" #include "TList.h" #include "AliEveHOMERManager.h" #include "TEveManager.h" #include "TTimer.h" #include "TGLOverlayButton.h" #include "TGLViewer.h" ClassImp(AliEveHLTEventManagerHomer) AliEveHLTEventManagerHomer::AliEveHLTEventManagerHomer() : AliEveHLTEventManager(), fEventBuffer(NULL), fNextEventTimer(NULL), fInfoButton(NULL) { fEventBuffer = new AliEveEventBufferHomer(); fEventBuffer->StartBufferMonitor(); fNextEventTimer = new TTimer(); fNextEventTimer->Connect("Timeout()", "AliEveHLTEventManagerHomer", this, "TryNextEvent()" ); fInfoButton = new TGLOverlayButton(dynamic_cast<TGLViewerBase*>(gEve->GetDefaultGLViewer()), "", 0, 540, 210, 25); fInfoButton->SetAlphaValues(0.0, 0.8); } AliEveHLTEventManagerHomer::~AliEveHLTEventManagerHomer() { if(fEve
UpdateDisplay(); } else { cout << "couldn't get the sync event"<<endl; fInfoButton->SetAlphaValues(0.8, 0.8); fInfoButton->SetText("Waiting for buffer..."); fEventBuffer->UnLockMutex(); fEventBuffer->CreateBufferThread(); fNextEventTimer->Start(3000); return; } fInfoButton->SetAlphaValues(0.0, 0.0); fInfoButton->SetText("Done.."); fEventBuffer->UnLockMutex(); } void AliEveHLTEventManagerHomer::NavigateFwd() { TList * fEvent = dynamic_cast<TList*>(fEventBuffer->Fwd()); if(fEvent) { ResetDisplay(); ProcessEvent(fEvent); UpdateDisplay(); } else { cout << "couldn't get the fwd event"<<endl; } } void AliEveHLTEventManagerHomer::NavigateBack() { TList * fEvent = dynamic_cast<TList*>(fEventBuffer->Back()); if(fEvent) { ResetDisplay(); ProcessEvent(fEvent); UpdateDisplay(); } else { cout << "couldn't get the back event"<<endl; } }
ntBuffer) delete fEventBuffer; fEventBuffer = NULL; } void AliEveHLTEventManagerHomer::ProcessList(TList * blockList) { ProcessEvent(blockList); UpdateDisplay(); } void AliEveHLTEventManagerHomer::NextEvent() { fNextEventTimer->Start(1000); } void AliEveHLTEventManagerHomer::TryNextEvent() { if ( fEventBuffer->LockMutex() ) { fInfoButton->SetAlphaValues(0.8, 0.8); fInfoButton->SetText("Waiting for buffer..."); gEve->Redraw3D(kFALSE); cout << "try again in 1 sec"<<endl; return; } fInfoButton->SetAlphaValues(0.8, 0.8); fNextEventTimer->Stop(); cout << "Mutex is freeee!!"<<endl; TList * aSyncEvent = fEventBuffer->GetASyncEvent(); TList * event = static_cast<TList*>(fEventBuffer->NextEvent()); if(event) { cout << "Got the event, reset the display " <<endl; fInfoButton->SetText("Reset display.."); ResetDisplay(); cout << "Process event"<<endl; fInfoButton->SetText("Processing event.."); ProcessEvent(event); if(aSyncEvent) { cout << "Process asynchroneous event" << endl; ProcessEvent(aSyncEvent); } else { cout << "Could not get async event"<<endl; } cout << "Upate the display"<<endl; fInfoButton->SetText("Updating display...");
random
[]
C++
mvm-reversed/server/tf/bot/behavior/tf_bot_retreat_to_cover.cpp
fugueinheels/sigsegv-mvm
092a69d44a3ed9aacd14886037f4093a27ff816b
ConVar tf_bot_retreat_to_cover_range("tf_bot_retreat_to_cover_range", "1000", FCVAR_CHEAT); ConVar tf_bot_debug_retreat_to_cover("tf_bot_debug_retreat_to_cover", "0", FCVAR_CHEAT); ConVar tf_bot_wait_in_cover_min_time("tf_bot_wait_in_cover_min_time", "1", FCVAR_CHEAT); ConVar tf_bot_wait_in_cover_max_time("tf_bot_wait_in_cover_max_time", "2", FCVAR_CHEAT); CTFBotRetreatToCover::CTFBotRetreatToCover(Action<CTFBot *> *done_action) { this->m_flDuration = -1.0f; this->m_DoneAction = done_action; } CTFBotRetreatToCover::CTFBotRetreatToCover(float duration) { this->m_flDuration = duration; this->m_DoneAction = nullptr; } CTFBotRetreatToCover::~CTFBotRetreatToCover() { } const char *CTFBotRetreatToCover::GetName() const { return "RetreatToCover"; } ActionResult<CTFBot> CTFBotRetreatToCover::OnStart(CTFBot *actor, Action<CTFBot> *action) { this->m_PathFollower.SetMinLookAheadDistance(actor->GetDesiredPathLookAheadRange()); this->m_CoverArea = this->FindCoverArea(actor); if (this->m_CoverArea == nullptr) { return ActionResult<CTFBot>::Done("No cover available!"); } if (this->m_flDuration < 0.0f) { this->m_flDuration = RandomFloat(tf_bot_wait_in_cover_min_time.GetFloat(), tf_bot_wait_in_cover_max_time.GetFloat()); } this->m_ctActionDuration.Start(this->m_flDuration); if (actor->IsPlayerClass(TF_CLASS_SPY) && !actor->m_Shared.IsStealthed()) { actor->PressAltFireButton(); } return ActionResult<CTFBot>::Continue(); } ActionResult<CTFBot> CTFBotRetreatToCover::Update(CTFBot *actor, float dt) { const CKnownEntity *threat = actor->GetVisionInterface()->GetPrimaryKnownThreat(true); if (actor->m_Shared.InCond(TF_COND_INVULNERABLE)) { return ActionResult<CTFBot>::Done("I'm invulnerable - no need to reatreat!"); } if (!this->ShouldRetreat(actor)) { return ActionResult<CTFBot>::Done("No longer need to retreat"); } actor->EquipBestWeaponForThreat(threat); auto primary = static_cast<CTFWeaponBase *>(actor->Weapon_GetSlot(0)); bool reloading = false; if (primary != nullptr && actor->GetAmmoCount(TF_AMMO_PRIMARY) > 0 && actor->IsBarrageAndReloadWeapon(primary) && primary->Clip1() < primary->GetMaxClip1()) { actor->PressReloadButton(); reloading = true; } if (actor->GetLastKnownArea() == this->m_CoverArea && threat != nullptr) { this->m_CoverArea = this->FindCoverArea(actor); if (this->m_CoverArea == nullptr) { return ActionResult<CTFBot>::Done("My cover is exposed, and there is no other cover available!"); } } if (threat != nullptr) { this->m_ctActionDuration.Reset(); if (this->m_ctRecomputePath.IsElapsed()) { this->m_ctRecomputePath.Start(RandomFloat(0.3f, 0.5f)); CTFBotPathCost cost_func(actor, RETREAT_ROUTE); this->m_PathFollower.Compute(actor, this->m_CoverArea->GetCenter(), cost_func, 0.0f, true); } this->m_PathFollower.Update(actor); return ActionResult<CTFBot>::Continue(); } if (actor->IsPlayerClass(TF_CLASS_SPY) && actor->m_Shared.InCond(TF_COND_DISGUISED)) { return ActionResult<CTFBot>::Continue(); } if (actor->m_Shared.IsStealthed()) { actor->PressAltFireButton(); } if (this->m_DoneAction != nullptr) { return ActionResult<CTFBot>::ChangeTo(this->m_DoneAction, "Doing given action now that I'm in cover"); } } EventDesiredResult<CTFBot> CTFBotRetreatToCover::OnMoveToSuccess(CTFBot *actor, const Path *path) { return EventDesiredResult<CTFBot>::Continue(); } EventDesiredResult<CTFBot> CTFBotRetreatToCover::OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) { return EventDesiredResult<CTFBot>::Continue(); } EventDesiredResult<CTFBot> CTFBotRetreatToCover::OnStuck(CTFBot *actor) { return EventDesiredResult<CTFBot>::Continue(); } QueryResponse CTFBotRetreatToCover::ShouldHurry(const INextBot *nextbot) const { return QueryResponse::YES; } CTFNavArea *CTFBotRetreatToCover::FindCoverArea(CTFBot *actor) { VPROF_BUDGET("CTFBotRetreatToCover::FindCoverArea", "NextBot"); } CSearchForCover::CSearchForCover() { } CSearchForCover::~CSearchForCover() { } bool CSearchForCover::operator()(CNavArea *area, CNavArea *priorArea, float travelDistanceSoFar) { VPROF_BUDGET("CSearchForCover::operator()", "NextBot"); CTestAreaAgainstThreats functor(); this->m_Actor->GetVisionInterface()->ForEachKnownEntity(functor); } bool CSearchForCover::ShouldSearch(CNavArea *adjArea, CNavArea *currentArea, float travelDistanceSoFar) { if (travelDistanceSoFar > tf_bot_retreat_to_cover_range.GetFloat()) { return false; } return (this->m_Actor->GetLocomotionInterface()->GetStepHeight() > currentArea->ComputeAdjacentConnectionHeightChange(adjArea)) } void CSearchForCover::PostSearch() { if (tf_bot_debug_retreat_to_cover.GetBool()) { FOR_EACH_VEC(this->m_Areas, i) { TheNavMesh->AddToSelectedSet(this->m_Areas[i]); } } } CTestAreaAgainstThreats::CTestAreaAgainstThreats() { } CTestAreaAgainstThreats::~CTestAreaAgainstThreats() { } bool CTestAreaAgainstThreats::Inspect(const CKnownEntity& known) { VPROF_BUDGET("CTestAreaAgainstThreats::Inspect", "NextBot"); if (this->m_Actor->IsEnemy(known.GetEntity())) { CNavArea *lastknown = this->m_Actor->GetLastKnownArea(); if (lastknown != nullptr && this->m_Area->IsPotentiallyVisible(lastknown)) { ++this->m_nVisible; } } return true; }
ConVar tf_bot_retreat_to_cover_range("tf_bot_retreat_to_cover_range", "1000", FCVAR_CHEAT); ConVar tf_bot_debug_retreat_to_cover("tf_bot_debug_retreat_to_cover", "0", FCVAR_CHEAT); ConVar tf_bot_wait_in_cover_min_time("tf_bot_wait_in_cover_min_time", "1", FCVAR_CHEAT); ConVar tf_bot_wait_in_cover_max_time("tf_bot_wait_in_cover_max_time", "2", FCVAR_CHEAT); CTFBotRetreatToCover::CTFBotRetreatToCover(Action<CTFBot *> *done_action) { this->m_flDuration = -1.0f; this->m_DoneAction = done_action; } CTFBotRetreatToCover::CTFBotRetreatToCover(float duration) { this->m_flDuration = duration; this->m_DoneAction = nullptr; } CTFBotRetreatToCover::~CTFBotRetreatToCover() { } const char *CTFBotRetreatToCover::GetName() const { return "RetreatToCover"; } ActionResult<CTFBot> CTFBotRetreatToCover::OnStart(CTFBot *actor, Action<CTFBot> *action) { this->m_PathFollower.SetMinLookAheadDistance(actor->GetDesiredPathLookAheadRange()); this->m_CoverArea = this->FindCoverArea(actor); if (this->m_CoverArea == nullptr) { return ActionResult<CTFBot>::Done("No cover available!"); } if (this->m_flDuration < 0.0f) { this->m_flDuration = RandomFloat(tf_bot_wait_in_cover_min_time.GetFloat(), tf_bot_wait_in_cover_max_time.GetFloat()); } this->m_ctActionDuration.Start(this->m_flDuration); if (actor->IsPlayerClass(TF_CLASS_SPY) && !actor->m_Shared.IsStealthed()) { actor->PressAltFireButton(); } return ActionResult<CTFBot>::Continue(); } ActionResult<CTFBot> CTFBotRetreatToCover::Update(CTFBot *actor, float dt) { const CKnownEntity *threat = actor->GetVisionInterface()->GetPrimaryKnownThreat(true);
if (!this->ShouldRetreat(actor)) { return ActionResult<CTFBot>::Done("No longer need to retreat"); } actor->EquipBestWeaponForThreat(threat); auto primary = static_cast<CTFWeaponBase *>(actor->Weapon_GetSlot(0)); bool reloading = false; if (primary != nullptr && actor->GetAmmoCount(TF_AMMO_PRIMARY) > 0 && actor->IsBarrageAndReloadWeapon(primary) && primary->Clip1() < primary->GetMaxClip1()) { actor->PressReloadButton(); reloading = true; } if (actor->GetLastKnownArea() == this->m_CoverArea && threat != nullptr) { this->m_CoverArea = this->FindCoverArea(actor); if (this->m_CoverArea == nullptr) { return ActionResult<CTFBot>::Done("My cover is exposed, and there is no other cover available!"); } } if (threat != nullptr) { this->m_ctActionDuration.Reset(); if (this->m_ctRecomputePath.IsElapsed()) { this->m_ctRecomputePath.Start(RandomFloat(0.3f, 0.5f)); CTFBotPathCost cost_func(actor, RETREAT_ROUTE); this->m_PathFollower.Compute(actor, this->m_CoverArea->GetCenter(), cost_func, 0.0f, true); } this->m_PathFollower.Update(actor); return ActionResult<CTFBot>::Continue(); } if (actor->IsPlayerClass(TF_CLASS_SPY) && actor->m_Shared.InCond(TF_COND_DISGUISED)) { return ActionResult<CTFBot>::Continue(); } if (actor->m_Shared.IsStealthed()) { actor->PressAltFireButton(); } if (this->m_DoneAction != nullptr) { return ActionResult<CTFBot>::ChangeTo(this->m_DoneAction, "Doing given action now that I'm in cover"); } } EventDesiredResult<CTFBot> CTFBotRetreatToCover::OnMoveToSuccess(CTFBot *actor, const Path *path) { return EventDesiredResult<CTFBot>::Continue(); } EventDesiredResult<CTFBot> CTFBotRetreatToCover::OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) { return EventDesiredResult<CTFBot>::Continue(); } EventDesiredResult<CTFBot> CTFBotRetreatToCover::OnStuck(CTFBot *actor) { return EventDesiredResult<CTFBot>::Continue(); } QueryResponse CTFBotRetreatToCover::ShouldHurry(const INextBot *nextbot) const { return QueryResponse::YES; } CTFNavArea *CTFBotRetreatToCover::FindCoverArea(CTFBot *actor) { VPROF_BUDGET("CTFBotRetreatToCover::FindCoverArea", "NextBot"); } CSearchForCover::CSearchForCover() { } CSearchForCover::~CSearchForCover() { } bool CSearchForCover::operator()(CNavArea *area, CNavArea *priorArea, float travelDistanceSoFar) { VPROF_BUDGET("CSearchForCover::operator()", "NextBot"); CTestAreaAgainstThreats functor(); this->m_Actor->GetVisionInterface()->ForEachKnownEntity(functor); } bool CSearchForCover::ShouldSearch(CNavArea *adjArea, CNavArea *currentArea, float travelDistanceSoFar) { if (travelDistanceSoFar > tf_bot_retreat_to_cover_range.GetFloat()) { return false; } return (this->m_Actor->GetLocomotionInterface()->GetStepHeight() > currentArea->ComputeAdjacentConnectionHeightChange(adjArea)) } void CSearchForCover::PostSearch() { if (tf_bot_debug_retreat_to_cover.GetBool()) { FOR_EACH_VEC(this->m_Areas, i) { TheNavMesh->AddToSelectedSet(this->m_Areas[i]); } } } CTestAreaAgainstThreats::CTestAreaAgainstThreats() { } CTestAreaAgainstThreats::~CTestAreaAgainstThreats() { } bool CTestAreaAgainstThreats::Inspect(const CKnownEntity& known) { VPROF_BUDGET("CTestAreaAgainstThreats::Inspect", "NextBot"); if (this->m_Actor->IsEnemy(known.GetEntity())) { CNavArea *lastknown = this->m_Actor->GetLastKnownArea(); if (lastknown != nullptr && this->m_Area->IsPotentiallyVisible(lastknown)) { ++this->m_nVisible; } } return true; }
if (actor->m_Shared.InCond(TF_COND_INVULNERABLE)) { return ActionResult<CTFBot>::Done("I'm invulnerable - no need to reatreat!"); }
if_condition
[ { "content": "Returns 1, 2, or 1 + 2\n\n==================\n\n*/\n\nint __cdecl BoxOnPlaneSide (const float *emins, const float *emaxs, const cplane_t *p)\n\n{\n\n\tAssert( s_bMathlibInitialized );\n\n\tfloat\tdist1, dist2;\n\n\tint\t\tsides;\n\n\n\n\t// fast axial cases\n\n\tif (p->type < 3)\n\n\t{\n\n\t\tif (p->dist <= emins[p->type])\n\n\t\t\treturn 1;\n\n\t\tif (p->dist >= emaxs[p->type])\n\n\t\t\treturn 2;\n\n\t\treturn 3;\n\n\t}\n\n\t\n\n\t// general case\n", "file_path": "src/sdk2013/mathlib_base.cpp", "rank": 0, "score": 154638.63798487335 }, { "content": "// sizeof: 0x482c\n\nclass CTFBotRetreatToCover : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotRetreatToCover(Action<CTFBot *> *done_action);\n\n\tCTFBotRetreatToCover(float duration = -1.0f);\n\n\tvirtual ~CTFBotRetreatToCover();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToSuccess(CTFBot *actor, const Path *path) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n\n\t\n\nprivate:\n\n\tCTFNavArea *FindCoverArea(CTFBot *actor);\n\n\t\n\n\tfloat m_flDuration; // +0x0034\n\n\tAction<CTFBot> *m_DoneAction; // +0x0038\n\n\tPathFollower m_PathFollower; // +0x003c\n\n\tCountdownTimer m_ctRecomputePath; // +0x4810\n\n\tCTFNavArea *m_CoverArea; // +0x481c\n\n\tCountdownTimer m_ctActionDuration; // +0x4820\n\n};\n\n\n\n\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_retreat_to_cover.h", "rank": 1, "score": 134312.3530398953 }, { "content": "//-----------------------------------------------------------------------------\n\n// Forward declarations\n\n//-----------------------------------------------------------------------------\n\nclass ConVar;\n", "file_path": "src/sdk2013/convar.h", "rank": 2, "score": 105622.24457421535 }, { "content": "class ActionStub : public Action<T>\n\n{\n\npublic:\n\n\tvirtual const char *GetName() const override { return nullptr; }\n\n\t\n\nprotected:\n\n\tActionStub() = default;\n\n\t\n\n\t/* needed for some cases when desiring to construct an in-game version of the action,\n\n\t * and there isn't a non-inlined constructor available to simply call,\n\n\t * and you want to put the in-game vtable ptrs into place so things will work correctly */\n\n\ttemplate<typename U, typename V = U>\n\n\tvoid OverwriteVTPtr()\n\n\t{\n\n\t\tptrdiff_t offset = base_off<U, V>();\n\n\t\t\n\n\t\tuint32_t vt_ptr;\n\n\t\tif (offset == 0x0000) {\n\n\t\t\t/* main vtable @ +0x0000 */\n\n\t\t\tvt_ptr = (uint32_t)RTTI::GetVTable<V>();\n", "file_path": "src/re/nextbot.h", "rank": 3, "score": 104144.87749961819 }, { "content": "class CTFBotMainAction : public Action<CTFBot> {};\n\n\n\n\n\nnamespace Mod::Debug::Tele_Sapper\n\n{\n\n\tbool *CBaseObject_IsPlasmaDisabled (CBaseObject *obj) { return reinterpret_cast<bool *>((uintptr_t)obj + 0x0a1c); }\n\n\tfloat *CBaseObject_GetPlasmaDisabledTime(CBaseObject *obj) { return reinterpret_cast<float *>((uintptr_t)obj + 0x0a18); }\n\n\tbool *CBaseObject_m_bHasSapper (CBaseObject *obj) { return reinterpret_cast<bool *>((uintptr_t)obj + 0x0a30); }\n\n\t\n\n\t\n", "file_path": "src/mod/debug/tele_sapper.cpp", "rank": 4, "score": 97591.43980028344 }, { "content": "class CSchemaAttributeType_Float : public CSchemaAttributeTypeBase<float> {};\n", "file_path": "src/stub/econ.h", "rank": 5, "score": 96921.77954759673 }, { "content": "class IHotplugAction : public Action<T>, public IHotplugActionBase, public AutoList<IHotplugAction<T>>\n\n{\n\npublic:\n\n\tIHotplugAction()\n\n\t{\n\n\t\tIHotplugActionBase::Register(&UnloadAll);\n\n\t}\n\n\t\n\n\tstatic void UnloadAll()\n\n\t{\n\n\t\t// NOTE: [20190204] we've been getting some cases where the autolist-is-empty assertion fails due to actors being nullptr lately\n\n\t\t\n\n\t\tMsg(\"IHotplugAction<%s>::UnloadAll: found %zu currently existent hotplug actions\\n\", TypeName<T>(true), AutoList<IHotplugAction<T>>::List().size());\n\n\t\t\n\n\t\tstd::set<T *> actors;\n\n\t\t\n\n\t\tfor (auto action : AutoList<IHotplugAction<T>>::List()) {\n\n\t\t\tT *actor = action->GetActor();\n\n\t\t\t\n\n\t\t\tif (actor == nullptr && action->m_Behavior != nullptr && action->m_Behavior->m_Actor != nullptr) {\n", "file_path": "src/re/nextbot.h", "rank": 6, "score": 95802.3975768154 }, { "content": "// sizeof: 0x74\n\nclass CTFBotMainAction : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotMainAction(/* TODO */);\n\n\tvirtual ~CTFBotMainAction();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\n\tvirtual Action<CTFBot> *InitialContainedAction(CTFBot *actor) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnContact(CTFBot *actor, CBaseEntity *ent, CGameTrace *trace) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnInjured(CTFBot *actor, const CTakeDamageInfo& info) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnOtherKilled(CTFBot *actor, CBaseCombatCharacter *who, const CTakeDamageInfo& info) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldRetreat(const INextBot *nextbot) const override;\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_behavior.h", "rank": 7, "score": 94779.0675631641 }, { "content": "// sizeof: 0x4824\n\nclass CTFGotoActionPoint : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFGotoActionPoint(/* TODO */);\n\n\tvirtual ~CTFGotoActionPoint();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\nprivate:\n\n\t// TODO\n\n};\n\n\n\n\n", "file_path": "mvm-reversed/server/tf/bot/behavior/training/tf_bot_training.h", "rank": 8, "score": 93899.73838901107 }, { "content": "\tclass CTFBotHelperSpy : public Action<CTFBot> /*IHotplugAction*/\n\n\t{\n\n\tpublic:\n\n\t\tvirtual const char *GetName() const override { return \"HelperSpy\"; }\n\n\t\t\n\n\t\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override\n\n\t\t{\n\n\t\t\tactor->PushRequiredWeapon(actor->Weapon_OwnsThisID(TF_WEAPON_BUILDER));\n\n\t\t\t\n\n\t\t\treturn ActionResult<CTFBot>::Continue();\n\n\t\t}\n\n\t\t\n\n\t\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override\n\n\t\t{\n\n\t\t\tif (this->m_bSapping) {\n\n\t\t\t\tactor->PressFireButton();\n\n\t\t\t} else {\n\n\t\t\t\tactor->ReleaseFireButton();\n\n\t\t\t}\n\n\t\t\t\n", "file_path": "src/mod/debug/tele_sapper.cpp", "rank": 9, "score": 93131.61499412401 }, { "content": "\tclass CTFBotHelperSoldier : public Action<CTFBot> /*IHotplugAction*/\n\n\t{\n\n\tpublic:\n\n\t\tvirtual const char *GetName() const override { return \"HelperSoldier\"; }\n\n\t\t\n\n\t\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override\n\n\t\t{\n\n\t\t\tactor->AddItem(\"The Cow Mangler 5000\");\n\n\t\t\t\n\n\t\t\treturn ActionResult<CTFBot>::Continue();\n\n\t\t}\n\n\t\t\n\n\t\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override\n\n\t\t{\n\n\t\t\tif (this->m_bCharging) {\n\n\t\t\t\tactor->PressAltFireButton();\n\n\t\t\t} else {\n\n\t\t\t\tactor->ReleaseAltFireButton();\n\n\t\t\t}\n\n\t\t\t\n", "file_path": "src/mod/debug/tele_sapper.cpp", "rank": 10, "score": 93131.61499412401 }, { "content": "// sizeof: 0x4814\n\nclass CTFTrainingAttackSentryActionPoint : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFTrainingAttackSentryActionPoint(/* TODO */);\n\n\tvirtual ~CTFTrainingAttackSentryActionPoint();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\nprivate:\n\n\t// TODO\n\n};\n\n\n\n\n", "file_path": "mvm-reversed/server/tf/bot/behavior/training/tf_bot_training.h", "rank": 11, "score": 92220.40655446192 }, { "content": "class CEmptyConVar : public ConVar {};\n\n\n\n\n\nnamespace ConVar_Restore\n\n{\n\n\tConCommand ccmd_save(\"sig_cvar_save\", &Save, \"Save the values of this mod's ConVars\");\n\n\tConCommand ccmd_savenondefault(\"sig_cvar_save_non_default\", &SaveNonDefault, \"Save the values of this mod's ConVars, excluding default values\");\n\n\tConCommand ccmd_load(\"sig_cvar_load\", &Load, \"Load the previously saved ConVar values of this mod\");\n\n\tConCommand ccmd_reset(\"sig_cvar_reset\", &Reset, \"Reset ConVars to default values\");\n\n\tConVar cvar_autosave(\"sig_cvar_autosave\", \"0\", FCVAR_NONE, \"Should ConVar values automatically be saved on disk during mod unload\");\n\n\t\n\n\tstd::list<ConVar *> s_ConVars;\n\n\tstd::list<ConCommand *> s_ConCmds;\n\n\t\n\n\t\n\n\tvoid Register(ConCommandBase *pCommand)\n\n\t{\n\n\t\t/* ignore s_EmptyConVar */\n\n\t\tif (dynamic_cast<CEmptyConVar *>(pCommand) != nullptr) return;\n\n\t\t\n", "file_path": "src/convar_restore.cpp", "rank": 12, "score": 89014.94008610435 }, { "content": "struct CExtract_perteamvisuals_t_m_Sounds : public IExtract<const_char_ptr (*)[NUM_SHOOT_SOUND_TYPES]>\n\n{\n\n\tCExtract_perteamvisuals_t_m_Sounds() : IExtract<const_char_ptr (*)[NUM_SHOOT_SOUND_TYPES]>(sizeof(s_Buf_perteamvisuals_t_m_Sounds)) {}\n\n\t\n\n\tvirtual bool GetExtractInfo(ByteBuf& buf, ByteBuf& mask) const override\n\n\t{\n\n\t\tbuf.CopyFrom(s_Buf_perteamvisuals_t_m_Sounds);\n\n\t\t\n\n\t\tint off_CEconItemDefinition_m_Visuals;\n\n\t//\tif (!Prop::FindOffset(off_CEconItemDefinition_m_Visuals, \"CEconItemDefinition\", \"m_Visuals\")) return false;\n\n\t\tif (!Prop::FindOffset(off_CEconItemDefinition_m_Visuals, \"CEconItemDefinition\", \"m_Visuals\")) {\n\n\t\t\tDevMsg(\"Extractor for perteamvisuals_t::m_Sounds: can't find prop offset for CEconItemDefinition::m_Visuals\\n\");\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t\n\n\t\tbuf.SetDword(0x00 + 2, (uint32_t)off_CEconItemDefinition_m_Visuals);\n\n\t\t\n\n\t\tmask[0x08 + 1] = 0x00;\n\n\t\tmask[0x0d + 1] = 0x00;\n\n\t\tmask.SetDword(0x0f + 3, ~0x000003ff);\n", "file_path": "src/stub/econ.cpp", "rank": 13, "score": 82609.84138669579 }, { "content": "struct CExtract_CNavArea_m_costSoFar : public IExtract<float *>\n\n{\n\n\tusing T = float *;\n\n\t\n\n\tCExtract_CNavArea_m_costSoFar() : IExtract<T>(sizeof(s_Buf_CNavArea_m_costSoFar)) {}\n\n\t\n\n\tvirtual bool GetExtractInfo(ByteBuf& buf, ByteBuf& mask) const override\n\n\t{\n\n\t\tbuf.CopyFrom(s_Buf_CNavArea_m_costSoFar);\n\n\t\t\n\n\t\tmask.SetRange(0x14 + 4, 1, 0x00);\n\n\t\tmask.SetRange(0x19 + 4, 1, 0x00);\n\n\t\t\n\n\t\treturn true;\n\n\t}\n\n\t\n\n\tvirtual const char *GetFuncName() const override { return \"ISearchSurroundingAreasFunctor::IterateAdjacentAreas\"; }\n\n\tvirtual uint32_t GetFuncOffMin() const override { return 0x00a0; } // @ 0x00ea\n\n\tvirtual uint32_t GetFuncOffMax() const override { return 0x0100; }\n\n\tvirtual uint32_t GetExtractOffset() const override { return 0x0014 + 4; }\n", "file_path": "src/stub/nav.cpp", "rank": 14, "score": 82549.40478369214 }, { "content": "struct CExtract_CTFWeaponBaseMelee_Holster : public IExtract<float *>\n\n{\n\n\tusing T = float *;\n\n\t\n\n\tCExtract_CTFWeaponBaseMelee_Holster() : IExtract<T>(sizeof(s_Buf_CTFWeaponBaseMelee_Holster)) {}\n\n\t\n\n\tvirtual bool GetExtractInfo(ByteBuf& buf, ByteBuf& mask) const override\n\n\t{\n\n\t\tbuf.CopyFrom(s_Buf_CTFWeaponBaseMelee_Holster);\n\n\t\t\n\n\t\t//buf.SetDword(0x0c + 1, (uint32_t)AddrManager::GetAddr(\"gpGlobals\"));\n\n\t\t\n\n\t\tmask.SetRange(0x0c + 2, 4, 0x00);\n\n\t\t//mask.SetRange(0x24 + 3, 4, 0x00);\n\n\t\t//mask.SetRange(0x2b + 2, 4, 0x00);\n\n\t\t\n\n\t\treturn true;\n\n\t}\n\n\t\n\n\tvirtual const char *GetFuncName() const override { return \"CTFWeaponBaseMelee::Holster\"; }\n", "file_path": "src/stub/tfweaponbase.cpp", "rank": 15, "score": 82549.40478369214 }, { "content": "struct CExtract_CTFProjectile_Arrow_ArrowTouch : public IExtract<float *>\n\n{\n\n\tusing T = float *;\n\n\t\n\n\tCExtract_CTFProjectile_Arrow_ArrowTouch() : IExtract<T>(sizeof(s_Buf_CTFProjectile_Arrow_ArrowTouch)) {}\n\n\t\n\n\tvirtual bool GetExtractInfo(ByteBuf& buf, ByteBuf& mask) const override\n\n\t{\n\n\t\tbuf.CopyFrom(s_Buf_CTFProjectile_Arrow_ArrowTouch);\n\n\t\t\n\n\t\tbuf.SetDword(0x0c + 1, (uint32_t)AddrManager::GetAddr(\"gpGlobals\"));\n\n\t\t\n\n\t\tmask.SetRange(0x1c + 4, 4, 0x00);\n\n\t\tmask.SetRange(0x24 + 3, 4, 0x00);\n\n\t\tmask.SetRange(0x2b + 2, 4, 0x00);\n\n\t\t\n\n\t\treturn true;\n\n\t}\n\n\t\n\n\tvirtual const char *GetFuncName() const override { return \"CTFProjectile_Arrow::ArrowTouch\"; }\n", "file_path": "src/stub/projectiles.cpp", "rank": 16, "score": 82549.40478369214 }, { "content": "struct CExtract_CObjectSentrygun_FireRocket : public IExtract<float *>\n\n{\n\n\tusing T = float *;\n\n\t\n\n\tCExtract_CObjectSentrygun_FireRocket() : IExtract<T>(sizeof(s_Buf_CObjectSentrygun_FireRocket)) {}\n\n\t\n\n\tvirtual bool GetExtractInfo(ByteBuf& buf, ByteBuf& mask) const override\n\n\t{\n\n\t\tbuf.CopyFrom(s_Buf_CObjectSentrygun_FireRocket);\n\n\t\t\n\n\t\tbuf.SetDword(0x0F + 1, (uint32_t)AddrManager::GetAddr(\"gpGlobals\"));\n\n\t\t\n\n\t\tmask.SetRange(0x14 + 4, 4, 0x00);\n\n\t\tmask.SetRange(0x1c + 3, 1, 0x00);\n\n\t\t\n\n\t\treturn true;\n\n\t}\n\n\t\n\n\tvirtual const char *GetFuncName() const override { return \"CObjectSentrygun::FireRocket\"; }\n\n\tvirtual uint32_t GetFuncOffMin() const override { return 0x0000; }\n", "file_path": "src/stub/objects.cpp", "rank": 17, "score": 82549.40478369214 }, { "content": "class CEyeballBossIdle : public Action<CEyeballBoss>\n\n{\n\npublic:\n\n\tCountdownTimer m_ctLookAround; // +0x0034\n\n\tPathFollower m_PathFollower; // +0x0040\n\n\tCountdownTimer m_ctUnused; // +0x4814\n\n\tCHandle<CBaseEntity> m_hLastAttacker; // +0x4820\n\n\tCountdownTimer m_ctMakeSound; // +0x4824\n\n\tCountdownTimer m_ctLifetime; // +0x4830\n\n\tCountdownTimer m_ctTeleport; // +0x483c\n\n\tfloat m_flLifetimeLeft; // +0x4848\n\n\tint m_iHealth; // +0x484c\n\n\tbool m_bOtherKilled; // +0x4850\n\n};\n\nSIZE_CHECK(CEyeballBossIdle, 0x4854); // 0x4851\n\n\n", "file_path": "src/stub/nextbot_cc_behavior.h", "rank": 18, "score": 82286.99572449448 }, { "content": "//#include \"../mvm-reversed/server/tf/bot/behavior/tf_bot_use_item.h\"\n\nclass CTFBotUseItem : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCHandle<CTFWeaponBase> m_hItem;\n\n\tCountdownTimer m_ctInitialDelay;\n\n};\n\n\n\n\n\nnamespace Mod::Debug::UseItem_Broken\n\n{\n\n\t// here's the problem:\n\n\t// the initial delay is calculated based on the required item's m_flNextPrimaryAttack\n\n\t// however, m_flNextPrimaryAttack isn't set to something reasonable until the weapon has actually been deployed\n\n\t// so our initial delay is set to 100ms or something dumb\n\n\t// and then as soon as we EquipRequiredWeapon, m_flNextPrimaryAttack is updated to 500ms from now\n\n\t// but we've already decided we'll be done after 100ms\n\n\t\n\n\t\n\n\tconst char *WeaponID_ToString(int id)\n\n\t{\n", "file_path": "src/mod/debug/useitem_broken.cpp", "rank": 19, "score": 82286.99572449448 }, { "content": "\tclass CTFBotUseItem : public Action<CTFBot>\n\n\t{\n\n\tpublic:\n\n\t\tCHandle<CTFWeaponBase> m_hItem;\n\n\t};\n\n\t\n\n\t\n", "file_path": "src/mod/ai/improved_useitem.cpp", "rank": 20, "score": 82286.99572449448 }, { "content": "class CEyeballBossDead : public Action<CEyeballBoss>\n\n{\n\npublic:\n\n\tCountdownTimer m_ctDelay; // +0x0034\n\n};\n\nSIZE_CHECK(CEyeballBossDead, 0x0040); // 0x0040\n\n\n\n\n\n#endif\n", "file_path": "src/stub/nextbot_cc_behavior.h", "rank": 21, "score": 82286.99572449448 }, { "content": "\tclass CTFBotChaseStickies : public Action<CTFBot>\n\n\t{\n\n\tpublic:\n\n\t\tCTFBotChaseStickies()\n\n\t\t{\n\n\t\t\tDevMsg(\"CTFBotChaseStickies::CTFBotChaseStickies\\n\");\n\n\t\t\t\n\n\t\t\t// TODO\n\n\t\t}\n\n\t\t\n\n\t\tvirtual ~CTFBotChaseStickies()\n\n\t\t{\n\n\t\t\tDevMsg(\"CTFBotChaseStickies::~CTFBotChaseStickies\\n\");\n\n\t\t\t\n\n\t\t\t// TODO\n\n\t\t}\n\n\t\t\n\n\t\t\n\n\t\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override\n\n\t\t{\n", "file_path": "src/mod/pop/extattr/targetstickies.cpp", "rank": 22, "score": 82286.99572449448 }, { "content": "//-----------------------------------------------------------------------------\n\n// Purpose: A console variable\n\n//-----------------------------------------------------------------------------\n\nclass ConVar : public ConCommandBase, public IConVar\n\n{\n\nfriend class CCvar;\n\nfriend class ConVarRef;\n\n\n\npublic:\n\n\ttypedef ConCommandBase BaseClass;\n\n\n\n\t\t\t\t\t\t\t\tConVar( const char *pName, const char *pDefaultValue, int flags = 0);\n\n\n\n\t\t\t\t\t\t\t\tConVar( const char *pName, const char *pDefaultValue, int flags, \n\n\t\t\t\t\t\t\t\t\tconst char *pHelpString );\n\n\t\t\t\t\t\t\t\tConVar( const char *pName, const char *pDefaultValue, int flags, \n\n\t\t\t\t\t\t\t\t\tconst char *pHelpString, bool bMin, float fMin, bool bMax, float fMax );\n\n\t\t\t\t\t\t\t\tConVar( const char *pName, const char *pDefaultValue, int flags, \n\n\t\t\t\t\t\t\t\t\tconst char *pHelpString, FnChangeCallback_t callback );\n\n\t\t\t\t\t\t\t\tConVar( const char *pName, const char *pDefaultValue, int flags, \n\n\t\t\t\t\t\t\t\t\tconst char *pHelpString, bool bMin, float fMin, bool bMax, float fMax,\n\n\t\t\t\t\t\t\t\t\tFnChangeCallback_t callback );\n\n\n", "file_path": "src/sdk2013/convar.h", "rank": 23, "score": 82250.50526104675 }, { "content": "\tclass CTFBotUseItemImproved : public Action<CTFBot>\n\n\t{\n\n\tpublic:\n", "file_path": "src/mod/ai/improved_useitem.cpp", "rank": 24, "score": 81226.82995813258 }, { "content": "class CTestAreaAgainstThreats : public IVision::IForEachKnownEntity\n\n{\n\npublic:\n\n\tCTestAreaAgainstThreats(/* TODO */);\n\n\tvirtual ~CTestAreaAgainstThreats();\n\n\t\n\n\tvirtual bool Inspect(const CKnownEntity& known) override;\n\n\t\n\nprivate:\n\n\tCTFBot *m_Actor; // +0x04\n\n\tCNavArea *m_Area; // +0x08\n\n\tint m_nVisible; // +0x0c\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_retreat_to_cover.h", "rank": 25, "score": 80756.92476243922 }, { "content": "// sizeof: TODO (>=0x4824)\n\nclass CTFBotEscort : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotEscort(CBaseEntity *who);\n\n\tvirtual ~CTFBotEscort();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToSuccess(CTFBot *actor, const Path *path) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnCommandApproach(CTFBot *actor, const Vector& v1, float f1) override;\n\n\t\n\n\tvirtual QueryResponse ShouldRetreat(const INextBot *nextbot) const override;\n\n\t\n\n\tCBaseEntity *GetWho() const;\n\n\tvoid SetWho(CBaseEntity *who);\n\n\t\n\nprivate:\n\n\tCBaseEntity *m_hWho; // +0x0034\n\n\tPathFollower m_PathFollower; // +0x0038\n\n\t// 480c CountdownTimer\n\n\tCountdownTimer m_ctRecomputePath; // +0x4818\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_escort.h", "rank": 26, "score": 80216.2941445687 }, { "content": "class CTFBotMvMEngineerIdle : public Action<CTFBot> {};\n\n\n\n\n\nnamespace Mod::AI::EngieBot_Wrangler\n\n{\n", "file_path": "src/mod/ai/engiebot_wrangler.cpp", "rank": 27, "score": 80216.2941445687 }, { "content": "// sizeof: 0x38\n\nclass CTFBotDead : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotDead();\n\n\tvirtual ~CTFBotDead();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\nprivate:\n\n\tIntervalTimer m_itDeathEpoch; // +0x34\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_dead.h", "rank": 28, "score": 80216.2941445687 }, { "content": "// sizeof: 0x34\n\nclass CTFDespawn : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFDespawn(/* TODO */);\n\n\tvirtual ~CTFDespawn();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/training/tf_bot_training.h", "rank": 29, "score": 80216.2941445687 }, { "content": "// sizeof: 0x50\n\nclass CTFBotTaunt : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotTaunt();\n\n\tvirtual ~CTFBotTaunt();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\nprivate:\n\n\tCountdownTimer m_ctWait; // +0x34\n\n\tCountdownTimer m_ctTaunt; // +0x40\n\n\tbool m_bTaunting; // +0x4c\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_taunt.h", "rank": 30, "score": 80216.2941445687 }, { "content": "// sizeof: 0x9014\n\nclass CTFBotAttack : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotAttack();\n\n\tvirtual ~CTFBotAttack();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToSuccess(CTFBot *actor, const Path *path) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldRetreat(const INextBot *nextbot) const override;\n\n\t\n\nprivate:\n\n\tPathFollower m_PathFollower; // +0x0034\n\n\tChasePath m_ChasePath; // +0x4808\n\n\tCountdownTimer m_ctRecomputePath; // +0x9008\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_attack.h", "rank": 31, "score": 80216.2941445687 }, { "content": "struct CExtract_CTFNavArea_m_IncursionDistances : public IExtract<float (*)[4]>\n\n{\n\n\tCExtract_CTFNavArea_m_IncursionDistances() : IExtract<float (*)[4]>(sizeof(s_Buf_CTFNavArea_m_IncursionDistances)) {}\n\n\t\n\n\tvirtual bool GetExtractInfo(ByteBuf& buf, ByteBuf& mask) const override\n\n\t{\n\n\t\tbuf.CopyFrom(s_Buf_CTFNavArea_m_IncursionDistances);\n\n\t\t\n\n\t\tmask.SetRange(0x06 + 5, 4, 0x00);\n\n\t\t\n\n\t\treturn true;\n\n\t}\n\n\t\n\n\tvirtual const char *GetFuncName() const override { return \"CTFNavArea::GetNextIncursionArea\"; }\n\n\tvirtual uint32_t GetFuncOffMin() const override { return 0x0000; }\n\n\tvirtual uint32_t GetFuncOffMax() const override { return 0x0030; }\n\n\tvirtual uint32_t GetExtractOffset() const override { return 0x0006 + 5; }\n\n};\n\n\n\n#elif defined _WINDOWS\n", "file_path": "src/stub/nav.cpp", "rank": 32, "score": 79984.30120480285 }, { "content": "// sizeof: 0x44\n\nclass CTFBotUseItem : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotUseItem(CTFWeaponBase *item);\n\n\tvirtual ~CTFBotUseItem();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual void OnEnd(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\nprivate:\n\n\tCHandle<CTFWeaponBase> m_hItem; // +0x34\n\n\tCountdownTimer m_ctInitialDelay; // +0x38\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_use_item.h", "rank": 33, "score": 78330.79569688837 }, { "content": "// sizeof: 0x4838\n\nclass CTFBotMeleeAttack : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotMeleeAttack(float abandon_range = -1.0f);\n\n\tvirtual ~CTFBotMeleeAttack();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\nprivate:\n\n\tfloat m_flAbandonRange; // +0x0034\n\n\tChasePath m_ChasePath; // +0x0038\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_melee_attack.h", "rank": 34, "score": 78330.79569688837 }, { "content": "// sizeof: 0x4810\n\nclass CTFBotGetHealth : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotGetHealth();\n\n\tvirtual ~CTFBotGetHealth();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToSuccess(CTFBot *actor, const Path *path) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n\n\t\n\n\tstatic bool IsPossible(CTFBot *actor);\n\n\t\n\nprivate:\n\n\tPathFollower m_PathFollower; // +0x0034\n\n\tCHandle<CBaseEntity> m_hHealth; // +0x4808\n\n\t// 4808 CHandle<T>\n\n\t// 480c \n\n};\n\n\n\n\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_get_health.h", "rank": 35, "score": 78330.79569688837 }, { "content": "// sizeof: 0x4810\n\nclass CTFBotGetAmmo : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotGetAmmo();\n\n\tvirtual ~CTFBotGetAmmo();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnContact(CTFBot *actor, CBaseEntity *ent, CGameTrace *trace) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToSuccess(CTFBot *actor, const Path *path) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n\n\t\n\n\tstatic bool IsPossible(CTFBot *actor);\n\n\t\n\nprivate:\n\n\tPathFollower m_PathFollower; // +0x0034\n\n\tCHandle<CBaseEntity> m_hAmmo; // +0x4808\n\n\t// 480c bool\n\n};\n\n\n\n\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_get_ammo.h", "rank": 36, "score": 78330.79569688837 }, { "content": "// sizeof: 0x4c\n\nclass CTFBotScenarioMonitor : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotScenarioMonitor();\n\n\tvirtual ~CTFBotScenarioMonitor();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\n\tvirtual Action<CTFBot> *InitialContainedAction(CTFBot *actor) override;\n\n\t\n\nprivate:\n\n\tvirtual Action<CTFBot> *DesiredScenarioAndClassAction(CTFBot *actor);\n\n\t\n\n\tCountdownTimer m_ctFetchFlagInitial; // +0x34\n\n\tCountdownTimer m_ctFetchFlag; // +0x40\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_scenario_monitor.h", "rank": 37, "score": 78330.79569688837 }, { "content": "// sizeof: 0x7c\n\nclass CTFBotTacticalMonitor : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotTacticalMonitor();\n\n\tvirtual ~CTFBotTacticalMonitor();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\n\tvirtual Action<CTFBot> *InitialContainedAction(CTFBot *actor) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnOtherKilled(CTFBot *actor, CBaseCombatCharacter *who, const CTakeDamageInfo& info) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnNavAreaChanged(CTFBot *actor, CNavArea *area1, CNavArea *area2) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnCommandString(CTFBot *actor, const char *cmd) override;\n\n\t\n\nprivate:\n\n\tvoid AvoidBumpingEnemies(CTFBot *actor);\n\n\tCObjectTeleporter *FindNearbyTeleporter(CTFBot *actor);\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_tactical_monitor.h", "rank": 38, "score": 78330.79569688837 }, { "content": "// sizeof: 0x4820\n\nclass CTFBotUseTeleporter : public Action<CTFBot>\n\n{\n\npublic:\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_use_teleporter.h", "rank": 39, "score": 78330.79569688837 }, { "content": "// sizeof: 0x481c\n\nclass CTFBotApproachObject : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotApproachObject(CBaseEntity *object, float dist);\n\n\tvirtual ~CTFBotApproachObject();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\nprivate:\n\n\tCHandle<CBaseEntity> m_hObject; // +0x0034\n\n\tfloat m_flDist; // +0x0038\n\n\tPathFollower m_PathFollower; // +0x003c\n\n\tCountdownTimer m_ctRecomputePath; // +0x4810\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_approach_object.h", "rank": 40, "score": 78330.79569688837 }, { "content": "// sizeof: 0x4828\n\nclass CTFBotSeekAndDestroy : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotSeekAndDestroy(float duration = -1.0f);\n\n\tvirtual ~CTFBotSeekAndDestroy();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToSuccess(CTFBot *actor, const Path *path) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryContested(CTFBot *actor, int i1) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryCaptured(CTFBot *actor, int i1) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryLost(CTFBot *actor, int i1) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_seek_and_destroy.h", "rank": 41, "score": 78330.79569688837 }, { "content": "// sizeof: 0x4818\n\nclass CTFBotSpySap : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotSpySap(CBaseObject *target);\n\n\tvirtual ~CTFBotSpySap();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual void OnEnd(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> OnSuspend(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\t\n\n\tvirtual QueryResponse ShouldRetreat(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n\n\tvirtual QueryResponse IsHindrance(const INextBot *nextbot, CBaseEntity *it) const override;\n\n\t\n\nprivate:\n\n\tbool AreAllDangerousSentriesSapped(CTFBot *actor) const;\n\n\t\n\n\tCHandle<CBaseObject> m_hTarget; // +0x0034\n\n\tCountdownTimer m_ctRecomputePath; // +0x0038\n\n\tPathFollower m_PathFollower; // +0x0044\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/spy/tf_bot_spy_sap.h", "rank": 42, "score": 77449.90284324993 }, { "content": "// sizeof: 0x9058\n\nclass CTFBotMedicHeal : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotMedicHeal();\n\n\tvirtual ~CTFBotMedicHeal();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToSuccess(CTFBot *actor, const Path *path) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnActorEmoted(CTFBot *actor, CBaseCombatCharacter *who, int emote_concept) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldRetreat(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n", "file_path": "mvm-reversed/server/tf/bot/behavior/medic/tf_bot_medic_heal.h", "rank": 43, "score": 77449.90284324993 }, { "content": "// sizeof: 0x40\n\nclass CTFBotSpyLurk : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotSpyLurk();\n\n\tvirtual ~CTFBotSpyLurk();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n\n\t\n\nprivate:\n\n\tCountdownTimer m_ctPatience; // +0x34\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/spy/tf_bot_spy_lurk.h", "rank": 44, "score": 77449.90284324993 }, { "content": "// sizeof: 0x7c\n\nclass CTFBotStickybombSentrygun : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotStickybombSentrygun(CObjectSentrygun *sentry);\n\n\tCTFBotStickybombSentrygun(CObjectSentrygun *sentry, float x, float y, float z);\n\n\tvirtual ~CTFBotStickybombSentrygun();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual void OnEnd(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> OnSuspend(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnInjured(CTFBot *actor, const CTakeDamageInfo& info) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldRetreat(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n\n\t\n", "file_path": "mvm-reversed/server/tf/bot/behavior/demoman/tf_bot_stickybomb_sentrygun.h", "rank": 45, "score": 77449.90284324993 }, { "content": "// sizeof: 0x485c\n\nclass CTFBotSniperLurk : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotSniperLurk();\n\n\tvirtual ~CTFBotSniperLurk();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual void OnEnd(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> OnSuspend(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual QueryResponse ShouldRetreat(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n\n\tvirtual const CKnownEntity *SelectMoreDangerousThreat(const INextBot *nextbot, const CBaseCombatCharacter *them, const CKnownEntity *threat1, const CKnownEntity *threat2) const override;\n\n\t\n\nprivate:\n\n\tCTFBotHint *FindHint(CTFBot *actor);\n", "file_path": "mvm-reversed/server/tf/bot/behavior/sniper/tf_bot_sniper_lurk.h", "rank": 46, "score": 77449.90284324993 }, { "content": "// sizeof: TODO\n\nclass CTFBotSpyEscape : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotSpyEscape();\n\n\tvirtual ~CTFBotSpyEscape();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/spy/tf_bot_spy_escape.h", "rank": 47, "score": 77449.90284324993 }, { "content": "// sizeof: 0x40+\n\nclass CTFBotSniperAttack : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotSniperAttack(/* TODO */);\n\n\tvirtual ~CTFBotSniperAttack();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual void OnEnd(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> OnSuspend(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual Vector SelectTargetPoint(const INextBot *nextbot, const CBaseCombatCharacter *them) const override;\n\n\tvirtual const CKnownEntity *SelectMoreDangerousThreat(const INextBot *nextbot, const CBaseCombatCharacter *them, const CKnownEntity *threat1, const CKnownEntity *threat2) const override;\n\n\t\n\n\tstatic bool IsPossible(CTFBot *actor);\n\n\t\n\nprivate:\n\n\tbool IsImmediateThreat(const CBaseCombatCharacter *who, const CKnownEntity *threat) const;\n\n\t\n\n\tCountdownTimer m_ctLinger; // +0x34\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/sniper/tf_bot_sniper_attack.h", "rank": 48, "score": 77449.90284324993 }, { "content": "// sizeof: 0x34\n\nclass CTFBotEngineerBuild : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotEngineerBuild(/* TODO */);\n\n\tvirtual ~CTFBotEngineerBuild();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual Action<CTFBot> *InitialContainedAction(CTFBot *actor) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryLost(CTFBot *actor, int i1) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/engineer/tf_bot_engineer_build.h", "rank": 49, "score": 77449.90284324993 }, { "content": "// sizeof: 0x483c\n\nclass CTFBotSpyHide : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotSpyHide(CTFPlayer *victim);\n\n\tvirtual ~CTFBotSpyHide();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToSuccess(CTFBot *actor, const Path *path) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) override;\n\n\t\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n\n\t\n\nprivate:\n\n\tbool FindHidingSpot(CTFBot *actor);\n\n\t\n", "file_path": "mvm-reversed/server/tf/bot/behavior/spy/tf_bot_spy_hide.h", "rank": 50, "score": 77449.90284324993 }, { "content": "// sizeof: 0x4814\n\nclass CTFBotMedicRetreat : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotMedicRetreat();\n\n\tvirtual ~CTFBotMedicRetreat();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToSuccess(CTFBot *actor, const Path *path) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\t\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n\n\t\n\nprivate:\n\n\tPathFollower m_PathFollower; // +0x0034\n\n\tCountdownTimer m_ctLookForPatients; // +0x4808\n\n};\n\n\n\n\n", "file_path": "mvm-reversed/server/tf/bot/behavior/medic/tf_bot_medic_retreat.h", "rank": 51, "score": 77449.90284324993 }, { "content": "// sizeof: TODO\n\nclass CTFBotSpyBackstab : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotSpyBackstab();\n\n\tvirtual ~CTFBotSpyBackstab();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/spy/tf_bot_spy_backstab.h", "rank": 52, "score": 77449.90284324993 }, { "content": "// sizeof: 0x4834\n\nclass CTFBotSpyInfiltrate : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotSpyInfiltrate();\n\n\tvirtual ~CTFBotSpyInfiltrate();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual void OnEnd(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> OnSuspend(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryCaptured(CTFBot *actor, int i1) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryLost(CTFBot *actor, int i1) override;\n\n\t\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n\n\t\n", "file_path": "mvm-reversed/server/tf/bot/behavior/spy/tf_bot_spy_infiltrate.h", "rank": 53, "score": 77449.90284324993 }, { "content": "// sizeof: 0x4854\n\nclass CTFBotSpyAttack : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotSpyAttack(CTFPlayer *victim);\n\n\tvirtual ~CTFBotSpyAttack();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnContact(CTFBot *actor, CBaseEntity *ent, CGameTrace *trace) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnInjured(CTFBot *actor, const CTakeDamageInfo& info) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldRetreat(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n\n\tvirtual QueryResponse IsHindrance(const INextBot *nextbot, CBaseEntity *it) const override;\n\n\tvirtual const CKnownEntity *SelectMoreDangerousThreat(const INextBot *nextbot, const CBaseCombatCharacter *them, const CKnownEntity *threat1, const CKnownEntity *threat2) const override;\n\n\t\n\nprivate:\n\n\tCHandle<CTFPlayer> m_hVictim; // +0x0034\n\n\tChasePath m_ChasePath; // +0x0038\n\n\t// 4838 bool\n\n\t// 483c CountdownTimer\n\n\t// 4848 CountdownTimer\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/spy/tf_bot_spy_attack.h", "rank": 54, "score": 77449.90284324993 }, { "content": "// sizeof: 0x4870\n\nclass CTFBotEngineerBuilding : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotEngineerBuilding();\n\n\tCTFBotEngineerBuilding(CTFBotHintSentrygun *hint);\n\n\tvirtual ~CTFBotEngineerBuilding();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual void OnEnd(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryCaptured(CTFBot *actor, int i1) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryLost(CTFBot *actor, int i1) override;\n\n\t\n\nprivate:\n\n\tbool CheckIfSentryIsOutOfPosition(CTFBot *actor) const;\n\n\tbool IsMetalSourceNearby(CTFBot *actor) const;\n", "file_path": "mvm-reversed/server/tf/bot/behavior/engineer/tf_bot_engineer_building.h", "rank": 55, "score": 77449.90284324993 }, { "content": "class Action : public INextBotEventResponder, public IContextualQuery\n\n{\n\npublic:\n\n\tAction();\n\n\tvirtual ~Action();\n\n\t\n\n\t/* INextBotEventResponder overrides */\n\n\tvirtual INextBotEventResponder *FirstContainedResponder() const override final;\n\n\tvirtual INextBotEventResponder *NextContainedResponder(INextBotEventResponder *prev) const override final;\n\n\t\n\n\tvirtual void OnLeaveGround(CBaseEntity *ent) override final;\n\n\tvirtual void OnLandOnGround(CBaseEntity *ent) override final;\n\n\t\n\n\tvirtual void OnContact(CBaseEntity *ent, CGameTrace *trace) override final;\n\n\t\n\n\tvirtual void OnMoveToSuccess(const Path *path) override final;\n\n\tvirtual void OnMoveToFailure(const Path *path, MoveToFailureType fail) override final;\n\n\t\n\n\tvirtual void OnStuck() override final;\n\n\tvirtual void OnUnStuck() override final;\n", "file_path": "mvm-reversed/server/NextBot/NextBotBehavior.h", "rank": 56, "score": 76697.06701806307 }, { "content": "// sizeof: 0x482c\n\nclass CTFBotDestroyEnemySentry : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotDestroyEnemySentry();\n\n\tvirtual ~CTFBotDestroyEnemySentry();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldRetreat(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n\n\t\n\n\tstatic bool IsPossible(CTFBot *actor);\n\n\t\n\nprivate:\n\n\tvoid ComputeCornerAttackSpot(CTFBot *actor);\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_destroy_enemy_sentry.h", "rank": 57, "score": 76606.71716809095 }, { "content": "// sizeof: 0x481c\n\nclass CTFBotMoveToVantagePoint : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotMoveToVantagePoint(float max_cost);\n\n\tvirtual ~CTFBotMoveToVantagePoint();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToSuccess(CTFBot *actor, const Path *path) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\t\n\nprivate:\n\n\tfloat m_flMaxCost; // +0x0034\n\n\tPathFollower m_PathFollower; // +0x0038\n\n\tCountdownTimer m_ctRecomputePath; // +0x480c\n\n\tCTFNavArea *m_VantagePoint; // +0x4818\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_move_to_vantage_point.h", "rank": 58, "score": 76606.71716809095 }, { "content": "// sizeof: 0x4820\n\nclass CTFBotPayloadBlock : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotPayloadBlock();\n\n\tvirtual ~CTFBotPayloadBlock();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToSuccess(CTFBot *actor, const Path *path) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryContested(CTFBot *actor, int i1) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryCaptured(CTFBot *actor, int i1) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryLost(CTFBot *actor, int i1) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldRetreat(const INextBot *nextbot) const override;\n\n\t\n\nprivate:\n\n\tPathFollower m_PathFollower; // +0x0034\n\n\tCountdownTimer m_ctRecomputePath; // +0x4808\n\n\tCountdownTimer m_ctBlockDuration; // +0x4814\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/scenario/payload/tf_bot_payload_block.h", "rank": 59, "score": 76606.71716809095 }, { "content": "// sizeof: 0x4838\n\nclass CTFBotPayloadGuard : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotPayloadGuard();\n\n\tvirtual ~CTFBotPayloadGuard();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToSuccess(CTFBot *actor, const Path *path) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryContested(CTFBot *actor, int i1) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryCaptured(CTFBot *actor, int i1) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryLost(CTFBot *actor, int i1) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n", "file_path": "mvm-reversed/server/tf/bot/behavior/scenario/payload/tf_bot_payload_guard.h", "rank": 60, "score": 76606.71716809095 }, { "content": "// sizeof: 0x4818\n\nclass CTFBotPayloadPush : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotPayloadPush();\n\n\tvirtual ~CTFBotPayloadPush();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToSuccess(CTFBot *actor, const Path *path) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldRetreat(const INextBot *nextbot) const override;\n\n\t\n\nprivate:\n\n\tPathFollower m_PathFollower; // +0x0034\n\n\tCountdownTimer m_ctRecomputePath; // +0x4808\n\n\t// 4814 float\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/scenario/payload/tf_bot_payload_push.h", "rank": 61, "score": 76606.71716809095 }, { "content": "// sizeof: 0x4850\n\nclass CTFBotMissionSuicideBomber : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotMissionSuicideBomber();\n\n\tvirtual ~CTFBotMissionSuicideBomber();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual void OnEnd(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnKilled(CTFBot *actor, const CTakeDamageInfo& info) override;\n\n\t\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n\n\t\n\nprivate:\n\n\tvoid StartDetonate(CTFBot *actor, bool reached_goal, bool lost_all_health);\n\n\tvoid Detonate(CTFBot *actor);\n", "file_path": "mvm-reversed/server/tf/bot/behavior/missions/tf_bot_mission_suicide_bomber.h", "rank": 62, "score": 75798.86828475393 }, { "content": "// sizeof: 0x4814\n\nclass CTFBotFetchFlag : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotFetchFlag(bool give_up_when_done);\n\n\tvirtual ~CTFBotFetchFlag();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldRetreat(const INextBot *nextbot) const override;\n\n\t\n\nprivate:\n\n\tbool m_bGiveUpWhenDone; // +0x0032\n\n\tPathFollower m_PathFollower; // +0x0034\n\n\tCountdownTimer m_ctRecomputePath; // +0x4808\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/scenario/capture_the_flag/tf_bot_fetch_flag.h", "rank": 63, "score": 75798.86828475393 }, { "content": "// sizeof: 0x4c\n\nclass CTFBotMvMDeployBomb : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotMvMDeployBomb();\n\n\tvirtual ~CTFBotMvMDeployBomb();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual void OnEnd(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnContact(CTFBot *actor, CBaseEntity *ent, CGameTrace *trace) override;\n\n\t\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n\n\t\n\nprivate:\n\n\tCountdownTimer m_ctDelay; // +0x34\n\n\t// 40 Vector\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_mvm_deploy_bomb.h", "rank": 64, "score": 75798.86828475393 }, { "content": "// sizeof: TODO (>=0x38)\n\nclass CTFBotMissionDestroySentries : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotMissionDestroySentries(CObjectSentrygun *sentry);\n\n\tvirtual ~CTFBotMissionDestroySentries();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual void OnEnd(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\nprivate:\n\n\tCObjectSentrygun *SelectSentryTarget(CTFBot *actor);\n\n\t\n\n\tCHandle<CObjectSentrygun> m_hSentry; // +0x34\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/missions/tf_bot_mission_destroy_sentries.h", "rank": 65, "score": 75798.86828475393 }, { "content": "// sizeof: 0x4814\n\nclass CTFBotCapturePoint : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotCapturePoint();\n\n\tvirtual ~CTFBotCapturePoint();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToSuccess(CTFBot *actor, const Path *path) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryContested(CTFBot *actor, int i1) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryCaptured(CTFBot *actor, int i1) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryLost(CTFBot *actor, int i1) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldRetreat(const INextBot *nextbot) const override;\n\n\t\n\nprivate:\n\n\tPathFollower m_PathFollower; // +0x0034\n\n\tCountdownTimer m_ctRecomputePath; // +0x4808\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/scenario/capture_point/tf_bot_capture_point.h", "rank": 66, "score": 75798.86828475393 }, { "content": "// sizeof: 0x58\n\nclass CTFBotPrepareStickybombTrap : public Action<CTFBot>\n\n{\n\npublic:\n\n\tstruct BombTargetArea\n\n\t{\n\n\t\tCTFNavArea *area;\n\n\t\tint stickies;\n\n\t};\n\n\t\n\n\tCTFBotPrepareStickybombTrap();\n\n\tvirtual ~CTFBotPrepareStickybombTrap();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual void OnEnd(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> OnSuspend(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnInjured(CTFBot *actor, const CTakeDamageInfo& info) override;\n", "file_path": "mvm-reversed/server/tf/bot/behavior/demoman/tf_bot_prepare_stickybomb_trap.h", "rank": 67, "score": 75798.86828475393 }, { "content": "// sizeof: 0x4848\n\nclass CTFBotEngineerMoveToBuild : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotEngineerMoveToBuild();\n\n\tvirtual ~CTFBotEngineerMoveToBuild();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToSuccess(CTFBot *actor, const Path *path) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryLost(CTFBot *actor, int i1) override;\n\n\t\n\nprivate:\n\n\tvoid CollectBuildAreas(CTFBot *actor);\n\n\tvoid SelectBuildLocation(CTFBot *actor);\n\n\t\n", "file_path": "mvm-reversed/server/tf/bot/behavior/engineer/tf_bot_engineer_move_to_build.h", "rank": 68, "score": 75798.86828475393 }, { "content": "// sizeof: 0x4830\n\nclass CTFBotEngineerBuildDispenser : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotEngineerBuildDispenser();\n\n\tvirtual ~CTFBotEngineerBuildDispenser();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual void OnEnd(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\nprivate:\n\n\t// 0034 CountdownTimer\n\n\t// 0040 CountdownTimer\n\n\tCountdownTimer m_ctRecomputePath; // +0x004c\n\n\t// 0058 int\n\n\tPathFollower m_PathFollower; // +0x005c\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/engineer/tf_bot_engineer_build_dispenser.h", "rank": 69, "score": 75798.86828475393 }, { "content": "// sizeof: 0x4834\n\nclass CTFBotDeliverFlag : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotDeliverFlag();\n\n\tvirtual ~CTFBotDeliverFlag();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual void OnEnd(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnContact(CTFBot *actor, CBaseEntity *ent, CGameTrace *trace) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldRetreat(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n\n\t\n\nprivate:\n\n\tbool UpgradeOverTime(CTFBot *actor);\n\n\t\n\n\tPathFollower m_PathFollower; // +0x0034\n\n\tCountdownTimer m_ctRecomputePath; // +0x4808\n\n\t// 4814 float\n\n\t// 4818 CountdownTimer\n\n\t// 4824 int\n\n\t// 4828 CountdownTimer\n\n};\n\n\n\n\n", "file_path": "mvm-reversed/server/tf/bot/behavior/scenario/capture_the_flag/tf_bot_deliver_flag.h", "rank": 70, "score": 75798.86828475393 }, { "content": "// sizeof: 0x4818\n\nclass CTFBotUberAttackEnemySentry : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotUberAttackEnemySentry(CObjectSentrygun *sentry);\n\n\tvirtual ~CTFBotUberAttackEnemySentry();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual void OnEnd(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldRetreat(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n\n\t\n\nprivate:\n\n\tbool m_bSavedIgnoreEnemies; // +0x0032\n\n\tPathFollower m_PathFollower; // +0x0034\n\n\tCountdownTimer m_ctRecomputePath; // +0x4808\n\n\tCHandle<CObjectSentrygun> m_hSentry; // +0x4814\n\n};\n\n\n\n\n", "file_path": "mvm-reversed/server/tf/bot/behavior/tf_bot_destroy_enemy_sentry.h", "rank": 71, "score": 75798.86828475393 }, { "content": "// sizeof: 0x9034\n\nclass CTFBotDefendPoint : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotDefendPoint();\n\n\tvirtual ~CTFBotDefendPoint();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnContact(CTFBot *actor, CBaseEntity *ent, CGameTrace *trace) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToSuccess(CTFBot *actor, const Path *path) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryContested(CTFBot *actor, int i1) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryCaptured(CTFBot *actor, int i1) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryLost(CTFBot *actor, int i1) override;\n\n\t\n", "file_path": "mvm-reversed/server/tf/bot/behavior/scenario/capture_point/tf_bot_defend_point.h", "rank": 72, "score": 75798.86828475393 }, { "content": "// sizeof: 0x905c\n\nclass CTFBotEscortSquadLeader : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotEscortSquadLeader(Action<CTFBot *> *done_action);\n\n\tvirtual ~CTFBotEscortSquadLeader();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual void OnEnd(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\nprivate:\n\n\tAction<CTFBot *> *m_DoneAction; // +0x0034\n\n\tCTFBotMeleeAttack m_MeleeAttack; // +0x0038\n\n\tPathFollower m_PathFollower; // +0x4870\n\n\tCountdownTimer m_ctRecomputePath; // +0x9044\n\n\tVector m_vecLeaderGoalDirection; // +0x9050\n\n};\n\n\n\n\n", "file_path": "mvm-reversed/server/tf/bot/behavior/squad/tf_bot_escort_squad_leader.h", "rank": 73, "score": 75798.86828475393 }, { "content": "// sizeof: 0x40\n\nclass CTFBotWaitForOutOfPositionSquadMember : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotWaitForOutOfPositionSquadMember();\n\n\tvirtual ~CTFBotWaitForOutOfPositionSquadMember();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\nprivate:\n\n\tCountdownTimer m_ctTimeout; // +0x34\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/squad/tf_bot_escort_squad_leader.h", "rank": 74, "score": 75024.18040834414 }, { "content": "// sizeof: 0x44\n\nclass CTFBotNavEntWait : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotNavEntWait(const CFuncNavPrerequisite *prereq);\n\n\tvirtual ~CTFBotNavEntWait();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\nprivate:\n\n\tCHandle<CFuncNavPrerequisite> m_hPrereq; // +0x34\n\n\tCountdownTimer m_ctWait; // +0x38\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/nav_entities/tf_bot_nav_ent_wait.h", "rank": 75, "score": 75024.18040834414 }, { "content": "// sizeof: 0x486c\n\nclass CTFBotEngineerBuildSentryGun : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotEngineerBuildSentryGun();\n\n\tCTFBotEngineerBuildSentryGun(CTFBotHintSentrygun *hint);\n\n\tvirtual ~CTFBotEngineerBuildSentryGun();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\nprivate:\n\n\t// 0034 CountdownTimer\n\n\t// 0040 CountdownTimer\n\n\t// 004c CountdownTimer\n\n\tCountdownTimer m_ctRecomputePath; // +0x0058\n\n\t// 0064 CountdownTimer\n\n\t// 0070 int\n\n\tPathFollower m_PathFollower; // +0x0074\n\n\tCTFBotHintSentrygun *m_pHint; // +0x4848\n\n\tVector m_vecTarget; // +0x484c\n\n\t// 4858 int\n\n\t// 485c bool\n\n\t// 4860 \n\n\t// 4864 \n\n\t// 4868 \n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/engineer/tf_bot_engineer_build_sentrygun.h", "rank": 76, "score": 75024.18040834414 }, { "content": "// sizeof: 0x4834\n\nclass CTFBotNavEntMoveTo : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotNavEntMoveTo(const CFuncNavPrerequisite *prereq);\n\n\tvirtual ~CTFBotNavEntMoveTo();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\nprivate:\n\n\tCHandle<CFuncNavPrerequisite> m_hPrereq; // +0x0034\n\n\tVector m_vecGoalPos; // +0x0038\n\n\tCNavArea *m_GoalArea; // +0x0044\n\n\tCountdownTimer m_ctWaitDuration; // +0x0048\n\n\tPathFollower m_PathFollower; // +0x0054\n\n\tCountdownTimer m_ctRecomputePath; // +0x4828\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/nav_entities/tf_bot_nav_ent_move_to.h", "rank": 77, "score": 75024.18040834414 }, { "content": "// sizeof: 0x4818\n\nclass CTFBotPushToCapturePoint : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotPushToCapturePoint(Action<CTFBot> *done_action);\n\n\tvirtual ~CTFBotPushToCapturePoint();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnNavAreaChanged(CTFBot *actor, CNavArea *area1, CNavArea *area2) override;\n\n\t\n\nprivate:\n\n\tPathFollower m_PathFollower; // +0x0034\n\n\tCountdownTimer m_ctRecomputePath; // +0x4808\n\n\tAction<CTFBot> *m_DoneAction; // +0x4814\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/scenario/capture_the_flag/tf_bot_deliver_flag.h", "rank": 78, "score": 75024.18040834414 }, { "content": "// sizeof: 0x4808\n\nclass CTFBotEngineerBuildTeleportEntrance : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotEngineerBuildTeleportEntrance();\n\n\tvirtual ~CTFBotEngineerBuildTeleportEntrance();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\t\n\nprivate:\n\n\tPathFollower m_PathFollower; // +0x0034\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/engineer/tf_bot_engineer_build_teleport_entrance.h", "rank": 79, "score": 74280.65278707247 }, { "content": "// sizeof: 0x904c\n\nclass CTFBotEscortFlagCarrier : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotEscortFlagCarrier();\n\n\tvirtual ~CTFBotEscortFlagCarrier();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\nprivate:\n\n\tPathFollower m_PathFollower; // +0x0034\n\n\tCountdownTimer m_ctRecomputePath; // +0x4808\n\n\tCTFBotMeleeAttack m_MeleeAttack; // +0x4814\n\n};\n\n\n\n\n\nint GetBotEscortCount(int teamnum);\n", "file_path": "mvm-reversed/server/tf/bot/behavior/scenario/capture_the_flag/tf_bot_escort_flag_carrier.h", "rank": 80, "score": 74280.65278707247 }, { "content": "// sizeof: 0x484c\n\nclass CTFBotEngineerBuildTeleportExit : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotEngineerBuildTeleportExit();\n\n\tCTFBotEngineerBuildTeleportExit(const Vector& v1, float f1);\n\n\tvirtual ~CTFBotEngineerBuildTeleportExit();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\t\n\nprivate:\n\n\tPathFollower m_PathFollower; // +0x0034\n\n\t// 4808 bool\n\n\t// 480c Vector\n\n\t// 4818 float\n\n\t// 481c CountdownTimer\n\n\t// 4828 CountdownTimer\n\n\t// 4834 CountdownTimer\n\n\t// 4840 CountdownTimer\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/engineer/tf_bot_engineer_build_teleport_exit.h", "rank": 81, "score": 74280.65278707247 }, { "content": "// sizeof: 0x44\n\nclass CTFBotSpyLeaveSpawnRoom : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotSpyLeaveSpawnRoom();\n\n\tvirtual ~CTFBotSpyLeaveSpawnRoom();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n\n\t\n\nprivate:\n\n\tCountdownTimer m_ctTeleport; // +0x34\n\n\tint m_nDistance; // +0x40\n\n};\n\n\n\n\n\nbool TeleportNearVictim(CTFBot *spy, CTFPlayer *victim, int i1);\n", "file_path": "mvm-reversed/server/tf/bot/behavior/spy/tf_bot_spy_leave_spawn_room.h", "rank": 82, "score": 74280.65278707247 }, { "content": "// sizeof: 0x4868\n\nclass CTFBotMvMEngineerIdle : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotMvMEngineerIdle();\n\n\tvirtual ~CTFBotMvMEngineerIdle();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldRetreat(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldAttack(const INextBot *nextbot, const CKnownEntity *threat) const override;\n\n\t\n\nprivate:\n\n\tbool ShouldAdvanceNestSpot(CTFBot *actor);\n\n\tvoid TakeOverStaleNest(CBaseTFBotHintEntity *hint, CTFBot *actor);\n\n\tvoid TryToDetonateStaleNest();\n\n\t\n", "file_path": "mvm-reversed/server/tf/bot/behavior/engineer/mvm_engineer/tf_bot_mvm_engineer_idle.h", "rank": 83, "score": 73566.44244837384 }, { "content": "// sizeof: TODO (>=0x4819)\n\nclass CTFBotNavEntDestroyEntity : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotNavEntDestroyEntity(const CFuncNavPrerequisite *prereq);\n\n\tvirtual ~CTFBotNavEntDestroyEntity();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual void OnEnd(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\nprivate:\n\n\tvoid DetonateStickiesWhenSet(CTFBot *actor, CTFPipebombLauncher *launcher) const;\n\n\t\n\n\tCHandle<CFuncNavPrerequisite> m_hPrereq; // +0x0034\n\n\tPathFollower m_PathFollower; // +0x0038\n\n\tCountdownTimer m_ctRecomputePath; // +0x480c\n\n\t// 4818 bool\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/nav_entities/tf_bot_nav_ent_destroy_entity.h", "rank": 84, "score": 73566.44244837384 }, { "content": "// sizeof: 0x481c\n\nclass CTFBotDefendPointBlockCapture : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotDefendPointBlockCapture();\n\n\tvirtual ~CTFBotDefendPointBlockCapture();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual ActionResult<CTFBot> OnResume(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToSuccess(CTFBot *actor, const Path *path) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnMoveToFailure(CTFBot *actor, const Path *path, MoveToFailureType fail) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnStuck(CTFBot *actor) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryContested(CTFBot *actor, int i1) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryCaptured(CTFBot *actor, int i1) override;\n\n\tvirtual EventDesiredResult<CTFBot> OnTerritoryLost(CTFBot *actor, int i1) override;\n\n\t\n\n\tvirtual QueryResponse ShouldHurry(const INextBot *nextbot) const override;\n\n\tvirtual QueryResponse ShouldRetreat(const INextBot *nextbot) const override;\n\n\t\n\nprivate:\n\n\tbool IsPointSafe(CTFBot *actor);\n\n\t\n\n\tPathFollower m_PathFollower; // +0x0034\n\n\tCountdownTimer m_ctRecomputePath; // +0x4808\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/scenario/capture_point/tf_bot_defend_point_block_capture.h", "rank": 85, "score": 72879.84894652679 }, { "content": "class MemberVFuncThunk<const C *, RET, PARAMS...> : public MemberVFuncThunkBase\n\n{\n\npublic:\n\n\tusing RetType = RET;\n\n\tusing FPtr = RET (C::*)(PARAMS...) const;\n\n\t\n\n\tMemberVFuncThunk(const char *n_vtable, const char *n_func) :\n\n\t\tMemberVFuncThunkBase(n_vtable, n_func) {}\n\n\t\n\n\tinline RET operator()( C *obj, PARAMS... args) const = delete;\n\n\tinline RET operator()(const C *obj, PARAMS... args) const\n\n\t{\n\n\t\tint vt_index = this->GetVTableIndex();\n\n\t\t\n\n\t\tassert(vt_index != -1);\n\n\t\tassert(obj != nullptr);\n\n\t\t\n\n\t\tauto pVT = *reinterpret_cast<void **const *>(obj);\n\n\t\tFPtr pFunc = MakePtrToConstMemberFunc<C, RET, PARAMS...>(pVT[vt_index]);\n\n\t\treturn (obj->*pFunc)(args...);\n\n\t}\n\n};\n\n\n\n\n\ntemplate<typename T>\n", "file_path": "src/link/link.h", "rank": 86, "score": 72733.09247509246 }, { "content": "// sizeof: 0x48\n\nclass CTFBotMvMEngineerTeleportSpawn : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotMvMEngineerTeleportSpawn(CBaseTFBotHintEntity *hint, bool non_silent);\n\n\tvirtual ~CTFBotMvMEngineerTeleportSpawn();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\nprivate:\n\n\tCountdownTimer m_ctPushAway; // +0x34\n\n\tCHandle<CBaseTFBotHintEntity> m_hintEntity; // +0x40 (actual name)\n\n\tbool m_bNonSilent; // +0x44\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/engineer/mvm_engineer/tf_bot_mvm_engineer_teleport_spawn.h", "rank": 87, "score": 72219.30084603559 }, { "content": "// sizeof: 0x4828\n\nclass CTFBotMvMEngineerBuildSentryGun : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotMvMEngineerBuildSentryGun(CTFBotHintSentrygun *hint);\n\n\tvirtual ~CTFBotMvMEngineerBuildSentryGun();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\tvirtual void OnEnd(CTFBot *actor, Action<CTFBot> *action) override;\n\n\t\n\nprivate:\n\n\tCHandle<CTFBotHintSentrygun> m_hintEntity; // +0x0034\n\n\tCHandle<CObjectSentrygun> m_hSentry; // +0x0038\n\n\tCountdownTimer m_ctPushAway; // +0x003c\n\n\tCountdownTimer m_ctRecomputePath; // +0x0048\n\n\tPathFollower m_PathFollower; // +0x0054\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/engineer/mvm_engineer/tf_bot_mvm_engineer_build_sentry.h", "rank": 88, "score": 71583.34371460721 }, { "content": "// sizeof: 0x4824\n\nclass CTFBotMvMEngineerBuildTeleportExit : public Action<CTFBot>\n\n{\n\npublic:\n\n\tCTFBotMvMEngineerBuildTeleportExit(CTFBotHintTeleportExit *hint);\n\n\tvirtual ~CTFBotMvMEngineerBuildTeleportExit();\n\n\t\n\n\tvirtual const char *GetName() const override;\n\n\t\n\n\tvirtual ActionResult<CTFBot> OnStart(CTFBot *actor, Action<CTFBot> *action) override;\n\n\tvirtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override;\n\n\t\n\nprivate:\n\n\tCHandle<CTFBotHintTeleportExit> m_hintEntity; // +0x0034\n\n\tCountdownTimer m_ctPushAway; // +0x0038\n\n\tCountdownTimer m_ctRecomputePath; // +0x0044\n\n\tPathFollower m_PathFollower; // +0x0050\n\n};\n", "file_path": "mvm-reversed/server/tf/bot/behavior/engineer/mvm_engineer/tf_bot_mvm_engineer_build_teleporter.h", "rank": 89, "score": 71583.34371460721 }, { "content": "\t\t\t\t\t\t\t\t// what to do in case of error\n\nenum ANNerr {ANNwarn = 0, ANNabort = 1};\n\n\n\n//----------------------------------------------------------------------\n\n//\tMaximum number of points to visit\n\n//\tWe have an option for terminating the search early if the\n\n//\tnumber of points visited exceeds some threshold. If the\n\n//\tthreshold is 0 (its default) this means there is no limit\n\n//\tand the algorithm applies its normal termination condition.\n\n//----------------------------------------------------------------------\n\n\n\nextern int\t\tANNmaxPtsVisited;\t// maximum number of pts visited\n\nextern int\t\tANNptsVisited;\t\t// number of pts visited in search\n\n\n\n//----------------------------------------------------------------------\n\n//\tGlobal function declarations\n\n//----------------------------------------------------------------------\n\n\n\nvoid annError(\t\t\t\t\t// ANN error routine\n\n\tconst char*\t\tmsg,\t\t// error message\n\n\tANNerr\t\t\tlevel);\t\t// level of error\n", "file_path": "libs/ann/include/ANN/ANNx.h", "rank": 90, "score": 71291.04777789183 }, { "content": "class MemberFuncThunk<const C *, RET, PARAMS...> : public MemberFuncThunkBase//<C, RET, PARAMS...>\n\n{\n\npublic:\n\n\tusing FPtr = RET (C::*)(PARAMS...) const;\n\n\t\n\n\tMemberFuncThunk(const char *n_func) :\n\n\t\tMemberFuncThunkBase/*<C, RET, PARAMS...>*/(n_func) {}\n\n\t\n\n\tinline RET operator()( C *obj, PARAMS... args) const = delete;\n\n\tinline RET operator()(const C *obj, PARAMS... args) const\n\n\t{\n\n\t\tFPtr pFunc = MakePtrToConstMemberFunc<C, RET, PARAMS...>(this->GetFuncPtr());\n\n\t\t\n\n\t\tassert(pFunc != nullptr);\n\n\t\tassert(obj != nullptr);\n\n\t\t\n\n\t\treturn (obj->*pFunc)(args...);\n\n\t}\n\n};\n\n\n\n\n", "file_path": "src/link/link.h", "rank": 91, "score": 67070.22950066222 }, { "content": "\t\n\n\tvirtual bool\t\t\t\tIsRegistered( void ) const;\n\n\n\n\t// Returns the DLL identifier\n\n\tvirtual CVarDLLIdentifier_t\tGetDLLIdentifier() const;\n\n\n\nprotected:\n\n\tvirtual void\t\t\t\tCreateBase( const char *pName, const char *pHelpString = 0, \n\n\t\t\t\t\t\t\t\t\tint flags = 0 );\n\n\n\n\t// Used internally by OneTimeInit to initialize/shutdown\n\n\tvirtual void\t\t\t\tInit();\n\n\tvoid\t\t\t\t\t\tShutdown();\n\n\n\n\t// Internal copy routine ( uses new operator from correct module )\n\n\tchar\t\t\t\t\t\t*CopyString( const char *from );\n\n\n\nprivate:\n\n\t// Next ConVar in chain\n\n\t// Prior to register, it points to the next convar in the DLL.\n", "file_path": "src/sdk2013/convar.h", "rank": 92, "score": 60731.66688460907 }, { "content": "\tvoid SetValue( int nValue );\n\n\tvoid SetValue( bool bValue );\n\n\n\n\tconst char *GetName() const;\n\n\n\n\tconst char *GetDefault() const;\n\n\n\n\t// sigsegv: non-standard stuff added by me (DANGEROUS: USE WITH EXTREME CAUTION!)\n\n\tint& Ref_Flags() const { return m_pConVarState->m_pParent->m_nFlags; }\n\n\tfloat& Ref_FloatVal() const { return m_pConVarState->m_pParent->m_fValue; }\n\n\tint& Ref_IntVal() const { return m_pConVarState->m_pParent->m_nValue; }\n\n\tbool& Ref_HasMin() const { return m_pConVarState->m_pParent->m_bHasMin; }\n\n\tbool& Ref_HasMax() const { return m_pConVarState->m_pParent->m_bHasMax; }\n\n\tfloat& Ref_MinVal() const { return m_pConVarState->m_pParent->m_fMinVal; }\n\n\tfloat& Ref_MaxVal() const { return m_pConVarState->m_pParent->m_fMaxVal; }\n\n\n\nprivate:\n\n\t// High-speed method to read convar data\n\n\tIConVar *m_pConVar;\n\n\tConVar *m_pConVarState;\n", "file_path": "src/sdk2013/convar.h", "rank": 93, "score": 60730.59842849893 }, { "content": "\n\n\n\n//-----------------------------------------------------------------------------\n\n// Purpose: Return ConVar value as a float\n\n//-----------------------------------------------------------------------------\n\nFORCEINLINE_CVAR float ConVarRef::GetFloat( void ) const\n\n{\n\n\treturn m_pConVarState->m_fValue;\n\n}\n\n\n\n//-----------------------------------------------------------------------------\n\n// Purpose: Return ConVar value as an int\n\n//-----------------------------------------------------------------------------\n\nFORCEINLINE_CVAR int ConVarRef::GetInt( void ) const \n\n{\n\n\treturn m_pConVarState->m_nValue;\n\n}\n\n\n\n//-----------------------------------------------------------------------------\n\n// Purpose: Return ConVar value as a string, return \"\" for bogus string pointer, etc.\n", "file_path": "src/sdk2013/convar.h", "rank": 94, "score": 60729.26197973311 }, { "content": "\tconst char\t\t\t\t\t*m_pszDefaultValue;\n\n\t\n\n\t// Value\n\n\t// Dynamically allocated\n\n\tchar\t\t\t\t\t\t*m_pszString;\n\n\tint\t\t\t\t\t\t\tm_StringLength;\n\n\n\n\t// Values\n\n\tfloat\t\t\t\t\t\tm_fValue;\n\n\tint\t\t\t\t\t\t\tm_nValue;\n\n\n\n\t// Min/Max values\n\n\tbool\t\t\t\t\t\tm_bHasMin;\n\n\tfloat\t\t\t\t\t\tm_fMinVal;\n\n\tbool\t\t\t\t\t\tm_bHasMax;\n\n\tfloat\t\t\t\t\t\tm_fMaxVal;\n\n\t\n\n\tbool\t\t\t\t\t\tm_bHasCompMin;\n\n\tfloat\t\t\t\t\t\tm_fCompMinVal;\n\n\tbool\t\t\t\t\t\tm_bHasCompMax;\n", "file_path": "src/sdk2013/convar.h", "rank": 95, "score": 60729.119621879545 }, { "content": "\t\n\n\t// These just call into the IConCommandBaseAccessor to check flags and set the var (which ends up calling InternalSetValue).\n\n\tvirtual void\t\t\t\tSetValue( const char *value );\n\n\tvirtual void\t\t\t\tSetValue( float value );\n\n\tvirtual void\t\t\t\tSetValue( int value );\n\n\t\n\n\t// Reset to default value\n\n\tvoid\t\t\t\t\t\tRevert( void );\n\n\n\n\t// True if it has a min/max setting\n\n\tbool\t\t\t\t\t\tGetMin( float& minVal ) const;\n\n\tbool\t\t\t\t\t\tGetMax( float& maxVal ) const;\n\n\tconst char\t\t\t\t\t*GetDefault( void ) const;\n\n\tvoid\t\t\t\t\t\tSetDefault( const char *pszDefault );\n\n\n\nprivate:\n\n\t// Called by CCvar when the value of a var is changing.\n\n\tvirtual void\t\t\t\tInternalSetValue(const char *value);\n\n\t// For CVARs marked FCVAR_NEVER_AS_STRING\n\n\tvirtual void\t\t\t\tInternalSetFloatValue( float fNewValue, bool bForce = false );\n", "file_path": "src/sdk2013/convar.h", "rank": 96, "score": 60728.877646319525 }, { "content": "\tvirtual void\t\t\t\tInternalSetIntValue( int nValue );\n\n\n\n\tvirtual bool\t\t\t\tClampValue( float& value );\n\n\tvirtual void\t\t\t\tChangeStringValue( const char *tempVal, float flOldValue );\n\n\n\n\tvirtual void\t\t\t\tCreate( const char *pName, const char *pDefaultValue, int flags = 0,\n\n\t\t\t\t\t\t\t\t\tconst char *pHelpString = 0, bool bMin = false, float fMin = 0.0,\n\n\t\t\t\t\t\t\t\t\tbool bMax = false, float fMax = false, FnChangeCallback_t callback = 0 );\n\n\n\n\t// Used internally by OneTimeInit to initialize.\n\n\tvirtual void\t\t\t\tInit();\n\n\tint GetFlags() { return m_pParent->m_nFlags; }\n\nprivate:\n\n\n\n\t// This either points to \"this\" or it points to the original declaration of a ConVar.\n\n\t// This allows ConVars to exist in separate modules, and they all use the first one to be declared.\n\n\t// m_pParent->m_pParent must equal m_pParent (ie: m_pParent must be the root, or original, ConVar).\n\n\tConVar\t\t\t\t\t\t*m_pParent;\n\n\n\n\t// Static data\n", "file_path": "src/sdk2013/convar.h", "rank": 97, "score": 60728.32035556726 }, { "content": "\n\n//-----------------------------------------------------------------------------\n\n// Purpose: Return ConVar value as an int\n\n// Output : int\n\n//-----------------------------------------------------------------------------\n\nFORCEINLINE_CVAR int ConVar::GetInt( void ) const \n\n{\n\n\treturn m_pParent->m_nValue;\n\n}\n\n\n\n\n\n//-----------------------------------------------------------------------------\n\n// Purpose: Return ConVar value as a string, return \"\" for bogus string pointer, etc.\n\n// Output : const char *\n\n//-----------------------------------------------------------------------------\n\nFORCEINLINE_CVAR const char *ConVar::GetString( void ) const \n\n{\n\n\tif ( m_nFlags & FCVAR_NEVER_AS_STRING )\n\n\t\treturn \"FCVAR_NEVER_AS_STRING\";\n\n\n\n\treturn ( m_pParent->m_pszString ) ? m_pParent->m_pszString : \"\";\n\n}\n\n\n\n\n", "file_path": "src/sdk2013/convar.h", "rank": 98, "score": 60727.82709430324 }, { "content": "\tfloat\t\t\t\t\t\tm_fCompMaxVal;\n\n\tbool\t\t\t\t\t\tm_bCompetitiveRestrictions;\n\n\t\n\n\t// Call this function when ConVar changes\n\n\tFnChangeCallback_t\t\t\tm_fnChangeCallback;\n\n\t\n\n\tuint32_t __PAD_0x5c[0x1];\n\n};\n\n// sigsegv: sizeof(ConVar) is known to be >= 0x5C, as of TF2 20180626a\n\nstatic_assert(sizeof(ConVar) >= 0x5c);\n\n\n\n\n\n//-----------------------------------------------------------------------------\n\n// Purpose: Return ConVar value as a float\n\n// Output : float\n\n//-----------------------------------------------------------------------------\n\nFORCEINLINE_CVAR float ConVar::GetFloat( void ) const\n\n{\n\n\treturn m_pParent->m_fValue;\n\n}\n", "file_path": "src/sdk2013/convar.h", "rank": 99, "score": 60727.53213790214 } ]
C++
copasi/UI/CQReportDM.cpp
bmoreau/COPASI
d0bbec8947b1266ffd2b0ecf2566da7cf2c3e5ba
#include <QtCore/QString> #include <QtCore/QList> #include "CopasiDataModel/CCopasiDataModel.h" #include "report/CCopasiRootContainer.h" #include "report/CReportDefinition.h" #include "report/CReportDefinitionVector.h" #include "CQMessageBox.h" #include "CQReportDM.h" #include "qtUtilities.h" CQReportDM::CQReportDM(QObject *parent) : CQBaseDataModel(parent) { } int CQReportDM::rowCount(const QModelIndex& C_UNUSED(parent)) const { return (int)(*CCopasiRootContainer::getDatamodelList())[0]->getReportDefinitionList()->size() + 1; } int CQReportDM::columnCount(const QModelIndex& C_UNUSED(parent)) const { return TOTAL_COLS_REPORTS; } Qt::ItemFlags CQReportDM::flags(const QModelIndex &index) const { if (!index.isValid()) return Qt::ItemIsEnabled; if (index.column() == COL_NAME_REPORTS) return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; else return QAbstractItemModel::flags(index); } QVariant CQReportDM::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); if (index.row() >= rowCount()) return QVariant(); if (index.column() > 0 && role == Qt::ForegroundRole && !(flags(index) & Qt::ItemIsEditable)) return QColor(Qt::darkGray); if (role == Qt::DisplayRole || role == Qt::EditRole) { if (isDefaultRow(index)) { switch (index.column()) { case COL_ROW_NUMBER: return QVariant(QString("")); case COL_NAME_REPORTS: return QVariant(QString("New Report")); default: return QVariant(QString("")); } } else { CReportDefinition *pRepDef = (*CCopasiRootContainer::getDatamodelList())[0]->getReportDefinitionList()->operator[](index.row()); switch (index.column()) { case COL_ROW_NUMBER: return QVariant(index.row() + 1); case COL_NAME_REPORTS: return QVariant(QString(FROM_UTF8(pRepDef->getObjectName()))); } } } return QVariant(); } QVariant CQReportDM::headerData(int section, Qt::Orientation orientation, int role) const { if (role != Qt::DisplayRole) return QVariant(); if (orientation == Qt::Horizontal) { switch (section) { case COL_ROW_NUMBER: return QVariant(QString("#")); case COL_NAME_REPORTS: return QVariant(QString("Name")); default: return QVariant(); } } else return QString("%1").arg(section + 1); } bool CQReportDM::setData(const QModelIndex &index, const QVariant &value, int role) { if (index.isValid() && role == Qt::EditRole) { bool defaultRow = isDefaultRow(index); if (defaultRow) { if (index.data() != value) insertRow(); else return false; } CReportDefinition *pRepDef = (*CCopasiRootContainer::getDatamodelList())[0]->getReportDefinitionList()->operator[](index.row()); if (index.column() == COL_NAME_REPORTS) pRepDef->setObjectName(TO_UTF8(value.toString())); if (defaultRow && this->index(index.row(), COL_NAME_REPORTS).data().toString() == "report") pRepDef->setObjectName(TO_UTF8(createNewName("report", COL_NAME_REPORTS))); emit dataChanged(index, index); emit notifyGUI(ListViews::REPORT, ListViews::CHANGE, pRepDef->getKey()); } return true; } bool CQReportDM::insertRows(int position, int rows, const QModelIndex&) { beginInsertRows(QModelIndex(), position, position + rows - 1); for (int row = 0; row < rows; ++row) { CReportDefinition *pRepDef = (*CCopasiRootContainer::getDatamodelList())[0]->getReportDefinitionList()->createReportDefinition(TO_UTF8(createNewName("report", COL_NAME_REPORTS)), ""); emit notifyGUI(ListViews::REPORT, ListViews::ADD, pRepDef->getKey()); } endInsertRows(); return true; } bool CQReportDM::removeRows(int position, int rows, const QModelIndex&) { if (rows <= 0) return true; CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0]; if (pDataModel == NULL) return false; CCopasiVector< CReportDefinition > * pReportList = pDataModel->getReportDefinitionList(); if (pReportList == NULL) return false; beginRemoveRows(QModelIndex(), position, position + rows - 1); for (int row = 0; row < rows; ++row) { CReportDefinition * pReport = (*pReportList)[position]; if (pReport == NULL) continue; std::set< const CCopasiObject * > Tasks; std::set< const CCopasiObject * > DeletedObjects; DeletedObjects.insert(pReport); if (pDataModel->appendDependentTasks(DeletedObjects, Tasks)) { std::set< const CCopasiObject * >::iterator it = Tasks.begin(); std::set< const CCopasiObject * >::iterator end = Tasks.end(); for (; it != end; ++it) { const CCopasiTask * pTask = static_cast< const CCopasiTask *>(*it); const_cast< CCopasiTask * >(pTask)->getReport().setReportDefinition(NULL); } } std::string deletedKey = pReport->getKey(); pReportList->remove(pReport); emit notifyGUI(ListViews::REPORT, ListViews::DELETE, deletedKey); } endRemoveRows(); return true; } bool CQReportDM::removeRows(QModelIndexList rows, const QModelIndex&) { if (rows.isEmpty()) return false; CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0]; assert(pDataModel != NULL); CCopasiVector< CReportDefinition > * pReportList = pDataModel->getReportDefinitionList(); if (pReportList == NULL) return false; QList< CReportDefinition * > Reports; QModelIndexList::const_iterator i; for (i = rows.begin(); i != rows.end(); ++i) { if (!isDefaultRow(*i) && (*pReportList)[(*i).row()]) Reports.append((*pReportList)[(*i).row()]); } QList< CReportDefinition * >::const_iterator j; for (j = Reports.begin(); j != Reports.end(); ++j) { CReportDefinition * pReport = *j; size_t delRow = pReportList->getIndex(pReport); if (delRow != C_INVALID_INDEX) { std::set< const CCopasiObject * > DeletedObjects; DeletedObjects.insert(pReport); QMessageBox::StandardButton choice = CQMessageBox::confirmDelete(NULL, "report", FROM_UTF8(pReport->getObjectName()), DeletedObjects); if (choice == QMessageBox::Ok) { removeRow((int) delRow); } } } return true; }
#include <QtCore/QString> #include <QtCore/QList> #include "CopasiDataModel/CCopasiDataModel.h" #include "report/CCopasiRootContainer.h" #include "report/CReportDefinition.h" #include "report/CReportDefinitionVector.h" #include "CQMessageBox.h" #include "CQReportDM.h" #include "qtUtilities.h" CQReportDM::CQReportDM(QObject *parent) : CQBaseDataModel(parent) { } int CQReportDM::rowCount(const QModelIndex& C_UNUSED(parent)) const { return (int)(*CCopasiRootContainer::getDatamodelList())[0]->getReportDefinitionList()->size() + 1; } int CQReportDM::columnCount(const QModelIndex& C_UNUSED(parent)) const { return TOTAL_COLS_REPORTS; } Qt::ItemFlags CQReportDM::flags(const QModelIndex &index) const { if (!index.isValid()) return Qt::ItemIsEnabled;
} QVariant CQReportDM::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); if (index.row() >= rowCount()) return QVariant(); if (index.column() > 0 && role == Qt::ForegroundRole && !(flags(index) & Qt::ItemIsEditable)) return QColor(Qt::darkGray); if (role == Qt::DisplayRole || role == Qt::EditRole) { if (isDefaultRow(index)) { switch (index.column()) { case COL_ROW_NUMBER: return QVariant(QString("")); case COL_NAME_REPORTS: return QVariant(QString("New Report")); default: return QVariant(QString("")); } } else { CReportDefinition *pRepDef = (*CCopasiRootContainer::getDatamodelList())[0]->getReportDefinitionList()->operator[](index.row()); switch (index.column()) { case COL_ROW_NUMBER: return QVariant(index.row() + 1); case COL_NAME_REPORTS: return QVariant(QString(FROM_UTF8(pRepDef->getObjectName()))); } } } return QVariant(); } QVariant CQReportDM::headerData(int section, Qt::Orientation orientation, int role) const { if (role != Qt::DisplayRole) return QVariant(); if (orientation == Qt::Horizontal) { switch (section) { case COL_ROW_NUMBER: return QVariant(QString("#")); case COL_NAME_REPORTS: return QVariant(QString("Name")); default: return QVariant(); } } else return QString("%1").arg(section + 1); } bool CQReportDM::setData(const QModelIndex &index, const QVariant &value, int role) { if (index.isValid() && role == Qt::EditRole) { bool defaultRow = isDefaultRow(index); if (defaultRow) { if (index.data() != value) insertRow(); else return false; } CReportDefinition *pRepDef = (*CCopasiRootContainer::getDatamodelList())[0]->getReportDefinitionList()->operator[](index.row()); if (index.column() == COL_NAME_REPORTS) pRepDef->setObjectName(TO_UTF8(value.toString())); if (defaultRow && this->index(index.row(), COL_NAME_REPORTS).data().toString() == "report") pRepDef->setObjectName(TO_UTF8(createNewName("report", COL_NAME_REPORTS))); emit dataChanged(index, index); emit notifyGUI(ListViews::REPORT, ListViews::CHANGE, pRepDef->getKey()); } return true; } bool CQReportDM::insertRows(int position, int rows, const QModelIndex&) { beginInsertRows(QModelIndex(), position, position + rows - 1); for (int row = 0; row < rows; ++row) { CReportDefinition *pRepDef = (*CCopasiRootContainer::getDatamodelList())[0]->getReportDefinitionList()->createReportDefinition(TO_UTF8(createNewName("report", COL_NAME_REPORTS)), ""); emit notifyGUI(ListViews::REPORT, ListViews::ADD, pRepDef->getKey()); } endInsertRows(); return true; } bool CQReportDM::removeRows(int position, int rows, const QModelIndex&) { if (rows <= 0) return true; CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0]; if (pDataModel == NULL) return false; CCopasiVector< CReportDefinition > * pReportList = pDataModel->getReportDefinitionList(); if (pReportList == NULL) return false; beginRemoveRows(QModelIndex(), position, position + rows - 1); for (int row = 0; row < rows; ++row) { CReportDefinition * pReport = (*pReportList)[position]; if (pReport == NULL) continue; std::set< const CCopasiObject * > Tasks; std::set< const CCopasiObject * > DeletedObjects; DeletedObjects.insert(pReport); if (pDataModel->appendDependentTasks(DeletedObjects, Tasks)) { std::set< const CCopasiObject * >::iterator it = Tasks.begin(); std::set< const CCopasiObject * >::iterator end = Tasks.end(); for (; it != end; ++it) { const CCopasiTask * pTask = static_cast< const CCopasiTask *>(*it); const_cast< CCopasiTask * >(pTask)->getReport().setReportDefinition(NULL); } } std::string deletedKey = pReport->getKey(); pReportList->remove(pReport); emit notifyGUI(ListViews::REPORT, ListViews::DELETE, deletedKey); } endRemoveRows(); return true; } bool CQReportDM::removeRows(QModelIndexList rows, const QModelIndex&) { if (rows.isEmpty()) return false; CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0]; assert(pDataModel != NULL); CCopasiVector< CReportDefinition > * pReportList = pDataModel->getReportDefinitionList(); if (pReportList == NULL) return false; QList< CReportDefinition * > Reports; QModelIndexList::const_iterator i; for (i = rows.begin(); i != rows.end(); ++i) { if (!isDefaultRow(*i) && (*pReportList)[(*i).row()]) Reports.append((*pReportList)[(*i).row()]); } QList< CReportDefinition * >::const_iterator j; for (j = Reports.begin(); j != Reports.end(); ++j) { CReportDefinition * pReport = *j; size_t delRow = pReportList->getIndex(pReport); if (delRow != C_INVALID_INDEX) { std::set< const CCopasiObject * > DeletedObjects; DeletedObjects.insert(pReport); QMessageBox::StandardButton choice = CQMessageBox::confirmDelete(NULL, "report", FROM_UTF8(pReport->getObjectName()), DeletedObjects); if (choice == QMessageBox::Ok) { removeRow((int) delRow); } } } return true; }
if (index.column() == COL_NAME_REPORTS) return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; else return QAbstractItemModel::flags(index);
if_condition
[ { "content": "class FSwapClass : public FSwapBase<IndexType, ReturnType>\n\n{\n\nprotected:\n\n /**\n\n * Default constructor\n\n */\n\n FSwapClass():\n\n FSwapBase<IndexType, ReturnType>(),\n\n mpType(NULL),\n\n mpSwap(NULL)\n\n {}\n\n\n\npublic:\n\n /**\n\n * Specific constructor\n\n * @param ClassType * pType\n\n * @param ReturnType (ClassType::*swap) (IndexType, IndexType)\n\n */\n\n FSwapClass(ClassType * pType, ReturnType(ClassType::*swap)(IndexType, IndexType)):\n\n FSwapBase<IndexType, ReturnType>(),\n", "file_path": "copasi/utilities/CSort.h", "rank": 0, "score": 99502.75613264917 }, { "content": "", "file_path": "copasi/utilities/CIndexedPriorityQueue.h", "rank": 1, "score": 73391.65544743363 }, { "content": "", "file_path": "copasi/utilities/CIndexedPriorityQueue.h", "rank": 2, "score": 73391.65544743363 }, { "content": "#! /usr/bin/perl -w\n\n#\n\n# Virginia Bioinformatics Institute, Virginia Tech\n\n# Biochemical Networks Modeling Group\n\n# \n\n# This module written by Pedro Mendes, September 2002\n\n#\n\n# A-Biochem\n\n#\n\n# index.pl \n\n# This module creates an index page for the \n\n# networks in the current directory\n\n#\n\n\n\nuse POSIX;\n\n\n\n$counter = 0;\n\n\n\n$dirname=\"Dummy\";\n\n\n", "file_path": "copasi/ABiochem/index.pl", "rank": 3, "score": 67492.69609061987 }, { "content": "open( HTFILE, \">index.html\" );\n\n$strtime = localtime();\n\nprint( HTFILE \"<html>\\n<!-- Created by A-Biochem, $strtime -->\\n\");\n\nprint( HTFILE \"<head>\\n<style type=\\\"text/css\\\" media=\\\"all\\\">\\@import \\\"nets.css\\\";</style>\\n\");\n\nprint( HTFILE \"<title>$dirname data set - Artificial Gene Networks</title>\\n</head>\\n\");\n\n# write the HTML body\n\nprint( HTFILE \"<body>\\n\");\n\nprint( HTFILE \"<div id=\\\"topmenu\\\">\\n<center>\\n\");\n\nprint( HTFILE \"<a href=\\\"http://www.vbi.vt.edu/~mendes\\\">Biochemical Networks Modeling Group</a> |\\n\");\n\nprint( HTFILE \"<a href=\\\"..\\\">Artificial Gene Networks Home</a>\\n\");\n\nprint( HTFILE \"</center></div>\\n\");\n\nprint( HTFILE \"<div id=\\\"main\\\">\\n<center>\\n\");\n\nprint( HTFILE \"<h1>Artificial Gene Network Data Set $dirname</h1>\\n\");\n\nprint( HTFILE \"<h2>Statistics</h2>\\n<table>\\n\");\n\nwhile( defined($htmlfile = <*.html>) )\n\n{\n\n if ($htmlfile eq \"index.html\") {next;}\n\n\t$counter++;\n\n\t$name = $htmlfile;\n\n\t$name =~ s/\\.html//;\n\n print( HTFILE \"<tr><td><a href=\\\"$htmlfile\\\">$name</a></td></tr>\\n\");\n\n print \".\";\n\n}\n\nprint( HTFILE \"</table>\\n\");\n\nprint( HTFILE \"</center>\\n</div>\\n\");\n\nprint( HTFILE \"</body>\\n</html>\");\n\nclose( HTFILE );\n", "file_path": "copasi/ABiochem/index.pl", "rank": 4, "score": 67490.22069376973 }, { "content": "", "file_path": "copasi/utilities/CIndexedPriorityQueue.h", "rank": 5, "score": 63393.05343079698 }, { "content": "", "file_path": "copasi/utilities/CIndexedPriorityQueue.h", "rank": 6, "score": 63389.70157240231 }, { "content": "", "file_path": "copasi/utilities/CIndexedPriorityQueue.h", "rank": 7, "score": 63387.81781923366 }, { "content": "", "file_path": "copasi/utilities/CIndexedPriorityQueue.h", "rank": 8, "score": 63385.74099815014 }, { "content": "", "file_path": "copasi/utilities/CIndexedPriorityQueue.h", "rank": 9, "score": 63385.72179782857 }, { "content": "", "file_path": "copasi/utilities/CIndexedPriorityQueue.h", "rank": 10, "score": 63385.25296517495 }, { "content": "", "file_path": "copasi/utilities/CIndexedPriorityQueue.h", "rank": 11, "score": 63384.78555062707 }, { "content": "", "file_path": "copasi/utilities/CIndexedPriorityQueue.h", "rank": 12, "score": 63383.89733784318 }, { "content": "", "file_path": "copasi/utilities/CIndexedPriorityQueue.h", "rank": 13, "score": 63383.89733784318 }, { "content": "// All rights reserved.\n\n\n\n#include \"copasi.h\"\n\n#include \"CCopasiMessage.h\"\n\n#include \"CIndexedPriorityQueue.h\"\n\n\n\nCIndexedPriorityQueue::CIndexedPriorityQueue()\n\n{}\n\n\n\nCIndexedPriorityQueue::~CIndexedPriorityQueue()\n\n{}\n\n\n\nC_FLOAT64 CIndexedPriorityQueue::topKey() const\n\n{\n\n return mHeap[0].mKey;\n\n}\n\n\n\nsize_t CIndexedPriorityQueue::topIndex() const\n\n{\n\n return mHeap[0].mIndex;\n", "file_path": "copasi/utilities/CIndexedPriorityQueue.cpp", "rank": 14, "score": 61521.81452383346 }, { "content": "\n\n while ((pos > 0) && (mHeap[parent(pos)].mKey > key))\n\n {\n\n swapNodes(pos, parent(pos));\n\n pos = parent(pos);\n\n }\n\n\n\n return 0;\n\n}\n\n\n\n// juergen: added 26 July, 2002\n\nvoid CIndexedPriorityQueue::initializeIndexPointer(const size_t numberOfReactions)\n\n{\n\n size_t i;\n\n\n\n for (i = 0; i < numberOfReactions; i++)\n\n {\n\n mIndexPointer.push_back(C_INVALID_INDEX);\n\n }\n\n}\n", "file_path": "copasi/utilities/CIndexedPriorityQueue.cpp", "rank": 15, "score": 61521.3564352872 }, { "content": " if (highest_priority != current)\n\n {\n\n swapNodes(current, highest_priority);\n\n heapify(highest_priority);\n\n }\n\n}\n\n\n\nvoid CIndexedPriorityQueue::updateAux(const size_t pos)\n\n{\n\n size_t parent_pos = parent(pos);\n\n C_FLOAT64 keyval = mHeap[pos].mKey;\n\n\n\n if (parent_pos != C_INVALID_INDEX &&\n\n keyval < mHeap[parent_pos].mKey)\n\n {\n\n swapNodes(pos, parent_pos);\n\n updateAux(parent_pos);\n\n }\n\n else\n\n {\n", "file_path": "copasi/utilities/CIndexedPriorityQueue.cpp", "rank": 16, "score": 61520.48890959753 }, { "content": "\n\n for (int i = 0; i < count; i++)\n\n {\n\n cout << \"Queue: \";\n\n\n\n for (int j = 0; j < count; j++) cout << \" \" << j << \"-\" << pq[j];\n\n\n\n cout << endl;\n\n cout << \"Position: \" << i;\n\n cout << \" Index = \" << pq.topIndex();\n\n cout << \" Key = \" << pq.topKey() << endl;\n\n pq.updateNode(pq.topIndex(), 10000000);\n\n }\n\n\n\n return 0;\n\n}\n\n\n\n#endif // TEST_PRIORITY_QUEUE\n\n\n\nstd::ostream & operator<<(std::ostream &os, const PQNode & d)\n", "file_path": "copasi/utilities/CIndexedPriorityQueue.cpp", "rank": 17, "score": 61520.0720581807 }, { "content": " {\n\n // swapNodes(mHeap[pos].mIndex, min_pos);\n\n swapNodes(pos, min_pos);\n\n updateAux(min_pos);\n\n }\n\n }\n\n}\n\n\n\n#ifdef TEST_PRIORITY_QUEUE\n\n\n\nint main(int argc, char **argv)\n\n{\n\n // Generates a vector of pairs, with a size given by the first argument. Each element is added to a priority queue.\n\n if (argc != 2)\n\n {\n\n cout << \"Usage: \" << argv[0] << \" <number of pairs to generate>\" << endl;\n\n return - 1;\n\n }\n\n\n\n int count = atoi(argv[1]);\n", "file_path": "copasi/utilities/CIndexedPriorityQueue.cpp", "rank": 18, "score": 61517.77586721186 }, { "content": "\n\nsize_t CIndexedPriorityQueue::pushPair(const size_t index, const C_FLOAT64 key)\n\n{\n\n // Add an element to the priority queue. This merely pushes an item onto\n\n // the back of the vector corresponding to the heap, and pushes the index\n\n // onto the back of the vector corresponding to the index structure.\n\n // Implicit is the assumption that this is done in contiguous ascending order\n\n // for the index; i.e. in index order 0,1,2,3...\n\n // N.B. The structures are not yet ordered as an indexed priority queue; this must\n\n // be done using the buildHeap() method\n\n\n\n // First check that the index corresponds to the heap size before insertion\n\n if (static_cast<unsigned int>(index) != mHeap.size())\n\n {\n\n CCopasiMessage(CCopasiMessage::ERROR, \"Error inserting pair into priority queue\");\n\n return - 1;\n\n }\n\n\n\n PQNode heap_node(index, key);\n\n mHeap.push_back(heap_node);\n", "file_path": "copasi/utilities/CIndexedPriorityQueue.cpp", "rank": 19, "score": 61517.655662545796 }, { "content": " mIndexPointer[index2] = pos1;\n\n}\n\n\n\nvoid CIndexedPriorityQueue::heapify(const size_t current)\n\n{\n\n size_t left = leftChild(current);\n\n size_t right = rightChild(current);\n\n size_t highest_priority = current;\n\n\n\n // cout << \"Heapifying \" << current << \"(Currently \" << mHeap[current].mKey << \")\" << endl;\n\n if ((static_cast<unsigned int>(left) < mHeap.size()) && (mHeap[left].mKey < mHeap[current].mKey))\n\n {\n\n highest_priority = left;\n\n }\n\n\n\n if ((static_cast<unsigned int>(right) < mHeap.size()) && (mHeap[right].mKey < mHeap[highest_priority].mKey))\n\n {\n\n highest_priority = right;\n\n }\n\n\n", "file_path": "copasi/utilities/CIndexedPriorityQueue.cpp", "rank": 20, "score": 61517.588350284306 }, { "content": "}\n\n\n\n// juergen: added 26 July, 2002\n\nsize_t CIndexedPriorityQueue::removeStochReaction(const size_t index)\n\n{\n\n size_t t;\n\n\n\n // check if index is valid\n\n if (index >= mIndexPointer.size()) return C_INVALID_INDEX;\n\n\n\n if ((mIndexPointer[index] != C_INVALID_INDEX) && (mIndexPointer[index] != (mHeap.size() - 1))) // if the node with the given index exists in the tree\n\n {// remove the node with the given index from the tree\n\n swapNodes(t = mIndexPointer[index], mHeap.size() - 1);\n\n mHeap.pop_back();\n\n mIndexPointer[index] = -1;\n\n heapify(t);\n\n }\n\n else if (mIndexPointer[index] == (mHeap.size() - 1)) // last node in the heap\n\n {\n\n mHeap.pop_back();\n", "file_path": "copasi/utilities/CIndexedPriorityQueue.cpp", "rank": 21, "score": 61514.348339314216 }, { "content": " cout << \"Creating priority queue of size \" << count << endl;\n\n std::vector<C_FLOAT64> invec;\n\n CIndexedPriorityQueue pq;\n\n CRandom *rand = new CRandom(1);\n\n C_FLOAT64 rndval;\n\n cout << \"Input vector:\\n\";\n\n\n\n for (int i = 0; i < count; i++)\n\n {\n\n rndval = rand->getUniformRandom();\n\n invec.push_back(rndval);\n\n cout << \"element \" << i << \":\" << rndval << endl;\n\n pq.pushPair(i, invec[i]);\n\n }\n\n\n\n cout << \"Building heap\\n\";\n\n pq.buildHeap();\n\n cout << \"Done building heap\\n\";\n\n // Display the priority queue\n\n cout << \"\\nPriority Queue:\\n\";\n", "file_path": "copasi/utilities/CIndexedPriorityQueue.cpp", "rank": 22, "score": 61514.34242222452 }, { "content": " mIndexPointer[index] = -1;\n\n }\n\n\n\n return 0;\n\n}\n\n\n\n// juergen: added 26 July, 2002\n\nsize_t CIndexedPriorityQueue::insertStochReaction(const size_t index, const C_FLOAT64 key)\n\n{\n\n size_t pos;\n\n\n\n // check if index is valid\n\n if (index >= mIndexPointer.size()) return - 1;\n\n\n\n // first the node is inserted at the end of the heap\n\n mIndexPointer[index] = mHeap.size();\n\n PQNode heap_node(index, key);\n\n mHeap.push_back(heap_node);\n\n // bubble the node up the tree to the right position !\n\n pos = mIndexPointer[index];\n", "file_path": "copasi/utilities/CIndexedPriorityQueue.cpp", "rank": 23, "score": 61514.14128374926 }, { "content": " // at first, position == index\n\n size_t position = index; // for clarity\n\n mIndexPointer.push_back(position);\n\n return 0;\n\n}\n\n\n\nvoid CIndexedPriorityQueue::buildHeap()\n\n{\n\n for (size_t i = mHeap.size() / 2 - 1; i != C_INVALID_INDEX; i--)\n\n {\n\n heapify(i);\n\n }\n\n}\n\n\n\nvoid CIndexedPriorityQueue::clear()\n\n{mHeap.clear(); mIndexPointer.clear();}\n\n\n\nvoid CIndexedPriorityQueue::updateNode(const size_t index, const C_FLOAT64 new_key)\n\n{\n\n size_t pos = mIndexPointer[index];\n", "file_path": "copasi/utilities/CIndexedPriorityQueue.cpp", "rank": 24, "score": 61514.09303642114 }, { "content": "{\n\n os << \"(\" << d.mIndex << \", \" << d.mKey << \")\";\n\n return os;\n\n}\n\n\n\nstd::ostream & operator<<(std::ostream &os, const CIndexedPriorityQueue & d)\n\n{\n\n size_t i;\n\n\n\n os << \"PQ: \" << std::endl;\n\n\n\n std::vector <PQNode>::const_iterator it;\n\n os << \" mHeap: \" << std::endl;\n\n\n\n for (it = d.mHeap.begin(); it != d.mHeap.end(); it++)\n\n os << *it << std::endl;\n\n\n\n os << \" mIndexPointer: \" << std::endl;\n\n\n\n for (i = 0; i < d.mIndexPointer.size(); i++)\n\n os << d.mIndexPointer[i] << \" \";\n\n\n\n os << std::endl;\n\n\n\n os << std::endl;\n\n\n\n return os;\n\n}\n", "file_path": "copasi/utilities/CIndexedPriorityQueue.cpp", "rank": 25, "score": 61513.39032507099 }, { "content": " // cout << \"Setting heap at \" << pos << \" to be \" << new_key << endl;\n\n mHeap[pos].mKey = new_key;\n\n updateAux(pos);\n\n}\n\n\n\nvoid CIndexedPriorityQueue::swapNodes(const size_t pos1, const size_t pos2)\n\n{\n\n // cout << \"Swapping node \" << pos1 << \"(\" << mHeap[pos1].mKey << \") with node \";\n\n // cout << pos2 << \"(\" << mHeap[pos2].mKey << \")\\n\";\n\n C_FLOAT64 tempkey = mHeap[pos1].mKey;\n\n size_t index1 = mHeap[pos1].mIndex;\n\n size_t index2 = mHeap[pos2].mIndex;\n\n // Put the contents of the node at pos2 into the node at pos1\n\n mHeap[pos1].mIndex = index2;\n\n mHeap[pos1].mKey = mHeap[pos2].mKey;\n\n // Put the contents formerly in the node at pos1 into the node at pos2\n\n mHeap[pos2].mIndex = index1;\n\n mHeap[pos2].mKey = tempkey;\n\n // Swap the pointers in the index vector\n\n mIndexPointer[index1] = pos2;\n", "file_path": "copasi/utilities/CIndexedPriorityQueue.cpp", "rank": 26, "score": 61513.12544327091 }, { "content": "#else\n\n class const_iterator:\n\n public std::iterator< std::forward_iterator_tag, _Node, ptrdiff_t >\n\n#endif\n\n\n\n {\n\n private:\n\n /**\n\n * A pointer to the current node.\n\n */\n\n const _Node * mCurrent;\n\n\n\n public:\n\n /**\n\n * Default constructor.\n\n * Note: When no argument is given the iterator points to the end of\n\n * the tree.\n\n * @param Node * begin (default NULL)\n\n */\n\n const_iterator(const _Node * begin = NULL):\n\n mCurrent(begin)\n", "file_path": "copasi/utilities/CCopasiTree.h", "rank": 27, "score": 61511.402332547776 }, { "content": "// Begin CVS Header\n\n// $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/utilities/CIndexedPriorityQueue.cpp,v $\n\n// $Revision: 1.19 $\n\n// $Name: $\n\n// $Author: shoops $\n\n// $Date: 2011/03/07 19:34:55 $\n\n// End CVS Header\n\n\n\n// Copyright (C) 2011 - 2010 by Pedro Mendes, Virginia Tech Intellectual\n\n// Properties, Inc., University of Heidelberg, and The University\n\n// of Manchester.\n\n// All rights reserved.\n\n\n\n// Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual\n\n// Properties, Inc., EML Research, gGmbH, University of Heidelberg,\n\n// and The University of Manchester.\n\n// All rights reserved.\n\n\n\n// Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual\n\n// Properties, Inc. and EML Research, gGmbH.\n", "file_path": "copasi/utilities/CIndexedPriorityQueue.cpp", "rank": 28, "score": 61509.232572041365 }, { "content": " size_t left = leftChild(pos);\n\n size_t right = rightChild(pos);\n\n C_FLOAT64 min = 0.0;\n\n size_t min_pos = 0;\n\n\n\n if (left < mHeap.size())\n\n {\n\n min = mHeap[left].mKey;\n\n min_pos = left;\n\n }\n\n\n\n C_FLOAT64 val; // = mHeap[right].mKey; //!!!\n\n\n\n if ((right < mHeap.size()) && ((val = mHeap[right].mKey) < min))\n\n {\n\n min = val;\n\n min_pos = right;\n\n }\n\n\n\n if ((min_pos > 0) && (keyval > min))\n", "file_path": "copasi/utilities/CIndexedPriorityQueue.cpp", "rank": 29, "score": 61504.720349955576 }, { "content": "class CQValidatorInt;\n", "file_path": "copasi/UI/CQTSSAWidget.h", "rank": 30, "score": 61499.21493922358 }, { "content": "C_INT32 strToInt(const char * str,\n", "file_path": "copasi/utilities/utility.h", "rank": 31, "score": 59749.626769577335 }, { "content": "#else\n\n class const_row_iterator:\n\n public std::iterator< std::forward_iterator_tag, C_FLOAT64, ptrdiff_t >\n\n#endif\n\n\n\n {\n\n public:\n\n /**\n\n * Default constructor.\n\n */\n\n const_row_iterator(const CCompressedColumnFormat * pMatrix = NULL,\n\n const size_t & rowIndex = C_INVALID_INDEX);\n\n\n\n /**\n\n * Copy constructor\n\n * @param const iterator & src\n\n */\n\n const_row_iterator(const const_row_iterator & src);\n\n\n\n /**\n\n * Destructor\n", "file_path": "copasi/utilities/CSparseMatrix.h", "rank": 32, "score": 59746.53386865478 }, { "content": "", "file_path": "copasi/ABiochem/r250.c", "rank": 33, "score": 59740.04360369387 }, { "content": "", "file_path": "copasi/utilities/CIndexedPriorityQueue.h", "rank": 34, "score": 59740.04360369387 }, { "content": "class CQValidatorInt;\n", "file_path": "copasi/UI/CQTrajectoryWidget.h", "rank": 35, "score": 59734.69615271265 }, { "content": "unsigned C_INT32 strToUnsignedInt(const char * str,\n", "file_path": "copasi/utilities/utility.h", "rank": 36, "score": 58083.43675868006 }, { "content": "enum pageIndex {LISTVIEWPAGE = 0, SELECTEDITEMPAGE};\n\n\n", "file_path": "copasi/UI/ObjectBrowserWidget.h", "rank": 37, "score": 58073.80572872601 }, { "content": " class CIndex\n\n {\n\n friend class CZeroSet;\n\n\n\n // Operations\n\n public:\n\n CIndex(const size_t & index = 0);\n\n\n\n CIndex(const CIndex & src);\n\n\n\n ~CIndex();\n\n\n\n CIndex & operator ++ ();\n\n\n\n CIndex & operator = (const CIndex & rhs);\n\n\n\n CIndex & operator = (const size_t & index);\n\n\n\n bool operator < (const CIndex & rhs) const;\n\n\n", "file_path": "copasi/elementaryFluxModes/CZeroSet.h", "rank": 38, "score": 58073.80572872601 }, { "content": "class CIndexedPriorityQueue;\n", "file_path": "copasi/trajectory/CHybridMethod.h", "rank": 39, "score": 58073.80572872601 }, { "content": "class CIndexedPriorityQueue;\n", "file_path": "copasi/trajectory/CHybridMethodLSODA.h", "rank": 40, "score": 56497.99341248351 }, { "content": "class CIndexedPriorityQueue;\n", "file_path": "copasi/trajectory/CHybridMethodODE45.h", "rank": 41, "score": 56497.99341248351 }, { "content": "class CQValidatorInt;\n", "file_path": "copasi/UI/CQCrossSectionTaskWidget.h", "rank": 42, "score": 56492.936163909755 }, { "content": "#if (defined __GNUC__ && __GNUC__ < 3 && !defined __APPLE_CC__)\n\n class const_iterator: public std::forward_iterator< _Node, ptrdiff_t >\n", "file_path": "copasi/utilities/CCopasiTree.h", "rank": 43, "score": 52250.71691431715 }, { "content": "class CQIndexComboDelegate : public CQComboDelegate\n\n{\n\npublic:\n\n CQIndexComboDelegate(const QStringList *pComboItems,\n\n QObject *parent = NULL);\n\n\n\n virtual ~CQIndexComboDelegate();\n\n\n\n virtual void setModelData(QWidget * editor,\n\n QAbstractItemModel * model,\n\n const QModelIndex & index) const;\n\n};\n\n#endif //CQComboDelegate_H\n", "file_path": "copasi/UI/CQComboDelegate.h", "rank": 44, "score": 52245.040919824874 }, { "content": "class CQValidatorInt : public CQValidator< QLineEdit >\n\n{\n\n // Operations\n\npublic:\n\n CQValidatorInt(QLineEdit * parent, const char * name = 0);\n\n\n\n virtual State validate(QString & input, int & pos) const;\n\n\n\n void setRange(const int & lowerBound, const int & upperBound);\n\n\n\n //Attributes\n\nprotected:\n\n QIntValidator * mpIntValidator;\n\n};\n\n\n\n#endif // COPASI_CQValidator\n", "file_path": "copasi/UI/CQValidator.h", "rank": 45, "score": 52240.364361548745 }, { "content": "#if (defined __GNUC__ && __GNUC__ < 3)\n\n class const_row_iterator: public std::forward_iterator< C_FLOAT64, ptrdiff_t >\n", "file_path": "copasi/utilities/CSparseMatrix.h", "rank": 46, "score": 49753.863430778816 }, { "content": " def test_getIndex(self):\n\n index=self.vector.getIndex(self.metab)\n\n self.assert_(type(index)==IntType)\n\n self.assert_(index==2)\n\n index=self.vector.getIndexByName(self.metab.getObjectName())\n\n self.assert_(type(index)==IntType)\n", "file_path": "copasi/bindings/python/unittests/Test_CCopasiVector.py", "rank": 47, "score": 49748.45866943811 }, { "content": " def test_getVariableIndex(self):\n\n index=self.function.getVariableIndex(\"Kmp\")\n\n self.assert_(type(index)==IntType)\n", "file_path": "copasi/bindings/python/unittests/Test_CFunction.py", "rank": 48, "score": 49748.45866943811 }, { "content": " def test_isValueInt(self):\n\n result=self.object.isValueInt()\n", "file_path": "copasi/bindings/python/unittests/Test_CCopasiObject.py", "rank": 49, "score": 49744.005585240666 }, { "content": " def test_getObjectParent(self):\n\n parent=self.object.getObjectParent() \n\n self.assert_(parent!=None)\n\n self.assert_(parent.__class__==COPASI.MetabVectorNS)\n", "file_path": "copasi/bindings/python/unittests/Test_CCopasiObject.py", "rank": 50, "score": 48593.25840302895 }, { "content": " def test_getDataForIndex(self):\n\n data=self.ctimeseries.getDataForIndex(0)\n\n self.assert_(data != None)\n\n self.assert_(type(data) == ListType)\n\n self.assert_(len(data) == self.ctimeseries.getRecordedSteps())\n\n data=self.ctimeseries.getDataForIndex(2)\n\n self.assert_(data != None)\n\n self.assert_(type(data) == ListType)\n\n self.assert_(len(data) == self.ctimeseries.getRecordedSteps())\n\n # with this test setup there is only one step and the\n", "file_path": "copasi/bindings/python/unittests/Test_CTimeSeries.py", "rank": 51, "score": 48587.5558601525 }, { "content": " def test_getVariableIndex(self):\n\n expr=\"3 * A + 5.0\"\n\n self.assert_(self.tree.setInfix(expr))\n\n index=self.tree.getVariableIndex(\"A\")\n\n self.assert_(type(index)==IntType)\n", "file_path": "copasi/bindings/python/unittests/Test_CEvaluationTree.py", "rank": 52, "score": 48587.5558601525 }, { "content": " def test_getIndex(self):\n\n index=self.paramgroup.getIndex(\"param3\")\n\n self.assert_(type(index)==IntType)\n", "file_path": "copasi/bindings/python/unittests/Test_CCopasiParameterGroup.py", "rank": 53, "score": 48587.5558601525 }, { "content": " def test_getDefaultReportIndex(self):\n\n self.assert_(self.task!=None)\n\n index=COPASI.COutputAssistant.getDefaultReportIndex(self.problem)\n", "file_path": "copasi/bindings/python/unittests/Test_COutputAssistant.py", "rank": 54, "score": 47479.597943258465 }, { "content": " def test_getConcentrationDataForIndex(self):\n\n data=self.ctimeseries.getConcentrationDataForIndex(0)\n\n self.assert_(data != None)\n\n self.assert_(type(data) == ListType)\n\n self.assert_(len(data) == self.ctimeseries.getRecordedSteps())\n\n data=self.ctimeseries.getConcentrationDataForIndex(2)\n\n self.assert_(data != None)\n\n self.assert_(type(data) == ListType)\n\n self.assert_(len(data) == self.ctimeseries.getRecordedSteps())\n\n # with this test setup there is only one step and the\n", "file_path": "copasi/bindings/python/unittests/Test_CTimeSeries.py", "rank": 55, "score": 47479.597943258465 }, { "content": " public static Enum forInt(int i) {\n\n return (Enum) table.forInt(i);\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/Species.java", "rank": 56, "score": 41776.25579630547 }, { "content": " public static Enum forInt(int i) {\n\n return (Enum) table.forInt(i);\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/ExperimentType.java", "rank": 57, "score": 41776.25579630547 }, { "content": " public static Enum forInt(int i) {\n\n return (Enum) table.forInt(i);\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/WeightMethod.java", "rank": 58, "score": 41776.25579630547 }, { "content": " public static Enum forInt(int i) {\n\n return (Enum) table.forInt(i);\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/Method.java", "rank": 59, "score": 41776.25579630547 }, { "content": " public static Enum forInt(int i) {\n\n return (Enum) table.forInt(i);\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/Reaction.java", "rank": 60, "score": 41776.25579630547 }, { "content": " public static Enum forInt(int i) {\n\n return (Enum) table.forInt(i);\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/StatusCode.java", "rank": 61, "score": 41776.25579630547 }, { "content": " public static Enum forInt(int i) {\n\n return (Enum) table.forInt(i);\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/AffectedExperiment.java", "rank": 62, "score": 40955.03913974464 }, { "content": " static final int INT_INCORRECTOBJECTMAP = 3;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/StatusCode.java", "rank": 63, "score": 40940.31953652834 }, { "content": " static final int INT_FAIL = 2;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/StatusCode.java", "rank": 64, "score": 40940.31953652834 }, { "content": " static final int INT_SUCCESS = 1;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/StatusCode.java", "rank": 65, "score": 40940.31953652834 }, { "content": " static final int INT_CONCENTRATION = 1;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/Species.java", "rank": 66, "score": 40940.31953652834 }, { "content": " static final int INT_INCOMPLETEDATA = 6;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/StatusCode.java", "rank": 67, "score": 40940.31953652834 }, { "content": " static final int INT_UNKNOWN = 12;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/StatusCode.java", "rank": 68, "score": 40940.31953652834 }, { "content": " static final int INT_RUNNING = 11;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/StatusCode.java", "rank": 69, "score": 40940.31953652834 }, { "content": " static final int INT_ALREADYEXISTS = 7;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/StatusCode.java", "rank": 70, "score": 40940.31953652834 }, { "content": " static final int INT_FLUX = 2;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/Reaction.java", "rank": 71, "score": 40940.31953652834 }, { "content": " static final int INT_MEAN = 1;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/WeightMethod.java", "rank": 72, "score": 40940.31953652834 }, { "content": " static final int INT_UNKNOWNTRANSACTION = 4;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/StatusCode.java", "rank": 73, "score": 40940.31953652834 }, { "content": " static final int INT_CANNOT_BE_STARTED = 15;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/StatusCode.java", "rank": 74, "score": 40940.31953652834 }, { "content": " static final int INT_ALL = 1;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/AffectedExperiment.java", "rank": 75, "score": 40940.31953652834 }, { "content": " static final int INT_SUSPENDED = 13;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/StatusCode.java", "rank": 76, "score": 40940.31953652834 }, { "content": " static final int INT_COMPLETED = 9;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/StatusCode.java", "rank": 77, "score": 40940.31953652834 }, { "content": " static final int INT_NOEXPERIMENTALDATA = 5;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/StatusCode.java", "rank": 78, "score": 40940.31953652834 }, { "content": " public static Enum forInt(int i) {\n\n return (Enum) table.forInt(i);\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/ArbitraryVariable.java", "rank": 79, "score": 40165.49712852174 }, { "content": " public static Enum forInt(int i) {\n\n return (Enum) table.forInt(i);\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/ModelObject.java", "rank": 80, "score": 40165.49712852174 }, { "content": " static final int INT_NO_OF_RESOURCES_EXCEEDED = 8;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/StatusCode.java", "rank": 81, "score": 40150.77752530544 }, { "content": " static final int INT_X_4 = 5;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/AffectedExperiment.java", "rank": 82, "score": 40150.77752530544 }, { "content": " static final int INT_STEADY_STATE = 2;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/ExperimentType.java", "rank": 83, "score": 40150.77752530544 }, { "content": " static final int INT_PARTICLE_SWARM = 3;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/Method.java", "rank": 84, "score": 40150.77752530544 }, { "content": " static final int INT_PARTICLE_NUMBER = 2;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/Species.java", "rank": 85, "score": 40150.77752530544 }, { "content": " static final int INT_PARAMETER_VALUE = 1;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/Reaction.java", "rank": 86, "score": 40150.77752530544 }, { "content": " static final int INT_PARTICLE_FLUX = 3;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/Reaction.java", "rank": 87, "score": 40150.77752530544 }, { "content": " static final int INT_X_2 = 3;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/AffectedExperiment.java", "rank": 88, "score": 40150.77752530544 }, { "content": " static final int INT_TIME_COURSE = 1;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/ExperimentType.java", "rank": 89, "score": 40150.77752530544 }, { "content": " static final int INT_SCHEDULE_TO_START = 10;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/StatusCode.java", "rank": 90, "score": 40150.77752530544 }, { "content": " static final int INT_SIMULATED_ANNEALING = 4;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/Method.java", "rank": 91, "score": 40150.77752530544 }, { "content": " static final int INT_LEVENBERG_MARQUARDT = 2;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/Method.java", "rank": 92, "score": 40150.77752530544 }, { "content": " static final int INT_GENETIC_ALGORITHM = 1;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/Method.java", "rank": 93, "score": 40150.77752530544 }, { "content": " static final int INT_CONCENTRATION_RATE = 3;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/Species.java", "rank": 94, "score": 40150.77752530544 }, { "content": " static final int INT_INITIAL_CONCENTRATION = 5;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/Species.java", "rank": 95, "score": 40150.77752530544 }, { "content": " static final int INT_X_5 = 6;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/AffectedExperiment.java", "rank": 96, "score": 40150.77752530544 }, { "content": " static final int INT_X_1 = 2;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/AffectedExperiment.java", "rank": 97, "score": 40150.77752530544 }, { "content": " static final int INT_X_6 = 7;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/AffectedExperiment.java", "rank": 98, "score": 40150.77752530544 }, { "content": " static final int INT_X_3 = 4;\n", "file_path": "CopasiWS/copasiws_dev/copasiws/parameterestimationws/src/org/copasi/copasiws/services/parameterestimationws/types/AffectedExperiment.java", "rank": 99, "score": 40150.77752530544 } ]
C++
source/exhumed/src/bubbles.cpp
Talon1024/Raze
d92f56f36f246f12ea4012b3f9d5eb6c4abe0070
#include "ns.h" #include "bubbles.h" #include "runlist.h" #include "exhumed.h" #include "random.h" #include "engine.h" #include "sequence.h" #include "move.h" #include "init.h" #include "runlist.h" #include "init.h" #include "anims.h" #include <assert.h> BEGIN_PS_NS #define kMaxBubbles 200 #define kMaxMachines 125 struct Bubble { short nFrame; short nSeq; short nSprite; short nRun; }; struct machine { short _0; short nSprite; short _4; }; short BubbleCount = 0; short nFreeCount; short nMachineCount; uint8_t nBubblesFree[kMaxBubbles]; machine Machine[kMaxMachines]; Bubble BubbleList[kMaxBubbles]; static SavegameHelper sgh("bubbles", SV(BubbleCount), SV(nFreeCount), SV(nMachineCount), SA(nBubblesFree), SA(Machine), SA(BubbleList), nullptr); void InitBubbles() { BubbleCount = 0; nMachineCount = 0; for (int i = 0; i < kMaxBubbles; i++) { nBubblesFree[i] = i; } nFreeCount = kMaxBubbles; } void DestroyBubble(short nBubble) { short nSprite = BubbleList[nBubble].nSprite; runlist_DoSubRunRec(sprite[nSprite].lotag - 1); runlist_DoSubRunRec(sprite[nSprite].owner); runlist_SubRunRec(BubbleList[nBubble].nRun); mydeletesprite(nSprite); nBubblesFree[nFreeCount] = nBubble; nFreeCount++; } short GetBubbleSprite(short nBubble) { return BubbleList[nBubble].nSprite; } int BuildBubble(int x, int y, int z, short nSector) { int nSize = RandomSize(3); if (nSize > 4) { nSize -= 4; } if (nFreeCount <= 0) { return -1; } nFreeCount--; uint8_t nBubble = nBubblesFree[nFreeCount]; int nSprite = insertsprite(nSector, 402); assert(nSprite >= 0 && nSprite < kMaxSprites); sprite[nSprite].x = x; sprite[nSprite].y = y; sprite[nSprite].z = z; sprite[nSprite].cstat = 0; sprite[nSprite].shade = -32; sprite[nSprite].pal = 0; sprite[nSprite].clipdist = 5; sprite[nSprite].xrepeat = 40; sprite[nSprite].yrepeat = 40; sprite[nSprite].xoffset = 0; sprite[nSprite].yoffset = 0; sprite[nSprite].picnum = 1; sprite[nSprite].ang = inita; sprite[nSprite].xvel = 0; sprite[nSprite].yvel = 0; sprite[nSprite].zvel = -1200; sprite[nSprite].hitag = -1; sprite[nSprite].extra = -1; sprite[nSprite].lotag = runlist_HeadRun() + 1; BubbleList[nBubble].nSprite = nSprite; BubbleList[nBubble].nFrame = 0; BubbleList[nBubble].nSeq = SeqOffsets[kSeqBubble] + nSize; sprite[nSprite].owner = runlist_AddRunRec(sprite[nSprite].lotag - 1, nBubble | 0x140000); BubbleList[nBubble].nRun = runlist_AddRunRec(NewRun, nBubble | 0x140000); return nBubble | 0x140000; } void FuncBubble(int a, int UNUSED(b), int nRun) { short nBubble = RunData[nRun].nVal; assert(nBubble >= 0 && nBubble < kMaxBubbles); short nSprite = BubbleList[nBubble].nSprite; short nSeq = BubbleList[nBubble].nSeq; int nMessage = a & kMessageMask; switch (nMessage) { case 0x20000: { seq_MoveSequence(nSprite, nSeq, BubbleList[nBubble].nFrame); BubbleList[nBubble].nFrame++; if (BubbleList[nBubble].nFrame >= SeqSize[nSeq]) { BubbleList[nBubble].nFrame = 0; } sprite[nSprite].z += sprite[nSprite].zvel; short nSector = sprite[nSprite].sectnum; if (sprite[nSprite].z <= sector[nSector].ceilingz) { short nSectAbove = SectAbove[nSector]; if (sprite[nSprite].hitag > -1 && nSectAbove != -1) { BuildAnim(-1, 70, 0, sprite[nSprite].x, sprite[nSprite].y, sector[nSectAbove].floorz, nSectAbove, 64, 0); } DestroyBubble(nBubble); } return; } case 0x90000: { seq_PlotSequence(a & 0xFFFF, nSeq, BubbleList[nBubble].nFrame, 1); tsprite[a & 0xFFFF].owner = -1; return; } case 0x80000: case 0xA0000: return; default: Printf("unknown msg %d for Bubble\n", nMessage); return; } } void DoBubbleMachines() { for (int i = 0; i < nMachineCount; i++) { Machine[i]._0--; if (Machine[i]._0 <= 0) { Machine[i]._0 = (RandomWord() % Machine[i]._4) + 30; int nSprite = Machine[i].nSprite; BuildBubble(sprite[nSprite].x, sprite[nSprite].y, sprite[nSprite].z, sprite[nSprite].sectnum); } } } void BuildBubbleMachine(int nSprite) { if (nMachineCount >= kMaxMachines) { I_Error("too many bubble machines in level %d\n", levelnew); exit(-1); } Machine[nMachineCount]._4 = 75; Machine[nMachineCount].nSprite = nSprite; Machine[nMachineCount]._0 = Machine[nMachineCount]._4; nMachineCount++; sprite[nSprite].cstat = 0x8000; } void DoBubbles(int nPlayer) { int x, y, z; short nSector; WheresMyMouth(nPlayer, &x, &y, &z, &nSector); int nBubble = BuildBubble(x, y, z, nSector); int nSprite = GetBubbleSprite(nBubble); sprite[nSprite].hitag = nPlayer; } END_PS_NS
#include "ns.h" #include "bubbles.h" #include "runlist.h" #include "exhumed.h" #include "random.h" #include "engine.h" #include "sequence.h" #include "move.h" #include "init.h" #include "runlist.h" #include "init.h" #include "anims.h" #include <assert.h> BEGIN_PS_NS #define kMaxBubbles 200 #define kMaxMachines 125 struct Bubble { short nFrame; short nSeq; short nSprite; short nRun; }; struct machine { short _0; short nSprite; short _4; }; short BubbleCount = 0; short nFreeCount; short nMachineCount; uint8_t nBubblesFree[kMaxBubbles]; machine Machine[kMaxMachines]; Bubble BubbleList[kMaxBubbles]; static SavegameHelper sgh("bubbles", SV(BubbleCount), SV(nFreeCount), SV(nMachineCount), SA(nBubblesFree), SA(Machine), SA(BubbleList), nullptr); void InitBubbles() { BubbleCount = 0; nMachineCount = 0; for (int i = 0; i < kMaxBubbles; i++) { nBubblesFree[i] = i; } nFreeCount = kMaxBubbles; }
short GetBubbleSprite(short nBubble) { return BubbleList[nBubble].nSprite; } int BuildBubble(int x, int y, int z, short nSector) { int nSize = RandomSize(3); if (nSize > 4) { nSize -= 4; } if (nFreeCount <= 0) { return -1; } nFreeCount--; uint8_t nBubble = nBubblesFree[nFreeCount]; int nSprite = insertsprite(nSector, 402); assert(nSprite >= 0 && nSprite < kMaxSprites); sprite[nSprite].x = x; sprite[nSprite].y = y; sprite[nSprite].z = z; sprite[nSprite].cstat = 0; sprite[nSprite].shade = -32; sprite[nSprite].pal = 0; sprite[nSprite].clipdist = 5; sprite[nSprite].xrepeat = 40; sprite[nSprite].yrepeat = 40; sprite[nSprite].xoffset = 0; sprite[nSprite].yoffset = 0; sprite[nSprite].picnum = 1; sprite[nSprite].ang = inita; sprite[nSprite].xvel = 0; sprite[nSprite].yvel = 0; sprite[nSprite].zvel = -1200; sprite[nSprite].hitag = -1; sprite[nSprite].extra = -1; sprite[nSprite].lotag = runlist_HeadRun() + 1; BubbleList[nBubble].nSprite = nSprite; BubbleList[nBubble].nFrame = 0; BubbleList[nBubble].nSeq = SeqOffsets[kSeqBubble] + nSize; sprite[nSprite].owner = runlist_AddRunRec(sprite[nSprite].lotag - 1, nBubble | 0x140000); BubbleList[nBubble].nRun = runlist_AddRunRec(NewRun, nBubble | 0x140000); return nBubble | 0x140000; } void FuncBubble(int a, int UNUSED(b), int nRun) { short nBubble = RunData[nRun].nVal; assert(nBubble >= 0 && nBubble < kMaxBubbles); short nSprite = BubbleList[nBubble].nSprite; short nSeq = BubbleList[nBubble].nSeq; int nMessage = a & kMessageMask; switch (nMessage) { case 0x20000: { seq_MoveSequence(nSprite, nSeq, BubbleList[nBubble].nFrame); BubbleList[nBubble].nFrame++; if (BubbleList[nBubble].nFrame >= SeqSize[nSeq]) { BubbleList[nBubble].nFrame = 0; } sprite[nSprite].z += sprite[nSprite].zvel; short nSector = sprite[nSprite].sectnum; if (sprite[nSprite].z <= sector[nSector].ceilingz) { short nSectAbove = SectAbove[nSector]; if (sprite[nSprite].hitag > -1 && nSectAbove != -1) { BuildAnim(-1, 70, 0, sprite[nSprite].x, sprite[nSprite].y, sector[nSectAbove].floorz, nSectAbove, 64, 0); } DestroyBubble(nBubble); } return; } case 0x90000: { seq_PlotSequence(a & 0xFFFF, nSeq, BubbleList[nBubble].nFrame, 1); tsprite[a & 0xFFFF].owner = -1; return; } case 0x80000: case 0xA0000: return; default: Printf("unknown msg %d for Bubble\n", nMessage); return; } } void DoBubbleMachines() { for (int i = 0; i < nMachineCount; i++) { Machine[i]._0--; if (Machine[i]._0 <= 0) { Machine[i]._0 = (RandomWord() % Machine[i]._4) + 30; int nSprite = Machine[i].nSprite; BuildBubble(sprite[nSprite].x, sprite[nSprite].y, sprite[nSprite].z, sprite[nSprite].sectnum); } } } void BuildBubbleMachine(int nSprite) { if (nMachineCount >= kMaxMachines) { I_Error("too many bubble machines in level %d\n", levelnew); exit(-1); } Machine[nMachineCount]._4 = 75; Machine[nMachineCount].nSprite = nSprite; Machine[nMachineCount]._0 = Machine[nMachineCount]._4; nMachineCount++; sprite[nSprite].cstat = 0x8000; } void DoBubbles(int nPlayer) { int x, y, z; short nSector; WheresMyMouth(nPlayer, &x, &y, &z, &nSector); int nBubble = BuildBubble(x, y, z, nSector); int nSprite = GetBubbleSprite(nBubble); sprite[nSprite].hitag = nPlayer; } END_PS_NS
void DestroyBubble(short nBubble) { short nSprite = BubbleList[nBubble].nSprite; runlist_DoSubRunRec(sprite[nSprite].lotag - 1); runlist_DoSubRunRec(sprite[nSprite].owner); runlist_SubRunRec(BubbleList[nBubble].nRun); mydeletesprite(nSprite); nBubblesFree[nFreeCount] = nBubble; nFreeCount++; }
function_block-full_function
[ { "content": "struct TestSpanOpt0 { static const int Flags = 0; };\n", "file_path": "source/common/rendering/polyrenderer/drawers/screen_triangle.h", "rank": 1, "score": 232160.25810981102 }, { "content": "struct BlendColorOpt_Add { static const int Flags = 0; };\n", "file_path": "source/common/rendering/polyrenderer/drawers/screen_blend.h", "rank": 2, "score": 228366.06429591752 }, { "content": "struct TestSpanOpt3 { static const int Flags = 3; };\n", "file_path": "source/common/rendering/polyrenderer/drawers/screen_triangle.h", "rank": 3, "score": 214240.3527111041 }, { "content": "struct TestSpanOpt1 { static const int Flags = 1; };\n", "file_path": "source/common/rendering/polyrenderer/drawers/screen_triangle.h", "rank": 4, "score": 214240.3527111041 }, { "content": "struct TestSpanOpt2 { static const int Flags = 2; };\n", "file_path": "source/common/rendering/polyrenderer/drawers/screen_triangle.h", "rank": 5, "score": 214240.3527111041 }, { "content": "struct BlendColorOpt_Sub { static const int Flags = 1; };\n", "file_path": "source/common/rendering/polyrenderer/drawers/screen_blend.h", "rank": 6, "score": 210446.15889721058 }, { "content": "struct BlendColorOpt_RevSub { static const int Flags = 2; };\n\n\n\ntemplate<typename OptT>\n\nvoid BlendColor(int y, int x0, int x1, PolyTriangleThreadData* thread);\n\nvoid BlendColorOpaque(int y, int x0, int x1, PolyTriangleThreadData* thread);\n\nvoid BlendColorOpaque(int y, int x0, int x1, PolyTriangleThreadData* thread);\n\nvoid BlendColorAdd_Src_InvSrc(int y, int x0, int x1, PolyTriangleThreadData* thread);\n\nvoid BlendColorAdd_SrcCol_InvSrcCol(int y, int x0, int x1, PolyTriangleThreadData* thread);\n\nvoid BlendColorAdd_Src_One(int y, int x0, int x1, PolyTriangleThreadData* thread);\n\nvoid BlendColorAdd_SrcCol_One(int y, int x0, int x1, PolyTriangleThreadData* thread);\n\nvoid BlendColorAdd_DstCol_Zero(int y, int x0, int x1, PolyTriangleThreadData* thread);\n\nvoid BlendColorAdd_InvDstCol_Zero(int y, int x0, int x1, PolyTriangleThreadData* thread);\n\nvoid BlendColorRevSub_Src_One(int y, int x0, int x1, PolyTriangleThreadData* thread);\n\n\n\nvoid SelectWriteColorFunc(PolyTriangleThreadData* thread);\n", "file_path": "source/common/rendering/polyrenderer/drawers/screen_blend.h", "rank": 7, "score": 206827.16585334943 }, { "content": "struct define_t\n\n{\n\n FString _text;\n\n int _value;\n\n};\n\n\n\ndefine_t gCmdDefines[kMaxCmdLineDefines];\n\n\n\nvoid addMemoryResource(char *fileName, char flags, int ID);\n\n\n", "file_path": "source/blood/src/barf.cpp", "rank": 9, "score": 172253.89184424162 }, { "content": "struct libdivide_s64_t {\n\n int64_t magic;\n\n uint8_t more;\n\n};\n\n\n", "file_path": "source/thirdparty/include/libdivide.h", "rank": 10, "score": 172150.57194243255 }, { "content": "struct libdivide_s32_t {\n\n int32_t magic;\n\n uint8_t more;\n\n};\n\n\n", "file_path": "source/thirdparty/include/libdivide.h", "rank": 11, "score": 172150.57194243255 }, { "content": "struct libdivide_u32_t {\n\n uint32_t magic;\n\n uint8_t more;\n\n};\n\n\n", "file_path": "source/thirdparty/include/libdivide.h", "rank": 12, "score": 172150.57194243255 }, { "content": "struct libdivide_u64_t {\n\n uint64_t magic;\n\n uint8_t more;\n\n};\n\n\n", "file_path": "source/thirdparty/include/libdivide.h", "rank": 13, "score": 172150.57194243255 }, { "content": "struct TypeHelper<ValueType, int> {\n\n static bool Is(const ValueType& v) { return v.IsInt(); }\n\n static int Get(const ValueType& v) { return v.GetInt(); }\n\n static ValueType& Set(ValueType& v, int data) { return v.SetInt(data); }\n\n static ValueType& Set(ValueType& v, int data, typename ValueType::AllocatorType&) { return v.SetInt(data); }\n\n};\n\n\n\ntemplate<typename ValueType> \n", "file_path": "source/common/thirdparty/rapidjson/document.h", "rank": 14, "score": 171799.9086309672 }, { "content": "struct libdivide_s32_branchfree_t {\n\n int32_t magic;\n\n uint8_t more;\n\n};\n\n\n", "file_path": "source/thirdparty/include/libdivide.h", "rank": 15, "score": 168285.5620353281 }, { "content": "struct libdivide_s64_branchfree_t {\n\n int64_t magic;\n\n uint8_t more;\n\n};\n\n\n\n#pragma pack(pop)\n\n\n\n// Explanation of the \"more\" field:\n\n//\n\n// * Bits 0-5 is the shift value (for shift path or mult path).\n\n// * Bit 6 is the add indicator for mult path.\n\n// * Bit 7 is set if the divisor is negative. We use bit 7 as the negative\n\n// divisor indicator so that we can efficiently use sign extension to\n\n// create a bitmask with all bits set to 1 (if the divisor is negative)\n\n// or 0 (if the divisor is positive).\n\n//\n\n// u32: [0-4] shift value\n\n// [5] ignored\n\n// [6] add indicator\n\n// magic number of 0 indicates shift path\n", "file_path": "source/thirdparty/include/libdivide.h", "rank": 16, "score": 168285.5620353281 }, { "content": "// exportable interface\n\nstruct SmackerHandle\n\n{\n\n\tbool isValid;\n\n\tint instanceIndex;\n\n};\n\n\n", "file_path": "source/libsmackerdec/include/SmackerDecoder.h", "rank": 17, "score": 168285.5620353281 }, { "content": "struct DBCtx;\n\n\n", "file_path": "source/libsmackerdec/include/SmackerDecoder.h", "rank": 18, "score": 168285.5620353281 }, { "content": "struct libdivide_u32_branchfree_t {\n\n uint32_t magic;\n\n uint8_t more;\n\n};\n\n\n", "file_path": "source/thirdparty/include/libdivide.h", "rank": 19, "score": 168285.5620353281 }, { "content": "struct libdivide_u64_branchfree_t {\n\n uint64_t magic;\n\n uint8_t more;\n\n};\n\n\n", "file_path": "source/thirdparty/include/libdivide.h", "rank": 20, "score": 168285.5620353281 }, { "content": "// forward declare\n\nstruct HuffContext;\n", "file_path": "source/libsmackerdec/include/SmackerDecoder.h", "rank": 21, "score": 168285.5620353281 }, { "content": "struct TypeIdOfInt {\n\n enum {\n\n kSignatureed = int(~static_cast<T>(0) < static_cast<T>(0)),\n\n kTypeId = (sizeof(T) == 1) ? (int)(kSignatureed ? TypeId::kI8 : TypeId::kU8 ) :\n\n (sizeof(T) == 2) ? (int)(kSignatureed ? TypeId::kI16 : TypeId::kU16) :\n\n (sizeof(T) == 4) ? (int)(kSignatureed ? TypeId::kI32 : TypeId::kU32) :\n\n (sizeof(T) == 8) ? (int)(kSignatureed ? TypeId::kI64 : TypeId::kU64) : (int)TypeId::kVoid\n\n };\n\n};\n\n\n\n#define ASMJIT_DEFINE_TYPE_ID(T, TYPE_ID) \\\n\n template<> \\\n\n struct TypeIdOf<T> { enum { kTypeId = TYPE_ID}; }\n\n\n\nASMJIT_DEFINE_TYPE_ID(signed char , TypeIdOfInt< signed char >::kTypeId);\n\nASMJIT_DEFINE_TYPE_ID(unsigned char , TypeIdOfInt< unsigned char >::kTypeId);\n\nASMJIT_DEFINE_TYPE_ID(short , TypeIdOfInt< short >::kTypeId);\n\nASMJIT_DEFINE_TYPE_ID(unsigned short , TypeIdOfInt< unsigned short >::kTypeId);\n\nASMJIT_DEFINE_TYPE_ID(int , TypeIdOfInt< int >::kTypeId);\n\nASMJIT_DEFINE_TYPE_ID(unsigned int , TypeIdOfInt< unsigned int >::kTypeId);\n", "file_path": "libraries/asmjit/asmjit/base/operand.h", "rank": 22, "score": 164727.24916010932 }, { "content": "// Specialization constants need both a nominal size and a node that defines\n\n// the specialization constant being used. Array types are the same when their\n\n// size and specialization constant nodes are the same.\n\nstruct TArraySize {\n\n unsigned int size;\n\n TIntermTyped* node; // nullptr means no specialization constant node\n\n bool operator==(const TArraySize& rhs) const\n\n {\n\n if (size != rhs.size)\n\n return false;\n\n if (node == nullptr || rhs.node == nullptr)\n\n return node == rhs.node;\n\n\n\n return SameSpecializationConstants(node, rhs.node);\n\n }\n\n};\n\n\n", "file_path": "libraries/glslang/glslang/Include/arrays.h", "rank": 23, "score": 164646.17938883347 }, { "content": "struct SmackerAudioInfo\n\n{\n\n\tuint32_t sampleRate;\n\n\tuint8_t nChannels;\n\n\tuint8_t bitsPerSample;\n\n\n\n\tuint32_t idealBufferSize;\n\n};\n\n\n\nSmackerHandle Smacker_Open (const char *fileName);\n\nvoid Smacker_Close (SmackerHandle &handle);\n\nuint32_t Smacker_GetNumAudioTracks (SmackerHandle &handle);\n\nSmackerAudioInfo Smacker_GetAudioTrackDetails (SmackerHandle &handle, uint32_t trackIndex);\n\nuint32_t Smacker_GetAudioData (SmackerHandle &handle, uint32_t trackIndex, int16_t *data);\n\nuint32_t Smacker_GetNumFrames (SmackerHandle &handle);\n\nvoid Smacker_GetFrameSize (SmackerHandle &handle, uint32_t &width, uint32_t &height);\n\nuint32_t Smacker_GetCurrentFrameNum (SmackerHandle &handle);\n\nuint32_t Smacker_GetNextFrame (SmackerHandle &handle);\n\nfloat Smacker_GetFrameRate (SmackerHandle &handle);\n\nvoid Smacker_GetPalette (SmackerHandle &handle, uint8_t *palette);\n\nvoid Smacker_GetFrame (SmackerHandle &handle, uint8_t *frame);\n\nvoid Smacker_GotoFrame (SmackerHandle &handle, uint32_t frameNum);\n\n\n\nconst int kMaxAudioTracks = 7;\n\n\n", "file_path": "source/libsmackerdec/include/SmackerDecoder.h", "rank": 24, "score": 164639.45519291455 }, { "content": "// Qualifiers that don't need to be keep per object. They have shader scope, not object scope.\n\n// So, they will not be part of TType, TQualifier, etc.\n\nstruct TShaderQualifiers {\n\n TLayoutGeometry geometry; // geometry/tessellation shader in/out primitives\n\n bool pixelCenterInteger; // fragment shader\n\n bool originUpperLeft; // fragment shader\n\n int invocations;\n\n int vertices; // for tessellation \"vertices\", geometry & mesh \"max_vertices\"\n\n TVertexSpacing spacing;\n\n TVertexOrder order;\n\n bool pointMode;\n\n int localSize[3]; // compute shader\n\n bool localSizeNotDefault[3]; // compute shader\n\n int localSizeSpecId[3]; // compute shader specialization id for gl_WorkGroupSize\n\n#ifndef GLSLANG_WEB\n\n bool earlyFragmentTests; // fragment input\n\n bool postDepthCoverage; // fragment input\n\n TLayoutDepth layoutDepth;\n\n bool blendEquation; // true if any blend equation was specified\n\n int numViews; // multiview extenstions\n\n TInterlockOrdering interlockOrdering;\n\n bool layoutOverrideCoverage; // true if layout override_coverage set\n", "file_path": "libraries/glslang/glslang/Include/Types.h", "rank": 25, "score": 164639.45519291455 }, { "content": "struct TSourceLoc {\n\n void init()\n\n {\n\n name = nullptr; string = 0; line = 0; column = 0;\n\n }\n\n void init(int stringNum) { init(); string = stringNum; }\n\n // Returns the name if it exists. Otherwise, returns the string number.\n\n std::string getStringNameOrNum(bool quoteStringName = true) const\n\n {\n\n if (name != nullptr) {\n\n TString qstr = quoteStringName ? (\"\\\"\" + *name + \"\\\"\") : *name;\n\n std::string ret_str(qstr.c_str());\n\n return ret_str;\n\n }\n\n return std::to_string((long long)string);\n\n }\n\n const char* getFilename() const\n\n {\n\n if (name == nullptr)\n\n return nullptr;\n\n return name->c_str();\n\n }\n\n const char* getFilenameStr() const { return name == nullptr ? \"\" : name->c_str(); }\n\n TString* name; // descriptive name for this string, when a textual name is available, otherwise nullptr\n\n int string;\n\n int line;\n\n int column;\n\n};\n\n\n", "file_path": "libraries/glslang/glslang/Include/Common.h", "rank": 26, "score": 164639.45519291455 }, { "content": "struct TTypeLoc {\n\n TType* type;\n\n TSourceLoc loc;\n\n};\n\ntypedef TVector<TTypeLoc> TTypeList;\n\n\n\ntypedef TVector<TString*> TIdentifierList;\n\n\n\n//\n\n// Following are a series of helper enums for managing layouts and qualifiers,\n\n// used for TPublicType, TType, others.\n\n//\n\n\n", "file_path": "libraries/glslang/glslang/Include/Types.h", "rank": 27, "score": 164639.45519291455 }, { "content": "//\n\n// Represent an array, or array of arrays, to arbitrary depth. This is not\n\n// done through a hierarchy of types in a type tree, rather all contiguous arrayness\n\n// in the type hierarchy is localized into this single cumulative object.\n\n//\n\n// The arrayness in TTtype is a pointer, so that it can be non-allocated and zero\n\n// for the vast majority of types that are non-array types.\n\n//\n\n// Order Policy: these are all identical:\n\n// - left to right order within a contiguous set of ...[..][..][..]... in the source language\n\n// - index order 0, 1, 2, ... within the 'sizes' member below\n\n// - outer-most to inner-most\n\n//\n\nstruct TArraySizes {\n\n POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())\n\n\n\n TArraySizes() : implicitArraySize(1), variablyIndexed(false) { }\n\n\n\n // For breaking into two non-shared copies, independently modifiable.\n\n TArraySizes& operator=(const TArraySizes& from)\n\n {\n\n implicitArraySize = from.implicitArraySize;\n\n variablyIndexed = from.variablyIndexed;\n\n sizes = from.sizes;\n\n\n\n return *this;\n\n }\n\n\n\n // translate from array-of-array semantics to container semantics\n\n int getNumDims() const { return sizes.size(); }\n\n int getDimSize(int dim) const { return sizes.getDimSize(dim); }\n\n TIntermTyped* getDimNode(int dim) const { return sizes.getDimNode(dim); }\n\n void setDimSize(int dim, int size) { sizes.setDimSize(dim, size); }\n", "file_path": "libraries/glslang/glslang/Include/arrays.h", "rank": 28, "score": 164639.45519291455 }, { "content": "struct SmackerAudioTrack\n\n{\n\n\tuint32_t sizeInBytes;\n\n\tuint32_t flags;\n\n\tuint32_t sampleRate;\n\n\tuint8_t nChannels;\n\n\tuint8_t bitsPerSample;\n\n//\tint\t compressionType;\n\n\n\n\tuint8_t *buffer;\n\n\tuint32_t bufferSize;\n\n\n\n\tuint32_t bytesReadThisFrame;\n\n};\n\n\n", "file_path": "source/libsmackerdec/include/SmackerDecoder.h", "rank": 29, "score": 164639.45519291455 }, { "content": "// A descriptor, for a single profile, of when something is available.\n\n// If the current profile does not match 'profile' mask below, the other fields\n\n// do not apply (nor validate).\n\n// profiles == EBadProfile is the end of an array of these\n\nstruct Versioning {\n\n EProfile profiles; // the profile(s) (mask) that the following fields are valid for\n\n int minExtendedVersion; // earliest version when extensions are enabled; ignored if numExtensions is 0\n\n int minCoreVersion; // earliest version function is in core; 0 means never\n\n int numExtensions; // how many extensions are in the 'extensions' list\n\n const char** extensions; // list of extension names enabling the function\n\n};\n\n\n\nEProfile EDesktopProfile = static_cast<EProfile>(ENoProfile | ECoreProfile | ECompatibilityProfile);\n\n\n\n// Declare pointers to put into the table for versioning.\n\n#ifdef GLSLANG_WEB\n\n const Versioning* Es300Desktop130 = nullptr;\n\n const Versioning* Es310Desktop430 = nullptr;\n\n#else\n\n const Versioning Es300Desktop130Version[] = { { EEsProfile, 0, 300, 0, nullptr },\n\n { EDesktopProfile, 0, 130, 0, nullptr },\n\n { EBadProfile } };\n\n const Versioning* Es300Desktop130 = &Es300Desktop130Version[0];\n\n\n", "file_path": "libraries/glslang/glslang/MachineIndependent/Initialize.cpp", "rank": 30, "score": 164426.72202028835 }, { "content": "// Used for call-graph algorithms for detecting recursion, missing bodies, and dead bodies.\n\n// A \"call\" is a pair: <caller, callee>.\n\n// There can be duplicates. General assumption is the list is small.\n\nstruct TCall {\n\n TCall(const TString& pCaller, const TString& pCallee) : caller(pCaller), callee(pCallee) { }\n\n TString caller;\n\n TString callee;\n\n bool visited;\n\n bool currentPath;\n\n bool errorGiven;\n\n int calleeBodyPosition;\n\n};\n\n\n", "file_path": "libraries/glslang/glslang/MachineIndependent/localintermediate.h", "rank": 31, "score": 164426.72202028835 }, { "content": "// A generic 1-D range.\n\nstruct TRange {\n\n TRange(int start, int last) : start(start), last(last) { }\n\n bool overlap(const TRange& rhs) const\n\n {\n\n return last >= rhs.start && start <= rhs.last;\n\n }\n\n int start;\n\n int last;\n\n};\n\n\n", "file_path": "libraries/glslang/glslang/MachineIndependent/localintermediate.h", "rank": 32, "score": 164426.72202028835 }, { "content": "//\n\n// This is just to help yacc.\n\n//\n\nstruct TIntermNodePair {\n\n TIntermNode* node1;\n\n TIntermNode* node2;\n\n};\n\n\n", "file_path": "libraries/glslang/glslang/Include/intermediate.h", "rank": 33, "score": 161194.16649256987 }, { "content": "// Represent the independent aspects of a texturing TOperator\n\nstruct TCrackedTextureOp {\n\n bool query;\n\n bool proj;\n\n bool lod;\n\n bool fetch;\n\n bool offset;\n\n bool offsets;\n\n bool gather;\n\n bool grad;\n\n bool subpass;\n\n bool lodClamp;\n\n bool fragMask;\n\n};\n\n\n", "file_path": "libraries/glslang/glslang/Include/intermediate.h", "rank": 34, "score": 161194.16649256987 }, { "content": "//\n\n// TSmallArrayVector is used as the container for the set of sizes in TArraySizes.\n\n// It has generic-container semantics, while TArraySizes has array-of-array semantics.\n\n// That is, TSmallArrayVector should be more focused on mechanism and TArraySizes on policy.\n\n//\n\nstruct TSmallArrayVector {\n\n //\n\n // TODO: memory: TSmallArrayVector is intended to be smaller.\n\n // Almost all arrays could be handled by two sizes each fitting\n\n // in 16 bits, needing a real vector only in the cases where there\n\n // are more than 3 sizes or a size needing more than 16 bits.\n\n //\n\n POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())\n\n\n\n TSmallArrayVector() : sizes(nullptr) { }\n\n virtual ~TSmallArrayVector() { dealloc(); }\n\n\n\n // For breaking into two non-shared copies, independently modifiable.\n\n TSmallArrayVector& operator=(const TSmallArrayVector& from)\n\n {\n\n if (from.sizes == nullptr)\n\n sizes = nullptr;\n\n else {\n\n alloc();\n\n *sizes = *from.sizes;\n", "file_path": "libraries/glslang/glslang/Include/arrays.h", "rank": 35, "score": 161194.16649256987 }, { "content": "// Things that need to be tracked per xfb buffer.\n\nstruct TXfbBuffer {\n\n TXfbBuffer() : stride(TQualifier::layoutXfbStrideEnd), implicitStride(0), contains64BitType(false),\n\n contains32BitType(false), contains16BitType(false) { }\n\n std::vector<TRange> ranges; // byte offsets that have already been assigned\n\n unsigned int stride;\n\n unsigned int implicitStride;\n\n bool contains64BitType;\n\n bool contains32BitType;\n\n bool contains16BitType;\n\n};\n\n#endif\n\n\n", "file_path": "libraries/glslang/glslang/MachineIndependent/localintermediate.h", "rank": 36, "score": 160987.29171662946 }, { "content": "// An IO range is a 3-D rectangle; the set of (location, component, index) triples all lying\n\n// within the same location range, component range, and index value. Locations don't alias unless\n\n// all other dimensions of their range overlap.\n\nstruct TIoRange {\n\n TIoRange(TRange location, TRange component, TBasicType basicType, int index)\n\n : location(location), component(component), basicType(basicType), index(index) { }\n\n bool overlap(const TIoRange& rhs) const\n\n {\n\n return location.overlap(rhs.location) && component.overlap(rhs.component) && index == rhs.index;\n\n }\n\n TRange location;\n\n TRange component;\n\n TBasicType basicType;\n\n int index;\n\n};\n\n\n", "file_path": "libraries/glslang/glslang/MachineIndependent/localintermediate.h", "rank": 37, "score": 160987.29171662946 }, { "content": "struct str_hash\n\n{\n\n size_t operator()(const char* str) const\n\n {\n\n // djb2\n\n unsigned long hash = 5381;\n\n int c;\n\n\n\n while ((c = *str++) != 0)\n\n hash = ((hash << 5) + hash) + c;\n\n\n\n return hash;\n\n }\n\n};\n\n\n\n// A single global usable by all threads, by all versions, by all languages.\n\n// After a single process-level initialization, this is read only and thread safe\n\nstd::unordered_map<const char*, int, str_hash, str_eq>* KeywordMap = nullptr;\n\n#ifndef GLSLANG_WEB\n\nstd::unordered_set<const char*, str_hash, str_eq>* ReservedSet = nullptr;\n", "file_path": "libraries/glslang/glslang/MachineIndependent/Scan.cpp", "rank": 38, "score": 160987.29171662946 }, { "content": "// An offset range is a 2-D rectangle; the set of (binding, offset) pairs all lying\n\n// within the same binding and offset range.\n\nstruct TOffsetRange {\n\n TOffsetRange(TRange binding, TRange offset)\n\n : binding(binding), offset(offset) { }\n\n bool overlap(const TOffsetRange& rhs) const\n\n {\n\n return binding.overlap(rhs.binding) && offset.overlap(rhs.offset);\n\n }\n\n TRange binding;\n\n TRange offset;\n\n};\n\n\n\n#ifndef GLSLANG_WEB\n", "file_path": "libraries/glslang/glslang/MachineIndependent/localintermediate.h", "rank": 39, "score": 160987.29171662946 }, { "content": "//\n\n// The function sub-class of symbols and the parser will need to\n\n// share this definition of a function parameter.\n\n//\n\nstruct TParameter {\n\n TString *name;\n\n TType* type;\n\n TIntermTyped* defaultValue;\n\n void copyParam(const TParameter& param)\n\n {\n\n if (param.name)\n\n name = NewPoolTString(param.name->c_str());\n\n else\n\n name = 0;\n\n type = param.type->clone();\n\n defaultValue = param.defaultValue;\n\n }\n\n TBuiltInVariable getDeclaredBuiltIn() const { return type->getQualifier().declaredBuiltIn; }\n\n};\n\n\n", "file_path": "libraries/glslang/glslang/MachineIndependent/SymbolTable.h", "rank": 40, "score": 160987.29171662946 }, { "content": "struct str_eq\n\n{\n\n bool operator()(const char* lhs, const char* rhs) const\n\n {\n\n return strcmp(lhs, rhs) == 0;\n\n }\n\n};\n\n\n", "file_path": "libraries/glslang/glslang/MachineIndependent/Scan.cpp", "rank": 41, "score": 160987.29171662946 }, { "content": "// DoPreprocessing is a valid ProcessingContext template argument,\n\n// which only performs the preprocessing step of compilation.\n\n// It places the result in the \"string\" argument to its constructor.\n\n//\n\n// This is not an officially supported or fully working path.\n\nstruct DoPreprocessing {\n\n explicit DoPreprocessing(std::string* string): outputString(string) {}\n\n bool operator()(TParseContextBase& parseContext, TPpContext& ppContext,\n\n TInputScanner& input, bool versionWillBeError,\n\n TSymbolTable&, TIntermediate&,\n\n EShOptimizationLevel, EShMessages)\n\n {\n\n // This is a list of tokens that do not require a space before or after.\n\n static const std::string unNeededSpaceTokens = \";()[]\";\n\n static const std::string noSpaceBeforeTokens = \",\";\n\n glslang::TPpToken ppToken;\n\n\n\n parseContext.setScanner(&input);\n\n ppContext.setInput(input, versionWillBeError);\n\n\n\n std::string outputBuffer;\n\n SourceLineSynchronizer lineSync(\n\n std::bind(&TInputScanner::getLastValidSourceIndex, &input), &outputBuffer);\n\n\n\n parseContext.setExtensionCallback([&lineSync, &outputBuffer](\n", "file_path": "libraries/glslang/glslang/MachineIndependent/ShaderLang.cpp", "rank": 42, "score": 160987.29171662946 }, { "content": "// For functions declared some other way, but still use the table to relate to operator.\n\nstruct CustomFunction {\n\n TOperator op; // operator to map the name to\n\n const char* name; // function name\n\n const Versioning* versioning; // nullptr means always a valid version\n\n};\n\n\n\nconst CustomFunction CustomFunctions[] = {\n\n { EOpBarrier, \"barrier\", nullptr },\n\n { EOpMemoryBarrierShared, \"memoryBarrierShared\", nullptr },\n\n { EOpGroupMemoryBarrier, \"groupMemoryBarrier\", nullptr },\n\n { EOpMemoryBarrier, \"memoryBarrier\", nullptr },\n\n { EOpMemoryBarrierBuffer, \"memoryBarrierBuffer\", nullptr },\n\n\n\n { EOpPackSnorm2x16, \"packSnorm2x16\", nullptr },\n\n { EOpUnpackSnorm2x16, \"unpackSnorm2x16\", nullptr },\n\n { EOpPackUnorm2x16, \"packUnorm2x16\", nullptr },\n\n { EOpUnpackUnorm2x16, \"unpackUnorm2x16\", nullptr },\n\n { EOpPackHalf2x16, \"packHalf2x16\", nullptr },\n\n { EOpUnpackHalf2x16, \"unpackHalf2x16\", nullptr },\n\n\n", "file_path": "libraries/glslang/glslang/MachineIndependent/Initialize.cpp", "rank": 43, "score": 160987.29171662946 }, { "content": "struct TMatrixSelector {\n\n int coord1; // stay agnostic about column/row; this is parse order\n\n int coord2;\n\n};\n\n\n\ntypedef int TVectorSelector;\n\n\n\nconst int MaxSwizzleSelectors = 4;\n\n\n\ntemplate<typename selectorType>\n", "file_path": "libraries/glslang/glslang/MachineIndependent/localintermediate.h", "rank": 44, "score": 160987.29171662946 }, { "content": "// The main descriptor of what a set of function prototypes can look like, and\n\n// a pointer to extra versioning information, when needed.\n\nstruct BuiltInFunction {\n\n TOperator op; // operator to map the name to\n\n const char* name; // function name\n\n int numArguments; // number of arguments (overloads with varying arguments need different entries)\n\n ArgType types; // ArgType mask\n\n ArgClass classes; // the ways this particular function entry manifests\n\n const Versioning* versioning; // nullptr means always a valid version\n\n};\n\n\n\n// The tables can have the same built-in function name more than one time,\n\n// but the exact same prototype must be indicated at most once.\n\n// The prototypes that get declared are the union of all those indicated.\n\n// This is important when different releases add new prototypes for the same name.\n\n// It also also congnitively simpler tiling of the prototype space.\n\n// In practice, most names can be fully represented with one entry.\n\n//\n\n// Table is terminated by an OpNull TOperator.\n\n\n\nconst BuiltInFunction BaseFunctions[] = {\n\n// TOperator, name, arg-count, ArgType, ArgClass, versioning\n", "file_path": "libraries/glslang/glslang/MachineIndependent/Initialize.cpp", "rank": 45, "score": 160987.29171662946 }, { "content": "struct TPragma {\n\n TPragma(bool o, bool d) : optimize(o), debug(d) { }\n\n bool optimize;\n\n bool debug;\n\n TPragmaTable pragmaTable;\n\n};\n\n\n", "file_path": "libraries/glslang/glslang/MachineIndependent/ParseHelper.h", "rank": 46, "score": 160987.29171662946 }, { "content": "struct TSymbolValidater\n\n{\n\n TSymbolValidater(TIoMapResolver& r, TInfoSink& i, TVarLiveMap* in[EShLangCount], TVarLiveMap* out[EShLangCount],\n\n TVarLiveMap* uniform[EShLangCount], bool& hadError)\n\n : preStage(EShLangCount)\n\n , currentStage(EShLangCount)\n\n , nextStage(EShLangCount)\n\n , resolver(r)\n\n , infoSink(i)\n\n , hadError(hadError)\n\n {\n\n memcpy(inVarMaps, in, EShLangCount * (sizeof(TVarLiveMap*)));\n\n memcpy(outVarMaps, out, EShLangCount * (sizeof(TVarLiveMap*)));\n\n memcpy(uniformVarMap, uniform, EShLangCount * (sizeof(TVarLiveMap*)));\n\n }\n\n\n\n inline void operator()(std::pair<const TString, TVarEntryInfo>& entKey) {\n\n TVarEntryInfo& ent1 = entKey.second;\n\n TIntermSymbol* base = ent1.symbol;\n\n const TType& type = ent1.symbol->getType();\n", "file_path": "libraries/glslang/glslang/MachineIndependent/iomapper.cpp", "rank": 47, "score": 157732.21936561586 }, { "content": "struct TBinop {\n\n int token, precedence, (*op)(int, int);\n\n} binop[] = {\n\n { PpAtomOr, LOGOR, op_logor },\n\n { PpAtomAnd, LOGAND, op_logand },\n\n { '|', OR, op_or },\n\n { '^', XOR, op_xor },\n\n { '&', AND, op_and },\n\n { PpAtomEQ, EQUAL, op_eq },\n\n { PpAtomNE, EQUAL, op_ne },\n\n { '>', RELATION, op_gt },\n\n { PpAtomGE, RELATION, op_ge },\n\n { '<', RELATION, op_lt },\n\n { PpAtomLE, RELATION, op_le },\n\n { PpAtomLeft, SHIFT, op_shl },\n\n { PpAtomRight, SHIFT, op_shr },\n\n { '+', ADD, op_add },\n\n { '-', ADD, op_sub },\n\n { '*', MUL, op_mul },\n\n { '/', MUL, op_div },\n\n { '%', MUL, op_mod },\n\n};\n\n\n", "file_path": "libraries/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp", "rank": 48, "score": 157732.21936561586 }, { "content": "struct TNotifyInOutAdaptor\n\n{\n\n EShLanguage stage;\n\n TIoMapResolver& resolver;\n\n inline TNotifyInOutAdaptor(EShLanguage s, TIoMapResolver& r) \n\n : stage(s)\n\n , resolver(r)\n\n {\n\n }\n\n\n\n inline void operator()(std::pair<const TString, TVarEntryInfo>& entKey)\n\n {\n\n resolver.notifyInOut(stage, entKey.second);\n\n }\n\n\n\nprivate:\n\n TNotifyInOutAdaptor& operator=(TNotifyInOutAdaptor&);\n\n};\n\n\n", "file_path": "libraries/glslang/glslang/MachineIndependent/iomapper.cpp", "rank": 49, "score": 157732.21936561586 }, { "content": "struct TUnop {\n\n int token, (*op)(int);\n\n} unop[] = {\n\n { '+', op_pos },\n\n { '-', op_neg },\n\n { '~', op_cmpl },\n\n { '!', op_not },\n\n};\n\n\n\n#define NUM_ELEMENTS(A) (sizeof(A) / sizeof(A[0]))\n\n\n\nint TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, bool& err, TPpToken* ppToken)\n\n{\n\n TSourceLoc loc = ppToken->loc; // because we sometimes read the newline before reporting the error\n\n if (token == PpAtomIdentifier) {\n\n if (strcmp(\"defined\", ppToken->name) == 0) {\n\n if (! parseContext.isReadingHLSL() && isMacroInput()) {\n\n if (parseContext.relaxedErrors())\n\n parseContext.ppWarn(ppToken->loc, \"nonportable when expanded from macros for preprocessor expression\",\n\n \"defined\", \"\");\n", "file_path": "libraries/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp", "rank": 50, "score": 157732.21936561586 }, { "content": "struct TSlotCollector {\n\n TSlotCollector(TIoMapResolver& r, TInfoSink& i) : resolver(r), infoSink(i) { }\n\n\n\n inline void operator()(std::pair<const TString, TVarEntryInfo>& entKey) {\n\n resolver.reserverStorageSlot(entKey.second, infoSink);\n\n resolver.reserverResourceSlot(entKey.second, infoSink);\n\n }\n\n TIoMapResolver& resolver;\n\n TInfoSink& infoSink;\n\n\n\nprivate:\n\n TSlotCollector& operator=(TSlotCollector&);\n\n};\n\n\n\nTDefaultIoResolverBase::TDefaultIoResolverBase(const TIntermediate& intermediate)\n\n : intermediate(intermediate)\n\n , nextUniformLocation(intermediate.getUniformLocationBase())\n\n , nextInputLocation(0)\n\n , nextOutputLocation(0)\n\n{\n", "file_path": "libraries/glslang/glslang/MachineIndependent/iomapper.cpp", "rank": 51, "score": 157732.21936561586 }, { "content": "// DoFullParse is a valid ProcessingConext template argument for fully\n\n// parsing the shader. It populates the \"intermediate\" with the AST.\n\nstruct DoFullParse{\n\n bool operator()(TParseContextBase& parseContext, TPpContext& ppContext,\n\n TInputScanner& fullInput, bool versionWillBeError,\n\n TSymbolTable&, TIntermediate& intermediate,\n\n EShOptimizationLevel optLevel, EShMessages messages)\n\n {\n\n bool success = true;\n\n // Parse the full shader.\n\n if (! parseContext.parseShaderStrings(ppContext, fullInput, versionWillBeError))\n\n success = false;\n\n\n\n if (success && intermediate.getTreeRoot()) {\n\n if (optLevel == EShOptNoGeneration)\n\n parseContext.infoSink.info.message(EPrefixNone, \"No errors. No code generation or linking was requested.\");\n\n else\n\n success = intermediate.postProcess(intermediate.getTreeRoot(), parseContext.getLanguage());\n\n } else if (! success) {\n\n parseContext.infoSink.info.prefix(EPrefixError);\n\n parseContext.infoSink.info << parseContext.getNumErrors() << \" compilation errors. No code generated.\\n\\n\";\n\n }\n", "file_path": "libraries/glslang/glslang/MachineIndependent/ShaderLang.cpp", "rank": 52, "score": 157732.21936561586 }, { "content": "struct TVarEntryInfo {\n\n int id;\n\n TIntermSymbol* symbol;\n\n bool live;\n\n int newBinding;\n\n int newSet;\n\n int newLocation;\n\n int newComponent;\n\n int newIndex;\n\n EShLanguage stage;\n\n struct TOrderById {\n\n inline bool operator()(const TVarEntryInfo& l, const TVarEntryInfo& r) { return l.id < r.id; }\n\n };\n\n\n\n struct TOrderByPriority {\n\n // ordering:\n\n // 1) has both binding and set\n\n // 2) has binding but no set\n\n // 3) has no binding but set\n\n // 4) has no binding and no set\n", "file_path": "libraries/glslang/glslang/MachineIndependent/iomapper.h", "rank": 53, "score": 157732.21936561586 }, { "content": "struct TResolverInOutAdaptor {\n\n TResolverInOutAdaptor(EShLanguage s, TIoMapResolver& r, TInfoSink& i, bool& e)\n\n : stage(s)\n\n , resolver(r)\n\n , infoSink(i)\n\n , error(e)\n\n {\n\n }\n\n\n\n inline void operator()(std::pair<const TString, TVarEntryInfo>& entKey)\n\n {\n\n TVarEntryInfo& ent = entKey.second;\n\n ent.newLocation = -1;\n\n ent.newComponent = -1;\n\n ent.newBinding = -1;\n\n ent.newSet = -1;\n\n ent.newIndex = -1;\n\n const bool isValid = resolver.validateInOut(stage, ent);\n\n if (isValid) {\n\n resolver.resolveInOutLocation(stage, ent);\n", "file_path": "libraries/glslang/glslang/MachineIndependent/iomapper.cpp", "rank": 54, "score": 157732.21936561586 }, { "content": "struct TNotifyUniformAdaptor\n\n{\n\n EShLanguage stage;\n\n TIoMapResolver& resolver;\n\n inline TNotifyUniformAdaptor(EShLanguage s, TIoMapResolver& r)\n\n : stage(s)\n\n , resolver(r)\n\n {\n\n }\n\n\n\n inline void operator()(std::pair<const TString, TVarEntryInfo>& entKey)\n\n {\n\n resolver.notifyBinding(stage, entKey.second);\n\n }\n\n\n\nprivate:\n\n TNotifyUniformAdaptor& operator=(TNotifyUniformAdaptor&);\n\n};\n\n\n", "file_path": "libraries/glslang/glslang/MachineIndependent/iomapper.cpp", "rank": 55, "score": 154647.0691171822 }, { "content": "struct TResolverUniformAdaptor {\n\n TResolverUniformAdaptor(EShLanguage s, TIoMapResolver& r, TInfoSink& i, bool& e)\n\n : stage(s)\n\n , resolver(r)\n\n , infoSink(i)\n\n , error(e)\n\n {\n\n }\n\n\n\n inline void operator()(std::pair<const TString, TVarEntryInfo>& entKey) {\n\n TVarEntryInfo& ent = entKey.second;\n\n ent.newLocation = -1;\n\n ent.newComponent = -1;\n\n ent.newBinding = -1;\n\n ent.newSet = -1;\n\n ent.newIndex = -1;\n\n const bool isValid = resolver.validateBinding(stage, ent);\n\n if (isValid) {\n\n resolver.resolveBinding(stage, ent);\n\n resolver.resolveSet(stage, ent);\n", "file_path": "libraries/glslang/glslang/MachineIndependent/iomapper.cpp", "rank": 56, "score": 154647.0691171822 }, { "content": "struct libdivide_u64_t libdivide_u64_gen(uint64_t d) {\n\n return libdivide_internal_u64_gen(d, 0);\n\n}\n\n\n", "file_path": "source/thirdparty/include/libdivide.h", "rank": 57, "score": 141278.12963073354 }, { "content": "struct libdivide_u32_t libdivide_u32_gen(uint32_t d) {\n\n return libdivide_internal_u32_gen(d, 0);\n\n}\n\n\n", "file_path": "source/thirdparty/include/libdivide.h", "rank": 58, "score": 141278.12963073354 }, { "content": "struct libdivide_s32_t libdivide_s32_gen(int32_t d) {\n\n return libdivide_internal_s32_gen(d, 0);\n\n}\n\n\n", "file_path": "source/thirdparty/include/libdivide.h", "rank": 59, "score": 141278.12963073354 }, { "content": "struct libdivide_s64_t libdivide_s64_gen(int64_t d) {\n\n return libdivide_internal_s64_gen(d, 0);\n\n}\n\n\n", "file_path": "source/thirdparty/include/libdivide.h", "rank": 60, "score": 141278.12963073354 }, { "content": "void DoBubbleMachines();\n", "file_path": "source/exhumed/src/bubbles.h", "rank": 61, "score": 138841.7582125095 }, { "content": "//\n\n// Code to recursively delete the intermediate tree.\n\n//\n\nstruct TRemoveTraverser : TIntermTraverser {\n\n TRemoveTraverser() : TIntermTraverser(false, false, true, false) {}\n\n\n\n virtual void visitSymbol(TIntermSymbol* node)\n\n {\n\n delete node;\n\n }\n\n\n\n virtual bool visitBinary(TVisit /* visit*/ , TIntermBinary* node)\n\n {\n\n delete node;\n\n\n\n return true;\n\n }\n\n\n\n virtual bool visitUnary(TVisit /* visit */, TIntermUnary* node)\n\n {\n\n delete node;\n\n\n\n return true;\n", "file_path": "libraries/glslang/glslang/MachineIndependent/RemoveTree.cpp", "rank": 62, "score": 138567.5411527674 }, { "content": "void BuildBubbleMachine(int nSprite);\n", "file_path": "source/exhumed/src/bubbles.h", "rank": 63, "score": 135858.03141838827 }, { "content": "struct libdivide_s32_branchfree_t libdivide_s32_branchfree_gen(int32_t d) {\n\n struct libdivide_s32_t tmp = libdivide_internal_s32_gen(d, 1);\n\n struct libdivide_s32_branchfree_t result = {tmp.magic, tmp.more};\n\n return result;\n\n}\n\n\n\nint32_t libdivide_s32_do(int32_t numer, const struct libdivide_s32_t *denom) {\n\n uint8_t more = denom->more;\n\n uint8_t shift = more & LIBDIVIDE_32_SHIFT_MASK;\n\n\n\n if (!denom->magic) {\n\n uint32_t sign = (int8_t)more >> 7;\n\n uint32_t mask = (1U << shift) - 1;\n\n uint32_t uq = numer + ((numer >> 31) & mask);\n\n int32_t q = (int32_t)uq;\n\n q >>= shift;\n\n q = (q ^ sign) - sign;\n\n return q;\n\n } else {\n\n uint32_t uq = (uint32_t)libdivide_mullhi_s32(denom->magic, numer);\n", "file_path": "source/thirdparty/include/libdivide.h", "rank": 64, "score": 135254.5416584432 }, { "content": "struct libdivide_u32_branchfree_t libdivide_u32_branchfree_gen(uint32_t d) {\n\n if (d == 1) {\n\n LIBDIVIDE_ERROR(\"branchfree divider must be != 1\");\n\n }\n\n struct libdivide_u32_t tmp = libdivide_internal_u32_gen(d, 1);\n\n struct libdivide_u32_branchfree_t ret = {tmp.magic, (uint8_t)(tmp.more & LIBDIVIDE_32_SHIFT_MASK)};\n\n return ret;\n\n}\n\n\n\nuint32_t libdivide_u32_do(uint32_t numer, const struct libdivide_u32_t *denom) {\n\n uint8_t more = denom->more;\n\n if (!denom->magic) {\n\n return numer >> more;\n\n }\n\n else {\n\n uint32_t q = libdivide_mullhi_u32(denom->magic, numer);\n\n if (more & LIBDIVIDE_ADD_MARKER) {\n\n uint32_t t = ((numer - q) >> 1) + q;\n\n return t >> (more & LIBDIVIDE_32_SHIFT_MASK);\n\n }\n", "file_path": "source/thirdparty/include/libdivide.h", "rank": 65, "score": 135254.5416584432 }, { "content": "struct libdivide_u64_branchfree_t libdivide_u64_branchfree_gen(uint64_t d) {\n\n if (d == 1) {\n\n LIBDIVIDE_ERROR(\"branchfree divider must be != 1\");\n\n }\n\n struct libdivide_u64_t tmp = libdivide_internal_u64_gen(d, 1);\n\n struct libdivide_u64_branchfree_t ret = {tmp.magic, (uint8_t)(tmp.more & LIBDIVIDE_64_SHIFT_MASK)};\n\n return ret;\n\n}\n\n\n\nuint64_t libdivide_u64_do(uint64_t numer, const struct libdivide_u64_t *denom) {\n\n uint8_t more = denom->more;\n\n if (!denom->magic) {\n\n return numer >> more;\n\n }\n\n else {\n\n uint64_t q = libdivide_mullhi_u64(denom->magic, numer);\n\n if (more & LIBDIVIDE_ADD_MARKER) {\n\n uint64_t t = ((numer - q) >> 1) + q;\n\n return t >> (more & LIBDIVIDE_64_SHIFT_MASK);\n\n }\n", "file_path": "source/thirdparty/include/libdivide.h", "rank": 66, "score": 135254.5416584432 }, { "content": "struct libdivide_s64_branchfree_t libdivide_s64_branchfree_gen(int64_t d) {\n\n struct libdivide_s64_t tmp = libdivide_internal_s64_gen(d, 1);\n\n struct libdivide_s64_branchfree_t ret = {tmp.magic, tmp.more};\n\n return ret;\n\n}\n\n\n\nint64_t libdivide_s64_do(int64_t numer, const struct libdivide_s64_t *denom) {\n\n uint8_t more = denom->more;\n\n uint8_t shift = more & LIBDIVIDE_64_SHIFT_MASK;\n\n\n\n if (!denom->magic) { // shift path\n\n uint64_t mask = (1ULL << shift) - 1;\n\n uint64_t uq = numer + ((numer >> 63) & mask);\n\n int64_t q = (int64_t)uq;\n\n q >>= shift;\n\n // must be arithmetic shift and then sign-extend\n\n int64_t sign = (int8_t)more >> 7;\n\n q = (q ^ sign) - sign;\n\n return q;\n\n } else {\n", "file_path": "source/thirdparty/include/libdivide.h", "rank": 67, "score": 135254.5416584432 }, { "content": "struct TSampler { // misnomer now; includes images, textures without sampler, and textures with sampler\n\n TBasicType type : 8; // type returned by sampler\n\n TSamplerDim dim : 8;\n\n bool arrayed : 1;\n\n bool shadow : 1;\n\n bool ms : 1;\n\n bool image : 1; // image, combined should be false\n\n bool combined : 1; // true means texture is combined with a sampler, false means texture with no sampler\n\n bool sampler : 1; // true means a pure sampler, other fields should be clear()\n\n\n\n#ifdef GLSLANG_WEB\n\n bool is1D() const { return false; }\n\n bool isBuffer() const { return false; }\n\n bool isRect() const { return false; }\n\n bool isSubpass() const { return false; }\n\n bool isCombined() const { return true; }\n\n bool isImage() const { return false; }\n\n bool isImageClass() const { return false; }\n\n bool isMultiSample() const { return false; }\n\n bool isExternal() const { return false; }\n", "file_path": "libraries/glslang/glslang/Include/Types.h", "rank": 68, "score": 131284.32225267895 }, { "content": "struct TModuleType<false> { using Type = FStaticModule; };\n\n\n\ntemplate<bool Dynamic>\n\nusing FModuleMaybe = typename TModuleType<Dynamic>::Type;\n\n\n\n// ------------------------------------------------------------------------\n\n\n\ntemplate<FModule &Module, typename Proto>\n", "file_path": "source/common/utility/i_module.h", "rank": 69, "score": 129721.23360066491 }, { "content": "struct TextureUpgradeAndSamplerRemovalTransform : public TIntermTraverser {\n\n void visitSymbol(TIntermSymbol* symbol) override {\n\n if (symbol->getBasicType() == EbtSampler && symbol->getType().getSampler().isTexture()) {\n\n symbol->getWritableType().getSampler().setCombined(true);\n\n }\n\n }\n\n bool visitAggregate(TVisit, TIntermAggregate* ag) override {\n\n using namespace std;\n\n TIntermSequence& seq = ag->getSequence();\n\n TQualifierList& qual = ag->getQualifierList();\n\n\n\n // qual and seq are indexed using the same indices, so we have to modify both in lock-step\n\n assert(seq.size() == qual.size() || qual.empty());\n\n\n\n size_t write = 0;\n\n for (size_t i = 0; i < seq.size(); ++i) {\n\n TIntermSymbol* symbol = seq[i]->getAsSymbolNode();\n\n if (symbol && symbol->getBasicType() == EbtSampler && symbol->getType().getSampler().isPureSampler()) {\n\n // remove pure sampler variables\n\n continue;\n", "file_path": "libraries/glslang/glslang/MachineIndependent/Intermediate.cpp", "rank": 70, "score": 128440.47275013123 }, { "content": "struct TDefaultIoResolver : public TDefaultIoResolverBase {\n\n TDefaultIoResolver(const TIntermediate& intermediate) : TDefaultIoResolverBase(intermediate) { }\n\n\n\n bool validateBinding(EShLanguage /*stage*/, TVarEntryInfo& /*ent*/) override { return true; }\n\n\n\n TResourceType getResourceType(const glslang::TType& type) override {\n\n if (isImageType(type)) {\n\n return EResImage;\n\n }\n\n if (isTextureType(type)) {\n\n return EResTexture;\n\n }\n\n if (isSsboType(type)) {\n\n return EResSsbo;\n\n }\n\n if (isSamplerType(type)) {\n\n return EResSampler;\n\n }\n\n if (isUboType(type)) {\n\n return EResUbo;\n", "file_path": "libraries/glslang/glslang/MachineIndependent/iomapper.cpp", "rank": 71, "score": 126142.56953961209 }, { "content": "// Defaulf I/O resolver for OpenGL\n\nstruct TDefaultGlslIoResolver : public TDefaultIoResolverBase {\n\npublic:\n\n typedef std::map<TString, int> TVarSlotMap; // <resourceName, location/binding>\n\n typedef std::map<int, TVarSlotMap> TSlotMap; // <resourceKey, TVarSlotMap>\n\n TDefaultGlslIoResolver(const TIntermediate& intermediate);\n\n bool validateBinding(EShLanguage /*stage*/, TVarEntryInfo& /*ent*/) override { return true; }\n\n TResourceType getResourceType(const glslang::TType& type) override;\n\n int resolveInOutLocation(EShLanguage stage, TVarEntryInfo& ent) override;\n\n int resolveUniformLocation(EShLanguage /*stage*/, TVarEntryInfo& ent) override;\n\n int resolveBinding(EShLanguage /*stage*/, TVarEntryInfo& ent) override;\n\n void beginResolve(EShLanguage /*stage*/) override;\n\n void endResolve(EShLanguage stage) override;\n\n void beginCollect(EShLanguage) override;\n\n void endCollect(EShLanguage) override;\n\n void reserverStorageSlot(TVarEntryInfo& ent, TInfoSink& infoSink) override;\n\n void reserverResourceSlot(TVarEntryInfo& ent, TInfoSink& infoSink) override;\n\n // in/out symbol and uniform symbol are stored in the same resourceSlotMap, the storage key is used to identify each type of symbol.\n\n // We use stage and storage qualifier to construct a storage key. it can help us identify the same storage resource used in different stage.\n\n // if a resource is a program resource and we don't need know it usage stage, we can use same stage to build storage key.\n\n // Note: both stage and type must less then 0xffff.\n", "file_path": "libraries/glslang/glslang/MachineIndependent/iomapper.h", "rank": 72, "score": 126142.56953961209 }, { "content": "struct TDefaultHlslIoResolver : public TDefaultIoResolverBase {\n\n TDefaultHlslIoResolver(const TIntermediate& intermediate) : TDefaultIoResolverBase(intermediate) { }\n\n\n\n bool validateBinding(EShLanguage /*stage*/, TVarEntryInfo& /*ent*/) override { return true; }\n\n\n\n TResourceType getResourceType(const glslang::TType& type) override {\n\n if (isUavType(type)) {\n\n return EResUav;\n\n }\n\n if (isSrvType(type)) {\n\n return EResTexture;\n\n }\n\n if (isSamplerType(type)) {\n\n return EResSampler;\n\n }\n\n if (isUboType(type)) {\n\n return EResUbo;\n\n }\n\n return EResCount;\n\n }\n", "file_path": "libraries/glslang/glslang/MachineIndependent/iomapper.cpp", "rank": 73, "score": 123946.09096789635 }, { "content": "// Base class for shared TIoMapResolver services, used by several derivations.\n\nstruct TDefaultIoResolverBase : public glslang::TIoMapResolver {\n\npublic:\n\n TDefaultIoResolverBase(const TIntermediate& intermediate);\n\n typedef std::vector<int> TSlotSet;\n\n typedef std::unordered_map<int, TSlotSet> TSlotSetMap;\n\n\n\n // grow the reflection stage by stage\n\n void notifyBinding(EShLanguage, TVarEntryInfo& /*ent*/) override {}\n\n void notifyInOut(EShLanguage, TVarEntryInfo& /*ent*/) override {}\n\n void beginNotifications(EShLanguage) override {}\n\n void endNotifications(EShLanguage) override {}\n\n void beginResolve(EShLanguage) override {}\n\n void endResolve(EShLanguage) override {}\n\n void beginCollect(EShLanguage) override {}\n\n void endCollect(EShLanguage) override {}\n\n void reserverResourceSlot(TVarEntryInfo& /*ent*/, TInfoSink& /*infoSink*/) override {}\n\n void reserverStorageSlot(TVarEntryInfo& /*ent*/, TInfoSink& /*infoSink*/) override {}\n\n int getBaseBinding(TResourceType res, unsigned int set) const;\n\n const std::vector<std::string>& getResourceSetBinding() const;\n\n virtual TResourceType getResourceType(const glslang::TType& type) = 0;\n", "file_path": "libraries/glslang/glslang/MachineIndependent/iomapper.h", "rank": 74, "score": 122404.89393356569 }, { "content": "static inline constexpr int fix16_to_int(fix16_t a)\n\n{\n\n#ifdef FIXMATH_NO_ROUNDING\n\n return (a >> 16);\n\n#else\n\n if (a >= 0)\n\n return (a + (fix16_one >> 1)) / fix16_one;\n\n return (a - (fix16_one >> 1)) / fix16_one;\n\n#endif\n", "file_path": "source/thirdparty/include/fix16.h", "rank": 75, "score": 121727.2197479505 }, { "content": "static FORCE_INLINE CONSTEXPR fix16_t fix16_from_int(int a) { return a * fix16_one; }\n", "file_path": "source/thirdparty/include/fix16.h", "rank": 76, "score": 121727.2197479505 }, { "content": "#define SHORT_CIRCUIT__STATIC 21\n", "file_path": "source/rr/src/soundsdyn.h", "rank": 77, "score": 118551.34082828462 }, { "content": "struct ZCC_StructWork\n\n{\n\n\tPSymbolTable TreeNodes;\n\n\tZCC_Struct *strct;\n\n\tZCC_Class *OuterDef;\n\n\tPClass *Outer;\n\n\tPSymbolTreeNode *node;\n\n\tTArray<ZCC_Enum *> Enums;\n\n\tTArray<ZCC_ConstantDef *> Constants;\n\n\tTArray<ZCC_VarDeclarator *> Fields;\n\n\tTArray<ZCC_FuncDeclarator *> Functions;\n\n\tTArray<ZCC_StaticArrayStatement *> Arrays;\n\n\n\n\tZCC_StructWork()\n\n\t{\n\n\t}\n\n\n\n\tZCC_StructWork(ZCC_Struct * s, PSymbolTreeNode *n, ZCC_Class *outer)\n\n\t{\n\n\t\tstrct = s;\n", "file_path": "source/common/scripting/frontend/zcc_compile.h", "rank": 78, "score": 117663.996250025 }, { "content": "local void tr_static_init OF((void));\n", "file_path": "libraries/zlib/trees.c", "rank": 79, "score": 116840.8099320016 }, { "content": "local void fixedtables(state)\n", "file_path": "libraries/zlib/inflate.c", "rank": 80, "score": 116837.9758960015 }, { "content": "local void fixedtables(state)\n", "file_path": "libraries/zlib/infback.c", "rank": 81, "score": 116837.9758960015 }, { "content": "local void check_match OF((deflate_state *s, IPos start, IPos match,\n", "file_path": "libraries/zlib/deflate.c", "rank": 82, "score": 116833.14870090019 }, { "content": "local void make_crc_table OF((void));\n", "file_path": "libraries/zlib/crc32.c", "rank": 83, "score": 116833.14870090019 }, { "content": "#include \"player.h\"\n\n#include \"seq.h\"\n\n#include \"sfx.h\"\n\n#include \"trig.h\"\n\n#include \"nnexts.h\"\n\n\n\nBEGIN_BLD_NS\n\n\n\nstatic void SlashFSeqCallback(int, int);\n\nstatic void ThrowFSeqCallback(int, int);\n\nstatic void BlastSSeqCallback(int, int);\n\nstatic void ThrowSSeqCallback(int, int);\n\nstatic void thinkTarget(spritetype *, XSPRITE *);\n\nstatic void thinkSearch(spritetype *, XSPRITE *);\n\nstatic void thinkGoto(spritetype *, XSPRITE *);\n\nstatic void MoveDodgeUp(spritetype *, XSPRITE *);\n\nstatic void MoveDodgeDown(spritetype *, XSPRITE *);\n\nstatic void thinkChase(spritetype *, XSPRITE *);\n\nstatic void entryFStatue(spritetype *, XSPRITE *);\n\nstatic void entrySStatue(spritetype *, XSPRITE *);\n", "file_path": "source/blood/src/aigarg.cpp", "rank": 86, "score": 33.88700552794228 }, { "content": "#include \"player.h\"\n\n#include \"seq.h\"\n\n#include \"sfx.h\"\n\n#include \"trig.h\"\n\n#include \"nnexts.h\"\n\n\n\nBEGIN_BLD_NS\n\n\n\nstatic void SlashSeqCallback(int, int);\n\nstatic void ThrowSeqCallback(int, int);\n\nstatic void BlastSeqCallback(int, int);\n\nstatic void thinkTarget(spritetype *, XSPRITE *);\n\nstatic void thinkSearch(spritetype *, XSPRITE *);\n\nstatic void thinkGoto(spritetype *, XSPRITE *);\n\nstatic void MoveDodgeUp(spritetype *, XSPRITE *);\n\nstatic void MoveDodgeDown(spritetype *, XSPRITE *);\n\nstatic void thinkChase(spritetype *, XSPRITE *);\n\nstatic void MoveForward(spritetype *, XSPRITE *);\n\nstatic void MoveSlow(spritetype *, XSPRITE *);\n\nstatic void MoveSwoop(spritetype *, XSPRITE *);\n", "file_path": "source/blood/src/aighost.cpp", "rank": 87, "score": 33.79376636319216 }, { "content": "#include \"player.h\"\n\n#include \"seq.h\"\n\n#include \"sfx.h\"\n\n#include \"trig.h\"\n\n\n\nBEGIN_BLD_NS\n\n\n\nstatic void sub_6FF08(int, int);\n\nstatic void sub_6FF54(int, int);\n\nstatic void sub_6FFA0(int, int);\n\nstatic void sub_70284(int, int);\n\nstatic void sub_7034C(spritetype *, XSPRITE *);\n\nstatic void sub_70380(spritetype *, XSPRITE *);\n\nstatic void sub_704D8(spritetype *, XSPRITE *);\n\n\n\nstatic int dword_279B34 = seqRegisterClient(sub_6FFA0);\n\nstatic int dword_279B38 = seqRegisterClient(sub_70284);\n\nstatic int dword_279B3C = seqRegisterClient(sub_6FF08);\n\nstatic int dword_279B40 = seqRegisterClient(sub_6FF54);\n\n\n", "file_path": "source/blood/src/aipod.cpp", "rank": 88, "score": 33.52458429785591 }, { "content": "#include \"player.h\"\n\n#include \"seq.h\"\n\n#include \"sfx.h\"\n\n#include \"trig.h\"\n\n\n\nBEGIN_BLD_NS\n\n\n\nstatic void sub_71A90(int, int);\n\nstatic void sub_71BD4(int, int);\n\nstatic void sub_720AC(int, int);\n\nstatic void sub_72580(spritetype *, XSPRITE *);\n\nstatic void sub_725A4(spritetype *, XSPRITE *);\n\nstatic void sub_72850(spritetype *, XSPRITE *);\n\nstatic void sub_72934(spritetype *, XSPRITE *);\n\n\n\nstatic int dword_279B54 = seqRegisterClient(sub_71BD4);\n\nstatic int dword_279B58 = seqRegisterClient(sub_720AC);\n\nstatic int dword_279B5C = seqRegisterClient(sub_71A90);\n\n\n\nAISTATE tchernobogIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, sub_725A4, NULL };\n", "file_path": "source/blood/src/aitchern.cpp", "rank": 89, "score": 32.89978572807572 }, { "content": "#include \"seq.h\"\n\n#include \"sfx.h\"\n\n#include \"trig.h\"\n\n\n\nBEGIN_BLD_NS\n\n\n\nstatic void TommySeqCallback(int, int);\n\nstatic void TeslaSeqCallback(int, int);\n\nstatic void ShotSeqCallback(int, int);\n\nstatic void ThrowSeqCallback(int, int);\n\nstatic void sub_68170(int, int);\n\nstatic void sub_68230(int, int);\n\nstatic void thinkSearch(spritetype *, XSPRITE *);\n\nstatic void thinkGoto(spritetype *, XSPRITE *);\n\nstatic void thinkChase(spritetype *, XSPRITE *);\n\n\n\nstatic int nTommyClient = seqRegisterClient(TommySeqCallback);\n\nstatic int nTeslaClient = seqRegisterClient(TeslaSeqCallback);\n\nstatic int nShotClient = seqRegisterClient(ShotSeqCallback);\n\nstatic int nThrowClient = seqRegisterClient(ThrowSeqCallback);\n", "file_path": "source/blood/src/aicult.cpp", "rank": 90, "score": 32.74727831972056 }, { "content": " {28, 1}\n\n};\n\n\n\n\n\nstatic SavegameHelper sgh(\"rex\",\n\n SV(RexCount),\n\n SA(RexChan),\n\n SA(RexList),\n\n nullptr);\n\n\n\n\n\nvoid InitRexs()\n\n{\n\n RexCount = kMaxRex;\n\n}\n\n\n\nint BuildRex(short nSprite, int x, int y, int z, short nSector, short nAngle, int nChannel)\n\n{\n\n RexCount--;\n\n\n", "file_path": "source/exhumed/src/rex.cpp", "rank": 91, "score": 32.72925360509846 }, { "content": "*/\n\n//-------------------------------------------------------------------------\n\n#include \"ns.h\"\t// Must come before everything else!\n\n\n\n#include \"build.h\"\n\n#include \"compat.h\"\n\n#include \"common_game.h\"\n\n#include \"qav.h\"\n\n#include \"tile.h\"\n\n#include \"sfx.h\"\n\n#include \"sound.h\"\n\n\n\nBEGIN_BLD_NS\n\n\n\n#define kMaxClients 64\n\nstatic void (*clientCallback[kMaxClients])(int, void *);\n\nstatic int nClients;\n\n\n\n\n\nint qavRegisterClient(void(*pClient)(int, void *))\n", "file_path": "source/blood/src/qav.cpp", "rank": 92, "score": 32.439922964682395 }, { "content": "#include \"seq.h\"\n\n#include \"sfx.h\"\n\n#include \"trig.h\"\n\n\n\nBEGIN_BLD_NS\n\n\n\nstatic void HackSeqCallback(int, int);\n\nstatic void StandSeqCallback(int, int);\n\nstatic void thinkSearch(spritetype *, XSPRITE *);\n\nstatic void thinkGoto(spritetype *, XSPRITE *);\n\nstatic void thinkChase(spritetype *, XSPRITE *);\n\nstatic void thinkPonder(spritetype *, XSPRITE *);\n\nstatic void myThinkTarget(spritetype *, XSPRITE *);\n\nstatic void myThinkSearch(spritetype *, XSPRITE *);\n\nstatic void entryEZombie(spritetype *, XSPRITE *);\n\nstatic void entryAIdle(spritetype *, XSPRITE *);\n\nstatic void entryEStand(spritetype *, XSPRITE *);\n\n\n\nstatic int nHackClient = seqRegisterClient(HackSeqCallback);\n\nstatic int nStandClient = seqRegisterClient(StandSeqCallback);\n", "file_path": "source/blood/src/aizomba.cpp", "rank": 93, "score": 31.93155018344968 }, { "content": "\n\nDEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, ByteAt, StringByteAt)\n\n{\n\n\tPARAM_SELF_STRUCT_PROLOGUE(FString);\n\n\tPARAM_INT(pos);\n\n\tACTION_RETURN_INT(StringByteAt(self, pos));\n\n}\n\n\n\nstatic void StringFilter(FString *self, FString *result)\n\n{\n\n\t*result = strbin1(*self);\n\n}\n\n\n\nDEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, Filter, StringFilter)\n\n{\n\n\tPARAM_SELF_STRUCT_PROLOGUE(FString);\n\n\tACTION_RETURN_STRING(strbin1(*self));\n\n}\n\n\n\nstatic int StringIndexOf(FString *self, const FString &substr, int startIndex)\n", "file_path": "source/common/scripting/interface/stringformat.cpp", "rank": 94, "score": 31.628994817761523 }, { "content": "#include \"player.h\"\n\n#include \"seq.h\"\n\n#include \"sfx.h\"\n\n#include \"trig.h\"\n\n\n\nBEGIN_BLD_NS\n\n\n\nstatic void SpidBiteSeqCallback(int, int);\n\nstatic void SpidJumpSeqCallback(int, int);\n\nstatic void sub_71370(int, int);\n\nstatic void thinkSearch(spritetype *, XSPRITE *);\n\nstatic void thinkGoto(spritetype *, XSPRITE *);\n\nstatic void thinkChase(spritetype *, XSPRITE *);\n\n\n\nstatic int nBiteClient = seqRegisterClient(SpidBiteSeqCallback);\n\nstatic int nJumpClient = seqRegisterClient(SpidJumpSeqCallback);\n\nstatic int dword_279B50 = seqRegisterClient(sub_71370);\n\n\n\nAISTATE spidIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, aiThinkTarget, NULL };\n\nAISTATE spidChase = { kAiStateChase, 7, -1, 0, NULL, aiMoveForward, thinkChase, NULL };\n", "file_path": "source/blood/src/aispid.cpp", "rank": 95, "score": 31.449831497095992 }, { "content": "#include \"sfx.h\"\n\n#include \"trig.h\"\n\n\n\nBEGIN_BLD_NS\n\n\n\nstatic void SlashSeqCallback(int, int);\n\nstatic void StompSeqCallback(int, int);\n\nstatic void MorphToBeast(spritetype *, XSPRITE *);\n\nstatic void thinkSearch(spritetype *, XSPRITE *);\n\nstatic void thinkGoto(spritetype *, XSPRITE *);\n\nstatic void thinkChase(spritetype *, XSPRITE *);\n\nstatic void thinkSwimGoto(spritetype *, XSPRITE *);\n\nstatic void thinkSwimChase(spritetype *, XSPRITE *);\n\nstatic void MoveForward(spritetype *, XSPRITE *);\n\nstatic void sub_628A0(spritetype *, XSPRITE *);\n\nstatic void sub_62AE0(spritetype *, XSPRITE *);\n\nstatic void sub_62D7C(spritetype *, XSPRITE *);\n\n\n\nstatic int nSlashClient = seqRegisterClient(SlashSeqCallback);\n\nstatic int nStompClient = seqRegisterClient(StompSeqCallback);\n", "file_path": "source/blood/src/aibeast.cpp", "rank": 96, "score": 30.781646630310295 }, { "content": "};\n\n\n\nstatic SavegameHelper sgh(\"spider\",\n\n SV(SpiderCount),\n\n SA(SpiderList),\n\n nullptr);\n\n\n\nvoid InitSpider()\n\n{\n\n SpiderCount = 0;\n\n}\n\n\n\nint BuildSpider(int nSprite, int x, int y, int z, short nSector, int nAngle)\n\n{\n\n int nSpider = SpiderCount++;\n\n if (nSpider >= kMaxSpiders) {\n\n return -1;\n\n }\n\n\n\n if (nSprite == -1)\n", "file_path": "source/exhumed/src/spider.cpp", "rank": 97, "score": 30.751326783386503 }, { "content": "//#include <io.h>\n\n//#include <fcntl.h>\n\n#include \"gamecvars.h\"\n\n\n\n// static int globhiz, globloz, globhihit, globlohit;\n\n\n\nBEGIN_PS_NS\n\n\n\n\n\nvoid overwritesprite(int thex, int they, short tilenum, signed char shade, char stat, char dapalnum, int basepal)\n\n{\n\n#if 0\n\n rotatesprite(thex << 16, they << 16, 0x10000, (short)((flags & 8) << 7), tilenum, shade, dapalnum,\n\n (char)(((flags & 1 ^ 1) << 4) + (flags & 2) + ((flags & 4) >> 2) + ((flags & 16) >> 2) ^ ((flags & 8) >> 1)),\n\n windowx1, windowy1, windowx2, windowy2);\n\n#endif\n\n // no animation\n\n uint8_t animbak = picanm[tilenum].sf;\n\n picanm[tilenum].sf = 0;\n\n int offx = 0, offy = 0;\n", "file_path": "source/exhumed/src/enginesubs.cpp", "rank": 98, "score": 30.566337769375643 } ]
C++
source/Core/ElementStyleProxy.cpp
weimingtom/rocketsquirrel
1d2a22672b7bacf2775d71c0164dee0ce419da2d
#include "ElementStyleProxy.h" #include "ElementInterface.h" #include "VariantInterface.h" #include <sqbind/SquirrelBind.h> #include "../Debug.h" #include "../BindingUtil.h" #include "../NamespaceHelper.h" #include "ElementWrapperDerived.h" namespace Rocket { namespace Core { namespace Squirrel { ElementStyleProxy::ElementStyleProxy(const ElementStyleProxy& other) : m_pElement(0x0) { operator=(other); } ElementStyleProxy::ElementStyleProxy(Rocket::Core::Element* pElement) : m_pElement(0x0) { SetElement(pElement); } ElementStyleProxy::ElementStyleProxy() : m_pElement(0x0) { } void ElementStyleProxy::SetElement(Rocket::Core::Element* pElement) { m_pElement = pElement; m_pElement->AddReference(); } ElementStyleProxy::~ElementStyleProxy() { if (m_pElement) { m_pElement->RemoveReference(); } } ElementStyleProxy& ElementStyleProxy::operator= (const ElementStyleProxy& other) { ROCKETSQUIRREL_ASSERT(other.m_pElement != 0x0); SetElement(other.m_pElement); return *this; } SQInteger ElementStyleProxy::SetAttr(HSQUIRRELVM vm) { sqb::StackHandler sh(vm); ROCKETSQUIRREL_ASSERT(sh.GetParamCount() >= 3); ROCKETSQUIRREL_ASSERT(sh.IsString(2)); Rocket::Core::String key = Rocket::Core::String(sh.GetString(2)).Replace("_", "-"); Rocket::Core::String value; if (sh.IsString(3)) { value = sh.GetString(3); } if (sh.IsNumber(3)) { Rocket::Core::Variant vari; vari.Set(sh.GetNumber<float>(3)); value = vari.Get<Rocket::Core::String>(); } if (!m_pElement->SetProperty(key.CString(), value.CString())) { return sh.ThrowNull(); } return sh.Return(); } SQInteger ElementStyleProxy::GetAttr(HSQUIRRELVM vm) { sqb::StackHandler sh(vm); ROCKETSQUIRREL_ASSERT(sh.GetParamCount() >= 2); ROCKETSQUIRREL_ASSERT(sh.IsString(2)); Rocket::Core::String key = Rocket::Core::String(sh.GetString(2)).Replace("_", "-"); const Rocket::Core::Property* property = m_pElement->GetProperty(key.CString()); if (!property) { return sh.ThrowNull(); } mCache = property->ToString(); return sh.Return(mCache.CString()); } void ElementStyleProxy::Bind(HSQUIRRELVM vm) { sqb::ClassDefinition<ElementStyleProxy> cE(vm, -1, _SC("Style")); cE.Constructor(&NoConstructable); cE.NativeClassFunction(&ElementStyleProxy::SetAttr, _SC("_set"), sqb::FunctionOptions().ParamCheckCount(-2).TypeMask(_SC("xss|i|f"))); cE.NativeClassFunction(&ElementStyleProxy::GetAttr, _SC("_get"), sqb::FunctionOptions().ParamCheckCount(-2).TypeMask(_SC("xs"))); } } } }
#include "ElementStyleProxy.h" #include "ElementInterface.h" #include "VariantInterface.h" #include <sqbind/SquirrelBind.h> #include "../Debug.h" #include "../BindingUtil.h" #include "../NamespaceHelper.h" #include "ElementWrapperDerived.h" namespace Rocket { namespace Core { namespace Squirrel { ElementStyleProxy::ElementStyleProxy(const ElementStyleProxy& other) : m_pElement(0x0) { operator=(other); } ElementStyleProxy::ElementStyleProxy(Rocket::Core::Element* pElement) : m_pElement(0x0) { SetElement(pElement); } ElementStyleProxy::ElementStyleProxy() : m_pElement(0x0) { } void ElementStyleProxy::SetElement(Rocket::Core::Element* pElement) { m_pElement = pElement; m_pElement->AddReference(); } ElementStyleProxy::~ElementStyleProxy() { if (m_pElement) { m_pElement->RemoveReference(); } } ElementStyleProxy& ElementStyleProxy::operator= (const ElementStyleProxy& other) { ROCKETSQUIRREL_ASSERT(other.m_pElement != 0x0); SetElement(other.m_pElement); return *this; } SQInteger ElementStyleProxy::SetAttr(HSQUIRRELVM vm) { sqb::StackHandler sh(vm); ROCKETSQUIRREL_ASSERT(sh.GetParamCount() >= 3); ROCKETSQUIRREL_ASSERT(sh.IsString(2)); Rocket::Core::String key = Rocket::Core::String(sh.GetString(2)).Replace("_", "-"); Rocket::Core::String value; if (sh.IsString(3)) { value = sh.GetString(3); } if (sh.IsNumber(3)) { Rocket::Core::Variant vari; vari.Set(sh.GetNumber<float>(3)); value = vari.Get<Rocket::Core::String>(); } if (!m_pElement->SetProperty(key.CString(), value.CString())) { return sh.ThrowNull(); } return sh.Return(); }
void ElementStyleProxy::Bind(HSQUIRRELVM vm) { sqb::ClassDefinition<ElementStyleProxy> cE(vm, -1, _SC("Style")); cE.Constructor(&NoConstructable); cE.NativeClassFunction(&ElementStyleProxy::SetAttr, _SC("_set"), sqb::FunctionOptions().ParamCheckCount(-2).TypeMask(_SC("xss|i|f"))); cE.NativeClassFunction(&ElementStyleProxy::GetAttr, _SC("_get"), sqb::FunctionOptions().ParamCheckCount(-2).TypeMask(_SC("xs"))); } } } }
SQInteger ElementStyleProxy::GetAttr(HSQUIRRELVM vm) { sqb::StackHandler sh(vm); ROCKETSQUIRREL_ASSERT(sh.GetParamCount() >= 2); ROCKETSQUIRREL_ASSERT(sh.IsString(2)); Rocket::Core::String key = Rocket::Core::String(sh.GetString(2)).Replace("_", "-"); const Rocket::Core::Property* property = m_pElement->GetProperty(key.CString()); if (!property) { return sh.ThrowNull(); } mCache = property->ToString(); return sh.Return(mCache.CString()); }
function_block-full_function
[ { "content": "class ROCKETSQUIRRELDLL_API Module : public Rocket::Core::Plugin\n\n{\n\nprivate:\n\n\n\n\tvoid OnInitialise();\n\n\tvoid OnShutdown();\n\n\n\n\tstatic Module* s_pInstance;\n\n\tbool mInitialized;\n\n\n\n\tScriptInterface* m_pScriptInterface;\n\n\n\npublic:\n\n\n\n\t/*! Module entry point\n\n\t * @param pScriptInterface ScriptInterface (similar to Rocket Interfaces) to customize\n\n\t * as your needs. if NULL then it will be created internally\n\n\t */\n\n\tModule(ScriptInterface* pScriptInterface = 0x0);\n\n\t~Module();\n", "file_path": "include/RocketSquirrel/Core/Module.h", "rank": 0, "score": 183525.8613827307 }, { "content": "class ROCKETSQUIRRELDLL_API Module : public Rocket::Core::Plugin\n\n{\n\nprivate:\n\n\n\n\tRocket::Core::Squirrel::Module& mCore;\n\n\n\n\tvoid OnInitialise();\n\n\tvoid OnShutdown();\n\n\n\npublic:\n\n\n\n\t/*! This has to be created and registered after Core::Squirrel::Module */\n\n\tModule();\n\n\t~Module();\n\n};\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n}\n\n}\n\n}\n\n\n\n\n\n\n\n#endif", "file_path": "include/RocketSquirrel/Controls/Module.h", "rank": 1, "score": 174237.75360219378 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n\n\n#ifndef __ROCKETSQUIRREL_CORE_MODULE_INCLUDED\n\n#define __ROCKETSQUIRREL_CORE_MODULE_INCLUDED\n\n\n\n\n\n\n\n#include \"Rocket/Core.h\"\n\n#include \"Rocket/Core/Plugin.h\"\n\n#include <squirrel.h>\n\n#include \"RocketSquirrel.h\"\n\n\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n", "file_path": "include/RocketSquirrel/Core/Module.h", "rank": 2, "score": 152602.70369838836 }, { "content": "/*\n\n * This source file is part of RocketSquirrel, libRocket Plugin / Module / Extension\n\n *\n\n * For the latest information, see http://code.google.com/p/rocketsquirrel/\n\n *\n\n * Copyright (c) 2012 Luis Jimenez\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n * \n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n", "file_path": "include/RocketSquirrel/Core/Module.h", "rank": 3, "score": 152589.32662845924 }, { "content": "\n\n\t/*! Gets the instance (itself)*/\n\n\tstatic Module& instance();\n\n\n\n\t/*! returns mInitialized */\n\n\tbool isInit() const;\n\n\n\n\t/*! Gets the ScriptInterface */\n\n\tScriptInterface& getScriptInterface() const;\n\n};\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n}\n\n}\n\n}\n\n\n\n\n\n\n\n#endif", "file_path": "include/RocketSquirrel/Core/Module.h", "rank": 4, "score": 152578.62144636465 }, { "content": "namespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n/*! \n\n * We need to call this to unreference contexts \n\n * created by squirrel, if you have a better idea\n\n * please let me know on google code.\n\n */\n\nvoid CollectGarbage();\n\n\n\n\n\n}\n\n}\n", "file_path": "include/RocketSquirrel.h", "rank": 5, "score": 148710.71828119946 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef __ROCKETSQUIRREL_SCRIPTINTERFACE_INCLUDED\n\n#define __ROCKETSQUIRREL_SCRIPTINTERFACE_INCLUDED\n\n\n\n#include <squirrel.h>\n\n#include <RocketSquirrel.h>\n\n#include <vector>\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n\n\n\ntypedef void (*ScriptBindFunction)(HSQUIRRELVM vm);\n\n\n\n\n", "file_path": "include/RocketSquirrel/Core/ScriptInterface.h", "rank": 6, "score": 148035.79892650823 }, { "content": "\tvirtual void PrintError(const Rocket::Core::String& text);\n\n\n\n\t/*!\n\n\t * Call this from your C++ squirrel print function\n\n\t * By default if mAttachSquirrelFunctions is true this will be called internally\n\n\t */\n\n\tvirtual void Print(const Rocket::Core::String& text);\n\n\n\n\t/*!\n\n\t * Bindes all the interfaces into the selected VM (no the internal mVM)\n\n\t * This is called internally (BindVM(mVM)) on initialization\n\n\t * but it could be usefull if you want to bind other VM\n\n\t */\n\n\tvoid BindIntoSquirrelVM(HSQUIRRELVM vm) const;\n\n\n\n\tbool isUsingNamespace() const;\n\n\tHSQUIRRELVM getSquirrelVM() const;\n\n\n\n\tvoid AddBindFunction(ScriptBindFunction function);\n\n\tvoid RemoveBindFunction(ScriptBindFunction function);\n", "file_path": "include/RocketSquirrel/Core/ScriptInterface.h", "rank": 7, "score": 148032.4881993404 }, { "content": "\t * it's freshly created or previously created by your own code\n\n\t * RocketSquirrel will bind the interfaces into that VM\n\n\t *\n\n\t * If you dont replace this method then a default VM will be created\n\n\t */\n\n\tvirtual HSQUIRRELVM OpenVM();\n\n\n\n\t/*!\n\n\t * Called on Destroy, it expects to call sq_close on the Virtual Machine\n\n\t * But you dont have to close if you still needing it, by default it calls sq_close(mVM);\n\n\t */\n\n\tvirtual void CloseVM();\n\n\n\n\t/*! \n\n\t * Called at Core::Module deletion \n\n\t */\n\n\tvirtual void Release();\n\n\n\n\t/*!\n\n\t * Called on initialization (tryggered by Rocket::Core::Initialise)\n", "file_path": "include/RocketSquirrel/Core/ScriptInterface.h", "rank": 8, "score": 148027.3481670594 }, { "content": "\n\n\t/*!\n\n\t * Pushes a table related the the document, where all slots \n\n\t * can be created/accesed without messing with the root table\n\n\t * if you want to call function on your own use this to bind the\n\n\t * table and some other variables aswell.\n\n\t */\n\n\tvoid PushDocumentTable(HSQUIRRELVM vm, Rocket::Core::ElementDocument* pDoc);\n\n\n\n\tbool Initialize();\n\n\tvoid Destroy();\n\n};\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n}\n\n}\n\n}\n\n\n\n\n\n\n\n\n\n\n\n#endif", "file_path": "include/RocketSquirrel/Core/ScriptInterface.h", "rank": 9, "score": 148021.836522583 }, { "content": "\t */\n\n\tvirtual bool OnInitialization() = 0;\n\n\n\n\t/*!\n\n\t * Called on Rocket shutdown\n\n\t */\n\n\tvirtual void OnDestroy() = 0;\n\n\n\n\t/*!\n\n\t * Reports a compilation error\n\n\t * You're supoused to call this from your C++ squirrel compilation error function\n\n\t * to enable logging/diplaying of errors\n\n\t * By default if mAttachSquirrelFunctions is true this will be called internally\n\n\t */\n\n\tvirtual void ReportCompilationError(const SQChar* desc, const SQChar* source, SQInteger line, SQInteger column);\n\n\n\n\t/*!\n\n\t * Call this from your C++ squirrel print error function\n\n\t * By default if mAttachSquirrelFunctions is true this will be called internally\n\n\t */\n", "file_path": "include/RocketSquirrel/Core/ScriptInterface.h", "rank": 10, "score": 148018.6481977776 }, { "content": "/*\n\n * This source file is part of RocketSquirrel, libRocket Plugin / Module / Extension\n\n *\n\n * For the latest information, see http://code.google.com/p/rocketsquirrel/\n\n *\n\n * Copyright (c) 2012 Luis Jimenez\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n * \n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n", "file_path": "include/RocketSquirrel/Core/ScriptInterface.h", "rank": 11, "score": 148017.57224919263 }, { "content": "class ElementFormWrapper : public Rocket::Core::Squirrel::ElementWrapper\n\n{\n\nprotected:\n\n\tRocket::Controls::ElementForm* form();\n\n\n\npublic:\n\n\n\n\tSQInteger Submit(HSQUIRRELVM vm);\n\n\n\n\tstatic void Bind(HSQUIRRELVM vm);\n\n\tstatic SQInteger Cast(HSQUIRRELVM vm);\n\n};\n\n\n\n\n\n\n\n\n\n\n\n/*! Wrapper for Rocket::Controls::ElementFormControl */\n", "file_path": "source/Controls/ElementWrapperDerived.h", "rank": 12, "score": 147414.48043299498 }, { "content": "class ElementFormControlWrapper : public Rocket::Core::Squirrel::ElementWrapper\n\n{\n\nprotected:\n\n\tRocket::Controls::ElementFormControl* formControl();\n\n\n\n\t//mutable Rocket::Core::String mValueCache;\n\n\t//mutable Rocket::Core::String mNameCache;\n\n\n\npublic:\n\n\n\n\tconst char* GetName();\n\n\tvoid SetName(const char* name);\n\n\n\n\tconst char* GetValue();\n\n\tvoid SetValue(const char* value);\n\n\n\n\tbool IsDisabled();\n\n\tvoid SetDisabled(bool disable);\n\n\n\n\tstatic void Bind(HSQUIRRELVM vm);\n\n};\n\n\n\n/*! Wrapper for Rocket::Controls::ElementFormControlInput */\n", "file_path": "source/Controls/ElementWrapperDerived.h", "rank": 13, "score": 145317.98307164185 }, { "content": "class ScriptInterface;\n\n\n\n\n\n\n", "file_path": "include/RocketSquirrel/Core/Module.h", "rank": 14, "score": 143701.11190029955 }, { "content": "class ROCKETSQUIRRELDLL_API ScriptInterface\n\n{\n\nprivate:\n\n\n\n\t/*! List of the functions needed to bind RocketSquirrel into a VM*/\n\n\tstd::vector<ScriptBindFunction> mBindingFunctions;\n\n\n\nprotected:\n\n\n\n\tHSQUIRRELVM mVM;\n\n\tbool mAttachSquirrelFunctions;\n\n\tbool mUseNamespace;\n\n\n\npublic:\n\n\n\n\tScriptInterface();\n\n\tvirtual ~ScriptInterface();\n\n\n\n\t/*!\n\n\t * Should return a valid Squirrel VM doesn't matter if\n", "file_path": "include/RocketSquirrel/Core/ScriptInterface.h", "rank": 15, "score": 132166.32600148674 }, { "content": "class ShellFileInterface : public Rocket::Core::FileInterface\n\n{\n\npublic:\n\n\tShellFileInterface(const Rocket::Core::String& root);\n\n\tvirtual ~ShellFileInterface();\n\n\n\n\t/// Opens a file.\t\t\n\n\tvirtual Rocket::Core::FileHandle Open(const Rocket::Core::String& path);\n\n\n\n\t/// Closes a previously opened file.\t\t\n\n\tvirtual void Close(Rocket::Core::FileHandle file);\n\n\n\n\t/// Reads data from a previously opened file.\t\t\n\n\tvirtual size_t Read(void* buffer, size_t size, Rocket::Core::FileHandle file);\n\n\n\n\t/// Seeks to a point in a previously opened file.\t\t\n\n\tvirtual bool Seek(Rocket::Core::FileHandle file, long offset, int origin);\n\n\n\n\t/// Returns the current position of the file pointer.\t\t\n\n\tvirtual size_t Tell(Rocket::Core::FileHandle file);\n\n\n\nprivate:\n\n\tRocket::Core::String root;\n\n};\n\n\n\n#endif\n", "file_path": "shell/include/ShellFileInterface.h", "rank": 16, "score": 131796.19094979088 }, { "content": "class ShellSystemInterface : public Rocket::Core::SystemInterface\n\n{\n\npublic:\n\n\t/// Get the number of seconds elapsed since the start of the application\n\n\t/// @returns Seconds elapsed\n\n\tvirtual float GetElapsedTime();\n\n};\n\n\n\n#endif\n", "file_path": "shell/include/ShellSystemInterface.h", "rank": 17, "score": 131796.19094979088 }, { "content": "class ShellRenderInterfaceOpenGL : public Rocket::Core::RenderInterface\n\n{\n\npublic:\n\n\tShellRenderInterfaceOpenGL();\n\n\n\n\t/// Called by Rocket when it wants to render geometry that it does not wish to optimise.\n\n\tvirtual void RenderGeometry(Rocket::Core::Vertex* vertices, int num_vertices, int* indices, int num_indices, Rocket::Core::TextureHandle texture, const Rocket::Core::Vector2f& translation);\n\n\n\n\t/// Called by Rocket when it wants to compile geometry it believes will be static for the forseeable future.\n\n\tvirtual Rocket::Core::CompiledGeometryHandle CompileGeometry(Rocket::Core::Vertex* vertices, int num_vertices, int* indices, int num_indices, Rocket::Core::TextureHandle texture);\n\n\n\n\t/// Called by Rocket when it wants to render application-compiled geometry.\n\n\tvirtual void RenderCompiledGeometry(Rocket::Core::CompiledGeometryHandle geometry, const Rocket::Core::Vector2f& translation);\n\n\t/// Called by Rocket when it wants to release application-compiled geometry.\n\n\tvirtual void ReleaseCompiledGeometry(Rocket::Core::CompiledGeometryHandle geometry);\n\n\n\n\t/// Called by Rocket when it wants to enable or disable scissoring to clip content.\n\n\tvirtual void EnableScissorRegion(bool enable);\n\n\t/// Called by Rocket when it wants to change the scissor region.\n\n\tvirtual void SetScissorRegion(int x, int y, int width, int height);\n", "file_path": "shell/include/ShellRenderInterfaceOpenGL.h", "rank": 18, "score": 123588.03617111666 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n\n\n#ifndef __ROCKETSQUIRREL_CONTROLS_MODULE_INCLUDED\n\n#define __ROCKETSQUIRREL_CONTROLS_MODULE_INCLUDED\n\n\n\n\n\n\n\n#include \"Rocket/Core.h\"\n\n#include \"Rocket/Core/Plugin.h\"\n\n#include <squirrel.h>\n\n#include \"RocketSquirrel.h\"\n\n\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Controls {\n\nnamespace Squirrel {\n\n\n\n\n", "file_path": "include/RocketSquirrel/Controls/Module.h", "rank": 19, "score": 117290.56510003448 }, { "content": "/*\n\n * This source file is part of RocketSquirrel, libRocket Plugin / Module / Extension\n\n *\n\n * For the latest information, see http://code.google.com/p/rocketsquirrel/\n\n *\n\n * Copyright (c) 2012 Luis Jimenez\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n * \n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n", "file_path": "include/RocketSquirrel/Controls/Module.h", "rank": 20, "score": 117277.91417648843 }, { "content": "class VariantInterface : public Rocket::Core::Variant\n\n{\n\nprotected:\n\n\tRocket::Core::String mCacheStr;\n\n\n\npublic:\n\n\n\n\tVariantInterface(const Rocket::Core::Variant& variant);\n\n\tVariantInterface();\n\n\t~VariantInterface();\n\n\n\n\tconst char* toString();\n\n\tfloat toFloat();\n\n\tint32_t toInteger();\n\n\tRocket::Core::Vector2f toVector2f();\n\n\tRocket::Core::Vector2i toVector2i();\n\n\n\n\n\n\tstatic SQInteger constructor(HSQUIRRELVM v);\n\n\n", "file_path": "source/Core/VariantInterface.h", "rank": 21, "score": 114347.88187799077 }, { "content": "class EventListener : public Rocket::Core::EventListener\n\n{\n\nprotected:\n\n\n\n\tSquirrelScript mScript;\n\n\n\n\tRocket::Core::Element* m_pElement;\n\n\n\npublic:\n\n\n\n\tEventListener(const Rocket::Core::String& code, Rocket::Core::Element* context = NULL);\n\n\tvirtual ~EventListener();\n\n\n\n\tvoid ProcessEvent(Rocket::Core::Event& event);\n\n\n\n\tvoid OnAttach(Rocket::Core::Element* element);\n\n\tvoid OnDetach(Rocket::Core::Element* element);\n\n\t\n\n};\n\n\n", "file_path": "source/Core/EventListener.h", "rank": 22, "score": 112787.0349120297 }, { "content": "class ElementDocument : public Rocket::Core::ElementDocument\n\n{\n\npublic:\n\n\n", "file_path": "source/Core/ElementDocument.h", "rank": 23, "score": 112787.0349120297 }, { "content": "class ElementInstancer : public Rocket::Core::ElementInstancer\n\n{\n\npublic:\n\n\tElementInstancer();\n\n\tvirtual ~ElementInstancer();\n\n\n\n\tvirtual Element* InstanceElement(Element* parent, const Rocket::Core::String& tag, const Rocket::Core::XMLAttributes& attributes);\n\n\n\n\tvirtual void ReleaseElement(Element* element);\n\n\n\n\tvirtual void Release();\n\n};\n\n\n\n\n\n\n\n\n\n\n\n}\n\n}\n\n}\n\n\n\n\n\n\n\n#endif", "file_path": "source/Core/ElementInstancer.h", "rank": 24, "score": 112787.0349120297 }, { "content": "class ContextInstancer : public Rocket::Core::ContextInstancer\n\n{\n\nprotected:\n\n\n\npublic:\n\n\tContextInstancer();\n\n\tvirtual ~ContextInstancer();\n\n\n\n\tvirtual Context* InstanceContext(const Rocket::Core::String& name);\n\n\n\n\tvirtual void ReleaseContext(Rocket::Core::Context* context);\n\n\n\n\tvirtual void Release();\n\n};\n\n\n\n\n\n\n\n\n\n\n\n\n", "file_path": "source/Core/ContextInstancer.h", "rank": 25, "score": 112787.0349120297 }, { "content": "class ScriptInterface;\n\n\n\n\n\n\n", "file_path": "include/RocketSquirrel/Controls/Module.h", "rank": 26, "score": 110444.22974985994 }, { "content": "class EventListenerInstancer : public Rocket::Core::EventListenerInstancer\n\n{\n\npublic:\n\n\n\n\tvirtual ~EventListenerInstancer() {};\n\n\n\n\tRocket::Core::EventListener* InstanceEventListener(const Rocket::Core::String& value);\n\n\n\n\tvoid Release();\n\n};\n\n\n\n\n\n\n\n\n\n\n\n}\n\n}\n\n}\n\n\n\n\n\n\n\n#endif", "file_path": "source/Core/EventListenerInstancer.h", "rank": 27, "score": 108492.69457343245 }, { "content": "namespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n\n\n\n\n\nvoid BindSquirrelInterfaces(HSQUIRRELVM vm);\n\nvoid BindKeyMap(HSQUIRRELVM vm);\n\n\n\n\n\n\n\n\n\n\n\n}\n\n}\n", "file_path": "source/Core/Interfaces.h", "rank": 28, "score": 98930.57911839604 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#include \"RocketSquirrel.h\"\n\n#include \"Core/ContextInterface.h\"\n\n#include \"RocketSquirrel/Core/Module.h\"\n\n#include \"Debug.h\"\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n\n\n\n\n\nvoid CollectGarbage()\n", "file_path": "source/RocketSquirrel.cpp", "rank": 29, "score": 80743.01062779954 }, { "content": "/*\n\n * This source file is part of RocketSquirrel, libRocket Plugin / Module / Extension\n\n *\n\n * For the latest information, see http://code.google.com/p/rocketsquirrel/\n\n *\n\n * Copyright (c) 2012 Luis Jimenez\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n * \n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n", "file_path": "source/RocketSquirrel.cpp", "rank": 30, "score": 80726.62006485552 }, { "content": "{\n\n\t//Trugger assert if it's not instanced and inistialized\n\n\tROCKETSQUIRREL_ASSERT(Module::instance().isInit() == true);\n\n\n\n\t/* !Remove the contexts reference created by squirrel scripts\n\n\t * We do this so it's safe to create contexts within \n\n\t * squirrel at the cost of having to do garbage collection */\n\n\tContextInterface::RemoveReferences();\n\n}\n\n\n\n\n\n\n\n\n\n}\n\n}\n\n}", "file_path": "source/RocketSquirrel.cpp", "rank": 31, "score": 80720.50273937809 }, { "content": "class SquirrelScript;\n\n\n\n\n\n\n", "file_path": "source/Core/EventListener.h", "rank": 32, "score": 72103.99267690434 }, { "content": "class SquirrelScript;\n\n\n\n\n\n\n", "file_path": "source/Core/ElementDocument.h", "rank": 33, "score": 72103.99267690434 }, { "content": "class NamespaceHelper \n\n{\n\npublic:\n\n\n\n\n\n\tstatic bool switchTo(HSQUIRRELVM vm, const char* name);\n\n\tstatic bool create(HSQUIRRELVM vm, const char* name);\n\n\n\n\n\n};\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n}\n\n}\n\n}\n\n\n\n\n\n\n\n#endif", "file_path": "source/NamespaceHelper.h", "rank": 34, "score": 48576.364461714955 }, { "content": "class SquirrelGame\n\n{\n\nprivate:\n\n\n\n\tHSQUIRRELVM vm;\n\n\n\n\tstatic SQInteger file_lexfeedASCII(SQUserPointer file)\n\n\t{\n\n\t\tint ret;\n\n\t\tchar c;\n\n\t\tif( ( ret=fread(&c,sizeof(c),1,(FILE *)file )>0) )\n\n\t\t\treturn c;\n\n\t\treturn 0;\n\n\t}\n\n\n\n\tstatic SQRESULT CompileNutFile(HSQUIRRELVM v, const char *filename)\n\n\t{\n\n\t\tSQRESULT r = -1;\n\n\n\n\t\tFILE *f=fopen(filename,\"rb\");\n", "file_path": "sample/SquirrelGame.h", "rank": 35, "score": 47975.13445653929 }, { "content": "class SquirrelScript\n\n{\n\nprivate:\n\n\n\n\tRocket::Core::String mCode;\n\n\tRocket::Core::String mSourceName;\n\n\tstd::vector<char> mBytecode;\n\n\tSQInteger mReadIndex;\n\n\t\n\n\tbool mCompiled;\n\n\tbool mCacheBytecode;\n\n\n\npublic:\n\n\n\n\tSquirrelScript();\n\n\tSquirrelScript(const Rocket::Core::String& code, const Rocket::Core::String& sourcename);\n\n\n\n\tstatic SQInteger WriteFunc(SQUserPointer script, SQUserPointer buffer, SQInteger size);\n\n\tstatic SQInteger ReadFunc(SQUserPointer script, SQUserPointer buffer, SQInteger size);\n\n\n", "file_path": "source/SquirrelScript.h", "rank": 36, "score": 47975.13445653929 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef __ROCKETSQUIRREL_NAMESPACEHELPER_INCLUDED\n\n#define __ROCKETSQUIRREL_NAMESPACEHELPER_INCLUDED\n\n\n\n\n\n\n\n#include <squirrel.h>\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n\n\n\n\n\n\n", "file_path": "source/NamespaceHelper.h", "rank": 37, "score": 42131.43046710346 }, { "content": "/*\n\n * This source file is part of RocketSquirrel, libRocket Plugin / Module / Extension\n\n *\n\n * For the latest information, see http://code.google.com/p/rocketsquirrel/\n\n *\n\n * Copyright (c) 2012 Luis Jimenez\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n * \n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n", "file_path": "source/NamespaceHelper.h", "rank": 38, "score": 42120.96221592575 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef SHELLINPUT_H\n\n#define SHELLINPUT_H\n\n\n\n#include <Rocket/Core/Input.h>\n\n#include <Rocket/Core/Types.h>\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\n\n", "file_path": "shell/include/Input.h", "rank": 39, "score": 41633.40199426938 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef ROCKETSHELL_H\n\n#define ROCKETSHELL_H\n\n\n\n#include <Rocket/Core/Types.h>\n\n#include <Rocket/Core/SystemInterface.h>\n\n\n\n#ifdef ROCKET_PLATFORM_WIN32\n\n#define PATH_SEPARATOR\t\";\"\n\n#else\n\n#define PATH_SEPARATOR\t\":\"\n\n#endif\n\n\n\n/**\n\n\tShell functions for creating windows, attaching OpenGL and handling input in a platform independent way.\n\n\t@author Lloyd Weehuizen\n\n */\n\n\n", "file_path": "shell/include/Shell.h", "rank": 40, "score": 41627.67737976173 }, { "content": "\n\nprivate:\n\n\tstatic Rocket::Core::String executable_path;\n\n};\n\n\n\n#include \"ShellRenderInterfaceOpenGL.h\"\n\n#include \"ShellSystemInterface.h\"\n\n\n\n#endif\n", "file_path": "shell/include/Shell.h", "rank": 41, "score": 41627.61057688828 }, { "content": "\tstatic void CloseWindow();\n\n\n\n\t/// Returns a platform-dependent handle to the window.\n\n\tstatic void* GetWindowHandle();\n\n\n\n\t/// Flips the OpenGL buffers.\n\n\tstatic void FlipBuffers();\n\n\n\n\t/// Run the event loop, calling the idle function every frame.\n\n\ttypedef void (*ShellIdleFunction)();\n\n\tstatic void EventLoop(ShellIdleFunction idle_function);\n\n\tstatic void RequestExit();\n\n\n\n\t/// Display an error message.\n\n\tstatic void DisplayError(const char* fmt, ...);\n\n\t/// Log a message to the debugger.\n\n\tstatic void Log(const char* fmt, ...);\n\n\n\n\t/// Get the number of seconds that have passed since shell startup.\n\n\tstatic float GetElapsedTime();\t\n", "file_path": "shell/include/Shell.h", "rank": 42, "score": 41623.814704387674 }, { "content": "/*\n\n * This source file is part of libRocket, the HTML/CSS Interface Middleware\n\n *\n\n * For the latest information, see http://www.librocket.com\n\n *\n\n * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n * \n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n", "file_path": "shell/include/Shell.h", "rank": 43, "score": 41622.30934775986 }, { "content": "/*\n\n * This source file is part of libRocket, the HTML/CSS Interface Middleware\n\n *\n\n * For the latest information, see http://www.librocket.com\n\n *\n\n * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n * \n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n", "file_path": "shell/include/Input.h", "rank": 44, "score": 41622.30934775986 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef __ROCKETSQUIRREL_SQUIRRELSCRIPT_INCLUDED\n\n#define __ROCKETSQUIRREL_SQUIRRELSCRIPT_INCLUDED\n\n\n\n\n\n#include <squirrel.h>\n\n#include <sqbind/SquirrelBind.h>\n\n#include <Rocket/Core/String.h>\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n\n\n", "file_path": "source/SquirrelScript.h", "rank": 45, "score": 41611.98268550012 }, { "content": "\n\n\t\tSQInteger i = sq_gettop(vm);\n\n\n\n\t\tsq_pushroottable(vm);\n\n\n\n\t\tsq_pushstring(vm, _SC(\"Tick\"), -1);\n\n\t\tsq_get(vm, -2);\n\n\t\tsq_pushroottable(vm);\n\n\t\tsq_pushfloat(vm, delta);\n\n\t\tsq_call(vm, 2, false, true);\n\n\n\n\t\tsq_pop(vm, i);\n\n\n\n\t\tShell::FlipBuffers();\n\n\t}\n\n\n\n\tvoid initialize()\n\n\t{\n\n\t\tusing Rocket::Core::Squirrel::Module;\n\n\n", "file_path": "sample/SquirrelGame.h", "rank": 46, "score": 41608.2006015211 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef __SQUIRREL_GAME\n\n#define __SQUIRREL_GAME\n\n\n\n\n\n#include <squirrel.h>\n\n#include <sqbind/SquirrelBind.h>\n\n#include <RocketSquirrel/Core/Module.h>\n\n#include <RocketSquirrel/Core/ScriptInterface.h>\n\n#include <Rocket/Core/String.h>\n\n#include \"Config.h\"\n\n#include \"Shell.h\"\n\n\n\n#define SAMPLE_STANDALONE 1;\n", "file_path": "sample/SquirrelGame.h", "rank": 47, "score": 41608.04999410241 }, { "content": "\tvoid Compile(HSQUIRRELVM vm, bool cacheBytecode = true);\n\n\n\n\tbool IsCompiled() const;\n\n\n\n\tvoid Run(HSQUIRRELVM vm);\n\n\n\n\tvoid SetSourceCode(const Rocket::Core::String& code);\n\n\tconst Rocket::Core::String& GetSourceCode() const;\n\n\n\n\tvoid SetSourceName(const Rocket::Core::String& name);\n\n\tconst Rocket::Core::String& GetSourceName() const;\n\n\n\n};\n\n\n\n\n\n\n\n\n\n\n\n}\n\n}\n\n}\n\n\n\n\n\n#endif", "file_path": "source/SquirrelScript.h", "rank": 48, "score": 41607.6847331056 }, { "content": "\t\t/*Get the context crreated by squirrel*/\n\n\t\tcontext = Rocket::Core::GetContext(\"SquirrelGame\");\n\n\t\tassert(context != NULL);\n\n\n\n\t\tRocket::Debugger::Initialise(context);\n\n\t\tInput::SetContext(context);\n\n\n\n\t\ttime = Shell::GetElapsedTime();\n\n\t}\n\n\n\n\tvoid destroy()\n\n\t{\n\n\t\tExecuteScript(\"scripts/Destroy.nut\");\n\n\t}\n\n\n\n};\n\n\n\n\n\n\n\n#endif", "file_path": "sample/SquirrelGame.h", "rank": 49, "score": 41604.72798766498 }, { "content": "\t\tfullPath += \"/\";\n\n\t\tfullPath += path;\n\n\n\n\t\treturn fullPath.CString();\n\n\t}\n\n\n\n\tvoid ExecuteScript(const char* path)\n\n\t{\n\n\t\tCompileNutFile(vm, AssetDir(path));\n\n\n\n\t\tSQInteger i = sq_gettop(vm);\n\n\n\n\t\tsq_pushroottable(vm);\n\n\n\n\t\tsq_call(vm, 1, false, true);\n\n\n\n\t\tsq_pop(vm, i);\n\n\t}\n\n\n\n\tRocket::Core::Context* context;\n", "file_path": "sample/SquirrelGame.h", "rank": 50, "score": 41604.40646987718 }, { "content": "/*\n\n * This source file is part of RocketSquirrel, libRocket Plugin / Module / Extension\n\n *\n\n * For the latest information, see http://code.google.com/p/rocketsquirrel/\n\n *\n\n * Copyright (c) 2012 Luis Jimenez\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n * \n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n", "file_path": "sample/SquirrelGame.h", "rank": 51, "score": 41599.76326794039 }, { "content": "/*\n\n * This source file is part of RocketSquirrel, libRocket Plugin / Module / Extension\n\n *\n\n * For the latest information, see http://code.google.com/p/rocketsquirrel/\n\n *\n\n * Copyright (c) 2012 Luis Jimenez\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n * \n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n", "file_path": "source/SquirrelScript.h", "rank": 52, "score": 41599.76326794039 }, { "content": "\n\n#ifdef _WIN32\n\n #include <windows.h>\n\n\n\n void sleep(unsigned milliseconds)\n\n {\n\n Sleep(milliseconds);\n\n }\n\n#else\n\n #include <unistd.h>\n\n\n\n void sleep(unsigned milliseconds)\n\n {\n\n usleep(milliseconds * 1000); // takes microseconds\n\n }\n\n#endif\n\n\n", "file_path": "sample/SquirrelGame.h", "rank": 53, "score": 41598.468362603424 }, { "content": "\t\tShell::LoadFonts(AssetDir(\"\"));\n\n\n\n\t\t//Now lets get the VM that rocketsquirrel created for us\n\n\t\tvm = Module::instance().getScriptInterface().getSquirrelVM();\n\n\n\n\t\t/*bind the elapsed time*/\n\n\t\tsq_pushroottable(vm);\n\n\t\tsqb::Bind::BindFunction(vm, -1, &Shell::GetElapsedTime, _SC(\"GetElapsedTime\"));\n\n\n\n\t\t/*Bind the close WIndow function*/\n\n\t\tsqb::Bind::BindFunction(vm, -1, &Shell::CloseWindow, _SC(\"CloseWindow\"));\n\n\n\n\t\t/*Bind the assetsdir function*/\n\n\t\tsqb::Bind::BindFunction(vm, -1, &AssetDir, _SC(\"AssetDir\"));\n\n\n\n\t\tsq_poptop(vm);\n\n\n\n\t\t/*Lets call the initialization script*/\n\n\t\tExecuteScript(\"scripts/Initialize.nut\");\n\n\n", "file_path": "sample/SquirrelGame.h", "rank": 54, "score": 41597.34766674448 }, { "content": "\t\tif(f)\n\n\t\t{\n\n\t\t\tr = sq_compile(v,file_lexfeedASCII, f, filename, 1);\n\n\n\n\t\t\tfclose(f);\n\n\t\t}\n\n\n\n\t\treturn r;\n\n\t}\n\n\n\n\tstatic const char* AssetDir(const char* path)\n\n\t{\n\n\t\tstatic Rocket::Core::String fullPath;\n\n\n\n\t\tfullPath.Clear();\n\n#ifdef SAMPLE_STANDALONE\n\n\t\tfullPath += \"./assets\";\n\n#else\n\n\t\tfullPath += ROCKETSQUIRREL_SAMPLE_ASSETS;\n\n#endif\n", "file_path": "sample/SquirrelGame.h", "rank": 55, "score": 41595.85749376699 }, { "content": "\n\n\tfloat delta;\n\n\tfloat time;\n\n\n\npublic:\n\n\n\n\t/*AKA called once each loop in the game loop*/\n\n\tvoid Tick()\n\n\t{\n\n\t\tfloat currentTime = Shell::GetElapsedTime();\n\n\n\n\t\tif ((currentTime - time) < (1.0f / 60.0f))\n\n\t\t{\n\n\t\t\treturn;\n\n\t\t}\n\n\n\n\t\tglClear(GL_COLOR_BUFFER_BIT);\n\n\n\n\t\tdelta = currentTime - time;\n\n\t\ttime = currentTime;\n", "file_path": "sample/SquirrelGame.h", "rank": 56, "score": 41592.74852241149 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#include \"NamespaceHelper.h\"\n\n#include \"RocketSquirrel/Core/Module.h\"\n\n\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n\n\n\n\n\nbool NamespaceHelper::switchTo(HSQUIRRELVM vm, const char* name)\n", "file_path": "source/NamespaceHelper.cpp", "rank": 57, "score": 40794.01372740219 }, { "content": "/*\n\n * This source file is part of RocketSquirrel, libRocket Plugin / Module / Extension\n\n *\n\n * For the latest information, see http://code.google.com/p/rocketsquirrel/\n\n *\n\n * Copyright (c) 2012 Luis Jimenez\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n * \n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n", "file_path": "source/NamespaceHelper.cpp", "rank": 58, "score": 40778.76818547625 }, { "content": "{\n\n\tif (Module::instance().getScriptInterface().isUsingNamespace())\n\n\t{\n\n\t\tsq_pushroottable(vm);\n\n\t\tsq_pushstring(vm, _SC(name), -1);\n\n\t\treturn SQ_SUCCEEDED(sq_get(vm, -2));\n\n\t}\n\n\treturn true;\n\n}\n\n\n\nbool NamespaceHelper::create(HSQUIRRELVM vm, const char* name)\n\n{\n\n\tif (Module::instance().getScriptInterface().isUsingNamespace())\n\n\t{\n\n\t\tsq_pushstring(vm, _SC(name), -1);\n\n\t\tsq_newtable(vm);\n\n\t\treturn SQ_SUCCEEDED(sq_newslot(vm, -3, SQTrue));\n\n\t}\n\n\treturn true;\n\n}\n\n\n\n\n\n\n\n\n\n\n\n}\n\n}\n\n}", "file_path": "source/NamespaceHelper.cpp", "rank": 59, "score": 40778.263683926285 }, { "content": "class Context;\n\n\n\n}\n\n}\n\n\n\n/**\n\n */\n\n\n", "file_path": "shell/include/Input.h", "rank": 60, "score": 40288.99031598756 }, { "content": "class Input\n\n{\n\npublic:\n\n\t/// Sets the context to send input events to.\n\n\t/// @param[in] context The context to send input events to.\n\n\tstatic void SetContext(Rocket::Core::Context* context);\n\n\t/// Returns the character code for a key identifer / key modifier combination.\n\n\t/// @param[in] key_identifier The key to generate a character code for.\n\n\t/// @param[in] key_modifier_state The configuration of the key modifiers.\n\n\t/// @return The character code.\n\n\tstatic Rocket::Core::word GetCharacterCode(Rocket::Core::Input::KeyIdentifier key_identifier, int key_modifier_state);\n\n\n\nprotected:\n\n\tstatic Rocket::Core::Context* context;\n\n};\n\n\n\n#endif\n", "file_path": "shell/include/Input.h", "rank": 61, "score": 40288.99031598756 }, { "content": "class Shell\n\n{\n\npublic:\n\n\t/// Initialise the shell.\n\n\t/// @param[in] path The path (relative to the current working directory) of the application's working directory.\n\n\tstatic bool Initialise(const Rocket::Core::String& path);\n\n\t/// Shutdown the shell.\n\n\tstatic void Shutdown();\n\n\n\n\t/// Loads the default fonts from the given path.\n\n\tstatic void LoadFonts(const char* directory);\n\n\n\n\t/// Returns the path to the application's executable.\n\n\tstatic const Rocket::Core::String& GetExecutablePath();\n\n\n\n\t/// Open a platform specific window, optionally initialising an OpenGL context on it.\n\n\t/// @param[in] title Title of the window.\n\n\t/// @param[in] attach_opengl Attach and opengl context to the window.\n\n\tstatic bool OpenWindow(const char* title, bool attach_opengl);\n\n\t/// Close the active window.\n", "file_path": "shell/include/Shell.h", "rank": 62, "score": 40288.99031598756 }, { "content": "\t{\n\n\t\tmCompiled = false;\n\n\t}\n\n\n\n\tsq_call(vm, 1, false, true);\n\n\n\n\n\n\t//sq_poptop(vm);\n\n}\n\n\n\nvoid SquirrelScript::SetSourceCode(const Rocket::Core::String& code)\n\n{\n\n\tmCode = code;\n\n}\n\n\n\nconst Rocket::Core::String& SquirrelScript::GetSourceCode() const\n\n{\n\n\treturn mCode;\n\n}\n\n\n", "file_path": "source/SquirrelScript.cpp", "rank": 63, "score": 40284.7357341903 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n\n\n#include \"SquirrelScript.h\"\n\n#include \"Debug.h\"\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n\n\n\n\n\n\n", "file_path": "source/SquirrelScript.cpp", "rank": 64, "score": 40284.6592391919 }, { "content": "void SquirrelScript::SetSourceName(const Rocket::Core::String& name)\n\n{\n\n\tmSourceName = name;\n\n}\n\n\n\nconst Rocket::Core::String& SquirrelScript::GetSourceName() const\n\n{\n\n\treturn mSourceName;\n\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n}\n\n}\n\n}", "file_path": "source/SquirrelScript.cpp", "rank": 65, "score": 40280.57762766333 }, { "content": "\n\nSquirrelScript::SquirrelScript(const Rocket::Core::String& code, const Rocket::Core::String& sourcename) :\n\n\tmCode(code),\n\n\tmSourceName(sourcename),\n\n\tmCompiled(false)\n\n{\n\n}\n\n\n\nSquirrelScript::SquirrelScript() :\n\n\tmCompiled(false)\n\n{\n\n}\n\n\n\nSQInteger SquirrelScript::WriteFunc(SQUserPointer script, SQUserPointer buffer, SQInteger size)\n\n{\n\n\tSquirrelScript* pScript = (SquirrelScript*)script;\n\n\n\n\tfor (SQInteger i = 0; i < size; i++)\n\n\t{\n\n\t\tpScript->mBytecode.push_back(((char*)buffer)[i]);\n", "file_path": "source/SquirrelScript.cpp", "rank": 66, "score": 40276.41365413054 }, { "content": "\n\nvoid SquirrelScript::Run(HSQUIRRELVM vm)\n\n{\n\n\t//sq_pushroottable(vm);\n\n\n\n\tif (mCacheBytecode)\n\n\t{\n\n\t\tif (mCompiled)\n\n\t\t{\n\n\t\t\tmReadIndex = 0;\n\n\t\t\tif (SQ_FAILED(sq_readclosure(vm, &ReadFunc, this)))\n\n\t\t\t{\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\n\n\t\t\t//Push the function\n\n\t\t\tsq_push(vm, -2);\n\n\t\t}\n\n\t}\n\n\telse\n", "file_path": "source/SquirrelScript.cpp", "rank": 67, "score": 40276.399442847214 }, { "content": "\t\treadCount -= (readTotal - total);\n\n\t}\n\n\n\n\tfor (SQInteger i = 0; i < readCount; i++)\n\n\t{\n\n\t\t((char*)buffer)[i] = pScript->mBytecode[pScript->mReadIndex+i];\n\n\t}\n\n\n\n\tpScript->mReadIndex += readCount;\n\n\n\n\treturn readCount;\n\n}\n\n\n\nvoid SquirrelScript::Compile(HSQUIRRELVM vm, bool cacheBytecode)\n\n{\n\n\tSQRESULT sqr;\n\n\tsqr = sq_compilebuffer(vm, mCode.CString(), mCode.Length(), mSourceName.CString(), true);\n\n\n\n\tmCacheBytecode = cacheBytecode;\n\n\n", "file_path": "source/SquirrelScript.cpp", "rank": 68, "score": 40274.61218565013 }, { "content": "/*\n\n * This source file is part of RocketSquirrel, libRocket Plugin / Module / Extension\n\n *\n\n * For the latest information, see http://code.google.com/p/rocketsquirrel/\n\n *\n\n * Copyright (c) 2012 Luis Jimenez\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n * \n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n", "file_path": "source/SquirrelScript.cpp", "rank": 69, "score": 40274.18158246186 }, { "content": "\tif (SQ_SUCCEEDED(sqr))\n\n\t{\n\n\t\tmCompiled = true;\n\n\t\tif (cacheBytecode)\n\n\t\t{\n\n\t\t\t//We clear the previous bytecode\n\n\t\t\tmBytecode.clear();\n\n\t\t\tif (SQ_FAILED(sq_writeclosure(vm, &WriteFunc, this)))\n\n\t\t\t{\n\n\t\t\t\tmCompiled = false;\n\n\t\t\t\tmCacheBytecode = false;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\n\n\nbool SquirrelScript::IsCompiled() const\n\n{\n\n\treturn mCompiled;\n\n}\n", "file_path": "source/SquirrelScript.cpp", "rank": 70, "score": 40271.12594819309 }, { "content": "\t}\n\n\n\n\treturn size;\n\n}\n\n\n\nSQInteger SquirrelScript::ReadFunc(SQUserPointer script, SQUserPointer buffer, SQInteger size)\n\n{\n\n\tSquirrelScript* pScript = (SquirrelScript*)script;\n\n\n\n\tSQInteger readCount = size;\n\n\tSQInteger readTotal = pScript->mReadIndex+readCount;\n\n\tSQInteger total = pScript->mBytecode.size();\n\n\n\n\tif (pScript->mReadIndex > total)\n\n\t{\n\n\t\treturn -1;\n\n\t}\n\n\n\n\tif (readTotal > total)\n\n\t{\n", "file_path": "source/SquirrelScript.cpp", "rank": 71, "score": 40268.163746425125 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef SHELLFILEINTERFACE_H\n\n#define SHELLFILEINTERFACE_H\n\n\n\n#include <Rocket/Core/String.h>\n\n#include <Rocket/Core/FileInterface.h>\n\n\n\n/**\n\n\tRocket file interface for the shell examples.\n\n\t@author Lloyd Weehuizen\n\n */\n\n\n", "file_path": "shell/include/ShellFileInterface.h", "rank": 72, "score": 39057.373802987466 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef ROCKETSHELLSYSTEMINTERFACE_H\n\n#define ROCKETSHELLSYSTEMINTERFACE_H\n\n\n\n#include <Rocket/Core/SystemInterface.h>\n\n\n\n/**\n\n\tA custom system interface for Rocket. This provides timing information.\n\n\t@author Lloyd Weehuizen\n\n */\n\n\n", "file_path": "shell/include/ShellSystemInterface.h", "rank": 73, "score": 39055.49517051784 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef ROCKETINPUTWIN32_H\n\n#define ROCKETINPUTWIN32_H\n\n\n\n#include <Input.h>\n\n#if !defined _WIN32_WINNT || _WIN32_WINNT < 0x0500\n\n#undef _WIN32_WINNT\n\n#define _WIN32_WINNT 0x0500\n\n#endif\n\n#include <windows.h>\n\n\n\n/**\n\n\tProcesses Windows input events and passes them through to Rocket. Feel free to take this class and integrate it\n\n\twith your project.\n\n\t@author Lloyd Weehuizen\n\n */\n\n\n", "file_path": "shell/include/win32/InputWin32.h", "rank": 74, "score": 39051.67214317024 }, { "content": "/*\n\n * This source file is part of libRocket, the HTML/CSS Interface Middleware\n\n *\n\n * For the latest information, see http://www.librocket.com\n\n *\n\n * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n * \n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n", "file_path": "shell/include/ShellSystemInterface.h", "rank": 75, "score": 39051.40914871684 }, { "content": "/*\n\n * This source file is part of libRocket, the HTML/CSS Interface Middleware\n\n *\n\n * For the latest information, see http://www.librocket.com\n\n *\n\n * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n * \n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n", "file_path": "shell/include/x11/InputX11.h", "rank": 76, "score": 39051.40914871684 }, { "content": "/*\n\n * This source file is part of libRocket, the HTML/CSS Interface Middleware\n\n *\n\n * For the latest information, see http://www.librocket.com\n\n *\n\n * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n * \n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n", "file_path": "shell/include/win32/InputWin32.h", "rank": 77, "score": 39051.40914871684 }, { "content": "/*\n\n * This source file is part of libRocket, the HTML/CSS Interface Middleware\n\n *\n\n * For the latest information, see http://www.librocket.com\n\n *\n\n * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n * \n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n", "file_path": "shell/include/ShellFileInterface.h", "rank": 78, "score": 39051.40914871684 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef INPUTX11_H\n\n#define INPUTX11_H\n\n\n\n#include <X11/Xlib.h>\n\n#include \"Input.h\"\n\n\n\n/**\n\n * Input Wrapper Code\n\n *\n\n * Feel free to take this class and integrate it with your project.\n\n *\n\n * @author Lloyd Weehuizen\n\n */\n\n\n", "file_path": "shell/include/x11/InputX11.h", "rank": 79, "score": 39048.94069896412 }, { "content": "/*\n\n * This source file is part of libRocket, the HTML/CSS Interface Middleware\n\n *\n\n * For the latest information, see http://www.librocket.com\n\n *\n\n * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n * \n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n", "file_path": "shell/include/macosx/InputMacOSX.h", "rank": 80, "score": 37881.50791310772 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef INPUTMACOSX_H\n\n#define INPUTMACOSX_H\n\n\n\n#include \"Input.h\"\n\n#include <Carbon/Carbon.h>\n\n\n\n/**\n\n\tInput Wrapper Code\n\n\tFeel free to take this class and integrate it with your project.\n\n\t@author Lloyd Weehuizen\n\n */\n\n\n", "file_path": "shell/include/macosx/InputMacOSX.h", "rank": 81, "score": 37879.039463355 }, { "content": "\n\n\t/// Called by Rocket when a texture is required by the library.\n\n\tvirtual bool LoadTexture(Rocket::Core::TextureHandle& texture_handle, Rocket::Core::Vector2i& texture_dimensions, const Rocket::Core::String& source);\n\n\t/// Called by Rocket when a texture is required to be built from an internally-generated sequence of pixels.\n\n\tvirtual bool GenerateTexture(Rocket::Core::TextureHandle& texture_handle, const Rocket::Core::byte* source, const Rocket::Core::Vector2i& source_dimensions);\n\n\t/// Called by Rocket when a loaded texture is no longer required.\n\n\tvirtual void ReleaseTexture(Rocket::Core::TextureHandle texture_handle);\n\n};\n\n\n\n#endif\n", "file_path": "shell/include/ShellRenderInterfaceOpenGL.h", "rank": 82, "score": 36785.54514132495 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef ROCKETSHELLRENDERINTERFACE_H\n\n#define ROCKETSHELLRENDERINTERFACE_H\n\n\n\n#include \"Rocket/Core/RenderInterface.h\"\n\n#include \"ShellOpenGL.h\"\n\n\n\n/**\n\n\tLow level OpenGL render interface for Rocket\n\n\t@author Peter Curry\n\n */\n\n\n", "file_path": "shell/include/ShellRenderInterfaceOpenGL.h", "rank": 83, "score": 36784.42732400237 }, { "content": "/*\n\n * This source file is part of libRocket, the HTML/CSS Interface Middleware\n\n *\n\n * For the latest information, see http://www.librocket.com\n\n *\n\n * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd\n\n *\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n\n * of this software and associated documentation files (the \"Software\"), to deal\n\n * in the Software without restriction, including without limitation the rights\n\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\n * copies of the Software, and to permit persons to whom the Software is\n\n * furnished to do so, subject to the following conditions:\n\n *\n\n * The above copyright notice and this permission notice shall be included in\n\n * all copies or substantial portions of the Software.\n\n * \n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n", "file_path": "shell/include/ShellRenderInterfaceOpenGL.h", "rank": 84, "score": 36779.67525282471 }, { "content": "\t}\t\n\n\n\n\treturn sqb::ClassDefinition<Rocket::Core::String>::DefaultConstructor(v);\n\n}\n\n\n\nvoid BindSquirrelInterfaces(HSQUIRRELVM vm)\n\n{\n\n\n\n\t//Namespace Rocket\n\n\tsq_pushroottable(vm);\t\n\n\tNamespaceHelper::switchTo(vm, \"Rocket\");\n\n\n\n\n\n\t//RocketString\n\n\tsqb::ClassDefinition<Rocket::Core::String> cStr(vm, -1, _SC(\"String\"));\n\n\n\n\tcStr.Constructor(&StringConstructor, sqb::FunctionOptions().ParamCheckCount(-1).TypeMask(_SC(\"x\")));\n\n\n\n\ttypedef Rocket::Core::String& (Rocket::Core::String::* AppendType)(const char* assign);\n\n\n", "file_path": "source/Core/Interfaces.cpp", "rank": 85, "score": 36461.90990118733 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef __ROCKETSQUIRREL_VARIANTINTERFACE_INCLUDED\n\n#define __ROCKETSQUIRREL_VARIANTINTERFACE_INCLUDED\n\n\n\n\n\n#include <Rocket/Core/Variant.h>\n\n#include <Rocket/Core/Vector2.h>\n\n#include <squirrel.h>\n\n#include <sqbind/SquirrelBind.h>\n\n\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "file_path": "source/Core/VariantInterface.h", "rank": 86, "score": 36460.4406387791 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef __ROCKETSQUIRREL_CONTEXTINSTANCER_INCLUDED\n\n#define __ROCKETSQUIRREL_CONTEXTINSTANCER_INCLUDED\n\n\n\n\n\n\n\n#include <Rocket/Core/String.h>\n\n#include <Rocket/Core/ContextInstancer.h>\n\n#include <squirrel.h>\n\n#include <unordered_map>\n\n\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "file_path": "source/Core/ContextInstancer.h", "rank": 87, "score": 36460.05017536664 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef __ROCKETSQUIRREL_EVENTLISTENER_INCLUDED\n\n#define __ROCKETSQUIRREL_EVENTLISTENER_INCLUDED\n\n\n\n\n\n#include <Rocket/Core/EventListener.h>\n\n#include <Rocket/Core/Element.h>\n\n#include \"../SquirrelScript.h\"\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n\n\n", "file_path": "source/Core/EventListener.h", "rank": 88, "score": 36460.04684792959 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef __ROCKETSQUIRREL_DICTIONARYINTERFACE_INCLUDED\n\n#define __ROCKETSQUIRREL_DICTIONARYINTERFACE_INCLUDED\n\n\n\n\n\n#include <Rocket/Core/Dictionary.h>\n\n#include <squirrel.h>\n\n#include <sqbind/SquirrelBind.h>\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n\n\n", "file_path": "source/Core/DictionaryInterface.h", "rank": 89, "score": 36459.829279366684 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef __ROCKETSQUIRREL_EVENTINTERFACE_INCLUDED\n\n#define __ROCKETSQUIRREL_EVENTINTERFACE_INCLUDED\n\n\n\n\n\n#include <Rocket/Core/Event.h>\n\n#include <squirrel.h>\n\n#include <sqbind/SquirrelBind.h>\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n\n\n\n\n\n\n", "file_path": "source/Core/EventInterface.h", "rank": 90, "score": 36459.829279366684 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef __ROCKETSQUIRREL_ELEMENTINTERFACE_INCLUDED\n\n#define __ROCKETSQUIRREL_ELEMENTINTERFACE_INCLUDED\n\n\n\n\n\n#include <Rocket/Core/ElementDocument.h>\n\n#include <squirrel.h>\n\n#include <sqbind/SquirrelBind.h>\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n\n\n\n\n\n\n", "file_path": "source/Core/ElementInterface.h", "rank": 91, "score": 36459.77767328045 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef __ROCKETSQUIRREL_ELEMENTINSTANCER_INCLUDED\n\n#define __ROCKETSQUIRREL_ELEMENTINSTANCER_INCLUDED\n\n\n\n\n\n#include <Rocket/Core/ElementInstancer.h>\n\n#include <squirrel.h>\n\n#include <sqbind/SquirrelBind.h>\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "file_path": "source/Core/ElementInstancer.h", "rank": 92, "score": 36459.77767328045 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef __ROCKETSQUIRREL_CONTEXTINTERFACE_INCLUDED\n\n#define __ROCKETSQUIRREL_CONTEXTINTERFACE_INCLUDED\n\n\n\n\n\n#include <Rocket/Core/Context.h>\n\n#include <squirrel.h>\n\n#include <sqbind/SquirrelBind.h>\n\n#include <unordered_map>\n\n\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n\n\n", "file_path": "source/Core/ContextInterface.h", "rank": 93, "score": 36459.77512019354 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef __ROCKETSQUIRREL_ELEMENTDOCUMENT_INCLUDED\n\n#define __ROCKETSQUIRREL_ELEMENTDOCUMENT_INCLUDED\n\n\n\n\n\n#include <Rocket/Core/ElementDocument.h>\n\n#include <squirrel.h>\n\n#include <sqbind/SquirrelBind.h>\n\n#include <streambuf>\n\n\n\n\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n\n\n", "file_path": "source/Core/ElementDocument.h", "rank": 94, "score": 36459.77512019354 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef __ROCKETSQUIRREL_ELEMENTCASTER_INCLUDED\n\n#define __ROCKETSQUIRREL_ELEMENTCASTER_INCLUDED\n\n\n\n\n\n#include <Rocket/Core/Element.h>\n\n#include <squirrel.h>\n\n#include <sqbind/SquirrelBind.h>\n\n#include \"ElementWrapper.h\"\n\n#include <map>\n\n\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n", "file_path": "source/Core/ElementCaster.h", "rank": 95, "score": 36459.7507243855 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef __ROCKETSQUIRREL_VECTORINTERFACE_INCLUDED\n\n#define __ROCKETSQUIRREL_VECTORINTERFACE_INCLUDED\n\n\n\n\n\n#include <Rocket/Core/Variant.h>\n\n#include <squirrel.h>\n\n#include <sqbind/SquirrelBind.h>\n\n#include \"../Debug.h\"\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n\n\n\n\n\n\n\n\n\ntemplate <typename Container>\n", "file_path": "source/Core/VectorInterface.h", "rank": 96, "score": 36459.67549550411 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef __ROCKETSQUIRREL_ELEMENTWRAPPER_INCLUDED\n\n#define __ROCKETSQUIRREL_ELEMENTWRAPPER_INCLUDED\n\n\n\n\n\n#include <Rocket/Core/Element.h>\n\n#include <squirrel.h>\n\n#include <sqbind/SquirrelBind.h>\n\n#include \"VectorInterface.h\"\n\n#include \"ElementStyleProxy.h\"\n\n\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n", "file_path": "source/Core/ElementWrapper.h", "rank": 97, "score": 36459.65346301529 }, { "content": " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\n * THE SOFTWARE.\n\n *\n\n */\n\n\n\n#ifndef __ROCKETSQUIRREL_EVENTWRAPPER_INCLUDED\n\n#define __ROCKETSQUIRREL_EVENTWRAPPER_INCLUDED\n\n\n\n\n\n#include <Rocket/Core/Element.h>\n\n#include <squirrel.h>\n\n#include <sqbind/SquirrelBind.h>\n\n#include \"VectorInterface.h\"\n\n#include \"ElementStyleProxy.h\"\n\n\n\n\n\n\n\nnamespace Rocket {\n\nnamespace Core {\n\nnamespace Squirrel {\n\n\n\n\n\n\n", "file_path": "source/Core/EventWrapper.h", "rank": 98, "score": 36459.65346301529 }, { "content": "\tstatic void Bind(HSQUIRRELVM vm);\n\n};\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n}\n\n}\n\n}\n\n\n\n\n\nSQBIND_DECLARE_CLASS(Rocket::Core::Squirrel::ElementWrapper);\n\nSQBIND_DECLARE_CLASS(Rocket::Core::Squirrel::VectorInterface<Rocket::Core::Squirrel::ElementWrapperList>);\n\n\n\n\n\n#endif", "file_path": "source/Core/ElementWrapper.h", "rank": 99, "score": 36458.61149353566 } ]
C++
webkit/glue/event_conversion.cc
bluebellzhy/chromium
008c4fef2676506869a0404239da31e83fd6ccc7
#include "config.h" #include "base/compiler_specific.h" #if defined(OS_WIN) #include <windows.h> #else #include "KeyboardCodes.h" #endif #include "StringImpl.h" MSVC_PUSH_WARNING_LEVEL(0); #include "PlatformKeyboardEvent.h" #include "PlatformMouseEvent.h" #include "PlatformWheelEvent.h" #include "Widget.h" MSVC_POP_WARNING(); #undef LOG #include "base/gfx/point.h" #include "base/logging.h" #include "webkit/glue/event_conversion.h" #include "webkit/glue/webinputevent.h" #include "webkit/glue/webkit_glue.h" using namespace WebCore; int MakePlatformMouseEvent::last_click_count_ = 0; uint32 MakePlatformMouseEvent::last_click_time_ = 0; MakePlatformMouseEvent::MakePlatformMouseEvent(Widget* widget, const WebMouseEvent& e) { m_position = widget->convertFromContainingWindow(IntPoint(e.x, e.y)); m_globalPosition = IntPoint(e.global_x, e.global_y); m_button = static_cast<MouseButton>(e.button); m_shiftKey = (e.modifiers & WebInputEvent::SHIFT_KEY) != 0; m_ctrlKey = (e.modifiers & WebInputEvent::CTRL_KEY) != 0; m_altKey = (e.modifiers & WebInputEvent::ALT_KEY) != 0; m_metaKey = (e.modifiers & WebInputEvent::META_KEY) != 0; m_modifierFlags = e.modifiers; m_timestamp = e.timestamp_sec; static IntPoint last_click_position; static MouseButton last_click_button = LeftButton; const uint32 current_time = static_cast<uint32>(m_timestamp * 1000); #if defined(OS_WIN) const bool cancel_previous_click = (abs(last_click_position.x() - m_position.x()) > (GetSystemMetrics(SM_CXDOUBLECLK) / 2)) || (abs(last_click_position.y() - m_position.y()) > (GetSystemMetrics(SM_CYDOUBLECLK) / 2)) || ((current_time - last_click_time_) > GetDoubleClickTime()); #elif defined(OS_MACOSX) || defined(OS_LINUX) const bool cancel_previous_click = false; #endif switch (e.type) { case WebInputEvent::MOUSE_MOVE: case WebInputEvent::MOUSE_LEAVE: if (cancel_previous_click) { last_click_count_ = 0; last_click_position = IntPoint(); last_click_time_ = 0; } m_clickCount = last_click_count_; m_eventType = MouseEventMoved; break; case WebInputEvent::MOUSE_DOWN: case WebInputEvent::MOUSE_DOUBLE_CLICK: if (!cancel_previous_click && (m_button == last_click_button)) { ++last_click_count_; } else { last_click_count_ = 1; last_click_position = m_position; } last_click_time_ = current_time; last_click_button = m_button; m_clickCount = last_click_count_; m_eventType = MouseEventPressed; break; case WebInputEvent::MOUSE_UP: m_clickCount = last_click_count_; m_eventType = MouseEventReleased; break; default: NOTREACHED() << "unexpected mouse event type"; } if (webkit_glue::IsLayoutTestMode()) { m_clickCount = e.layout_test_click_count; } } MakePlatformWheelEvent::MakePlatformWheelEvent(Widget* widget, const WebMouseWheelEvent& e) { m_position = widget->convertFromContainingWindow(IntPoint(e.x, e.y)); m_globalPosition = IntPoint(e.global_x, e.global_y); m_deltaX = static_cast<float>(e.delta_x); m_deltaY = static_cast<float>(e.delta_y); m_charsToScrollPerDelta = 1; m_linesToScrollPerDelta = 1; m_pageXScrollMode = false; m_pageYScrollMode = false; m_isAccepted = false; m_shiftKey = (e.modifiers & WebInputEvent::SHIFT_KEY) != 0; m_ctrlKey = (e.modifiers & WebInputEvent::CTRL_KEY) != 0; m_altKey = (e.modifiers & WebInputEvent::ALT_KEY) != 0; m_metaKey = (e.modifiers & WebInputEvent::META_KEY) != 0; m_isContinuous = false; m_continuousDeltaX = 0; m_continuousDeltaY = 0; } static inline const PlatformKeyboardEvent::Type ToPlatformKeyboardEventType( WebInputEvent::Type type) { switch (type) { case WebInputEvent::KEY_UP: return PlatformKeyboardEvent::KeyUp; case WebInputEvent::KEY_DOWN: return PlatformKeyboardEvent::KeyDown; case WebInputEvent::CHAR: return PlatformKeyboardEvent::Char; default: ASSERT_NOT_REACHED(); } return PlatformKeyboardEvent::KeyDown; } static inline String ToSingleCharacterString(UChar c) { return String(&c, 1); } static String GetKeyIdentifierForWindowsKeyCode(unsigned short keyCode) { switch (keyCode) { case VK_MENU: return "Alt"; case VK_CONTROL: return "Control"; case VK_SHIFT: return "Shift"; case VK_CAPITAL: return "CapsLock"; case VK_LWIN: case VK_RWIN: return "Win"; case VK_CLEAR: return "Clear"; case VK_DOWN: return "Down"; case VK_END: return "End"; case VK_RETURN: return "Enter"; case VK_EXECUTE: return "Execute"; case VK_F1: return "F1"; case VK_F2: return "F2"; case VK_F3: return "F3"; case VK_F4: return "F4"; case VK_F5: return "F5"; case VK_F6: return "F6"; case VK_F7: return "F7"; case VK_F8: return "F8"; case VK_F9: return "F9"; case VK_F10: return "F11"; case VK_F12: return "F12"; case VK_F13: return "F13"; case VK_F14: return "F14"; case VK_F15: return "F15"; case VK_F16: return "F16"; case VK_F17: return "F17"; case VK_F18: return "F18"; case VK_F19: return "F19"; case VK_F20: return "F20"; case VK_F21: return "F21"; case VK_F22: return "F22"; case VK_F23: return "F23"; case VK_F24: return "F24"; case VK_HELP: return "Help"; case VK_HOME: return "Home"; case VK_INSERT: return "Insert"; case VK_LEFT: return "Left"; case VK_NEXT: return "PageDown"; case VK_PRIOR: return "PageUp"; case VK_PAUSE: return "Pause"; case VK_SNAPSHOT: return "PrintScreen"; case VK_RIGHT: return "Right"; case VK_SCROLL: return "Scroll"; case VK_SELECT: return "Select"; case VK_UP: return "Up"; case VK_DELETE: return "U+007F"; default: return String::format("U+%04X", toupper(keyCode)); } } MakePlatformKeyboardEvent::MakePlatformKeyboardEvent(const WebKeyboardEvent& e) { #if defined(OS_WIN) || defined(OS_LINUX) m_type = ToPlatformKeyboardEventType(e.type); if (m_type == Char || m_type == KeyDown) m_text = m_unmodifiedText = ToSingleCharacterString(e.key_code); if (m_type != Char) m_keyIdentifier = GetKeyIdentifierForWindowsKeyCode(e.key_code); if (m_type == Char || m_type == KeyDown || m_type == KeyUp || m_type == RawKeyDown) { m_windowsVirtualKeyCode = e.key_code; } else { m_windowsVirtualKeyCode = 0; } #endif m_autoRepeat = (e.modifiers & WebInputEvent::IS_AUTO_REPEAT) != 0; m_isKeypad = (e.modifiers & WebInputEvent::IS_KEYPAD) != 0; m_shiftKey = (e.modifiers & WebInputEvent::SHIFT_KEY) != 0; m_ctrlKey = (e.modifiers & WebInputEvent::CTRL_KEY) != 0; m_altKey = (e.modifiers & WebInputEvent::ALT_KEY) != 0; m_metaKey = (e.modifiers & WebInputEvent::META_KEY) != 0; #if defined(OS_WIN) m_isSystemKey = e.system_key; #endif } void MakePlatformKeyboardEvent::SetKeyType(Type type) { ASSERT(m_type == KeyDown); ASSERT(type == RawKeyDown || type == Char); m_type = type; if (type == RawKeyDown) { m_text = String(); m_unmodifiedText = String(); } else { m_keyIdentifier = String(); m_windowsVirtualKeyCode = 0; } } bool MakePlatformKeyboardEvent::IsCharacterKey() const { switch (windowsVirtualKeyCode()) { #if defined(OS_WIN) case VK_BACK: case VK_ESCAPE: #endif return false; default: break; } return true; }
#include "config.h" #include "base/compiler_specific.h" #if defined(OS_WIN) #include <windows.h> #else #include "KeyboardCodes.h" #endif #include "StringImpl.h" MSVC_PUSH_WARNING_LEVEL(0); #include "PlatformKeyboardEvent.h" #include "PlatformMouseEvent.h" #include "PlatformWheelEvent.h" #include "Widget.h" MSVC_POP_WARNING(); #undef LOG #include "base/gfx/point.h" #include "base/logging.h" #include "webkit/glue/event_conversion.h" #include "webkit/glue/webinputevent.h" #include "webkit/glue/webkit_glue.h" using namespace WebCore; int MakePlatformMouseEvent::last_click_count_ = 0; uint32 MakePlatformMouseEvent::last_click_time_ = 0; MakePlatformMouseEvent::MakePlatformMouseEvent(Widget* widget, const WebMouseEvent& e) { m_position = widget->convertFromContainingWindow(IntPoint(e.x, e.y)); m_globalPosition = IntPoint(e.global_x, e.global_y); m_button = static_cast<MouseButton>(e.button); m_shiftKey = (e.modifiers & WebInputEvent::SHIFT_KEY) != 0; m_ctrlKey = (e.modifiers & WebInputEvent::CTRL_KEY) != 0; m_altKey = (e.modifiers & WebInputEvent::ALT_KEY) != 0; m_metaKey = (e.modifiers & WebInputEvent::META_KEY) != 0; m_modifierFlags = e.modifiers; m_timestamp = e.timestamp_sec; static IntPoint last_click_position; static MouseButton last_click_button = LeftButton; const uint32 current_time = static_cast<uint32>(m_timestamp * 1000); #if defined(OS_WIN) const bool cancel_previous_click = (abs(last_click_position.x() - m_position.x()) > (GetSystemMetrics(SM_CXDOUBLECLK) / 2)) || (abs(last_click_position.y() - m_position.y()) > (GetSystemMetrics(SM_CYDOUBLECLK) / 2)) || ((current_time - last_click_time_) > GetDoubleClickTime()); #elif defined(OS_MACOSX) || defined(OS_LINUX) const bool cancel_previous_click = false; #endif switch (e.type) { case WebInputEvent::MOUSE_MOVE: case WebInputEvent::MOUSE_LEAVE: if (cancel_previous_click) { last_click_count_ = 0; last_click_position = IntPoint(); last_click_time_ = 0; } m_clickCount = last_click_count_; m_eventType = MouseEventMoved; break; case WebInputEvent::MOUSE_DOWN: case WebInputEvent::MOUSE_DOUBLE_CLICK: if (!cancel_previous_click && (m_button == last_click_button)) { ++last_click_count_; } else { last_click_count_ = 1; last_click_position = m_position; } last_click_time_ = current_time; last_click_button = m_button; m_clickCount = last_click_count_; m_eventType = MouseEventPressed; break; case WebInputEvent::MOUSE_UP: m_clickCount = last_click_count_; m_eventType = MouseEventReleased; break; default: NOTREACHED() << "unexpected mouse event type"; } if (webkit_glue::IsLayoutTestMode()) { m_clickCount = e.layout_test_click_count; } } MakePlatformWheelEvent::MakePlatformWheelEvent(Widget* widget, const WebMouseWheelEvent& e) { m_position = widget->convertFromContainingWindow(IntPoint(e.x, e.y)); m_globalPosition = IntPoint(e.global_x, e.global_y); m_deltaX = static_cast<float>(e.delta_x); m_deltaY = static_cast<float>(e.delta_y); m_charsToScrollPerDelta = 1; m_linesToScrollPerDelta = 1; m_pageXScrollMode = false; m_pageYScrollMode = false; m_isAccepted = false; m_shiftKey = (e.modifiers & WebInputEvent::SHIFT_KEY) != 0; m_ctrlKey = (e.modifiers & WebInputEvent::CTRL_KEY) != 0; m_altKey = (e.modifiers & WebInputEvent::ALT_KEY) != 0; m_metaKey = (e.modifiers & WebInputEvent::META_KEY) != 0; m_isContinuous = false; m_continuousDeltaX = 0; m_continuousDeltaY = 0; } static inline const PlatformKeyboardEvent::Type ToPlatformKeyboardEventType( WebInputEvent::Type type) { switch (type) { case WebInputEvent::KEY_UP: return PlatformKeyboardEvent::KeyUp; case WebInputEvent::KEY_DOWN:
static inline String ToSingleCharacterString(UChar c) { return String(&c, 1); } static String GetKeyIdentifierForWindowsKeyCode(unsigned short keyCode) { switch (keyCode) { case VK_MENU: return "Alt"; case VK_CONTROL: return "Control"; case VK_SHIFT: return "Shift"; case VK_CAPITAL: return "CapsLock"; case VK_LWIN: case VK_RWIN: return "Win"; case VK_CLEAR: return "Clear"; case VK_DOWN: return "Down"; case VK_END: return "End"; case VK_RETURN: return "Enter"; case VK_EXECUTE: return "Execute"; case VK_F1: return "F1"; case VK_F2: return "F2"; case VK_F3: return "F3"; case VK_F4: return "F4"; case VK_F5: return "F5"; case VK_F6: return "F6"; case VK_F7: return "F7"; case VK_F8: return "F8"; case VK_F9: return "F9"; case VK_F10: return "F11"; case VK_F12: return "F12"; case VK_F13: return "F13"; case VK_F14: return "F14"; case VK_F15: return "F15"; case VK_F16: return "F16"; case VK_F17: return "F17"; case VK_F18: return "F18"; case VK_F19: return "F19"; case VK_F20: return "F20"; case VK_F21: return "F21"; case VK_F22: return "F22"; case VK_F23: return "F23"; case VK_F24: return "F24"; case VK_HELP: return "Help"; case VK_HOME: return "Home"; case VK_INSERT: return "Insert"; case VK_LEFT: return "Left"; case VK_NEXT: return "PageDown"; case VK_PRIOR: return "PageUp"; case VK_PAUSE: return "Pause"; case VK_SNAPSHOT: return "PrintScreen"; case VK_RIGHT: return "Right"; case VK_SCROLL: return "Scroll"; case VK_SELECT: return "Select"; case VK_UP: return "Up"; case VK_DELETE: return "U+007F"; default: return String::format("U+%04X", toupper(keyCode)); } } MakePlatformKeyboardEvent::MakePlatformKeyboardEvent(const WebKeyboardEvent& e) { #if defined(OS_WIN) || defined(OS_LINUX) m_type = ToPlatformKeyboardEventType(e.type); if (m_type == Char || m_type == KeyDown) m_text = m_unmodifiedText = ToSingleCharacterString(e.key_code); if (m_type != Char) m_keyIdentifier = GetKeyIdentifierForWindowsKeyCode(e.key_code); if (m_type == Char || m_type == KeyDown || m_type == KeyUp || m_type == RawKeyDown) { m_windowsVirtualKeyCode = e.key_code; } else { m_windowsVirtualKeyCode = 0; } #endif m_autoRepeat = (e.modifiers & WebInputEvent::IS_AUTO_REPEAT) != 0; m_isKeypad = (e.modifiers & WebInputEvent::IS_KEYPAD) != 0; m_shiftKey = (e.modifiers & WebInputEvent::SHIFT_KEY) != 0; m_ctrlKey = (e.modifiers & WebInputEvent::CTRL_KEY) != 0; m_altKey = (e.modifiers & WebInputEvent::ALT_KEY) != 0; m_metaKey = (e.modifiers & WebInputEvent::META_KEY) != 0; #if defined(OS_WIN) m_isSystemKey = e.system_key; #endif } void MakePlatformKeyboardEvent::SetKeyType(Type type) { ASSERT(m_type == KeyDown); ASSERT(type == RawKeyDown || type == Char); m_type = type; if (type == RawKeyDown) { m_text = String(); m_unmodifiedText = String(); } else { m_keyIdentifier = String(); m_windowsVirtualKeyCode = 0; } } bool MakePlatformKeyboardEvent::IsCharacterKey() const { switch (windowsVirtualKeyCode()) { #if defined(OS_WIN) case VK_BACK: case VK_ESCAPE: #endif return false; default: break; } return true; }
return PlatformKeyboardEvent::KeyDown; case WebInputEvent::CHAR: return PlatformKeyboardEvent::Char; default: ASSERT_NOT_REACHED(); } return PlatformKeyboardEvent::KeyDown; }
function_block-function_prefix_line
[ { "content": "class SkEvent;\n\n\n", "file_path": "skia/include/SkWidget.h", "rank": 0, "score": 202538.54512832483 }, { "content": "class WebMouseEvent;\n", "file_path": "chrome/browser/render_widget_host.h", "rank": 1, "score": 191707.1018699238 }, { "content": "class WebMouseWheelEvent;\n", "file_path": "chrome/browser/render_widget_host.h", "rank": 2, "score": 186523.81193697584 }, { "content": "enum nsPluginEventType {\n\n#if defined(XP_MAC) || defined(XP_MACOSX)\n\n nsPluginEventType_GetFocusEvent = (osEvt + 16),\n\n nsPluginEventType_LoseFocusEvent,\n\n nsPluginEventType_AdjustCursorEvent,\n\n nsPluginEventType_MenuCommandEvent,\n\n nsPluginEventType_ClippingChangedEvent,\n\n nsPluginEventType_ScrollingBeginsEvent,\n\n nsPluginEventType_ScrollingEndsEvent,\n\n#endif /* XP_MAC || XP_MACOSX */\n\n nsPluginEventType_Idle = 0\n\n};\n\n\n\n////////////////////////////////////////////////////////////////////////////////\n\n\n", "file_path": "third_party/mozilla/include/nsplugindefs.h", "rank": 3, "score": 186078.27485863943 }, { "content": " friend bool operator>=(const Sk64& a, const Sk64& b) {\n", "file_path": "skia/include/corecg/Sk64.h", "rank": 4, "score": 185721.0476966447 }, { "content": "struct Sk64 {\n\n int32_t fHi; //!< the high 32 bits of the number (including sign)\n\n uint32_t fLo; //!< the low 32 bits of the number\n\n\n\n /** Returns non-zero if the Sk64 can be represented as a signed 32 bit integer\n\n */\n\n SkBool is32() const { return fHi == ((int32_t)fLo >> 31); }\n\n\n\n /** Returns non-zero if the Sk64 cannot be represented as a signed 32 bit integer\n\n */\n", "file_path": "skia/include/corecg/Sk64.h", "rank": 5, "score": 185716.89055185643 }, { "content": " class Widget;\n\n}\n\n\n", "file_path": "webkit/glue/event_conversion.h", "rank": 6, "score": 185355.38280090346 }, { "content": " u8 type; /* One of the SQLITE_COLL_... values below */\n", "file_path": "third_party/sqlite/sqliteInt.h", "rank": 7, "score": 182519.84629426096 }, { "content": " u8 type; /* One of SQLITE_NULL, SQLITE_TEXT, SQLITE_INTEGER, etc */\n", "file_path": "third_party/sqlite/vdbeInt.h", "rank": 8, "score": 182519.84629426096 }, { "content": " friend bool operator!=(const SkPoint& a, const SkPoint& b) {\n", "file_path": "skia/include/corecg/SkPoint.h", "rank": 9, "score": 182275.2633378561 }, { "content": "struct SkIPoint {\n\n int32_t fX, fY;\n\n\n\n /** Set the x and y values of the point. */\n\n void set(int32_t x, int32_t y) { fX = x; fY = y; }\n\n\n\n /** Rotate the point clockwise, writing the new point into dst\n\n It is legal for dst == this\n\n */\n", "file_path": "skia/include/corecg/SkPoint.h", "rank": 10, "score": 182271.23326263446 }, { "content": "struct SkRect {\n\n SkScalar fLeft, fTop, fRight, fBottom;\n\n\n\n /** Return true if the rectangle's width or height are <= 0\n\n */\n\n bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; }\n", "file_path": "skia/include/corecg/SkRect.h", "rank": 11, "score": 182271.23326263446 }, { "content": " const T& top() const { return (*this)[fCount - 1]; }\n", "file_path": "skia/include/SkTDArray.h", "rank": 12, "score": 182271.23326263446 }, { "content": " friend int operator!=(const SkRect& a, const SkRect& b)\n", "file_path": "skia/include/corecg/SkRect.h", "rank": 13, "score": 182171.04427318225 }, { "content": "class WebMouseEvent;\n", "file_path": "chrome/browser/render_widget_host_view_win.h", "rank": 14, "score": 181613.4301361413 }, { "content": " def Type(self):\n", "file_path": "third_party/libevent/event_rpcgen.py", "rank": 15, "score": 179276.15155344678 }, { "content": " unsigned int use;\t\t/* The buffer size used */\n", "file_path": "third_party/libxml/include/libxml/tree.h", "rank": 16, "score": 179007.80452410717 }, { "content": " int type;\n", "file_path": "third_party/libxml/include/libxml/tree.h", "rank": 17, "score": 178948.07145318962 }, { "content": " xmlElementType type; /* XML_ENTITY_DECL, must be second ! */\n", "file_path": "third_party/libxml/include/libxml/entities.h", "rank": 18, "score": 178933.2806086113 }, { "content": " xmlXPathObjectType type;\n", "file_path": "third_party/libxml/include/libxml/xpath.h", "rank": 19, "score": 178933.2806086113 }, { "content": "class SkStaticTextView : public SkView {\n\npublic:\n\n SkStaticTextView(uint32_t flags = 0);\n\n virtual ~SkStaticTextView();\n\n\n\n enum Mode {\n\n kFixedSize_Mode,\n\n kAutoWidth_Mode,\n\n kAutoHeight_Mode,\n\n\n\n kModeCount\n\n };\n\n Mode getMode() const { return (Mode)fMode; }\n\n void setMode(Mode);\n\n\n\n SkTextBox::SpacingAlign getSpacingAlign() const { return (SkTextBox::SpacingAlign)fSpacingAlign; }\n\n void setSpacingAlign(SkTextBox::SpacingAlign);\n\n\n\n void getMargin(SkPoint* margin) const;\n\n void setMargin(SkScalar dx, SkScalar dy);\n", "file_path": "skia/include/SkWidget.h", "rank": 20, "score": 176620.30676807562 }, { "content": "class SkListSource : public SkEventSink {\n\npublic:\n\n virtual int countRows() = 0;\n\n virtual void getRow(int index, SkString* left, SkString* right) = 0;\n\n virtual SkEvent* getEvent(int index);\n\n\n\n static SkListSource* CreateFromDir(const char path[], const char suffix[],\n\n const char targetPrefix[]);\n\n static SkListSource* CreateFromDOM(const SkDOM& dom, const SkDOM::Node* node);\n\n};\n\n\n", "file_path": "skia/include/SkWidget.h", "rank": 21, "score": 176562.47558330497 }, { "content": " xmlSchemaTypePtr type;/* the linked type */\n", "file_path": "third_party/libxml/include/libxml/schemasInternals.h", "rank": 22, "score": 175845.87841256196 }, { "content": "class SkStaticTextView : public SkView {\n\npublic:\n\n SkStaticTextView();\n\n virtual ~SkStaticTextView();\n\n\n\n enum Mode {\n\n kFixedSize_Mode,\n\n kAutoWidth_Mode,\n\n kAutoHeight_Mode,\n\n\n\n kModeCount\n\n };\n\n Mode getMode() const { return (Mode)fMode; }\n\n void setMode(Mode);\n\n\n\n SkTextBox::SpacingAlign getSpacingAlign() const { return (SkTextBox::SpacingAlign)fSpacingAlign; }\n\n void setSpacingAlign(SkTextBox::SpacingAlign);\n\n\n\n void getMargin(SkPoint* margin) const;\n\n void setMargin(SkScalar dx, SkScalar dy);\n", "file_path": "skia/include/SkWidgetViews.h", "rank": 23, "score": 172203.20923618547 }, { "content": "class nsIEventHandler; // event handler interface\n", "file_path": "third_party/mozilla/include/nsplugindefs.h", "rank": 24, "score": 163693.41752403794 }, { "content": "struct DefaultSingletonObjCTraits : public DefaultSingletonTraits<Type> {\n\n static Type* New() {\n\n return [[Type alloc] init];\n\n }\n\n\n\n static void Delete(Type* object) {\n\n [object release];\n\n }\n\n};\n\n\n\n// Exactly like Singleton, but without the DefaultSingletonObjCTraits as the\n\n// default trait class. This makes it straightforward for Objective-C++ code\n\n// to hold Objective-C objects as singletons.\n\ntemplate<typename Type,\n\n typename Traits = DefaultSingletonObjCTraits<Type>,\n\n typename DifferentiatingType = Type>\n", "file_path": "base/singleton_objc.h", "rank": 25, "score": 158684.92974225993 }, { "content": "class MakePlatformMouseEvent : public WebCore::PlatformMouseEvent {\n\n public:\n\n MakePlatformMouseEvent(WebCore::Widget* widget, const WebMouseEvent& e);\n\n\n\n static void ResetLastClick() {\n\n last_click_time_ = last_click_count_ = 0;\n\n }\n\n\n\n private:\n\n static int last_click_count_;\n\n static uint32 last_click_time_;\n\n};\n\n\n", "file_path": "webkit/glue/event_conversion.h", "rank": 26, "score": 155914.11477717437 }, { "content": "class WebMouseWheelEvent : public WebMouseEvent {\n\n public:\n\n int delta_x;\n\n int delta_y;\n\n\n\n WebMouseWheelEvent() {}\n\n#if defined(OS_WIN)\n\n WebMouseWheelEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);\n\n#elif defined(OS_MACOSX)\n\n WebMouseWheelEvent(NSEvent *event, NSView* view);\n\n#elif defined(OS_LINUX)\n\n explicit WebMouseWheelEvent(const GdkEventScroll* event);\n\n#endif\n\n};\n\n\n\n// WebKeyboardEvent -----------------------------------------------------------\n\n\n", "file_path": "webkit/glue/webinputevent.h", "rank": 27, "score": 153963.16087182373 }, { "content": "////////////////////////////////////////////////////////////////////////////////\n\n//\n\n// MouseEvent class\n\n//\n\n// A mouse event is used for any input event related to the mouse.\n\n//\n\n////////////////////////////////////////////////////////////////////////////////\n\nclass MouseEvent : public LocatedEvent {\n\n public:\n\n // Flags specific to mouse events\n\n enum MouseEventFlags { EF_IS_DOUBLE_CLICK = 1 << 16 };\n\n\n\n // Create a new mouse event\n\n MouseEvent(EventType type, int x, int y, int flags)\n\n : LocatedEvent(type, gfx::Point(x, y), flags) {\n\n }\n\n\n\n // Create a new mouse event from a type and a point. If from / to views\n\n // are provided, the point will be converted from 'from' coordinate system to\n\n // 'to' coordinate system.\n\n MouseEvent(EventType type,\n\n View* from,\n\n View* to,\n\n const gfx::Point &l,\n\n int flags);\n\n\n\n // Create a new MouseEvent which is identical to the provided model.\n", "file_path": "chrome/views/event.h", "rank": 28, "score": 152930.06817280495 }, { "content": "class SkEvent {\n\npublic:\n\n /** Default construct, creating an empty event.\n\n */\n\n SkEvent();\n\n /** Construct a new event with the specified type.\n\n */\n\n explicit SkEvent(const SkString& type);\n\n /** Construct a new event with the specified type.\n\n */\n\n explicit SkEvent(const char type[]);\n\n /** Construct a new event by copying the fields from the src event.\n\n */\n\n SkEvent(const SkEvent& src);\n\n ~SkEvent();\n\n\n\n// /** Return the event's type (will never be null) */\n\n// const char* getType() const;\n\n /** Copy the event's type into the specified SkString parameter */\n\n void getType(SkString* str) const;\n", "file_path": "skia/include/SkEvent.h", "rank": 29, "score": 151217.83670894802 }, { "content": "////////////////////////////////////////////////////////////////////////////////\n\n//\n\n// MouseWheelEvent class\n\n//\n\n// A MouseWheelEvent is used to propagate mouse wheel user events\n\n//\n\n////////////////////////////////////////////////////////////////////////////////\n\nclass MouseWheelEvent : public LocatedEvent {\n\n public:\n\n // Create a new key event\n\n MouseWheelEvent(int offset, int x, int y, int flags)\n\n : LocatedEvent(ET_MOUSEWHEEL, gfx::Point(x, y), flags),\n\n offset_(offset) {\n\n }\n\n\n\n int GetOffset() const {\n\n return offset_;\n\n }\n\n\n\n private:\n\n int offset_;\n\n\n\n DISALLOW_EVIL_CONSTRUCTORS(MouseWheelEvent);\n\n};\n\n\n", "file_path": "chrome/views/event.h", "rank": 30, "score": 150067.56099565374 }, { "content": "class WebMouseEvent;\n", "file_path": "webkit/glue/event_conversion.h", "rank": 31, "score": 148226.6872130068 }, { "content": "class MouseEvent;\n\n}\n\n\n\nnamespace event_utils {\n\n\n\n// Translates event flags into what kind of disposition they represents.\n\n// For example, a middle click would mean to open a background tab.\n\n// event_flags are the flags as understood by views::MouseEvent.\n\nWindowOpenDisposition DispositionFromEventFlags(int event_flags);\n\n\n\n// Returns true if the specified mouse event may have a\n\n// WindowOptionDisposition.\n\nbool IsPossibleDispositionEvent(const views::MouseEvent& event);\n\n\n\n}\n\n\n\n#endif // CHROME_BROWSER_VIEWS_BOOKMARK_BAR_VIEW_H__\n\n\n", "file_path": "chrome/browser/views/event_utils.h", "rank": 32, "score": 148226.6872130068 }, { "content": "class SkHasLabelWidget : public SkWidget {\n\npublic:\n\n SkHasLabelWidget(uint32_t flags = 0) : SkWidget(flags) {}\n\n\n\n size_t getLabel(SkString* label = NULL) const;\n\n size_t getLabel(char lable[] = NULL) const;\n\n void setLabel(const SkString&);\n\n void setLabel(const char label[]);\n\n void setLabel(const char label[], size_t len);\n\n\n\nprotected:\n\n // called when the label changes\n\n virtual void onLabelChange();\n\n\n\n // overrides\n\n virtual void onInflate(const SkDOM& dom, const SkDOM::Node*);\n\n\n\nprivate:\n\n SkString fLabel;\n\n typedef SkWidget INHERITED;\n\n};\n\n\n", "file_path": "skia/include/SkWidget.h", "rank": 33, "score": 146937.9764744974 }, { "content": "struct LockTrait : public DefaultSingletonTraits<Type> {\n\n};\n\n\n", "file_path": "base/singleton_unittest.cc", "rank": 34, "score": 146059.49856765842 }, { "content": "struct Init5Trait : public DefaultSingletonTraits<int> {\n\n static int* New() {\n\n return new int(5);\n\n }\n\n};\n\n\n\ntypedef void (*CallbackFunc)();\n\n\n", "file_path": "base/singleton_unittest.cc", "rank": 35, "score": 146035.5467868311 }, { "content": "class V8SVGStaticPODTypeWrapperWithPODTypeParent : public V8SVGStaticPODTypeWrapper<PODType> { \n\npublic: \n\n typedef V8SVGPODTypeWrapper<ParentTypeArg> ParentType; \n\n \n\n V8SVGStaticPODTypeWrapperWithPODTypeParent(PODType type, ParentType* parent) \n\n : V8SVGStaticPODTypeWrapper<PODType>(type) \n\n , m_parentType(parent) \n\n { \n\n } \n\n\n\n virtual void commitChange(PODType type, SVGElement* context) \n\n { \n\n V8SVGStaticPODTypeWrapper<PODType>::commitChange(type, context); \n\n m_parentType->commitChange(ParentTypeArg(type), context); \n\n } \n\n \n\nprivate: \n\n RefPtr<ParentType> m_parentType; \n\n}; \n\n \n\ntemplate<typename PODType, typename ParentType> \n", "file_path": "webkit/port/bindings/v8/V8SVGPODTypeWrapper.h", "rank": 36, "score": 145432.54897729194 }, { "content": "class WebMouseWheelEvent;\n", "file_path": "webkit/glue/event_conversion.h", "rank": 37, "score": 144945.9521450423 }, { "content": "enum SkWidgetEnum {\n\n kBorder_WidgetEnum, //!< <sk-border>\n\n kButton_WidgetEnum, //!< <sk-button>\n\n kImage_WidgetEnum, //!< <sk-image>\n\n kList_WidgetEnum, //!< <sk-list>\n\n kProgress_WidgetEnum, //!< <sk-progress>\n\n kScroll_WidgetEnum, //!< <sk-scroll>\n\n kText_WidgetEnum, //!< <sk-text>\n\n \n\n kWidgetEnumCount\n\n};\n\n\n", "file_path": "skia/include/SkWidgetViews.h", "rank": 38, "score": 144558.83996627058 }, { "content": "class SkButtonWidget : public SkHasLabelWidget {\n\npublic:\n\n SkButtonWidget(uint32_t flags = 0) : SkHasLabelWidget(flags), fState(kOff_State) {}\n\n\n\n enum State {\n\n kOff_State, //!< XML: buttonState=\"off\"\n\n kOn_State, //!< XML: buttonState=\"on\"\n\n kUnknown_State //!< XML: buttonState=\"unknown\"\n\n };\n\n State getButtonState() const { return fState; }\n\n void setButtonState(State);\n\n\n\nprotected:\n\n /** called when the label changes. default behavior is to inval the widget */\n\n virtual void onButtonStateChange();\n\n\n\n // overrides\n\n virtual void onInflate(const SkDOM& dom, const SkDOM::Node*);\n\n\n\nprivate:\n\n State fState;\n\n typedef SkHasLabelWidget INHERITED;\n\n};\n\n\n", "file_path": "skia/include/SkWidget.h", "rank": 39, "score": 144316.80861774163 }, { "content": " void ensureStrCache(int visibleCount);\n\n\n\n int logicalToVisualIndex(int index) const { return index - fScrollIndex; }\n\n void invalSelection();\n\n bool getRowRect(int index, SkRect*) const;\n\n void ensureSelectionIsVisible();\n\n\n\n typedef SkWidgetView INHERITED;\n\n};\n\n\n\n//////////////////////////////////////////////////////////\n\n\n", "file_path": "skia/include/SkWidget.h", "rank": 40, "score": 143363.6027154187 }, { "content": " */\n\n void setActionEvent(Action, SkEvent* event);\n\n#endif\n\n\n\nprotected:\n\n virtual void onDraw(SkCanvas*);\n\n virtual void onSizeChange();\n\n virtual bool onEvent(const SkEvent&);\n\n virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node);\n\n\n\nprivate:\n\n SkPaint fPaint[kAttrCount];\n\n SkListSource* fSource;\n\n SkScalar fRowHeight;\n\n int fCurrIndex; // logical index\n\n int fScrollIndex; // logical index of top-most visible row\n\n int fVisibleRowCount;\n\n SkString* fStrCache;\n\n\n\n void dirtyStrCache();\n", "file_path": "skia/include/SkWidget.h", "rank": 41, "score": 143363.46163550302 }, { "content": "/* include/graphics/SkWidget.h\n\n**\n\n** Copyright 2006, Google Inc.\n\n**\n\n** Licensed under the Apache License, Version 2.0 (the \"License\"); \n\n** you may not use this file except in compliance with the License. \n\n** You may obtain a copy of the License at \n\n**\n\n** http://www.apache.org/licenses/LICENSE-2.0 \n\n**\n\n** Unless required by applicable law or agreed to in writing, software \n\n** distributed under the License is distributed on an \"AS IS\" BASIS, \n\n** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \n\n** See the License for the specific language governing permissions and \n\n** limitations under the License.\n\n*/\n\n\n\n#ifndef SkWidget_DEFINED\n\n#define SkWidget_DEFINED\n\n\n\n#include \"SkView.h\"\n\n#include \"SkBitmap.h\"\n\n#include \"SkDOM.h\"\n\n#include \"SkPaint.h\"\n\n#include \"SkString.h\"\n\n#include \"SkTDArray.h\"\n\n\n\n//////////////////////////////////////////////////////////////////////////////\n\n\n", "file_path": "skia/include/SkWidget.h", "rank": 42, "score": 143363.315885711 }, { "content": " SkPoint fCellSize;\n\n SkIPoint fVisibleCount;\n\n\n\n int logicalToVisualIndex(int index) const { return index; }\n\n void invalSelection();\n\n bool getCellRect(int index, SkRect*) const;\n\n void ensureSelectionIsVisible();\n\n\n\n typedef SkWidgetView INHERITED;\n\n};\n\n\n\n#endif\n\n\n", "file_path": "skia/include/SkWidget.h", "rank": 43, "score": 143363.2339731987 }, { "content": " /** Returns true if the event's type matches exactly the specified type (case sensitive) */\n\n bool isType(const SkString& str) const;\n\n /** Returns true if the event's type matches exactly the specified type (case sensitive) */\n\n bool isType(const char type[], size_t len = 0) const;\n\n /** Set the event's type to the specified string.\n\n In XML, use the \"type\" attribute.\n\n */\n\n void setType(const SkString&);\n\n /** Set the event's type to the specified string.\n\n In XML, use the \"type\" attribute.\n\n */\n\n void setType(const char type[], size_t len = 0);\n\n\n\n /** Return the event's unnamed 32bit field. Default value is 0 */\n\n uint32_t getFast32() const { return f32; }\n\n /** Set the event's unnamed 32bit field. In XML, use\n\n the subelement <data fast32=... />\n\n */\n\n void setFast32(uint32_t x) { f32 = x; }\n\n\n", "file_path": "skia/include/SkEvent.h", "rank": 44, "score": 143361.30595656464 }, { "content": " kHiliteCell_Attr,\n\n kAttrCount\n\n };\n\n SkPaint& paint(Attr);\n\n\n\n SkListSource* getListSource() const { return fSource; }\n\n SkListSource* setListSource(SkListSource*);\n\n\n\nprotected:\n\n virtual void onDraw(SkCanvas*);\n\n virtual void onSizeChange();\n\n virtual bool onEvent(const SkEvent&);\n\n virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node);\n\n\n\nprivate:\n\n SkView* fScrollBar;\n\n SkPaint fPaint[kAttrCount];\n\n SkListSource* fSource;\n\n int fCurrIndex; // logical index\n\n\n", "file_path": "skia/include/SkWidget.h", "rank": 45, "score": 143358.80508252245 }, { "content": " kNormalText_Attr,\n\n kHiliteText_Attr,\n\n kHiliteCell_Attr,\n\n kAttrCount\n\n };\n\n SkPaint& paint(Attr);\n\n\n\n SkListSource* getListSource() const { return fSource; }\n\n SkListSource* setListSource(SkListSource*);\n\n\n\n#if 0\n\n enum Action {\n\n kSelectionChange_Action,\n\n kSelectionPicked_Action,\n\n kActionCount\n\n };\n\n /** If event is not null, it is retained by the view, and a copy\n\n of the event will be posted to its listeners when the specified\n\n action occurs. If event is null, then no event will be posted for\n\n the specified action.\n", "file_path": "skia/include/SkWidget.h", "rank": 46, "score": 143352.13978522262 }, { "content": "\n\n ////////////////////////////////////////////////////\n\n /** Porting layer must implement these functions **/\n\n ////////////////////////////////////////////////////\n\n\n\n /** Called whenever an SkEvent is posted to an empty queue, so that the OS\n\n can be told to later call Dequeue().\n\n */\n\n static void SignalNonEmptyQueue();\n\n /** Called whenever the delay until the next delayed event changes. If zero is\n\n passed, then there are no more queued delay events.\n\n */\n\n static void SignalQueueTimer(SkMSec delay);\n\n\n\n#ifndef SK_USE_WXWIDGETS\n\n#ifdef SK_BUILD_FOR_WIN\n\n static bool WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);\n\n#elif defined(SK_BUILD_FOR_UNIXx)\n\n static uint32_t HandleTimer(uint32_t, void*);\n\n static bool WndProc(Display*, Window, XEvent&);\n", "file_path": "skia/include/SkEvent.h", "rank": 47, "score": 143344.27097085555 }, { "content": "\n\n size_t getText(SkString* text = NULL) const;\n\n size_t getText(char text[] = NULL) const;\n\n void setText(const SkString&);\n\n void setText(const char text[]);\n\n void setText(const char text[], size_t len);\n\n\n\n void getPaint(SkPaint*) const;\n\n void setPaint(const SkPaint&);\n\n\n\nprotected:\n\n // overrides\n\n virtual void onDraw(SkCanvas*);\n\n virtual void onInflate(const SkDOM& dom, const SkDOM::Node*);\n\n\n\nprivate:\n\n SkPoint fMargin;\n\n SkString fText;\n\n SkPaint fPaint;\n\n uint8_t fMode;\n\n uint8_t fSpacingAlign;\n\n\n\n void computeSize();\n\n\n\n typedef SkView INHERITED;\n\n};\n\n\n", "file_path": "skia/include/SkWidget.h", "rank": 48, "score": 143344.13356008072 }, { "content": " SkPaint& paint() { return fPaint; }\n\n\n\nprotected:\n\n virtual void onDraw(SkCanvas*);\n\n virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node);\n\n\n\nprivate:\n\n SkString fText;\n\n SkPaint fPaint;\n\n SkPoint fMargin;\n\n\n", "file_path": "skia/include/SkWidget.h", "rank": 49, "score": 143344.13356008072 }, { "content": "#endif\n\n#else\n\n // Don't know yet what this will be\n\n //static bool CustomEvent();\n\n#endif\n\n\n\nprivate:\n\n SkMetaData fMeta;\n\n mutable char* fType; // may be characters with low bit set to know that it is not a pointer\n\n uint32_t f32;\n\n SkDEBUGCODE(bool fDebugTrace;)\n\n\n\n // these are for our implementation of the event queue\n\n SkEventSinkID fTargetID;\n\n SkMSec fTime;\n\n SkEvent* fNextEvent; // either in the delay or normal event queue\n\n void initialize(const char* type, size_t typeLen);\n\n\n\n static bool Enqueue(SkEvent* evt);\n\n static SkMSec EnqueueTime(SkEvent* evt, SkMSec time);\n\n static SkEvent* Dequeue(SkEventSinkID* targetID);\n\n static bool QHasEvents();\n\n};\n\n\n\n#endif\n\n\n", "file_path": "skia/include/SkEvent.h", "rank": 50, "score": 143341.8130039583 }, { "content": "#include \"SkDOM.h\"\n\n#include \"SkMetaData.h\"\n\n#include \"SkString.h\"\n\n\n\n//class SkOSWindow;\n\n\n\n/** Unique 32bit id used to identify an instance of SkEventSink. When events are\n\n posted, they are posted to a specific sinkID. When it is time to dispatch the\n\n event, the sinkID is used to find the specific SkEventSink object. If it is found,\n\n its doEvent() method is called with the event.\n\n*/\n\ntypedef uint32_t SkEventSinkID;\n\n\n\n/** \\class SkEvent\n\n\n\n SkEvents are used to communicate type-safe information to SkEventSinks.\n\n SkEventSinks (including SkViews) each have a unique ID, which is stored\n\n in an event. This ID is used to target the event once it has been \"posted\".\n\n*/\n", "file_path": "skia/include/SkEvent.h", "rank": 51, "score": 143338.89713279513 }, { "content": " and ignore the value parameter.\n\n */\n\n bool findPtr(const char name[], void** value) const { return fMeta.findPtr(name, value); }\n\n bool findBool(const char name[], bool* value) const { return fMeta.findBool(name, value); }\n\n\n\n /** Returns true if ethe event contains the named 32bit field, and if it equals the specified value */\n\n bool hasS32(const char name[], int32_t value) const { return fMeta.hasS32(name, value); }\n\n /** Returns true if ethe event contains the named SkScalar field, and if it equals the specified value */\n\n bool hasScalar(const char name[], SkScalar value) const { return fMeta.hasScalar(name, value); }\n\n /** Returns true if ethe event contains the named string field, and if it equals (using strcmp) the specified value */\n\n bool hasString(const char name[], const char value[]) const { return fMeta.hasString(name, value); }\n\n /** Returns true if ethe event contains the named pointer field, and if it equals the specified value */\n\n bool hasPtr(const char name[], void* value) const { return fMeta.hasPtr(name, value); }\n\n bool hasBool(const char name[], bool value) const { return fMeta.hasBool(name, value); }\n\n\n\n /** Add/replace the named 32bit field to the event. In XML use the subelement <data name=... s32=... /> */\n\n void setS32(const char name[], int32_t value) { fMeta.setS32(name, value); }\n\n /** Add/replace the named SkScalar field to the event. In XML use the subelement <data name=... scalar=... /> */\n\n void setScalar(const char name[], SkScalar value) { fMeta.setScalar(name, value); }\n\n /** Add/replace the named SkScalar[] field to the event. */\n", "file_path": "skia/include/SkEvent.h", "rank": 52, "score": 143336.24266477034 }, { "content": " SkScalar* setScalars(const char name[], int count, const SkScalar values[] = NULL) { return fMeta.setScalars(name, count, values); }\n\n /** Add/replace the named string field to the event. In XML use the subelement <data name=... string=... */\n\n void setString(const char name[], const SkString& value) { fMeta.setString(name, value.c_str()); }\n\n /** Add/replace the named string field to the event. In XML use the subelement <data name=... string=... */\n\n void setString(const char name[], const char value[]) { fMeta.setString(name, value); }\n\n /** Add/replace the named pointer field to the event. There is no XML equivalent for this call */\n\n void setPtr(const char name[], void* value) { fMeta.setPtr(name, value); }\n\n void setBool(const char name[], bool value) { fMeta.setBool(name, value); }\n\n\n\n /** Return the underlying metadata object */\n\n SkMetaData& getMetaData() { return fMeta; }\n\n /** Return the underlying metadata object */\n\n const SkMetaData& getMetaData() const { return fMeta; }\n\n\n\n void tron() { SkDEBUGCODE(fDebugTrace = true;) }\n\n void troff() { SkDEBUGCODE(fDebugTrace = false;) }\n\n bool isDebugTrace() const\n\n {\n\n#ifdef SK_DEBUG\n\n return fDebugTrace;\n", "file_path": "skia/include/SkEvent.h", "rank": 53, "score": 143333.49647983554 }, { "content": "#else\n\n return false;\n\n#endif\n\n }\n\n\n\n /** Call this to initialize the event from the specified XML node */\n\n void inflate(const SkDOM&, const SkDOM::Node*);\n\n\n\n SkDEBUGCODE(void dump(const char title[] = NULL);)\n\n\n\n /** Post the specified event to the event queue, targeting the specified eventsink, with an optional\n\n delay. The event must be dynamically allocated for this. It cannot be a global or on the stack.\n\n After this call, ownership is transfered to the system, so the caller must not retain\n\n the event's ptr. Returns false if the event could not be posted (which means it will have been deleted).\n\n */\n\n static bool Post(SkEvent* evt, SkEventSinkID targetID, SkMSec delay = 0);\n\n /** Post the specified event to the event queue, targeting the specified eventsink, to be delivered on/after the\n\n specified millisecond time. The event must be dynamically allocated for this. It cannot be a global or on the stack.\n\n After this call, ownership is transfered to the system, so the caller must not retain\n\n the event's ptr. Returns false if the event could not be posted (which means it will have been deleted).\n", "file_path": "skia/include/SkEvent.h", "rank": 54, "score": 143331.47257250478 }, { "content": "\n\n /** Global initialization function for the SkEvent system. Should be called exactly\n\n once before any other event method is called, and should be called after the\n\n call to SkGraphics::Init().\n\n */\n\n static void Init();\n\n /** Global cleanup function for the SkEvent system. Should be called exactly once after\n\n all event methods have been called, and should be called before calling SkGraphics::Term().\n\n */\n\n static void Term();\n\n\n\n /** Call this to process one event from the queue. If it returns true, there are more events\n\n to process.\n\n */\n\n static bool ProcessEvent();\n\n /** Call this whenever the requested timer has expired (requested by a call to SetQueueTimer).\n\n It will post any delayed events whose time as \"expired\" onto the event queue.\n\n It may also call SignalQueueTimer() and SignalNonEmptyQueue().\n\n */\n\n static void ServiceQueueTimer();\n", "file_path": "skia/include/SkEvent.h", "rank": 55, "score": 143330.33260070928 }, { "content": " /** Return true if the event contains the named 32bit field, and return the field\n\n in value (if value is non-null). If there is no matching named field, return false\n\n and ignore the value parameter.\n\n */\n\n bool findS32(const char name[], int32_t* value = NULL) const { return fMeta.findS32(name, value); }\n\n /** Return true if the event contains the named SkScalar field, and return the field\n\n in value (if value is non-null). If there is no matching named field, return false\n\n and ignore the value parameter.\n\n */\n\n bool findScalar(const char name[], SkScalar* value = NULL) const { return fMeta.findScalar(name, value); }\n\n /** Return true if the event contains the named SkScalar field, and return the fields\n\n in value[] (if value is non-null), and return the number of SkScalars in count (if count is non-null).\n\n If there is no matching named field, return false and ignore the value and count parameters.\n\n */\n\n const SkScalar* findScalars(const char name[], int* count, SkScalar values[] = NULL) const { return fMeta.findScalars(name, count, values); }\n\n /** Return the value of the named string field, or if no matching named field exists, return null.\n\n */\n\n const char* findString(const char name[]) const { return fMeta.findString(name); }\n\n /** Return true if the event contains the named pointer field, and return the field\n\n in value (if value is non-null). If there is no matching named field, return false\n", "file_path": "skia/include/SkEvent.h", "rank": 56, "score": 143330.2531670084 }, { "content": " */\n\n static bool PostTime(SkEvent* evt, SkEventSinkID targetID, SkMSec time);\n\n\n\n /** Helper method for calling SkEvent::PostTime(this, ...), where the caller specifies a delay.\n\n The real \"time\" will be computed automatically by sampling the clock and adding its value\n\n to delay.\n\n */\n\n bool post(SkEventSinkID sinkID, SkMSec delay = 0)\n\n {\n\n return SkEvent::Post(this, sinkID, delay);\n\n }\n\n\n\n void postTime(SkEventSinkID sinkID, SkMSec time)\n\n {\n\n SkEvent::PostTime(this, sinkID, time);\n\n }\n\n\n\n ///////////////////////////////////////////////\n\n /** Porting layer must call these functions **/\n\n ///////////////////////////////////////////////\n", "file_path": "skia/include/SkEvent.h", "rank": 57, "score": 143328.5134040907 }, { "content": "/* include/graphics/SkEvent.h\n\n**\n\n** Copyright 2006, Google Inc.\n\n**\n\n** Licensed under the Apache License, Version 2.0 (the \"License\"); \n\n** you may not use this file except in compliance with the License. \n\n** You may obtain a copy of the License at \n\n**\n\n** http://www.apache.org/licenses/LICENSE-2.0 \n\n**\n\n** Unless required by applicable law or agreed to in writing, software \n\n** distributed under the License is distributed on an \"AS IS\" BASIS, \n\n** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \n\n** See the License for the specific language governing permissions and \n\n** limitations under the License.\n\n*/\n\n\n\n#ifndef SkEvent_DEFINED\n\n#define SkEvent_DEFINED\n\n\n", "file_path": "skia/include/SkEvent.h", "rank": 58, "score": 143326.4670670559 }, { "content": "static void event_log(int severity, const char *msg);\n", "file_path": "third_party/libevent/log.c", "rank": 59, "score": 141809.9876749245 }, { "content": "class SkCheckBoxWidget : public SkButtonWidget {\n\npublic:\n\n SkCheckBoxWidget(uint32_t flags = 0);\n\n\n\nprotected:\n\n virtual bool onEvent(const SkEvent&);\n\n virtual void onDraw(SkCanvas*);\n\n virtual void onInflate(const SkDOM& dom, const SkDOM::Node*);\n\n\n\nprivate:\n\n typedef SkButtonWidget INHERITED;\n\n};\n\n\n\n#include \"SkTextBox.h\"\n\n\n", "file_path": "skia/include/SkWidget.h", "rank": 60, "score": 141799.2830122883 }, { "content": "class SkPushButtonWidget : public SkButtonWidget {\n\npublic:\n\n SkPushButtonWidget(uint32_t flags = 0) : SkButtonWidget(flags) {}\n\n\n\nprotected:\n\n virtual bool onEvent(const SkEvent&);\n\n virtual void onDraw(SkCanvas*);\n\n virtual Click* onFindClickHandler(SkScalar x, SkScalar y);\n\n virtual bool onClick(Click* click);\n\n\n\nprivate:\n\n typedef SkButtonWidget INHERITED;\n\n};\n\n\n", "file_path": "skia/include/SkWidget.h", "rank": 61, "score": 141799.2830122883 }, { "content": "class SkWidget : public SkView {\n\npublic:\n\n SkWidget(uint32_t flags = 0) : SkView(flags | kFocusable_Mask | kEnabled_Mask) {}\n\n\n\n /** Call this to post the widget's event to its listeners */\n\n void postWidgetEvent();\n\n\n\n static void Init();\n\n static void Term();\n\nprotected:\n\n // override to add slots to an event before posting\n\n virtual void prepareWidgetEvent(SkEvent*);\n\n virtual void onEnabledChange();\n\n\n\n // <event ...> to initialize the event from XML\n\n virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node);\n\n\n\nprivate:\n\n SkEvent fEvent;\n\n typedef SkView INHERITED;\n\n};\n\n\n", "file_path": "skia/include/SkWidget.h", "rank": 62, "score": 141438.0969106585 }, { "content": "class MouseEvent;\n\n\n", "file_path": "chrome/views/button.h", "rank": 63, "score": 139429.58696200512 }, { "content": "// Copyright (c) 2008 The Chromium Authors. All rights reserved.\n\n// Use of this source code is governed by a BSD-style license that can be\n\n// found in the LICENSE file.\n\n\n\n#ifndef BASE_GFX_NATIVE_WIDGET_TYPES_H_\n\n#define BASE_GFX_NATIVE_WIDGET_TYPES_H_\n\n\n\n#include \"build/build_config.h\"\n\n\n\n#if defined(OS_WIN)\n\n#include <windows.h>\n\n#elif defined(OS_MACOSX)\n\n#ifdef __OBJC__\n\n@class NSView;\n\n@class NSWindow;\n\n@class NSTextField;\n\n#else\n", "file_path": "base/gfx/native_widget_types.h", "rank": 64, "score": 139419.84772068344 }, { "content": "class TraceLog {\n\n public:\n\n enum EventType {\n\n EVENT_BEGIN,\n\n EVENT_END,\n\n EVENT_INSTANT\n\n };\n\n\n\n // Is tracing currently enabled.\n\n static bool IsTracing();\n\n // Start logging trace events.\n\n static bool StartTracing();\n\n // Stop logging trace events.\n\n static void StopTracing();\n\n\n\n // Log a trace event of (name, type, id) with the optional extra string.\n\n void Trace(const std::string& name, \n\n EventType type,\n\n const void* id,\n\n const std::wstring& extra,\n", "file_path": "base/trace_event.h", "rank": 65, "score": 139410.60618695582 }, { "content": " */\n\n bool moveSelectionUp();\n\n /** If possible, move the selection down and return true,\n\n else do nothing and return false.\n\n If nothing is selected, select the first item (unless there are no items).\n\n */\n\n bool moveSelectionDown();\n\n\n\n SkListSource* getListSource() const { return fSource; }\n\n SkListSource* setListSource(SkListSource*);\n\n\n\n /** Call this in your event handler. If the specified event is from a SkListView,\n\n then it returns the index of the selected item in this list, otherwise it\n\n returns -1\n\n */\n\n static int GetWidgetEventListIndex(const SkEvent&);\n\n\n\nprotected:\n\n // overrides\n\n virtual void onDraw(SkCanvas*);\n", "file_path": "skia/include/SkWidgetViews.h", "rank": 66, "score": 139025.56319613222 }, { "content": " virtual void onSizeChange();\n\n virtual bool onEvent(const SkEvent&);\n\n virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node);\n\n virtual bool onPrepareWidgetEvent(SkEvent*);\n\n\n\nprivate:\n\n enum DirtyFlags {\n\n kAnimCount_DirtyFlag = 0x01,\n\n kAnimContent_DirtyFlag = 0x02\n\n };\n\n void dirtyCache(unsigned dirtyFlags);\n\n bool ensureCache();\n\n\n\n int logicalToVisualIndex(int index) const { return index - fScrollIndex; }\n\n void invalSelection();\n\n SkScalar getContentWidth() const;\n\n bool getRowRect(int index, SkRect*) const;\n\n void ensureSelectionIsVisible();\n\n void ensureVisibleRowCount();\n\n\n", "file_path": "skia/include/SkWidgetViews.h", "rank": 67, "score": 139023.94407867506 }, { "content": " static SkEventSinkID GetWidgetEventSinkID(const SkEvent&);\n\n\n\nprotected:\n\n /** called when the label changes. override in subclasses. default action invals the view's bounds.\n\n called with the old and new labels, before the label has actually changed.\n\n */\n\n virtual void onLabelChange(const char oldLabel[], const char newLabel[]);\n\n /** called before posting the event to our listeners. Override to add slots to the event\n\n before posting. Return true to proceed with posting, or false to not post the event to any\n\n listener. Note: the event passed in may not be the same as calling this->event().\n\n Be sure to call your INHERITED method as well, so that all classes in the hierarchy get a shot\n\n at modifying the event (and possibly returning false to abort).\n\n */\n\n virtual bool onPrepareWidgetEvent(SkEvent* evt);\n\n\n\n // overrides\n\n virtual void onInflate(const SkDOM& dom, const SkDOM::Node*);\n\n \n\nprivate:\n\n SkString fLabel;\n\n SkEvent fEvent;\n\n \n\n typedef SkView INHERITED;\n\n};\n\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////\n\n\n", "file_path": "skia/include/SkWidgetViews.h", "rank": 68, "score": 139022.95838303943 }, { "content": "\n\nprotected:\n\n // called when the check-state is about to change, but before it actually has\n\n virtual void onCheckStateChange(CheckState oldState, CheckState newState);\n\n\n\n // overrides\n\n virtual void onInflate(const SkDOM& dom, const SkDOM::Node*);\n\n virtual bool onPrepareWidgetEvent(SkEvent* evt);\n\n \n\nprivate:\n\n uint8_t fCheckState;\n\n \n\n typedef SkWidgetView INHERITED;\n\n};\n\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////\n\n#include \"SkTextBox.h\"\n\n\n", "file_path": "skia/include/SkWidgetViews.h", "rank": 69, "score": 139022.08940994955 }, { "content": "/* include/graphics/SkWidgetViews.h\n\n**\n\n** Copyright 2006, Google Inc.\n\n**\n\n** Licensed under the Apache License, Version 2.0 (the \"License\"); \n\n** you may not use this file except in compliance with the License. \n\n** You may obtain a copy of the License at \n\n**\n\n** http://www.apache.org/licenses/LICENSE-2.0 \n\n**\n\n** Unless required by applicable law or agreed to in writing, software \n\n** distributed under the License is distributed on an \"AS IS\" BASIS, \n\n** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \n\n** See the License for the specific language governing permissions and \n\n** limitations under the License.\n\n*/\n\n\n\n#ifndef SkWidgetViews_DEFINED\n\n#define SkWidgetViews_DEFINED\n\n\n\n#include \"SkView.h\"\n\n\n\n\n", "file_path": "skia/include/SkWidgetViews.h", "rank": 70, "score": 139015.90094757258 }, { "content": " struct BindingRec;\n\n\n\n enum Heights {\n\n kNormal_Height,\n\n kSelected_Height\n\n };\n\n SkListSource* fSource;\n\n SkScrollBarView* fScrollBar;\n\n SkAnimator* fAnims;\n\n BindingRec* fBindings;\n\n SkString fSkinName;\n\n SkScalar fHeights[2];\n\n int16_t fScrollIndex, fCurrIndex;\n\n uint16_t fVisibleRowCount, fBindingCount;\n\n SkBool8 fAnimContentDirty;\n\n SkBool8 fAnimFocusDirty;\n\n\n\n typedef SkWidgetView INHERITED;\n\n};\n\n\n", "file_path": "skia/include/SkWidgetViews.h", "rank": 71, "score": 139003.15932553128 }, { "content": "\n\nWebMouseEvent::WebMouseEvent(const GdkEventButton* event) {\n\n timestamp_sec = GdkEventTimeToWebEventTime(event->time);\n\n modifiers = GdkStateToWebEventModifiers(event->state);\n\n x = static_cast<int>(event->x);\n\n y = static_cast<int>(event->y);\n\n global_x = static_cast<int>(event->x_root);\n\n global_y = static_cast<int>(event->y_root);\n\n\n\n switch (event->type) {\n\n case GDK_BUTTON_PRESS:\n\n case GDK_2BUTTON_PRESS:\n\n case GDK_3BUTTON_PRESS:\n\n type = MOUSE_DOWN;\n\n break;\n\n case GDK_BUTTON_RELEASE:\n\n type = MOUSE_UP;\n\n break;\n\n\n\n default:\n", "file_path": "webkit/glue/webinputevent_linux.cc", "rank": 73, "score": 50.43103617750297 }, { "content": "\n\n// static\n\nconst char* MetricsLog::WindowEventTypeToString(WindowEventType type) {\n\n switch (type) {\n\n case WINDOW_CREATE:\n\n return \"create\";\n\n\n\n case WINDOW_OPEN:\n\n return \"open\";\n\n\n\n case WINDOW_CLOSE:\n\n return \"close\";\n\n\n\n case WINDOW_DESTROY:\n\n return \"destroy\";\n\n\n\n default:\n\n NOTREACHED();\n\n return \"unknown\";\n\n }\n", "file_path": "chrome/browser/metrics_log.cc", "rank": 74, "score": 46.930149693073844 }, { "content": "// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.\n\n// Use of this source code is governed by a BSD-style license that can be\n\n// found in the LICENSE file.\n\n\n\n#include \"chrome/views/accelerator.h\"\n\n\n\n#include \"base/logging.h\"\n\n#include \"base/string_util.h\"\n\n#include \"chrome/common/l10n_util.h\"\n\n#include \"generated_resources.h\"\n\n\n\nnamespace views {\n\n\n\nstd::wstring Accelerator::GetShortcutText() const {\n\n int string_id = 0;\n\n switch(key_code_) {\n\n case VK_TAB:\n\n string_id = IDS_TAB_KEY;\n\n break;\n\n case VK_RETURN:\n", "file_path": "chrome/views/accelerator.cc", "rank": 75, "score": 45.92841153781899 }, { "content": "// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.\n\n// Use of this source code is governed by a BSD-style license that can be\n\n// found in the LICENSE file.\n\n\n\n#include \"config.h\"\n\n\n\n#include \"webkit/glue/webinputevent.h\"\n\n\n\n#include \"webkit/glue/event_conversion.h\"\n\n\n\n#undef LOG\n\n#include \"base/logging.h\"\n\n\n\nstatic const unsigned long kDefaultScrollLinesPerWheelDelta = 3;\n\n\n\n// WebMouseEvent --------------------------------------------------------------\n\n\n\nstatic LPARAM GetRelativeCursorPos(HWND hwnd) {\n\n POINT pos = {-1, -1};\n\n GetCursorPos(&pos);\n", "file_path": "webkit/glue/webinputevent_win.cc", "rank": 76, "score": 45.59659036933811 }, { "content": " // server, ORed together into one value.\n\n int collectors() { return collectors_; }\n\n\n\n // Returns true if the given CollectorType is desired by the server.\n\n bool collector_active(CollectorType type) { return !!(collectors_ & type); }\n\n\n\n // Returns the maximum number of event that the server wants in each\n\n // metrics log sent. (If 0, no value was provided.)\n\n int events() { return events_; }\n\n\n\n // Returns the size of the time interval that the server wants us to include\n\n // in each log (in seconds). (If 0, no value was provided.)\n\n int interval() { return interval_; }\n\n\n\nprivate:\n\n bool valid_;\n\n int collectors_;\n\n int events_;\n\n int interval_;\n\n\n\n DISALLOW_EVIL_CONSTRUCTORS(MetricsResponse);\n\n};\n\n\n\n#endif // CHROME_BROWSER_METRICS_RESPONSE_H__\n\n\n", "file_path": "chrome/browser/metrics_response.h", "rank": 77, "score": 45.50250638750256 }, { "content": "// Copyright (c) 2008 The Chromium Authors. All rights reserved.\n\n// Use of this source code is governed by a BSD-style license that can be\n\n// found in the LICENSE file.\n\n\n\n#include \"base/system_monitor.h\"\n\n\n\nnamespace base {\n\n\n\nvoid SystemMonitor::ProcessWmPowerBroadcastMessage(int event_id) {\n\n PowerEvent power_event;\n\n switch (event_id) {\n\n case PBT_APMPOWERSTATUSCHANGE:\n\n power_event = PowerStateEvent;\n\n break;\n\n case PBT_APMRESUMEAUTOMATIC:\n\n power_event = ResumeEvent;\n\n break;\n\n case PBT_APMSUSPEND:\n\n power_event = SuspendEvent;\n\n break;\n", "file_path": "base/system_monitor_win.cc", "rank": 78, "score": 45.382325301466366 }, { "content": " }\n\n}\n\n\n\nbool WebWidgetImpl::HandleInputEvent(const WebInputEvent* input_event) {\n\n if (!widget_)\n\n return false;\n\n\n\n // TODO (jcampan): WebKit seems to always return false on mouse events\n\n // methods. For now we'll assume it has processed them (as we are only\n\n // interested in whether keyboard events are processed).\n\n switch (input_event->type) {\n\n case WebInputEvent::MOUSE_MOVE:\n\n MouseMove(*static_cast<const WebMouseEvent*>(input_event));\n\n return true;\n\n\n\n case WebInputEvent::MOUSE_LEAVE:\n\n MouseLeave(*static_cast<const WebMouseEvent*>(input_event));\n\n return true;\n\n\n\n case WebInputEvent::MOUSE_WHEEL:\n", "file_path": "webkit/glue/webwidget_impl.cc", "rank": 79, "score": 45.362609327732926 }, { "content": " timestamp_sec = GdkEventTimeToWebEventTime(event->time);\n\n modifiers = GdkStateToWebEventModifiers(event->state);\n\n x = static_cast<int>(event->x);\n\n y = static_cast<int>(event->y);\n\n global_x = static_cast<int>(event->x_root);\n\n global_y = static_cast<int>(event->y_root);\n\n\n\n type = MOUSE_WHEEL;\n\n\n\n // TODO(tc): Figure out what the right value for this is.\n\n static const int kWheelDelta = 1;\n\n\n\n delta_x = 0;\n\n delta_y = 0;\n\n\n\n switch (event->direction) {\n\n case GDK_SCROLL_UP:\n\n delta_y = kWheelDelta;\n\n break;\n\n case GDK_SCROLL_DOWN:\n", "file_path": "webkit/glue/webinputevent_linux.cc", "rank": 80, "score": 45.18544378200373 }, { "content": "\n\n // The type used for the bitfield.\n\n typedef int Type;\n\n\n\n static bool ValidType(int32 type) {\n\n int32 t = StripQualifier(static_cast<Type>(type));\n\n return (t >= 0 && t <= LAST_CORE &&\n\n (type & ~(QUALIFIER_MASK | CORE_MASK)) == 0);\n\n }\n\n\n\n static Type FromInt(int32 type) {\n\n if (!ValidType(type)) {\n\n NOTREACHED() << \"Invalid transition type \" << type;\n\n\n\n // Return a safe default so we don't have corrupt data in release mode.\n\n return LINK;\n\n }\n\n return static_cast<Type>(type);\n\n }\n\n\n", "file_path": "chrome/common/page_transition_types.h", "rank": 81, "score": 45.144195918272445 }, { "content": " switch (type_) {\n\n case views::Event::ET_MOUSE_PRESSED:\n\n view_->OnMousePressed(event);\n\n break;\n\n\n\n case views::Event::ET_MOUSE_DRAGGED:\n\n view_->OnMouseDragged(event);\n\n break;\n\n\n\n case views::Event::ET_MOUSE_RELEASED:\n\n view_->OnMouseReleased(event, false);\n\n break;\n\n\n\n default:\n\n NOTREACHED();\n\n }\n\n }\n\n\n\n private:\n\n views::View* view_;\n", "file_path": "chrome/browser/automation/automation_provider.cc", "rank": 82, "score": 45.02807749225797 }, { "content": " break;\n\n case AutocompleteMatch::SEARCH:\n\n str_type = L\"SEARCH\";\n\n break;\n\n case AutocompleteMatch::HISTORY_SEARCH:\n\n str_type = L\"HISTORY\";\n\n break;\n\n default:\n\n NOTREACHED();\n\n }\n\n }\n\n std::wstring contents;\n\n bool deletable;\n\n std::wstring description;\n\n std::wstring destination_url;\n\n std::wstring fill_into_edit;\n\n size_t inline_autocomplete_offset;\n\n bool is_history_what_you_typed_match;\n\n std::string provider_name;\n\n int relevance;\n\n bool starred;\n\n std::wstring str_type;\n\n};\n\ntypedef std::vector<AutocompleteMatchData> Matches;\n\n\n\nnamespace IPC {\n\n\n\ntemplate <>\n", "file_path": "chrome/test/automation/autocomplete_edit_proxy.h", "rank": 83, "score": 44.985094757139876 }, { "content": "#include \"V8SVGUnitTypes.h\"\n\n#include \"V8SVGURIReference.h\"\n\n#include \"V8SVGZoomEvent.h\"\n\n#endif\n\n\n\nnamespace WebCore {\n\n\n\nFunctionTemplateFactory V8ClassIndex::GetFactory(V8WrapperType type) {\n\n switch (type) {\n\n#define MAKE_CASE(type, name)\\\n\n case V8ClassIndex::type: return V8##name::GetTemplate;\n\n WRAPPER_TYPES(MAKE_CASE)\n\n#undef MAKE_CASE\n\n default: return NULL;\n\n }\n\n}\n\n\n\n\n\n#define MAKE_CACHE(type, name)\\\n\n static v8::Persistent<v8::FunctionTemplate> name##_cache_;\n", "file_path": "webkit/port/bindings/v8/v8_index.cpp", "rank": 84, "score": 44.72113098901854 }, { "content": "\n\nvoid NPVariantWrap::Copy(const NPVariant& v) {\n\n if (this == &v)\n\n return;\n\n Release();\n\n switch(v.type) {\n\n case NPVariantType_Void:\n\n break;\n\n case NPVariantType_Null:\n\n break;\n\n case NPVariantType_Bool:\n\n value.boolValue = v.value.boolValue;\n\n break;\n\n case NPVariantType_Int32:\n\n value.intValue = v.value.intValue;\n\n break;\n\n case NPVariantType_Double:\n\n value.doubleValue = v.value.doubleValue;\n\n break;\n\n case NPVariantType_String:\n", "file_path": "webkit/activex_shim/npn_scripting.cc", "rank": 86, "score": 43.48048745288154 }, { "content": " // coordinates.\n\n\n\n // NOTE: These may be called after we've been removed from the widget/\n\n // window hierarchy, for example because the EventHandler keeps a reference\n\n // around and tries to feed us MouseOut events. In this case, doing\n\n // something would be not only pointless but dangerous, as without a\n\n // parent() we will end up failing an ASSERT(). So bail early if we get to\n\n // any of these with no parent().\n\n virtual bool handleMouseMoveEvent(const PlatformMouseEvent&);\n\n virtual bool handleMouseOutEvent(const PlatformMouseEvent&);\n\n virtual bool handleMousePressEvent(const PlatformMouseEvent&);\n\n virtual bool handleMouseReleaseEvent(const PlatformMouseEvent&);\n\n\n\n virtual IntRect windowClipRect() const;\n\n\n\n static void themeChanged();\n\n static int horizontalScrollbarHeight(ScrollbarControlSize size = RegularScrollbar);\n\n static int verticalScrollbarWidth(ScrollbarControlSize size = RegularScrollbar);\n\n\n\n // Scrolls the page when auto-repeat scrolling.\n", "file_path": "webkit/port/platform/chromium/PlatformScrollBar.h", "rank": 87, "score": 43.2041336662783 }, { "content": " // Safari must perform a similar hack, ours is in our WebKit glue layer\n\n // theirs is in the application. This should go when WebCore can be fixed\n\n // to pass more event information to ChromeClient::show()\n\n g_current_input_event = input_event;\n\n\n\n bool handled = true;\n\n\n\n // TODO(jcampan): WebKit seems to always return false on mouse events\n\n // processing methods. For now we'll assume it has processed them (as we are\n\n // only interested in whether keyboard events are processed).\n\n switch (input_event->type) {\n\n case WebInputEvent::MOUSE_MOVE:\n\n MouseMove(*static_cast<const WebMouseEvent*>(input_event));\n\n break;\n\n\n\n case WebInputEvent::MOUSE_LEAVE:\n\n MouseLeave(*static_cast<const WebMouseEvent*>(input_event));\n\n break;\n\n\n\n case WebInputEvent::MOUSE_WHEEL:\n", "file_path": "webkit/glue/webview_impl.cc", "rank": 88, "score": 42.84501284398694 }, { "content": " MouseWheel(*static_cast<const WebMouseWheelEvent*>(input_event));\n\n break;\n\n\n\n case WebInputEvent::MOUSE_DOWN:\n\n case WebInputEvent::MOUSE_DOUBLE_CLICK:\n\n MouseDown(*static_cast<const WebMouseEvent*>(input_event));\n\n break;\n\n\n\n case WebInputEvent::MOUSE_UP:\n\n MouseUp(*static_cast<const WebMouseEvent*>(input_event));\n\n break;\n\n\n\n case WebInputEvent::KEY_DOWN:\n\n case WebInputEvent::KEY_UP:\n\n handled = KeyEvent(*static_cast<const WebKeyboardEvent*>(input_event));\n\n break;\n\n\n\n case WebInputEvent::CHAR:\n\n handled = CharEvent(*static_cast<const WebKeyboardEvent*>(input_event));\n\n break;\n", "file_path": "webkit/glue/webview_impl.cc", "rank": 89, "score": 42.70572604809186 }, { "content": "// Copyright (c) 2008 The Chromium Authors. All rights reserved.\n\n// Use of this source code is governed by a BSD-style license that can be\n\n// found in the LICENSE file.\n\n\n\n#include \"base/message_pump_libevent.h\"\n\n\n\n#include <fcntl.h>\n\n\n\n#include \"base/logging.h\"\n\n#include \"base/scoped_nsautorelease_pool.h\"\n\n#include \"base/time.h\"\n\n#include \"third_party/libevent/event.h\"\n\n\n\nnamespace base {\n\n\n\n// Return 0 on success\n\n// Too small a function to bother putting in a library?\n\nstatic int SetNonBlocking(int fd)\n\n{\n\n int flags = fcntl(fd, F_GETFL, 0);\n", "file_path": "base/message_pump_libevent.cc", "rank": 90, "score": 42.66530300772644 }, { "content": "void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) {\n\n WebMouseEvent event(view_, message, wparam, lparam);\n\n switch (event.type) {\n\n case WebInputEvent::MOUSE_MOVE:\n\n TrackMouseLeave(true);\n\n break;\n\n case WebInputEvent::MOUSE_LEAVE:\n\n TrackMouseLeave(false);\n\n break;\n\n case WebInputEvent::MOUSE_DOWN:\n\n SetCapture(view_);\n\n break;\n\n case WebInputEvent::MOUSE_UP:\n\n if (GetCapture() == view_)\n\n ReleaseCapture();\n\n break;\n\n }\n\n webwidget_->HandleInputEvent(&event);\n\n}\n\n\n", "file_path": "webkit/tools/test_shell/webwidget_host.cc", "rank": 92, "score": 42.29184258976745 }, { "content": "// Windows callback for the playback mode.\n\nLRESULT EventRecorder::PlaybackWndProc(int nCode, WPARAM wParam,\n\n LPARAM lParam) {\n\n static bool playback_enabled = true;\n\n int delay = 0;\n\n\n\n switch(nCode) {\n\n // A system modal dialog box is being displayed. Stop playing back\n\n // messages.\n\n case HC_SYSMODALON:\n\n playback_enabled = false;\n\n break;\n\n\n\n // A system modal dialog box is destroyed. We can start playing back\n\n // messages again.\n\n case HC_SYSMODALOFF:\n\n playback_enabled = true;\n\n break;\n\n\n\n // Prepare to copy the next mouse or keyboard event to playback.\n", "file_path": "base/event_recorder.cc", "rank": 93, "score": 42.02522569292091 }, { "content": " if (!obj->eventLogging)\n\n return 0;\n\n \n\n#ifdef WIN32\n\n // Below is the event handling code. Per the NPAPI spec, the events don't\n\n // map directly between operating systems:\n\n // http://devedge-temp.mozilla.org/library/manuals/2002/plugin/1.0/structures5.html#1000000\n\n NPEvent* evt = static_cast<NPEvent*>(event);\n\n short x = static_cast<short>(evt->lParam & 0xffff);\n\n short y = static_cast<short>(evt->lParam >> 16);\n\n switch (evt->event) {\n\n case WM_PAINT:\n\n printf(\"PLUGIN: updateEvt\\n\");\n\n break;\n\n case WM_LBUTTONDOWN:\n\n case WM_MBUTTONDOWN:\n\n case WM_RBUTTONDOWN:\n\n printf(\"PLUGIN: mouseDown at (%d, %d)\\n\", x, y);\n\n break;\n\n case WM_LBUTTONUP:\n", "file_path": "webkit/tools/npapi_layout_test_plugin/main.cpp", "rank": 94, "score": 41.92162782752543 }, { "content": "#include \"FrameView.h\"\n\n#include \"GraphicsContext.h\"\n\n#include \"HTMLNames.h\"\n\n#include \"HTMLPlugInElement.h\"\n\n#include \"IntRect.h\"\n\n#include \"KURL.h\"\n\n#include \"KeyboardEvent.h\"\n\n#include \"MouseEvent.h\"\n\n#include \"Page.h\"\n\n#include \"PlatformContextSkia.h\"\n\n#include \"PlatformMouseEvent.h\"\n\n#include \"PlatformString.h\"\n\n#include \"ResourceHandle.h\"\n\n#include \"ResourceHandleClient.h\"\n\n#include \"ResourceResponse.h\"\n\n#include \"ScriptController.h\"\n\n#include \"ScrollView.h\"\n\n#include \"Widget.h\"\n\nMSVC_POP_WARNING();\n\n#undef LOG\n", "file_path": "webkit/glue/webplugin_impl.cc", "rank": 95, "score": 41.69659196478847 }, { "content": " return m_hWnd;\n\n}\n\n\n\nvoid RenderWidgetHostViewWin::ForwardMouseEventToRenderer(UINT message,\n\n WPARAM wparam,\n\n LPARAM lparam) {\n\n WebMouseEvent event(m_hWnd, message, wparam, lparam);\n\n switch (event.type) {\n\n case WebInputEvent::MOUSE_MOVE:\n\n TrackMouseLeave(true);\n\n break;\n\n case WebInputEvent::MOUSE_LEAVE:\n\n TrackMouseLeave(false);\n\n break;\n\n case WebInputEvent::MOUSE_DOWN:\n\n SetCapture();\n\n break;\n\n case WebInputEvent::MOUSE_UP:\n\n if (GetCapture() == m_hWnd)\n\n ReleaseCapture();\n", "file_path": "chrome/browser/render_widget_host_view_win.cc", "rank": 96, "score": 41.6357766139031 }, { "content": " virtual void OnMouseReleased(const MouseEvent& event, bool canceled);\n\n\n\n private:\n\n // Returns true if |x| is over the divider.\n\n bool IsPointInDivider(int x);\n\n\n\n // Used to track drag info.\n\n struct DragInfo {\n\n // The initial coordinate of the mouse when the user started the drag.\n\n int initial_mouse_x;\n\n // The initial position of the divider when the user started the drag.\n\n int initial_divider_x;\n\n };\n\n\n\n DragInfo drag_info_;\n\n\n\n // Position of the divider.\n\n int divider_x_;\n\n\n\n DISALLOW_COPY_AND_ASSIGN(SingleSplitView);\n\n};\n\n\n\n} // namespace views\n\n\n\n#endif // CHROME_VIEWS_SINGLE_SPLIT_VIEW_H_\n", "file_path": "chrome/views/single_split_view.h", "rank": 97, "score": 41.49019051063204 }, { "content": " break;\n\n\n\n case NOTIFY_PLUGIN_INSTANCE_CREATED:\n\n stats.instances++;\n\n break;\n\n\n\n case NOTIFY_PLUGIN_PROCESS_CRASHED:\n\n stats.process_crashes++;\n\n break;\n\n\n\n default:\n\n NOTREACHED() << \"Unexpected notification type \" << type;\n\n return;\n\n }\n\n}\n\n\n\n// Recursively counts the number of bookmarks and folders in node.\n\nstatic void CountBookmarks(BookmarkNode* node, int* bookmarks, int* folders) {\n\n if (node->GetType() == history::StarredEntry::URL)\n\n (*bookmarks)++;\n", "file_path": "chrome/browser/metrics_service.cc", "rank": 98, "score": 41.31496168846098 }, { "content": "#include \"chrome/common/os_exchange_data.h\"\n\n#include \"chrome/common/pref_names.h\"\n\n#include \"chrome/common/resource_bundle.h\"\n\n#include \"chrome/common/slide_animation.h\"\n\n#include \"chrome/common/stl_util-inl.h\"\n\n#include \"chrome/common/win_util.h\"\n\n#include \"chrome/views/image_view.h\"\n\n#include \"chrome/views/painter.h\"\n\n\n\n#include \"generated_resources.h\"\n\n\n\n#undef min\n\n#undef max\n\n\n\nusing views::DropTargetEvent;\n\n\n\nstatic const int kDefaultAnimationDurationMs = 100;\n\nstatic const int kResizeLayoutAnimationDurationMs = 166;\n\nstatic const int kReorderAnimationDurationMs = 166;\n\n\n", "file_path": "chrome/browser/views/tabs/tab_strip.cc", "rank": 99, "score": 41.306240120690724 } ]
C++
sync/internal_api/public/base/unique_position.cc
pozdnyakov/chromium-crosswalk
0fb25c7278bf1d93e53a3b0bcb75aa8b99d4b26e
#include "sync/internal_api/public/base/unique_position.h" #include "base/logging.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "sync/protocol/unique_position.pb.h" #include "third_party/zlib/zlib.h" namespace syncer { const size_t UniquePosition::kSuffixLength = 28; const size_t UniquePosition::kCompressBytesThreshold = 128; bool UniquePosition::IsValidSuffix(const std::string& suffix) { return suffix.length() == kSuffixLength; } bool UniquePosition::IsValidBytes(const std::string& bytes) { return bytes.length() >= kSuffixLength && bytes[bytes.length()-1] != 0; } UniquePosition UniquePosition::CreateInvalid() { UniquePosition pos; DCHECK(!pos.IsValid()); return pos; } UniquePosition UniquePosition::FromProto(const sync_pb::UniquePosition& proto) { if (proto.has_value()) { return UniquePosition(proto.value()); } else if (proto.has_compressed_value() && proto.has_uncompressed_length()) { uLongf uncompressed_len = proto.uncompressed_length(); std::string uncompressed; uncompressed.resize(uncompressed_len); int result = uncompress( reinterpret_cast<Bytef*>(string_as_array(&uncompressed)), &uncompressed_len, reinterpret_cast<const Bytef*>(proto.compressed_value().data()), proto.compressed_value().size()); if (result != Z_OK) { DLOG(ERROR) << "Unzip failed " << result; return UniquePosition::CreateInvalid(); } if (uncompressed_len != proto.uncompressed_length()) { DLOG(ERROR) << "Uncompressed length " << uncompressed_len << " did not match specified length " << proto.uncompressed_length(); return UniquePosition::CreateInvalid(); } return UniquePosition(uncompressed); } else { return UniquePosition::CreateInvalid(); } } UniquePosition UniquePosition::FromInt64( int64 x, const std::string& suffix) { uint64 y = static_cast<uint64>(x); y ^= 0x8000000000000000ULL; std::string bytes(8, 0); for (int i = 7; i >= 0; --i) { bytes[i] = static_cast<uint8>(y); y >>= 8; } return UniquePosition(bytes, suffix); } UniquePosition UniquePosition::InitialPosition( const std::string& suffix) { DCHECK(IsValidSuffix(suffix)); return UniquePosition(std::string(), suffix); } UniquePosition UniquePosition::Before( const UniquePosition& x, const std::string& suffix) { DCHECK(IsValidSuffix(suffix)); DCHECK(x.IsValid()); const std::string& before = FindSmallerWithSuffix(x.bytes_, suffix); return UniquePosition(before, suffix); } UniquePosition UniquePosition::After( const UniquePosition& x, const std::string& suffix) { DCHECK(IsValidSuffix(suffix)); DCHECK(x.IsValid()); const std::string& after = FindGreaterWithSuffix(x.bytes_, suffix); return UniquePosition(after, suffix); } UniquePosition UniquePosition::Between( const UniquePosition& before, const UniquePosition& after, const std::string& suffix) { DCHECK(before.IsValid()); DCHECK(after.IsValid()); DCHECK(before.LessThan(after)); DCHECK(IsValidSuffix(suffix)); const std::string& mid = FindBetweenWithSuffix(before.bytes_, after.bytes_, suffix); return UniquePosition(mid, suffix); } UniquePosition::UniquePosition() : is_valid_(false) {} bool UniquePosition::LessThan(const UniquePosition& other) const { DCHECK(this->IsValid()); DCHECK(other.IsValid()); return bytes_ < other.bytes_; } bool UniquePosition::Equals(const UniquePosition& other) const { if (!this->IsValid() && !other.IsValid()) return true; return bytes_ == other.bytes_; } void UniquePosition::ToProto(sync_pb::UniquePosition* proto) const { proto->Clear(); if (bytes_.size() < kCompressBytesThreshold) { proto->set_value(bytes_); } else { proto->set_uncompressed_length(bytes_.size()); std::string* compressed = proto->mutable_compressed_value(); uLongf compressed_len = compressBound(bytes_.size()); compressed->resize(compressed_len); int result = compress(reinterpret_cast<Bytef*>(string_as_array(compressed)), &compressed_len, reinterpret_cast<const Bytef*>(bytes_.data()), bytes_.size()); if (result != Z_OK) { NOTREACHED() << "Failed to compress position: " << result; proto->Clear(); proto->set_value(bytes_); } else if (compressed_len >= bytes_.size()) { proto->Clear(); proto->set_value(bytes_); } else { compressed->resize(compressed_len); } } } void UniquePosition::SerializeToString(std::string* blob) const { DCHECK(blob); sync_pb::UniquePosition proto; ToProto(&proto); proto.SerializeToString(blob); } int64 UniquePosition::ToInt64() const { uint64 y = 0; const std::string& s = bytes_; size_t l = sizeof(int64); if (s.length() < l) { NOTREACHED(); l = s.length(); } for (size_t i = 0; i < l; ++i) { const uint8 byte = s[l - i - 1]; y |= static_cast<uint64>(byte) << (i * 8); } y ^= 0x8000000000000000ULL; return static_cast<int64>(y); } bool UniquePosition::IsValid() const { return is_valid_; } std::string UniquePosition::ToDebugString() const { if (bytes_.empty()) return std::string("INVALID[]"); std::string debug_string = base::HexEncode(bytes_.data(), bytes_.length()); if (!IsValid()) { debug_string = "INVALID[" + debug_string + "]"; } return debug_string;; } std::string UniquePosition::GetSuffixForTest() const { const size_t prefix_len = bytes_.length() - kSuffixLength; return bytes_.substr(prefix_len, std::string::npos); } std::string UniquePosition::FindSmallerWithSuffix( const std::string& reference, const std::string& suffix) { size_t ref_zeroes = reference.find_first_not_of('\0'); size_t suffix_zeroes = suffix.find_first_not_of('\0'); DCHECK_NE(ref_zeroes, std::string::npos); DCHECK_NE(suffix_zeroes, std::string::npos); if (suffix_zeroes > ref_zeroes) { return std::string(); } if (suffix.substr(suffix_zeroes) < reference.substr(ref_zeroes)) { return std::string(ref_zeroes - suffix_zeroes, '\0'); } else if (suffix_zeroes > 1) { return std::string(ref_zeroes - suffix_zeroes + 1, '\0'); } else { char lt_digit = static_cast<uint8>(reference[ref_zeroes])/2; return std::string(ref_zeroes, '\0') + lt_digit; } } std::string UniquePosition::FindGreaterWithSuffix( const std::string& reference, const std::string& suffix) { size_t ref_FFs = reference.find_first_not_of(kuint8max); size_t suffix_FFs = suffix.find_first_not_of(kuint8max); if (ref_FFs == std::string::npos) { ref_FFs = reference.length(); } if (suffix_FFs == std::string::npos) { suffix_FFs = suffix.length(); } if (suffix_FFs > ref_FFs) { return std::string(); } if (suffix.substr(suffix_FFs) > reference.substr(ref_FFs)) { return std::string(ref_FFs - suffix_FFs, kuint8max); } else if (suffix_FFs > 1) { return std::string(ref_FFs - suffix_FFs + 1, kuint8max); } else { char gt_digit = static_cast<uint8>(reference[ref_FFs]) + (kuint8max - static_cast<uint8>(reference[ref_FFs]) + 1) / 2; return std::string(ref_FFs, kuint8max) + gt_digit; } } std::string UniquePosition::FindBetweenWithSuffix( const std::string& before, const std::string& after, const std::string& suffix) { DCHECK(IsValidSuffix(suffix)); DCHECK_NE(before, after); DCHECK_LT(before, after); std::string mid; if (before < suffix && suffix < after) { return std::string(); } size_t i = 0; for ( ; i < std::min(before.length(), after.length()); ++i) { uint8 a_digit = before[i]; uint8 b_digit = after[i]; if (b_digit - a_digit >= 2) { mid.push_back(a_digit + (b_digit - a_digit)/2); return mid; } else if (a_digit == b_digit) { mid.push_back(a_digit); if (before.substr(i+1) < suffix && suffix < after.substr(i+1)) { return mid; } } else { DCHECK_EQ(b_digit - a_digit, 1); std::string mid_a = mid; mid_a.push_back(a_digit); mid_a.append(FindGreaterWithSuffix(before.substr(i+1), suffix)); if (after.length() > i+1) { std::string mid_b = mid; mid_b.push_back(b_digit); mid_b.append(FindSmallerWithSuffix(after.substr(i+1), suffix)); if (mid_b.length() < mid_a.length()) { return mid_b; } } return mid_a; } } DCHECK_EQ(before.substr(0, i), after.substr(0, i)); DCHECK_EQ(before, mid); DCHECK_LT(before.length(), after.length()); mid.append(FindSmallerWithSuffix(after.substr(i), suffix)); return mid; } UniquePosition::UniquePosition(const std::string& internal_rep) : bytes_(internal_rep), is_valid_(IsValidBytes(bytes_)) { } UniquePosition::UniquePosition( const std::string& prefix, const std::string& suffix) : bytes_(prefix + suffix), is_valid_(IsValidBytes(bytes_)) { DCHECK(IsValidSuffix(suffix)); DCHECK(IsValid()); } }
#include "sync/internal_api/public/base/unique_position.h" #include "base/logging.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "sync/protocol/unique_position.pb.h" #include "third_party/zlib/zlib.h" namespace syncer { const size_t UniquePosition::kSuffixLength = 28; const size_t UniquePosition::kCompressBytesThreshold = 128; bool UniquePosition::IsValidSuffix(const std::string& suffix) { return suffix.length() == kSuffixLength; } bool UniquePosition::IsValidBytes(const std::string& bytes) { return bytes.length() >= kSuffixLength && bytes[bytes.length()-1] != 0; } UniquePosition UniquePosition::CreateInvalid() { UniquePosition pos; DCHECK(!pos.IsValid()); return pos; } UniquePosition UniquePosition::FromProto(const sync_pb::UniquePosition& proto) { if (proto.has_value()) { return UniquePosition(proto.value()); } else if (proto.has_compressed_value() && proto.has_uncompressed_length()) { uLongf uncompressed_len = proto.uncompressed_length(); std::string uncompressed; uncompressed.resize(uncompressed_len); int result = uncompress( reinterpret_cast<Bytef*>(string_as_array(&uncompressed)), &uncompressed_len, reinterpret_cast<const Bytef*>(proto.compressed_value().data()), proto.compressed_value().size()); if (result != Z_OK) { DLOG(ERROR) << "Unzip failed " << result; return UniquePosition::CreateInvalid(); } if (uncompressed_len != proto.uncompressed_length()) { DLOG(ERROR) << "Uncompressed length " << uncompressed_len << " did not match specified length " << proto.uncompressed_length(); return UniquePosition::CreateInvalid(); } return UniquePosition(uncompressed); } else { return UniquePosition::CreateInvalid(); } } UniquePosition UniquePosition::FromInt64( int64 x, const std::string& suffix) { uint64 y = static_cast<uint64>(x); y ^= 0x8000000000000000ULL; std::string bytes(8, 0); for (int i = 7; i >= 0; --i) { bytes[i] = static_cast<uint8>(y); y >>= 8; } return UniquePosition(bytes, suffix); } UniquePosition UniquePosition::InitialPosition( const std::string& suffix) { DCHECK(IsValidSuffix(suffix)); return UniquePosition(std::string(), suffix); } UniquePosition UniquePosition::Before( const UniquePosition& x, const std::string& suffix) { DCHECK(IsValidSuffix(suffix)); DCHECK(x.IsValid()); const std::string& before = FindSmallerWithSuffix(x.bytes_, suffix); return UniquePosition(before, suffix); }
UniquePosition UniquePosition::Between( const UniquePosition& before, const UniquePosition& after, const std::string& suffix) { DCHECK(before.IsValid()); DCHECK(after.IsValid()); DCHECK(before.LessThan(after)); DCHECK(IsValidSuffix(suffix)); const std::string& mid = FindBetweenWithSuffix(before.bytes_, after.bytes_, suffix); return UniquePosition(mid, suffix); } UniquePosition::UniquePosition() : is_valid_(false) {} bool UniquePosition::LessThan(const UniquePosition& other) const { DCHECK(this->IsValid()); DCHECK(other.IsValid()); return bytes_ < other.bytes_; } bool UniquePosition::Equals(const UniquePosition& other) const { if (!this->IsValid() && !other.IsValid()) return true; return bytes_ == other.bytes_; } void UniquePosition::ToProto(sync_pb::UniquePosition* proto) const { proto->Clear(); if (bytes_.size() < kCompressBytesThreshold) { proto->set_value(bytes_); } else { proto->set_uncompressed_length(bytes_.size()); std::string* compressed = proto->mutable_compressed_value(); uLongf compressed_len = compressBound(bytes_.size()); compressed->resize(compressed_len); int result = compress(reinterpret_cast<Bytef*>(string_as_array(compressed)), &compressed_len, reinterpret_cast<const Bytef*>(bytes_.data()), bytes_.size()); if (result != Z_OK) { NOTREACHED() << "Failed to compress position: " << result; proto->Clear(); proto->set_value(bytes_); } else if (compressed_len >= bytes_.size()) { proto->Clear(); proto->set_value(bytes_); } else { compressed->resize(compressed_len); } } } void UniquePosition::SerializeToString(std::string* blob) const { DCHECK(blob); sync_pb::UniquePosition proto; ToProto(&proto); proto.SerializeToString(blob); } int64 UniquePosition::ToInt64() const { uint64 y = 0; const std::string& s = bytes_; size_t l = sizeof(int64); if (s.length() < l) { NOTREACHED(); l = s.length(); } for (size_t i = 0; i < l; ++i) { const uint8 byte = s[l - i - 1]; y |= static_cast<uint64>(byte) << (i * 8); } y ^= 0x8000000000000000ULL; return static_cast<int64>(y); } bool UniquePosition::IsValid() const { return is_valid_; } std::string UniquePosition::ToDebugString() const { if (bytes_.empty()) return std::string("INVALID[]"); std::string debug_string = base::HexEncode(bytes_.data(), bytes_.length()); if (!IsValid()) { debug_string = "INVALID[" + debug_string + "]"; } return debug_string;; } std::string UniquePosition::GetSuffixForTest() const { const size_t prefix_len = bytes_.length() - kSuffixLength; return bytes_.substr(prefix_len, std::string::npos); } std::string UniquePosition::FindSmallerWithSuffix( const std::string& reference, const std::string& suffix) { size_t ref_zeroes = reference.find_first_not_of('\0'); size_t suffix_zeroes = suffix.find_first_not_of('\0'); DCHECK_NE(ref_zeroes, std::string::npos); DCHECK_NE(suffix_zeroes, std::string::npos); if (suffix_zeroes > ref_zeroes) { return std::string(); } if (suffix.substr(suffix_zeroes) < reference.substr(ref_zeroes)) { return std::string(ref_zeroes - suffix_zeroes, '\0'); } else if (suffix_zeroes > 1) { return std::string(ref_zeroes - suffix_zeroes + 1, '\0'); } else { char lt_digit = static_cast<uint8>(reference[ref_zeroes])/2; return std::string(ref_zeroes, '\0') + lt_digit; } } std::string UniquePosition::FindGreaterWithSuffix( const std::string& reference, const std::string& suffix) { size_t ref_FFs = reference.find_first_not_of(kuint8max); size_t suffix_FFs = suffix.find_first_not_of(kuint8max); if (ref_FFs == std::string::npos) { ref_FFs = reference.length(); } if (suffix_FFs == std::string::npos) { suffix_FFs = suffix.length(); } if (suffix_FFs > ref_FFs) { return std::string(); } if (suffix.substr(suffix_FFs) > reference.substr(ref_FFs)) { return std::string(ref_FFs - suffix_FFs, kuint8max); } else if (suffix_FFs > 1) { return std::string(ref_FFs - suffix_FFs + 1, kuint8max); } else { char gt_digit = static_cast<uint8>(reference[ref_FFs]) + (kuint8max - static_cast<uint8>(reference[ref_FFs]) + 1) / 2; return std::string(ref_FFs, kuint8max) + gt_digit; } } std::string UniquePosition::FindBetweenWithSuffix( const std::string& before, const std::string& after, const std::string& suffix) { DCHECK(IsValidSuffix(suffix)); DCHECK_NE(before, after); DCHECK_LT(before, after); std::string mid; if (before < suffix && suffix < after) { return std::string(); } size_t i = 0; for ( ; i < std::min(before.length(), after.length()); ++i) { uint8 a_digit = before[i]; uint8 b_digit = after[i]; if (b_digit - a_digit >= 2) { mid.push_back(a_digit + (b_digit - a_digit)/2); return mid; } else if (a_digit == b_digit) { mid.push_back(a_digit); if (before.substr(i+1) < suffix && suffix < after.substr(i+1)) { return mid; } } else { DCHECK_EQ(b_digit - a_digit, 1); std::string mid_a = mid; mid_a.push_back(a_digit); mid_a.append(FindGreaterWithSuffix(before.substr(i+1), suffix)); if (after.length() > i+1) { std::string mid_b = mid; mid_b.push_back(b_digit); mid_b.append(FindSmallerWithSuffix(after.substr(i+1), suffix)); if (mid_b.length() < mid_a.length()) { return mid_b; } } return mid_a; } } DCHECK_EQ(before.substr(0, i), after.substr(0, i)); DCHECK_EQ(before, mid); DCHECK_LT(before.length(), after.length()); mid.append(FindSmallerWithSuffix(after.substr(i), suffix)); return mid; } UniquePosition::UniquePosition(const std::string& internal_rep) : bytes_(internal_rep), is_valid_(IsValidBytes(bytes_)) { } UniquePosition::UniquePosition( const std::string& prefix, const std::string& suffix) : bytes_(prefix + suffix), is_valid_(IsValidBytes(bytes_)) { DCHECK(IsValidSuffix(suffix)); DCHECK(IsValid()); } }
UniquePosition UniquePosition::After( const UniquePosition& x, const std::string& suffix) { DCHECK(IsValidSuffix(suffix)); DCHECK(x.IsValid()); const std::string& after = FindGreaterWithSuffix(x.bytes_, suffix); return UniquePosition(after, suffix); }
function_block-full_function
[]
C++
src/main.cpp
chhsgithub/PolygonExpand
36e42bcd9a5dee09e028cf7024e49dd7f67517b4
#include <iostream> #include <Windows.h> #include <vector> #include <opencv2/opencv.hpp> #define CVUI_IMPLEMENTATION #include "cvui.h" using namespace std; using namespace cv; #define WINDOW_NAME "Show" bool clockwise(vector<Point> contour); void expand_polygon(vector<Point> &contour, vector<Point> &contour_exp, float range); void on_Trackbar(int, void*) { } int main() { Mat show(800, 800, CV_8UC3, Scalar(255,255,255)); namedWindow(WINDOW_NAME); cvui::init(WINDOW_NAME); int range=0; vector<Point> contours; contours.push_back(Point(400, 650)); contours.push_back(Point(450, 600)); contours.push_back(Point(450, 450)); contours.push_back(Point(500, 450)); contours.push_back(Point(500, 400)); contours.push_back(Point(400, 400)); while (true) { show= Mat(800, 800, CV_8UC3, Scalar(255, 255, 255)); cvui::window(show, 200, 20, 400, 70, "Setting"); cvui::trackbar(show, 250, 40, 300, &range, -100, 100); cvui::update(); vector<Point> points_expand; expand_polygon(contours, points_expand, range); Point vertex; for (int i = 0; i < contours.size(); i++) { vertex.x = contours[i].x; vertex.y = contours[i].y; circle(show, vertex, 2, Scalar(0, 255, 0), 1); ostringstream indexText; indexText << i; putText(show, indexText.str(), vertex, cv::FONT_HERSHEY_DUPLEX, 0.5, cv::Scalar(0, 0, 255), 1); int next = (i == (contours.size() - 1) ? 0 : (i + 1)); line(show, contours[i], contours[next], Scalar(0, 0, 255), 1); } for (int i = 0; i < points_expand.size(); i++) { vertex.x = points_expand[i].x; vertex.y = points_expand[i].y; circle(show, vertex, 2, Scalar(0, 255, 0), 1); ostringstream indexText; indexText << i; putText(show, indexText.str(), vertex, cv::FONT_HERSHEY_DUPLEX, 0.5, cv::Scalar(0, 0, 255), 1); int next = (i == (points_expand.size() - 1) ? 0 : (i + 1)); line(show, points_expand[i], points_expand[next], Scalar(0, 255, 0), 1); } imshow(WINDOW_NAME, show); waitKey(1); } return 0; } bool clockwise(vector<Point> contour) { int x_max = contour[0].x; int index = 0; for (int i = 1; i < contour.size(); i++) { if (contour[i].x > x_max) { x_max = contour[i].x; index = i; } } Point a, b, c; if (index == 0) { a = contour.back(); b = contour[0]; c = contour[1]; } else if (index == contour.size() - 1) { a = contour[contour.size() - 2]; b = contour.back(); c = contour[0]; } else { a = contour[index - 1]; b = contour[index]; c = contour[index + 1]; } return ((b.x - a.x) * (c.y - b.y) - (b.y - a.y) * (c.x - b.x)) > 0 ? TRUE : FALSE; } void expand_polygon(vector<Point> &contour, vector<Point> &contour_exp, float range) { if (clockwise(contour)) { range = -range; } vector<Point2f> dpList, ndpList; int count = contour.size(); for (int i = 0; i < count; i++) { int next = (i == (count - 1) ? 0 : (i + 1)); dpList.push_back(contour.at(next) - contour.at(i)); float unitLen = 1.0f / sqrt(dpList.at(i).dot(dpList.at(i))); ndpList.push_back(dpList.at(i) * unitLen); cout << "i=" << i << ",pList:" << contour.at(next) << "," << contour.at(i) << ",dpList:" << dpList.at(i) << ",ndpList:" << ndpList.at(i) << endl; } for (int i = 0; i < count; i++) { int startIndex = (i == 0 ? (count - 1) : (i - 1)); int endIndex = i; float sinTheta = ndpList.at(startIndex).cross(ndpList.at(endIndex)); Point2f orientVector = ndpList.at(endIndex) - ndpList.at(startIndex); Point2f temp_out; temp_out.x = contour.at(i).x + range / sinTheta * orientVector.x; temp_out.y = contour.at(i).y + range / sinTheta * orientVector.y; contour_exp.push_back(temp_out); } }
#include <iostream> #include <Windows.h> #include <vector> #include <opencv2/opencv.hpp> #define CVUI_IMPLEMENTATION #include "cvui.h" using namespace std; using namespace cv; #define WINDOW_NAME "Show" bool clockwise(vector<Point> contour); void expand_polygon(vector<Point> &contour, vector<Point> &contour_exp, float range); void on_Trackbar(int, void*) { } int main() { Mat show(800, 800, CV_8UC3, Scalar(255,255,255)); namedWindow(WINDOW_NAME); cvui::init(WINDOW_NAME); int range=0; vector<Point> contours; contours.push_back(Point(400, 650)); contours.push_back(Point(450, 600)); contours.push_back(Point(450, 450)); contours.push_back(Point(500, 450)); contours.push_back(Point(500, 400)); contours.push_back(Point(400, 400)); while (true) { show= Mat(800, 800, CV_8UC3, Scalar(255, 255, 255)); cvui::window(show, 200, 20, 400, 70, "Setting"); cvui::trackbar(show, 250, 40, 300, &range, -100, 100); cvui::update(); vector<Point> points_expand; expand_polygon(contours, points_expand, range); Point vertex; for (int i = 0; i < contours.size(); i++) { vertex.x = contours[i].x; vertex.y = contours[i].y; circle(show, vertex, 2, Scalar(0, 255, 0), 1); ostringstream indexText; indexText << i; putText(show, indexText.str(), vertex, cv::FONT_HERSHEY_DUPLEX, 0.5, cv::Scalar(0, 0, 255), 1); int next = (i == (contours.size() - 1) ? 0 : (i + 1)); line(show, contours[i], contours[next], Scalar(0, 0, 255), 1); } for (int i = 0; i < points_expand.size(); i++) { vertex.x = points_expand[i].x; vertex.y = points_expand[i].y; circle(show, vertex, 2, Scalar(0, 255, 0), 1); ostringstream indexText; indexText << i; putText(show, indexText.str(), vertex, cv::FONT_HERSHEY_DUPLEX, 0.5, cv::Scalar(0, 0, 255), 1); int next = (i == (points_expand.size() - 1) ? 0 : (i + 1)); line(show, points_expand[i], points_expand[next], Scalar(0, 255, 0), 1); } imshow(WINDOW_NAME, show); waitKey(1); } return 0; }
void expand_polygon(vector<Point> &contour, vector<Point> &contour_exp, float range) { if (clockwise(contour)) { range = -range; } vector<Point2f> dpList, ndpList; int count = contour.size(); for (int i = 0; i < count; i++) { int next = (i == (count - 1) ? 0 : (i + 1)); dpList.push_back(contour.at(next) - contour.at(i)); float unitLen = 1.0f / sqrt(dpList.at(i).dot(dpList.at(i))); ndpList.push_back(dpList.at(i) * unitLen); cout << "i=" << i << ",pList:" << contour.at(next) << "," << contour.at(i) << ",dpList:" << dpList.at(i) << ",ndpList:" << ndpList.at(i) << endl; } for (int i = 0; i < count; i++) { int startIndex = (i == 0 ? (count - 1) : (i - 1)); int endIndex = i; float sinTheta = ndpList.at(startIndex).cross(ndpList.at(endIndex)); Point2f orientVector = ndpList.at(endIndex) - ndpList.at(startIndex); Point2f temp_out; temp_out.x = contour.at(i).x + range / sinTheta * orientVector.x; temp_out.y = contour.at(i).y + range / sinTheta * orientVector.y; contour_exp.push_back(temp_out); } }
bool clockwise(vector<Point> contour) { int x_max = contour[0].x; int index = 0; for (int i = 1; i < contour.size(); i++) { if (contour[i].x > x_max) { x_max = contour[i].x; index = i; } } Point a, b, c; if (index == 0) { a = contour.back(); b = contour[0]; c = contour[1]; } else if (index == contour.size() - 1) { a = contour[contour.size() - 2]; b = contour.back(); c = contour[0]; } else { a = contour[index - 1]; b = contour[index]; c = contour[index + 1]; } return ((b.x - a.x) * (c.y - b.y) - (b.y - a.y) * (c.x - b.x)) > 0 ? TRUE : FALSE; }
function_block-full_function
[ { "content": "# PolygonExpand\n\nEnlarging or reducing the polygon with trackbar\n\n\n\n![show](https://github.com/chhsgithub/PolygonExpand/blob/master/GIF.gif)\n\n****\n\n\t\n\n|Author|chh|\n\n|---|---\n\n|E-mail|[email protected]\n\n\n\n\n\n****\n\n# Requirements\n\n- Cmake\n\n- OpenCV\n\n- CVUI\n", "file_path": "README.md", "rank": 7, "score": 1.3153820310662991 } ]
C++
sources/cpp/ecs/src/game/main.cpp
xunilrj/sandbox
f92c12f83433cac01a885585e41c02bb5826a01f
#include <deltaTime/deltaTime.h> #include <TaskSystem/TaskSystem.h> #include "../ecs/ecs.h" struct PositionComponent { COMPONENTID(1, DenseStore<PositionComponent>); float x, y, z; }; struct RigidBodyComponent { COMPONENTID(2, DenseStore<RigidBodyComponent>); float vx, vy, vz; float ax, ay, az; }; struct EulerIntegratorSystem : System<DeltaTimeComponent, PositionComponent, RigidBodyComponent> { virtual void update() override { foreach([](DeltaTimeComponent& time, PositionComponent& pos, RigidBodyComponent& rb) { pos.x += rb.vx * time.dt; pos.y += rb.vy; pos.z += rb.vz; rb.vx += rb.ax; rb.vy += rb.ay; rb.vz += rb.az; }); } }; #include <iostream> #include <iomanip> bool input_enabled = true; void enable_input(Scene& s) { input_enabled = true; } void disable_input(Scene& s) { input_enabled = false; } void animA(Scene& scene, EntityRef ref) { scene.call(0); auto anim1 = scene.build_anim() .then(AnimManager::lerp(1, 0, 1)) .then(AnimManager::lerp(2, 1, 0.5)); auto anim2 = scene.build_anim() .then(AnimManager::lerp(1, 0, 1)); auto& anim_i1 = scene.start(anim1, ref, &PositionComponent::x); auto& anim_i2 = scene.start_after(anim2, ref, &PositionComponent::y, &anim_i1); scene.call(1, &anim_i2); } int main() { auto scene = Scene{}; scene.add(0, disable_input); scene.add(1, enable_input); scene .add<EulerIntegratorSystem>(); auto e1 = scene.build_entity() .set(PositionComponent{ 0, 0, 0 }) .set(RigidBodyComponent{ 1, 0, 0, 0, 0, 0}) .build(); auto e2 = scene.build_entity() .set(PositionComponent{ 0, 0, 0 }) .build(); auto hStdout = GetStdHandle(STD_OUTPUT_HANDLE); deltaTime<double> dt{ 16, true }; while (true) { auto elapsed = dt.step(); if (elapsed > 0) { auto& int2 = scene.get<PositionComponent>(e2); if (input_enabled && (GetKeyState('A') & 0x8000)) { animA(scene, e2); } scene.set<DeltaTimeComponent>({ (float)(elapsed / 1000.0) }); scene.update(); std::cout.precision(4); std::cout << std::setw(4) << int2.x << " " << std::setw(4) << int2.y << std::endl; } } return 0; }
#include <deltaTime/deltaTime.h> #include <TaskSystem/TaskSystem.h> #include "../ecs/ecs.h" struct PositionComponent { COMPONENTID(1, DenseStore<PositionComponent>); float x, y, z; }; struct RigidBodyComponent { COMPONENTID(2, DenseStore<RigidBodyComponent>); float vx, vy, vz; float ax, ay, az; }; struct EulerIntegratorSystem : System<DeltaTimeComponent, PositionComponent, RigidBodyComponent> { virtua
}; #include <iostream> #include <iomanip> bool input_enabled = true; void enable_input(Scene& s) { input_enabled = true; } void disable_input(Scene& s) { input_enabled = false; } void animA(Scene& scene, EntityRef ref) { scene.call(0); auto anim1 = scene.build_anim() .then(AnimManager::lerp(1, 0, 1)) .then(AnimManager::lerp(2, 1, 0.5)); auto anim2 = scene.build_anim() .then(AnimManager::lerp(1, 0, 1)); auto& anim_i1 = scene.start(anim1, ref, &PositionComponent::x); auto& anim_i2 = scene.start_after(anim2, ref, &PositionComponent::y, &anim_i1); scene.call(1, &anim_i2); } int main() { auto scene = Scene{}; scene.add(0, disable_input); scene.add(1, enable_input); scene .add<EulerIntegratorSystem>(); auto e1 = scene.build_entity() .set(PositionComponent{ 0, 0, 0 }) .set(RigidBodyComponent{ 1, 0, 0, 0, 0, 0}) .build(); auto e2 = scene.build_entity() .set(PositionComponent{ 0, 0, 0 }) .build(); auto hStdout = GetStdHandle(STD_OUTPUT_HANDLE); deltaTime<double> dt{ 16, true }; while (true) { auto elapsed = dt.step(); if (elapsed > 0) { auto& int2 = scene.get<PositionComponent>(e2); if (input_enabled && (GetKeyState('A') & 0x8000)) { animA(scene, e2); } scene.set<DeltaTimeComponent>({ (float)(elapsed / 1000.0) }); scene.update(); std::cout.precision(4); std::cout << std::setw(4) << int2.x << " " << std::setw(4) << int2.y << std::endl; } } return 0; }
l void update() override { foreach([](DeltaTimeComponent& time, PositionComponent& pos, RigidBodyComponent& rb) { pos.x += rb.vx * time.dt; pos.y += rb.vy; pos.z += rb.vz; rb.vx += rb.ax; rb.vy += rb.ay; rb.vz += rb.az; }); }
function_block-function_prefixed
[ { "content": "struct some_non_vectorizable_type { float x; };\n\n\n\nvoid test_first_aligned()\n\n{\n\n EIGEN_ALIGN16 float array_float[100];\n\n test_first_aligned_helper(array_float, 50);\n\n test_first_aligned_helper(array_float+1, 50);\n\n test_first_aligned_helper(array_float+2, 50);\n\n test_first_aligned_helper(array_float+3, 50);\n\n test_first_aligned_helper(array_float+4, 50);\n\n test_first_aligned_helper(array_float+5, 50);\n\n \n\n EIGEN_ALIGN16 double array_double[100];\n\n test_first_aligned_helper(array_double, 50);\n\n test_first_aligned_helper(array_double+1, 50);\n\n test_first_aligned_helper(array_double+2, 50);\n\n \n\n double *array_double_plus_4_bytes = (double*)(size_t(array_double)+4);\n\n test_none_aligned_helper(array_double_plus_4_bytes, 50);\n\n test_none_aligned_helper(array_double_plus_4_bytes+1, 50);\n\n \n\n some_non_vectorizable_type array_nonvec[100];\n\n test_first_aligned_helper(array_nonvec, 100);\n\n test_none_aligned_helper(array_nonvec, 100);\n\n}\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/test/first_aligned.cpp", "rank": 0, "score": 295447.3182155107 }, { "content": "struct some_non_vectorizable_type { float x; };\n\n\n\nvoid test_first_aligned()\n\n{\n\n EIGEN_ALIGN16 float array_float[100];\n\n test_first_aligned_helper(array_float, 50);\n\n test_first_aligned_helper(array_float+1, 50);\n\n test_first_aligned_helper(array_float+2, 50);\n\n test_first_aligned_helper(array_float+3, 50);\n\n test_first_aligned_helper(array_float+4, 50);\n\n test_first_aligned_helper(array_float+5, 50);\n\n \n\n EIGEN_ALIGN16 double array_double[100];\n\n test_first_aligned_helper(array_double, 50);\n\n test_first_aligned_helper(array_double+1, 50);\n\n test_first_aligned_helper(array_double+2, 50);\n\n \n\n double *array_double_plus_4_bytes = (double*)(size_t(array_double)+4);\n\n test_none_aligned_helper(array_double_plus_4_bytes, 50);\n\n test_none_aligned_helper(array_double_plus_4_bytes+1, 50);\n\n \n\n some_non_vectorizable_type array_nonvec[100];\n\n test_first_aligned_helper(array_nonvec, 100);\n\n test_none_aligned_helper(array_nonvec, 100);\n\n}\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/test/first_aligned.cpp", "rank": 1, "score": 295447.3182155107 }, { "content": "struct some_non_vectorizable_type { float x; };\n\n\n\nvoid test_first_aligned()\n\n{\n\n EIGEN_ALIGN16 float array_float[100];\n\n test_first_aligned_helper(array_float, 50);\n\n test_first_aligned_helper(array_float+1, 50);\n\n test_first_aligned_helper(array_float+2, 50);\n\n test_first_aligned_helper(array_float+3, 50);\n\n test_first_aligned_helper(array_float+4, 50);\n\n test_first_aligned_helper(array_float+5, 50);\n\n \n\n EIGEN_ALIGN16 double array_double[100];\n\n test_first_aligned_helper(array_double, 50);\n\n test_first_aligned_helper(array_double+1, 50);\n\n test_first_aligned_helper(array_double+2, 50);\n\n \n\n double *array_double_plus_4_bytes = (double*)(size_t(array_double)+4);\n\n test_none_aligned_helper(array_double_plus_4_bytes, 50);\n\n test_none_aligned_helper(array_double_plus_4_bytes+1, 50);\n\n \n\n some_non_vectorizable_type array_nonvec[100];\n\n test_first_aligned_helper(array_nonvec, 100);\n\n test_none_aligned_helper(array_nonvec, 100);\n\n}\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/test/first_aligned.cpp", "rank": 2, "score": 295447.3182155107 }, { "content": "struct some_non_vectorizable_type { float x; };\n\n\n\nvoid test_first_aligned()\n\n{\n\n EIGEN_ALIGN16 float array_float[100];\n\n test_first_aligned_helper(array_float, 50);\n\n test_first_aligned_helper(array_float+1, 50);\n\n test_first_aligned_helper(array_float+2, 50);\n\n test_first_aligned_helper(array_float+3, 50);\n\n test_first_aligned_helper(array_float+4, 50);\n\n test_first_aligned_helper(array_float+5, 50);\n\n \n\n EIGEN_ALIGN16 double array_double[100];\n\n test_first_aligned_helper(array_double, 50);\n\n test_first_aligned_helper(array_double+1, 50);\n\n test_first_aligned_helper(array_double+2, 50);\n\n \n\n double *array_double_plus_4_bytes = (double*)(size_t(array_double)+4);\n\n test_none_aligned_helper(array_double_plus_4_bytes, 50);\n\n test_none_aligned_helper(array_double_plus_4_bytes+1, 50);\n\n \n\n some_non_vectorizable_type array_nonvec[100];\n\n test_first_aligned_helper(array_nonvec, 100);\n\n test_none_aligned_helper(array_nonvec, 100);\n\n}\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/test/first_aligned.cpp", "rank": 3, "score": 295447.3182155107 }, { "content": "struct Converter<float> {\n\n static_assert(sizeof(float) == sizeof(int32_t), \"Important ULP matcher assumption violated\");\n\n Converter(float f) {\n\n std::memcpy(&i, &f, sizeof(f));\n\n }\n\n int32_t i;\n\n};\n\n\n\ntemplate <>\n", "file_path": "sources/cpp/timer/sources/catch.hpp", "rank": 4, "score": 226727.9206946654 }, { "content": "struct Converter<float> {\n\n static_assert(sizeof(float) == sizeof(int32_t), \"Important ULP matcher assumption violated\");\n\n Converter(float f) {\n\n std::memcpy(&i, &f, sizeof(f));\n\n }\n\n int32_t i;\n\n};\n\n\n\ntemplate <>\n", "file_path": "sources/cpp/memory/tests/catch.hpp", "rank": 5, "score": 226727.9206946654 }, { "content": "struct solve_retval<PastixBase<_MatrixType>, Rhs>\n\n : solve_retval_base<PastixBase<_MatrixType>, Rhs>\n\n{\n\n typedef PastixBase<_MatrixType> Dec;\n\n EIGEN_MAKE_SOLVE_HELPERS(Dec,Rhs)\n\n\n\n template<typename Dest> void evalTo(Dest& dst) const\n\n {\n\n dec()._solve(rhs(),dst);\n\n }\n\n};\n\n\n\ntemplate<typename _MatrixType, typename Rhs>\n", "file_path": "courses/columbia-cg-animation/week03/include/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h", "rank": 6, "score": 204489.05083944715 }, { "content": "struct sparse_solve_retval<PastixBase<_MatrixType>, Rhs>\n\n : sparse_solve_retval_base<PastixBase<_MatrixType>, Rhs>\n\n{\n\n typedef PastixBase<_MatrixType> Dec;\n\n EIGEN_MAKE_SPARSE_SOLVE_HELPERS(Dec,Rhs)\n\n\n\n template<typename Dest> void evalTo(Dest& dst) const\n\n {\n\n this->defaultEvalTo(dst);\n\n }\n\n};\n\n\n\n} // end namespace internal\n\n\n\n} // end namespace Eigen\n\n\n\n#endif\n", "file_path": "courses/columbia-cg-animation/week03/include/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h", "rank": 7, "score": 202256.72946800056 }, { "content": "// test compilation with both a struct and a class...\n\nstruct MyStruct\n\n{\n\n EIGEN_MAKE_ALIGNED_OPERATOR_NEW\n\n char dummychar;\n\n Vector4f avec;\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/test/dynalloc.cpp", "rank": 8, "score": 192538.42205712644 }, { "content": "// test compilation with both a struct and a class...\n\nstruct MyStruct\n\n{\n\n EIGEN_MAKE_ALIGNED_OPERATOR_NEW\n\n char dummychar;\n\n Vector4f avec;\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/test/dynalloc.cpp", "rank": 9, "score": 192538.42205712644 }, { "content": "// test compilation with both a struct and a class...\n\nstruct MyStruct\n\n{\n\n EIGEN_MAKE_ALIGNED_OPERATOR_NEW\n\n char dummychar;\n\n Vector4f avec;\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/test/dynalloc.cpp", "rank": 10, "score": 192538.42205712644 }, { "content": "// test compilation with both a struct and a class...\n\nstruct MyStruct\n\n{\n\n EIGEN_MAKE_ALIGNED_OPERATOR_NEW\n\n char dummychar;\n\n Vector4f avec;\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/test/dynalloc.cpp", "rank": 11, "score": 192538.42205712644 }, { "content": "struct ratio_string {\n\n static std::string symbol();\n\n};\n\n\n\ntemplate <class Ratio>\n\nstd::string ratio_string<Ratio>::symbol() {\n\n Catch::ReusableStringStream rss;\n\n rss << '[' << Ratio::num << '/'\n\n << Ratio::den << ']';\n\n return rss.str();\n\n}\n\ntemplate <>\n", "file_path": "books/NumericalRecipesInC/include/catch.hpp", "rank": 12, "score": 181092.24493297638 }, { "content": "struct NameAndTags {\n\n NameAndTags( StringRef const& name_ = StringRef(), StringRef const& tags_ = StringRef() ) noexcept;\n\n StringRef name;\n\n StringRef tags;\n\n};\n\n\n", "file_path": "books/NumericalRecipesInC/include/catch.hpp", "rank": 13, "score": 181092.24493297638 }, { "content": "struct SummaryColumn {\n\n\n\n SummaryColumn( std::string _label, Colour::Code _colour )\n\n : label( std::move( _label ) ),\n\n colour( _colour ) {}\n\n SummaryColumn addRow( std::size_t count ) {\n\n ReusableStringStream rss;\n\n rss << count;\n\n std::string row = rss.str();\n\n for (auto& oldRow : rows) {\n\n while (oldRow.size() < row.size())\n\n oldRow = ' ' + oldRow;\n\n while (oldRow.size() > row.size())\n\n row = ' ' + row;\n\n }\n\n rows.push_back(row);\n\n return *this;\n\n }\n\n\n\n std::string label;\n", "file_path": "books/NumericalRecipesInC/include/catch.hpp", "rank": 14, "score": 181092.24493297638 }, { "content": "struct ColumnInfo {\n\n enum Justification { Left, Right };\n\n std::string name;\n\n int width;\n\n Justification justification;\n\n};\n", "file_path": "books/NumericalRecipesInC/include/catch.hpp", "rank": 15, "score": 181092.24493297638 }, { "content": "struct ColumnBreak {};\n", "file_path": "books/NumericalRecipesInC/include/catch.hpp", "rank": 16, "score": 181092.24493297638 }, { "content": "struct RowBreak {};\n\n\n", "file_path": "books/NumericalRecipesInC/include/catch.hpp", "rank": 17, "score": 181092.24493297638 }, { "content": "// We need a dummy global operator<< so we can bring it into Catch namespace later\n\nstruct Catch_global_namespace_dummy {};\n\nstd::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy);\n\n\n\nnamespace Catch {\n\n\n\n struct CaseSensitive { enum Choice {\n\n Yes,\n\n No\n\n }; };\n\n\n", "file_path": "books/NumericalRecipesInC/include/catch.hpp", "rank": 18, "score": 176097.12433691317 }, { "content": "struct TestNew2\n\n{\n\n Matrix3d m; // good: m's size isn't a multiple of 16 bytes, so m doesn't have to be 16-byte aligned,\n\n // 8-byte alignment is good enough here, which we'll get automatically\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/test/unalignedassert.cpp", "rank": 19, "score": 173741.78103820296 }, { "content": "struct loop_on_n\n\n{\n\n static void run()\n\n {\n\n bench_prod<M,N,K,Scalar,Mode==-1? alt_prod<M,N,K>::ret : Mode>();\n\n \n\n loop_on_n<M,N+1,K,Scalar,Mode>::run();\n\n }\n\n};\n\n\n\ntemplate<int M, int K, typename Scalar, int Mode>\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/bench/product_threshold.cpp", "rank": 20, "score": 173741.78103820296 }, { "content": "struct TestNew5\n\n{\n\n EIGEN_MAKE_ALIGNED_OPERATOR_NEW\n\n float f; // try the f at first -- the EIGEN_ALIGN16 attribute of m should make that still work\n\n Matrix4f m;\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/test/unalignedassert.cpp", "rank": 21, "score": 173741.78103820296 }, { "content": "struct TestNew6\n\n{\n\n Matrix<float,2,2,DontAlign> m; // good: no alignment requested\n\n float f;\n\n};\n\n\n\ntemplate<bool Align> struct Depends\n\n{\n\n EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(Align)\n\n Vector2d m;\n\n float f;\n\n};\n\n\n\ntemplate<typename T>\n\nvoid check_unalignedassert_good()\n\n{\n\n T *x, *y;\n\n x = new T;\n\n delete x;\n\n y = new T[2];\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/test/unalignedassert.cpp", "rank": 22, "score": 173741.78103820296 }, { "content": "struct TestNew6\n\n{\n\n Matrix<float,2,2,DontAlign> m; // good: no alignment requested\n\n float f;\n\n};\n\n\n\ntemplate<bool Align> struct Depends\n\n{\n\n EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(Align)\n\n Vector2d m;\n\n float f;\n\n};\n\n\n\ntemplate<typename T>\n\nvoid check_unalignedassert_good()\n\n{\n\n T *x, *y;\n\n x = new T;\n\n delete x;\n\n y = new T[2];\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/test/unalignedassert.cpp", "rank": 23, "score": 173741.78103820296 }, { "content": "struct TestNew4\n\n{\n\n EIGEN_MAKE_ALIGNED_OPERATOR_NEW\n\n Vector2d m;\n\n float f; // make the struct have sizeof%16!=0 to make it a little more tricky when we allow an array of 2 such objects\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/test/unalignedassert.cpp", "rank": 24, "score": 173741.78103820296 }, { "content": "struct other_matrix_type\n\n{\n\n typedef int type;\n\n};\n\n\n\ntemplate<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/test/swap.cpp", "rank": 25, "score": 173741.78103820296 }, { "content": "struct TestNew1\n\n{\n\n MatrixXd m; // good: m will allocate its own array, taking care of alignment.\n\n TestNew1() : m(20,20) {}\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/test/unalignedassert.cpp", "rank": 26, "score": 173741.78103820296 }, { "content": "struct Ball\n\n{\n\nEIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(double, Dim)\n\n\n\n typedef Matrix<double, Dim, 1> VectorType;\n\n\n\n Ball() {}\n\n Ball(const VectorType &c, double r) : center(c), radius(r) {}\n\n\n\n VectorType center;\n\n double radius;\n\n};\n\n\n\n\n\ntemplate<typename Scalar, int Dim> AlignedBox<Scalar, Dim> ei_bounding_box(const Matrix<Scalar, Dim, 1> &v) { return AlignedBox<Scalar, Dim>(v); }\n\ntemplate<int Dim> AlignedBox<double, Dim> ei_bounding_box(const Ball<Dim> &b)\n\n{ return AlignedBox<double, Dim>(b.center.array() - b.radius, b.center.array() + b.radius); }\n\n\n\n\n\ntemplate<int Dim>\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/unsupported/test/BVH.cpp", "rank": 27, "score": 173741.78103820296 }, { "content": "struct TestNew2\n\n{\n\n Matrix3d m; // good: m's size isn't a multiple of 16 bytes, so m doesn't have to be 16-byte aligned,\n\n // 8-byte alignment is good enough here, which we'll get automatically\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/test/unalignedassert.cpp", "rank": 28, "score": 173741.78103820296 }, { "content": "struct TestNew4\n\n{\n\n EIGEN_MAKE_ALIGNED_OPERATOR_NEW\n\n Vector2d m;\n\n float f; // make the struct have sizeof%16!=0 to make it a little more tricky when we allow an array of 2 such objects\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/test/unalignedassert.cpp", "rank": 29, "score": 173741.78103820296 }, { "content": "struct TestNew2\n\n{\n\n Matrix3d m; // good: m's size isn't a multiple of 16 bytes, so m doesn't have to be 16-byte aligned,\n\n // 8-byte alignment is good enough here, which we'll get automatically\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/test/unalignedassert.cpp", "rank": 30, "score": 173741.78103820296 }, { "content": "struct loop_on_m\n\n{\n\n static void run()\n\n {\n\n std::cout << M << \"f\\t\";\n\n loop_on_n<M,N,K,float,CoeffBasedProductMode>::run();\n\n std::cout << \"\\n\";\n\n \n\n std::cout << M << \"f\\t\";\n\n loop_on_n<M,N,K,float,-1>::run();\n\n std::cout << \"\\n\";\n\n\n\n loop_on_m<M+1,N,K>::run();\n\n }\n\n};\n\n\n\ntemplate<int N, int K>\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/bench/product_threshold.cpp", "rank": 31, "score": 173741.78103820296 }, { "content": "struct loop_on_k\n\n{\n\n static void run()\n\n {\n\n std::cout << \"K=\" << K << \"\\t\";\n\n print_n<N>::run();\n\n std::cout << \"\\n\";\n\n\n\n loop_on_m<M,N,K>::run();\n\n std::cout << \"\\n\\n\";\n\n\n\n loop_on_k<M,N,K+1>::run();\n\n }\n\n};\n\n\n\ntemplate<int M, int N>\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/bench/product_threshold.cpp", "rank": 32, "score": 173741.78103820296 }, { "content": "struct TestNew3\n\n{\n\n Vector2f m; // good: m's size isn't a multiple of 16 bytes, so m doesn't have to be 16-byte aligned\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/test/unalignedassert.cpp", "rank": 33, "score": 173741.78103820296 }, { "content": "struct TestNew3\n\n{\n\n Vector2f m; // good: m's size isn't a multiple of 16 bytes, so m doesn't have to be 16-byte aligned\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/test/unalignedassert.cpp", "rank": 34, "score": 173741.78103820296 }, { "content": "struct other_matrix_type\n\n{\n\n typedef int type;\n\n};\n\n\n\ntemplate<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/test/swap.cpp", "rank": 35, "score": 173741.78103820296 }, { "content": "struct TestNew4\n\n{\n\n EIGEN_MAKE_ALIGNED_OPERATOR_NEW\n\n Vector2d m;\n\n float f; // make the struct have sizeof%16!=0 to make it a little more tricky when we allow an array of 2 such objects\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/test/unalignedassert.cpp", "rank": 36, "score": 173741.78103820296 }, { "content": "struct packet_helper\n\n{\n\n template<typename T>\n\n inline Packet load(const T* from) const { return ei_pload(from); }\n\n\n\n template<typename T>\n\n inline void store(T* to, const Packet& x) const { ei_pstore(to,x); }\n\n};\n\n\n\ntemplate<typename Packet>\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/test/packetmath.cpp", "rank": 37, "score": 173741.78103820296 }, { "content": "struct TestNew5\n\n{\n\n EIGEN_MAKE_ALIGNED_OPERATOR_NEW\n\n float f; // try the f at first -- the EIGEN_ALIGN16 attribute of m should make that still work\n\n Matrix4f m;\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/test/unalignedassert.cpp", "rank": 38, "score": 173741.78103820296 }, { "content": "struct other_matrix_type\n\n{\n\n typedef int type;\n\n};\n\n\n\ntemplate<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/test/swap.cpp", "rank": 39, "score": 173741.78103820296 }, { "content": "struct loop_on_m\n\n{\n\n static void run()\n\n {\n\n std::cout << M << \"f\\t\";\n\n loop_on_n<M,N,K,float,CoeffBasedProductMode>::run();\n\n std::cout << \"\\n\";\n\n \n\n std::cout << M << \"f\\t\";\n\n loop_on_n<M,N,K,float,-1>::run();\n\n std::cout << \"\\n\";\n\n\n\n loop_on_m<M+1,N,K>::run();\n\n }\n\n};\n\n\n\ntemplate<int N, int K>\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/bench/product_threshold.cpp", "rank": 40, "score": 173741.78103820296 }, { "content": "struct TestNew1\n\n{\n\n MatrixXd m; // good: m will allocate its own array, taking care of alignment.\n\n TestNew1() : m(20,20) {}\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/test/unalignedassert.cpp", "rank": 41, "score": 173741.78103820296 }, { "content": "struct loop_on_n\n\n{\n\n static void run()\n\n {\n\n bench_prod<M,N,K,Scalar,Mode==-1? alt_prod<M,N,K>::ret : Mode>();\n\n \n\n loop_on_n<M,N+1,K,Scalar,Mode>::run();\n\n }\n\n};\n\n\n\ntemplate<int M, int K, typename Scalar, int Mode>\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/bench/product_threshold.cpp", "rank": 42, "score": 173741.78103820296 }, { "content": "struct TestNew4\n\n{\n\n EIGEN_MAKE_ALIGNED_OPERATOR_NEW\n\n Vector2d m;\n\n float f; // make the struct have sizeof%16!=0 to make it a little more tricky when we allow an array of 2 such objects\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/test/unalignedassert.cpp", "rank": 43, "score": 173741.78103820296 }, { "content": "struct TestNew6\n\n{\n\n Matrix<float,2,2,DontAlign> m; // good: no alignment requested\n\n float f;\n\n};\n\n\n\ntemplate<bool Align> struct Depends\n\n{\n\n EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(Align)\n\n Vector2d m;\n\n float f;\n\n};\n\n\n\ntemplate<typename T>\n\nvoid check_unalignedassert_good()\n\n{\n\n T *x, *y;\n\n x = new T;\n\n delete x;\n\n y = new T[2];\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/test/unalignedassert.cpp", "rank": 44, "score": 173741.78103820296 }, { "content": "struct TestNew3\n\n{\n\n Vector2f m; // good: m's size isn't a multiple of 16 bytes, so m doesn't have to be 16-byte aligned\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/test/unalignedassert.cpp", "rank": 45, "score": 173741.78103820296 }, { "content": "struct other_matrix_type\n\n{\n\n typedef int type;\n\n};\n\n\n\ntemplate<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/test/swap.cpp", "rank": 46, "score": 173741.78103820296 }, { "content": "struct TestNew6\n\n{\n\n Matrix<float,2,2,DontAlign> m; // good: no alignment requested\n\n float f;\n\n};\n\n\n\ntemplate<bool Align> struct Depends\n\n{\n\n EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(Align)\n\n Vector2d m;\n\n float f;\n\n};\n\n\n\ntemplate<typename T>\n\nvoid check_unalignedassert_good()\n\n{\n\n T *x, *y;\n\n x = new T;\n\n delete x;\n\n y = new T[2];\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/test/unalignedassert.cpp", "rank": 47, "score": 173741.78103820296 }, { "content": "struct loop_on_k\n\n{\n\n static void run()\n\n {\n\n std::cout << \"K=\" << K << \"\\t\";\n\n print_n<N>::run();\n\n std::cout << \"\\n\";\n\n\n\n loop_on_m<M,N,K>::run();\n\n std::cout << \"\\n\\n\";\n\n\n\n loop_on_k<M,N,K+1>::run();\n\n }\n\n};\n\n\n\ntemplate<int M, int N>\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/bench/product_threshold.cpp", "rank": 48, "score": 173741.78103820296 }, { "content": "struct loop_on_n\n\n{\n\n static void run()\n\n {\n\n bench_prod<M,N,K,Scalar,Mode==-1? alt_prod<M,N,K>::ret : Mode>();\n\n \n\n loop_on_n<M,N+1,K,Scalar,Mode>::run();\n\n }\n\n};\n\n\n\ntemplate<int M, int K, typename Scalar, int Mode>\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/bench/product_threshold.cpp", "rank": 49, "score": 173741.78103820296 }, { "content": "struct packet_helper\n\n{\n\n template<typename T>\n\n inline Packet load(const T* from) const { return ei_pload(from); }\n\n\n\n template<typename T>\n\n inline void store(T* to, const Packet& x) const { ei_pstore(to,x); }\n\n};\n\n\n\ntemplate<typename Packet>\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/test/packetmath.cpp", "rank": 50, "score": 173741.78103820296 }, { "content": "struct loop_on_m\n\n{\n\n static void run()\n\n {\n\n std::cout << M << \"f\\t\";\n\n loop_on_n<M,N,K,float,CoeffBasedProductMode>::run();\n\n std::cout << \"\\n\";\n\n \n\n std::cout << M << \"f\\t\";\n\n loop_on_n<M,N,K,float,-1>::run();\n\n std::cout << \"\\n\";\n\n\n\n loop_on_m<M+1,N,K>::run();\n\n }\n\n};\n\n\n\ntemplate<int N, int K>\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/bench/product_threshold.cpp", "rank": 51, "score": 173741.78103820296 }, { "content": "struct packet_helper\n\n{\n\n template<typename T>\n\n inline Packet load(const T* from) const { return ei_pload(from); }\n\n\n\n template<typename T>\n\n inline void store(T* to, const Packet& x) const { ei_pstore(to,x); }\n\n};\n\n\n\ntemplate<typename Packet>\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/test/packetmath.cpp", "rank": 52, "score": 173741.78103820296 }, { "content": "struct loop_on_m\n\n{\n\n static void run()\n\n {\n\n std::cout << M << \"f\\t\";\n\n loop_on_n<M,N,K,float,CoeffBasedProductMode>::run();\n\n std::cout << \"\\n\";\n\n \n\n std::cout << M << \"f\\t\";\n\n loop_on_n<M,N,K,float,-1>::run();\n\n std::cout << \"\\n\";\n\n\n\n loop_on_m<M+1,N,K>::run();\n\n }\n\n};\n\n\n\ntemplate<int N, int K>\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/bench/product_threshold.cpp", "rank": 53, "score": 173741.78103820296 }, { "content": "struct TestNew5\n\n{\n\n EIGEN_MAKE_ALIGNED_OPERATOR_NEW\n\n float f; // try the f at first -- the EIGEN_ALIGN16 attribute of m should make that still work\n\n Matrix4f m;\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/test/unalignedassert.cpp", "rank": 54, "score": 173741.78103820296 }, { "content": "struct loop_on_k\n\n{\n\n static void run()\n\n {\n\n std::cout << \"K=\" << K << \"\\t\";\n\n print_n<N>::run();\n\n std::cout << \"\\n\";\n\n\n\n loop_on_m<M,N,K>::run();\n\n std::cout << \"\\n\\n\";\n\n\n\n loop_on_k<M,N,K+1>::run();\n\n }\n\n};\n\n\n\ntemplate<int M, int N>\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/bench/product_threshold.cpp", "rank": 55, "score": 173741.78103820296 }, { "content": "struct Ball\n\n{\n\nEIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(double, Dim)\n\n\n\n typedef Matrix<double, Dim, 1> VectorType;\n\n\n\n Ball() {}\n\n Ball(const VectorType &c, double r) : center(c), radius(r) {}\n\n\n\n VectorType center;\n\n double radius;\n\n};\n\n\n\n\n\ntemplate<typename Scalar, int Dim> AlignedBox<Scalar, Dim> ei_bounding_box(const Matrix<Scalar, Dim, 1> &v) { return AlignedBox<Scalar, Dim>(v); }\n\ntemplate<int Dim> AlignedBox<double, Dim> ei_bounding_box(const Ball<Dim> &b)\n\n{ return AlignedBox<double, Dim>(b.center.array() - b.radius, b.center.array() + b.radius); }\n\n\n\n\n\ntemplate<int Dim>\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/unsupported/test/BVH.cpp", "rank": 56, "score": 173741.78103820296 }, { "content": "struct TestNew1\n\n{\n\n MatrixXd m; // good: m will allocate its own array, taking care of alignment.\n\n TestNew1() : m(20,20) {}\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/test/unalignedassert.cpp", "rank": 57, "score": 173741.78103820296 }, { "content": "struct TestNew1\n\n{\n\n MatrixXd m; // good: m will allocate its own array, taking care of alignment.\n\n TestNew1() : m(20,20) {}\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/test/unalignedassert.cpp", "rank": 58, "score": 173741.78103820296 }, { "content": "struct loop_on_n\n\n{\n\n static void run()\n\n {\n\n bench_prod<M,N,K,Scalar,Mode==-1? alt_prod<M,N,K>::ret : Mode>();\n\n \n\n loop_on_n<M,N+1,K,Scalar,Mode>::run();\n\n }\n\n};\n\n\n\ntemplate<int M, int K, typename Scalar, int Mode>\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/bench/product_threshold.cpp", "rank": 59, "score": 173741.78103820296 }, { "content": "struct loop_on_k\n\n{\n\n static void run()\n\n {\n\n std::cout << \"K=\" << K << \"\\t\";\n\n print_n<N>::run();\n\n std::cout << \"\\n\";\n\n\n\n loop_on_m<M,N,K>::run();\n\n std::cout << \"\\n\\n\";\n\n\n\n loop_on_k<M,N,K+1>::run();\n\n }\n\n};\n\n\n\ntemplate<int M, int N>\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/bench/product_threshold.cpp", "rank": 60, "score": 173741.78103820296 }, { "content": "struct TestNew2\n\n{\n\n Matrix3d m; // good: m's size isn't a multiple of 16 bytes, so m doesn't have to be 16-byte aligned,\n\n // 8-byte alignment is good enough here, which we'll get automatically\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/test/unalignedassert.cpp", "rank": 61, "score": 173741.78103820296 }, { "content": "struct packet_helper\n\n{\n\n template<typename T>\n\n inline Packet load(const T* from) const { return ei_pload(from); }\n\n\n\n template<typename T>\n\n inline void store(T* to, const Packet& x) const { ei_pstore(to,x); }\n\n};\n\n\n\ntemplate<typename Packet>\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/test/packetmath.cpp", "rank": 62, "score": 173741.78103820296 }, { "content": "struct TestNew5\n\n{\n\n EIGEN_MAKE_ALIGNED_OPERATOR_NEW\n\n float f; // try the f at first -- the EIGEN_ALIGN16 attribute of m should make that still work\n\n Matrix4f m;\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/test/unalignedassert.cpp", "rank": 63, "score": 173741.78103820296 }, { "content": "struct Ball\n\n{\n\nEIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(double, Dim)\n\n\n\n typedef Matrix<double, Dim, 1> VectorType;\n\n\n\n Ball() {}\n\n Ball(const VectorType &c, double r) : center(c), radius(r) {}\n\n\n\n VectorType center;\n\n double radius;\n\n};\n\n\n\n\n\ntemplate<typename Scalar, int Dim> AlignedBox<Scalar, Dim> ei_bounding_box(const Matrix<Scalar, Dim, 1> &v) { return AlignedBox<Scalar, Dim>(v); }\n\ntemplate<int Dim> AlignedBox<double, Dim> ei_bounding_box(const Ball<Dim> &b)\n\n{ return AlignedBox<double, Dim>(b.center.array() - b.radius, b.center.array() + b.radius); }\n\n\n\n\n\ntemplate<int Dim>\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/unsupported/test/BVH.cpp", "rank": 64, "score": 173741.78103820296 }, { "content": "struct TestNew3\n\n{\n\n Vector2f m; // good: m's size isn't a multiple of 16 bytes, so m doesn't have to be 16-byte aligned\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/test/unalignedassert.cpp", "rank": 65, "score": 173741.78103820296 }, { "content": "struct Ball\n\n{\n\nEIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(double, Dim)\n\n\n\n typedef Matrix<double, Dim, 1> VectorType;\n\n\n\n Ball() {}\n\n Ball(const VectorType &c, double r) : center(c), radius(r) {}\n\n\n\n VectorType center;\n\n double radius;\n\n};\n\n\n\n\n\ntemplate<typename Scalar, int Dim> AlignedBox<Scalar, Dim> ei_bounding_box(const Matrix<Scalar, Dim, 1> &v) { return AlignedBox<Scalar, Dim>(v); }\n\ntemplate<int Dim> AlignedBox<double, Dim> ei_bounding_box(const Ball<Dim> &b)\n\n{ return AlignedBox<double, Dim>(b.center.array() - b.radius, b.center.array() + b.radius); }\n\n\n\n\n\ntemplate<int Dim>\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/unsupported/test/BVH.cpp", "rank": 66, "score": 173741.78103820296 }, { "content": "struct TreeTest\n\n{\n\n typedef Matrix<double, Dim, 1> VectorType;\n\n typedef std::vector<VectorType, aligned_allocator<VectorType> > VectorTypeList;\n\n typedef Ball<Dim> BallType;\n\n typedef std::vector<BallType, aligned_allocator<BallType> > BallTypeList;\n\n typedef AlignedBox<double, Dim> BoxType;\n\n\n\n void testIntersect1()\n\n {\n\n BallTypeList b;\n\n for(int i = 0; i < 500; ++i) {\n\n b.push_back(BallType(VectorType::Random(), 0.5 * ei_random(0., 1.)));\n\n }\n\n KdBVH<double, Dim, BallType> tree(b.begin(), b.end());\n\n\n\n VectorType pt = VectorType::Random();\n\n BallPointStuff<Dim> i1(pt), i2(pt);\n\n\n\n for(int i = 0; i < (int)b.size(); ++i)\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/unsupported/test/BVH.cpp", "rank": 67, "score": 171474.18478234523 }, { "content": "struct TestFunc1\n\n{\n\n typedef _Scalar Scalar;\n\n enum {\n\n InputsAtCompileTime = NX,\n\n ValuesAtCompileTime = NY\n\n };\n\n typedef Matrix<Scalar,InputsAtCompileTime,1> InputType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,1> ValueType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,InputsAtCompileTime> JacobianType;\n\n\n\n int m_inputs, m_values;\n\n\n\n TestFunc1() : m_inputs(InputsAtCompileTime), m_values(ValuesAtCompileTime) {}\n\n TestFunc1(int inputs, int values) : m_inputs(inputs), m_values(values) {}\n\n\n\n int inputs() const { return m_inputs; }\n\n int values() const { return m_values; }\n\n\n\n template<typename T>\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/unsupported/test/autodiff.cpp", "rank": 68, "score": 171474.18478234523 }, { "content": "struct Functor\n\n{\n\n typedef _Scalar Scalar;\n\n enum {\n\n InputsAtCompileTime = NX,\n\n ValuesAtCompileTime = NY\n\n };\n\n typedef Matrix<Scalar,InputsAtCompileTime,1> InputType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,1> ValueType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,InputsAtCompileTime> JacobianType;\n\n \n\n int m_inputs, m_values;\n\n \n\n Functor() : m_inputs(InputsAtCompileTime), m_values(ValuesAtCompileTime) {}\n\n Functor(int inputs, int values) : m_inputs(inputs), m_values(values) {}\n\n \n\n int inputs() const { return m_inputs; }\n\n int values() const { return m_values; }\n\n\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/unsupported/test/NumericalDiff.cpp", "rank": 69, "score": 171474.18478234523 }, { "content": "struct transform_traits\n\n{\n\n enum\n\n {\n\n Dim = Transform::Dim,\n\n HDim = Transform::HDim,\n\n Mode = Transform::Mode,\n\n IsProjective = (int(Mode)==int(Projective))\n\n };\n\n};\n\n\n\ntemplate< typename TransformType,\n\n typename MatrixType,\n\n int Case = transform_traits<TransformType>::IsProjective ? 0\n\n : int(MatrixType::RowsAtCompileTime) == int(transform_traits<TransformType>::HDim) ? 1\n\n : 2>\n", "file_path": "courses/columbia-cg-animation/week03/include/eigen/Eigen/src/Geometry/Transform.h", "rank": 70, "score": 171474.18478234523 }, { "content": "struct IOFormat\n\n{\n\n /** Default contructor, see class IOFormat for the meaning of the parameters */\n\n IOFormat(int _precision = StreamPrecision, int _flags = 0,\n\n const std::string& _coeffSeparator = \" \",\n\n const std::string& _rowSeparator = \"\\n\", const std::string& _rowPrefix=\"\", const std::string& _rowSuffix=\"\",\n\n const std::string& _matPrefix=\"\", const std::string& _matSuffix=\"\")\n\n : matPrefix(_matPrefix), matSuffix(_matSuffix), rowPrefix(_rowPrefix), rowSuffix(_rowSuffix), rowSeparator(_rowSeparator),\n\n coeffSeparator(_coeffSeparator), precision(_precision), flags(_flags)\n\n {\n\n rowSpacer = \"\";\n\n int i = int(matSuffix.length())-1;\n\n while (i>=0 && matSuffix[i]!='\\n')\n\n {\n\n rowSpacer += ' ';\n\n i--;\n\n }\n\n }\n\n std::string matPrefix, matSuffix;\n\n std::string rowPrefix, rowSuffix, rowSeparator, rowSpacer;\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/Eigen/src/Core/IO.h", "rank": 71, "score": 171474.18478234523 }, { "content": "struct IOFormat\n\n{\n\n /** Default contructor, see class IOFormat for the meaning of the parameters */\n\n IOFormat(int _precision = StreamPrecision, int _flags = 0,\n\n const std::string& _coeffSeparator = \" \",\n\n const std::string& _rowSeparator = \"\\n\", const std::string& _rowPrefix=\"\", const std::string& _rowSuffix=\"\",\n\n const std::string& _matPrefix=\"\", const std::string& _matSuffix=\"\")\n\n : matPrefix(_matPrefix), matSuffix(_matSuffix), rowPrefix(_rowPrefix), rowSuffix(_rowSuffix), rowSeparator(_rowSeparator),\n\n rowSpacer(\"\"), coeffSeparator(_coeffSeparator), precision(_precision), flags(_flags)\n\n {\n\n int i = int(matSuffix.length())-1;\n\n while (i>=0 && matSuffix[i]!='\\n')\n\n {\n\n rowSpacer += ' ';\n\n i--;\n\n }\n\n }\n\n std::string matPrefix, matSuffix;\n\n std::string rowPrefix, rowSuffix, rowSeparator, rowSpacer;\n\n std::string coeffSeparator;\n", "file_path": "courses/columbia-cg-animation/week03/include/eigen/Eigen/src/Core/IO.h", "rank": 72, "score": 171474.18478234523 }, { "content": "struct TestFunc1\n\n{\n\n typedef _Scalar Scalar;\n\n enum {\n\n InputsAtCompileTime = NX,\n\n ValuesAtCompileTime = NY\n\n };\n\n typedef Matrix<Scalar,InputsAtCompileTime,1> InputType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,1> ValueType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,InputsAtCompileTime> JacobianType;\n\n\n\n int m_inputs, m_values;\n\n\n\n TestFunc1() : m_inputs(InputsAtCompileTime), m_values(ValuesAtCompileTime) {}\n\n TestFunc1(int inputs, int values) : m_inputs(inputs), m_values(values) {}\n\n\n\n int inputs() const { return m_inputs; }\n\n int values() const { return m_values; }\n\n\n\n template<typename T>\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/unsupported/test/autodiff.cpp", "rank": 73, "score": 171474.18478234523 }, { "content": "struct TestFunc1\n\n{\n\n typedef _Scalar Scalar;\n\n enum {\n\n InputsAtCompileTime = NX,\n\n ValuesAtCompileTime = NY\n\n };\n\n typedef Matrix<Scalar,InputsAtCompileTime,1> InputType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,1> ValueType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,InputsAtCompileTime> JacobianType;\n\n\n\n int m_inputs, m_values;\n\n\n\n TestFunc1() : m_inputs(InputsAtCompileTime), m_values(ValuesAtCompileTime) {}\n\n TestFunc1(int inputs, int values) : m_inputs(inputs), m_values(values) {}\n\n\n\n int inputs() const { return m_inputs; }\n\n int values() const { return m_values; }\n\n\n\n template<typename T>\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/unsupported/test/autodiff.cpp", "rank": 74, "score": 171474.18478234523 }, { "content": "struct contributor\n\n{\n\n string name;\n\n int changedlines;\n\n int changesets;\n\n string url;\n\n string misc;\n\n \n\n contributor() : changedlines(0), changesets(0) {}\n\n \n\n bool operator < (const contributor& other)\n\n {\n\n return lastname(name).compare(lastname(other.name)) < 0;\n\n }\n\n};\n\n\n\nvoid add_online_info_into_contributors_list(list<contributor>& contributors_list, const char *filename)\n\n{\n\n string line;\n\n ifstream online_info;\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/scripts/eigen_gen_credits.cpp", "rank": 75, "score": 171474.18478234523 }, { "content": "struct TreeTest\n\n{\n\n typedef Matrix<double, Dim, 1> VectorType;\n\n typedef std::vector<VectorType, aligned_allocator<VectorType> > VectorTypeList;\n\n typedef Ball<Dim> BallType;\n\n typedef std::vector<BallType, aligned_allocator<BallType> > BallTypeList;\n\n typedef AlignedBox<double, Dim> BoxType;\n\n\n\n void testIntersect1()\n\n {\n\n BallTypeList b;\n\n for(int i = 0; i < 500; ++i) {\n\n b.push_back(BallType(VectorType::Random(), 0.5 * ei_random(0., 1.)));\n\n }\n\n KdBVH<double, Dim, BallType> tree(b.begin(), b.end());\n\n\n\n VectorType pt = VectorType::Random();\n\n BallPointStuff<Dim> i1(pt), i2(pt);\n\n\n\n for(int i = 0; i < (int)b.size(); ++i)\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/unsupported/test/BVH.cpp", "rank": 76, "score": 171474.18478234523 }, { "content": "struct IOFormat\n\n{\n\n /** Default contructor, see class IOFormat for the meaning of the parameters */\n\n IOFormat(int _precision = StreamPrecision, int _flags = 0,\n\n const std::string& _coeffSeparator = \" \",\n\n const std::string& _rowSeparator = \"\\n\", const std::string& _rowPrefix=\"\", const std::string& _rowSuffix=\"\",\n\n const std::string& _matPrefix=\"\", const std::string& _matSuffix=\"\")\n\n : matPrefix(_matPrefix), matSuffix(_matSuffix), rowPrefix(_rowPrefix), rowSuffix(_rowSuffix), rowSeparator(_rowSeparator),\n\n coeffSeparator(_coeffSeparator), precision(_precision), flags(_flags)\n\n {\n\n rowSpacer = \"\";\n\n int i = int(matSuffix.length())-1;\n\n while (i>=0 && matSuffix[i]!='\\n')\n\n {\n\n rowSpacer += ' ';\n\n i--;\n\n }\n\n }\n\n std::string matPrefix, matSuffix;\n\n std::string rowPrefix, rowSuffix, rowSeparator, rowSpacer;\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/Eigen/src/Core/IO.h", "rank": 77, "score": 171474.18478234523 }, { "content": "struct contributor\n\n{\n\n string name;\n\n int changedlines;\n\n int changesets;\n\n string url;\n\n string misc;\n\n \n\n contributor() : changedlines(0), changesets(0) {}\n\n \n\n bool operator < (const contributor& other)\n\n {\n\n return lastname(name).compare(lastname(other.name)) < 0;\n\n }\n\n};\n\n\n\nvoid add_online_info_into_contributors_list(list<contributor>& contributors_list, const char *filename)\n\n{\n\n string line;\n\n ifstream online_info;\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/scripts/eigen_gen_credits.cpp", "rank": 78, "score": 171474.18478234523 }, { "content": "struct Functor\n\n{\n\n typedef _Scalar Scalar;\n\n enum {\n\n InputsAtCompileTime = NX,\n\n ValuesAtCompileTime = NY\n\n };\n\n typedef Matrix<Scalar,InputsAtCompileTime,1> InputType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,1> ValueType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,InputsAtCompileTime> JacobianType;\n\n \n\n int m_inputs, m_values;\n\n \n\n Functor() : m_inputs(InputsAtCompileTime), m_values(ValuesAtCompileTime) {}\n\n Functor(int inputs, int values) : m_inputs(inputs), m_values(values) {}\n\n \n\n int inputs() const { return m_inputs; }\n\n int values() const { return m_values; }\n\n\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/unsupported/test/NumericalDiff.cpp", "rank": 79, "score": 171474.18478234523 }, { "content": "struct IOFormat\n\n{\n\n /** Default contructor, see class IOFormat for the meaning of the parameters */\n\n IOFormat(int _precision = StreamPrecision, int _flags = 0,\n\n const std::string& _coeffSeparator = \" \",\n\n const std::string& _rowSeparator = \"\\n\", const std::string& _rowPrefix=\"\", const std::string& _rowSuffix=\"\",\n\n const std::string& _matPrefix=\"\", const std::string& _matSuffix=\"\")\n\n : matPrefix(_matPrefix), matSuffix(_matSuffix), rowPrefix(_rowPrefix), rowSuffix(_rowSuffix), rowSeparator(_rowSeparator),\n\n coeffSeparator(_coeffSeparator), precision(_precision), flags(_flags)\n\n {\n\n rowSpacer = \"\";\n\n int i = int(matSuffix.length())-1;\n\n while (i>=0 && matSuffix[i]!='\\n')\n\n {\n\n rowSpacer += ' ';\n\n i--;\n\n }\n\n }\n\n std::string matPrefix, matSuffix;\n\n std::string rowPrefix, rowSuffix, rowSeparator, rowSpacer;\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/Eigen/src/Core/IO.h", "rank": 80, "score": 171474.18478234523 }, { "content": "struct TreeTest\n\n{\n\n typedef Matrix<double, Dim, 1> VectorType;\n\n typedef std::vector<VectorType, aligned_allocator<VectorType> > VectorTypeList;\n\n typedef Ball<Dim> BallType;\n\n typedef std::vector<BallType, aligned_allocator<BallType> > BallTypeList;\n\n typedef AlignedBox<double, Dim> BoxType;\n\n\n\n void testIntersect1()\n\n {\n\n BallTypeList b;\n\n for(int i = 0; i < 500; ++i) {\n\n b.push_back(BallType(VectorType::Random(), 0.5 * ei_random(0., 1.)));\n\n }\n\n KdBVH<double, Dim, BallType> tree(b.begin(), b.end());\n\n\n\n VectorType pt = VectorType::Random();\n\n BallPointStuff<Dim> i1(pt), i2(pt);\n\n\n\n for(int i = 0; i < (int)b.size(); ++i)\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/unsupported/test/BVH.cpp", "rank": 81, "score": 171474.18478234523 }, { "content": "struct Functor\n\n{\n\n typedef _Scalar Scalar;\n\n enum {\n\n InputsAtCompileTime = NX,\n\n ValuesAtCompileTime = NY\n\n };\n\n typedef Matrix<Scalar,InputsAtCompileTime,1> InputType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,1> ValueType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,InputsAtCompileTime> JacobianType;\n\n \n\n int m_inputs, m_values;\n\n \n\n Functor() : m_inputs(InputsAtCompileTime), m_values(ValuesAtCompileTime) {}\n\n Functor(int inputs, int values) : m_inputs(inputs), m_values(values) {}\n\n \n\n int inputs() const { return m_inputs; }\n\n int values() const { return m_values; }\n\n\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/unsupported/test/NumericalDiff.cpp", "rank": 82, "score": 171474.18478234523 }, { "content": "struct IOFormat\n\n{\n\n /** Default contructor, see class IOFormat for the meaning of the parameters */\n\n IOFormat(int _precision = StreamPrecision, int _flags = 0,\n\n const std::string& _coeffSeparator = \" \",\n\n const std::string& _rowSeparator = \"\\n\", const std::string& _rowPrefix=\"\", const std::string& _rowSuffix=\"\",\n\n const std::string& _matPrefix=\"\", const std::string& _matSuffix=\"\")\n\n : matPrefix(_matPrefix), matSuffix(_matSuffix), rowPrefix(_rowPrefix), rowSuffix(_rowSuffix), rowSeparator(_rowSeparator),\n\n coeffSeparator(_coeffSeparator), precision(_precision), flags(_flags)\n\n {\n\n rowSpacer = \"\";\n\n int i = int(matSuffix.length())-1;\n\n while (i>=0 && matSuffix[i]!='\\n')\n\n {\n\n rowSpacer += ' ';\n\n i--;\n\n }\n\n }\n\n std::string matPrefix, matSuffix;\n\n std::string rowPrefix, rowSuffix, rowSeparator, rowSpacer;\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/Eigen/src/Core/IO.h", "rank": 83, "score": 171474.18478234523 }, { "content": "struct TreeTest\n\n{\n\n typedef Matrix<double, Dim, 1> VectorType;\n\n typedef std::vector<VectorType, aligned_allocator<VectorType> > VectorTypeList;\n\n typedef Ball<Dim> BallType;\n\n typedef std::vector<BallType, aligned_allocator<BallType> > BallTypeList;\n\n typedef AlignedBox<double, Dim> BoxType;\n\n\n\n void testIntersect1()\n\n {\n\n BallTypeList b;\n\n for(int i = 0; i < 500; ++i) {\n\n b.push_back(BallType(VectorType::Random(), 0.5 * ei_random(0., 1.)));\n\n }\n\n KdBVH<double, Dim, BallType> tree(b.begin(), b.end());\n\n\n\n VectorType pt = VectorType::Random();\n\n BallPointStuff<Dim> i1(pt), i2(pt);\n\n\n\n for(int i = 0; i < (int)b.size(); ++i)\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/unsupported/test/BVH.cpp", "rank": 84, "score": 171474.18478234523 }, { "content": "struct contributor\n\n{\n\n string name;\n\n int changedlines;\n\n int changesets;\n\n string url;\n\n string misc;\n\n \n\n contributor() : changedlines(0), changesets(0) {}\n\n \n\n bool operator < (const contributor& other)\n\n {\n\n return lastname(name).compare(lastname(other.name)) < 0;\n\n }\n\n};\n\n\n\nvoid add_online_info_into_contributors_list(list<contributor>& contributors_list, const char *filename)\n\n{\n\n string line;\n\n ifstream online_info;\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/scripts/eigen_gen_credits.cpp", "rank": 85, "score": 171474.18478234523 }, { "content": "struct TestFunc1\n\n{\n\n typedef _Scalar Scalar;\n\n enum {\n\n InputsAtCompileTime = NX,\n\n ValuesAtCompileTime = NY\n\n };\n\n typedef Matrix<Scalar,InputsAtCompileTime,1> InputType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,1> ValueType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,InputsAtCompileTime> JacobianType;\n\n\n\n int m_inputs, m_values;\n\n\n\n TestFunc1() : m_inputs(InputsAtCompileTime), m_values(ValuesAtCompileTime) {}\n\n TestFunc1(int inputs, int values) : m_inputs(inputs), m_values(values) {}\n\n\n\n int inputs() const { return m_inputs; }\n\n int values() const { return m_values; }\n\n\n\n template<typename T>\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/unsupported/test/autodiff.cpp", "rank": 86, "score": 171474.18478234523 }, { "content": "struct Functor\n\n{\n\n typedef _Scalar Scalar;\n\n enum {\n\n InputsAtCompileTime = NX,\n\n ValuesAtCompileTime = NY\n\n };\n\n typedef Matrix<Scalar,InputsAtCompileTime,1> InputType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,1> ValueType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,InputsAtCompileTime> JacobianType;\n\n \n\n int m_inputs, m_values;\n\n \n\n Functor() : m_inputs(InputsAtCompileTime), m_values(ValuesAtCompileTime) {}\n\n Functor(int inputs, int values) : m_inputs(inputs), m_values(values) {}\n\n \n\n int inputs() const { return m_inputs; }\n\n int values() const { return m_values; }\n\n\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/unsupported/test/NumericalDiff.cpp", "rank": 87, "score": 171474.18478234523 }, { "content": "struct contributor\n\n{\n\n string name;\n\n int changedlines;\n\n int changesets;\n\n string url;\n\n string misc;\n\n \n\n contributor() : changedlines(0), changesets(0) {}\n\n \n\n bool operator < (const contributor& other)\n\n {\n\n return lastname(name).compare(lastname(other.name)) < 0;\n\n }\n\n};\n\n\n\nvoid add_online_info_into_contributors_list(list<contributor>& contributors_list, const char *filename)\n\n{\n\n string line;\n\n ifstream online_info;\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/scripts/eigen_gen_credits.cpp", "rank": 88, "score": 171474.18478234523 }, { "content": "class f77_interface<float> : public f77_interface_base<float>\n\n{\n\npublic :\n\n\n\n static inline std::string name( void )\n\n {\n\n return \"F77\";\n\n }\n\n\n\n\n\n static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N)\n\n {\n\n smxv_(A,&N,B,&N,X);\n\n }\n\n\n\n static inline void matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N)\n\n {\n\n smxm_(A,&N,B,&N,X,&N);\n\n }\n\n\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/bench/btl/libs/f77/f77_interface.hh", "rank": 89, "score": 169895.97645125183 }, { "content": "class f77_interface<float> : public f77_interface_base<float>\n\n{\n\npublic :\n\n\n\n static inline std::string name( void )\n\n {\n\n return \"F77\";\n\n }\n\n\n\n\n\n static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N)\n\n {\n\n smxv_(A,&N,B,&N,X);\n\n }\n\n\n\n static inline void matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N)\n\n {\n\n smxm_(A,&N,B,&N,X,&N);\n\n }\n\n\n", "file_path": "courses/columbia-cg-animation/week01/include/eigen/bench/btl/libs/f77/f77_interface.hh", "rank": 90, "score": 169895.97645125183 }, { "content": "class f77_interface<float> : public f77_interface_base<float>\n\n{\n\npublic :\n\n\n\n static inline std::string name( void )\n\n {\n\n return \"F77\";\n\n }\n\n\n\n\n\n static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N)\n\n {\n\n smxv_(A,&N,B,&N,X);\n\n }\n\n\n\n static inline void matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N)\n\n {\n\n smxm_(A,&N,B,&N,X,&N);\n\n }\n\n\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/bench/btl/libs/f77/f77_interface.hh", "rank": 91, "score": 169895.97645125183 }, { "content": "class f77_interface<float> : public f77_interface_base<float>\n\n{\n\npublic :\n\n\n\n static inline std::string name( void )\n\n {\n\n return \"F77\";\n\n }\n\n\n\n\n\n static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N)\n\n {\n\n smxv_(A,&N,B,&N,X);\n\n }\n\n\n\n static inline void matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N)\n\n {\n\n smxm_(A,&N,B,&N,X,&N);\n\n }\n\n\n", "file_path": "courses/columbia-cg-animation/week02/include/eigen/bench/btl/libs/f77/f77_interface.hh", "rank": 92, "score": 169895.97645125183 }, { "content": "struct Functor\n\n{\n\n typedef _Scalar Scalar;\n\n enum {\n\n InputsAtCompileTime = NX,\n\n ValuesAtCompileTime = NY\n\n };\n\n typedef Matrix<Scalar,InputsAtCompileTime,1> InputType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,1> ValueType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,InputsAtCompileTime> JacobianType;\n\n\n\n const int m_inputs, m_values;\n\n\n\n Functor() : m_inputs(InputsAtCompileTime), m_values(ValuesAtCompileTime) {}\n\n Functor(int inputs, int values) : m_inputs(inputs), m_values(values) {}\n\n\n\n int inputs() const { return m_inputs; }\n\n int values() const { return m_values; }\n\n\n\n // you should define that in the subclass :\n\n// void operator() (const InputType& x, ValueType* v, JacobianType* _j=0) const;\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/unsupported/test/NonLinearOptimization.cpp", "rank": 93, "score": 169289.52178377594 }, { "content": "struct TestFunc1\n\n{\n\n typedef _Scalar Scalar;\n\n enum {\n\n InputsAtCompileTime = NX,\n\n ValuesAtCompileTime = NY\n\n };\n\n typedef Matrix<Scalar,InputsAtCompileTime,1> InputType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,1> ValueType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,InputsAtCompileTime> JacobianType;\n\n\n\n int m_inputs, m_values;\n\n\n\n TestFunc1() : m_inputs(InputsAtCompileTime), m_values(ValuesAtCompileTime) {}\n\n TestFunc1(int inputs, int values) : m_inputs(inputs), m_values(values) {}\n\n\n\n int inputs() const { return m_inputs; }\n\n int values() const { return m_values; }\n\n\n\n template<typename T>\n", "file_path": "courses/columbia-cg-animation/week04/include/eigen/unsupported/test/forward_adolc.cpp", "rank": 94, "score": 169289.52178377594 }, { "content": "struct significant_decimals_impl\n\n : significant_decimals_default_impl<Scalar, NumTraits<Scalar>::IsInteger>\n\n{};\n\n\n\n/** \\internal\n\n * print the matrix \\a _m to the output stream \\a s using the output format \\a fmt */\n\ntemplate<typename Derived>\n\nstd::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& fmt)\n\n{\n\n if(_m.size() == 0)\n\n {\n\n s << fmt.matPrefix << fmt.matSuffix;\n\n return s;\n\n }\n\n \n\n typename Derived::Nested m = _m;\n\n typedef typename Derived::Scalar Scalar;\n\n typedef typename Derived::Index Index;\n\n\n\n Index width = 0;\n", "file_path": "courses/columbia-cg-animation/week03/include/eigen/Eigen/src/Core/IO.h", "rank": 95, "score": 169289.52178377594 }, { "content": "struct ProductReturnType\n\n{\n\n // TODO use the nested type to reduce instanciations ????\n\n// typedef typename ei_nested<Lhs,Rhs::ColsAtCompileTime>::type LhsNested;\n\n// typedef typename ei_nested<Rhs,Lhs::RowsAtCompileTime>::type RhsNested;\n\n\n\n typedef GeneralProduct<Lhs/*Nested*/, Rhs/*Nested*/, ProductType> Type;\n\n};\n\n\n\ntemplate<typename Lhs, typename Rhs>\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/Eigen/src/Core/Product.h", "rank": 96, "score": 169289.52178377594 }, { "content": "struct member_redux {\n\n typedef typename result_of<\n\n BinaryOp(Scalar)\n\n >::type result_type;\n\n template<typename _Scalar, int Size> struct Cost\n\n { enum { value = (Size-1) * functor_traits<BinaryOp>::Cost }; };\n\n member_redux(const BinaryOp func) : m_functor(func) {}\n\n template<typename Derived>\n\n inline result_type operator()(const DenseBase<Derived>& mat) const\n\n { return mat.redux(m_functor); }\n\n const BinaryOp m_functor;\n\n};\n\n}\n\n\n\n/** \\class VectorwiseOp\n\n * \\ingroup Core_Module\n\n *\n\n * \\brief Pseudo expression providing partial reduction operations\n\n *\n\n * \\param ExpressionType the type of the object on which to do partial reductions\n", "file_path": "courses/columbia-cg-animation/week03/include/eigen/Eigen/src/Core/VectorwiseOp.h", "rank": 97, "score": 169289.52178377594 }, { "content": "struct ei_gemv_selector;\n\n\n\ntemplate<typename Lhs, typename Rhs>\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/Eigen/src/Core/Product.h", "rank": 98, "score": 169289.52178377594 }, { "content": "struct Functor\n\n{\n\n typedef _Scalar Scalar;\n\n enum {\n\n InputsAtCompileTime = NX,\n\n ValuesAtCompileTime = NY\n\n };\n\n typedef Matrix<Scalar,InputsAtCompileTime,1> InputType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,1> ValueType;\n\n typedef Matrix<Scalar,ValuesAtCompileTime,InputsAtCompileTime> JacobianType;\n\n\n\n const int m_inputs, m_values;\n\n\n\n Functor() : m_inputs(InputsAtCompileTime), m_values(ValuesAtCompileTime) {}\n\n Functor(int inputs, int values) : m_inputs(inputs), m_values(values) {}\n\n\n\n int inputs() const { return m_inputs; }\n\n int values() const { return m_values; }\n\n\n\n // you should define that in the subclass :\n\n// void operator() (const InputType& x, ValueType* v, JacobianType* _j=0) const;\n\n};\n\n\n", "file_path": "courses/columbia-cg-animation/week05/include/eigen/unsupported/test/NonLinearOptimization.cpp", "rank": 99, "score": 169289.52178377594 } ]
C++
uarm/src/swiftpro_rviz_node2.cpp
iamrajee/ROS
c8b0f09db9624f4d06e86a0b0e12df4f0471ca86
#include <string> #include <ros/ros.h> #include <std_msgs/String.h> #include <swiftpro/SwiftproState.h> #include <sensor_msgs/JointState.h> #include <tf/transform_broadcaster.h> #define MATH_PI 3.141592653589793238463 #define MATH_TRANS 57.2958 #define MATH_L1 106.6 #define MATH_L2 13.2 #define MATH_LOWER_ARM 142.07 #define MATH_UPPER_ARM 158.81 #define MATH_UPPER_LOWER (MATH_UPPER_ARM / MATH_LOWER_ARM) #define LOWER_ARM_MAX_ANGLE 135.6 #define LOWER_ARM_MIN_ANGLE 0 #define UPPER_ARM_MAX_ANGLE 100.7 #define UPPER_ARM_MIN_ANGLE 0 #define LOWER_UPPER_MAX_ANGLE 151 #define LOWER_UPPER_MIN_ANGLE 10 float joint_angle[9] = {0.0}; void all_joints_state(float angle[3]) { double alpha2; double alpha3; alpha2 = angle[1]; alpha3 = angle[2] - 3.8; joint_angle[0] = angle[0] - 90; joint_angle[1] = 90 - alpha2; joint_angle[5] = alpha3; joint_angle[2] = (alpha2 + alpha3) - 176.11 + 90; joint_angle[3] = -90 + alpha2; joint_angle[4] = joint_angle[1]; joint_angle[6] = 90 - (alpha2 + alpha3); joint_angle[7] = 176.11 - 180 - alpha3; joint_angle[8] = 48.39 + alpha3 - 44.55; } bool swiftpro_ik(float position[3], float angle[3]) { float x = position[0]; float y = position[1]; float z = position[2]; float xIn, zIn, phi, rightAll, sqrtZX = 0.0; float angleRot, angleLeft, angleRight = 0.0; z += 74.55; zIn = (z - MATH_L1) / MATH_LOWER_ARM; if (x < 0.1) x = 0.1; if (y == 0) angleRot = 90; else if (y < 0) angleRot = -atan(x / y) * MATH_TRANS; else if (y > 0) angleRot = 180 - atan(x / y) * MATH_TRANS; xIn = (x / sin(angleRot / MATH_TRANS) - MATH_L2 - 56.55) / MATH_LOWER_ARM; phi = atan(zIn / xIn) * MATH_TRANS; sqrtZX = sqrt(zIn * zIn + xIn * xIn); rightAll = (sqrtZX * sqrtZX + MATH_UPPER_LOWER * MATH_UPPER_LOWER - 1) / (2 * MATH_UPPER_LOWER * sqrtZX); angleRight = acos(rightAll) * MATH_TRANS; rightAll = (sqrtZX * sqrtZX + 1 - MATH_UPPER_LOWER * MATH_UPPER_LOWER ) / (2 * sqrtZX); angleLeft = acos(rightAll) * MATH_TRANS; angleLeft = angleLeft + phi; angleRight = angleRight - phi; if (isnan(angleRot) || isnan(angleLeft) || isnan(angleRight)) return false; angle[0] = angleRot; angle[1] = angleLeft; angle[2] = angleRight; return true; } void SwiftproState_Callback(const swiftpro::SwiftproState& msg) { float position[3]; float angle[3]; position[0] = msg.x; position[1] = msg.y; position[2] = msg.z; if ( swiftpro_ik(position, angle) ) all_joints_state(angle); else ROS_ERROR("Inverse kinematic is wrong"); } int main(int argc, char **argv) { ros::init(argc, argv, "swiftpro_rviz_node"); ros::NodeHandle n; ros::Subscriber sub = n.subscribe("SwiftproState_topic", 1, SwiftproState_Callback); ros::Publisher pub = n.advertise<sensor_msgs::JointState>("joint_states", 1); ros::Rate loop_rate(20); tf::TransformBroadcaster broadcaster; sensor_msgs::JointState joint_state; geometry_msgs::TransformStamped odom_trans; odom_trans.header.frame_id = "odom"; odom_trans.child_frame_id = "Base"; while (ros::ok()) { joint_state.header.stamp = ros::Time::now(); joint_state.name.resize(9); joint_state.position.resize(9); joint_state.name[0] = "Joint1"; joint_state.position[0] = joint_angle[0] / 57.2958; joint_state.name[1] = "Joint2"; joint_state.position[1] = joint_angle[1] / 57.2958; joint_state.name[2] = "Joint3"; joint_state.position[2] = joint_angle[2] / 57.2958; joint_state.name[3] = "Joint4"; joint_state.position[3] = joint_angle[3] / 57.2958; joint_state.name[4] = "Joint5"; joint_state.position[4] = joint_angle[4] / 57.2958; joint_state.name[5] = "Joint6"; joint_state.position[5] = joint_angle[5] / 57.2958; joint_state.name[6] = "Joint7"; joint_state.position[6] = joint_angle[6] / 57.2958; joint_state.name[7] = "Joint8"; joint_state.position[7] = joint_angle[7] / 57.2958; joint_state.name[8] = "Joint9"; joint_state.position[8] = joint_angle[8] / 57.2958; odom_trans.header.stamp = ros::Time::now(); odom_trans.transform.translation.x = 0; odom_trans.transform.translation.y = 0; odom_trans.transform.translation.z = 0.0; odom_trans.transform.rotation = tf::createQuaternionMsgFromYaw(10); pub.publish(joint_state); broadcaster.sendTransform(odom_trans); ros::spinOnce(); loop_rate.sleep(); } return 0; }
#include <string> #include <ros/ros.h> #include <std_msgs/String.h> #include <swiftpro/SwiftproState.h> #include <sensor_msgs/JointState.h> #include <tf/transform_broadcaster.h> #define MATH_PI 3.141592653589793238463 #define MATH_TRANS 57.2958 #define MATH_L1 106.6 #define MATH_L2 13.2 #define MATH_LOWER_ARM 142.07 #define MATH_UPPER_ARM 158.81 #define MATH_UPPER_LOWER (MATH_UPPER_ARM / MATH_LOWER_ARM) #define LOWER_ARM_MAX_ANGLE 135.6 #define LOWER_ARM_MIN_ANGLE 0 #define UPPER_ARM_MAX_ANGLE 100.7 #define UPPER_ARM_MIN_ANGLE 0 #define LOWER_UPPER_MAX_ANGLE 151 #define LOWER_UPPER_MIN_ANGLE 10 float joint_angle[9] = {0.0}; void all_joints_state(float angle[3]) { double alpha2; double alpha3; alpha2 = angle[1]; alpha3 = angle[2] - 3.8; joint_angle[0] = angle[0] - 90; joint_angle[1] = 90 - alpha2; joint_angle[5] = alpha3; joint_angle[2] = (alpha2 + alpha3) - 176.11 + 90; joint_angle[3] = -90 + alpha2; joint_angle[4] = joint_angle[1]; joint_angle[6] = 90 - (alpha2 + alpha3); joint_angle[7] = 176.11 - 180 - alpha3; joint_angle[8] = 48.39 + alpha3 - 44.55; } bool swiftpro_ik(float position[3], float angle[3]) { float x = position[0]; float y = position[1]; float z = position[2]; float xIn, zIn, phi, rightAll, sqrtZX = 0.0; float angleRot, angleLeft, angleRight = 0.0; z += 74.55; zIn = (z - MATH_L1) / MATH_LOWER_ARM; if (x < 0.1) x = 0.1; if (y == 0) angleRot = 90; else if (y < 0) angleRot = -atan(x / y) * MATH_TRANS; else if (y > 0) angleRot = 180 - atan(x / y) * MATH_TRANS; xIn = (x / sin(angleRot / MATH_TRANS) -
sqrtZX + 1 - MATH_UPPER_LOWER * MATH_UPPER_LOWER ) / (2 * sqrtZX); angleLeft = acos(rightAll) * MATH_TRANS; angleLeft = angleLeft + phi; angleRight = angleRight - phi; if (isnan(angleRot) || isnan(angleLeft) || isnan(angleRight)) return false; angle[0] = angleRot; angle[1] = angleLeft; angle[2] = angleRight; return true; } void SwiftproState_Callback(const swiftpro::SwiftproState& msg) { float position[3]; float angle[3]; position[0] = msg.x; position[1] = msg.y; position[2] = msg.z; if ( swiftpro_ik(position, angle) ) all_joints_state(angle); else ROS_ERROR("Inverse kinematic is wrong"); } int main(int argc, char **argv) { ros::init(argc, argv, "swiftpro_rviz_node"); ros::NodeHandle n; ros::Subscriber sub = n.subscribe("SwiftproState_topic", 1, SwiftproState_Callback); ros::Publisher pub = n.advertise<sensor_msgs::JointState>("joint_states", 1); ros::Rate loop_rate(20); tf::TransformBroadcaster broadcaster; sensor_msgs::JointState joint_state; geometry_msgs::TransformStamped odom_trans; odom_trans.header.frame_id = "odom"; odom_trans.child_frame_id = "Base"; while (ros::ok()) { joint_state.header.stamp = ros::Time::now(); joint_state.name.resize(9); joint_state.position.resize(9); joint_state.name[0] = "Joint1"; joint_state.position[0] = joint_angle[0] / 57.2958; joint_state.name[1] = "Joint2"; joint_state.position[1] = joint_angle[1] / 57.2958; joint_state.name[2] = "Joint3"; joint_state.position[2] = joint_angle[2] / 57.2958; joint_state.name[3] = "Joint4"; joint_state.position[3] = joint_angle[3] / 57.2958; joint_state.name[4] = "Joint5"; joint_state.position[4] = joint_angle[4] / 57.2958; joint_state.name[5] = "Joint6"; joint_state.position[5] = joint_angle[5] / 57.2958; joint_state.name[6] = "Joint7"; joint_state.position[6] = joint_angle[6] / 57.2958; joint_state.name[7] = "Joint8"; joint_state.position[7] = joint_angle[7] / 57.2958; joint_state.name[8] = "Joint9"; joint_state.position[8] = joint_angle[8] / 57.2958; odom_trans.header.stamp = ros::Time::now(); odom_trans.transform.translation.x = 0; odom_trans.transform.translation.y = 0; odom_trans.transform.translation.z = 0.0; odom_trans.transform.rotation = tf::createQuaternionMsgFromYaw(10); pub.publish(joint_state); broadcaster.sendTransform(odom_trans); ros::spinOnce(); loop_rate.sleep(); } return 0; }
MATH_L2 - 56.55) / MATH_LOWER_ARM; phi = atan(zIn / xIn) * MATH_TRANS; sqrtZX = sqrt(zIn * zIn + xIn * xIn); rightAll = (sqrtZX * sqrtZX + MATH_UPPER_LOWER * MATH_UPPER_LOWER - 1) / (2 * MATH_UPPER_LOWER * sqrtZX); angleRight = acos(rightAll) * MATH_TRANS; rightAll = (sqrtZX *
function_block-random_span
[ { "content": " class DDDouble : virtual public DDParam {\n\n public:\n\n string getName() const;\n\n\n\n void prepGroup(Group &group);\n\n\n\n void prepConfig(Config &conf);\n\n\n\n void prepConfigDescription(ConfigDescription &conf_desc);\n\n\n\n int getLevel() const;\n\n\n\n bool sameType(Value val);\n\n\n\n bool sameValue(Value val);\n\n\n\n void setValue(Value val);\n\n\n\n Value getValue() const;\n\n\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_double_param.h", "rank": 0, "score": 79677.44074427793 }, { "content": " class DDBool : virtual public DDParam {\n\n public:\n\n string getName() const;\n\n\n\n void prepGroup(Group &group);\n\n\n\n void prepConfig(Config &conf);\n\n\n\n void prepConfigDescription(ConfigDescription &conf_desc);\n\n\n\n int getLevel() const;\n\n\n\n bool sameType(Value val);\n\n\n\n bool sameValue(Value val);\n\n\n\n void setValue(Value val);\n\n\n\n Value getValue() const;\n\n\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_bool_param.h", "rank": 1, "score": 79677.44074427793 }, { "content": " class DDString : virtual public DDParam {\n\n public:\n\n string getName() const;\n\n\n\n void prepGroup(Group &group);\n\n\n\n void prepConfig(Config &conf);\n\n\n\n void prepConfigDescription(ConfigDescription &conf_desc);\n\n\n\n int getLevel() const;\n\n\n\n bool sameType(Value val);\n\n\n\n bool sameValue(Value val);\n\n\n\n void setValue(Value val);\n\n\n\n Value getValue() const;\n\n\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_string_param.h", "rank": 2, "score": 79677.44074427793 }, { "content": "//\n\n// Created by Noam Dori on 19/06/18.\n\n//\n\n\n\n#ifndef DDYNAMIC_RECONFIGURE_DD_DOUBLE_PARAM_H\n\n#define DDYNAMIC_RECONFIGURE_DD_DOUBLE_PARAM_H\n\n\n\n#include \"ddynamic_reconfigure/dd_param.h\"\n\n\n\n\n\nnamespace ddynamic_reconfigure {\n\n typedef numeric_limits<double> d_limit;\n\n /**\n\n * @brief a double implementation of the parameter.\n\n * This is used to handle double-precision floating point numbers,\n\n * though it can handle single precision as well.\n\n */\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_double_param.h", "rank": 3, "score": 77108.39162659523 }, { "content": " /**\n\n * @brief creates a new bool param\n\n * @param name the name of the parameter\n\n * @param level the change level\n\n * @param description details about the parameter\n\n * @param def the default value\n\n */\n\n DDBool(const string &name, unsigned int level, const string &description, bool def) {\n\n name_ = name;\n\n level_ = level;\n\n desc_ = description;\n\n def_ = def;\n\n val_ = def;\n\n }\n\n protected:\n\n /**\n\n * @brief the level of the parameter:\n\n * the degree in which things need to be shut down if this param changes\n\n */\n\n unsigned int level_;\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_bool_param.h", "rank": 4, "score": 77106.21933363154 }, { "content": " /**\n\n * @brief the default value (def_),\n\n * and the current value (val_)\n\n */\n\n bool def_,val_;\n\n /**\n\n * @brief the name of the parameter (name_),\n\n * and its description (desc_)\n\n */\n\n string name_, desc_;\n\n };\n\n}\n\n\n\n\n\n#endif //DDYNAMIC_RECONFIGURE_DD_BOOL_PARAM_H\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_bool_param.h", "rank": 5, "score": 77105.95734924369 }, { "content": "//\n\n// Created by Noam Dori on 19/06/18.\n\n//\n\n\n\n#ifndef DDYNAMIC_RECONFIGURE_DD_STRING_PARAM_H\n\n#define DDYNAMIC_RECONFIGURE_DD_STRING_PARAM_H\n\n\n\n#include \"ddynamic_reconfigure/dd_param.h\"\n\n\n\nnamespace ddynamic_reconfigure {\n\n /**\n\n * @brief a string implementation of the parameter.\n\n * This is used to handle strings of characters of variable length.\n\n * Like string, each param value can hold up to 2^32-1 characters.\n\n */\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_string_param.h", "rank": 6, "score": 77105.9616865491 }, { "content": "//\n\n// Created by Noam Dori on 19/06/18.\n\n//\n\n\n\n#ifndef DDYNAMIC_RECONFIGURE_DD_BOOL_PARAM_H\n\n#define DDYNAMIC_RECONFIGURE_DD_BOOL_PARAM_H\n\n\n\n#include \"ddynamic_reconfigure/dd_param.h\"\n\n\n\nnamespace ddynamic_reconfigure {\n\n /**\n\n * @brief a boolean implementation of the parameter.\n\n * These are used to handle true/false values, or bit quantities if needed.\n\n * In ROS, booleans are handled as u-bytes (u-int8), so be careful with these!\n\n */\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_bool_param.h", "rank": 7, "score": 77105.19595149056 }, { "content": " /**\n\n * creates a new double param\n\n * @param name the name of the parameter\n\n * @param level the change level\n\n * @param def the default value\n\n * @param description details about the parameter\n\n * @param max the maximum allowed value. Defaults to DBL_MAX\n\n * @param min the minimum allowed value. Defaults to -DBL_MAX\n\n */\n\n DDDouble(const string &name, unsigned int level, const string &description, double def,\n\n double min = -d_limit::infinity(), double max = d_limit::infinity())\n\n : max_(), min_() {\n\n name_ = name;\n\n level_ = level;\n\n desc_ = description;\n\n def_ = def;\n\n val_ = def;\n\n max_ = max;\n\n min_ = min;\n\n }\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_double_param.h", "rank": 8, "score": 77104.24240649953 }, { "content": " protected:\n\n /**\n\n * @brief the level of the parameter:\n\n * the degree in which things need to be shut down if this param changes\n\n */\n\n unsigned int level_;\n\n /**\n\n * @brief the default value (def_),\n\n * the current value (val_),\n\n * the minimum allowed value (min_),\n\n * and the maximum allowed value (max_)\n\n */\n\n double def_,max_,min_,val_;\n\n /**\n\n * @brief the name of the parameter (name_),\n\n * and its description (desc_)\n\n */\n\n string name_, desc_;\n\n };\n\n}\n\n\n\n\n\n#endif //DDYNAMIC_RECONFIGURE_DD_DOUBLE_PARAM_H\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_double_param.h", "rank": 9, "score": 77104.00753056731 }, { "content": " /**\n\n * creates a new string param\n\n * @param name the name of the parameter\n\n * @param level the change level\n\n * @param description details about the parameter\n\n * @param def the default value\n\n */\n\n DDString(const string &name, unsigned int level, const string &description, const string &def) {\n\n name_ = name;\n\n level_ = level;\n\n desc_ = description;\n\n def_ = def;\n\n val_ = def;\n\n }\n\n protected:\n\n /**\n\n * @brief the level of the parameter:\n\n * the degree in which things need to be shut down if this param changes\n\n */\n\n unsigned int level_;\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_string_param.h", "rank": 10, "score": 77102.53449879441 }, { "content": " /**\n\n * @brief the default value (def_),\n\n * and the current value (val_)\n\n */\n\n string def_,val_;\n\n /**\n\n * @brief the name of the parameter (name_),\n\n * and its description (desc_)\n\n */\n\n string name_, desc_;\n\n };\n\n}\n\n\n\n\n\n#endif //DDYNAMIC_RECONFIGURE_DD_STRING_PARAM_H\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_string_param.h", "rank": 11, "score": 77102.47950733577 }, { "content": " };\n\n\n\n std::string _base_frame_id;\n\n std::string _odom_frame_id;\n\n std::map<stream_index_pair, std::string> _frame_id;\n\n std::map<stream_index_pair, std::string> _optical_frame_id;\n\n std::map<stream_index_pair, std::string> _depth_aligned_frame_id;\n\n ros::NodeHandle& _node_handle, _pnh;\n\n bool _align_depth;\n\n\n\n virtual void calcAndPublishStaticTransform(const stream_index_pair& stream, const rs2::stream_profile& base_profile);\n\n rs2::stream_profile getAProfile(const stream_index_pair& stream);\n\n tf::Quaternion rotationMatrixToQuaternion(const float rotation[9]) const;\n\n void publish_static_tf(const ros::Time& t,\n\n const float3& trans,\n\n const tf::Quaternion& q,\n\n const std::string& from,\n\n const std::string& to);\n\n\n\n\n\n private:\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/base_realsense_node.h", "rank": 12, "score": 40809.74622657525 }, { "content": " void clip_depth(rs2::depth_frame depth_frame, float clipping_dist);\n\n void updateStreamCalibData(const rs2::video_stream_profile& video_profile);\n\n void publishStaticTransforms();\n\n void publishPointCloud(rs2::points f, const ros::Time& t, const rs2::frameset& frameset);\n\n Extrinsics rsExtrinsicsToMsg(const rs2_extrinsics& extrinsics, const std::string& frame_id) const;\n\n\n\n IMUInfo getImuInfo(const stream_index_pair& stream_index);\n\n void publishFrame(rs2::frame f, const ros::Time& t,\n\n const stream_index_pair& stream,\n\n std::map<stream_index_pair, cv::Mat>& images,\n\n const std::map<stream_index_pair, ros::Publisher>& info_publishers,\n\n const std::map<stream_index_pair, ImagePublisherWithFrequencyDiagnostics>& image_publishers,\n\n std::map<stream_index_pair, int>& seq,\n\n std::map<stream_index_pair, sensor_msgs::CameraInfo>& camera_info,\n\n const std::map<stream_index_pair, std::string>& optical_frame_id,\n\n const std::map<rs2_stream, std::string>& encoding,\n\n bool copy_data_from_frame = true);\n\n bool getEnabledProfile(const stream_index_pair& stream_index, rs2::stream_profile& profile);\n\n\n\n void publishAlignedDepthToOthers(rs2::frameset frames, const ros::Time& t);\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/base_realsense_node.h", "rank": 13, "score": 40808.84455708749 }, { "content": "\n\n public:\n\n CIMUHistory(size_t size);\n\n void add_data(sensor_name module, imuData data);\n\n bool is_all_data(sensor_name);\n\n bool is_data(sensor_name);\n\n const std::list<imuData>& get_data(sensor_name module);\n\n imuData last_data(sensor_name module);\n\n };\n\n\n\n static std::string getNamespaceStr();\n\n void getParameters();\n\n void setupDevice();\n\n void setupErrorCallback();\n\n void setupPublishers();\n\n void enable_devices();\n\n void setupFilters();\n\n void setupStreams();\n\n void setBaseTime(double frame_time, bool warn_no_metadata);\n\n cv::Mat& fix_depth_scale(const cv::Mat& from_image, cv::Mat& to_image);\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/base_realsense_node.h", "rank": 14, "score": 40808.444225162224 }, { "content": " static void callback(const ddynamic_reconfigure::DDMap& map, int, rs2::options sensor);\n\n double FillImuData_Copy(const stream_index_pair stream_index, const CIMUHistory::imuData imu_data, sensor_msgs::Imu& imu_msg);\n\n double FillImuData_LinearInterpolation(const stream_index_pair stream_index, const CIMUHistory::imuData imu_data, sensor_msgs::Imu& imu_msg);\n\n void imu_callback(rs2::frame frame);\n\n void imu_callback_sync(rs2::frame frame, imu_sync_method sync_method=imu_sync_method::COPY);\n\n void pose_callback(rs2::frame frame);\n\n void multiple_message_callback(rs2::frame frame, imu_sync_method sync_method);\n\n void frame_callback(rs2::frame frame);\n\n void registerDynamicOption(ros::NodeHandle& nh, rs2::options sensor, std::string& module_name);\n\n rs2_stream rs2_string_to_stream(std::string str);\n\n\n\n rs2::device _dev;\n\n std::map<stream_index_pair, rs2::sensor> _sensors;\n\n std::map<std::string, std::function<void(rs2::frame)>> _sensors_callback;\n\n std::vector<std::shared_ptr<ddynamic_reconfigure::DDynamicReconfigure>> _ddynrec;\n\n\n\n std::string _json_file_path;\n\n std::string _serial_no;\n\n float _depth_scale_meters;\n\n float _clipping_distance;\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/base_realsense_node.h", "rank": 15, "score": 40808.044077748644 }, { "content": " std::map<rs2_stream, std::string> _encoding;\n\n\n\n std::map<stream_index_pair, int> _seq;\n\n std::map<rs2_stream, int> _unit_step_size;\n\n std::map<stream_index_pair, sensor_msgs::CameraInfo> _camera_info;\n\n std::atomic_bool _is_initialized_time_base;\n\n double _camera_time_base;\n\n std::map<stream_index_pair, std::vector<rs2::stream_profile>> _enabled_profiles;\n\n\n\n ros::Publisher _pointcloud_publisher;\n\n ros::Time _ros_time_base;\n\n bool _sync_frames;\n\n bool _pointcloud;\n\n bool _publish_odom_tf;\n\n imu_sync_method _imu_sync_method;\n\n std::string _filters_str;\n\n stream_index_pair _pointcloud_texture;\n\n PipelineSyncer _syncer;\n\n std::vector<NamedFilter> _filters;\n\n std::vector<rs2::sensor> _dev_sensors;\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/base_realsense_node.h", "rank": 16, "score": 40804.194500413156 }, { "content": " bool _allow_no_texture_points;\n\n\n\n double _linear_accel_cov;\n\n double _angular_velocity_cov;\n\n bool _hold_back_imu_for_frames;\n\n\n\n std::map<stream_index_pair, rs2_intrinsics> _stream_intrinsics;\n\n std::map<stream_index_pair, int> _width;\n\n std::map<stream_index_pair, int> _height;\n\n std::map<stream_index_pair, int> _fps;\n\n std::map<stream_index_pair, bool> _enable;\n\n std::map<rs2_stream, std::string> _stream_name;\n\n tf2_ros::StaticTransformBroadcaster _static_tf_broadcaster;\n\n\n\n std::map<stream_index_pair, ImagePublisherWithFrequencyDiagnostics> _image_publishers;\n\n std::map<stream_index_pair, ros::Publisher> _imu_publishers;\n\n std::shared_ptr<SyncedImuPublisher> _synced_imu_publisher;\n\n std::map<rs2_stream, int> _image_format;\n\n std::map<stream_index_pair, ros::Publisher> _info_publisher;\n\n std::map<stream_index_pair, cv::Mat> _image;\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/base_realsense_node.h", "rank": 17, "score": 40802.39552450772 }, { "content": "// License: Apache 2.0. See LICENSE file in root directory.\n\n// Copyright(c) 2018 Intel Corporation. All Rights Reserved\n\n\n\n#pragma once\n\n\n\n#include <pluginlib/class_list_macros.h>\n\n#include <nodelet/nodelet.h>\n\n#include <image_transport/image_transport.h>\n\n#include <ros/ros.h>\n\n#include <ros/package.h>\n\n#include <librealsense2/rs.hpp>\n\n#include <librealsense2/rsutil.h>\n\n#include <librealsense2/hpp/rs_processing.hpp>\n\n#include <librealsense2/rs_advanced_mode.hpp>\n\n#include <cv_bridge/cv_bridge.h>\n\n#include <constants.h>\n\n#include <realsense2_camera/Extrinsics.h>\n\n#include <tf/transform_broadcaster.h>\n\n#include <tf2_ros/static_transform_broadcaster.h>\n\n#include <realsense2_camera/IMUInfo.h>\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/realsense_node_factory.h", "rank": 18, "score": 40802.2347338902 }, { "content": "// License: Apache 2.0. See LICENSE file in root directory.\n\n// Copyright(c) 2018 Intel Corporation. All Rights Reserved\n\n\n\n#pragma once\n\n\n\n#include \"../include/realsense_node_factory.h\"\n\n#include <ddynamic_reconfigure/ddynamic_reconfigure.h>\n\n#include <ddynamic_reconfigure/param/dd_all_params.h>\n\n\n\n#include <diagnostic_updater/diagnostic_updater.h>\n\n#include <diagnostic_updater/update_functions.h>\n\n#include <sensor_msgs/CameraInfo.h>\n\n#include <sensor_msgs/PointCloud2.h>\n\n#include <sensor_msgs/point_cloud2_iterator.h>\n\n#include <sensor_msgs/Imu.h>\n\n#include <nav_msgs/Odometry.h>\n\n\n\n#include <queue>\n\n#include <mutex>\n\n#include <atomic>\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/base_realsense_node.h", "rank": 19, "score": 40802.23194057435 }, { "content": "\n\nnamespace realsense2_camera\n\n{\n\n struct FrequencyDiagnostics\n\n {\n\n FrequencyDiagnostics(double expected_frequency, std::string name, std::string hardware_id) :\n\n expected_frequency_(expected_frequency),\n\n frequency_status_(diagnostic_updater::FrequencyStatusParam(&expected_frequency_, &expected_frequency_)),\n\n diagnostic_updater_(ros::NodeHandle(), ros::NodeHandle(\"~\"), ros::this_node::getName() + \"_\" + name)\n\n {\n\n ROS_INFO(\"Expected frequency for %s = %.5f\", name.c_str(), expected_frequency_);\n\n diagnostic_updater_.setHardwareID(hardware_id);\n\n diagnostic_updater_.add(frequency_status_);\n\n }\n\n\n\n void update()\n\n {\n\n frequency_status_.tick();\n\n diagnostic_updater_.update();\n\n }\n\n\n\n double expected_frequency_;\n\n diagnostic_updater::FrequencyStatus frequency_status_;\n\n diagnostic_updater::Updater diagnostic_updater_;\n\n };\n\n typedef std::pair<image_transport::Publisher, std::shared_ptr<FrequencyDiagnostics>> ImagePublisherWithFrequencyDiagnostics;\n\n\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/base_realsense_node.h", "rank": 20, "score": 40802.141448700684 }, { "content": "#pragma once\n\n\n\n#include <base_realsense_node.h>\n\n\n\nnamespace realsense2_camera\n\n{\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/t265_realsense_node.h", "rank": 21, "score": 40800.95252651928 }, { "content": "#include <csignal>\n\n#include <eigen3/Eigen/Geometry>\n\n#include <fstream>\n\n#include <thread>\n\n\n\nnamespace realsense2_camera\n\n{\n\n const stream_index_pair COLOR{RS2_STREAM_COLOR, 0};\n\n const stream_index_pair DEPTH{RS2_STREAM_DEPTH, 0};\n\n const stream_index_pair INFRA1{RS2_STREAM_INFRARED, 1};\n\n const stream_index_pair INFRA2{RS2_STREAM_INFRARED, 2};\n\n const stream_index_pair FISHEYE{RS2_STREAM_FISHEYE, 0};\n\n const stream_index_pair FISHEYE1{RS2_STREAM_FISHEYE, 1};\n\n const stream_index_pair FISHEYE2{RS2_STREAM_FISHEYE, 2};\n\n const stream_index_pair GYRO{RS2_STREAM_GYRO, 0};\n\n const stream_index_pair ACCEL{RS2_STREAM_ACCEL, 0};\n\n const stream_index_pair POSE{RS2_STREAM_POSE, 0};\n\n \n\n\n\n const std::vector<stream_index_pair> IMAGE_STREAMS = {DEPTH, INFRA1, INFRA2,\n\n COLOR,\n\n FISHEYE,\n\n FISHEYE1, FISHEYE2};\n\n\n\n const std::vector<stream_index_pair> HID_STREAMS = {GYRO, ACCEL, POSE};\n\n\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/realsense_node_factory.h", "rank": 22, "score": 40800.922968044775 }, { "content": " std::map<rs2_stream, std::shared_ptr<rs2::align>> _align;\n\n\n\n std::map<stream_index_pair, cv::Mat> _depth_aligned_image;\n\n std::map<stream_index_pair, cv::Mat> _depth_scaled_image;\n\n std::map<rs2_stream, std::string> _depth_aligned_encoding;\n\n std::map<stream_index_pair, sensor_msgs::CameraInfo> _depth_aligned_camera_info;\n\n std::map<stream_index_pair, int> _depth_aligned_seq;\n\n std::map<stream_index_pair, ros::Publisher> _depth_aligned_info_publisher;\n\n std::map<stream_index_pair, ImagePublisherWithFrequencyDiagnostics> _depth_aligned_image_publishers;\n\n std::map<stream_index_pair, ros::Publisher> _depth_to_other_extrinsics_publishers;\n\n std::map<stream_index_pair, rs2_extrinsics> _depth_to_other_extrinsics;\n\n\n\n const std::string _namespace;\n\n\n\n };//end class\n\n\n\n}\n\n\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/base_realsense_node.h", "rank": 23, "score": 40799.7916486708 }, { "content": " * for native strings: if the string contains a floating value (for example \"1.1\" contains the double '1.1' in it),\n\n * it will return the double interpretation of that string.\n\n * Otherwise, returns the hash value of the string.\n\n */\n\n inline double toDouble() const {\n\n if(type_ == \"string\") {\n\n double f;\n\n if(sscanf(str_val_.c_str(), \"%lf\", &f) == 0) {\n\n return boost::hash<string>()(str_val_);\n\n }\n\n return f;\n\n } else if(type_ == \"bool\") {return bool_val_ ? 1.0 : 0.0;}\n\n else if(type_ == \"double\") {return double_val_;}\n\n else {return int_val_;}\n\n }\n\n\n\n /**\n\n * @brief converts the stored value into a boolean.\n\n * @return for native integers: returns true if the value is bigger than 0, false otherwise.\n\n * for native doubles: returns true if the value is bigger than 0, false otherwise.\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/dd_value.h", "rank": 24, "score": 39943.171221738514 }, { "content": "//\n\n// Created by Noam Dori on 19/06/18.\n\n//\n\n#include <string>\n\n#include <sstream>\n\n#include <cstdio>\n\n#include <boost/functional/hash.hpp>\n\n\n\n#ifndef DDYNAMIC_RECONFIGURE_DD_VALUE_H\n\n#define DDYNAMIC_RECONFIGURE_DD_VALUE_H\n\nusing namespace std;\n\nusing namespace boost;\n\nnamespace ddynamic_reconfigure {\n\n /**\n\n * @brief The Value class is used to wrap all basic data-types (bool,int,double,string) in something generic.\n\n * The value object always stores an explicit basic data-type.\n\n * This has three main uses:\n\n *\n\n * 1. Values can represent all basic data-types.\n\n * This means that arguments that need something relatively similar from all basic data-types can now just use the value in its argument.\n\n * This also goes for when you need to return something that is of different data-types from different classes\n\n * (one can only return integer, other can only return strings).\n\n *\n\n * 2. Values can be explicitly converted to all basic data-types they wrap.\n\n * This means that converting an int to a string is far easier.\n\n *\n\n * 3. Values store the type they were instantiated with. This can be tested against to get the original piece of data the value stored.\n\n */\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/dd_value.h", "rank": 25, "score": 39938.77387158079 }, { "content": " * for native booleans: returns itself\n\n * for native strings: returns true if the string's value is 'true', false otherwise.\n\n */\n\n inline bool toBool() const {\n\n if(type_ == \"string\") { return str_val_ == \"true\";}\n\n else if(type_ == \"bool\") {return bool_val_;}\n\n else if(type_ == \"double\") {return double_val_ > 0.0;}\n\n else {return int_val_ > 0;}\n\n }\n\n };\n\n}\n\n\n\n#endif //DDYNAMIC_RECONFIGURE_DD_VALUE_H\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/dd_value.h", "rank": 26, "score": 39938.08980184785 }, { "content": " }\n\n\n\n /**\n\n * @brief creates an integer value wrapper\n\n * @param val the boolean to wrap\n\n */\n\n inline explicit Value(bool val) : int_val_(0), double_val_(0.0) {\n\n type_ = \"bool\";\n\n bool_val_ = val;\n\n }\n\n\n\n /**\n\n * @brief gets the type this value wrapper stores\n\n * @return a string containing the type: one of {\"int\",\"double\",\"bool\",\"string\"}\n\n */\n\n inline string getType() const {\n\n return type_;\n\n }\n\n\n\n /**\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/dd_value.h", "rank": 27, "score": 39937.85480458831 }, { "content": " inline explicit Value(double val) : int_val_(0), bool_val_(false) {\n\n type_ = \"double\";\n\n double_val_ = val;\n\n }\n\n\n\n /**\n\n * @brief creates a string value wrapper\n\n * @param val the string to wrap\n\n */\n\n inline explicit Value(const string &val) : int_val_(0), double_val_(0.0), bool_val_(false) {\n\n type_ = \"string\";\n\n str_val_ = val;\n\n }\n\n\n\n /**\n\n * @brief creates a c-string value wrapper, though it is considered a regular string.\n\n * @param val the c-string to wrap\n\n */\n\n inline explicit Value(const char* val) : int_val_(0), double_val_(0.0), bool_val_(false) {\n\n *this = Value(string(val));\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/dd_value.h", "rank": 28, "score": 39937.64422929807 }, { "content": " /**\n\n * @brief converts the stored value into a string.\n\n * @return for native integers: returns the number in string form ('1' -> \"1\")\n\n * for native doubles: returns the number in shorthand string form ('1.0' -> \"1\")\n\n * for native booleans: returns \"true\" if true, \"false\" if false.\n\n * for native strings: returns itself.\n\n */\n\n inline string toString() const {\n\n stringstream ss;\n\n if(type_ == \"string\") { return str_val_;}\n\n else if(type_ == \"bool\") {return bool_val_ ? \"true\" : \"false\";}\n\n else if(type_ == \"double\") {ss << double_val_; return ss.str();}\n\n else {ss << int_val_; return ss.str();}\n\n }\n\n\n\n /**\n\n * @brief converts the stored value into a double.\n\n * @return for native integers: returns itself\n\n * for native doubles: returns a itself\n\n * for native booleans: returns 1.0 if true, 0.0 if false.\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/dd_value.h", "rank": 29, "score": 39937.21356079122 }, { "content": " * @brief converts the stored value into an integer.\n\n * @return for native integers: returns itself.\n\n * for native doubles: returns a casted integer.\n\n * for native booleans: returns 1 if true, 0 if false.\n\n * for native strings: if the string contains an integer value (for example \"1\" contains the int '1' in it),\n\n * it will return the integer interpretation of that string.\n\n * Otherwise, returns the hash value of the string.\n\n */\n\n inline int toInt() const {\n\n if (type_ == \"string\") {\n\n int i;\n\n if (sscanf(str_val_.c_str(), \"%d\", &i) == 0) {\n\n return (int) boost::hash<string>()(str_val_);\n\n }\n\n return i;\n\n } else if (type_ == \"bool\") { return bool_val_ ? 1 : 0; }\n\n else if (type_ == \"double\") { return (int) double_val_; }\n\n else { return int_val_; }\n\n }\n\n\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/dd_value.h", "rank": 30, "score": 39937.18297174609 }, { "content": "//\n\n// Created by Noam Dori on 18/06/18.\n\n//\n\n//include space, written in C++03\n\n#include <ros/ros.h>\n\n#include <dynamic_reconfigure/server.h>\n\n\n\n#include <string>\n\n#include <vector>\n\n#include <map>\n\n\n\n#include <boost/shared_ptr.hpp>\n\n#include <boost/function.hpp>\n\n#include <boost/bind.hpp>\n\n\n\n#include \"dd_param.h\"\n\nusing namespace std;\n\nusing namespace boost;\n\nusing namespace dynamic_reconfigure;\n\n\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/ddynamic_reconfigure.h", "rank": 31, "score": 39936.880291619134 }, { "content": "//\n\n// Created by Noam Dori on 18/06/18.\n\n//\n\n\n\n#ifndef DDYNAMIC_RECONFIGURE_DD_PARAM_H\n\n#define DDYNAMIC_RECONFIGURE_DD_PARAM_H\n\n\n\n#include <string>\n\n#include <dynamic_reconfigure/Group.h>\n\n#include <dynamic_reconfigure/Config.h>\n\n#include <dynamic_reconfigure/ConfigDescription.h>\n\n#include \"dd_value.h\"\n\n\n\nusing namespace dynamic_reconfigure;\n\nusing namespace std;\n\nnamespace ddynamic_reconfigure {\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/dd_param.h", "rank": 32, "score": 39936.558120903646 }, { "content": " */\n\n virtual void add(DDParam *param);\n\n\n\n /**\n\n * removes the specified parameter from the list.\n\n * @param param the parameter to remove.\n\n */\n\n virtual void remove(DDPtr param);\n\n\n\n /**\n\n * removes the specified parameter from the list.\n\n * @param param the parameter to remove.\n\n */\n\n virtual void remove(DDParam *param);\n\n\n\n /**\n\n * removes the specified parameter from the list.\n\n * @param param_name the name of the parameter to remove.\n\n */\n\n virtual void remove(string param_name);\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/ddynamic_reconfigure.h", "rank": 33, "score": 39935.96973014908 }, { "content": " * While DDParam is abstract, all of its concrete implementations should follow this guideline:\n\n * DD<Type>(const string &name, unsigned int level, const string &description, <type> def, <extra-args>)\n\n * Where:\n\n * - <Type> is the type name you are implementing\n\n * - name is the reference name\n\n * - level is the severity level\n\n * - description is the object's description\n\n * - def is the default value and the first value stored right after construction.\n\n *\n\n * You may then include extra arguments as you wish, required or optional.\n\n */\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/dd_param.h", "rank": 34, "score": 39935.58460999948 }, { "content": " */\n\n void start(DDFunc callback);\n\n\n\n /**\n\n * @brief starts the server, using the given callback in method form.\n\n * @param callback a void pointer accepting a callback type with the method to use when values are updated.\n\n */\n\n void start(void(*callback)(const DDMap&, int));\n\n\n\n /**\n\n * @brief starts the server, using the given callback in class-wise static method form.\n\n * @param callback a class void pointer accepting a callback type with the method to use when values are updated.\n\n * @param obj the object used for reference in the class void\n\n * @tparam T the class of the object.\n\n */\n\n template<class T>\n\n void start(void(T::*callback)(const DDMap&, int), T *obj) {\n\n DDFunc f = bind(callback,obj,_1,_2);\n\n start();\n\n }\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/ddynamic_reconfigure.h", "rank": 35, "score": 39933.268400506815 }, { "content": "\n\n /**\n\n * @brief sets the callback to this.\n\n * @param callback a boost function with the method to use when values are updated.\n\n */\n\n void setCallback(DDFunc callback);\n\n\n\n /**\n\n * @brief sets the callback to be empty.\n\n */\n\n void clearCallback();\n\n\n\n /**\n\n * @brief starts the server and config, without having any callback.\n\n */\n\n virtual void start();\n\n\n\n /**\n\n * @brief starts the server, using the given callback in function form.\n\n * @param callback a boost function with the method to use when values are updated.\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/ddynamic_reconfigure.h", "rank": 36, "score": 39932.68245881599 }, { "content": " * @param val the value to use\n\n */\n\n virtual void setValue(Value val) = 0;\n\n\n\n /**\n\n * @brief updates a group message according to this param's info.\n\n * @param group the group to update.\n\n * @note this is an internal method. It is recommended not to use it.\n\n */\n\n virtual void prepGroup(Group &group) = 0;\n\n\n\n /**\n\n * @brief updates a config message according to this param's info.\n\n * @param conf the group to update.\n\n * @note this is an internal method. It is recommended not to use it.\n\n */\n\n virtual void prepConfig(Config &conf) = 0;\n\n\n\n /**\n\n * @brief updates a config description message according to this param's info.\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/dd_param.h", "rank": 37, "score": 39932.487202895674 }, { "content": "#ifndef DDYNAMIC_RECONFIGURE_DDYNAMIC_RECONFIGURE_H\n\n#define DDYNAMIC_RECONFIGURE_DDYNAMIC_RECONFIGURE_H\n\nnamespace ddynamic_reconfigure {\n\n // this is a map from the DDParam name to the object. Acts like a set with a search function.\n\n typedef map<string,DDPtr> DDMap;\n\n // the function you will use a lot\n\n typedef boost::function<void(const DDMap&,int)> DDFunc;\n\n\n\n /**\n\n * @brief The DDynamicReconfigure class is the main class responsible for keeping track of parameters basic properties,\n\n * values, descriptions, etc.\n\n *\n\n * It is also responsible of handling callbacks, config change requests, description setup and config setup,\n\n * and the ROS publishers and services.\n\n *\n\n * To operate a DDynamic instance, you must go through the following procedure:\n\n *\n\n * 1. Construct a DDynamicReconfigure instance with proper handling.\n\n * 2. Add parameters to the instance as needed with any of the \"add\" methods.\n\n * 3. Start the ROS services with any of the \"start\" methods.\n\n * 4. If you need to change the callback after startup you may do so using \"setCallback\".\n\n * 5. When you need to get any of the stored parameters, call either \"get\" or \"at\" on this instance,\n\n * rather than through the callback.\n\n */\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/ddynamic_reconfigure.h", "rank": 38, "score": 39932.409006991445 }, { "content": "\n\n /**\n\n * @brief a tool people who use this API can use to find the value given within the param map.\n\n * @param name the string to look for\n\n * @return the value of param with the given name if it exists, a string value containing \"\\000\" otherwise\n\n */\n\n Value get(const char* name);\n\n\n\n /**\n\n * @brief a tool people who use this API can use to find the param given within the param map.\n\n * @param name the string to look for\n\n * @return the param with the given name if it exists, nullptr otherwise\n\n */\n\n DDPtr at(const char* name);\n\n\n\n /**\n\n * @brief the operator taking care of streaming the param values\n\n * @param os the stream to place the param into\n\n * @param dd the dd-reconfigure you want to place into the stream\n\n * @return os, but with dd-reconfigure added.\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/ddynamic_reconfigure.h", "rank": 39, "score": 39932.21247917293 }, { "content": " };\n\n\n\n /**\n\n * @brief a tool people who use this API can use to find the param given within the param map.\n\n * @param name the string to look for\n\n * @param map the map to search\n\n * @return the param with the given name if it exists, nullptr otherwise\n\n */\n\n DDPtr at(const DDMap& map, const char* name); // I could do this with an operator, but its bad design.\n\n\n\n /**\n\n * @brief a tool people who use this API can use to find the value given within the param map.\n\n * @param name the string to look for\n\n * @param map the map to search\n\n * @return the value of param with the given name if it exists, a string value containing \"\\000\" otherwise\n\n */\n\n Value get(const DDMap& map, const char* name); // I could do this with an operator, but its bad design.\n\n}\n\n#endif //DDYNAMIC_RECONFIGURE_DDYNAMIC_RECONFIGURE_H\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/ddynamic_reconfigure.h", "rank": 40, "score": 39932.18891667058 }, { "content": " \n\n /**\n\n * @brief checks whether or not the raw value stored in the value is compatible with the given parameter.\n\n * Compatible is a very broad word in this scenario.\n\n * It means that the value can be placed in the parameter regardless of other limitations.\n\n * @param val the value to test\n\n * @return true is this parameter can handle the original value, false otherwise.\n\n */\n\n virtual bool sameType(Value val) = 0;\n\n \n\n /**\n\n * @brief checks whether or not the value stored in the value object,\n\n * when converted to the type of the internal value, are equal. This acts regardless of type.\n\n * @param val the value to test\n\n * @return true is this parameter can is the same as the original value, false otherwise.\n\n */\n\n virtual bool sameValue(Value val) = 0;\n\n\n\n /**\n\n * @brief sets the value of this parameter as this one.\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/dd_param.h", "rank": 41, "score": 39931.9393438403 }, { "content": " * @param conf_desc the config description to update.\n\n * @note this is an internal method. It is recommended not to use it.\n\n */\n\n virtual void prepConfigDescription(ConfigDescription &conf_desc) = 0;\n\n\n\n /**\n\n * @brief the operator taking care of streaming the param values\n\n * @param os the stream to place the param into\n\n * @param param the param you want to place into the stream\n\n * @return os, but with param added.\n\n */\n\n friend ostream& operator<<(ostream& os, const DDParam &param);\n\n };\n\n}\n\n#endif //DDYNAMIC_RECONFIGURE_DD_PARAM_H\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/dd_param.h", "rank": 42, "score": 39931.128996280655 }, { "content": "\n\n private:\n\n\n\n /**\n\n * @brief reassigns a value to the internal map assuming it is registered.\n\n * @param map the map that is being edited\n\n * @param name the name of the parameter to test\n\n * @param value the value of the new parameter\n\n * @tparam T the type of value\n\n * @return -1 if the value could not be reassigned,\n\n * 0 if the value was not changed,\n\n * otherwise the level of the parameter changed.\n\n */\n\n template <class T>\n\n static int reassign(DDMap& map, const string &name, T value);\n\n\n\n /**\n\n * @brief gets the updates and assigns them to DDMap\n\n * @param req the ROS request holding info about the new map\n\n * @param config the map to update\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/ddynamic_reconfigure.h", "rank": 43, "score": 39930.95230915641 }, { "content": " * @param rsp ----(ROS)\n\n * @return -------(ROS)\n\n * @note this is here so that deriving methods can call the internal callback.\n\n */\n\n static bool internalCallback(DDynamicReconfigure *obj, Reconfigure::Request &req, Reconfigure::Response &rsp);\n\n\n\n /**\n\n * @brief the ROS node handler to use to make everything ROS related.\n\n */\n\n ros::NodeHandle nh_;\n\n /**\n\n * @brief a map of all contained parameters.\n\n */\n\n DDMap params_;\n\n /**\n\n * @brief the publisher responsible for updating the descriptions of the parameter for commandline (desc_pub_),\n\n * and the publisher responsible for updating the configuration values for commandline and client (update_pub_).\n\n * desc_pub_ publishes to \"parameter_descriptions\", and update_pub_ publishes to \"/parameter_updates\".\n\n */\n\n ros::Publisher desc_pub_, update_pub_;\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/ddynamic_reconfigure.h", "rank": 44, "score": 39930.800834387286 }, { "content": " class float3\n\n {\n\n public:\n\n float x, y, z;\n\n\n\n public:\n\n float3& operator*=(const float& factor)\n\n {\n\n x*=factor;\n\n y*=factor;\n\n z*=factor;\n\n return (*this);\n\n }\n\n float3& operator+=(const float3& other)\n\n {\n\n x+=other.x;\n\n y+=other.y;\n\n z+=other.z;\n\n return (*this);\n\n }\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/base_realsense_node.h", "rank": 45, "score": 39928.13823910353 }, { "content": " * @return the level of change (integer)\n\n */\n\n int getUpdates(const Reconfigure::Request &req, DDMap &config);\n\n\n\n /**\n\n * @brief the use defined callback to call when parameters are updated.\n\n */\n\n boost::shared_ptr<DDFunc> callback_;\n\n #ifdef __clang__\n\n #pragma clang diagnostic push // CLion suppressor\n\n #pragma ide diagnostic ignored \"OCUnusedGlobalDeclarationInspection\"\n\n #endif\n\n /**\n\n * @brief the service server used to trigger parameter updates.\n\n * It also contains the new parameters sent from client or commandline.\n\n */\n\n ros::ServiceServer set_service_;\n\n #ifdef __clang__\n\n #pragma clang diagnostic pop\n\n #endif\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/ddynamic_reconfigure.h", "rank": 46, "score": 39928.13823910353 }, { "content": " */\n\n friend ostream& operator<<(ostream& os, const DDynamicReconfigure &dd);\n\n protected:\n\n\n\n /**\n\n * @brief makes the config descriptions for publishing\n\n * @return a ROS message of type ConfigDescription\n\n */\n\n ConfigDescription makeDescription();\n\n\n\n /**\n\n * @brief makes the config update for publishing\n\n * @return a ROS message of type Config\n\n */\n\n Config makeConfig();\n\n\n\n /**\n\n * @brief calls the internal callback for the low-level service, not exposed to us.\n\n * @param obj the object we are using for its callback.\n\n * @param req ----(ROS)\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/ddynamic_reconfigure.h", "rank": 47, "score": 39928.13823910353 }, { "content": "//\n\n// Created by Noam Dori on 19/06/18.\n\n//\n\n\n\n#include <ddynamic_reconfigure/param/dd_bool_param.h>\n\n\n\nnamespace ddynamic_reconfigure {\n\n string DDBool::getName() const {\n\n return name_;\n\n }\n\n\n\n void DDBool::prepGroup(Group &group) {\n\n ParamDescription desc;\n\n desc.name = name_;\n\n desc.level = level_;\n\n desc.description = desc_;\n\n desc.type = \"bool\";\n\n group.parameters.push_back(desc);\n\n }\n\n\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/src/param/dd_bool_param.cpp", "rank": 48, "score": 39623.253580397504 }, { "content": "//\n\n// Created by Noam Dori on 19/06/18.\n\n//\n\n\n\n#include <ddynamic_reconfigure/param/dd_double_param.h>\n\n\n\nnamespace ddynamic_reconfigure {\n\n string DDDouble::getName() const {\n\n return name_;\n\n }\n\n\n\n void DDDouble::prepGroup(Group &group) {\n\n ParamDescription desc;\n\n desc.name = name_;\n\n desc.level = level_;\n\n desc.description = desc_;\n\n desc.type = \"double\";\n\n group.parameters.push_back(desc);\n\n }\n\n\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/src/param/dd_double_param.cpp", "rank": 49, "score": 39623.072363376676 }, { "content": " }\n\n\n\n bool DDDouble::sameType(Value val) {\n\n return val.getType() == \"double\";\n\n }\n\n\n\n bool DDDouble::sameValue(Value val) {\n\n return val.toDouble() == val_;\n\n }\n\n\n\n void DDDouble::setValue(Value val) {\n\n val_ = val.toDouble();\n\n }\n\n\n\n Value DDDouble::getValue() const {\n\n return Value(val_);\n\n }\n\n}\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/src/param/dd_double_param.cpp", "rank": 50, "score": 39621.95583245896 }, { "content": " }\n\n\n\n bool DDString::sameType(Value val) {\n\n return val.getType() == \"string\";\n\n }\n\n\n\n bool DDString::sameValue(Value val) {\n\n return val.toString() == val_;\n\n }\n\n\n\n void DDString::setValue(Value val) {\n\n val_ = val.toString();\n\n }\n\n\n\n Value DDString::getValue() const {\n\n return Value(val_);\n\n }\n\n}\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/src/param/dd_string_param.cpp", "rank": 51, "score": 39621.7342525261 }, { "content": "//\n\n// Created by Noam Dori on 19/06/18.\n\n//\n\n\n\n#include <ddynamic_reconfigure/param/dd_string_param.h>\n\n\n\nnamespace ddynamic_reconfigure {\n\n string DDString::getName() const {\n\n return name_;\n\n }\n\n\n\n void DDString::prepGroup(Group &group) {\n\n ParamDescription desc;\n\n desc.name = name_;\n\n desc.level = level_;\n\n desc.description = desc_;\n\n desc.type = \"string\";\n\n group.parameters.push_back(desc);\n\n }\n\n\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/src/param/dd_string_param.cpp", "rank": 52, "score": 39620.11534387237 }, { "content": " }\n\n\n\n bool DDBool::sameType(Value val) {\n\n return val.getType() == \"bool\";\n\n }\n\n\n\n bool DDBool::sameValue(Value val) {\n\n return val.toBool() == val_;\n\n }\n\n\n\n void DDBool::setValue(Value val) {\n\n val_ = val.toBool();\n\n }\n\n\n\n Value DDBool::getValue() const {\n\n return Value(val_);\n\n }\n\n}\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/src/param/dd_bool_param.cpp", "rank": 53, "score": 39617.645744029105 }, { "content": " void DDBool::prepConfig(Config &conf) {\n\n BoolParameter param;\n\n param.name = name_;\n\n param.value = (unsigned char)val_;\n\n conf.bools.push_back(param);\n\n }\n\n\n\n void DDBool::prepConfigDescription(ConfigDescription &conf_desc) {\n\n BoolParameter param;\n\n param.name = name_;\n\n param.value = (unsigned char)def_;\n\n conf_desc.dflt.bools.push_back(param);\n\n param.value = (unsigned char)true;\n\n conf_desc.max.bools.push_back(param);\n\n param.value = (unsigned char)false;\n\n conf_desc.min.bools.push_back(param);\n\n }\n\n\n\n int DDBool::getLevel() const {\n\n return level_;\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/src/param/dd_bool_param.cpp", "rank": 54, "score": 39617.551380107805 }, { "content": " void DDDouble::prepConfig(Config &conf) {\n\n DoubleParameter param;\n\n param.name = name_;\n\n param.value = val_;\n\n conf.doubles.push_back(param);\n\n }\n\n\n\n void DDDouble::prepConfigDescription(ConfigDescription &conf_desc) {\n\n DoubleParameter param;\n\n param.name = name_;\n\n param.value = def_;\n\n conf_desc.dflt.doubles.push_back(param);\n\n param.value = max_;\n\n conf_desc.max.doubles.push_back(param);\n\n param.value = min_;\n\n conf_desc.min.doubles.push_back(param);\n\n }\n\n\n\n int DDDouble::getLevel() const {\n\n return level_;\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/src/param/dd_double_param.cpp", "rank": 55, "score": 39617.35601553404 }, { "content": " void DDString::prepConfig(Config &conf) {\n\n StrParameter param;\n\n param.name = name_;\n\n param.value = val_;\n\n conf.strs.push_back(param);\n\n }\n\n\n\n void DDString::prepConfigDescription(ConfigDescription &conf_desc) {\n\n StrParameter param;\n\n param.name = name_;\n\n param.value = def_;\n\n conf_desc.dflt.strs.push_back(param);\n\n param.value = \"\";\n\n conf_desc.max.strs.push_back(param);\n\n param.value = \"\";\n\n conf_desc.min.strs.push_back(param);\n\n }\n\n\n\n int DDString::getLevel() const {\n\n return level_;\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/src/param/dd_string_param.cpp", "rank": 56, "score": 39616.594630713254 }, { "content": " class CIMUHistory\n\n {\n\n public:\n\n enum sensor_name {mGYRO, mACCEL};\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/base_realsense_node.h", "rank": 57, "score": 39095.89808604912 }, { "content": " class Value {\n\n private:\n\n int int_val_;\n\n string str_val_, type_;\n\n double double_val_;\n\n bool bool_val_;\n\n public:\n\n /**\n\n * @brief creates an integer value wrapper\n\n * @param val the int to wrap\n\n */\n\n inline explicit Value(int val) : double_val_(0.0), bool_val_(false) {\n\n type_ = \"int\";\n\n int_val_ = val;\n\n }\n\n\n\n /**\n\n * @brief creates an double value wrapper\n\n * @param val the double to wrap\n\n */\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/dd_value.h", "rank": 58, "score": 39095.89808604912 }, { "content": " class imuData\n\n {\n\n public:\n\n imuData(const imuData& other):\n\n imuData(other.m_reading, other.m_time)\n\n {};\n\n imuData(const float3 reading, double time):\n\n m_reading(reading),\n\n m_time(time)\n\n {};\n\n imuData operator*(const double factor);\n\n imuData operator+(const imuData& other);\n\n public:\n\n BaseRealSenseNode::float3 m_reading;\n\n double m_time;\n\n };\n\n \n\n private:\n\n size_t m_max_size;\n\n std::map<sensor_name, std::list<imuData> > m_map;\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/base_realsense_node.h", "rank": 59, "score": 39095.89808604912 }, { "content": " class NamedFilter\n\n {\n\n public:\n\n std::string _name;\n\n std::shared_ptr<rs2::filter> _filter;\n\n\n\n public:\n\n NamedFilter(std::string name, std::shared_ptr<rs2::filter> filter):\n\n _name(name), _filter(filter)\n\n {}\n\n };\n\n\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/base_realsense_node.h", "rank": 60, "score": 39095.89808604912 }, { "content": "#include <ros/ros.h>\n\n#include <gtest/gtest.h>\n\n#include <ddynamic_reconfigure/param/dd_double_param.h>\n\n\n\nnamespace ddynamic_reconfigure {\n\n\n\n /**\n\n * @brief preliminary test which makes sure we can use the object.\n\n */\n\n TEST(DDDoubleTest, constructorTest) { // NOLINT(cert-err58-cpp,modernize-use-equals-delete)\n\n DDDouble param1(\"param1\",0,\"param1\",0.5);\n\n DDDouble param2(\"\",0,\"\",1,10);\n\n DDDouble param3(\"\\000\",0,\"\\000\", -0, -3.4e100, 43.5e20); // NOLINT(bugprone-string-literal-with-embedded-nul)\n\n }\n\n\n\n /**\n\n * @brief a test making sure we can handle all API for handling the values of the param\n\n */\n\n TEST(DDDoubleTest, valueTest) { // NOLINT(cert-err58-cpp,modernize-use-equals-delete)\n\n DDDouble param(\"dd_param\",0,\"dd_param\",1);\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/test/dd_param/test_dd_double.cpp", "rank": 61, "score": 38811.77552310516 }, { "content": "#include <ros/ros.h>\n\n#include <gtest/gtest.h>\n\n#include <ddynamic_reconfigure/param/dd_bool_param.h>\n\n\n\nnamespace ddynamic_reconfigure {\n\n\n\n /**\n\n * @brief preliminary test which makes sure we can use the object.\n\n */\n\n TEST(DDBoolTest, constructorTest) { // NOLINT(cert-err58-cpp,modernize-use-equals-delete)\n\n DDBool param1(\"param1\",0,\"param1\",true);\n\n DDBool param2(\"\",0,\"\",false);\n\n DDBool param3(\"\\000\",0,\"\\000\",false); // NOLINT(bugprone-string-literal-with-embedded-nul)\n\n }\n\n\n\n /**\n\n * @brief a test making sure we can handle all API for handling the values of the param\n\n */\n\n TEST(DDBoolTest, valueTest) { // NOLINT(cert-err58-cpp,modernize-use-equals-delete)\n\n DDBool param(\"dd_param\",0,\"dd_param\",true);\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/test/dd_param/test_dd_bool.cpp", "rank": 62, "score": 38811.60646859969 }, { "content": "#include <ros/ros.h>\n\n#include <gtest/gtest.h>\n\n#include <ddynamic_reconfigure/param/dd_string_param.h>\n\n\n\nnamespace ddynamic_reconfigure {\n\n\n\n /**\n\n * @brief preliminary test which makes sure we can use the object.\n\n */\n\n TEST(DDStringTest, constructorTest) { // NOLINT(cert-err58-cpp,modernize-use-equals-delete)\n\n DDString param1(\"param1\",0,\"param1\",\"Hello World\");\n\n DDString param2(\"\",0,\"\",\"\");\n\n DDString param3(\"\\000\",0,\"\\000\",\"\\000\"); // NOLINT(bugprone-string-literal-with-embedded-nul)\n\n }\n\n\n\n /**\n\n * @brief a test making sure we can handle all API for handling the values of the param\n\n */\n\n TEST(DDStringTest, valueTest) { // NOLINT(cert-err58-cpp,modernize-use-equals-delete)\n\n DDString param(\"dd_param\",0,\"param1\",\"1\");\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/test/dd_param/test_dd_string.cpp", "rank": 63, "score": 38809.15094982345 }, { "content": "\n\n ASSERT_TRUE(param.getValue().getType() == \"bool\");\n\n ASSERT_TRUE(param.sameValue(Value(false)));\n\n }\n\n\n\n TEST(DDBoolTest, streamTest) { // NOLINT(cert-err58-cpp,modernize-use-equals-delete)\n\n DDBool param1(\"param1\",0,\"param1\",true);\n\n stringstream stream;\n\n stream << param1;\n\n ASSERT_EQ(param1.getName() + \":\" + param1.getValue().toString(),stream.str());\n\n }\n\n}\n\n\n\n\n\nint main(int argc, char** argv) {\n\n testing::InitGoogleTest(&argc, argv);\n\n\n\n srand((unsigned int)random());\n\n\n\n return RUN_ALL_TESTS();\n\n}", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/test/dd_param/test_dd_bool.cpp", "rank": 64, "score": 38807.07701577213 }, { "content": "\n\n ASSERT_TRUE(param.getValue().getType() == \"double\");\n\n ASSERT_TRUE(param.sameValue(Value(2)));\n\n }\n\n\n\n TEST(DDDoubleTest, streamTest) { // NOLINT(cert-err58-cpp,modernize-use-equals-delete)\n\n DDDouble param1(\"param1\",0,\"param1\",1.0);\n\n stringstream stream;\n\n stream << param1;\n\n ASSERT_EQ(param1.getName() + \":\" + param1.getValue().toString(),stream.str());\n\n }\n\n}\n\n\n\n\n\nint main(int argc, char** argv) {\n\n testing::InitGoogleTest(&argc, argv);\n\n\n\n srand((unsigned int)random());\n\n\n\n return RUN_ALL_TESTS();\n\n}", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/test/dd_param/test_dd_double.cpp", "rank": 65, "score": 38806.689695833404 }, { "content": "\n\n ASSERT_TRUE(param.getValue().getType() == \"string\");\n\n ASSERT_TRUE(param.sameValue(Value(\"2\")));\n\n }\n\n\n\n TEST(DDStringTest, streamTest) { // NOLINT(cert-err58-cpp,modernize-use-equals-delete)\n\n DDString param1(\"param1\",0,\"param1\",\"Hello World\");\n\n stringstream stream;\n\n stream << param1;\n\n ASSERT_EQ(param1.getName() + \":\" + param1.getValue().toString(),stream.str());\n\n }\n\n}\n\n\n\n\n\nint main(int argc, char** argv) {\n\n testing::InitGoogleTest(&argc, argv);\n\n\n\n srand((unsigned int)random());\n\n\n\n return RUN_ALL_TESTS();\n\n}", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/test/dd_param/test_dd_string.cpp", "rank": 66, "score": 38804.49949413581 }, { "content": " // we won't do any tests on getLevel or getName, as those are implicit.\n\n Value v(\"1\");\n\n ASSERT_TRUE(param.sameType(v));\n\n ASSERT_TRUE(param.sameValue(v));\n\n\n\n v = Value(1);\n\n ASSERT_FALSE(param.sameType(v));\n\n ASSERT_TRUE(param.sameValue(v));\n\n\n\n v = Value(\"2\");\n\n ASSERT_TRUE(param.sameType(v));\n\n ASSERT_FALSE(param.sameValue(v));\n\n\n\n v = Value(2);\n\n ASSERT_FALSE(param.sameType(v));\n\n ASSERT_FALSE(param.sameValue(v));\n\n\n\n param.setValue(v);\n\n v = Value(\"3\");\n\n ASSERT_FALSE(param.sameValue(v)); // makes sure anti-aliasing happens\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/test/dd_param/test_dd_string.cpp", "rank": 67, "score": 38799.952523898326 }, { "content": " // we won't do any tests on getLevel or getName, as those are implicit.\n\n Value v(true);\n\n ASSERT_TRUE(param.sameType(v));\n\n ASSERT_TRUE(param.sameValue(v));\n\n\n\n v = Value(1);\n\n ASSERT_FALSE(param.sameType(v));\n\n ASSERT_TRUE(param.sameValue(v));\n\n\n\n v = Value(false);\n\n ASSERT_TRUE(param.sameType(v));\n\n ASSERT_FALSE(param.sameValue(v));\n\n\n\n v = Value(0);\n\n ASSERT_FALSE(param.sameType(v));\n\n ASSERT_FALSE(param.sameValue(v));\n\n\n\n param.setValue(v);\n\n v = Value(true);\n\n ASSERT_FALSE(param.sameValue(v)); // makes sure anti-aliasing happens\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/test/dd_param/test_dd_bool.cpp", "rank": 68, "score": 38799.952523898326 }, { "content": " // we won't do any tests on getLevel or getName, as those are implicit.\n\n Value v(1.0);\n\n ASSERT_TRUE(param.sameType(v));\n\n ASSERT_TRUE(param.sameValue(v));\n\n\n\n v = Value(1);\n\n ASSERT_FALSE(param.sameType(v));\n\n ASSERT_TRUE(param.sameValue(v));\n\n\n\n v = Value(2.0);\n\n ASSERT_TRUE(param.sameType(v));\n\n ASSERT_FALSE(param.sameValue(v));\n\n\n\n v = Value(2);\n\n ASSERT_FALSE(param.sameType(v));\n\n ASSERT_FALSE(param.sameValue(v));\n\n\n\n param.setValue(v);\n\n v = Value(3);\n\n ASSERT_FALSE(param.sameValue(v)); // makes sure anti-aliasing happens\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/test/dd_param/test_dd_double.cpp", "rank": 69, "score": 38799.952523898326 }, { "content": "//\n\n// Created by Noam Dori on 20/06/18.\n\n//\n\n\n\n#ifndef DDYNAMIC_RECONFIGURE_DD_ENUM_PARAM_H\n\n#define DDYNAMIC_RECONFIGURE_DD_ENUM_PARAM_H\n\n\n\n#include \"dd_int_param.h\"\n\n#include <boost/foreach.hpp>\n\n\n\nnamespace ddynamic_reconfigure {\n\n typedef map<string,pair<int,string> > EnumMap;\n\n /**\n\n * @brief an integer enum implementation of the parameter.\n\n * This is an extension to the int parameter,\n\n * which allows creating string aliases for certain (if not all) numbers available.\n\n *\n\n */\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_enum_param.h", "rank": 70, "score": 38306.32326455289 }, { "content": " * @deprecated see note. This is not tested, so it may fail.\n\n */\n\n DDEnum(const string &name, unsigned int level, const string &description,\n\n const string& def, const pair<map<string,pair<int,string> >,string> &dictionary);\n\n #ifdef __clang__\n\n #pragma clang diagnostic pop\n\n #endif\n\n\n\n protected:\n\n /** \n\n * @brief A dictionary from the string aliases to their integer counterparts.\n\n * This method of storage allows integers to have multiple aliases.\n\n */\n\n const EnumMap dict_;\n\n /**\n\n * @brief this holds the physical enum's description. why is this here? because 1D-reconfigure.\n\n */\n\n string enum_description_;\n\n private:\n\n /**\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_enum_param.h", "rank": 71, "score": 38302.85623164435 }, { "content": " * converts the value given to an integer according to the embedded dictionary.\n\n * @param val the value to look up within the dictionary\n\n * @return if the value is a string which exists in the dictionary, returns the int definition of the term given.\n\n * otherwise, returns the Value object defined conversion of the type to an integer.\n\n */\n\n int lookup(Value val);\n\n\n\n /**\n\n * generates the 'edit_method' sting for prepGroup().\n\n * @return a string that should not be touched.\n\n */\n\n string makeEditMethod();\n\n\n\n /**\n\n * generates a 'const' sting for prepGroup().\n\n * @param name the name of the constant\n\n * @param value the value of the constant\n\n * @param desc the description given to the constant.\n\n * @return a string that should not be touched.\n\n */\n\n string makeConst(string name, int value, string desc);\n\n };\n\n}\n\n\n\n#endif //DDYNAMIC_RECONFIGURE_DD_ENUM_PARAM_H\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_enum_param.h", "rank": 72, "score": 38302.61347038098 }, { "content": " * @param level the change level\n\n * @param def the default value in integer form\n\n * @param description details about the parameter\n\n * @param dictionary the alias dictionary this enum will use.\n\n * @note since ROS cannot send the enum and const descriptions, this method is useless.\n\n * Please use the constructor which takes a map<string,int> instead.\n\n * @deprecated see note. This is not tested, so it may fail.\n\n */\n\n DDEnum(const string &name, unsigned int level, const string &description,\n\n int def, const pair<map<string,pair<int,string> >,string> &dictionary);\n\n\n\n /**\n\n * @brief creates a new int-enum param\n\n * @param name the name of the parameter\n\n * @param level the change level\n\n * @param def an alias of the default value\n\n * @param description details about the parameter\n\n * @param dictionary the alias dictionary this enum will use.\n\n * @note since ROS cannot send the enum and const descriptions, this method is useless.\n\n * Please use the constructor which takes a map<string,int> instead.\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_enum_param.h", "rank": 73, "score": 38302.43143425335 }, { "content": " int def, const map<string,int> &dictionary);\n\n\n\n /**\n\n * @brief creates a new int-enum param\n\n * @param name the name of the parameter\n\n * @param level the change level\n\n * @param def an alias of the default value\n\n * @param description details about the parameter\n\n * @param dictionary the alias dictionary this enum will use.\n\n */\n\n DDEnum(const string &name, unsigned int level, const string &description,\n\n const string& def, const map<string,int> &dictionary);\n\n\n\n #ifdef __clang__\n\n #pragma clang diagnostic push\n\n #pragma ide diagnostic ignored \"OCUnusedGlobalDeclarationInspection\"\n\n #endif\n\n /**\n\n * @brief creates a new int-enum param\n\n * @param name the name of the parameter\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_enum_param.h", "rank": 74, "score": 38302.37190159722 }, { "content": " /**\n\n * creates a new int param\n\n * @param name the name of the parameter\n\n * @param level the change level\n\n * @param def the default value\n\n * @param description details about the parameter\n\n * @param max the maximum allowed value. Defaults to INT32_MAX\n\n * @param min the minimum allowed value. Defaults to INT32_MIN\n\n */\n\n inline DDInt(const string &name, unsigned int level, const string &description,\n\n int def, int min = INT32_MIN, int max = INT32_MAX) {\n\n name_ = name;\n\n level_ = level;\n\n desc_ = description;\n\n def_ = def;\n\n val_ = def;\n\n max_ = max;\n\n min_ = min;\n\n }\n\n\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_int_param.h", "rank": 75, "score": 38301.395452110286 }, { "content": "//\n\n// Created by Noam Dori on 19/06/18.\n\n//\n\n\n\n#ifndef DDYNAMIC_RECONFIGURE_DD_INT_PARAM_H\n\n#define DDYNAMIC_RECONFIGURE_DD_INT_PARAM_H\n\n\n\n#include \"ddynamic_reconfigure/dd_param.h\"\n\n\n\nnamespace ddynamic_reconfigure {\n\n /**\n\n * @brief an integer implementation of the parameter.\n\n * This is used to 32 bit signed integral numbers.\n\n * This can also handle shorts, bytes, and other integrals provided they are not too big\n\n * (by then looping will occur)\n\n */\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_int_param.h", "rank": 76, "score": 38300.92849012372 }, { "content": " protected:\n\n /**\n\n * @brief the level of the parameter:\n\n * the degree in which things need to be shut down if this param changes\n\n */\n\n unsigned int level_;\n\n /**\n\n * @brief the default value (def_),\n\n * the current value (val_),\n\n * the minimum allowed value (min_),\n\n * and the maximum allowed value (max_)\n\n */\n\n int def_,max_,min_,val_;\n\n /**\n\n * @brief the name of the parameter (name_),\n\n * and its description (desc_)\n\n */\n\n string name_, desc_;\n\n };\n\n}\n\n\n\n#endif //DDYNAMIC_RECONFIGURE_DD_INT_PARAM_H\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_int_param.h", "rank": 77, "score": 38300.75745366544 }, { "content": " class SyncedImuPublisher\n\n {\n\n public:\n\n SyncedImuPublisher() {_is_enabled=false;};\n\n SyncedImuPublisher(ros::Publisher imu_publisher, std::size_t waiting_list_size=1000);\n\n ~SyncedImuPublisher();\n\n void Pause(); // Pause sending messages. All messages from now on are saved in queue.\n\n void Resume(); // Send all pending messages and allow sending future messages.\n\n void Publish(sensor_msgs::Imu msg); //either send or hold message.\n\n uint32_t getNumSubscribers() { return _publisher.getNumSubscribers();};\n\n void Enable(bool is_enabled) {_is_enabled=is_enabled;};\n\n \n\n private:\n\n void PublishPendingMessages();\n\n\n\n private:\n\n std::mutex _mutex;\n\n ros::Publisher _publisher;\n\n bool _pause_mode;\n\n std::queue<sensor_msgs::Imu> _pending_messages;\n\n std::size_t _waiting_list_size;\n\n bool _is_enabled;\n\n };\n\n\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/base_realsense_node.h", "rank": 78, "score": 38297.643077376444 }, { "content": " class DDParam {\n\n public:\n\n\n\n /**\n\n * @brief gets the name of the parameter, that is, the ID used in the program when requesting it.\n\n * @return the unique string name of the parameter.\n\n */\n\n virtual string getName() const = 0;\n\n\n\n /**\n\n * @brief fetches the level of the parameter\n\n * @return the level of the param.\n\n */\n\n virtual int getLevel() const = 0;\n\n\n\n /**\n\n * @brief gets the value of this parameter.\n\n * @return the value stored in this param.\n\n */\n\n virtual Value getValue() const = 0;\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/dd_param.h", "rank": 79, "score": 38297.643077376444 }, { "content": "namespace realsense2_camera\n\n{\n\n const uint16_t SR300_PID = 0x0aa5; // SR300\n\n const uint16_t RS400_PID = 0x0ad1; // PSR\n\n const uint16_t RS410_PID = 0x0ad2; // ASR\n\n const uint16_t RS415_PID = 0x0ad3; // ASRC\n\n const uint16_t RS430_PID = 0x0ad4; // AWG\n\n const uint16_t RS430_MM_PID = 0x0ad5; // AWGT\n\n const uint16_t RS_USB2_PID = 0x0ad6; // USB2\n\n const uint16_t RS420_PID = 0x0af6; // PWG\n\n const uint16_t RS420_MM_PID = 0x0afe; // PWGT\n\n const uint16_t RS410_MM_PID = 0x0aff; // ASR\n\n const uint16_t RS400_MM_PID = 0x0b00; // PSR\n\n const uint16_t RS430_MM_RGB_PID = 0x0b01; // AWGCT\n\n const uint16_t RS460_PID = 0x0b03; // DS5U\n\n const uint16_t RS435_RGB_PID = 0x0b07; // AWGC\n\n const uint16_t RS435i_RGB_PID = 0x0B3A; // AWGC_MM\n\n const uint16_t RS405_PID = 0x0b0c; // DS5U\n\n const uint16_t RS_T265_PID = 0x0b37; // \n\n \n\n\n\n const bool ALIGN_DEPTH = false;\n\n const bool POINTCLOUD = false;\n\n const bool ALLOW_NO_TEXTURE_POINTS = false;\n\n const bool SYNC_FRAMES = false;\n\n\n\n const int IMAGE_WIDTH = 640;\n\n const int IMAGE_HEIGHT = 480;\n\n const int IMAGE_FPS = 30;\n\n\n\n const int IMU_FPS = 0;\n\n\n\n\n\n const bool ENABLE_DEPTH = true;\n\n const bool ENABLE_INFRA1 = true;\n\n const bool ENABLE_INFRA2 = true;\n\n const bool ENABLE_COLOR = true;\n\n const bool ENABLE_FISHEYE = true;\n\n const bool ENABLE_IMU = true;\n\n const bool HOLD_BACK_IMU_FOR_FRAMES = false;\n\n const bool PUBLISH_ODOM_TF = true;\n\n\n\n\n\n const std::string DEFAULT_BASE_FRAME_ID = \"camera_link\";\n\n const std::string DEFAULT_ODOM_FRAME_ID = \"odom_frame\";\n\n const std::string DEFAULT_DEPTH_FRAME_ID = \"camera_depth_frame\";\n\n const std::string DEFAULT_INFRA1_FRAME_ID = \"camera_infra1_frame\";\n\n const std::string DEFAULT_INFRA2_FRAME_ID = \"camera_infra2_frame\";\n\n const std::string DEFAULT_COLOR_FRAME_ID = \"camera_color_frame\";\n\n const std::string DEFAULT_FISHEYE_FRAME_ID = \"camera_fisheye_frame\";\n\n const std::string DEFAULT_IMU_FRAME_ID = \"camera_imu_frame\";\n\n\n\n const std::string DEFAULT_DEPTH_OPTICAL_FRAME_ID = \"camera_depth_optical_frame\";\n\n const std::string DEFAULT_INFRA1_OPTICAL_FRAME_ID = \"camera_infra1_optical_frame\";\n\n const std::string DEFAULT_INFRA2_OPTICAL_FRAME_ID = \"camera_infra2_optical_frame\";\n\n const std::string DEFAULT_COLOR_OPTICAL_FRAME_ID = \"camera_color_optical_frame\";\n\n const std::string DEFAULT_FISHEYE_OPTICAL_FRAME_ID = \"camera_fisheye_optical_frame\";\n\n const std::string DEFAULT_ACCEL_OPTICAL_FRAME_ID = \"camera_accel_optical_frame\";\n\n const std::string DEFAULT_GYRO_OPTICAL_FRAME_ID = \"camera_gyro_optical_frame\";\n\n const std::string DEFAULT_IMU_OPTICAL_FRAME_ID = \"camera_imu_optical_frame\";\n\n\n\n const std::string DEFAULT_ALIGNED_DEPTH_TO_COLOR_FRAME_ID = \"camera_aligned_depth_to_color_frame\";\n\n const std::string DEFAULT_ALIGNED_DEPTH_TO_INFRA1_FRAME_ID = \"camera_aligned_depth_to_infra1_frame\";\n\n const std::string DEFAULT_ALIGNED_DEPTH_TO_INFRA2_FRAME_ID = \"camera_aligned_depth_to_infra2_frame\";\n\n const std::string DEFAULT_ALIGNED_DEPTH_TO_FISHEYE_FRAME_ID = \"camera_aligned_depth_to_fisheye_frame\";\n\n\n\n const std::string DEFAULT_UNITE_IMU_METHOD = \"\";\n\n const std::string DEFAULT_FILTERS = \"\";\n\n const std::string DEFAULT_TOPIC_ODOM_IN = \"\";\n\n\n\n const float ROS_DEPTH_SCALE = 0.001;\n\n using stream_index_pair = std::pair<rs2_stream, int>;\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/constants.h", "rank": 80, "score": 38297.643077376444 }, { "content": " class DDynamicReconfigure {\n\n public:\n\n /**\n\n * @brief creates the most basic instance of a 2d-conf object.\n\n * @param nh the node handler of the node this is placed at.\n\n */\n\n explicit DDynamicReconfigure(ros::NodeHandle &nh);\n\n\n\n /**\n\n * @brief adds a parameter to the list, allowing it to be generated.\n\n * @param param the pointer to the 2d-param to add to the list.\n\n */\n\n virtual void add(DDPtr param);\n\n\n\n /**\n\n * @brief a convenience method for adding a parameter to the list, allowing it to be generated.\n\n * @warning When adding in this manner, you must be careful. After using this method to add the parameter,\n\n * running any of the \"remove\" methods on this object WILL cause the entire param object to be deleted!\n\n * To make sure that you can add the object back after removing it, please use the other \"add\" method.\n\n * @param param the pointer to the 2d-param to add to the list.\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/ddynamic_reconfigure.h", "rank": 81, "score": 37531.333153857384 }, { "content": " class InterfaceRealSenseNode\n\n {\n\n public:\n\n virtual void publishTopics() = 0;\n\n virtual void registerDynamicReconfigCb(ros::NodeHandle& nh) = 0;\n\n virtual ~InterfaceRealSenseNode() = default;\n\n };\n\n\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/realsense_node_factory.h", "rank": 82, "score": 37531.333153857384 }, { "content": "#define REALSENSE_ROS_VERSION_STR (VAR_ARG_STRING(REALSENSE_ROS_MAJOR_VERSION.REALSENSE_ROS_MINOR_VERSION.REALSENSE_ROS_PATCH_VERSION))\n\n\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/constants.h", "rank": 83, "score": 36804.170616516756 }, { "content": "#define REALSENSE_ROS_MINOR_VERSION 2\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/constants.h", "rank": 84, "score": 36795.08833403484 }, { "content": "#define REALSENSE_ROS_MAJOR_VERSION 2\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/constants.h", "rank": 85, "score": 36795.08833403484 }, { "content": "#define REALSENSE_ROS_PATCH_VERSION 4\n\n\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/constants.h", "rank": 86, "score": 36795.08833403484 }, { "content": "\tclass PipelineSyncer : public rs2::asynchronous_syncer\n\n\t{\n\n\tpublic: \n\n\t\tvoid operator()(rs2::frame f) const\n\n\t\t{\n\n\t\t\tinvoke(std::move(f));\n\n\t\t}\n\n\t};\n\n\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/base_realsense_node.h", "rank": 87, "score": 36087.17331523018 }, { "content": " class DDParam;// declaration for the sake of order.\n\n // this is the pointer to any type of Dynamic Dynamic parameter.\n\n typedef boost::shared_ptr<DDParam> DDPtr;\n\n /**\n\n * @brief The DDParam class is the abstraction of all parameter types, and is the template for creating them.\n\n * At this point, not much is known about the parameter, but the following:\n\n *\n\n * - the parameter has a name\n\n * - the parameter has a severity level\n\n * - the parameter has a description\n\n * - the parameter contains some value, though its type and contents are unknown.\n\n *\n\n * Other than storing data, the parameter also has specialised methods to interact with DDynamicReconfigure in order to apply changes and send them.\n\n * These methods should not be touched by the user.\n\n *\n\n * Since this class is abstract, the class has multiple implementations whicch are not directly exposed but are used,\n\n * so its worth checking out their descriptions.\n\n *\n\n * While this class is abstract, it does have one implemented thing, and that is its stream operator (`<<`) which can be freely used.\n\n *\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/dd_param.h", "rank": 88, "score": 36087.17331523018 }, { "content": " class RealSenseNodeFactory : public nodelet::Nodelet\n\n {\n\n public:\n\n RealSenseNodeFactory();\n\n virtual ~RealSenseNodeFactory();\n\n\n\n private:\n\n void closeDevice();\n\n void StartDevice();\n\n void change_device_callback(rs2::event_information& info);\n\n void getDevice(rs2::device_list list);\n\n virtual void onInit() override;\n\n void tryGetLogSeverity(rs2_log_severity& severity) const;\n\n\n\n rs2::device _device;\n\n std::unique_ptr<InterfaceRealSenseNode> _realSenseNode;\n\n rs2::context _ctx;\n\n std::string _serial_no;\n\n bool _initial_reset;\n\n std::thread _query_thread;\n\n\n\n };\n\n}//end namespace\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/realsense_node_factory.h", "rank": 89, "score": 35405.98381859954 }, { "content": " class T265RealsenseNode : public BaseRealSenseNode\n\n {\n\n public:\n\n T265RealsenseNode(ros::NodeHandle& nodeHandle,\n\n ros::NodeHandle& privateNodeHandle,\n\n rs2::device dev,\n\n const std::string& serial_no);\n\n void publishTopics();\n\n\n\n protected:\n\n void calcAndPublishStaticTransform(const stream_index_pair& stream, const rs2::stream_profile& base_profile) override;\n\n\n\n private:\n\n void initializeOdometryInput();\n\n void setupSubscribers();\n\n void odom_in_callback(const nav_msgs::Odometry::ConstPtr& msg);\n\n\n\n ros::Subscriber _odom_subscriber;\n\n rs2::wheel_odometer _wo_snr;\n\n bool _use_odom_in;\n\n };\n\n}\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/t265_realsense_node.h", "rank": 90, "score": 34750.03445206085 }, { "content": " class DDInt : virtual public DDParam {\n\n public:\n\n string getName() const;\n\n\n\n void prepGroup(Group &group);\n\n\n\n void prepConfig(Config &conf);\n\n\n\n void prepConfigDescription(ConfigDescription &conf_desc);\n\n\n\n int getLevel() const;\n\n\n\n bool sameType(Value val);\n\n\n\n bool sameValue(Value val);\n\n\n\n void setValue(Value val);\n\n\n\n Value getValue() const;\n\n\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_int_param.h", "rank": 91, "score": 34117.947897826416 }, { "content": " class BaseRealSenseNode : public InterfaceRealSenseNode\n\n {\n\n public:\n\n BaseRealSenseNode(ros::NodeHandle& nodeHandle,\n\n ros::NodeHandle& privateNodeHandle,\n\n rs2::device dev,\n\n const std::string& serial_no);\n\n\n\n void toggleSensors(bool enabled);\n\n virtual void publishTopics() override;\n\n virtual void registerDynamicReconfigCb(ros::NodeHandle& nh) override;\n\n virtual ~BaseRealSenseNode() {}\n\n\n\n public:\n\n enum imu_sync_method{NONE, COPY, LINEAR_INTERPOLATION};\n\n\n\n protected:\n", "file_path": "realsense-ros-2.2.4/realsense2_camera/include/base_realsense_node.h", "rank": 92, "score": 34117.947897826416 }, { "content": " class DDEnum : virtual public DDInt {\n\n public:\n\n\n\n void prepGroup(Group &group);\n\n\n\n bool sameType(Value val);\n\n\n\n bool sameValue(Value val);\n\n\n\n void setValue(Value val);\n\n\n\n /**\n\n * @brief creates a new int-enum param\n\n * @param name the name of the parameter\n\n * @param level the change level\n\n * @param def the default value in integer form\n\n * @param description details about the parameter\n\n * @param dictionary the alias dictionary this enum will use.\n\n */\n\n DDEnum(const string &name, unsigned int level, const string &description,\n", "file_path": "realsense-ros-2.2.4/ddynamic_reconfigure/include/ddynamic_reconfigure/param/dd_enum_param.h", "rank": 93, "score": 34117.947897826416 }, { "content": "function map(x,old_low,old_high,new_low,new_high)\n\n return ((x-old_low)*((new_high-new_low)/(old_high-old_low))) + new_low\n\nend\n\n\n", "file_path": "sih/Controlling-UAV-in-V-REP-via-ROS-master/child_script.lua", "rank": 94, "score": 16835.55892814097 }, { "content": "#include <ros/ros.h>\n\n#include <serial/serial.h>\n\n#include <std_msgs/String.h>\n\n#include <string>\n\n#include <swiftpro/SwiftproState.h>\n\n\n\nserial::Serial _serial;\t\t\t\t// serial object\n\nfloat position[4] = {0.0};\t\t\t// 3 cartesian coordinates: x, y, z(mm) and 1 angle(degree)\n\nchar strdata[2048];\t\t\t\t// global variables for handling string\n\n\n\n\n\nvoid handlestr()\n\n{\n\n\tchar *pch = strtok(strdata, \" \");\n\n\tfloat value[8];\n\n\tint index = 0;\n\n\n\n\twhile (pch != NULL && index < 5)\n\n\t{\n\n\t\tvalue[index] = atof(pch+1);\n", "file_path": "uarm/src/swiftpro_read_node2.cpp", "rank": 96, "score": 16.91888013677238 }, { "content": " * Description: callback when receive data from position_write_topic\n\n * Inputs: \t\tmsg(float)\t\t\t3 cartesian coordinates: x, y, z(mm)\n\n * Outputs:\t\tGcode\t\t\t\tsend gcode to control swift pro\n\n */\n\nvoid position_write_callback(const swiftpro::position& msg)\n\n{\n\n\tstd::string Gcode = \"\";\n\n\tstd_msgs::String result;\n\n\tchar x[10];\n\n\tchar y[10];\n\n\tchar z[10];\n\n\n\n\tpos.x = msg.x;\n\n\tpos.y = msg.y;\n\n\tpos.z = msg.z;\n\n\tsprintf(x, \"%.2f\", msg.x);\n\n\tsprintf(y, \"%.2f\", msg.y);\n\n\tsprintf(z, \"%.2f\", msg.z);\n\n\tGcode = (std::string)\"G0 X\" + x + \" Y\" + y + \" Z\" + z + \" F10000\" + \"\\r\\n\";\n\n\tROS_INFO(\"%s\", Gcode.c_str());\n", "file_path": "uarm/src/swiftpro_write_node2.cpp", "rank": 97, "score": 16.223595357838498 }, { "content": " * Description: callback when receive data from position_write_topic\n\n * Inputs: \t\tmsg(float)\t\t\t3 cartesian coordinates: x, y, z(mm)\n\n * Outputs:\t\tGcode\t\t\t\tsend gcode to control swift pro\n\n */\n\nvoid position_write_callback(const swiftpro::position& msg)\n\n{\n\n\tstd::string Gcode = \"\";\n\n\tstd_msgs::String result;\n\n\tchar x[10];\n\n\tchar y[10];\n\n\tchar z[10];\n\n\n\n\tpos.x = msg.x;\n\n\tpos.y = msg.y;\n\n\tpos.z = msg.z;\n\n\tsprintf(x, \"%.2f\", msg.x);\n\n\tsprintf(y, \"%.2f\", msg.y);\n\n\tsprintf(z, \"%.2f\", msg.z);\n\n\tGcode = (std::string)\"G0 X\" + x + \" Y\" + y + \" Z\" + z + \" F10000\" + \"\\r\\n\";\n\n\tROS_INFO(\"%s\", Gcode.c_str());\n", "file_path": "swiftpro/src/swiftpro_write_node.cpp", "rank": 98, "score": 16.223595357838498 } ]
C++
BZOJ/BZOJ1336.cpp
xehoth/OnlineJudgeCodes
013d31cccaaa1d2b6d652c2f5d5d6cb2e39884a7
#include <algorithm> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <iostream> namespace IO { inline char read() { static const int IN_LEN = 1000000; static char buf[IN_LEN], *s, *t; s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin) : 0; return s == t ? -1 : *s++; } template <typename T> inline void read(T &x) { static char c; static bool iosig; for (c = read(), iosig = false; !isdigit(c); c = read()) { if (c == -1) return; iosig ? x = -x : 0; } for (x = 0; isdigit(c); c = read()) x = (x + (x << 2) << 1) + (c ^ '0'); iosig ? x = -x : 0; } inline int read(char *buf) { register int s = 0; register char c; while (c = read(), isspace(c) && c != -1) ; if (c == -1) { *buf = '\0'; return -1; } do buf[s++] = c; while (c = read(), !isspace(c) && c != -1); buf[s] = '\0'; return s; } inline void read(double &x) { static char buf[30]; read(buf), x = atof(buf); } const int OUT_LEN = 1000000; char obuf[OUT_LEN], *oh = obuf; inline void print(char c) { oh == obuf + OUT_LEN ? (fwrite(obuf, 1, OUT_LEN, stdout), oh = obuf) : 0; *oh++ = c; } template <typename T> inline void print(T x) { static int buf[30], cnt; if (x == 0) { print('0'); } else { x < 0 ? (print('-'), x = -x) : 0; for (cnt = 0; x; x /= 10) buf[++cnt] = x % 10 | 48; while (cnt) print((char)buf[cnt--]); } } inline void flush() { fwrite(obuf, 1, oh - obuf, stdout); } } namespace Task { const int MAXN = 100005; const double EPS = 1e-8; template <typename T> inline T square(const T &x) { return x * x; } struct Point { double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} inline double dis(const Point &p) const { return sqrt(square(x - p.x) + square(y - p.y)); } inline Point operator+(const Point &p) const { return Point(x + p.x, y + p.y); } inline Point operator-(const Point &p) const { return Point(x - p.x, y - p.y); } inline Point operator*(const double i) const { return Point(x * i, y * i); } inline double operator*(const Point &p) const { return x * p.y - y * p.x; } inline double operator^(const Point &p) const { return x * p.x + y * p.y; } inline Point operator/(const double i) const { return Point(x / i, y / i); } inline void read() { IO::read(x), IO::read(y); } } p[MAXN]; struct Circle { Point o; double r; Circle(const Point &o, const double r) : o(o), r(r) {} Circle() {} }; struct Line { Point s, t; Line(const Point &s, const Point &t) : s(s), t(t) {} inline Point intersect(const Line &l) const { return s + (t - s) * (((s - l.s) * (l.t - l.s)) / ((l.t - l.s) * (t - s))); } inline Line getPerpendicularBisector() { return Line( Point((s.x + t.x) / 2, (s.y + t.y) / 2), Point((s.x + t.x) / 2 + s.y - t.y, (s.y + t.y) / 2 + t.x - s.x)); } }; inline Point getCenter(const Point &a, const Point &b, const Point &c) { return Line(a, b).getPerpendicularBisector().intersect( Line(a, c).getPerpendicularBisector()); } inline void solve() { using namespace IO; srand(495); register int n; read(n); for (register int i = 1; i <= n; i++) p[i].read(); std::random_shuffle(p + 1, p + n + 1); Circle c(p[1], 0); for (register int i = 1; i <= n; i++) { if (c.o.dis(p[i]) - c.r < EPS) continue; c = Circle((p[1] + p[i]) / 2, p[1].dis(p[i]) / 2); for (register int j = 2; j < i; j++) { if (c.o.dis(p[j]) - c.r < EPS) continue; c = Circle((p[i] + p[j]) / 2, p[i].dis(p[j]) / 2); for (register int k = 1; k < j; k++) { if (c.o.dis(p[k]) - c.r < EPS) continue; c = Circle(getCenter(p[i], p[j], p[k]), c.r); c.r = c.o.dis(p[k]); } } } printf("%.5lf\n%.5lf %.5lf\n", c.r, c.o.x, c.o.y); } } int main() { #ifdef DBG freopen("in.in", "r", stdin); #endif Task::solve(); return 0; }
#include <algorithm> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <iostream> namespace IO { inline char read() { static const int IN_LEN = 1000000; static char buf[IN_LEN], *s, *t; s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin) : 0; return s == t ? -1 : *s++; } template <typename T> inline void read(T &x) { static char c; static bool iosig; for (c = read(), iosig = false; !isdigit(c); c = read()) { if (c == -1) return; iosig ? x = -x : 0; } for (x = 0; isdigit(c); c = read()) x = (x + (x << 2) << 1) + (c ^ '0'); iosig ? x = -x : 0; } inline int read(char *buf) { register int s = 0; register char c; while (c = read(), isspace(c) && c != -1) ; if (c == -1) { *buf = '\0'; return -1; } do buf[s++] = c; while (c = read(), !isspace(c) && c != -1); buf[s] = '\0'; return s; } inline void read(double &x) { static char buf[30]; read(buf), x = atof(buf); } const int OUT_LEN = 1000000; char obuf[OUT_LEN], *oh = obuf; inline void print(char c) { oh == obuf + OUT_LEN ? (fwrite(obuf, 1, OUT_LEN, stdout), oh = obuf) : 0; *oh++ = c; } template <typename T> inline void print(T x) { static int buf[30], cnt;
} inline void flush() { fwrite(obuf, 1, oh - obuf, stdout); } } namespace Task { const int MAXN = 100005; const double EPS = 1e-8; template <typename T> inline T square(const T &x) { return x * x; } struct Point { double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} inline double dis(const Point &p) const { return sqrt(square(x - p.x) + square(y - p.y)); } inline Point operator+(const Point &p) const { return Point(x + p.x, y + p.y); } inline Point operator-(const Point &p) const { return Point(x - p.x, y - p.y); } inline Point operator*(const double i) const { return Point(x * i, y * i); } inline double operator*(const Point &p) const { return x * p.y - y * p.x; } inline double operator^(const Point &p) const { return x * p.x + y * p.y; } inline Point operator/(const double i) const { return Point(x / i, y / i); } inline void read() { IO::read(x), IO::read(y); } } p[MAXN]; struct Circle { Point o; double r; Circle(const Point &o, const double r) : o(o), r(r) {} Circle() {} }; struct Line { Point s, t; Line(const Point &s, const Point &t) : s(s), t(t) {} inline Point intersect(const Line &l) const { return s + (t - s) * (((s - l.s) * (l.t - l.s)) / ((l.t - l.s) * (t - s))); } inline Line getPerpendicularBisector() { return Line( Point((s.x + t.x) / 2, (s.y + t.y) / 2), Point((s.x + t.x) / 2 + s.y - t.y, (s.y + t.y) / 2 + t.x - s.x)); } }; inline Point getCenter(const Point &a, const Point &b, const Point &c) { return Line(a, b).getPerpendicularBisector().intersect( Line(a, c).getPerpendicularBisector()); } inline void solve() { using namespace IO; srand(495); register int n; read(n); for (register int i = 1; i <= n; i++) p[i].read(); std::random_shuffle(p + 1, p + n + 1); Circle c(p[1], 0); for (register int i = 1; i <= n; i++) { if (c.o.dis(p[i]) - c.r < EPS) continue; c = Circle((p[1] + p[i]) / 2, p[1].dis(p[i]) / 2); for (register int j = 2; j < i; j++) { if (c.o.dis(p[j]) - c.r < EPS) continue; c = Circle((p[i] + p[j]) / 2, p[i].dis(p[j]) / 2); for (register int k = 1; k < j; k++) { if (c.o.dis(p[k]) - c.r < EPS) continue; c = Circle(getCenter(p[i], p[j], p[k]), c.r); c.r = c.o.dis(p[k]); } } } printf("%.5lf\n%.5lf %.5lf\n", c.r, c.o.x, c.o.y); } } int main() { #ifdef DBG freopen("in.in", "r", stdin); #endif Task::solve(); return 0; }
if (x == 0) { print('0'); } else { x < 0 ? (print('-'), x = -x) : 0; for (cnt = 0; x; x /= 10) buf[++cnt] = x % 10 | 48; while (cnt) print((char)buf[cnt--]); }
if_condition
[ { "content": "struct PriorityQueue : public std::map<int, int, std::greater<int> > {\n\n typedef std::map<int, int, std::greater<int> > super;\n\n\n\n inline void push(int x) { super::operator[](x)++; }\n\n\n\n inline void erase(int x) {\n\n super::iterator it = super::find(x);\n\n if (it != super::end() && --it->second == 0) super::erase(it);\n\n }\n\n\n\n inline int top() { return super::empty() ? 0 : super::begin()->first; }\n\n};\n\n\n", "file_path": "BZOJ/BZOJ4382-Podział naszyjnika-线段树+map.cpp", "rank": 0, "score": 99142.46373898798 }, { "content": "struct buf {\n\n char z[1 << 25], *s;\n\n buf() : s(z) { fread(z, 1, sizeof z, stdin); }\n\n inline void pre(char *v) {\n\n while (*s < 48) ++s;\n\n while (*s > 32) *v++ = *s++;\n\n *v = 0;\n\n }\n\n operator int() {\n\n int x = 0, y = 0;\n\n while (*s < 48) y = *s++;\n\n while (*s > 32) x = x * 10 + *s++ - 48;\n\n if (y == 45) return -x;\n\n return x;\n\n }\n\n} it;\n\nint main() {\n\n static char s[N];\n\n static arr1 a, t;\n\n register int n = it;\n", "file_path": "BZOJ/BZOJ4199.cpp", "rank": 1, "score": 94759.63732507822 }, { "content": "n, k, x = map(int, input().split())\n\nrangers = list(map(int, input().split()))\n\nfor i in range(min(k, 8 + (k & 3))):\n\n rangers.sort()\n\n rangers = [rangers[i] if (i & 1) else rangers[i] ^ x for i in range(n)]\n\n print(rangers)\n\nrangers.sort()\n", "file_path": "codeforces/Divide by Zero 2017 and Codeforces Round #399 (Div. 1 + Div. 2, combined) 768/C-Jon Snow and his Favourite Number.py", "rank": 2, "score": 69464.61375650797 }, { "content": "class MonotoneQueue : public std::deque<std::pair<T, int> > {\n\n public:\n\n typedef std::pair<T, int> Pair;\n\n typedef std::deque<Pair> super;\n\n\n\n MonotoneQueue(Comparator cmp = Comparator()) : cmp(cmp), pos(0), cur(0) {}\n\n\n\n inline void push(const T &v) {\n\n while (!super::empty() && cmp(super::front().first, v))\n\n super::pop_front();\n\n super::push_front(Pair(v, cur++));\n\n }\n\n\n\n inline void pop() {\n\n if (super::back().second == pos++) super::pop_back();\n\n }\n\n\n\n inline const T &top() { return super::back().first; }\n\n\n\n inline void clear() { super::clear(), pos = cur = 0; }\n", "file_path": "CodeVS/CodeVS3269-混合背包-dp+单调队列.cpp", "rank": 3, "score": 59352.197070466624 }, { "content": "/**\n\n * Copyright (c) 2017, xehoth\n\n * All rights reserved.\n\n * 「BZOJ 3453」XLkxc 18-09-2017\n\n * 拉格朗日插值\n\n * @author xehoth\n\n */\n\n#include <bits/stdc++.h>\n\n\n\nnamespace IO {\n\n\n\ninline char read() {\n\n static const int IN_LEN = 1000000;\n\n static char buf[IN_LEN], *s, *t;\n\n s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin) : 0;\n\n return s == t ? -1 : *s++;\n\n}\n\n\n\ntemplate <typename T>\n\ninline void read(T &x) {\n", "file_path": "BZOJ/BZOJ3453-XLkxc-拉格朗日插值.cpp", "rank": 4, "score": 49060.9242236257 }, { "content": "template <typename T>\n\ninline void print(T x) {\n\n static int buf[30], cnt;\n\n if (x == 0) {\n\n print('0');\n\n } else {\n\n x < 0 ? (print('-'), x = -x) : 0;\n\n for (cnt = 0; x; x /= 10) buf[++cnt] = x % 10 | 48;\n\n while (cnt) print((char)buf[cnt--]);\n\n }\n\n}\n\n\n\ninline void print(const char *s) {\n\n for (; *s; s++) print(*s);\n\n}\n\n\n\ninline void flush() { fwrite(obuf, 1, oh - obuf, stdout); }\n\n\n", "file_path": "BZOJ/BZOJ3453-XLkxc-拉格朗日插值.cpp", "rank": 5, "score": 49057.18330959311 }, { "content": " static char c;\n\n static bool iosig;\n\n for (c = read(), iosig = false; !isdigit(c); c = read()) {\n\n if (c == -1) return;\n\n c == '-' ? iosig = true : 0;\n\n }\n\n for (x = 0; isdigit(c); c = read()) x = x * 10 + (c ^ '0');\n\n iosig ? x = -x : 0;\n\n}\n\n\n\ninline void read(char &c) {\n\n while (c = read(), isspace(c) && c != -1)\n\n ;\n\n}\n\n\n\ninline int read(char *buf) {\n\n register int s = 0;\n\n register char c;\n\n while (c = read(), isspace(c) && c != -1)\n\n ;\n", "file_path": "BZOJ/BZOJ3453-XLkxc-拉格朗日插值.cpp", "rank": 6, "score": 49054.92138489802 }, { "content": " if (c == -1) {\n\n *buf = 0;\n\n return -1;\n\n }\n\n do\n\n buf[s++] = c;\n\n while (c = read(), !isspace(c) && c != -1);\n\n buf[s] = 0;\n\n return s;\n\n}\n\n\n\nconst int OUT_LEN = 1000000;\n\n\n\nchar obuf[OUT_LEN], *oh = obuf;\n\n\n\ninline void print(char c) {\n\n oh == obuf + OUT_LEN ? (fwrite(obuf, 1, OUT_LEN, stdout), oh = obuf) : 0;\n\n *oh++ = c;\n\n}\n\n\n", "file_path": "BZOJ/BZOJ3453-XLkxc-拉格朗日插值.cpp", "rank": 7, "score": 49048.48210689305 }, { "content": " register uint ret = 0, tmp;\n\n for (register int i = 1; i <= n + 1; i++) {\n\n tmp = (ulong)f[i] * pre[i - 1] % MOD * suf[i + 1] % MOD *\n\n inv[i - 1] % MOD * inv[n + 1 - i] % MOD;\n\n if ((n + 1 - i) % 2) tmp = MOD - tmp;\n\n ret = (ret + tmp) % MOD;\n\n }\n\n return ret;\n\n }\n\n\n\n inline void solve() {\n\n register int T;\n\n io >> T;\n\n init(MAXN + 5);\n\n static uint g[MAXN + 10], f[MAXN + 10];\n\n while (T--) {\n\n io >> k >> a >> n >> d;\n\n for (register int i = 0; i <= k + 3; i++) g[i] = modPow(i, k);\n\n for (register int i = 1; i <= k + 3; i++)\n\n g[i] = (g[i] + g[i - 1]) % MOD;\n", "file_path": "BZOJ/BZOJ3453-XLkxc-拉格朗日插值.cpp", "rank": 8, "score": 49028.06370505897 }, { "content": " for (register int i = 1; i <= k + 3; i++)\n\n g[i] = (g[i] + g[i - 1]) % MOD;\n\n f[0] = interpolation(g, a, k + 2);\n\n for (register int i = 1; i <= k + 5; i++)\n\n f[i] = (f[i - 1] +\n\n interpolation(g, (a + (ulong)d * i) % MOD, k + 2)) %\n\n MOD;\n\n io << interpolation(f, n, k + 4) << '\\n';\n\n }\n\n }\n\n} task;\n\n}\n\n\n\nint main() {\n\n task.solve();\n\n return 0;\n\n}", "file_path": "BZOJ/BZOJ3453-XLkxc-拉格朗日插值.cpp", "rank": 9, "score": 49017.12987719444 }, { "content": "typedef unsigned int uint;\n\n\n\nconst uint MOD = 1234567891;\n\nconst int MAXN = 123;\n\n\n\ntypedef unsigned long long ulong;\n\n\n\ninline int modPow(int a, int b) {\n\n register int ret = 1;\n\n for (; b; b >>= 1, a = (ulong)a * a % MOD)\n\n (b & 1) ? ret = (ulong)ret * a % MOD : 0;\n\n return ret;\n\n}\n\n\n", "file_path": "BZOJ/BZOJ3453-XLkxc-拉格朗日插值.cpp", "rank": 10, "score": 49014.69136726026 }, { "content": "def c(n, m):\n\n if (n < m):\n\n return 0\n", "file_path": "BZOJ/BZOJ2729.py", "rank": 11, "score": 48286.83665702732 }, { "content": "\n\ntemplate<class T>\n\ninline void read(T &x) {\n\n static char c;\n\n static bool iosig;\n\n for (c = read(), iosig = false; !isdigit(c); c = read()) {\n\n if (c == -1) return;\n\n c == '-' ? iosig = true : 0;\n\n }\n\n for (x = 0; isdigit(c); c = read())\n\n x = (x + (x << 2) << 1) + (c ^ '0');\n\n iosig ? x = -x : 0;\n\n}\n\n\n\nconst int OUT_LEN = 1000000;\n\n\n\nchar obuf[OUT_LEN], *oh = obuf;\n\n\n\ninline void print(char c) {\n\n oh == obuf + OUT_LEN ? (fwrite(obuf, 1, OUT_LEN, stdout), oh = obuf) : 0;\n", "file_path": "atcoder/AtCoder Beginner Contest 061/C.cpp", "rank": 12, "score": 46911.30402238217 }, { "content": " *oh++ = c;\n\n}\n\n\n\ntemplate<class T>\n\ninline void print(T x) {\n\n static int buf[30], cnt;\n\n if (x == 0) {\n\n print('0');\n\n } else {\n\n for (cnt = 0; x; x /= 10) buf[++cnt] = x % 10 | 48;\n\n while (cnt) print((char)buf[cnt--]);\n\n }\n\n}\n\n\n\ninline void flush() {\n\n fwrite(obuf, 1, oh - obuf, stdout);\n\n}\n\n}\n\n\n\nnamespace Task {\n\n\n\nconst int MAXN = 100005;\n\n\n", "file_path": "atcoder/AtCoder Beginner Contest 061/C.cpp", "rank": 13, "score": 46910.304842856174 }, { "content": "struct Task {\n\n uint inv[MAXN + 10];\n\n int k, a, n, d;\n\n\n\n inline void init(const int n) {\n\n inv[0] = inv[1] = 1;\n\n for (register int i = 2; i <= n; i++)\n\n inv[i] = (ulong)i * inv[i - 1] % MOD;\n\n inv[n] = modPow(inv[n], MOD - 2);\n\n for (register int i = n - 1; i >= 0; i--)\n\n inv[i] = inv[i + 1] * (i + 1ll) % MOD;\n\n }\n\n\n\n inline uint interpolation(uint *f, uint u, int n) {\n\n static uint pre[MAXN + 10], suf[MAXN + 10];\n\n pre[0] = suf[n + 2] = 1;\n\n for (register int i = 1; i <= n + 1; i++)\n\n pre[i] = (ulong)pre[i - 1] * (u - i + MOD) % MOD;\n\n for (register int i = n + 1; i; i--)\n\n suf[i] = (ulong)suf[i + 1] * (u - i + MOD) % MOD;\n", "file_path": "BZOJ/BZOJ3453-XLkxc-拉格朗日插值.cpp", "rank": 14, "score": 46896.38549692933 }, { "content": " * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n ******************************************************************************/\n\n#include <bits/stdc++.h>\n\n/**\n\n * 「AtCoder Beginner Contest 061」Big Array 13-05-2017\n\n * @author xehoth \n\n */\n\nnamespace IO {\n\n\n\ninline char read() {\n\n static const int IN_LEN = 1000000;\n\n static char buf[IN_LEN], *s, *t;\n\n s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin) : 0;\n\n return s == t ? -1 : *s++;\n\n}\n", "file_path": "atcoder/AtCoder Beginner Contest 061/C.cpp", "rank": 15, "score": 46887.48794200966 }, { "content": "\n\nint main() {\n\n // freopen(\"in.in\", \"r\", stdin);\n\n ios::sync_with_stdio(false);\n\n cin.tie(NULL);\n\n cin >> n;\n\n for (register int i = 1; i <= n; i++) {\n\n cin >> (s + 1);\n\n l = strlen(s + 1);\n\n solve(0, 0);\n\n ss[++len] = 'a' + 26;\n\n for (register int j = 1; j <= l; j++) ss[++len] = s[j];\n\n }\n\n ac_bfs();\n\n int pos = 0, now = 0;\n\n for (; pos < len; pos++) tag[now = f[now][ss[pos + 1] - 'a']]++;\n\n for (register int i = tail; i; i--) {\n\n tag[fail[line[i]]] += tag[line[i]];\n\n for (int k = first[line[i]]; k; k = next[k]) ans[k] = tag[line[i]];\n\n }\n\n for (register int i = 1; i <= n; i++) cout << ans[i] << \"\\n\";\n\n return 0;\n\n}", "file_path": "省选/2013/TJOI/单词-AC自动机.cpp", "rank": 16, "score": 46867.26762317405 }, { "content": "/**\n\n * Copyright (c) 2016, xehoth\n\n * All rights reserved.\n\n * 「TJOI 2013」单词 26-07-2016\n\n * AC 自动机\n\n * @author xehoth\n\n */\n\n#include <bits/stdc++.h>\n\n#define MAX_N 1050050\n\nusing namespace std;\n\nint n, len, l, tot, head = 0, tail = 1;\n\nchar ss[MAX_N], s[MAX_N];\n\nint first[MAX_N], next[MAX_N], ans[MAX_N], fail[MAX_N], f[MAX_N][27];\n\nint st, tag[MAX_N], line[MAX_N];\n\n\n\nvoid solve(int v, int x) {\n\n if (x == l) {\n\n next[++st] = first[v];\n\n first[v] = st;\n\n return;\n", "file_path": "省选/2013/TJOI/单词-AC自动机.cpp", "rank": 17, "score": 46867.164473284094 }, { "content": " return;\n\n }\n\n k -= q[i].b;\n\n }\n\n}\n\n}\n\n\n\nint main() {\n\n#ifdef DBG\n\n freopen(\"in.in\", \"r\", stdin);\n\n#endif\n\n Task::solve();\n\n IO::flush();\n\n return 0;\n\n}\n", "file_path": "atcoder/AtCoder Beginner Contest 061/C.cpp", "rank": 18, "score": 46864.06409351797 }, { "content": " }\n\n if (!f[v][s[x + 1] - 'a']) f[v][s[x + 1] - 'a'] = ++tot;\n\n solve(f[v][s[x + 1] - 'a'], x + 1);\n\n}\n\n\n\nvoid ac_bfs() {\n\n line[1] = 0;\n\n while (head ^ tail) {\n\n head++;\n\n if (line[head])\n\n for (int j = 0; j < 26; j++)\n\n if (f[line[head]][j])\n\n fail[f[line[head]][j]] = f[fail[line[head]]][j];\n\n for (int j = 0; j < 26; j++)\n\n if (!f[line[head]][j])\n\n f[line[head]][j] = f[fail[line[head]]][j];\n\n else\n\n line[++tail] = f[line[head]][j];\n\n }\n\n}\n", "file_path": "省选/2013/TJOI/单词-AC自动机.cpp", "rank": 19, "score": 46857.17617634322 }, { "content": "/*******************************************************************************\n\n * Copyright (c) 2016-2017, xehoth\n\n * All rights reserved.\n\n *\n\n * Redistribution and use in source and binary forms, with or without\n\n * modification, are permitted provided that the following conditions are met:\n\n *\n\n * * Redistributions of source code must retain the above copyright\n\n * notice, this list of conditions and the following disclaimer.\n\n * * Redistributions in binary form must reproduce the above copyright\n\n * notice, this list of conditions and the following disclaimer in the\n\n * documentation and/or other materials provided with the distribution.\n\n * * Neither the name xehoth, nor the names of its contributors may be used\n\n * to endorse or promote products derived from this software without \n\n * specific prior written permission.\n\n *\n\n * THIS SOFTWARE IS PROVIDED BY XEHOTH AND CONTRIBUTORS \"AS IS\" AND ANY\n\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n\n * DISCLAIMED. IN NO EVENT SHALL XEHOTH AND CONTRIBUTORS BE LIABLE FOR ANY\n", "file_path": "atcoder/AtCoder Beginner Contest 061/C.cpp", "rank": 20, "score": 46851.56233734379 }, { "content": "/**\n\n * Copyright (c) 2017, xehoth\n\n * All rights reserved.\n\n * 「ARC 071C」怪文書 20-08-2017\n\n * dp\n\n * @author xehoth\n\n */\n\n#include <bits/stdc++.h>\n\n\n\nnamespace Task {\n\n\n\ninline void solve() {\n\n std::ios::sync_with_stdio(false), std::cin.tie(NULL), std::cout.tie(NULL);\n\n register int n;\n\n std::cin >> n;\n\n std::streambuf *ob = std::cout.rdbuf(), *ib = std::cin.rdbuf();\n\n static int buc[26], f[26];\n\n memset(f, 127, sizeof(f));\n\n register char c;\n\n for (register int i = 0; i < n; i++) {\n", "file_path": "atcoder/AtCoder Regular Contest 071/C-怪文書-dp.cpp", "rank": 21, "score": 44957.653535553814 }, { "content": "/**\n\n * Copyright (c) 2017, xehoth\n\n * All rights reserved.\n\n * 「ARC 080C」4-adjacent 24-08-2017\n\n *\n\n * @author xehoth\n\n */\n\n#include <bits/stdc++.h>\n\n\n\nnamespace Task {\n\n\n\nconst int MAXN = 200000;\n\nint a[MAXN + 1];\n\n\n\ninline void solve() {\n\n std::ios::sync_with_stdio(false), std::cin.tie(NULL), std::cout.tie(NULL);\n\n register int n;\n\n std::cin >> n;\n\n for (register int i = 1; i <= n; i++) std::cin >> a[i];\n\n register int cnt4 = 0, cnt2 = 0, cnt = 0;\n", "file_path": "atcoder/AtCoder Regular Contest 080/C-4-adjacent.cpp", "rank": 22, "score": 44956.8414167616 }, { "content": "/**\n\n * Copyright (c) 2017, xehoth\n\n * All rights reserved.\n\n * 「ARC 085C」HSI 06-12-2017\n\n *\n\n * @author xehoth\n\n */\n\n#include <bits/stdc++.h>\n\n\n\nint main() {\n\n register int n, m;\n\n std::cin >> n >> m;\n\n std::cout << (1900 * m + 100 * (n - m)) * (1 << m);\n\n return 0;\n\n}\n", "file_path": "atcoder/AtCoder Regular Contest 085/C-HSI.cpp", "rank": 23, "score": 44939.50917053249 }, { "content": "\n\nint main() {\n\n // freopen(\"in.in\", \"r\", stdin);\n\n ios::sync_with_stdio(false);\n\n cin.tie(NULL);\n\n cin >> n;\n\n for (register int i = 1; i <= n; i++) {\n\n cin >> (s + 1);\n\n l = strlen(s + 1);\n\n solve(0, 0);\n\n ss[++len] = 'a' + 26;\n\n for (register int j = 1; j <= l; j++) ss[++len] = s[j];\n\n }\n\n ac_bfs();\n\n int pos = 0, now = 0;\n\n for (; pos < len; pos++) tag[now = f[now][ss[pos + 1] - 'a']]++;\n\n for (register int i = tail; i; i--) {\n\n tag[fail[line[i]]] += tag[line[i]];\n\n for (int k = first[line[i]]; k; k = next[k]) ans[k] = tag[line[i]];\n\n }\n\n for (register int i = 1; i <= n; i++) cout << ans[i] << \"\\n\";\n\n return 0;\n\n}", "file_path": "BZOJ/BZOJ3172-单词-AC自动机.cpp", "rank": 24, "score": 44938.41989627859 }, { "content": "/**\n\n * Copyright (c) 2016, xehoth\n\n * All rights reserved.\n\n * 「TJOI 2013」单词 26-07-2016\n\n * AC 自动机\n\n * @author xehoth\n\n */\n\n#include <bits/stdc++.h>\n\n#define MAX_N 1050050\n\nusing namespace std;\n\nint n, len, l, tot, head = 0, tail = 1;\n\nchar ss[MAX_N], s[MAX_N];\n\nint first[MAX_N], next[MAX_N], ans[MAX_N], fail[MAX_N], f[MAX_N][27];\n\nint st, tag[MAX_N], line[MAX_N];\n\n\n\nvoid solve(int v, int x) {\n\n if (x == l) {\n\n next[++st] = first[v];\n\n first[v] = st;\n\n return;\n", "file_path": "BZOJ/BZOJ3172-单词-AC自动机.cpp", "rank": 25, "score": 44938.316746388635 }, { "content": " for (register int i = 1; i <= n; i++) {\n\n if (a[i] % 4 == 0) {\n\n cnt4++;\n\n } else if (a[i] % 2 == 0) {\n\n cnt2++;\n\n } else {\n\n cnt++;\n\n }\n\n }\n\n if (cnt2 == 0 && cnt <= cnt4 + 1) {\n\n std::cout << \"Yes\";\n\n } else if (cnt <= cnt4) {\n\n std::cout << \"Yes\";\n\n } else {\n\n std::cout << \"No\";\n\n }\n\n}\n\n}\n\n\n\nint main() {\n\n Task::solve();\n\n return 0;\n\n}", "file_path": "atcoder/AtCoder Regular Contest 080/C-4-adjacent.cpp", "rank": 26, "score": 44935.969171642966 }, { "content": " memset(buc, 0, sizeof(buc));\n\n while (c = ib->sbumpc(), !isalpha(c))\n\n ;\n\n while (isalpha(c)) buc[c - 'a']++, c = ib->sbumpc();\n\n for (register int i = 0; i < 26; i++) f[i] = std::min(f[i], buc[i]);\n\n }\n\n for (register int i = 0; i < 26; i++)\n\n for (; f[i]--;) ob->sputc('a' + i);\n\n}\n\n}\n\n\n\nint main() {\n\n Task::solve();\n\n return 0;\n\n}\n", "file_path": "atcoder/AtCoder Regular Contest 071/C-怪文書-dp.cpp", "rank": 27, "score": 44930.803211457336 }, { "content": " }\n\n if (!f[v][s[x + 1] - 'a']) f[v][s[x + 1] - 'a'] = ++tot;\n\n solve(f[v][s[x + 1] - 'a'], x + 1);\n\n}\n\n\n\nvoid ac_bfs() {\n\n line[1] = 0;\n\n while (head ^ tail) {\n\n head++;\n\n if (line[head])\n\n for (int j = 0; j < 26; j++)\n\n if (f[line[head]][j])\n\n fail[f[line[head]][j]] = f[fail[line[head]]][j];\n\n for (int j = 0; j < 26; j++)\n\n if (!f[line[head]][j])\n\n f[line[head]][j] = f[fail[line[head]]][j];\n\n else\n\n line[++tail] = f[line[head]][j];\n\n }\n\n}\n", "file_path": "BZOJ/BZOJ3172-单词-AC自动机.cpp", "rank": 28, "score": 44928.32844944776 }, { "content": "class CPlusPlusInterpreter {\n\n public:\n\n CPlusPlusInterpreter() {\n\n init();\n\n funcAndVar();\n\n runFunction(func[\"main\"].first, std::vector<int>());\n\n }\n\n\n\n private:\n\n std::vector<std::string> code;\n\n\n\n inline void init() {\n\n std::ios::sync_with_stdio(false);\n\n std::cin.tie(NULL);\n\n std::cout.tie(NULL);\n\n InputNumber::init();\n\n std::string str, src;\n\n for (register int i = 0; i < 5; i++) std::cin >> str;\n\n while (std::cin >> str) src += str + '\\n';\n\n\n", "file_path": "BZOJ/BZOJ4020.cpp", "rank": 29, "score": 44919.68230560329 }, { "content": "struct Query {\n\n int a, b;\n\n\n\n inline bool operator<(const Query &n) const {\n\n return a < n.a || (a == n.a && b < n.b);\n\n }\n\n} q[MAXN];\n\n\n\ninline void solve() {\n\n using namespace IO;\n\n register int n;\n\n register long long k;\n\n read(n), read(k);\n\n for (register int i = 0; i < n; i++) {\n\n read(q[i].a), read(q[i].b);\n\n }\n\n std::sort(q, q + n);\n\n for (register int i = 0; i < n; i++) {\n\n if (k <= q[i].b) {\n\n print(q[i].a), print('\\n');\n", "file_path": "atcoder/AtCoder Beginner Contest 061/C.cpp", "rank": 30, "score": 44919.68230560329 }, { "content": "/**\n\n * Copyright (c) 2017, xehoth\n\n * All rights reserved.\n\n * 「BZOJ 4264」小C找朋友 16-10-2017\n\n * Hash\n\n * @author xehoth\n\n */\n\n#include <bits/stdc++.h>\n\n\n\nnamespace IO {\n\n\n\ninline char read() {\n\n static const int IN_LEN = 1000000;\n\n static char buf[IN_LEN], *s, *t;\n\n s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin) : 0;\n\n return s == t ? -1 : *s++;\n\n}\n\n\n\ntemplate <typename T>\n\ninline bool read(T &x) {\n", "file_path": "BZOJ/BZOJ4264-小C找朋友-Hash.cpp", "rank": 31, "score": 43202.75764774292 }, { "content": "\n\ntemplate <typename T>\n\ninline void print(T x) {\n\n static int buf[30], cnt;\n\n if (x == 0) {\n\n print('0');\n\n } else {\n\n x < 0 ? (print('-'), x = -x) : 0;\n\n for (cnt = 0; x; x /= 10) buf[++cnt] = x % 10 | 48;\n\n while (cnt) print((char)buf[cnt--]);\n\n }\n\n}\n\n\n\ninline void print(const char *s) {\n\n for (; *s; s++) print(*s);\n\n}\n\n\n\ninline void flush() { fwrite(obuf, 1, oh - obuf, stdout); }\n\n\n", "file_path": "SuperOJ/p1985-字符串-AC自动机.cpp", "rank": 32, "score": 43200.10463597317 }, { "content": "\n\ntemplate <typename T>\n\ninline void print(T x) {\n\n static int buf[30], cnt;\n\n if (x == 0) {\n\n print('0');\n\n } else {\n\n x < 0 ? (print('-'), x = -x) : 0;\n\n for (cnt = 0; x; x /= 10) buf[++cnt] = x % 10 | 48;\n\n while (cnt) print((char)buf[cnt--]);\n\n }\n\n}\n\n\n\ninline void print(const char *s) {\n\n for (; *s; s++) print(*s);\n\n}\n\n\n\ninline void flush() { fwrite(obuf, 1, oh - obuf, stdout); }\n\n\n", "file_path": "BZOJ/BZOJ4264-小C找朋友-Hash.cpp", "rank": 33, "score": 43200.10463597317 }, { "content": "/**\n\n * Copyright (c) 2017, xehoth\n\n * All rights reserved.\n\n * 「SuperOJ 1985」字符串 15-09-2017\n\n * AC 自动机\n\n * @author xehoth\n\n */\n\n#include <bits/stdc++.h>\n\n\n\nnamespace IO {\n\n\n\ninline char read() {\n\n static const int IN_LEN = 1000000;\n\n static char buf[IN_LEN], *s, *t;\n\n s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin) : 0;\n\n return s == t ? -1 : *s++;\n\n}\n\n\n\ntemplate <typename T>\n\ninline bool read(T &x) {\n", "file_path": "SuperOJ/p1985-字符串-AC自动机.cpp", "rank": 34, "score": 43199.79021602961 }, { "content": " static char c;\n\n static bool iosig;\n\n for (c = read(), iosig = false; !isdigit(c); c = read()) {\n\n if (c == -1) return false;\n\n c == '-' ? iosig = true : 0;\n\n }\n\n for (x = 0; isdigit(c); c = read()) x = x * 10 + (c ^ '0');\n\n iosig ? x = -x : 0;\n\n return true;\n\n}\n\n\n\ninline void read(char &c) {\n\n while (c = read(), isspace(c) && c != -1)\n\n ;\n\n}\n\n\n\ninline int read(char *buf) {\n\n register int s = 0;\n\n register char c;\n\n while (c = read(), isspace(c) && c != -1)\n", "file_path": "SuperOJ/p1985-字符串-AC自动机.cpp", "rank": 35, "score": 43197.20495503703 }, { "content": " static char c;\n\n static bool iosig;\n\n for (c = read(), iosig = false; !isdigit(c); c = read()) {\n\n if (c == -1) return false;\n\n c == '-' ? iosig = true : 0;\n\n }\n\n for (x = 0; isdigit(c); c = read()) x = x * 10 + (c ^ '0');\n\n iosig ? x = -x : 0;\n\n return true;\n\n}\n\n\n\ninline void read(char &c) {\n\n while (c = read(), isspace(c) && c != -1)\n\n ;\n\n}\n\n\n\ninline int read(char *buf) {\n\n register int s = 0;\n\n register char c;\n\n while (c = read(), isspace(c) && c != -1)\n", "file_path": "BZOJ/BZOJ4264-小C找朋友-Hash.cpp", "rank": 36, "score": 43197.20495503703 }, { "content": " ;\n\n if (c == -1) {\n\n *buf = 0;\n\n return -1;\n\n }\n\n do\n\n buf[s++] = c;\n\n while (c = read(), !isspace(c) && c != -1);\n\n buf[s] = 0;\n\n return s;\n\n}\n\n\n\nconst int OUT_LEN = 1000000;\n\n\n\nchar obuf[OUT_LEN], *oh = obuf;\n\n\n\ninline void print(char c) {\n\n oh == obuf + OUT_LEN ? (fwrite(obuf, 1, OUT_LEN, stdout), oh = obuf) : 0;\n\n *oh++ = c;\n\n}\n", "file_path": "SuperOJ/p1985-字符串-AC自动机.cpp", "rank": 37, "score": 43191.40343327311 }, { "content": " ;\n\n if (c == -1) {\n\n *buf = 0;\n\n return -1;\n\n }\n\n do\n\n buf[s++] = c;\n\n while (c = read(), !isspace(c) && c != -1);\n\n buf[s] = 0;\n\n return s;\n\n}\n\n\n\nconst int OUT_LEN = 1000000;\n\n\n\nchar obuf[OUT_LEN], *oh = obuf;\n\n\n\ninline void print(char c) {\n\n oh == obuf + OUT_LEN ? (fwrite(obuf, 1, OUT_LEN, stdout), oh = obuf) : 0;\n\n *oh++ = c;\n\n}\n", "file_path": "BZOJ/BZOJ4264-小C找朋友-Hash.cpp", "rank": 38, "score": 43191.40343327311 }, { "content": "struct InputOutputStream {\n\n template <typename T>\n\n inline InputOutputStream &operator>>(T &x) {\n\n read(x);\n\n return *this;\n\n }\n\n\n\n template <typename T>\n\n inline InputOutputStream &operator<<(const T &x) {\n\n print(x);\n\n return *this;\n\n }\n\n\n\n ~InputOutputStream() { flush(); }\n\n} io;\n\n}\n\n\n\nnamespace {\n\n\n\nusing IO::io;\n", "file_path": "BZOJ/BZOJ3453-XLkxc-拉格朗日插值.cpp", "rank": 39, "score": 43187.45358133679 }, { "content": "/**\n\n * Copyright (c) 2017, xehoth\n\n * All rights reserved.\n\n * 「ARC 081C」Make a Rectangle 21-08-2017\n\n * 贪心\n\n * @author xehoth\n\n */\n\n#include <bits/stdc++.h>\n\n\n\nnamespace Task {\n\n\n\n#define long long long\n\n\n\nstd::map<int, int> map;\n\n\n\ninline void solve() {\n\n std::ios::sync_with_stdio(false), std::cin.tie(NULL), std::cout.tie(NULL);\n\n register int n, cnt = 2;\n\n register long ans = 1;\n\n std::cin >> n;\n", "file_path": "atcoder/AtCoder Regular Contest 081/C-Make a Rectangle-贪心.cpp", "rank": 40, "score": 43179.23429021368 }, { "content": "inline void insert(const char *s) {\n\n register Node *p = root;\n\n for (register int idx = 0; *s; s++) {\n\n if (p->c[idx = *s - 'a'] == null) p->c[idx] = new Node();\n\n p = p->c[idx];\n\n }\n\n p->cnt++;\n\n}\n\n\n\ninline void init() {\n\n null->fail = null, root = new Node();\n\n for (register int i = 0; i < MAX_SIGMA; i++) null->c[i] = root;\n\n null->cnt = 0;\n\n}\n\n\n\ninline void build() {\n\n static std::queue<Node *> q;\n\n q.push(root);\n\n for (Node *p, *u; !q.empty();) {\n\n p = q.front(), q.pop();\n", "file_path": "SuperOJ/p1985-字符串-AC自动机.cpp", "rank": 41, "score": 43177.05718239754 }, { "content": "\n\ninline void solve() {\n\n init();\n\n register int n, q, maxLen = 0;\n\n io >> n >> q;\n\n for (register int i = 1; i <= n; i++)\n\n maxLen = std::max(maxLen, IO::read(s)), insert(s);\n\n build();\n\n register int len = IO::read(s + 1);\n\n register char c;\n\n register int ans = query(s + 1, len);\n\n io << ans << '\\n';\n\n for (register int pos; q--;) {\n\n io >> pos >> c;\n\n ans -=\n\n query(s + std::max(pos - maxLen, 1),\n\n std::min(len, pos + maxLen) - std::max(pos - maxLen, 1) + 1);\n\n s[pos] = c;\n\n ans +=\n\n query(s + std::max(pos - maxLen, 1),\n", "file_path": "SuperOJ/p1985-字符串-AC自动机.cpp", "rank": 42, "score": 43175.059690846625 }, { "content": " for (register int i = 0; i < MAX_SIGMA; i++) {\n\n if (p->c[i] != null) {\n\n for (u = p->fail; u->c[i] == null;) u = u->fail;\n\n p->c[i]->fail = u->c[i], q.push(p->c[i]);\n\n p->c[i]->cnt += u->c[i]->cnt;\n\n } else {\n\n p->c[i] = p->fail->c[i];\n\n }\n\n }\n\n }\n\n}\n\n\n\ninline int query(const char *s, register int len) {\n\n register int ret = 0;\n\n register Node *p = root;\n\n for (register int i = 0; i < len; i++) p = p->c[s[i] - 'a'], ret += p->cnt;\n\n return ret;\n\n}\n\n\n\nchar s[MAXN + 1];\n", "file_path": "SuperOJ/p1985-字符串-AC自动机.cpp", "rank": 43, "score": 43171.43953096296 }, { "content": "\n\ntypedef unsigned long long ulong;\n\n\n\ninline ulong xorShift128Plus() {\n\n static ulong seed1 = 495;\n\n static ulong seed2 = 233;\n\n register ulong x = seed1;\n\n register const ulong y = seed2;\n\n seed1 = y, x ^= x << 23;\n\n seed2 = x ^ y ^ (x >> 17) ^ (y >> 26);\n\n return seed2 + y;\n\n}\n\n\n\nconst int MAXN = 1000000;\n\nulong hash[MAXN + 1], val[MAXN + 1], ans, cnt;\n\n\n", "file_path": "BZOJ/BZOJ4264-小C找朋友-Hash.cpp", "rank": 44, "score": 43166.08004296032 }, { "content": " for (register int i = 1; i <= m; i++) {\n\n if (edge[i].u != edge[i].v) {\n\n hash[edge[i].u] ^= val[edge[i].v];\n\n hash[edge[i].v] ^= val[edge[i].u];\n\n }\n\n }\n\n for (register int i = 1; i <= m; i++) {\n\n if (edge[i].u != edge[i].v && ((hash[edge[i].u] ^ val[edge[i].v]) ==\n\n (hash[edge[i].v] ^ val[edge[i].u])))\n\n ans++;\n\n }\n\n std::sort(hash + 1, hash + n + 1);\n\n for (register int i = 1; i <= n; i++) {\n\n cnt++;\n\n if (i == n || hash[i] != hash[i + 1])\n\n ans += cnt * (cnt - 1) >> 1, cnt = 0;\n\n }\n\n io << ans << '\\n';\n\n}\n\n}\n\n\n\nint main() {\n\n solve();\n\n return 0;\n\n}\n", "file_path": "BZOJ/BZOJ4264-小C找朋友-Hash.cpp", "rank": 45, "score": 43164.87668491422 }, { "content": "/**\n\n * Copyright (c) 2017, xehoth\n\n * All rights reserved.\n\n * 「ARC 070C」Go Home 18-08-2017\n\n * 结论题\n\n * @author xehoth\n\n */\n\n#include <bits/stdc++.h>\n\n\n\nint main() {\n\n register int n = 1, x;\n\n std::cin >> x;\n\n while (n * (n + 1) / 2 < x) n++;\n\n std::cout << n;\n\n return 0;\n\n}", "file_path": "atcoder/AtCoder Regular Contest 070/C-GoHome-结论.cpp", "rank": 46, "score": 43163.015017052334 }, { "content": " std::min(len, pos + maxLen) - std::max(pos - maxLen, 1) + 1);\n\n io << ans << '\\n';\n\n }\n\n}\n\n}\n\n\n\nint main() {\n\n // freopen(\"blocks.in\", \"r\", stdin);\n\n // freopen(\"blocks.out\", \"w\", stdout);\n\n solve();\n\n return 0;\n\n}", "file_path": "SuperOJ/p1985-字符串-AC自动机.cpp", "rank": 47, "score": 43161.81053248975 }, { "content": " for (register int i = 0, t; i < n; i++) std::cin >> t, map[t]++;\n\n for (auto it = map.rbegin(); it != map.rend(); it++) {\n\n if (it->second > 1) {\n\n ans *= it->first, cnt--;\n\n if (it->second > 3 && cnt == 1) ans *= it->first, cnt--;\n\n }\n\n if (cnt == 0) break;\n\n }\n\n if (cnt == 0)\n\n std::cout << ans;\n\n else\n\n std::cout << '0';\n\n}\n\n\n\n#undef long\n\n}\n\n\n\nint main() {\n\n Task::solve();\n\n return 0;\n\n}", "file_path": "atcoder/AtCoder Regular Contest 081/C-Make a Rectangle-贪心.cpp", "rank": 48, "score": 43159.14141731502 }, { "content": "#include <bits/stdc++.h>\n\n\n\nnamespace IO {\n\n\n\ninline char read() {\n\n static const int IN_LEN = 1000000;\n\n static char buf[IN_LEN], *s, *t;\n\n s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin) : 0;\n\n return s == t ? -1 : *s++;\n\n}\n\n\n\ntemplate <typename T>\n\ninline void read(T &x) {\n\n static char c;\n\n static bool iosig;\n\n for (c = read(), iosig = false; !isdigit(c); c = read()) {\n\n if (c == -1) return;\n\n c == '-' ? iosig = true : 0;\n\n }\n\n for (x = 0; isdigit(c); c = read()) x = (x + (x << 2) << 1) + (c ^ '0');\n", "file_path": "codeforces/Codeforces Round #417 (Div. 2)/C-Sagheer and Nubian Market-二分.cpp", "rank": 49, "score": 41569.732126468756 }, { "content": "inline void read(T1 &a, T2 &b, T3 &c, T4 &d, T5 &e) {\n\n read(a), read(b), read(c), read(d), read(e);\n\n}\n\n\n\nconst int OUT_LEN = 1000000;\n\n\n\nchar obuf[OUT_LEN], *oh = obuf;\n\n\n\ninline void print(char c) {\n\n oh == obuf + OUT_LEN ? (fwrite(obuf, 1, OUT_LEN, stdout), oh = obuf) : 0;\n\n *oh++ = c;\n\n}\n\n\n\ntemplate <typename T>\n\ninline void print(T x) {\n\n static int buf[30], cnt;\n\n if (x == 0) {\n\n print('0');\n\n } else {\n\n x < 0 ? (print('-'), x = -x) : 0;\n", "file_path": "codeforces/Codeforces Round #417 (Div. 2)/C-Sagheer and Nubian Market-二分.cpp", "rank": 50, "score": 41561.57939287101 }, { "content": "}\n\n\n\ntemplate <typename T>\n\ninline void read(T &x) {\n\n static char c;\n\n static bool iosig;\n\n for (c = read(), iosig = false; !isdigit(c); c = read()) {\n\n if (c == -1) return;\n\n c == '-' ? iosig = true : 0;\n\n }\n\n for (x = 0; isdigit(c); c = read()) x = (x + (x << 2) << 1) + (c ^ '0');\n\n iosig ? x = -x : 0;\n\n}\n\n\n\ninline int read(char *buf) {\n\n register int s = 0;\n\n register char c;\n\n while (c = read(), isspace(c) && c != -1)\n\n ;\n\n if (c == -1) {\n", "file_path": "codeforces/Codeforces Round #416 (Div. 2)/C-Vladik and Memorable Trip.cpp", "rank": 51, "score": 41560.188116102676 }, { "content": " oh == obuf + OUT_LEN ? (fwrite(obuf, 1, OUT_LEN, stdout), oh = obuf) : 0;\n\n *oh++ = c;\n\n}\n\n\n\ntemplate <typename T>\n\ninline void print(T x) {\n\n static int buf[30], cnt;\n\n if (x == 0) {\n\n print('0');\n\n } else {\n\n x < 0 ? (print('-'), x = -x) : 0;\n\n for (cnt = 0; x; x /= 10) buf[++cnt] = x % 10 | 48;\n\n while (cnt) print((char)buf[cnt--]);\n\n }\n\n}\n\n\n\ninline void print(const char *s) {\n\n for (; *s; s++) print(*s);\n\n}\n\n\n", "file_path": "codeforces/Codeforces Round #416 (Div. 2)/C-Vladik and Memorable Trip.cpp", "rank": 52, "score": 41559.7109399017 }, { "content": "template <typename T1, typename T2, typename T3, typename T4, typename T5>\n\ninline void println(T1 a, T2 b, T3 c, T4 d, T5 e) {\n\n print(a), print(b), print(c), print(d), print(e), print('\\n');\n\n}\n\n\n\ninline void flush() { fwrite(obuf, 1, oh - obuf, stdout); }\n\n}\n\n\n\nnamespace Task {\n\n\n\nconst int MAXN = 5005;\n\n\n\ntypedef std::pair<int, int> Pair;\n\n\n\ninline void solve() {\n\n using namespace IO;\n\n register int n;\n\n read(n);\n\n static int l[MAXN], r[MAXN], a[MAXN];\n\n memset(l, 127, sizeof(int) * (MAXN + 1));\n", "file_path": "codeforces/Codeforces Round #416 (Div. 2)/C-Vladik and Memorable Trip.cpp", "rank": 53, "score": 41551.38850288457 }, { "content": " iosig ? x = -x : 0;\n\n}\n\n\n\ninline int read(char *buf) {\n\n register int s = 0;\n\n register char c;\n\n while (c = read(), isspace(c) && c != -1)\n\n ;\n\n if (c == -1) {\n\n *buf = '\\0';\n\n return -1;\n\n }\n\n do\n\n buf[s++] = c;\n\n while (c = read(), !isspace(c) && c != -1);\n\n buf[s] = '\\0';\n\n return s;\n\n}\n\n\n\ninline void read(double &x) {\n", "file_path": "codeforces/Codeforces Round #417 (Div. 2)/C-Sagheer and Nubian Market-二分.cpp", "rank": 54, "score": 41548.1522809269 }, { "content": " * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n ******************************************************************************/\n\n#include <bits/stdc++.h>\n\n/**\n\n * T1 28-05-2017\n\n * dp\n\n * @author xehoth\n\n */\n\nnamespace IO {\n\n\n\ninline char read() {\n\n static const int IN_LEN = 1000000;\n\n static char buf[IN_LEN], *s, *t;\n\n s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin) : 0;\n\n return s == t ? -1 : *s++;\n", "file_path": "codeforces/Codeforces Round #416 (Div. 2)/C-Vladik and Memorable Trip.cpp", "rank": 55, "score": 41541.88065038773 }, { "content": " *buf = '\\0';\n\n return -1;\n\n }\n\n do\n\n buf[s++] = c;\n\n while (c = read(), !isspace(c) && c != -1);\n\n buf[s] = '\\0';\n\n return s;\n\n}\n\n\n\ninline void read(double &x) {\n\n static char buf[30];\n\n read(buf), x = atof(buf);\n\n}\n\n\n\ntemplate <typename T1, typename T2>\n\ninline void read(T1 &a, T2 &b) {\n\n read(a), read(b);\n\n}\n\n\n", "file_path": "codeforces/Codeforces Round #416 (Div. 2)/C-Vladik and Memorable Trip.cpp", "rank": 56, "score": 41540.90262603176 }, { "content": "template <typename T1, typename T2, typename T3>\n\ninline void read(T1 &a, T2 &b, T3 &c) {\n\n read(a), read(b), read(c);\n\n}\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4>\n\ninline void read(T1 &a, T2 &b, T3 &c, T4 &d) {\n\n read(a), read(b), read(c), read(d);\n\n}\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\n\ninline void read(T1 &a, T2 &b, T3 &c, T4 &d, T5 &e) {\n\n read(a), read(b), read(c), read(d), read(e);\n\n}\n\n\n\nconst int OUT_LEN = 1000000;\n\n\n\nchar obuf[OUT_LEN], *oh = obuf;\n\n\n\ninline void print(char c) {\n", "file_path": "codeforces/Codeforces Round #416 (Div. 2)/C-Vladik and Memorable Trip.cpp", "rank": 57, "score": 41540.690951637174 }, { "content": "/**\n\n * Copyright (c) 2017, xehoth\n\n * All rights reserved.\n\n * 「ARC 079C」Cat Snuke and a Voyage 26-08-2017\n\n *\n\n * @author xehoth\n\n */\n\n#include <bits/stdc++.h>\n\n\n\nnamespace {\n\n\n\nconst int MAXN = 200000;\n\nbool vis[MAXN + 1];\n\n\n\ninline void solve() {\n\n std::ios::sync_with_stdio(false), std::cin.tie(NULL), std::cout.tie(NULL);\n\n register int n, m, u, v;\n\n for (std::cin >> n >> m; m--;) {\n\n std::cin >> u >> v;\n\n if (u == 1) {\n", "file_path": "atcoder/AtCoder Regular Contest 079/C-Cat Snuke and a Voyage.cpp", "rank": 58, "score": 41537.85546304997 }, { "content": " static char buf[30];\n\n read(buf), x = atof(buf);\n\n}\n\n\n\ntemplate <typename T1, typename T2>\n\ninline void read(T1 &a, T2 &b) {\n\n read(a), read(b);\n\n}\n\n\n\ntemplate <typename T1, typename T2, typename T3>\n\ninline void read(T1 &a, T2 &b, T3 &c) {\n\n read(a), read(b), read(c);\n\n}\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4>\n\ninline void read(T1 &a, T2 &b, T3 &c, T4 &d) {\n\n read(a), read(b), read(c), read(d);\n\n}\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\n", "file_path": "codeforces/Codeforces Round #417 (Div. 2)/C-Sagheer and Nubian Market-二分.cpp", "rank": 59, "score": 41537.553621957086 }, { "content": " for (cnt = 0; x; x /= 10) buf[++cnt] = x % 10 | 48;\n\n while (cnt) print((char)buf[cnt--]);\n\n }\n\n}\n\n\n\ninline void print(const char *s) {\n\n for (; *s; s++) print(*s);\n\n}\n\n\n\ntemplate <typename T>\n\ninline void println(T x) {\n\n print(x), print('\\n');\n\n}\n\n\n\ntemplate <typename T1, typename T2>\n\ninline void print(T1 a, T2 b) {\n\n print(a), print(b);\n\n}\n\n\n\ntemplate <typename T1, typename T2, typename T3>\n", "file_path": "codeforces/Codeforces Round #417 (Div. 2)/C-Sagheer and Nubian Market-二分.cpp", "rank": 60, "score": 41536.81586556131 }, { "content": "inline void println(T1 a, T2 b, T3 c) {\n\n print(a), print(b), print(c), print('\\n');\n\n}\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4>\n\ninline void println(T1 a, T2 b, T3 c, T4 d) {\n\n print(a), print(b), print(c), print(d), print('\\n');\n\n}\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\n\ninline void println(T1 a, T2 b, T3 c, T4 d, T5 e) {\n\n print(a), print(b), print(c), print(d), print(e), print('\\n');\n\n}\n\n\n\ninline void flush() { fwrite(obuf, 1, oh - obuf, stdout); }\n\n}\n\n\n\nnamespace Task {\n\n\n\nconst int MAXN = 100010;\n", "file_path": "codeforces/Codeforces Round #417 (Div. 2)/C-Sagheer and Nubian Market-二分.cpp", "rank": 61, "score": 41534.966491103805 }, { "content": "\n\n#define long long long\n\nlong cost[MAXN], base[MAXN];\n\nlong n, S;\n\n\n\ninline bool check(long m) {\n\n for (int i = 1; i <= n; i++) {\n\n cost[i] = base[i] + i * m;\n\n }\n\n std::sort(cost + 1, cost + n + 1);\n\n long s = 0;\n\n for (int i = 1; i <= m; ++i) {\n\n s += cost[i];\n\n }\n\n return s <= S;\n\n}\n\n\n\ninline void solve() {\n\n using namespace IO;\n\n read(n), read(S);\n", "file_path": "codeforces/Codeforces Round #417 (Div. 2)/C-Sagheer and Nubian Market-二分.cpp", "rank": 62, "score": 41534.063968292714 }, { "content": " for (register int i = 0; i < n; i++) {\n\n read(a[i]);\n\n l[a[i]] = std::min(l[a[i]], i), r[a[i]] = i;\n\n }\n\n static std::vector<Pair> vec[MAXN];\n\n for (register int i = 0; i < n; i++) {\n\n bool vis[MAXN] = {false};\n\n register int x = 0, min = INT_MAX, max = INT_MIN;\n\n for (register int j = i; j < n; j++) {\n\n if (!vis[a[j]]) x ^= a[j], vis[a[j]] = true;\n\n min = std::min(min, l[a[j]]), max = std::max(max, r[a[j]]);\n\n if (min >= i && max <= j) vec[i].emplace_back(j, x);\n\n }\n\n }\n\n static int f[MAXN];\n\n for (register int i = 0; i < n; i++) {\n\n for (const auto &j : vec[i])\n\n f[j.first + 1] = std::max(f[j.first + 1], f[i] + j.second);\n\n f[i + 1] = std::max(f[i + 1], f[i]);\n\n }\n", "file_path": "codeforces/Codeforces Round #416 (Div. 2)/C-Vladik and Memorable Trip.cpp", "rank": 63, "score": 41526.06885192274 }, { "content": " for (register int i = 1; i <= n; i++) read(base[i]);\n\n static long sum[MAXN];\n\n register int l = 0, r = n + 1;\n\n while (r - l > 1) {\n\n register int mid = l + r >> 1;\n\n if (check(mid))\n\n l = mid;\n\n else\n\n r = mid;\n\n }\n\n print(l), print(' ');\n\n for (int i = 1; i <= n; i++) {\n\n cost[i] = base[i] + i * l;\n\n }\n\n std::sort(cost + 1, cost + n + 1);\n\n long s = 0;\n\n for (int i = 1; i <= l; ++i) {\n\n s += cost[i];\n\n }\n\n print(s);\n", "file_path": "codeforces/Codeforces Round #417 (Div. 2)/C-Sagheer and Nubian Market-二分.cpp", "rank": 64, "score": 41522.89730630432 }, { "content": " print(std::max(f[n], f[n + 1]));\n\n}\n\n}\n\n\n\nint main() {\n\n#ifdef DBG\n\n freopen(\"in.in\", \"r\", stdin);\n\n freopen(\"out.out\", \"w\", stdout);\n\n freopen(\"debug.log\", \"w\", stderr);\n\n#endif\n\n Task::solve();\n\n IO::flush();\n\n return 0;\n\n}", "file_path": "codeforces/Codeforces Round #416 (Div. 2)/C-Vladik and Memorable Trip.cpp", "rank": 65, "score": 41521.26228824745 }, { "content": "template <typename T>\n\ninline void println(T x) {\n\n print(x), print('\\n');\n\n}\n\n\n\ntemplate <typename T1, typename T2>\n\ninline void print(T1 a, T2 b) {\n\n print(a), print(b);\n\n}\n\n\n\ntemplate <typename T1, typename T2, typename T3>\n\ninline void print(T1 a, T2 b, T3 c) {\n\n print(a), print(b), print(c);\n\n}\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4>\n\ninline void print(T1 a, T2 b, T3 c, T4 d) {\n\n print(a), print(b), print(c), print(d);\n\n}\n\n\n", "file_path": "codeforces/Codeforces Round #416 (Div. 2)/C-Vladik and Memorable Trip.cpp", "rank": 66, "score": 41519.79718656047 }, { "content": "inline void print(T1 a, T2 b, T3 c) {\n\n print(a), print(b), print(c);\n\n}\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4>\n\ninline void print(T1 a, T2 b, T3 c, T4 d) {\n\n print(a), print(b), print(c), print(d);\n\n}\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\n\ninline void print(T1 a, T2 b, T3 c, T4 d, T5 e) {\n\n print(a), print(b), print(c), print(d), print(e);\n\n}\n\n\n\ntemplate <typename T1, typename T2>\n\ninline void println(T1 a, T2 b) {\n\n print(a), print(b), print('\\n');\n\n}\n\n\n\ntemplate <typename T1, typename T2, typename T3>\n", "file_path": "codeforces/Codeforces Round #417 (Div. 2)/C-Sagheer and Nubian Market-二分.cpp", "rank": 67, "score": 41518.887755326636 }, { "content": "template <typename T1, typename T2, typename T3, typename T4, typename T5>\n\ninline void print(T1 a, T2 b, T3 c, T4 d, T5 e) {\n\n print(a), print(b), print(c), print(d), print(e);\n\n}\n\n\n\ntemplate <typename T1, typename T2>\n\ninline void println(T1 a, T2 b) {\n\n print(a), print(b), print('\\n');\n\n}\n\n\n\ntemplate <typename T1, typename T2, typename T3>\n\ninline void println(T1 a, T2 b, T3 c) {\n\n print(a), print(b), print(c), print('\\n');\n\n}\n\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4>\n\ninline void println(T1 a, T2 b, T3 c, T4 d) {\n\n print(a), print(b), print(c), print(d), print('\\n');\n\n}\n\n\n", "file_path": "codeforces/Codeforces Round #416 (Div. 2)/C-Vladik and Memorable Trip.cpp", "rank": 68, "score": 41518.7806519511 }, { "content": "}\n\n}\n\n\n\nint main() {\n\n#ifdef DBG\n\n freopen(\"in.in\", \"r\", stdin);\n\n#endif\n\n Task::solve();\n\n IO::flush();\n\n return 0;\n\n}", "file_path": "codeforces/Codeforces Round #417 (Div. 2)/C-Sagheer and Nubian Market-二分.cpp", "rank": 69, "score": 41517.75721729353 }, { "content": " if (vis[v]) std::cout << \"POSSIBLE\", exit(0);\n\n vis[v] = true;\n\n } else if (v == n) {\n\n if (vis[u]) std::cout << \"POSSIBLE\", exit(0);\n\n vis[u] = true;\n\n }\n\n }\n\n std::cout << \"IMPOSSIBLE\";\n\n}\n\n}\n\n\n\nint main() {\n\n solve();\n\n return 0;\n\n}", "file_path": "atcoder/AtCoder Regular Contest 079/C-Cat Snuke and a Voyage.cpp", "rank": 70, "score": 41506.15465165505 }, { "content": "/*******************************************************************************\n\n * Copyright (c) 2016-2017, xehoth\n\n * All rights reserved.\n\n *\n\n * Redistribution and use in source and binary forms, with or without\n\n * modification, are permitted provided that the following conditions are met:\n\n *\n\n * * Redistributions of source code must retain the above copyright\n\n * notice, this list of conditions and the following disclaimer.\n\n * * Redistributions in binary form must reproduce the above copyright\n\n * notice, this list of conditions and the following disclaimer in the\n\n * documentation and/or other materials provided with the distribution.\n\n * * Neither the name xehoth, nor the names of its contributors may be used\n\n * to endorse or promote products derived from this software without\n\n * specific prior written permission.\n\n *\n\n * THIS SOFTWARE IS PROVIDED BY XEHOTH AND CONTRIBUTORS \"AS IS\" AND ANY\n\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n\n * DISCLAIMED. IN NO EVENT SHALL XEHOTH AND CONTRIBUTORS BE LIABLE FOR ANY\n", "file_path": "codeforces/Codeforces Round #416 (Div. 2)/C-Vladik and Memorable Trip.cpp", "rank": 71, "score": 41505.255461119355 }, { "content": "struct Edge {\n\n int u, v;\n\n\n\n inline bool operator<(const Edge &x) const {\n\n return u == x.u && v < x.v && u < x.u;\n\n }\n\n\n\n inline bool operator==(const Edge &x) const { return u == x.u && v == x.v; }\n\n} edge[MAXN + 1];\n\n\n\ninline void solve() {\n\n register int n, m;\n\n io >> n >> m;\n\n for (register int i = 1; i <= n; i++) val[i] = xorShift128Plus();\n\n for (register int i = 1; i <= m; i++) {\n\n io >> edge[i].u >> edge[i].v;\n\n if (edge[i].u > edge[i].v) std::swap(edge[i].u, edge[i].v);\n\n }\n\n std::sort(edge + 1, edge + m + 1);\n\n m = std::unique(edge + 1, edge + m + 1) - edge - 1;\n", "file_path": "BZOJ/BZOJ4264-小C找朋友-Hash.cpp", "rank": 72, "score": 41502.22315627431 }, { "content": "struct Node {\n\n Node *c[MAX_SIGMA], *fail;\n\n int cnt;\n\n Node();\n\n\n\n inline void *operator new(size_t);\n\n};\n\n\n\nconst int NODE_SIZE = sizeof(Node);\n\n\n\nchar pool[MAXN * NODE_SIZE], *cur = pool;\n\n\n\nNode *null = (Node *)pool, *root;\n\n\n\nNode::Node() : fail(null), cnt(0) {\n\n for (register int i = 0; i < MAX_SIGMA; i++) c[i] = null;\n\n}\n\n\n\ninline void *Node::operator new(size_t) { return cur += NODE_SIZE; }\n\n\n", "file_path": "SuperOJ/p1985-字符串-AC自动机.cpp", "rank": 73, "score": 41502.22315627431 }, { "content": "struct InputOutputStream {\n\n template <typename T>\n\n inline InputOutputStream &operator>>(T &x) {\n\n read(x);\n\n return *this;\n\n }\n\n\n\n template <typename T>\n\n inline InputOutputStream &operator<<(const T &x) {\n\n print(x);\n\n return *this;\n\n }\n\n\n\n ~InputOutputStream() { flush(); }\n\n} io;\n\n}\n\n\n\nnamespace {\n\n\n\nconst int MAXN = 100000;\n\nconst int MAX_SIGMA = 26;\n\n\n\nusing IO::io;\n\n\n", "file_path": "SuperOJ/p1985-字符串-AC自动机.cpp", "rank": 74, "score": 38567.996018015816 }, { "content": "struct InputOutputStream {\n\n template <typename T>\n\n inline InputOutputStream &operator>>(T &x) {\n\n read(x);\n\n return *this;\n\n }\n\n\n\n template <typename T>\n\n inline InputOutputStream &operator<<(const T &x) {\n\n print(x);\n\n return *this;\n\n }\n\n\n\n ~InputOutputStream() { flush(); }\n\n} io;\n\n}\n\n\n\nnamespace {\n\n\n\nusing IO::io;\n", "file_path": "BZOJ/BZOJ4264-小C找朋友-Hash.cpp", "rank": 75, "score": 38567.996018015816 }, { "content": "from math import log2\n\nn, l, r = map(int, input().split())\n\na = list(map(int, list(bin(n)[2:])))\n\nans = 0\n\nfor i in range(l, r + 1):\n\n ans += a[int(log2(i & -i))]\n", "file_path": "codeforces/Divide by Zero 2017 and Codeforces Round #399 (Div. 1 + Div. 2, combined) 768/B-Code For 1.py", "rank": 76, "score": 37316.93525783213 }, { "content": "inline void print(char c) {\n\n oh == obuf + OUT_LEN ? (fwrite(obuf, 1, OUT_LEN, stdout), oh = obuf) : 0;\n\n *oh++ = c;\n\n}\n\n\n\ntemplate <typename T>\n\ninline void print(T x) {\n\n static int buf[30], cnt;\n\n if (x == 0) {\n\n print('0');\n\n } else {\n\n x < 0 ? (print('-'), x = -x) : 0;\n\n for (cnt = 0; x; x /= 10) buf[++cnt] = x % 10 | 48;\n\n while (cnt) print((char)buf[cnt--]);\n\n }\n\n}\n\n\n\ninline void flush() { fwrite(obuf, 1, oh - obuf, stdout); }\n\n\n", "file_path": "BZOJ/BZOJ3578-GTY的人类基因组计划2-HASH.cpp", "rank": 77, "score": 33884.844745402865 }, { "content": "inline void read(T &x) {\n\n static char c;\n\n static bool iosig;\n\n for (c = read(), iosig = false; !isdigit(c); c = read()) {\n\n if (c == -1) return;\n\n c == '-' ? iosig = true : 0;\n\n }\n\n for (x = 0; isdigit(c); c = read()) x = x * 10 + (c ^ '0');\n\n iosig ? x = -x : 0;\n\n}\n\n\n\ninline void read(char &c) {\n\n while (c = read(), isspace(c) && c != -1)\n\n ;\n\n}\n\n\n\nconst int OUT_LEN = 100000;\n\n\n\nchar obuf[OUT_LEN], *oh = obuf;\n\n\n", "file_path": "BZOJ/BZOJ3578-GTY的人类基因组计划2-HASH.cpp", "rank": 78, "score": 33880.28840925502 }, { "content": "/**\n\n * Copyright (c) 2017, xehoth\n\n * All rights reserved.\n\n * 「BZOJ 3578」GTY的人类基因组计划2 07-10-2017\n\n * Hash\n\n * @author xehoth\n\n */\n\n#include <bits/stdc++.h>\n\n#include <tr1/unordered_set>\n\n\n\nnamespace IO {\n\n\n\ninline char read() {\n\n static const int IN_LEN = 1000000;\n\n static char buf[IN_LEN], *s, *t;\n\n s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin) : 0;\n\n return s == t ? -1 : *s++;\n\n}\n\n\n\ntemplate <typename T>\n", "file_path": "BZOJ/BZOJ3578-GTY的人类基因组计划2-HASH.cpp", "rank": 79, "score": 33877.14690435087 }, { "content": "inline void solve() {\n\n io >> n >> m >> q;\n\n for (register int i = 1; i <= n; i++) num[i] = xorShift128Plus();\n\n s.insert(1);\n\n for (register int i = 1; i <= n; i++) h[1] ^= num[i], size[1]++, pos[i] = 1;\n\n for (register int i = 1, x, y; i <= q; i++) {\n\n register char c;\n\n io >> c >> x >> y;\n\n switch (c) {\n\n case 'C': {\n\n if (pos[x] == y) continue;\n\n s.erase(pos[x]), s.erase(y);\n\n h[pos[x]] ^= num[x], size[pos[x]]--;\n\n if (exist.find(h[pos[x]]) == exist.end()) s.insert(pos[x]);\n\n h[y] ^= num[x], size[y]++;\n\n if (exist.find(h[y]) == exist.end()) s.insert(y);\n\n pos[x] = y;\n\n break;\n\n }\n\n case 'W': {\n", "file_path": "BZOJ/BZOJ3578-GTY的人类基因组计划2-HASH.cpp", "rank": 80, "score": 33856.30848542977 }, { "content": "\n\ninline ulong xorShift128Plus() {\n\n static ulong seed1 = 495;\n\n static ulong seed2 = 233;\n\n register ulong x = seed1;\n\n register const ulong y = seed2;\n\n seed1 = y, x ^= x << 23;\n\n seed2 = x ^ y ^ (x >> 17) ^ (y >> 26);\n\n return seed2 + y;\n\n}\n\n\n\nusing IO::io;\n\n\n\nstd::set<int> s;\n\nstd::tr1::unordered_set<ulong> exist;\n\nconst int MAXN = 100010;\n\n\n\nulong num[MAXN], size[MAXN], pos[MAXN], h[MAXN];\n\nint n, m, q;\n\n\n", "file_path": "BZOJ/BZOJ3578-GTY的人类基因组计划2-HASH.cpp", "rank": 81, "score": 33850.02791895626 }, { "content": " register int ans = 0;\n\n for (register std::set<int>::iterator it = s.lower_bound(x);\n\n it != s.end() && *it <= y; it = s.lower_bound(x))\n\n exist.insert(h[*it]), ans += size[*it], s.erase(it);\n\n io << ans << '\\n';\n\n break;\n\n }\n\n }\n\n }\n\n}\n\n}\n\n\n\nint main() {\n\n#ifdef DBG\n\n freopen(\"sample/1.in\", \"r\", stdin);\n\n#endif\n\n solve();\n\n return 0;\n\n}", "file_path": "BZOJ/BZOJ3578-GTY的人类基因组计划2-HASH.cpp", "rank": 82, "score": 33845.82159125843 }, { "content": "struct MulInv<mod, 0, inv> {\n\n static const uint INV = inv;\n\n};\n\n\n\ntemplate <uint mod>\n", "file_path": "BZOJ/BZOJ4517-排列计数-组合数学+取模优化.cpp", "rank": 83, "score": 33394.67431568321 }, { "content": "struct MulInv<mod, 0, inv> {\n\n static const uint INV = inv;\n\n};\n\n\n\ntemplate <uint mod>\n", "file_path": "SuperOJ/p2103-呼吸决定-扩展埃筛+自然数幂和+取模优化.cpp", "rank": 84, "score": 33394.67431568321 }, { "content": "struct Node *pos[MAXN + 1];\n", "file_path": "BZOJ/BZOJ3600-没有人的算术-线段树 + 替罪羊树 + 动态标号.cpp", "rank": 85, "score": 33377.9904410897 }, { "content": "struct InputOutputStream {\n\n ~InputOutputStream() { flush(); }\n\n\n\n template <typename T>\n\n inline InputOutputStream &operator<<(const T &x) {\n\n print(x);\n\n return *this;\n\n }\n\n\n\n template <typename T>\n\n inline InputOutputStream &operator>>(T &x) {\n\n read(x);\n\n return *this;\n\n }\n\n} io;\n\n}\n\n\n\nnamespace {\n\n\n\ntypedef unsigned long long ulong;\n", "file_path": "BZOJ/BZOJ3578-GTY的人类基因组计划2-HASH.cpp", "rank": 86, "score": 30950.180198459668 }, { "content": "k, q = map(int, input().split())\n\ndp = [[0.0 for i in range(k + 1)] for j in range(10000)]\n\ndp[0][0] = 1.0\n\nfor i in range(1, 10000):\n\n for j in range(1, k + 1):\n\n dp[i][j] = dp[i - 1][j] * j / k + dp[i - 1][j - 1] * (k - j + 1) / k\n\nfor t in range(q):\n\n p = int(input())\n\n for i in range(10000):\n\n if p <= dp[i][k] * 2000:\n\n print(i)\n", "file_path": "codeforces/Divide by Zero 2017 and Codeforces Round #399 (Div. 1 + Div. 2, combined) 768/D-Jon and Orbs.py", "rank": 87, "score": 28891.164188639457 }, { "content": "from math import sqrt\n\nk = 0\n\nfor t in range(int(input())): k ^= int(int(sqrt(8 * int(input()) + 1) - 1) / 2)\n", "file_path": "codeforces/Divide by Zero 2017 and Codeforces Round #399 (Div. 1 + Div. 2, combined) 768/E-Game of Stones.py", "rank": 88, "score": 28891.164188639457 }, { "content": "n = int(input())\n\ni = list(map(int, input().split()))\n", "file_path": "codeforces/Divide by Zero 2017 and Codeforces Round #399 (Div. 1 + Div. 2, combined) 768/A-Oath of the Night's Watch.py", "rank": 89, "score": 27083.75681566728 }, { "content": "#include <cmath>\n\n#include <cstddef>\n\n#include <cstdio>\n\n#include <cstring>\n\n#include <iostream>\n\n#include <map>\n\n#include <vector>\n\n\n\ninline char read() {\n\n static const int IN_LEN = 1 << 18 | 1;\n\n static char buf[IN_LEN], *s, *t;\n\n return (s == t) && (t = (s = buf) + fread(buf, 1, IN_LEN, stdin)),\n\n s == t ? -1 : *s++;\n\n}\n\n\n\ntemplate <typename T>\n\ninline void read(T &x) {\n\n static char c;\n\n static bool iosig;\n\n for (c = read(), iosig = false; !isdigit(c); c = read()) {\n", "file_path": "BZOJ/BZOJ2402-陶陶的难题II.cpp", "rank": 90, "score": 71.87701857953616 }, { "content": " for (cnt = 0; x; x /= 10) buf[++cnt] = x % 10 | 48;\n\n while (cnt) print((char)buf[cnt--]);\n\n }\n\n}\n\n\n\ninline void flush() { fwrite(obuf, 1, oh - obuf, stdout); }\n\n}\n\n\n\nnamespace Task {\n\n\n\nconst int MAXN = 1010;\n\n\n\nbool isPalindrome[MAXN][MAXN];\n\nchar s[MAXN];\n\n\n\ninline void solve() {\n\n using namespace IO;\n\n register int t;\n\n for (read(t); t--;) {\n\n register int n = read(s);\n", "file_path": "UVA/UVA11584-PartitioningbyPalindromes-dp.cpp", "rank": 91, "score": 71.0758960789894 }, { "content": "#include <cstdio>\n\n#include <cctype>\n\n\n\ninline char read() {\n\n static const int IN_LEN = 1000000;\n\n static char buf[IN_LEN], *s, *t;\n\n s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin) : 0;\n\n return s == t ? -1 : *s++;\n\n}\n\n\n\ntemplate <class T>\n\ninline void read(T &x) {\n\n static char c;\n\n static bool iosig;\n\n for (c = read(), iosig = false; !isdigit(c); c = read()) {\n\n if (c == -1) return;\n\n c == '-' ? iosig = true : 0;\n\n }\n\n for (x = 0; isdigit(c); c = read()) x = (x + (x << 2) << 1) + (c ^ '0');\n\n iosig ? x = -x : 0;\n", "file_path": "BZOJ/BZOJ2733_new_seg.cpp", "rank": 92, "score": 70.02926876647689 }, { "content": "namespace {\n\n\n\n inline char read() {\n\n static const int IN_LEN = 1 << 18 | 1;\n\n static char buf[IN_LEN], *s, *t;\n\n return (s == t) && (t = (s = buf) + fread(buf, 1, IN_LEN, stdin)), s == t ? -1 : *s++;\n\n }\n\n\n\n const int OUT_LEN = 1 << 18 | 1;\n\n\n\n char obuf[OUT_LEN], *oh = obuf;\n\n\n\n inline void print(char c) {\n\n (oh == obuf + OUT_LEN) && (fwrite(obuf, 1, OUT_LEN, stdout), oh = obuf);\n\n *oh++ = c;\n\n }\n\n\n\n template <typename T>\n\n inline void print(T x) {\n\n static int buf[21], cnt;\n", "file_path": "loj/LOJ6029-市场-线段树.cpp", "rank": 93, "score": 69.30127679886067 }, { "content": " print('0');\n\n } else {\n\n x < 0 ? (print('-'), x = -x) : 0;\n\n for (cnt = 0; x; x /= 10) buf[++cnt] = x % 10 | 48;\n\n while (cnt) print((char)buf[cnt--]);\n\n }\n\n}\n\n\n\ninline void flush() { fwrite(obuf, 1, oh - obuf, stdout); }\n\n}\n\n\n\nnamespace Task {\n\n\n\nconst int MAXN = 2000;\n\n\n\ninline void solve() {\n\n using namespace IO;\n\n register int n;\n\n read(n);\n\n static struct Array {\n", "file_path": "BZOJ/BZOJ4247-挂饰-dp.cpp", "rank": 94, "score": 68.89449207159889 }, { "content": " for (cnt = 0; x; x /= 10) buf[++cnt] = x % 10 | 48;\n\n while (cnt) print((char)buf[cnt--]);\n\n }\n\n}\n\n\n\ninline void flush() { fwrite(obuf, 1, oh - obuf, stdout); }\n\n}\n\n\n\nnamespace Task {\n\n\n\nconst int MAXN = 50;\n\nconst int MAXM = 50;\n\nconst int MAXT = 2500;\n\n\n\ninline void solve() {\n\n using namespace IO;\n\n register int n, m, t;\n\n read(n), read(m), read(t);\n\n static int w[MAXN][MAXM + 1], f[MAXM + 1][MAXM + 1];\n\n for (register int i = 0; i < n; i++) {\n", "file_path": "省选/2009/SCOI/粉刷匠-dp.cpp", "rank": 95, "score": 68.8555102420587 }, { "content": "#include <bits/stdc++.h>\n\n\n\nnamespace IO {\n\n\n\ninline char read() {\n\n static const int IN_LEN = 1000000;\n\n static char buf[IN_LEN], *s, *t;\n\n s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin) : 0;\n\n return s == t ? -1 : *s++;\n\n}\n\n\n\ntemplate <class T>\n\ninline void read(T &x) {\n\n static char c;\n\n static bool iosig;\n\n for (c = read(), iosig = false; !isdigit(c); c = read()) {\n\n if (c == -1) return;\n\n c == '-' ? iosig = true : 0;\n\n }\n\n for (x = 0; isdigit(c); c = read()) x = (x + (x << 2) << 1) + (c ^ '0');\n", "file_path": "BZOJ/BZOJ4814.cpp", "rank": 96, "score": 67.94459986429021 }, { "content": "#include <bits/stdc++.h>\n\n\n\nnamespace IO {\n\n\n\ninline char read() {\n\n static const int IN_LEN = 1000000;\n\n static char buf[IN_LEN], *s, *t;\n\n s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin) : 0;\n\n return s == t ? -1 : *s++;\n\n}\n\n\n\ntemplate <class T>\n\ninline void read(T &x) {\n\n static char c;\n\n static bool iosig;\n\n for (c = read(), iosig = false; !isdigit(c); c = read()) {\n\n if (c == -1) return;\n\n c == '-' ? iosig = true : 0;\n\n }\n\n for (x = 0; isdigit(c); c = read()) x = (x + (x << 2) << 1) + (c ^ '0');\n", "file_path": "BZOJ/BZOJ3653.cpp", "rank": 97, "score": 67.94459986429021 }, { "content": "/*\n\n * created by xehoth\n\n */\n\n#include <bits/stdc++.h>\n\n\n\nnamespace IO {\n\n\n\ninline char read() {\n\n static const int IN_LEN = 1000000;\n\n static char buf[IN_LEN], *s, *t;\n\n s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin) : 0;\n\n return s == t ? -1 : *s++;\n\n}\n\n\n\ntemplate <class T>\n\ninline void read(T &x) {\n\n static char c;\n\n static bool iosig;\n\n for (c = read(), iosig = false; !isdigit(c); c = read()) {\n\n if (c == -1) return;\n", "file_path": "BZOJ/BZOJ2929.cpp", "rank": 98, "score": 67.87040326658993 }, { "content": "/*\n\n * created by xehoth 04-05-2017\n\n */\n\n#include <bits/stdc++.h>\n\n\n\nnamespace IO {\n\n\n\ninline char read() {\n\n static const int IN_LEN = 1000000;\n\n static char buf[IN_LEN], *s, *t;\n\n s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin) : 0;\n\n return s == t ? -1 : *s++;\n\n}\n\n\n\ntemplate <class T>\n\ninline void read(T &x) {\n\n static char c;\n\n static bool iosig;\n\n for (c = read(), iosig = false; !isdigit(c); c = read()) {\n\n if (c == -1) return;\n", "file_path": "BZOJ/BZOJ4887.cpp", "rank": 99, "score": 67.87040326658993 } ]
C++
src/termination_check_base.cpp
kuri-kustar/victim_localization
b5b0b8f2915d9805372a1d8c4809991b6d63c1b5
#include "victim_localization/termination_check_base.h" TerminationCheckBase::TerminationCheckBase() { ros::param::param<int>("~termination_repeat_window_size", repeat_window_size_, 8); ros::param::param<std::string>("~SaveDataFolder",saveFolder, std::string("Data")); result_status="Success"; } bool TerminationCheckBase::isTerminated() { std::cout << "[TerminationCheckBase]: " << cc.yellow << "update() not defined. Used derived class with proper implimentation.\n" << cc.reset; return false; } void TerminationCheckBase::setHistory(nbv_history* h) { nbv_history_ = h; } void TerminationCheckBase::setViewEvaluator(view_evaluator_base* v) { view_evaluator = v; } void TerminationCheckBase::setNBVTimeTaken(ros::Duration t) { NBVDurationTaken=t; } void TerminationCheckBase::SaveResults() { std::string path = ros::package::getPath("victim_localization"); std::cout << "path to package is" << path <<std::endl; std::string file_path; file_path=path + "/" + saveFolder+ "/"; view_evaluator->view_gen_->manager_-> octree_->writeBinary(file_path+"environment"); ofstream myfile (file_path+"POSES.txt"); if (myfile.is_open()) { for(int i =0; i< (nbv_history_->selected_poses.size()) ;i+=1) { myfile << nbv_history_->selected_poses[i].position.x << " " << nbv_history_->selected_poses[i].position.y<< " " << nbv_history_->selected_poses[i].position.z<< " " << nbv_history_->selected_poses[i].orientation.x<< " " << nbv_history_->selected_poses[i].orientation.y<< " " << nbv_history_->selected_poses[i].orientation.z<< " " << nbv_history_->selected_poses[i].orientation.w<< "\n"; } myfile.close(); } else cout << "Unable to open PATH.txt file"; ofstream myfile2 (file_path+"PATH.txt"); if (myfile2.is_open()) { for(int i =0; i< (nbv_history_->selected_poses_along_path.size()) ;i+=1) { myfile2 << nbv_history_->selected_poses_along_path[i].position.x << " " << nbv_history_->selected_poses_along_path[i].position.y<< " " << nbv_history_->selected_poses_along_path[i].position.z<< " " << nbv_history_->selected_poses_along_path[i].orientation.x<< " " << nbv_history_->selected_poses_along_path[i].orientation.y<< " " << nbv_history_->selected_poses_along_path[i].orientation.z<< " " << nbv_history_->selected_poses_along_path[i].orientation.w<< "\n"; } myfile2.close(); } else cout << "Unable to open PATH.txt file"; cv::Mat occupancyImage; grid_map::GridMap gridMap; Victim_Map_Base *Map_=view_evaluator->mapping_module_; double upscale_factor=32; double upscale_resolution= Map_->map_resol/upscale_factor; std::string mapName= "SaveOccupancy"; gridMap.setGeometry(Map_->map.getLength(),upscale_resolution); gridMap.add(mapName,0); occupancyImage= upscaleOccupancyImage(Map_->map,Map_->layer_name,gridMap,mapName); cv::imwrite(file_path+Map_->getlayer_name()+"Occupancy.jpeg",occupancyImage); if (Map_->Maptype==MAP::COMBINED) { gridMap[mapName].setZero(); occupancyImage= upscaleOccupancyImage(Map_->getMapLayer(MAP::DL)->map, Map_->getMapLayer(MAP::DL)->getlayer_name(), gridMap,mapName); cv::imwrite(file_path+Map_->getMapLayer(MAP::DL)->getlayer_name()+"Occupancy.jpeg",occupancyImage); gridMap[mapName].setZero(); occupancyImage= upscaleOccupancyImage(Map_->getMapLayer(MAP::THERMAL)->map, Map_->getMapLayer(MAP::THERMAL)->getlayer_name(), gridMap,mapName); cv::imwrite(file_path+Map_->getMapLayer(MAP::THERMAL)->getlayer_name()+"Occupancy.jpeg",occupancyImage); gridMap[mapName].setZero(); occupancyImage= upscaleOccupancyImage(Map_->getMapLayer(MAP::WIRELESS)->map, Map_->getMapLayer(MAP::WIRELESS)->getlayer_name(), gridMap,mapName); cv::imwrite(file_path+Map_->getMapLayer(MAP::WIRELESS)->getlayer_name()+"Occupancy.jpeg",occupancyImage); } ofstream Results (file_path+Map_->layer_name+"Result.txt"); if (Results.is_open()) { Results << "time taken: " << NBVDurationTaken.toSec() << "\n" << "Total entropy: " << view_evaluator->info_entropy_total_ << "\n" << "distance: " << view_evaluator->info_distance_total_ << "\n" << "iteration: " << nbv_history_->iteration << "\n" << "Result Status: " << result_status << std::endl << "\n"; Results.close(); } else cout << "Unable to find Results file"; } cv::Mat TerminationCheckBase::upscaleOccupancyImage(grid_map::GridMap inputMap , std::string Input, grid_map::GridMap upscaledMap, std::string Output) { cv::Mat image; const float minValue = 0.0; const float maxValue = 1.0; Index index; Position position; for (grid_map::GridMapIterator iterator(upscaledMap); !iterator.isPastEnd(); ++iterator) { index=*iterator; upscaledMap.getPosition(index,position); upscaledMap.atPosition(Output,position)=1-inputMap.atPosition(Input,position); } GridMapCvConverter::toImage<unsigned char, 4>(upscaledMap, Output, CV_8UC4, minValue, maxValue, image); return image; }
#include "victim_localization/termination_check_base.h" TerminationCheckBase::TerminationCheckBase() { ros::param::param<int>("~termination_repeat_window_size", repeat_window_size_, 8); ros::param::param<std::string>("~SaveDataFolder",saveFolder, std::string("Data")); result_status="Success"; } bool TerminationCheckBase::isTerminated() { std::cout << "[TerminationCheckBase]: " << cc.yellow << "update() not defined. Used derived class with proper implimentation.\n" << cc.reset; return false; } void TerminationCheckBase::setHistory(nbv_history* h) { nbv_history_ = h; } void TerminationCheckBase::setViewEvaluator(view_evaluator_base* v) { view_evaluator = v; } void TerminationCheckBase::setNBVTimeTaken(ros::Duration t) { NBVDurationTaken=t; } void TerminationCheckBase::SaveResults() { std::string path = ros::package::getPath("victim_localization"); std::cout << "path to package is" << path <<std::endl; std::string file_path; file_path=path + "/" + saveFolder+ "/"; view_evaluator->view_gen_->manager_-> octree_->writeBinary(file_path+"environment"); ofstream myfile (file_path+"POSES.txt"); if (myfile.is_open()) { for(int i =0; i< (nbv_history_->selected_poses.size()) ;i+=1) { myfile << nbv_history_->selected_poses[i].position.x << " " << nbv_history_->selected_poses[i].position.y<< " " << nbv_history_->selected_poses[i].position.z<< " " << nbv_history_->selected_poses[i].orientation.x<< " " << nbv_history_->selected_poses[i].orientation.y<< " " << nbv_history_->selected_poses[i].orientation.z<< " " << nbv_history_->selected_poses[i].orientation.w<< "\n"; } myfile.close(); } else cout << "Unable to open PATH.txt file"; ofstream myfile2 (file_path+"PATH.txt"); if (myfile2.is_open()) { for(int i =0; i< (nbv_history_->selected_poses_along_path.size()) ;i+=1) { myfile2 << nbv_history_->selected_poses_along_path[i].position.x << " " << nbv_history_->selected_poses_along_path[i].position.y<< " " << nbv_history_->selected_poses_along_path[i].position.z<< " " << nbv_history_->selected_poses_along_path[i].orientation.x<< " " << nbv_history_->selected_poses_along_path[i].orientation.y<< " " << nbv_history_->selected_poses_along_path[i].orientation.z<< " " << nbv_history_->selected_poses_along_path[i].orientation.w<< "\n"; } myfile2.close(); } else cout
tion)=1-inputMap.atPosition(Input,position); } GridMapCvConverter::toImage<unsigned char, 4>(upscaledMap, Output, CV_8UC4, minValue, maxValue, image); return image; }
<< "Unable to open PATH.txt file"; cv::Mat occupancyImage; grid_map::GridMap gridMap; Victim_Map_Base *Map_=view_evaluator->mapping_module_; double upscale_factor=32; double upscale_resolution= Map_->map_resol/upscale_factor; std::string mapName= "SaveOccupancy"; gridMap.setGeometry(Map_->map.getLength(),upscale_resolution); gridMap.add(mapName,0); occupancyImage= upscaleOccupancyImage(Map_->map,Map_->layer_name,gridMap,mapName); cv::imwrite(file_path+Map_->getlayer_name()+"Occupancy.jpeg",occupancyImage); if (Map_->Maptype==MAP::COMBINED) { gridMap[mapName].setZero(); occupancyImage= upscaleOccupancyImage(Map_->getMapLayer(MAP::DL)->map, Map_->getMapLayer(MAP::DL)->getlayer_name(), gridMap,mapName); cv::imwrite(file_path+Map_->getMapLayer(MAP::DL)->getlayer_name()+"Occupancy.jpeg",occupancyImage); gridMap[mapName].setZero(); occupancyImage= upscaleOccupancyImage(Map_->getMapLayer(MAP::THERMAL)->map, Map_->getMapLayer(MAP::THERMAL)->getlayer_name(), gridMap,mapName); cv::imwrite(file_path+Map_->getMapLayer(MAP::THERMAL)->getlayer_name()+"Occupancy.jpeg",occupancyImage); gridMap[mapName].setZero(); occupancyImage= upscaleOccupancyImage(Map_->getMapLayer(MAP::WIRELESS)->map, Map_->getMapLayer(MAP::WIRELESS)->getlayer_name(), gridMap,mapName); cv::imwrite(file_path+Map_->getMapLayer(MAP::WIRELESS)->getlayer_name()+"Occupancy.jpeg",occupancyImage); } ofstream Results (file_path+Map_->layer_name+"Result.txt"); if (Results.is_open()) { Results << "time taken: " << NBVDurationTaken.toSec() << "\n" << "Total entropy: " << view_evaluator->info_entropy_total_ << "\n" << "distance: " << view_evaluator->info_distance_total_ << "\n" << "iteration: " << nbv_history_->iteration << "\n" << "Result Status: " << result_status << std::endl << "\n"; Results.close(); } else cout << "Unable to find Results file"; } cv::Mat TerminationCheckBase::upscaleOccupancyImage(grid_map::GridMap inputMap , std::string Input, grid_map::GridMap upscaledMap, std::string Output) { cv::Mat image; const float minValue = 0.0; const float maxValue = 1.0; Index index; Position position; for (grid_map::GridMapIterator iterator(upscaledMap); !iterator.isPastEnd(); ++iterator) { index=*iterator; upscaledMap.getPosition(index,position); upscaledMap.atPosition(Output,posi
random
[ { "content": "class ReactivePathPlanner : public navigationBase\n\n{\n\npublic:\n\n ReactivePathPlanner(const ros::NodeHandle &nh, const ros::NodeHandle &nh_private, volumetric_mapping::OctomapManager *manager);\n\n\n\n sspp::sspp_srv planningService;\n\n ReactivePlannerServer *reactivePlannerServer;\n\n\n\n ros::NodeHandle nh_;\n\n ros::NodeHandle nh_private_;\n\n volumetric_mapping::OctomapManager *manager_;\n\n\n\n // ros::ServiceClient clientPath_;\n\n\n\n double uav_fixed_height;\n\n double extensionRange_;\n\n double boundingbox_x_;\n\n double boundingbox_y_;\n\n double boundingbox_z_;\n\n double dOvershoot_;\n", "file_path": "include/victim_localization/reactive_path_planner.h", "rank": 0, "score": 134070.60781306797 }, { "content": "class Raytracing\n\n{\n\npublic:\n\n\n\n rviz_visual_tools::RvizVisualToolsPtr visualTools;\n\n\n\n geometry_msgs::Pose current_pose_;\n\n std::shared_ptr<octomap::OcTree> tree_;\n\n vehicle_communicator *drone_comm;\n\n VehicleControlBase *vehicle;\n\n volumetric_mapping::OctomapManager *manager_;\n\n\n\n nav_msgs::OccupancyGridPtr grid_;\n\n\n\n std::string Layer_name_;\n\n double HFOV_deg;\n\n double VFOV_deg;\n\n double range_max_;\n\n double range_min_;\n\n double x_arena_max;\n", "file_path": "include/victim_localization/raytracing.h", "rank": 1, "score": 108643.92784109377 }, { "content": "class vehicle_communicator\n\n{\n\npublic:\n\n vehicle_communicator(const ros::NodeHandle& nh, const ros::NodeHandle& nh_private,\n\n volumetric_mapping::OctomapManager *mapManager);\n\n ros::NodeHandle nh_;\n\n ros::NodeHandle nh_private_;\n\n volumetric_mapping::OctomapManager *manager_;\n\n\n\n ros::Publisher pub_waypoint;\n\n ros::Publisher pub_path;\n\n\n\n ros::Subscriber sub_pose;\n\n ros::Subscriber sub_command_status;\n\n\n\n ros::ServiceClient clientExecuteRotation ;\n\n ros::ServiceClient clientExecuteWaypoint;\n\n ros::ServiceClient clientExecutePath;\n\n ros::ServiceClient clientExecutePath2;\n\n ros::ServiceClient ClientCheckStatus;\n", "file_path": "include/control/vehicle_communicator.h", "rank": 2, "score": 106102.28436550131 }, { "content": "class OcclusionCulling\n\n{\n\npublic:\n\n\t// >>>>>>>>\n\n // Attributes\n\n // >>>>>>>>\n\n ros::NodeHandle nh;\n\n std::string model;\n\n // ros::Publisher original_pub;\n\n // ros::Publisher visible_pub;\n\n ros::Publisher fov_pub;\n\n pcl::PointCloud<pcl::PointXYZ>::Ptr cloud;\n\n pcl::PointCloud<pcl::PointXYZ>::Ptr filtered_cloud;\n\n pcl::PointCloud<pcl::PointXYZ>::Ptr occlusionFreeCloud;//I can add it to accumulate cloud if I want to extract visible surface from multiple locations\n\n pcl::PointCloud<pcl::PointXYZ>::Ptr FrustumCloud;//frustum cull\n\n\n\n pcl::PointCloud<pcl::PointXYZ> FreeCloud;\n\n float voxelRes, OriginalVoxelsSize;\n\n double id;\n\n pcl::VoxelGridOcclusionEstimationT voxelFilterOriginal;\n", "file_path": "include/culling/occlusion_culling.h", "rank": 3, "score": 106102.28436550131 }, { "content": "class TimeProfiler {\n\n\n\n public:\n\n struct ProfilerEntry{\n\n double min, max, total, avg, last;\n\n int count;\n\n };\n\n\n\n TimeProfiler();\n\n TimeProfiler(bool b);\n\n double getLatestTime(std::string s);\n\n void start();\n\n void start(std::string s);\n\n void toc();\n\n void toc(std::string s);\n\n void stop();\n\n void stop(std::string s);\n\n void dump();\n\n\n\n private:\n\n bool verbose;\n\n std::map<std::string,std::chrono::steady_clock::time_point> timers;\n\n std::map<std::string,ProfilerEntry> entries;\n\n\n\n std::string getEntryTitle(std::string s);\n\n};\n\n\n\n#endif // TimeProfiler_H\n", "file_path": "include/utilities/time_profiler.h", "rank": 4, "score": 106102.28436550131 }, { "content": "class navigationBase\n\n{\n\npublic:\n\n navigationBase();\n\n geometry_msgs::Pose current_pose_;\n\n\n\n\n\n double nav_bounds_x_min_;\n\n double nav_bounds_y_min_;\n\n double nav_bounds_z_min_;\n\n double nav_bounds_x_max_;\n\n double nav_bounds_y_max_;\n\n double nav_bounds_z_max_;\n\n double uav_fixed_height;\n\n\n\n std::string methodName_;\n\n double d_close;\n\n double getDistance(geometry_msgs::Pose p1, geometry_msgs::Pose p2);\n\n\n\n\n", "file_path": "include/victim_localization/navigation_base.h", "rank": 5, "score": 103709.53681133158 }, { "content": "class TestNBV\n\n{\n\n\n\n tf::TransformListener tf_;\n\npublic:\n\n ros::NodeHandle nh;\n\n ros::NodeHandle nh_private;\n\n ros::Publisher pub_iteration_info;\n\n TimeProfiler timer;\n\n\n\n rviz_visual_tools::RvizVisualToolsPtr visualTools;\n\n ros::Time StartTimeForNBV;\n\n\n\n\n\n vehicle_communicator *drone_communicator_;\n\n VehicleControlBase *vehicle_;\n\n Victim_Map_Base *Map_;\n\n nbv_history *history_;\n\n TerminationCheckBase *termination_check_module_;\n\n\n", "file_path": "include/victim_localization/test_NBV.h", "rank": 6, "score": 103709.53681133158 }, { "content": "class iris_drone_commander\n\n{\n\npublic:\n\n iris_drone_commander(const ros::NodeHandle &nh, const ros::NodeHandle &nhPrivate);\n\n VehicleControlBase *vehicle_;\n\n ros::NodeHandle nh_;\n\n ros::NodeHandle nh_private_;\n\n ros::Publisher localPosePub;\n\n\n\n ros::Publisher waypoint_status;\n\n ros::Publisher path_status;\n\n\n\n bool command_status;\n\n Command::State state;\n\n bool enable_rotate;\n\n geometry_msgs::PoseStamped hoverPose;\n\n\n\n double start_x, start_y, start_z, start_yaw;\n\n int vehicle_type;\n\n std::string base_frame;\n", "file_path": "include/control/vehicle_commander.h", "rank": 7, "score": 103709.53681133158 }, { "content": "class nbv_history\n\n{\n\npublic:\n\n nbv_history();\n\n void computeEntropyDiff();\n\n double getMaxUtility (int N_iterations);\n\n bool isRepeatingMotions(int window_size);\n\n void update();\n\n\n\n int iteration;\n\n std::vector<float> entropy_diff;\n\n std::vector<geometry_msgs::Pose> selected_poses;\n\n std::vector<geometry_msgs::Pose> selected_poses_along_path;\n\n std::vector<float> selected_utility;\n\n std::vector<float> number_of_visited_cells_in_selected_poses;\n\n std::vector<float> number_of_unvisited_cells_in_selected_poses;\n\n std::vector<float> percentage_of_Unvisited_cells;\n\n\n\n\n\n std::vector<float> total_entropy;\n", "file_path": "include/victim_localization/nbv_history.h", "rank": 8, "score": 103709.53681133158 }, { "content": "class visualizeResults1\n\n{\n\npublic:\n\n visualizeResults1(const ros::NodeHandle &nh_,\n\n const ros::NodeHandle &nh_private_ );\n\n\n\n ros::NodeHandle nh;\n\n ros::NodeHandle nh_private;\n\n\n\n rviz_visual_tools::RvizVisualToolsPtr visualTools;\n\n volumetric_mapping::OctomapManager *manager_;\n\n\n\n std::string resultPath;\n\n std::vector<geometry_msgs::Pose> Poses;\n\n std::vector<geometry_msgs::Pose> Path;\n\n\n\n void SetPathtoResults(std::string path);\n\n void trigger();\n\n\n\n\n\n};\n\n\n\n#endif // PLOTRESULTS1_H\n", "file_path": "include/victim_localization/visualize_results1.h", "rank": 9, "score": 103709.53681133158 }, { "content": "class SSD_client {\n\n protected:\n\n ros::NodeHandle n;\n\n ros::Rate loop_rate;\n\n ros::ServiceClient client ;\n\n\n\n public:\n\n bool Detection_success;\n\n victim_localization::DL_box srv;\n\n SSD_client::SSD_client();\n\n void Get_SSD_Detection();\n\n\n\n};\n\n\n\n#endif // SSD_CLIENT_H\n", "file_path": "include/victim_localization/ssd_client.h", "rank": 10, "score": 103709.53681133158 }, { "content": "class test_navigation\n\n{\n\n tf::TransformListener tf_;\n\npublic:\n\n test_navigation(const ros::NodeHandle &nh,const ros::NodeHandle &nh_private );\n\n ReactivePathPlanner *planner_;\n\n vehicle_communicator *drone_communicator_;\n\n volumetric_mapping::OctomapManager *manager_;\n\n\n\n rviz_visual_tools::RvizVisualToolsPtr visualTools;\n\n\n\n\n\n Volumetric_Map *Volumetric_Map_;\n\n costmap_2d::Costmap2DROS *CostMapROS_;\n\n nav_msgs::Path path_;\n\n nav_msgs::Path path_to_waypoint;\n\n\n\n\n\n ros::NodeHandle nh_;\n\n ros::NodeHandle nh_private_;\n", "file_path": "include/victim_localization/test_navigation.h", "rank": 11, "score": 103709.53681133158 }, { "content": "class visualizeResults\n\n{\n\npublic:\n\n visualizeResults(const ros::NodeHandle &nh_,\n\n const ros::NodeHandle &nh_private_ );\n\n\n\n ros::NodeHandle nh;\n\n ros::NodeHandle nh_private;\n\n\n\n rviz_visual_tools::RvizVisualToolsPtr visualTools;\n\n volumetric_mapping::OctomapManager *manager_;\n\n\n\n std::string resultPath;\n\n std::vector<geometry_msgs::Pose> Path;\n\n void SetPathtoResults(std::string path);\n\n void trigger();\n\n\n\n\n\n};\n\n\n\n#endif // PLOTRESULTS_H\n", "file_path": "include/victim_localization/visualize_results.h", "rank": 12, "score": 103709.53681133158 }, { "content": "class VehicleControlBase\n\n{\n\nprotected:\n\n bool is_ready_;\n\n\n\npublic:\n\n double distance_threshold_;\n\n double angular_threshold_;\n\n double linear_speed_threshold_;\n\n double angular_speed_threshold_;\n\n\n\n geometry_msgs::Pose vehicle_current_pose_;\n\n geometry_msgs::Twist vehicle_current_twist_;\n\n mavros_msgs::State vehicle_current_state_;\n\n\n\n geometry_msgs::Pose setpoint_;\n\n std::vector<geometry_msgs::Pose> setpath_;\n\n\n\n ros::Time setpoint_last_received;\n\n geometry_msgs::PoseStamped setpoint_last_pose;\n", "file_path": "include/control/vehicle_control_base.h", "rank": 13, "score": 101452.97346955829 }, { "content": "class Volumetric_Map\n\n{\n\n\n\n typedef octomap::OcTree OcTreeT;\n\n typedef octomap_msgs::GetOctomap OctomapSrv;\n\n typedef octomap_msgs::BoundingBoxQuery BBXSrv;\n\n\n\npublic:\n\n //....variables....\n\n ros::Time previous_time;\n\n std::string topic_pointcloud_;\n\n std::string topic_Pose;\n\n ros::Subscriber pointcloud_sub_;\n\n costmap_2d::Costmap2DROS *costmap_ros_;\n\n costmap_2d::Costmap2D *costmap_;\n\n double pcl_throttle_;\n\n double map2D_throttle_;\n\n bool accept_pointCloud;\n\n bool stop;\n\n int count_pointCloud;\n", "file_path": "include/victim_localization/volumetric_map_manager.h", "rank": 14, "score": 101452.97346955829 }, { "content": "class view_generator_IG\n\n{\n\npublic:\n\n\n\n\n\nprotected:\n\n double res_x_, res_y_, res_z_, res_yaw_;\n\n\n\n double nav_bounds_x_max_, nav_bounds_y_max_, nav_bounds_z_max_;\n\n double nav_bounds_x_min_, nav_bounds_y_min_, nav_bounds_z_min_;\n\n double dist_to_goal;\n\n\n\n double uav_fixed_height;\n\n double extensionRange_;\n\n Eigen::Vector3d boundingbox_;\n\n double boundingbox_x_,boundingbox_y_,boundingbox_z_;\n\n double dOvershoot_;\n\n\n\npublic:\n\n //....variables....\n", "file_path": "include/victim_localization/view_generator_ig.h", "rank": 15, "score": 99321.28957701172 }, { "content": "class ReactivePlannerServer\n\n{\n\nprivate:\n\n ros::ServiceServer planningService;\n\n ros::Subscriber sub;\n\n ros::NodeHandle nh;\n\n ros::NodeHandle nh_private;\n\n volumetric_mapping::OctomapManager * mapManager = NULL;\n\n geometry_msgs::Point robotCenter;\n\n geometry_msgs::Vector3 gridSize;\n\n geometry_msgs::Pose gridStart;\n\n SSPP::PathPlanner* pathPlanner = NULL;\n\n Robot* robot = NULL;\n\n Pose start,end;\n\n double orientationSamplingRes = 90.0;\n\n double debugDelay = 0.0;\n\n double regGridConRad;\n\n double gridRes;\n\n double distanceToGoal = 0;\n\n int treeProgressDisplayFrequency = -1;\n", "file_path": "include/victim_localization/reactive_planner_server.h", "rank": 16, "score": 99321.28957701172 }, { "content": "class view_evaluator_base\n\n{\n\npublic:\n\n float info_selected_utility_;\n\n float info_percentage_of_New_Cells;\n\n\n\n float info_dl_selected_utility_;\n\n float info_thermal_selected_utility_;\n\n float info_wireless_selected_utility_;\n\n\n\n float info_selected_direction_; // this param is used for in wireless Viewpoint evaluation\n\n float info_entropy_total_;\n\n float info_dl_entropy_total_;\n\n float info_thermal_entropy_total_;\n\n float info_wireless_entropy_total_;\n\n\n\n\n\n view_evaluator_base();\n\n geometry_msgs::Pose getTargetPose();\n\n void setViewGenerator(view_generator_IG* v);\n", "file_path": "include/victim_localization/view_evaluator_base.h", "rank": 17, "score": 99321.28957701172 }, { "content": "class TerminationCheckBase\n\n{\n\npublic:\n\n TerminationCheckBase();\n\n virtual bool isTerminated();\n\n void setHistory(nbv_history* h);\n\n void setViewEvaluator(view_evaluator_base* v);\n\n void SaveResults();\n\n cv::Mat upscaleOccupancyImage(grid_map::GridMap inputMap , std::string Input,\n\n grid_map::GridMap upscaledMap, std::string Output);\n\n\n\n void setNBVTimeTaken(ros::Duration t);\n\n ros::Duration NBVDurationTaken;\n\n std::string saveFolder;\n\n std::string result_status; // result_status\n\n\n\n\n\nprotected:\n\n nbv_history* nbv_history_;\n\n view_evaluator_base* view_evaluator;\n\n\n\n int repeat_window_size_;\n\n};\n\n\n\n#endif // TERMINATION_CHECK_BASE_H\n", "file_path": "include/victim_localization/termination_check_base.h", "rank": 18, "score": 99321.28957701172 }, { "content": "class victim_detector_base\n\n{\n\npublic:\n\n victim_detector_base();\n\n ~victim_detector_base();\n\n\n\n vehicle_communicator *vehicle_comm_;\n\n virtual Status getDetectorStatus(){};\n\n virtual void performDetection(){};\n\n\n\n geometry_msgs::PoseStamped capture_ps;\n\n geometry_msgs::PoseStamped current_ps;\n\n void SetVehicleCommunicator(vehicle_communicator *vehicle_comm);\n\n virtual ros::Time getCaptureTime(){};\n\n virtual ros::Duration GetConnectionTime(); // GetConnectionTime only use with\n\n // DeepLeanring Detector to account for possible connection drop\n\n};\n\n\n\n#endif // VICTIM_DETECTOR_BASE_H\n", "file_path": "include/victim_localization/victim_detector_base.h", "rank": 19, "score": 99321.28957701172 }, { "content": "class Victim_Map_Base\n\n{\n\n\n\nprotected://get it from config ..\n\n double Prob_D_H; //P(D|H)\n\n double Prob_D_Hc; //P(D|Hc)\n\n double Prob_Dc_H; //P(Dc|H)\n\n double Prob_Dc_Hc; //P(Dc|Hc)\n\n\n\npublic:\n\n Victim_Map_Base(const ros::NodeHandle &nh,const ros::NodeHandle &nh_private);\n\n ~Victim_Map_Base();\n\n\n\n MAP::MAPtype Maptype;\n\n\n\n vehicle_communicator *drone_comm;\n\n VehicleControlBase *vehicle_;\n\n\n\n std::string camera_optical_frame;\n\n std::string camera_thermal_frame;\n", "file_path": "include/victim_localization/victim_map_base.h", "rank": 20, "score": 99321.28957701172 }, { "content": "class victim_thermal_detector\n\n{\n\npublic:\n\n victim_thermal_detector(ros::NodeHandle& nh_,ros::NodeHandle& pnh_);\n\n ~victim_thermal_detector();\n\n\n\n image_transport::Subscriber sub_image;\n\n image_transport::Publisher pub_detection_;\n\n\n\n double minTempVictim_;\n\n double maxTempVictim_;\n\n double minAreaVictim_;\n\n double minDistBetweenBlobs_;\n\n double blob_temperature_;\n\n std::vector<geometry_msgs::Point> victim_loc;\n\n\n\n void imageCallback(const sensor_msgs::ImageConstPtr& img);\n\n std::vector<geometry_msgs::Point> GetDetectionResult();\n\n\n\n\n\n\n\n\n\n};\n\n\n\n#endif // VICTIM_THERMAL_DETECTOR_H\n", "file_path": "include/victim_localization/victim_thermal_detector_node.h", "rank": 21, "score": 97304.39790457269 }, { "content": "class SSD_Detection_with_clustering\n\n{\n\npublic:\n\n SSD_Detection_with_clustering();\n\n cv_bridge::CvImagePtr current_depth_image;\n\n victim_localization::DL_msgs_boxes current_ssd_detection;\n\n geometry_msgs::Pose current_pose;\n\n geometry_msgs::Point detected_point;\n\n bool detection_status_; //\n\n ros::Publisher pub_segemented_human_pointcloud;\n\n\n\n tf::TransformListener *tf_listener;\n\n typedef message_filters::sync_policies::ApproximateTime<sensor_msgs::Image,victim_localization::DL_msgs_boxes,geometry_msgs::PoseStamped> MySyncPolicy;\n\n message_filters::Subscriber<sensor_msgs::Image> *depth_in_;\n\n message_filters::Subscriber<victim_localization::DL_msgs_boxes> *box_;\n\n message_filters::Subscriber<geometry_msgs::PoseStamped> *loc_sub_;\n\n message_filters::Synchronizer<MySyncPolicy> *sync;\n\n\n\n bool DetectionAvailable();\n\n void CallBackData(const sensor_msgs::ImageConstPtr& input_depth, const victim_localization::DL_msgs_boxesConstPtr& boxes_,\n\n const geometry_msgs::PoseStamped::ConstPtr& loc);\n\n void FindClusterCentroid();\n\n bool getClusterCentroidResultStatus();\n\n geometry_msgs::Point getClusterCentroid();\n\n void PublishSegmentedPointCloud(const pcl::PointCloud<pcl::PointXYZ> input_PointCloud);\n\n};\n\n\n\n#endif // SSD_DETECTION_H\n", "file_path": "include/ssd_keras/ssd_detection_with_ecludian_clustering (backup).h", "rank": 22, "score": 95393.26914281788 }, { "content": "class Raytracing2D : public Raytracing\n\n{\n\npublic:\n\n\n\n Raytracing2D(double map_res_);\n\n Raytracing2D(double map_res_, double HFOV_deg, double VFOV_deg, double max_d, double min_d);\n\n ~Raytracing2D();\n\n\n\n void GenerateOctomap(bool rebuild_once, bool publish);\n\n void generateMarkerArray(\n\n const std::string& tf_frame,\n\n visualization_msgs::MarkerArray* occupied_nodes,\n\n visualization_msgs::MarkerArray* free_nodes);\n\n\n\n double colorizeMapByHeight(double z, double min_z,\n\n double max_z) const {\n\n return (1.0 - std::min(std::max((z - min_z) / (max_z - min_z), 0.0), 1.0));\n\n }\n\n\n\n std_msgs::ColorRGBA percentToColor(double h)const;\n", "file_path": "include/victim_localization/raytracing_2d.h", "rank": 23, "score": 94226.29371551238 }, { "content": "class straightLine : public navigationBase\n\n{\n\npublic:\n\n straightLine(const ros::NodeHandle &nh, const ros::NodeHandle &nh_private, volumetric_mapping::OctomapManager *manager);\n\n\n\n ros::NodeHandle nh_;\n\n ros::NodeHandle nh_private_;\n\n volumetric_mapping::OctomapManager *manager_;\n\n double extensionRange_;\n\n double boundingbox_x_;\n\n double boundingbox_y_;\n\n double boundingbox_z_;\n\n double dOvershoot_;\n\n\n\n Eigen::Vector3d boundingbox_;\n\n\n\n std::string methodName(void);\n\n bool GeneratePath(geometry_msgs::Pose end, nav_msgs::Path &Path);\n\n void start(){};\n\n\n\n};\n\n\n\n#endif // STRAIGHTLINE_H\n", "file_path": "include/victim_localization/straightline.h", "rank": 24, "score": 92094.60982296581 }, { "content": "class FloatingSensorPosition : public ModelPlugin\n\n{\n\npublic:\n\n FloatingSensorPosition();\n\n virtual ~FloatingSensorPosition();\n\n\n\nprotected:\n\n virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);\n\n virtual void Update();\n\n virtual void Reset();\n\n virtual void OnRosMsgPose(const geometry_msgs::PoseStampedConstPtr &msg);\n\n virtual void OnRosMsgTwist(const geometry_msgs::TwistConstPtr &msg);\n\n virtual void QueueThread();\n\n virtual void GetCurrentPose();\n\n virtual void UpdatePosition();\n\n\n\nprivate:\n\n std::mutex mtx_pose_; // mutex for critical section\n\n tf::TransformBroadcaster tf_broadcaster_;\n\n\n", "file_path": "include/vehicle/floating_sensor_position_plugin.h", "rank": 25, "score": 86353.1170019225 }, { "content": "class VehicleControlIris : public VehicleControlBase\n\n{\n\nprivate:\n\n double uav_height_min_;\n\n double uav_height_max_;\n\n\n\n\n\npublic:\n\n ros::Subscriber sub_odom;\n\n ros::Subscriber sub_state;\n\n ros::Subscriber sub_setpoint;\n\n ros::ServiceClient arming_client;\n\n ros::ServiceClient set_mode_client;\n\n ros::Publisher pub_setpoint;\n\n VehicleControlIris();\n\n\n\n//private:\n\n\n\n void callbackOdometry(const nav_msgs::Odometry& odom_msg);\n\n void callbackState(const mavros_msgs::State& state_msg);\n", "file_path": "include/control/vehicle_control_iris.h", "rank": 26, "score": 86353.1170019225 }, { "content": "class view_evaluator_ig : public view_evaluator_base\n\n{\n\npublic:\n\n view_evaluator_ig();\n\n\n\n double calculateUtiltiy(geometry_msgs::Pose p, Victim_Map_Base *mapping_module, double &new_cell_percentage);\n\n double calculateWirelessUtility(geometry_msgs::Pose p, Victim_Map_Base *mapping_module, double &new_cell_percentage);\n\n double calculateCombinedUtility(geometry_msgs::Pose p,double &new_cell_percentage);\n\n\n\n\n\n std::string getMethodName();\n\n\n\n};\n\n\n\n#endif // VIEW_EVALUATOR_IG_H\n", "file_path": "include/victim_localization/view_evaluator_ig.h", "rank": 27, "score": 84630.00228306273 }, { "content": "class Victim_Map_Wireless: public Victim_Map_Base\n\n{\n\n\n\nprivate:\n\n std::string wireless_polygon_topic=\"polygon_wireless\";\n\n std::string wireless_layer_name=\"victim_wireless\";\n\n Position victim_loc;\n\n double vision_map_resol;\n\n double max_wireless_range;\n\n\n\npublic:\n\n Victim_Map_Wireless(const ros::NodeHandle &nh,const ros::NodeHandle &nh_private);\n\n victim_wireless_detector *detector_;\n\n void Update();\n\n void runDetector();\n\n virtual void setDetectionResult(Status detection_status);\n\n\n\n double Distance_to_center(Position p1, Position p2);\n\n\n\n\n\n};\n\n\n\n#endif // VICTIM_MAP_WIRELESS_2_H\n", "file_path": "include/victim_localization/victim_map_wireless_2.h", "rank": 28, "score": 84630.00228306273 }, { "content": "class victim_thermal_detector : public victim_detector_base\n\n{\n\npublic:\n\n victim_thermal_detector();\n\n ~victim_thermal_detector();\n\n\n\n image_transport::Subscriber sub_image;\n\n image_transport::Publisher pub_detection_;\n\n\n\n double minTempVictim_;\n\n double maxTempVictim_;\n\n double minAreaVictim_;\n\n double minDistBetweenBlobs_;\n\n double blob_temperature_;\n\n sensor_msgs::ImageConstPtr input_image;\n\n cv::Mat img_proc;\n\n Position victim_loc;\n\n bool victim_found;\n\n bool plot_;\n\n\n", "file_path": "include/victim_localization/victim_thermal_detector.h", "rank": 29, "score": 84630.00228306273 }, { "content": "class victim_map_Thermal: public Victim_Map_Base\n\n{\n\n\n\nprivate:\n\n std::string thermal_polygon_topic=\"polygon_thermal\";\n\n std::string Thermal_layer_name=\"victim_thermal\";\n\n double thermal_img_x_res;\n\n double thermal_img_y_res;\n\n double thermal_x_offset;\n\n double thermal_y_offset;\n\n double max_thermal_d;\n\n double min_thermal_d;\n\n\n\n Position ThermalRayStart;\n\n Position ThermalRayEnd;\n\n std::vector<Position> ThermalRay;\n\n\n\n rviz_visual_tools::RvizVisualToolsPtr visualize_thermal_ray;\n\n\n\n\n", "file_path": "include/victim_localization/victim_map_thermal.h", "rank": 30, "score": 84630.00228306273 }, { "content": "class victim_map_DL: public Victim_Map_Base\n\n{\n\n\n\nprivate:\n\n std::string DL_polygon_topic=\"polygon_DL\";\n\n std::string DL_layer_name=\"victim_DL\";\n\n\n\n victim_vision_detector *detector_;\n\n\n\n\n\npublic:\n\n victim_map_DL(const ros::NodeHandle &nh,const ros::NodeHandle &nh_private);\n\n void Update();\n\n void runDetector();\n\n ros::Duration getServiceConnectionTimeout();\n\n};\n\n\n\n#endif // VICTIM_MAP_DL_H\n", "file_path": "include/victim_localization/victim_map_dl.h", "rank": 31, "score": 84630.00228306273 }, { "content": "class view_evaluator_weighted : public view_evaluator_base\n\n{\n\npublic:\n\n view_evaluator_weighted();\n\n\n\n double calculateUtility(geometry_msgs::Pose p, Victim_Map_Base *mapping_module,double &new_cell_percentage);\n\n void calculateIGwithMax(geometry_msgs::Pose p, Victim_Map_Base *mapping_module, double &IG, double &Max,double &new_cell_percentage);\n\n void calculateWirelessIGwithMax(geometry_msgs::Pose p, Victim_Map_Base *mapping_module, double &IG, double &Max,double &new_cell_percentage);\n\n void evaluate();\n\n void evaluateWireless();\n\n void evaluateCombined();\n\n double f_;\n\n bool use_dist;\n\n\n\n\n\n std::string getMethodName();\n\n std::vector<geometry_msgs::Pose> Info_poses;\n\n std::vector<double> Info_View_utilities;\n\n std::vector<double> Info_View_Max;\n\n std::vector<double> Info_WirelessDiection;\n", "file_path": "include/victim_localization/view_evaluator_weighted.h", "rank": 32, "score": 84630.00228306273 }, { "content": "class victim_vision_detector : public victim_detector_base\n\n{\n\npublic:\n\n victim_vision_detector();\n\n ~victim_vision_detector();\n\n cv_bridge::CvImagePtr current_depth_image;\n\n victim_localization::DL_msgs_box current_ssd_detection;\n\n geometry_msgs::Point detected_point;\n\n bool detection_Cluster_succeed; //\n\n ros::Publisher pub_segemented_human_pointcloud;\n\n ros::Publisher pub_setpoint;\n\n double image_x_resol;\n\n double image_y_resol;\n\n double image_x_offset;\n\n double image_y_offset;\n\n double RGB_FL;\n\n std::string camera_optical_frame;\n\n bool ServiceCallFirstTime;\n\n ros::Time Start_time;\n\n ros::Duration Service_startTime;\n", "file_path": "include/ssd_keras/victim_vision_detector.h", "rank": 33, "score": 84630.00228306273 }, { "content": "class view_evaluator_sum: public view_evaluator_base\n\n{\n\npublic:\n\n view_evaluator_sum();\n\n ~view_evaluator_sum();\n\n\n\n double calculateUtiltiy(geometry_msgs::Pose p, Victim_Map_Base *mapping_module, double &new_cell_percentage);\n\n double calculateWirelessUtility(geometry_msgs::Pose p, Victim_Map_Base *mapping_module, double &new_cell_percentage);\n\n std::string getMethodName();\n\n\n\nprivate:\n\n double w_dist_;\n\n\n\n};\n\n\n\n#endif // VIEW_EVALUATOR_SUMM_H\n", "file_path": "include/victim_localization/view_evaluator_sum.h", "rank": 34, "score": 84630.00228306273 }, { "content": "class view_evaluator_FOV: public view_evaluator_base\n\n{\n\npublic:\n\n view_evaluator_FOV();\n\n ~view_evaluator_FOV();\n\n\n\n double FOVSize(geometry_msgs::Pose p, Victim_Map_Base *mapping_module);\n\n std::string getMethodName();\n\n\n\n std::vector<double> Info_View_counts;\n\n std::vector<geometry_msgs::Pose> Info_poses;\n\n\n\n std::vector<double> Info_View_counts_dl;\n\n std::vector<double> Info_View_counts_thermal;\n\n\n\n void evaluate();\n\n void evaluateCombined();\n\n\n\nprivate:\n\n double w_dist_;\n\n\n\n};\n\n\n\n#endif // VIEW_EVALUATOR_FFOV_H\n", "file_path": "include/victim_localization/view_evaluator_fieldofview.h", "rank": 35, "score": 84630.00228306273 }, { "content": "class victim_wireless_detector : public victim_detector_base\n\n{\n\npublic:\n\n victim_wireless_detector();\n\n ~victim_wireless_detector();\n\n\n\n\n\n double current_node_loc;\n\n double target_node_loc;\n\n double d0;\n\n double N_sensor;\n\n double lamda;\n\n double frequency;\n\n double SNR;\n\n double K;\n\n double path_loss;\n\n double exact_dist;\n\n double distance_to_victim;\n\n double distance_threshold;\n\n double current_loc[2];\n", "file_path": "include/victim_localization/victim_wireless_detector.h", "rank": 36, "score": 84630.00228306273 }, { "content": "class Victim_Map_Wireless: public Victim_Map_Base\n\n{\n\n\n\nprivate:\n\n std::string wireless_polygon_topic=\"polygon_wireless\";\n\n std::string wireless_layer_name=\"victim_wireless\";\n\n grid_map::Polygon wireless_polygon;\n\n Position victim_loc;\n\n\n\n grid_map::GridMap offline_map;\n\n double offline_map_resol;\n\n double detection_threshold;\n\n double wireless_error;\n\n\n\n ros::Publisher pub_map_offline;\n\n\n\npublic:\n\n Victim_Map_Wireless(const ros::NodeHandle &nh,const ros::NodeHandle &nh_private);\n\n void Update();\n\n void runDetector(){};\n\n void Generate_offline_wireless_map(double error);\n\n void Publish_Offline_Map();\n\n};\n\n\n\n#endif // VICTIM_MAP_WIRELESS_H\n", "file_path": "include/victim_localization/victim_map_wireless.h", "rank": 37, "score": 84630.00228306273 }, { "content": "class victim_map_combined : public Victim_Map_Base\n\n{\n\npublic:\n\n victim_map_combined(const ros::NodeHandle &nh,const ros::NodeHandle &nh_private);\n\n\n\n\n\n\n\n std::string combinedMap_layer_name=\"victim_fused\";\n\n double alpha;\n\n double beta;\n\n double gama;\n\n\n\n void Update();\n\n void setDroneCommunicator(vehicle_communicator *drone_comm_);\n\n void setVehicle(VehicleControlBase *vehicle);\n\n void setOctomapManager(volumetric_mapping::OctomapManager *manager);\n\n void SetNavMap(nav_msgs::OccupancyGridPtr Nav_map);\n\n void setCurrentPose(geometry_msgs::Pose ps);\n\n\n\n Victim_Map_Base *victim_map_dl_;\n", "file_path": "include/victim_localization/victim_map_combined.h", "rank": 38, "score": 84630.00228306273 }, { "content": "class VehicleControlIrisOrigin : public VehicleControlIris\n\n{\n\npublic:\n\n VehicleControlIrisOrigin();\n\n\n\n void setOffboardState();\n\n //void moveVehicle(double threshold_sensitivity);\n\n\n\n geometry_msgs::Pose transformSetpoint2Global (const geometry_msgs::Pose p_set);\n\n geometry_msgs::Pose transformGlobal2Setpoint (const geometry_msgs::Pose p_global);\n\n};\n\n\n\n#endif // VEHICLE_CONTROL_IRIS_ORIGIN_H\n", "file_path": "include/control/vehicle_control_iris_origin.h", "rank": 39, "score": 82990.65617335825 }, { "content": "class VehicleControlFloatingSensor : public VehicleControlBase\n\n{\n\nprivate:\n\n ros::Subscriber sub_pose;\n\n ros::Publisher pub_pose;\n\n ros::Publisher pub_twist;\n\n\n\n double speed_;\n\n double time_to_target_;\n\n geometry_msgs::Twist twist_;\n\n\n\npublic:\n\n VehicleControlFloatingSensor();\n\n\n\n void callbackPose(const geometry_msgs::PoseStamped& pose_msg);\n\n\n\n bool isReady();\n\n bool isSationary(double threshold_sensitivity = 1);\n\n void moveVehicle(double threshold_sensitivity = 1);\n\n void FollowPath(double threshold_sensitivity = 1);\n", "file_path": "include/control/vehicle_control_floating_sensor.h", "rank": 40, "score": 82990.65617335825 }, { "content": "\n\n std::string methodName(void);\n\n bool GeneratePath(geometry_msgs::Pose end, nav_msgs::Path &Path);\n\n bool GeneratePath(geometry_msgs::Pose end, std::vector<geometry_msgs::Pose> &Path);\n\n\n\n void SetDynamicGridSize(double x, double y,double z);\n\n void SetOriginPose(double x, double y,double z);\n\n\n\n void start();\n\n\n\n};\n\n\n\n#endif // REACTIVEPATHPLANNER_H\n", "file_path": "include/victim_localization/reactive_path_planner.h", "rank": 41, "score": 81982.45771064873 }, { "content": "#ifndef REACTIVEPATHPLANNER_H\n\n#define REACTIVEPATHPLANNER_H\n\n\n\n#include <ros/ros.h>\n\n#include \"sspp/pathplanner.h\"\n\n\n\n#include <ros/package.h>\n\n#include <geometry_msgs/Pose.h>\n\n#include <geometry_msgs/PoseArray.h>\n\n\n\n#include \"sspp/distance_heuristic.h\"\n\n#include \"rviz_visual_tools/rviz_visual_tools.h\"\n\n#include <octomap_world/octomap_manager.h>\n\n#include <pcl_conversions/pcl_conversions.h>\n\n#include <sspp/sspp_srv.h>\n\n#include <geometry_msgs/PoseStamped.h>\n\n#include <geometry_msgs/Pose.h>\n\n#include \"victim_localization/reactive_planner_server.h\"\n\n#include \"victim_localization/navigation_base.h\"\n\n#include \"nav_msgs/Path.h\"\n\n\n", "file_path": "include/victim_localization/reactive_path_planner.h", "rank": 42, "score": 81976.58611336035 }, { "content": "class TerminationCheckMaxProbability: public TerminationCheckBase\n\n{\n\npublic:\n\n TerminationCheckMaxProbability();\n\n bool isTerminated();\n\n\n\nprotected:\n\n double max_probablity;\n\n};\n\n\n\n#endif // TERMINATION_CHECK_MAX_PROBABILITY_H\n", "file_path": "include/victim_localization/termination_check_max_probability.h", "rank": 43, "score": 81429.11506054642 }, { "content": "class view_generator_ig_frontier: public view_generator_IG\n\n{\n\npublic:\n\n double frontier_yaw_res_;\n\n void setvictimmap(grid_map::GridMap *map,std::string layer_name);\n\n bool setYawtoViewpoint(geometry_msgs::Pose Frontier, Index index_, std::vector<geometry_msgs::Pose> &Frontier_with_yaws);\n\n bool IsPointingtoUnkown(double yaw, Index index_);\n\n\n\n ros::NodeHandle nh_;\n\n ros::Publisher pub_Nav_map;\n\n void publish_Map(grid_map::GridMap Map);\n\n grid_map::GridMap Victim_Nav_map;\n\n std::string Nav_map_layer;\n\n double x_arena_max;\n\n double y_arena_max;\n\n int pointing_to_unknown;\n\n double pointing_to_unknown_threshold;\n\n bool IsWithinCostmap(double x1,double x2);\n\n bool isPreviouslyRejected(geometry_msgs::Pose p);\n\n\n", "file_path": "include/victim_localization/view_generator_ig_frontier.h", "rank": 44, "score": 81429.11506054642 }, { "content": "class TerminationCheckMaxIterations: public TerminationCheckBase\n\n{\n\npublic:\n\n TerminationCheckMaxIterations();\n\n bool isTerminated();\n\n\n\nprotected:\n\n int max_iterations_;\n\n double max_probablity;\n\n\n\n};\n\n\n\n#endif // TERMINATION_CHECK_MAX_ITERATIONS_H\n", "file_path": "include/victim_localization/termination_check_max_iterations.h", "rank": 45, "score": 81429.11506054642 }, { "content": "class view_evaluator_log_reward : public view_evaluator_base\n\n{\n\npublic:\n\n view_evaluator_log_reward();\n\n\n\n double calculateUtility(geometry_msgs::Pose p, Victim_Map_Base *mapping_module);\n\n std::string getMethodName();\n\n\n\n\n\n};\n\n\n\n#endif // VIEW_EVALUATOR_LOG_H\n", "file_path": "include/victim_localization/view_evaluator_log_reward.h", "rank": 46, "score": 81429.11506054642 }, { "content": "class view_evaluator_ig_exp : public view_evaluator_base\n\n{\n\npublic:\n\n view_evaluator_ig_exp();\n\n\n\n double calculateUtiltiy(geometry_msgs::Pose p, Victim_Map_Base *mapping_module, double &new_cell_percentage);\n\n double calculateWirelessUtility(geometry_msgs::Pose p, Victim_Map_Base *mapping_module, double &new_cell_percentage);\n\n double calculateCombinedUtility(geometry_msgs::Pose p,double &new_cell_percentage);\n\n\n\n\n\n std::string getMethodName();\n\n double w_dist_;\n\n};\n\n\n\n#endif // VIEW_EVALUATOR_IG_EXP_H\n", "file_path": "include/victim_localization/view_evaluator_ig_exp.h", "rank": 47, "score": 81429.11506054642 }, { "content": "class view_evaluator_MaxSUM : public view_evaluator_base\n\n{\n\npublic:\n\n view_evaluator_MaxSUM();\n\n\n\n void evaluate();\n\n double calculateUtility(geometry_msgs::Pose p, Victim_Map_Base *mapping_module);\n\n std::string getMethodName();\n\n\n\n};\n\n#endif // VIEW_EVALUATOR_MAX_SUM_H\n", "file_path": "include/victim_localization/view_evaluator_max_sum.h", "rank": 48, "score": 81429.11506054642 }, { "content": "class view_evaluator_weighted_max : public view_evaluator_base\n\n{\n\npublic:\n\n view_evaluator_weighted_max();\n\n\n\n double calculateUtility(geometry_msgs::Pose p, Victim_Map_Base *mapping_module);\n\n void calculateIGwithMax(geometry_msgs::Pose p, Victim_Map_Base *mapping_module, double &IG, double &Max);\n\n void calculateWirelessIGwithMax(geometry_msgs::Pose p, Victim_Map_Base *mapping_module, double &IG, double &Max);\n\n void evaluate();\n\n void evaluateWireless();\n\n void evaluateCombined();\n\n\n\n\n\n std::string getMethodName();\n\n std::vector<geometry_msgs::Pose> Info_poses;\n\n std::vector<double> Info_View_utilities;\n\n std::vector<double> Info_View_Max;\n\n std::vector<double> Info_WirelessDiection;\n\n\n\n\n", "file_path": "include/victim_localization/view_evaluator_weighted_max.h", "rank": 49, "score": 81429.11506054642 }, { "content": "class view_evaluator_MaxMax : public view_evaluator_base\n\n{\n\npublic:\n\n view_evaluator_MaxMax();\n\n\n\n\n\n double GetMAXANDCOUNT(geometry_msgs::Pose p, Victim_Map_Base *mapping_module, double &max, double &max_count, double &new_cell_percentage);\n\n double GetMAXANDCOUNTWIRELESS(geometry_msgs::Pose p, Victim_Map_Base *mapping_module, double &max, double &max_count,double &new_cell_percentage);\n\n double GetMAXANDCOUNCombined(geometry_msgs::Pose p, Victim_Map_Base *mapping_module, double &max, double &max_count, double &new_cell_percentage);\n\n void evaluate();\n\n void evaluateCombined();\n\n void evaluateWireless();\n\n\n\n\n\n std::string getMethodName();\n\n std::vector<double> Info_View_max;\n\n std::vector<double> Info_View_max_count;\n\n std::vector<double> Info_WirelessDiection;\n\n std::vector<geometry_msgs::Pose> Info_poses;\n\n std::vector<double> Info_New_cellsPercentage;\n\n\n\n\n\nprivate:\n\n double max_belief;\n\n\n\n};\n\n\n\n#endif // VIEW_EVALUATOR_MAX_MAX_H\n", "file_path": "include/victim_localization/view_evaluator_max_max.h", "rank": 50, "score": 81429.11506054642 }, { "content": "class view_evaluator_MinNEIGH : public view_evaluator_base\n\n{\n\npublic:\n\n view_evaluator_MinNEIGH();\n\n\n\n void evaluate();\n\n double calculateUtility(geometry_msgs::Pose p, Victim_Map_Base *mapping_module);\n\n std::string getMethodName();\n\n\n\nprivate:\n\n double min_belief;\n\n double max_belief;\n\n\n\n};\n\n\n\n#endif // VIEW_EVALUATOR_MIN_NEIGH_H\n", "file_path": "include/victim_localization/view_evaluator_min_neigh.h", "rank": 51, "score": 81429.11506054642 }, { "content": "class view_evaluator_MaxMIN : public view_evaluator_base\n\n{\n\npublic:\n\n view_evaluator_MaxMIN();\n\n\n\n void evaluate();\n\n double calculateUtility(geometry_msgs::Pose p, Victim_Map_Base *mapping_module);\n\n std::string getMethodName();\n\n\n\nprivate:\n\n double min_belief;\n\n\n\n};\n\n\n\n#endif // VIEW_EVALUATOR_MAX_MIN_H\n", "file_path": "include/victim_localization/view_evaluator_max_min.h", "rank": 52, "score": 81429.11506054642 }, { "content": " class FrustumCullingTT : public FilterIndices<pcl::PointXYZ>\n\n {\n\n typedef typename Filter<pcl::PointXYZ>::PointCloud PointCloud;\n\n typedef typename PointCloud::Ptr PointCloudPtr;\n\n typedef typename PointCloud::ConstPtr PointCloudConstPtr;\n\n\n\n public:\n\n\n\n typedef boost::shared_ptr< FrustumCullingTT> Ptr;\n\n typedef boost::shared_ptr< const FrustumCullingTT > ConstPtr;\n\n\n\n\n\n using Filter<pcl::PointXYZ>::getClassName;\n\n\n\n FrustumCullingTT (bool extract_removed_indices = false)\n\n : FilterIndices<pcl::PointXYZ>::FilterIndices (extract_removed_indices)\n\n , camera_pose_ (Eigen::Matrix4f::Identity ())\n\n , hfov_ (60.0f)\n\n , vfov_ (60.0f)\n\n , np_dist_ (0.1f)\n", "file_path": "include/culling/frustum_culling.h", "rank": 53, "score": 80704.4253286197 }, { "content": "class view_generator_ig_nn_adaptive : public view_generator_IG\n\n{\n\npublic:\n\n view_generator_ig_nn_adaptive();\n\n virtual void generateViews();\n\n std::string getMethodName();\n\n double scale_factor_;\n\n double scale_multiplier_;\n\n\n\n\n\nprivate:\n\n int minima_iterations_;\n\n double minima_threshold_;\n\n bool isStuckInLocalMinima();\n\n bool IsPreviouslyCheckedSamples(double i_x,double i_y);\n\n bool do_adaptive_generation;\n\n double entropy_max;\n\n double new_cell_percentage_threshold;\n\n double current_percentage;\n\n double new_cell_percentage_threshold_respawn;\n\n double new_cell_percentage_Iteration;\n\n bool new_cell_status;\n\n bool new_cell_status_stop;\n\n\n\n\n\n};\n\n\n\n#endif // VIEW_GENERATOR_IG_NN_ADAPTIVE_H\n", "file_path": "include/victim_localization/view_generator_ig_nn_adaptive.h", "rank": 54, "score": 78518.29551983727 }, { "content": "class view_evaluator_ig_exp_max: public view_evaluator_base\n\n{\n\npublic:\n\n view_evaluator_ig_exp_max();\n\n\n\n double calculateUtiltiy(geometry_msgs::Pose p, Victim_Map_Base *mapping_module, double &new_cell_percentage);\n\n double calculateWirelessUtility(geometry_msgs::Pose p, Victim_Map_Base *mapping_module, double &new_cell_percentage);\n\n\n\n std::string getMethodName();\n\n\n\nprivate:\n\n double w_dist_;\n\n double calculateIGMax(geometry_msgs::Pose p, Victim_Map_Base *mapping_module, double &new_cell_percentage);\n\n double calculateWirelessIGMAX(geometry_msgs::Pose p, Victim_Map_Base *mapping_module , double &new_cell_percentage);\n\n};\n\n\n\n#endif // VIEW_EVALUATOR_IG_EXP_MAX_H\n", "file_path": "include/victim_localization/view_evaluator_ig_exp_max.h", "rank": 55, "score": 78518.29551983727 }, { "content": "/*\n\n * Academic License - for use in teaching, academic research, and meeting\n\n * course requirements at degree granting institutions only. Not for\n\n * government, commercial, or other organizational use.\n\n * File: rtGetNaN.cpp\n\n *\n\n * MATLAB Coder version : 3.2\n\n * C/C++ source code generated on : 05-Feb-2018 03:23:30\n\n */\n\n\n\n/*\n\n * Abstract:\n\n * MATLAB for code generation function to initialize non-finite, NaN\n\n */\n\n#include \"rtGetNaN.h\"\n\n#define NumBitsPerChar 8U\n\n\n\n/* Function: rtGetNaN ==================================================\n\n * Abstract:\n\n * Initialize rtNaN needed by the generated code.\n", "file_path": "include/RSSmodel2/rtGetNaN.cpp", "rank": 56, "score": 77299.27514181833 }, { "content": " switch (machByteOrder) {\n\n case LittleEndian:\n\n {\n\n nanF.wordL.wordLuint = 0xFFC00000U;\n\n break;\n\n }\n\n\n\n case BigEndian:\n\n {\n\n nanF.wordL.wordLuint = 0x7FFFFFFFU;\n\n break;\n\n }\n\n }\n\n\n\n return nanF.wordL.wordLreal;\n\n}\n\n\n\n/*\n\n * File trailer for rtGetNaN.cpp\n\n *\n\n * [EOF]\n\n */\n", "file_path": "include/RSSmodel2/rtGetNaN.cpp", "rank": 57, "score": 77290.36283923745 }, { "content": " * NaN is initialized as non-signaling. Assumes IEEE.\n\n */\n\nreal_T rtGetNaN(void)\n\n{\n\n size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);\n\n real_T nan = 0.0;\n\n if (bitsPerReal == 32U) {\n\n nan = rtGetNaNF();\n\n } else {\n\n uint16_T one = 1U;\n\n enum {\n\n LittleEndian,\n\n BigEndian\n\n } machByteOrder = (*((uint8_T *) &one) == 1U) ? LittleEndian : BigEndian;\n\n switch (machByteOrder) {\n\n case LittleEndian:\n\n {\n\n union {\n\n LittleEndianIEEEDouble bitVal;\n\n real_T fltVal;\n", "file_path": "include/RSSmodel2/rtGetNaN.cpp", "rank": 58, "score": 77290.03433129114 }, { "content": " }\n\n }\n\n\n\n return nan;\n\n}\n\n\n\n/* Function: rtGetNaNF ==================================================\n\n * Abstract:\n\n * Initialize rtNaNF needed by the generated code.\n\n * NaN is initialized as non-signaling. Assumes IEEE.\n\n */\n\nreal32_T rtGetNaNF(void)\n\n{\n\n IEEESingle nanF = { { 0 } };\n\n\n\n uint16_T one = 1U;\n\n enum {\n\n LittleEndian,\n\n BigEndian\n\n } machByteOrder = (*((uint8_T *) &one) == 1U) ? LittleEndian : BigEndian;\n", "file_path": "include/RSSmodel2/rtGetNaN.cpp", "rank": 59, "score": 77289.74857983881 }, { "content": " } tmpVal;\n\n\n\n tmpVal.bitVal.words.wordH = 0xFFF80000U;\n\n tmpVal.bitVal.words.wordL = 0x00000000U;\n\n nan = tmpVal.fltVal;\n\n break;\n\n }\n\n\n\n case BigEndian:\n\n {\n\n union {\n\n BigEndianIEEEDouble bitVal;\n\n real_T fltVal;\n\n } tmpVal;\n\n\n\n tmpVal.bitVal.words.wordH = 0x7FFFFFFFU;\n\n tmpVal.bitVal.words.wordL = 0xFFFFFFFFU;\n\n nan = tmpVal.fltVal;\n\n break;\n\n }\n", "file_path": "include/RSSmodel2/rtGetNaN.cpp", "rank": 60, "score": 77287.14275215888 }, { "content": "class view_generator_ig_adaptive_frontier : public view_generator_ig_frontier\n\n{\n\npublic:\n\n view_generator_ig_adaptive_frontier();\n\n\n\n void generateViews(); //viewpoints is generated at current pose\n\n std::string getMethodName();\n\n void resetScaleFactor();\n\n void setSampleResolution(double resX, double resY);\n\n\n\n\n\n //visualize\n\n double scale_factor_;\n\n double scale_multiplier_;\n\n\n\nprivate:\n\n int minima_iterations_;\n\n double minima_threshold_;\n\n int adaptive_ig_max_iteration_;\n\n int adaptive_iteration_;\n\n bool isStuckInLocalMinima();\n\n\n\n};\n\n\n\n#endif // VIEW_GENERATOR_IG_ADAPTIVE_FRONTIER_H\n", "file_path": "include/victim_localization/view_generator_ig_adaptive_frontier.h", "rank": 61, "score": 77159.6124259931 }, { "content": "extern real_T rtGetNaN(void);\n", "file_path": "include/RSSmodel2/rtGetNaN.h", "rank": 62, "score": 74879.14091574417 }, { "content": " class VoxelGridOcclusionEstimationT: public VoxelGrid<pcl::PointXYZ>\n\n {\n\n protected:\n\n using VoxelGrid<pcl::PointXYZ>::min_b_;\n\n using VoxelGrid<pcl::PointXYZ>::max_b_;\n\n using VoxelGrid<pcl::PointXYZ>::div_b_;\n\n using VoxelGrid<pcl::PointXYZ>::leaf_size_;\n\n using VoxelGrid<pcl::PointXYZ>::inverse_leaf_size_;\n\n\n\n typedef typename Filter<pcl::PointXYZ>::PointCloud PointCloud;\n\n typedef typename PointCloud::Ptr PointCloudPtr;\n\n typedef typename PointCloud::ConstPtr PointCloudConstPtr;\n\n\n\n public:\n\n /** \\brief Empty constructor. */\n\n VoxelGridOcclusionEstimationT ()\n\n {\n\n initialized_ = false;\n\n this->setSaveLeafLayout (true);\n\n }\n", "file_path": "include/culling/voxel_grid_occlusion_estimation.h", "rank": 63, "score": 74592.71856539424 }, { "content": " class VoxelGridOcclusionEstimationT: public VoxelGrid<pcl::PointXYZ>\n\n {\n\n protected:\n\n using VoxelGrid<pcl::PointXYZ>::min_b_;\n\n using VoxelGrid<pcl::PointXYZ>::max_b_;\n\n using VoxelGrid<pcl::PointXYZ>::div_b_;\n\n using VoxelGrid<pcl::PointXYZ>::leaf_size_;\n\n using VoxelGrid<pcl::PointXYZ>::inverse_leaf_size_;\n\n\n\n typedef typename Filter<pcl::PointXYZ>::PointCloud PointCloud;\n\n typedef typename PointCloud::Ptr PointCloudPtr;\n\n typedef typename PointCloud::ConstPtr PointCloudConstPtr;\n\n\n\n public:\n\n /** \\brief Empty constructor. */\n\n VoxelGridOcclusionEstimationT ()\n\n {\n\n initialized_ = false;\n\n this->setSaveLeafLayout (true);\n\n }\n", "file_path": "include/component_test/voxel_grid_occlusion_estimation.h", "rank": 64, "score": 73234.03547155007 }, { "content": " uint32_T wordH;\n", "file_path": "include/RSSmodel2/rt_nonfinite.h", "rank": 65, "score": 69421.64076384345 }, { "content": "extern boolean_T rtIsNaN(real_T value);\n", "file_path": "include/RSSmodel2/rt_nonfinite.h", "rank": 66, "score": 67656.04280728946 }, { "content": "extern real_T rtNaN;\n", "file_path": "include/RSSmodel2/rt_nonfinite.h", "rank": 67, "score": 67656.04280728946 }, { "content": "extern void rt_InitInfAndNaN(size_t realSize);\n", "file_path": "include/RSSmodel2/rt_nonfinite.h", "rank": 68, "score": 64445.01972361658 }, { "content": "extern real32_T rtGetNaNF(void);\n", "file_path": "include/RSSmodel2/rtGetNaN.h", "rank": 69, "score": 62951.15745106927 }, { "content": "#include \"victim_localization/reactive_path_planner.h\"\n\n\n\n\n\nReactivePathPlanner::ReactivePathPlanner(const ros::NodeHandle &nh, const ros::NodeHandle &nh_private, volumetric_mapping::OctomapManager *manager):\n\nnh_(nh),\n\nnh_private_(nh_private),\n\nmanager_(manager),\n\nnavigationBase()\n\n{\n\n}\n\n\n\nbool ReactivePathPlanner::GeneratePath(geometry_msgs::Pose end, nav_msgs::Path &Path)\n\n{\n\n if (getDistance(current_pose_,end)< d_close) // terminate if the end pose is at the robot current pose\n\n return false;\n\n\n\n std::cout << \"calling the service\" << std::endl;\n\n\n\n if (manager_ == NULL) {\n\n ROS_ERROR_THROTTLE(1, \"Planner not set up: No octomap available!\");\n", "file_path": "src/reactive_path_planner.cpp", "rank": 70, "score": 43996.853961453 }, { "content": " return false;\n\n\n\n if (manager_ == NULL) {\n\n ROS_ERROR_THROTTLE(1, \"Planner not set up: No octomap available!\");\n\n return false;\n\n }\n\n\n\n ROS_INFO(\"Executing the Reactive Planner\");\n\n\n\n if(reactivePlannerServer->PathGeneration(current_pose_,end,Path))\n\n {\n\n return true;\n\n }\n\n else\n\n {\n\n std::cout << cc.red << \"Planner Failed to generate planne... Skipping Navigation \\n\" << cc.reset;\n\n return false;\n\n }\n\n}\n\nstd::string ReactivePathPlanner::methodName(void)\n", "file_path": "src/reactive_path_planner.cpp", "rank": 71, "score": 43994.24560127945 }, { "content": "{\n\n methodName_=\"ReactivePathPlanner\";\n\n return methodName_;\n\n}\n\n\n\nvoid ReactivePathPlanner::start()\n\n\n\n{\n\n //initiate the reactive planner service\n\n reactivePlannerServer= new ReactivePlannerServer(nh_,nh_private_,manager_);\n\n}\n\n\n\nvoid ReactivePathPlanner::SetDynamicGridSize(double x, double y, double z)\n\n{\n\n reactivePlannerServer->SetDynamicGridSize(x,y,z);\n\n}\n\n\n\nvoid ReactivePathPlanner::SetOriginPose(double x, double y, double z)\n\n{\n\n reactivePlannerServer->SetOriginPose(x,y,z);\n\n}\n", "file_path": "src/reactive_path_planner.cpp", "rank": 72, "score": 43992.01995055516 }, { "content": " return false;\n\n }\n\n\n\n ROS_INFO(\"Executing the Planner Loop...\");\n\n\n\n if(reactivePlannerServer->PathGeneration(current_pose_,end,Path))\n\n {\n\n return true;\n\n }\n\n else\n\n {\n\n ROS_INFO(\"No Path Found or planner not ready!\");\n\n return false;\n\n }\n\n\n\n}\n\n\n\nbool ReactivePathPlanner::GeneratePath(geometry_msgs::Pose end,std::vector<geometry_msgs::Pose> &Path)\n\n{\n\n if (getDistance(current_pose_,end)< d_close) // terminate if the end pose is at the robot current pose\n", "file_path": "src/reactive_path_planner.cpp", "rank": 73, "score": 43991.300300336115 }, { "content": " void callbackCommandStatus(const std_msgs::Bool::ConstPtr& msg);\n\n bool GetStatus();\n\n\n\n ros::Time previous_time;\n\n\n\n bool Execute_waypoint(geometry_msgs::Pose p);\n\n bool Execute_path(nav_msgs::Path path);\n\n bool Execute_path(std::vector<geometry_msgs::Pose> path);\n\n\n\n};\n\n\n\n#endif // DRONE_COMMUNICATOR_H\n", "file_path": "include/control/vehicle_communicator.h", "rank": 74, "score": 41851.87826607616 }, { "content": "\n\n double sensor_max_range,visualize_max_z,visualize_min_z,map_publish_frequency;\n\n bool treat_unknown_as_occupied;\n\n\n\npublic:\n\n\n\n void update();\n\n double compute2DRelativeRays();\n\n void compute2DRaysAtPose(geometry_msgs::Pose p);\n\n virtual void Initiate(bool publish, bool rebuild_once=false);\n\n void Done();\n\n\n\n\n\n};\n\n\n\n#endif // RAY_TRACING_2D_H\n", "file_path": "include/victim_localization/raytracing_2d.h", "rank": 75, "score": 41851.051509419085 }, { "content": " void setOctomapManager(volumetric_mapping::OctomapManager *manager);\n\n void publish_Map(grid_map::GridMap Map);\n\n void SetNavMap(nav_msgs::OccupancyGridPtr Nav_map);\n\n virtual void update();\n\n virtual void Initiate(bool publish, bool rebuild_once=false){};\n\n virtual void Done(){};\n\n\n\n};\n\n\n\n#endif // RAY_TRACING_H\n", "file_path": "include/victim_localization/raytracing.h", "rank": 76, "score": 41850.79250174356 }, { "content": "#ifndef IRIS_DRONE_COMMANDER_H\n\n#define IRIS_DRONE_COMMANDER_H\n\n\n\n#include \"control/vehicle_control_iris.h\"\n\n#include \"control/vehicle_control_iris_origin.h\"\n\n#include \"control/vehicle_control_floating_sensor.h\"\n\n#include \"std_msgs/Bool.h\"\n\n#include \"std_msgs/Int32.h\"\n\n#include \"victim_localization/rotate_action.h\"\n\n#include \"victim_localization/waypoint_action.h\"\n\n#include \"victim_localization/path_action.h\"\n\n#include \"victim_localization/path2_action.h\"\n\n#include \"victim_localization/status_action.h\"\n\n\n\nnamespace Command {\n", "file_path": "include/control/vehicle_commander.h", "rank": 77, "score": 41850.06269692413 }, { "content": "#ifndef DRONE_COMMUNICATOR_H\n\n#define DRONE_COMMUNICATOR_H\n\n\n\n#include \"control/vehicle_control_iris.h\"\n\n#include \"std_msgs/Bool.h\"\n\n#include \"std_msgs/Int32.h\"\n\n#include \"victim_localization/volumetric_map_manager.h\"\n\n#include \"victim_localization/rotate_action.h\"\n\n#include \"victim_localization/path_action.h\"\n\n#include \"victim_localization/path2_action.h\"\n\n#include \"victim_localization/waypoint_action.h\"\n\n#include \"victim_localization/status_action.h\"\n\n#include \"rviz_visual_tools/rviz_visual_tools.h\"\n\n#include \"vehicle_control_base.h\"\n\n\n\n\n\n\n\nnamespace Command {\n", "file_path": "include/control/vehicle_communicator.h", "rank": 78, "score": 41849.93465785261 }, { "content": "\n\n ros::ServiceServer service_rotation;\n\n ros::ServiceServer service_waypoint;\n\n ros::ServiceServer service_path;\n\n ros::ServiceServer service_path2;\n\n ros::ServiceServer service_status;\n\n void Takeoff();\n\n void rotate();\n\n void start();\n\n bool execute_rotation(victim_localization::rotate_action::Request &request,\n\n victim_localization::rotate_action::Response &respond);\n\n\n\n bool execute_waypoint(victim_localization::waypoint_action::Request &request,\n\n victim_localization::waypoint_action::Response &respond);\n\n\n\n bool execute_path(victim_localization::path_action::Request &request,\n\n victim_localization::path_action::Response &respond);\n\n\n\n bool execute_path2(victim_localization::path2_action::Request &request,\n\n victim_localization::path2_action::Response &respond);\n\n\n\n bool check_status(victim_localization::status_action::Request &request,\n\n victim_localization::status_action::Response &respond);\n\n\n\n};\n\n\n\n#endif // IRIS_DRONE_COMMANDER_H\n", "file_path": "include/control/vehicle_commander.h", "rank": 79, "score": 41849.71436329802 }, { "content": "#ifndef RAY_TRACING_2D_H\n\n#define RAY_TRACING_2D_H\n\n\n\n#include <victim_localization/raytracing.h>\n\n\n\n\n\ntypedef geometry_msgs::Point Point;\n\ntypedef geometry_msgs::PoseStamped PoseStamped;\n\n\n\nusing namespace grid_map;\n\nusing namespace volumetric_mapping;\n\n\n\n\n\n\n", "file_path": "include/victim_localization/raytracing_2d.h", "rank": 80, "score": 41846.849783215774 }, { "content": "\n\n void Publish2DOctomap();\n\n void updateOctomapOccupancy(octomap::KeySet* free_cells,\n\n octomap::KeySet* occupied_cells);\n\n void ResetOctomapRebuild();\n\n\n\n grid_map::GridMap Generate_2D_Safe_Plane(geometry_msgs::Pose p, bool publish_=false, bool castThroughUnkown=true);\n\n\n\n void publish_Map2(GridMap Map);\n\n\n\n // Publish markers for visualization.\n\n ros::Publisher occupied_nodes_pub_;\n\n ros::Publisher free_nodes_pub_;\n\n ros::Publisher pub_temp_map1;\n\n\n\n grid_map::GridMap map_;\n\n std::shared_ptr<octomap::OcTree> octree_2d;\n\n bool rebuild_octomap_once;\n\n double octomap_height;\n\n bool rebuild_octomap_;\n", "file_path": "include/victim_localization/raytracing_2d.h", "rank": 81, "score": 41845.88665878092 }, { "content": "\n\n victim_localization::rotate_action rotate_srv;\n\n victim_localization::waypoint_action waypoint_srv;\n\n victim_localization::path_action path_srv;\n\n victim_localization::path2_action path2_srv;\n\n victim_localization::status_action status_srv;\n\n\n\n geometry_msgs::Pose Waypoint_;\n\n nav_msgs::Path Path_;\n\n\n\n geometry_msgs::Pose current_pose;\n\n\n\n bool current_drone_status;\n\n\n\n rviz_visual_tools::RvizVisualToolsPtr visualTools;\n\n\n\n\n\n geometry_msgs::Pose GetPose();\n\n void Check_MapManager_and_Drone_Ready();\n\n void callbackPose(const geometry_msgs::PoseStamped::ConstPtr& msg);\n", "file_path": "include/control/vehicle_communicator.h", "rank": 82, "score": 41845.228360274916 }, { "content": "#ifndef TimeProfiler_H\n\n#define TimeProfiler_H\n\n\n\n#include <iostream>\n\n#include <sstream>\n\n#include <chrono>\n\n#include <fstream>\n\n#include <map>\n\n\n", "file_path": "include/utilities/time_profiler.h", "rank": 83, "score": 41844.31264730584 }, { "content": "/*\n\n * Software License Agreement (BSD License)\n\n *\n\n * Point Cloud Library (PCL) - www.pointclouds.org\n\n * Copyright (c) 2012-, Open Perception, Inc.\n\n *\n\n * All rights reserved.\n\n *\n\n * Redistribution and use in source and binary forms, with or without\n\n * modification, are permitted provided that the following conditions\n\n * are met:\n\n *\n\n * * Redistributions of source code must retain the above copyright\n\n * notice, this list of conditions and the following disclaimer.\n\n * * Redistributions in binary form must reproduce the above\n\n * copyright notice, this list of conditions and the following\n\n * disclaimer in the documentation and/or other materials provided\n\n * with the distribution.\n\n * * Neither the name of the copyright holder(s) nor the names of its\n\n * contributors may be used to endorse or promote products derived\n", "file_path": "include/culling/frustum_culling.h", "rank": 84, "score": 41843.9161063502 }, { "content": "#ifndef OCCLUSION_H_\n\n#define OCCLUSION_H_\n\n\n\n#include <iostream>\n\n\n\n#include \"ros/ros.h\"\n\n#include <ros/package.h>\n\n\n\n#include <eigen_conversions/eigen_msg.h>\n\n#include <Eigen/Geometry>\n\n#include <Eigen/Dense>\n\n\n\n#include <geometry_msgs/Pose.h>\n\n\n\n#include <pcl/io/pcd_io.h>\n\n#include <pcl/point_types.h>\n\n#include <pcl_conversions/pcl_conversions.h>\n\n#include <pcl/common/eigen.h>\n\n#include <pcl/common/transforms.h>\n\n#include <pcl/range_image/range_image.h>\n", "file_path": "include/culling/occlusion_culling.h", "rank": 85, "score": 41843.68700035304 }, { "content": "#ifndef RAY_TRACING_H\n\n#define RAY_TRACING_H\n\n\n\n#include <ros/ros.h>\n\n#include <grid_map_ros/grid_map_ros.hpp>\n\n#include <grid_map_msgs/GridMap.h>\n\n#include <cmath>\n\n#include \"math.h\"\n\n#include <iostream>\n\n#include <string>\n\n#include <vector>\n\n#include \"geometry_msgs/PointStamped.h\"\n\n#include <boost/filesystem.hpp>\n\n#include <boost/shared_ptr.hpp>\n\n#include <boost/array.hpp>\n\n#include <sensor_msgs/PointCloud.h>\n\n#include \"victim_localization/common.h\"\n\n#include <octomap_world/octomap_manager.h>\n\n#include <visualization_msgs/Marker.h>\n\n#include <std_msgs/Float32.h>\n", "file_path": "include/victim_localization/raytracing.h", "rank": 86, "score": 41843.39880571366 }, { "content": "#ifndef STRAIGHTLINE_H\n\n#define STRAIGHTLINE_H\n\n\n\n#include \"victim_localization/navigation_base.h\"\n\n\n\n\n", "file_path": "include/victim_localization/straightline.h", "rank": 87, "score": 41843.11924793462 }, { "content": " * from this software without specific prior written permission.\n\n *\n\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n\n * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n\n * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n\n * POSSIBILITY OF SUCH DAMAGE.\n\n *\n\n */\n\n\n\n#include <pcl/point_types.h>\n\n#include <pcl/filters/filter_indices.h>\n\n#include <pcl/common/transforms.h>\n", "file_path": "include/culling/frustum_culling.h", "rank": 88, "score": 41842.61458308899 }, { "content": "#include <tf_conversions/tf_eigen.h>\n\n#include <tf/transform_listener.h>\n\n#include <Eigen/Geometry>\n\n#include <victim_localization/view_generator_ig.h>\n\n#include <control/vehicle_communicator.h>\n\n\n\n\n\ntypedef geometry_msgs::Point Point;\n\ntypedef geometry_msgs::PoseStamped PoseStamped;\n\n\n\nusing namespace grid_map;\n\n\n", "file_path": "include/victim_localization/raytracing.h", "rank": 89, "score": 41842.597346839575 }, { "content": "\n\nRaytracing(double map_res_);\n\nRaytracing(double map_res_, double HFOV_deg, double VFOV_deg, double max_d, double min_d);\n\n~Raytracing();\n\n\n\nvoid setCameraSettings(double fov_h, double fov_v, double r_max, double r_min);\n\nbool isInsideBounds(Position p);\n\n\n\npublic:\n\n\n\n bool isPointInBounds(octomap::point3d &p);\n\n void getCameraRotationMtxs();\n\n double getNodeOccupancy(octomap::OcTreeNode* node);\n\n double getNodeEntropy(octomap::OcTreeNode* node);\n\n int getPointCountAtOcTreeKey(octomap::OcTreeKey key);\n\n double computeRelativeRays();\n\n void computeRaysAtPose(geometry_msgs::Pose p);\n\n bool isInsideRegionofInterest(double z , double tolerance=0.3);\n\n void setDroneCommunicator(vehicle_communicator *drone_comm_);\n\n void setVehicle(VehicleControlBase *vehicle_);\n", "file_path": "include/victim_localization/raytracing.h", "rank": 90, "score": 41842.31191373775 }, { "content": "\n\n#include <sensor_msgs/PointCloud2.h>\n\n\n\n#include <tf/tf.h>\n\n#include <tf_conversions/tf_eigen.h>\n\n\n\n#include <visualization_msgs/Marker.h>\n\n#include <visualization_msgs/MarkerArray.h>\n\n\n\n// Custom classes\n\n#include <culling/frustum_culling.h>\n\n#include <culling/voxel_grid_occlusion_estimation.h>\n\n\n", "file_path": "include/culling/occlusion_culling.h", "rank": 91, "score": 41838.98224228825 }, { "content": " Eigen::Vector3f fp_tl;\n\n Eigen::Vector3f fp_tr;\n\n Eigen::Vector3f fp_bl;\n\n Eigen::Vector3f fp_br;\n\n \n\n Eigen::Vector3f np_tr;\n\n Eigen::Vector3f np_bl;\n\n Eigen::Vector3f np_br;\n\n Eigen::Vector3f np_tl;\n\n protected:\n\n using PCLBase<pcl::PointXYZ>::input_;\n\n using PCLBase<pcl::PointXYZ>::indices_;\n\n using Filter<pcl::PointXYZ>::filter_name_;\n\n using FilterIndices<pcl::PointXYZ>::negative_;\n\n using FilterIndices<pcl::PointXYZ>::keep_organized_;\n\n using FilterIndices<pcl::PointXYZ>::user_filter_value_;\n\n using FilterIndices<pcl::PointXYZ>::extract_removed_indices_;\n\n using FilterIndices<pcl::PointXYZ>::removed_indices_;\n\n\n\n /** \\brief Sample of point indices into a separate PointCloud\n", "file_path": "include/culling/frustum_culling.h", "rank": 92, "score": 41838.62564268653 }, { "content": " * fc.setCameraPose (pose_new);\n\n * \\endcode\n\n */\n\n void \n\n setCameraPose (const Eigen::Matrix4f& camera_pose)\n\n {\n\n camera_pose_ = camera_pose;\n\n }\n\n\n\n /** \\brief Get the pose of the camera w.r.t the origin */\n\n Eigen::Matrix4f\n\n getCameraPose () const\n\n {\n\n return (camera_pose_);\n\n }\n\n\n\n /** \\brief Set the horizontal field of view for the camera in degrees\n\n * \\param[in] hfov the field of view\n\n */\n\n void \n", "file_path": "include/culling/frustum_culling.h", "rank": 93, "score": 41837.58807951584 }, { "content": " double y_arena_max;\n\n std::string camera_optical_frame;\n\n std::string base_frame;\n\n double tree_resolution;\n\n Eigen::Matrix3d camera_rotation_mtx_; // Camera rotation mtx\n\n double map_res;\n\n bool publish_ray_;\n\n ros::Publisher pub_temp_map;\n\n ros::NodeHandle nh_;\n\n\n\n\n\nstd::vector<Eigen::Vector3d> rays_far_plane_;\n\nstd::vector<octomap::point3d> rays_far_plane_at_pose_;\n\n\n\ndouble nav_bounds_x_max_, nav_bounds_y_max_, nav_bounds_z_max_;\n\ndouble nav_bounds_x_min_, nav_bounds_y_min_, nav_bounds_z_min_;\n\ndouble uav_fixed_height_;\n\n\n\nvirtual grid_map::GridMap Generate_2D_Safe_Plane(geometry_msgs::Pose p, bool publish_=false, bool castThroughUnkown=true);\n\n\n", "file_path": "include/victim_localization/raytracing.h", "rank": 94, "score": 41837.49455963446 }, { "content": " * \\param[out] output the resultant point cloud\n\n */\n\n void\n\n applyFilter (PointCloud &output);\n\n\n\n /** \\brief Sample of point indices\n\n * \\param[out] indices the resultant point cloud indices\n\n */\n\n void\n\n applyFilter (std::vector<int> &indices);\n\n\n\n private:\n\n\n\n /** \\brief The camera pose */\n\n Eigen::Matrix4f camera_pose_;\n\n /** \\brief Horizontal field of view */\n\n float hfov_;\n\n /** \\brief Vertical field of view */\n\n float vfov_;\n\n /** \\brief Near plane distance */\n\n float np_dist_;\n\n /** \\brief Far plane distance */\n\n float fp_dist_;\n\n\n\n public:\n\n EIGEN_MAKE_ALIGNED_OPERATOR_NEW\n\n };\n\n}\n", "file_path": "include/culling/frustum_culling.h", "rank": 95, "score": 41837.18983933975 }, { "content": " Eigen::Vector3i max_b1, min_b1;\n\n visualization_msgs::Marker linesList1,linesList2,linesList3,linesList4;\n\n visualization_msgs::MarkerArray marker_array;\n\n pcl::FrustumCullingTT fc;\n\n double maxAccuracyError, minAccuracyError;\n\n\n\n // >>>>>>>>\n\n // Methods\n\n // >>>>>>>>\n\n //OcclusionCulling();\n\n //OcclusionCulling(std::string modelName);\n\n //OcclusionCulling(ros::NodeHandle & n, std::string modelName);\n\n OcclusionCulling(pcl::PointCloud<pcl::PointXYZ>::Ptr& cloudPtr);\n\n OcclusionCulling(pcl::PointCloud<pcl::PointXYZRGB>::Ptr& cloudPtr);\n\n \n\n ~OcclusionCulling(){};\n\n void initConfig(pcl::PointCloud<pcl::PointXYZ>::Ptr& cloudPtr);\n\n void initConfig(pcl::PointCloud<pcl::PointXYZ>::Ptr& cloudPtr, ros::NodeHandle nodeHandle);\n\n void visualizeRaycast(geometry_msgs::Pose location);\n\n \n", "file_path": "include/culling/occlusion_culling.h", "rank": 96, "score": 41837.181081487324 }, { "content": " setHorizontalFOV (float hfov)\n\n {\n\n hfov_ = hfov;\n\n }\n\n\n\n /** \\brief Get the horizontal field of view for the camera in degrees */\n\n float \n\n getHorizontalFOV () const\n\n {\n\n return (hfov_);\n\n }\n\n\n\n /** \\brief Set the vertical field of view for the camera in degrees\n\n * \\param[in] vfov the field of view\n\n */\n\n void \n\n setVerticalFOV (float vfov)\n\n {\n\n vfov_ = vfov;\n\n }\n", "file_path": "include/culling/frustum_culling.h", "rank": 97, "score": 41836.68338015755 }, { "content": " {\n\n return (np_dist_);\n\n }\n\n\n\n /** \\brief Set the far plane distance\n\n * \\param[in] fp_dist the far plane distance\n\n */\n\n void \n\n setFarPlaneDistance (float fp_dist)\n\n {\n\n fp_dist_ = fp_dist;\n\n }\n\n\n\n /** \\brief Get the far plane distance */\n\n float \n\n getFarPlaneDistance () const\n\n {\n\n return (fp_dist_);\n\n }\n\n //added part for debuging\n", "file_path": "include/culling/frustum_culling.h", "rank": 98, "score": 41836.63492378264 } ]
C++
fin_control/src/fin_control.cpp
ChrisScianna/ROS-Underwater-RnD
f928bcc6b19a830b98e2cc2aedd65ff35b887901
#include "fin_control/fin_control.h" #include <string> #include <diagnostic_tools/message_stagnation_check.h> #include <diagnostic_tools/periodic_message_status.h> namespace qna { namespace robot { FinControl::FinControl(ros::NodeHandle &nodeHandle) : nodeHandle(nodeHandle), diagnosticsUpdater(nodeHandle) { diagnosticsUpdater.setHardwareID("fin_control"); fincontrolEnabled = false; std::string serial_dev = "/dev/ttyUSB0"; int serial_baud = 57600; ctrlFinOffset = 0; ctrlFinScaleFactor = 1.0; servosON = false; const char *log; currentLoggingEnabled = false; reportAngleRate = 25.0; minReportAngleRate = reportAngleRate / 2.0; maxReportAngleRate = reportAngleRate * 2.0; ros::NodeHandle nh; ROS_INFO("Starting fin_control node Version: [%s]", NODE_VERSION); nh.setParam("/version_numbers/fin_control", NODE_VERSION); if (nh.getParam("/fin_control/port", serial_dev) == 0) ROS_INFO("Parmeter Not found defaullting Serial Port: [%s]", serial_dev.c_str()); nh.getParam("/fin_control/baud", serial_baud); ROS_INFO("Serial Port: [%s]", serial_dev.c_str()); ROS_INFO("baud: [%d]", serial_baud); maxCtrlFinAngle = degreesToRadians(10); nh.getParam("/fin_control/max_ctrl_fin_angle", maxCtrlFinAngle); ROS_INFO("max cf angle: [%f] rad", maxCtrlFinAngle); nh.getParam("/fin_control/ctrl_fin_offset", ctrlFinOffset); ROS_INFO("cf offset: [%f] rad", ctrlFinOffset); nh.getParam("/fin_control/ctrl_fin_scale_factor", ctrlFinScaleFactor); ROS_INFO("cf scale: [%f]", ctrlFinScaleFactor); nh.getParam("/fin_control/current_logging_enabled", currentLoggingEnabled); if (currentLoggingEnabled) ROS_INFO("FIN CURRENT LOGGING ENABLED"); nh.getParam("/fin_control/report_angle_rate", reportAngleRate); nh.getParam("/fin_control/min_report_angle_rate", minReportAngleRate); nh.getParam("/fin_control/max_report_angle_rate", maxReportAngleRate); ROS_INFO("fin control constructor enter"); subscriber_setAngles = nodeHandle.subscribe("/fin_control/set_angles", 10, &FinControl::handleSetAngles, this); publisher_reportAngle = diagnostic_tools::create_publisher<fin_control::ReportAngle>( nodeHandle, "/fin_control/report_angle", 1); diagnostic_tools::PeriodicMessageStatusParams report_angle_rate_check_params; report_angle_rate_check_params.min_acceptable_period(minReportAngleRate); report_angle_rate_check_params.max_acceptable_period(maxReportAngleRate); report_angle_rate_check_params.abnormal_diagnostic(diagnostic_tools::Diagnostic::WARN); report_angle_rate_check_params.stale_diagnostic({ diagnostic_tools::Diagnostic::STALE, health_monitor::ReportFault::FIN_DATA_STALE }); diagnosticsUpdater.add( publisher_reportAngle.add_check<diagnostic_tools::PeriodicMessageStatus>( "rate check", report_angle_rate_check_params)); timer_reportAngle = nodeHandle.createTimer( ros::Duration(1. / reportAngleRate), &FinControl::reportAngleSendTimeout, this); finAngleCheck = diagnostic_tools::create_health_check<double>( "Fin angle within range", [this](double angle) -> diagnostic_tools::Diagnostic { using diagnostic_tools::Diagnostic; if (std::abs(angle) > maxCtrlFinAngle) { using health_monitor::ReportFault; return Diagnostic(Diagnostic::WARN, ReportFault::FIN_DATA_THRESHOLD_REACHED) .description("Fin angle beyond limits: |%f| rad > %f rad", angle, maxCtrlFinAngle); } return Diagnostic::OK; }); diagnosticsUpdater.add(finAngleCheck); if (myWorkBench.begin(serial_dev.c_str(), serial_baud, &log)) { ROS_INFO("Dynamixel Workbench intialized"); } else { ROS_ERROR("Dynamixel Workbench failed init %s", log); return; } numOfIDs = 0; if (myWorkBench.scan(ids, &numOfIDs, 1, 4, &log)) { ROS_INFO("num of ids found [%d]", numOfIDs); if (numOfIDs < NUM_FINS) ROS_WARN("Fin servos found: [%d] does not match expected number of fins [%d]", numOfIDs, NUM_FINS); } else { ROS_ERROR("Servo scan failed! %s", log); return; } for (int x = 0; x < numOfIDs; x++) { if (!myWorkBench.torqueOn(ids[x], &log)) { ROS_ERROR("Could not set torque on fin sevro [%d] %s", ids[x], log); return; } else { servosON = true; } } if (!myWorkBench.initBulkWrite(&log)) { ROS_ERROR("Could not init bulk write %s", log); return; } ros::spin(); } FinControl::~FinControl() { const char *log; if (servosON) { ROS_INFO("Turning off fin servos"); for (int x = 0; x < numOfIDs; x++) { if (!myWorkBench.torqueOff(ids[x], &log)) ROS_ERROR("Could not turn off torque on fin sevro [%d] %s", ids[x], log); } } } void FinControl::reportAngles() { const char *log; fin_control::ReportAngle message; bool servos_angles_info_complete = true; float radianAngleFromMyWorkBench = 0.; message.header.stamp = ros::Time::now(); for (int id = 1; id <= numOfIDs; ++id) { if (myWorkBench.getRadian(id, &radianAngleFromMyWorkBench, &log)) { message.angles_in_radians.push_back( static_cast<float>( round(((radianAngleFromMyWorkBench / ctrlFinScaleFactor) - ctrlFinOffset) * 100.0) / 100.0)); finAngleCheck.test(message.angles_in_radians.back()); } else { servos_angles_info_complete = false; ROS_ERROR("Could not get servo angle for ID %d %s", id, log); } } if (servos_angles_info_complete) { publisher_reportAngle.publish(message); } } float FinControl::degreesToRadians(float degrees) { return ((degrees / 180.0) * M_PI); } void FinControl::handleSetAngles(const fin_control::SetAngles::ConstPtr &msg) { const char *log; float angle_plus_offset; for (int i = 0; i < 4; i++) { if (fabs(msg->fin_angle_in_radians[i]) > maxCtrlFinAngle) { ROS_ERROR_STREAM("The Angle " << i << "to be set is out of range - value: " << msg->fin_angle_in_radians[i]); return; } } boost::mutex::scoped_lock lock(m_mutex); if (!myWorkBench.initBulkWrite(&log)) { ROS_ERROR("Could not init bulk write %s", log); return; } int32_t current_data = 0; for (int i = 0; i < 4; ++i) { angle_plus_offset = ctrlFinScaleFactor * (msg->fin_angle_in_radians[i] + ctrlFinOffset); const int id = i + 1; if (!(myWorkBench.addBulkWriteParam( id, "Goal_Position", myWorkBench.convertRadian2Value(id, angle_plus_offset), &log))) { ROS_ERROR_STREAM("Could not add bulk write param " << id << " " << log); return; } if (!myWorkBench.bulkWrite(&log)) { ROS_ERROR_STREAM("Could not bulk write " << log); } if (currentLoggingEnabled) { if (!myWorkBench.itemRead(id, "Present_Current", &current_data, &log)) { ROS_ERROR_STREAM("Could not read current from finID: " << id << " log: " << log); } else { ROS_DEBUG_STREAM("Current for Fin: " << id << " = " << myWorkBench.convertValue2Current(static_cast<int16_t>(current_data))); } } } } void FinControl::reportAngleSendTimeout(const ros::TimerEvent &ev) { reportAngles(); diagnosticsUpdater.update(); } } }
#include "fin_control/fin_control.h" #include <string> #include <diagnostic_tools/message_stagnation_check.h> #include <diagnostic_tools/periodic_message_status.h> namespace qna { namespace robot { FinControl::FinControl(ros::NodeHandle &nodeHandle) : nodeHandle(nodeHandle), diagnosticsUpdater(nodeHandle) { diagnosticsUpdater.setHardwareID("fin_control"); fincontrolEnabled = false; std::string serial_dev = "/dev/ttyUSB0"; int serial_baud = 57600; ctrlFinOffset = 0; ctrlFinScaleFactor = 1.0; servosON = false; const char *log; currentLoggingEnabled = false; reportAngleRate = 25.0; minReportAngleRate = reportAngleRate / 2.0; maxReportAngleRate = reportAngleRate * 2.0; ros::NodeHandle nh; ROS_INFO("Starting fin_control node Version: [%s]", NODE_VERSION); nh.setParam("/version_numbers/fin_control", NODE_VERSION); if (nh.getParam("/fin_control/port", serial_dev) == 0) ROS_INFO("Parmeter Not found defaullting Serial Port: [%s]", serial_dev.c_str()); nh.getParam("/fin_control/baud", serial_baud); ROS_INFO("Serial Port: [%s]", serial_dev.c_str()); ROS_INFO("baud: [%d]", serial_baud); maxCtrlFinAngle = degreesToRadians(10); nh.getParam("/fin_control/max_ctrl_fin_angle", maxCtrlFinAngle); ROS_INFO("max cf angle: [%f] rad", maxCtrlFinAngle); nh.getParam("/fin_control/ctrl_fin_offset", ctrlFinOffset); ROS_INFO("cf offset: [%f] rad", ctrlFinOffset); nh.getParam("/fin_control/ctrl_fin_scale_factor", ctrlFinScaleFactor); ROS_INFO("cf scale: [%f]", ctrlFinScaleFactor); nh.getParam("/fin_control/current_logging_enabled", currentLoggingEnabled); if (currentLoggingEnabled) ROS_INFO("FIN CURRENT LOGGING ENABLED"); nh.getParam("/fin_control/report_angle_rate", reportAngleRate); nh.getParam("/fin_control/min_report_angle_rate", minReportAngleRate); nh.getParam("/fin_control/max_report_angle_rate", maxReportAngleRate); ROS_INFO("fin control constructor enter"); subscriber_setAngles = nodeHandle.subscribe("/fin_control/set_angles", 10, &FinControl::handleSetAngles, this); publisher_reportAngle = diagnostic_tools::create_publisher<fin_control::ReportAngle>( nodeHandle, "/fin_control/report_angle", 1); diagnostic_tools::PeriodicMessageStatusParams report_angle_rate_check_params; report_angle_rate_check_params.min_acceptable_period(minReportAngleRate); report_angle_rate_check_params.max_acceptable_period(maxReportAngleRate); report_angle_rate_check_params.abnormal_diagnostic(diagnostic_tools::Diagnostic::WARN); report_angle_rate_check_params.stale_diagnostic({ diagnostic_tools::Diagnostic::STALE, health_monitor::ReportFault::FIN_DATA_STALE }); diagnosticsUpdater.add( publisher_reportAngle.add_check<diagnostic_tools::PeriodicMessageStatus>( "rate check", report_angle_rate_check_params)); timer_reportAngle = nodeHandle.createTimer( ros::Duration(1. / reportAngleRate), &FinControl::reportAngleSendTimeout, this); finAngleCheck = diagnostic_tools::create_health_check<double>( "Fin angle within range", [this](double angle) -> diagnostic_tools::Diagnostic { using diagnostic_tools::Diagnostic; if (std::abs(angle) > maxCtrlFinAngle) { using health_monitor::ReportFault; return Diagnostic(Diagnostic::WARN, ReportFault::FIN_DATA_THRESHOLD_REACHED) .description("Fin angle beyond limits: |%f| rad > %f rad", angle, maxCtrlFinAngle); } return Diagnostic::OK; }); diagnosticsUpdater.add(finAngleCheck); if (myWorkBench.begin(serial_dev.c_str(), serial_baud, &log)) { ROS_INFO("Dynamixel Workbench intialized"); } else { ROS_ERROR("Dynamixel Workbench failed init %s", log); return; } numOfIDs = 0; if (myWorkBench.scan(ids, &numOfIDs, 1, 4, &log)) { ROS_INFO("num of ids found [%d]", numOfIDs); if (numOfIDs < NUM_FINS) ROS_WARN("Fin servos found: [%d] does not match expected number of fins [%d]", numOfIDs, NUM_FINS); } else { ROS_ERROR("Servo scan failed! %s", log); return; } for (int x = 0; x < numOfIDs; x++) { if (!myWorkBench.torqueOn(ids[x], &log)) { ROS_ERROR("Could not set torque on fin sevro [%d] %s", ids[x], log); return; } else { servosON = true; } } if (!myWorkBench.initBulkWrite(&log)) { ROS_ERROR("Could not init bulk write %s", log); return; } ros::spin(); } FinControl::~FinControl() { const char *log; if (servosON) { ROS_INFO("Turning off fin servos"); for (int x = 0; x < numOfIDs; x++) { if (!myWorkBench.torqueOff(ids[x], &log)) ROS_ERROR("Could not turn off torque on fin sevro [%d] %s", ids[x], log); } } } void FinControl::reportAngles() { const char *log; fin_control::ReportAngle message; bool servos_angles_info_complete = true; float radianAngleFromMyWorkBench = 0.; message.header.stamp = ros::Time::now(); for (int id = 1; id <= numOfIDs; ++id) { if (myWorkBench.getRadian(id, &radianAngleFromMyWorkBench, &log)) { message.angles_in_radians.push_back( static_cast<floa
float FinControl::degreesToRadians(float degrees) { return ((degrees / 180.0) * M_PI); } void FinControl::handleSetAngles(const fin_control::SetAngles::ConstPtr &msg) { const char *log; float angle_plus_offset; for (int i = 0; i < 4; i++) { if (fabs(msg->fin_angle_in_radians[i]) > maxCtrlFinAngle) { ROS_ERROR_STREAM("The Angle " << i << "to be set is out of range - value: " << msg->fin_angle_in_radians[i]); return; } } boost::mutex::scoped_lock lock(m_mutex); if (!myWorkBench.initBulkWrite(&log)) { ROS_ERROR("Could not init bulk write %s", log); return; } int32_t current_data = 0; for (int i = 0; i < 4; ++i) { angle_plus_offset = ctrlFinScaleFactor * (msg->fin_angle_in_radians[i] + ctrlFinOffset); const int id = i + 1; if (!(myWorkBench.addBulkWriteParam( id, "Goal_Position", myWorkBench.convertRadian2Value(id, angle_plus_offset), &log))) { ROS_ERROR_STREAM("Could not add bulk write param " << id << " " << log); return; } if (!myWorkBench.bulkWrite(&log)) { ROS_ERROR_STREAM("Could not bulk write " << log); } if (currentLoggingEnabled) { if (!myWorkBench.itemRead(id, "Present_Current", &current_data, &log)) { ROS_ERROR_STREAM("Could not read current from finID: " << id << " log: " << log); } else { ROS_DEBUG_STREAM("Current for Fin: " << id << " = " << myWorkBench.convertValue2Current(static_cast<int16_t>(current_data))); } } } } void FinControl::reportAngleSendTimeout(const ros::TimerEvent &ev) { reportAngles(); diagnosticsUpdater.update(); } } }
t>( round(((radianAngleFromMyWorkBench / ctrlFinScaleFactor) - ctrlFinOffset) * 100.0) / 100.0)); finAngleCheck.test(message.angles_in_radians.back()); } else { servos_angles_info_complete = false; ROS_ERROR("Could not get servo angle for ID %d %s", id, log); } } if (servos_angles_info_complete) { publisher_reportAngle.publish(message); } }
function_block-function_prefixed
[ { "content": "class IntrospectableNode<BaseNodeT, true> : public BaseNodeT\n\n{\n\n public:\n\n IntrospectableNode(const std::string& name, const BT::NodeConfiguration& config)\n\n : BaseNodeT(name), blackboard_(config.blackboard)\n\n {\n\n }\n\n\n\n BT::NodeStatus executeTick() override\n\n {\n\n if (BT::NodeStatus::IDLE == this->status())\n\n {\n\n parent_path_ =\n\n introspection::extendActivePath(blackboard_.get(), this->name());\n\n }\n\n // NOTE(hidmic): this will not work for async and coroutine-based action types.\n\n // The BT library does not lend itself well to built-in node types extension.\n\n BT::NodeStatus current_status = BaseNodeT::executeTick();\n\n\n\n if (BT::NodeStatus::RUNNING != current_status)\n", "file_path": "mission_control/include/mission_control/behaviors/introspectable_node.h", "rank": 0, "score": 196185.8618802681 }, { "content": "class AttitudeServoNode : public ReactiveActionNode\n\n{\n\npublic:\n\n AttitudeServoNode(const std::string& name, const BT::NodeConfiguration& config);\n\n\n\n static BT::PortsList providedPorts()\n\n {\n\n return MakePortsList(\n\n InputPort<double, HasTolerance, HasAngleUnits>(\n\n \"roll\", NAN, \"Roll angle to reach\"),\n\n InputPort<double, HasTolerance, HasAngleUnits>(\n\n \"pitch\", NAN, \"Pitch angle to reach\"),\n\n InputPort<double, HasTolerance, HasAngleUnits>(\n\n \"yaw\", NAN, \"Yaw angle to reach\"),\n\n BT::InputPort<double>(\"speed_knots\", NAN, \"Cruise speed to command, in knots\"));\n\n }\n\n\n\nprivate:\n\n void stateDataCallback(auv_interfaces::StateStamped::ConstPtr msg);\n\n\n", "file_path": "mission_control/include/mission_control/behaviors/attitude_servo.h", "rank": 1, "score": 189528.7938831936 }, { "content": "class LogToBagfileNode : public BT::DecoratorNode\n\n{\n\n public:\n\n struct Options\n\n {\n\n static BT::PortsList portsList()\n\n {\n\n static const Options options;\n\n return {\n\n BT::InputPort<std::string>(\n\n \"prefix\", options.prefix,\n\n \"Prefix for bag filename. If relative, it is resolved against the ROS log directory. \"\n\n \"If it lacks the '.bag' extension, a '{timestamp}.bag' suffix is appended.\"),\n\n BT::InputPort<std::string>(\n\n \"topics\", \"all\",\n\n \"Topic names to be logged as a comma-separated list. If the 'all' value is given, \"\n\n \"all topics are logged by periodically looking up the ROS graph.\"),\n\n BT::InputPort<rosbag::CompressionType>(\n\n \"compression\", options.writer_options.compression,\n\n \"Compression type to be used. Supported types are 'none', 'bz2', and 'lz4'.\")};\n", "file_path": "mission_control/include/mission_control/behaviors/log_to_bagfile.h", "rank": 2, "score": 189511.89727815945 }, { "content": "class SetFinDeflection : public JausMessageIn {\n\n private:\n\n void commandFinAngles(const ros::TimerEvent& ev);\n\n\n\n int8_t _finId; // 1 byte\n\n int8_t _deflectionAngle; // 1 byte\n\n int8_t _deflectionRateCmd; // 1 byte but not used\n\n ros::Publisher _publisher_setAngles;\n\n ros::Timer _commandFinAnglesTimer;\n\n std::vector<float> _finAngles{0.,0.,0.,0.};\n\n\n\n public:\n\n void init(ros::NodeHandle* nodeHandle);\n\n void PublishFinAngles(const bool enable);\n\n\n\n void ProcessData(char* message);\n\n\n\n int8_t GetFinID();\n\n int8_t GetDeflectionAngle();\n\n int8_t GetDeflectionRateCmd();\n\n};\n\n\n\n#endif /* SETFINDEFLECTION_H_ */\n", "file_path": "jaus_ros_bridge/include/SetFinDeflection.h", "rank": 3, "score": 184488.28551864854 }, { "content": "class SetAltitudeHeadingNode : public ReactiveActionNode\n\n{\n\npublic:\n\n SetAltitudeHeadingNode(const std::string &name, const BT::NodeConfiguration &config);\n\n\n\n static BT::PortsList providedPorts()\n\n {\n\n return MakePortsList(\n\n InputPort<double, HasTolerance>(\n\n \"altitude\", NAN, \"Altitude to reach (positive up), in meters\"),\n\n InputPort<double, HasTolerance, HasAngleUnits>(\n\n \"heading\", NAN, \"Heading (or yaw) to reach\"),\n\n BT::InputPort<double>(\"speed_knots\", NAN, \"Cruise speed to command, in knots\"));\n\n }\n\n\n\nprivate:\n\n void stateDataCallback(auv_interfaces::StateStamped::ConstPtr msg);\n\n\n\n BT::NodeStatus setUp() override;\n\n BT::NodeStatus doWork() override;\n", "file_path": "mission_control/include/mission_control/behaviors/set_altitude_heading.h", "rank": 4, "score": 182718.7812501337 }, { "content": "class SetDepthHeadingNode : public ReactiveActionNode\n\n{\n\n public:\n\n SetDepthHeadingNode(const std::string &name, const BT::NodeConfiguration &config);\n\n\n\n static BT::PortsList providedPorts()\n\n {\n\n return MakePortsList(\n\n InputPort<double, HasTolerance>(\n\n \"depth\", NAN, \"Depth to reach (positive down), in meters\"),\n\n InputPort<double, HasTolerance, HasAngleUnits>(\n\n \"heading\", NAN, \"Heading (or yaw) to reach\"),\n\n BT::InputPort<double>(\"speed_knots\", NAN, \"Cruise speed to command, in knots\"));\n\n }\n\n\n\n private:\n\n void stateDataCallback(auv_interfaces::StateStamped::ConstPtr msg);\n\n\n\n BT::NodeStatus setUp() override;\n\n BT::NodeStatus doWork() override;\n", "file_path": "mission_control/include/mission_control/behaviors/set_depth_heading.h", "rank": 5, "score": 182718.7812501337 }, { "content": "class FinControl\n\n{\n\n public:\n\n explicit FinControl(ros::NodeHandle& nodeHandle);\n\n virtual ~FinControl();\n\n\n\n private:\n\n bool fincontrolEnabled;\n\n bool servosON;\n\n bool currentLoggingEnabled;\n\n\n\n void reportAngles();\n\n\n\n float degreesToRadians(float degrees);\n\n\n\n void reportAngleSendTimeout(const ros::TimerEvent& ev);\n\n void handleSetAngles(const fin_control::SetAngles::ConstPtr& msg);\n\n\n\n double maxCtrlFinAngle;\n\n double ctrlFinOffset;\n", "file_path": "fin_control/include/fin_control/fin_control.h", "rank": 6, "score": 175067.3718278023 }, { "content": " double ctrlFinScaleFactor;\n\n\n\n double reportAngleRate;\n\n double minReportAngleRate;\n\n double maxReportAngleRate;\n\n\n\n ros::NodeHandle& nodeHandle;\n\n ros::Subscriber subscriber_setAngles;\n\n ros::Subscriber subscriber_enableReportAngles;\n\n diagnostic_tools::DiagnosedPublisher<\n\n fin_control::ReportAngle> publisher_reportAngle;\n\n ros::Timer timer_reportAngle;\n\n\n\n DynamixelWorkbench myWorkBench;\n\n\n\n uint8_t ids[10];\n\n uint8_t numOfIDs;\n\n\n\n boost::mutex m_mutex;\n\n\n\n diagnostic_tools::HealthCheck<double> finAngleCheck;\n\n diagnostic_updater::Updater diagnosticsUpdater;\n\n};\n\n\n\n} // namespace robot\n\n} // namespace qna\n\n\n\n#endif // FIN_CONTROL_FIN_CONTROL_H\n", "file_path": "fin_control/include/fin_control/fin_control.h", "rank": 7, "score": 174122.78928462663 }, { "content": "#include <fin_control/SetAngles.h>\n\n#include <health_monitor/ReportFault.h>\n\n\n\n#include \"dynamixel_workbench_msgs/DynamixelCommand.h\"\n\n#include \"dynamixel_workbench_msgs/DynamixelInfo.h\"\n\n#include \"dynamixel_workbench_msgs/GetDynamixelInfo.h\"\n\n#include \"dynamixel_workbench_toolbox/dynamixel_workbench.h\"\n\n\n\nnamespace qna\n\n{\n\nnamespace robot\n\n{\n", "file_path": "fin_control/include/fin_control/fin_control.h", "rank": 8, "score": 174104.9814148911 }, { "content": "#ifndef FIN_CONTROL_FIN_CONTROL_H\n\n#define FIN_CONTROL_FIN_CONTROL_H\n\n\n\n#define NUM_FINS 4\n\n#define NODE_VERSION \"1.8x\"\n\n\n\n#include <pthread.h>\n\n#include <stdio.h>\n\n#include <sys/select.h>\n\n#include <string>\n\n\n\n#include <ros/ros.h>\n\n\n\n#include <boost/thread.hpp>\n\n#include <boost/thread/mutex.hpp>\n\n\n\n#include <diagnostic_tools/diagnosed_publisher.h>\n\n#include <diagnostic_tools/health_check.h>\n\n#include <diagnostic_updater/diagnostic_updater.h>\n\n#include <fin_control/ReportAngle.h>\n", "file_path": "fin_control/include/fin_control/fin_control.h", "rank": 9, "score": 174102.83773817477 }, { "content": " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n\n * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n\n * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n\n * POSSIBILITY OF SUCH DAMAGE.\n\n *********************************************************************/\n\n\n\n// Original version: Christopher Scianna [email protected]\n\n\n\n/*\n\n * fin_control.h\n\n */\n\n\n", "file_path": "fin_control/include/fin_control/fin_control.h", "rank": 10, "score": 174085.80087345548 }, { "content": "/*********************************************************************\n\n * Software License Agreement (BSD License)\n\n *\n\n * Copyright (c) 2020, QinetiQ, Inc.\n\n * All rights reserved.\n\n *\n\n * Redistribution and use in source and binary forms, with or without\n\n * modification, are permitted provided that the following conditions\n\n * are met:\n\n *\n\n * * Redistributions of source code must retain the above copyright\n\n * notice, this list of conditions and the following disclaimer.\n\n * * Redistributions in binary form must reproduce the above\n\n * copyright notice, this list of conditions and the following\n\n * disclaimer in the documentation and/or other materials provided\n\n * with the distribution.\n\n * * Neither the name of QinetiQ nor the names of its\n\n * contributors may be used to endorse or promote products derived\n\n * from this software without specific prior written permission.\n\n *\n", "file_path": "fin_control/include/fin_control/fin_control.h", "rank": 11, "score": 174069.1111305272 }, { "content": " double read_period_;\n\n double write_period_;\n\n double pub_period_;\n\n\n\n bool is_moving_;\n\n\n\n public:\n\n DynamixelController();\n\n ~DynamixelController();\n\n\n\n bool initWorkbench(const std::string port_name, const uint32_t baud_rate);\n\n bool getDynamixelsInfo(const std::string yaml_file);\n\n bool loadDynamixels(void);\n\n bool initDynamixels(void);\n\n bool initSDKHandlers(void);\n\n bool getPresentPosition(std::vector<std::string> dxl_name);\n\n\n\n double getReadPeriod(){return read_period_;}\n\n double getWritePeriod(){return write_period_;}\n\n double getPublishPeriod(){return pub_period_;}\n", "file_path": "dynamixel-workbench/dynamixel_workbench_controllers/include/dynamixel_workbench_controllers/dynamixel_workbench_controllers.h", "rank": 12, "score": 161834.72577428824 }, { "content": "\n\n void initPublisher(void);\n\n void initSubscriber(void);\n\n\n\n void initServer();\n\n\n\n void readCallback(const ros::TimerEvent&);\n\n void writeCallback(const ros::TimerEvent&);\n\n void publishCallback(const ros::TimerEvent&);\n\n\n\n void commandVelocityCallback(const geometry_msgs::Twist::ConstPtr &msg);\n\n void trajectoryMsgCallback(const trajectory_msgs::JointTrajectory::ConstPtr &msg);\n\n bool dynamixelCommandMsgCallback(dynamixel_workbench_msgs::DynamixelCommand::Request &req,\n\n dynamixel_workbench_msgs::DynamixelCommand::Response &res);\n\n};\n\n\n\n#endif //DYNAMIXEL_WORKBENCH_CONTROLLERS_H\n", "file_path": "dynamixel-workbench/dynamixel_workbench_controllers/include/dynamixel_workbench_controllers/dynamixel_workbench_controllers.h", "rank": 13, "score": 161824.44554412903 }, { "content": "/*******************************************************************************\n\n* Copyright 2018 ROBOTIS CO., LTD.\n\n*\n\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n\n* you may not use this file except in compliance with the License.\n\n* You may obtain a copy of the License at\n\n*\n\n* http://www.apache.org/licenses/LICENSE-2.0\n\n*\n\n* Unless required by applicable law or agreed to in writing, software\n\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n* See the License for the specific language governing permissions and\n\n* limitations under the License.\n\n*******************************************************************************/\n\n\n\n/* Authors: Taehun Lim (Darby) */\n\n\n\n#ifndef DYNAMIXEL_WORKBENCH_CONTROLLERS_H\n\n#define DYNAMIXEL_WORKBENCH_CONTROLLERS_H\n", "file_path": "dynamixel-workbench/dynamixel_workbench_controllers/include/dynamixel_workbench_controllers/dynamixel_workbench_controllers.h", "rank": 14, "score": 161815.72066875966 }, { "content": "\n\n#include <ros/ros.h>\n\n\n\n#include <yaml-cpp/yaml.h>\n\n\n\n#include <sensor_msgs/JointState.h>\n\n#include <geometry_msgs/Twist.h>\n\n#include <trajectory_msgs/JointTrajectory.h>\n\n#include <trajectory_msgs/JointTrajectoryPoint.h>\n\n\n\n#include <dynamixel_workbench_toolbox/dynamixel_workbench.h>\n\n#include <dynamixel_workbench_msgs/DynamixelStateList.h>\n\n#include <dynamixel_workbench_msgs/DynamixelCommand.h>\n\n\n\n#include <dynamixel_workbench_controllers/trajectory_generator.h>\n\n\n\n// SYNC_WRITE_HANDLER\n\n#define SYNC_WRITE_HANDLER_FOR_GOAL_POSITION 0\n\n#define SYNC_WRITE_HANDLER_FOR_GOAL_VELOCITY 1\n\n\n", "file_path": "dynamixel-workbench/dynamixel_workbench_controllers/include/dynamixel_workbench_controllers/dynamixel_workbench_controllers.h", "rank": 15, "score": 161814.2024360993 }, { "content": " // ROS Service Client\n\n\n\n // Dynamixel Workbench Parameters\n\n DynamixelWorkbench *dxl_wb_;\n\n std::map<std::string, uint32_t> dynamixel_;\n\n std::vector<std::pair<std::string, ItemValue>> dynamixel_info_;\n\n dynamixel_workbench_msgs::DynamixelStateList dynamixel_state_list_;\n\n sensor_msgs::JointState joint_state_msg_;\n\n std::vector<WayPoint> pre_goal_;\n\n\n\n bool is_joint_state_topic_;\n\n bool is_cmd_vel_topic_;\n\n bool use_moveit_;\n\n\n\n double wheel_separation_;\n\n double wheel_radius_;\n\n\n\n JointTrajectory *jnt_tra_;\n\n trajectory_msgs::JointTrajectory *jnt_tra_msg_;\n\n\n", "file_path": "dynamixel-workbench/dynamixel_workbench_controllers/include/dynamixel_workbench_controllers/dynamixel_workbench_controllers.h", "rank": 16, "score": 161810.5548302992 }, { "content": "// SYNC_READ_HANDLER(Only for Protocol 2.0)\n\n#define SYNC_READ_HANDLER_FOR_PRESENT_POSITION_VELOCITY_CURRENT 0\n\n\n\n// Protocol 2.0\n\n#define ADDR_PRESENT_CURRENT_2 126\n\n#define ADDR_PRESENT_VELOCITY_2 128\n\n#define ADDR_PRESENT_POSITION_2 132\n\n\n\n#define LENGTH_PRESENT_CURRENT_2 2\n\n#define LENGTH_PRESENT_VELOCITY_2 4\n\n#define LENGTH_PRESENT_POSITION_2 4\n\n\n\n// Protocol 2.0 (XL-320)\n\n#define ADDR_PRESENT_LOAD_XL_320 41\n\n#define ADDR_PRESENT_VELOCITY_XL_320 39\n\n#define ADDR_PRESENT_POSITION_XL_320 37\n\n\n\n#define LENGTH_PRESENT_LOAD_XL_320 2\n\n#define LENGTH_PRESENT_VELOCITY_XL_320 2\n\n#define LENGTH_PRESENT_POSITION_XL_320 2\n", "file_path": "dynamixel-workbench/dynamixel_workbench_controllers/include/dynamixel_workbench_controllers/dynamixel_workbench_controllers.h", "rank": 17, "score": 161797.42299401393 }, { "content": "\n\n// Protocol 1.0\n\n#define ADDR_PRESENT_LOAD_1 40\n\n#define ADDR_PRESENT_VELOCITY_1 38\n\n#define ADDR_PRESENT_POSITION_1 36\n\n\n\n#define LENGTH_PRESENT_LOAD_1 2\n\n#define LENGTH_PRESENT_VELOCITY_1 2\n\n#define LENGTH_PRESENT_POSITION_1 2\n\n\n\n//#define DEBUG\n\n\n\ntypedef struct\n\n{\n\n std::string item_name;\n\n int32_t value;\n\n} ItemValue;\n\n\n", "file_path": "dynamixel-workbench/dynamixel_workbench_controllers/include/dynamixel_workbench_controllers/dynamixel_workbench_controllers.h", "rank": 18, "score": 161796.20675618658 }, { "content": "class DynamixelController\n\n{\n\n private:\n\n // ROS NodeHandle\n\n ros::NodeHandle node_handle_;\n\n ros::NodeHandle priv_node_handle_;\n\n\n\n // ROS Parameters\n\n\n\n // ROS Topic Publisher\n\n ros::Publisher dynamixel_state_list_pub_;\n\n ros::Publisher joint_states_pub_;\n\n\n\n // ROS Topic Subscriber\n\n ros::Subscriber cmd_vel_sub_;\n\n ros::Subscriber trajectory_sub_;\n\n\n\n // ROS Service Server\n\n ros::ServiceServer dynamixel_command_server_;\n\n\n", "file_path": "dynamixel-workbench/dynamixel_workbench_controllers/include/dynamixel_workbench_controllers/dynamixel_workbench_controllers.h", "rank": 19, "score": 161101.71113395068 }, { "content": "/*******************************************************************************\n\n* Copyright 2018 ROBOTIS CO., LTD.\n\n*\n\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n\n* you may not use this file except in compliance with the License.\n\n* You may obtain a copy of the License at\n\n*\n\n* http://www.apache.org/licenses/LICENSE-2.0\n\n*\n\n* Unless required by applicable law or agreed to in writing, software\n\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n* See the License for the specific language governing permissions and\n\n* limitations under the License.\n\n*******************************************************************************/\n\n\n\n/* Authors: Darby Lim, Hye-Jong KIM, Ryan Shim, Yong-Ho Na */\n\n\n\n#ifndef TRAJECTORY_GENERATOR_H_\n\n#define TRAJECTORY_GENERATOR_H_\n", "file_path": "dynamixel-workbench/dynamixel_workbench_controllers/include/dynamixel_workbench_controllers/trajectory_generator.h", "rank": 20, "score": 154153.37959412835 }, { "content": "\n\n#include <math.h>\n\n#include <vector>\n\n\n\n#include <eigen3/Eigen/Eigen>\n\n#include <eigen3/Eigen/LU>\n\n#include <eigen3/Eigen/QR>\n\n\n\ntypedef struct _Point\n\n{\n\n double position;\n\n double velocity;\n\n double acceleration;\n\n} WayPoint;\n\n\n", "file_path": "dynamixel-workbench/dynamixel_workbench_controllers/include/dynamixel_workbench_controllers/trajectory_generator.h", "rank": 21, "score": 154146.65474834817 }, { "content": "class IntrospectableNode;\n\n\n\ntemplate<class BaseNodeT>\n", "file_path": "mission_control/include/mission_control/behaviors/introspectable_node.h", "rank": 22, "score": 152333.6190622801 }, { "content": "class MissionControlNode\n\n{\n\npublic:\n\n MissionControlNode();\n\n\n\n void spin();\n\n\n\nprivate:\n\n int loadMission(const std::string& path);\n\n void reportOn(const Mission& mission);\n\n void update(const ros::TimerEvent& ev);\n\n\n\n void reportHeartbeat(const ros::TimerEvent& ev);\n\n\n\n void loadMissionCallback(const LoadMission& msg);\n\n void executeMissionCallback(const ExecuteMission& msg);\n\n void abortMissionCallback(const AbortMission& msg);\n\n void queryMissionsCallback(const QueryMissions& msg);\n\n void removeMissionsCallback(const RemoveMissions& msg);\n\n void stopMissionsCallback(const std_msgs::Empty&);\n", "file_path": "mission_control/include/mission_control/mission_control.h", "rank": 23, "score": 149027.44889161078 }, { "content": "class JointTrajectory\n\n{\n\nprivate:\n\n MinimumJerk trajectory_generator_;\n\n\n\n uint8_t joint_num_;\n\n Eigen::MatrixXd coefficient_;\n\n std::vector<WayPoint> joint_way_point_;\n\n\n\npublic:\n\n JointTrajectory();\n\n virtual ~JointTrajectory();\n\n\n\n void setJointNum(uint8_t joint_num);\n\n void init(double move_time,\n\n double control_time,\n\n std::vector<WayPoint> start,\n\n std::vector<WayPoint> goal\n\n );\n\n\n\n std::vector<WayPoint> getJointWayPoint(double tick);\n\n\n\n Eigen::MatrixXd getCoefficient();\n\n};\n\n\n\n#endif // TRAJECTORY_GENERATOR_H_\n", "file_path": "dynamixel-workbench/dynamixel_workbench_controllers/include/dynamixel_workbench_controllers/trajectory_generator.h", "rank": 24, "score": 148601.6436905654 }, { "content": "class MinimumJerk\n\n{\n\nprivate:\n\n Eigen::VectorXd coefficient_;\n\n\n\npublic:\n\n MinimumJerk();\n\n virtual ~MinimumJerk();\n\n\n\n void calcCoefficient(WayPoint start,\n\n WayPoint goal,\n\n double move_time,\n\n double control_time);\n\n\n\n Eigen::VectorXd getCoefficient();\n\n};\n\n\n", "file_path": "dynamixel-workbench/dynamixel_workbench_controllers/include/dynamixel_workbench_controllers/trajectory_generator.h", "rank": 25, "score": 148601.6436905654 }, { "content": " BT::NodeStatus setUp() override;\n\n BT::NodeStatus doWork() override;\n\n void tearDown() override;\n\n\n\n ros::NodeHandle nh_;\n\n ros::Publisher attitude_servo_pub_;\n\n ros::Subscriber state_sub_;\n\n\n\n double target_roll_;\n\n double target_pitch_;\n\n double target_yaw_;\n\n double speed_knots_;\n\n uint8_t enable_mask_;\n\n\n\n double roll_tolerance_;\n\n double pitch_tolerance_;\n\n double yaw_tolerance_;\n\n\n\n auv_interfaces::StateStamped::ConstPtr state_;\n\n};\n\n\n\n} // namespace mission_control\n\n\n\n#endif // MISSION_CONTROL_BEHAVIORS_ATTITUDE_SERVO_H\n", "file_path": "mission_control/include/mission_control/behaviors/attitude_servo.h", "rank": 26, "score": 146339.02852057942 }, { "content": " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n\n * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n\n * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n\n * POSSIBILITY OF SUCH DAMAGE.\n\n *********************************************************************/\n\n\n\n// Original version: Christopher Scianna [email protected]\n\n\n\n#ifndef MISSION_CONTROL_BEHAVIORS_ATTITUDE_SERVO_H\n\n#define MISSION_CONTROL_BEHAVIORS_ATTITUDE_SERVO_H\n\n\n\n#include <behaviortree_cpp_v3/basic_types.h>\n", "file_path": "mission_control/include/mission_control/behaviors/attitude_servo.h", "rank": 27, "score": 146328.65889157212 }, { "content": "#include <behaviortree_cpp_v3/behavior_tree.h>\n\n#include <behaviortree_cpp_v3/bt_factory.h>\n\n#include <ros/ros.h>\n\n\n\n#include <string>\n\n\n\n#include \"auv_interfaces/StateStamped.h\"\n\n#include \"mission_control/behaviors/helpers.h\"\n\n#include \"mission_control/behaviors/reactive_action.h\"\n\n\n\n\n\nnamespace mission_control\n\n{\n", "file_path": "mission_control/include/mission_control/behaviors/attitude_servo.h", "rank": 28, "score": 146324.50802976207 }, { "content": " bool startLogging();\n\n bool stopLogging();\n\n\n\n ros::NodeHandle nh_;\n\n Options options_;\n\n bool read_parameter_from_ports_;\n\n\n\n internal::AsyncBagWriter bag_writer_;\n\n internal::GenericSubscription subscription_;\n\n};\n\n\n\n} // namespace mission_control\n\n\n\n#endif // MISSION_CONTROL_BEHAVIORS_LOG_TO_BAGFILE_H\n", "file_path": "mission_control/include/mission_control/behaviors/log_to_bagfile.h", "rank": 29, "score": 146323.20170217854 }, { "content": " }\n\n\n\n static Options populateFromPorts(BT::TreeNode * node);\n\n\n\n std::string prefix{\"mission_bag_\"};\n\n std::vector<std::string> topics{};\n\n internal::AsyncBagWriter::Options writer_options{};\n\n };\n\n\n\n static BT::PortsList providedPorts() { return Options::portsList(); }\n\n\n\n LogToBagfileNode(const std::string& name, Options options);\n\n\n\n LogToBagfileNode(const std::string& name, const BT::NodeConfiguration& config);\n\n\n\n void halt() override;\n\n\n\n private:\n\n BT::NodeStatus tick() override;\n\n\n", "file_path": "mission_control/include/mission_control/behaviors/log_to_bagfile.h", "rank": 30, "score": 146315.06149579637 }, { "content": " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n\n * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n\n * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n\n * POSSIBILITY OF SUCH DAMAGE.\n\n *********************************************************************/\n\n#ifndef MISSION_CONTROL_BEHAVIORS_LOG_TO_BAGFILE_H\n\n#define MISSION_CONTROL_BEHAVIORS_LOG_TO_BAGFILE_H\n\n\n\n#include <behaviortree_cpp_v3/basic_types.h>\n\n#include <behaviortree_cpp_v3/decorator_node.h>\n\n\n\n#include <ros/ros.h>\n", "file_path": "mission_control/include/mission_control/behaviors/log_to_bagfile.h", "rank": 31, "score": 146314.31912902687 }, { "content": "\n\n#include <string>\n\n#include <vector>\n\n\n\n#include \"mission_control/behaviors/internal/async_bag_writer.h\"\n\n#include \"mission_control/behaviors/internal/generic_subscription.h\"\n\n\n\n\n\nnamespace mission_control\n\n{\n\n\n", "file_path": "mission_control/include/mission_control/behaviors/log_to_bagfile.h", "rank": 32, "score": 146310.73654693487 }, { "content": "/*********************************************************************\n\n * Software License Agreement (BSD License)\n\n *\n\n * Copyright (c) 2020, QinetiQ, Inc.\n\n * All rights reserved.\n\n *\n\n * Redistribution and use in source and binary forms, with or without\n\n * modification, are permitted provided that the following conditions\n\n * are met:\n\n *\n\n * * Redistributions of source code must retain the above copyright\n\n * notice, this list of conditions and the following disclaimer.\n\n * * Redistributions in binary form must reproduce the above\n\n * copyright notice, this list of conditions and the following\n\n * disclaimer in the documentation and/or other materials provided\n\n * with the distribution.\n\n * * Neither the name of QinetiQ nor the names of its\n\n * contributors may be used to endorse or promote products derived\n\n * from this software without specific prior written permission.\n\n *\n", "file_path": "mission_control/include/mission_control/behaviors/attitude_servo.h", "rank": 33, "score": 146307.4610473709 }, { "content": "/*********************************************************************\n\n * Software License Agreement (BSD License)\n\n *\n\n * Copyright (c) 2021, QinetiQ, Inc.\n\n * All rights reserved.\n\n *\n\n * Redistribution and use in source and binary forms, with or without\n\n * modification, are permitted provided that the following conditions\n\n * are met:\n\n *\n\n * * Redistributions of source code must retain the above copyright\n\n * notice, this list of conditions and the following disclaimer.\n\n * * Redistributions in binary form must reproduce the above\n\n * copyright notice, this list of conditions and the following\n\n * disclaimer in the documentation and/or other materials provided\n\n * with the distribution.\n\n * * Neither the name of QinetiQ nor the names of its\n\n * contributors may be used to endorse or promote products derived\n\n * from this software without specific prior written permission.\n\n *\n", "file_path": "mission_control/include/mission_control/behaviors/log_to_bagfile.h", "rank": 34, "score": 146292.49466259216 }, { "content": "\n\n#include <string>\n\n\n\n#include \"mission_control/behaviors/introspection.h\"\n\n\n\n\n\nnamespace mission_control\n\n{\n\n\n\n// NOTE(hidmic): this is insane, but BT library support for\n\n// various constructor forms left little margin.\n\ntemplate<class BaseNodeT, bool default_constructible_only =\n\n BT::has_default_constructor<BaseNodeT>::value &&\n\n !BT::has_params_constructor<BaseNodeT>::value>\n", "file_path": "mission_control/include/mission_control/behaviors/introspectable_node.h", "rank": 35, "score": 146285.516079933 }, { "content": " {\n\n introspection::setActivePath(blackboard_.get(), parent_path_);\n\n }\n\n return current_status;\n\n }\n\n\n\n void halt() override\n\n {\n\n introspection::setActivePath(blackboard_.get(), parent_path_);\n\n\n\n BaseNodeT::halt();\n\n }\n\n\n\n private:\n\n BT::Blackboard::Ptr blackboard_;\n\n std::string parent_path_{};\n\n};\n\n\n\n} // namespace mission_control\n\n\n\n#endif // MISSION_CONTROL_BEHAVIORS_INTROSPECTABLE_NODE_H\n", "file_path": "mission_control/include/mission_control/behaviors/introspectable_node.h", "rank": 36, "score": 146283.68555754237 }, { "content": " }\n\n return current_status;\n\n }\n\n\n\n void halt() override\n\n {\n\n introspection::setActivePath(this->config().blackboard.get(), parent_path_);\n\n\n\n BaseNodeT::halt();\n\n }\n\n\n\n private:\n\n std::string parent_path_{};\n\n};\n\n\n\ntemplate<class BaseNodeT>\n", "file_path": "mission_control/include/mission_control/behaviors/introspectable_node.h", "rank": 37, "score": 146275.59532750607 }, { "content": " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n\n * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n\n * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n\n * POSSIBILITY OF SUCH DAMAGE.\n\n *********************************************************************/\n\n\n\n#ifndef MISSION_CONTROL_BEHAVIORS_INTROSPECTABLE_NODE_H\n\n#define MISSION_CONTROL_BEHAVIORS_INTROSPECTABLE_NODE_H\n\n\n\n#include <behaviortree_cpp_v3/behavior_tree.h>\n\n#include <behaviortree_cpp_v3/bt_factory.h>\n\n#include <ros/ros.h>\n", "file_path": "mission_control/include/mission_control/behaviors/introspectable_node.h", "rank": 38, "score": 146274.5694027718 }, { "content": "/*********************************************************************\n\n * Software License Agreement (BSD License)\n\n *\n\n * Copyright (c) 2021, QinetiQ, Inc.\n\n * All rights reserved.\n\n *\n\n * Redistribution and use in source and binary forms, with or without\n\n * modification, are permitted provided that the following conditions\n\n * are met:\n\n *\n\n * * Redistributions of source code must retain the above copyright\n\n * notice, this list of conditions and the following disclaimer.\n\n * * Redistributions in binary form must reproduce the above\n\n * copyright notice, this list of conditions and the following\n\n * disclaimer in the documentation and/or other materials provided\n\n * with the distribution.\n\n * * Neither the name of QinetiQ nor the names of its\n\n * contributors may be used to endorse or promote products derived\n\n * from this software without specific prior written permission.\n\n *\n", "file_path": "mission_control/include/mission_control/behaviors/introspectable_node.h", "rank": 39, "score": 146255.76003755038 }, { "content": "class MessageStagnationCheckParams final\n\n{\n\npublic:\n\n MessageStagnationCheckParams() = default;\n\n\n\n MessageStagnationCheckParams &window_size(size_t size)\n\n {\n\n window_size_ = size;\n\n return *this;\n\n }\n\n\n\n size_t window_size() const\n\n {\n\n return window_size_;\n\n }\n\n\n\n MessageStagnationCheckParams &stagnation_diagnostic(Diagnostic diagnostic)\n\n {\n\n if (diagnostic.description().empty())\n\n {\n", "file_path": "diagnostics_tools/include/diagnostic_tools/message_stagnation_check.h", "rank": 40, "score": 144806.9923656939 }, { "content": "class TimeoutNode : public BT::DecoratorNode\n\n{\n\n public:\n\n TimeoutNode(const std::string& name, std::chrono::milliseconds timeout);\n\n\n\n TimeoutNode(const std::string& name, const BT::NodeConfiguration& config);\n\n\n\n ~TimeoutNode() override { halt(); }\n\n\n\n static BT::PortsList providedPorts()\n\n {\n\n return {\n\n BT::InputPort<unsigned>(\"msec\", \"Timeout to halt child if still running, in milliseconds\")};\n\n }\n\n\n\n void halt() override\n\n {\n\n timer_.cancelAll();\n\n DecoratorNode::halt();\n\n }\n\n\n\n private:\n\n internal::TimerQueue timer_;\n\n\n\n BT::NodeStatus tick() override;\n\n\n\n std::chrono::milliseconds timeout_;\n\n\n", "file_path": "mission_control/include/mission_control/behaviors/timeout.h", "rank": 41, "score": 143312.76147263835 }, { "content": "class AbortNode : public ReactiveActionNode\n\n{\n\npublic:\n\n AbortNode(const std::string& name, const BT::NodeConfiguration& config);\n\n\n\n static BT::PortsList providedPorts() { return {}; }\n\n\n\nprivate:\n\n void stateDataCallback(auv_interfaces::StateStamped::ConstPtr msg);\n\n\n\n BT::NodeStatus setUp() override;\n\n BT::NodeStatus doWork() override;\n\n void tearDown() override;\n\n\n\n ros::NodeHandle nh_;\n\n ros::Publisher attitude_servo_pub_;\n\n ros::Subscriber state_sub_;\n\n\n\n auv_interfaces::StateStamped::ConstPtr state_;\n\n\n", "file_path": "mission_control/include/mission_control/behaviors/abort.h", "rank": 42, "score": 143312.76147263835 }, { "content": "class DelayForNode : public BT::DecoratorNode\n\n{\n\n public:\n\n DelayForNode(const std::string& name, std::chrono::milliseconds delay);\n\n\n\n DelayForNode(const std::string& name, const BT::NodeConfiguration& config);\n\n\n\n ~DelayForNode() override { halt(); }\n\n\n\n static BT::PortsList providedPorts()\n\n {\n\n return {BT::InputPort<unsigned>(\"delay_msec\", \"Time to delay child ticking, in milliseconds\")};\n\n }\n\n\n\n void halt() override\n\n {\n\n timer_.cancelAll();\n\n DecoratorNode::halt();\n\n }\n\n\n\n private:\n\n internal::TimerQueue timer_;\n\n\n\n BT::NodeStatus tick() override;\n\n\n\n std::chrono::milliseconds delay_;\n\n\n", "file_path": "mission_control/include/mission_control/behaviors/delay_for.h", "rank": 43, "score": 143312.76147263835 }, { "content": "class IntrospectableNode<BaseNodeT, false> : public BaseNodeT\n\n{\n\npublic:\n\n using BaseNodeT::BaseNodeT;\n\n\n\n BT::NodeStatus executeTick() override\n\n {\n\n if (BT::NodeStatus::IDLE == this->status())\n\n {\n\n parent_path_ = introspection::extendActivePath(\n\n this->config().blackboard.get(), this->name());\n\n }\n\n\n\n // NOTE(hidmic): this will not work for async and coroutine-based action types.\n\n // The BT library does not lend itself well to built-in node types extension.\n\n BT::NodeStatus current_status = BaseNodeT::executeTick();\n\n\n\n if (BT::NodeStatus::RUNNING != current_status)\n\n {\n\n introspection::setActivePath(this->config().blackboard.get(), parent_path_);\n", "file_path": "mission_control/include/mission_control/behaviors/introspectable_node.h", "rank": 44, "score": 142598.8995606905 }, { "content": " void tearDown() override;\n\n\n\n ros::NodeHandle nh_;\n\n ros::Publisher depth_heading_pub_;\n\n ros::Subscriber state_sub_;\n\n\n\n double target_depth_;\n\n double depth_tolerance_;\n\n double target_heading_;\n\n double heading_tolerance_;\n\n double speed_knots_;\n\n uint8_t enable_mask_;\n\n\n\n auv_interfaces::StateStamped::ConstPtr state_;\n\n};\n\n\n\n} // namespace mission_control\n\n\n\n#endif // MISSION_CONTROL_BEHAVIORS_SET_DEPTH_HEADING_H\n", "file_path": "mission_control/include/mission_control/behaviors/set_depth_heading.h", "rank": 45, "score": 142579.23760892535 }, { "content": " void tearDown() override;\n\n\n\n ros::NodeHandle nh_;\n\n ros::Publisher altitude_heading_pub_;\n\n ros::Subscriber state_sub_;\n\n\n\n double target_altitude_;\n\n double altitude_tolerance_;\n\n double target_heading_;\n\n double heading_tolerance_;\n\n double speed_knots_;\n\n uint8_t enable_mask_;\n\n\n\n auv_interfaces::StateStamped::ConstPtr state_;\n\n};\n\n\n\n} // namespace mission_control\n\n\n\n#endif // MISSION_CONTROL_BEHAVIORS_SET_ALTITUDE_HEADING_H\n", "file_path": "mission_control/include/mission_control/behaviors/set_altitude_heading.h", "rank": 46, "score": 142579.23760892535 }, { "content": " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n\n * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n\n * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n\n * POSSIBILITY OF SUCH DAMAGE.\n\n *********************************************************************/\n\n\n\n// Original version: Christopher Scianna [email protected]\n\n\n\n#ifndef MISSION_CONTROL_BEHAVIORS_SET_DEPTH_HEADING_H\n\n#define MISSION_CONTROL_BEHAVIORS_SET_DEPTH_HEADING_H\n\n\n\n#include <behaviortree_cpp_v3/basic_types.h>\n", "file_path": "mission_control/include/mission_control/behaviors/set_depth_heading.h", "rank": 47, "score": 142572.62367396362 }, { "content": " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n\n * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n\n * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n\n * POSSIBILITY OF SUCH DAMAGE.\n\n *********************************************************************/\n\n\n\n// Original version: Christopher Scianna [email protected]\n\n\n\n#ifndef MISSION_CONTROL_BEHAVIORS_SET_ALTITUDE_HEADING_H\n\n#define MISSION_CONTROL_BEHAVIORS_SET_ALTITUDE_HEADING_H\n\n\n\n#include <behaviortree_cpp_v3/basic_types.h>\n", "file_path": "mission_control/include/mission_control/behaviors/set_altitude_heading.h", "rank": 48, "score": 142572.62367396362 }, { "content": "#include <behaviortree_cpp_v3/behavior_tree.h>\n\n#include <ros/ros.h>\n\n\n\n#include <string>\n\n\n\n#include \"auv_interfaces/StateStamped.h\"\n\n#include \"mission_control/behaviors/helpers.h\"\n\n#include \"mission_control/behaviors/reactive_action.h\"\n\n\n\n\n\nnamespace mission_control\n\n{\n", "file_path": "mission_control/include/mission_control/behaviors/set_depth_heading.h", "rank": 49, "score": 142569.28749238874 }, { "content": "#include <behaviortree_cpp_v3/behavior_tree.h>\n\n#include <ros/ros.h>\n\n\n\n#include <string>\n\n\n\n#include \"auv_interfaces/StateStamped.h\"\n\n#include \"mission_control/behaviors/helpers.h\"\n\n#include \"mission_control/behaviors/reactive_action.h\"\n\n\n\n\n\nnamespace mission_control\n\n{\n\n\n", "file_path": "mission_control/include/mission_control/behaviors/set_altitude_heading.h", "rank": 50, "score": 142569.28749238874 }, { "content": "/*********************************************************************\n\n * Software License Agreement (BSD License)\n\n *\n\n * Copyright (c) 2020, QinetiQ, Inc.\n\n * All rights reserved.\n\n *\n\n * Redistribution and use in source and binary forms, with or without\n\n * modification, are permitted provided that the following conditions\n\n * are met:\n\n *\n\n * * Redistributions of source code must retain the above copyright\n\n * notice, this list of conditions and the following disclaimer.\n\n * * Redistributions in binary form must reproduce the above\n\n * copyright notice, this list of conditions and the following\n\n * disclaimer in the documentation and/or other materials provided\n\n * with the distribution.\n\n * * Neither the name of QinetiQ nor the names of its\n\n * contributors may be used to endorse or promote products derived\n\n * from this software without specific prior written permission.\n\n *\n", "file_path": "mission_control/include/mission_control/behaviors/set_depth_heading.h", "rank": 51, "score": 142551.69804740185 }, { "content": "/*********************************************************************\n\n * Software License Agreement (BSD License)\n\n *\n\n * Copyright (c) 2021, QinetiQ, Inc.\n\n * All rights reserved.\n\n *\n\n * Redistribution and use in source and binary forms, with or without\n\n * modification, are permitted provided that the following conditions\n\n * are met:\n\n *\n\n * * Redistributions of source code must retain the above copyright\n\n * notice, this list of conditions and the following disclaimer.\n\n * * Redistributions in binary form must reproduce the above\n\n * copyright notice, this list of conditions and the following\n\n * disclaimer in the documentation and/or other materials provided\n\n * with the distribution.\n\n * * Neither the name of QinetiQ nor the names of its\n\n * contributors may be used to endorse or promote products derived\n\n * from this software without specific prior written permission.\n\n *\n", "file_path": "mission_control/include/mission_control/behaviors/set_altitude_heading.h", "rank": 52, "score": 142551.69804740185 }, { "content": "class MessageStagnationCheck : public TopicDiagnosticTask<MessageT>\n\n{\n\npublic:\n\n using MessageEqualOp = boost::function<bool(const MessageT &, const MessageT &)>;\n\n\n\n MessageStagnationCheck(const std::string &name, const MessageEqualOp &equal_op)\n\n : MessageStagnationCheck(name, equal_op, MessageStagnationCheckParams{}) {}\n\n\n\n MessageStagnationCheck(const std::string &name, const MessageEqualOp &equal_op,\n\n MessageStagnationCheckParams params)\n\n : TopicDiagnosticTask<MessageT>(name), equal_op_(equal_op), params_(std::move(params)) {}\n\n\n\n void tick(const ros::Time &stamp, const MessageT &message) override\n\n {\n\n tick(stamp, boost::make_shared<MessageT const>(message));\n\n }\n\n\n\n void tick(const ros::Time &stamp, const boost::shared_ptr<MessageT const> &message) override\n\n {\n\n if (!message)\n", "file_path": "diagnostics_tools/include/diagnostic_tools/message_stagnation_check.h", "rank": 53, "score": 141621.4832303572 }, { "content": " * Author: jsun\n\n */\n\n\n\n#ifndef SETFINDEFLECTION_H_\n\n#define SETFINDEFLECTION_H_\n\n\n\n#include <ros/ros.h>\n\n#include <stdint.h>\n\n#include \"JausMessageIn.h\"\n\n#include <fin_control/SetAngles.h>\n\n\n", "file_path": "jaus_ros_bridge/include/SetFinDeflection.h", "rank": 54, "score": 139240.64644344078 }, { "content": " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n\n * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n\n * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n\n * POSSIBILITY OF SUCH DAMAGE.\n\n *********************************************************************/\n\n\n\n// Original version: Jie Sun <[email protected]>\n\n\n\n/*\n\n * SetFinDeflection.h\n\n *\n\n * Created on: Jun 11, 2019\n", "file_path": "jaus_ros_bridge/include/SetFinDeflection.h", "rank": 55, "score": 139238.36613039422 }, { "content": "/*********************************************************************\n\n * Software License Agreement (BSD License)\n\n *\n\n * Copyright (c) 2020, QinetiQ, Inc.\n\n * All rights reserved.\n\n *\n\n * Redistribution and use in source and binary forms, with or without\n\n * modification, are permitted provided that the following conditions\n\n * are met:\n\n *\n\n * * Redistributions of source code must retain the above copyright\n\n * notice, this list of conditions and the following disclaimer.\n\n * * Redistributions in binary form must reproduce the above\n\n * copyright notice, this list of conditions and the following\n\n * disclaimer in the documentation and/or other materials provided\n\n * with the distribution.\n\n * * Neither the name of QinetiQ nor the names of its\n\n * contributors may be used to endorse or promote products derived\n\n * from this software without specific prior written permission.\n\n *\n", "file_path": "jaus_ros_bridge/include/SetFinDeflection.h", "rank": 56, "score": 139218.7330317905 }, { "content": "class SingleDynamixelController\n\n{\n\n private:\n\n // ROS NodeHandle\n\n ros::NodeHandle node_handle_;\n\n\n\n // ROS Parameters\n\n\n\n // ROS Topic Publisher\n\n\n\n // ROS Topic Subscriber\n\n\n\n // ROS Service Server\n\n\n\n // ROS Service Client\n\n ros::ServiceClient dynamixel_info_client_;\n\n ros::ServiceClient dynamixel_command_client_;\n\n\n\n // Dynamixel Workbench Parameters\n\n\n", "file_path": "dynamixel-workbench/dynamixel_workbench_single_manager/include/dynamixel_workbench_single_manager/single_dynamixel_controller.h", "rank": 57, "score": 138716.310761672 }, { "content": "class FixRudderNode : public ReactiveActionNode\n\n{\n\npublic:\n\n FixRudderNode(const std::string& name, const BT::NodeConfiguration& config);\n\n\n\n static BT::PortsList providedPorts()\n\n {\n\n return MakePortsList(\n\n InputPort<double, HasAngleUnits>(\"rudder\", NAN, \"Rudder angle\"),\n\n BT::InputPort<double>(\"depth\", NAN, \"Depth to reach (positive down), in meters\"),\n\n BT::InputPort<double>(\"speed_knots\", NAN, \"Cruise speed to command, in knots\"));\n\n }\n\n\n\nprotected:\n\n BT::NodeStatus doWork() override;\n\n\n\nprivate:\n\n ros::NodeHandle nodeHandle_;\n\n ros::Publisher fixedRudderBehaviorPub_;\n\n};\n\n\n\n} // namespace mission_control\n\n\n\n#endif // MISSION_CONTROL_BEHAVIORS_FIX_RUDDER_H\n", "file_path": "mission_control/include/mission_control/behaviors/fix_rudder.h", "rank": 58, "score": 137889.22583845793 }, { "content": "class GoToWaypointNode : public ReactiveActionNode\n\n{\n\npublic:\n\n GoToWaypointNode(const std::string &name, const BT::NodeConfiguration &config);\n\n\n\n static BT::PortsList providedPorts()\n\n {\n\n return {\n\n BT::InputPort<double>(\"depth\", NAN, \"Waypoint depth (positive down), in meters\"),\n\n BT::InputPort<double>(\"altitude\", NAN, \"Waypoint altitude (positive up), in meters\"),\n\n BT::InputPort<double>(\"latitude\", NAN, \"Waypoint latitude, in degrees\"),\n\n BT::InputPort<double>(\"longitude\", NAN, \"Waypoint longitude, in degrees\"),\n\n BT::InputPort<double>(\"speed_knots\", NAN, \"Cruise speed to command, in knots\"),\n\n BT::InputPort<double>(\"tolerance_radius\", 0.0, \"Radius of the tolerance sphere \"\n\n \"for UTM coordinates, in meters\")};\n\n }\n\n\n\nprivate:\n\n void stateCallback(auv_interfaces::StateStamped::ConstPtr msg);\n\n\n", "file_path": "mission_control/include/mission_control/behaviors/go_to_waypoint.h", "rank": 59, "score": 137889.22583845793 }, { "content": "class PayloadCommandNode : public ReactiveActionNode\n\n{\n\npublic:\n\n PayloadCommandNode(const std::string& name, const BT::NodeConfiguration& config);\n\n\n\n static BT::PortsList providedPorts()\n\n {\n\n return {BT::InputPort<std::string>(\"command\", \"Command to be sent to payload\")};\n\n }\n\n\n\nprotected:\n\n BT::NodeStatus doWork() override;\n\n\n\nprivate:\n\n ros::NodeHandle nodeHandle_;\n\n ros::Publisher payloadCommandPub_;\n\n};\n\n\n\n} // namespace mission_control\n\n\n\n#endif // MISSION_CONTROL_BEHAVIORS_PAYLOAD_COMMAND_H\n", "file_path": "mission_control/include/mission_control/behaviors/payload_command.h", "rank": 60, "score": 137889.22583845793 }, { "content": " dxl_id[1] = atoi(argv[4]);\n\n }\n\n\n\n DynamixelWorkbench dxl_wb;\n\n\n\n const char *log;\n\n bool result = false;\n\n\n\n result = dxl_wb.init(port_name, baud_rate, &log);\n\n if (result == false)\n\n {\n\n printf(\"%s\\n\", log);\n\n printf(\"Failed to init\\n\");\n\n\n\n return 0;\n\n }\n\n else\n\n printf(\"Succeed to init(%d)\\n\", baud_rate); \n\n\n\n for (int cnt = 0; cnt < 2; cnt++)\n", "file_path": "dynamixel-workbench/dynamixel_workbench_toolbox/examples/src/n_Bulk_Read_Write.cpp", "rank": 61, "score": 137861.4688933535 }, { "content": "void swap(int32_t *array);\n\n\n\nint main(int argc, char *argv[]) \n\n{\n\n const char* port_name = \"/dev/ttyUSB0\";\n\n int baud_rate = 57600;\n\n\n\n uint16_t model_number = 0;\n\n uint8_t dxl_id[2] = {0, 0};\n\n\n\n if (argc < 5)\n\n {\n\n printf(\"Please set '-port_name', '-baud_rate', '-dynamixel_id_1', '-dynamixel_id_2' arguments for connected Dynamixels\\n\");\n\n return 0;\n\n }\n\n else\n\n {\n\n port_name = argv[1];\n\n baud_rate = atoi(argv[2]);\n\n dxl_id[0] = atoi(argv[3]);\n", "file_path": "dynamixel-workbench/dynamixel_workbench_toolbox/examples/src/n_Bulk_Read_Write.cpp", "rank": 62, "score": 137854.2760774127 }, { "content": " printf(\"Failed to add bulk write position param\\n\");\n\n }\n\n else\n\n {\n\n printf(\"%s\\n\", log);\n\n }\n\n\n\n result = dxl_wb.addBulkWriteParam(dxl_id[1], \"LED\", led[0], &log);\n\n if (result == false)\n\n {\n\n printf(\"%s\\n\", log);\n\n printf(\"Failed to add bulk write led param\\n\");\n\n }\n\n else\n\n {\n\n printf(\"%s\\n\", log);\n\n }\n\n\n\n result = dxl_wb.bulkWrite(&log);\n\n if (result == false)\n", "file_path": "dynamixel-workbench/dynamixel_workbench_toolbox/examples/src/n_Bulk_Read_Write.cpp", "rank": 63, "score": 137842.9219647419 }, { "content": " printf(\"Failed to add bulk read led param\\n\");\n\n }\n\n else\n\n {\n\n printf(\"%s\\n\", log);\n\n }\n\n\n\n int32_t goal_position[2] = {0, 1023};\n\n int32_t led[2] = {0, 1};\n\n\n\n int32_t get_data[2] = {0, 0};\n\n\n\n const uint8_t handler_index = 0;\n\n\n\n while(1)\n\n {\n\n result = dxl_wb.addBulkWriteParam(dxl_id[0], \"Goal_Position\", goal_position[0], &log);\n\n if (result == false)\n\n {\n\n printf(\"%s\\n\", log);\n", "file_path": "dynamixel-workbench/dynamixel_workbench_toolbox/examples/src/n_Bulk_Read_Write.cpp", "rank": 64, "score": 137838.29123744817 }, { "content": " {\n\n result = dxl_wb.ping(dxl_id[cnt], &model_number, &log);\n\n if (result == false)\n\n {\n\n printf(\"%s\\n\", log);\n\n printf(\"Failed to ping\\n\");\n\n }\n\n else\n\n {\n\n printf(\"Succeeded to ping\\n\");\n\n printf(\"id : %d, model_number : %d\\n\", dxl_id[cnt], model_number);\n\n }\n\n\n\n result = dxl_wb.jointMode(dxl_id[cnt], 0, 0, &log);\n\n if (result == false)\n\n {\n\n printf(\"%s\\n\", log);\n\n printf(\"Failed to change joint mode\\n\");\n\n }\n\n else\n", "file_path": "dynamixel-workbench/dynamixel_workbench_toolbox/examples/src/n_Bulk_Read_Write.cpp", "rank": 65, "score": 137837.66164188896 }, { "content": " {\n\n printf(\"%s\\n\", log);\n\n printf(\"Failed to bulk write\\n\");\n\n }\n\n\n\n do\n\n {\n\n result = dxl_wb.bulkRead(&log);\n\n if (result == false)\n\n {\n\n printf(\"%s\\n\", log);\n\n printf(\"Failed to bulk read\\n\");\n\n }\n\n\n\n result = dxl_wb.getBulkReadData(&get_data[0], &log);\n\n if (result == false)\n\n {\n\n printf(\"%s\\n\", log);\n\n }\n\n else\n", "file_path": "dynamixel-workbench/dynamixel_workbench_toolbox/examples/src/n_Bulk_Read_Write.cpp", "rank": 66, "score": 137837.30732305473 }, { "content": " {\n\n printf(\"Succeed to change joint mode\\n\");\n\n }\n\n }\n\n\n\n result = dxl_wb.initBulkWrite(&log);\n\n if (result == false)\n\n {\n\n printf(\"%s\\n\", log);\n\n }\n\n else\n\n {\n\n printf(\"%s\\n\", log);\n\n }\n\n\n\n result = dxl_wb.initBulkRead(&log);\n\n if (result == false)\n\n {\n\n printf(\"%s\\n\", log);\n\n }\n", "file_path": "dynamixel-workbench/dynamixel_workbench_toolbox/examples/src/n_Bulk_Read_Write.cpp", "rank": 67, "score": 137836.93442471052 }, { "content": " else\n\n {\n\n printf(\"%s\\n\", log);\n\n }\n\n\n\n result = dxl_wb.addBulkReadParam(dxl_id[0], \"Present_Position\", &log);\n\n if (result == false)\n\n {\n\n printf(\"%s\\n\", log);\n\n printf(\"Failed to add bulk read position param\\n\");\n\n }\n\n else\n\n {\n\n printf(\"%s\\n\", log);\n\n }\n\n\n\n result = dxl_wb.addBulkReadParam(dxl_id[1], \"LED\", &log);\n\n if (result == false)\n\n {\n\n printf(\"%s\\n\", log);\n", "file_path": "dynamixel-workbench/dynamixel_workbench_toolbox/examples/src/n_Bulk_Read_Write.cpp", "rank": 68, "score": 137836.2708466289 }, { "content": "/*******************************************************************************\n\n* Copyright 2018 ROBOTIS CO., LTD.\n\n*\n\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n\n* you may not use this file except in compliance with the License.\n\n* You may obtain a copy of the License at\n\n*\n\n* http://www.apache.org/licenses/LICENSE-2.0\n\n*\n\n* Unless required by applicable law or agreed to in writing, software\n\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n* See the License for the specific language governing permissions and\n\n* limitations under the License.\n\n*******************************************************************************/\n\n\n\n/* Authors: Taehun Lim (Darby) */\n\n\n\n#include <DynamixelWorkbench.h>\n\n\n", "file_path": "dynamixel-workbench/dynamixel_workbench_toolbox/examples/src/n_Bulk_Read_Write.cpp", "rank": 69, "score": 137835.91098889205 }, { "content": " {\n\n printf(\"[ID %d]\\tGoal Position : %d\\tPresent Position : %d, [ID %d]\\tLED : %d\\n\"\n\n ,dxl_id[0], goal_position[0], get_data[0], dxl_id[1], get_data[1]);\n\n }\n\n\n\n }while(abs(goal_position[0] - get_data[0]) > 15);\n\n\n\n swap(goal_position);\n\n swap(led);\n\n }\n\n\n\n return 0;\n\n}\n\n\n\nvoid swap(int32_t *array)\n\n{\n\n int32_t tmp = array[0];\n\n array[0] = array[1];\n\n array[1] = tmp;\n\n}", "file_path": "dynamixel-workbench/dynamixel_workbench_toolbox/examples/src/n_Bulk_Read_Write.cpp", "rank": 70, "score": 137824.33373168053 }, { "content": "class ReactiveActionNode : public BT::ActionNodeBase\n\n{\n\npublic:\n\n using BT::ActionNodeBase::ActionNodeBase;\n\n\n\n BT::NodeStatus tick() override\n\n {\n\n BT::NodeStatus current_status = status();\n\n switch (current_status)\n\n {\n\n case BT::NodeStatus::IDLE:\n\n current_status = setUp();\n\n break;\n\n case BT::NodeStatus::RUNNING:\n\n current_status = doWork();\n\n if (BT::NodeStatus::RUNNING != current_status)\n\n {\n\n tearDown();\n\n }\n\n break;\n", "file_path": "mission_control/include/mission_control/behaviors/reactive_action.h", "rank": 71, "score": 135333.38878858718 }, { "content": " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n\n * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n\n * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n\n * POSSIBILITY OF SUCH DAMAGE.\n\n *********************************************************************/\n\n\n\n/*\n\n * diagnostic_tools/message_stagnation_check.h\n\n */\n\n\n\n#ifndef DIAGNOSTIC_TOOLS_MESSAGE_STAGNATION_CHECK_H\n\n#define DIAGNOSTIC_TOOLS_MESSAGE_STAGNATION_CHECK_H\n", "file_path": "diagnostics_tools/include/diagnostic_tools/message_stagnation_check.h", "rank": 72, "score": 135127.6278015817 }, { "content": " return params_.stagnation_diagnostic();\n\n }\n\n return params_.normal_diagnostic();\n\n }\n\n\n\n MessageEqualOp equal_op_;\n\n MessageStagnationCheckParams params_;\n\n std::deque<boost::shared_ptr<MessageT const>> message_window_;\n\n std::mutex mutex_;\n\n};\n\n\n\n} // namespace diagnostic_tools\n\n} // namespace qna\n\n\n\n#endif // DIAGNOSTIC_TOOLS_MESSAGE_STAGNATION_CHECK_H\n", "file_path": "diagnostics_tools/include/diagnostic_tools/message_stagnation_check.h", "rank": 73, "score": 135124.73307702402 }, { "content": "\n\n#include <cinttypes>\n\n#include <deque>\n\n#include <mutex> // NOLINT(build/c++11)\n\n#include <string>\n\n#include <utility>\n\n\n\n#include <diagnostic_updater/diagnostic_updater.h>\n\n\n\n#include <ros/ros.h>\n\n\n\n#include \"diagnostic_tools/diagnostic.h\"\n\n#include \"diagnostic_tools/topic_diagnostic_task.h\"\n\n\n\nnamespace qna\n\n{\n\nnamespace diagnostic_tools\n\n{\n\n\n", "file_path": "diagnostics_tools/include/diagnostic_tools/message_stagnation_check.h", "rank": 74, "score": 135124.24544484136 }, { "content": " {\n\n ROS_WARN_NAMED(\"diagnostic_tools\", \"No stagnation checks possible on null message\");\n\n return;\n\n }\n\n\n\n std::lock_guard<std::mutex> guard(mutex_);\n\n message_window_.push_back(message);\n\n if (message_window_.size() > params_.window_size())\n\n {\n\n message_window_.pop_front();\n\n }\n\n }\n\n\n\n void run(diagnostic_updater::DiagnosticStatusWrapper &stat) override\n\n {\n\n std::lock_guard<std::mutex> guard(mutex_);\n\n const Diagnostic &diagnostic = diagnose();\n\n stat.summary(diagnostic.status(), diagnostic.description());\n\n if (diagnostic.has_code())\n\n {\n", "file_path": "diagnostics_tools/include/diagnostic_tools/message_stagnation_check.h", "rank": 75, "score": 135116.33943766088 }, { "content": " diagnostic.description(\"Messages have stagnated\");\n\n }\n\n stagnation_diagnostic_ = std::move(diagnostic);\n\n return *this;\n\n }\n\n\n\n const Diagnostic &stagnation_diagnostic() const\n\n {\n\n return stagnation_diagnostic_;\n\n }\n\n\n\n MessageStagnationCheckParams &stale_diagnostic(Diagnostic diagnostic)\n\n {\n\n if (diagnostic.description().empty())\n\n {\n\n diagnostic.description(\"Not enough messages since last update\");\n\n }\n\n stale_diagnostic_ = std::move(diagnostic);\n\n return *this;\n\n }\n", "file_path": "diagnostics_tools/include/diagnostic_tools/message_stagnation_check.h", "rank": 76, "score": 135113.1252927396 }, { "content": "\n\n const Diagnostic &stale_diagnostic() const\n\n {\n\n return stale_diagnostic_;\n\n }\n\n\n\n MessageStagnationCheckParams &normal_diagnostic(Diagnostic diagnostic)\n\n {\n\n if (diagnostic.description().empty())\n\n {\n\n diagnostic.description(\"Messages fluctuate normally\");\n\n }\n\n normal_diagnostic_ = std::move(diagnostic);\n\n return *this;\n\n }\n\n\n\n const Diagnostic &normal_diagnostic() const\n\n {\n\n return normal_diagnostic_;\n\n }\n\n\n\nprivate:\n\n size_t window_size_{3};\n\n Diagnostic normal_diagnostic_{Diagnostic::OK, \"Messages fluctuate normally\"};\n\n Diagnostic stagnation_diagnostic_{Diagnostic::WARN, \"Messages have stagnated\"};\n\n Diagnostic stale_diagnostic_{Diagnostic::STALE, \"Not enough messages since last update\"};\n\n};\n\n\n\ntemplate <typename MessageT>\n", "file_path": "diagnostics_tools/include/diagnostic_tools/message_stagnation_check.h", "rank": 77, "score": 135112.78415380284 }, { "content": " stat.addf(\"Code\", \"%\" PRIu64, diagnostic.code());\n\n }\n\n }\n\n\n\nprivate:\n\n const Diagnostic &diagnose()\n\n {\n\n if (message_window_.size() < params_.window_size())\n\n {\n\n return params_.stale_diagnostic();\n\n }\n\n auto predicate = [this](const boost::shared_ptr<MessageT const> &a,\n\n const boost::shared_ptr<MessageT const> &b)\n\n {\n\n return equal_op_(*a, *b);\n\n };\n\n if (std::adjacent_find(message_window_.begin(),\n\n message_window_.end(),\n\n predicate) != message_window_.end())\n\n {\n", "file_path": "diagnostics_tools/include/diagnostic_tools/message_stagnation_check.h", "rank": 78, "score": 135109.45072859223 }, { "content": "/*********************************************************************\n\n * Software License Agreement (BSD License)\n\n *\n\n * Copyright (c) 2020, QinetiQ, Inc.\n\n * All rights reserved.\n\n *\n\n * Redistribution and use in source and binary forms, with or without\n\n * modification, are permitted provided that the following conditions\n\n * are met:\n\n *\n\n * * Redistributions of source code must retain the above copyright\n\n * notice, this list of conditions and the following disclaimer.\n\n * * Redistributions in binary form must reproduce the above\n\n * copyright notice, this list of conditions and the following\n\n * disclaimer in the documentation and/or other materials provided\n\n * with the distribution.\n\n * * Neither the name of QinetiQ nor the names of its\n\n * contributors may be used to endorse or promote products derived\n\n * from this software without specific prior written permission.\n\n *\n", "file_path": "diagnostics_tools/include/diagnostic_tools/message_stagnation_check.h", "rank": 79, "score": 135107.39988133364 }, { "content": " public:\n\n SingleDynamixelController();\n\n ~SingleDynamixelController();\n\n void viewManagerMenu(void);\n\n bool controlLoop(void);\n\n\n\n private:\n\n bool initSingleDynamixelController();\n\n bool shutdownSingleDynamixelController();\n\n\n\n int getch(void);\n\n int kbhit(void);\n\n\n\n bool sendCommandMsg(std::string cmd, std::string addr = \"\", int64_t value = 0);\n\n\n\n};\n\n}\n\n\n\n#endif //DYNAMIXEL_WORKBENCH_SINGLE_DYNAMIXEL_CONTROLLER_H\n", "file_path": "dynamixel-workbench/dynamixel_workbench_single_manager/include/dynamixel_workbench_single_manager/single_dynamixel_controller.h", "rank": 80, "score": 132700.045534833 }, { "content": "\n\n#include <fcntl.h> // FILE control\n\n#include <termios.h> // Terminal IO\n\n#include <ros/ros.h>\n\n\n\n#include \"dynamixel_workbench_msgs/DynamixelCommand.h\"\n\n#include \"dynamixel_workbench_msgs/GetDynamixelInfo.h\"\n\n#include \"message_header.h\"\n\n\n\nnamespace single_dynamixel_controller\n\n{\n\n#define ESC_ASCII_VALUE 0x1b\n\n#define SPACEBAR_ASCII_VALUE 0x20\n\n#define ENTER_ASCII_VALUE 0x0a\n\n\n", "file_path": "dynamixel-workbench/dynamixel_workbench_single_manager/include/dynamixel_workbench_single_manager/single_dynamixel_controller.h", "rank": 81, "score": 132691.80188293476 }, { "content": "/*******************************************************************************\n\n* Copyright 2016 ROBOTIS CO., LTD.\n\n*\n\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n\n* you may not use this file except in compliance with the License.\n\n* You may obtain a copy of the License at\n\n*\n\n* http://www.apache.org/licenses/LICENSE-2.0\n\n*\n\n* Unless required by applicable law or agreed to in writing, software\n\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n* See the License for the specific language governing permissions and\n\n* limitations under the License.\n\n*******************************************************************************/\n\n\n\n/* Authors: Taehun Lim (Darby) */\n\n\n\n#ifndef DYNAMIXEL_WORKBENCH_SINGLE_DYNAMIXEL_CONTROLLER_H\n\n#define DYNAMIXEL_WORKBENCH_SINGLE_DYNAMIXEL_CONTROLLER_H\n", "file_path": "dynamixel-workbench/dynamixel_workbench_single_manager/include/dynamixel_workbench_single_manager/single_dynamixel_controller.h", "rank": 82, "score": 132685.53670886823 }, { "content": "class ReportFinDeflection : public JausMessageOut {\n\n private:\n\n int8_t _deflectionAngle; // 1 byte - DeflectionCMD in document\n\n int8_t _finId; // 1 byte\n\n ros::Subscriber _subscriber_reportAngle;\n\n\n\n public:\n\n void init(ros::NodeHandle* nodeHandle, int8_t finId, udpserver* udp);\n\n virtual DataInfo GetPackedMessage(void* data);\n\n void SetFinId(int8_t finId) { _finId = finId; };\n\n virtual void Reset() { _deflectionAngle = -100; }\n\n // void SetdeflectionAngle(int8_t angle){\n\n // _deflectionAngle = angle;};\n\n void handleReportAngle(const fin_control::ReportAngle::ConstPtr& msg);\n\n};\n\n\n\n#endif /* REPORTFINDEFLECTION_H_ */\n", "file_path": "jaus_ros_bridge/include/ReportFinDeflection.h", "rank": 83, "score": 131168.17253069536 }, { "content": "class SetPayloadCommands : public JausMessageIn {\n\n public:\n\n void init(ros::NodeHandle* nodeHandle);\n\n\n\n void ProcessData(char* message, JausCommandID cmdID);\n\n\n\n private:\n\n ros::Publisher _publisher_payload_command;\n\n};\n\n\n\n#endif // SETPAYLOADCOMMANDS_H\n", "file_path": "jaus_ros_bridge/include/SetPayloadCommands.h", "rank": 84, "score": 131101.3822766257 }, { "content": "class SetMissionCommands : public JausMessageIn {\n\n public:\n\n void init(ros::NodeHandle* nodeHandle);\n\n\n\n void ProcessData(char* message, JausCommandID cmdID);\n\n\n\n void StopMissions();\n\n\n\n private:\n\n ros::Publisher _publisher_Execute_mission;\n\n ros::Publisher _publisher_Stop_mission;\n\n ros::Publisher _publisher_Abort_mission;\n\n ros::Publisher _publisher_Load_mission;\n\n ros::Publisher _publisher_Query_mission;\n\n ros::Publisher _publisher_Remove_mission;\n\n};\n\n\n\n#endif // SETMISSIONCOMMANDS_H\n", "file_path": "jaus_ros_bridge/include/SetMissionCommands.h", "rank": 85, "score": 131101.3822766257 }, { "content": "class PowerPlantControl : public JausMessageIn {\n\n public:\n\n // PowerPlantControl();\n\n void init(ros::NodeHandle* nodeHandle);\n\n void PublishRPM(const bool enable);\n\n void ProcessData(char* message);\n\n\n\n enum PresenceBits { RPMBit = 0, ThrottleBit = 1, GlowPlugStateBit = 2 };\n\n\n\n int8_t GetPowerPlantID();\n\n\n\n int8_t GetPowerCMD();\n\n\n\n int8_t GetEnginId();\n\n\n\n int GetRpm();\n\n void StopThruster();\n\n\n\n private:\n\n void commandRPM(const ros::TimerEvent& ev);\n", "file_path": "jaus_ros_bridge/include/PowerPlantControl.h", "rank": 86, "score": 129663.9674542912 }, { "content": "enum JausCommandID {\n\n JAUS_COMMAND_Invalid = 0,\n\n JAUS_COMMAND_PowerPlantControl = 0x0A06,\n\n // JAUS_COMMAND_QueryPowerPlantSpecifications = 0x2A05,\n\n // JAUS_COMMAND_QueryPowerPlantStatus = 0x2A06,\n\n // JAUS_COMMAND_ReportPowerPlantSpecifications = 0x4A05,\n\n JAUS_COMMAND_ReportPowerPlantStatus = 0x4A06,\n\n\n\n // Fin control\n\n JAUS_COMMAND_SetFinDeflection = 0x0A36,\n\n JAUS_COMMAND_ReportFinDeflection = 0x4A36,\n\n\n\n // INS data report\n\n JAUS_COMMAND_ReportINSData = 0x5A01,\n\n\n\n // Altimeter report\n\n JAUS_COMMAND_ReportAltimeter = 0x5A06,\n\n\n\n // Altimeter report\n\n JAUS_COMMAND_ReportPoseEstimetorData = 0x5A10,\n", "file_path": "jaus_ros_bridge/include/JausMessageHeader.h", "rank": 87, "score": 127506.25560732269 }, { "content": "/// \\brief Represents a cross-platform serial port.\n\n///\n\n/// When the SerialPort if first created and the connection opened, the user\n\n/// will normally have to poll the method \\ref read to see if any new data is\n\n/// available on the serial port. However, if the user code registers a\n\n/// handler with the method \\ref registerDataReceivedHandler, the SerialPort\n\n/// object will start an internal thread that monitors the serial port for new\n\n/// data, and when new data is available, it will alert the user code through\n\n/// the callback handler. Then the user can call \\ref read to retrieve the\n\n/// data.\n\nclass vn_proglib_DLLEXPORT SerialPort : public IPort, util::NoCopy\n\n{\n\n\n\n\t// Types //////////////////////////////////////////////////////////////////\n\n\t\n\npublic:\n\n\t\n\n\tenum StopBits\n\n\t{\n\n\t\tONE_STOP_BIT,\n\n\t\tTWO_STOP_BITS\n\n\t};\n\n\n\n\t// Constructors ///////////////////////////////////////////////////////////\n\n\n\npublic:\n\n\n\n\t/// \\brief Creates a new \\ref SerialPort with the provided connection\n\n\t/// parameters.\n\n\t///\n", "file_path": "vectornav/vnproglib-1.1.4.0/cpp/include/vn/serialport.h", "rank": 88, "score": 125698.26195179526 } ]
C++
Source/UnitUtil.cpp
biug/XBot
20f51094ee18aeaa58d769a894c68b4f05f900d4
#include "UnitUtil.h" using namespace XBot; bool UnitUtil::IsMorphedBuildingType(BWAPI::UnitType type) { return type == BWAPI::UnitTypes::Zerg_Sunken_Colony || type == BWAPI::UnitTypes::Zerg_Spore_Colony || type == BWAPI::UnitTypes::Zerg_Lair || type == BWAPI::UnitTypes::Zerg_Hive || type == BWAPI::UnitTypes::Zerg_Greater_Spire; } bool UnitUtil::IsCombatSimUnit(BWAPI::UnitType type) { if (type.isWorker()) { return false; } return type.canAttack() || type == BWAPI::UnitTypes::Terran_Medic || type.isDetector(); } bool UnitUtil::IsCombatUnit(BWAPI::UnitType type) { if (type.isWorker() || type.isBuilding() || type == BWAPI::UnitTypes::Protoss_Interceptor) { return false; } if (type.canAttack() || type.isDetector() || type == BWAPI::UnitTypes::Terran_Medic || type == BWAPI::UnitTypes::Protoss_High_Templar || type.isFlyer() && type.spaceProvided() > 0) { return true; } return false; } bool UnitUtil::IsCombatUnit(BWAPI::Unit unit) { UAB_ASSERT(unit != nullptr, "Unit was null"); if (!unit) { return false; } return IsCombatUnit(unit->getType()); } bool UnitUtil::IsValidUnit(BWAPI::Unit unit) { return unit && unit->exists() && (unit->isCompleted() || IsMorphedBuildingType(unit->getType())) && unit->getHitPoints() > 0 && unit->getType() != BWAPI::UnitTypes::Unknown && unit->getPosition().isValid(); } bool UnitUtil::CanAttack(BWAPI::Unit attacker, BWAPI::Unit target) { return target->isFlying() ? TypeCanAttackAir(attacker->getType()) : TypeCanAttackGround(attacker->getType()); } bool UnitUtil::CanAttack(BWAPI::UnitType attacker, BWAPI::UnitType target) { return target.isFlyer() ? TypeCanAttackAir(attacker) : TypeCanAttackGround(attacker); } bool UnitUtil::CanAttackAir(BWAPI::Unit attacker) { return TypeCanAttackAir(attacker->getType()); } bool UnitUtil::TypeCanAttackAir(BWAPI::UnitType attacker) { return attacker.airWeapon() != BWAPI::WeaponTypes::None || attacker == BWAPI::UnitTypes::Terran_Bunker || attacker == BWAPI::UnitTypes::Protoss_Carrier; } bool UnitUtil::CanAttackGround(BWAPI::Unit attacker) { return TypeCanAttackGround(attacker->getType()); } bool UnitUtil::TypeCanAttackGround(BWAPI::UnitType attacker) { return attacker.groundWeapon() != BWAPI::WeaponTypes::None || attacker == BWAPI::UnitTypes::Terran_Bunker || attacker == BWAPI::UnitTypes::Protoss_Carrier || attacker == BWAPI::UnitTypes::Protoss_Reaver; } double UnitUtil::CalculateLTD(BWAPI::Unit attacker, BWAPI::Unit target) { BWAPI::WeaponType weapon = GetWeapon(attacker, target); if (weapon == BWAPI::WeaponTypes::None || weapon.damageCooldown() <= 0) { return 0; } return double(weapon.damageAmount()) / weapon.damageCooldown(); } BWAPI::WeaponType UnitUtil::GetWeapon(BWAPI::Unit attacker, BWAPI::Unit target) { return GetWeapon(attacker->getType(), target); } BWAPI::WeaponType UnitUtil::GetWeapon(BWAPI::UnitType attacker, BWAPI::Unit target) { if (attacker == BWAPI::UnitTypes::Protoss_Carrier) { return GetWeapon(BWAPI::UnitTypes::Protoss_Interceptor, target); } if (attacker == BWAPI::UnitTypes::Protoss_Reaver) { return GetWeapon(BWAPI::UnitTypes::Protoss_Scarab, target); } return target->isFlying() ? attacker.airWeapon() : attacker.groundWeapon(); } BWAPI::WeaponType UnitUtil::GetWeapon(BWAPI::UnitType attacker, BWAPI::UnitType target) { if (attacker == BWAPI::UnitTypes::Protoss_Carrier) { return GetWeapon(BWAPI::UnitTypes::Protoss_Interceptor, target); } if (attacker == BWAPI::UnitTypes::Protoss_Reaver) { return GetWeapon(BWAPI::UnitTypes::Protoss_Scarab, target); } return target.isFlyer() ? attacker.airWeapon() : attacker.groundWeapon(); } int UnitUtil::GetAttackRange(BWAPI::Unit attacker, BWAPI::Unit target) { if (attacker->getType() == BWAPI::UnitTypes::Protoss_Reaver && !target->isFlying()) { return 8; } if (attacker->getType() == BWAPI::UnitTypes::Protoss_Carrier) { return 8; } if (attacker->getType() == BWAPI::UnitTypes::Terran_Bunker) { if (attacker->getPlayer() == BWAPI::Broodwar->enemy() || BWAPI::Broodwar->self()->getUpgradeLevel(BWAPI::UpgradeTypes::U_238_Shells)) { return 6 * 32; } return 5 * 32; } const BWAPI::WeaponType weapon = GetWeapon(attacker, target); if (weapon == BWAPI::WeaponTypes::None) { return 0; } int range = weapon.maxRange(); if (attacker->getType() == BWAPI::UnitTypes::Protoss_Dragoon) { if (attacker->getPlayer() == BWAPI::Broodwar->enemy() || BWAPI::Broodwar->self()->getUpgradeLevel(BWAPI::UpgradeTypes::Singularity_Charge)) { range = 6 * 32; } } else if (attacker->getType() == BWAPI::UnitTypes::Terran_Marine) { if (attacker->getPlayer() == BWAPI::Broodwar->enemy() || BWAPI::Broodwar->self()->getUpgradeLevel(BWAPI::UpgradeTypes::U_238_Shells)) { range = 5 * 32; } } else if (attacker->getType() == BWAPI::UnitTypes::Terran_Goliath && target->isFlying()) { if (attacker->getPlayer() == BWAPI::Broodwar->enemy() || BWAPI::Broodwar->self()->getUpgradeLevel(BWAPI::UpgradeTypes::Charon_Boosters)) { range = 8 * 32; } } else if (attacker->getType() == BWAPI::UnitTypes::Zerg_Hydralisk) { if (attacker->getPlayer() == BWAPI::Broodwar->enemy() || BWAPI::Broodwar->self()->getUpgradeLevel(BWAPI::UpgradeTypes::Grooved_Spines)) { range = 5 * 32; } } return range; } int UnitUtil::GetAttackRangeAssumingUpgrades(BWAPI::UnitType attacker, BWAPI::UnitType target) { if (attacker == BWAPI::UnitTypes::Protoss_Reaver && !target.isFlyer()) { return 8; } if (attacker == BWAPI::UnitTypes::Protoss_Carrier) { return 8; } if (attacker == BWAPI::UnitTypes::Terran_Bunker) { return 6 * 32; } BWAPI::WeaponType weapon = GetWeapon(attacker, target); if (weapon == BWAPI::WeaponTypes::None) { return 0; } int range = weapon.maxRange(); if (attacker == BWAPI::UnitTypes::Protoss_Dragoon) { range = 6 * 32; } else if (attacker == BWAPI::UnitTypes::Terran_Marine) { range = 5 * 32; } else if (attacker == BWAPI::UnitTypes::Terran_Goliath && target.isFlyer()) { range = 8 * 32; } else if (attacker == BWAPI::UnitTypes::Zerg_Hydralisk) { range = 5 * 32; } return range; } int UnitUtil::GetAllUnitCount(BWAPI::UnitType type) { int count = 0; for (const auto unit : BWAPI::Broodwar->self()->getUnits()) { if (unit->getType() == type) { count++; } if (unit->getType() == BWAPI::UnitTypes::Zerg_Egg && unit->getBuildType() == type) { count += type.isTwoUnitsInOneEgg() ? 2 : 1; } if (unit->getRemainingTrainTime() > 0) { BWAPI::UnitType trainType = unit->getLastCommand().getUnitType(); if (trainType == type && unit->getRemainingTrainTime() == trainType.buildTime()) { count++; } } } return count; } int UnitUtil::GetCompletedUnitCount(BWAPI::UnitType type) { int count = 0; for (const auto unit : BWAPI::Broodwar->self()->getUnits()) { if (unit->getType() == type && unit->isCompleted()) { count++; } } return count; }
#include "UnitUtil.h" using namespace XBot; bool UnitUtil::IsMorphedBuildingType(BWAPI::UnitType type) { return type == BWAPI::UnitTypes::Zerg_Sunken_Colony || type == BWAPI::UnitTypes::Zerg_Spore_Colony || type == BWAPI::UnitTypes::Zerg_Lair || type == BWAPI::UnitTypes::Zerg_Hive || type == BWAPI::UnitTypes::Zerg_Greater_Spire; } bool UnitUtil::IsCombatSimUnit(BWAPI::UnitType type) { if (type.isWorker()) { return false; } return type.canAttack() || type == BWAPI::UnitTypes::Terran_Medic || type.isDetector(); } bool UnitUtil::IsCombatUnit(BWAPI::UnitType type) { if (type.isWorker() || type.isBuilding() || type == BWAPI::UnitTypes::Protoss_Interceptor) { return false; } if (type.canAttack() || type.isDetector() || type == BWAPI::UnitTypes::Terran_Medic || type == BWAPI::UnitTypes::Protoss_High_Templar || type.isFlyer() && type.spaceProvided() > 0) { return true; } return false; } bool UnitUtil::IsCombatUnit(BWAPI::Unit unit) { UAB_ASSERT(unit != nullptr, "Unit was null"); if (!unit) { return false; } return IsCombatUnit(unit->getType()); } bool UnitUtil::IsValidUnit(BWAPI::Unit unit) { return unit && unit->exists() && (unit->isCompleted() || IsMorphedBuildingType(unit->getType())) && unit->getHitPoints() > 0 && unit->getType() != BWAPI::UnitTypes::Unknown && unit->getPosition().isValid(); } bool UnitUtil::CanAttack(BWAPI::Unit attacker, BWAPI::Unit target) { return target->isFlying() ? TypeCanAttackAir(attacker->getType()) : TypeCanAttackGround(attacker->getType()); } bool UnitUtil::CanAttack(BWAPI::UnitType attacker, BWAPI::UnitType target) { return target.isFlyer() ? TypeCanAttackAir(attacker) : TypeCanAttackGround(attacker); } bool UnitUtil::CanAttackAir(BWAPI::Unit attacker) { return TypeCanAttackAir(attacker->getType()); } bool UnitUtil::TypeCanAttackAir(BWAPI::UnitType attacker) { return attacker.airWeapon() != BWAPI::WeaponTypes::None || attacker == BWAPI::UnitTypes::Terran_Bunker || attacker == BWAPI::UnitTypes::Protoss_Carrier; } bool UnitUtil::CanAttackGround(BWAPI::Unit attacker) { return TypeCanAttackGround(attacker->getType()); } bool UnitUtil::TypeCanAttackGround(BWAPI::UnitType attacker) { return attacker.groundWeapon() != BWAPI::WeaponTypes::None || attacker == BWAPI::UnitTypes::Terran_Bunker || attacker == BWAPI::UnitTypes::Protoss_Carrier || attacker == BWAPI::UnitTypes::Protoss_Reaver; } double UnitUtil::CalculateLTD(BWAPI::Unit attacker, BWAPI::Unit target) { BWAPI::WeaponType weapon = GetWeapon(attacker, target); if (weapon == BWAPI::WeaponTypes::None || weapon.damageCooldown() <= 0) { return 0; } return double(weapon.damageAmount()) / weapon.damageCooldown(); } BWAPI::WeaponType UnitUtil::GetWeapon(BWAPI::Unit attacker, BWAPI::Unit target) { return GetWeapon(attacker->getType(), target); } BWAPI::WeaponType UnitUtil::GetWeapon(BWAPI::UnitType attacker, BWAPI::Unit target) { if (attacker == BWAPI::UnitTypes::Protoss_Carrier) { return GetWeapon(BWAPI::UnitTypes::Protoss_Interceptor, target); } if (attacker == BWAPI::UnitTypes::Protoss_Reaver) { return GetWeapon(BWAPI::UnitTypes::Protoss_Scarab, target); } return target->isFlying() ? attacker.airWeapon() : attacker.groundWeapon(); } BWAPI::WeaponType UnitUtil::GetWeapon(BWAPI::UnitType attacker, BWAPI::UnitType target) { if (attacker == BWAPI::UnitTypes::Protoss_Carrier) { return GetWeapon(BWAPI::UnitTypes::Protoss_Interceptor, target); } if (attacker == BWAPI::UnitTypes::Protoss_Reaver) { return GetWeapon(BWAPI::UnitTypes::Protoss_Scarab, target); } return target.isFlyer() ? attacker.airWeapon() : attacker.groundWeapon(); } int UnitUtil::GetAttackRange(BWAPI::Unit attacker, BWAPI::Unit target) { if (attacker->getType() == BWAPI::UnitTypes::Protoss_Reaver && !target->isFlying()) { return 8; } if (attacker->getType() == BWAPI::UnitTypes::Protoss_Carrier) { return 8; } if (attacker->getType() == BWAPI::UnitTypes::Terran_Bunker) { if (attacker->getPlayer() == BWAPI::Broodwar->enemy() || BWAPI::Broodwar->self()->getUpgradeLevel(BWAPI::UpgradeTypes::U_238_Shells)) { return 6 * 32; } return 5 * 32; } const BWAPI::WeaponType weapon = GetWeapon(attacker, target); if (weapon == BWAPI::WeaponTypes::None) { return 0; } int range = weapon.maxRange(); if (attacker->getType() == BWAPI::UnitTypes::Protoss_Dragoon) { if (attacker->getPlayer() == BWAPI::Broodwar->enemy() || BWAPI::Broodwar->self()->getUpgradeLevel(BWAPI::UpgradeTypes::Singularity_Charge)) { range = 6 * 32; } } else if (attacker->getType() == BWAPI::UnitTypes::Terran_Marine) { if (attacker->getPlayer() == BWAPI::Broodwar->enemy() || BWAPI::Broodwar->self()->getUpgradeLevel(BWAPI::UpgradeTypes::U_238_Shells)) { range = 5 * 32; } } else if (attacker->getType() == BWAPI::UnitTypes::Terran_Goliath && target->isFlying()) { if (attacker->getPlayer() == BWAPI::Broodwar->enemy() || BWAPI::Broodwar->self()->getUpgradeLevel(BWAPI::UpgradeTypes::Charon_Boosters)) { range = 8 * 32; } } else if (attacker->getType() == BWAPI::UnitTypes::Zerg_Hydralisk) { if (attacker->getPlayer() == BWAPI::Broodwar->enemy() || BWAPI::Broodwar->self()->getUpgradeLevel(BWAPI::UpgradeTypes::Grooved_Spines)) { range = 5 * 32; } } return range; } int UnitUtil::GetAttackRangeAssumingUpgrades(BWAPI::UnitType attacker, BWAPI::UnitType target) { if (attacker == BWAPI::UnitTypes::Protoss_Reaver && !target.isFlyer()) { return 8; } if (attacker == BWAPI::UnitTypes::Protoss_Carrier) { return 8; } if (attacker == BWAPI::UnitTypes::Terran_Bunker) { return 6 * 32; } BWAPI::WeaponType weapon = GetWeapon(attacker, target); if (weapon == BWAPI::WeaponTypes::None) { return 0; } int range = weapon.maxRange(); if (attacker == BWAPI::UnitTypes::Protoss_Dragoon) { range = 6 * 32; } else if (attacker == BWAPI::UnitTypes::Terran_Marine) { range = 5 * 32; } else if (attacker == BWAPI::UnitTypes::Terran_Goliath && target.isFlyer()) { range = 8 * 32; } else if (attacker == BWAPI::UnitTypes::Zerg_Hydralisk) { range = 5 * 32; } return range; } int UnitUtil::GetAllUnitCount(BWAPI::UnitType type) { int count = 0; for (const auto unit : BWAPI::Broodwar->self()->getUnits()) { if (unit->getType() == type) { count++; } if (unit->getType() == BWAPI::UnitTypes::Ze
int UnitUtil::GetCompletedUnitCount(BWAPI::UnitType type) { int count = 0; for (const auto unit : BWAPI::Broodwar->self()->getUnits()) { if (unit->getType() == type && unit->isCompleted()) { count++; } } return count; }
rg_Egg && unit->getBuildType() == type) { count += type.isTwoUnitsInOneEgg() ? 2 : 1; } if (unit->getRemainingTrainTime() > 0) { BWAPI::UnitType trainType = unit->getLastCommand().getUnitType(); if (trainType == type && unit->getRemainingTrainTime() == trainType.buildTime()) { count++; } } } return count; }
function_block-function_prefixed
[ { "content": "// Unit choices for main unit mix and tech target.\n\n// This deliberately omits support units like queens and defilers.\n\nenum class TechUnit : int\n\n\t{ None\n\n\t, Zerglings\n\n\t, Hydralisks\n\n\t, Lurkers\n\n\t, Mutalisks\n\n\t, Ultralisks\n\n\t, Guardians\n\n\t, Devourers\n\n\t, Size\n\n};\n\n\n", "file_path": "Source/StrategyBossZerg.h", "rank": 0, "score": 97105.6186361545 }, { "content": " friend bool operator==(ParseErrorCode code, const ParseResult & err) { return code == err.code_; }\n", "file_path": "Source/rapidjson/error/error.h", "rank": 1, "score": 73195.34718891876 }, { "content": "namespace XBot\n\n{\n\nnamespace UnitUtil\n\n{ \n\n\tbool IsMorphedBuildingType(BWAPI::UnitType unitType);\n\n\t\n\n\tbool IsCombatSimUnit(BWAPI::UnitType type);\n\n\tbool IsCombatUnit(BWAPI::UnitType type);\n\n\tbool IsCombatUnit(BWAPI::Unit unit);\n\n bool IsValidUnit(BWAPI::Unit unit);\n\n \n\n\tbool CanAttack(BWAPI::Unit attacker, BWAPI::Unit target);\n\n\tbool CanAttack(BWAPI::UnitType attacker, BWAPI::UnitType target);\n\n\tbool CanAttackAir(BWAPI::Unit attacker);\n\n\tbool TypeCanAttackAir(BWAPI::UnitType attacker);\n\n\tbool CanAttackGround(BWAPI::Unit attacker);\n\n\tbool TypeCanAttackGround(BWAPI::UnitType attacker);\n\n\tdouble CalculateLTD(BWAPI::Unit attacker, BWAPI::Unit target);\n\n\tBWAPI::WeaponType GetWeapon(BWAPI::Unit attacker, BWAPI::Unit target);\n\n\tBWAPI::WeaponType GetWeapon(BWAPI::UnitType attacker, BWAPI::Unit target);\n\n\tBWAPI::WeaponType GetWeapon(BWAPI::UnitType attacker, BWAPI::UnitType target);\n\n\tint GetAttackRange(BWAPI::Unit attacker, BWAPI::Unit target);\n\n\tint GetAttackRangeAssumingUpgrades(BWAPI::UnitType attacker, BWAPI::UnitType target);\n\n\t\n\n\tint GetAllUnitCount(BWAPI::UnitType type);\n\n\tint GetCompletedUnitCount(BWAPI::UnitType type);\n\n};\n", "file_path": "Source/UnitUtil.h", "rank": 2, "score": 73066.87243961479 }, { "content": "", "file_path": "Source/StateManager.h", "rank": 3, "score": 71134.48540044519 }, { "content": "", "file_path": "Source/StateManager.h", "rank": 4, "score": 71070.42466152788 }, { "content": "", "file_path": "Source/StateManager.h", "rank": 5, "score": 71070.42466152788 }, { "content": "", "file_path": "Source/StateManager.h", "rank": 6, "score": 71070.42466152788 }, { "content": "", "file_path": "Source/StateManager.h", "rank": 7, "score": 71070.42466152788 }, { "content": "enum WorkerData::WorkerJob WorkerData::getWorkerJob(BWAPI::Unit unit)\n\n{\n\n\tif (!unit) { return Default; }\n\n\n\n\tstd::map<BWAPI::Unit, enum WorkerJob>::iterator it = workerJobMap.find(unit);\n\n\n\n\tif (it != workerJobMap.end())\n\n\t{\n\n\t\treturn it->second;\n\n\t}\n\n\n\n\treturn Default;\n\n}\n\n\n\nbool WorkerData::depotIsFull(BWAPI::Unit depot)\n\n{\n\n\tif (!depot) { return false; }\n\n\n\n\tint assignedWorkers = getNumAssignedWorkers(depot);\n\n\tint mineralsNearDepot = getMineralsNearDepot(depot);\n", "file_path": "Source/WorkerData.cpp", "rank": 8, "score": 62455.36619926634 }, { "content": "class UnitData\n\n{\n\n UIMap unitMap;\n\n\n\n const bool badUnitInfo(const UnitInfo & ui) const;\n\n\n\n std::vector<int>\t\t\t\t\t\tnumUnits; // how many now\n\n\tstd::vector<int>\t\t\t\t\t\tnumDeadUnits; // how many lost\n\n\n\n int\t\t\t\t\t\t\t\t\t\tmineralsLost;\n\n int\t\t\t\t\t\t\t\t\t\tgasLost;\n\n\n\npublic:\n\n\n\n UnitData();\n\n\n\n void\tupdateUnit(BWAPI::Unit unit);\n\n void\tremoveUnit(BWAPI::Unit unit);\n\n void\tremoveBadUnits();\n\n\n\n int\t\tgetGasLost() const;\n\n int\t\tgetMineralsLost() const;\n\n int\t\tgetNumUnits(BWAPI::UnitType t) const;\n\n int\t\tgetNumDeadUnits(BWAPI::UnitType t) const;\n\n const\tstd::map<BWAPI::Unit,UnitInfo> & getUnits() const;\n\n\tconst\tUnitInfo * getUnit(BWAPI::Unit unit)\t\tconst;\n\n};\n\n}", "file_path": "Source/UnitData.h", "rank": 9, "score": 56271.435437263855 }, { "content": "struct UnitInfo\n\n{\n\n // we need to store all of this data because if the unit is not visible, we\n\n // can't reference it from the unit pointer\n\n\n\n int unitID;\n\n\tint\t\t\t\tupdateFrame;\n\n int lastHealth;\n\n int lastShields;\n\n BWAPI::Player player;\n\n BWAPI::Unit unit;\n\n BWAPI::Position lastPosition;\n\n\tBWAPI::TilePosition lastTilePosition;\n\n BWAPI::UnitType type;\n\n bool completed;\n\n\n\n UnitInfo()\n\n : unitID(0)\n\n\t\t, updateFrame(0)\n\n\t\t, lastHealth(0)\n", "file_path": "Source/UnitData.h", "rank": 10, "score": 56271.435437263855 }, { "content": "\tclass Graph &\t\t\t\tGetGraph()\t\t\t\t\t\t\t\t\t\t\t\t{ return m_Graph; }\n\n\n\n\n\n\tconst vector<pair<pair<Area::id, Area::id>, BWAPI::WalkPosition>> &\t\tRawFrontier() const override\t\t{ return m_RawFrontier; }\n\n\n\n\n\n\n\n\tvoid\t\t\t\t\t\tOnMineralDestroyed(const Mineral * pMineral);\n\n\tvoid\t\t\t\t\t\tOnBlockingNeutralDestroyed(const Neutral * pBlocking);\n\n\n\nprivate:\n\n\tvoid\t\t\t\t\t\tReplaceAreaIds(BWAPI::WalkPosition p, Area::id newAreaId);\n\n\n\n\tvoid\t\t\t\t\t\tInitializeNeutrals();\n\n\tvoid\t\t\t\t\t\tLoadData();\n\n\tvoid\t\t\t\t\t\tDecideSeasOrLakes();\n\n\tvoid\t\t\t\t\t\tComputeAltitude();\n\n\tvoid\t\t\t\t\t\tProcessBlockingNeutrals();\n\n\tvoid\t\t\t\t\t\tComputeAreas();\n\n\tvector<pair<BWAPI::WalkPosition, MiniTile *>>\n", "file_path": "Source/bwem/mapImpl.h", "rank": 11, "score": 53691.5073949815 }, { "content": "struct GenericMemberIterator<true,Encoding,Allocator> {\n\n //! use plain const pointer as iterator type\n\n typedef const GenericMember<Encoding,Allocator>* Iterator;\n\n};\n\n\n\n#endif // RAPIDJSON_NOMEMBERITERATORCLASS\n\n\n\n///////////////////////////////////////////////////////////////////////////////\n\n// GenericStringRef\n\n\n\n//! Reference to a constant string (not taking a copy)\n\n/*!\n\n \\tparam CharType character type of the string\n\n\n\n This helper class is used to automatically infer constant string\n\n references for string literals, especially from \\c const \\b (!)\n\n character arrays.\n\n\n\n The main use is for creating JSON string values without copying the\n\n source string via an \\ref Allocator. This requires that the referenced\n", "file_path": "Source/rapidjson/document.h", "rank": 12, "score": 53685.481801766015 }, { "content": "class MicroRanged : public MicroManager\n\n{\n\npublic:\n\n\n\n\tMicroRanged();\n\n\tvoid executeMicro(const BWAPI::Unitset & targets);\n\n\n\n\tBWAPI::Unit chooseTarget(BWAPI::Unit rangedUnit, const BWAPI::Unitset & targets, std::map<BWAPI::Unit, int> & numTargeting);\n\n\n\n\tint getAttackPriority(BWAPI::Unit rangedUnit, BWAPI::Unit target);\n\n\tBWAPI::Unit getTarget(BWAPI::Unit rangedUnit, const BWAPI::Unitset & targets);\n\n\n\n void assignTargets(const BWAPI::Unitset & targets);\n\n\n\n\tbool stayHomeUntilReady(const BWAPI::Unit u) const;\n\n};\n\n}", "file_path": "Source/MicroRanged.h", "rank": 13, "score": 52210.68997473142 }, { "content": "#pragma once;\n\n\n\n#include <Common.h>\n\n#include \"MicroManager.h\"\n\n\n\nnamespace XBot\n\n{\n", "file_path": "Source/MicroRanged.h", "rank": 14, "score": 48459.494676786504 }, { "content": "\t\t, lastShields(0)\n\n\t\t, player(nullptr)\n\n , unit(nullptr)\n\n , lastPosition(BWAPI::Positions::None)\n\n\t\t, lastTilePosition(BWAPI::TilePositions::None)\n\n , type(BWAPI::UnitTypes::None)\n\n , completed(false)\n\n\t{\n\n }\n\n\n\n\tUnitInfo(BWAPI::Unit unit)\n\n\t\t: unitID(unit->getID())\n\n\t\t, updateFrame(BWAPI::Broodwar->getFrameCount())\n\n\t\t, lastHealth(unit->getHitPoints())\n\n\t\t, lastShields(unit->getShields())\n\n\t\t, player(unit->getPlayer())\n\n\t\t, unit(unit)\n\n\t\t, lastPosition(unit->getPosition())\n\n\t\t, lastTilePosition(unit->getTilePosition())\n\n\t\t, type(unit->getType())\n", "file_path": "Source/UnitData.h", "rank": 15, "score": 48431.30028950554 }, { "content": "\t\t, completed(unit->isCompleted())\n\n\t{\n\n\t}\n\n\n\n const bool operator == (BWAPI::Unit unit) const\n\n {\n\n return unitID == unit->getID();\n\n }\n\n\n\n const bool operator == (const UnitInfo & rhs) const\n\n {\n\n return (unitID == rhs.unitID);\n\n }\n\n\n\n const bool operator < (const UnitInfo & rhs) const\n\n {\n\n return (unitID < rhs.unitID);\n\n }\n\n};\n\n\n\ntypedef std::vector<UnitInfo> UnitInfoVector;\n\ntypedef std::map<BWAPI::Unit,UnitInfo> UIMap;\n\n\n", "file_path": "Source/UnitData.h", "rank": 16, "score": 48425.147653345215 }, { "content": "#pragma once\n\n\n\n#include \"Common.h\"\n\n#include \"BWTA.h\"\n\n\n\nnamespace XBot\n\n{\n", "file_path": "Source/UnitData.h", "rank": 17, "score": 48424.61279654068 }, { "content": "\tint bestScore = -999999;\n\n\tBWAPI::Unit bestTarget = nullptr;\n\n\n\n\tfor (const auto target : targets)\n\n\t{\n\n\t\tint priority = getAttackPriority(rangedUnit, target); // 0..12\n\n\t\tint range = rangedUnit->getDistance(target); // 0..map size in pixels\n\n\t\tint toGoal = target->getDistance(order.getPosition()); // 0..map size in pixels\n\n\n\n\t\t// Let's say that 1 priority step is worth 160 pixels (5 tiles).\n\n\t\t// We care about unit-target range and target-order position distance.\n\n\t\tint score = 5 * 32 * priority - range - toGoal/2;\n\n\n\n\t\t// Adjust for special features.\n\n\t\t// This could adjust for relative speed and direction, so that we don't chase what we can't catch.\n\n\t\tif (rangedUnit->isInWeaponRange(target))\n\n\t\t{\n\n\t\t\tscore += 4 * 32;\n\n\t\t}\n\n\t\telse if (!target->isMoving())\n", "file_path": "Source/MicroRanged.cpp", "rank": 18, "score": 46395.20319950419 }, { "content": "\t\t{\n\n\t\t\tif (target->getType().size() == BWAPI::UnitSizeTypes::Small)\n\n\t\t\t{\n\n\t\t\t\tscore += 32;\n\n\t\t\t}\n\n\t\t}\n\n\n\n\t\tif (score > bestScore)\n\n\t\t{\n\n\t\t\tbestScore = score;\n\n\t\t\tbestTarget = target;\n\n\t\t}\n\n\t}\n\n\t\n\n\treturn bestTarget;\n\n}\n\n\n\n// get the attack priority of a target unit\n\nint MicroRanged::getAttackPriority(BWAPI::Unit rangedUnit, BWAPI::Unit target) \n\n{\n", "file_path": "Source/MicroRanged.cpp", "rank": 19, "score": 46390.750631375406 }, { "content": "#include \"MicroRanged.h\"\n\n#include \"UnitUtil.h\"\n\n\n\nusing namespace XBot;\n\n\n\nMicroRanged::MicroRanged()\n\n{ \n\n}\n\n\n\nvoid MicroRanged::executeMicro(const BWAPI::Unitset & targets) \n\n{\n\n\tassignTargets(targets);\n\n}\n\n\n\nvoid MicroRanged::assignTargets(const BWAPI::Unitset & targets)\n\n{\n\n const BWAPI::Unitset & rangedUnits = getUnits();\n\n\n\n\t// The set of potential targets.\n\n\tBWAPI::Unitset rangedUnitTargets;\n", "file_path": "Source/MicroRanged.cpp", "rank": 20, "score": 46390.29980219689 }, { "content": "\t\t{\n\n\t\t\t// This includes proxy buildings, which deserve high priority.\n\n\t\t\t// But when bases are close together, it can include innocent buildings.\n\n\t\t\t// We also don't want to disrupt priorities in case of proxy buildings\n\n\t\t\t// supported by units; we may want to target the units first.\n\n\t\t\tif (UnitUtil::CanAttackGround(target) || UnitUtil::CanAttackAir(target))\n\n\t\t\t{\n\n\t\t\t\treturn 10;\n\n\t\t\t}\n\n\t\t\treturn 8;\n\n\t\t}\n\n\t}\n\n \n\n\tif (rangedType.isFlyer()) {\n\n\t\t// Exceptions if we're a flyer (other than scourge, which is handled above).\n\n\t\tif (targetType == BWAPI::UnitTypes::Zerg_Scourge)\n\n\t\t{\n\n\t\t\treturn 12;\n\n\t\t}\n\n\t}\n", "file_path": "Source/MicroRanged.cpp", "rank": 21, "score": 46389.19678785186 }, { "content": "\t// Short circuit: Give bunkers a lower priority to reduce bunker obsession.\n\n\tif (targetType == BWAPI::UnitTypes::Terran_Bunker)\n\n\t{\n\n\t\treturn 9;\n\n\t}\n\n\n\n\t// Threats can attack us. Exception: Workers are not threats.\n\n\tif (UnitUtil::CanAttack(targetType, rangedType) && !targetType.isWorker())\n\n\t{\n\n\t\t// Enemy unit which is far enough outside its range is lower priority than a worker.\n\n\t\tif (rangedUnit->getDistance(target) > 48 + UnitUtil::GetAttackRange(target, rangedUnit))\n\n\t\t{\n\n\t\t\treturn 8;\n\n\t\t}\n\n\t\treturn 10;\n\n\t}\n\n\t// Droppers are as bad as threats. They may be loaded and are often isolated and safer to attack.\n\n\tif (targetType == BWAPI::UnitTypes::Terran_Dropship ||\n\n\t\ttargetType == BWAPI::UnitTypes::Protoss_Shuttle)\n\n\t{\n", "file_path": "Source/MicroRanged.cpp", "rank": 22, "score": 46388.573937875175 }, { "content": "\tif (targetType.gasPrice() > 0)\n\n\t{\n\n\t\treturn 4;\n\n\t}\n\n\tif (targetType.mineralPrice() > 0)\n\n\t{\n\n\t\treturn 3;\n\n\t}\n\n\t// Finally everything else.\n\n\treturn 1;\n\n}\n\n\n\n// Should the unit stay (or return) home until ready to move out?\n\nbool MicroRanged::stayHomeUntilReady(const BWAPI::Unit u) const\n\n{\n\n\treturn\n\n\t\tu->getType() == BWAPI::UnitTypes::Protoss_Carrier && u->getInterceptorCount() < 4;\n\n}\n", "file_path": "Source/MicroRanged.cpp", "rank": 23, "score": 46388.418413187894 }, { "content": "\t\t\tBWAPI::Unit target = getTarget(rangedUnit, rangedUnitTargets);\n\n\t\t\tif (target)\n\n\t\t\t{\n\n\t\t\t\tif (Config::Debug::DrawUnitTargetInfo)\n\n\t\t\t\t{\n\n\t\t\t\t\tBWAPI::Broodwar->drawLineMap(rangedUnit->getPosition(), rangedUnit->getTargetPosition(), BWAPI::Colors::Purple);\n\n\t\t\t\t}\n\n\n\n\t\t\t\t// attack it\n\n\t\t\t\tif (Config::Micro::KiteWithRangedUnits)\n\n\t\t\t\t{\n\n\t\t\t\t\tif (rangedUnit->getType() == BWAPI::UnitTypes::Zerg_Mutalisk || rangedUnit->getType() == BWAPI::UnitTypes::Terran_Vulture)\n\n\t\t\t\t\t{\n\n\t\t\t\t\t\tMicro::MutaDanceTarget(rangedUnit, target);\n\n\t\t\t\t\t}\n\n\t\t\t\t\telse\n\n\t\t\t\t\t{\n\n\t\t\t\t\t\tMicro::SmartKiteTarget(rangedUnit, target);\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n", "file_path": "Source/MicroRanged.cpp", "rank": 24, "score": 46387.009323541235 }, { "content": "\t\t\t\telse\n\n\t\t\t\t{\n\n\t\t\t\t\tMicro::SmartAttackUnit(rangedUnit, target);\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\telse\n\n\t\t\t{\n\n\t\t\t\t// No target found. If we're not near the order position, go there.\n\n\t\t\t\tif (rangedUnit->getDistance(order.getPosition()) > 100)\n\n\t\t\t\t{\n\n\t\t\t\t\tMicro::SmartAttackMove(rangedUnit, order.getPosition());\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\n\n\n// This could return null if no target is worth attacking, but doesn't happen to.\n\nBWAPI::Unit MicroRanged::getTarget(BWAPI::Unit rangedUnit, const BWAPI::Unitset & targets)\n\n{\n", "file_path": "Source/MicroRanged.cpp", "rank": 25, "score": 46386.98562360152 }, { "content": " std::copy_if(targets.begin(), targets.end(), std::inserter(rangedUnitTargets, rangedUnitTargets.end()),\n\n\t\t[](BWAPI::Unit u) {\n\n\t\treturn\n\n\t\t\tu->isVisible() &&\n\n\t\t\tu->isDetected() &&\n\n\t\t\tu->getType() != BWAPI::UnitTypes::Zerg_Larva &&\n\n\t\t\tu->getType() != BWAPI::UnitTypes::Zerg_Egg &&\n\n\t\t\t!u->isStasised();\n\n\t});\n\n\n\n for (const auto rangedUnit : rangedUnits)\n\n\t{\n\n\t\tif (buildScarabOrInterceptor(rangedUnit))\n\n\t\t{\n\n\t\t\t// If we started one, no further action this frame.\n\n\t\t\tcontinue;\n\n\t\t}\n\n\n\n\t\t// Special case for irradiated zerg air units.\n\n\t\tif (rangedUnit->isIrradiated() && rangedUnit->getType().getRace() == BWAPI::Races::Zerg)\n", "file_path": "Source/MicroRanged.cpp", "rank": 26, "score": 46386.389261027245 }, { "content": "\t\t\n\n\t\t// Prefer targets that are already hurt.\n\n\t\tif (target->getType().getRace() == BWAPI::Races::Protoss && target->getShields() == 0)\n\n\t\t{\n\n\t\t\tscore += 32;\n\n\t\t}\n\n\t\tif (target->getHitPoints() < target->getType().maxHitPoints())\n\n\t\t{\n\n\t\t\tscore += 24;\n\n\t\t}\n\n\n\n\t\tBWAPI::DamageType damage = UnitUtil::GetWeapon(rangedUnit, target).damageType();\n\n\t\tif (damage == BWAPI::DamageTypes::Explosive)\n\n\t\t{\n\n\t\t\tif (target->getType().size() == BWAPI::UnitSizeTypes::Large)\n\n\t\t\t{\n\n\t\t\t\tscore += 32;\n\n\t\t\t}\n\n\t\t}\n\n\t\telse if (damage == BWAPI::DamageTypes::Concussive)\n", "file_path": "Source/MicroRanged.cpp", "rank": 27, "score": 46383.67900097899 }, { "content": "\t\treturn 6;\n\n\t}\n\n\tif (targetType == BWAPI::UnitTypes::Protoss_Pylon)\n\n\t{\n\n\t\treturn 5;\n\n\t}\n\n\tif (targetType == BWAPI::UnitTypes::Terran_Factory || targetType == BWAPI::UnitTypes::Terran_Armory)\n\n\t{\n\n\t\treturn 5;\n\n\t}\n\n\t// Downgrade unfinished/unpowered buildings, with exceptions.\n\n\tif (targetType.isBuilding() &&\n\n\t\t(!target->isCompleted() || !target->isPowered()) &&\n\n\t\t!(\ttargetType.isResourceDepot() ||\n\n\t\t\ttargetType.groundWeapon() != BWAPI::WeaponTypes::None ||\n\n\t\t\ttargetType.airWeapon() != BWAPI::WeaponTypes::None ||\n\n\t\t\ttargetType == BWAPI::UnitTypes::Terran_Bunker))\n\n\t{\n\n\t\treturn 2;\n\n\t}\n", "file_path": "Source/MicroRanged.cpp", "rank": 28, "score": 46383.55801973491 }, { "content": "\tconst BWAPI::UnitType rangedType = rangedUnit->getType();\n\n\tconst BWAPI::UnitType targetType = target->getType();\n\n\n\n\tif (rangedType == BWAPI::UnitTypes::Zerg_Scourge)\n\n {\n\n\t\tif (!targetType.isFlyer())\n\n\t\t{\n\n\t\t\t// Can't target it. Also, ignore lifted buildings.\n\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tif (targetType == BWAPI::UnitTypes::Zerg_Overlord ||\n\n\t\t\ttargetType == BWAPI::UnitTypes::Zerg_Scourge ||\n\n\t\t\ttargetType == BWAPI::UnitTypes::Protoss_Interceptor)\n\n\t\t{\n\n\t\t\t// Usually not worth scourge at all.\n\n\t\t\treturn 0;\n\n\t\t}\n\n\t\t\n\n\t\t// Everything else is the same. Hit whatever's closest.\n\n\t\treturn 10;\n", "file_path": "Source/MicroRanged.cpp", "rank": 29, "score": 46383.41145424937 }, { "content": "\t// Spellcasters are as important as key buildings.\n\n\t// Also remember to target other non-threat combat units.\n\n\tif (targetType.isSpellcaster() ||\n\n\t\ttargetType.groundWeapon() != BWAPI::WeaponTypes::None ||\n\n\t\ttargetType.airWeapon() != BWAPI::WeaponTypes::None)\n\n\t{\n\n\t\treturn 7;\n\n\t}\n\n\t// Templar tech and spawning pool are more important.\n\n\tif (targetType == BWAPI::UnitTypes::Protoss_Templar_Archives)\n\n\t{\n\n\t\treturn 7;\n\n\t}\n\n\tif (targetType == BWAPI::UnitTypes::Zerg_Spawning_Pool)\n\n\t{\n\n\t\treturn 7;\n\n\t}\n\n\t// Don't forget the nexus/cc/hatchery.\n\n\tif (targetType.isResourceDepot())\n\n\t{\n", "file_path": "Source/MicroRanged.cpp", "rank": 30, "score": 46382.72086577251 }, { "content": "\t\t// Carriers stay at home until they have enough interceptors to be useful,\n\n\t\t// or retreat toward home to rebuild them if they run low.\n\n\t\t// On attack-move so that they're not helpless, but that can cause problems too....\n\n\t\t// Potentially useful for other units.\n\n\t\t// NOTE Regrouping can cause the carriers to move away from home.\n\n\t\tif (stayHomeUntilReady(rangedUnit))\n\n\t\t{\n\n\t\t\tBWAPI::Position fleeTo(InformationManager::Instance().getMyMainBaseLocation()->getPosition());\n\n\t\t\tMicro::SmartAttackMove(rangedUnit, fleeTo);\n\n\t\t\tcontinue;\n\n\t\t}\n\n\n\n\t\tif (order.isCombatOrder())\n\n {\n\n\t\t\tif (unstickStuckUnit(rangedUnit))\n\n\t\t\t{\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\n\n\t\t\t// If a target can be found.\n", "file_path": "Source/MicroRanged.cpp", "rank": 31, "score": 46382.44138976413 }, { "content": "\t}\n\n\n\n\tif (rangedType == BWAPI::UnitTypes::Zerg_Devourer)\n\n\t{\n\n\t\tif (!target->isFlying())\n\n\t\t{\n\n\t\t\t// Can't target it.\n\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tif (targetType.isBuilding())\n\n\t\t{\n\n\t\t\t// A lifted building is less important.\n\n\t\t\treturn 1;\n\n\t\t}\n\n\n\n\t\t// Everything else is the same.\n\n\t\treturn 10;\n\n\t}\n\n\t\n\n\tif (rangedType == BWAPI::UnitTypes::Zerg_Guardian && target->isFlying())\n", "file_path": "Source/MicroRanged.cpp", "rank": 32, "score": 46382.38770157002 }, { "content": "\t\treturn 10;\n\n\t}\n\n\t// Also as bad are other dangerous things.\n\n\tif (targetType == BWAPI::UnitTypes::Terran_Science_Vessel ||\n\n\t\ttargetType == BWAPI::UnitTypes::Zerg_Scourge)\n\n\t{\n\n\t\treturn 10;\n\n\t}\n\n\t// Next are workers.\n\n\tif (targetType.isWorker()) \n\n\t{\n\n if (rangedUnit->getType() == BWAPI::UnitTypes::Terran_Vulture)\n\n {\n\n return 11;\n\n }\n\n\t\t// Repairing or blocking a choke makes you critical.\n\n\t\tif (target->isRepairing() || unitNearChokepoint(target))\n\n\t\t{\n\n\t\t\treturn 11;\n\n\t\t}\n", "file_path": "Source/MicroRanged.cpp", "rank": 33, "score": 46381.501905517856 }, { "content": "\t\t{\n\n\t\t\tif (target->isSieged() ||\n\n\t\t\t\ttarget->getOrder() == BWAPI::Orders::Sieging ||\n\n\t\t\t\ttarget->getOrder() == BWAPI::Orders::Unsieging)\n\n\t\t\t{\n\n\t\t\t\tscore += 48;\n\n\t\t\t}\n\n\t\t\telse\n\n\t\t\t{\n\n\t\t\t\tscore += 24;\n\n\t\t\t}\n\n\t\t}\n\n\t\telse if (target->isBraking())\n\n\t\t{\n\n\t\t\tscore += 16;\n\n\t\t}\n\n\t\telse if (target->getType().topSpeed() >= rangedUnit->getType().topSpeed())\n\n\t\t{\n\n\t\t\tscore -= 5 * 32;\n\n\t\t}\n", "file_path": "Source/MicroRanged.cpp", "rank": 34, "score": 46379.134029896195 }, { "content": "\telse\n\n\t{\n\n\t\t// Exceptions if we're a ground unit.\n\n\t\tif (targetType == BWAPI::UnitTypes::Terran_Vulture_Spider_Mine && !target->isBurrowed() ||\n\n\t\t\ttargetType == BWAPI::UnitTypes::Zerg_Infested_Terran)\n\n\t\t{\n\n\t\t\treturn 12;\n\n\t\t}\n\n\t}\n\n\n\n\tif (targetType == BWAPI::UnitTypes::Protoss_High_Templar)\n\n\t{\n\n\t\treturn 12;\n\n\t}\n\n\n\n\tif (targetType == BWAPI::UnitTypes::Protoss_Reaver)\n\n\t{\n\n\t\treturn 11;\n\n\t}\n\n\n", "file_path": "Source/MicroRanged.cpp", "rank": 35, "score": 46377.92883209711 }, { "content": "\t\t// SCVs constructing are also important.\n\n\t\tif (target->isConstructing())\n\n\t\t{\n\n\t\t\treturn 10;\n\n\t\t}\n\n\n\n \t\treturn 9;\n\n\t}\n\n\t// Important combat units that we may not have targeted above (esp. if we're a flyer).\n\n\tif (targetType == BWAPI::UnitTypes::Protoss_Carrier ||\n\n\t\ttargetType == BWAPI::UnitTypes::Terran_Siege_Tank_Tank_Mode ||\n\n\t\ttargetType == BWAPI::UnitTypes::Terran_Siege_Tank_Siege_Mode)\n\n\t{\n\n\t\treturn 8;\n\n\t}\n\n\t// Nydus canal is the most important building to kill.\n\n\tif (targetType == BWAPI::UnitTypes::Zerg_Nydus_Canal)\n\n\t{\n\n\t\treturn 9;\n\n\t}\n", "file_path": "Source/MicroRanged.cpp", "rank": 36, "score": 46377.46319076497 }, { "content": "\t\t{\n\n\t\t\tif (rangedUnit->isFlying())\n\n\t\t\t{\n\n\t\t\t\tif (rangedUnit->getDistance(order.getPosition()) < 300)\n\n\t\t\t\t{\n\n\t\t\t\t\tMicro::SmartAttackMove(rangedUnit, order.getPosition());\n\n\t\t\t\t}\n\n\t\t\t\telse\n\n\t\t\t\t{\n\n\t\t\t\t\tMicro::SmartMove(rangedUnit, order.getPosition());\n\n\t\t\t\t}\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\telse if (rangedUnit->canBurrow())\n\n\t\t\t{\n\n\t\t\t\trangedUnit->burrow();\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t}\n\n\n", "file_path": "Source/MicroRanged.cpp", "rank": 37, "score": 46376.11351309152 }, { "content": "\t{\n\n\t\t// Can't target it.\n\n\t\treturn 0;\n\n\t}\n\n\n\n\t// An addon other than a completed comsat is boring.\n\n\t// TODO should also check that it is attached\n\n\tif (targetType.isAddon() && !(targetType == BWAPI::UnitTypes::Terran_Comsat_Station && target->isCompleted()))\n\n\t{\n\n\t\treturn 1;\n\n\t}\n\n\n\n // if the target is building something near our base something is fishy\n\n BWAPI::Position ourBasePosition = BWAPI::Position(InformationManager::Instance().getMyMainBaseLocation()->getPosition());\n\n\tif (target->getDistance(ourBasePosition) < 1200) {\n\n\t\tif (target->getType().isWorker() && (target->isConstructing() || target->isRepairing()))\n\n\t\t{\n\n\t\t\treturn 12;\n\n\t\t}\n\n\t\tif (target->getType().isBuilding())\n", "file_path": "Source/MicroRanged.cpp", "rank": 38, "score": 46374.821599824456 }, { "content": "#include \"Common.h\"\n\n#include \"UnitData.h\"\n\n\n\nusing namespace XBot;\n\n\n\nUnitData::UnitData() \n\n\t: mineralsLost(0)\n\n\t, gasLost(0)\n\n{\n\n\tint maxTypeID(0);\n\n\tfor (const BWAPI::UnitType & t : BWAPI::UnitTypes::allUnitTypes())\n\n\t{\n\n\t\tmaxTypeID = maxTypeID > t.getID() ? maxTypeID : t.getID();\n\n\t}\n\n\n\n\tnumUnits\t\t= std::vector<int>(maxTypeID + 1, 0);\n\n\tnumDeadUnits\t= std::vector<int>(maxTypeID + 1, 0);\n\n}\n\n\n\nvoid UnitData::updateUnit(BWAPI::Unit unit)\n", "file_path": "Source/UnitData.cpp", "rank": 49, "score": 46354.27581661133 }, { "content": "{\n\n\tif (!unit) { return; }\n\n\n\n bool firstSeen = false;\n\n auto & it = unitMap.find(unit);\n\n if (it == unitMap.end())\n\n {\n\n firstSeen = true;\n\n unitMap[unit] = UnitInfo();\n\n }\n\n \n\n\tUnitInfo & ui = unitMap[unit];\n\n ui.unit = unit;\n\n\tui.updateFrame\t= BWAPI::Broodwar->getFrameCount();\n\n ui.player = unit->getPlayer();\n\n\tui.lastPosition = unit->getPosition();\n\n\tui.lastTilePosition = unit->getTilePosition();\n\n\tui.lastHealth = unit->getHitPoints();\n\n ui.lastShields = unit->getShields();\n\n\tui.unitID = unit->getID();\n", "file_path": "Source/UnitData.cpp", "rank": 56, "score": 46344.66420100084 }, { "content": "const bool UnitData::badUnitInfo(const UnitInfo & ui) const\n\n{\n\n if (!ui.unit)\n\n {\n\n return false;\n\n }\n\n\n\n\t// Cull away any refineries/assimilators/extractors that were destroyed and reverted to vespene geysers\n\n\tif (ui.unit->getType() == BWAPI::UnitTypes::Resource_Vespene_Geyser)\n\n\t{ \n\n\t\treturn true;\n\n\t}\n\n\n\n\t// If the unit is a building and we can currently see its position and it is not there.\n\n\t// NOTE A terran building could have lifted off and moved away.\n\n\tif (ui.type.isBuilding() && BWAPI::Broodwar->isVisible(ui.lastPosition.x/32, ui.lastPosition.y/32) && !ui.unit->isVisible())\n\n\t{\n\n\t\treturn true;\n\n\t}\n\n\n", "file_path": "Source/UnitData.cpp", "rank": 57, "score": 46344.431224355074 }, { "content": "\t// NOTE This assert fails, so the unit counts cannot be trusted. :-(\n\n\t// UAB_ASSERT(numUnits[unit->getType().getID()] >= 0, \"negative units\");\n\n}\n\n\n\nvoid UnitData::removeBadUnits()\n\n{\n\n\tfor (auto iter(unitMap.begin()); iter != unitMap.end();)\n\n\t{\n\n\t\tif (badUnitInfo(iter->second))\n\n\t\t{\n\n\t\t\tnumUnits[iter->second.type.getID()]--;\n\n\t\t\titer = unitMap.erase(iter);\n\n\t\t}\n\n\t\telse\n\n\t\t{\n\n\t\t\titer++;\n\n\t\t}\n\n\t}\n\n}\n\n\n", "file_path": "Source/UnitData.cpp", "rank": 59, "score": 46343.15368789241 }, { "content": "\treturn false;\n\n}\n\n\n\nint UnitData::getGasLost() const \n\n{ \n\n return gasLost; \n\n}\n\n\n\nint UnitData::getMineralsLost() const \n\n{ \n\n return mineralsLost; \n\n}\n\n\n\nint UnitData::getNumUnits(BWAPI::UnitType t) const \n\n{ \n\n return numUnits[t.getID()]; \n\n}\n\n\n\nint UnitData::getNumDeadUnits(BWAPI::UnitType t) const \n\n{ \n", "file_path": "Source/UnitData.cpp", "rank": 60, "score": 46342.91219198512 }, { "content": "\tui.type = unit->getType();\n\n ui.completed = unit->isCompleted();\n\n\n\n if (firstSeen)\n\n {\n\n numUnits[unit->getType().getID()]++;\n\n }\n\n}\n\n\n\nvoid UnitData::removeUnit(BWAPI::Unit unit)\n\n{\n\n\tif (!unit) { return; }\n\n\n\n\tmineralsLost += unit->getType().mineralPrice();\n\n\tgasLost += unit->getType().gasPrice();\n\n\t--numUnits[unit->getType().getID()];\n\n\t++numDeadUnits[unit->getType().getID()];\n\n\t\n\n\tunitMap.erase(unit);\n\n\n", "file_path": "Source/UnitData.cpp", "rank": 61, "score": 46338.30108266939 }, { "content": " return numDeadUnits[t.getID()]; \n\n}\n\n\n\nconst std::map<BWAPI::Unit,UnitInfo> & UnitData::getUnits() const \n\n{ \n\n return unitMap; \n\n}\n\n\n\nconst UnitInfo * UnitData::getUnit(BWAPI::Unit unit) const\n\n{\n\n\tif (unitMap.find(unit) != unitMap.end())\n\n\t{\n\n\t\treturn &unitMap.at(unit);\n\n\t}\n\n\treturn nullptr;\n\n}", "file_path": "Source/UnitData.cpp", "rank": 62, "score": 46336.63464265848 }, { "content": "enum class ExtractorTrick { None, Start, ExtractorOrdered, UnitOrdered, MakeUnitBypass };\n\n\n", "file_path": "Source/ProductionManager.h", "rank": 63, "score": 44594.43919522029 }, { "content": "class Double {\n\npublic:\n\n Double() {}\n\n Double(double d) : d_(d) {}\n\n Double(uint64_t u) : u_(u) {}\n\n\n\n double Value() const { return d_; }\n\n uint64_t Uint64Value() const { return u_; }\n\n\n\n double NextPositiveDouble() const {\n\n RAPIDJSON_ASSERT(!Sign());\n\n return Double(u_ + 1).Value();\n\n }\n\n\n\n bool Sign() const { return (u_ & kSignMask) != 0; }\n\n uint64_t Significand() const { return u_ & kSignificandMask; }\n\n int Exponent() const { return static_cast<int>(((u_ & kExponentMask) >> kSignificandSize) - kExponentBias); }\n\n\n\n bool IsNan() const { return (u_ & kExponentMask) == kExponentMask && Significand() != 0; }\n\n bool IsInf() const { return (u_ & kExponentMask) == kExponentMask && Significand() == 0; }\n", "file_path": "Source/rapidjson/internal/ieee754.h", "rank": 64, "score": 44507.477484396084 }, { "content": "class UnitToAssign\n\n{\n\npublic:\n\n\n\n\tBWAPI::Unit unit;\n\n\tbool isAssigned;\n\n\n\n\tUnitToAssign(BWAPI::Unit u)\n\n\t{\n\n\t\tunit = u;\n\n\t\tisAssigned = false;\n\n\t}\n\n};\n\n\n", "file_path": "Source/GameCommander.h", "rank": 65, "score": 44411.32461346539 }, { "content": " class NumberStream<InputStream, true> : public NumberStream<InputStream, false> {\n\n typedef NumberStream<InputStream, false> Base;\n\n public:\n\n NumberStream(GenericReader& reader, InputStream& is) : NumberStream<InputStream, false>(reader, is), stackStream(reader.stack_) {}\n\n ~NumberStream() {}\n\n\n\n RAPIDJSON_FORCEINLINE Ch TakePush() {\n\n stackStream.Put((char)Base::is.Peek());\n\n return Base::is.Take();\n\n }\n\n\n\n size_t Length() { return stackStream.Length(); }\n\n\n\n const char* Pop() {\n\n stackStream.Put('\\0');\n\n return stackStream.Pop();\n\n }\n\n\n\n private:\n\n StackStream<char> stackStream;\n", "file_path": "Source/rapidjson/reader.h", "rank": 66, "score": 43366.10040762825 }, { "content": "class Area : public utils::Markable<Area, int>, public utils::UserData\n\n{\n\npublic:\n\n\ttypedef int16_t\t\t\t\t\tid;\n\n\n\n\ttypedef int16_t\t\t\t\t\tgroupId;\n\n\n\n\t// Unique id > 0 of this Area. Range = 1 .. Map::Areas().size()\n\n\t// this == Map::GetArea(Id())\n\n\t// Id() == Map::GetMiniTile(w).AreaId() for each walkable MiniTile w in this Area.\n\n\t// Area::ids are guaranteed to remain unchanged.\n\n\tid\t\t\t\t\t\t\t\tId() const\t\t\t\t\t\t{ return m_id; }\n\n\n\n\t// Unique id > 0 of the group of Areas which are accessible from this Area.\n\n\t// For each pair (a, b) of Areas: a->GroupId() == b->GroupId() <==> a->AccessibleFrom(b)\n\n\t// A groupId uniquely identifies a maximum set of mutually accessible Areas, that is, in the absence of blocking ChokePoints, a continent.\n\n\tgroupId\t\t\t\t\t\t\tGroupId() const\t\t\t\t\t{ return m_groupId; }\n\n\n\n\t// Bounding box of this Area.\n\n\tconst BWAPI::TilePosition &\t\tTopLeft() const\t\t\t\t\t{ return m_topLeft ; }\n", "file_path": "Source/bwem/area.h", "rank": 67, "score": 42569.428153901914 }, { "content": "class Tile : public utils::Markable<Tile, int>, public utils::UserData\n\n{\n\npublic:\n\n\t// Corresponds to BWAPI::isBuildable\n\n\t// Note: BWEM enforces the relation buildable ==> walkable (Cf. MiniTile::Walkable)\n\n\tbool\t\t\t\tBuildable() const\t\t\t\t{ return m_bits.buildable; }\n\n\n\n\t// Tile::AreaId() somewhat aggregates the MiniTile::AreaId() values of the 4 x 4 sub-MiniTiles.\n\n\t// Let S be the set of MiniTile::AreaId() values for each walkable MiniTile in this Tile.\n\n\t// If empty(S), returns 0. Note: in this case, no contained MiniTile is walkable, so all of them have their AreaId() == 0.\n\n\t// If S = {a}, returns a (whether positive or negative).\n\n\t// If size(S) > 1 returns -1 (note that -1 is never returned by MiniTile::AreaId()).\n\n\tArea::id\t\t\tAreaId() const\t\t\t\t\t{ return m_areaId; }\n\n\n\n\t// Tile::MinAltitude() somewhat aggregates the MiniTile::Altitude() values of the 4 x 4 sub-MiniTiles.\n\n\t// Returns the minimum value.\n\n\taltitude_t\t\t\tMinAltitude() const\t\t\t\t{ return m_minAltitude; }\n\n\n\n\t// Tells if at least one of the sub-MiniTiles is Walkable.\n\n\tbool\t\t\t\tWalkable() const\t\t\t\t{ return m_areaId != 0; }\n", "file_path": "Source/bwem/tiles.h", "rank": 68, "score": 42569.428153901914 }, { "content": "class AutoUTFOutputStream {\n\n RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);\n\npublic:\n\n typedef CharType Ch;\n\n\n\n //! Constructor.\n\n /*!\n\n \\param os output stream to be wrapped.\n\n \\param type UTF encoding type.\n\n \\param putBOM Whether to write BOM at the beginning of the stream.\n\n */\n\n AutoUTFOutputStream(OutputByteStream& os, UTFType type, bool putBOM) : os_(&os), type_(type) {\n\n RAPIDJSON_ASSERT(type >= kUTF8 && type <= kUTF32BE);\n\n\n\n // Runtime check whether the size of character type is sufficient. It only perform checks with assertion.\n\n if (type_ == kUTF16LE || type_ == kUTF16BE) RAPIDJSON_ASSERT(sizeof(Ch) >= 2);\n\n if (type_ == kUTF32LE || type_ == kUTF32BE) RAPIDJSON_ASSERT(sizeof(Ch) >= 4);\n\n\n\n static const PutFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Put) };\n\n putFunc_ = f[type_];\n", "file_path": "Source/rapidjson/encodedstream.h", "rank": 69, "score": 41109.2264147653 }, { "content": "class AutoUTFInputStream {\n\n RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);\n\npublic:\n\n typedef CharType Ch;\n\n\n\n //! Constructor.\n\n /*!\n\n \\param is input stream to be wrapped.\n\n \\param type UTF encoding type if it is not detected from the stream.\n\n */\n\n AutoUTFInputStream(InputByteStream& is, UTFType type = kUTF8) : is_(&is), type_(type), hasBOM_(false) {\n\n RAPIDJSON_ASSERT(type >= kUTF8 && type <= kUTF32BE); \n\n DetectType();\n\n static const TakeFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Take) };\n\n takeFunc_ = f[type_];\n\n current_ = takeFunc_(*is_);\n\n }\n\n\n\n UTFType GetType() const { return type_; }\n\n bool HasBOM() const { return hasBOM_; }\n", "file_path": "Source/rapidjson/encodedstream.h", "rank": 70, "score": 41109.2264147653 }, { "content": "enum class MacroCommandType\n\n\t{ None\n\n\t, Scout\n\n\t, ScoutIfNeeded\n\n\t, ScoutLocation\n\n\t, StartGas\n\n\t, StopGas\n\n\t, GasUntil\n\n\t, StealGas\n\n\t, ExtractorTrickDrone\n\n\t, ExtractorTrickZergling\n\n\t, Aggressive\n\n\t, Defensive\n\n\t, PullWorkers\n\n\t, PullWorkersLeaving\n\n\t, ReleaseWorkers\n\n\t, UntilFindEnemy\n\n\t, DroneEnemyNatural\n\n\t, IgnoreScoutWorker\n\n\t};\n\n\n", "file_path": "Source/MacroCommand.h", "rank": 71, "score": 41106.65276351931 }, { "content": "class ChokePoint : public utils::Markable<ChokePoint, int>, public utils::UserData\n\n{\n\npublic:\n\n\t// ChokePoint::middle denotes the \"middle\" MiniTile of Geometry(), while\n\n\t// ChokePoint::end1 and ChokePoint::end2 denote its \"ends\".\n\n\t// It is guaranteed that, among all the MiniTiles of Geometry(), ChokePoint::middle has the highest altitude value (Cf. MiniTile::Altitude()).\n\n\tenum node {end1, middle, end2, node_count};\n\n\n\n\t// Type of all the Paths used in BWEM (Cf. Map::GetPath).\n\n\t// See also the typedef CPPath.\n\n\ttypedef std::vector<const ChokePoint *> Path;\n\n\n\n\t// Tells whether this ChokePoint is a pseudo ChokePoint, i.e., it was created on top of a blocking Neutral.\n\n\tbool\t\t\t\t\t\t\t\t\tIsPseudo() const\t\t{ return m_pseudo; }\n\n\n\n\t// Returns the two Areas of this ChokePoint.\n\n\tconst std::pair<const Area *, const Area *> & GetAreas() const\t{ return m_Areas; }\n\n\n\n\t// Returns the center of this ChokePoint.\n\n\tconst BWAPI::WalkPosition &\t\t\t\tCenter() const\t\t\t{ return Pos(middle); }\n", "file_path": "Source/bwem/cp.h", "rank": 72, "score": 40613.45464539064 }, { "content": "RAPIDJSON_NAMESPACE_BEGIN\n", "file_path": "Source/rapidjson/rapidjson.h", "rank": 73, "score": 39602.820891650474 }, { "content": "struct IsGenericValueImpl : FalseType {};\n\n\n\n// select candidates according to nested encoding and allocator types\n\ntemplate <typename T> struct IsGenericValueImpl<T, typename Void<typename T::EncodingType>::Type, typename Void<typename T::AllocatorType>::Type>\n\n : IsBaseOf<GenericValue<typename T::EncodingType, typename T::AllocatorType>, T>::Type {};\n\n\n\n// helper to match arbitrary GenericValue instantiations, including derived classes\n\ntemplate <typename T> struct IsGenericValue : IsGenericValueImpl<T>::Type {};\n\n\n\n} // namespace internal\n\n\n\n///////////////////////////////////////////////////////////////////////////////\n\n// GenericValue\n\n\n\n//! Represents a JSON value. Use Value for UTF8 encoding and default allocator.\n\n/*!\n\n A JSON value can be one of 7 types. This class is a variant type supporting\n\n these types.\n\n\n\n Use the Value if UTF8 and default allocator\n\n\n\n \\tparam Encoding Encoding of the value. (Even non-string values need to have the same encoding in a document)\n\n \\tparam Allocator Allocator type for allocating memory of object, array and string.\n\n*/\n\ntemplate <typename Encoding, typename Allocator = MemoryPoolAllocator<> > \n", "file_path": "Source/rapidjson/document.h", "rank": 74, "score": 39595.06440173808 }, { "content": "int GetIntFromString(const std::string & s);\n", "file_path": "Source/Common.h", "rank": 75, "score": 38212.563502770114 }, { "content": "#define _USE_MATH_DEFINES\n", "file_path": "Source/Common.h", "rank": 76, "score": 38193.09348343703 }, { "content": " double ToDouble() const {\n\n union {\n\n double d;\n\n uint64_t u64;\n\n }u;\n\n const uint64_t be = (e == kDpDenormalExponent && (f & kDpHiddenBit) == 0) ? 0 : \n\n static_cast<uint64_t>(e + kDpExponentBias);\n\n u.u64 = (f & kDpSignificandMask) | (be << kDpSignificandSize);\n\n return u.d;\n", "file_path": "Source/rapidjson/internal/diyfp.h", "rank": 77, "score": 38193.09348343703 }, { "content": "RAPIDJSON_NAMESPACE_BEGIN\n\n\n\n///////////////////////////////////////////////////////////////////////////////\n\n// Encoding\n\n\n\n/*! \\class rapidjson::Encoding\n\n \\brief Concept for encoding of Unicode characters.\n\n\n\n\\code\n\nconcept Encoding {\n\n typename Ch; //! Type of character. A \"character\" is actually a code unit in unicode's definition.\n\n\n\n enum { supportUnicode = 1 }; // or 0 if not supporting unicode\n\n\n\n //! \\brief Encode a Unicode codepoint to an output stream.\n\n //! \\param os Output stream.\n\n //! \\param codepoint An unicode codepoint, ranging from 0x0 to 0x10FFFF inclusively.\n\n template<typename OutputStream>\n\n static void Encode(OutputStream& os, unsigned codepoint);\n\n\n\n //! \\brief Decode a Unicode codepoint from an input stream.\n\n //! \\param is Input stream.\n\n //! \\param codepoint Output of the unicode codepoint.\n\n //! \\return true if a valid codepoint can be decoded from the stream.\n\n template <typename InputStream>\n\n static bool Decode(InputStream& is, unsigned* codepoint);\n\n\n\n //! \\brief Validate one Unicode codepoint from an encoded stream.\n\n //! \\param is Input stream to obtain codepoint.\n\n //! \\param os Output for copying one codepoint.\n\n //! \\return true if it is valid.\n\n //! \\note This function just validating and copying the codepoint without actually decode it.\n\n template <typename InputStream, typename OutputStream>\n\n static bool Validate(InputStream& is, OutputStream& os);\n\n\n\n // The following functions are deal with byte streams.\n\n\n\n //! Take a character from input byte stream, skip BOM if exist.\n\n template <typename InputByteStream>\n\n static CharType TakeBOM(InputByteStream& is);\n\n\n\n //! Take a character from input byte stream.\n\n template <typename InputByteStream>\n\n static Ch Take(InputByteStream& is);\n\n\n\n //! Put BOM to output byte stream.\n\n template <typename OutputByteStream>\n\n static void PutBOM(OutputByteStream& os);\n\n\n\n //! Put a character to output byte stream.\n\n template <typename OutputByteStream>\n\n static void Put(OutputByteStream& os, Ch c);\n\n};\n\n\\endcode\n\n*/\n\n\n\n///////////////////////////////////////////////////////////////////////////////\n\n// UTF8\n\n\n\n//! UTF-8 encoding.\n\n/*! http://en.wikipedia.org/wiki/UTF-8\n\n http://tools.ietf.org/html/rfc3629\n\n \\tparam CharType Code unit for storing 8-bit UTF-8 data. Default is char.\n\n \\note implements Encoding concept\n\n*/\n\ntemplate<typename CharType = char>\n\nstruct UTF8 {\n\n typedef CharType Ch;\n\n\n\n enum { supportUnicode = 1 };\n\n\n\n template<typename OutputStream>\n\n static void Encode(OutputStream& os, unsigned codepoint) {\n\n if (codepoint <= 0x7F) \n\n os.Put(static_cast<Ch>(codepoint & 0xFF));\n\n else if (codepoint <= 0x7FF) {\n\n os.Put(static_cast<Ch>(0xC0 | ((codepoint >> 6) & 0xFF)));\n\n os.Put(static_cast<Ch>(0x80 | ((codepoint & 0x3F))));\n\n }\n\n else if (codepoint <= 0xFFFF) {\n\n os.Put(static_cast<Ch>(0xE0 | ((codepoint >> 12) & 0xFF)));\n\n os.Put(static_cast<Ch>(0x80 | ((codepoint >> 6) & 0x3F)));\n\n os.Put(static_cast<Ch>(0x80 | (codepoint & 0x3F)));\n\n }\n\n else {\n\n RAPIDJSON_ASSERT(codepoint <= 0x10FFFF);\n\n os.Put(static_cast<Ch>(0xF0 | ((codepoint >> 18) & 0xFF)));\n\n os.Put(static_cast<Ch>(0x80 | ((codepoint >> 12) & 0x3F)));\n\n os.Put(static_cast<Ch>(0x80 | ((codepoint >> 6) & 0x3F)));\n\n os.Put(static_cast<Ch>(0x80 | (codepoint & 0x3F)));\n\n }\n", "file_path": "Source/rapidjson/encodings.h", "rank": 78, "score": 38190.70239726967 }, { "content": "RAPIDJSON_NAMESPACE_BEGIN\n\nnamespace internal {\n\n\n\n//! Computes integer powers of 10 in double (10.0^n).\n\n/*! This function uses lookup table for fast and accurate results.\n\n \\param n non-negative exponent. Must <= 308.\n\n \\return 10.0^n\n\n*/\n\ninline double Pow10(int n) {\n\n static const double e[] = { // 1e-0...1e308: 309 * 8 bytes = 2472 bytes\n\n 1e+0, \n\n 1e+1, 1e+2, 1e+3, 1e+4, 1e+5, 1e+6, 1e+7, 1e+8, 1e+9, 1e+10, 1e+11, 1e+12, 1e+13, 1e+14, 1e+15, 1e+16, 1e+17, 1e+18, 1e+19, 1e+20, \n\n 1e+21, 1e+22, 1e+23, 1e+24, 1e+25, 1e+26, 1e+27, 1e+28, 1e+29, 1e+30, 1e+31, 1e+32, 1e+33, 1e+34, 1e+35, 1e+36, 1e+37, 1e+38, 1e+39, 1e+40,\n\n 1e+41, 1e+42, 1e+43, 1e+44, 1e+45, 1e+46, 1e+47, 1e+48, 1e+49, 1e+50, 1e+51, 1e+52, 1e+53, 1e+54, 1e+55, 1e+56, 1e+57, 1e+58, 1e+59, 1e+60,\n\n 1e+61, 1e+62, 1e+63, 1e+64, 1e+65, 1e+66, 1e+67, 1e+68, 1e+69, 1e+70, 1e+71, 1e+72, 1e+73, 1e+74, 1e+75, 1e+76, 1e+77, 1e+78, 1e+79, 1e+80,\n\n 1e+81, 1e+82, 1e+83, 1e+84, 1e+85, 1e+86, 1e+87, 1e+88, 1e+89, 1e+90, 1e+91, 1e+92, 1e+93, 1e+94, 1e+95, 1e+96, 1e+97, 1e+98, 1e+99, 1e+100,\n\n 1e+101,1e+102,1e+103,1e+104,1e+105,1e+106,1e+107,1e+108,1e+109,1e+110,1e+111,1e+112,1e+113,1e+114,1e+115,1e+116,1e+117,1e+118,1e+119,1e+120,\n\n 1e+121,1e+122,1e+123,1e+124,1e+125,1e+126,1e+127,1e+128,1e+129,1e+130,1e+131,1e+132,1e+133,1e+134,1e+135,1e+136,1e+137,1e+138,1e+139,1e+140,\n\n 1e+141,1e+142,1e+143,1e+144,1e+145,1e+146,1e+147,1e+148,1e+149,1e+150,1e+151,1e+152,1e+153,1e+154,1e+155,1e+156,1e+157,1e+158,1e+159,1e+160,\n\n 1e+161,1e+162,1e+163,1e+164,1e+165,1e+166,1e+167,1e+168,1e+169,1e+170,1e+171,1e+172,1e+173,1e+174,1e+175,1e+176,1e+177,1e+178,1e+179,1e+180,\n\n 1e+181,1e+182,1e+183,1e+184,1e+185,1e+186,1e+187,1e+188,1e+189,1e+190,1e+191,1e+192,1e+193,1e+194,1e+195,1e+196,1e+197,1e+198,1e+199,1e+200,\n\n 1e+201,1e+202,1e+203,1e+204,1e+205,1e+206,1e+207,1e+208,1e+209,1e+210,1e+211,1e+212,1e+213,1e+214,1e+215,1e+216,1e+217,1e+218,1e+219,1e+220,\n\n 1e+221,1e+222,1e+223,1e+224,1e+225,1e+226,1e+227,1e+228,1e+229,1e+230,1e+231,1e+232,1e+233,1e+234,1e+235,1e+236,1e+237,1e+238,1e+239,1e+240,\n\n 1e+241,1e+242,1e+243,1e+244,1e+245,1e+246,1e+247,1e+248,1e+249,1e+250,1e+251,1e+252,1e+253,1e+254,1e+255,1e+256,1e+257,1e+258,1e+259,1e+260,\n\n 1e+261,1e+262,1e+263,1e+264,1e+265,1e+266,1e+267,1e+268,1e+269,1e+270,1e+271,1e+272,1e+273,1e+274,1e+275,1e+276,1e+277,1e+278,1e+279,1e+280,\n\n 1e+281,1e+282,1e+283,1e+284,1e+285,1e+286,1e+287,1e+288,1e+289,1e+290,1e+291,1e+292,1e+293,1e+294,1e+295,1e+296,1e+297,1e+298,1e+299,1e+300,\n\n 1e+301,1e+302,1e+303,1e+304,1e+305,1e+306,1e+307,1e+308\n\n };\n\n RAPIDJSON_ASSERT(n >= 0 && n <= 308);\n\n return e[n];\n\n}\n\n\n", "file_path": "Source/rapidjson/internal/pow10.h", "rank": 79, "score": 38181.47191615001 }, { "content": "RAPIDJSON_NAMESPACE_BEGIN\n\nnamespace internal {\n\n\n\n#ifdef __GNUC__\n\nRAPIDJSON_DIAG_PUSH\n\nRAPIDJSON_DIAG_OFF(effc++)\n\n#endif\n\n\n\ninline void GrisuRound(char* buffer, int len, uint64_t delta, uint64_t rest, uint64_t ten_kappa, uint64_t wp_w) {\n\n while (rest < wp_w && delta - rest >= ten_kappa &&\n\n (rest + ten_kappa < wp_w || /// closer\n\n wp_w - rest > rest + ten_kappa - wp_w)) {\n\n buffer[len - 1]--;\n\n rest += ten_kappa;\n\n }\n\n}\n\n\n\ninline unsigned CountDecimalDigit32(uint32_t n) {\n\n // Simple pure C++ implementation was faster than __builtin_clz version in this situation.\n\n if (n < 10) return 1;\n\n if (n < 100) return 2;\n\n if (n < 1000) return 3;\n\n if (n < 10000) return 4;\n\n if (n < 100000) return 5;\n\n if (n < 1000000) return 6;\n\n if (n < 10000000) return 7;\n\n if (n < 100000000) return 8;\n\n // Will not reach 10 digits in DigitGen()\n\n //if (n < 1000000000) return 9;\n\n //return 10;\n\n return 9;\n\n}\n\n\n\ninline void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, char* buffer, int* len, int* K) {\n\n static const uint32_t kPow10[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 };\n\n const DiyFp one(uint64_t(1) << -Mp.e, Mp.e);\n\n const DiyFp wp_w = Mp - W;\n\n uint32_t p1 = static_cast<uint32_t>(Mp.f >> -one.e);\n\n uint64_t p2 = Mp.f & (one.f - 1);\n\n int kappa = CountDecimalDigit32(p1); // kappa in [0, 9]\n\n *len = 0;\n\n\n\n while (kappa > 0) {\n\n uint32_t d = 0;\n\n switch (kappa) {\n\n case 9: d = p1 / 100000000; p1 %= 100000000; break;\n\n case 8: d = p1 / 10000000; p1 %= 10000000; break;\n\n case 7: d = p1 / 1000000; p1 %= 1000000; break;\n\n case 6: d = p1 / 100000; p1 %= 100000; break;\n\n case 5: d = p1 / 10000; p1 %= 10000; break;\n\n case 4: d = p1 / 1000; p1 %= 1000; break;\n\n case 3: d = p1 / 100; p1 %= 100; break;\n\n case 2: d = p1 / 10; p1 %= 10; break;\n\n case 1: d = p1; p1 = 0; break;\n\n default:;\n\n }\n\n if (d || *len)\n\n buffer[(*len)++] = static_cast<char>('0' + static_cast<char>(d));\n\n kappa--;\n\n uint64_t tmp = (static_cast<uint64_t>(p1) << -one.e) + p2;\n\n if (tmp <= delta) {\n\n *K += kappa;\n\n GrisuRound(buffer, *len, delta, tmp, static_cast<uint64_t>(kPow10[kappa]) << -one.e, wp_w.f);\n\n return;\n\n }\n\n }\n\n\n\n // kappa = 0\n\n for (;;) {\n\n p2 *= 10;\n\n delta *= 10;\n\n char d = static_cast<char>(p2 >> -one.e);\n\n if (d || *len)\n\n buffer[(*len)++] = static_cast<char>('0' + d);\n\n p2 &= one.f - 1;\n\n kappa--;\n\n if (p2 < delta) {\n\n *K += kappa;\n\n GrisuRound(buffer, *len, delta, p2, one.f, wp_w.f * kPow10[-kappa]);\n\n return;\n\n }\n\n }\n\n}\n\n\n\ninline void Grisu2(double value, char* buffer, int* length, int* K) {\n\n const DiyFp v(value);\n\n DiyFp w_m, w_p;\n\n v.NormalizedBoundaries(&w_m, &w_p);\n\n\n\n const DiyFp c_mk = GetCachedPower(w_p.e, K);\n\n const DiyFp W = v.Normalize() * c_mk;\n\n DiyFp Wp = w_p * c_mk;\n\n DiyFp Wm = w_m * c_mk;\n\n Wm.f++;\n\n Wp.f--;\n\n DigitGen(W, Wp, Wp.f - Wm.f, buffer, length, K);\n\n}\n\n\n\ninline char* WriteExponent(int K, char* buffer) {\n\n if (K < 0) {\n\n *buffer++ = '-';\n\n K = -K;\n\n }\n\n\n\n if (K >= 100) {\n\n *buffer++ = static_cast<char>('0' + static_cast<char>(K / 100));\n\n K %= 100;\n\n const char* d = GetDigitsLut() + K * 2;\n\n *buffer++ = d[0];\n\n *buffer++ = d[1];\n\n }\n\n else if (K >= 10) {\n\n const char* d = GetDigitsLut() + K * 2;\n\n *buffer++ = d[0];\n\n *buffer++ = d[1];\n\n }\n\n else\n\n *buffer++ = static_cast<char>('0' + static_cast<char>(K));\n\n\n\n return buffer;\n\n}\n\n\n\ninline char* Prettify(char* buffer, int length, int k) {\n\n const int kk = length + k; // 10^(kk-1) <= v < 10^kk\n\n\n\n if (length <= kk && kk <= 21) {\n\n // 1234e7 -> 12340000000\n\n for (int i = length; i < kk; i++)\n\n buffer[i] = '0';\n\n buffer[kk] = '.';\n\n buffer[kk + 1] = '0';\n\n return &buffer[kk + 2];\n\n }\n\n else if (0 < kk && kk <= 21) {\n\n // 1234e-2 -> 12.34\n\n std::memmove(&buffer[kk + 1], &buffer[kk], length - kk);\n\n buffer[kk] = '.';\n\n return &buffer[length + 1];\n\n }\n\n else if (-6 < kk && kk <= 0) {\n\n // 1234e-6 -> 0.001234\n\n const int offset = 2 - kk;\n\n std::memmove(&buffer[offset], &buffer[0], length);\n\n buffer[0] = '0';\n\n buffer[1] = '.';\n\n for (int i = 2; i < offset; i++)\n\n buffer[i] = '0';\n\n return &buffer[length + offset];\n\n }\n\n else if (length == 1) {\n\n // 1e30\n\n buffer[1] = 'e';\n\n return WriteExponent(kk - 1, &buffer[2]);\n\n }\n\n else {\n\n // 1234e30 -> 1.234e33\n\n std::memmove(&buffer[2], &buffer[1], length - 1);\n\n buffer[1] = '.';\n\n buffer[length + 1] = 'e';\n\n return WriteExponent(kk - 1, &buffer[0 + length + 2]);\n\n }\n\n}\n\n\n\ninline char* dtoa(double value, char* buffer) {\n\n Double d(value);\n\n if (d.IsZero()) {\n\n if (d.Sign())\n\n *buffer++ = '-'; // -0.0, Issue #289\n\n buffer[0] = '0';\n\n buffer[1] = '.';\n\n buffer[2] = '0';\n\n return &buffer[3];\n\n }\n\n else {\n\n if (value < 0) {\n\n *buffer++ = '-';\n\n value = -value;\n\n }\n\n int length, K;\n\n Grisu2(value, buffer, &length, &K);\n\n return Prettify(buffer, length, K);\n\n }\n\n}\n\n\n\n#ifdef __GNUC__\n\nRAPIDJSON_DIAG_POP\n\n#endif\n\n\n", "file_path": "Source/rapidjson/internal/dtoa.h", "rank": 80, "score": 38181.47191615001 }, { "content": "RAPIDJSON_NAMESPACE_BEGIN\n\nnamespace internal {\n\n\n\ninline double FastPath(double significand, int exp) {\n\n if (exp < -308)\n\n return 0.0;\n\n else if (exp >= 0)\n\n return significand * internal::Pow10(exp);\n\n else\n\n return significand / internal::Pow10(-exp);\n\n}\n\n\n\ninline double StrtodNormalPrecision(double d, int p) {\n\n if (p < -308) {\n\n // Prevent expSum < -308, making Pow10(p) = 0\n\n d = FastPath(d, -308);\n\n d = FastPath(d, p + 308);\n\n }\n\n else\n\n d = FastPath(d, p);\n\n return d;\n\n}\n\n\n\ntemplate <typename T>\n\ninline T Min3(T a, T b, T c) {\n\n T m = a;\n\n if (m > b) m = b;\n\n if (m > c) m = c;\n\n return m;\n\n}\n\n\n\ninline int CheckWithinHalfULP(double b, const BigInteger& d, int dExp) {\n\n const Double db(b);\n\n const uint64_t bInt = db.IntegerSignificand();\n\n const int bExp = db.IntegerExponent();\n\n const int hExp = bExp - 1;\n\n\n\n int dS_Exp2 = 0, dS_Exp5 = 0, bS_Exp2 = 0, bS_Exp5 = 0, hS_Exp2 = 0, hS_Exp5 = 0;\n\n\n\n // Adjust for decimal exponent\n\n if (dExp >= 0) {\n\n dS_Exp2 += dExp;\n\n dS_Exp5 += dExp;\n\n }\n\n else {\n\n bS_Exp2 -= dExp;\n\n bS_Exp5 -= dExp;\n\n hS_Exp2 -= dExp;\n\n hS_Exp5 -= dExp;\n\n }\n\n\n\n // Adjust for binary exponent\n\n if (bExp >= 0)\n\n bS_Exp2 += bExp;\n\n else {\n\n dS_Exp2 -= bExp;\n\n hS_Exp2 -= bExp;\n\n }\n\n\n\n // Adjust for half ulp exponent\n\n if (hExp >= 0)\n\n hS_Exp2 += hExp;\n\n else {\n\n dS_Exp2 -= hExp;\n\n bS_Exp2 -= hExp;\n\n }\n\n\n\n // Remove common power of two factor from all three scaled values\n\n int common_Exp2 = Min3(dS_Exp2, bS_Exp2, hS_Exp2);\n\n dS_Exp2 -= common_Exp2;\n\n bS_Exp2 -= common_Exp2;\n\n hS_Exp2 -= common_Exp2;\n\n\n\n BigInteger dS = d;\n\n dS.MultiplyPow5(dS_Exp5) <<= dS_Exp2;\n\n\n\n BigInteger bS(bInt);\n\n bS.MultiplyPow5(bS_Exp5) <<= bS_Exp2;\n\n\n\n BigInteger hS(1);\n\n hS.MultiplyPow5(hS_Exp5) <<= hS_Exp2;\n\n\n\n BigInteger delta(0);\n\n dS.Difference(bS, &delta);\n\n\n\n return delta.Compare(hS);\n\n}\n\n\n\ninline bool StrtodFast(double d, int p, double* result) {\n\n // Use fast path for string-to-double conversion if possible\n\n // see http://www.exploringbinary.com/fast-path-decimal-to-floating-point-conversion/\n\n if (p > 22 && p < 22 + 16) {\n\n // Fast Path Cases In Disguise\n\n d *= internal::Pow10(p - 22);\n\n p = 22;\n\n }\n\n\n\n if (p >= -22 && p <= 22 && d <= 9007199254740991.0) { // 2^53 - 1\n\n *result = FastPath(d, p);\n\n return true;\n\n }\n\n else\n\n return false;\n\n}\n\n\n\n// Compute an approximation and see if it is within 1/2 ULP\n\ninline bool StrtodDiyFp(const char* decimals, size_t length, size_t decimalPosition, int exp, double* result) {\n\n uint64_t significand = 0;\n\n size_t i = 0; // 2^64 - 1 = 18446744073709551615, 1844674407370955161 = 0x1999999999999999 \n\n for (; i < length; i++) {\n\n if (significand > RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) ||\n\n (significand == RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) && decimals[i] > '5'))\n\n break;\n\n significand = significand * 10 + (decimals[i] - '0');\n\n }\n\n \n\n if (i < length && decimals[i] >= '5') // Rounding\n\n significand++;\n\n\n\n size_t remaining = length - i;\n\n const unsigned kUlpShift = 3;\n\n const unsigned kUlp = 1 << kUlpShift;\n\n int error = (remaining == 0) ? 0 : kUlp / 2;\n\n\n\n DiyFp v(significand, 0);\n\n v = v.Normalize();\n\n error <<= -v.e;\n\n\n\n const int dExp = (int)decimalPosition - (int)i + exp;\n\n\n\n int actualExp;\n\n DiyFp cachedPower = GetCachedPower10(dExp, &actualExp);\n\n if (actualExp != dExp) {\n\n static const DiyFp kPow10[] = {\n\n DiyFp(RAPIDJSON_UINT64_C2(0xa0000000, 00000000), -60), // 10^1\n\n DiyFp(RAPIDJSON_UINT64_C2(0xc8000000, 00000000), -57), // 10^2\n\n DiyFp(RAPIDJSON_UINT64_C2(0xfa000000, 00000000), -54), // 10^3\n\n DiyFp(RAPIDJSON_UINT64_C2(0x9c400000, 00000000), -50), // 10^4\n\n DiyFp(RAPIDJSON_UINT64_C2(0xc3500000, 00000000), -47), // 10^5\n\n DiyFp(RAPIDJSON_UINT64_C2(0xf4240000, 00000000), -44), // 10^6\n\n DiyFp(RAPIDJSON_UINT64_C2(0x98968000, 00000000), -40) // 10^7\n\n };\n\n int adjustment = dExp - actualExp - 1;\n\n RAPIDJSON_ASSERT(adjustment >= 0 && adjustment < 7);\n\n v = v * kPow10[adjustment];\n\n if (length + adjustment > 19) // has more digits than decimal digits in 64-bit\n\n error += kUlp / 2;\n\n }\n\n\n\n v = v * cachedPower;\n\n\n\n error += kUlp + (error == 0 ? 0 : 1);\n\n\n\n const int oldExp = v.e;\n\n v = v.Normalize();\n\n error <<= oldExp - v.e;\n\n\n\n const unsigned effectiveSignificandSize = Double::EffectiveSignificandSize(64 + v.e);\n\n unsigned precisionSize = 64 - effectiveSignificandSize;\n\n if (precisionSize + kUlpShift >= 64) {\n\n unsigned scaleExp = (precisionSize + kUlpShift) - 63;\n\n v.f >>= scaleExp;\n\n v.e += scaleExp; \n\n error = (error >> scaleExp) + 1 + kUlp;\n\n precisionSize -= scaleExp;\n\n }\n\n\n\n DiyFp rounded(v.f >> precisionSize, v.e + precisionSize);\n\n const uint64_t precisionBits = (v.f & ((uint64_t(1) << precisionSize) - 1)) * kUlp;\n\n const uint64_t halfWay = (uint64_t(1) << (precisionSize - 1)) * kUlp;\n\n if (precisionBits >= halfWay + error) {\n\n rounded.f++;\n\n if (rounded.f & (DiyFp::kDpHiddenBit << 1)) { // rounding overflows mantissa (issue #340)\n\n rounded.f >>= 1;\n\n rounded.e++;\n\n }\n\n }\n\n\n\n *result = rounded.ToDouble();\n\n\n\n return halfWay - error >= precisionBits || precisionBits >= halfWay + error;\n\n}\n\n\n\ninline double StrtodBigInteger(double approx, const char* decimals, size_t length, size_t decimalPosition, int exp) {\n\n const BigInteger dInt(decimals, length);\n\n const int dExp = (int)decimalPosition - (int)length + exp;\n\n Double a(approx);\n\n int cmp = CheckWithinHalfULP(a.Value(), dInt, dExp);\n\n if (cmp < 0)\n\n return a.Value(); // within half ULP\n\n else if (cmp == 0) {\n\n // Round towards even\n\n if (a.Significand() & 1)\n\n return a.NextPositiveDouble();\n\n else\n\n return a.Value();\n\n }\n\n else // adjustment\n\n return a.NextPositiveDouble();\n\n}\n\n\n\ninline double StrtodFullPrecision(double d, int p, const char* decimals, size_t length, size_t decimalPosition, int exp) {\n\n RAPIDJSON_ASSERT(d >= 0.0);\n\n RAPIDJSON_ASSERT(length >= 1);\n\n\n\n double result;\n\n if (StrtodFast(d, p, &result))\n\n return result;\n\n\n\n // Trim leading zeros\n\n while (*decimals == '0' && length > 1) {\n\n length--;\n\n decimals++;\n\n decimalPosition--;\n\n }\n\n\n\n // Trim trailing zeros\n\n while (decimals[length - 1] == '0' && length > 1) {\n\n length--;\n\n decimalPosition--;\n\n exp++;\n\n }\n\n\n\n // Trim right-most digits\n\n const int kMaxDecimalDigit = 780;\n\n if ((int)length > kMaxDecimalDigit) {\n\n int delta = (int(length) - kMaxDecimalDigit);\n\n exp += delta;\n\n decimalPosition -= delta;\n\n length = kMaxDecimalDigit;\n\n }\n\n\n\n // If too small, underflow to zero\n\n if (int(length) + exp < -324)\n\n return 0.0;\n\n\n\n if (StrtodDiyFp(decimals, length, decimalPosition, exp, &result))\n\n return result;\n\n\n\n // Use approximation from StrtodDiyFp and make adjustment with BigInteger comparison\n\n return StrtodBigInteger(result, decimals, length, decimalPosition, exp);\n\n}\n\n\n", "file_path": "Source/rapidjson/internal/strtod.h", "rank": 81, "score": 38181.47191615001 }, { "content": "RAPIDJSON_NAMESPACE_BEGIN\n\nnamespace internal {\n\n\n\n//! Custom strlen() which works on different character types.\n\n/*! \\tparam Ch Character type (e.g. char, wchar_t, short)\n\n \\param s Null-terminated input string.\n\n \\return Number of characters in the string. \n\n \\note This has the same semantics as strlen(), the return value is not number of Unicode codepoints.\n\n*/\n\ntemplate <typename Ch>\n\ninline SizeType StrLen(const Ch* s) {\n\n const Ch* p = s;\n\n while (*p) ++p;\n\n return SizeType(p - s);\n\n}\n\n\n", "file_path": "Source/rapidjson/internal/strfunc.h", "rank": 82, "score": 38181.47191615001 }, { "content": "RAPIDJSON_NAMESPACE_BEGIN\n\nnamespace internal {\n\n\n\n// Helper to wrap/convert arbitrary types to void, useful for arbitrary type matching\n\ntemplate <typename T> struct Void { typedef void Type; };\n\n\n\n///////////////////////////////////////////////////////////////////////////////\n\n// BoolType, TrueType, FalseType\n\n//\n\ntemplate <bool Cond> struct BoolType {\n\n static const bool Value = Cond;\n\n typedef BoolType Type;\n\n};\n\ntypedef BoolType<true> TrueType;\n\ntypedef BoolType<false> FalseType;\n\n\n\n\n\n///////////////////////////////////////////////////////////////////////////////\n\n// SelectIf, BoolExpr, NotExpr, AndExpr, OrExpr\n\n//\n\n\n\ntemplate <bool C> struct SelectIfImpl { template <typename T1, typename T2> struct Apply { typedef T1 Type; }; };\n\ntemplate <> struct SelectIfImpl<false> { template <typename T1, typename T2> struct Apply { typedef T2 Type; }; };\n\ntemplate <bool C, typename T1, typename T2> struct SelectIfCond : SelectIfImpl<C>::template Apply<T1,T2> {};\n\ntemplate <typename C, typename T1, typename T2> struct SelectIf : SelectIfCond<C::Value, T1, T2> {};\n\n\n\ntemplate <bool Cond1, bool Cond2> struct AndExprCond : FalseType {};\n\ntemplate <> struct AndExprCond<true, true> : TrueType {};\n\ntemplate <bool Cond1, bool Cond2> struct OrExprCond : TrueType {};\n\ntemplate <> struct OrExprCond<false, false> : FalseType {};\n\n\n\ntemplate <typename C> struct BoolExpr : SelectIf<C,TrueType,FalseType>::Type {};\n\ntemplate <typename C> struct NotExpr : SelectIf<C,FalseType,TrueType>::Type {};\n\ntemplate <typename C1, typename C2> struct AndExpr : AndExprCond<C1::Value, C2::Value>::Type {};\n\ntemplate <typename C1, typename C2> struct OrExpr : OrExprCond<C1::Value, C2::Value>::Type {};\n\n\n\n\n\n///////////////////////////////////////////////////////////////////////////////\n\n// AddConst, MaybeAddConst, RemoveConst\n\ntemplate <typename T> struct AddConst { typedef const T Type; };\n\ntemplate <bool Constify, typename T> struct MaybeAddConst : SelectIfCond<Constify, const T, T> {};\n\ntemplate <typename T> struct RemoveConst { typedef T Type; };\n\ntemplate <typename T> struct RemoveConst<const T> { typedef T Type; };\n\n\n\n\n\n///////////////////////////////////////////////////////////////////////////////\n\n// IsSame, IsConst, IsMoreConst, IsPointer\n\n//\n\ntemplate <typename T, typename U> struct IsSame : FalseType {};\n\ntemplate <typename T> struct IsSame<T, T> : TrueType {};\n\n\n\ntemplate <typename T> struct IsConst : FalseType {};\n\ntemplate <typename T> struct IsConst<const T> : TrueType {};\n\n\n\ntemplate <typename CT, typename T>\n\nstruct IsMoreConst\n\n : AndExpr<IsSame<typename RemoveConst<CT>::Type, typename RemoveConst<T>::Type>,\n\n BoolType<IsConst<CT>::Value >= IsConst<T>::Value> >::Type {};\n\n\n\ntemplate <typename T> struct IsPointer : FalseType {};\n\ntemplate <typename T> struct IsPointer<T*> : TrueType {};\n\n\n\n///////////////////////////////////////////////////////////////////////////////\n\n// IsBaseOf\n\n//\n\n#if RAPIDJSON_HAS_CXX11_TYPETRAITS\n\n\n\ntemplate <typename B, typename D> struct IsBaseOf\n\n : BoolType< ::std::is_base_of<B,D>::value> {};\n\n\n\n#else // simplified version adopted from Boost\n\n\n\ntemplate<typename B, typename D> struct IsBaseOfImpl {\n\n RAPIDJSON_STATIC_ASSERT(sizeof(B) != 0);\n\n RAPIDJSON_STATIC_ASSERT(sizeof(D) != 0);\n\n\n\n typedef char (&Yes)[1];\n\n typedef char (&No) [2];\n\n\n\n template <typename T>\n\n static Yes Check(const D*, T);\n\n static No Check(const B*, int);\n\n\n\n struct Host {\n\n operator const B*() const;\n\n operator const D*();\n\n };\n\n\n\n enum { Value = (sizeof(Check(Host(), 0)) == sizeof(Yes)) };\n\n};\n\n\n\ntemplate <typename B, typename D> struct IsBaseOf\n\n : OrExpr<IsSame<B, D>, BoolExpr<IsBaseOfImpl<B, D> > >::Type {};\n\n\n\n#endif // RAPIDJSON_HAS_CXX11_TYPETRAITS\n\n\n\n\n\n//////////////////////////////////////////////////////////////////////////\n\n// EnableIf / DisableIf\n\n//\n\ntemplate <bool Condition, typename T = void> struct EnableIfCond { typedef T Type; };\n\ntemplate <typename T> struct EnableIfCond<false, T> { /* empty */ };\n\n\n\ntemplate <bool Condition, typename T = void> struct DisableIfCond { typedef T Type; };\n\ntemplate <typename T> struct DisableIfCond<true, T> { /* empty */ };\n\n\n\ntemplate <typename Condition, typename T = void>\n\nstruct EnableIf : EnableIfCond<Condition::Value, T> {};\n\n\n\ntemplate <typename Condition, typename T = void>\n\nstruct DisableIf : DisableIfCond<Condition::Value, T> {};\n\n\n\n// SFINAE helpers\n\nstruct SfinaeTag {};\n\ntemplate <typename T> struct RemoveSfinaeTag;\n", "file_path": "Source/rapidjson/internal/meta.h", "rank": 83, "score": 38181.47191615001 }, { "content": "RAPIDJSON_NAMESPACE_BEGIN\n\nnamespace internal {\n\n\n\n#ifdef __GNUC__\n\nRAPIDJSON_DIAG_PUSH\n\nRAPIDJSON_DIAG_OFF(effc++)\n\n#endif\n\n\n\nstruct DiyFp {\n\n DiyFp() {}\n\n\n\n DiyFp(uint64_t fp, int exp) : f(fp), e(exp) {}\n\n\n\n explicit DiyFp(double d) {\n\n union {\n\n double d;\n\n uint64_t u64;\n\n } u = { d };\n\n\n\n int biased_e = static_cast<int>((u.u64 & kDpExponentMask) >> kDpSignificandSize);\n\n uint64_t significand = (u.u64 & kDpSignificandMask);\n\n if (biased_e != 0) {\n\n f = significand + kDpHiddenBit;\n\n e = biased_e - kDpExponentBias;\n\n } \n\n else {\n\n f = significand;\n\n e = kDpMinExponent + 1;\n\n }\n", "file_path": "Source/rapidjson/internal/diyfp.h", "rank": 84, "score": 38181.47191615001 }, { "content": "RAPIDJSON_NAMESPACE_BEGIN\n\nnamespace internal {\n\n\n\ninline const char* GetDigitsLut() {\n\n static const char cDigitsLut[200] = {\n\n '0','0','0','1','0','2','0','3','0','4','0','5','0','6','0','7','0','8','0','9',\n\n '1','0','1','1','1','2','1','3','1','4','1','5','1','6','1','7','1','8','1','9',\n\n '2','0','2','1','2','2','2','3','2','4','2','5','2','6','2','7','2','8','2','9',\n\n '3','0','3','1','3','2','3','3','3','4','3','5','3','6','3','7','3','8','3','9',\n\n '4','0','4','1','4','2','4','3','4','4','4','5','4','6','4','7','4','8','4','9',\n\n '5','0','5','1','5','2','5','3','5','4','5','5','5','6','5','7','5','8','5','9',\n\n '6','0','6','1','6','2','6','3','6','4','6','5','6','6','6','7','6','8','6','9',\n\n '7','0','7','1','7','2','7','3','7','4','7','5','7','6','7','7','7','8','7','9',\n\n '8','0','8','1','8','2','8','3','8','4','8','5','8','6','8','7','8','8','8','9',\n\n '9','0','9','1','9','2','9','3','9','4','9','5','9','6','9','7','9','8','9','9'\n\n };\n\n return cDigitsLut;\n\n}\n\n\n\ninline char* u32toa(uint32_t value, char* buffer) {\n\n const char* cDigitsLut = GetDigitsLut();\n\n\n\n if (value < 10000) {\n\n const uint32_t d1 = (value / 100) << 1;\n\n const uint32_t d2 = (value % 100) << 1;\n\n \n\n if (value >= 1000)\n\n *buffer++ = cDigitsLut[d1];\n\n if (value >= 100)\n\n *buffer++ = cDigitsLut[d1 + 1];\n\n if (value >= 10)\n\n *buffer++ = cDigitsLut[d2];\n\n *buffer++ = cDigitsLut[d2 + 1];\n\n }\n\n else if (value < 100000000) {\n\n // value = bbbbcccc\n\n const uint32_t b = value / 10000;\n\n const uint32_t c = value % 10000;\n\n \n\n const uint32_t d1 = (b / 100) << 1;\n\n const uint32_t d2 = (b % 100) << 1;\n\n \n\n const uint32_t d3 = (c / 100) << 1;\n\n const uint32_t d4 = (c % 100) << 1;\n\n \n\n if (value >= 10000000)\n\n *buffer++ = cDigitsLut[d1];\n\n if (value >= 1000000)\n\n *buffer++ = cDigitsLut[d1 + 1];\n\n if (value >= 100000)\n\n *buffer++ = cDigitsLut[d2];\n\n *buffer++ = cDigitsLut[d2 + 1];\n\n \n\n *buffer++ = cDigitsLut[d3];\n\n *buffer++ = cDigitsLut[d3 + 1];\n\n *buffer++ = cDigitsLut[d4];\n\n *buffer++ = cDigitsLut[d4 + 1];\n\n }\n\n else {\n\n // value = aabbbbcccc in decimal\n\n \n\n const uint32_t a = value / 100000000; // 1 to 42\n\n value %= 100000000;\n\n \n\n if (a >= 10) {\n\n const unsigned i = a << 1;\n\n *buffer++ = cDigitsLut[i];\n\n *buffer++ = cDigitsLut[i + 1];\n\n }\n\n else\n\n *buffer++ = static_cast<char>('0' + static_cast<char>(a));\n\n\n\n const uint32_t b = value / 10000; // 0 to 9999\n\n const uint32_t c = value % 10000; // 0 to 9999\n\n \n\n const uint32_t d1 = (b / 100) << 1;\n\n const uint32_t d2 = (b % 100) << 1;\n\n \n\n const uint32_t d3 = (c / 100) << 1;\n\n const uint32_t d4 = (c % 100) << 1;\n\n \n\n *buffer++ = cDigitsLut[d1];\n\n *buffer++ = cDigitsLut[d1 + 1];\n\n *buffer++ = cDigitsLut[d2];\n\n *buffer++ = cDigitsLut[d2 + 1];\n\n *buffer++ = cDigitsLut[d3];\n\n *buffer++ = cDigitsLut[d3 + 1];\n\n *buffer++ = cDigitsLut[d4];\n\n *buffer++ = cDigitsLut[d4 + 1];\n\n }\n\n return buffer;\n\n}\n\n\n\ninline char* i32toa(int32_t value, char* buffer) {\n\n uint32_t u = static_cast<uint32_t>(value);\n\n if (value < 0) {\n\n *buffer++ = '-';\n\n u = ~u + 1;\n\n }\n\n\n\n return u32toa(u, buffer);\n\n}\n\n\n\ninline char* u64toa(uint64_t value, char* buffer) {\n\n const char* cDigitsLut = GetDigitsLut();\n\n const uint64_t kTen8 = 100000000;\n\n const uint64_t kTen9 = kTen8 * 10;\n\n const uint64_t kTen10 = kTen8 * 100;\n\n const uint64_t kTen11 = kTen8 * 1000;\n\n const uint64_t kTen12 = kTen8 * 10000;\n\n const uint64_t kTen13 = kTen8 * 100000;\n\n const uint64_t kTen14 = kTen8 * 1000000;\n\n const uint64_t kTen15 = kTen8 * 10000000;\n\n const uint64_t kTen16 = kTen8 * kTen8;\n\n \n\n if (value < kTen8) {\n\n uint32_t v = static_cast<uint32_t>(value);\n\n if (v < 10000) {\n\n const uint32_t d1 = (v / 100) << 1;\n\n const uint32_t d2 = (v % 100) << 1;\n\n \n\n if (v >= 1000)\n\n *buffer++ = cDigitsLut[d1];\n\n if (v >= 100)\n\n *buffer++ = cDigitsLut[d1 + 1];\n\n if (v >= 10)\n\n *buffer++ = cDigitsLut[d2];\n\n *buffer++ = cDigitsLut[d2 + 1];\n\n }\n\n else {\n\n // value = bbbbcccc\n\n const uint32_t b = v / 10000;\n\n const uint32_t c = v % 10000;\n\n \n\n const uint32_t d1 = (b / 100) << 1;\n\n const uint32_t d2 = (b % 100) << 1;\n\n \n\n const uint32_t d3 = (c / 100) << 1;\n\n const uint32_t d4 = (c % 100) << 1;\n\n \n\n if (value >= 10000000)\n\n *buffer++ = cDigitsLut[d1];\n\n if (value >= 1000000)\n\n *buffer++ = cDigitsLut[d1 + 1];\n\n if (value >= 100000)\n\n *buffer++ = cDigitsLut[d2];\n\n *buffer++ = cDigitsLut[d2 + 1];\n\n \n\n *buffer++ = cDigitsLut[d3];\n\n *buffer++ = cDigitsLut[d3 + 1];\n\n *buffer++ = cDigitsLut[d4];\n\n *buffer++ = cDigitsLut[d4 + 1];\n\n }\n\n }\n\n else if (value < kTen16) {\n\n const uint32_t v0 = static_cast<uint32_t>(value / kTen8);\n\n const uint32_t v1 = static_cast<uint32_t>(value % kTen8);\n\n \n\n const uint32_t b0 = v0 / 10000;\n\n const uint32_t c0 = v0 % 10000;\n\n \n\n const uint32_t d1 = (b0 / 100) << 1;\n\n const uint32_t d2 = (b0 % 100) << 1;\n\n \n\n const uint32_t d3 = (c0 / 100) << 1;\n\n const uint32_t d4 = (c0 % 100) << 1;\n\n\n\n const uint32_t b1 = v1 / 10000;\n\n const uint32_t c1 = v1 % 10000;\n\n \n\n const uint32_t d5 = (b1 / 100) << 1;\n\n const uint32_t d6 = (b1 % 100) << 1;\n\n \n\n const uint32_t d7 = (c1 / 100) << 1;\n\n const uint32_t d8 = (c1 % 100) << 1;\n\n\n\n if (value >= kTen15)\n\n *buffer++ = cDigitsLut[d1];\n\n if (value >= kTen14)\n\n *buffer++ = cDigitsLut[d1 + 1];\n\n if (value >= kTen13)\n\n *buffer++ = cDigitsLut[d2];\n\n if (value >= kTen12)\n\n *buffer++ = cDigitsLut[d2 + 1];\n\n if (value >= kTen11)\n\n *buffer++ = cDigitsLut[d3];\n\n if (value >= kTen10)\n\n *buffer++ = cDigitsLut[d3 + 1];\n\n if (value >= kTen9)\n\n *buffer++ = cDigitsLut[d4];\n\n if (value >= kTen8)\n\n *buffer++ = cDigitsLut[d4 + 1];\n\n \n\n *buffer++ = cDigitsLut[d5];\n\n *buffer++ = cDigitsLut[d5 + 1];\n\n *buffer++ = cDigitsLut[d6];\n\n *buffer++ = cDigitsLut[d6 + 1];\n\n *buffer++ = cDigitsLut[d7];\n\n *buffer++ = cDigitsLut[d7 + 1];\n\n *buffer++ = cDigitsLut[d8];\n\n *buffer++ = cDigitsLut[d8 + 1];\n\n }\n\n else {\n\n const uint32_t a = static_cast<uint32_t>(value / kTen16); // 1 to 1844\n\n value %= kTen16;\n\n \n\n if (a < 10)\n\n *buffer++ = static_cast<char>('0' + static_cast<char>(a));\n\n else if (a < 100) {\n\n const uint32_t i = a << 1;\n\n *buffer++ = cDigitsLut[i];\n\n *buffer++ = cDigitsLut[i + 1];\n\n }\n\n else if (a < 1000) {\n\n *buffer++ = static_cast<char>('0' + static_cast<char>(a / 100));\n\n \n\n const uint32_t i = (a % 100) << 1;\n\n *buffer++ = cDigitsLut[i];\n\n *buffer++ = cDigitsLut[i + 1];\n\n }\n\n else {\n\n const uint32_t i = (a / 100) << 1;\n\n const uint32_t j = (a % 100) << 1;\n\n *buffer++ = cDigitsLut[i];\n\n *buffer++ = cDigitsLut[i + 1];\n\n *buffer++ = cDigitsLut[j];\n\n *buffer++ = cDigitsLut[j + 1];\n\n }\n\n \n\n const uint32_t v0 = static_cast<uint32_t>(value / kTen8);\n\n const uint32_t v1 = static_cast<uint32_t>(value % kTen8);\n\n \n\n const uint32_t b0 = v0 / 10000;\n\n const uint32_t c0 = v0 % 10000;\n\n \n\n const uint32_t d1 = (b0 / 100) << 1;\n\n const uint32_t d2 = (b0 % 100) << 1;\n\n \n\n const uint32_t d3 = (c0 / 100) << 1;\n\n const uint32_t d4 = (c0 % 100) << 1;\n\n \n\n const uint32_t b1 = v1 / 10000;\n\n const uint32_t c1 = v1 % 10000;\n\n \n\n const uint32_t d5 = (b1 / 100) << 1;\n\n const uint32_t d6 = (b1 % 100) << 1;\n\n \n\n const uint32_t d7 = (c1 / 100) << 1;\n\n const uint32_t d8 = (c1 % 100) << 1;\n\n \n\n *buffer++ = cDigitsLut[d1];\n\n *buffer++ = cDigitsLut[d1 + 1];\n\n *buffer++ = cDigitsLut[d2];\n\n *buffer++ = cDigitsLut[d2 + 1];\n\n *buffer++ = cDigitsLut[d3];\n\n *buffer++ = cDigitsLut[d3 + 1];\n\n *buffer++ = cDigitsLut[d4];\n\n *buffer++ = cDigitsLut[d4 + 1];\n\n *buffer++ = cDigitsLut[d5];\n\n *buffer++ = cDigitsLut[d5 + 1];\n\n *buffer++ = cDigitsLut[d6];\n\n *buffer++ = cDigitsLut[d6 + 1];\n\n *buffer++ = cDigitsLut[d7];\n\n *buffer++ = cDigitsLut[d7 + 1];\n\n *buffer++ = cDigitsLut[d8];\n\n *buffer++ = cDigitsLut[d8 + 1];\n\n }\n\n \n\n return buffer;\n\n}\n\n\n\ninline char* i64toa(int64_t value, char* buffer) {\n\n uint64_t u = static_cast<uint64_t>(value);\n\n if (value < 0) {\n\n *buffer++ = '-';\n\n u = ~u + 1;\n\n }\n\n\n\n return u64toa(u, buffer);\n\n}\n\n\n", "file_path": "Source/rapidjson/internal/itoa.h", "rank": 85, "score": 38181.47191615001 }, { "content": " static unsigned char GetRange(unsigned char c) {\n\n // Referring to DFA of http://bjoern.hoehrmann.de/utf-8/decoder/dfa/\n\n // With new mapping 1 -> 0x10, 7 -> 0x20, 9 -> 0x40, such that AND operation can test multiple types.\n\n static const unsigned char type[] = {\n\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n\n 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,\n\n 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,\n\n 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,\n\n 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,\n\n 8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,\n\n 10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3, 11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8,\n\n };\n\n return type[c];\n", "file_path": "Source/rapidjson/encodings.h", "rank": 86, "score": 38138.109447878516 }, { "content": "", "file_path": "Source/StateManager.h", "rank": 87, "score": 38001.30954510052 }, { "content": "", "file_path": "Source/StateManager.h", "rank": 88, "score": 38001.30954510052 }, { "content": "", "file_path": "Source/StateManager.h", "rank": 89, "score": 38001.30954510052 }, { "content": "", "file_path": "Source/StateManager.h", "rank": 90, "score": 38001.30954510052 }, { "content": "", "file_path": "Source/StateManager.h", "rank": 91, "score": 38001.30954510052 }, { "content": "", "file_path": "Source/StateManager.h", "rank": 92, "score": 38001.30954510052 }, { "content": "", "file_path": "Source/StateManager.h", "rank": 93, "score": 38001.30954510052 }, { "content": "", "file_path": "Source/StateManager.h", "rank": 94, "score": 38001.30954510052 }, { "content": "", "file_path": "Source/StateManager.h", "rank": 95, "score": 38001.30954510052 }, { "content": "", "file_path": "Source/StateManager.h", "rank": 96, "score": 38001.30954510052 }, { "content": "", "file_path": "Source/StateManager.h", "rank": 97, "score": 38001.30954510052 }, { "content": "", "file_path": "Source/StateManager.h", "rank": 98, "score": 38001.30954510052 }, { "content": "", "file_path": "Source/StateManager.h", "rank": 99, "score": 38001.30954510052 } ]
C++
wrappers/8.1.1/vtkSPHQuinticKernelWrap.cc
axkibe/node-vtk
900ad7b5500f672519da5aa24c99aa5a96466ef3
#define VTK_WRAPPING_CXX #define VTK_STREAMS_FWD_ONLY #include <nan.h> #include "vtkSPHKernelWrap.h" #include "vtkSPHQuinticKernelWrap.h" #include "vtkObjectBaseWrap.h" #include "vtkAbstractPointLocatorWrap.h" #include "vtkDataSetWrap.h" #include "vtkPointDataWrap.h" #include "../../plus/plus.h" using namespace v8; extern Nan::Persistent<v8::Object> vtkNodeJsNoWrap; Nan::Persistent<v8::FunctionTemplate> VtkSPHQuinticKernelWrap::ptpl; VtkSPHQuinticKernelWrap::VtkSPHQuinticKernelWrap() { } VtkSPHQuinticKernelWrap::VtkSPHQuinticKernelWrap(vtkSmartPointer<vtkSPHQuinticKernel> _native) { native = _native; } VtkSPHQuinticKernelWrap::~VtkSPHQuinticKernelWrap() { } void VtkSPHQuinticKernelWrap::Init(v8::Local<v8::Object> exports) { Nan::SetAccessor(exports, Nan::New("vtkSPHQuinticKernel").ToLocalChecked(), ConstructorGetter); Nan::SetAccessor(exports, Nan::New("SPHQuinticKernel").ToLocalChecked(), ConstructorGetter); } void VtkSPHQuinticKernelWrap::ConstructorGetter( v8::Local<v8::String> property, const Nan::PropertyCallbackInfo<v8::Value>& info) { InitPtpl(); info.GetReturnValue().Set(Nan::New(ptpl)->GetFunction()); } void VtkSPHQuinticKernelWrap::InitPtpl() { if (!ptpl.IsEmpty()) return; v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New); VtkSPHKernelWrap::InitPtpl( ); tpl->Inherit(Nan::New<FunctionTemplate>(VtkSPHKernelWrap::ptpl)); tpl->SetClassName(Nan::New("VtkSPHQuinticKernelWrap").ToLocalChecked()); tpl->InstanceTemplate()->SetInternalFieldCount(1); Nan::SetPrototypeMethod(tpl, "ComputeDerivWeight", ComputeDerivWeight); Nan::SetPrototypeMethod(tpl, "computeDerivWeight", ComputeDerivWeight); Nan::SetPrototypeMethod(tpl, "ComputeFunctionWeight", ComputeFunctionWeight); Nan::SetPrototypeMethod(tpl, "computeFunctionWeight", ComputeFunctionWeight); Nan::SetPrototypeMethod(tpl, "Initialize", Initialize); Nan::SetPrototypeMethod(tpl, "initialize", Initialize); Nan::SetPrototypeMethod(tpl, "NewInstance", NewInstance); Nan::SetPrototypeMethod(tpl, "newInstance", NewInstance); Nan::SetPrototypeMethod(tpl, "SafeDownCast", SafeDownCast); Nan::SetPrototypeMethod(tpl, "safeDownCast", SafeDownCast); #ifdef VTK_NODE_PLUS_VTKSPHQUINTICKERNELWRAP_INITPTPL VTK_NODE_PLUS_VTKSPHQUINTICKERNELWRAP_INITPTPL #endif ptpl.Reset( tpl ); } void VtkSPHQuinticKernelWrap::New(const Nan::FunctionCallbackInfo<v8::Value>& info) { if(!info.IsConstructCall()) { Nan::ThrowError("Constructor not called in a construct call."); return; } if(info.Length() == 0) { vtkSmartPointer<vtkSPHQuinticKernel> native = vtkSmartPointer<vtkSPHQuinticKernel>::New(); VtkSPHQuinticKernelWrap* obj = new VtkSPHQuinticKernelWrap(native); obj->Wrap(info.This()); } else { if(info[0]->ToObject() != vtkNodeJsNoWrap ) { Nan::ThrowError("Parameter Error"); return; } } info.GetReturnValue().Set(info.This()); } void VtkSPHQuinticKernelWrap::ComputeDerivWeight(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkSPHQuinticKernelWrap *wrapper = ObjectWrap::Unwrap<VtkSPHQuinticKernelWrap>(info.Holder()); vtkSPHQuinticKernel *native = (vtkSPHQuinticKernel *)wrapper->native.GetPointer(); if(info.Length() > 0 && info[0]->IsNumber()) { double r; if(info.Length() != 1) { Nan::ThrowError("Too many parameters."); return; } r = native->ComputeDerivWeight( info[0]->NumberValue() ); info.GetReturnValue().Set(Nan::New(r)); return; } Nan::ThrowError("Parameter mismatch"); } void VtkSPHQuinticKernelWrap::ComputeFunctionWeight(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkSPHQuinticKernelWrap *wrapper = ObjectWrap::Unwrap<VtkSPHQuinticKernelWrap>(info.Holder()); vtkSPHQuinticKernel *native = (vtkSPHQuinticKernel *)wrapper->native.GetPointer(); if(info.Length() > 0 && info[0]->IsNumber()) { double r; if(info.Length() != 1) { Nan::ThrowError("Too many parameters."); return; } r = native->ComputeFunctionWeight( info[0]->NumberValue() ); info.GetReturnValue().Set(Nan::New(r)); return; } Nan::ThrowError("Parameter mismatch"); } void VtkSPHQuinticKernelWrap::Initialize(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkSPHQuinticKernelWrap *wrapper = ObjectWrap::Unwrap<VtkSPHQuinticKernelWrap>(info.Holder()); vtkSPHQuinticKernel *native = (vtkSPHQuinticKernel *)wrapper->native.GetPointer(); if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkAbstractPointLocatorWrap::ptpl))->HasInstance(info[0])) { VtkAbstractPointLocatorWrap *a0 = ObjectWrap::Unwrap<VtkAbstractPointLocatorWrap>(info[0]->ToObject()); if(info.Length() > 1 && info[1]->IsObject() && (Nan::New(VtkDataSetWrap::ptpl))->HasInstance(info[1])) { VtkDataSetWrap *a1 = ObjectWrap::Unwrap<VtkDataSetWrap>(info[1]->ToObject()); if(info.Length() > 2 && info[2]->IsObject() && (Nan::New(VtkPointDataWrap::ptpl))->HasInstance(info[2])) { VtkPointDataWrap *a2 = ObjectWrap::Unwrap<VtkPointDataWrap>(info[2]->ToObject()); if(info.Length() != 3) { Nan::ThrowError("Too many parameters."); return; } native->Initialize( (vtkAbstractPointLocator *) a0->native.GetPointer(), (vtkDataSet *) a1->native.GetPointer(), (vtkPointData *) a2->native.GetPointer() ); return; } } } Nan::ThrowError("Parameter mismatch"); } void VtkSPHQuinticKernelWrap::NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkSPHQuinticKernelWrap *wrapper = ObjectWrap::Unwrap<VtkSPHQuinticKernelWrap>(info.Holder()); vtkSPHQuinticKernel *native = (vtkSPHQuinticKernel *)wrapper->native.GetPointer(); vtkSPHQuinticKernel * r; if(info.Length() != 0) { Nan::ThrowError("Too many parameters."); return; } r = native->NewInstance(); VtkSPHQuinticKernelWrap::InitPtpl(); v8::Local<v8::Value> argv[1] = { Nan::New(vtkNodeJsNoWrap) }; v8::Local<v8::Function> cons = Nan::New<v8::FunctionTemplate>(VtkSPHQuinticKernelWrap::ptpl)->GetFunction(); v8::Local<v8::Object> wo = cons->NewInstance(1, argv); VtkSPHQuinticKernelWrap *w = new VtkSPHQuinticKernelWrap(); w->native = r; w->Wrap(wo); info.GetReturnValue().Set(wo); } void VtkSPHQuinticKernelWrap::SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkSPHQuinticKernelWrap *wrapper = ObjectWrap::Unwrap<VtkSPHQuinticKernelWrap>(info.Holder()); vtkSPHQuinticKernel *native = (vtkSPHQuinticKernel *)wrapper->native.GetPointer(); if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkObjectBaseWrap::ptpl))->HasInstance(info[0])) { VtkObjectBaseWrap *a0 = ObjectWrap::Unwrap<VtkObjectBaseWrap>(info[0]->ToObject()); vtkSPHQuinticKernel * r; if(info.Length() != 1) { Nan::ThrowError("Too many parameters."); return; } r = native->SafeDownCast( (vtkObjectBase *) a0->native.GetPointer() ); VtkSPHQuinticKernelWrap::InitPtpl(); v8::Local<v8::Value> argv[1] = { Nan::New(vtkNodeJsNoWrap) }; v8::Local<v8::Function> cons = Nan::New<v8::FunctionTemplate>(VtkSPHQuinticKernelWrap::ptpl)->GetFunction(); v8::Local<v8::Object> wo = cons->NewInstance(1, argv); VtkSPHQuinticKernelWrap *w = new VtkSPHQuinticKernelWrap(); w->native = r; w->Wrap(wo); info.GetReturnValue().Set(wo); return; } Nan::ThrowError("Parameter mismatch"); }
#define VTK_WRAPPING_CXX #define VTK_STREAMS_FWD_ONLY #include <nan.h> #include "vtkSPHKernelWrap.h" #include "vtkSPHQuinticKernelWrap.h" #include "vtkObjectBaseWrap.h" #include "vtkAbstractPointLocatorWrap.h" #include "vtkDataSetWrap.h" #include "vtkPointDataWrap.h" #include "../../plus/plus.h" using namespace v8; extern Nan::Persistent<v8::Object> vtkNodeJsNoWrap; Nan::Persistent<v8::FunctionTemplate> VtkSPHQuinticKernelWrap::ptpl; VtkSPHQuinticKernelWrap::VtkSPHQuinticKernelWrap() { } VtkSPHQuinticKernelWrap::VtkSPHQuinticKernelWrap(vtkSmartPointer<vtkSPHQuinticKernel> _native) { native = _native; } VtkSPHQuinticKernelWrap::~VtkSPHQuinticKernelWrap() { } void VtkSPHQuinticKernelWrap::Init(v8::Local<v8::Object> exports) { Nan::SetAccessor(exports, Nan::New("vtkSPHQuinticKernel").ToLocalChecked(), ConstructorGetter); Nan::SetAccessor(exports, Nan::New("SPHQuinticKernel").ToLocalChecked(), ConstructorGetter); } void VtkSPHQuinticKernelWrap::ConstructorGetter( v8::Local<v8::String> property, const Nan::PropertyCallbackInfo<v8::Value>& info) { InitPtpl(); info.GetReturnValue().Set(Nan::New(ptpl)->GetFunction()); } void VtkSPHQuinticKernelWrap::InitPtpl() { if (!ptpl.IsEmpty()) return; v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New); VtkSPHKernelWrap::InitPtpl( ); tpl->Inherit(Nan::New<FunctionTemplate>(VtkSPHKernelWrap::ptpl)); tpl->SetClassName(Nan::New("VtkSPHQuinticKernelWrap").ToLocalChecked()); tpl->InstanceTemplate()->SetInternalFieldCount(1); Nan::SetPrototypeMethod(tpl, "ComputeDerivWeight", ComputeDerivWeight); Nan::SetPrototypeMethod(tpl, "computeDerivWeight", ComputeDerivWeight); Nan::SetPrototypeMethod(tpl, "ComputeFunctionWeight", ComputeFunctionWeight); Nan::SetPrototypeMethod(tpl, "computeFunctionWeight", ComputeFunctionWeight); Nan::SetPrototypeMethod(tpl, "Initialize", Initialize); Nan::SetPrototypeMethod(tpl, "initialize", Initialize); Nan::SetPrototypeMethod(tpl, "NewInstance", NewInstance); Nan::SetPrototypeMethod(tpl, "newInstance", NewInstance); Nan::SetPrototypeMethod(tpl, "SafeDownCast", SafeDownCast); Nan::SetPrototypeMethod(tpl, "safeDownCast", SafeDownCast); #ifdef VTK_NODE_PLUS_VTKSPHQUINTICKERNELWRAP_INITPTPL VTK_NODE_PLUS_VTKSPHQUINTICKERNEL
et(wo); return; } Nan::ThrowError("Parameter mismatch"); }
WRAP_INITPTPL #endif ptpl.Reset( tpl ); } void VtkSPHQuinticKernelWrap::New(const Nan::FunctionCallbackInfo<v8::Value>& info) { if(!info.IsConstructCall()) { Nan::ThrowError("Constructor not called in a construct call."); return; } if(info.Length() == 0) { vtkSmartPointer<vtkSPHQuinticKernel> native = vtkSmartPointer<vtkSPHQuinticKernel>::New(); VtkSPHQuinticKernelWrap* obj = new VtkSPHQuinticKernelWrap(native); obj->Wrap(info.This()); } else { if(info[0]->ToObject() != vtkNodeJsNoWrap ) { Nan::ThrowError("Parameter Error"); return; } } info.GetReturnValue().Set(info.This()); } void VtkSPHQuinticKernelWrap::ComputeDerivWeight(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkSPHQuinticKernelWrap *wrapper = ObjectWrap::Unwrap<VtkSPHQuinticKernelWrap>(info.Holder()); vtkSPHQuinticKernel *native = (vtkSPHQuinticKernel *)wrapper->native.GetPointer(); if(info.Length() > 0 && info[0]->IsNumber()) { double r; if(info.Length() != 1) { Nan::ThrowError("Too many parameters."); return; } r = native->ComputeDerivWeight( info[0]->NumberValue() ); info.GetReturnValue().Set(Nan::New(r)); return; } Nan::ThrowError("Parameter mismatch"); } void VtkSPHQuinticKernelWrap::ComputeFunctionWeight(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkSPHQuinticKernelWrap *wrapper = ObjectWrap::Unwrap<VtkSPHQuinticKernelWrap>(info.Holder()); vtkSPHQuinticKernel *native = (vtkSPHQuinticKernel *)wrapper->native.GetPointer(); if(info.Length() > 0 && info[0]->IsNumber()) { double r; if(info.Length() != 1) { Nan::ThrowError("Too many parameters."); return; } r = native->ComputeFunctionWeight( info[0]->NumberValue() ); info.GetReturnValue().Set(Nan::New(r)); return; } Nan::ThrowError("Parameter mismatch"); } void VtkSPHQuinticKernelWrap::Initialize(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkSPHQuinticKernelWrap *wrapper = ObjectWrap::Unwrap<VtkSPHQuinticKernelWrap>(info.Holder()); vtkSPHQuinticKernel *native = (vtkSPHQuinticKernel *)wrapper->native.GetPointer(); if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkAbstractPointLocatorWrap::ptpl))->HasInstance(info[0])) { VtkAbstractPointLocatorWrap *a0 = ObjectWrap::Unwrap<VtkAbstractPointLocatorWrap>(info[0]->ToObject()); if(info.Length() > 1 && info[1]->IsObject() && (Nan::New(VtkDataSetWrap::ptpl))->HasInstance(info[1])) { VtkDataSetWrap *a1 = ObjectWrap::Unwrap<VtkDataSetWrap>(info[1]->ToObject()); if(info.Length() > 2 && info[2]->IsObject() && (Nan::New(VtkPointDataWrap::ptpl))->HasInstance(info[2])) { VtkPointDataWrap *a2 = ObjectWrap::Unwrap<VtkPointDataWrap>(info[2]->ToObject()); if(info.Length() != 3) { Nan::ThrowError("Too many parameters."); return; } native->Initialize( (vtkAbstractPointLocator *) a0->native.GetPointer(), (vtkDataSet *) a1->native.GetPointer(), (vtkPointData *) a2->native.GetPointer() ); return; } } } Nan::ThrowError("Parameter mismatch"); } void VtkSPHQuinticKernelWrap::NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkSPHQuinticKernelWrap *wrapper = ObjectWrap::Unwrap<VtkSPHQuinticKernelWrap>(info.Holder()); vtkSPHQuinticKernel *native = (vtkSPHQuinticKernel *)wrapper->native.GetPointer(); vtkSPHQuinticKernel * r; if(info.Length() != 0) { Nan::ThrowError("Too many parameters."); return; } r = native->NewInstance(); VtkSPHQuinticKernelWrap::InitPtpl(); v8::Local<v8::Value> argv[1] = { Nan::New(vtkNodeJsNoWrap) }; v8::Local<v8::Function> cons = Nan::New<v8::FunctionTemplate>(VtkSPHQuinticKernelWrap::ptpl)->GetFunction(); v8::Local<v8::Object> wo = cons->NewInstance(1, argv); VtkSPHQuinticKernelWrap *w = new VtkSPHQuinticKernelWrap(); w->native = r; w->Wrap(wo); info.GetReturnValue().Set(wo); } void VtkSPHQuinticKernelWrap::SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkSPHQuinticKernelWrap *wrapper = ObjectWrap::Unwrap<VtkSPHQuinticKernelWrap>(info.Holder()); vtkSPHQuinticKernel *native = (vtkSPHQuinticKernel *)wrapper->native.GetPointer(); if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkObjectBaseWrap::ptpl))->HasInstance(info[0])) { VtkObjectBaseWrap *a0 = ObjectWrap::Unwrap<VtkObjectBaseWrap>(info[0]->ToObject()); vtkSPHQuinticKernel * r; if(info.Length() != 1) { Nan::ThrowError("Too many parameters."); return; } r = native->SafeDownCast( (vtkObjectBase *) a0->native.GetPointer() ); VtkSPHQuinticKernelWrap::InitPtpl(); v8::Local<v8::Value> argv[1] = { Nan::New(vtkNodeJsNoWrap) }; v8::Local<v8::Function> cons = Nan::New<v8::FunctionTemplate>(VtkSPHQuinticKernelWrap::ptpl)->GetFunction(); v8::Local<v8::Object> wo = cons->NewInstance(1, argv); VtkSPHQuinticKernelWrap *w = new VtkSPHQuinticKernelWrap(); w->native = r; w->Wrap(wo); info.GetReturnValue().S
random
[]
C++
Engine/qxtcheckcombobox.cpp
vadkasevas/BAS
657f62794451c564c77d6f92b2afa9f5daf2f517
#include "qxtcheckcombobox.h" #include <QKeyEvent> #include <QDebug> #include <QStylePainter> bool QxtCheckComboBox::eventFilter(QObject* receiver, QEvent* event) { if(event->type() == QEvent::MouseButtonPress && receiver == Edit) { if(Edit->underMouse()) { showPopup(); } else { hidePopup(); } return true; } switch (event->type()) { case QEvent::KeyPress: case QEvent::KeyRelease: { QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event); if (receiver == this && (keyEvent->key() == Qt::Key_Up || keyEvent->key() == Qt::Key_Down)) { showPopup(); return true; } else if (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Escape) { QComboBox::hidePopup(); if (keyEvent->key() != Qt::Key_Escape) return true; } } case QEvent::MouseButtonPress: containerMousePress = (receiver == view()->window()); break; case QEvent::MouseButtonRelease: containerMousePress = false; break; default: break; } return false; } void QxtCheckComboBox::updateCheckedItems() { QStringList items = checkedItems(); QList<int> indexes = checkedIndexes(); if (items.isEmpty()) { setEditText(_defaultText); } else { setEditText(items.join(_separator)); } emit checkedItemsChanged(items); QList<int> New = indexes,Old = LastItemsSelected; LastItemsSelected = indexes; emit checkedIndexesChanged(Old,New); } void QxtCheckComboBox::toggleCheckState(int index) { QVariant value = itemData(index, Qt::CheckStateRole); if (value.isValid()) { Qt::CheckState state = static_cast<Qt::CheckState>(value.toInt()); setItemData(index, (state == Qt::Unchecked ? Qt::Checked : Qt::Unchecked), Qt::CheckStateRole); } } QxtCheckComboModel::QxtCheckComboModel(QObject* parent) : QStandardItemModel(0, 1, parent) { } Qt::ItemFlags QxtCheckComboModel::flags(const QModelIndex& index) const { return QStandardItemModel::flags(index) | Qt::ItemIsUserCheckable; } QVariant QxtCheckComboModel::data(const QModelIndex& index, int role) const { QVariant value = QStandardItemModel::data(index, role); if (index.isValid() && role == Qt::CheckStateRole && !value.isValid()) value = Qt::Unchecked; return value; } bool QxtCheckComboModel::setData(const QModelIndex& index, const QVariant& value, int role) { bool ok = QStandardItemModel::setData(index, value, role); if (ok && role == Qt::CheckStateRole) { emit dataChanged(index, index); emit checkStateChanged(); } return ok; } QxtCheckComboBox::QxtCheckComboBox(QWidget* parent) : QComboBox(parent), mDisplayRectDelta(4, 1, -25, 0) { QListView * listView = new QListView(this); QPalette palette; palette.setColor(QPalette::Window, QColor( 200 , 200 , 200 )); palette.setColor(QPalette::Base, QColor( 55, 55 , 55 )); listView->setPalette(palette); setView(listView); _separator = QLatin1String(","); setModel(new QxtCheckComboModel(this)); connect(this, SIGNAL(activated(int)), this, SLOT(toggleCheckState(int))); connect(model(), SIGNAL(checkStateChanged()), this, SLOT(updateCheckedItems())); connect(model(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(updateCheckedItems())); connect(model(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(updateCheckedItems())); Edit = new QLineEdit(this); Edit->setReadOnly(true); setLineEdit(Edit); Edit->disconnect(this); Edit->installEventFilter(this); Edit->setEnabled(false); setInsertPolicy(QComboBox::NoInsert); view()->installEventFilter(this); view()->window()->installEventFilter(this); view()->viewport()->installEventFilter(this); this->installEventFilter(this); } QxtCheckComboBox::~QxtCheckComboBox() { } void QxtCheckComboBox::hidePopup() { if (containerMousePress) { QComboBox::hidePopup(); } } void QxtCheckComboBox::showPopup() { QComboBox::showPopup(); } Qt::CheckState QxtCheckComboBox::itemCheckState(int index) const { return static_cast<Qt::CheckState>(itemData(index, Qt::CheckStateRole).toInt()); } void QxtCheckComboBox::setItemCheckState(int index, Qt::CheckState state) { setItemData(index, state, Qt::CheckStateRole); } QStringList QxtCheckComboBox::checkedItems() const { QStringList items; if (model()) { QModelIndex index = model()->index(0, modelColumn(), rootModelIndex()); QModelIndexList indexes = model()->match(index, Qt::CheckStateRole, Qt::Checked, -1, Qt::MatchExactly); foreach(const QModelIndex& index, indexes) items += index.data().toString(); } return items; } QStringList QxtCheckComboBox::checkedData() const { QStringList items; if (model()) { QModelIndex index = model()->index(0, modelColumn(), rootModelIndex()); QModelIndexList indexes = model()->match(index, Qt::CheckStateRole, Qt::Checked, -1, Qt::MatchExactly); foreach(const QModelIndex& index, indexes) items += index.data(Qt::UserRole).toString(); } return items; } QList<int> QxtCheckComboBox::checkedIndexes() { QList<int> items; if (model()) { QModelIndex index = model()->index(0, modelColumn(), rootModelIndex()); QModelIndexList indexes = model()->match(index, Qt::CheckStateRole, Qt::Checked, -1, Qt::MatchExactly); foreach(const QModelIndex& index, indexes) items += index.row(); } return items; } void QxtCheckComboBox::setCheckedItems(const QStringList& items) { foreach(const QString& text, items) { const int index = findText(text); setItemCheckState(index, index != -1 ? Qt::Checked : Qt::Unchecked); } } void QxtCheckComboBox::setCheckedData(const QStringList& items) { foreach(const QString& text, items) { const int index = findData(text); setItemCheckState(index, index != -1 ? Qt::Checked : Qt::Unchecked); } } void QxtCheckComboBox::setCheckedIndexes(const QList<int>& indexes) { for(int index = 0;index<model()->rowCount();index ++) { setItemCheckState(index, indexes.contains(index) ? Qt::Checked : Qt::Unchecked); } LastItemsSelected = indexes; } QList<int> QxtCheckComboBox::currentIndexes() { return LastItemsSelected; } QString QxtCheckComboBox::defaultText() const { return _defaultText; } void QxtCheckComboBox::setDefaultText(const QString& text) { if (_defaultText != text) { _defaultText = text; this->updateCheckedItems(); } } QString QxtCheckComboBox::separator() const { return _separator; } void QxtCheckComboBox::setSeparator(const QString& separator) { if (_separator != separator) { _separator = separator; updateCheckedItems(); } }
#include "qxtcheckcombobox.h" #include <QKeyEvent> #include <QDebug> #include <QStylePainter> bool QxtCheckComboBox::eventFilter(QObject* receiver, QEvent* event) { if(event->type() == QEvent::MouseButtonPress && receiver == Edit) { if(Edit->underMouse()) { showPopup(); } else { hidePopup(); } return true; } switch (event->type()) { case QEvent::KeyPress: case QEvent::KeyRelease: { QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event); if (receiver == this && (keyEvent->key() == Qt::Key_Up || keyEvent->key() == Qt::Key_Down)) { showPopup(); return true; } else if (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Escape) { QComboBox::hidePopup(); if (keyEvent->key() != Qt::Key_Escape) return true; } } case QEvent::MouseButtonPress: containerMousePress = (receiver == view()->window()); break; case QEvent::MouseButtonRelease: containerMousePress = false; break; default: break; } return false; } void QxtCheckComboBox::updateCheckedItems() { QStringList items = checkedItems(); QList<int> indexes = checkedIndexes(); if (items.isEmpty()) { setEditText(_defaultText); } else { setEditText(items.join(_separator)); } emit checkedItemsChanged(items); QList<int> New = indexes,Old = LastItemsSelected; LastItemsSelected = indexes; emit checkedIndexesChanged(Old,New); } void QxtCheckComboBox::toggleCheckState(int index) { QVariant value = itemData(index, Qt::CheckStateRole); if (value.isValid()) { Qt::CheckState state = static_cast<Qt::CheckState>(value.toInt()); setItemData(index, (state == Qt::Unchecked ? Qt::Checked : Qt::Unchecked), Qt::CheckStateRole); } } QxtCheckComboModel::QxtCheckComboModel(QObject* parent) : QStandardItemModel(0, 1, parent) { } Qt::ItemFlags QxtCheckComboModel::flags(const QModelIndex& index) const { return QStandardItemModel::flags(index) | Qt::ItemIsUserCheckable; } QVariant QxtCheckComboModel::data(const QModelIndex& index, int role) const { QVariant value = QStandardItemModel::data(index, role); if (index.isValid() && role == Qt::CheckStateRole && !value.isValid()) value = Qt::Unchecked; return value; } bool QxtCheckComboModel::setData(const QModelIndex& index, const QVariant& value, int role) { bool ok = QStandardItemModel::setData(index, value, role); if (ok && role == Qt::CheckStateRole) { emit dataChanged(index, index); emit checkStateChanged(); } return ok; } QxtCheckComboBox::QxtCheckComboBox(QWidget* parent) : QComboBox(parent), mDisplayRectDelta(4, 1, -25, 0) { QListView * listView = new QListView(this); QPalette palette; palette.setColor(QPalette::Window, QColor( 200 , 200 , 200 )); palette.setColor(QPalette::Base, QColor( 55, 55 , 55 )); listView->setPalette(palette); setView(listView); _separator = QLatin1String(","); setModel(new QxtCheckComboModel(this)); connect(this, SIGNAL(activated(int)), this, SLOT(toggleCheckState(int))); connect(model(), SIGNAL(checkStateChanged()), this, SLOT(updateCheckedItems())); connect(model(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(updateCheckedItems())); connect(model(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(updateCheckedItems())); Edit = new QLineEdit(this); Edit->setReadOnly(true); setLineEdit(Edit); Edit->disconnect(this); Edit->installEventFilter(this); Edit->setEnabled(false);
QxtCheckComboBox::~QxtCheckComboBox() { } void QxtCheckComboBox::hidePopup() { if (containerMousePress) { QComboBox::hidePopup(); } } void QxtCheckComboBox::showPopup() { QComboBox::showPopup(); } Qt::CheckState QxtCheckComboBox::itemCheckState(int index) const { return static_cast<Qt::CheckState>(itemData(index, Qt::CheckStateRole).toInt()); } void QxtCheckComboBox::setItemCheckState(int index, Qt::CheckState state) { setItemData(index, state, Qt::CheckStateRole); } QStringList QxtCheckComboBox::checkedItems() const { QStringList items; if (model()) { QModelIndex index = model()->index(0, modelColumn(), rootModelIndex()); QModelIndexList indexes = model()->match(index, Qt::CheckStateRole, Qt::Checked, -1, Qt::MatchExactly); foreach(const QModelIndex& index, indexes) items += index.data().toString(); } return items; } QStringList QxtCheckComboBox::checkedData() const { QStringList items; if (model()) { QModelIndex index = model()->index(0, modelColumn(), rootModelIndex()); QModelIndexList indexes = model()->match(index, Qt::CheckStateRole, Qt::Checked, -1, Qt::MatchExactly); foreach(const QModelIndex& index, indexes) items += index.data(Qt::UserRole).toString(); } return items; } QList<int> QxtCheckComboBox::checkedIndexes() { QList<int> items; if (model()) { QModelIndex index = model()->index(0, modelColumn(), rootModelIndex()); QModelIndexList indexes = model()->match(index, Qt::CheckStateRole, Qt::Checked, -1, Qt::MatchExactly); foreach(const QModelIndex& index, indexes) items += index.row(); } return items; } void QxtCheckComboBox::setCheckedItems(const QStringList& items) { foreach(const QString& text, items) { const int index = findText(text); setItemCheckState(index, index != -1 ? Qt::Checked : Qt::Unchecked); } } void QxtCheckComboBox::setCheckedData(const QStringList& items) { foreach(const QString& text, items) { const int index = findData(text); setItemCheckState(index, index != -1 ? Qt::Checked : Qt::Unchecked); } } void QxtCheckComboBox::setCheckedIndexes(const QList<int>& indexes) { for(int index = 0;index<model()->rowCount();index ++) { setItemCheckState(index, indexes.contains(index) ? Qt::Checked : Qt::Unchecked); } LastItemsSelected = indexes; } QList<int> QxtCheckComboBox::currentIndexes() { return LastItemsSelected; } QString QxtCheckComboBox::defaultText() const { return _defaultText; } void QxtCheckComboBox::setDefaultText(const QString& text) { if (_defaultText != text) { _defaultText = text; this->updateCheckedItems(); } } QString QxtCheckComboBox::separator() const { return _separator; } void QxtCheckComboBox::setSeparator(const QString& separator) { if (_separator != separator) { _separator = separator; updateCheckedItems(); } }
setInsertPolicy(QComboBox::NoInsert); view()->installEventFilter(this); view()->window()->installEventFilter(this); view()->viewport()->installEventFilter(this); this->installEventFilter(this); }
function_block-function_prefix_line
[ { "content": "var Index = GetInputConstructorValue(\"Index\", loader);\n", "file_path": "Modules/List/js/get_list_element_by_index_select.js", "rank": 0, "score": 107529.92272205185 }, { "content": "class DatabaseAdminItemEdit;\n\n}\n\nusing namespace BrowserAutomationStudioFramework;\n", "file_path": "Engine/databaseadminitemedit.h", "rank": 1, "score": 105654.5356569789 }, { "content": "local void zip64local_putValue_inmemory OF((void* dest, ZPOS64_T x, int nbByte));\n", "file_path": "Engine/zip/zip.c", "rank": 2, "score": 100719.33099010467 }, { "content": "local void zip64local_putValue_inmemory OF((void* dest, ZPOS64_T x, int nbByte));\n", "file_path": "Updater/zip/zip.c", "rank": 3, "score": 100719.33099010467 }, { "content": "local int unz64local_getByte OF((\n", "file_path": "Updater/zip/unzip.c", "rank": 4, "score": 100647.94641337525 }, { "content": "local int unz64local_getByte OF((\n", "file_path": "Engine/zip/unzip.c", "rank": 5, "score": 100647.94641337525 }, { "content": "local int zip64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX));\n", "file_path": "Updater/zip/zip.c", "rank": 6, "score": 100642.47172968116 }, { "content": "local int zip64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX));\n", "file_path": "Engine/zip/zip.c", "rank": 7, "score": 100642.47172968116 }, { "content": "local void zip64local_putValue_inmemory OF((void* dest, ZPOS64_T x, int nbByte));\n", "file_path": "RemoteExecuteScript/zip/zip.c", "rank": 8, "score": 97321.69593421812 }, { "content": "local int unz64local_getByte OF((\n", "file_path": "RemoteExecuteScript/zip/unzip.c", "rank": 9, "score": 97251.24585410111 }, { "content": "local int zip64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX));\n", "file_path": "RemoteExecuteScript/zip/zip.c", "rank": 10, "score": 97245.77117040701 }, { "content": "class DatabaseAdminItemEdit : public QDialog\n\n{\n\n Q_OBJECT\n\n QHash<int,QWidget *> Widgets;\n\n QList<DatabaseColumn> Columns;\n\n\n\npublic:\n\n explicit DatabaseAdminItemEdit(QWidget *parent = 0);\n\n ~DatabaseAdminItemEdit();\n\n void SetColumns(QList<DatabaseColumn> Columns);\n\n void SetGroupList(QStringList Groups);\n\n void SetSelectedGroup(int index);\n\n int GetSelectedIndex();\n\n void HideGroupBox();\n\n DatabaseItem GetDatabaseItem();\n\n void SetDatabaseItem(DatabaseItem Item);\n\nprivate:\n\n Ui::DatabaseAdminItemEdit *ui;\n\n};\n\n\n\n#endif // DATABASEADMINITEMEDIT_H\n", "file_path": "Engine/databaseadminitemedit.h", "rank": 11, "score": 95084.47661727692 }, { "content": "#ifdef LODEPNG_COMPILE_PNG\n\nclass State : public LodePNGState\n\n{\n\n public:\n\n State();\n\n State(const State& other);\n\n virtual ~State();\n\n State& operator=(const State& other);\n\n};\n\n\n\n#ifdef LODEPNG_COMPILE_DECODER\n\n/* Same as other lodepng::decode, but using a State for more settings and information. */\n\nunsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h,\n\n State& state,\n\n const unsigned char* in, size_t insize);\n\nunsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h,\n\n State& state,\n\n const std::vector<unsigned char>& in);\n\n#endif /*LODEPNG_COMPILE_DECODER*/\n\n\n\n#ifdef LODEPNG_COMPILE_ENCODER\n", "file_path": "ChromeWorker/png/lodepng.h", "rank": 12, "score": 95049.04685941734 }, { "content": "var els = $(\"*[data-table-id=\" + Table + \"]\")\n", "file_path": "Modules/Database/js/database_insert_record_select.js", "rank": 13, "score": 93000.63835306438 }, { "content": "var els = $(\"*[data-table-id=\" + Table + \"]\")\n", "file_path": "Modules/Database/js/database_update_record_select.js", "rank": 14, "score": 93000.63835306438 }, { "content": "var Index = GetInputConstructorValue(\"Index\", loader);\n", "file_path": "Modules/List/js/insert_element_to_list_select.js", "rank": 15, "score": 92987.60745450656 }, { "content": "var Index = GetInputConstructorValue(\"Index\", loader);\n", "file_path": "Modules/List/js/list_set_element_select.js", "rank": 16, "score": 92987.60745450656 }, { "content": "var Value = GetInputConstructorValue(\"Value\", loader);\n", "file_path": "Modules/List/js/delete_by_index_select.js", "rank": 17, "score": 89112.54011689377 }, { "content": "var Value = GetInputConstructorValue(\"Value\", loader);\n", "file_path": "Modules/List/js/get_index_from_list_select.js", "rank": 18, "score": 86411.09007047981 }, { "content": "11. state settings reference\n\n----------------------------\n\n\n\nA quick reference of some settings to set on the LodePNGState\n\n\n\nFor decoding:\n\n\n\nstate.decoder.zlibsettings.ignore_adler32: ignore ADLER32 checksums\n\nstate.decoder.zlibsettings.custom_...: use custom inflate function\n\nstate.decoder.ignore_crc: ignore CRC checksums\n\nstate.decoder.color_convert: convert internal PNG color to chosen one\n\nstate.decoder.read_text_chunks: whether to read in text metadata chunks\n\nstate.decoder.remember_unknown_chunks: whether to read in unknown chunks\n\nstate.info_raw.colortype: desired color type for decoded image\n\nstate.info_raw.bitdepth: desired bit depth for decoded image\n\nstate.info_raw....: more color settings, see struct LodePNGColorMode\n\nstate.info_png....: no settings for decoder but ouput, see struct LodePNGInfo\n\n\n\nFor encoding:\n\n\n", "file_path": "ChromeWorker/png/lodepng.h", "rank": 19, "score": 85019.3226670419 }, { "content": "class bool_array\n\n{\n\npublic:\n\n#if (defined(__x86_64) || defined(__ia64) || defined(__ppc64__) || \\\n\n defined(_WIN64) || defined(_M_IA64)) && \\\n\n !(defined(_LP64) || defined(__lp64))\n\n /** Type of array indices. */\n\n typedef unsigned long long size_type;\n\n#else\n\n /** Type of array indices. */\n\n typedef unsigned long size_type;\n\n#endif\n\n\n\nprivate:\n\n /** Private definition of byte to avoid polluting the global namespace. */\n\n typedef unsigned char byte;\n\n\n\n /** Class to represent a reference to an array element. */\n\n template <typename _Byte_type>\n", "file_path": "Engine/debug_memory/bool_array.h", "rank": 20, "score": 65697.39776177352 }, { "content": "class bool_array\n\n{\n\npublic:\n\n#if (defined(__x86_64) || defined(__ia64) || defined(__ppc64__) || \\\n\n defined(_WIN64) || defined(_M_IA64)) && \\\n\n !(defined(_LP64) || defined(__lp64))\n\n /** Type of array indices. */\n\n typedef unsigned long long size_type;\n\n#else\n\n /** Type of array indices. */\n\n typedef unsigned long size_type;\n\n#endif\n\n\n\nprivate:\n\n /** Private definition of byte to avoid polluting the global namespace. */\n\n typedef unsigned char byte;\n\n\n\n /** Class to represent a reference to an array element. */\n\n template <typename _Byte_type>\n", "file_path": "Studio/debug_memory/bool_array.h", "rank": 21, "score": 65697.39776177352 }, { "content": "class debug_new_recorder\n\n{\n\n const char* _M_file;\n\n const int _M_line;\n\n void _M_process(void* ptr);\n\npublic:\n\n /**\n\n * Constructor to remember the call context. The information will\n\n * be used in debug_new_recorder::operator->*.\n\n */\n\n debug_new_recorder(const char* file, int line)\n\n : _M_file(file), _M_line(line) {}\n\n /**\n\n * Operator to write the context information to memory.\n\n * <code>operator->*</code> is chosen because it has the right\n\n * precedence, it is rarely used, and it looks good: so people can\n\n * tell the special usage more quickly.\n\n */\n\n template <class _Tp> _Tp* operator->*(_Tp* ptr)\n\n { _M_process(ptr); return ptr; }\n", "file_path": "Engine/debug_memory/debug_new.h", "rank": 22, "score": 64192.76177119041 }, { "content": "class debug_new_counter\n\n{\n\n static int _S_count;\n\npublic:\n\n debug_new_counter();\n\n ~debug_new_counter();\n\n};\n\n/** Counting object for each file including debug_new.h. */\n\nstatic debug_new_counter __debug_new_count;\n\n\n\nNVWA_NAMESPACE_END\n\n\n\n#endif // NVWA_DEBUG_NEW_H\n", "file_path": "Engine/debug_memory/debug_new.h", "rank": 23, "score": 64192.76177119041 }, { "content": "class debug_new_counter\n\n{\n\n static int _S_count;\n\npublic:\n\n debug_new_counter();\n\n ~debug_new_counter();\n\n};\n\n/** Counting object for each file including debug_new.h. */\n\nstatic debug_new_counter __debug_new_count;\n\n\n\nNVWA_NAMESPACE_END\n\n\n\n#endif // NVWA_DEBUG_NEW_H\n", "file_path": "Studio/debug_memory/debug_new.h", "rank": 24, "score": 64192.76177119041 }, { "content": "class debug_new_recorder\n\n{\n\n const char* _M_file;\n\n const int _M_line;\n\n void _M_process(void* ptr);\n\npublic:\n\n /**\n\n * Constructor to remember the call context. The information will\n\n * be used in debug_new_recorder::operator->*.\n\n */\n\n debug_new_recorder(const char* file, int line)\n\n : _M_file(file), _M_line(line) {}\n\n /**\n\n * Operator to write the context information to memory.\n\n * <code>operator->*</code> is chosen because it has the right\n\n * precedence, it is rarely used, and it looks good: so people can\n\n * tell the special usage more quickly.\n\n */\n\n template <class _Tp> _Tp* operator->*(_Tp* ptr)\n\n { _M_process(ptr); return ptr; }\n", "file_path": "Studio/debug_memory/debug_new.h", "rank": 25, "score": 64192.76177119041 }, { "content": "struct BufferAndFilter{std::string *Buffer; const QString* Filter;};\n", "file_path": "Engine/QtCUrl.h", "rank": 26, "score": 63835.055166312515 }, { "content": " class ENGINESHARED_EXPORT DatabaseState : public IDatabaseState\n\n {\n\n Q_OBJECT\n\n QList<DatabaseTable> Tables;\n\n QHash<int, QList<DatabaseColumn> > Columns;\n\n QHash<int, QList<DatabaseGroup> > Groups;\n\n IDatabaseConnector *DatabaseConnector;\n\n public:\n\n explicit DatabaseState(QObject *parent = 0);\n\n virtual QList<DatabaseTable> GetDatabaseTables();\n\n virtual QList<DatabaseColumn> GetColumns(int TableId);\n\n virtual QList<DatabaseGroup> GetGroups(int TableId);\n\n virtual QString ToJson();\n\n void SetDatabaseConnector(IDatabaseConnector *DatabaseConnector);\n\n signals:\n\n\n\n public slots:\n\n void Reload();\n\n };\n\n}\n\n\n\n#endif // DATABASESTATE_H\n", "file_path": "Engine/databasestate.h", "rank": 27, "score": 62856.45170620578 }, { "content": "struct new_ptr_list_t\n\n{\n\n new_ptr_list_t* next; ///< Pointer to the next memory block\n\n new_ptr_list_t* prev; ///< Pointer to the previous memory block\n\n size_t size; ///< Size of the memory block\n\n union\n\n {\n\n#if _DEBUG_NEW_FILENAME_LEN == 0\n\n const char* file; ///< Pointer to the file name of the caller\n\n#else\n\n char file[_DEBUG_NEW_FILENAME_LEN]; ///< File name of the caller\n\n#endif\n\n void* addr; ///< Address of the caller to \\e new\n\n };\n\n unsigned line :31; ///< Line number of the caller; or \\c 0\n\n unsigned is_array:1; ///< Non-zero iff <em>new[]</em> is used\n\n unsigned magic; ///< Magic number for error detection\n\n};\n\n\n\n/**\n", "file_path": "Studio/debug_memory/debug_new.cpp", "rank": 28, "score": 62777.6238909477 }, { "content": "struct new_ptr_list_t\n\n{\n\n new_ptr_list_t* next; ///< Pointer to the next memory block\n\n new_ptr_list_t* prev; ///< Pointer to the previous memory block\n\n size_t size; ///< Size of the memory block\n\n union\n\n {\n\n#if _DEBUG_NEW_FILENAME_LEN == 0\n\n const char* file; ///< Pointer to the file name of the caller\n\n#else\n\n char file[_DEBUG_NEW_FILENAME_LEN]; ///< File name of the caller\n\n#endif\n\n void* addr; ///< Address of the caller to \\e new\n\n };\n\n unsigned line :31; ///< Line number of the caller; or \\c 0\n\n unsigned is_array:1; ///< Non-zero iff <em>new[]</em> is used\n\n unsigned magic; ///< Magic number for error detection\n\n};\n\n\n\n/**\n", "file_path": "Engine/debug_memory/debug_new.cpp", "rank": 29, "score": 62777.6238909477 }, { "content": "var Value = GetInputConstructorValue(\"Value\", loader);\n", "file_path": "Modules/List/js/delete_by_value_select.js", "rank": 30, "score": 60177.65156049259 }, { "content": "function creates a new chunk with the given parameters and appends it. Type is the 4-letter\n\nname of the chunk.\n\n\n", "file_path": "ChromeWorker/png/lodepng.h", "rank": 31, "score": 55884.114830104794 }, { "content": "class QDropEvent;\n\n\n", "file_path": "Engine/dragwidget.h", "rank": 32, "score": 54862.931178905936 }, { "content": "struct KeyState\n\n{\n\n bool IsShift;\n\n bool IsAlt;\n\n bool IsCtrl;\n\n KeyState();\n\n void Clear();\n\n bool IsClear();\n\n};\n", "file_path": "ChromeWorker/browsereventsemulator.h", "rank": 33, "score": 54859.54670868923 }, { "content": "class DatabaseStateDialog;\n\n}\n\n\n", "file_path": "Studio/databasestatedialog.h", "rank": 34, "score": 54859.54670868923 }, { "content": "7. error values\n\n---------------\n\n\n\nAll functions in LodePNG that return an error code, return 0 if everything went\n\nOK, or a non-zero code if there was an error.\n\n\n\nThe meaning of the LodePNG error values can be retrieved with the function\n\nlodepng_error_text: given the numerical error code, it returns a description\n\nof the error in English as a string.\n\n\n\nCheck the implementation of lodepng_error_text to see the meaning of each code.\n\n\n\n\n", "file_path": "ChromeWorker/png/lodepng.h", "rank": 35, "score": 54837.24586352779 }, { "content": " class value {\n\n public:\n\n typedef std::vector<value> array;\n\n typedef std::map<std::string, value> object;\n\n union _storage {\n\n bool boolean_;\n\n double number_;\n\n#ifdef PICOJSON_USE_INT64\n\n int64_t int64_;\n\n#endif\n\n std::string* string_;\n\n array* array_;\n\n object* object_;\n\n };\n\n protected:\n\n int type_;\n\n _storage u_;\n\n public:\n\n value();\n\n value(int type, bool);\n", "file_path": "ChromeWorker/json/picojson.h", "rank": 36, "score": 54837.24586352779 }, { "content": "template <typename _Byte_type>\n\ninline bool_array::_Element<_Byte_type>::_Element(\n\n _Byte_type* ptr,\n\n size_type pos)\n\n{\n\n _M_byte_ptr = ptr;\n\n _M_byte_pos = (size_t)(pos / 8);\n\n _M_bit_pos = (size_t)(pos % 8);\n\n}\n\n\n\n/**\n\n * Assigns a new boolean value to an array element.\n\n *\n\n * @param value the new boolean value\n\n * @return the assigned boolean value\n\n */\n\ntemplate <typename _Byte_type>\n\ninline bool bool_array::_Element<_Byte_type>::operator=(bool value)\n\n{\n\n if (value)\n", "file_path": "Studio/debug_memory/bool_array.h", "rank": 37, "score": 54829.29914643171 }, { "content": "template <typename _Byte_type>\n\ninline bool_array::_Element<_Byte_type>::_Element(\n\n _Byte_type* ptr,\n\n size_type pos)\n\n{\n\n _M_byte_ptr = ptr;\n\n _M_byte_pos = (size_t)(pos / 8);\n\n _M_bit_pos = (size_t)(pos % 8);\n\n}\n\n\n\n/**\n\n * Assigns a new boolean value to an array element.\n\n *\n\n * @param value the new boolean value\n\n * @return the assigned boolean value\n\n */\n\ntemplate <typename _Byte_type>\n\ninline bool bool_array::_Element<_Byte_type>::operator=(bool value)\n\n{\n\n if (value)\n", "file_path": "Engine/debug_memory/bool_array.h", "rank": 38, "score": 54829.29914643171 }, { "content": "\n\n size_type size() const _NOEXCEPT;\n\n size_type count() const _NOEXCEPT;\n\n size_type count(size_type begin, size_type end = npos) const;\n\n size_type find(bool value, size_type offset = 0) const;\n\n size_type find(bool value, size_type offset, size_type count) const;\n\n size_type find_until(bool value, size_type begin, size_type end) const;\n\n\n\n void flip() _NOEXCEPT;\n\n void swap(bool_array& rhs) _NOEXCEPT;\n\n void merge_and(const bool_array& rhs,\n\n size_type begin = 0,\n\n size_type end = npos,\n\n size_type offset = 0);\n\n void merge_or (const bool_array& rhs,\n\n size_type begin = 0,\n\n size_type end = npos,\n\n size_type offset = 0);\n\n void copy_to_bitmap(void* dest, size_type begin = 0, size_type end = npos);\n\n\n", "file_path": "Engine/debug_memory/bool_array.h", "rank": 39, "score": 54828.65478836206 }, { "content": "\n\n size_type size() const _NOEXCEPT;\n\n size_type count() const _NOEXCEPT;\n\n size_type count(size_type begin, size_type end = npos) const;\n\n size_type find(bool value, size_type offset = 0) const;\n\n size_type find(bool value, size_type offset, size_type count) const;\n\n size_type find_until(bool value, size_type begin, size_type end) const;\n\n\n\n void flip() _NOEXCEPT;\n\n void swap(bool_array& rhs) _NOEXCEPT;\n\n void merge_and(const bool_array& rhs,\n\n size_type begin = 0,\n\n size_type end = npos,\n\n size_type offset = 0);\n\n void merge_or (const bool_array& rhs,\n\n size_type begin = 0,\n\n size_type end = npos,\n\n size_type offset = 0);\n\n void copy_to_bitmap(void* dest, size_type begin = 0, size_type end = npos);\n\n\n", "file_path": "Studio/debug_memory/bool_array.h", "rank": 40, "score": 54828.65478836206 }, { "content": " static const size_type npos = (size_type)-1;\n\n#endif\n\n\n\n bool_array() _NOEXCEPT;\n\n explicit bool_array(size_type size);\n\n bool_array(const void* ptr, size_type size);\n\n ~bool_array();\n\n\n\n bool_array(const bool_array& rhs);\n\n bool_array& operator=(const bool_array& rhs);\n\n\n\n bool create(size_type size) _NOEXCEPT;\n\n void initialize(bool value) _NOEXCEPT;\n\n\n\n reference operator[](size_type pos);\n\n const_reference operator[](size_type pos) const;\n\n\n\n bool at(size_type pos) const;\n\n void reset(size_type pos);\n\n void set(size_type pos);\n", "file_path": "Engine/debug_memory/bool_array.h", "rank": 41, "score": 54827.765325889915 }, { "content": " static const size_type npos = (size_type)-1;\n\n#endif\n\n\n\n bool_array() _NOEXCEPT;\n\n explicit bool_array(size_type size);\n\n bool_array(const void* ptr, size_type size);\n\n ~bool_array();\n\n\n\n bool_array(const bool_array& rhs);\n\n bool_array& operator=(const bool_array& rhs);\n\n\n\n bool create(size_type size) _NOEXCEPT;\n\n void initialize(bool value) _NOEXCEPT;\n\n\n\n reference operator[](size_type pos);\n\n const_reference operator[](size_type pos) const;\n\n\n\n bool at(size_type pos) const;\n\n void reset(size_type pos);\n\n void set(size_type pos);\n", "file_path": "Studio/debug_memory/bool_array.h", "rank": 42, "score": 54827.765325889915 }, { "content": " *(_M_byte_ptr + _M_byte_pos) |= 1 << _M_bit_pos;\n\n else\n\n *(_M_byte_ptr + _M_byte_pos) &= ~(1 << _M_bit_pos);\n\n return value;\n\n}\n\n\n\n/**\n\n * Reads the boolean value from an array element.\n\n *\n\n * @return the boolean value of the accessed array element\n\n */\n\ntemplate <typename _Byte_type>\n\ninline bool_array::_Element<_Byte_type>::operator bool() const\n\n{\n\n return *(_M_byte_ptr + _M_byte_pos) & (1 << _M_bit_pos) ? true : false;\n\n}\n\n\n\n/**\n\n * Constructs an empty bool_array.\n\n */\n", "file_path": "Studio/debug_memory/bool_array.h", "rank": 43, "score": 54826.32204116386 }, { "content": " *(_M_byte_ptr + _M_byte_pos) |= 1 << _M_bit_pos;\n\n else\n\n *(_M_byte_ptr + _M_byte_pos) &= ~(1 << _M_bit_pos);\n\n return value;\n\n}\n\n\n\n/**\n\n * Reads the boolean value from an array element.\n\n *\n\n * @return the boolean value of the accessed array element\n\n */\n\ntemplate <typename _Byte_type>\n\ninline bool_array::_Element<_Byte_type>::operator bool() const\n\n{\n\n return *(_M_byte_ptr + _M_byte_pos) & (1 << _M_bit_pos) ? true : false;\n\n}\n\n\n\n/**\n\n * Constructs an empty bool_array.\n\n */\n", "file_path": "Engine/debug_memory/bool_array.h", "rank": 44, "score": 54826.32204116386 }, { "content": "#include <stdlib.h> // exit/free/NULL\n\n#include <new> // std::bad_alloc\n\n#include <stdexcept> // std::out_of_range\n\n#include <string> // for exception constructors\n\n#include \"_nvwa.h\" // NVWA_NAMESPACE_*\n\n#include \"c++11.h\" // _NOEXCEPT\n\n\n\nNVWA_NAMESPACE_BEGIN\n\n\n\n/**\n\n * Class to represent a packed boolean array.\n\n *\n\n * This was first written in April 1995, before I knew of any existing\n\n * implementation of this kind of classes. Of course, the C++ Standard\n\n * Template Library now demands an implementation of packed boolean\n\n * array as \\c vector&lt;bool&gt;, but the code here should still be\n\n * useful for the following reasons:\n\n *\n\n * -# Some compilers (like MSVC 6) did not implement this\n\n * specialization (and they may not have a \\c bit_vector either);\n\n * -# I included some additional member functions, like \\e #initialize,\n\n * \\e #count, and \\e #find, which should be useful;\n\n * -# My tests show that the code here is significantly FASTER\n\n * than \\c vector&lt;bool&gt; (and the normal boolean array)\n\n * under MSVC versions 6/8/9 and GCC versions before 4.3 (while\n\n * the \\c vector&lt;bool&gt; implementations of MSVC 7.1 and\n\n * GCC 4.3 have performance similar to that of \\c bool_array).\n\n */\n", "file_path": "Engine/debug_memory/bool_array.h", "rank": 45, "score": 54825.36648540233 }, { "content": "#include <stdlib.h> // exit/free/NULL\n\n#include <new> // std::bad_alloc\n\n#include <stdexcept> // std::out_of_range\n\n#include <string> // for exception constructors\n\n#include \"_nvwa.h\" // NVWA_NAMESPACE_*\n\n#include \"c++11.h\" // _NOEXCEPT\n\n\n\nNVWA_NAMESPACE_BEGIN\n\n\n\n/**\n\n * Class to represent a packed boolean array.\n\n *\n\n * This was first written in April 1995, before I knew of any existing\n\n * implementation of this kind of classes. Of course, the C++ Standard\n\n * Template Library now demands an implementation of packed boolean\n\n * array as \\c vector&lt;bool&gt;, but the code here should still be\n\n * useful for the following reasons:\n\n *\n\n * -# Some compilers (like MSVC 6) did not implement this\n\n * specialization (and they may not have a \\c bit_vector either);\n\n * -# I included some additional member functions, like \\e #initialize,\n\n * \\e #count, and \\e #find, which should be useful;\n\n * -# My tests show that the code here is significantly FASTER\n\n * than \\c vector&lt;bool&gt; (and the normal boolean array)\n\n * under MSVC versions 6/8/9 and GCC versions before 4.3 (while\n\n * the \\c vector&lt;bool&gt; implementations of MSVC 7.1 and\n\n * GCC 4.3 have performance similar to that of \\c bool_array).\n\n */\n", "file_path": "Studio/debug_memory/bool_array.h", "rank": 46, "score": 54825.36648540233 }, { "content": " * @throw out_of_range \\a pos is greater than the size of the array\n\n */\n\ninline void bool_array::reset(size_type pos)\n\n{\n\n size_t byte_pos, bit_pos;\n\n if (pos >= _M_length)\n\n throw std::out_of_range(\"invalid bool_array position\");\n\n byte_pos = (size_t)(pos / 8);\n\n bit_pos = (size_t)(pos % 8);\n\n *(_M_byte_ptr + byte_pos) &= ~(1 << bit_pos);\n\n}\n\n\n\n/**\n\n * Sets an array element to \\c true at a specified position.\n\n *\n\n * @param pos position of the array element to access\n\n * @throw out_of_range \\a pos is greater than the size of the array\n\n */\n\ninline void bool_array::set(size_type pos)\n\n{\n", "file_path": "Studio/debug_memory/bool_array.h", "rank": 47, "score": 54824.44925704722 }, { "content": " * @throw out_of_range \\a pos is greater than the size of the array\n\n */\n\ninline void bool_array::reset(size_type pos)\n\n{\n\n size_t byte_pos, bit_pos;\n\n if (pos >= _M_length)\n\n throw std::out_of_range(\"invalid bool_array position\");\n\n byte_pos = (size_t)(pos / 8);\n\n bit_pos = (size_t)(pos % 8);\n\n *(_M_byte_ptr + byte_pos) &= ~(1 << bit_pos);\n\n}\n\n\n\n/**\n\n * Sets an array element to \\c true at a specified position.\n\n *\n\n * @param pos position of the array element to access\n\n * @throw out_of_range \\a pos is greater than the size of the array\n\n */\n\ninline void bool_array::set(size_type pos)\n\n{\n", "file_path": "Engine/debug_memory/bool_array.h", "rank": 48, "score": 54824.44925704722 }, { "content": " * Reads the boolean value of an array element at a specified position.\n\n *\n\n * @param pos position of the array element to access\n\n * @return the boolean value of the accessed array element\n\n * @throw out_of_range \\a pos is greater than the size of the array\n\n */\n\ninline bool bool_array::at(size_type pos) const\n\n{\n\n size_t byte_pos, bit_pos;\n\n if (pos >= _M_length)\n\n throw std::out_of_range(\"invalid bool_array position\");\n\n byte_pos = (size_t)(pos / 8);\n\n bit_pos = (size_t)(pos % 8);\n\n return *(_M_byte_ptr + byte_pos) & (1 << bit_pos) ? true : false;\n\n}\n\n\n\n/**\n\n * Resets an array element to \\c false at a specified position.\n\n *\n\n * @param pos position of the array element to access\n", "file_path": "Studio/debug_memory/bool_array.h", "rank": 49, "score": 54824.08082935222 }, { "content": " * Reads the boolean value of an array element at a specified position.\n\n *\n\n * @param pos position of the array element to access\n\n * @return the boolean value of the accessed array element\n\n * @throw out_of_range \\a pos is greater than the size of the array\n\n */\n\ninline bool bool_array::at(size_type pos) const\n\n{\n\n size_t byte_pos, bit_pos;\n\n if (pos >= _M_length)\n\n throw std::out_of_range(\"invalid bool_array position\");\n\n byte_pos = (size_t)(pos / 8);\n\n bit_pos = (size_t)(pos % 8);\n\n return *(_M_byte_ptr + byte_pos) & (1 << bit_pos) ? true : false;\n\n}\n\n\n\n/**\n\n * Resets an array element to \\c false at a specified position.\n\n *\n\n * @param pos position of the array element to access\n", "file_path": "Engine/debug_memory/bool_array.h", "rank": 50, "score": 54824.08082935222 }, { "content": " * the specified position (default to beginning) to the end.\n\n *\n\n * @param offset the position at which the search is to begin\n\n * @param value the boolean value to find\n\n * @return position of the first value found if successful; \\c #npos\n\n * otherwise\n\n */\n\ninline bool_array::size_type bool_array::find(\n\n bool value,\n\n size_type offset) const\n\n{\n\n return find_until(value, offset, _M_length);\n\n}\n\n\n\n/**\n\n * Searches for the specified boolean value. This function accepts a\n\n * range expressed in {position, count}.\n\n *\n\n * @param offset the position at which the search is to begin\n\n * @param count the number of bits to search\n", "file_path": "Studio/debug_memory/bool_array.h", "rank": 51, "score": 54823.84247856542 }, { "content": " * the specified position (default to beginning) to the end.\n\n *\n\n * @param offset the position at which the search is to begin\n\n * @param value the boolean value to find\n\n * @return position of the first value found if successful; \\c #npos\n\n * otherwise\n\n */\n\ninline bool_array::size_type bool_array::find(\n\n bool value,\n\n size_type offset) const\n\n{\n\n return find_until(value, offset, _M_length);\n\n}\n\n\n\n/**\n\n * Searches for the specified boolean value. This function accepts a\n\n * range expressed in {position, count}.\n\n *\n\n * @param offset the position at which the search is to begin\n\n * @param count the number of bits to search\n", "file_path": "Engine/debug_memory/bool_array.h", "rank": 52, "score": 54823.84247856542 }, { "content": " * @param value the boolean value to find\n\n * @return position of the first value found if successful;\n\n * \\c #npos otherwise\n\n * @throw out_of_range \\a offset and/or \\a count is too big\n\n */\n\ninline bool_array::size_type bool_array::find(\n\n bool value,\n\n size_type offset,\n\n size_type count) const\n\n{\n\n return find_until(value, offset, offset + count);\n\n}\n\n\n\n/**\n\n * Converts the number of bits to number of bytes.\n\n *\n\n * @param num_bits number of bits\n\n * @return number of bytes needed to store \\a num_bits bits\n\n */\n\ninline size_t bool_array::get_num_bytes_from_bits(size_type num_bits)\n", "file_path": "Studio/debug_memory/bool_array.h", "rank": 53, "score": 54823.78631548724 }, { "content": " * @param value the boolean value to find\n\n * @return position of the first value found if successful;\n\n * \\c #npos otherwise\n\n * @throw out_of_range \\a offset and/or \\a count is too big\n\n */\n\ninline bool_array::size_type bool_array::find(\n\n bool value,\n\n size_type offset,\n\n size_type count) const\n\n{\n\n return find_until(value, offset, offset + count);\n\n}\n\n\n\n/**\n\n * Converts the number of bits to number of bytes.\n\n *\n\n * @param num_bits number of bits\n\n * @return number of bytes needed to store \\a num_bits bits\n\n */\n\ninline size_t bool_array::get_num_bytes_from_bits(size_type num_bits)\n", "file_path": "Engine/debug_memory/bool_array.h", "rank": 54, "score": 54823.78631548724 }, { "content": "{\n\n return (size_t)((num_bits + 7) / 8);\n\n}\n\n\n\n/**\n\n * Exchanges the content of two bool_arrays.\n\n *\n\n * @param lhs the first bool_array to exchange\n\n * @param rhs the second bool_array to exchange\n\n */\n\ninline void swap(bool_array& lhs, bool_array& rhs) _NOEXCEPT\n\n{\n\n lhs.swap(rhs);\n\n}\n\n\n\nNVWA_NAMESPACE_END\n\n\n\n#endif // NVWA_BOOL_ARRAY_H\n", "file_path": "Studio/debug_memory/bool_array.h", "rank": 55, "score": 54822.43836624876 }, { "content": "{\n\n return (size_t)((num_bits + 7) / 8);\n\n}\n\n\n\n/**\n\n * Exchanges the content of two bool_arrays.\n\n *\n\n * @param lhs the first bool_array to exchange\n\n * @param rhs the second bool_array to exchange\n\n */\n\ninline void swap(bool_array& lhs, bool_array& rhs) _NOEXCEPT\n\n{\n\n lhs.swap(rhs);\n\n}\n\n\n\nNVWA_NAMESPACE_END\n\n\n\n#endif // NVWA_BOOL_ARRAY_H\n", "file_path": "Engine/debug_memory/bool_array.h", "rank": 56, "score": 54822.43836624876 }, { "content": " * 3. This notice may not be removed or altered from any source\n\n * distribution.\n\n *\n\n * This file is part of Stones of Nvwa:\n\n * http://sourceforge.net/projects/nvwa\n\n *\n\n */\n\n\n\n/**\n\n * @file bool_array.h\n\n *\n\n * Header file for class bool_array (packed boolean array).\n\n *\n\n * @date 2013-10-06\n\n */\n\n\n\n#ifndef NVWA_BOOL_ARRAY_H\n\n#define NVWA_BOOL_ARRAY_H\n\n\n\n#include <assert.h> // assert\n", "file_path": "Engine/debug_memory/bool_array.h", "rank": 57, "score": 54822.02498313789 }, { "content": " * 3. This notice may not be removed or altered from any source\n\n * distribution.\n\n *\n\n * This file is part of Stones of Nvwa:\n\n * http://sourceforge.net/projects/nvwa\n\n *\n\n */\n\n\n\n/**\n\n * @file bool_array.h\n\n *\n\n * Header file for class bool_array (packed boolean array).\n\n *\n\n * @date 2013-10-06\n\n */\n\n\n\n#ifndef NVWA_BOOL_ARRAY_H\n\n#define NVWA_BOOL_ARRAY_H\n\n\n\n#include <assert.h> // assert\n", "file_path": "Studio/debug_memory/bool_array.h", "rank": 58, "score": 54822.02498313789 }, { "content": " size_t byte_pos, bit_pos;\n\n if (pos >= _M_length)\n\n throw std::out_of_range(\"invalid bool_array position\");\n\n byte_pos = (size_t)(pos / 8);\n\n bit_pos = (size_t)(pos % 8);\n\n *(_M_byte_ptr + byte_pos) |= 1 << bit_pos;\n\n}\n\n\n\n/**\n\n * Gets the size of the bool_array.\n\n *\n\n * @return the number of bits of the bool_array\n\n */\n\ninline bool_array::size_type bool_array::size() const _NOEXCEPT\n\n{\n\n return _M_length;\n\n}\n\n\n\n/**\n\n * Searches for the specified boolean value. This function seaches from\n", "file_path": "Engine/debug_memory/bool_array.h", "rank": 59, "score": 54821.430094967734 }, { "content": " size_t byte_pos, bit_pos;\n\n if (pos >= _M_length)\n\n throw std::out_of_range(\"invalid bool_array position\");\n\n byte_pos = (size_t)(pos / 8);\n\n bit_pos = (size_t)(pos % 8);\n\n *(_M_byte_ptr + byte_pos) |= 1 << bit_pos;\n\n}\n\n\n\n/**\n\n * Gets the size of the bool_array.\n\n *\n\n * @return the number of bits of the bool_array\n\n */\n\ninline bool_array::size_type bool_array::size() const _NOEXCEPT\n\n{\n\n return _M_length;\n\n}\n\n\n\n/**\n\n * Searches for the specified boolean value. This function seaches from\n", "file_path": "Studio/debug_memory/bool_array.h", "rank": 60, "score": 54821.430094967734 }, { "content": "inline bool_array::bool_array() _NOEXCEPT : _M_byte_ptr(NULL), _M_length(0)\n\n{\n\n}\n\n\n\n/**\n\n * Destroys the bool_array and releases memory.\n\n */\n\ninline bool_array::~bool_array()\n\n{\n\n if (_M_byte_ptr != NULL)\n\n free(_M_byte_ptr);\n\n}\n\n\n\n/**\n\n * Creates a reference to an array element.\n\n *\n\n * @param pos position of the array element to access\n\n * @return reference to the specified element\n\n */\n\ninline bool_array::reference bool_array::operator[](size_type pos)\n", "file_path": "Studio/debug_memory/bool_array.h", "rank": 61, "score": 54818.328652451135 }, { "content": "inline bool_array::bool_array() _NOEXCEPT : _M_byte_ptr(NULL), _M_length(0)\n\n{\n\n}\n\n\n\n/**\n\n * Destroys the bool_array and releases memory.\n\n */\n\ninline bool_array::~bool_array()\n\n{\n\n if (_M_byte_ptr != NULL)\n\n free(_M_byte_ptr);\n\n}\n\n\n\n/**\n\n * Creates a reference to an array element.\n\n *\n\n * @param pos position of the array element to access\n\n * @return reference to the specified element\n\n */\n\ninline bool_array::reference bool_array::operator[](size_type pos)\n", "file_path": "Engine/debug_memory/bool_array.h", "rank": 62, "score": 54818.328652451135 }, { "content": "// -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-\n\n// vim:tabstop=4:shiftwidth=4:expandtab:\n\n\n\n/*\n\n * Copyright (C) 2004-2013 Wu Yongwei <adah at users dot sourceforge dot net>\n\n *\n\n * This software is provided 'as-is', without any express or implied\n\n * warranty. In no event will the authors be held liable for any\n\n * damages arising from the use of this software.\n\n *\n\n * Permission is granted to anyone to use this software for any purpose,\n\n * including commercial applications, and to alter it and redistribute\n\n * it freely, subject to the following restrictions:\n\n *\n\n * 1. The origin of this software must not be misrepresented; you must\n\n * not claim that you wrote the original software. If you use this\n\n * software in a product, an acknowledgement in the product\n\n * documentation would be appreciated but is not required.\n\n * 2. Altered source versions must be plainly marked as such, and must\n\n * not be misrepresented as being the original software.\n", "file_path": "Studio/debug_memory/bool_array.h", "rank": 63, "score": 54816.890274846315 }, { "content": "// -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-\n\n// vim:tabstop=4:shiftwidth=4:expandtab:\n\n\n\n/*\n\n * Copyright (C) 2004-2013 Wu Yongwei <adah at users dot sourceforge dot net>\n\n *\n\n * This software is provided 'as-is', without any express or implied\n\n * warranty. In no event will the authors be held liable for any\n\n * damages arising from the use of this software.\n\n *\n\n * Permission is granted to anyone to use this software for any purpose,\n\n * including commercial applications, and to alter it and redistribute\n\n * it freely, subject to the following restrictions:\n\n *\n\n * 1. The origin of this software must not be misrepresented; you must\n\n * not claim that you wrote the original software. If you use this\n\n * software in a product, an acknowledgement in the product\n\n * documentation would be appreciated but is not required.\n\n * 2. Altered source versions must be plainly marked as such, and must\n\n * not be misrepresented as being the original software.\n", "file_path": "Engine/debug_memory/bool_array.h", "rank": 64, "score": 54816.890274846315 }, { "content": "{\n\n assert(_M_byte_ptr);\n\n assert(pos < _M_length);\n\n return reference(_M_byte_ptr, pos);\n\n}\n\n\n\n/**\n\n * Creates a const reference to an array element.\n\n *\n\n * @param pos position of the array element to access\n\n * @return const reference to the specified element\n\n */\n\ninline bool_array::const_reference bool_array::operator[](size_type pos) const\n\n{\n\n assert(_M_byte_ptr);\n\n assert(pos < _M_length);\n\n return const_reference(_M_byte_ptr, pos);\n\n}\n\n\n\n/**\n", "file_path": "Engine/debug_memory/bool_array.h", "rank": 65, "score": 54816.2409487314 }, { "content": "{\n\n assert(_M_byte_ptr);\n\n assert(pos < _M_length);\n\n return reference(_M_byte_ptr, pos);\n\n}\n\n\n\n/**\n\n * Creates a const reference to an array element.\n\n *\n\n * @param pos position of the array element to access\n\n * @return const reference to the specified element\n\n */\n\ninline bool_array::const_reference bool_array::operator[](size_type pos) const\n\n{\n\n assert(_M_byte_ptr);\n\n assert(pos < _M_length);\n\n return const_reference(_M_byte_ptr, pos);\n\n}\n\n\n\n/**\n", "file_path": "Studio/debug_memory/bool_array.h", "rank": 66, "score": 54816.2409487314 }, { "content": "#include <stdio.h> // FILE\n\n#include \"_nvwa.h\" // NVWA_NAMESPACE_*\n\n#include \"c++11.h\" // _NOEXCEPT\n\n\n\n/* Special allocation/deallocation functions in the global scope */\n\nvoid* operator new(size_t size, const char* file, int line);\n\nvoid* operator new[](size_t size, const char* file, int line);\n\nvoid operator delete(void* ptr, const char* file, int line) _NOEXCEPT;\n\nvoid operator delete[](void* ptr, const char* file, int line) _NOEXCEPT;\n\n\n\nNVWA_NAMESPACE_BEGIN\n\n\n\n/**\n\n * @def _DEBUG_NEW_REDEFINE_NEW\n\n *\n\n * Macro to indicate whether redefinition of \\c new is wanted. If one\n\n * wants to define one's own <code>operator new</code>, or to call\n\n * <code>operator new</code> directly, it should be defined to \\c 0 to\n\n * alter the default behaviour. Unless, of course, one is willing to\n\n * take the trouble to write something like:\n", "file_path": "Engine/debug_memory/debug_new.h", "rank": 67, "score": 54814.385796934825 }, { "content": "#include <stdio.h> // FILE\n\n#include \"_nvwa.h\" // NVWA_NAMESPACE_*\n\n#include \"c++11.h\" // _NOEXCEPT\n\n\n\n/* Special allocation/deallocation functions in the global scope */\n\nvoid* operator new(size_t size, const char* file, int line);\n\nvoid* operator new[](size_t size, const char* file, int line);\n\nvoid operator delete(void* ptr, const char* file, int line) _NOEXCEPT;\n\nvoid operator delete[](void* ptr, const char* file, int line) _NOEXCEPT;\n\n\n\nNVWA_NAMESPACE_BEGIN\n\n\n\n/**\n\n * @def _DEBUG_NEW_REDEFINE_NEW\n\n *\n\n * Macro to indicate whether redefinition of \\c new is wanted. If one\n\n * wants to define one's own <code>operator new</code>, or to call\n\n * <code>operator new</code> directly, it should be defined to \\c 0 to\n\n * alter the default behaviour. Unless, of course, one is willing to\n\n * take the trouble to write something like:\n", "file_path": "Studio/debug_memory/debug_new.h", "rank": 68, "score": 54814.385796934825 }, { "content": " static size_t get_num_bytes_from_bits(size_type num_bits);\n\n\n\nprivate:\n\n byte get_8bits(size_type offset, size_type end) const;\n\n\n\n byte* _M_byte_ptr;\n\n size_type _M_length;\n\n static byte _S_bit_count[256];\n\n static byte _S_bit_ordinal[256];\n\n};\n\n\n\n\n\n/* Inline functions */\n\n\n\n/**\n\n * Constructs a reference to an array element.\n\n *\n\n * @param ptr ptr to the interal boolean data\n\n * @param pos position of the array element to access\n\n */\n", "file_path": "Engine/debug_memory/bool_array.h", "rank": 69, "score": 54810.9597530575 }, { "content": " static size_t get_num_bytes_from_bits(size_type num_bits);\n\n\n\nprivate:\n\n byte get_8bits(size_type offset, size_type end) const;\n\n\n\n byte* _M_byte_ptr;\n\n size_type _M_length;\n\n static byte _S_bit_count[256];\n\n static byte _S_bit_ordinal[256];\n\n};\n\n\n\n\n\n/* Inline functions */\n\n\n\n/**\n\n * Constructs a reference to an array element.\n\n *\n\n * @param ptr ptr to the interal boolean data\n\n * @param pos position of the array element to access\n\n */\n", "file_path": "Studio/debug_memory/bool_array.h", "rank": 70, "score": 54810.9597530575 }, { "content": "/**\n\n * @def _DEBUG_NEW_TYPE\n\n *\n\n * Macro to indicate which variant of #DEBUG_NEW is wanted. The\n\n * default value \\c 1 allows the use of placement new (like\n\n * <code>%new(std::nothrow)</code>), but the verbose output (when\n\n * nvwa#new_verbose_flag is \\c true) looks worse than some older\n\n * versions (no file/line information for allocations). Define it\n\n * to \\c 2 to revert to the old behaviour that records file and line\n\n * information directly on the call to <code>operator new</code>.\n\n */\n\n#ifndef _DEBUG_NEW_TYPE\n\n#define _DEBUG_NEW_TYPE 1\n\n#endif\n\n\n\n/* Prototypes */\n\nint check_leaks();\n\nint check_mem_corruption();\n\n\n\n/* Control variables */\n", "file_path": "Engine/debug_memory/debug_new.h", "rank": 71, "score": 54809.13761721055 }, { "content": "/**\n\n * @def _DEBUG_NEW_TYPE\n\n *\n\n * Macro to indicate which variant of #DEBUG_NEW is wanted. The\n\n * default value \\c 1 allows the use of placement new (like\n\n * <code>%new(std::nothrow)</code>), but the verbose output (when\n\n * nvwa#new_verbose_flag is \\c true) looks worse than some older\n\n * versions (no file/line information for allocations). Define it\n\n * to \\c 2 to revert to the old behaviour that records file and line\n\n * information directly on the call to <code>operator new</code>.\n\n */\n\n#ifndef _DEBUG_NEW_TYPE\n\n#define _DEBUG_NEW_TYPE 1\n\n#endif\n\n\n\n/* Prototypes */\n\nint check_leaks();\n\nint check_mem_corruption();\n\n\n\n/* Control variables */\n", "file_path": "Studio/debug_memory/debug_new.h", "rank": 72, "score": 54809.13761721055 }, { "content": "# define new DEBUG_NEW\n\n# endif\n\n# ifdef _DEBUG_NEW_EMULATE_MALLOC\n\n# include <stdlib.h>\n\n# ifdef new\n\n# define malloc(s) ((void*)(new char[s]))\n\n# else\n\n# define malloc(s) ((void*)(DEBUG_NEW char[s]))\n\n# endif\n\n# define free(p) delete[] (char*)(p)\n\n# endif\n\n\n\n/**\n\n * Recorder class to remember the call context.\n\n *\n\n * The idea comes from <a href=\"http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/7089382e3bc1c489/85f9107a1dc79ee9?#85f9107a1dc79ee9\">Greg Herlihy's post</a> in comp.lang.c++.moderated.\n\n */\n", "file_path": "Engine/debug_memory/debug_new.h", "rank": 73, "score": 54806.47693853767 }, { "content": "# define new DEBUG_NEW\n\n# endif\n\n# ifdef _DEBUG_NEW_EMULATE_MALLOC\n\n# include <stdlib.h>\n\n# ifdef new\n\n# define malloc(s) ((void*)(new char[s]))\n\n# else\n\n# define malloc(s) ((void*)(DEBUG_NEW char[s]))\n\n# endif\n\n# define free(p) delete[] (char*)(p)\n\n# endif\n\n\n\n/**\n\n * Recorder class to remember the call context.\n\n *\n\n * The idea comes from <a href=\"http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/7089382e3bc1c489/85f9107a1dc79ee9?#85f9107a1dc79ee9\">Greg Herlihy's post</a> in comp.lang.c++.moderated.\n\n */\n", "file_path": "Studio/debug_memory/debug_new.h", "rank": 74, "score": 54806.47693853767 }, { "content": "extern bool new_autocheck_flag; // default to true: call check_leaks() on exit\n\nextern bool new_verbose_flag; // default to false: no verbose information\n\nextern FILE* new_output_fp; // default to stderr: output to console\n\nextern const char* new_progname;// default to NULL; should be assigned argv[0]\n\n\n\n/**\n\n * @def DEBUG_NEW\n\n *\n\n * Macro to catch file/line information on allocation. If\n\n * #_DEBUG_NEW_REDEFINE_NEW is \\c 0, one can use this macro directly;\n\n * otherwise \\c new will be defined to it, and one must use \\c new\n\n * instead.\n\n */\n\n# if _DEBUG_NEW_TYPE == 1\n\n# define DEBUG_NEW NVWA::debug_new_recorder(__FILE__, __LINE__) ->* new\n\n# else\n\n# define DEBUG_NEW new(__FILE__, __LINE__)\n\n# endif\n\n\n\n# if _DEBUG_NEW_REDEFINE_NEW\n", "file_path": "Engine/debug_memory/debug_new.h", "rank": 75, "score": 54805.78791710394 }, { "content": "\n\n Qt::CheckState itemCheckState(int index) const;\n\n void setItemCheckState(int index, Qt::CheckState state);\n\n\n\n QString separator() const;\n\n void setSeparator(const QString& separator);\n\n\n\n QStringList checkedItems() const;\n\n QStringList checkedData() const;\n\n\n\n QList<int> checkedIndexes();\n\n\n\n\n\n bool eventFilter(QObject* receiver, QEvent* event);\n\n QString _separator;\n\n QString _defaultText;\n\n bool containerMousePress;\n\n\n\n //virtual void paintEvent(QPaintEvent *event);\n\n\n", "file_path": "Engine/qxtcheckcombobox.h", "rank": 76, "score": 46.479770076673894 }, { "content": " int index = 0;\n\n foreach (DatabaseColumn Column, Columns)\n\n {\n\n QVariant val;\n\n QWidget*DataItem = Widgets[Column.Id];\n\n switch(Column.Type)\n\n {\n\n case DatabaseColumn::String: val = qobject_cast<QLineEdit*>(DataItem)->text(); break;\n\n case DatabaseColumn::Int: val = qobject_cast<QSpinBox*>(DataItem)->value(); break;\n\n case DatabaseColumn::Bool: val = qobject_cast<QCheckBox*>(DataItem)->isChecked(); break;\n\n case DatabaseColumn::Date: val = qobject_cast<QDateTimeEdit*>(DataItem)->dateTime(); break;\n\n\n\n }\n\n res.Data[Column.Id] = val;\n\n index++;\n\n }\n\n return res;\n\n}\n\n\n\nvoid DatabaseAdminItemEdit::SetDatabaseItem(DatabaseItem Item)\n", "file_path": "Engine/databaseadminitemedit.cpp", "rank": 78, "score": 42.19681964769058 }, { "content": " {\n\n QLabel *Label = new QLabel(this);\n\n Label->setText(Column.Description);\n\n QWidget *DataItem;\n\n switch(Column.Type)\n\n {\n\n case DatabaseColumn::String: {QLineEdit* e = new QLineEdit(this);e->setMaxLength(2147483647); DataItem = e;} break;\n\n case DatabaseColumn::Int: {QSpinBox * w = new QSpinBox(this);w->setMinimum(-1000000);w->setMaximum(1000000);DataItem = w;} break;\n\n case DatabaseColumn::Bool: DataItem = new QCheckBox(this); break;\n\n case DatabaseColumn::Date: DataItem = new QDateTimeEdit(this); break;\n\n\n\n }\n\n Widgets[Column.Id] = DataItem;\n\n ui->MainLayout->addRow(Label,DataItem);\n\n }\n\n}\n\n\n\nvoid DatabaseAdminItemEdit::HideGroupBox()\n\n{\n\n ui->comboBox->setVisible(false);\n", "file_path": "Engine/databaseadminitemedit.cpp", "rank": 81, "score": 39.28948896391996 }, { "content": " {\n\n i.next();\n\n std::string column = QString::number(i.key()).toStdString();\n\n switch(i.value().type())\n\n {\n\n case QVariant::Int:\n\n {\n\n ItemBuild.append(column,i.value().toInt());\n\n }break;\n\n case QVariant::String:\n\n {\n\n ItemBuild.append(column,i.value().toString().toStdString());\n\n }break;\n\n case QVariant::Bool:\n\n {\n\n ItemBuild.append(column,i.value().toBool());\n\n }break;\n\n case QVariant::DateTime:\n\n {\n\n ItemBuild.append(column,Date_t(i.value().toDateTime().toMSecsSinceEpoch()));\n", "file_path": "Engine/mongodatabaseconnector.cpp", "rank": 82, "score": 38.0277790571506 }, { "content": " item.Id = id;\n\n item.IsNull = false;\n\n\n\n for(int i = 0;i<Params.length() - 1;i+=2)\n\n {\n\n int ColumnIndex = Params.at(i).toInt();\n\n QString val = Params.at(i+1);\n\n\n\n QVariant VariantParam;\n\n foreach(DatabaseColumn Column, Columns)\n\n {\n\n if(ColumnIndex == Column.Id)\n\n {\n\n switch(Column.Type)\n\n {\n\n case DatabaseColumn::Int: VariantParam = QVariant(val.toInt());break;\n\n case DatabaseColumn::String: VariantParam = QVariant(val);break;\n\n case DatabaseColumn::Bool: VariantParam = QVariant(val == \"true\");break;\n\n case DatabaseColumn::Date:\n\n {\n", "file_path": "Engine/engineresourcestringbox.cpp", "rank": 83, "score": 37.36104226344257 }, { "content": " {\n\n case DatabaseColumn::String: qobject_cast<QLineEdit*>(DataItem)->setText(val.toString()); break;\n\n case DatabaseColumn::Int: qobject_cast<QSpinBox*>(DataItem)->setValue(val.toInt()); break;\n\n case DatabaseColumn::Bool: qobject_cast<QCheckBox*>(DataItem)->setChecked(val.toBool()); break;\n\n case DatabaseColumn::Date: qobject_cast<QDateTimeEdit*>(DataItem)->setDateTime(val.toDateTime()); break;\n\n\n\n }\n\n }\n\n\n\n\n\n }\n\n}\n\n\n\nDatabaseAdminItemEdit::~DatabaseAdminItemEdit()\n\n{\n\n delete ui;\n\n}\n", "file_path": "Engine/databaseadminitemedit.cpp", "rank": 84, "score": 36.77955417559164 }, { "content": " emit Done(\"Closed by user\",id,false);\n\n this->deleteLater();\n\n }\n\n\n\n void SingleCaptchaWidget::on_pushButton_clicked()\n\n {\n\n emit Done(ui->lineEdit->text(),id,true);\n\n this->deleteLater();\n\n }\n\n\n\n void SingleCaptchaWidget::on_lineEdit_returnPressed()\n\n {\n\n emit Done(ui->lineEdit->text(),id,true);\n\n this->deleteLater();\n\n }\n\n\n\n void SingleCaptchaWidget::changeEvent(QEvent *e)\n\n {\n\n QWidget::changeEvent(e);\n\n switch (e->type()) {\n", "file_path": "Engine/singlecaptchawidget.cpp", "rank": 85, "score": 35.997168804264916 }, { "content": " state = Disconnected;\n\n}\n\n\n\nvoid QxtPop3Private::socketRead()\n\n{\n\n buffer += socket->readAll();\n\n while (true)\n\n {\n\n int pos = buffer.indexOf(\"\\r\\n\");\n\n if (pos < 0) return;\n\n QByteArray line = buffer.left(pos);\n\n buffer = buffer.mid(pos + 2);\n\n// qDebug(\"QxtPop3Private::socketRead: received %s\", line.data());\n\n switch (state)\n\n {\n\n case StartState: // we expect a greetings line, beginning with \"+OK\"\n\n if (!QxtPop3ReplyImpl::isAnswerOK(line))\n\n {\n\n q_func()->disconnectFromHost();\n\n }\n", "file_path": "Engine/mail/mailpop3.cpp", "rank": 86, "score": 35.64543978789018 }, { "content": "\n\n void UserResourceWrapper::VisibilityTriggerChanged(const QString& Value)\n\n {\n\n QStringList list = GetVisibilityConditionValue().split(QRegExp(\"[\\\\|\\\\;\\\\,]\"));\n\n bool res = false;\n\n foreach(QString item, list)\n\n {\n\n if(Value.contains(item))\n\n {\n\n res = true;\n\n break;\n\n }\n\n }\n\n IsVisibleAccordingToTrigger = res;\n\n emit RequiresValidationStateChanged(IsVisible && IsVisibleAccordingToTrigger && DependendVisibilityParentVisible);\n\n\n\n if(res)\n\n {\n\n Widget->SetVisibleToUser(IsVisible && DependendVisibilityParentVisible && IsAdvancedVisible);\n\n emit VisibilityChanged(IsVisible && DependendVisibilityParentVisible && IsAdvancedVisible);\n", "file_path": "Engine/userresourcewrapper.cpp", "rank": 87, "score": 35.450326053854084 }, { "content": " return QWidget::eventFilter(obj, event);\n\n}\n\n\n\nvoid UIConstructor::EditUnit(int index)\n\n{\n\n QDialog d;\n\n d.setMinimumWidth(400);\n\n d.setWindowTitle(tr(\"Edit resource\"));\n\n d.setLayout(new QVBoxLayout(&d));\n\n d.layout()->setAlignment(Qt::AlignTop);\n\n QWidget *WidgetResource = Data[CurrentTab][index].WidgetEdit;\n\n QWidget *WidgetParent = WidgetResource->parentWidget();\n\n QVBoxLayout *LayoutParent = dynamic_cast<QVBoxLayout *>(WidgetParent->layout());\n\n int Index = LayoutParent->indexOf(WidgetResource);\n\n QScrollArea *Scroll = new QScrollArea(&d);\n\n Scroll->setWidgetResizable(true);\n\n QWidget *ScrollWidget = new QWidget(Scroll);\n\n ScrollWidget->setLayout(new QVBoxLayout(ScrollWidget));\n\n ScrollWidget->layout()->addWidget(WidgetResource);\n\n ScrollWidget->layout()->addItem(new QSpacerItem(10, 10, QSizePolicy::Expanding, QSizePolicy::Expanding));\n", "file_path": "Engine/uiconstructor.cpp", "rank": 88, "score": 35.33094006532995 }, { "content": " typedef value::object object;\n\n \n\n inline value::value() : type_(null_type) {}\n\n \n\n inline value::value(int type, bool) : type_(type) {\n\n switch (type) {\n\n#define INIT(p, v) case p##type: u_.p = v; break\n\n INIT(boolean_, false);\n\n INIT(number_, 0.0);\n\n#ifdef PICOJSON_USE_INT64\n\n INIT(int64_, 0);\n\n#endif\n\n INIT(string_, new std::string());\n\n INIT(array_, new array());\n\n INIT(object_, new object());\n\n#undef INIT\n\n default: break;\n\n }\n\n }\n\n \n", "file_path": "ChromeWorker/json/picojson.h", "rank": 89, "score": 35.02916299160572 }, { "content": "\n\n\n\n\n\nQWidget* DesignChooserResourceWidget::GetTemplateWidgetByIndex(int index)\n\n{\n\n return ui->stackedWidget->widget(index);\n\n}\n\n\n\nvoid DesignChooserResourceWidget::changeEvent(QEvent *e)\n\n{\n\n QWidget::changeEvent(e);\n\n switch (e->type()) {\n\n case QEvent::LanguageChange:\n\n ui->retranslateUi(this);\n\n break;\n\n default:\n\n break;\n\n }\n\n}\n\n\n", "file_path": "Engine/designchooserresourcewidget.cpp", "rank": 90, "score": 35.000525270605195 }, { "content": " {\n\n ui->ComboType->addItem(tr(\"Is True\"));\n\n ui->ComboType->addItem(tr(\"Is False\"));\n\n }break;\n\n }\n\n}\n\n\n\nvoid DatabaseAdminFilterCreate::on_ComboType_currentIndexChanged(int index)\n\n{\n\n if(Widget)\n\n {\n\n delete Widget;\n\n Widget = 0;\n\n }\n\n DatabaseColumn Column = Columns[ui->ComboColumn->currentIndex()];\n\n switch(Column.Type)\n\n {\n\n case DatabaseColumn::String:\n\n {\n\n if(index == 2)\n", "file_path": "Engine/databaseadminfiltercreate.cpp", "rank": 91, "score": 34.93993837027039 }, { "content": " {\n\n case DatabaseColumn::Int:\n\n {\n\n ItemBuild.append(column_name,Item.toInt());\n\n }break;\n\n case DatabaseColumn::String:\n\n {\n\n ItemBuild.append(column_name,Item.toStdString());\n\n }break;\n\n case DatabaseColumn::Bool:\n\n {\n\n ItemBuild.append(column_name,Item == \"true\");\n\n }break;\n\n case DatabaseColumn::Date:\n\n {\n\n ItemBuild.append(column_name,Date_t(QDateTime::fromString(\"yyyy-MM-dd HH:mm:ss\").toMSecsSinceEpoch()));\n\n }break;\n\n\n\n }\n\n index++;\n", "file_path": "Engine/mongodatabaseconnector.cpp", "rank": 92, "score": 34.81466846196093 }, { "content": "\n\n\n\n void DesignResourceWidget::changeEvent(QEvent *e)\n\n {\n\n QGroupBox::changeEvent(e);\n\n switch (e->type()) {\n\n case QEvent::LanguageChange:\n\n {\n\n int index = ui->comboBox->currentIndex();\n\n ui->retranslateUi(this);\n\n ui->comboBox->setCurrentIndex(index);\n\n DescriptionChanged(DescriptionTextBox->GetCurrentText());\n\n break;\n\n }\n\n default:\n\n break;\n\n }\n\n }\n\n\n\n\n", "file_path": "Engine/designresourcewidget.cpp", "rank": 93, "score": 34.27579166687983 }, { "content": "public Q_SLOTS:\n\n void setCheckedItems(const QStringList& items);\n\n void setCheckedData(const QStringList& items);\n\n void setCheckedIndexes(const QList<int>& indexes);\n\n QList<int> currentIndexes();\n\n\n\n void updateCheckedItems();\n\n void toggleCheckState(int index);\n\n\n\nQ_SIGNALS:\n\n void checkedItemsChanged(const QStringList& items);\n\n void checkedIndexesChanged(const QList<int>& itemsLast,const QList<int>& itemsNew);\n\n};\n\n\n\n#endif // QXTCHECKCOMBOBOX_H\n", "file_path": "Engine/qxtcheckcombobox.h", "rank": 94, "score": 34.099838573441815 }, { "content": " virtual bool IsValid() = 0;\n\n virtual bool GetRequiresValidation() = 0;\n\n\n\n virtual bool GetIsAdvancedVisible() = 0;\n\n\n\n virtual void SetVisibleAdvanced(bool Visible) = 0;\n\n\n\n signals:\n\n void Up(int index);\n\n void Down(int index);\n\n void VariableNameChanged(QString name);\n\n void ResourceDestroyed();\n\n void VisibilityChanged(bool Visible);\n\n void ValidationStateChanged();\n\n void RequiresValidationStateChanged(bool Visible);\n\n public slots:\n\n virtual void VisibilityTriggerChanged(const QString& Value) = 0;\n\n virtual void VisibilityParentChanged(bool Visible) = 0;\n\n virtual void VisibilityAdvancedChanged(bool Visible) = 0;\n\n };\n\n}\n\n\n\n#endif // IRESOURCEWIDGET_H\n", "file_path": "Engine/iresourcewidget.h", "rank": 95, "score": 33.92772862319036 }, { "content": "void DatabaseAdminTable::SingleItemEdit(QString Index)\n\n{\n\n DatabaseAdminItemEdit d;\n\n\n\n d.HideGroupBox();\n\n QList<DatabaseColumn> columns = DatabaseConnector->GetColumns(TableId);\n\n\n\n d.SetColumns(columns);\n\n\n\n bool found = false;\n\n DatabaseItem Item;\n\n foreach(DatabaseItem i, CurrentItems)\n\n {\n\n if(i.Id == Index)\n\n {\n\n Item = i;\n\n found = true;\n\n break;\n\n }\n\n }\n", "file_path": "Engine/databaseadmintable.cpp", "rank": 97, "score": 33.731558432727546 }, { "content": " dataStream >> text >> offset;\n\n\n\n\n\n\n\n QLabel *newIcon = new QLabel(this);\n\n newIcon->setText(text);\n\n\n\n int index = 0;\n\n\n\n while(index < Layout->count())\n\n {\n\n QLayoutItem* item = Layout->itemAt(index);\n\n if(item)\n\n {\n\n if(!item->widget())\n\n {\n\n break;\n\n }\n\n if(!((event->pos() - offset).y() > item->widget()->pos().y()))\n\n {\n", "file_path": "Engine/dragwidget.cpp", "rank": 99, "score": 33.24865800299428 } ]
C++
wrappers/src/object-store/tests/results.cpp
drungrin/realm-dotnet
ebf18e8493fc730bfef694957a00b7890fc360c8
#include "catch.hpp" #include "util/test_file.hpp" #include "impl/realm_coordinator.hpp" #include "object_schema.hpp" #include "property.hpp" #include "results.hpp" #include "schema.hpp" #include <realm/commit_log.hpp> #include <realm/group_shared.hpp> #include <realm/link_view.hpp> using namespace realm; TEST_CASE("Results") { InMemoryTestFile config; config.cache = false; config.automatic_change_notifications = false; config.schema = std::make_unique<Schema>(Schema{ {"object", "", { {"value", PropertyTypeInt}, {"link", PropertyTypeObject, "linked to object", false, false, true} }}, {"other object", "", { {"value", PropertyTypeInt} }}, {"linking object", "", { {"link", PropertyTypeObject, "object", false, false, true} }}, {"linked to object", "", { {"value", PropertyTypeInt} }} }); auto r = Realm::get_shared_realm(config); auto coordinator = _impl::RealmCoordinator::get_existing_coordinator(config.path); auto table = r->read_group()->get_table("class_object"); r->begin_transaction(); table->add_empty_row(10); for (int i = 0; i < 10; ++i) table->set_int(0, i, i); r->commit_transaction(); Results results(r, *config.schema->find("object"), table->where().greater(0, 0).less(0, 5)); SECTION("notifications") { int notification_calls = 0; auto token = results.async([&](std::exception_ptr err) { REQUIRE_FALSE(err); ++notification_calls; }); coordinator->on_change(); r->notify(); SECTION("initial results are delivered") { REQUIRE(notification_calls == 1); } SECTION("modifying the table sends a notification asynchronously") { r->begin_transaction(); table->set_int(0, 0, 0); r->commit_transaction(); REQUIRE(notification_calls == 1); coordinator->on_change(); r->notify(); REQUIRE(notification_calls == 2); } SECTION("modifying a linked-to table send a notification") { r->begin_transaction(); r->read_group()->get_table("class_linked to object")->add_empty_row(); r->commit_transaction(); REQUIRE(notification_calls == 1); coordinator->on_change(); r->notify(); REQUIRE(notification_calls == 2); } SECTION("modifying a a linking table sends a notification") { r->begin_transaction(); r->read_group()->get_table("class_linking object")->add_empty_row(); r->commit_transaction(); REQUIRE(notification_calls == 1); coordinator->on_change(); r->notify(); REQUIRE(notification_calls == 2); } SECTION("modifying a an unrelated table does not send a notification") { r->begin_transaction(); r->read_group()->get_table("class_other object")->add_empty_row(); r->commit_transaction(); REQUIRE(notification_calls == 1); coordinator->on_change(); r->notify(); REQUIRE(notification_calls == 1); } SECTION("modifications from multiple transactions are collapsed") { r->begin_transaction(); table->set_int(0, 0, 0); r->commit_transaction(); r->begin_transaction(); table->set_int(0, 1, 0); r->commit_transaction(); REQUIRE(notification_calls == 1); coordinator->on_change(); r->notify(); REQUIRE(notification_calls == 2); } SECTION("notifications are not delivered when the token is destroyed before they are calculated") { r->begin_transaction(); table->set_int(0, 0, 0); r->commit_transaction(); REQUIRE(notification_calls == 1); token = {}; coordinator->on_change(); r->notify(); REQUIRE(notification_calls == 1); } SECTION("notifications are not delivered when the token is destroyed before they are delivered") { r->begin_transaction(); table->set_int(0, 0, 0); r->commit_transaction(); REQUIRE(notification_calls == 1); coordinator->on_change(); token = {}; r->notify(); REQUIRE(notification_calls == 1); } } }
#include "catch.hpp" #include "util/test_file.hpp" #include "impl/realm_coordinator.hpp" #include "object_schema.hpp" #include "property.hpp" #include "results.hpp" #include "schema.hpp" #include <realm/commit_log.hpp> #include <realm/group_shared.hpp> #include <realm/link_view.hpp> using namespace realm; TEST_CASE("Results") { InMemoryTestFile config; config.cache = false; config.automatic_change_notifications = false; config.schema = std::make_unique<Schema>(Schema{ {"object", "", { {"value", PropertyTypeInt}, {"link", PropertyTypeObject, "linked to object", false, false, true} }}, {"other object", "", { {"value", PropertyTypeInt} }}, {"linking object", "", { {"link", PropertyTypeObject, "object", false, false, true} }}, {"linked to object", "", { {"value", PropertyTypeInt} }} }); auto r = Realm::get_shared_realm(config); auto coordinator = _impl::RealmCoordinator::get_existing_coordinator(config.path); auto table = r->read_group()->get_table("class_object"); r->begin_transaction(); table->add_empty_row(10); for (int i = 0; i < 10; ++i) table->set_int(0, i, i); r->commit_transaction(); Results results(r, *config.schema->find("object"), table->where().greater(0, 0).less(0, 5)); SECTION("notifications") { int notification_calls = 0; auto token = results.async([&](std::exception_ptr err) { REQUIRE_FALSE(err); ++notification_calls; }); coordinator->on_change(); r->notify(); SECTION("initial results are delivered") { REQUIRE(notification_calls == 1); } SECTION("modifying the table sends a notification asynchronously") { r->begin_transaction(); table->set_int(0, 0, 0); r->commit_transaction(); REQUIRE(notification_calls == 1); coordinator->on_change(); r->notify(); REQUIRE(notification_calls == 2); } SECTION("modifying a linked-to table send a notification") { r->begin_transaction(); r->read_group()->get_table("class_linked to object")->add_empty_row(); r->commit_transaction(); REQUIRE(notification_calls == 1); coordinator->on_change(); r->notify(); REQUIRE(notification_calls == 2); } SECTION("modifying a a linking table sends a notification") { r->begin_transaction();
(); REQUIRE(notification_calls == 1); } SECTION("modifications from multiple transactions are collapsed") { r->begin_transaction(); table->set_int(0, 0, 0); r->commit_transaction(); r->begin_transaction(); table->set_int(0, 1, 0); r->commit_transaction(); REQUIRE(notification_calls == 1); coordinator->on_change(); r->notify(); REQUIRE(notification_calls == 2); } SECTION("notifications are not delivered when the token is destroyed before they are calculated") { r->begin_transaction(); table->set_int(0, 0, 0); r->commit_transaction(); REQUIRE(notification_calls == 1); token = {}; coordinator->on_change(); r->notify(); REQUIRE(notification_calls == 1); } SECTION("notifications are not delivered when the token is destroyed before they are delivered") { r->begin_transaction(); table->set_int(0, 0, 0); r->commit_transaction(); REQUIRE(notification_calls == 1); coordinator->on_change(); token = {}; r->notify(); REQUIRE(notification_calls == 1); } } }
r->read_group()->get_table("class_linking object")->add_empty_row(); r->commit_transaction(); REQUIRE(notification_calls == 1); coordinator->on_change(); r->notify(); REQUIRE(notification_calls == 2); } SECTION("modifying a an unrelated table does not send a notification") { r->begin_transaction(); r->read_group()->get_table("class_other object")->add_empty_row(); r->commit_transaction(); REQUIRE(notification_calls == 1); coordinator->on_change(); r->notify
random
[ { "content": "struct ValueGetter<Int, TableGetter> {\n\n static Int convert(TableGetter&&, const parser::Expression & value, Arguments &args)\n\n {\n\n if (value.type == parser::Expression::Type::Argument) {\n\n return args.long_for_argument(stot<int>(value.s));\n\n }\n\n return stot<long long>(value.s);\n\n }\n\n};\n\n\n\ntemplate <typename TableGetter>\n", "file_path": "wrappers/src/object-store/src/parser/query_builder.cpp", "rank": 0, "score": 171603.5841718181 }, { "content": "class Results;\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.hpp", "rank": 1, "score": 166494.91037915432 }, { "content": "struct TestFile : realm::Realm::Config {\n\n TestFile();\n\n ~TestFile();\n\n};\n\n\n", "file_path": "wrappers/src/object-store/tests/util/test_file.hpp", "rank": 2, "score": 159108.45091983024 }, { "content": "struct AsyncQueryCancelationToken;\n\n\n\nnamespace _impl {\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.hpp", "rank": 3, "score": 155139.7666355736 }, { "content": "struct true_value : pegtl_istring_t(\"true\") {};\n", "file_path": "wrappers/src/object-store/src/parser/parser.cpp", "rank": 4, "score": 147700.97269541209 }, { "content": "// RealmCoordinator manages the weak cache of Realm instances and communication\n\n// between per-thread Realm instances for a given file\n\nclass RealmCoordinator : public std::enable_shared_from_this<RealmCoordinator> {\n\npublic:\n\n // Get the coordinator for the given path, creating it if neccesary\n\n static std::shared_ptr<RealmCoordinator> get_coordinator(StringData path);\n\n // Get the coordinator for the given path, or null if there is none\n\n static std::shared_ptr<RealmCoordinator> get_existing_coordinator(StringData path);\n\n\n\n // Get a thread-local shared Realm with the given configuration\n\n // If the Realm is already open on another thread, validates that the given\n\n // configuration is compatible with the existing one\n\n std::shared_ptr<Realm> get_realm(Realm::Config config);\n\n std::shared_ptr<Realm> get_realm();\n\n\n\n const Schema* get_schema() const noexcept;\n\n uint64_t get_schema_version() const noexcept { return m_config.schema_version; }\n\n const std::string& get_path() const noexcept { return m_config.path; }\n\n const std::vector<char>& get_encryption_key() const noexcept { return m_config.encryption_key; }\n\n bool is_in_memory() const noexcept { return m_config.in_memory; }\n\n\n\n // Asynchronously call notify() on every Realm instance for this coordinator's\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.hpp", "rank": 5, "score": 142543.49181552642 }, { "content": " class RealmCoordinator;\n\n }\n\n\n", "file_path": "wrappers/src/object-store/src/shared_realm.hpp", "rank": 6, "score": 134338.9082635727 }, { "content": "// FIXME: TrueExpression and FalseExpression should be supported by core in some way\n\nstruct TrueExpression : realm::Expression {\n\n size_t find_first(size_t start, size_t end) const override\n\n {\n\n if (start != end)\n\n return start;\n\n\n\n return realm::not_found;\n\n }\n\n void set_base_table(const Table*) override {}\n\n const Table* get_base_table() const override { return nullptr; }\n\n std::unique_ptr<Expression> clone(QueryNodeHandoverPatches*) const override\n\n {\n\n return std::unique_ptr<Expression>(new TrueExpression(*this));\n\n }\n\n};\n\n\n", "file_path": "wrappers/src/object-store/src/parser/query_builder.cpp", "rank": 7, "score": 130488.83623084967 }, { "content": "class WeakRealmNotifier;\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.hpp", "rank": 8, "score": 128773.28248804285 }, { "content": " // path, including those in other processes\n\n void send_commit_notifications();\n\n\n\n // Clear the weak Realm cache for all paths\n\n // Should only be called in test code, as continuing to use the previously\n\n // cached instances will have odd results\n\n static void clear_cache();\n\n\n\n // Clears all caches on existing coordinators\n\n static void clear_all_caches();\n\n\n\n // Explicit constructor/destructor needed for the unique_ptrs to forward-declared types\n\n RealmCoordinator();\n\n ~RealmCoordinator();\n\n\n\n // Called by Realm's destructor to ensure the cache is cleaned up promptly\n\n // Do not call directly\n\n void unregister_realm(Realm* realm);\n\n\n\n // Called by m_notifier when there's a new commit to send notifications for\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.hpp", "rank": 9, "score": 126599.42023404858 }, { "content": "#include \"impl/async_query.hpp\"\n\n#include \"impl/weak_realm_notifier.hpp\"\n\n#include \"impl/external_commit_helper.hpp\"\n\n#include \"impl/transact_log_handler.hpp\"\n\n#include \"object_store.hpp\"\n\n#include \"schema.hpp\"\n\n\n\n#include <realm/commit_log.hpp>\n\n#include <realm/group_shared.hpp>\n\n#include <realm/lang_bind_helper.hpp>\n\n#include <realm/query.hpp>\n\n#include <realm/table_view.hpp>\n\n\n\n#include <cassert>\n\n#include <unordered_map>\n\n\n\nusing namespace realm;\n\nusing namespace realm::_impl;\n\n\n\nstatic std::mutex s_coordinator_mutex;\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 10, "score": 126596.92501506646 }, { "content": " coordinator->clear_cache();\n\n }\n\n }\n\n}\n\n\n\nvoid RealmCoordinator::send_commit_notifications()\n\n{\n\n REALM_ASSERT(!m_config.read_only);\n\n if (m_notifier) {\n\n m_notifier->notify_others();\n\n }\n\n}\n\n\n\nvoid RealmCoordinator::pin_version(uint_fast64_t version, uint_fast32_t index)\n\n{\n\n if (m_async_error) {\n\n return;\n\n }\n\n\n\n SharedGroup::VersionID versionid(version, index);\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 11, "score": 126592.17076040943 }, { "content": "////////////////////////////////////////////////////////////////////////////\n\n//\n\n// Copyright 2015 Realm Inc.\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n\n//\n\n////////////////////////////////////////////////////////////////////////////\n\n\n\n#ifndef REALM_COORDINATOR_HPP\n\n#define REALM_COORDINATOR_HPP\n\n\n\n#include \"shared_realm.hpp\"\n\n\n\n#include <realm/string_data.hpp>\n\n#include <mutex>\n\n\n\nnamespace realm {\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.hpp", "rank": 12, "score": 126590.43438180596 }, { "content": "\n\n auto realm = std::make_shared<Realm>(std::move(config));\n\n realm->init(shared_from_this());\n\n m_weak_realm_notifiers.emplace_back(realm, m_config.cache);\n\n return realm;\n\n}\n\n\n\nstd::shared_ptr<Realm> RealmCoordinator::get_realm()\n\n{\n\n return get_realm(m_config);\n\n}\n\n\n\nconst Schema* RealmCoordinator::get_schema() const noexcept\n\n{\n\n return m_weak_realm_notifiers.empty() ? nullptr : m_config.schema.get();\n\n}\n\n\n\nvoid RealmCoordinator::update_schema(Schema const& schema)\n\n{\n\n // FIXME: this should probably be doing some sort of validation and\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 13, "score": 126589.55347675926 }, { "content": " // then updated m_config with any tables present in config but not in\n\n // it\n\n // Public API currently doesn't make it possible to have non-matching\n\n // schemata so it's not a huge issue\n\n if ((false) && m_config.schema != config.schema) {\n\n throw MismatchedConfigException(\"Realm at path already opened with different schema\");\n\n }\n\n }\n\n\n\n if (config.cache) {\n\n for (auto& cachedRealm : m_weak_realm_notifiers) {\n\n if (cachedRealm.is_cached_for_current_thread()) {\n\n // can be null if we jumped in between ref count hitting zero and\n\n // unregister_realm() getting the lock\n\n if (auto realm = cachedRealm.realm()) {\n\n return realm;\n\n }\n\n }\n\n }\n\n }\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 14, "score": 126588.97521873185 }, { "content": " // notifying all Realm instances of the new schema in some way\n\n m_config.schema = std::make_unique<Schema>(schema);\n\n}\n\n\n\nRealmCoordinator::RealmCoordinator() = default;\n\n\n\nRealmCoordinator::~RealmCoordinator()\n\n{\n\n std::lock_guard<std::mutex> coordinator_lock(s_coordinator_mutex);\n\n for (auto it = s_coordinators_per_path.begin(); it != s_coordinators_per_path.end(); ) {\n\n if (it->second.expired()) {\n\n it = s_coordinators_per_path.erase(it);\n\n }\n\n else {\n\n ++it;\n\n }\n\n }\n\n}\n\n\n\nvoid RealmCoordinator::unregister_realm(Realm* realm)\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 15, "score": 126588.67301881687 }, { "content": " return it == s_coordinators_per_path.end() ? nullptr : it->second.lock();\n\n}\n\n\n\nstd::shared_ptr<Realm> RealmCoordinator::get_realm(Realm::Config config)\n\n{\n\n std::lock_guard<std::mutex> lock(m_realm_mutex);\n\n if ((!m_config.read_only && !m_notifier) || (m_config.read_only && m_weak_realm_notifiers.empty())) {\n\n m_config = config;\n\n if (!config.read_only && !m_notifier && config.automatic_change_notifications) {\n\n try {\n\n m_notifier = std::make_unique<ExternalCommitHelper>(*this);\n\n }\n\n catch (std::system_error const& ex) {\n\n throw RealmFileException(RealmFileException::Kind::AccessError, config.path, ex.code().message());\n\n }\n\n }\n\n }\n\n else {\n\n if (m_config.read_only != config.read_only) {\n\n throw MismatchedConfigException(\"Realm at path already opened with different read permissions.\");\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 16, "score": 126588.37555488684 }, { "content": " }\n\n\n\n for (auto& query : queries) {\n\n query->call_callbacks();\n\n }\n\n}\n\n\n\nvoid RealmCoordinator::process_available_async(Realm& realm)\n\n{\n\n auto& sg = Realm::Internal::get_shared_group(realm);\n\n decltype(m_queries) queries;\n\n {\n\n std::lock_guard<std::mutex> lock(m_query_mutex);\n\n for (auto& query : m_queries) {\n\n if (query->deliver(sg, m_async_error)) {\n\n queries.push_back(query);\n\n }\n\n }\n\n }\n\n\n\n for (auto& query : queries) {\n\n query->call_callbacks();\n\n }\n\n}\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 17, "score": 126587.4504532688 }, { "content": "\n\n for (auto& weak_coordinator : s_coordinators_per_path) {\n\n auto coordinator = weak_coordinator.second.lock();\n\n if (!coordinator) {\n\n continue;\n\n }\n\n\n\n coordinator->m_notifier = nullptr;\n\n\n\n // Gather a list of all of the realms which will be removed\n\n for (auto& weak_realm_notifier : coordinator->m_weak_realm_notifiers) {\n\n if (auto realm = weak_realm_notifier.realm()) {\n\n realms_to_close.push_back(realm);\n\n }\n\n }\n\n }\n\n\n\n s_coordinators_per_path.clear();\n\n }\n\n\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 18, "score": 126586.9683499873 }, { "content": " // Close all of the previously cached Realms. This can't be done while\n\n // s_coordinator_mutex is held as it may try to re-lock it.\n\n for (auto& weak_realm : realms_to_close) {\n\n if (auto realm = weak_realm.lock()) {\n\n realm->close();\n\n }\n\n }\n\n}\n\n\n\nvoid RealmCoordinator::clear_all_caches()\n\n{\n\n std::vector<std::weak_ptr<RealmCoordinator>> to_clear;\n\n {\n\n std::lock_guard<std::mutex> lock(s_coordinator_mutex);\n\n for (auto iter : s_coordinators_per_path) {\n\n to_clear.push_back(iter.second);\n\n }\n\n }\n\n for (auto weak_coordinator : to_clear) {\n\n if (auto coordinator = weak_coordinator.lock()) {\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 19, "score": 126586.59921166494 }, { "content": "static std::unordered_map<std::string, std::weak_ptr<RealmCoordinator>> s_coordinators_per_path;\n\n\n\nstd::shared_ptr<RealmCoordinator> RealmCoordinator::get_coordinator(StringData path)\n\n{\n\n std::lock_guard<std::mutex> lock(s_coordinator_mutex);\n\n\n\n auto& weak_coordinator = s_coordinators_per_path[path];\n\n if (auto coordinator = weak_coordinator.lock()) {\n\n return coordinator;\n\n }\n\n\n\n auto coordinator = std::make_shared<RealmCoordinator>();\n\n weak_coordinator = coordinator;\n\n return coordinator;\n\n}\n\n\n\nstd::shared_ptr<RealmCoordinator> RealmCoordinator::get_existing_coordinator(StringData path)\n\n{\n\n std::lock_guard<std::mutex> lock(s_coordinator_mutex);\n\n auto it = s_coordinators_per_path.find(path);\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 20, "score": 126586.06926895019 }, { "content": " }\n\n if (m_config.in_memory != config.in_memory) {\n\n throw MismatchedConfigException(\"Realm at path already opened with different inMemory settings.\");\n\n }\n\n if (m_config.encryption_key != config.encryption_key) {\n\n std::stringstream msg;\n\n msg << \"Realm at path \" << config.path << \" already opened with a different encryption key.\" << std::hex;\n\n for (char c : m_config.encryption_key)\n\n msg << c << ' ';\n\n msg << \"\\n---\\n\";\n\n for (char c : config.encryption_key)\n\n msg << c << ' ';\n\n throw MismatchedConfigException(msg.str());\n\n// throw MismatchedConfigException(\"Realm at path already opened with a different encryption key.\");\n\n }\n\n if (m_config.schema_version != config.schema_version && config.schema_version != ObjectStore::NotVersioned) {\n\n throw MismatchedConfigException(\"Realm at path already opened with different schema version.\");\n\n }\n\n // FIXME: verify that schema is compatible\n\n // Needs to verify that all tables present in both are identical, and\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 21, "score": 126585.6624025909 }, { "content": " m_advancer_sg->end_read();\n\n m_advancer_sg->begin_read(versionid);\n\n }\n\n}\n\n\n\nvoid RealmCoordinator::register_query(std::shared_ptr<AsyncQuery> query)\n\n{\n\n auto version = query->version();\n\n auto& self = Realm::Internal::get_coordinator(query->get_realm());\n\n {\n\n std::lock_guard<std::mutex> lock(self.m_query_mutex);\n\n self.pin_version(version.version, version.index);\n\n self.m_new_queries.push_back(std::move(query));\n\n }\n\n}\n\n\n\nvoid RealmCoordinator::clean_up_dead_queries()\n\n{\n\n auto swap_remove = [&](auto& container) {\n\n bool did_remove = false;\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 22, "score": 126584.44167442931 }, { "content": "\n\n move_new_queries_to_main();\n\n m_advancer_sg->end_read();\n\n}\n\n\n\nvoid RealmCoordinator::advance_to_ready(Realm& realm)\n\n{\n\n decltype(m_queries) queries;\n\n\n\n auto& sg = Realm::Internal::get_shared_group(realm);\n\n\n\n auto get_query_version = [&] {\n\n for (auto& query : m_queries) {\n\n auto version = query->version();\n\n if (version != SharedGroup::VersionID{}) {\n\n return version;\n\n }\n\n }\n\n return SharedGroup::VersionID{};\n\n };\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 23, "score": 126583.76173555509 }, { "content": "////////////////////////////////////////////////////////////////////////////\n\n//\n\n// Copyright 2015 Realm Inc.\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n\n//\n\n////////////////////////////////////////////////////////////////////////////\n\n\n\n#include \"impl/realm_coordinator.hpp\"\n\n\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 24, "score": 126583.5665108331 }, { "content": " void open_helper_shared_group();\n\n void move_new_queries_to_main();\n\n void advance_helper_shared_group_to_latest();\n\n void clean_up_dead_queries();\n\n};\n\n\n\n} // namespace _impl\n\n} // namespace realm\n\n\n\n#endif /* REALM_COORDINATOR_HPP */\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.hpp", "rank": 25, "score": 126583.18646239185 }, { "content": "{\n\n std::lock_guard<std::mutex> lock(m_realm_mutex);\n\n for (size_t i = 0; i < m_weak_realm_notifiers.size(); ++i) {\n\n auto& weak_realm_notifier = m_weak_realm_notifiers[i];\n\n if (!weak_realm_notifier.expired() && !weak_realm_notifier.is_for_realm(realm)) {\n\n continue;\n\n }\n\n\n\n if (i + 1 < m_weak_realm_notifiers.size()) {\n\n weak_realm_notifier = std::move(m_weak_realm_notifiers.back());\n\n }\n\n m_weak_realm_notifiers.pop_back();\n\n }\n\n}\n\n\n\nvoid RealmCoordinator::clear_cache()\n\n{\n\n std::vector<WeakRealm> realms_to_close;\n\n {\n\n std::lock_guard<std::mutex> lock(s_coordinator_mutex);\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 26, "score": 126582.42662212723 }, { "content": "\n\n clean_up_dead_queries();\n\n}\n\n\n\nvoid RealmCoordinator::open_helper_shared_group()\n\n{\n\n if (!m_query_sg) {\n\n try {\n\n std::unique_ptr<Group> read_only_group;\n\n Realm::open_with_config(m_config, m_query_history, m_query_sg, read_only_group);\n\n REALM_ASSERT(!read_only_group);\n\n m_query_sg->begin_read();\n\n }\n\n catch (...) {\n\n // Store the error to be passed to the async queries\n\n m_async_error = std::current_exception();\n\n m_query_sg = nullptr;\n\n m_query_history = nullptr;\n\n }\n\n }\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 27, "score": 126581.86635893796 }, { "content": " // may end up calling user code (in did_change() notifications)\n\n transaction::advance(sg, realm.m_binding_context.get(), version);\n\n\n\n // Reacquire the lock and recheck the query version, as the queries may\n\n // have advanced to a later version while we didn't hold the lock. If\n\n // so, we need to release the lock and re-advance\n\n std::lock_guard<std::mutex> lock(m_query_mutex);\n\n version = get_query_version();\n\n if (version.version == std::numeric_limits<uint_fast64_t>::max())\n\n return;\n\n if (version != sg.get_version_of_current_transaction())\n\n continue;\n\n\n\n // Query version now matches the SG version, so we can deliver them\n\n for (auto& query : m_queries) {\n\n if (query->deliver(sg, m_async_error)) {\n\n queries.push_back(query);\n\n }\n\n }\n\n break;\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 28, "score": 126581.77992776605 }, { "content": " // groups is expensive\n\n if (m_queries.empty() && m_query_sg) {\n\n m_query_sg->end_read();\n\n }\n\n }\n\n if (swap_remove(m_new_queries)) {\n\n if (m_new_queries.empty() && m_advancer_sg) {\n\n m_advancer_sg->end_read();\n\n }\n\n }\n\n}\n\n\n\nvoid RealmCoordinator::on_change()\n\n{\n\n run_async_queries();\n\n\n\n std::lock_guard<std::mutex> lock(m_realm_mutex);\n\n for (auto& realm : m_weak_realm_notifiers) {\n\n realm.notify();\n\n }\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 29, "score": 126581.77883793744 }, { "content": " void on_change();\n\n\n\n // Update the schema in the cached config\n\n void update_schema(Schema const& new_schema);\n\n\n\n static void register_query(std::shared_ptr<AsyncQuery> query);\n\n\n\n // Advance the Realm to the most recent transaction version which all async\n\n // work is complete for\n\n void advance_to_ready(Realm& realm);\n\n void process_available_async(Realm& realm);\n\n\n\nprivate:\n\n Realm::Config m_config;\n\n\n\n std::mutex m_realm_mutex;\n\n std::vector<WeakRealmNotifier> m_weak_realm_notifiers;\n\n\n\n std::mutex m_query_mutex;\n\n std::vector<std::shared_ptr<_impl::AsyncQuery>> m_new_queries;\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.hpp", "rank": 30, "score": 126579.13485281267 }, { "content": "\n\n SharedGroup::VersionID version;\n\n {\n\n std::lock_guard<std::mutex> lock(m_query_mutex);\n\n version = get_query_version();\n\n }\n\n\n\n // no async queries; just advance to latest\n\n if (version.version == std::numeric_limits<uint_fast64_t>::max()) {\n\n transaction::advance(sg, realm.m_binding_context.get());\n\n return;\n\n }\n\n\n\n // async results are out of date; ignore\n\n if (version < sg.get_version_of_current_transaction()) {\n\n return;\n\n }\n\n\n\n while (true) {\n\n // Advance to the ready version without holding any locks because it\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 31, "score": 126578.69076864712 }, { "content": " else if (m_queries.empty()) {\n\n m_query_sg->begin_read();\n\n }\n\n}\n\n\n\nvoid RealmCoordinator::move_new_queries_to_main()\n\n{\n\n m_queries.reserve(m_queries.size() + m_new_queries.size());\n\n std::move(m_new_queries.begin(), m_new_queries.end(), std::back_inserter(m_queries));\n\n m_new_queries.clear();\n\n}\n\n\n\nvoid RealmCoordinator::advance_helper_shared_group_to_latest()\n\n{\n\n if (m_new_queries.empty()) {\n\n LangBindHelper::advance_read(*m_query_sg);\n\n return;\n\n }\n\n\n\n // Sort newly added queries by their source version so that we can pull them\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 32, "score": 126577.06457230657 }, { "content": " if (!m_advancer_sg) {\n\n try {\n\n std::unique_ptr<Group> read_only_group;\n\n Realm::open_with_config(m_config, m_advancer_history, m_advancer_sg, read_only_group);\n\n REALM_ASSERT(!read_only_group);\n\n m_advancer_sg->begin_read(versionid);\n\n }\n\n catch (...) {\n\n m_async_error = std::current_exception();\n\n m_advancer_sg = nullptr;\n\n m_advancer_history = nullptr;\n\n }\n\n }\n\n else if (m_new_queries.empty()) {\n\n // If this is the first query then we don't already have a read transaction\n\n m_advancer_sg->begin_read(versionid);\n\n }\n\n else if (versionid < m_advancer_sg->get_version_of_current_transaction()) {\n\n // Ensure we're holding a readlock on the oldest version we have a\n\n // handover object for, as handover objects don't\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 33, "score": 126576.80744404714 }, { "content": "}\n\n\n\nvoid RealmCoordinator::run_async_queries()\n\n{\n\n std::unique_lock<std::mutex> lock(m_query_mutex);\n\n\n\n clean_up_dead_queries();\n\n\n\n if (m_queries.empty() && m_new_queries.empty()) {\n\n return;\n\n }\n\n\n\n if (!m_async_error) {\n\n open_helper_shared_group();\n\n }\n\n\n\n if (m_async_error) {\n\n move_new_queries_to_main();\n\n return;\n\n }\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 34, "score": 126575.94475168914 }, { "content": "\n\n advance_helper_shared_group_to_latest();\n\n\n\n // Make a copy of the queries vector so that we can release the lock while\n\n // we run the queries\n\n auto queries_to_run = m_queries;\n\n lock.unlock();\n\n\n\n for (auto& query : queries_to_run) {\n\n query->run();\n\n }\n\n\n\n // Reacquire the lock while updating the fields that are actually read on\n\n // other threads\n\n {\n\n lock.lock();\n\n for (auto& query : queries_to_run) {\n\n query->prepare_handover();\n\n }\n\n }\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 35, "score": 126573.3825575404 }, { "content": " // all forward to the latest version in a single pass over the transaction log\n\n std::sort(m_new_queries.begin(), m_new_queries.end(), [](auto const& lft, auto const& rgt) {\n\n return lft->version() < rgt->version();\n\n });\n\n\n\n // Import all newly added queries to our helper SG\n\n for (auto& query : m_new_queries) {\n\n LangBindHelper::advance_read(*m_advancer_sg, query->version());\n\n query->attach_to(*m_advancer_sg);\n\n }\n\n\n\n // Advance both SGs to the newest version\n\n LangBindHelper::advance_read(*m_advancer_sg);\n\n LangBindHelper::advance_read(*m_query_sg, m_advancer_sg->get_version_of_current_transaction());\n\n\n\n // Transfer all new queries over to the main SG\n\n for (auto& query : m_new_queries) {\n\n query->detatch();\n\n query->attach_to(*m_query_sg);\n\n }\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 36, "score": 126573.09025340127 }, { "content": " std::vector<std::shared_ptr<_impl::AsyncQuery>> m_queries;\n\n\n\n // SharedGroup used for actually running async queries\n\n // Will have a read transaction iff m_queries is non-empty\n\n std::unique_ptr<Replication> m_query_history;\n\n std::unique_ptr<SharedGroup> m_query_sg;\n\n\n\n // SharedGroup used to advance queries in m_new_queries to the main shared\n\n // group's transaction version\n\n // Will have a read transaction iff m_new_queries is non-empty\n\n std::unique_ptr<Replication> m_advancer_history;\n\n std::unique_ptr<SharedGroup> m_advancer_sg;\n\n std::exception_ptr m_async_error;\n\n\n\n std::unique_ptr<_impl::ExternalCommitHelper> m_notifier;\n\n\n\n // must be called with m_query_mutex locked\n\n void pin_version(uint_fast64_t version, uint_fast32_t index);\n\n\n\n void run_async_queries();\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.hpp", "rank": 37, "score": 126571.6167292231 }, { "content": " for (size_t i = 0; i < container.size(); ++i) {\n\n if (container[i]->is_alive())\n\n continue;\n\n\n\n // Ensure the query is destroyed here even if there's lingering refs\n\n // to the async query elsewhere\n\n container[i]->release_query();\n\n\n\n if (container.size() > i + 1)\n\n container[i] = std::move(container.back());\n\n container.pop_back();\n\n --i;\n\n did_remove = true;\n\n }\n\n return did_remove;\n\n };\n\n\n\n if (swap_remove(m_queries)) {\n\n // Make sure we aren't holding on to read versions needlessly if there\n\n // are no queries left, but don't close them entirely as opening shared\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.cpp", "rank": 38, "score": 126571.45893748602 }, { "content": "// A token which keeps an asynchronous query alive\n\nstruct AsyncQueryCancelationToken {\n\n AsyncQueryCancelationToken() = default;\n\n AsyncQueryCancelationToken(std::shared_ptr<_impl::AsyncQuery> query, size_t token);\n\n ~AsyncQueryCancelationToken();\n\n\n\n AsyncQueryCancelationToken(AsyncQueryCancelationToken&&);\n\n AsyncQueryCancelationToken& operator=(AsyncQueryCancelationToken&&);\n\n\n\n AsyncQueryCancelationToken(AsyncQueryCancelationToken const&) = delete;\n\n AsyncQueryCancelationToken& operator=(AsyncQueryCancelationToken const&) = delete;\n\n\n\nprivate:\n\n util::AtomicSharedPtr<_impl::AsyncQuery> m_query;\n\n size_t m_token;\n\n};\n\n\n", "file_path": "wrappers/src/object-store/src/results.hpp", "rank": 39, "score": 124944.57382635515 }, { "content": "class Schema;\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.hpp", "rank": 40, "score": 123411.35808220456 }, { "content": "class Replication;\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.hpp", "rank": 41, "score": 123411.35808220456 }, { "content": "class SharedGroup;\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.hpp", "rank": 42, "score": 120408.87735105006 }, { "content": "class AsyncQuery;\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.hpp", "rank": 43, "score": 120408.87735105006 }, { "content": "class AsyncQueryCallback;\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.hpp", "rank": 44, "score": 117549.02167780974 }, { "content": "class ExternalCommitHelper;\n\n\n", "file_path": "wrappers/src/object-store/src/impl/realm_coordinator.hpp", "rank": 45, "score": 117549.02167780974 }, { "content": " class Realm;\n", "file_path": "wrappers/src/object-store/src/shared_realm.hpp", "rank": 46, "score": 116605.73899319385 }, { "content": "struct ValueGetter<Float, TableGetter> {\n\n static Float convert(TableGetter&&, const parser::Expression & value, Arguments &args)\n\n {\n\n if (value.type == parser::Expression::Type::Argument) {\n\n return args.float_for_argument(stot<int>(value.s));\n\n }\n\n return stot<float>(value.s);\n\n }\n\n};\n\n\n\ntemplate <typename TableGetter>\n", "file_path": "wrappers/src/object-store/src/parser/query_builder.cpp", "rank": 47, "score": 116575.41835758643 }, { "content": "struct ValueGetter<bool, TableGetter> {\n\n static bool convert(TableGetter&&, const parser::Expression & value, Arguments &args)\n\n {\n\n if (value.type == parser::Expression::Type::Argument) {\n\n return args.bool_for_argument(stot<int>(value.s));\n\n }\n\n if (value.type != parser::Expression::Type::True && value.type != parser::Expression::Type::False) {\n\n throw std::runtime_error(\"Attempting to compare bool property to a non-bool value\");\n\n }\n\n return value.type == parser::Expression::Type::True;\n\n }\n\n};\n\n\n\ntemplate <typename TableGetter>\n", "file_path": "wrappers/src/object-store/src/parser/query_builder.cpp", "rank": 48, "score": 116575.41835758643 }, { "content": "struct ValueGetter<Binary, TableGetter> {\n\n static std::string convert(TableGetter&&, const parser::Expression & value, Arguments &args)\n\n {\n\n if (value.type == parser::Expression::Type::Argument) {\n\n return args.binary_for_argument(stot<int>(value.s));\n\n }\n\n throw std::runtime_error(\"Binary properties must be compared against a binary argument.\");\n\n }\n\n};\n\n\n\ntemplate <typename RetType, typename Value, typename TableGetter>\n\nauto value_of_type_for_query(TableGetter&& tables, Value&& value, Arguments &args)\n\n{\n\n const bool isColumn = std::is_same<PropertyExpression, typename std::remove_reference<Value>::type>::value;\n\n using helper = std::conditional_t<isColumn, ColumnGetter<RetType, TableGetter>, ValueGetter<RetType, TableGetter>>;\n\n return helper::convert(tables, value, args);\n\n}\n\n\n\ntemplate <typename A, typename B>\n\nvoid do_add_comparison_to_query(Query &query, const Schema &schema, const ObjectSchema &object_schema, Predicate::Comparison cmp,\n", "file_path": "wrappers/src/object-store/src/parser/query_builder.cpp", "rank": 49, "score": 116575.41835758643 }, { "content": "struct ValueGetter<Double, TableGetter> {\n\n static Double convert(TableGetter&&, const parser::Expression & value, Arguments &args)\n\n {\n\n if (value.type == parser::Expression::Type::Argument) {\n\n return args.double_for_argument(stot<int>(value.s));\n\n }\n\n return stot<double>(value.s);\n\n }\n\n};\n\n\n\ntemplate <typename TableGetter>\n", "file_path": "wrappers/src/object-store/src/parser/query_builder.cpp", "rank": 50, "score": 116575.41835758643 }, { "content": "struct ValueGetter<Timestamp, TableGetter> {\n\n static Timestamp convert(TableGetter&&, const parser::Expression & value, Arguments &args)\n\n {\n\n if (value.type != parser::Expression::Type::Argument) {\n\n throw std::runtime_error(\"You must pass in a date argument to compare\");\n\n }\n\n return args.timestamp_for_argument(stot<int>(value.s));\n\n }\n\n};\n\n\n\ntemplate <typename TableGetter>\n", "file_path": "wrappers/src/object-store/src/parser/query_builder.cpp", "rank": 51, "score": 116575.41835758643 }, { "content": "struct ValueGetter<String, TableGetter> {\n\n static std::string convert(TableGetter&&, const parser::Expression & value, Arguments &args)\n\n {\n\n if (value.type == parser::Expression::Type::Argument) {\n\n return args.string_for_argument(stot<int>(value.s));\n\n }\n\n if (value.type != parser::Expression::Type::String) {\n\n throw std::runtime_error(\"Attempting to compare String property to a non-String value\");\n\n }\n\n return value.s;\n\n }\n\n};\n\n\n\ntemplate <typename TableGetter>\n", "file_path": "wrappers/src/object-store/src/parser/query_builder.cpp", "rank": 52, "score": 116575.41835758643 }, { "content": "class RealmCoordinator;\n\n\n", "file_path": "wrappers/src/object-store/src/impl/apple/external_commit_helper.hpp", "rank": 53, "score": 114821.86428532735 }, { "content": "class RealmCoordinator;\n\n\n", "file_path": "wrappers/src/object-store/src/impl/android/external_commit_helper.hpp", "rank": 54, "score": 114821.86428532735 }, { "content": "class RealmCoordinator;\n\n\n", "file_path": "wrappers/src/object-store/src/impl/generic/external_commit_helper.hpp", "rank": 55, "score": 114821.86428532735 }, { "content": "// expressions and operators\n\nstruct expr : sor< dq_string, sq_string, number, argument, true_value, false_value, key_path > {};\n", "file_path": "wrappers/src/object-store/src/parser/parser.cpp", "rank": 56, "score": 112020.61349159316 }, { "content": "class Realm;\n\n\n\nnamespace _impl {\n\n\n", "file_path": "wrappers/src/object-store/src/impl/android/weak_realm_notifier.hpp", "rank": 57, "score": 111224.69475457053 }, { "content": "class Realm;\n\n\n\nnamespace _impl {\n\n\n", "file_path": "wrappers/src/object-store/src/impl/weak_realm_notifier_base.hpp", "rank": 58, "score": 111224.69475457053 }, { "content": "class Realm;\n\n\n\nnamespace _impl {\n\n\n", "file_path": "wrappers/src/object-store/src/impl/apple/weak_realm_notifier.hpp", "rank": 59, "score": 111224.69475457053 }, { "content": "class Realm;\n\n\n\nnamespace _impl {\n\n\n", "file_path": "wrappers/src/object-store/src/impl/generic/weak_realm_notifier.hpp", "rank": 60, "score": 111224.69475457053 }, { "content": " class MismatchedConfigException : public std::runtime_error {\n\n public:\n\n MismatchedConfigException(std::string message) : std::runtime_error(message) {}\n\n };\n\n\n", "file_path": "wrappers/src/object-store/src/shared_realm.hpp", "rank": 61, "score": 109805.06709170752 }, { "content": " class Realm : public std::enable_shared_from_this<Realm> {\n\n public:\n\n typedef std::function<void(SharedRealm old_realm, SharedRealm realm)> MigrationFunction;\n\n\n\n struct Config {\n\n std::string path;\n\n // User-supplied encryption key. Must be either empty or 64 bytes.\n\n std::vector<char> encryption_key;\n\n\n\n // Optional schema for the file. If nullptr, the existing schema\n\n // from the file opened will be used. If present, the file will be\n\n // migrated to the schema if needed.\n\n std::unique_ptr<Schema> schema;\n\n uint64_t schema_version;\n\n\n\n MigrationFunction migration_function;\n\n\n\n bool read_only = false;\n\n bool in_memory = false;\n\n\n", "file_path": "wrappers/src/object-store/src/shared_realm.hpp", "rank": 62, "score": 109682.97869016336 }, { "content": "class Realm;\n", "file_path": "wrappers/src/object-store/src/list.hpp", "rank": 63, "score": 108017.3462494512 }, { "content": " {\n\n NativeTable.clear_link(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n }\n\n else\n\n {\n\n if (!value.IsManaged)\n\n _realm.Manage(value);\n\n NativeTable.set_link(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, (IntPtr)value.RowHandle.RowIndex);\n\n }\n\n }\n\n\n\n #endregion\n\n\n\n /**\n\n * Shared factory to make an object in the realm from a known row\n\n * @param rowPtr may be null if a relationship lookup has failed.\n\n */\n\n internal RealmObject MakeRealmObject(Type objectType, IntPtr rowPtr) {\n\n if (rowPtr == IntPtr.Zero)\n\n return null; // typically no related object\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 64, "score": 101367.08161588392 }, { "content": " protected T GetObjectValue<T>(string propertyName) where T : RealmObject\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n var linkedRowPtr = NativeTable.get_link (_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n return (T)MakeRealmObject(typeof(T), linkedRowPtr);\n\n }\n\n\n\n #endregion\n\n\n\n #region Setters\n\n\n\n protected void SetStringValue(string propertyName, string value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 65, "score": 101365.72858346124 }, { "content": "\n\n protected DateTimeOffset? GetNullableDateTimeOffsetValue(string propertyName)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n long unixTimeMS = 0;\n\n var hasValue = MarshalHelpers.IntPtrToBool(NativeTable.get_nullable_timestamp_milliseconds(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, ref unixTimeMS));\n\n return hasValue ? DateTimeOffsetExtensions.FromRealmUnixTimeMilliseconds(unixTimeMS) : (DateTimeOffset?)null;\n\n }\n\n\n\n protected RealmList<T> GetListValue<T>(string propertyName) where T : RealmObject\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var listHandle = _metadata.Table.TableLinkList (_metadata.ColumnIndices[propertyName], _rowHandle);\n\n return new RealmList<T>(this, listHandle);\n\n }\n\n\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 66, "score": 101362.91024460361 }, { "content": "\n\n if (value.HasValue)\n\n {\n\n var marshalledValue = value.Value.ToRealmUnixTimeMilliseconds();\n\n NativeTable.set_timestamp_milliseconds(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr) rowIndex, marshalledValue);\n\n }\n\n else\n\n NativeTable.set_null(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n }\n\n\n\n // TODO make not generic\n\n protected void SetObjectValue<T>(string propertyName, T value) where T : RealmObject\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n if (value == null)\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 67, "score": 101362.68407896494 }, { "content": " NativeTable.set_string_unique(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value, (IntPtr)value.Length);\n\n }\n\n\n\n protected void SetCharValue(string propertyName, char value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n NativeTable.set_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value);\n\n }\n\n\n\n protected void SetCharValueUnique(string propertyName, char value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 68, "score": 101362.0315149458 }, { "content": " NativeTable.set_float(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value.Value);\n\n else\n\n NativeTable.set_null(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n }\n\n\n\n protected void SetDoubleValue(string propertyName, double value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n NativeTable.set_double(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value);\n\n }\n\n\n\n protected void SetNullableDoubleValue(string propertyName, double? value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 69, "score": 101361.76347608081 }, { "content": " var rowIndex = _rowHandle.RowIndex;\n\n\n\n if (value != null)\n\n NativeTable.set_string(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value, (IntPtr)value.Length);\n\n else\n\n NativeTable.set_null(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n }\n\n\n\n protected void SetStringValueUnique(string propertyName, string value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n if (value == null)\n\n throw new ArgumentException(\"Object identifiers cannot be null\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 70, "score": 101361.57360874528 }, { "content": " protected void SetInt32Value(string propertyName, int value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n NativeTable.set_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value);\n\n }\n\n\n\n protected void SetInt32ValueUnique(string propertyName, int value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 71, "score": 101361.3308045598 }, { "content": " {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n var retVal = 0L;\n\n var hasValue = MarshalHelpers.IntPtrToBool(NativeTable.get_nullable_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr) rowIndex, ref retVal));\n\n return hasValue ? (short)retVal : (short?) null;\n\n }\n\n\n\n protected int GetInt32Value(string propertyName)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n var value = NativeTable.get_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n return (int) value;\n\n }\n\n\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 72, "score": 101361.11668623352 }, { "content": "\n\n NativeTable.set_int64_unique(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value);\n\n }\n\n\n\n protected void SetNullableInt32Value(string propertyName, int? value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n if (value.HasValue)\n\n NativeTable.set_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value.Value);\n\n else\n\n NativeTable.set_null(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n }\n\n\n\n protected void SetInt64Value(string propertyName, long value)\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 73, "score": 101361.00818083288 }, { "content": " protected int? GetNullableInt32Value(string propertyName)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n var retVal = 0L;\n\n var hasValue = MarshalHelpers.IntPtrToBool(NativeTable.get_nullable_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr) rowIndex, ref retVal));\n\n return hasValue ? (int)retVal : (int?) null;\n\n }\n\n\n\n protected long GetInt64Value(string propertyName)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n return NativeTable.get_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n }\n\n\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 74, "score": 101360.71590314338 }, { "content": "\n\n NativeTable.set_bool(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, MarshalHelpers.BoolToIntPtr(value));\n\n }\n\n\n\n protected void SetNullableBooleanValue(string propertyName, bool? value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n if (value.HasValue)\n\n NativeTable.set_bool(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, MarshalHelpers.BoolToIntPtr(value.Value));\n\n else\n\n NativeTable.set_null(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n }\n\n\n\n protected void SetDateTimeOffsetValue(string propertyName, DateTimeOffset value)\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 75, "score": 101360.61044502202 }, { "content": " throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n NativeTable.set_int64_unique(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value);\n\n }\n\n\n\n protected void SetNullableCharValue(string propertyName, char? value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n if (value.HasValue)\n\n NativeTable.set_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value.Value);\n\n else\n\n NativeTable.set_null(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 76, "score": 101360.58484064469 }, { "content": " NativeTable.set_int64_unique(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value);\n\n }\n\n\n\n protected void SetNullableInt64Value(string propertyName, long? value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n if (value.HasValue)\n\n NativeTable.set_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value.Value);\n\n else\n\n NativeTable.set_null(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n }\n\n\n\n protected void SetSingleValue(string propertyName, float value)\n\n {\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 77, "score": 101360.58011111806 }, { "content": " var rowIndex = _rowHandle.RowIndex;\n\n\n\n NativeTable.set_int64_unique(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value);\n\n }\n\n\n\n protected void SetNullableInt16Value(string propertyName, short? value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n if (value.HasValue)\n\n NativeTable.set_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value.Value);\n\n else\n\n NativeTable.set_null(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n }\n\n\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 78, "score": 101360.56614339435 }, { "content": "\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n NativeTable.set_int64_unique(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value);\n\n }\n\n\n\n protected void SetNullableByteValue(string propertyName, byte? value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n if (value.HasValue)\n\n NativeTable.set_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value.Value);\n\n else\n\n NativeTable.set_null(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n }\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 79, "score": 101360.56614339435 }, { "content": "\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n if (value.HasValue)\n\n NativeTable.set_double(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value.Value);\n\n else\n\n NativeTable.set_null(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n }\n\n\n\n protected void SetBooleanValue(string propertyName, bool value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 80, "score": 101360.51090369337 }, { "content": " Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n var retVal = 0L;\n\n var hasValue = MarshalHelpers.IntPtrToBool(NativeTable.get_nullable_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr) rowIndex, ref retVal));\n\n return hasValue ? (byte)retVal : (byte?) null;\n\n }\n\n\n\n protected short GetInt16Value(string propertyName)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n var value = NativeTable.get_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n return (short) value;\n\n }\n\n\n\n protected short? GetNullableInt16Value(string propertyName)\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 81, "score": 101360.09311728484 }, { "content": " protected double? GetNullableDoubleValue(string propertyName)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n var retVal = 0.0d;\n\n var hasValue = MarshalHelpers.IntPtrToBool(NativeTable.get_nullable_double(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, ref retVal));\n\n return hasValue ? retVal : (double?) null;\n\n }\n\n\n\n protected bool GetBooleanValue(string propertyName)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n return MarshalHelpers.IntPtrToBool(NativeTable.get_bool(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex));\n\n }\n\n\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 82, "score": 101360.00949157015 }, { "content": " Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n NativeTable.set_float(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value);\n\n }\n\n\n\n protected void SetNullableSingleValue(string propertyName, float? value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n if (value.HasValue)\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 83, "score": 101359.93887054872 }, { "content": " protected float? GetNullableSingleValue(string propertyName)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n var retVal = 0.0f;\n\n var hasValue = MarshalHelpers.IntPtrToBool(NativeTable.get_nullable_float(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr) rowIndex, ref retVal));\n\n return hasValue ? retVal : (float?) null;\n\n }\n\n\n\n protected double GetDoubleValue(string propertyName)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n return NativeTable.get_double(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n }\n\n\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 84, "score": 101359.91798696436 }, { "content": " }\n\n\n\n protected void SetByteValue(string propertyName, byte value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n NativeTable.set_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value);\n\n }\n\n\n\n protected void SetByteValueUnique(string propertyName, byte value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 85, "score": 101359.86890483489 }, { "content": "\n\n protected void SetInt16Value(string propertyName, short value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n NativeTable.set_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value);\n\n }\n\n\n\n protected void SetInt16ValueUnique(string propertyName, short value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 86, "score": 101359.86890483489 }, { "content": " protected long? GetNullableInt64Value(string propertyName)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n var retVal = 0L;\n\n var hasValue = MarshalHelpers.IntPtrToBool(NativeTable.get_nullable_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr) rowIndex, ref retVal));\n\n return hasValue ? retVal : (long?) null;\n\n }\n\n\n\n protected float GetSingleValue(string propertyName)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n return NativeTable.get_float(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n }\n\n\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 87, "score": 101359.8495901375 }, { "content": " {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n NativeTable.set_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, value);\n\n }\n\n\n\n protected void SetInt64ValueUnique(string propertyName, long value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 88, "score": 101359.73538611352 }, { "content": " protected bool? GetNullableBooleanValue(string propertyName)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n var retVal = IntPtr.Zero;\n\n var hasValue = MarshalHelpers.IntPtrToBool(NativeTable.get_nullable_bool(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, ref retVal));\n\n return hasValue ? MarshalHelpers.IntPtrToBool(retVal) : (bool?) null;\n\n }\n\n\n\n protected DateTimeOffset GetDateTimeOffsetValue(string propertyName)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n var unixTimeMS = NativeTable.get_timestamp_milliseconds(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n return DateTimeOffsetExtensions.FromRealmUnixTimeMilliseconds(unixTimeMS);\n\n }\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 89, "score": 101359.67804537655 }, { "content": " {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n var marshalledValue = value.ToRealmUnixTimeMilliseconds();\n\n NativeTable.set_timestamp_milliseconds(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, marshalledValue);\n\n }\n\n\n\n protected void SetNullableDateTimeOffsetValue(string propertyName, DateTimeOffset? value)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n if (!_realm.IsInTransaction)\n\n throw new RealmOutsideTransactionException(\"Cannot set values outside transaction\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 90, "score": 101359.35770448783 }, { "content": " return \"\";\n\n }\n\n\n\n return Marshal.PtrToStringUni(_realm.stringGetBuffer, bytesRead);\n\n // leaving buffer sitting allocated for quick reuse next time we read a string \n\n } // GetStringValue\n\n\n\n protected char GetCharValue(string propertyName)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n var value = NativeTable.get_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n return (char) value;\n\n }\n\n\n\n protected char? GetNullableCharValue(string propertyName)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 91, "score": 101358.71085773301 }, { "content": "\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n var retVal = 0L;\n\n var hasValue = MarshalHelpers.IntPtrToBool(NativeTable.get_nullable_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr) rowIndex, ref retVal));\n\n return hasValue ? (char)retVal : (char?) null;\n\n }\n\n\n\n protected byte GetByteValue(string propertyName)\n\n {\n\n Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n\n\n var value = NativeTable.get_int64(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex);\n\n return (byte) value;\n\n }\n\n\n\n protected byte? GetNullableByteValue(string propertyName)\n\n {\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 92, "score": 101358.18262332006 }, { "content": "/* Copyright 2015 Realm Inc - All Rights Reserved\n\n * Proprietary and Confidential\n\n */\n\n\n\nusing System;\n\nusing System.Collections;\n\nusing System.Collections.Generic;\n\nusing System.Diagnostics;\n\nusing System.Linq;\n\nusing System.Reflection;\n\nusing System.Runtime.InteropServices;\n\n\n\nnamespace Realms\n\n{\n\n /// <summary>\n\n /// Base for any object that can be persisted in a Realm.\n\n /// </summary>\n\n public class RealmObject\n\n {\n\n private Realm _realm;\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 93, "score": 101357.10345309741 }, { "content": " Debug.Assert(_realm != null, \"Object is not managed, but managed access was attempted\");\n\n\n\n var rowIndex = _rowHandle.RowIndex;\n\n var badUTF8msg = $\"Corrupted string UTF8 in {propertyName}\";\n\n\n\n int bufferSizeNeededChars = 128;\n\n // First alloc this thread\n\n if (_realm.stringGetBuffer==IntPtr.Zero) { // first get of a string in this Realm\n\n _realm.stringGetBuffer = Marshal.AllocHGlobal((IntPtr)(bufferSizeNeededChars * sizeof(char)));\n\n _realm.stringGetBufferLen = bufferSizeNeededChars;\n\n } \n\n\n\n bool isNull = false;\n\n\n\n // try to read\n\n int bytesRead = (int)NativeTable.get_string(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, _realm.stringGetBuffer,\n\n (IntPtr)_realm.stringGetBufferLen, out isNull);\n\n if (bytesRead == -1)\n\n {\n\n // bad UTF-8 data unable to transcode, vastly unlikely error but could be corrupt file\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 94, "score": 101354.14666705804 }, { "content": " throw new RealmInvalidDatabaseException(badUTF8msg);\n\n }\n\n if (bytesRead > _realm.stringGetBufferLen) // need a bigger buffer\n\n {\n\n Marshal.FreeHGlobal(_realm.stringGetBuffer);\n\n _realm.stringGetBuffer = Marshal.AllocHGlobal((IntPtr)(bytesRead * sizeof(char)));\n\n _realm.stringGetBufferLen = bytesRead;\n\n // try to read with big buffer\n\n bytesRead = (int)NativeTable.get_string(_metadata.Table, _metadata.ColumnIndices[propertyName], (IntPtr)rowIndex, _realm.stringGetBuffer,\n\n (IntPtr)_realm.stringGetBufferLen, out isNull);\n\n if (bytesRead == -1) // bad UTF-8 in full string\n\n throw new RealmInvalidDatabaseException(badUTF8msg);\n\n Debug.Assert(bytesRead <= _realm.stringGetBufferLen);\n\n } // needed re-read with expanded buffer\n\n\n\n if (bytesRead == 0)\n\n {\n\n if (isNull)\n\n return null;\n\n \n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 95, "score": 101350.9753351533 }, { "content": "\n\n // Optimization for a common success case. \n\n if (ReferenceEquals(this, obj))\n\n {\n\n return true;\n\n }\n\n\n\n // If run-time types are not exactly the same, return false. \n\n if (this.GetType() != obj.GetType())\n\n return false;\n\n\n\n // Return true if the fields match. \n\n // Note that the base class is not invoked because it is \n\n // System.Object, which defines Equals as reference equality. \n\n return RowHandle.Equals(((RealmObject)obj).RowHandle);\n\n }\n\n\n\n }\n\n}\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 96, "score": 101350.78311926237 }, { "content": " internal TableHandle Table;\n\n\n\n internal Weaving.IRealmObjectHelper Helper;\n\n\n\n internal Dictionary<string, IntPtr> ColumnIndices;\n\n }\n\n\n\n internal void _CopyDataFromBackingFieldsToRow()\n\n {\n\n Debug.Assert(this.IsManaged);\n\n\n\n var thisType = this.GetType();\n\n var wovenProperties = from prop in thisType.GetProperties()\n\n let backingField = prop.GetCustomAttributes(false)\n\n .OfType<WovenPropertyAttribute>()\n\n .Select(a => a.BackingFieldName)\n\n .SingleOrDefault()\n\n where backingField != null\n\n select new { Info = prop, Field = thisType.GetField(backingField, BindingFlags.Instance | BindingFlags.NonPublic) };\n\n\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 97, "score": 101350.48212690349 }, { "content": " var ret = _realm.Metadata[objectType].Helper.CreateInstance();\n\n var relatedHandle = Realm.CreateRowHandle (rowPtr, _realm.SharedRealmHandle);\n\n ret._Manage(_realm, relatedHandle);\n\n return ret;\n\n }\n\n\n\n\n\n /// <summary>\n\n /// Compare objects with identity query for persistent objects.\n\n /// </summary>\n\n /// <remarks>Persisted RealmObjects map their properties directly to the realm with no caching so multiple instances of a given object always refer to the same store.</remarks>\n\n /// <param name=\"obj\"></param>\n\n /// <returns>True when objects are the same memory object or refer to the same persisted object.</returns>\n\n public override bool Equals(object obj)\n\n {\n\n // If parameter is null, return false. \n\n if (ReferenceEquals(obj, null))\n\n {\n\n return false;\n\n }\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 98, "score": 101349.13548432136 }, { "content": " foreach (var prop in wovenProperties)\n\n {\n\n var value = prop.Field.GetValue(this);\n\n if (prop.Info.PropertyType.IsGenericType)\n\n {\n\n var genericType = prop.Info.PropertyType.GetGenericTypeDefinition();\n\n if (genericType == typeof(RealmList<>))\n\n {\n\n continue;\n\n }\n\n }\n\n\n\n prop.Info.SetValue(this, value, null);\n\n }\n\n }\n\n\n\n\n\n #region Getters\n\n protected string GetStringValue(string propertyName)\n\n {\n", "file_path": "Realm.Shared/RealmObject.cs", "rank": 99, "score": 101345.80220394004 } ]
C++
dev/Code/Tools/RC/ResourceCompilerPC/CGA/ControllerPQ.cpp
crazyskateface/lumberyard
164512f8d415d6bdf37e195af319ffe5f96a8f0b
#include "stdafx.h" #include "AnimationLoader.h" #include "AnimationManager.h" #include "Wavelets/Compression.h" #include <float.h> namespace ControllerHelper { uint32 GetPositionsFormatSizeOf(uint32 format) { switch (format) { case eNoCompress: case eNoCompressVec3: { return sizeof (NoCompressVec3); } } return 0; } uint32 GetRotationFormatSizeOf(uint32 format) { switch (format) { case eNoCompress: case eNoCompressQuat: return sizeof(NoCompressQuat); case eSmallTree48BitQuat: return sizeof(SmallTree48BitQuat); case eSmallTree64BitQuat: return sizeof(SmallTree64BitQuat); case eSmallTree64BitExtQuat: return sizeof(SmallTree64BitExtQuat); } return 0; } uint32 GetKeyTimesFormatSizeOf(uint32 format) { switch (format) { case eF32: return sizeof(float); case eUINT16: return sizeof(uint16); case eByte: return sizeof(uint8); case eF32StartStop: return sizeof(float); case eUINT16StartStop: return sizeof(uint16); case eByteStartStop: return sizeof(uint8); case eBitset: return sizeof(uint16); } return 0; } ITrackPositionStorage* GetPositionControllerPtr(ECompressionFormat format) { switch (format) { case eNoCompress: case eNoCompressVec3: { return new NoCompressPosition; } } return 0; } ITrackRotationStorage* GetRotationControllerPtr(ECompressionFormat format) { switch (format) { case eNoCompress: case eNoCompressQuat: return new NoCompressRotation; case eSmallTree48BitQuat: return new SmallTree48BitQuatRotation; case eSmallTree64BitQuat: return new SmallTree64BitQuatRotation; case eSmallTree64BitExtQuat: return new SmallTree64BitExtQuatRotation; } return 0; } IKeyTimesInformation* GetKeyTimesControllerPtr(uint32 format) { switch (format) { case eF32: return new F32KeyTimesInformation; case eUINT16: return new UINT16KeyTimesInformation; case eByte: return new ByteKeyTimesInformation; case eBitset: return new CKeyTimesInformationBitSet; } return 0; } const uint8 m_byteLowBit[byteArraySize] _ALIGN(16) = { 8, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 }; const uint8 m_byteHighBit[byteArraySize] _ALIGN(16) = { 16, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 }; }; uint8 CKeyTimesInformationBitSet::m_bTable[256] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8 };
#include "stdafx.h" #include "AnimationLoader.h" #include "AnimationManager.h" #include "Wavelets/Compression.h" #include <float.h> namespace ControllerHelper { uint32 GetPositionsFormatSizeOf(uint32 format) { switch (format) { case eNoCompress: case eNoCompressVec3: { return sizeof (NoCompressVec3); } } return 0; } uint32 GetRotationFormatSizeOf(uint32 format) { switch (format) { case eNoCompress: case eNoCompressQuat: return sizeof(NoCompressQuat); case eSmallTree48BitQuat: return sizeof(SmallTree48BitQuat); case eSmallTree64BitQuat: return sizeof(SmallTree64BitQuat); case eSmallTree64BitExtQuat: return sizeof(SmallTree64BitExtQuat); } return 0; } uint32 GetKeyTimesFormatSizeOf(uint32 format) { switc
ation; case eByte: return new ByteKeyTimesInformation; case eBitset: return new CKeyTimesInformationBitSet; } return 0; } const uint8 m_byteLowBit[byteArraySize] _ALIGN(16) = { 8, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 }; const uint8 m_byteHighBit[byteArraySize] _ALIGN(16) = { 16, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 }; }; uint8 CKeyTimesInformationBitSet::m_bTable[256] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8 };
h (format) { case eF32: return sizeof(float); case eUINT16: return sizeof(uint16); case eByte: return sizeof(uint8); case eF32StartStop: return sizeof(float); case eUINT16StartStop: return sizeof(uint16); case eByteStartStop: return sizeof(uint8); case eBitset: return sizeof(uint16); } return 0; } ITrackPositionStorage* GetPositionControllerPtr(ECompressionFormat format) { switch (format) { case eNoCompress: case eNoCompressVec3: { return new NoCompressPosition; } } return 0; } ITrackRotationStorage* GetRotationControllerPtr(ECompressionFormat format) { switch (format) { case eNoCompress: case eNoCompressQuat: return new NoCompressRotation; case eSmallTree48BitQuat: return new SmallTree48BitQuatRotation; case eSmallTree64BitQuat: return new SmallTree64BitQuatRotation; case eSmallTree64BitExtQuat: return new SmallTree64BitExtQuatRotation; } return 0; } IKeyTimesInformation* GetKeyTimesControllerPtr(uint32 format) { switch (format) { case eF32: return new F32KeyTimesInformation; case eUINT16: return new UINT16KeyTimesInform
random
[]
C++
qtmultimedia/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp
wgnet/wds_qt
8db722fd367d2d0744decf99ac7bafaba8b8a3d3
#include "camerabinrecorder.h" #include "camerabincontrol.h" #include "camerabinresourcepolicy.h" #include "camerabinaudioencoder.h" #include "camerabinvideoencoder.h" #include "camerabincontainer.h" #include <QtCore/QDebug> QT_BEGIN_NAMESPACE CameraBinRecorder::CameraBinRecorder(CameraBinSession *session) :QMediaRecorderControl(session), m_session(session), m_state(QMediaRecorder::StoppedState), m_status(QMediaRecorder::UnloadedStatus) { connect(m_session, SIGNAL(statusChanged(QCamera::Status)), SLOT(updateStatus())); connect(m_session, SIGNAL(pendingStateChanged(QCamera::State)), SLOT(updateStatus())); connect(m_session, SIGNAL(busyChanged(bool)), SLOT(updateStatus())); connect(m_session, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64))); connect(m_session, SIGNAL(mutedChanged(bool)), this, SIGNAL(mutedChanged(bool))); connect(m_session->cameraControl()->resourcePolicy(), SIGNAL(canCaptureChanged()), this, SLOT(updateStatus())); } CameraBinRecorder::~CameraBinRecorder() { } QUrl CameraBinRecorder::outputLocation() const { return m_session->outputLocation(); } bool CameraBinRecorder::setOutputLocation(const QUrl &sink) { m_session->setOutputLocation(sink); return true; } QMediaRecorder::State CameraBinRecorder::state() const { return m_state; } QMediaRecorder::Status CameraBinRecorder::status() const { return m_status; } void CameraBinRecorder::updateStatus() { QCamera::Status sessionStatus = m_session->status(); QMediaRecorder::State oldState = m_state; QMediaRecorder::Status oldStatus = m_status; if (sessionStatus == QCamera::ActiveStatus && m_session->captureMode().testFlag(QCamera::CaptureVideo)) { if (!m_session->cameraControl()->resourcePolicy()->canCapture()) { m_status = QMediaRecorder::UnavailableStatus; m_state = QMediaRecorder::StoppedState; m_session->stopVideoRecording(); } else if (m_state == QMediaRecorder::RecordingState) { m_status = QMediaRecorder::RecordingStatus; } else { m_status = m_session->isBusy() ? QMediaRecorder::FinalizingStatus : QMediaRecorder::LoadedStatus; } } else { if (m_state == QMediaRecorder::RecordingState) { m_state = QMediaRecorder::StoppedState; m_session->stopVideoRecording(); } m_status = m_session->pendingState() == QCamera::ActiveState && m_session->captureMode().testFlag(QCamera::CaptureVideo) ? QMediaRecorder::LoadingStatus : QMediaRecorder::UnloadedStatus; } if (m_state != oldState) emit stateChanged(m_state); if (m_status != oldStatus) emit statusChanged(m_status); } qint64 CameraBinRecorder::duration() const { return m_session->duration(); } void CameraBinRecorder::applySettings() { #ifdef HAVE_GST_ENCODING_PROFILES CameraBinContainer *containerControl = m_session->mediaContainerControl(); CameraBinAudioEncoder *audioEncoderControl = m_session->audioEncodeControl(); CameraBinVideoEncoder *videoEncoderControl = m_session->videoEncodeControl(); containerControl->resetActualContainerFormat(); audioEncoderControl->resetActualSettings(); videoEncoderControl->resetActualSettings(); if (containerControl->containerFormat().isEmpty() && audioEncoderControl->audioSettings().codec().isEmpty() && videoEncoderControl->videoSettings().codec().isEmpty()) { QList<QStringList> candidates; candidates.append(QStringList() << "video/x-matroska" << "video/x-h264" << "audio/mpeg, mpegversion=(int)4"); candidates.append(QStringList() << "video/webm" << "video/x-vp8" << "audio/x-vorbis"); candidates.append(QStringList() << "application/ogg" << "video/x-theora" << "audio/x-vorbis"); candidates.append(QStringList() << "video/quicktime" << "video/x-h264" << "audio/mpeg, mpegversion=(int)4"); candidates.append(QStringList() << "video/quicktime" << "video/x-h264" << "audio/mpeg"); candidates.append(QStringList() << "video/x-msvideo" << "video/x-divx" << "audio/mpeg"); foreach (const QStringList &candidate, candidates) { if (containerControl->supportedContainers().contains(candidate[0]) && videoEncoderControl->supportedVideoCodecs().contains(candidate[1]) && audioEncoderControl->supportedAudioCodecs().contains(candidate[2])) { containerControl->setActualContainerFormat(candidate[0]); QVideoEncoderSettings videoSettings = videoEncoderControl->videoSettings(); videoSettings.setCodec(candidate[1]); videoEncoderControl->setActualVideoSettings(videoSettings); QAudioEncoderSettings audioSettings = audioEncoderControl->audioSettings(); audioSettings.setCodec(candidate[2]); audioEncoderControl->setActualAudioSettings(audioSettings); break; } } } #endif } #ifdef HAVE_GST_ENCODING_PROFILES GstEncodingContainerProfile *CameraBinRecorder::videoProfile() { GstEncodingContainerProfile *containerProfile = m_session->mediaContainerControl()->createProfile(); if (containerProfile) { GstEncodingProfile *audioProfile = m_session->audioEncodeControl()->createProfile(); GstEncodingProfile *videoProfile = m_session->videoEncodeControl()->createProfile(); if (audioProfile) { if (!gst_encoding_container_profile_add_profile(containerProfile, audioProfile)) gst_encoding_profile_unref(audioProfile); } if (videoProfile) { if (!gst_encoding_container_profile_add_profile(containerProfile, videoProfile)) gst_encoding_profile_unref(videoProfile); } } return containerProfile; } #endif void CameraBinRecorder::setState(QMediaRecorder::State state) { if (m_state == state) return; QMediaRecorder::State oldState = m_state; QMediaRecorder::Status oldStatus = m_status; switch (state) { case QMediaRecorder::StoppedState: m_state = state; m_status = QMediaRecorder::FinalizingStatus; m_session->stopVideoRecording(); break; case QMediaRecorder::PausedState: emit error(QMediaRecorder::ResourceError, tr("QMediaRecorder::pause() is not supported by camerabin2.")); break; case QMediaRecorder::RecordingState: if (m_session->status() != QCamera::ActiveStatus) { emit error(QMediaRecorder::ResourceError, tr("Service has not been started")); } else if (!m_session->cameraControl()->resourcePolicy()->canCapture()) { emit error(QMediaRecorder::ResourceError, tr("Recording permissions are not available")); } else { m_session->recordVideo(); m_state = state; m_status = QMediaRecorder::RecordingStatus; emit actualLocationChanged(m_session->outputLocation()); } } if (m_state != oldState) emit stateChanged(m_state); if (m_status != oldStatus) emit statusChanged(m_status); } bool CameraBinRecorder::isMuted() const { return m_session->isMuted(); } qreal CameraBinRecorder::volume() const { return 1.0; } void CameraBinRecorder::setMuted(bool muted) { m_session->setMuted(muted); } void CameraBinRecorder::setVolume(qreal volume) { if (!qFuzzyCompare(volume, qreal(1.0))) qWarning() << "Media service doesn't support recorder audio gain."; } QT_END_NAMESPACE
#include "camerabinrecorder.h" #include "camerabincontrol.h" #include "camerabinresourcepolicy.h" #include "camerabinaudioencoder.h" #include "camerabinvideoencoder.h" #include "camerabincontainer.h" #include <QtCore/QDebug> QT_BEGIN_NAMESPACE CameraBinRecorder::CameraBinRecorder(CameraBinSession *session) :QMediaRecorderControl(session), m_session(session), m_state(QMediaRecorder::StoppedState), m_status(QMediaRecorder::UnloadedStatus) { connect(m_session, SIGNAL(statusChanged(QCamera::Status)), SLOT(updateStatus())); connect(m_session, SIGNAL(pendingStateChanged(QCamera::State)), SLOT(updateStatus())); connect(m_session, SIGNAL(busyChanged(bool)), SLOT(updateStatus())); connect(m_session, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64))); connect(m_session, SIGNAL(mutedChanged(bool)), this, SIGNAL(mutedChanged(bool))); connect(m_session->cameraControl()->resourcePolicy(), SIGNAL(canCaptureChanged()), this, SLOT(updateStatus())); } CameraBinRecorder::~CameraBinRecorder() { } QUrl CameraBinRecorder::outputLocation() const { return m_session->outputLocation(); } bool CameraBinRecorder::setOutputLocation(const QUrl &sink) { m_session->setOutputLocation(sink); return true; } QMediaRecorder::State CameraBinRecorder::state() const { return m_state; } QMediaRecorder::Status CameraBinRecorder::status() const { return m_status; } void CameraBinRecorder::updateStatus() { QCamera::Status sessionStatus = m_session->status(); QMediaRecorder::State oldState = m_state; QMediaRecorder::Status oldStatus = m_status; if (sessionStatus == QCamera::ActiveStatus && m_session->captureMode().testFlag(QCamera::CaptureVideo)) { if (!m_session->cameraControl()->resourcePolicy()->canCapture()) { m_status = QMediaRecorder::UnavailableStatus; m_state = QMediaRecorder::StoppedState; m_session->stopVideoRecording(); } else if (m_state == QMediaRecorder::RecordingState) { m_status = QMediaRecorder::RecordingStatus; } else { m_status = m_session->isBusy() ? QMediaRecorder::FinalizingStatus : QMediaRecorder::LoadedStatus; } } else { if (m_state == QMediaRecorder::RecordingState) { m_state = QMediaRecorder::StoppedState; m_session->stopVideoRecording(); } m_status = m_session->pendingState() == QCamera::ActiveState && m_session->captureMode().testFlag(QCamera::CaptureVideo) ? QMediaRecorder::LoadingStatus : QMediaRecorder::UnloadedStatus; } if (m_state != oldState) emit stateChanged(m_state); if (m_status != oldStatus) emit statusChanged(m_status); } qint64 CameraBinRecorder::duration() const { return m_session->duration(); } void CameraBinRecorder::applySettings() { #ifdef HAVE_GST_ENCODING_PROFILES CameraBinContainer *containerControl = m_session->mediaContainerControl(); CameraBinAudioEncoder *audioEncoderControl = m_session->audioEncodeControl(); CameraBinVideoEncoder *videoEncoderControl = m_session->videoEncodeControl(); containerControl->resetActualContainerFormat(); audioEncoderControl->resetActualSettings(); videoEncoderControl->resetActualSettings(); if (containerControl->containerFormat().isEmpty() && audioEncoderControl->audioSettings().codec().isEmpty() && videoEncoderControl->videoSettings().codec().isEmpty()) { QList<QStringList> candidates; candidates.append(QStringList() << "video/x-matroska" << "video/x-h264" << "audio/mpeg, mpegversion=(int)4"); candidates.append(QStringList() << "video/webm" << "video/x-vp8" << "audio/x-vorbis"); candidates.append(QStringList() << "application/ogg" << "video/x-theora" << "audio/x-vorbis"); candidates.append(QStringList() << "video/quicktime" << "video/x-h264" << "audio/mpeg, mpegversion=(int)4"); candidates.append(QStringList() << "video/quicktime" << "video/x-h264" << "audio/mpeg"); candidates.append(QStringList() << "video/x-msvideo" << "video/x-divx" << "audio/mpeg"); foreach (const QStringList &candidate, candidates) { if (containerControl->supportedContainers().contains(candidate[0]) && videoEncoderControl->supportedVideoCodecs().contains(candidate[1]) && audioEncoderControl->supportedAudioCodecs().contains(candidate[2])) { containerControl->setActualContainerFormat(candidate[0]); QVideoEncoderSettings videoSettings = videoEncoderControl->videoSettings(); videoSettings.setCodec(candidate[1]); videoEncoderControl->setActualVideoSettings(videoSettings); QAudioEncoderSettings audioSettings = audioEncoderControl->audioSettings(); audioSettings.setCodec(candidate[2]); audioEncoderControl->setActualAudioSettings(audioSettings); break; } } } #endif } #ifdef HAVE_GST_ENCODING_PROFILES GstEncodingContainerProfile *CameraBinRecorder::videoProfile() { GstEncodingContainerProfile *containerProfile = m_session->mediaContainerControl()->createProfile(); if (containerProfile) { GstEncodingProfile *audioProfile = m_session->audioEncodeControl()->createProfile(); GstEncodingProfile *videoProfile = m_session->videoEncodeControl()->createProfile(); if (audioProfile) { if (!gst_encoding_container_profile_add_profile(containerProfile, audioProfile)) gst_encoding_profile_unref(audioProfile); } if (videoProfile) { if (!gst_encoding_container_profile_add_profile(containerProfile, videoProfile)) gst_encoding_profile_unref(videoProfile); } } return containerProfile; } #endif void CameraBinRecorder::setState(QMediaRecorder::State state) { if (m_state == state) return; QMediaRecorder::State oldState = m_state; QMediaRecorder::Status oldStatus = m_status; switch (state) { case QMediaRecorder::StoppedState: m_state = state; m_status = QMediaRecorder::FinalizingStatus; m_session->stopVideoRecording(); break; case QMediaRecorder::PausedState: emit error(QMediaRecorder::ResourceError, tr("QMediaRecorder::pause() is not supported by camerabin2.")); break; case QMediaRecorder::RecordingState:
} if (m_state != oldState) emit stateChanged(m_state); if (m_status != oldStatus) emit statusChanged(m_status); } bool CameraBinRecorder::isMuted() const { return m_session->isMuted(); } qreal CameraBinRecorder::volume() const { return 1.0; } void CameraBinRecorder::setMuted(bool muted) { m_session->setMuted(muted); } void CameraBinRecorder::setVolume(qreal volume) { if (!qFuzzyCompare(volume, qreal(1.0))) qWarning() << "Media service doesn't support recorder audio gain."; } QT_END_NAMESPACE
if (m_session->status() != QCamera::ActiveStatus) { emit error(QMediaRecorder::ResourceError, tr("Service has not been started")); } else if (!m_session->cameraControl()->resourcePolicy()->canCapture()) { emit error(QMediaRecorder::ResourceError, tr("Recording permissions are not available")); } else { m_session->recordVideo(); m_state = state; m_status = QMediaRecorder::RecordingStatus; emit actualLocationChanged(m_session->outputLocation()); }
if_condition
[]
C++
camera/hal/test/v4l2/src/pipeline_test.cpp
openharmony-gitee-mirror/drivers_peripheral
4ee6d41befdf54a97afeb5838be5fcd0b4888d56
#include "pipeline_test.h" void UtestPipelineTest::SetUpTestCase(void) {} void UtestPipelineTest::TearDownTestCase(void) {} void UtestPipelineTest::SetUp(void) { if (display_ == nullptr) display_ = std::make_shared<TestDisplay>(); display_->FBInit(); display_->Init(); } void UtestPipelineTest::TearDown(void) { display_->Close(); } TEST_F(UtestPipelineTest, camera_ppl_0001) { std::cout << "==========[test log] Check ppl: preview success." << std::endl; display_->AchieveStreamOperator(); display_->intents = {Camera::PREVIEW}; display_->StartStream(display_->intents); display_->StartCapture(display_->streamId_preview, display_->captureId_preview, false, true); display_->captureIds = {display_->captureId_preview}; display_->streamIds = {display_->streamId_preview}; display_->StopStream(display_->captureIds, display_->streamIds); } TEST_F(UtestPipelineTest, camera_ppl_0002) { std::cout << "==========[test log] Check ppl: preview + capture success." << std::endl; display_->AchieveStreamOperator(); display_->intents = {Camera::PREVIEW, Camera::STILL_CAPTURE}; display_->StartStream(display_->intents); display_->StartCapture(display_->streamId_preview, display_->captureId_preview, false, true); display_->StartCapture(display_->streamId_capture, display_->captureId_capture, false, true); display_->captureIds = {display_->captureId_preview, display_->captureId_capture}; display_->streamIds = {display_->streamId_preview, display_->streamId_capture}; display_->StopStream(display_->captureIds, display_->streamIds); } TEST_F(UtestPipelineTest, camera_ppl_0003) { std::cout << "==========[test log] Check ppl: preview + video success." << std::endl; display_->AchieveStreamOperator(); display_->intents = {Camera::PREVIEW, Camera::VIDEO}; display_->StartStream(display_->intents); display_->StartCapture(display_->streamId_preview, display_->captureId_preview, false, true); display_->StartCapture(display_->streamId_video, display_->captureId_video, false, true); display_->captureIds = {display_->captureId_preview, display_->captureId_video}; display_->streamIds = {display_->streamId_preview, display_->streamId_video}; display_->StopStream(display_->captureIds, display_->streamIds); } TEST_F(UtestPipelineTest, camera_ppl_0004) { std::cout << "==========[test log] Video mode without preview, system not support, "; std::cout << "expected return fail." << std::endl; EXPECT_EQ(true, display_->cameraDevice != nullptr); display_->AchieveStreamOperator(); std::vector<std::shared_ptr<StreamInfo>> streamInfos; std::shared_ptr<IBufferProducer> producer = IBufferProducer::CreateBufferQueue(); producer->SetQueueSize(8); if (producer->GetQueueSize() != 8) { std::cout << "~~~~~~~" << std::endl; } auto callback = [this](std::shared_ptr<SurfaceBuffer> b) { display_->BufferCallback(b, display_->video_mode); return; }; producer->SetCallback(callback); display_->streamInfo = std::make_shared<OHOS::Camera::StreamInfo>(); display_->streamInfo->streamId_ = display_->streamId_video; display_->streamInfo->width_ = 640; display_->streamInfo->height_ = 480; display_->streamInfo->format_ = CAMERA_FORMAT_YUYV_422_PKG; display_->streamInfo->datasapce_ = 10; display_->streamInfo->intent_ = Camera::VIDEO; display_->streamInfo->tunneledMode_ = 5; display_->streamInfo->bufferQueue_ = producer; std::vector<std::shared_ptr<OHOS::Camera::StreamInfo>>().swap(streamInfos); streamInfos.push_back(display_->streamInfo); display_->rc = display_->streamOperator->CreateStreams(streamInfos); EXPECT_EQ(false, display_->rc == Camera::METHOD_NOT_SUPPORTED); if (display_->rc == Camera::METHOD_NOT_SUPPORTED) { std::cout << "==========[test log] CreateStreams METHOD_NOT_SUPPORTED, streamId = "; std::cout << display_->streamId_video <<", intent = Camera::VIDEO" << std::endl; } else { std::cout << "==========[test log] CreateStreams fail, rc = " << display_->rc << std::endl; } display_->rc = display_->streamOperator->CommitStreams(Camera::NORMAL, nullptr); EXPECT_EQ(false, display_->rc == Camera::NO_ERROR); if (display_->rc == Camera::NO_ERROR) { std::cout << "==========[test log] CommitStreams success." << std::endl; } else { std::cout << "==========[test log] CommitStreams fail, rc = ." << display_->rc << std::endl; } }
#include "pipeline_test.h" void UtestPipelineTest::SetUpTestCase(void) {} void UtestPipelineTest::TearDownTestCase(void) {} void UtestPipelineTest::SetUp(void) { if (display_ == nullptr) display_ = std::make_shared<TestDisplay>(); display_->FBInit(); display_->Init(); } void UtestPipelineTest::TearDown(void) { display_->Close(); }
TEST_F(UtestPipelineTest, camera_ppl_0002) { std::cout << "==========[test log] Check ppl: preview + capture success." << std::endl; display_->AchieveStreamOperator(); display_->intents = {Camera::PREVIEW, Camera::STILL_CAPTURE}; display_->StartStream(display_->intents); display_->StartCapture(display_->streamId_preview, display_->captureId_preview, false, true); display_->StartCapture(display_->streamId_capture, display_->captureId_capture, false, true); display_->captureIds = {display_->captureId_preview, display_->captureId_capture}; display_->streamIds = {display_->streamId_preview, display_->streamId_capture}; display_->StopStream(display_->captureIds, display_->streamIds); } TEST_F(UtestPipelineTest, camera_ppl_0003) { std::cout << "==========[test log] Check ppl: preview + video success." << std::endl; display_->AchieveStreamOperator(); display_->intents = {Camera::PREVIEW, Camera::VIDEO}; display_->StartStream(display_->intents); display_->StartCapture(display_->streamId_preview, display_->captureId_preview, false, true); display_->StartCapture(display_->streamId_video, display_->captureId_video, false, true); display_->captureIds = {display_->captureId_preview, display_->captureId_video}; display_->streamIds = {display_->streamId_preview, display_->streamId_video}; display_->StopStream(display_->captureIds, display_->streamIds); } TEST_F(UtestPipelineTest, camera_ppl_0004) { std::cout << "==========[test log] Video mode without preview, system not support, "; std::cout << "expected return fail." << std::endl; EXPECT_EQ(true, display_->cameraDevice != nullptr); display_->AchieveStreamOperator(); std::vector<std::shared_ptr<StreamInfo>> streamInfos; std::shared_ptr<IBufferProducer> producer = IBufferProducer::CreateBufferQueue(); producer->SetQueueSize(8); if (producer->GetQueueSize() != 8) { std::cout << "~~~~~~~" << std::endl; } auto callback = [this](std::shared_ptr<SurfaceBuffer> b) { display_->BufferCallback(b, display_->video_mode); return; }; producer->SetCallback(callback); display_->streamInfo = std::make_shared<OHOS::Camera::StreamInfo>(); display_->streamInfo->streamId_ = display_->streamId_video; display_->streamInfo->width_ = 640; display_->streamInfo->height_ = 480; display_->streamInfo->format_ = CAMERA_FORMAT_YUYV_422_PKG; display_->streamInfo->datasapce_ = 10; display_->streamInfo->intent_ = Camera::VIDEO; display_->streamInfo->tunneledMode_ = 5; display_->streamInfo->bufferQueue_ = producer; std::vector<std::shared_ptr<OHOS::Camera::StreamInfo>>().swap(streamInfos); streamInfos.push_back(display_->streamInfo); display_->rc = display_->streamOperator->CreateStreams(streamInfos); EXPECT_EQ(false, display_->rc == Camera::METHOD_NOT_SUPPORTED); if (display_->rc == Camera::METHOD_NOT_SUPPORTED) { std::cout << "==========[test log] CreateStreams METHOD_NOT_SUPPORTED, streamId = "; std::cout << display_->streamId_video <<", intent = Camera::VIDEO" << std::endl; } else { std::cout << "==========[test log] CreateStreams fail, rc = " << display_->rc << std::endl; } display_->rc = display_->streamOperator->CommitStreams(Camera::NORMAL, nullptr); EXPECT_EQ(false, display_->rc == Camera::NO_ERROR); if (display_->rc == Camera::NO_ERROR) { std::cout << "==========[test log] CommitStreams success." << std::endl; } else { std::cout << "==========[test log] CommitStreams fail, rc = ." << display_->rc << std::endl; } }
TEST_F(UtestPipelineTest, camera_ppl_0001) { std::cout << "==========[test log] Check ppl: preview success." << std::endl; display_->AchieveStreamOperator(); display_->intents = {Camera::PREVIEW}; display_->StartStream(display_->intents); display_->StartCapture(display_->streamId_preview, display_->captureId_preview, false, true); display_->captureIds = {display_->captureId_preview}; display_->streamIds = {display_->streamId_preview}; display_->StopStream(display_->captureIds, display_->streamIds); }
function_block-full_function
[ { "content": "struct IWiFi *g_wifi = nullptr;\n\nconst int32_t WLAN_TX_POWER = 160;\n\nconst uint32_t WLAN_MIN_CHIPID = 0;\n\nconst uint32_t WLAN_MAX_CHIPID = 2;\n\nconst uint32_t IFNAME_MIN_NUM = 0;\n\nconst uint32_t IFNAME_MAX_NUM = 32;\n\nconst uint32_t MAX_IF_NAME_LENGTH = 16;\n\nconst uint32_t SIZE = 4;\n\n\n", "file_path": "wlan/test/unittest/common/wifi_hal_test.cpp", "rank": 0, "score": 80817.08703279891 }, { "content": "struct IWiFi *g_wifi = nullptr;\n\nconst int32_t USEC_TIME = 1000000;\n\nconst int32_t MSEC_TIME = 1000;\n\nconst int32_t COMMON_TIME = 3000;\n\nconst int32_t MEDIUM_TIME = 20000;\n\nconst int32_t LONG_TIME = 200000;\n\nconst int32_t WLAN_BAND_2G = 0;\n\nconst int32_t WLAN_FREQ_MAX_NUM = 14;\n\nconst int32_t WLAN_MAX_NUM_STA_WITH_AP = 4;\n\nconst uint32_t DEFAULT_COMBO_SIZE = 10;\n\nconst uint32_t RESET_TIME = 20;\n\nconst uint32_t WLAN_MIN_CHIPID = 0;\n\nconst uint32_t WLAN_MAX_CHIPID = 2;\n\n\n\nstatic int32_t g_resetStatus = -1;\n\n\n", "file_path": "wlan/test/performance/common/hdf_wlan_performance_test.cpp", "rank": 1, "score": 79850.32426108514 }, { "content": "struct AcmDevice * SetUpAcmDevice(void)\n\n{\n\n int32_t ret;\n\n\n\n struct AcmDevice *acmDevice = nullptr;\n\n struct UsbFnDescriptorData descData;\n\n descData.type = USBFN_DESC_DATA_TYPE_DESC;\n\n descData.descriptor = &g_acmFnDevice;\n\n acmDevice = (struct AcmDevice *)OsalMemCalloc(sizeof(*acmDevice));\n\n if (acmDevice == nullptr) {\n\n return nullptr;\n\n }\n\n acmDevice->fnDev = (struct UsbFnDevice *)UsbFnCreateDevice(\"100e0000.hidwc3_0\", &descData);\n\n if (acmDevice->fnDev == nullptr) {\n\n return nullptr;\n\n }\n\n acmDevice->port = (struct Serial *)SerialAlloc();\n\n if (acmDevice->port == nullptr) {\n\n return nullptr;\n\n }\n", "file_path": "usb/test/unittest/device_sdk/usb_device_cdcacm_test.cpp", "rank": 2, "score": 77143.47501789978 }, { "content": " virtual int32_t GetSequenceId() const = 0;\n\n virtual int32_t GetFenceId() const = 0;\n\n virtual EsFrameInfo GetEsFrameInfo() const = 0;\n\n virtual int32_t GetEncodeType() const = 0;\n\n virtual int32_t GetStreamId() const = 0;\n\n\n\n virtual void SetIndex(const int32_t index) = 0;\n\n virtual void SetWidth(const uint32_t width) = 0;\n\n virtual void SetHeight(const uint32_t height) = 0;\n\n virtual void SetStride(const uint32_t stride) = 0;\n\n virtual void SetFormat(const int32_t format) = 0;\n\n virtual void SetSize(const uint32_t size) = 0;\n\n virtual void SetUsage(const uint64_t usage) = 0;\n\n virtual void SetVirAddress(const void* addr) = 0;\n\n virtual void SetPhyAddress(const uint64_t addr) = 0;\n\n virtual void SetFileDescriptor(const int32_t fd) = 0;\n\n virtual void SetTimestamp(const uint64_t timestamp) = 0;\n\n virtual void SetFrameNumber(const uint64_t frameNumber) = 0;\n\n virtual void SetPoolId(const int64_t id) = 0;\n\n virtual void SetCaptureId(const int32_t id) = 0;\n", "file_path": "camera/hal/include/ibuffer.h", "rank": 3, "score": 63349.93315361182 }, { "content": " virtual void SetBufferStatus(const CameraBufferStatus flag) = 0;\n\n virtual void SetSequenceId(const int32_t sequence) = 0;\n\n virtual void SetFenceId(const int32_t fence) = 0;\n\n virtual void SetEncodeType(const int32_t type) = 0;\n\n virtual void SetEsFrameSize(const int32_t frameSize) = 0;\n\n virtual void SetEsTimestamp(const int64_t timeStamp) = 0;\n\n virtual void SetEsKeyFrame(const int32_t isKey) = 0;\n\n virtual void SetEsFrameNum(const int32_t frameNum) = 0;\n\n virtual void SetStreamId(const int32_t streamId) = 0;\n\n\n\n virtual void Free() = 0;\n\n\n\n virtual bool operator==(const IBuffer& u) = 0;\n\n};\n\n} // namespace OHOS::Camera\n\n#endif\n\n\n", "file_path": "camera/hal/include/ibuffer.h", "rank": 4, "score": 63349.849849742044 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef HOS_CAMERA_IBUFFER_H\n\n#define HOS_CAMERA_IBUFFER_H\n\n\n\n#include \"camera.h\"\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal/include/ibuffer.h", "rank": 5, "score": 63346.47170655384 }, { "content": "struct DevHandle *(*AudioSmartPaTest::BindServiceRenderSo)(const char *) = nullptr;\n\nint32_t (*AudioSmartPaTest::InterfaceLibOutputRender)(struct DevHandle *, int, struct AudioHwRenderParam *) = nullptr;\n\nint32_t (*AudioSmartPaTest::InterfaceLibCtlRender)(struct DevHandle *, int, struct AudioHwRenderParam *) = nullptr;\n\nvoid (*AudioSmartPaTest::CloseServiceRenderSo)(struct DevHandle *) = nullptr;\n\nvoid *AudioSmartPaTest::PtrHandle = nullptr;\n\nusing THREAD_FUNC = void *(*)(void *);\n\n\n\nvoid AudioSmartPaTest::SetUpTestCase(void)\n\n{\n\n char absPath[PATH_MAX] = {0};\n\n if (realpath(RESOLVED_PATH.c_str(), absPath) == nullptr) {\n\n return;\n\n }\n\n handleSo = dlopen(absPath, RTLD_LAZY);\n\n if (handleSo == nullptr) {\n\n return;\n\n }\n\n GetAudioManager = (TestAudioManager *(*)())(dlsym(handleSo, FUNCTION_NAME.c_str()));\n\n if (GetAudioManager == nullptr) {\n\n return;\n", "file_path": "audio/test/systemtest/audio_function/audio_smartpa/src/audio_smartpa_test.cpp", "rank": 6, "score": 63099.424477775014 }, { "content": "struct DevHandle *(*AudioLibRenderTest::BindServiceRenderSo)(const char *) = nullptr;\n\nint32_t (*AudioLibRenderTest::InterfaceLibOutputRender)(struct DevHandle *, int, struct AudioHwRenderParam *) = nullptr;\n\nint32_t (*AudioLibRenderTest::InterfaceLibCtlRender)(struct DevHandle *, int, struct AudioHwRenderParam *) = nullptr;\n\nvoid (*AudioLibRenderTest::CloseServiceRenderSo)(struct DevHandle *) = nullptr;\n\nvoid *AudioLibRenderTest::PtrHandle = nullptr;\n\n#ifdef AUDIO_MPI_SO\n\n int32_t (*AudioLibRenderTest::SdkInit)() = nullptr;\n\n void (*AudioLibRenderTest::SdkExit)() = nullptr;\n\n#endif\n\n\n\nvoid AudioLibRenderTest::SetUpTestCase(void)\n\n{\n\n#ifdef __LITEOS__\n\n char resolvedPath[] = \"/usr/lib/libhdi_audio_interface_lib_render.so\";\n\n#else\n\n char resolvedPath[] = \"//system/lib/libhdi_audio_interface_lib_render.z.so\";\n\n#endif\n\n PtrHandle = dlopen(resolvedPath, RTLD_LAZY);\n\n if (PtrHandle == nullptr) {\n\n return;\n", "file_path": "audio/test/systemtest/adm_interface_lib/render/src/audio_librender_test.cpp", "rank": 7, "score": 63099.424477775014 }, { "content": "struct DevHandle *(*AudioLibCaptureTest::BindServiceCaptureSo)(const char *) = nullptr;\n\nint32_t (*AudioLibCaptureTest::InterfaceLibOutputCapture)(struct DevHandle *, int,\n\n struct AudioHwCaptureParam *) = nullptr;\n\nint32_t (*AudioLibCaptureTest::InterfaceLibCtlCapture)(struct DevHandle *, int, struct AudioHwCaptureParam *) = nullptr;\n\nvoid (*AudioLibCaptureTest::CloseServiceCaptureSo)(struct DevHandle *) = nullptr;\n\n#ifdef AUDIO_MPI_SO\n\n int32_t (*AudioLibCaptureTest::SdkInit)() = nullptr;\n\n void (*AudioLibCaptureTest::SdkExit)() = nullptr;\n\n#endif\n\nvoid *AudioLibCaptureTest::PtrHandle = nullptr;\n\n\n\nvoid AudioLibCaptureTest::SetUpTestCase(void)\n\n{\n\n#ifdef __LITEOS__\n\n char resolvedPath[] = \"/usr/lib/libhdi_audio_interface_lib_capture.so\";\n\n#else\n\n char resolvedPath[] = \"//system/lib/libhdi_audio_interface_lib_capture.z.so\";\n\n#endif\n\n PtrHandle = dlopen(resolvedPath, RTLD_LAZY);\n\n if (PtrHandle == nullptr) {\n", "file_path": "audio/test/systemtest/adm_interface_lib/capture/src/audio_libcapture_test.cpp", "rank": 8, "score": 63099.424477775014 }, { "content": "\n\nprivate:\n\n int32_t index_ = -1;\n\n uint32_t width_ = 0;\n\n uint32_t height_ = 0;\n\n uint32_t stride_ = 0;\n\n uint32_t format_ = CAMERA_FORMAT_INVALID;\n\n uint32_t size_ = 0;\n\n uint64_t usage_ = 0;\n\n void* virAddr_ = nullptr;\n\n uint64_t phyAddr_ = 0;\n\n int32_t fd_ = -1;\n\n int32_t sourceType_ = CAMERA_BUFFER_SOURCE_TYPE_NONE;\n\n uint64_t frameNumber_ = 0;\n\n uint64_t timeStamp_ = 0;\n\n int64_t poolId_ = -1;\n\n int32_t captureId_ = -1;\n\n CameraBufferStatus status_ = CAMERA_BUFFER_STATUS_OK;\n\n int32_t sequenceId_ = -1;\n\n int32_t fenceId_ = -1;\n\n int32_t encodeType_ = 0;\n\n EsFrameInfo esInfo_ = {-1, -1, -1, -1, -1};\n\n int32_t streamId_ = -1;\n\n std::mutex l_;\n\n};\n\n} // namespace OHOS::Camera\n\n#endif\n\n\n", "file_path": "camera/hal/include/image_buffer.h", "rank": 9, "score": 62086.359061116375 }, { "content": " * @since 1.0\n\n * @version 1.0\n\n */\n\n\n\n#ifndef HDI_CAMERA_DEVICE_CLIENT_INF_H\n\n#define HDI_CAMERA_DEVICE_CLIENT_INF_H\n\n\n\n#include <list>\n\n#include <map>\n\n#include <vector>\n\n#include <hdf_log.h>\n\n#include \"types.h\"\n\n#include \"icamera_device_callback.h\"\n\n#include \"istream_operator.h\"\n\n#include \"istream_operator_callback.h\"\n\n#include \"icamera_interface.h\"\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/interfaces/include/icamera_device.h", "rank": 10, "score": 62086.030734961714 }, { "content": " * @since 1.0\n\n * @version 1.0\n\n */\n\n\n\n#ifndef HDI_STREAM_OPERATOR_CLIENT_INF_H\n\n#define HDI_STREAM_OPERATOR_CLIENT_INF_H\n\n\n\n#include <list>\n\n#include <map>\n\n#include <vector>\n\n#include <hdf_log.h>\n\n#include \"istream_operator_callback.h\"\n\n#include \"ioffline_stream_operator.h\"\n\n#include \"types.h\"\n\n#include \"icamera_interface.h\"\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/interfaces/include/istream_operator.h", "rank": 11, "score": 62085.983647172405 }, { "content": " * @since 1.0\n\n * @version 1.0\n\n */\n\n\n\n#ifndef HDI_CAMERA_HOST_CLIENT_INF_H\n\n#define HDI_CAMERA_HOST_CLIENT_INF_H\n\n\n\n#include <list>\n\n#include <map>\n\n#include <vector>\n\n#include <hdf_log.h>\n\n#include \"icamera_device_callback.h\"\n\n#include \"types.h\"\n\n#include \"icamera_interface.h\"\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/interfaces/include/icamera_host.h", "rank": 12, "score": 62085.9339957456 }, { "content": " virtual void SetUsage(const uint64_t usage) override;\n\n virtual void SetVirAddress(const void* addr) override;\n\n virtual void SetPhyAddress(const uint64_t addr) override;\n\n virtual void SetFileDescriptor(const int32_t fd) override;\n\n virtual void SetTimestamp(const uint64_t timestamp) override;\n\n virtual void SetFrameNumber(const uint64_t frameNumber) override;\n\n virtual void SetPoolId(const int64_t id) override;\n\n virtual void SetCaptureId(const int32_t id) override;\n\n virtual void SetBufferStatus(const CameraBufferStatus flag) override;\n\n virtual void SetSequenceId(const int32_t sequence) override;\n\n virtual void SetFenceId(const int32_t fence) override;\n\n virtual void SetEncodeType(const int32_t type) override;\n\n virtual void SetEsFrameSize(const int32_t frameSize) override;\n\n virtual void SetEsTimestamp(const int64_t timeStamp) override;\n\n virtual void SetEsKeyFrame(const int32_t isKey) override;\n\n virtual void SetEsFrameNum(const int32_t frameNum) override;\n\n virtual void SetStreamId(const int32_t streamId) override;\n\n\n\n virtual void Free() override;\n\n virtual bool operator==(const IBuffer& u) override;\n", "file_path": "camera/hal/include/image_buffer.h", "rank": 13, "score": 62085.90936485609 }, { "content": " virtual std::shared_ptr<IBuffer> AcquireBuffer(int timeout) = 0;\n\n std::shared_ptr<IBuffer> AcquireBuffer()\n\n {\n\n return AcquireBuffer(0);\n\n }\n\n\n\n // return a buffer to pool.\n\n virtual RetCode ReturnBuffer(std::shared_ptr<IBuffer>& buffer) = 0;\n\n\n\n // enable tracking buffers of pool\n\n virtual void EnableTracking(const int32_t id) = 0;\n\n virtual void SetId(const int64_t id) = 0;\n\n virtual void NotifyStop() = 0;\n\n virtual void NotifyStart() = 0;\n\n virtual void ClearBuffers() = 0;\n\n virtual uint32_t GetIdleBufferCount() = 0;\n\n};\n\n} // namespace OHOS::Camera\n\n\n\n#endif\n", "file_path": "camera/hal/include/ibuffer_pool.h", "rank": 14, "score": 62085.27498680663 }, { "content": "#include <map>\n\n#include <string>\n\n\n\nnamespace OHOS::Camera {\n\nenum {\n\n INVALID_TRACKING_ID = -1,\n\n NODE_IS_EMPTY,\n\n NODE_IS_NOT_EMPTY,\n\n};\n\n\n", "file_path": "camera/hal/include/buffer_trace.h", "rank": 15, "score": 62085.11193267465 }, { "content": " static void ReportBufferLocation(const std::shared_ptr<BufferTrackingMessage>& message);\n\n\n\n // start a thread to tracking buffers of a stream.\n\n static void StartTracking();\n\n\n\n // stop stacking\n\n static void StopTracking();\n\n\n\n // check if there are buffers in a specific node.\n\n static int32_t IsNodeEmpty(const int32_t id, const std::string node);\n\n\n\n // check if there are buffers from beginNode to endNode.\n\n static int32_t IsNodeEmpty(const int32_t id, const std::string beginNode, const std::string endNode);\n\n\n\n static void DumpBufferTrace(const int32_t id, BufferTraceGraph& graph);\n\n};\n\n} // namespace OHOS::Camera\n\n#endif\n", "file_path": "camera/hal/include/buffer_tracking.h", "rank": 16, "score": 62084.91422456556 }, { "content": " virtual uint64_t GetPhyAddress() const override;\n\n virtual int32_t GetFileDescriptor() const override;\n\n virtual int32_t GetSourceType() const override;\n\n virtual uint64_t GetTimestamp() const override;\n\n virtual uint64_t GetFrameNumber() const override;\n\n virtual int64_t GetPoolId() const override;\n\n virtual int32_t GetCaptureId() const override;\n\n virtual CameraBufferStatus GetBufferStatus() const override;\n\n virtual int32_t GetSequenceId() const override;\n\n virtual int32_t GetFenceId() const override;\n\n virtual EsFrameInfo GetEsFrameInfo() const override;\n\n virtual int32_t GetEncodeType() const override;\n\n virtual int32_t GetStreamId() const override;\n\n\n\n virtual void SetIndex(const int32_t index) override;\n\n virtual void SetWidth(const uint32_t width) override;\n\n virtual void SetHeight(const uint32_t height) override;\n\n virtual void SetStride(const uint32_t stride) override;\n\n virtual void SetFormat(const int32_t format) override;\n\n virtual void SetSize(const uint32_t size) override;\n", "file_path": "camera/hal/include/image_buffer.h", "rank": 17, "score": 62084.910038309485 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef HOS_CAMERA_BUFFER_MANAGER_H\n\n#define HOS_CAMERA_BUFFER_MANAGER_H\n\n\n\n#include \"ibuffer_pool.h\"\n\n#include <map>\n\n#include <memory>\n\n#include <mutex>\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal/include/buffer_manager.h", "rank": 18, "score": 62084.87872841601 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef HOS_BUFFER_TRACKING_H\n\n#define HOS_BUFFER_TRACKING_H\n\n\n\n#include \"buffer_trace.h\"\n\n#include <memory>\n", "file_path": "camera/hal/include/buffer_tracking.h", "rank": 19, "score": 62083.86495505552 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef HOS_CAMERA_BUFFER_TRACE_H\n\n#define HOS_CAMERA_BUFFER_TRACE_H\n\n\n\n#include \"camera.h\"\n\n#include <list>\n", "file_path": "camera/hal/include/buffer_trace.h", "rank": 20, "score": 62083.84557649773 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef HOS_IBUFFER_ALLOCATOR_H\n\n#define HOS_IBUFFER_ALLOCATOR_H\n\n\n\n#include \"camera.h\"\n\n#include \"memory\"\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal/include/ibuffer_allocator.h", "rank": 21, "score": 62083.826324104106 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef HOS_CAMERA_IBUFFER_POOL_H\n\n#define HOS_CAMERA_IBUFFER_POOL_H\n\n\n\n#include \"ibuffer.h\"\n\n#include <memory>\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal/include/ibuffer_pool.h", "rank": 22, "score": 62083.78819291282 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef HOS_CAMERA_IMAGE_BUFFER_H\n\n#define HOS_CAMERA_IMAGE_BUFFER_H\n\n\n\n#include \"ibuffer.h\"\n\n#include <mutex>\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal/include/image_buffer.h", "rank": 23, "score": 62083.78819291282 }, { "content": " * @param results Indicates the metadata for which reporting is to be disabled.\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode DisableResult(const std::vector<MetaType> &results) = 0;\n\n\n\n /**\n\n * @brief Closes the camera device.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual void Close() = 0;\n\n};\n\n}\n\n#endif // HDI_CAMERA_DEVICE_CLIENT_INF_H", "file_path": "camera/interfaces/include/icamera_device.h", "rank": 24, "score": 62082.93099635565 }, { "content": " const OHOS::sptr<IStreamOperatorCallback> &callback,\n\n OHOS::sptr<IStreamOperator> &streamOperator) = 0;\n\n\n\n /**\n\n * @brief Updates camera device control parameters.\n\n *\n\n * @param settings Indicates the camera parameters, including the sensor frame rate and 3A parameters. 3A stands for automatic focus (AF), automatic exposure (AE), and automatic white-balance (​AWB).\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode UpdateSettings(const std::shared_ptr<CameraSetting> &settings) = 0;\n\n\n\n /**\n\n * @brief Sets the metadata reporting mode.\n\n *\n\n * @param mode Indicates the metadata reporting mode to set, which can be frame-by-frame reporting or reporting upon device status change. For details, see {@link ResultCallbackMode}.\n\n *\n", "file_path": "camera/interfaces/include/icamera_device.h", "rank": 25, "score": 62081.92660162625 }, { "content": " * @param mode Indicates the operation mode of the stream. For details, see {@link OperationMode}.\n\n * @param modeSetting Indicates the stream configuration parameters, including the frame rate and zoom information.\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful;\n\n * returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode CommitStreams(OperationMode mode,\n\n const std::shared_ptr<CameraStandard::CameraMetadata> &modeSetting) = 0;\n\n\n\n /**\n\n * @brief Obtains stream attributes.\n\n *\n\n * @param attributes Indicates the obtained stream attributes.\n\n * Stream information passed by the <b>streamInfos</b> parameter in {@link CreateStreams}\n\n * may be overridden. Therefore, the stream attributes obtained by using this function may be\n\n * different from the stream information passed in {@link CreateStreams}.\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful;\n", "file_path": "camera/interfaces/include/istream_operator.h", "rank": 26, "score": 62081.891652242324 }, { "content": " * If the streams can be created only after the upper-layer service or application stops capturing all streams,\n\n * <b>type</b> is set to <b>RE_CONFIGURED_REQUIRED</b>.\n\n * If the streams are not supported, <b>type</b> is set to <b>NOT_SUPPORTED</b>.\n\n * This function must be called prior to {@link CreateStreams}.\n\n *\n\n * @param mode Indicates the operation mode of the streams. For details, see {@link OperationMode}.\n\n * @param modeSetting Indicates the stream configuration parameters, including the frame rate and 3A.\n\n * 3A stands for automatic focus (AF), automatic exposure (AE), and automatic white-balance (AWB).\n\n * @param info Indicates the stream configuration information. For details, see {@link StreamInfo}.\n\n * @param type Indicates the support type of the dynamically created stream.\n\n * The supported types are defined in {@link StreamSupportType}.\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful;\n\n * returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode IsStreamsSupported(\n\n OperationMode mode,\n", "file_path": "camera/interfaces/include/istream_operator.h", "rank": 27, "score": 62081.74166014088 }, { "content": " virtual CamRetCode GetCameraIds(std::vector<std::string> &cameraIds) = 0;\n\n\n\n /**\n\n * @brief Obtains the abilities of a camera device.\n\n *\n\n * @param cameraId Indicates the ID of the camera device, which can be obtained by calling {@link GetCameraIds}.\n\n *\n\n * @param ability Returns the abilities of the camera device.\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode GetCameraAbility(const std::string &cameraId,\n\n std::shared_ptr<CameraAbility> &ability) = 0;\n\n\n\n /**\n\n * @brief Opens a camera device.\n\n *\n", "file_path": "camera/interfaces/include/icamera_host.h", "rank": 28, "score": 62077.93131932017 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n/**\n\n * @file icamera_host.h\n\n *\n\n * @brief Management class of the camera service that provides Hardware Driver Interfaces (HDIs) for the upper layer.\n\n *\n", "file_path": "camera/interfaces/include/icamera_host.h", "rank": 29, "score": 62077.93131932017 }, { "content": " * Due to the limited processing capability, some devices may spend a long period of time on\n\n * algorithm processing during photographing, causing the capture requests to stack in the module.\n\n * Converting to an offline stream enables the bottom-layer device to close and\n\n * the offline stream to take over for subsequent processing.\n\n *\n\n * @param streamIds Indicates the IDs of the streams to be converted.\n\n * @param callback Indicates the callback for conversion to offline streams.\n\n * @param offlineOperator Indicates the offline stream after conversion.\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful;\n\n * returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode ChangeToOfflineStream(const std::vector<int> &streamIds,\n\n OHOS::sptr<IStreamOperatorCallback> &callback,\n\n OHOS::sptr<IOfflineStreamOperator> &offlineOperator) = 0;\n\n};\n\n}\n\n#endif // HDI_STREAM_OPERATOR_CLIENT_INF_H", "file_path": "camera/interfaces/include/istream_operator.h", "rank": 30, "score": 62077.93131932017 }, { "content": " * By calling this function, you can obtain the <b>ICameraDevice</b> instance and operate the specific camera device mapping to the instance.\n\n *\n\n * @param cameraId Indicates the ID of the camera device, which can be obtained by calling {@link GetCameraIds}.\n\n * @param callback Indicates the callback related to the camera. For details, see {@link ICameraDeviceCallback}.\n\n * @param device Indicates the <b>ICameraDevice</b> instance corresponding to the ID of the camera device.\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode OpenCamera(const std::string &cameraId,\n\n const OHOS::sptr<ICameraDeviceCallback> &callback,\n\n OHOS::sptr<ICameraDevice> &device) = 0;\n\n\n\n /**\n\n * @brief Turns on or off the flash.\n\n *\n\n * This function can be used only by the caller who has opened the camera device specified by <b>cameraId</b>.\n\n *\n", "file_path": "camera/interfaces/include/icamera_host.h", "rank": 31, "score": 62077.93131932017 }, { "content": " * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode SetResultMode(const ResultCallbackMode &mode) = 0;\n\n\n\n /**\n\n * @brief Obtains enabled metadata.\n\n *\n\n * Metadata to be reported is enabled by calling {@link EnableResult}.\n\n *\n\n * @param results Indicates all enabled metadata.\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode GetEnabledResults(std::vector<MetaType> &results) = 0;\n", "file_path": "camera/interfaces/include/icamera_device.h", "rank": 32, "score": 62077.93131932017 }, { "content": " * @param cameraId Indicates the ID of the camera whose flash is to be turned on or off.\n\n * @param isEnable Specifies whether to turn on or off the flash. The value <b>true</b> means to turn on the flash, and <b>false</b> means the opposite.\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode SetFlashlight(const std::string &cameraId, bool &isEnable) = 0;\n\n};\n\n}\n\n#endif // HDI_CAMERA_HOST_CLIENT_INF_H", "file_path": "camera/interfaces/include/icamera_host.h", "rank": 33, "score": 62077.93131932017 }, { "content": " * such as the number of captured frames.\n\n * <b>enableShutterCallback_</b> in {@link CaptureInfo} is used to enable the callback for each capture.\n\n * After the callback is enabled, {@link OnFrameShutter} is called upon each capture.\n\n * In the scenario where multiple streams are captured at the same time, this module ensures that\n\n * the captured data of multiple streams is reported simultaneously.\n\n *\n\n * @param captureId Indicates the ID of the capture request. You must ensure that the ID of the\n\n * capture request is unique when the camera is started.\n\n * @param info Indicates the capture request configuration information. For details, see {@link CaptureInfo}.\n\n * @param isStreaming Specifies whether to continuously capture images.\n\n * The value <b>true</b> means to continuously capture images, and <b>false</b> means the opposite.\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful;\n\n * returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode Capture(int captureId,\n\n const std::shared_ptr<CaptureInfo> &info, bool isStreaming) = 0;\n", "file_path": "camera/interfaces/include/istream_operator.h", "rank": 34, "score": 62077.93131932017 }, { "content": "\n\n /**\n\n * @brief Cancels a capture.\n\n *\n\n * {@link OnCaptureEnded} is called when a continuous capture is canceled.\n\n *\n\n * @param captureId Indicates the ID of the capture request to cancel.\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful;\n\n * returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode CancelCapture(int captureId) = 0;\n\n\n\n /**\n\n * @brief Converts a specific stream to an offline stream.\n\n *\n\n * Only photographing streams can be converted into offline streams.\n", "file_path": "camera/interfaces/include/istream_operator.h", "rank": 35, "score": 62077.93131932017 }, { "content": "\n\n#define PIPELINE_REPORT_BUFFER_LOCATION(I, F, N) TRACKING_REPORT_BUFFER_LOCATION(I, F, N, false);\n\n\n\n#define POOL_REPORT_BUFFER_LOCATION(I, F) TRACKING_REPORT_BUFFER_LOCATION(I, F, \"\", true);\n\n\n\n#define TRACKING_REPORT_BUFFER_LOCATION(I, F, N, R) \\\n\n do { \\\n\n auto m = std::make_shared<BufferTrackingMessage>(); \\\n\n m->trackingId = I; \\\n\n m->frameNumber = F; \\\n\n m->nodeName = N; \\\n\n m->isReturnBack = R; \\\n\n BufferTracking::ReportBufferLocation(m); \\\n\n } while (0);\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal/include/buffer_tracking.h", "rank": 36, "score": 62077.93131932017 }, { "content": "\n\n /**\n\n * @brief Enables metadata reporting.\n\n *\n\n * Only metadata that is enabled can be reported by using {@link OnResult}.\n\n *\n\n * @param results Indicates the metadata for which reporting is to be enabled.\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode EnableResult(const std::vector<MetaType> &results) = 0;\n\n\n\n /**\n\n * @brief Disables metadata reporting.\n\n *\n\n * After metadata reporting is disabled, the metadata is not reported by calling {@link OnResult}. To enable metadata reporting, you must call {@link EnableResult}.\n\n *\n", "file_path": "camera/interfaces/include/icamera_device.h", "rank": 37, "score": 62077.93131932017 }, { "content": " * returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode GetStreamAttributes(\n\n std::vector<std::shared_ptr<StreamAttribute>> &attributes) = 0;\n\n\n\n /**\n\n * @brief Attaches a producer handle to a stream.\n\n *\n\n * If a producer handle has been specified during stream creation (by {@link CreateStreams}),\n\n * you do not need to call this function. If you want to attach a new procedure handle,\n\n * call {@link DetachBufferQueue} to detach the existing procedure handle and then\n\n * call this function to attach the new one.\n\n * You do not need to attach a procedure handle for IoT devices that do not support or require\n\n * image data caching and transferring of preview streams.\n\n * In this case, set <b>bufferQueue_</b> in the {@link StreamInfo} parameter of {@link CreateStreams}\n\n * to <b>null</b>,\n\n * and set <b>tunneledMode_</b> to <b>false</b>.\n", "file_path": "camera/interfaces/include/istream_operator.h", "rank": 38, "score": 62077.93131932017 }, { "content": " virtual CamRetCode CreateStreams(const std::vector<std::shared_ptr<StreamInfo>> &streamInfos) = 0;\n\n\n\n /**\n\n * @brief Releases streams.\n\n *\n\n * @param streamIds Indicates the IDs of the streams to release.\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful;\n\n * returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode ReleaseStreams(const std::vector<int> &streamIds) = 0;\n\n\n\n /**\n\n * @brief Configures a stream.\n\n *\n\n * This function must be called after {@link CreateStreams}.\n\n *\n", "file_path": "camera/interfaces/include/istream_operator.h", "rank": 39, "score": 62077.93131932017 }, { "content": " *\n\n * @param callback Indicates the callbacks to set.\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode SetCallback(const OHOS::sptr<ICameraHostCallback> &callback) = 0;\n\n\n\n /**\n\n * @brief Obtains the IDs of available camera devices.\n\n *\n\n * @param cameraIds Indicates the IDs of available camera devices.\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n", "file_path": "camera/interfaces/include/icamera_host.h", "rank": 40, "score": 62077.93131932017 }, { "content": " const std::shared_ptr<CameraStandard::CameraMetadata> &modeSetting,\n\n const std::vector<std::shared_ptr<StreamInfo>> &info,\n\n StreamSupportType &type) = 0;\n\n\n\n /**\n\n * @brief Creates streams.\n\n *\n\n * Before calling this function, you must use {@link IsStreamsSupported} to check whether the hardware\n\n * abstraction layer (HAL) supports the streams to create.\n\n *\n\n * @param streamInfos Indicates the list of stream information, which is defined by {@link StreamInfo}.\n\n * The passed stream information may be changed. Therefore, you can run {@link GetStreamAttributes} to\n\n * obtain the latest stream attributes after the stream is created.\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful;\n\n * returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n", "file_path": "camera/interfaces/include/istream_operator.h", "rank": 41, "score": 62077.93131932017 }, { "content": "class IBuffer {\n\npublic:\n\n virtual ~IBuffer(){};\n\n\n\n virtual int32_t GetIndex() const = 0;\n\n virtual uint32_t GetWidth() const = 0;\n\n virtual uint32_t GetHeight() const = 0;\n\n virtual uint32_t GetStride() const = 0;\n\n virtual int32_t GetFormat() const = 0;\n\n virtual uint32_t GetSize() const = 0;\n\n virtual uint64_t GetUsage() const = 0;\n\n virtual void* GetVirAddress() const = 0;\n\n virtual uint64_t GetPhyAddress() const = 0;\n\n virtual int32_t GetFileDescriptor() const = 0;\n\n virtual int32_t GetSourceType() const = 0;\n\n virtual uint64_t GetTimestamp() const = 0;\n\n virtual uint64_t GetFrameNumber() const = 0;\n\n virtual int64_t GetPoolId() const = 0;\n\n virtual int32_t GetCaptureId() const = 0;\n\n virtual CameraBufferStatus GetBufferStatus() const = 0;\n", "file_path": "camera/hal/include/ibuffer.h", "rank": 42, "score": 62077.93131932017 }, { "content": " * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode DetachBufferQueue(int streamId) = 0;\n\n\n\n /**\n\n * @brief Captures an image.\n\n *\n\n * This function must be called after {@link CommitStreams}.\n\n * There are two image capture modes: continuous capture and single capture.\n\n * A continuous capture is performed inside the module after being triggered,\n\n * and the consumer can continuously receive captured image data after calling this function only once.\n\n * If this function is called again, the current capture is stopped, the capture request configuration is updated,\n\n * and a new capture is performed.\n\n * This mode is mainly used in preview, video recording, or continuous shooting scenarios.\n\n * After a single capture is triggered, only one frame of image data is captured.\n\n * This mode applies to the single shooting scenario.\n\n * When the capture is started, {@link OnCaptureStarted} is called to notify of the start.\n\n * To stop a continuous capture, call {@link CancelCapture}.\n\n * When the capture ends, {@link OnCaptureEnded} is called to notify the caller of the information\n", "file_path": "camera/interfaces/include/istream_operator.h", "rank": 43, "score": 62077.93131932017 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n/**\n\n * @file icamera_device.h\n\n *\n\n * @brief Declares APIs for camera device operations.\n\n *\n", "file_path": "camera/interfaces/include/icamera_device.h", "rank": 44, "score": 62077.93131932017 }, { "content": " *\n\n * @param streamId Indicates the ID of the stream to which the procedure handle is to be attached.\n\n * @param producer Indicates the producer handle to be attached.\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful;\n\n * returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode AttachBufferQueue(int streamId, const OHOS::sptr<OHOS::IBufferProducer> &producer) = 0;\n\n\n\n /**\n\n * @brief Detaches the producer handle from a stream.\n\n *\n\n * @param streamId Indicates the ID of the stream from which the procedure handle is to be detached.\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful;\n\n * returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n", "file_path": "camera/interfaces/include/istream_operator.h", "rank": 45, "score": 62077.93131932017 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n/**\n\n * @file istream_operator.h\n\n *\n\n * @brief Declares APIs for stream operations.\n\n *\n", "file_path": "camera/interfaces/include/istream_operator.h", "rank": 46, "score": 62077.93131932017 }, { "content": " running_ = false;\n\n if (consumerThread_ != nullptr) {\n\n consumerThread_->join();\n\n delete consumerThread_;\n\n }\n\n }\n\n public:\n\n std::atomic<uint64_t> shotCount_ = 0;\n\n std::mutex l_;\n\n std::condition_variable cv_;\n\n bool running_ = true;\n\n#ifdef CAMERA_BUILT_ON_OHOS_LITE\n\n std::shared_ptr<OHOS::Surface> consumer_ = nullptr;\n\n std::function<void(OHOS::SurfaceBuffer*)> callback_ = nullptr;\n\n#else\n\n OHOS::sptr<OHOS::Surface> consumer_ = nullptr;\n\n std::function<void(void*, uint32_t)> callback_ = nullptr;\n\n#endif\n\n std::thread* consumerThread_ = nullptr;\n\n };\n\n};\n\n\n", "file_path": "camera/hal/test/mpi/include/common.h", "rank": 47, "score": 60877.352085204286 }, { "content": "#include <iostream>\n\n#include <climits>\n\n#include <sys/stat.h>\n\n#include <fcntl.h>\n\n#include <unistd.h>\n\n#include <sys/ioctl.h>\n\n#include <sys/wait.h>\n\n#include <thread>\n\n#include <stdio.h>\n\n#include <sys/time.h>\n\n#include <vector>\n\n#include <map>\n\n#include \"utils.h\"\n\n#include \"camera.h\"\n\n#include \"camera_host.h\"\n\n#include \"types.h\"\n\n#include <surface.h>\n\n#include \"idevice_manager.h\"\n\n#include \"camera_metadata_info.h\"\n\n#include \"ibuffer.h\"\n", "file_path": "camera/hal/test/mpi/include/common.h", "rank": 48, "score": 60871.77061370636 }, { "content": "#include <display_type.h>\n\n#include <hdf_log.h>\n\n#include <osal_mem.h>\n\n#include \"securec.h\"\n\n#include \"icamera_host.h\"\n\n#include \"icamera_device.h\"\n\n#include \"istream_operator.h\"\n\n#include \"ioffline_stream_operator.h\"\n\n#include \"camera_host_callback.h\"\n\n#include \"camera_device_callback.h\"\n\n#include \"stream_operator_callback.h\"\n\n#include \"video_key_info.h\"\n\n#include \"type_common.h\"\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal/test/mpi/include/common.h", "rank": 49, "score": 60871.62060719702 }, { "content": " * @since 1.0\n\n * @version 1.0\n\n */\n\n\n\n#ifndef HDI_STREAM_OPERATOR_CALLBACK_SERVER_H\n\n#define HDI_STREAM_OPERATOR_CALLBACK_SERVER_H\n\n\n\n#include <list>\n\n#include <map>\n\n#include <vector>\n\n#include <hdf_log.h>\n\n#include \"types.h\"\n\n#include \"icamera_interface.h\"\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/interfaces/include/istream_operator_callback.h", "rank": 50, "score": 60871.28254813265 }, { "content": " * @since 1.0\n\n * @version 1.0\n\n */\n\n\n\n#ifndef HDI_CAMERA_DEVICE_CALLBACK_SERVER_H\n\n#define HDI_CAMERA_DEVICE_CALLBACK_SERVER_H\n\n\n\n#include <list>\n\n#include <map>\n\n#include <vector>\n\n#include <hdf_log.h>\n\n#include \"types.h\"\n\n#include \"icamera_interface.h\"\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/interfaces/include/icamera_device_callback.h", "rank": 51, "score": 60871.28254813265 }, { "content": " * @since 1.0\n\n * @version 1.0\n\n */\n\n\n\n#ifndef HDI_CAMERA_HOST_CALLBACK_SERVER_H\n\n#define HDI_CAMERA_HOST_CALLBACK_SERVER_H\n\n\n\n#include <list>\n\n#include <map>\n\n#include <vector>\n\n#include <hdf_log.h>\n\n#include \"types.h\"\n\n#include \"icamera_interface.h\"\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/interfaces/include/icamera_host_callback.h", "rank": 52, "score": 60871.28254813265 }, { "content": " * @since 1.0\n\n * @version 1.0\n\n */\n\n\n\n#ifndef HDI_OFFLINE_STREAM_OPERATOR_CLIENT_INF_H\n\n#define HDI_OFFLINE_STREAM_OPERATOR_CLIENT_INF_H\n\n\n\n#include <list>\n\n#include <map>\n\n#include <vector>\n\n#include <hdf_log.h>\n\n#include \"types.h\"\n\n#include \"icamera_interface.h\"\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/interfaces/include/ioffline_stream_operator.h", "rank": 53, "score": 60871.25942213042 }, { "content": " OHOS::sptr<StreamOperatorCallback> streamOperatorCallback = nullptr;\n\n OHOS::sptr<CameraHostCallback> hostCallback = nullptr;\n\n OHOS::sptr<CameraDeviceCallback> deviceCallback = nullptr;\n\n OHOS::sptr<IStreamOperator> streamOperator = nullptr;\n\n OHOS::sptr<Camera::IOfflineStreamOperator> offlineStreamOperator = nullptr;\n\n OHOS::sptr<IStreamOperatorCallback> offlineStreamOperatorCallback = nullptr;\n\n\n\n std::shared_ptr<OHOS::Camera::CaptureInfo> captureInfo = nullptr;\n\n std::vector<std::shared_ptr<OHOS::Camera::StreamInfo>> streamInfos;\n\n std::shared_ptr<OHOS::Camera::StreamInfo> streamInfo = nullptr;\n\n std::shared_ptr<OHOS::Camera::StreamInfo> streamInfo2 = nullptr;\n\n std::shared_ptr<OHOS::Camera::StreamInfo> streamInfo_pre = nullptr;\n\n std::shared_ptr<OHOS::Camera::StreamInfo> streamInfo_video = nullptr;\n\n std::shared_ptr<OHOS::Camera::StreamInfo> streamInfo_capture = nullptr;\n\n std::vector<std::string> cameraIds;\n\n int streamId_preview = 1000;\n\n int streamId_preview_double = 1001;\n\n int streamId_capture = 1010;\n\n int streamId_video = 1020;\n\n int captureId_preview = 2000;\n", "file_path": "camera/hal/test/mpi/include/common.h", "rank": 54, "score": 60870.67930468062 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef HDI_SAMPLE_CLIENT_CPP_INF_H\n\n#define HDI_SAMPLE_CLIENT_CPP_INF_H\n\n\n\n#include <list>\n\n#include <map>\n\n#include <vector>\n\n#include <hdf_log.h>\n\n#include <iservmgr_hdi.h>\n\n\n\nnamespace OHOS {\n\nnamespace HDI {\n\nnamespace WLAN {\n\nnamespace V1_0 {\n\n\n", "file_path": "wlan/hdi_service/include/Iwifi_hal.h", "rank": 55, "score": 60870.47601809776 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef HOS_BUFFER_ALLOCATOR_UTILS_H\n\n#define HOS_BUFFER_ALLOCATOR_UTILS_H\n\n\n\n#include \"camera.h\"\n\n#include \"ibuffer.h\"\n\n#include \"ibuffer_allocator.h\"\n\n#include <memory>\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal/include/buffer_allocator_utils.h", "rank": 56, "score": 60870.29253798874 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n#ifndef CAMERA_TEST_COMMON_H\n\n#define CAMERA_TEST_COMMON_H\n\n\n\n#include <stdlib.h>\n\n#include <limits.h>\n\n#include <gtest/gtest.h>\n", "file_path": "camera/hal/test/mpi/include/common.h", "rank": 57, "score": 60869.95820300638 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef HOS_CAMERA_ICONTROLLER_H\n\n#define HOS_CAMERA_ICONTROLLER_H\n\n\n\n#include \"device_manager_adapter.h\"\n\n#include <mutex>\n\n#include <string>\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal/device_manager/include/icontroller.h", "rank": 58, "score": 60869.89442555645 }, { "content": " int captureId_preview_double = 2001;\n\n int captureId_capture = 3000;\n\n int captureId_video = 4000;\n\n std::vector<int> captureIds;\n\n std::vector<int> streamIds;\n\n std::vector<Camera::StreamIntent> intents;\n\n OHOS::Camera::CamRetCode rc;\n\n\n\n#ifdef CAMERA_BUILT_ON_OHOS_LITE\n\n std::shared_ptr<OHOS::Camera::CameraHost> service = nullptr;\n\n std::shared_ptr<ICameraDevice> cameraDevice = nullptr;\n\n#else\n\n OHOS::sptr<OHOS::Camera::ICameraHost> service = nullptr;\n\n OHOS::sptr<ICameraDevice> cameraDevice = nullptr;\n\n#endif\n\n std::shared_ptr<CameraAbility> ability = nullptr;\n\n\n\n bool status;\n\n bool onCameraStatusFlag;\n\n bool onFlashlightStatusFlag;\n\n bool onErrorFlag;\n\n bool onResultFlag;\n\n bool captureStartFlag;\n\n bool captureEndFlag;\n\n bool captureErrorFlag;\n\n bool frameShutterFlag;\n\n int previewBufCnt = 0;\n\n int32_t videoFd = -1;\n", "file_path": "camera/hal/test/mpi/include/common.h", "rank": 59, "score": 60869.88336579769 }, { "content": " return RC_OK;\n\n };\n\n virtual void SetAbilityMetaDataTag(std::vector<int32_t> abilityMetaDataTag) {};\n\n virtual void SetAbilityMetaDataTag(std::vector<int32_t> abilityMetaDataTag, std::string hardwareName) {};\n\n virtual RetCode GetAbilityMetaData(std::shared_ptr<CameraStandard::CameraMetadata> meta)\n\n {\n\n return RC_OK;\n\n };\n\n virtual RetCode GetAbilityMetaData(std::shared_ptr<CameraStandard::CameraMetadata> meta, std::string hardwareName)\n\n {\n\n return RC_OK;\n\n };\n\n virtual bool GetMetaDataFlag()\n\n {\n\n return false;\n\n };\n\n virtual void SetMetaDataFlag(bool metaDataFlag) {};\n\n\n\nprivate:\n\n ManagerId managerID_;\n\n};\n\n} // namespace OHOS::Camera\n\n#endif", "file_path": "camera/hal/device_manager/include/imanager.h", "rank": 60, "score": 60869.53417326704 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef HOS_CAMERA_ISENSOR_H\n\n#define HOS_CAMERA_ISENSOR_H\n\n\n\n#include \"device_manager_adapter.h\"\n\n#include <string>\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal/device_manager/include/isensor.h", "rank": 61, "score": 60869.202002485545 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef HOS_CAMERA_IMANAGER_H\n\n#define HOS_CAMERA_IMANAGER_H\n\n\n\n#include \"icontroller.h\"\n\n#include \"device_manager_adapter.h\"\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal/device_manager/include/imanager.h", "rank": 62, "score": 60869.202002485545 }, { "content": " * @param captureId Indicates the ID of the capture request corresponding to the callback.\n\n * @param infos Indicates information related to the capture when it ends.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual void OnCaptureEnded(int32_t captureId,\n\n const std::vector<std::shared_ptr<CaptureEndedInfo>> &infos) = 0;\n\n\n\n /**\n\n * @brief Called when an error occurs during the capture.\n\n *\n\n * @param captureId Indicates the ID of the capture request corresponding to the callback.\n\n * @param infos Indicates a list of capture error messages.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual void OnCaptureError(int32_t captureId,\n\n const std::vector<std::shared_ptr<CaptureErrorInfo>> &infos) = 0;\n", "file_path": "camera/interfaces/include/istream_operator_callback.h", "rank": 63, "score": 60869.16792658114 }, { "content": " test_->captureErrorFlag = true;\n\n }\n\n virtual void OnFrameShutter(int32_t captureId,\n\n const std::vector<int32_t> &streamId, uint64_t timestamp) override\n\n {\n\n test_->frameShutterFlag = true;\n\n }\n\n};\n\n}\n\n#endif\n", "file_path": "camera/hal/test/mpi/include/common.h", "rank": 64, "score": 60869.00252428402 }, { "content": " *\n\n * @param timestamp Indicates the timestamp when the metadata is reported.\n\n * @param result Indicates the metadata reported. The reported metadata is specified by {@link EnableResult}.\n\n * You can call {@link GetEnabledResults} to obtain enabled metadata and\n\n * call {@link DisableResult} to disable metadata reporting.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual void OnResult(uint64_t timestamp, const std::shared_ptr<CameraStandard::CameraMetadata> &result) = 0;\n\n};\n\n}\n\n#endif // HDI_CAMERA_DEVICE_CALLBACK_SERVER_H", "file_path": "camera/interfaces/include/icamera_device_callback.h", "rank": 65, "score": 60868.13276707636 }, { "content": "\n\n /**\n\n * @brief Called when a frame is captured.\n\n *\n\n * This callback is enabled by using <b>enableShutterCallback_</b> in the {@link CaptureInfo} parameter of {@link Capture}.\n\n * When <b>enableShutterCallback_</b> is set to <b>true</b>,\n\n * this callback is triggered each time a frame is captured.\n\n *\n\n * @param captureId Indicates the ID of the capture request corresponding to the callback.\n\n * @param streamIds Indicates the IDs of the streams corresponding to the callback.\n\n * @param timestamp Indicates the timestamp when the callback is invoked.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual void OnFrameShutter(int32_t captureId,\n\n const std::vector<int32_t> &streamIds, uint64_t timestamp) = 0;\n\n};\n\n}\n\n#endif // HDI_STREAM_OPERATOR_CALLBACK_SERVER_H\n", "file_path": "camera/interfaces/include/istream_operator_callback.h", "rank": 66, "score": 60867.73696459509 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n/**\n\n * @file icamera_host_callback.h\n\n *\n\n * @brief Declares callbacks for status changes of cameras and flashes. The caller needs to implement the callbacks.\n\n *\n", "file_path": "camera/interfaces/include/icamera_host_callback.h", "rank": 67, "score": 60863.34512889289 }, { "content": " return RC_OK;\n\n };\n\n virtual RetCode CreateController(ControllerId controllerId, std::string hardwareName)\n\n {\n\n return RC_OK;\n\n };\n\n virtual RetCode PowerUp(CameraId cameraId)\n\n {\n\n return RC_OK;\n\n };\n\n virtual RetCode PowerDown(CameraId cameraId)\n\n {\n\n return RC_OK;\n\n };\n\n virtual RetCode PowerUp(std::string hardwareName)\n\n {\n\n return RC_OK;\n\n };\n\n virtual RetCode PowerDown(std::string hardwareName)\n\n {\n", "file_path": "camera/hal/device_manager/include/imanager.h", "rank": 68, "score": 60863.34512889289 }, { "content": "\n\n // flush the buffer\n\n static RetCode FlushCache(std::shared_ptr<IBuffer>& buffer);\n\n\n\n // invalidate the cache, update cache from memory\n\n static RetCode InvalidateCache(std::shared_ptr<IBuffer>& buffer);\n\nprivate:\n\n static std::shared_ptr<IBufferAllocator> GetBufferAllocator(const int32_t source);\n\n};\n\n} // namespace OHOS::Camera\n\n#endif\n", "file_path": "camera/hal/include/buffer_allocator_utils.h", "rank": 69, "score": 60863.34512889289 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n/**\n\n * @file icamera_device_callback.h\n\n *\n\n * @brief Declares callbacks for reporting camera device errors and metadata.\n\n *\n", "file_path": "camera/interfaces/include/icamera_device_callback.h", "rank": 70, "score": 60863.34512889289 }, { "content": "class IBuffer;\n", "file_path": "camera/hal/include/ibuffer_allocator.h", "rank": 71, "score": 60863.34512889289 }, { "content": " virtual int32_t getNetworkIfaceName(std::shared_ptr<WifiFeatureInfo> ifeature) = 0;\n\n virtual int32_t getFeatureType(std::shared_ptr<WifiFeatureInfo> ifeature) = 0;\n\n virtual int32_t setMacAddress(std::shared_ptr<WifiFeatureInfo> ifeature, std::vector<uint8_t>& mac) = 0;\n\n virtual int32_t getDeviceMacAddress(std::shared_ptr<WifiFeatureInfo> ifeature, std::vector<uint8_t>& mac,\n\n uint8_t len) = 0;\n\n virtual int32_t getFreqsWithBand(std::shared_ptr<WifiFeatureInfo> ifeature, int32_t band,\n\n std::vector<int32_t> freq, uint32_t count, uint32_t& num) = 0;\n\n virtual int32_t setTxPower(std::shared_ptr<WifiFeatureInfo> ifeature, int32_t power) = 0;\n\n virtual int32_t getChipId(std::shared_ptr<WifiFeatureInfo> ifeature, uint8_t& chipId) = 0;\n\n virtual int32_t getIfNamesByChipId(const uint8_t chipId, std::string& ifNames, uint32_t& num) = 0;\n\n virtual int32_t setScanningMacAddress(std::shared_ptr<WifiFeatureInfo> ifeature, std::vector<uint8_t>& scanMac,\n\n uint8_t len) = 0;\n\n};\n\n\n\n}\n\n}\n\n}\n\n}\n\n\n\n#endif", "file_path": "wlan/hdi_service/include/Iwifi_hal.h", "rank": 72, "score": 60863.34512889289 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n/**\n\n * @file istream_operator_callback.h\n\n *\n\n * @brief Declares callbacks related to {@link IStreamOperator}. The caller needs to implement these callbacks.\n\n *\n", "file_path": "camera/interfaces/include/istream_operator_callback.h", "rank": 73, "score": 60863.34512889289 }, { "content": " *\n\n * @param streamIds Indicates the IDs of the offline streams to release.\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode ReleaseStreams(const std::vector<int> &streamIds) = 0;\n\n\n\n /**\n\n * @brief Releases all offline streams.\n\n *\n\n *\n\n * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined in {@link CamRetCode} otherwise.\n\n *\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual CamRetCode Release() = 0;\n\n};\n\n}\n\n#endif // HDI_OFFLINE_STREAM_OPERATOR_CLIENT_INF_H", "file_path": "camera/interfaces/include/ioffline_stream_operator.h", "rank": 74, "score": 60863.34512889289 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n/**\n\n * @file ioffline_stream_operator.h\n\n *\n\n * @brief Declares APIs for offline stream operations.\n\n *\n", "file_path": "camera/interfaces/include/ioffline_stream_operator.h", "rank": 75, "score": 60863.34512889289 }, { "content": " CameraHost& operator=(CameraHost&& other) = delete;\n\n\n\nprivate:\n\n CamRetCode Init();\n\n\n\nprivate:\n\n void* handler_ = nullptr;\n\n CameraHostCIF* host_ = nullptr;\n\n};\n\n} // end namespace OHOS::Camera\n\n#endif // CAMERA_HOST_CAMERA_HOST_H\n", "file_path": "camera/hal_c/hdi_cif/include/camera_host.h", "rank": 76, "score": 59707.59859481342 }, { "content": " return nullptr;\n\n };\n\n virtual RetCode PowerUp(CameraId cameraId) = 0;\n\n virtual RetCode PowerDown(CameraId cameraId) = 0;\n\n virtual RetCode Init() = 0;\n\n virtual std::shared_ptr<ISensor> GetSensor(CameraId cameraId) = 0;\n\n virtual std::vector<CameraId> GetCameraId() = 0;\n\n virtual RetCode Connect(std::string controller,\n\n std::string portNum, std::string connectController, std::string connectPortNum)\n\n {\n\n (void)controller;\n\n (void)portNum;\n\n (void)connectController;\n\n (void)connectPortNum;\n\n return RC_OK;\n\n };\n\n virtual RetCode UnConnect(std::string controller,\n\n std::string portNum, std::string connectController, std::string connectPortNum)\n\n {\n\n (void)controller;\n", "file_path": "camera/hal/device_manager/include/idevice_manager.h", "rank": 77, "score": 59706.130872675945 }, { "content": "#include \"ibuffer.h\"\n\n#include <algorithm>\n\n#include <assert.h>\n\n#include <errno.h>\n\n#include <getopt.h>\n\n#include <linux/fb.h>\n\n#include <linux/videodev2.h>\n\n#include <mutex>\n\n#include <pthread.h>\n\n#include <stdlib.h>\n\n#include <string.h>\n\n#include <sys/mman.h>\n\n#include <sys/stat.h>\n\n#include <sys/time.h>\n\n#include <vector>\n\n#include <iostream>\n\n#include <cstring>\n\n#include <cerrno>\n\n#include <securec.h>\n\n#include <surface_buffer.h>\n\n#include <ibuffer_producer.h>\n\n#include <fstream>\n\n#define PATH_MAX 128\n\n#define BUFFERSCOUNT 8\n\n#define CAMERA_BUFFER_QUEUE_IPC 654320\n\n#define RANGE_LIMIT(x) (x > 255 ? 255 : (x < 0 ? 0 : x))\n\n\n", "file_path": "camera/hal/test/v4l2/include/test_display.h", "rank": 78, "score": 59703.76771367318 }, { "content": "#include \"stream_operator.h\"\n\n#include \"camera_device.h\"\n\n#include \"utils.h\"\n\n#include <thread>\n\n#include <map>\n\n#include <stdio.h>\n\n#include <climits>\n\n#include \"types.h\"\n\n#include \"camera_device_impl.h\"\n\n#include \"stream_operator_impl.h\"\n\n#include \"idevice_manager.h\"\n\n#include \"camera_metadata_info.h\"\n\n#include <display_type.h>\n\n#include <fcntl.h>\n\n#include <unistd.h>\n\n#include <sys/ioctl.h>\n\n#include <sys/wait.h>\n\n#include \"buffer_queue_producer.h\"\n\n#include \"buffer_manager.h\"\n\n#include \"test_stream_operator_impl.h\"\n", "file_path": "camera/hal/test/v4l2/include/test_display.h", "rank": 79, "score": 59703.76132911076 }, { "content": "#include \"Iwifi_hal.h\"\n\n#include <iremote_proxy.h>\n\n#include <hdf_log.h>\n\n#include <iservmgr_hdi.h>\n\n#include <ipc_object_stub.h>\n\n\n\nnamespace OHOS {\n\nnamespace HDI {\n\nnamespace WLAN {\n\nnamespace V1_0 {\n\n\n", "file_path": "wlan/hdi_service/include/wlan_hal_proxy.h", "rank": 80, "score": 59703.27748510421 }, { "content": " void ProcessImage(const unsigned char* p, unsigned char* fbp);\n\n void LcdDrawScreen(unsigned char* displayBuf_, unsigned char* addr);\n\n void BufferCallback(std::shared_ptr<SurfaceBuffer> buffer, int choice);\n\n void Init();\n\n void UsbInit();\n\n void Close();\n\n void OpenCamera();\n\n void AchieveStreamOperator();\n\n void StartStream(std::vector<OHOS::Camera::StreamIntent> intents);\n\n void StopStream(std::vector<int>& captureIds, std::vector<int>& streamIds);\n\n void StartCapture(int streamId, int captureId, bool shutterCallback, bool isStreaming);\n\n float calTime(struct timeval start, struct timeval end);\n\n};\n\n#endif", "file_path": "camera/hal/test/v4l2/include/test_display.h", "rank": 81, "score": 59703.27624368714 }, { "content": " (void)portNum;\n\n (void)connectController;\n\n (void)connectPortNum;\n\n return RC_OK;\n\n };\n\n virtual void BufferCallback(std::shared_ptr<FrameSpec> buffer)\n\n {\n\n (void)buffer;\n\n return;\n\n };\n\n virtual void SetAbilityMetaDataTag(std::vector<int32_t> abilityMetaDataTag)\n\n {\n\n (void)abilityMetaDataTag;\n\n return;\n\n };\n\n virtual RetCode SendFrameBuffer(std::shared_ptr<FrameSpec> buffer, CameraId cameraId = CAMERA_MAX)\n\n {\n\n (void)buffer;\n\n (void)cameraId;\n\n return RC_OK;\n", "file_path": "camera/hal/device_manager/include/idevice_manager.h", "rank": 82, "score": 59703.25733890847 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef I_NODE_H\n\n#define I_NODE_H\n\n#include <string>\n\n#include <thread>\n\n#include <list>\n\n#include \"stream_pipeline_data_structure.h\"\n\n#include \"object_factory.h\"\n\n#include \"no_copyable.h\"\n\n#include \"ibuffer.h\"\n\n#include \"ibuffer_pool.h\"\n\n#include \"camera_metadata_info.h\"\n\n#include <functional>\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal/pipeline_core/nodes/include/inode.h", "rank": 83, "score": 59703.22315970012 }, { "content": " };\n\n virtual void SetNodeCallBack(const NodeBufferCb cb, CameraId cameraId = CAMERA_MAX)\n\n {\n\n (void)cb;\n\n (void)cameraId;\n\n return;\n\n };\n\n virtual void SetMetaDataCallBack(const MetaDataCb cb, CameraId cameraId = CAMERA_MAX)\n\n {\n\n (void)cb;\n\n (void)cameraId;\n\n return;\n\n };\n\n virtual void SetDevStatusCallBack(const DeviceStatusCb cb)\n\n {\n\n (void)cb;\n\n return;\n\n };\n\n virtual RetCode SetFlashlight(FlashMode flashMode, bool enable, CameraId cameraId = CAMERA_MAX) = 0;\n\n virtual void Configure(std::shared_ptr<CameraStandard::CameraMetadata> meta) = 0;\n", "file_path": "camera/hal/device_manager/include/idevice_manager.h", "rank": 84, "score": 59703.13689694335 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef HOS_CAMERA_BUFFER_POOL_H\n\n#define HOS_CAMERA_BUFFER_POOL_H\n\n\n\n#include \"buffer_allocator_factory.h\"\n\n#include \"ibuffer.h\"\n\n#include \"ibuffer_pool.h\"\n\n#include <condition_variable>\n\n#include <list>\n\n#include <memory>\n\n#include <mutex>\n\n#include <utility>\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal/buffer_manager/include/buffer_pool.h", "rank": 85, "score": 59703.027371899436 }, { "content": " virtual void SetHotplugDevCallBack(HotplugDevCb cb)\n\n {\n\n (void)cb;\n\n return;\n\n };\n\n virtual RetCode PreConfig(const ModeMeta& meta, const std::vector<DeviceStreamSetting>& settings)\n\n {\n\n (void)meta;\n\n (void)settings;\n\n return RC_OK;\n\n }\n\n virtual RetCode Flush(int32_t streamId)\n\n {\n\n (void)streamId;\n\n return RC_OK;\n\n }\n\n virtual RetCode StartRecvFrame(int32_t streamId)\n\n {\n\n (void)streamId;\n\n return RC_OK;\n", "file_path": "camera/hal/device_manager/include/idevice_manager.h", "rank": 86, "score": 59702.991177019554 }, { "content": " }\n\n virtual RetCode StopRecvFrame(int32_t streamId)\n\n {\n\n (void)streamId;\n\n return RC_OK;\n\n }\n\n virtual void SetSendflag(bool flag)\n\n {\n\n (void)flag;\n\n return;\n\n }\n\n};\n\n} // namespace OHOS::Camera\n\n#endif\n", "file_path": "camera/hal/device_manager/include/idevice_manager.h", "rank": 87, "score": 59702.76202855506 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef I_PIPELINE_CORE_H\n\n#define I_PIPELINE_CORE_H\n\n\n\n#include <stdint.h>\n\n#include <cstdio>\n\n#include \"istream_pipeline_core.h\"\n\n#include \"no_copyable.h\"\n\n#include \"idevice_manager.h\"\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal/pipeline_core/include/ipipeline_core.h", "rank": 88, "score": 59702.619867320594 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef HOS_CAMERA_IDEVICED_MANAGER_H\n\n#define HOS_CAMERA_IDEVICED_MANAGER_H\n\n\n\n#include \"icontroller.h\"\n\n#include \"imanager.h\"\n\n#include \"device_manager_adapter.h\"\n\n#include \"isensor.h\"\n\n#include <vector>\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal/device_manager/include/idevice_manager.h", "rank": 89, "score": 59702.58525116059 }, { "content": " std::vector<std::shared_ptr<OHOS::Camera::StreamInfo>> streamInfos;\n\n std::shared_ptr<OHOS::Camera::StreamInfo> streamInfo = nullptr;\n\n std::shared_ptr<OHOS::Camera::StreamInfo> streamInfoPre = nullptr;\n\n std::shared_ptr<OHOS::Camera::StreamInfo> streamInfoVideo = nullptr;\n\n std::shared_ptr<OHOS::Camera::StreamInfo> streamInfoCapture = nullptr;\n\n std::shared_ptr<IBufferProducer> producer = nullptr;\n\n std::shared_ptr<IBufferProducer> producerCapture = nullptr;\n\n std::shared_ptr<IBufferProducer> producerVideo = nullptr;\n\n std::shared_ptr<OHOS::Camera::CameraHost> cameraHost = nullptr;\n\n std::shared_ptr<OHOS::Camera::ICameraDevice> cameraDevice = nullptr;\n\n std::shared_ptr<CameraAbility> ability = nullptr;\n\n std::vector<int> captureIds;\n\n std::vector<std::string> cameraIds;\n\n std::vector<int> streamIds;\n\n std::vector<OHOS::Camera::StreamIntent> intents;\n\n enum {\n\n streamId_preview = 1000, // 1000:preview streamID\n\n streamId_capture,\n\n streamId_video,\n\n captureId_preview = 2000, // 2000:preview captureId\n", "file_path": "camera/hal/test/v4l2/include/test_display.h", "rank": 90, "score": 59702.57177291322 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef OHOS_CAMERA_METADATA_UTILS_H\n\n#define OHOS_CAMERA_METADATA_UTILS_H\n\n\n\n#include <list>\n\n#include <map>\n\n#include <vector>\n\n#include <iostream>\n\n#include \"camera_metadata_info.h\"\n\n\n\nnamespace OHOS {\n\nnamespace CameraStandard {\n", "file_path": "camera/hal/utils/metadata/include/metadata_utils.h", "rank": 91, "score": 59702.56235690794 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef CAMERA_DEVICE_CAMERA_DEVICE_H\n\n#define CAMERA_DEVICE_CAMERA_DEVICE_H\n\n\n\n#include \"camera_device_c_if.h\"\n\n#include \"camera_metadata_c_if.h\"\n\n#include \"camera_types_c_if.h\"\n\n#include \"icamera_device.h\"\n\n#include \"camera_device_stub.h\"\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal_c/hdi_cif/include/camera_device.h", "rank": 92, "score": 59702.5396075817 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef CAMERA_HOST_CAMERA_HOST_H\n\n#define CAMERA_HOST_CAMERA_HOST_H\n\n\n\n#include \"camera_host_c_if.h\"\n\n#include \"camera_device_c_if.h\"\n\n#include \"icamera_host_callback.h\"\n\n#include \"icamera_device_callback.h\"\n\n#include \"icamera_device.h\"\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal_c/hdi_cif/include/camera_host.h", "rank": 93, "score": 59702.52828683661 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef HOS_BUFFER_ALLOCATOR_H\n\n#define HOS_BUFFER_ALLOCATOR_H\n\n\n\n#include \"buffer_allocator_factory.h\"\n\n#include \"ibuffer.h\"\n\n#include \"ibuffer_allocator.h\"\n\n#include <memory>\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal/buffer_manager/include/buffer_allocator.h", "rank": 94, "score": 59702.32227222425 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef HDI_PARCEL_UTILS_V1_0_H \n\n#define HDI_PARCEL_UTILS_V1_0_H\n\n\n\n#include <message_parcel.h>\n\n#include \"hdf_sbuf_ipc.h\"\n\n#include \"display_type.h\"\n\n#include \"hdf_log.h\"\n\n\n\nnamespace OHOS {\n\nnamespace HDI {\n\nnamespace Display {\n\nnamespace V1_0 {\n", "file_path": "display/hdi_service/gralloc/include/parcel_utils.h", "rank": 95, "score": 59702.2043691727 }, { "content": " virtual void DeliverBuffers(std::vector<std::shared_ptr<IBuffer>>& buffers) = 0;\n\n virtual void SetCallBack(BufferCb c) = 0;\n\n\n\n virtual RetCode ProvideBuffers(std::shared_ptr<FrameSpec> frameSpec) = 0;\n\n virtual void DeliverBuffers(std::shared_ptr<FrameSpec> frameSpec) = 0;\n\n virtual void DeliverBuffers(std::vector<std::shared_ptr<FrameSpec>> mergeVec) = 0;\n\n};\n\n\n\n\n\nusing NodeFactory = RegisterFactoty<INode, const std::string&, const std::string&>;\n\n\n\n#define REGISTERNODE(cls, ...) \\\n\nnamespace { \\\n\n static std::string g_##cls = NodeFactory::Instance().DoRegister<cls>(__VA_ARGS__, \\\n\n [](const std::string& name, const std::string& type) {return std::make_shared<cls>(name, type);}); \\\n\n}\n\n}\n\n#endif\n", "file_path": "camera/hal/pipeline_core/nodes/include/inode.h", "rank": 96, "score": 59702.14827709708 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef TEST_DISPLAY_H\n\n#define TEST_DISPLAY_H\n\n#include <gtest/gtest.h>\n\n#include \"camera.h\"\n\n#include \"camera_host.h\"\n", "file_path": "camera/hal/test/v4l2/include/test_display.h", "rank": 97, "score": 59702.004076162 }, { "content": "/*\n\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef STREAM_OPERATOR_STREAM_OPERATOR_H\n\n#define STREAM_OPERATOR_STREAM_OPERATOR_H\n\n\n\n#include \"istream_operator.h\"\n\n#include \"stream_operator_c_if.h\"\n\n#include \"stream_operator_stub.h\"\n\n\n\nnamespace OHOS::Camera {\n", "file_path": "camera/hal_c/hdi_cif/include/stream_operator.h", "rank": 98, "score": 59701.86160074956 }, { "content": " *\n\n * @param handle Indicates the reference to the buffer of the memory to map.\n\n *\n\n * @return Returns the pointer to a valid address if the operation is successful; returns <b>NULL</b> otherwise.\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual void *Mmap(const BufferHandle &handle) const = 0;\n\n\n\n /**\n\n * @brief Maps memory to memory with cache in the process's address space.\n\n *\n\n * @param handle Indicates the reference to the buffer of the memory to map.\n\n *\n\n * @return Returns the pointer to a valid address if the operation is successful; returns <b>NULL</b> otherwise.\n\n * @since 1.0\n\n * @version 1.0\n\n */\n\n virtual void *MmapCache(const BufferHandle &buffer) const = 0;\n\n\n", "file_path": "display/hdi_service/gralloc/include/idisplay_gralloc.h", "rank": 99, "score": 59701.53527654348 } ]
C++
src/type3_AndroidCloud/anbox-master/external/process-cpp-minimal/src/core/posix/child_process.cpp
akraino-edge-stack/iec
b01bce6165ef8368a607e17e1f3d4697b79db31b
#include <core/posix/child_process.h> #ifndef ANDROID #include <boost/iostreams/device/file_descriptor.hpp> #include <boost/iostreams/stream.hpp> #endif #include <atomic> #include <fstream> #include <mutex> #include <unordered_map> #include <fcntl.h> #include <poll.h> #include <unistd.h> #include <sys/eventfd.h> #include <sys/signalfd.h> #include <assert.h> #include <sys/wait.h> #ifndef ANDROID namespace io = boost::iostreams; #endif namespace { struct DeathObserverImpl : public core::posix::ChildProcess::DeathObserver { DeathObserverImpl(const std::shared_ptr<core::posix::SignalTrap>& trap) : on_sig_child_connection { trap->signal_raised().connect([this](core::posix::Signal signal) { switch (signal) { case core::posix::Signal::sig_chld: on_sig_child(); break; default: break; } }) } { if (!trap->has(core::posix::Signal::sig_chld)) throw std::logic_error( "DeathObserver::DeathObserverImpl: Given SignalTrap" " instance does not trap Signal::sig_chld."); } bool add(const core::posix::ChildProcess& process) override { if (process.pid() == -1) return false; std::lock_guard<std::mutex> lg(guard); bool added = false; auto new_process = std::make_pair(process.pid(), process); std::tie(std::ignore, added) = children.insert(new_process); if (added) { int status{-1}; if (::waitpid(process.pid(), &status, WNOHANG) != 0) { signals.child_died(new_process.second); children.erase(new_process.first); return false; } } return added; } bool has(const core::posix::ChildProcess& process) const override { std::lock_guard<std::mutex> lg(guard); return children.count(process.pid()) > 0; } const core::Signal<core::posix::ChildProcess>& child_died() const override { return signals.child_died; } void on_sig_child() override { pid_t pid{-1}; int status{-1}; while (true) { pid = ::waitpid(0, &status, WNOHANG); if (pid == -1) { if (errno == ECHILD) { break; } continue; } else if (pid == 0) { break; } else { std::lock_guard<std::mutex> lg(guard); auto it = children.find(pid); if (it != children.end()) { if (WIFSIGNALED(status) || WIFEXITED(status)) { signals.child_died(it->second); children.erase(it); } } } } } mutable std::mutex guard; std::unordered_map<pid_t, core::posix::ChildProcess> children; core::ScopedConnection on_sig_child_connection; struct { core::Signal<core::posix::ChildProcess> child_died; } signals; }; } std::unique_ptr<core::posix::ChildProcess::DeathObserver> core::posix::ChildProcess::DeathObserver::create_once_with_signal_trap( std::shared_ptr<core::posix::SignalTrap> trap) { static std::atomic<bool> has_been_created_once{false}; if (has_been_created_once.exchange(true)) throw std::runtime_error { "DeathObserver::create_once_with_signal_trap: " "Cannot create more than one instance." }; try { std::unique_ptr<core::posix::ChildProcess::DeathObserver> result { new DeathObserverImpl{trap} }; return result; } catch(...) { has_been_created_once.store(false); std::rethrow_exception(std::current_exception()); } assert(false && "We should never reach here."); return std::unique_ptr<core::posix::ChildProcess::DeathObserver>{}; } namespace core { namespace posix { ChildProcess::Pipe ChildProcess::Pipe::invalid() { static Pipe p; static std::once_flag flag; std::call_once(flag, [&]() { p.close_read_fd(); p.close_write_fd(); }); return p; } ChildProcess::Pipe::Pipe() { int rc = ::pipe(fds); if (rc == -1) throw std::system_error(errno, std::system_category()); } ChildProcess::Pipe::Pipe(const ChildProcess::Pipe& rhs) : fds{-1, -1} { if (rhs.fds[0] != -1) fds[0] = ::dup(rhs.fds[0]); if (rhs.fds[1] != -1) fds[1] = ::dup(rhs.fds[1]); } ChildProcess::Pipe::~Pipe() { if (fds[0] != -1) ::close(fds[0]); if (fds[1] != -1) ::close(fds[1]); } int ChildProcess::Pipe::read_fd() const { return fds[0]; } void ChildProcess::Pipe::close_read_fd() { if (fds[0] != -1) { ::close(fds[0]); fds[0] = -1; } } int ChildProcess::Pipe::write_fd() const { return fds[1]; } void ChildProcess::Pipe::close_write_fd() { if (fds[1] != -1) { ::close(fds[1]); fds[1] = -1; } } ChildProcess::Pipe& ChildProcess::Pipe::operator=(const ChildProcess::Pipe& rhs) { if (fds[0] != -1) ::close(fds[0]); if (fds[1] != -1) ::close(fds[1]); if (rhs.fds[0] != -1) fds[0] = ::dup(rhs.fds[0]); else fds[0] = -1; if (rhs.fds[1] != -1) fds[1] = ::dup(rhs.fds[1]); else fds[1] = -1; return *this; } struct ChildProcess::Private { Private(pid_t pid, const ChildProcess::Pipe& stderr, const ChildProcess::Pipe& stdin, const ChildProcess::Pipe& stdout) : pipes{stderr, stdin, stdout}, #ifndef ANDROID serr(pipes.stderr.read_fd(), io::never_close_handle), sin(pipes.stdin.write_fd(), io::never_close_handle), sout(pipes.stdout.read_fd(), io::never_close_handle), cerr(&serr), cin(&sin), cout(&sout), #endif original_parent_pid(::getpid()), original_child_pid(pid) { } ~Private() { if (original_parent_pid == getpid() && !dont_kill_on_cleanup) { if (original_child_pid != -1) ::kill(original_child_pid, SIGKILL); } } struct { ChildProcess::Pipe stdin; ChildProcess::Pipe stdout; ChildProcess::Pipe stderr; } pipes; #ifndef ANDROID io::stream_buffer<io::file_descriptor_source> serr; io::stream_buffer<io::file_descriptor_sink> sin; io::stream_buffer<io::file_descriptor_source> sout; std::istream cerr; std::ostream cin; std::istream cout; #endif pid_t original_parent_pid; pid_t original_child_pid; bool dont_kill_on_cleanup = false; }; ChildProcess ChildProcess::invalid() { static const pid_t invalid_pid = 1; return ChildProcess(invalid_pid, Pipe::invalid(), Pipe::invalid(), Pipe::invalid()); } ChildProcess::ChildProcess(pid_t pid, const ChildProcess::Pipe& stdin_pipe, const ChildProcess::Pipe& stdout_pipe, const ChildProcess::Pipe& stderr_pipe) : Process(pid), d(new Private{pid, stdin_pipe, stdout_pipe, stderr_pipe}) { } ChildProcess::~ChildProcess() { } wait::Result ChildProcess::wait_for(const wait::Flags& flags) { int status = -1; pid_t result_pid = ::waitpid(pid(), std::addressof(status), static_cast<int>(flags)); if (result_pid == -1) throw std::system_error(errno, std::system_category()); wait::Result result; if (result_pid == 0) { result.status = wait::Result::Status::no_state_change; return result; } if (WIFEXITED(status)) { result.status = wait::Result::Status::exited; result.detail.if_exited.status = static_cast<exit::Status>(WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) { result.status = wait::Result::Status::signaled; result.detail.if_signaled.signal = static_cast<Signal>(WTERMSIG(status)); result.detail.if_signaled.core_dumped = WCOREDUMP(status); } else if (WIFSTOPPED(status)) { result.status = wait::Result::Status::stopped; result.detail.if_stopped.signal = static_cast<Signal>(WSTOPSIG(status)); } #ifndef ANDROID else if (WIFCONTINUED(status)) { result.status = wait::Result::Status::continued; } #endif return result; } void ChildProcess::dont_kill_on_cleanup() { d->dont_kill_on_cleanup = true; } #ifndef ANDROID std::istream& ChildProcess::cerr() { return d->cerr; } std::ostream& ChildProcess::cin() { return d->cin; } std::istream& ChildProcess::cout() { return d->cout; } #endif } }
#include <core/posix/child_process.h> #ifndef ANDROID #include <boost/iostreams/device/file_descriptor.hpp> #include <boost/iostreams/stream.hpp> #endif #include <atomic> #include <fstream> #include <mutex> #include <unordered_map> #include <fcntl.h> #include <poll.h> #include <unistd.h> #include <sys/eventfd.h> #include <sys/signalfd.h> #include <assert.h> #include <sys/wait.h> #ifndef ANDROID namespace io = boost::iostreams; #endif namespace { struct DeathObserverImpl : public core::posix::ChildProcess::DeathObserver {
bool add(const core::posix::ChildProcess& process) override { if (process.pid() == -1) return false; std::lock_guard<std::mutex> lg(guard); bool added = false; auto new_process = std::make_pair(process.pid(), process); std::tie(std::ignore, added) = children.insert(new_process); if (added) { int status{-1}; if (::waitpid(process.pid(), &status, WNOHANG) != 0) { signals.child_died(new_process.second); children.erase(new_process.first); return false; } } return added; } bool has(const core::posix::ChildProcess& process) const override { std::lock_guard<std::mutex> lg(guard); return children.count(process.pid()) > 0; } const core::Signal<core::posix::ChildProcess>& child_died() const override { return signals.child_died; } void on_sig_child() override { pid_t pid{-1}; int status{-1}; while (true) { pid = ::waitpid(0, &status, WNOHANG); if (pid == -1) { if (errno == ECHILD) { break; } continue; } else if (pid == 0) { break; } else { std::lock_guard<std::mutex> lg(guard); auto it = children.find(pid); if (it != children.end()) { if (WIFSIGNALED(status) || WIFEXITED(status)) { signals.child_died(it->second); children.erase(it); } } } } } mutable std::mutex guard; std::unordered_map<pid_t, core::posix::ChildProcess> children; core::ScopedConnection on_sig_child_connection; struct { core::Signal<core::posix::ChildProcess> child_died; } signals; }; } std::unique_ptr<core::posix::ChildProcess::DeathObserver> core::posix::ChildProcess::DeathObserver::create_once_with_signal_trap( std::shared_ptr<core::posix::SignalTrap> trap) { static std::atomic<bool> has_been_created_once{false}; if (has_been_created_once.exchange(true)) throw std::runtime_error { "DeathObserver::create_once_with_signal_trap: " "Cannot create more than one instance." }; try { std::unique_ptr<core::posix::ChildProcess::DeathObserver> result { new DeathObserverImpl{trap} }; return result; } catch(...) { has_been_created_once.store(false); std::rethrow_exception(std::current_exception()); } assert(false && "We should never reach here."); return std::unique_ptr<core::posix::ChildProcess::DeathObserver>{}; } namespace core { namespace posix { ChildProcess::Pipe ChildProcess::Pipe::invalid() { static Pipe p; static std::once_flag flag; std::call_once(flag, [&]() { p.close_read_fd(); p.close_write_fd(); }); return p; } ChildProcess::Pipe::Pipe() { int rc = ::pipe(fds); if (rc == -1) throw std::system_error(errno, std::system_category()); } ChildProcess::Pipe::Pipe(const ChildProcess::Pipe& rhs) : fds{-1, -1} { if (rhs.fds[0] != -1) fds[0] = ::dup(rhs.fds[0]); if (rhs.fds[1] != -1) fds[1] = ::dup(rhs.fds[1]); } ChildProcess::Pipe::~Pipe() { if (fds[0] != -1) ::close(fds[0]); if (fds[1] != -1) ::close(fds[1]); } int ChildProcess::Pipe::read_fd() const { return fds[0]; } void ChildProcess::Pipe::close_read_fd() { if (fds[0] != -1) { ::close(fds[0]); fds[0] = -1; } } int ChildProcess::Pipe::write_fd() const { return fds[1]; } void ChildProcess::Pipe::close_write_fd() { if (fds[1] != -1) { ::close(fds[1]); fds[1] = -1; } } ChildProcess::Pipe& ChildProcess::Pipe::operator=(const ChildProcess::Pipe& rhs) { if (fds[0] != -1) ::close(fds[0]); if (fds[1] != -1) ::close(fds[1]); if (rhs.fds[0] != -1) fds[0] = ::dup(rhs.fds[0]); else fds[0] = -1; if (rhs.fds[1] != -1) fds[1] = ::dup(rhs.fds[1]); else fds[1] = -1; return *this; } struct ChildProcess::Private { Private(pid_t pid, const ChildProcess::Pipe& stderr, const ChildProcess::Pipe& stdin, const ChildProcess::Pipe& stdout) : pipes{stderr, stdin, stdout}, #ifndef ANDROID serr(pipes.stderr.read_fd(), io::never_close_handle), sin(pipes.stdin.write_fd(), io::never_close_handle), sout(pipes.stdout.read_fd(), io::never_close_handle), cerr(&serr), cin(&sin), cout(&sout), #endif original_parent_pid(::getpid()), original_child_pid(pid) { } ~Private() { if (original_parent_pid == getpid() && !dont_kill_on_cleanup) { if (original_child_pid != -1) ::kill(original_child_pid, SIGKILL); } } struct { ChildProcess::Pipe stdin; ChildProcess::Pipe stdout; ChildProcess::Pipe stderr; } pipes; #ifndef ANDROID io::stream_buffer<io::file_descriptor_source> serr; io::stream_buffer<io::file_descriptor_sink> sin; io::stream_buffer<io::file_descriptor_source> sout; std::istream cerr; std::ostream cin; std::istream cout; #endif pid_t original_parent_pid; pid_t original_child_pid; bool dont_kill_on_cleanup = false; }; ChildProcess ChildProcess::invalid() { static const pid_t invalid_pid = 1; return ChildProcess(invalid_pid, Pipe::invalid(), Pipe::invalid(), Pipe::invalid()); } ChildProcess::ChildProcess(pid_t pid, const ChildProcess::Pipe& stdin_pipe, const ChildProcess::Pipe& stdout_pipe, const ChildProcess::Pipe& stderr_pipe) : Process(pid), d(new Private{pid, stdin_pipe, stdout_pipe, stderr_pipe}) { } ChildProcess::~ChildProcess() { } wait::Result ChildProcess::wait_for(const wait::Flags& flags) { int status = -1; pid_t result_pid = ::waitpid(pid(), std::addressof(status), static_cast<int>(flags)); if (result_pid == -1) throw std::system_error(errno, std::system_category()); wait::Result result; if (result_pid == 0) { result.status = wait::Result::Status::no_state_change; return result; } if (WIFEXITED(status)) { result.status = wait::Result::Status::exited; result.detail.if_exited.status = static_cast<exit::Status>(WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) { result.status = wait::Result::Status::signaled; result.detail.if_signaled.signal = static_cast<Signal>(WTERMSIG(status)); result.detail.if_signaled.core_dumped = WCOREDUMP(status); } else if (WIFSTOPPED(status)) { result.status = wait::Result::Status::stopped; result.detail.if_stopped.signal = static_cast<Signal>(WSTOPSIG(status)); } #ifndef ANDROID else if (WIFCONTINUED(status)) { result.status = wait::Result::Status::continued; } #endif return result; } void ChildProcess::dont_kill_on_cleanup() { d->dont_kill_on_cleanup = true; } #ifndef ANDROID std::istream& ChildProcess::cerr() { return d->cerr; } std::ostream& ChildProcess::cin() { return d->cin; } std::istream& ChildProcess::cout() { return d->cout; } #endif } }
DeathObserverImpl(const std::shared_ptr<core::posix::SignalTrap>& trap) : on_sig_child_connection { trap->signal_raised().connect([this](core::posix::Signal signal) { switch (signal) { case core::posix::Signal::sig_chld: on_sig_child(); break; default: break; } }) } { if (!trap->has(core::posix::Signal::sig_chld)) throw std::logic_error( "DeathObserver::DeathObserverImpl: Given SignalTrap" " instance does not trap Signal::sig_chld."); }
function_block-full_function
[ { "content": "struct CORE_POSIX_DLL_PUBLIC Stat\n\n{\n\n pid_t pid = 1; ///< The process ID\n\n std::string executable; ///< The filename of the executable, in parentheses.\n\n State state = State::undefined; ///< State of the process.\n\n pid_t parent = -1; ///< The PID of the parent.\n\n pid_t process_group = -1; ///< The process group ID of the process.\n\n int session_id = -1; ///< The session ID of the process.\n\n int tty_nr = -1; ///< The controlling terminal of the process.\n\n int controlling_process_group = -1; ///< The ID of the foreground process group of the controlling terminal of the process.\n\n unsigned int kernel_flags = 0; ///< The kernel flags word of the process.\n\n long unsigned int minor_faults_count = 0; ///< The number of minor faults the process has made which have not required loading a memory page from disk.\n\n long unsigned int minor_faults_count_by_children = 0; ///< The number of minor faults that the process's waited-for children have made.\n\n long unsigned int major_faults_count = 0; ///< The number of major faults the process has made which have required loading a memory page from disk.\n\n long unsigned int major_faults_count_by_children = 0; ///< The number of major faults that the process's waited-for children have made.\n\n struct\n\n {\n\n long unsigned int user = 0; ///< Amount of time that this process has been scheduled in user mode, [clock ticks].\n\n long unsigned int system = 0; ///< Amount of time that this process has been scheduled in kernel mode, [clock ticks].\n\n long unsigned int user_for_children = 0; ///< Amount of time that this process's waited-for children have been scheduled in user mode, [clock ticks].\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/process-cpp-minimal/include/core/posix/linux/proc/process/stat.h", "rank": 0, "score": 222090.82454406342 }, { "content": "struct CORE_POSIX_DLL_PUBLIC OomAdj\n\n{\n\n /**\n\n * @brief Returns the value that makes a process \"invisible\" to the oom killer.\n\n * @return Returns the value that makes a process \"invisible\" to the oom killer.\n\n */\n\n static int disable_value();\n\n\n\n /**\n\n * @brief Returns the minimum valid value.\n\n * @return The minimum valid value that the OomAdj can be set to.\n\n */\n\n static int min_value();\n\n\n\n /**\n\n * @brief Returns the maximum valid value.\n\n * @return The maximum valid value that the OomAdj can be set to.\n\n */\n\n static int max_value();\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/process-cpp-minimal/include/core/posix/linux/proc/process/oom_adj.h", "rank": 1, "score": 217568.5732575133 }, { "content": "struct CORE_POSIX_DLL_PUBLIC OomScore\n\n{\n\n int value = 0; ///< Current OomScore as calculated by the kernel.\n\n};\n\n\n\n/**\n\n * \\brief Read the OomScore for a process instance.\n\n * \\throws std::runtime_error in case of errors.\n\n * \\param [in] process The process to read the score for.\n\n * \\param [out] score The destination to store the value in.\n\n */\n\nCORE_POSIX_DLL_PUBLIC const posix::Process& operator>>(const posix::Process& process, OomScore& score);\n\n}\n\n}\n\n}\n\n}\n\n}\n\n#endif // CORE_POSIX_LINUX_PROC_PROCESS_OOM_SCORE_H_\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/process-cpp-minimal/include/core/posix/linux/proc/process/oom_score.h", "rank": 2, "score": 217568.5732575133 }, { "content": "struct CORE_POSIX_DLL_PUBLIC OomScoreAdj\n\n{\n\n /**\n\n * @brief Returns the minimum valid value.\n\n * @return The minimum valid value that the Oom Score Adj can be set to.\n\n */\n\n static int min_value();\n\n\n\n /**\n\n * @brief Returns the maximum valid value.\n\n * @return The maximum valid value that the Oom Score Adj can be set to.\n\n */\n\n static int max_value();\n\n\n\n /**\n\n * @brief is_valid checks whether the contained value is within the predefined bounds.\n\n * @return true iff min_value() <= value <= max_value().\n\n */\n\n inline bool is_valid() const\n\n {\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/process-cpp-minimal/include/core/posix/linux/proc/process/oom_score_adj.h", "rank": 3, "score": 213251.78402233793 }, { "content": "struct egl_pbuffer_surface_t : public egl_surface_t {\n\n static egl_pbuffer_surface_t* create(EGLDisplay dpy, EGLConfig config,\n\n EGLint surfType, int32_t w, int32_t h, GLenum pixelFormat);\n\n\n\n virtual ~egl_pbuffer_surface_t();\n\n\n\n virtual void setSwapInterval(int interval) { (void)interval; }\n\n virtual EGLBoolean swapBuffers() { return EGL_TRUE; }\n\n\n\n uint32_t getRcColorBuffer() { return rcColorBuffer; }\n\n\n\nprivate:\n\n egl_pbuffer_surface_t(EGLDisplay dpy, EGLConfig config, EGLint surfType,\n\n int32_t w, int32_t h);\n\n EGLBoolean init(GLenum format);\n\n\n\n uint32_t rcColorBuffer;\n\n};\n\n\n\negl_pbuffer_surface_t::egl_pbuffer_surface_t(EGLDisplay dpy, EGLConfig config,\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/system/egl/egl.cpp", "rank": 4, "score": 208640.26342689333 }, { "content": "struct egl_window_surface_t : public egl_surface_t {\n\n static egl_window_surface_t* create(\n\n EGLDisplay dpy, EGLConfig config, EGLint surfType,\n\n ANativeWindow* window);\n\n\n\n virtual ~egl_window_surface_t();\n\n\n\n virtual void setSwapInterval(int interval);\n\n virtual EGLBoolean swapBuffers();\n\n\n\nprivate:\n\n egl_window_surface_t(\n\n EGLDisplay dpy, EGLConfig config, EGLint surfType,\n\n ANativeWindow* window);\n\n EGLBoolean init();\n\n\n\n ANativeWindow* nativeWindow;\n\n android_native_buffer_t* buffer;\n\n};\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/system/egl/egl.cpp", "rank": 5, "score": 208640.26342689333 }, { "content": "struct ResolvedTrace: public Trace {\n\n\n\n\tstruct SourceLoc {\n\n\t\tstd::string function;\n\n\t\tstd::string filename;\n\n\t\tunsigned line;\n\n\t\tunsigned col;\n\n\n\n\t\tSourceLoc(): line(0), col(0) {}\n\n\n\n\t\tbool operator==(const SourceLoc& b) const {\n\n\t\t\treturn function == b.function\n\n\t\t\t\t&& filename == b.filename\n\n\t\t\t\t&& line == b.line\n\n\t\t\t\t&& col == b.col;\n\n\t\t}\n\n\n\n\t\tbool operator!=(const SourceLoc& b) const {\n\n\t\t\treturn !(*this == b);\n\n\t\t}\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/backward-cpp/backward.hpp", "rank": 6, "score": 203027.64200824406 }, { "content": "// Wrapper class for threads. Does not use emugl::Thread intentionally.\n\n// Common data type used by the following tests below.\n\nstruct ThreadParams {\n\n ThreadParams() : mutex(), counter(0) {}\n\n\n\n Mutex mutex;\n\n int counter;\n\n};\n\n\n\n// This thread function uses Mutex::lock/unlock to synchronize a counter\n\n// increment operation.\n\nstatic void* threadFunction(void* param) {\n\n ThreadParams* p = static_cast<ThreadParams*>(param);\n\n\n\n p->mutex.lock();\n\n p->counter++;\n\n p->mutex.unlock();\n\n return NULL;\n\n}\n\n\n\nTEST(Mutex, Synchronization) {\n\n const size_t kNumThreads = 2000;\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/android-emugl/shared/emugl/common/mutex_unittest.cpp", "rank": 7, "score": 198444.11757226574 }, { "content": "struct BoostLogLogger : public anbox::Logger {\n\n BoostLogLogger() : initialized_(false) {}\n\n\n\n void Init(const anbox::Logger::Severity& severity = anbox::Logger::Severity::kWarning) override {\n\n if (initialized_)\n\n return;\n\n\n\n boost::log::formatter formatter =\n\n boost::log::expressions::stream\n\n << \"[\" << attrs::Severity << \" \"\n\n << boost::log::expressions::format_date_time<boost::posix_time::ptime>(\n\n \"Timestamp\", \"%Y-%m-%d %H:%M:%S\")\n\n << \"] \"\n\n << boost::log::expressions::if_(boost::log::expressions::has_attr(\n\n attrs::Location))[boost::log::expressions::stream\n\n << \"[\" << attrs::Location << \"] \"]\n\n << boost::log::expressions::smessage;\n\n\n\n boost::log::core::get()->remove_all_sinks();\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/logger.cpp", "rank": 8, "score": 194612.73058538302 }, { "content": "class BufferedIOStream : public IOStream {\n\n public:\n\n static const size_t default_buffer_size{384};\n\n\n\n explicit BufferedIOStream(\n\n const std::shared_ptr<anbox::network::SocketMessenger> &messenger,\n\n size_t buffer_size = default_buffer_size);\n\n\n\n virtual ~BufferedIOStream();\n\n\n\n void *allocBuffer(size_t min_size) override;\n\n size_t commitBuffer(size_t size) override;\n\n const unsigned char *read(void *buf, size_t *inout_len) override;\n\n void forceStop() override;\n\n void post_data(Buffer &&data);\n\n\n\n bool needs_data();\n\n\n\n private:\n\n void thread_main();\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/graphics/buffered_io_stream.h", "rank": 9, "score": 194413.6886367628 }, { "content": "struct Frame : public bt::Frame\n\n{\n\n struct Symbol : public bt::Frame::Symbol\n\n {\n\n Symbol(const char* symbol) : raw_(symbol)\n\n {\n\n auto first = raw_.find_first_of(\"(\");\n\n auto last = raw_.find_last_of(\")\");\n\n\n\n if (first != std::string::npos && last != std::string::npos)\n\n {\n\n auto mangled_symbol = raw_.substr(first+1,\n\n (last-1) - (first+1));\n\n\n\n auto plus = mangled_symbol.find_first_of(\"+\");\n\n if (plus != std::string::npos)\n\n mangled_symbol.erase(plus);\n\n\n\n std::tie(demangled_, is_cxx_) = demangle(mangled_symbol);\n\n if (!is_cxx_)\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/process-cpp-minimal/src/core/posix/backtrace.cpp", "rank": 10, "score": 188880.3079810391 }, { "content": "struct AsioStrandDispatcher : public anbox::common::Dispatcher {\n\n public:\n\n AsioStrandDispatcher(const std::shared_ptr<anbox::Runtime>& rt)\n\n : rt{rt}, strand{rt->service()} {}\n\n\n\n void dispatch(const Task& task) override { strand.post(task); }\n\n\n\n private:\n\n std::shared_ptr<anbox::Runtime> rt;\n\n boost::asio::io_service::strand strand;\n\n};\n\n}\n\n\n\nstd::shared_ptr<anbox::common::Dispatcher>\n\nanbox::common::create_dispatcher_for_runtime(\n\n const std::shared_ptr<anbox::Runtime>& rt) {\n\n return std::make_shared<AsioStrandDispatcher>(rt);\n\n}\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/common/dispatcher.cpp", "rank": 11, "score": 185899.17797578397 }, { "content": "class SocketStream : public IOStream {\n\npublic:\n\n typedef enum { ERR_INVALID_SOCKET = -1000 } SocketStreamError;\n\n\n\n explicit SocketStream(size_t bufsize = 10000);\n\n virtual ~SocketStream();\n\n\n\n virtual int listen(unsigned short port) = 0;\n\n virtual SocketStream *accept() = 0;\n\n virtual int connect(unsigned short port) = 0;\n\n\n\n virtual void *allocBuffer(size_t minSize);\n\n virtual int commitBuffer(size_t size);\n\n virtual const unsigned char *readFully(void *buf, size_t len);\n\n virtual const unsigned char *read(void *buf, size_t *inout_len);\n\n\n\n bool valid() { return m_sock >= 0; }\n\n virtual int recv(void *buf, size_t len);\n\n virtual int writeFully(const void *buf, size_t len);\n\n\n\nprotected:\n\n int m_sock;\n\n size_t m_bufsize;\n\n unsigned char *m_buf;\n\n\n\n SocketStream(int sock, size_t bufSize);\n\n};\n\n\n\n#endif /* __SOCKET_STREAM_H */\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/shared/OpenglCodecCommon/SocketStream.h", "rank": 13, "score": 183805.24810516567 }, { "content": "class QemuPipeStream : public IOStream {\n\npublic:\n\n typedef enum { ERR_INVALID_SOCKET = -1000 } QemuPipeStreamError;\n\n\n\n explicit QemuPipeStream(size_t bufsize = 10000);\n\n ~QemuPipeStream();\n\n int connect(void);\n\n\n\n virtual void *allocBuffer(size_t minSize);\n\n virtual int commitBuffer(size_t size);\n\n virtual const unsigned char *readFully( void *buf, size_t len);\n\n virtual const unsigned char *read( void *buf, size_t *inout_len);\n\n\n\n bool valid() { return m_sock >= 0; }\n\n int recv(void *buf, size_t len);\n\n\n\n virtual int writeFully(const void *buf, size_t len);\n\n\n\nprivate:\n\n int m_sock;\n\n size_t m_bufsize;\n\n unsigned char *m_buf;\n\n QemuPipeStream(int sock, size_t bufSize);\n\n};\n\n\n\n#endif\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/system/OpenglSystemCommon/QemuPipeStream.h", "rank": 14, "score": 180413.66498049602 }, { "content": "class CORE_POSIX_DLL_PUBLIC Process : public Signalable\n\n{\n\npublic:\n\n /**\n\n * @brief Creates a process instance wrapping an existing process.\n\n * @throw Throw std::system_error if pid is invalid, i.e., pid < 0.\n\n * @param pid The process identifier of the existing process.\n\n */\n\n explicit Process(pid_t pid);\n\n\n\n /**\n\n * @brief Returns an invalid instance for testing purposes.\n\n * @return An invalid instance.\n\n */\n\n static Process invalid();\n\n\n\n /**\n\n * @brief Frees resources associated with the process.\n\n */\n\n virtual ~Process() noexcept;\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/process-cpp-minimal/include/core/posix/process.h", "rank": 15, "score": 179511.43312866765 }, { "content": "class IOStream {\n\npublic:\n\n\n\n IOStream(size_t bufSize) {\n\n m_buf = NULL;\n\n m_bufsize = bufSize;\n\n m_free = 0;\n\n }\n\n\n\n virtual void *allocBuffer(size_t minSize) = 0;\n\n virtual int commitBuffer(size_t size) = 0;\n\n virtual const unsigned char *readFully( void *buf, size_t len) = 0;\n\n virtual const unsigned char *read( void *buf, size_t *inout_len) = 0;\n\n virtual int writeFully(const void* buf, size_t len) = 0;\n\n\n\n virtual ~IOStream() {\n\n\n\n // NOTE: m_buf is 'owned' by the child class thus we expect it to be released by it\n\n }\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/host/include/libOpenglRender/IOStream.h", "rank": 16, "score": 177961.21543588617 }, { "content": "class IOStream {\n\npublic:\n\n IOStream(size_t bufSize) {\n\n m_buf = NULL;\n\n m_bufsize = bufSize;\n\n m_free = 0;\n\n }\n\n\n\n virtual void *allocBuffer(size_t minSize) = 0;\n\n virtual size_t commitBuffer(size_t size) = 0;\n\n virtual const unsigned char *read(void *buf, size_t *inout_len) = 0;\n\n virtual void forceStop() = 0;\n\n\n\n virtual ~IOStream() {\n\n // NOTE: m_buf is 'owned' by the child class thus we expect it to be released by it\n\n }\n\n\n\n unsigned char *alloc(size_t len) {\n\n if (m_buf && len > m_free) {\n\n if (flush() < 0)\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/android-emugl/host/include/libOpenglRender/IOStream.h", "rank": 17, "score": 176310.6235429296 }, { "content": "class CORE_POSIX_DLL_PUBLIC ChildProcess : public Process\n\n{\n\npublic:\n\n /**\n\n * @brief The DeathObserver class observes child process' states and emits a signal when a monitored child has died.\n\n *\n\n * Please note that the name of this class is morbid for a reason: Listening\n\n * for SIGCHLD is not enough to catch all dying children. Whenever a SIGCHLD is\n\n * received, we have to wait for all the children of this process and reap all\n\n * monitored ones. We are thus changing state and potentially race with other\n\n * wait operations on children.\n\n *\n\n */\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/process-cpp-minimal/include/core/posix/child_process.h", "rank": 18, "score": 176306.98362636007 }, { "content": "class CORE_POSIX_DLL_PUBLIC ProcessGroup : public Signalable\n\n{\n\npublic:\n\n /**\n\n * @brief Accesses the id of this process group.\n\n * @return The id of this process group.\n\n */\n\n virtual pid_t id() const;\n\n\n\n static ProcessGroup invalid();\n\n\n\nprotected:\n\n friend class Process;\n\n CORE_POSIX_DLL_LOCAL ProcessGroup(pid_t id);\n\n\n\nprivate:\n\n struct CORE_POSIX_DLL_LOCAL Private;\n\n std::shared_ptr<Private> d;\n\n};\n\n}\n\n}\n\n\n\n#endif // CORE_POSIX_PROCESS_GROUP_H_\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/process-cpp-minimal/include/core/posix/process_group.h", "rank": 19, "score": 176306.98362636007 }, { "content": "/*\n\n* Copyright (C) 2011 The Android Open Source Project\n\n*\n\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n\n* you may not use this file except in compliance with the License.\n\n* You may obtain a copy of the License at\n\n*\n\n* http://www.apache.org/licenses/LICENSE-2.0\n\n*\n\n* Unless required by applicable law or agreed to in writing, software\n\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n* See the License for the specific language governing permissions and\n\n* limitations under the License.\n\n*/\n\n#ifndef __IO_STREAM_H__\n\n#define __IO_STREAM_H__\n\n\n\n#include <stdlib.h>\n\n#include <stdio.h>\n\n\n\n#include \"ErrorLog.h\"\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/host/include/libOpenglRender/IOStream.h", "rank": 20, "score": 167893.8780087823 }, { "content": " unsigned char *alloc(size_t len) {\n\n\n\n if (m_buf && len > m_free) {\n\n if (flush() < 0) {\n\n ERR(\"Failed to flush in alloc\\n\");\n\n return NULL; // we failed to flush so something is wrong\n\n }\n\n }\n\n\n\n if (!m_buf || len > m_bufsize) {\n\n int allocLen = m_bufsize < len ? len : m_bufsize;\n\n m_buf = (unsigned char *)allocBuffer(allocLen);\n\n if (!m_buf) {\n\n ERR(\"Alloc (%u bytes) failed\\n\", allocLen);\n\n return NULL;\n\n }\n\n m_bufsize = m_free = allocLen;\n\n }\n\n\n\n unsigned char *ptr;\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/host/include/libOpenglRender/IOStream.h", "rank": 21, "score": 167878.7459518016 }, { "content": "\n\n ptr = m_buf + (m_bufsize - m_free);\n\n m_free -= len;\n\n\n\n return ptr;\n\n }\n\n\n\n int flush() {\n\n\n\n if (!m_buf || m_free == m_bufsize) return 0;\n\n\n\n int stat = commitBuffer(m_bufsize - m_free);\n\n m_buf = NULL;\n\n m_free = 0;\n\n return stat;\n\n }\n\n\n\n const unsigned char *readback(void *buf, size_t len) {\n\n flush();\n\n return readFully(buf, len);\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/host/include/libOpenglRender/IOStream.h", "rank": 22, "score": 167878.7459518016 }, { "content": " }\n\n\n\n\n\nprivate:\n\n unsigned char *m_buf;\n\n size_t m_bufsize;\n\n size_t m_free;\n\n};\n\n\n\n//\n\n// When a client opens a connection to the renderer, it should\n\n// send unsigned int value indicating the \"clientFlags\".\n\n// The following are the bitmask of the clientFlags.\n\n// currently only one bit is used which flags the server\n\n// it should exit.\n\n//\n\n#define IOSTREAM_CLIENT_EXIT_SERVER 1\n\n\n\n#endif\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/host/include/libOpenglRender/IOStream.h", "rank": 23, "score": 167878.7459518016 }, { "content": "/*\n\n* Copyright (C) 2011 The Android Open Source Project\n\n*\n\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n\n* you may not use this file except in compliance with the License.\n\n* You may obtain a copy of the License at\n\n*\n\n* http://www.apache.org/licenses/LICENSE-2.0\n\n*\n\n* Unless required by applicable law or agreed to in writing, software\n\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n* See the License for the specific language governing permissions and\n\n* limitations under the License.\n\n*/\n\n#ifndef __IO_STREAM_H__\n\n#define __IO_STREAM_H__\n\n\n\n#include <stdlib.h>\n\n#include <stdio.h>\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/android-emugl/host/include/libOpenglRender/IOStream.h", "rank": 24, "score": 166016.2675738681 }, { "content": " return NULL; // we failed to flush so something is wrong\n\n }\n\n\n\n if (!m_buf || len > m_bufsize) {\n\n int allocLen = m_bufsize < len ? len : m_bufsize;\n\n m_buf = static_cast<unsigned char *>(allocBuffer(allocLen));\n\n if (!m_buf)\n\n return NULL;\n\n m_bufsize = m_free = allocLen;\n\n }\n\n\n\n unsigned char *ptr;\n\n\n\n ptr = m_buf + (m_bufsize - m_free);\n\n m_free -= len;\n\n\n\n return ptr;\n\n }\n\n\n\n int flush() {\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/android-emugl/host/include/libOpenglRender/IOStream.h", "rank": 25, "score": 166001.68943717133 }, { "content": " if (!m_buf || m_free == m_bufsize) return 0;\n\n\n\n int stat = commitBuffer(m_bufsize - m_free);\n\n m_buf = NULL;\n\n m_free = 0;\n\n return stat;\n\n }\n\n\n\nprivate:\n\n unsigned char *m_buf;\n\n size_t m_bufsize;\n\n size_t m_free;\n\n};\n\n\n\n//\n\n// When a client opens a connection to the renderer, it should\n\n// send unsigned int value indicating the \"clientFlags\".\n\n// The following are the bitmask of the clientFlags.\n\n// currently only one bit is used which flags the server\n\n// it should exit.\n\n//\n\n#define IOSTREAM_CLIENT_EXIT_SERVER 1\n\n\n\n#endif\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/android-emugl/host/include/libOpenglRender/IOStream.h", "rank": 26, "score": 166001.68943717136 }, { "content": "// Simple wrapper class for mutexes.\n\nclass Mutex {\n\npublic:\n\n // Constructor.\n\n Mutex() {\n\n#ifdef _WIN32\n\n ::InitializeCriticalSection(&mLock);\n\n#else\n\n ::pthread_mutex_init(&mLock, NULL);\n\n#endif\n\n }\n\n\n\n // Destructor.\n\n ~Mutex() {\n\n#ifdef _WIN32\n\n ::DeleteCriticalSection(&mLock);\n\n#else\n\n ::pthread_mutex_destroy(&mLock);\n\n#endif\n\n }\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/android-emugl/shared/emugl/common/mutex.h", "rank": 27, "score": 161184.416189796 }, { "content": "class EmulatedCamera3 : public camera3_device, public EmulatedBaseCamera {\n\npublic:\n\n /* Constructs EmulatedCamera3 instance.\n\n * Param:\n\n * cameraId - Zero based camera identifier, which is an index of the camera\n\n * instance in camera factory's array.\n\n * module - Emulated camera HAL module descriptor.\n\n */\n\n EmulatedCamera3(int cameraId,\n\n struct hw_module_t* module);\n\n\n\n /* Destructs EmulatedCamera2 instance. */\n\n virtual ~EmulatedCamera3();\n\n\n\n /* List of all defined capabilities plus useful HW levels */\n\n enum AvailableCapabilities {\n\n BACKWARD_COMPATIBLE,\n\n MANUAL_SENSOR,\n\n MANUAL_POST_PROCESSING,\n\n RAW,\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/camera/EmulatedCamera3.h", "rank": 28, "score": 150868.77013997053 }, { "content": "class EmulatedCamera : public camera_device, public EmulatedBaseCamera {\n\npublic:\n\n /* Constructs EmulatedCamera instance.\n\n * Param:\n\n * cameraId - Zero based camera identifier, which is an index of the camera\n\n * instance in camera factory's array.\n\n * module - Emulated camera HAL module descriptor.\n\n */\n\n EmulatedCamera(int cameraId,\n\n struct hw_module_t* module);\n\n\n\n /* Destructs EmulatedCamera instance. */\n\n virtual ~EmulatedCamera();\n\n\n\n /****************************************************************************\n\n * Abstract API\n\n ***************************************************************************/\n\n\n\npublic:\n\n /* Gets emulated camera device used by this instance of the emulated camera.\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/camera/EmulatedCamera.h", "rank": 29, "score": 150868.77013997053 }, { "content": "class EmulatedCamera2 : public camera2_device, public EmulatedBaseCamera {\n\npublic:\n\n /* Constructs EmulatedCamera2 instance.\n\n * Param:\n\n * cameraId - Zero based camera identifier, which is an index of the camera\n\n * instance in camera factory's array.\n\n * module - Emulated camera HAL module descriptor.\n\n */\n\n EmulatedCamera2(int cameraId,\n\n struct hw_module_t* module);\n\n\n\n /* Destructs EmulatedCamera2 instance. */\n\n virtual ~EmulatedCamera2();\n\n\n\n /****************************************************************************\n\n * Abstract API\n\n ***************************************************************************/\n\n\n\npublic:\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/camera/EmulatedCamera2.h", "rank": 30, "score": 150868.77013997053 }, { "content": "struct HwcContext {\n\n hwc_composer_device_1_t device;\n\n\n\n // These 3 variables could be reduced to first_overlay only, however it makes\n\n // the conditions in the code more complicated. In order to keep things as\n\n // simple as possible, there are 3 major ways to display a frame.\n\n // 1. Show only the framebuffer.\n\n // 2. Show the framebuffer with some overlays above it.\n\n // 3. Show all overlays and hide the framebuffer.\n\n //\n\n // Since the framebuffer has no alpha channel and is opaque, it can only ever\n\n // be the rearmost layer that we end up putting on screen, otherwise it will\n\n // cover up all layers behind it, since its display frame is the whole window.\n\n //\n\n // Without framebuffer_visible, the condition of whether to display the\n\n // frambuffer becomes more complex and possibly if (numHwLayers == 0 ||\n\n // hwLayers[0]->compositionType != HWC_OVERLAY) but that might not be correct.\n\n //\n\n // The range [first_overlay, first_overlay+num_overlay) is a natural way to\n\n // structure the loop and prevents requiring state and iterating through all\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/hwcomposer/hwcomposer.cpp", "rank": 31, "score": 150241.79590903246 }, { "content": "struct generic_stream_in {\n\n struct audio_stream_in stream;\n\n struct generic_audio_device *dev;\n\n audio_devices_t device;\n\n int fd;\n\n};\n\n\n\nstatic uint32_t out_get_sample_rate(const struct audio_stream *stream) {\n\n return OUT_SAMPLING_RATE;\n\n}\n\n\n\nstatic int out_set_sample_rate(struct audio_stream *stream, uint32_t rate) {\n\n return -ENOSYS;\n\n}\n\n\n\nstatic size_t out_get_buffer_size(const struct audio_stream *stream) {\n\n return OUT_BUFFER_SIZE;\n\n}\n\n\n\nstatic audio_channel_mask_t out_get_channels(const struct audio_stream *stream) {\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/audio/audio_hw.cpp", "rank": 32, "score": 148993.2406601911 }, { "content": "struct generic_stream_out {\n\n struct audio_stream_out stream;\n\n struct generic_audio_device *dev;\n\n audio_devices_t device;\n\n int fd;\n\n};\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/audio/audio_hw.cpp", "rank": 33, "score": 148993.2406601911 }, { "content": "class CORE_POSIX_DLL_PUBLIC Signalable\n\n{\n\npublic:\n\n virtual ~Signalable() { }\n\n\n\n /**\n\n * @brief Sends a signal to this signalable object.\n\n * @throws std::system_error in case of problems.\n\n * @param [in] signal The signal to be sent to the process.\n\n */\n\n virtual void send_signal_or_throw(Signal signal);\n\n\n\n /**\n\n * @brief Sends a signal to this signalable object.\n\n * @param [in] signal The signal to be sent to the process.\n\n * @param [out] e Set to contain an error if an issue arises.\n\n */\n\n virtual void send_signal(Signal signal, std::error_code& e) noexcept(true);\n\n\n\nprotected:\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/process-cpp-minimal/include/core/posix/signalable.h", "rank": 34, "score": 148947.60425506212 }, { "content": "struct generic_audio_device {\n\n struct audio_hw_device device;\n\n pthread_mutex_t lock;\n\n struct audio_stream_out *output;\n\n struct audio_stream_in *input;\n\n bool mic_mute;\n\n};\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/audio/audio_hw.cpp", "rank": 35, "score": 147772.721298119 }, { "content": "//\n\n// our private gralloc module structure\n\n//\n\nstruct private_module_t {\n\n gralloc_module_t base;\n\n};\n\n\n\n/* If not NULL, this is a pointer to the fallback module.\n\n * This really is gralloc.default, which we'll use if we detect\n\n * that the emulator we're running in does not support GPU emulation.\n\n */\n\nstatic gralloc_module_t* sFallback;\n\nstatic pthread_once_t sFallbackOnce = PTHREAD_ONCE_INIT;\n\n\n\nstatic void fallback_init(void); // forward\n\n\n\n\n\ntypedef struct _alloc_list_node {\n\n buffer_handle_t handle;\n\n _alloc_list_node *next;\n\n _alloc_list_node *prev;\n\n} AllocListNode;\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/system/gralloc/gralloc.cpp", "rank": 36, "score": 147772.721298119 }, { "content": "//\n\n// Our framebuffer device structure\n\n//\n\nstruct fb_device_t {\n\n framebuffer_device_t device;\n\n};\n\n\n\nstatic int map_buffer(cb_handle_t *cb, void **vaddr)\n\n{\n\n if (cb->fd < 0 || cb->ashmemSize <= 0) {\n\n return -EINVAL;\n\n }\n\n\n\n void *addr = mmap(0, cb->ashmemSize, PROT_READ | PROT_WRITE,\n\n MAP_SHARED, cb->fd, 0);\n\n if (addr == MAP_FAILED) {\n\n return -errno;\n\n }\n\n\n\n cb->ashmemBase = intptr_t(addr);\n\n cb->ashmemBasePid = getpid();\n\n\n\n *vaddr = addr;\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/system/gralloc/gralloc.cpp", "rank": 37, "score": 147772.721298119 }, { "content": "//\n\n// Our gralloc device structure (alloc interface)\n\n//\n\nstruct gralloc_device_t {\n\n alloc_device_t device;\n\n\n\n AllocListNode *allocListHead; // double linked list of allocated buffers\n\n pthread_mutex_t lock;\n\n};\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/system/gralloc/gralloc.cpp", "rank": 38, "score": 147772.721298119 }, { "content": "struct egl_surface_t {\n\n\n\n EGLDisplay dpy;\n\n EGLConfig config;\n\n\n\n\n\n egl_surface_t(EGLDisplay dpy, EGLConfig config, EGLint surfaceType);\n\n virtual ~egl_surface_t();\n\n\n\n virtual void setSwapInterval(int interval) = 0;\n\n virtual EGLBoolean swapBuffers() = 0;\n\n\n\n EGLint getSwapBehavior() const;\n\n uint32_t getRcSurface() { return rcSurface; }\n\n EGLint getSurfaceType() { return surfaceType; }\n\n\n\n EGLint getWidth(){ return width; }\n\n EGLint getHeight(){ return height; }\n\n void setTextureFormat(EGLint _texFormat) { texFormat = _texFormat; }\n\n EGLint getTextureFormat() { return texFormat; }\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/system/egl/egl.cpp", "rank": 39, "score": 147772.721298119 }, { "content": "class CORE_POSIX_DLL_PUBLIC SignalTrap\n\n{\n\npublic:\n\n SignalTrap(const SignalTrap&) = delete;\n\n virtual ~SignalTrap() = default;\n\n\n\n SignalTrap& operator=(const SignalTrap&) = delete;\n\n bool operator==(const SignalTrap&) const = delete;\n\n\n\n /**\n\n * @brief Returns true if the given signal is trapped by this instance.\n\n */\n\n virtual bool has(Signal signal) = 0;\n\n\n\n /**\n\n * @brief Starts observation of incoming signals, relaying them via\n\n * signal_raised(). The call blocks until stop is called.\n\n */\n\n virtual void run() = 0;\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/process-cpp-minimal/include/core/posix/signal.h", "rank": 40, "score": 147132.069276885 }, { "content": "struct EmulatedCameraHotplugThread;\n\n\n\n/*\n\n * Contains declaration of a class EmulatedCameraFactory that manages cameras\n\n * available for the emulation. A global instance of this class is statically\n\n * instantiated and initialized when camera emulation HAL is loaded.\n\n */\n\n\n\n/* Class EmulatedCameraFactoryManages cameras available for the emulation.\n\n *\n\n * When the global static instance of this class is created on the module load,\n\n * it enumerates cameras available for the emulation by connecting to the\n\n * emulator's 'camera' service. For every camera found out there it creates an\n\n * instance of an appropriate class, and stores it an in array of emulated\n\n * cameras. In addition to the cameras reported by the emulator, a fake camera\n\n * emulator is always created, so there is always at least one camera that is\n\n * available.\n\n *\n\n * Instance of this class is also used as the entry point for the camera HAL API,\n\n * including:\n\n * - hw_module_methods_t::open entry point\n\n * - camera_module_t::get_number_of_cameras entry point\n\n * - camera_module_t::get_camera_info entry point\n\n *\n\n */\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/camera/EmulatedCameraFactory.h", "rank": 41, "score": 146579.26079607772 }, { "content": "// Helper union to store a socket address.\n\nstruct SockAddr {\n\n socklen_t len;\n\n union {\n\n sockaddr generic;\n\n sockaddr_in inet;\n\n#ifndef _WIN32\n\n sockaddr_un local;\n\n#endif\n\n };\n\n\n\n int getFamily() const { return generic.sa_family; }\n\n\n\n void initEmpty() {\n\n ::memset(this, 0, sizeof(*this));\n\n this->len = static_cast<socklen_t>(sizeof(*this));\n\n }\n\n\n\n int initFromInet(uint32_t ip_address, int port) {\n\n if (port < 0 || port >= 65536)\n\n return -EINVAL;\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/android-emugl/shared/emugl/common/sockets.cpp", "rank": 42, "score": 145411.92858152583 }, { "content": "struct BufferData {\n\n BufferData();\n\n BufferData(GLsizeiptr size, void * data);\n\n GLsizeiptr m_size;\n\n FixedBuffer m_fixedBuffer; \n\n};\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/shared/OpenglCodecCommon/GLSharedGroup.h", "rank": 43, "score": 144269.83773947274 }, { "content": "struct ShaderData {\n\n typedef android::List<android::String8> StringList;\n\n StringList samplerExternalNames;\n\n int refcount;\n\n};\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/shared/OpenglCodecCommon/GLSharedGroup.h", "rank": 44, "score": 144269.83773947274 }, { "content": "struct UnpackerT {};\n\n\n\ntemplate <typename T, typename S>\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/android-emugl/shared/OpenglCodecCommon/ProtocolUtils.h", "rank": 45, "score": 144269.83773947274 }, { "content": "// The following is the shared structure between all threads.\n\nstruct MultiState {\n\n MultiState(LazyInstance<StaticCounter>* staticCounter) :\n\n mMutex(), mStaticCounter(staticCounter), mCount(0) {}\n\n\n\n enum {\n\n kMaxThreads = 1000,\n\n };\n\n\n\n Mutex mMutex;\n\n LazyInstance<StaticCounter>* mStaticCounter;\n\n size_t mCount;\n\n void* mValues[kMaxThreads];\n\n TestThread* mThreads[kMaxThreads];\n\n};\n\n\n\n// The thread function for the test below.\n\nstatic void* threadFunc(void* param) {\n\n MultiState* state = static_cast<MultiState*>(param);\n\n Mutex::AutoLock lock(state->mMutex);\n\n if (state->mCount < MultiState::kMaxThreads) {\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/android-emugl/shared/emugl/common/lazy_instance_unittest.cpp", "rank": 46, "score": 143152.1424188509 }, { "content": "// NotCopyable deletes the copy c'tor and the assignment operator.\n\nstruct NotCopyable\n\n{\n\n NotCopyable() = default;\n\n NotCopyable(const NotCopyable&) = delete;\n\n virtual ~NotCopyable() = default;\n\n NotCopyable& operator=(const NotCopyable&) = delete;\n\n};\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/xdg/xdg.h", "rank": 47, "score": 142495.39752184373 }, { "content": "// NotMoveable deletes the move c'tor and the move assignment operator.\n\nstruct NotMoveable\n\n{\n\n NotMoveable() = default;\n\n NotMoveable(NotMoveable&&) = delete;\n\n virtual ~NotMoveable() = default;\n\n NotMoveable& operator=(NotMoveable&&) = delete;\n\n};\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/xdg/xdg.h", "rank": 48, "score": 142495.39752184373 }, { "content": "struct PingPongState {\n\n MessageChannel<std::string, 3U> in;\n\n MessageChannel<std::string, 3U> out;\n\n};\n\n\n\nvoid* pingPongFunction(void* param) {\n\n for (;;) {\n\n PingPongState* s = static_cast<PingPongState*>(param);\n\n std::string str;\n\n s->in.receive(&str);\n\n s->out.send(str);\n\n if (str == \"quit\") {\n\n break;\n\n }\n\n }\n\n return 0;\n\n}\n\n\n\n} // namespace\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/android-emugl/shared/emugl/common/message_channel_unittest.cpp", "rank": 49, "score": 142058.0354247275 }, { "content": "class CORE_POSIX_DLL_PUBLIC CrossProcessSync\n\n{\n\n public:\n\n struct Error\n\n {\n\n Error() = delete;\n\n ~Error() = delete;\n\n\n\n /**\n\n * @brief Thrown if any of the *_for functions times out.\n\n */\n\n struct Timeout : public std::runtime_error\n\n {\n\n Timeout() : std::runtime_error(\"Timeout while waiting for event to happen.\")\n\n {\n\n }\n\n };\n\n };\n\n\n\n /**\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/process-cpp-minimal/include/core/testing/cross_process_sync.h", "rank": 50, "score": 141941.65275312006 }, { "content": "struct Event {\n\n std::uint16_t type;\n\n std::uint16_t code;\n\n std::int32_t value;\n\n};\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/input/device.h", "rank": 51, "score": 141011.18816619407 }, { "content": "struct deleter {\n\n\ttemplate <typename U>\n\n\t\tvoid operator()(U& ptr) const {\n\n\t\t\t(*F)(ptr);\n\n\t\t}\n\n};\n\n\n\ntemplate <typename T>\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/backward-cpp/backward.hpp", "rank": 52, "score": 139567.07057306488 }, { "content": "struct demangler:\n\n\tpublic demangler_impl<system_tag::current_tag> {};\n\n\n\n} // namespace details\n\n\n\n/*************** A TRACE ***************/\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/backward-cpp/backward.hpp", "rank": 53, "score": 139567.07057306488 }, { "content": "struct Configuration {\n\n graphics::Rect display_frame = graphics::Rect::Invalid;\n\n bool single_window = false;\n\n bool no_touch_emulation = false;\n\n bool server_side_decoration = false;\n\n};\n\n\n\nstd::shared_ptr<BasePlatform> create(const std::string &name,\n\n const std::shared_ptr<input::Manager> &input_manager,\n\n const Configuration &config);\n\n} // namespace platform\n\n} // namespace anbox\n\n\n\n#endif\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/platform/base_platform.h", "rank": 54, "score": 139567.07057306488 }, { "content": "struct Trace {\n\n\tvoid* addr;\n\n\tsize_t idx;\n\n\n\n\tTrace():\n\n\t\taddr(nullptr), idx(0) {}\n\n\n\n\texplicit Trace(void* _addr, size_t _idx):\n\n\t\taddr(_addr), idx(_idx) {}\n\n};\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/backward-cpp/backward.hpp", "rank": 55, "score": 139567.07057306488 }, { "content": "class SocketMessenger : public MessageSender, public MessageReceiver {\n\n public:\n\n virtual Credentials creds() const = 0;\n\n virtual unsigned short local_port() const = 0;\n\n virtual void set_no_delay() = 0;\n\n virtual void close() = 0;\n\n};\n\n} // namespace network\n\n} // namespace anbox\n\n\n\n#endif\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/network/socket_messenger.h", "rank": 56, "score": 139266.8840682224 }, { "content": "class PublishedSocketConnector : public DoNotCopyOrMove, public Connector {\n\n public:\n\n explicit PublishedSocketConnector(\n\n const std::string& socket_file, const std::shared_ptr<Runtime>& rt,\n\n const std::shared_ptr<ConnectionCreator<\n\n boost::asio::local::stream_protocol>>& connection_creator);\n\n ~PublishedSocketConnector() noexcept;\n\n\n\n std::string socket_file() const { return socket_file_; }\n\n\n\n private:\n\n void start_accept();\n\n void on_new_connection(\n\n std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket,\n\n boost::system::error_code const& err);\n\n\n\n const std::string socket_file_;\n\n std::shared_ptr<Runtime> runtime_;\n\n std::shared_ptr<ConnectionCreator<boost::asio::local::stream_protocol>>\n\n connection_creator_;\n\n boost::asio::local::stream_protocol::acceptor acceptor_;\n\n};\n\n} // namespace network\n\n} // namespace anbox\n\n\n\n#endif\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/network/published_socket_connector.h", "rank": 57, "score": 138218.00647272263 }, { "content": "class TcpSocketConnector : public DoNotCopyOrMove, public Connector {\n\n public:\n\n explicit TcpSocketConnector(\n\n const boost::asio::ip::address_v4 &address, unsigned short port,\n\n const std::shared_ptr<Runtime> &rt,\n\n const std::shared_ptr<ConnectionCreator<boost::asio::ip::tcp>>\n\n &connection_creator);\n\n ~TcpSocketConnector() noexcept;\n\n\n\n unsigned short port() const { return port_; }\n\n\n\n private:\n\n void start_accept();\n\n void on_new_connection(\n\n std::shared_ptr<boost::asio::ip::tcp::socket> const &socket,\n\n boost::system::error_code const &err);\n\n\n\n boost::asio::ip::address_v4 address_;\n\n unsigned short port_;\n\n std::shared_ptr<Runtime> runtime_;\n\n std::shared_ptr<ConnectionCreator<boost::asio::ip::tcp>> connection_creator_;\n\n boost::asio::ip::tcp::acceptor acceptor_;\n\n};\n\n} // namespace network\n\n} // namespace anbox\n\n\n\n#endif\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/network/tcp_socket_connector.h", "rank": 58, "score": 138218.00647272263 }, { "content": "struct RendererWindow;\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/graphics/emugl/Renderer.h", "rank": 59, "score": 138161.44193990383 }, { "content": "struct FuncDelete {\n\n explicit FuncDelete(Func f = {}) : mF(f) {}\n\n\n\n FuncDelete(const FuncDelete& other) = default;\n\n FuncDelete(FuncDelete&& other) = default;\n\n FuncDelete& operator=(const FuncDelete& other) = default;\n\n FuncDelete& operator=(FuncDelete&& other) = default;\n\n\n\n // To be able to copy/move from all compatible template instantiations.\n\n template <class U>\n\n friend struct FuncDelete;\n\n\n\n // Template constructors and move assignment from compatible instantiations.\n\n template <class U>\n\n FuncDelete(const FuncDelete<U>& other) : mF(other.mF) {}\n\n template <class U>\n\n FuncDelete(FuncDelete<U>&& other) : mF(std::move(other.mF)) {}\n\n template <class U>\n\n FuncDelete& operator=(const FuncDelete<U>& other) {\n\n mF = other.mF;\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/common/scope_ptr.h", "rank": 60, "score": 138161.44193990383 }, { "content": "struct IntOwnedFd {\n\n int int_owned_fd;\n\n};\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/common/fd.h", "rank": 61, "score": 138161.44193990383 }, { "content": "// A structure used to list the capabilities of the underlying EGL\n\n// implementation that the FrameBuffer instance depends on.\n\n// |has_eglimage_texture_2d| is true iff the EGL_KHR_gl_texture_2D_image\n\n// extension is supported.\n\n// |has_eglimage_renderbuffer| is true iff the EGL_KHR_gl_renderbuffer_image\n\n// extension is supported.\n\n// |eglMajor| and |eglMinor| are the major and minor version numbers of\n\n// the underlying EGL implementation.\n\nstruct RendererCaps {\n\n bool has_eglimage_texture_2d;\n\n bool has_eglimage_renderbuffer;\n\n EGLint eglMajor;\n\n EGLint eglMinor;\n\n};\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/graphics/emugl/Renderer.h", "rank": 62, "score": 138161.44193990383 }, { "content": "struct default_delete {\n\n\tvoid operator()(T& ptr) const {\n\n\t\tdelete ptr;\n\n\t}\n\n};\n\n\n\ntemplate <typename T, typename Deleter = deleter<void, void*, &::free> >\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/backward-cpp/backward.hpp", "rank": 63, "score": 138161.44193990383 }, { "content": "struct demangler_impl {\n\n\tstatic std::string demangle(const char* funcname) {\n\n\t\treturn funcname;\n\n\t}\n\n};\n\n\n\n#if defined(BACKWARD_SYSTEM_LINUX) || defined(BACKWARD_SYSTEM_DARWIN)\n\n\n\ntemplate <>\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/backward-cpp/backward.hpp", "rank": 64, "score": 138161.44193990383 }, { "content": "struct FreeDelete {\n\n template <class T>\n\n void operator()(T ptr) const {\n\n free(ptr);\n\n }\n\n};\n\n\n\ntemplate <class Func>\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/common/scope_ptr.h", "rank": 65, "score": 138161.44193990383 }, { "content": "struct audio_module HAL_MODULE_INFO_SYM = {\n\n .common = {\n\n .tag = HARDWARE_MODULE_TAG,\n\n .module_api_version = AUDIO_MODULE_API_VERSION_0_1,\n\n .hal_api_version = HARDWARE_HAL_API_VERSION,\n\n .id = AUDIO_HARDWARE_MODULE_ID,\n\n .name = \"Anbox audio HW HAL\",\n\n .author = \"The Android Open Source Project\",\n\n .methods = &hal_module_methods,\n\n },\n\n};\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/audio/audio_hw.cpp", "rank": 66, "score": 137724.18876417686 }, { "content": "struct ColorBufferRef {\n\n ColorBufferPtr cb;\n\n uint32_t refcount; // number of client-side references\n\n};\n\ntypedef std::map<HandleType, RenderContextPtr> RenderContextMap;\n\ntypedef std::map<HandleType, std::pair<WindowSurfacePtr, HandleType>>\n\n WindowSurfaceMap;\n\ntypedef std::map<HandleType, ColorBufferRef> ColorBufferMap;\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/graphics/emugl/Renderer.h", "rank": 67, "score": 136792.78377713138 }, { "content": "// Hard-coded arrays of vertex information.\n\nstruct Vertex {\n\n float pos[3];\n\n float coord[2];\n\n};\n\n\n\nconst Vertex kVertices[] = {\n\n {{+1, -1, +0}, {+1, +1}},\n\n {{+1, +1, +0}, {+1, +0}},\n\n {{-1, +1, +0}, {+0, +0}},\n\n {{-1, -1, +0}, {+0, +1}},\n\n};\n\n\n\nconst GLubyte kIndices[] = {0, 1, 2, 2, 3, 0};\n\nconst GLint kIndicesLen = sizeof(kIndices) / sizeof(kIndices[0]);\n\n\n\n} // namespace\n\n\n\nTextureDraw::TextureDraw(EGLDisplay)\n\n : mVertexShader(0),\n\n mFragmentShader(0),\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/graphics/emugl/TextureDraw.cpp", "rank": 68, "score": 136792.78377713138 }, { "content": "struct TestBase {\n\n\tconst char* name;\n\n\tTestStatus expected_status;\n\n\n\n\tvirtual ~TestBase() {}\n\n\tTestBase(const char*, TestStatus);\n\n\tvirtual void do_test() = 0;\n\n\n\n\tTestStatus run() {\n\n\t\ttry {\n\n\t\t\tdo_test();\n\n\t\t\treturn SUCCESS;\n\n\t\t} catch(const AssertFailedError& e) {\n\n\t\t\tprintf(\"!! %s\\n\", e.what());\n\n\t\t\treturn ASSERT_FAIL;\n\n\t\t} catch(const std::exception& e) {\n\n\t\t\tprintf(\"!! exception: %s\\n\", e.what());\n\n\t\t\treturn EXCEPTION_UNCAUGHT;\n\n\t\t} catch(...) {\n\n\t\t\tprintf(\"!! unknown exception\\n\");\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/backward-cpp/test/test.hpp", "rank": 69, "score": 136792.78377713138 }, { "content": "struct result_ptr_t {\n\n typedef ::google::protobuf::MessageLite* type;\n\n};\n\n\n\n// Boiler plate for unpacking a parameter message, invoking a server function,\n\n// and\n\n// sending the result message. Assumes the existence of Self::send_response().\n\ntemplate <class Self, class Bridge, class BridgeX, class ParameterMessage,\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/rpc/template_message_processor.h", "rank": 70, "score": 136792.78377713138 }, { "content": "struct RendererWindow {\n\n EGLNativeWindowType native_window = 0;\n\n EGLSurface surface = EGL_NO_SURFACE;\n\n anbox::graphics::Rect viewport;\n\n glm::mat4 screen_to_gl_coords = glm::mat4(1.0f);\n\n glm::mat4 display_transform = glm::mat4(1.0f);\n\n};\n\n\n\nRendererWindow *Renderer::createNativeWindow(\n\n EGLNativeWindowType native_window) {\n\n m_lock.lock();\n\n\n\n auto window = new RendererWindow;\n\n window->native_window = native_window;\n\n window->surface = s_egl.eglCreateWindowSurface(\n\n m_eglDisplay, m_eglConfig, window->native_window, nullptr);\n\n if (window->surface == EGL_NO_SURFACE) {\n\n delete window;\n\n m_lock.unlock();\n\n return nullptr;\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/graphics/emugl/Renderer.cpp", "rank": 71, "score": 136792.78377713138 }, { "content": "struct private_module_t HAL_MODULE_INFO_SYM = {\n\n base: {\n\n common: {\n\n tag: HARDWARE_MODULE_TAG,\n\n module_api_version: GRALLOC_MODULE_API_VERSION_0_2,\n\n hal_api_version: 0,\n\n id: GRALLOC_HARDWARE_MODULE_ID,\n\n name: \"Graphics Memory Allocator Module\",\n\n author: \"The Android Open Source Project\",\n\n methods: &gralloc_module_methods,\n\n dso: NULL,\n\n reserved: {0, }\n\n },\n\n registerBuffer: gralloc_register_buffer,\n\n unregisterBuffer: gralloc_unregister_buffer,\n\n lock: gralloc_lock,\n\n unlock: gralloc_unlock,\n\n perform: NULL,\n\n lock_ycbcr: gralloc_lock_ycbcr,\n\n }\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/system/gralloc/gralloc.cpp", "rank": 72, "score": 136606.49344355502 }, { "content": " class WorkerThread : public Thread {\n\n\n\n /****************************************************************************\n\n * Public API\n\n ***************************************************************************/\n\n\n\n public:\n\n inline explicit WorkerThread(EmulatedCameraDevice* camera_dev)\n\n : Thread(true), // Callbacks may involve Java calls.\n\n mCameraDevice(camera_dev),\n\n mThreadControl(-1),\n\n mControlFD(-1)\n\n {\n\n }\n\n\n\n inline ~WorkerThread()\n\n {\n\n ALOGW_IF(mThreadControl >= 0 || mControlFD >= 0,\n\n \"%s: Control FDs are opened in the destructor\",\n\n __FUNCTION__);\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/camera/EmulatedCameraDevice.h", "rank": 73, "score": 135497.34025889696 }, { "content": " // 3A management thread (auto-exposure, focus, white balance)\n\n class ControlThread: public Thread {\n\n public:\n\n ControlThread(EmulatedFakeCamera2 *parent);\n\n ~ControlThread();\n\n\n\n status_t readyToRun();\n\n\n\n status_t waitUntilRunning();\n\n\n\n // Interpret request's control parameters and override\n\n // capture settings as needed\n\n status_t processRequest(camera_metadata_t *request);\n\n\n\n status_t triggerAction(uint32_t msgType,\n\n int32_t ext1, int32_t ext2);\n\n private:\n\n ControlThread(const ControlThread &t);\n\n ControlThread& operator=(const ControlThread &t);\n\n\n\n // Constants controlling fake 3A behavior\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/camera/EmulatedFakeCamera2.h", "rank": 74, "score": 135497.34025889696 }, { "content": " class ConfigureThread: public Thread {\n\n public:\n\n ConfigureThread(EmulatedFakeCamera2 *parent);\n\n ~ConfigureThread();\n\n\n\n status_t waitUntilRunning();\n\n status_t newRequestAvailable();\n\n status_t readyToRun();\n\n\n\n bool isStreamInUse(uint32_t id);\n\n int getInProgressCount();\n\n private:\n\n EmulatedFakeCamera2 *mParent;\n\n static const nsecs_t kWaitPerLoop = 10000000L; // 10 ms\n\n\n\n bool mRunning;\n\n bool threadLoop();\n\n\n\n bool setupCapture();\n\n bool setupReprocess();\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/camera/EmulatedFakeCamera2.h", "rank": 75, "score": 135497.34025889696 }, { "content": "class IPlatformService : public IInterface {\n\npublic:\n\n DECLARE_META_INTERFACE(PlatformService);\n\n\n\n enum {\n\n // Keep this synchronized with frameworks/base/services/java/com/android/server/wm/AnboxPlatformServiceProxy.java\n\n BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION,\n\n UPDATE_WINDOW_STATE = IBinder::FIRST_CALL_TRANSACTION + 1,\n\n UPDATE_APPLICATION_LIST = IBinder::FIRST_CALL_TRANSACTION + 2,\n\n SET_CLIPBOARD_DATA = IBinder::FIRST_CALL_TRANSACTION + 3,\n\n GET_CLIPBOARD_DATA = IBinder::FIRST_CALL_TRANSACTION + 4,\n\n };\n\n\n\n virtual status_t boot_finished() = 0;\n\n virtual status_t update_window_state(const Parcel &data) = 0;\n\n virtual status_t update_application_list(const Parcel &data) = 0;\n\n virtual status_t set_clipboard_data(const Parcel &data) = 0;\n\n virtual status_t get_clipboard_data(const Parcel &data, Parcel *reply) = 0;\n\n};\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/service/platform_service_interface.h", "rank": 76, "score": 135497.34025889696 }, { "content": "class IActivityManager : public IInterface {\n\npublic:\n\n DECLARE_META_INTERFACE(ActivityManager);\n\n\n\n enum {\n\n // This needs to stay synchronized with frameworks/base/core/java/android/app/IActivityManager.java\n\n SET_FOCUSED_TASK = IBinder::FIRST_CALL_TRANSACTION + 130,\n\n REMOVE_TASK = IBinder::FIRST_CALL_TRANSACTION + 131,\n\n RESIZE_TASK = IBinder::FIRST_CALL_TRANSACTION + 285,\n\n };\n\n\n\n virtual status_t setFocusedTask(int32_t id) = 0;\n\n virtual status_t removeTask(int32_t id) = 0;\n\n virtual status_t resizeTask(int32_t id, const anbox::graphics::Rect &rect, int resize_mode) = 0;\n\n};\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/service/activity_manager_interface.h", "rank": 77, "score": 135497.34025889696 }, { "content": "class CameraQemuClient : public QemuClient {\n\npublic:\n\n /* Constructs CameraQemuClient instance. */\n\n CameraQemuClient();\n\n\n\n /* Destructs CameraQemuClient instance. */\n\n ~CameraQemuClient();\n\n\n\n /****************************************************************************\n\n * Public API\n\n ***************************************************************************/\n\n\n\npublic:\n\n /* Queries camera connection.\n\n * Return:\n\n * NO_ERROR on success, or an appropriate error status on failure.\n\n */\n\n status_t queryConnect();\n\n\n\n /* Queries camera disconnection.\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/camera/QemuClient.h", "rank": 78, "score": 134330.6907576609 }, { "content": "class PlatformService : public BnPlatformService {\n\npublic:\n\n static const char* service_name() { return \"org.anbox.PlatformService\"; }\n\n\n\n PlatformService(const std::shared_ptr<anbox::PlatformApiStub> &platform_api_stub);\n\n\n\n status_t boot_finished() override;\n\n status_t update_window_state(const Parcel &data) override;\n\n status_t update_application_list(const Parcel &data) override;\n\n status_t set_clipboard_data(const Parcel &data) override;\n\n status_t get_clipboard_data(const Parcel &data, Parcel *reply) override;\n\n\n\nprivate:\n\n anbox::PlatformApiStub::WindowStateUpdate::Window unpack_window_state(const Parcel &data);\n\n std::shared_ptr<anbox::PlatformApiStub> platform_api_stub_;\n\n};\n\n} // namespace android\n\n\n\n#endif\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/service/platform_service.h", "rank": 79, "score": 134330.6907576609 }, { "content": "class FactoryQemuClient : public QemuClient {\n\npublic:\n\n /* Constructs FactoryQemuClient instance. */\n\n FactoryQemuClient();\n\n\n\n /* Destructs FactoryQemuClient instance. */\n\n ~FactoryQemuClient();\n\n\n\n /****************************************************************************\n\n * Public API\n\n ***************************************************************************/\n\n\n\npublic:\n\n /* Lists camera devices connected to the host.\n\n * Param:\n\n * list - Upon success contains a list of cameras connected to the host. The\n\n * list returned here is represented as a string, containing multiple\n\n * lines separated with '\\n', where each line represents a camera. Each\n\n * camera line is formatted as such:\n\n *\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/camera/QemuClient.h", "rank": 80, "score": 134330.6907576609 }, { "content": "struct Features {\n\n bool a = false;\n\n bool b = false;\n\n bool c = false;\n\n};\n\n\n\nDECLARE_SETTER(Features, a)\n\nDECLARE_SETTER(Features, b)\n\nDECLARE_SETTER(Features, c)\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/cpu_features/test/linux_features_aggregator_test.cc", "rank": 81, "score": 134160.6940581074 }, { "content": "class EmulatedFakeCamera2 : public EmulatedCamera2 {\n\npublic:\n\n /* Constructs EmulatedFakeCamera instance. */\n\n EmulatedFakeCamera2(int cameraId, bool facingBack, struct hw_module_t* module);\n\n\n\n /* Destructs EmulatedFakeCamera instance. */\n\n ~EmulatedFakeCamera2();\n\n\n\n /****************************************************************************\n\n * EmulatedCamera2 virtual overrides.\n\n ***************************************************************************/\n\n\n\npublic:\n\n /* Initializes EmulatedFakeCamera2 instance. */\n\n status_t Initialize();\n\n\n\n /****************************************************************************\n\n * Camera Module API and generic hardware device API implementation\n\n ***************************************************************************/\n\npublic:\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/camera/EmulatedFakeCamera2.h", "rank": 82, "score": 133189.26535392334 }, { "content": "class EmulatedQemuCamera2 : public EmulatedCamera2 {\n\npublic:\n\n /* Constructs EmulatedFakeCamera instance. */\n\n EmulatedQemuCamera2(int cameraId, bool facingBack, struct hw_module_t* module);\n\n\n\n /* Destructs EmulatedFakeCamera instance. */\n\n ~EmulatedQemuCamera2();\n\n\n\n /****************************************************************************\n\n * EmulatedCamera2 virtual overrides.\n\n ***************************************************************************/\n\n\n\npublic:\n\n /* Initializes EmulatedQemuCamera2 instance. */\n\n status_t Initialize();\n\n\n\n /****************************************************************************\n\n * EmulatedCamera abstract API implementation.\n\n ***************************************************************************/\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/camera/EmulatedQemuCamera2.h", "rank": 83, "score": 133189.26535392334 }, { "content": "class EmulatedQemuCamera : public EmulatedCamera {\n\npublic:\n\n /* Constructs EmulatedQemuCamera instance. */\n\n EmulatedQemuCamera(int cameraId, struct hw_module_t* module);\n\n\n\n /* Destructs EmulatedQemuCamera instance. */\n\n ~EmulatedQemuCamera();\n\n\n\n /***************************************************************************\n\n * EmulatedCamera virtual overrides.\n\n **************************************************************************/\n\n\n\npublic:\n\n /* Initializes EmulatedQemuCamera instance. */\n\n status_t Initialize(const char* device_name,\n\n const char* frame_dims,\n\n const char* facing_dir);\n\n\n\n /***************************************************************************\n\n * EmulatedCamera abstract API implementation.\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/camera/EmulatedQemuCamera.h", "rank": 84, "score": 133189.26535392334 }, { "content": "class EmulatedFakeCamera : public EmulatedCamera {\n\npublic:\n\n /* Constructs EmulatedFakeCamera instance. */\n\n EmulatedFakeCamera(int cameraId, bool facingBack, struct hw_module_t* module);\n\n\n\n /* Destructs EmulatedFakeCamera instance. */\n\n ~EmulatedFakeCamera();\n\n\n\n /****************************************************************************\n\n * EmulatedCamera virtual overrides.\n\n ***************************************************************************/\n\n\n\npublic:\n\n /* Initializes EmulatedFakeCamera instance. */\n\n status_t Initialize();\n\n\n\n /****************************************************************************\n\n * EmulatedCamera abstract API implementation.\n\n ***************************************************************************/\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/camera/EmulatedFakeCamera.h", "rank": 85, "score": 133189.26535392334 }, { "content": "class EmulatedFakeCamera3 : public EmulatedCamera3,\n\n private Sensor::SensorListener {\n\npublic:\n\n\n\n EmulatedFakeCamera3(int cameraId, bool facingBack,\n\n struct hw_module_t* module);\n\n\n\n virtual ~EmulatedFakeCamera3();\n\n\n\n /****************************************************************************\n\n * EmulatedCamera3 virtual overrides\n\n ***************************************************************************/\n\n\n\npublic:\n\n\n\n virtual status_t Initialize();\n\n\n\n /****************************************************************************\n\n * Camera module API and generic hardware device API implementation\n\n ***************************************************************************/\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/camera/EmulatedFakeCamera3.h", "rank": 86, "score": 133189.26535392334 }, { "content": "class EmulatedCameraHotplugThread : public Thread {\n\n public:\n\n EmulatedCameraHotplugThread(const int* cameraIdArray, size_t size);\n\n ~EmulatedCameraHotplugThread();\n\n\n\n virtual void requestExit();\n\n virtual status_t requestExitAndWait();\n\n\n\n private:\n\n\n\n\n\n virtual status_t readyToRun();\n\n virtual bool threadLoop();\n\n\n\n struct SubscriberInfo {\n\n int CameraID;\n\n int WatchID;\n\n };\n\n\n\n bool addWatch(int cameraId);\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/camera/EmulatedCameraHotplugThread.h", "rank": 87, "score": 132072.21884410054 }, { "content": "class Window : public std::enable_shared_from_this<Window>, public wm::Window {\n\n public:\n\n typedef std::int32_t Id;\n\n static Id Invalid;\n\n\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/platform/sdl/window.h", "rank": 88, "score": 131499.99304664764 }, { "content": "class MessageProcessor : public rpc::MessageProcessor {\n\npublic:\n\n MessageProcessor(const std::shared_ptr<network::MessageSender> &sender,\n\n const std::shared_ptr<rpc::PendingCallCache> &pending_calls,\n\n const std::shared_ptr<AndroidApiSkeleton> &platform_api);\n\n ~MessageProcessor();\n\n\n\n void dispatch(rpc::Invocation const& invocation) override;\n\n void process_event_sequence(const std::string &event) override;\n\n\n\nprivate:\n\n std::shared_ptr<AndroidApiSkeleton> platform_api_;\n\n};\n\n} // namespace network\n\n\n\n#endif\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/service/message_processor.h", "rank": 89, "score": 131131.45035466045 }, { "content": "class TcpStream : public SocketStream {\n\npublic:\n\n explicit TcpStream(size_t bufsize = 10000);\n\n virtual int listen(unsigned short port);\n\n virtual SocketStream *accept();\n\n virtual int connect(unsigned short port);\n\n int connect(const char* hostname, unsigned short port);\n\nprivate:\n\n TcpStream(int sock, size_t bufSize);\n\n};\n\n\n\n#endif\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/shared/OpenglCodecCommon/TcpStream.h", "rank": 90, "score": 130978.74464878492 }, { "content": "class AndroidApiStub : public anbox::application::Manager {\n\n public:\n\n AndroidApiStub();\n\n ~AndroidApiStub();\n\n\n\n void set_rpc_channel(const std::shared_ptr<rpc::Channel> &channel);\n\n void reset_rpc_channel();\n\n\n\n void set_focused_task(const std::int32_t &id);\n\n void remove_task(const std::int32_t &id);\n\n void resize_task(const std::int32_t &id, const anbox::graphics::Rect &rect,\n\n const std::int32_t &resize_mode);\n\n\n\n void launch(const android::Intent &intent,\n\n const graphics::Rect &launch_bounds = graphics::Rect::Invalid,\n\n const wm::Stack::Id &stack = wm::Stack::Id::Default) override;\n\n\n\n core::Property<bool>& ready() override;\n\n\n\n private:\n", "file_path": "src/type3_AndroidCloud/anbox-master/src/anbox/bridge/android_api_stub.h", "rank": 91, "score": 130734.100405643 }, { "content": "class PodVector : public PodVectorBase {\n\npublic:\n\n // Default constructor for an empty PodVector<T>\n\n PodVector() : PodVectorBase() {}\n\n\n\n // Copy constructor. This copies all items from |other| into\n\n // the new instance with ::memmove().\n\n PodVector(const PodVector& other) : PodVectorBase(other) {}\n\n\n\n // Assignment operator.\n\n PodVector& operator=(const PodVector& other) {\n\n this->assignFrom(other);\n\n return *this;\n\n }\n\n\n\n // Destructor, this simply releases the internal storage block that\n\n // holds all the items, but doesn't touch them otherwise.\n\n ~PodVector() {}\n\n\n\n // Return true iff the PodVector<T> instance is empty, i.e. does not\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/android-emugl/shared/emugl/common/pod_vector.h", "rank": 92, "score": 129908.07257721908 }, { "content": "class EmulatedFakeCameraDevice : public EmulatedCameraDevice {\n\npublic:\n\n /* Constructs EmulatedFakeCameraDevice instance. */\n\n explicit EmulatedFakeCameraDevice(EmulatedFakeCamera* camera_hal);\n\n\n\n /* Destructs EmulatedFakeCameraDevice instance. */\n\n ~EmulatedFakeCameraDevice();\n\n\n\n /***************************************************************************\n\n * Emulated camera device abstract interface implementation.\n\n * See declarations of these methods in EmulatedCameraDevice class for\n\n * information on each of these methods.\n\n **************************************************************************/\n\n\n\npublic:\n\n /* Connects to the camera device.\n\n * Since there is no real device to connect to, this method does nothing,\n\n * but changes the state.\n\n */\n\n status_t connectDevice();\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/camera/EmulatedFakeCameraDevice.h", "rank": 93, "score": 129908.07257721908 }, { "content": "class MessageChannel : public MessageChannelBase {\n\npublic:\n\n MessageChannel() : MessageChannelBase(CAPACITY) {}\n\n\n\n void send(const T& msg) {\n\n size_t pos = beforeWrite();\n\n mItems[pos] = msg;\n\n afterWrite();\n\n }\n\n\n\n void receive(T* msg) {\n\n size_t pos = beforeRead();\n\n *msg = mItems[pos];\n\n afterRead();\n\n }\n\n\n\nprivate:\n\n T mItems[CAPACITY];\n\n};\n\n\n\n} // namespace emugl\n\n\n\n#endif // EMUGL_COMMON_MESSAGE_CHANNEL_H\n", "file_path": "src/type3_AndroidCloud/anbox-master/external/android-emugl/shared/emugl/common/message_channel.h", "rank": 94, "score": 129908.07257721908 }, { "content": "class GL2Encoder : public gl2_encoder_context_t {\n\npublic:\n\n GL2Encoder(IOStream *stream, ChecksumCalculator* protocol);\n\n virtual ~GL2Encoder();\n\n void setClientState(GLClientState *state) {\n\n m_state = state;\n\n }\n\n void setSharedGroup(GLSharedGroupPtr shared){ m_shared = shared; }\n\n const GLClientState *state() { return m_state; }\n\n const GLSharedGroupPtr shared() { return m_shared; }\n\n void flush() { m_stream->flush(); }\n\n\n\n void setInitialized(){ m_initialized = true; };\n\n bool isInitialized(){ return m_initialized; };\n\n\n\n virtual void setError(GLenum error){ m_error = error; };\n\n virtual GLenum getError() { return m_error; };\n\n\n\n void override2DTextureTarget(GLenum target);\n\n void restore2DTextureTarget();\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/system/GLESv2_enc/GL2Encoder.h", "rank": 95, "score": 129908.07257721908 }, { "content": "class EmulatedQemuCameraDevice : public EmulatedCameraDevice {\n\npublic:\n\n /* Constructs EmulatedQemuCameraDevice instance. */\n\n explicit EmulatedQemuCameraDevice(EmulatedQemuCamera* camera_hal);\n\n\n\n /* Destructs EmulatedQemuCameraDevice instance. */\n\n ~EmulatedQemuCameraDevice();\n\n\n\n /***************************************************************************\n\n * Public API\n\n **************************************************************************/\n\n\n\npublic:\n\n /* Initializes EmulatedQemuCameraDevice instance.\n\n * Param:\n\n * device_name - Name of the camera device connected to the host. The name\n\n * that is used here must have been reported by the 'factory' camera\n\n * service when it listed camera devices connected to the host.\n\n * Return:\n\n * NO_ERROR on success, or an appropriate error status.\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/camera/EmulatedQemuCameraDevice.h", "rank": 96, "score": 129908.07257721908 }, { "content": "class GLEncoder : public gl_encoder_context_t {\n\n\n\npublic:\n\n GLEncoder(IOStream *stream, ChecksumCalculator* protocol);\n\n virtual ~GLEncoder();\n\n void setClientState(GLClientState *state) {\n\n m_state = state;\n\n }\n\n void setSharedGroup(GLSharedGroupPtr shared) { m_shared = shared; }\n\n void flush() { m_stream->flush(); }\n\n size_t pixelDataSize(GLsizei width, GLsizei height, GLenum format, GLenum type, int pack);\n\n\n\n void setInitialized(){ m_initialized = true; };\n\n bool isInitialized(){ return m_initialized; };\n\n\n\n virtual void setError(GLenum error){ m_error = error; };\n\n virtual GLenum getError() { return m_error; };\n\n\n\n void override2DTextureTarget(GLenum target);\n\n void restore2DTextureTarget();\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/opengl/system/GLESv1_enc/GLEncoder.h", "rank": 97, "score": 129908.07257721908 }, { "content": "struct hw_module_methods_t EmulatedCameraFactory::mCameraModuleMethods = {\n\n open: EmulatedCameraFactory::device_open\n\n};\n\n\n\n}; /* namespace android */\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/camera/EmulatedCameraFactory.cpp", "rank": 98, "score": 128955.11722247464 }, { "content": "class LocalSocketConnection : public network::MessageSender {\n\npublic:\n\n LocalSocketConnection(const std::string &path);\n\n ~LocalSocketConnection();\n\n\n\n ssize_t read_all(std::uint8_t *buffer, const size_t &size);\n\n void send(char const* data, size_t length) override;\n\n ssize_t send_raw(char const* data, size_t length) override;\n\n\n\nprivate:\n\n Fd fd_;\n\n};\n\n} // namespace anbox\n\n\n\n#endif\n", "file_path": "src/type3_AndroidCloud/anbox-master/android/service/local_socket_connection.h", "rank": 99, "score": 128872.97844110007 } ]
C++
gmsh/Mesh/meshGRegionCarveHole.cpp
Poofee/fastFEM
14eb626df973e2123604041451912c867ab7188c
#include <set> #include "GmshConfig.h" #include "GmshMessage.h" #include "GModel.h" #include "MTriangle.h" #include "MQuadrangle.h" #include "MTetrahedron.h" #include "MHexahedron.h" #include "MPrism.h" #include "MPyramid.h" #if !defined(HAVE_ANN) void carveHole(GRegion *gr, int num, double distance, std::vector<int> &surfaces) { Msg::Error("Gmsh must be compiled with ANN support to carve holes in meshes"); } #else #include "ANN/ANN.h" template <class T> void carveHole(std::vector<T *> &elements, double distance, ANNkd_tree *kdtree) { ANNidxArray index = new ANNidx[1]; ANNdistArray dist = new ANNdist[1]; std::vector<T *> temp; for(std::size_t i = 0; i < elements.size(); i++) { for(std::size_t j = 0; j < elements[i]->getNumVertices(); j++) { MVertex *v = elements[i]->getVertex(j); double xyz[3] = {v->x(), v->y(), v->z()}; kdtree->annkSearch(xyz, 1, index, dist); double d = std::sqrt(dist[0]); if(d < distance) { delete elements[i]; break; } else if(j == elements[i]->getNumVertices() - 1) { temp.push_back(elements[i]); } } } elements = temp; delete[] index; delete[] dist; } template <class T> void addFaces(std::vector<T *> &elements, std::set<MFace, Less_Face> &faces) { for(std::size_t i = 0; i < elements.size(); i++) { for(int j = 0; j < elements[i]->getNumFaces(); j++) { MFace f = elements[i]->getFace(j); std::set<MFace, Less_Face>::iterator it = faces.find(f); if(it == faces.end()) faces.insert(f); else faces.erase(it); } } } void carveHole(GRegion *gr, int num, double distance, std::vector<int> &surfaces) { Msg::Info("Carving hole %d from surface %d at distance %g", num, surfaces[0], distance); GModel *m = gr->model(); int numnodes = 0; for(std::size_t i = 0; i < surfaces.size(); i++) { GFace *gf = m->getFaceByTag(surfaces[i]); if(!gf) { Msg::Error("Unknown carving surface %d", surfaces[i]); return; } numnodes += gf->mesh_vertices.size(); } ANNpointArray kdnodes = annAllocPts(numnodes, 3); int k = 0; for(std::size_t i = 0; i < surfaces.size(); i++) { GFace *gf = m->getFaceByTag(surfaces[i]); for(std::size_t j = 0; j < gf->mesh_vertices.size(); j++) { kdnodes[k][0] = gf->mesh_vertices[j]->x(); kdnodes[k][1] = gf->mesh_vertices[j]->y(); kdnodes[k][2] = gf->mesh_vertices[j]->z(); k++; } } ANNkd_tree *kdtree = new ANNkd_tree(kdnodes, numnodes, 3); carveHole(gr->tetrahedra, distance, kdtree); carveHole(gr->hexahedra, distance, kdtree); carveHole(gr->prisms, distance, kdtree); carveHole(gr->pyramids, distance, kdtree); delete kdtree; annDeallocPts(kdnodes); GFace *gf = m->getFaceByTag(num); if(!gf) return; std::set<MFace, Less_Face> faces; std::vector<GFace *> f = gr->faces(); for(std::vector<GFace *>::iterator it = f.begin(); it != f.end(); it++) { addFaces((*it)->triangles, faces); addFaces((*it)->quadrangles, faces); } addFaces(gr->tetrahedra, faces); addFaces(gr->hexahedra, faces); addFaces(gr->prisms, faces); addFaces(gr->pyramids, faces); std::set<MVertex *> verts; for(std::set<MFace, Less_Face>::iterator it = faces.begin(); it != faces.end(); it++) { for(std::size_t i = 0; i < it->getNumVertices(); i++) { it->getVertex(i)->setEntity(gf); verts.insert(it->getVertex(i)); } if(it->getNumVertices() == 3) gf->triangles.push_back( new MTriangle(it->getVertex(0), it->getVertex(1), it->getVertex(2))); else if(it->getNumVertices() == 4) gf->quadrangles.push_back( new MQuadrangle(it->getVertex(0), it->getVertex(1), it->getVertex(2), it->getVertex(3))); } } #endif
#include <set> #include "GmshConfig.h" #include "GmshMessage.h" #include "GModel.h" #include "MTriangle.h" #include "MQuadrangle.h" #include "MTetrahedron.h" #include "MHexahedron.h" #include "MPrism.h" #include "MPyramid.h" #if !defined(HAVE_ANN) void carveHole(GRegion *gr, int num, double distance, std::vector<int> &surfaces) { Msg::Error("Gmsh must be compiled with ANN support to carve holes in meshes"); } #else #include "ANN/ANN.h" template <class T> void carveHole(std::vector<T *> &elements, double distance, ANNkd_tree *kdtree) { ANNidxArray index = new ANNidx[1]; ANNdistArray dist = new ANNdist[1]; std::vector<T *> temp; for(std::size_t i = 0; i < elements.size(); i++) { for(std::size_t j = 0; j < elements[i]->getNumVertices(); j++) { MVertex *v = elements[i]->getVertex(j); double xyz[3] = {v->x(), v->y(), v->z()}; kdtree->annkSearch(xyz, 1, index, dist); double d = std::sqrt(dist[0]); if(d < distance) { delete elements[i]; break; } else if(j == elements[i]->getNumVertices() - 1) { temp.push_back(elements[i]); } } } elements = temp; delete[] index; delete[] dist; } template <class T> void addFaces(std::vector<T *> &elements, std::set<MFace, Less_Face> &faces) { for(std::size_t i = 0; i < elements.size(); i++) { for(int j = 0; j < elements[i]->getNumFaces(); j++) { MFace f = elements[i]->getFace(j); std::set<MFace, Less_Face>::iterator it = faces.find(f); if(it == faces.end()) faces.insert(f); else faces.erase(it); } } } void carveHole(GRegion *gr, int num, double distance, std::vector<int> &surfaces) { Msg::Info("Carving hole %d from surface %d at distance %g", num, surfaces[0], distance); GModel *m = gr->model(); int numnodes = 0; for(std::size_t i = 0; i < surfaces.size(); i++) { GFace *gf = m->getFaceByTag(surfaces[i]); if(!gf) { Msg::Error("Unknown carving surface %d", surfaces[i]); return; } numnodes += gf->mesh_vertices.size(); } ANNpointArray kdnodes = annAllocPts(numnodes, 3); int k = 0; for(std::size_t i = 0; i < surfaces.size(); i++) { GFace *gf = m->getFaceByTag(surfaces[i]); for(std::size_t j = 0; j < gf->mesh_vertices.size(); j++) { kdnodes[k][0] = gf->mesh_vertices[j]->x(); kdnodes[k][1] = gf->mesh_vertices[j]->y(); kdnodes[k][2] = gf->mesh_vertices[j]->z(); k++; } } ANNkd_tree *kdtree = new ANNkd_tree(kdnodes, numnodes, 3); carveHole(gr->tetrahedra, distance, kdtree); carveHole(gr->hexahedra, distance, kdtree); carveHole(gr->prisms, distance, kdtree); carveHole(gr->pyramids, distance, kdtree); delete kdtree; annDeallocPts(kdnodes); GFace *gf = m->getFaceByTag(num); if(!gf) return; std::set<MFace, Less_Face> faces; std::vector<GFace *> f = gr->faces(); for(std::vector<GFace *>::iterator it = f.begin(); it != f.end(); it++) { addFaces((*it)->triangles, faces); addFaces((*it)->quadrangles, faces); } addFaces(gr->tetrahedra, faces); addFaces(gr->hexahedra, faces); addFaces(gr->prisms, faces); addFaces(gr->pyramids, faces); std::set<MVertex *> verts; for(std::set<MFace, Less_Face>::iterator it = faces.begin(); it != faces.end(); it++) { for(std::size_t i = 0; i < it->getNumVertices(); i++) { it->getVertex(i)->setEntity(gf); verts.insert(it->getVertex(i)); } if(it->getNumVertices() == 3) gf->triangles.push_back( new MTriangle(it->getVertex(0), it->getVertex(1), it->getVertex(2))); else if(it->getNumVertices() == 4)
; } } #endif
gf->quadrangles.push_back( new MQuadrangle(it->getVertex(0), it->getVertex(1), it->getVertex(2), it->getVertex(3)))
call_expression
[ { "content": "class GFace;\n", "file_path": "gmsh/Mesh/meshGFace.h", "rank": 0, "score": 346488.86100550985 }, { "content": "class GFace;\n\n\n\nvoid meshGFaceBamg(GFace *gf);\n\n\n\n#endif\n", "file_path": "gmsh/Mesh/meshGFaceBamg.h", "rank": 1, "score": 339593.6655204776 }, { "content": "class GFace;\n", "file_path": "gmsh/Mesh/meshGFaceBDS.h", "rank": 2, "score": 339593.6655204776 }, { "content": "class GFace;\n", "file_path": "gmsh/Mesh/meshGFaceOptimize.h", "rank": 3, "score": 339593.6655204776 }, { "content": "class GFace;\n", "file_path": "gmsh/Mesh/meshGFaceDelaunayInsertion.h", "rank": 4, "score": 333057.75710543484 }, { "content": "class GFace;\n", "file_path": "gmsh/Mesh/meshGRegion.h", "rank": 5, "score": 330223.9255007503 }, { "content": "class GFace;\n", "file_path": "gmsh/Mesh/BackgroundMesh.h", "rank": 6, "score": 322092.85319761274 }, { "content": "class GModel;\n", "file_path": "gmsh/Mesh/meshGFaceDelaunayInsertion.h", "rank": 7, "score": 316276.3569890859 }, { "content": "class GFace;\n", "file_path": "gmsh/Mesh/meshGRegionDelaunayInsertion.h", "rank": 8, "score": 316271.2959253823 }, { "content": "class GFace;\n", "file_path": "gmsh/Mesh/BDS.h", "rank": 9, "score": 315334.40213265514 }, { "content": "class MVertex;\n\n\n", "file_path": "gmsh/Mesh/meshGFace.h", "rank": 10, "score": 314097.3220717434 }, { "content": "class GFace;\n", "file_path": "gmsh/Mesh/BackgroundMeshTools.h", "rank": 11, "score": 314093.948605755 }, { "content": "class GFace;\n", "file_path": "gmsh/Mesh/meshRelocateVertex.h", "rank": 12, "score": 314093.948605755 }, { "content": "// Create the mesh of the face\n\nclass meshGFace {\n\n const bool repairSelfIntersecting1dMesh;\n\n bool onlyInitialMesh;\n\n\n\npublic:\n\n meshGFace(bool r = true)\n\n : repairSelfIntersecting1dMesh(r), onlyInitialMesh(false)\n\n {\n\n }\n\n void operator()(GFace *, bool print = true);\n\n void setOnlyInitial() { onlyInitialMesh = true; }\n\n};\n\n\n", "file_path": "gmsh/Mesh/meshGFace.h", "rank": 13, "score": 307438.2047187082 }, { "content": "class MVertex;\n", "file_path": "gmsh/Mesh/meshGFaceBDS.h", "rank": 14, "score": 306624.8866591958 }, { "content": "class MVertex;\n\n\n", "file_path": "gmsh/Mesh/meshGFaceOptimize.h", "rank": 15, "score": 306624.8866591958 }, { "content": "class GFace;\n\ntypedef struct CDList DListRecord, *DListPeek;\n\ntypedef int PointNumero;\n\n\n\ntypedef struct {\n\n double v;\n\n double h;\n\n} DPoint;\n\n\n", "file_path": "gmsh/Mesh/DivideAndConquer.h", "rank": 16, "score": 306315.97676165076 }, { "content": "// Orient the mesh of a face to match the orientation of the underlying\n\n// geometry. This is necessary for 3 different reasons:\n\n// 1) some surface mesh algorithms do not respect the original geometrical\n\n// orientation\n\n// 2) some volume algorithms need to change the surface mesh orientation\n\n// 3) users can choose to reverse the natural orientation\n\nclass orientMeshGFace {\n\npublic:\n\n void operator()(GFace *);\n\n};\n\n\n\nvoid fourthPoint(double *p1, double *p2, double *p3, double *p4);\n\nvoid findTransfiniteCorners(GFace *gf, std::vector<MVertex *> &corners);\n\nint MeshTransfiniteSurface(GFace *gf);\n\nint MeshExtrudedSurface(\n\n GFace *gf, std::set<std::pair<MVertex *, MVertex *> > *constrainedEdges = 0);\n\nbool meshGenerator(GFace *gf, int RECUR_ITER, bool repairSelfIntersecting1dMesh,\n\n bool onlyInitialMesh, bool debug = true,\n\n std::vector<GEdge *> *replacement_edges = 0);\n\nbool pointInsideParametricDomain(std::vector<SPoint2> &bnd, SPoint2 &p,\n\n SPoint2 &out, int &N);\n\n\n\n#endif\n", "file_path": "gmsh/Mesh/meshGFace.h", "rank": 17, "score": 301165.8028725458 }, { "content": "// Destroy the mesh of the face\n\nclass deMeshGFace {\n\npublic:\n\n deMeshGFace() {}\n\n void operator()(GFace *);\n\n};\n\n\n", "file_path": "gmsh/Mesh/meshGFace.h", "rank": 18, "score": 301159.9356482198 }, { "content": "class GEdge;\n", "file_path": "gmsh/Mesh/meshGFace.h", "rank": 19, "score": 290030.1888060803 }, { "content": "class GVertex;\n", "file_path": "gmsh/Mesh/meshGFaceOptimize.h", "rank": 20, "score": 282845.17095400626 }, { "content": "class GModel;\n", "file_path": "gmsh/Mesh/meshGRegion.h", "rank": 21, "score": 275399.0953660632 }, { "content": "class BDS_Mesh;\n", "file_path": "gmsh/Mesh/meshGFaceBDS.h", "rank": 22, "score": 274451.4845618835 }, { "content": "class BDS_Mesh;\n", "file_path": "gmsh/Mesh/meshGFaceDelaunayInsertion.h", "rank": 23, "score": 267711.7314374723 }, { "content": "class MElement;\n", "file_path": "gmsh/Geo/GFace.h", "rank": 24, "score": 266650.92835004925 }, { "content": "class BDS_Point;\n\n\n\nvoid refineMeshBDS(\n\n GFace *gf, BDS_Mesh &m, const int NIT, const bool computeNodalSizeField,\n\n std::map<MVertex *, BDS_Point *> *recoverMapInv = 0,\n\n std::map<BDS_Point *, MVertex *, PointLessThan> *recoverMap = 0,\n\n std::vector<SPoint2> *true_boundary = 0);\n\nvoid optimizeMeshBDS(\n\n GFace *gf, BDS_Mesh &m, const int NIT,\n\n std::map<BDS_Point *, MVertex *, PointLessThan> *recoverMap = 0);\n\nvoid delaunayizeBDS(GFace *gf, BDS_Mesh &m, int &nb_swap);\n\nBDS_Mesh *gmsh2BDS(std::list<GFace *> &l);\n\ndouble computeEdgeLinearLength(BDS_Point *p1, BDS_Point *p2);\n\nvoid smoothVertexPass(GFace *gf, BDS_Mesh &m, int &nb_smooth, bool q);\n\nvoid modifyInitialMeshToRemoveDegeneracies(\n\n GFace *gf, BDS_Mesh &m,\n\n std::map<BDS_Point *, MVertex *, PointLessThan> *recoverMap);\n\n\n\n#endif\n", "file_path": "gmsh/Mesh/meshGFaceBDS.h", "rank": 25, "score": 266427.7764985375 }, { "content": "class GFace;\n", "file_path": "gmsh/Geo/GEntity.h", "rank": 26, "score": 265629.70710705436 }, { "content": "class GModel;\n", "file_path": "gmsh/Mesh/meshGRegionDelaunayInsertion.h", "rank": 27, "score": 265210.32494222187 }, { "content": "class GModel;\n", "file_path": "gmsh/Mesh/meshPartition.h", "rank": 28, "score": 265170.0688724885 }, { "content": "class GOrientedTransfiniteFace {\n\nprivate:\n\n GFace *_gf;\n\n int _ll, _hh;\n\n int _permutation, _index;\n\n std::vector<MVertex *> _list;\n\n\n\npublic:\n\n GOrientedTransfiniteFace()\n\n : _gf(0), _ll(0), _hh(0), _permutation(-1), _index(-1)\n\n {\n\n }\n\n GOrientedTransfiniteFace(GFace *gf, std::vector<MVertex *> &corners)\n\n : _gf(gf), _ll(0), _hh(0), _permutation(-1), _index(-1)\n\n {\n\n _ll = gf->transfinite_vertices.size() - 1;\n\n if(_ll <= 0) return;\n\n _hh = gf->transfinite_vertices[0].size() - 1;\n\n if(_hh <= 0) return;\n\n Msg::Debug(\"Face %d: L = %d H = %d\", gf->tag(), _ll, _hh);\n", "file_path": "gmsh/Mesh/meshGRegionTransfinite.cpp", "rank": 29, "score": 263652.24469477625 }, { "content": "class MTri3 {\n\nprotected:\n\n bool deleted;\n\n double circum_radius;\n\n MTriangle *base;\n\n MTri3 *neigh[3];\n\n\n\npublic:\n\n /// 2 is euclidian norm, -1 is infinite norm , 3 quality\n\n static int radiusNorm;\n\n bool isDeleted() const { return deleted; }\n\n void forceRadius(double r) { circum_radius = r; }\n\n inline double getRadius() const { return circum_radius; }\n\n inline MVertex *otherSide(int i)\n\n {\n\n MTri3 *n = neigh[i];\n\n if(!n) return 0;\n\n MVertex *v1 = base->getVertex((i + 2) % 3);\n\n MVertex *v2 = base->getVertex(i);\n\n for(int j = 0; j < 3; j++)\n", "file_path": "gmsh/Mesh/meshGFaceDelaunayInsertion.h", "rank": 30, "score": 259430.384029572 }, { "content": "class BDS_Point;\n\n\n", "file_path": "gmsh/Mesh/meshGFaceDelaunayInsertion.h", "rank": 31, "score": 259430.384029572 }, { "content": "class MVertex;\n", "file_path": "gmsh/Mesh/meshGRegion.h", "rank": 32, "score": 259267.43087335269 }, { "content": " class face {\n\n public:\n\n shellface *sh;\n\n int shver; // Range from 0 to 5.\n\n face() : sh(0), shver(0) {}\n\n face &operator=(const face &s)\n\n {\n\n sh = s.sh;\n\n shver = s.shver;\n\n return *this;\n\n }\n\n };\n\n\n\n ///////////////////////////////////////////////////////////////////////////////\n\n // //\n\n // Arraypool //\n\n // //\n\n // A dynamic linear array. (It is written by J. Shewchuk) //\n\n // //\n\n // Each arraypool contains an array of pointers to a number of blocks. Each\n", "file_path": "gmsh/Mesh/tetgenBR.h", "rank": 33, "score": 256642.4065518275 }, { "content": "class GModel;\n", "file_path": "gmsh/Mesh/Generator.h", "rank": 34, "score": 256146.72828208006 }, { "content": "class blyr_mvertex {\n\npublic:\n\n MVertex *_v;\n\n // all triangles connected to that vertex\n\n\n\n mutable std::vector<MTriangle *> _triangles;\n\n mutable std::vector<SVector3> _normals;\n\n mutable std::vector<GFace *> _gfaces;\n\n\n\n // all mesh edges connected to that vertex\n\n\n\n mutable std::vector<MLine *> _lines;\n\n mutable std::vector<GEdge *> _gedges;\n\n\n\n // one extruded vertex per face ...\n\n mutable std::vector<MVertex *> _v_per_face;\n\n mutable std::vector<SVector3> _n_per_vertex;\n\n mutable std::vector<GFace *> _f_per_normal;\n\n\n\n // ridge points\n", "file_path": "gmsh/Mesh/meshGRegionBoundaryLayer.cpp", "rank": 35, "score": 253027.09590297163 }, { "content": "class compareTri3Ptr {\n\n Less_Face lf;\n\n\n\npublic:\n\n inline bool operator()(const MTri3 *a, const MTri3 *b) const\n\n {\n\n if(a->getRadius() > b->getRadius()) return true;\n\n if(a->getRadius() < b->getRadius()) return false;\n\n return lf(a->tri()->getFace(0), b->tri()->getFace(0));\n\n }\n\n};\n\n\n\nvoid connectTriangles(std::list<MTri3 *> &);\n\nvoid connectTriangles(std::vector<MTri3 *> &);\n\nvoid connectTriangles(std::set<MTri3 *, compareTri3Ptr> &AllTris);\n\nvoid bowyerWatson(GFace *gf, int MAXPNT = 1000000000,\n\n std::map<MVertex *, MVertex *> *equivalence = 0,\n\n std::map<MVertex *, SPoint2> *parametricCoordinates = 0);\n\nvoid bowyerWatsonFrontal(\n\n GFace *gf, std::map<MVertex *, MVertex *> *equivalence = 0,\n", "file_path": "gmsh/Mesh/meshGFaceDelaunayInsertion.h", "rank": 36, "score": 252863.1943766731 }, { "content": "// A model face.\n\nclass GFace : public GEntity {\n\nprotected:\n\n // edge loops might replace what follows (list of all the edges of\n\n // the face + directions)\n\n std::vector<GEdge *> l_edges;\n\n std::vector<int> l_dirs;\n\n GRegion *r1, *r2;\n\n mean_plane meanPlane;\n\n std::vector<GEdge *> embedded_edges;\n\n std::set<GVertex *, GEntityLessThan> embedded_vertices;\n\n\n\n BoundaryLayerColumns _columns;\n\n\n\npublic: // this will become protected or private\n\n std::list<GEdgeLoop> edgeLoops;\n\n\n\n // periodic counterparts of edges\n\n std::map<GEdge *, std::pair<GEdge *, int> > edgeCounterparts;\n\n\n\n // specify mesh master with transformation, deduce edgeCounterparts\n", "file_path": "gmsh/Geo/GFace.h", "rank": 37, "score": 250560.0055550107 }, { "content": "class quadMeshRemoveHalfOfOneDMesh {\n\nprivate:\n\n GFace *_gf;\n\n std::map<GEdge *, std::vector<MLine *> > _backup;\n\n std::map<MEdge, MVertex *, Less_Edge> _middle;\n\n void _subdivide()\n\n {\n\n std::vector<MQuadrangle *> qnew;\n\n std::map<MEdge, MVertex *, Less_Edge> eds;\n\n for(std::size_t i = 0; i < _gf->triangles.size(); i++) {\n\n MVertex *v[3];\n\n SPoint2 m[3];\n\n for(int j = 0; j < 3; j++) {\n\n MEdge E = _gf->triangles[i]->getEdge(j);\n\n SPoint2 p1, p2;\n\n reparamMeshEdgeOnFace(E.getVertex(0), E.getVertex(1), _gf, p1, p2);\n\n std::map<MEdge, MVertex *, Less_Edge>::iterator it = _middle.find(E);\n\n std::map<MEdge, MVertex *, Less_Edge>::iterator it2 = eds.find(E);\n\n m[j] = p1;\n\n if(it == _middle.end() && it2 == eds.end()) {\n", "file_path": "gmsh/Mesh/meshGFace.cpp", "rank": 38, "score": 250066.7263744296 }, { "content": "class GModel;\n", "file_path": "gmsh/Geo/MElement.h", "rank": 39, "score": 249921.88071959498 }, { "content": "class GFace;\n", "file_path": "gmsh/Geo/MVertex.h", "rank": 40, "score": 249854.50374284724 }, { "content": "class GModel;\n\nvoid createTopologyFromMeshNew(GModel *gm);\n\n\n\n#endif\n", "file_path": "gmsh/Geo/GModelCreateTopologyFromMesh.h", "rank": 41, "score": 248561.38419055354 }, { "content": "// two dimensional elements\n\nclass surface_t: public element_t {\n\npublic:\n\n surface_t();\n\n ~surface_t();\n\n\n\n void setEdges(int);\n\n int getEdges() const;\n\n void setEdgeIndex(int, int);\n\n int getEdgeIndex(int) const;\n\n void newEdgeIndexes(int);\n\n void deleteEdgeIndexes();\n\n void setElements(int);\n\n int getElements() const;\n\n void setElementIndex(int, int);\n\n int getElementIndex(int) const;\n\n void newElementIndexes(int);\n\n void deleteElementIndexes();\n\n void setNormalVec(double*);\n\n double* getNormalVec();\n\n double getNormal(int) const;\n", "file_path": "fastFEM/mesh/meshtype.h", "rank": 42, "score": 246821.76907981306 }, { "content": "class initMeshGFace {\n\nprivate:\n\n bool _curved;\n\n int _estimateNumLines(GFace *f)\n\n {\n\n int num = 0;\n\n if(CTX::instance()->mesh.surfacesEdges) {\n\n num += (3 * f->triangles.size() + 4 * f->quadrangles.size() +\n\n 4 * f->polygons.size()) /\n\n 2;\n\n if(CTX::instance()->mesh.explode != 1.) num *= 2;\n\n if(_curved) num *= 2;\n\n }\n\n return num + 100;\n\n }\n\n int _estimateNumTriangles(GFace *f)\n\n {\n\n int num = 0;\n\n if(CTX::instance()->mesh.surfacesFaces) {\n\n num += (f->triangles.size() + 2 * f->quadrangles.size() +\n", "file_path": "gmsh/Geo/GModelVertexArrays.cpp", "rank": 43, "score": 246685.12188794036 }, { "content": "class GModel;\n\n\n", "file_path": "gmsh/Geo/MElementCut.h", "rank": 44, "score": 243646.63548332098 }, { "content": "class GModel;\n", "file_path": "gmsh/Geo/MElementOctree.h", "rank": 45, "score": 243646.63548332098 }, { "content": "class GFace;\n", "file_path": "gmsh/Geo/boundaryLayersData.h", "rank": 46, "score": 243581.5550264926 }, { "content": "class surfaceFunctorGFace : public surfaceFunctor {\n\n const GFace *gf;\n\n\n\npublic:\n\n surfaceFunctorGFace(const GFace *_gf) : gf(_gf) {}\n\n virtual SPoint3 operator()(double u, double v) const\n\n {\n\n GPoint gp = gf->point(u, v);\n\n if(!gp.succeeded()) throw gf;\n\n return SPoint3(gp.x(), gp.y(), gp.z());\n\n }\n\n};\n\n\n", "file_path": "gmsh/Geo/intersectCurveSurface.h", "rank": 47, "score": 238952.9188601577 }, { "content": "// Create the mesh of the region\n\nclass meshGRegion {\n\npublic:\n\n std::vector<GRegion *> &delaunay;\n\n meshGRegion(std::vector<GRegion *> &d) : delaunay(d) {}\n\n void operator()(GRegion *);\n\n};\n\n\n", "file_path": "gmsh/Mesh/meshGRegion.h", "rank": 48, "score": 237995.08139139807 }, { "content": "class topoFace {\n\nprotected:\n\n MElement *parent;\n\n int faceIndex;\n\n std::set<int> vtcs;\n\n\n\npublic:\n\n const std::set<int> &getVertices() const { return vtcs; }\n\n\n\n const MElement *getParent() const { return parent; }\n\n const int getIndex() const { return faceIndex; }\n\n const int getType() const\n\n {\n\n switch(vtcs.size()) {\n\n case 3: return TYPE_TRI; break;\n\n case 4: return TYPE_QUA; break;\n\n default: return vtcs.size() > 4 ? TYPE_POLYG : -1; break;\n\n }\n\n }\n\n\n", "file_path": "gmsh/Geo/GModelCreateTopologyFromMesh.cpp", "rank": 49, "score": 236033.90149349143 }, { "content": "class GEdge;\n\n\n", "file_path": "gmsh/Mesh/meshGEdge.h", "rank": 50, "score": 235200.29760768963 }, { "content": "class GRegion;\n", "file_path": "gmsh/Mesh/meshGRegion.h", "rank": 51, "score": 235200.29760768963 }, { "content": "class GEdge;\n", "file_path": "gmsh/Mesh/meshGRegion.h", "rank": 52, "score": 235200.29760768963 }, { "content": "#if defined(HAVE_ACIS)\n\n#include <face.hxx>\n\n#include <surface.hxx>\n\nclass ACISFace : public GFace {\n\nprotected:\n\n FACE *_f;\n\n double umin, umax, vmin, vmax;\n\n bool _periodic[2];\n\n\n\npublic:\n\n ACISFace(GModel *m, FACE *f, int num);\n\n virtual ~ACISFace() {}\n\n virtual bool periodic(int dir) const { return _periodic[dir]; }\n\n virtual double period(int dir) const;\n\n Range<double> parBounds(int i) const;\n\n virtual GPoint point(double par1, double par2) const;\n\n virtual GPoint closestPoint(const SPoint3 &queryPoint,\n\n const double initialGuess[2]) const;\n\n virtual bool containsPoint(const SPoint3 &pt) const;\n\n virtual SVector3 normal(const SPoint2 &param) const;\n\n virtual Pair<SVector3, SVector3> firstDer(const SPoint2 &param) const;\n\n virtual void secondDer(const SPoint2 &, SVector3 *, SVector3 *,\n\n SVector3 *) const;\n", "file_path": "gmsh/Geo/ACISFace.h", "rank": 53, "score": 233996.69509404406 }, { "content": "class discreteFace : public GFace {\n\nprivate:\n\n bool _checkAndFixOrientation();\n\n#if defined(HAVE_HXT)\n\n int _currentParametrization;\n\n std::vector<hxt_reparam_surf> _parametrizations;\n\n HXTStatus _reparametrizeThroughHxt();\n\n bool _computeTopologyOfPartition(int nbColors, int *colors, int *nNodes,\n\n int *nodes, double *uv,\n\n std::vector<MVertex *> &c2v,\n\n std::vector<std::vector<MEdge> > &boundaries);\n\n#endif\n\npublic:\n\n discreteFace(GModel *model, int num);\n\n virtual ~discreteFace() {}\n\n using GFace::point;\n\n GPoint point(double par1, double par2) const;\n\n SPoint2 parFromPoint(const SPoint3 &p, bool onSurface = true) const;\n\n GPoint closestPoint(const SPoint3 &queryPoint, double maxDistance,\n\n SVector3 *normal = nullptr) const;\n", "file_path": "gmsh/Geo/discreteFace.h", "rank": 54, "score": 233974.73221060526 }, { "content": "class xyFace : public GFace {\n\npublic:\n\n xyFace(GModel *gm, int t, xyEdge *e) : GFace(gm, t) { l_edges.push_back(e); }\n\n virtual ~xyFace() {}\n\n Range<double> parBounds(int i) const { return Range<double>(0, 1); }\n\n virtual GPoint point(double par1, double par2) const\n\n {\n\n double pp[2] = {par1, par2};\n\n return GPoint(par1, par2, 0.0, this, pp);\n\n }\n\n virtual GPoint closestPoint(const SPoint3 &queryPoint,\n\n const double initialGuess[2]) const\n\n {\n\n double u[2] = {queryPoint.x(), queryPoint.y()};\n\n return GPoint(queryPoint.x(), queryPoint.y(), 0.0, this, u);\n\n }\n\n virtual bool containsPoint(const SPoint3 &pt) const { return true; }\n\n virtual SVector3 normal(const SPoint2 &param) const\n\n {\n\n SVector3 n(0, 0, 1);\n", "file_path": "gmsh/Geo/xyFace.h", "rank": 55, "score": 233974.73221060526 }, { "content": "class OCCFace : public GFace {\n\nprotected:\n\n TopoDS_Face s;\n\n Handle(Geom_Surface) occface;\n\n double umin, umax, vmin, vmax;\n\n bool _periodic[2];\n\n double _period[2];\n\n bool buildSTLTriangulation(bool force = false);\n\n void setup();\n\n double _radius;\n\n SPoint3 _center;\n\n\n\npublic:\n\n OCCFace(GModel *m, TopoDS_Face s, int num);\n\n virtual ~OCCFace();\n\n virtual SBoundingBox3d bounds(bool fast = false) const;\n\n Range<double> parBounds(int i) const;\n\n virtual GPoint point(double par1, double par2) const;\n\n virtual GPoint closestPoint(const SPoint3 &queryPoint,\n\n const double initialGuess[2]) const;\n", "file_path": "gmsh/Geo/OCCFace.h", "rank": 56, "score": 233974.73221060526 }, { "content": "class gmshFace : public GFace {\n\nprotected:\n\n Surface *s;\n\n bool buildSTLTriangulation(bool force);\n\n\n\npublic:\n\n gmshFace(GModel *m, Surface *face);\n\n virtual ~gmshFace() {}\n\n Range<double> parBounds(int i) const;\n\n void setModelEdges(std::list<GEdge *> &);\n\n using GFace::point;\n\n virtual GPoint point(double par1, double par2) const;\n\n virtual GPoint closestPoint(const SPoint3 &queryPoint,\n\n const double initialGuess[2]) const;\n\n virtual bool containsPoint(const SPoint3 &pt) const;\n\n virtual double getMetricEigenvalue(const SPoint2 &);\n\n virtual SVector3 normal(const SPoint2 &param) const;\n\n virtual Pair<SVector3, SVector3> firstDer(const SPoint2 &param) const;\n\n virtual void secondDer(const SPoint2 &, SVector3 &, SVector3 &,\n\n SVector3 &) const;\n", "file_path": "gmsh/Geo/gmshFace.h", "rank": 57, "score": 233974.73221060526 }, { "content": "// adapt the mesh of a region\n\nclass adaptMeshGRegion {\n\npublic:\n\n void operator()(GRegion *);\n\n};\n\n\n\n#endif\n", "file_path": "gmsh/Mesh/meshGRegion.h", "rank": 58, "score": 233300.14915926164 }, { "content": "// destroy the mesh of the region\n\nclass deMeshGRegion {\n\npublic:\n\n void operator()(GRegion *);\n\n};\n\n\n\nvoid MeshDelaunayVolume(std::vector<GRegion *> &delaunay);\n\nbool CreateAnEmptyVolumeMesh(GRegion *gr);\n\nint MeshTransfiniteVolume(GRegion *gr);\n\nint SubdivideExtrudedMesh(GModel *m);\n\nvoid carveHole(GRegion *gr, int num, double distance,\n\n std::vector<int> &surfaces);\n\n\n\ntypedef std::map<MFace, GFace *, Less_Face> fs_cont;\n\ntypedef std::multimap<MVertex *, std::pair<MLine *, GEdge *> > es_cont;\n\nGFace *findInFaceSearchStructure(MVertex *p1, MVertex *p2, MVertex *p3,\n\n const fs_cont &search);\n\nGFace *findInFaceSearchStructure(const MFace &f, const fs_cont &search);\n\nGEdge *findInEdgeSearchStructure(MVertex *p1, MVertex *p2,\n\n const es_cont &search);\n\nbool buildFaceSearchStructure(GModel *model, fs_cont &search, bool onlyTriangles = false);\n\nbool buildEdgeSearchStructure(GModel *model, es_cont &search);\n\n\n", "file_path": "gmsh/Mesh/meshGRegion.h", "rank": 59, "score": 233300.14915926164 }, { "content": "// Optimize the mesh of the region using gmsh's algo\n\nclass optimizeMeshGRegion {\n\npublic:\n\n void operator()(GRegion *, bool always = false);\n\n};\n\n\n", "file_path": "gmsh/Mesh/meshGRegion.h", "rank": 60, "score": 233299.9004076693 }, { "content": "class meshGRegionExtruded {\n\npublic:\n\n void operator()(GRegion *);\n\n};\n\n\n", "file_path": "gmsh/Mesh/meshGRegion.h", "rank": 61, "score": 233292.87459174855 }, { "content": "class GRegion;\n\n\n\nvoid meshGRegionNetgen(GRegion *gr);\n\n\n\n#endif\n", "file_path": "gmsh/Mesh/meshGRegionNetgen.h", "rank": 62, "score": 229964.09876053903 }, { "content": "class GRegion;\n\n\n\nint meshGRegionHxt(std::vector<GRegion *> &regions);\n\n\n\n#endif\n", "file_path": "gmsh/Mesh/meshGRegionHxt.h", "rank": 63, "score": 229964.09876053903 }, { "content": "class GRegion;\n\n\n\nvoid refineMeshMMG(GRegion *gr);\n\n\n\n#endif\n", "file_path": "gmsh/Mesh/meshGRegionMMG3D.h", "rank": 64, "score": 229964.09876053903 }, { "content": "// Optimize the mesh of the region using netgen's algo\n\nclass optimizeMeshGRegionNetgen {\n\npublic:\n\n void operator()(GRegion *, bool always = false);\n\n};\n\n\n", "file_path": "gmsh/Mesh/meshGRegion.h", "rank": 65, "score": 228839.31231270704 }, { "content": "class MElement;\n", "file_path": "gmsh/Mesh/filterElements.h", "rank": 73, "score": 225653.67683480692 }, { "content": "class MElement;\n", "file_path": "gmsh/Mesh/BackgroundMesh.h", "rank": 74, "score": 225505.94690023124 }, { "content": "class MElement;\n\n\n\nint PartitionMesh(GModel *const model);\n\nint UnpartitionMesh(GModel *const model);\n\nint ConvertOldPartitioningToNewOne(GModel *const model);\n\n\n\n#endif\n", "file_path": "gmsh/Mesh/meshPartition.h", "rank": 75, "score": 225505.94690023124 }, { "content": "class GRegion;\n\n\n", "file_path": "gmsh/Geo/GFace.h", "rank": 76, "score": 225435.9704123844 }, { "content": "class GRegion;\n", "file_path": "gmsh/Mesh/meshGRegionBoundaryRecovery.h", "rank": 77, "score": 225011.52718384826 }, { "content": "//#define GMSH_PRE_ALLOCATE_STRATEGY 1\n\nclass GRegion;\n", "file_path": "gmsh/Mesh/meshGRegionDelaunayInsertion.h", "rank": 78, "score": 225011.52718384826 }, { "content": "class GEdge;\n", "file_path": "gmsh/Mesh/BackgroundMesh.h", "rank": 79, "score": 224971.27111411493 }, { "content": "class MElementOctree;\n", "file_path": "gmsh/Mesh/meshMetric.h", "rank": 80, "score": 219585.29216434408 }, { "content": "class MElementOctree;\n", "file_path": "gmsh/Mesh/BackgroundMesh.h", "rank": 81, "score": 219585.29216434408 }, { "content": "class MElement;\n\n\n\nvoid RelocateVertices(GRegion *region, int niter, double tol = 1.e-2);\n\nvoid RelocateVertices(std::vector<GRegion *> &regions, int niter,\n\n double tol = 1.e-2);\n\nvoid RelocateVertices(GFace *, int niter, double tol = 1.e-6);\n\nvoid RelocateVerticesOfPyramids(GRegion *region, int niter, double tol= 1.e-2);\n\nvoid RelocateVerticesOfPyramids(std::vector<GRegion *> &regions, int niter, double tol= 1.e-2);\n\n\n\n#endif\n", "file_path": "gmsh/Mesh/meshRelocateVertex.h", "rank": 82, "score": 219585.29216434408 }, { "content": "class GVertex;\n", "file_path": "gmsh/Mesh/BackgroundMeshTools.h", "rank": 83, "score": 219070.3207126944 }, { "content": "class GEdge;\n", "file_path": "gmsh/Mesh/BackgroundMeshTools.h", "rank": 84, "score": 219070.3207126944 }, { "content": "class GRegion;\n", "file_path": "gmsh/Mesh/meshRelocateVertex.h", "rank": 85, "score": 219070.3207126944 }, { "content": "class GEntity;\n\n\n\nSMetric3 buildMetricTangentToCurve(SVector3 &t, double l_t, double l_n);\n\nSMetric3 buildMetricTangentToSurface(SVector3 &t1, SVector3 &t2, double l_t1,\n\n double l_t2, double l_n);\n\ndouble BGM_MeshSize(GEntity *ge, double U, double V, double X, double Y,\n\n double Z);\n\nSMetric3 BGM_MeshMetric(GEntity *ge, double U, double V, double X, double Y,\n\n double Z);\n\nbool Extend1dMeshIn2dSurfaces();\n\nbool Extend2dMeshIn3dVolumes();\n\nSMetric3 max_edge_curvature_metric(const GVertex *gv);\n\nSMetric3 max_edge_curvature_metric(const GEdge *ge, double u, double &l);\n\nSMetric3 metric_based_on_surface_curvature(const GFace *gf, double u, double v,\n\n bool surface_isotropic = false,\n\n double d_normal = 1.e12,\n\n double d_tangent_max = 1.e12);\n\n\n\n#endif\n", "file_path": "gmsh/Mesh/BackgroundMeshTools.h", "rank": 86, "score": 219070.3207126944 }, { "content": "class MTriangle;\n\n\n", "file_path": "gmsh/Mesh/meshGRegion.h", "rank": 87, "score": 219070.3207126944 }, { "content": "class MLine;\n", "file_path": "gmsh/Mesh/meshGRegion.h", "rank": 88, "score": 219070.3207126944 }, { "content": "class Surface;\n\n\n", "file_path": "gmsh/Geo/gmshFace.h", "rank": 89, "score": 217102.1799953591 }, { "content": "class DistanceField;\n\n\n", "file_path": "gmsh/Mesh/Field.h", "rank": 90, "score": 216630.20642494725 }, { "content": "// base element class\n\nclass element_t {\n\npublic:\n\n element_t();\n\n ~element_t();\n\n\n\n void setNature(int);\n\n int getNature() const;\n\n void setCode(int);\n\n int getCode() const;\n\n void setNodes(int);\n\n int getNodes() const;\n\n void setIndex(int);\n\n int getIndex() const;\n\n void setSelected(int);\n\n int getSelected() const;\n\n int getNodeIndex(int) const;\n\n void setNodeIndex(int, int);\n\n int* getNodeIndexes() const;\n\n void newNodeIndexes(int);\n\n void deleteNodeIndexes();\n\n\n\nprivate:\n\n int nature; // PDE_BULK, ...\n\n int code; // element code for Elmer (504, 808, ...)\n\n int nodes; // number of nodes\n\n int index; // bc/mat index as defined in input file\n\n int selected; // element is selected or not\n\n int* node; // list of nodes\n\n};\n\n\n", "file_path": "fastFEM/mesh/meshtype.h", "rank": 91, "score": 216518.50401975823 }, { "content": "class BDS_Face;\n", "file_path": "gmsh/Mesh/BDS.h", "rank": 92, "score": 216439.08336042345 }, { "content": "class BDS_Face {\n\npublic:\n\n BDS_Face(BDS_Edge *A, BDS_Edge *B, BDS_Edge *C, BDS_Edge *D = 0)\n\n : deleted(false), e1(A), e2(B), e3(C), e4(D), g(0)\n\n {\n\n e1->addface(this);\n\n e2->addface(this);\n\n e3->addface(this);\n\n if(e4) e4->addface(this);\n\n }\n\n\n\n int numEdges() const { return e4 ? 4 : 3; }\n\n BDS_Edge *oppositeEdge(BDS_Point *p)\n\n {\n\n if(e4) {\n\n Msg::Error(\"oppositeEdge to point %d cannot be applied to a quad\", p->iD);\n\n return 0;\n\n }\n\n if(e1->p1 != p && e1->p2 != p) return e1;\n\n if(e2->p1 != p && e2->p2 != p) return e2;\n", "file_path": "gmsh/Mesh/BDS.h", "rank": 93, "score": 216439.08336042345 }, { "content": "class GEdge;\n", "file_path": "gmsh/Mesh/BDS.h", "rank": 94, "score": 215947.93052370648 }, { "content": "class GEntity;\n\n\n\ntypedef enum {\n\n FIELD_OPTION_DOUBLE = 0,\n\n FIELD_OPTION_INT,\n\n FIELD_OPTION_STRING,\n\n FIELD_OPTION_PATH,\n\n FIELD_OPTION_BOOL,\n\n FIELD_OPTION_LIST,\n\n FIELD_OPTION_LIST_DOUBLE\n\n} FieldOptionType;\n\n\n", "file_path": "gmsh/Mesh/Field.h", "rank": 95, "score": 215947.93052370648 }, { "content": "class GVertex;\n\n\n", "file_path": "gmsh/Mesh/BDS.h", "rank": 96, "score": 215947.93052370648 }, { "content": "class GRegion;\n\n\n\nvoid GetStatistics(double stat[50], double quality[4][100] = 0,\n\nbool visibleOnly = false);\n\nvoid AdaptMesh(GModel *m);\n\nvoid GenerateMesh(GModel *m, int dimension);\n\nvoid OptimizeMesh(GModel *m);\n\nvoid OptimizeMeshNetgen(GModel *m);\n\nvoid SmoothMesh(GModel *m);\n\nvoid RefineMesh(GModel *m, bool linear, bool splitIntoQuads = false,\n\n bool splitIntoHexas = false);\n\nvoid BarycentricRefineMesh(GModel *m);\n\nvoid RecombineMesh(GModel *m);\n\n\n\n#endif\n", "file_path": "gmsh/Mesh/Generator.h", "rank": 97, "score": 215947.93052370648 }, { "content": "// hybrid mesh recovery structure\n\nclass splitQuadRecovery {\n\nprivate:\n\n std::map<MFace, MVertex *, Less_Face> _quad;\n\n std::map<MFace, GFace *, Less_Face> _tri;\n\npublic:\n\n splitQuadRecovery() {}\n\n void add(const MFace &f, MVertex *v, GFace *gf);\n\n std::map<MFace, GFace *, Less_Face> &getTri() { return _tri; }\n\n std::map<MFace, MVertex *, Less_Face> &getQuad() { return _quad; }\n\n int buildPyramids(GModel *gm);\n\n};\n\n\n", "file_path": "gmsh/Mesh/meshGRegion.h", "rank": 98, "score": 213553.89402107178 }, { "content": "class MTriangle;\n", "file_path": "gmsh/Mesh/filterElements.h", "rank": 99, "score": 209729.07046426926 } ]
C++
Clients/OIViewer/ConfigurationLoader.cpp
OpenImageViewer/OIV
7b2b67ea156255bf77819ce77bf687c9d360e217
#include "ConfigurationLoader.h" #include <LLUtils/FileHelper.h> #include <LLUtils/PlatformUtility.h> #include <LLUtils/Exception.h> #include <LLUtils/Logging/Logger.h> #include <nlohmann/json.hpp> #include <stack> namespace OIV { ConfigurationLoader::CommandGroupList ConfigurationLoader::LoadCommandGroups() { using namespace nlohmann; using namespace LLUtils; std::string jsonText = File::ReadAllText<std::string>(LLUtils::PlatformUtility::GetExeFolder() + LLUTILS_TEXT("./Resources/Configuration/Commands.json")); auto jsonObject = json::parse(jsonText); auto commands = jsonObject["commands"]; if (commands == nullptr || commands.is_array() == false) LL_EXCEPTION(LLUtils::Exception::ErrorCode::BadParameters, "File contents mismatch"); CommandGroupList commandsList; for (auto commandGroup : commands) commandsList.push_back({ commandGroup["GroupID"], commandGroup["DisplayName"] ,commandGroup["Name"], commandGroup["arguments"] }); return commandsList; } ConfigurationLoader::KeyBindingList ConfigurationLoader::LoadKeyBindings() { using namespace nlohmann; using namespace LLUtils; std::string jsonText = File::ReadAllText<std::string>(LLUtils::PlatformUtility::GetExeFolder() + LLUTILS_TEXT("./Resources/Configuration/KeyBindings.json")); auto jsonObject = json::parse(jsonText); auto keyBindings = jsonObject["KeyBindings"]; if (keyBindings == nullptr || keyBindings.is_array() == false) LL_EXCEPTION(LLUtils::Exception::ErrorCode::BadParameters, "File contents mismatch"); KeyBindingList keyBindingsList; for (auto& keybindingPair : keyBindings.items()) { for (auto& [key, value] : keybindingPair.value().items()) keyBindingsList.push_back(KeyBinding{ key, value.get<std::string>() }); } return keyBindingsList; } ConfigurationLoader::MapSettings ConfigurationLoader::LoadSettings() { using namespace nlohmann; using namespace LLUtils; MapSettings mapSettings; try { std::string jsonText = File::ReadAllText<std::string>(LLUtils::PlatformUtility::GetExeFolder() + LLUTILS_TEXT("./Resources/Configuration/Settings.json")); auto jsonObject = json::parse(jsonText); SettingEntryForParsing root; using StackData = std::tuple<json*, SettingEntryForParsing*, std::string>; std::stack<StackData> stck; stck.emplace(&jsonObject, &root, ""); while (stck.empty() == false) { const auto [jsonTree, settingEntry, currentNamespace] = stck.top(); stck.pop(); struct TmpEntry { bool isObject = false; std::string name; json* child; SettingEntryForParsing entry; }; std::list< TmpEntry> tmpList; for (auto& child : jsonTree->items()) { tmpList.push_back(TmpEntry()); auto& currentTmp = tmpList.back(); auto& currentChild = tmpList.back().entry; currentChild.name = child.key(); if (child.value().is_object() == true) { currentTmp.isObject = true; currentTmp.child = &child.value(); currentTmp.name = child.key(); } else if (child.value().is_string()) currentChild.value = child.value().get<String>(); else currentChild.value = child.value().dump(0); if (child.value().is_object() == false) { std::string qualifiedName; if (currentNamespace.empty()) qualifiedName = currentChild.name; else qualifiedName = currentNamespace + seperator + currentChild.name; mapSettings.emplace(qualifiedName, currentChild.value); } } settingEntry->children.resize(tmpList.size()); decltype(tmpList)::const_iterator it = tmpList.begin(); for (size_t i = 0; i < tmpList.size(); i++, it++) { settingEntry->children.at(i) = it->entry; if (it->isObject) { std::string qualifiedName; if (currentNamespace.empty()) qualifiedName = it->name; else qualifiedName = currentNamespace + seperator + it->name; stck.emplace(it->child, &settingEntry->children.at(i), qualifiedName); } } } } catch (nlohmann::detail::exception& exception) { LLUtils::Logger::GetSingleton().Log(exception.what()); } catch (...) { } return mapSettings; } }
#include "ConfigurationLoader.h" #include <LLUtils/FileHelper.h> #include <LLUtils/PlatformUtility.h> #include <LLUtils/Exception.h> #include <LLUtils/Logging/Logger.h> #include <nlohmann/json.hpp> #include <stack> namespace OIV {
ConfigurationLoader::KeyBindingList ConfigurationLoader::LoadKeyBindings() { using namespace nlohmann; using namespace LLUtils; std::string jsonText = File::ReadAllText<std::string>(LLUtils::PlatformUtility::GetExeFolder() + LLUTILS_TEXT("./Resources/Configuration/KeyBindings.json")); auto jsonObject = json::parse(jsonText); auto keyBindings = jsonObject["KeyBindings"]; if (keyBindings == nullptr || keyBindings.is_array() == false) LL_EXCEPTION(LLUtils::Exception::ErrorCode::BadParameters, "File contents mismatch"); KeyBindingList keyBindingsList; for (auto& keybindingPair : keyBindings.items()) { for (auto& [key, value] : keybindingPair.value().items()) keyBindingsList.push_back(KeyBinding{ key, value.get<std::string>() }); } return keyBindingsList; } ConfigurationLoader::MapSettings ConfigurationLoader::LoadSettings() { using namespace nlohmann; using namespace LLUtils; MapSettings mapSettings; try { std::string jsonText = File::ReadAllText<std::string>(LLUtils::PlatformUtility::GetExeFolder() + LLUTILS_TEXT("./Resources/Configuration/Settings.json")); auto jsonObject = json::parse(jsonText); SettingEntryForParsing root; using StackData = std::tuple<json*, SettingEntryForParsing*, std::string>; std::stack<StackData> stck; stck.emplace(&jsonObject, &root, ""); while (stck.empty() == false) { const auto [jsonTree, settingEntry, currentNamespace] = stck.top(); stck.pop(); struct TmpEntry { bool isObject = false; std::string name; json* child; SettingEntryForParsing entry; }; std::list< TmpEntry> tmpList; for (auto& child : jsonTree->items()) { tmpList.push_back(TmpEntry()); auto& currentTmp = tmpList.back(); auto& currentChild = tmpList.back().entry; currentChild.name = child.key(); if (child.value().is_object() == true) { currentTmp.isObject = true; currentTmp.child = &child.value(); currentTmp.name = child.key(); } else if (child.value().is_string()) currentChild.value = child.value().get<String>(); else currentChild.value = child.value().dump(0); if (child.value().is_object() == false) { std::string qualifiedName; if (currentNamespace.empty()) qualifiedName = currentChild.name; else qualifiedName = currentNamespace + seperator + currentChild.name; mapSettings.emplace(qualifiedName, currentChild.value); } } settingEntry->children.resize(tmpList.size()); decltype(tmpList)::const_iterator it = tmpList.begin(); for (size_t i = 0; i < tmpList.size(); i++, it++) { settingEntry->children.at(i) = it->entry; if (it->isObject) { std::string qualifiedName; if (currentNamespace.empty()) qualifiedName = it->name; else qualifiedName = currentNamespace + seperator + it->name; stck.emplace(it->child, &settingEntry->children.at(i), qualifiedName); } } } } catch (nlohmann::detail::exception& exception) { LLUtils::Logger::GetSingleton().Log(exception.what()); } catch (...) { } return mapSettings; } }
ConfigurationLoader::CommandGroupList ConfigurationLoader::LoadCommandGroups() { using namespace nlohmann; using namespace LLUtils; std::string jsonText = File::ReadAllText<std::string>(LLUtils::PlatformUtility::GetExeFolder() + LLUTILS_TEXT("./Resources/Configuration/Commands.json")); auto jsonObject = json::parse(jsonText); auto commands = jsonObject["commands"]; if (commands == nullptr || commands.is_array() == false) LL_EXCEPTION(LLUtils::Exception::ErrorCode::BadParameters, "File contents mismatch"); CommandGroupList commandsList; for (auto commandGroup : commands) commandsList.push_back({ commandGroup["GroupID"], commandGroup["DisplayName"] ,commandGroup["Name"], commandGroup["arguments"] }); return commandsList; }
function_block-full_function
[ { "content": "namespace OIV\n\n{\n\n struct SelectionRect\n\n {\n\n LLUtils::PointI32 p0;\n\n LLUtils::PointI32 p1;\n\n };\n\n\n\n struct ViewParameters\n\n {\n\n LLUtils::PointI32 uViewportSize;\n\n LLUtils::Color uTransparencyColor1;\n\n LLUtils::Color uTransparencyColor2;\n\n bool showGrid;\n\n };\n", "file_path": "oivlib/oiv/Include/Interfaces/IRendererDefs.h", "rank": 0, "score": 119997.74623380002 }, { "content": "namespace OIV\n\n{\n\n ResultCode Execute_impl(int command, std::size_t requestSize, void* requestData, std::size_t responseSize, void* responseData);\n\n namespace Util\n\n {\n\n ResultCode GetBPPFromTexelFormat_impl(OIV_TexelFormat in_texelFormat, uint8_t* out_bpp);\n\n }\n\n \n", "file_path": "oivlib/oiv/Source/APIImpl.h", "rank": 1, "score": 85673.4010815513 }, { "content": "#pragma once\n\n#include <cstdint>\n\n\n\nnamespace OIV\n\n{\n", "file_path": "oivlib/oiv/Include/System.h", "rank": 2, "score": 85659.4113818168 }, { "content": " uint32_t x;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 3, "score": 83921.1042925374 }, { "content": " uint32_t y;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 4, "score": 83921.1042925374 }, { "content": " LLUtils::PointF64 scale;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 5, "score": 83921.1042925374 }, { "content": "constexpr int OIV_VERSION_MINOR = 18;\n", "file_path": "oivlib/oiv/Include/Version.h", "rank": 6, "score": 83904.89187227802 }, { "content": "constexpr int OIV_VERSION_MAJOR = 0 ;\n", "file_path": "oivlib/oiv/Include/Version.h", "rank": 7, "score": 83904.89187227802 }, { "content": "#pragma once\n\n#include <defs.h>\n\n#include <Image.h>\n\n#include \"IRendererDefs.h\"\n\n\n\nnamespace OIV\n\n{\n", "file_path": "oivlib/oiv/Include/Interfaces/IRenderer.h", "rank": 8, "score": 82958.81020681701 }, { "content": "\tclass System\n\n\t{\n\n\tpublic:\n\n\t\tstatic uint32_t GetIdealNumThreadsForMemoryOperations();\n\n\t};\n\n}", "file_path": "oivlib/oiv/Include/System.h", "rank": 9, "score": 82944.38644219028 }, { "content": " ImageHandle handle;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 10, "score": 82073.85596242147 }, { "content": " uint8_t bpp;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 11, "score": 82073.85596242147 }, { "content": " std::size_t length;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 12, "score": 82073.85596242147 }, { "content": " double offset;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 13, "score": 82073.85596242147 }, { "content": " uint32_t width;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 14, "score": 82073.85596242147 }, { "content": " size_t container;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 15, "score": 82073.85596242147 }, { "content": " const OIVCHAR* text;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 16, "score": 82073.85596242147 }, { "content": " char extension[MAX_EXTENSION_SIZE];\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 17, "score": 82073.85596242147 }, { "content": " double y0;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 18, "score": 82073.85596242147 }, { "content": " double gamma;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 19, "score": 82073.85596242147 }, { "content": " OIV_TexelFormat type;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 20, "score": 82073.85596242147 }, { "content": " double saturation;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 21, "score": 82073.85596242147 }, { "content": " OIV_AxisAlignedRotation rotation;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 22, "score": 82073.85596242147 }, { "content": " OIV_TexelFormat format;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 23, "score": 82073.85596242147 }, { "content": " OIV_RECT_I rect;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 24, "score": 82073.85596242147 }, { "content": " double y1;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 25, "score": 82073.85596242147 }, { "content": " double x0;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 26, "score": 82073.85596242147 }, { "content": " const wchar_t* callstack;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 27, "score": 82073.85596242147 }, { "content": " bool visible;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 28, "score": 82073.85596242147 }, { "content": " OIV_AxisAlignedFlip transformation;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 29, "score": 82073.85596242147 }, { "content": " char dummy;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 30, "score": 82073.85596242147 }, { "content": " double x1;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 31, "score": 82073.85596242147 }, { "content": " static constexpr uint8_t MAX_EXTENSION_SIZE = 16;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 32, "score": 82073.85596242147 }, { "content": " const wchar_t* description;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 33, "score": 82073.85596242147 }, { "content": " void* buffer;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 34, "score": 82073.85596242147 }, { "content": " OIV_Tranform transform;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 35, "score": 82073.85596242147 }, { "content": " double opacity;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 36, "score": 82073.85596242147 }, { "content": " double exposure;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 37, "score": 82073.85596242147 }, { "content": " uint8_t size;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 38, "score": 82073.85596242147 }, { "content": " OIV_AxisAlignedFlip flip;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 39, "score": 82073.85596242147 }, { "content": " double contrast;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 40, "score": 82073.85596242147 }, { "content": " uint32_t height;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 41, "score": 82073.85596242147 }, { "content": " OIV_CMD_LoadFile_Flags flags;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 42, "score": 82073.85596242147 }, { "content": " class IRenderer\n\n {\n\n public:\n\n virtual int Init(const OIV_RendererInitializationParams& initParams) = 0;\n\n virtual int SetViewParams(const ViewParameters& viewParams) = 0;\n\n virtual int Redraw() = 0;\n\n virtual int SetFilterLevel(OIV_Filter_type filterType) = 0;\n\n virtual int SetExposure(const OIV_CMD_ColorExposure_Request& exposure) = 0;\n\n virtual int SetSelectionRect(SelectionRect selectionRect) = 0;\n\n\n\n\n\n //Multi image API\n\n virtual int SetImageBuffer(uint32_t id, const IMCodec::ImageSharedPtr image) = 0;\n\n virtual int SetImageProperties(const OIV_CMD_ImageProperties_Request&) = 0;\n\n virtual int RemoveImage(uint32_t id) = 0;\n\n\n\n virtual ~IRenderer() {}\n\n };\n\n\n\n typedef std::shared_ptr<IRenderer> IRendererSharedPtr;\n\n} ", "file_path": "oivlib/oiv/Include/Interfaces/IRenderer.h", "rank": 43, "score": 80408.40701001583 }, { "content": " OIV_TexelFormat texelFormat;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 44, "score": 80309.7175273478 }, { "content": " uint8_t backgroundColor[4];\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 45, "score": 80309.7175273478 }, { "content": " LLUtils::Color uTransparencyColor2;\n", "file_path": "oivlib/oiv/Include/Interfaces/IRendererDefs.h", "rank": 46, "score": 80309.7175273478 }, { "content": " uint8_t outlineColor;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 47, "score": 80309.7175273478 }, { "content": " uint32_t rowPitch;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 48, "score": 80309.7175273478 }, { "content": " OIV_PROP_CreateText_Mode renderMode;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 49, "score": 80309.7175273478 }, { "content": " uint16_t fontSize;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 50, "score": 80309.7175273478 }, { "content": " const OIVCHAR* dataPath;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 51, "score": 80309.7175273478 }, { "content": " ImageHandle imageHandle;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 52, "score": 80309.7175273478 }, { "content": " const OIVCHAR* fontPath;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 53, "score": 80309.7175273478 }, { "content": " uint8_t outlineWidth;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 54, "score": 80309.7175273478 }, { "content": " uint16_t DPIy;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 55, "score": 80309.7175273478 }, { "content": " const wchar_t* functionName;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 56, "score": 80309.7175273478 }, { "content": "\t\tvoid* userPointer;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 57, "score": 80309.7175273478 }, { "content": " int errorCode;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 58, "score": 80309.7175273478 }, { "content": " uint16_t DPIx;\n", "file_path": "oivlib/oiv/Include/defs.h", "rank": 59, "score": 80309.7175273478 }, { "content": "#pragma once\n\n#include <defs.h>\n\n#include <map>\n\n#include \"OIVImage\\OIVTextImage.h\"\n\n#include \"EventManager.h\"\n\n\n\nnamespace OIV\n\n{\n", "file_path": "Clients/OIViewer/LabelManager.h", "rank": 60, "score": 15.187077033493052 }, { "content": "#pragma once\n\n#include <array>\n\n#include \"OIVImage/OIVBaseImage.h\"\n\n#include \"OIVImage/OIVFileImage.h\"\n\n\n\nnamespace OIV\n\n{\n", "file_path": "Clients/OIViewer/ImageState.h", "rank": 61, "score": 15.149622874589928 }, { "content": "#include <cstdint>\n\n#include \"../OIVImage/OIVBaseImage.h\"\n\nnamespace OIV\n\n{\n", "file_path": "Clients/OIViewer/Helpers/PixelHelper.h", "rank": 62, "score": 15.090069426741803 }, { "content": "#pragma once\n\n#include \"Helpers/OIVHelper.h\"\n\n#include \"LabelManager.h\"\n\n\n\nnamespace OIV\n\n{\n", "file_path": "Clients/OIViewer/VirtualStatusBar.h", "rank": 63, "score": 14.753628528021679 }, { "content": "#pragma once\n\n#include <Windows.h>\n\n#include <windowsx.h>\n\n#include <tchar.h>\n\n#include <Win32/Win32Window.h>\n\n#include \"ImageLIst.h\"\n\nnamespace OIV\n\n{\n\n namespace Win32\n\n\n\n {\n", "file_path": "Clients/OIViewer/win32/ImageControl.h", "rank": 64, "score": 14.6215407957274 }, { "content": "#pragma once\n\n#include <Win32/Win32Window.h>\n\n#include \"ImageControl.h\"\n\nnamespace OIV\n\n{\n\n namespace Win32\n\n {\n", "file_path": "Clients/OIViewer/win32/MainWindow.h", "rank": 65, "score": 14.546658650431004 }, { "content": "#include \"../OIVImage/OIVBaseImage.h\"\n\nnamespace OIV\n\n{\n", "file_path": "Clients/OIViewer/Helpers/MessageHelper.h", "rank": 66, "score": 14.506094960165097 }, { "content": "#pragma once\n\n#include <list>\n\n#include <map>\n\n#include <defs.h>\n\n#include <Image.h>\n\n\n\n\n\nnamespace OIV\n\n{\n", "file_path": "oivlib/oiv/Source/ImageManager.h", "rank": 67, "score": 14.496156404738226 }, { "content": "#pragma once\n\n#include <defs.h>\n\n#include <Image.h>\n\n\n\n\n\nnamespace OIV\n\n{\n", "file_path": "oivlib/oiv/Source/IPictureRenderer.h", "rank": 68, "score": 14.482907749087776 }, { "content": "#pragma once\n\n#include \"OIVCommands.h\"\n\n\n\nnamespace OIV\n\n{\n", "file_path": "Clients/OIViewer/SelectionRect.h", "rank": 69, "score": 14.455934714938092 }, { "content": "#pragma once\n\n#include <map>\n\n#include <functional>\n\n\n\nnamespace OIV\n\n{\n\n \n", "file_path": "Clients/OIViewer/CommandManager.h", "rank": 70, "score": 14.34706513419062 }, { "content": "#pragma once\n\n#include \"../CommandHandler.h\"\n\n#include <defs.h>\n\n\n\nnamespace OIV\n\n{\n\n\n", "file_path": "oivlib/oiv/Source/Commands/Handlers/CommandHandlerInit.h", "rank": 71, "score": 14.34706513419062 }, { "content": "#pragma once\n\n#include <windows.h>\n\nnamespace OIV\n\n{\n\n namespace Win32\n\n {\n", "file_path": "Clients/OIViewer/win32/UserMessages.h", "rank": 72, "score": 14.333868832422986 }, { "content": "#pragma once\n\n#include \"OIVBaseImage.h\"\n\nnamespace OIV\n\n{\n", "file_path": "Clients/OIViewer/OIVImage/OIVHandleImage.h", "rank": 73, "score": 14.319511911241904 }, { "content": "#pragma once\n\n#include \"../oiv/Interfaces/IRenderer.h\"\n\n\n\nnamespace OIV\n\n{\n", "file_path": "oivlib/renderers/OIVGLRenderer/OIVGLRendererFactory.h", "rank": 74, "score": 14.319511911241904 }, { "content": "#pragma once\n\n#include \"../CommandHandler.h\"\n\n#include <defs.h>\n\n#include \"../CommandProcessor.h\"\n\n\n\nnamespace OIV\n\n{\n\n\n", "file_path": "oivlib/oiv/Source/Commands/Handlers/CommandHandlerImageProperties.h", "rank": 75, "score": 14.303932221663187 }, { "content": "#pragma once\n\n#include \"../CommandHandler.h\"\n\n#include <defs.h>\n\n#include \"../CommandProcessor.h\"\n\n\n\nnamespace OIV\n\n{\n\n\n", "file_path": "oivlib/oiv/Source/Commands/Handlers/CommandHandlerGetKnownFileTypes.h", "rank": 76, "score": 14.303932221663187 }, { "content": "#pragma once\n\n#include \"../CommandHandler.h\"\n\n#include <defs.h>\n\n#include \"../CommandProcessor.h\"\n\n\n\nnamespace OIV\n\n{\n\n\n", "file_path": "oivlib/oiv/Source/Commands/Handlers/CommandHandlerAxisAlignedTransform.h", "rank": 77, "score": 14.303932221663187 }, { "content": "#pragma once\n\n#include \"../CommandHandler.h\"\n\n#include <defs.h>\n\n#include \"../CommandProcessor.h\"\n\n\n\nnamespace OIV\n\n{\n\n\n", "file_path": "oivlib/oiv/Source/Commands/Handlers/CommandHandlerRegisterCallbacks.h", "rank": 78, "score": 14.303932221663187 }, { "content": "#pragma once\n\n#include \"../CommandHandler.h\"\n\n#include <defs.h>\n\n#include \"../CommandProcessor.h\"\n\n\n\nnamespace OIV\n\n{\n\n\n", "file_path": "oivlib/oiv/Source/Commands/Handlers/CommandHandlerRefresh.h", "rank": 79, "score": 14.303932221663187 }, { "content": "#pragma once\n\n#include \"../CommandHandler.h\"\n\n#include <defs.h>\n\n#include \"../CommandProcessor.h\"\n\n\n\nnamespace OIV\n\n{\n\n\n", "file_path": "oivlib/oiv/Source/Commands/Handlers/CommandHandlerGetSubImages.h", "rank": 80, "score": 14.303932221663187 }, { "content": "#pragma once\n\n#include \"../CommandHandler.h\"\n\n#include <defs.h>\n\n#include \"../CommandProcessor.h\"\n\n\n\nnamespace OIV\n\n{\n\n\n", "file_path": "oivlib/oiv/Source/Commands/Handlers/CommandHandlerColorExposure.h", "rank": 81, "score": 14.303932221663187 }, { "content": "#pragma once\n\n#include \"../CommandHandler.h\"\n\n#include <defs.h>\n\n#include \"../CommandProcessor.h\"\n\n\n\nnamespace OIV\n\n{\n\n\n", "file_path": "oivlib/oiv/Source/Commands/Handlers/CommandHandlerGetPixels.h", "rank": 82, "score": 14.303932221663187 }, { "content": "#pragma once\n\n#include \"../CommandHandler.h\"\n\n#include <defs.h>\n\n#include \"../CommandProcessor.h\"\n\n\n\nnamespace OIV\n\n{\n\n\n", "file_path": "oivlib/oiv/Source/Commands/Handlers/CommandHandlerConvertFormat.h", "rank": 83, "score": 14.303932221663187 }, { "content": "#pragma once\n\n#include \"../CommandHandler.h\"\n\n#include <defs.h>\n\n#include \"../CommandProcessor.h\"\n\n\n\nnamespace OIV\n\n{\n\n\n", "file_path": "oivlib/oiv/Source/Commands/Handlers/CommandHandlerUnloadFile.h", "rank": 84, "score": 14.303932221663187 }, { "content": "#pragma once\n\n#include \"../CommandHandler.h\"\n\n#include <defs.h>\n\n#include \"../CommandProcessor.h\"\n\n\n\nnamespace OIV\n\n{\n\n\n", "file_path": "oivlib/oiv/Source/Commands/Handlers/CommandHandlerSetSelectionRect.h", "rank": 85, "score": 14.303932221663187 }, { "content": "#pragma once\n\n#include \"../CommandHandler.h\"\n\n#include <defs.h>\n\n#include \"../CommandProcessor.h\"\n\n\n\nnamespace OIV\n\n{\n\n\n", "file_path": "oivlib/oiv/Source/Commands/Handlers/CommandHandlerCreateText.h", "rank": 86, "score": 14.303932221663187 }, { "content": "#pragma once\n\n#include \"../CommandHandler.h\"\n\n#include <defs.h>\n\n#include \"../CommandProcessor.h\"\n\n\n\nnamespace OIV\n\n{\n\n\n", "file_path": "oivlib/oiv/Source/Commands/Handlers/CommandHandlerCropImage.h", "rank": 87, "score": 14.303932221663187 }, { "content": "#pragma once\n\n#include <string>\n\n#include <vector>\n\n#include <variant>\n\n#include <list>\n\n#include <map>\n\nnamespace OIV\n\n{\n\n\n", "file_path": "Clients/OIViewer/ConfigurationLoader.h", "rank": 88, "score": 14.29630949481656 }, { "content": "#pragma once\n\n#include <memory>\n\n#include <wrl/client.h>\n\n\n\nnamespace OIV\n\n{\n", "file_path": "oivlib/renderers/OIVD3D11Renderer/Source/D3D11/D3D11Common.h", "rank": 90, "score": 14.213887332837889 }, { "content": "#pragma once\n\n#include <memory>\n\n#include <d3d11.h>\n\n#include \"D3D11Device.h\"\n\nnamespace OIV\n\n{\n", "file_path": "oivlib/renderers/OIVD3D11Renderer/Source/D3D11/D3D11Texture.h", "rank": 91, "score": 14.18633419031239 }, { "content": "#pragma once\n\n#include \"../CommandHandler.h\"\n\n#include <defs.h>\n\n#include \"../CommandProcessor.h\"\n\n#include \"../../ApiGlobal.h\"\n\n\n\nnamespace OIV\n\n{\n\n\n", "file_path": "oivlib/oiv/Source/Commands/Handlers/CommandHandlerLoadRaw.h", "rank": 92, "score": 14.16455183267573 }, { "content": "#pragma once\n\n#include \"../CommandHandler.h\"\n\n#include <defs.h>\n\n#include \"../CommandProcessor.h\"\n\n#include \"../../ApiGlobal.h\"\n\n\n\nnamespace OIV\n\n{\n", "file_path": "oivlib/oiv/Source/Commands/Handlers/CommandHandlerTexelInfo.h", "rank": 93, "score": 14.16455183267573 }, { "content": "#pragma once\n\n#include <unordered_map>\n\n\n\n#include <defs.h>\n\n#include \"../IPictureRenderer.h\"\n\n#include \"CommandHandler.h\"\n\n\n\nnamespace OIV\n\n{\n\n\n", "file_path": "oivlib/oiv/Source/Commands/CommandProcessor.h", "rank": 94, "score": 14.16455183267573 }, { "content": "#pragma once\n\n#include \"../CommandHandler.h\"\n\n#include <defs.h>\n\n#include \"../CommandProcessor.h\"\n\n#include \"../../ApiGlobal.h\"\n\n\n\nnamespace OIV\n\n{\n\n\n", "file_path": "oivlib/oiv/Source/Commands/Handlers/CommandHandlerLoadFile.h", "rank": 95, "score": 14.16455183267573 }, { "content": "#pragma once\n\n#include \"../CommandHandler.h\"\n\n#include <defs.h>\n\n#include \"../CommandProcessor.h\"\n\n#include \"../../ApiGlobal.h\"\n\n\n\nnamespace OIV\n\n{\n\n\n", "file_path": "oivlib/oiv/Source/Commands/Handlers/CommandHandlerQueryImageInfo.h", "rank": 96, "score": 14.16455183267573 }, { "content": "#include \"SelectionRect.h\"\n\n\n\n\n\n#include \"OIVImage\\OIVHandleImage.h\"\n\n#include \"OIVImage\\OIVFileImage.h\"\n\n#include \"OIVImage\\OIVRawImage.h\"\n\n#include \"Helpers\\OIVImageHelper.h\"\n\n#include \"VirtualStatusBar.h\"\n\n#include \"MonitorProvider.h\"\n\n\n\n#include \"ContextMenu.h\"\n\n#include \"globals.h\"\n\n#include \"ConfigurationLoader.h\"\n\n\n\n\n\n#include \"resource.h\"\n\n\n\nnamespace OIV\n\n{\n\n void TestApp::CMD_Zoom(const CommandManager::CommandRequest& request, CommandManager::CommandResult& result)\n", "file_path": "Clients/OIViewer/TestApp.cpp", "rank": 97, "score": 14.09587079505684 }, { "content": "#pragma once\n\n#include <string>\n\n#include <vector>\n\n#include <memory>\n\n#include <LLUtils/StopWatch.h>\n\n#include <defs.h>\n\n\n\nnamespace OIV\n\n{\n", "file_path": "Clients/OIViewer/OIVImage/OIVBaseImage.h", "rank": 98, "score": 14.091586781535776 }, { "content": "#pragma once\n\n#include \"../OIVImage/OIVHandleImage.h\"\n\n#include \"../OIVCommands.h\"\n\nnamespace OIV\n\n{\n\n \n\n //Create an RGBA render compatible image, \n\n // TODO: accept any render compatible image format.\n\n\n", "file_path": "Clients/OIViewer/Helpers/OIVImageHelper.h", "rank": 99, "score": 14.089715328557691 } ]
C++
dependencies/PyMesh/tools/MeshUtils/DegeneratedTriangleRemoval.cpp
aprieels/3D-watermarking-spectral-decomposition
dcab78857d0bb201563014e58900917545ed4673
#include "DegeneratedTriangleRemoval.h" #include <cassert> #include <iostream> #include <limits> #include <set> #include <vector> #include <Math/MatrixUtils.h> #include <MeshUtils/FaceUtils.h> #include <MeshUtils/IsolatedVertexRemoval.h> #include <MeshUtils/ShortEdgeRemoval.h> #include <Predicates/predicates.h> using namespace PyMesh; namespace DegeneratedTriangleRemovalHelper { const size_t INVALID = std::numeric_limits<size_t>::max(); } using namespace DegeneratedTriangleRemovalHelper; DegeneratedTriangleRemoval::DegeneratedTriangleRemoval( const MatrixFr& vertices, const MatrixIr& faces) : m_vertices(vertices), m_faces(faces) { assert(m_vertices.cols() == 3); assert(m_faces.cols() == 3); exactinit(); init_ori_face_indices(); } void DegeneratedTriangleRemoval::run(size_t num_iterations) { size_t num_removed = 0; size_t count = 0; do { num_removed = 0; size_t e_removed = remove_zero_edges(); size_t e_flipped = remove_line_faces(); remove_isolated_vertices(); count++; num_removed += (e_removed + e_flipped); } while (num_removed != 0 && count < num_iterations); if (num_removed != 0) { std::cerr << "Warning: Max number of iterations reached. "; std::cerr << "Not all degenerated faces are removed." << std::endl; } } void DegeneratedTriangleRemoval::init_ori_face_indices() { const size_t num_faces = m_faces.rows(); m_ori_face_indices.resize(num_faces); for (size_t i=0; i<num_faces; i++) { m_ori_face_indices[i] = i; } } size_t DegeneratedTriangleRemoval::remove_zero_edges() { ShortEdgeRemoval remover(m_vertices, m_faces); size_t num_removed = remover.run(0.0); m_vertices = remover.get_vertices(); m_faces = remover.get_faces(); auto sources = remover.get_face_indices(); const size_t num_faces = m_faces.rows(); assert(num_faces == sources.rows()); assert(sources.size() == 0 || sources.minCoeff() >= 0); assert(sources.size() == 0 || sources.maxCoeff() < m_ori_face_indices.size()); VectorI updated_ori_face_indices(num_faces); for (size_t i=0; i<num_faces; i++) { updated_ori_face_indices[i] = m_ori_face_indices[sources[i]]; } m_ori_face_indices = updated_ori_face_indices; return num_removed; } size_t DegeneratedTriangleRemoval::remove_line_faces() { init_edge_map(); auto comp = [&](const Triplet& e1, const Triplet& e2) -> bool{ auto v1 = m_vertices.row(e1.get_ori_data()[0]); auto v2 = m_vertices.row(e1.get_ori_data()[1]); auto v3 = m_vertices.row(e2.get_ori_data()[0]); auto v4 = m_vertices.row(e2.get_ori_data()[1]); return (v1-v2).squaredNorm() > (v3-v4).squaredNorm(); }; const size_t num_faces = m_faces.rows(); std::set<Triplet, decltype(comp)> edges_to_remove(comp); std::vector<size_t> longest_edges(num_faces, INVALID); for (size_t fi=0; fi<num_faces; fi++) { if (!is_degenerated(fi)) continue; const auto& face = m_faces.row(fi); const size_t fi_opp_v = find_longest_edge(fi); const size_t vi_0 = face[(fi_opp_v+1)%3]; const size_t vi_1 = face[(fi_opp_v+2)%3]; Triplet edge(vi_0, vi_1); edges_to_remove.insert(edge); longest_edges[fi] = fi_opp_v; } std::vector<VectorI> new_faces; std::vector<VectorI::Scalar> new_ori_face_indices; std::vector<bool> is_valid(num_faces, true); size_t count = 0; for (auto& edge : edges_to_remove) { auto& neighboring_faces = m_edge_map[edge]; bool all_valid = true; for (auto fj : neighboring_faces) { all_valid &= is_valid[fj]; } if (!all_valid) continue; const size_t vi_0 = edge.get_ori_data()[0]; const size_t vi_1 = edge.get_ori_data()[1]; size_t vi_opp = INVALID; size_t fi = INVALID; for (auto fj : neighboring_faces) { if (longest_edges[fj] == INVALID) continue; const auto neighbor_face = m_faces.row(fj); const size_t vj_opp = neighbor_face[longest_edges[fj]]; if (vj_opp != vi_0 && vj_opp != vi_1) { fi = fj; vi_opp = vj_opp; break; } } assert(vi_opp != INVALID); assert(fi != INVALID); for (auto fj : neighboring_faces) { is_valid[fj] = false; if (fj == fi) continue; const auto neighbor_face = m_faces.row(fj); size_t fj_opp_v = INVALID; for (size_t i=0; i<3; i++) { if (neighbor_face[i] != vi_0 && neighbor_face[i] != vi_1) { fj_opp_v = i; break; } } assert(fj_opp_v != INVALID); const size_t vj_opp = neighbor_face[fj_opp_v]; const size_t vj_0 = neighbor_face[(fj_opp_v+1)%3]; const size_t vj_1 = neighbor_face[(fj_opp_v+2)%3]; new_faces.push_back(Vector3I(vi_opp, vj_opp, vj_0)); new_faces.push_back(Vector3I(vi_opp, vj_1, vj_opp)); new_ori_face_indices.push_back(m_ori_face_indices[fj]); new_ori_face_indices.push_back(m_ori_face_indices[fj]); } count++; } for (size_t fi=0; fi<num_faces; fi++) { if (is_valid[fi]) { new_faces.push_back(m_faces.row(fi)); new_ori_face_indices.push_back(m_ori_face_indices[fi]); } } if (!new_faces.empty()) { m_faces = MatrixUtils::rowstack(new_faces); m_ori_face_indices = MatrixUtils::std2eigen(new_ori_face_indices); } else { m_faces = MatrixIr(0, 3); m_ori_face_indices.resize(0); } assert(m_faces.rows() == new_faces.size()); return count; } void DegeneratedTriangleRemoval::remove_isolated_vertices() { IsolatedVertexRemoval remover(m_vertices, m_faces); remover.run(); m_vertices = remover.get_vertices(); m_faces = remover.get_faces(); } void DegeneratedTriangleRemoval::init_edge_map() { m_edge_map.clear(); const size_t num_faces = m_faces.rows(); assert(m_faces.cols() == 3); for (size_t i=0; i<num_faces; i++) { const auto& f = m_faces.row(i); m_edge_map.insert(Triplet(f[0], f[1]), i); m_edge_map.insert(Triplet(f[1], f[2]), i); m_edge_map.insert(Triplet(f[2], f[0]), i); } } bool DegeneratedTriangleRemoval::is_degenerated(size_t i) const { const auto& f = m_faces.row(i); const auto& v0 = m_vertices.row(f[0]); const auto& v1 = m_vertices.row(f[1]); const auto& v2 = m_vertices.row(f[2]); return FaceUtils::is_colinear_3D(v0, v1, v2); } size_t DegeneratedTriangleRemoval::find_longest_edge(size_t fi) const { const auto& f = m_faces.row(fi); const auto& v0 = m_vertices.row(f[0]); const auto& v1 = m_vertices.row(f[1]); const auto& v2 = m_vertices.row(f[2]); size_t i = 0; if (!(v0[0] == v1[0] || v0[0] == v2[0] || v1[0] == v2[0])) { i = 0; } else if (!(v0[1] == v1[1] || v0[1] == v2[1] || v1[1] == v2[1])) { i = 1; } else if (!(v0[2] == v1[2] || v0[2] == v2[2] || v1[2] == v2[2])) { i = 2; } else { std::cerr << f[0] << ": " << v0 << std::endl; std::cerr << f[1] << ": " << v1 << std::endl; std::cerr << f[2] << ": " << v2 << std::endl; throw RuntimeError("Triangle degenerates to a point, report this bug"); } if (v0[i] < v1[i] && v0[i] > v2[i]) return 0; if (v0[i] > v1[i] && v0[i] < v2[i]) return 0; if (v1[i] < v0[i] && v1[i] > v2[i]) return 1; if (v1[i] > v0[i] && v1[i] < v2[i]) return 1; if (v2[i] < v0[i] && v2[i] > v1[i]) return 2; if (v2[i] > v0[i] && v2[i] < v1[i]) return 2; std::cerr << f[0] << ": " << v0 << std::endl; std::cerr << f[1] << ": " << v1 << std::endl; std::cerr << f[2] << ": " << v2 << std::endl; throw RuntimeError("Triangle contains an zero edge, report this bug"); }
#include "DegeneratedTriangleRemoval.h" #include <cassert> #include <iostream> #include <limits> #include <set> #include <vector> #include <Math/MatrixUtils.h> #include <MeshUtils/FaceUtils.h> #include <MeshUtils/IsolatedVertexRemoval.h> #include <MeshUtils/ShortEdgeRemoval.h> #include <Predicates/predicates.h> using namespace PyMesh; namespace DegeneratedTriangleRemovalHelper { const size_t INVALID = std::numeric_limits<size_t>::max(); } using namespace DegeneratedTriangleRemovalHelper; DegeneratedTriangleRemoval::DegeneratedTriangleRemoval( const MatrixFr& vertices, const MatrixIr& faces) : m_vertices(vertices), m_faces(faces) { assert(m_vertices.cols() == 3); assert(m_faces.cols() == 3); exactinit(); init_ori_face_indices(); } void DegeneratedTriangleRemoval::run(size_t num_iterations) { size_t num_removed = 0; size_t count = 0; do { num_removed = 0; size_t e_removed = remove_zero_edges(); size_t e_flipped = remove_line_faces(); remove_isolated_vertices(); count++; num_removed += (e_removed + e_flipped); } while (num_removed != 0 && count < num_iterations); if (num_removed != 0) { std::cerr << "Warning: Max number of iterations reached. "; std::cerr << "Not all degenerated faces are removed." << std::endl; } } void DegeneratedTriangleRemoval::init_ori_face_indices() { const size_t num_faces = m_faces.rows(); m_ori_face_indices.resize(num_faces); for (size_t i=0; i<num_faces; i++) { m_ori_face_indices[i] = i; } } size_t DegeneratedTriangleRemoval::remove_zero_edges() { ShortEdgeRemoval remover(m_vertices, m_faces); size_t num_removed = remover.run(0.0); m_vertices = remover.get_vertices(); m_faces = remover.get_faces(); auto sources = remover.get_face_indices(); const size_t num_faces = m_faces.rows(); assert(num_faces == sources.rows()); assert(sources.size() == 0 || sources.minCoeff() >= 0); assert(sources.size() == 0 || sources.maxCoeff() < m_ori_face_indices.size()); VectorI updated_ori_face_indices(num_faces); for (size_t i=0; i<num_faces; i++) { updated_ori_face_indices[i] = m_ori_face_indices[sources[i]]; } m_ori_face_indices = updated_ori_face_indices; return num_removed; } size_t DegeneratedTriangleRemoval::remove_line_faces() { init_edge_map(); auto comp = [&](const Triplet& e1, const Triplet& e2) -> bool{ auto v1 = m_vertices.row(e1.get_ori_data()[0]); auto v2 = m_vertices.row(e1.get_ori_data()[1]); auto v3 = m_vertices.row(e2.get_ori_data()[0]); auto v4 = m_vertices.row(e2.get_ori_data()[1]); return (v1-v2).squaredNorm() > (v3-v4).squaredNorm(); }; const size_t num_faces = m_faces.rows(); std::set<Triplet, decltype(comp)> edges_to_remove(comp); std::vector<size_t> longest_edges(num_faces, INVALID); for (size_t fi=0; fi<num_faces; fi++) { if (!is_degenerated(fi)) continue; const auto& face = m_faces.row(fi); const size_t fi_opp_v = find_longest_edge(fi); const size_t vi_0 = face[(fi_opp_v+1)%3]; const size_t vi_1 = face[(fi_opp_v+2)%3]; Triplet edge(vi_0, vi_1); edges_to_remove.insert(edge); longest_edges[fi] = fi_opp_v; } std::vector<VectorI> new_faces; std::vector<VectorI::Scalar> new_ori_face_indices; std::vector<bool> is_valid(num_faces, true); size_t count = 0; for (auto& edge : edges_to_remove) { auto& neighboring_faces = m_edge_map[edge]; bool all_valid = true; for (auto fj : neighboring_faces) { all_valid &= is_valid[fj]; } if (!all_valid) continue; const size_t vi_0 = edge.get_ori_data()[0]; const size_t vi_1 = edge.get_ori_data()[1]; size_t vi_opp = INVALID; size_t fi = INVALID; for (auto fj : neighboring_faces) { if (longest_edges[fj] == INVALID) continue; const auto neighbor_face = m_faces.row(fj); const size_t vj_opp = neighbor_face[longest_edges[fj]]; if (vj_opp != vi_0 && vj_opp != vi_1) { fi = fj; vi_opp = vj_opp; break; } } assert(vi_opp != INVALID); assert(fi != INVALID); for (auto fj : neighboring_faces) { is_valid[fj] = false; if (fj == fi) continue; const auto neighbor_face = m_faces.row(fj); size_t fj_opp_v = INVALID; for (size_t i=0; i<3; i++) {
} assert(fj_opp_v != INVALID); const size_t vj_opp = neighbor_face[fj_opp_v]; const size_t vj_0 = neighbor_face[(fj_opp_v+1)%3]; const size_t vj_1 = neighbor_face[(fj_opp_v+2)%3]; new_faces.push_back(Vector3I(vi_opp, vj_opp, vj_0)); new_faces.push_back(Vector3I(vi_opp, vj_1, vj_opp)); new_ori_face_indices.push_back(m_ori_face_indices[fj]); new_ori_face_indices.push_back(m_ori_face_indices[fj]); } count++; } for (size_t fi=0; fi<num_faces; fi++) { if (is_valid[fi]) { new_faces.push_back(m_faces.row(fi)); new_ori_face_indices.push_back(m_ori_face_indices[fi]); } } if (!new_faces.empty()) { m_faces = MatrixUtils::rowstack(new_faces); m_ori_face_indices = MatrixUtils::std2eigen(new_ori_face_indices); } else { m_faces = MatrixIr(0, 3); m_ori_face_indices.resize(0); } assert(m_faces.rows() == new_faces.size()); return count; } void DegeneratedTriangleRemoval::remove_isolated_vertices() { IsolatedVertexRemoval remover(m_vertices, m_faces); remover.run(); m_vertices = remover.get_vertices(); m_faces = remover.get_faces(); } void DegeneratedTriangleRemoval::init_edge_map() { m_edge_map.clear(); const size_t num_faces = m_faces.rows(); assert(m_faces.cols() == 3); for (size_t i=0; i<num_faces; i++) { const auto& f = m_faces.row(i); m_edge_map.insert(Triplet(f[0], f[1]), i); m_edge_map.insert(Triplet(f[1], f[2]), i); m_edge_map.insert(Triplet(f[2], f[0]), i); } } bool DegeneratedTriangleRemoval::is_degenerated(size_t i) const { const auto& f = m_faces.row(i); const auto& v0 = m_vertices.row(f[0]); const auto& v1 = m_vertices.row(f[1]); const auto& v2 = m_vertices.row(f[2]); return FaceUtils::is_colinear_3D(v0, v1, v2); } size_t DegeneratedTriangleRemoval::find_longest_edge(size_t fi) const { const auto& f = m_faces.row(fi); const auto& v0 = m_vertices.row(f[0]); const auto& v1 = m_vertices.row(f[1]); const auto& v2 = m_vertices.row(f[2]); size_t i = 0; if (!(v0[0] == v1[0] || v0[0] == v2[0] || v1[0] == v2[0])) { i = 0; } else if (!(v0[1] == v1[1] || v0[1] == v2[1] || v1[1] == v2[1])) { i = 1; } else if (!(v0[2] == v1[2] || v0[2] == v2[2] || v1[2] == v2[2])) { i = 2; } else { std::cerr << f[0] << ": " << v0 << std::endl; std::cerr << f[1] << ": " << v1 << std::endl; std::cerr << f[2] << ": " << v2 << std::endl; throw RuntimeError("Triangle degenerates to a point, report this bug"); } if (v0[i] < v1[i] && v0[i] > v2[i]) return 0; if (v0[i] > v1[i] && v0[i] < v2[i]) return 0; if (v1[i] < v0[i] && v1[i] > v2[i]) return 1; if (v1[i] > v0[i] && v1[i] < v2[i]) return 1; if (v2[i] < v0[i] && v2[i] > v1[i]) return 2; if (v2[i] > v0[i] && v2[i] < v1[i]) return 2; std::cerr << f[0] << ": " << v0 << std::endl; std::cerr << f[1] << ": " << v1 << std::endl; std::cerr << f[2] << ": " << v2 << std::endl; throw RuntimeError("Triangle contains an zero edge, report this bug"); }
if (neighbor_face[i] != vi_0 && neighbor_face[i] != vi_1) { fj_opp_v = i; break; }
if_condition
[ { "content": "struct RemoveConst<const T[N]> {\n\n typedef typename RemoveConst<T>::type type[N];\n\n};\n\n\n\n#if defined(_MSC_VER) && _MSC_VER < 1400\n\n// This is the only specialization that allows VC++ 7.1 to remove const in\n\n// 'const int[3] and 'const int[3][4]'. However, it causes trouble with GCC\n\n// and thus needs to be conditionally compiled.\n\ntemplate <typename T, size_t N>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/internal/gtest-internal.h", "rank": 0, "score": 207685.25908348509 }, { "content": "struct IteratorTraits<const T*> {\n\n typedef T value_type;\n\n};\n\n\n\n#if GTEST_OS_WINDOWS\n\n# define GTEST_PATH_SEP_ \"\\\\\"\n\n# define GTEST_HAS_ALT_PATH_SEP_ 1\n\n// The biggest signed integer type the compiler supports.\n\ntypedef __int64 BiggestInt;\n\n#else\n\n# define GTEST_PATH_SEP_ \"/\"\n\n# define GTEST_HAS_ALT_PATH_SEP_ 0\n\ntypedef long long BiggestInt; // NOLINT\n\n#endif // GTEST_OS_WINDOWS\n\n\n\n// Utilities for char.\n\n\n\n// isspace(int ch) and friends accept an unsigned char or EOF. char\n\n// may be signed, depending on the compiler (or compiler flags).\n\n// Therefore we need to cast a char to unsigned char before calling\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/internal/gtest-port.h", "rank": 1, "score": 198337.06117945336 }, { "content": " def __remove_isolated_vertices(self):\n\n remover = IsolatedVertexRemoval(self.vertices, self.faces);\n\n remover.run();\n\n self.vertices = remover.get_vertices();\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/collapse_short_edges.py", "rank": 2, "score": 197144.73063755667 }, { "content": " def __remove_fin_faces(self):\n\n remover = FinFaceRemoval(self.vertices, self.faces);\n\n remover.run();\n\n self.vertices = remover.get_vertices();\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/collapse_short_edges.py", "rank": 3, "score": 197083.35693862228 }, { "content": "struct RemoveConstFromKey<std::pair<const K, V> > {\n\n typedef std::pair<K, V> type;\n\n};\n\n\n\n// Mapping from booleans to types. Similar to boost::bool_<kValue> and\n\n// std::integral_constant<bool, kValue>.\n\ntemplate <bool kValue>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/include/gmock/internal/gmock-internal-utils.h", "rank": 4, "score": 195270.02050562316 }, { "content": "import numpy as np\n\nfrom PyMesh import IsolatedVertexRemoval\n\nfrom ..meshio import form_mesh\n\n\n\ndef remove_isolated_vertices_raw(vertices, elements):\n\n \"\"\" Remove isolated vertices.\n\n\n\n Args:\n\n vertices (``numpy.ndarray``): Vertex array with one vertex per row.\n\n elements (``numpy.ndarray``): Element array with one face per row.\n\n\n\n Returns:\n\n 3 values are returned.\n\n\n\n * ``output_vertices``: Output vertex array with one vertex per row.\n\n * ``output_elements``: Output element array with one element per row.\n\n * ``infomation``: A ``dict`` of additional informations.\n\n\n\n The following fields are defined in ``infomation``:\n\n\n\n * ``num_vertex_removed``: Number of vertex removed.\n\n * ``ori_vertex_index``: Original vertex index. That is vertex ``i`` of\n\n ``output_vertices`` has index ``ori_vertex_index[i]`` in the input\n\n vertex array.\n\n \"\"\"\n\n remover = IsolatedVertexRemoval(vertices, elements);\n\n num_removed = remover.run();\n\n vertices = remover.get_vertices();\n\n elements = remover.get_faces();\n\n info = {\n\n \"num_vertex_removed\": num_removed,\n\n \"ori_vertex_index\": remover.get_ori_vertex_indices().ravel(),\n\n };\n\n return vertices, elements, info;\n\n\n\ndef remove_isolated_vertices(mesh):\n\n \"\"\" Wrapper function of :func:`remove_isolated_vertices_raw`.\n\n\n\n Args:\n\n mesh (:class:`Mesh`): Input mesh.\n\n\n\n Returns:\n\n 2 values are returned.\n\n\n\n * ``output_mesh`` (:class:`Mesh`): Output mesh.\n\n * ``infomation`` (:class:`dict`): A ``dict`` of additional informations.\n\n\n\n The following fields are defined in ``infomation``:\n\n\n\n * ``num_vertex_removed``: Number of vertex removed.\n\n * ``ori_vertex_index``: Original vertex index. That is vertex ``i`` of\n\n ``output_vertices`` has index ``ori_vertex_index[i]`` in the input\n\n vertex array.\n\n \"\"\"\n\n if mesh.num_voxels == 0:\n\n vertices, faces, info = remove_isolated_vertices_raw(\n\n mesh.vertices, mesh.faces);\n\n output_mesh = form_mesh(vertices, faces);\n\n else:\n\n vertices, voxels, info = remove_isolated_vertices_raw(\n\n mesh.vertices, mesh.voxels);\n\n output_mesh = form_mesh(vertices, np.zeros((0, 3)), voxels);\n\n return output_mesh, info;\n\n\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/remove_isolated_vertices.py", "rank": 5, "score": 194833.20345134335 }, { "content": "import numpy as np\n\nfrom PyMesh import DuplicatedVertexRemoval\n\nfrom ..meshio import form_mesh\n\n\n\ndef remove_duplicated_vertices_raw(vertices, elements, tol=1e-12, importance=None):\n\n \"\"\" Merge duplicated vertices into a single vertex.\n\n\n\n Args:\n\n vertices (``numpy.ndarray``): Vertices in row major.\n\n elements (``numpy.ndarray``): Elements in row major.\n\n tol (``float``): (optional) Vertices with distance less than ``tol`` are\n\n considered as duplicates. Default is ``1e-12``.\n\n importance (``numpy.ndarray``): (optional) Per-vertex importance value.\n\n When discarding duplicates, the vertex with the highest importance\n\n value will be kept.\n\n\n\n Returns:\n\n 3 values are returned.\n\n\n\n * ``output_vertices``: Output vertices in row major.\n\n * ``output_elements``: Output elements in row major.\n\n * ``information``: A ``dict`` of additional informations.\n\n\n\n The following fields are defined in ``information``:\n\n\n\n * ``num_vertex_merged``: number of vertex merged.\n\n * ``index_map``: An array that maps input vertex index to output vertex index.\n\n I.e. vertex ``i`` will be mapped to ``index_map[i]`` in the output.\n\n\n\n \"\"\"\n\n\n\n remover = DuplicatedVertexRemoval(vertices, elements);\n\n if importance is not None:\n\n if (len(importance) != len(vertices)):\n\n raise RuntimeError(\n\n \"Vertex importance must be of the same size as vertices\");\n\n remover.set_importance_level(importance);\n\n num_merged = remover.run(tol);\n\n new_vertices = remover.get_vertices();\n\n new_elements = remover.get_faces();\n\n info = {\n\n \"num_vertex_merged\": num_merged,\n\n \"index_map\": remover.get_index_map().ravel(),\n\n };\n\n return new_vertices, new_elements, info;\n\n\n\ndef remove_duplicated_vertices(mesh, tol=1e-12, importance=None):\n\n \"\"\" Wrapper function of :func:`remove_duplicated_vertices_raw`.\n\n\n\n Args:\n\n mesh (:class:`Mesh`): Input mesh.\n\n tol (``float``): (optional) Vertices with distance less than ``tol`` are\n\n considered as duplicates. Default is ``1e-12``.\n\n importance (``numpy.ndarray``): (optional) Per-vertex importance value.\n\n When discarding duplicates, the vertex with the highest importance\n\n value will be kept.\n\n\n\n Returns:\n\n 2 values are returned.\n\n\n\n * ``output_mesh`` (:class:`Mesh`): Output mesh.\n\n * ``information`` (:class:`dict`): A ``dict`` of additional informations.\n\n\n\n The following fields are defined in ``information``:\n\n\n\n * ``num_vertex_merged``: number of vertex merged.\n\n * ``index_map``: An array that maps input vertex index to output vertex index.\n\n I.e. vertex ``i`` will be mapped to ``index_map[i]`` in the output.\n\n\n\n \"\"\"\n\n if mesh.num_voxels == 0:\n\n vertices, faces, info = remove_duplicated_vertices_raw(\n\n mesh.vertices, mesh.faces, tol, importance);\n\n out_mesh = form_mesh(vertices, faces);\n\n else:\n\n vertices, voxels, info = remove_duplicated_vertices_raw(\n\n mesh.vertices, mesh.voxels, tol, importance);\n\n output_mesh = form_mesh(vertices, np.zeros((0, 3)), voxels);\n\n\n\n return out_mesh, info;\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/remove_duplicated_vertices.py", "rank": 6, "score": 194833.20345134335 }, { "content": "import numpy as np\n\nfrom PyMesh import FinFaceRemoval\n\nfrom ..meshio import form_mesh\n\n\n\ndef remove_duplicated_faces_raw(vertices, faces, fins_only=False):\n\n \"\"\" Remove duplicated faces.\n\n\n\n Duplicated faces are defined as faces consist of the same set of vertices.\n\n Depending on the face orientation. A special case of duplicated faces is\n\n a fin. A fin is defined as two duplicated faces with opposite orientaiton.\n\n\n\n If fins_only is set to True, all fins in the mesh are removed. The output\n\n mesh could still contain duplicated faces but no fins.\n\n\n\n If fins_only is not True, all duplicated faces will be removed. There could\n\n be two caes:\n\n\n\n If there is a dominant orientation, that is more than half of the faces are\n\n consistently orientated, and fins_only is False, one face with the dominant\n\n orientation will be kept while all other faces are removed.\n\n\n\n If there is no dominant orientation, i.e. half of the face are positively\n\n orientated and the other half is negatively orientated, all faces are\n\n discarded.\n\n\n\n Args:\n\n vertices (``numpy.ndarray``): Vertex array with one vertex per row.\n\n faces (``numpy.ndarray``): Face array with one face per row.\n\n fins_only (``bool``): If set, only remove fins.\n\n\n\n Returns:\n\n 3 values are returned.\n\n\n\n * ``output_vertices``: Output vertex array, one vertex per row.\n\n * ``output_faces``: Output face array, one face per row.\n\n * ``information``: A ``dict`` of additional informations.\n\n\n\n The following fields are defined in ``information``:\n\n\n\n * ``ori_face_index``: An array of original face indices. I.e. face\n\n ``i`` of the ``output_faces`` has index ``ori_face_index[i]`` in\n\n the input vertices.\n\n\n\n \"\"\"\n\n remover = FinFaceRemoval(vertices, faces);\n\n if fins_only: remover.set_fins_only();\n\n remover.run();\n\n info = {\n\n \"ori_face_index\": remover.get_face_indices().ravel(),\n\n };\n\n return remover.get_vertices(), remover.get_faces(), info;\n\n\n\ndef remove_duplicated_faces(mesh, fins_only=False):\n\n \"\"\" Wrapper function of :func:`remove_duplicated_faces_raw`.\n\n\n\n Args:\n\n mesh (:class:`Mesh`): Input mesh.\n\n fins_only (``bool``): If set, only remove fins.\n\n\n\n Returns:\n\n 2 values are returned.\n\n\n\n * ``output_mesh`` (:class:`Mesh`): Output mesh.\n\n * ``information`` (:class:`dict`): A ``dict`` of additional informations.\n\n\n\n The following fields are defined in ``information``:\n\n\n\n * ``ori_face_index``: An array of original face indices. I.e. face\n\n ``i`` of the ``output_faces`` has index ``ori_face_index[i]`` in\n\n the input vertices.\n\n\n\n \"\"\"\n\n vertices, faces, info = remove_duplicated_faces_raw(\n\n mesh.vertices, mesh.faces, fins_only);\n\n return form_mesh(vertices, faces), info;\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/remove_duplicated_faces.py", "rank": 7, "score": 194768.67109983676 }, { "content": "struct RemoveConst<const T> { typedef T type; }; // NOLINT\n\n\n\n// MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above\n\n// definition to fail to remove the const in 'const int[3]' and 'const\n\n// char[3][4]'. The following specialization works around the bug.\n\ntemplate <typename T, size_t N>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/internal/gtest-internal.h", "rank": 8, "score": 193078.93656213454 }, { "content": "class SetArgumentPointeeAction<N, Proto, true> {\n\n public:\n\n // Constructs an action that sets the variable pointed to by the\n\n // N-th function argument to 'proto'. Both ProtocolMessage and\n\n // proto2::Message have the CopyFrom() method, so the same\n\n // implementation works for both.\n\n explicit SetArgumentPointeeAction(const Proto& proto) : proto_(new Proto) {\n\n proto_->CopyFrom(proto);\n\n }\n\n\n\n template <typename Result, typename ArgumentTuple>\n\n void Perform(const ArgumentTuple& args) const {\n\n CompileAssertTypesEqual<void, Result>();\n\n ::std::tr1::get<N>(args)->CopyFrom(*proto_);\n\n }\n\n\n\n private:\n\n const internal::linked_ptr<Proto> proto_;\n\n\n\n GTEST_DISALLOW_ASSIGN_(SetArgumentPointeeAction);\n\n};\n\n\n\n// Implements the InvokeWithoutArgs(f) action. The template argument\n\n// FunctionImpl is the implementation type of f, which can be either a\n\n// function pointer or a functor. InvokeWithoutArgs(f) can be used as an\n\n// Action<F> as long as f's type is compatible with F (i.e. f can be\n\n// assigned to a tr1::function<F>).\n\ntemplate <typename FunctionImpl>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/include/gmock/gmock-actions.h", "rank": 9, "score": 192327.82539473395 }, { "content": "from pymesh.meshutils import remove_isolated_vertices_raw\n\nfrom pymesh.TestCase import TestCase\n\n\n\nimport numpy as np\n\nimport unittest\n\n\n\nclass RemoveIsolatedVerticesTest(TestCase):\n\n def test_no_isolated_vertices(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n ]);\n\n\n\n faces = np.array([\n\n [0, 1, 2]\n\n ]);\n\n\n\n out_vertices, out_faces, info = remove_isolated_vertices_raw(vertices, faces);\n\n\n\n self.assert_array_equal(vertices, out_vertices);\n\n self.assert_array_equal(faces, out_faces);\n\n self.assertEqual(0, info[\"num_vertex_removed\"]);\n\n self.assert_array_equal(np.arange(3), info[\"ori_vertex_index\"]);\n\n\n\n def test_multiple_isolated_vertices(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n [ 1.0, 1.0, 0.0],\n\n [ 0.0, 0.0, 1.0],\n\n ]);\n\n\n\n faces = np.array([\n\n [0, 1, 4]\n\n ]);\n\n\n\n out_vertices, out_faces, info = remove_isolated_vertices_raw(vertices, faces);\n\n\n\n self.assertEqual(3, len(out_vertices));\n\n self.assertTrue(np.all(out_faces < len(out_vertices)));\n\n self.assertEqual(2, info[\"num_vertex_removed\"]);\n\n self.assert_array_equal([0, 1, 4], info[\"ori_vertex_index\"]);\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/tests/test_remove_isolated_vertices.py", "rank": 10, "score": 188200.2718730756 }, { "content": "from pymesh.meshutils import remove_duplicated_vertices_raw\n\nfrom pymesh.TestCase import TestCase\n\n\n\nimport numpy as np\n\n\n\nclass RemoveDuplicatedVerticesTest(TestCase):\n\n def test_no_removal(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n ], dtype=float);\n\n faces = np.array([\n\n [0, 1, 2],\n\n ], dtype=int);\n\n\n\n out_vertices, out_faces, __ = remove_duplicated_vertices_raw(\n\n vertices, faces);\n\n\n\n self.assert_array_equal(vertices, out_vertices);\n\n self.assert_array_equal(faces, out_faces);\n\n\n\n def test_simple_removal(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n ], dtype=float);\n\n faces = np.array([\n\n [0, 2, 3],\n\n [1, 2, 3]\n\n ], dtype=int);\n\n\n\n out_vertices, out_faces, __ = remove_duplicated_vertices_raw(\n\n vertices, faces);\n\n\n\n self.assertEqual(3, len(out_vertices));\n\n self.assert_array_equal([[0, 1, 2], [0, 1, 2]], out_faces);\n\n\n\n def test_tiny_triangle(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 0.1, 0.0, 0.0],\n\n [ 0.0, 0.1, 0.0],\n\n ], dtype=float);\n\n faces = np.array([\n\n [0, 1, 2],\n\n ], dtype=int);\n\n\n\n out_vertices, out_faces, __ = remove_duplicated_vertices_raw(\n\n vertices, faces, 1.0);\n\n\n\n self.assertEqual(1, len(out_vertices));\n\n self.assert_array_equal([[0, 0, 0]], out_faces);\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/tests/test_remove_duplicated_vertices.py", "rank": 11, "score": 188200.2718730756 }, { "content": "from pymesh.meshutils import remove_duplicated_faces_raw\n\nfrom pymesh.TestCase import TestCase\n\n\n\nimport numpy as np\n\nimport numpy.testing\n\nimport unittest\n\n\n\nclass RemoveDuplicatedFacesTest(TestCase):\n\n def test_double_faces(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n ], dtype=float);\n\n faces = np.array([\n\n [0, 1, 2],\n\n [2, 1, 0],\n\n ], dtype=int);\n\n\n\n out_vertices, out_faces, info = remove_duplicated_faces_raw(vertices, faces);\n\n\n\n # Vertices are left alone.\n\n numpy.testing.assert_array_equal(vertices, out_vertices);\n\n self.assertEqual(0, len(out_faces));\n\n\n\n def test_triple_faces(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n ], dtype=float);\n\n faces = np.array([\n\n [0, 1, 2],\n\n [2, 1, 0],\n\n [0, 2, 1],\n\n ], dtype=int);\n\n\n\n out_vertices, out_faces, info = remove_duplicated_faces_raw(vertices, faces);\n\n\n\n # Vertices are left alone.\n\n numpy.testing.assert_array_equal(vertices, out_vertices);\n\n self.assertEqual(1, len(out_faces));\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/tests/test_remove_duplicated_faces.py", "rank": 12, "score": 188137.88021668085 }, { "content": "def remove_isolated_vertices(mesh):\n\n \"\"\" Wrapper function of :func:`remove_isolated_vertices_raw`.\n\n\n\n Args:\n\n mesh (:class:`Mesh`): Input mesh.\n\n\n\n Returns:\n\n 2 values are returned.\n\n\n\n * ``output_mesh`` (:class:`Mesh`): Output mesh.\n\n * ``infomation`` (:class:`dict`): A ``dict`` of additional informations.\n\n\n\n The following fields are defined in ``infomation``:\n\n\n\n * ``num_vertex_removed``: Number of vertex removed.\n\n * ``ori_vertex_index``: Original vertex index. That is vertex ``i`` of\n\n ``output_vertices`` has index ``ori_vertex_index[i]`` in the input\n\n vertex array.\n\n \"\"\"\n\n if mesh.num_voxels == 0:\n\n vertices, faces, info = remove_isolated_vertices_raw(\n\n mesh.vertices, mesh.faces);\n\n output_mesh = form_mesh(vertices, faces);\n\n else:\n\n vertices, voxels, info = remove_isolated_vertices_raw(\n\n mesh.vertices, mesh.voxels);\n\n output_mesh = form_mesh(vertices, np.zeros((0, 3)), voxels);\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/remove_isolated_vertices.py", "rank": 13, "score": 179180.68844942682 }, { "content": "def remove_duplicated_vertices(mesh, tol=1e-12, importance=None):\n\n \"\"\" Wrapper function of :func:`remove_duplicated_vertices_raw`.\n\n\n\n Args:\n\n mesh (:class:`Mesh`): Input mesh.\n\n tol (``float``): (optional) Vertices with distance less than ``tol`` are\n\n considered as duplicates. Default is ``1e-12``.\n\n importance (``numpy.ndarray``): (optional) Per-vertex importance value.\n\n When discarding duplicates, the vertex with the highest importance\n\n value will be kept.\n\n\n\n Returns:\n\n 2 values are returned.\n\n\n\n * ``output_mesh`` (:class:`Mesh`): Output mesh.\n\n * ``information`` (:class:`dict`): A ``dict`` of additional informations.\n\n\n\n The following fields are defined in ``information``:\n\n\n\n * ``num_vertex_merged``: number of vertex merged.\n\n * ``index_map``: An array that maps input vertex index to output vertex index.\n\n I.e. vertex ``i`` will be mapped to ``index_map[i]`` in the output.\n\n\n\n \"\"\"\n\n if mesh.num_voxels == 0:\n\n vertices, faces, info = remove_duplicated_vertices_raw(\n\n mesh.vertices, mesh.faces, tol, importance);\n\n out_mesh = form_mesh(vertices, faces);\n\n else:\n\n vertices, voxels, info = remove_duplicated_vertices_raw(\n\n mesh.vertices, mesh.voxels, tol, importance);\n\n output_mesh = form_mesh(vertices, np.zeros((0, 3)), voxels);\n\n\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/remove_duplicated_vertices.py", "rank": 14, "score": 179175.8209691525 }, { "content": "def remove_duplicated_faces(mesh, fins_only=False):\n\n \"\"\" Wrapper function of :func:`remove_duplicated_faces_raw`.\n\n\n\n Args:\n\n mesh (:class:`Mesh`): Input mesh.\n\n fins_only (``bool``): If set, only remove fins.\n\n\n\n Returns:\n\n 2 values are returned.\n\n\n\n * ``output_mesh`` (:class:`Mesh`): Output mesh.\n\n * ``information`` (:class:`dict`): A ``dict`` of additional informations.\n\n\n\n The following fields are defined in ``information``:\n\n\n\n * ``ori_face_index``: An array of original face indices. I.e. face\n\n ``i`` of the ``output_faces`` has index ``ori_face_index[i]`` in\n\n the input vertices.\n\n\n\n \"\"\"\n\n vertices, faces, info = remove_duplicated_faces_raw(\n\n mesh.vertices, mesh.faces, fins_only);\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/remove_duplicated_faces.py", "rank": 15, "score": 179109.8826717141 }, { "content": "def remove_isolated_vertices_raw(vertices, elements):\n\n \"\"\" Remove isolated vertices.\n\n\n\n Args:\n\n vertices (``numpy.ndarray``): Vertex array with one vertex per row.\n\n elements (``numpy.ndarray``): Element array with one face per row.\n\n\n\n Returns:\n\n 3 values are returned.\n\n\n\n * ``output_vertices``: Output vertex array with one vertex per row.\n\n * ``output_elements``: Output element array with one element per row.\n\n * ``infomation``: A ``dict`` of additional informations.\n\n\n\n The following fields are defined in ``infomation``:\n\n\n\n * ``num_vertex_removed``: Number of vertex removed.\n\n * ``ori_vertex_index``: Original vertex index. That is vertex ``i`` of\n\n ``output_vertices`` has index ``ori_vertex_index[i]`` in the input\n\n vertex array.\n\n \"\"\"\n\n remover = IsolatedVertexRemoval(vertices, elements);\n\n num_removed = remover.run();\n\n vertices = remover.get_vertices();\n\n elements = remover.get_faces();\n\n info = {\n\n \"num_vertex_removed\": num_removed,\n\n \"ori_vertex_index\": remover.get_ori_vertex_indices().ravel(),\n\n };\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/remove_isolated_vertices.py", "rank": 16, "score": 177012.8742194173 }, { "content": "def remove_duplicated_vertices_raw(vertices, elements, tol=1e-12, importance=None):\n\n \"\"\" Merge duplicated vertices into a single vertex.\n\n\n\n Args:\n\n vertices (``numpy.ndarray``): Vertices in row major.\n\n elements (``numpy.ndarray``): Elements in row major.\n\n tol (``float``): (optional) Vertices with distance less than ``tol`` are\n\n considered as duplicates. Default is ``1e-12``.\n\n importance (``numpy.ndarray``): (optional) Per-vertex importance value.\n\n When discarding duplicates, the vertex with the highest importance\n\n value will be kept.\n\n\n\n Returns:\n\n 3 values are returned.\n\n\n\n * ``output_vertices``: Output vertices in row major.\n\n * ``output_elements``: Output elements in row major.\n\n * ``information``: A ``dict`` of additional informations.\n\n\n\n The following fields are defined in ``information``:\n\n\n\n * ``num_vertex_merged``: number of vertex merged.\n\n * ``index_map``: An array that maps input vertex index to output vertex index.\n\n I.e. vertex ``i`` will be mapped to ``index_map[i]`` in the output.\n\n\n\n \"\"\"\n\n\n\n remover = DuplicatedVertexRemoval(vertices, elements);\n\n if importance is not None:\n\n if (len(importance) != len(vertices)):\n\n raise RuntimeError(\n\n \"Vertex importance must be of the same size as vertices\");\n\n remover.set_importance_level(importance);\n\n num_merged = remover.run(tol);\n\n new_vertices = remover.get_vertices();\n\n new_elements = remover.get_faces();\n\n info = {\n\n \"num_vertex_merged\": num_merged,\n\n \"index_map\": remover.get_index_map().ravel(),\n\n };\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/remove_duplicated_vertices.py", "rank": 17, "score": 177002.1766115245 }, { "content": "def remove_duplicated_faces_raw(vertices, faces, fins_only=False):\n\n \"\"\" Remove duplicated faces.\n\n\n\n Duplicated faces are defined as faces consist of the same set of vertices.\n\n Depending on the face orientation. A special case of duplicated faces is\n\n a fin. A fin is defined as two duplicated faces with opposite orientaiton.\n\n\n\n If fins_only is set to True, all fins in the mesh are removed. The output\n\n mesh could still contain duplicated faces but no fins.\n\n\n\n If fins_only is not True, all duplicated faces will be removed. There could\n\n be two caes:\n\n\n\n If there is a dominant orientation, that is more than half of the faces are\n\n consistently orientated, and fins_only is False, one face with the dominant\n\n orientation will be kept while all other faces are removed.\n\n\n\n If there is no dominant orientation, i.e. half of the face are positively\n\n orientated and the other half is negatively orientated, all faces are\n\n discarded.\n\n\n\n Args:\n\n vertices (``numpy.ndarray``): Vertex array with one vertex per row.\n\n faces (``numpy.ndarray``): Face array with one face per row.\n\n fins_only (``bool``): If set, only remove fins.\n\n\n\n Returns:\n\n 3 values are returned.\n\n\n\n * ``output_vertices``: Output vertex array, one vertex per row.\n\n * ``output_faces``: Output face array, one face per row.\n\n * ``information``: A ``dict`` of additional informations.\n\n\n\n The following fields are defined in ``information``:\n\n\n\n * ``ori_face_index``: An array of original face indices. I.e. face\n\n ``i`` of the ``output_faces`` has index ``ori_face_index[i]`` in\n\n the input vertices.\n\n\n\n \"\"\"\n\n remover = FinFaceRemoval(vertices, faces);\n\n if fins_only: remover.set_fins_only();\n\n remover.run();\n\n info = {\n\n \"ori_face_index\": remover.get_face_indices().ravel(),\n\n };\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/remove_duplicated_faces.py", "rank": 18, "score": 176943.22692630906 }, { "content": "struct LosslessArithmeticConvertibleImpl<kBool, bool, kBool, bool>\n\n : public true_type {}; // NOLINT\n\n\n\n// Converting bool to any integer type is lossless.\n\ntemplate <typename To>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/include/gmock/internal/gmock-internal-utils.h", "rank": 19, "score": 176404.70298680058 }, { "content": "struct TupleElement<true, 3, GTEST_10_TUPLE_(T) > {\n\n typedef T3 type;\n\n};\n\n\n\ntemplate <GTEST_10_TYPENAMES_(T)>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/internal/gtest-tuple.h", "rank": 20, "score": 173698.6093473549 }, { "content": "struct TupleElement<true, 0, GTEST_10_TUPLE_(T) > {\n\n typedef T0 type;\n\n};\n\n\n\ntemplate <GTEST_10_TYPENAMES_(T)>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/internal/gtest-tuple.h", "rank": 21, "score": 173694.37077978894 }, { "content": "class RemoveDuplicatedVerticesTest(TestCase):\n\n def test_no_removal(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n ], dtype=float);\n\n faces = np.array([\n\n [0, 1, 2],\n\n ], dtype=int);\n\n\n\n out_vertices, out_faces, __ = remove_duplicated_vertices_raw(\n\n vertices, faces);\n\n\n\n self.assert_array_equal(vertices, out_vertices);\n\n self.assert_array_equal(faces, out_faces);\n\n\n\n def test_simple_removal(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n ], dtype=float);\n\n faces = np.array([\n\n [0, 2, 3],\n\n [1, 2, 3]\n\n ], dtype=int);\n\n\n\n out_vertices, out_faces, __ = remove_duplicated_vertices_raw(\n\n vertices, faces);\n\n\n\n self.assertEqual(3, len(out_vertices));\n\n self.assert_array_equal([[0, 1, 2], [0, 1, 2]], out_faces);\n\n\n\n def test_tiny_triangle(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 0.1, 0.0, 0.0],\n\n [ 0.0, 0.1, 0.0],\n\n ], dtype=float);\n\n faces = np.array([\n\n [0, 1, 2],\n\n ], dtype=int);\n\n\n\n out_vertices, out_faces, __ = remove_duplicated_vertices_raw(\n\n vertices, faces, 1.0);\n\n\n\n self.assertEqual(1, len(out_vertices));\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/tests/test_remove_duplicated_vertices.py", "rank": 22, "score": 172803.42166140876 }, { "content": "class RemoveIsolatedVerticesTest(TestCase):\n\n def test_no_isolated_vertices(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n ]);\n\n\n\n faces = np.array([\n\n [0, 1, 2]\n\n ]);\n\n\n\n out_vertices, out_faces, info = remove_isolated_vertices_raw(vertices, faces);\n\n\n\n self.assert_array_equal(vertices, out_vertices);\n\n self.assert_array_equal(faces, out_faces);\n\n self.assertEqual(0, info[\"num_vertex_removed\"]);\n\n self.assert_array_equal(np.arange(3), info[\"ori_vertex_index\"]);\n\n\n\n def test_multiple_isolated_vertices(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n [ 1.0, 1.0, 0.0],\n\n [ 0.0, 0.0, 1.0],\n\n ]);\n\n\n\n faces = np.array([\n\n [0, 1, 4]\n\n ]);\n\n\n\n out_vertices, out_faces, info = remove_isolated_vertices_raw(vertices, faces);\n\n\n\n self.assertEqual(3, len(out_vertices));\n\n self.assertTrue(np.all(out_faces < len(out_vertices)));\n\n self.assertEqual(2, info[\"num_vertex_removed\"]);\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/tests/test_remove_isolated_vertices.py", "rank": 23, "score": 172803.42166140876 }, { "content": "class RemoveDuplicatedFacesTest(TestCase):\n\n def test_double_faces(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n ], dtype=float);\n\n faces = np.array([\n\n [0, 1, 2],\n\n [2, 1, 0],\n\n ], dtype=int);\n\n\n\n out_vertices, out_faces, info = remove_duplicated_faces_raw(vertices, faces);\n\n\n\n # Vertices are left alone.\n\n numpy.testing.assert_array_equal(vertices, out_vertices);\n\n self.assertEqual(0, len(out_faces));\n\n\n\n def test_triple_faces(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n ], dtype=float);\n\n faces = np.array([\n\n [0, 1, 2],\n\n [2, 1, 0],\n\n [0, 2, 1],\n\n ], dtype=int);\n\n\n\n out_vertices, out_faces, info = remove_duplicated_faces_raw(vertices, faces);\n\n\n\n # Vertices are left alone.\n\n numpy.testing.assert_array_equal(vertices, out_vertices);\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/tests/test_remove_duplicated_faces.py", "rank": 24, "score": 172725.0973377171 }, { "content": " def count(self):\n", "file_path": "dependencies/PyMesh/python/pymesh/timethis.py", "rank": 25, "score": 165494.86218172975 }, { "content": "// Implements the Return() action.\n\nclass ReturnVoidAction {\n\n public:\n\n // Allows Return() to be used in any void-returning function.\n\n template <typename Result, typename ArgumentTuple>\n\n static void Perform(const ArgumentTuple&) {\n\n CompileAssertTypesEqual<void, Result>();\n\n }\n\n};\n\n\n\n// Implements the polymorphic ReturnRef(x) action, which can be used\n\n// in any function that returns a reference to the type of x,\n\n// regardless of the argument types.\n\ntemplate <typename T>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/include/gmock/gmock-actions.h", "rank": 26, "score": 163507.3723252705 }, { "content": " def test_no_removal(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n ], dtype=float);\n\n faces = np.array([\n\n [0, 1, 2],\n\n ], dtype=int);\n\n\n\n out_vertices, out_faces, __ = remove_duplicated_vertices_raw(\n\n vertices, faces);\n\n\n\n self.assert_array_equal(vertices, out_vertices);\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/tests/test_remove_duplicated_vertices.py", "rank": 27, "score": 161213.72251137815 }, { "content": "struct RemoveConst<const T[N]> {\n\n typedef typename RemoveConst<T>::type type[N];\n\n};\n\n\n\n#if defined(_MSC_VER) && _MSC_VER < 1400\n\n// This is the only specialization that allows VC++ 7.1 to remove const in\n\n// 'const int[3] and 'const int[3][4]'. However, it causes trouble with GCC\n\n// and thus needs to be conditionally compiled.\n\ntemplate <typename T, size_t N>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/fused-src/gtest/gtest.h", "rank": 28, "score": 160599.48669645196 }, { "content": "class SetErrnoAndReturnAction {\n\n public:\n\n SetErrnoAndReturnAction(int errno_value, T result)\n\n : errno_(errno_value),\n\n result_(result) {}\n\n template <typename Result, typename ArgumentTuple>\n\n Result Perform(const ArgumentTuple& /* args */) const {\n\n errno = errno_;\n\n return result_;\n\n }\n\n\n\n private:\n\n const int errno_;\n\n const T result_;\n\n\n\n GTEST_DISALLOW_ASSIGN_(SetErrnoAndReturnAction);\n\n};\n\n\n\n#endif // !GTEST_OS_WINDOWS_MOBILE\n\n\n\n// Implements the SetArgumentPointee<N>(x) action for any function\n\n// whose N-th argument (0-based) is a pointer to x's type. The\n\n// template parameter kIsProto is true iff type A is ProtocolMessage,\n\n// proto2::Message, or a sub-class of those.\n\ntemplate <size_t N, typename A, bool kIsProto>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/include/gmock/gmock-actions.h", "rank": 29, "score": 160577.15156848638 }, { "content": " def test_no_isolated_vertices(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n ]);\n\n\n\n faces = np.array([\n\n [0, 1, 2]\n\n ]);\n\n\n\n out_vertices, out_faces, info = remove_isolated_vertices_raw(vertices, faces);\n\n\n\n self.assert_array_equal(vertices, out_vertices);\n\n self.assert_array_equal(faces, out_faces);\n\n self.assertEqual(0, info[\"num_vertex_removed\"]);\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/tests/test_remove_isolated_vertices.py", "rank": 30, "score": 159030.44837376065 }, { "content": " def test_simple_removal(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n ], dtype=float);\n\n faces = np.array([\n\n [0, 2, 3],\n\n [1, 2, 3]\n\n ], dtype=int);\n\n\n\n out_vertices, out_faces, __ = remove_duplicated_vertices_raw(\n\n vertices, faces);\n\n\n\n self.assertEqual(3, len(out_vertices));\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/tests/test_remove_duplicated_vertices.py", "rank": 31, "score": 159005.8308355033 }, { "content": " def test_triple_faces(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n ], dtype=float);\n\n faces = np.array([\n\n [0, 1, 2],\n\n [2, 1, 0],\n\n [0, 2, 1],\n\n ], dtype=int);\n\n\n\n out_vertices, out_faces, info = remove_duplicated_faces_raw(vertices, faces);\n\n\n\n # Vertices are left alone.\n\n numpy.testing.assert_array_equal(vertices, out_vertices);\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/tests/test_remove_duplicated_faces.py", "rank": 32, "score": 158951.30004626734 }, { "content": " def test_double_faces(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n ], dtype=float);\n\n faces = np.array([\n\n [0, 1, 2],\n\n [2, 1, 0],\n\n ], dtype=int);\n\n\n\n out_vertices, out_faces, info = remove_duplicated_faces_raw(vertices, faces);\n\n\n\n # Vertices are left alone.\n\n numpy.testing.assert_array_equal(vertices, out_vertices);\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/tests/test_remove_duplicated_faces.py", "rank": 33, "score": 158951.30004626734 }, { "content": "struct RemoveConst<const T[N]> {\n\n typedef typename RemoveConst<T>::type type[N];\n\n};\n\n\n\n#if defined(_MSC_VER) && _MSC_VER < 1400\n\n// This is the only specialization that allows VC++ 7.1 to remove const in\n\n// 'const int[3] and 'const int[3][4]'. However, it causes trouble with GCC\n\n// and thus needs to be conditionally compiled.\n\ntemplate <typename T, size_t N>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/fused-src/gtest/gtest.h", "rank": 34, "score": 158939.79869137998 }, { "content": "struct RemoveConstFromKey {\n\n typedef T type;\n\n};\n\n\n\n// Partially specialized to remove constness from std::pair<const K, V>.\n\ntemplate <typename K, typename V>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/include/gmock/internal/gmock-internal-utils.h", "rank": 35, "score": 157690.31438549873 }, { "content": " def test_multiple_isolated_vertices(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n [ 1.0, 1.0, 0.0],\n\n [ 0.0, 0.0, 1.0],\n\n ]);\n\n\n\n faces = np.array([\n\n [0, 1, 4]\n\n ]);\n\n\n\n out_vertices, out_faces, info = remove_isolated_vertices_raw(vertices, faces);\n\n\n\n self.assertEqual(3, len(out_vertices));\n\n self.assertTrue(np.all(out_faces < len(out_vertices)));\n\n self.assertEqual(2, info[\"num_vertex_removed\"]);\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/tests/test_remove_isolated_vertices.py", "rank": 36, "score": 156884.4117008424 }, { "content": " const char* e2,\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/gtest_pred_impl.h", "rank": 37, "score": 156306.2747611113 }, { "content": " const char* e1,\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/gtest_pred_impl.h", "rank": 38, "score": 156304.51867493588 }, { "content": "class DefaultValue<void> {\n\n public:\n\n static bool Exists() { return true; }\n\n static void Get() {}\n\n};\n\n\n\n// Points to the user-set default value for type T.\n\ntemplate <typename T>\n\nconst T* DefaultValue<T>::value_ = NULL;\n\n\n\n// Points to the user-set default value for type T&.\n\ntemplate <typename T>\n\nT* DefaultValue<T&>::address_ = NULL;\n\n\n\n// Implement this interface to define an action for function type F.\n\ntemplate <typename F>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/include/gmock/gmock-actions.h", "rank": 39, "score": 156102.75792150287 }, { "content": "class EqHelper<true> {\n\n public:\n\n // We define two overloaded versions of Compare(). The first\n\n // version will be picked when the second argument to ASSERT_EQ() is\n\n // NOT a pointer, e.g. ASSERT_EQ(0, AnIntFunction()) or\n\n // EXPECT_EQ(false, a_bool).\n\n template <typename T1, typename T2>\n\n static AssertionResult Compare(\n\n const char* expected_expression,\n\n const char* actual_expression,\n\n const T1& expected,\n\n const T2& actual,\n\n // The following line prevents this overload from being considered if T2\n\n // is not a pointer type. We need this because ASSERT_EQ(NULL, my_ptr)\n\n // expands to Compare(\"\", \"\", NULL, my_ptr), which requires a conversion\n\n // to match the Secret* in the other overload, which would otherwise make\n\n // this template match better.\n\n typename EnableIf<!is_pointer<T2>::value>::type* = 0) {\n\n return CmpHelperEQ(expected_expression, actual_expression, expected,\n\n actual);\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/gtest.h", "rank": 40, "score": 156055.310743908 }, { "content": "struct RemoveConst<T[N]> {\n\n typedef typename RemoveConst<T>::type type[N];\n\n};\n\n#endif\n\n\n\n// A handy wrapper around RemoveConst that works when the argument\n\n// T depends on template parameters.\n\n#define GTEST_REMOVE_CONST_(T) \\\n\n typename ::testing::internal::RemoveConst<T>::type\n\n\n\n// Turns const U&, U&, const U, and U all into U.\n\n#define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \\\n\n GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T))\n\n\n\n// Adds reference to a type if it is not a reference type,\n\n// otherwise leaves it unchanged. This is the same as\n\n// tr1::add_reference, which is not widely available yet.\n\ntemplate <typename T>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/internal/gtest-internal.h", "rank": 41, "score": 154985.0898034813 }, { "content": "struct IteratorTraits<const T*> {\n\n typedef T value_type;\n\n};\n\n\n\n#if GTEST_OS_WINDOWS\n\n# define GTEST_PATH_SEP_ \"\\\\\"\n\n# define GTEST_HAS_ALT_PATH_SEP_ 1\n\n// The biggest signed integer type the compiler supports.\n\ntypedef __int64 BiggestInt;\n\n#else\n\n# define GTEST_PATH_SEP_ \"/\"\n\n# define GTEST_HAS_ALT_PATH_SEP_ 0\n\ntypedef long long BiggestInt; // NOLINT\n\n#endif // GTEST_OS_WINDOWS\n\n\n\n// Utilities for char.\n\n\n\n// isspace(int ch) and friends accept an unsigned char or EOF. char\n\n// may be signed, depending on the compiler (or compiler flags).\n\n// Therefore we need to cast a char to unsigned char before calling\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/fused-src/gtest/gtest.h", "rank": 42, "score": 150804.25901849993 }, { "content": "struct LosslessArithmeticConvertibleImpl<kBool, bool, kInteger, To>\n\n : public true_type {}; // NOLINT\n\n\n\n// Converting bool to any floating-point type is lossless.\n\ntemplate <typename To>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/include/gmock/internal/gmock-internal-utils.h", "rank": 43, "score": 150772.85746387483 }, { "content": "struct LosslessArithmeticConvertibleImpl<kInteger, From, kBool, bool>\n\n : public false_type {}; // NOLINT\n\n\n\n// Converting an integer to another non-bool integer is lossless iff\n\n// the target type's range encloses the source type's range.\n\ntemplate <typename From, typename To>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/include/gmock/internal/gmock-internal-utils.h", "rank": 44, "score": 150772.85746387483 }, { "content": "struct RemoveConstFromKey<std::pair<const K, V> > {\n\n typedef std::pair<K, V> type;\n\n};\n\n\n\n// Mapping from booleans to types. Similar to boost::bool_<kValue> and\n\n// std::integral_constant<bool, kValue>.\n\ntemplate <bool kValue>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/fused-src/gmock/gmock.h", "rank": 45, "score": 150344.85191801187 }, { "content": "struct RemoveConst { typedef T type; }; // NOLINT\n\ntemplate <typename T>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/internal/gtest-internal.h", "rank": 46, "score": 149843.85728368102 }, { "content": "struct LosslessArithmeticConvertibleImpl<kFloatingPoint, From, kBool, bool>\n\n : public false_type {}; // NOLINT\n\n\n\n// Converting a floating-point to an integer is lossy.\n\ntemplate <typename From, typename To>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/include/gmock/internal/gmock-internal-utils.h", "rank": 47, "score": 149299.04359523824 }, { "content": "struct LosslessArithmeticConvertibleImpl<kBool, bool, kFloatingPoint, To>\n\n : public true_type {}; // NOLINT\n\n\n\n// Converting an integer to bool is lossy.\n\ntemplate <typename From>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/include/gmock/internal/gmock-internal-utils.h", "rank": 48, "score": 149299.04359523824 }, { "content": "struct IteratorTraits<const T*> {\n\n typedef T value_type;\n\n};\n\n\n\n#if GTEST_OS_WINDOWS\n\n# define GTEST_PATH_SEP_ \"\\\\\"\n\n# define GTEST_HAS_ALT_PATH_SEP_ 1\n\n// The biggest signed integer type the compiler supports.\n\ntypedef __int64 BiggestInt;\n\n#else\n\n# define GTEST_PATH_SEP_ \"/\"\n\n# define GTEST_HAS_ALT_PATH_SEP_ 0\n\ntypedef long long BiggestInt; // NOLINT\n\n#endif // GTEST_OS_WINDOWS\n\n\n\n// Utilities for char.\n\n\n\n// isspace(int ch) and friends accept an unsigned char or EOF. char\n\n// may be signed, depending on the compiler (or compiler flags).\n\n// Therefore we need to cast a char to unsigned char before calling\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/fused-src/gtest/gtest.h", "rank": 49, "score": 148927.4874565561 }, { "content": "import PyMesh\n\n\n\ndef compute_winding_number(mesh, queries, engine=\"auto\"):\n\n \"\"\" Compute winding number with respect to `mesh` at `queries`.\n\n\n\n Args:\n\n mesh (:class:`Mesh`): The mesh for which winding number is evaluated.\n\n queries (:class:`numpy.ndarray`): N by 3 matrix of query points at which\n\n winding number is evaluated.\n\n\n\n Returns:\n\n A list of size N, represent the winding nubmers at each query points in\n\n order.\n\n \"\"\"\n\n assert(mesh.dim == 3);\n\n assert(mesh.vertex_per_face == 3);\n\n\n\n if engine == \"auto\":\n\n engine = \"igl\";\n\n\n\n engine = PyMesh.WindingNumberEngine.create(engine);\n\n engine.set_mesh(mesh.vertices, mesh.faces);\n\n winding_numbers = engine.run(queries).ravel();\n\n\n\n return winding_numbers;\n", "file_path": "dependencies/PyMesh/python/pymesh/winding_number.py", "rank": 50, "score": 148272.1032585054 }, { "content": "class BuiltInDefaultValue<const T> {\n\n public:\n\n static bool Exists() { return BuiltInDefaultValue<T>::Exists(); }\n\n static T Get() { return BuiltInDefaultValue<T>::Get(); }\n\n};\n\n\n\n// This partial specialization defines the default values for pointer\n\n// types.\n\ntemplate <typename T>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/include/gmock/gmock-actions.h", "rank": 51, "score": 148222.01874080085 }, { "content": "struct RemoveConst<const T> { typedef T type; }; // NOLINT\n\n\n\n// MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above\n\n// definition to fail to remove the const in 'const int[3]' and 'const\n\n// char[3][4]'. The following specialization works around the bug.\n\ntemplate <typename T, size_t N>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/fused-src/gtest/gtest.h", "rank": 52, "score": 148153.76797452325 }, { "content": " def test_face_edge_touch(self):\n\n mesh_1 = generate_box_mesh(\n\n np.array([0, 0, 0]), np.array([1, 1, 1]));\n\n\n\n rot = Quaternion.fromData(\n\n np.array([1, 0, 1], dtype=float),\n\n np.array([0, 0, 1], dtype=float));\n\n mesh_2 = form_mesh(\n\n np.dot(rot.to_matrix(), mesh_1.vertices.T).T +\n\n np.array([0.5, 0.5, 1.0]),\n\n mesh_1.faces);\n\n\n\n mesh = merge_meshes((mesh_1, mesh_2));\n\n output_mesh = resolve_self_intersection(mesh);\n\n\n\n self.assert_self_intersect(mesh);\n\n self.assert_no_self_intersect(output_mesh);\n", "file_path": "dependencies/PyMesh/python/pymesh/tests/test_selfintersection.py", "rank": 53, "score": 147775.58661375986 }, { "content": " def test_face_edge_touch(self):\n\n mesh_1 = generate_box_mesh(\n\n np.array([0, 0, 0]), np.array([1, 1, 1]));\n\n\n\n rot = Quaternion.fromData(\n\n np.array([1, 0, 1], dtype=float),\n\n np.array([0, 0, 1], dtype=float));\n\n mesh_2 = form_mesh(\n\n np.dot(rot.to_matrix(), mesh_1.vertices.T).T +\n\n np.array([0.5, 0.5, 1.0]),\n\n mesh_1.faces);\n\n\n\n mesh = boolean(mesh_1, mesh_2, \"union\", \"igl\");\n\n\n\n self.assertEqual(17, mesh.num_vertices);\n\n self.assertEqual(30, mesh.num_faces);\n\n self.assertFalse(mesh.is_manifold());\n\n self.assertTrue(mesh.is_closed());\n", "file_path": "dependencies/PyMesh/python/pymesh/tests/test_boolean.py", "rank": 54, "score": 147775.58661375986 }, { "content": " def get_edge_adj_faces(self, mesh):\n\n self.assertEqual(3, mesh.vertex_per_face);\n\n edge_adj_faces = {};\n\n for i, f in enumerate(mesh.faces):\n\n f = sorted(f);\n\n edges = [(f[0], f[1]),\n\n (f[1], f[2]),\n\n (f[0], f[2])];\n\n for e in edges:\n\n if e in edge_adj_faces:\n\n edge_adj_faces[e].append(i);\n\n else:\n\n edge_adj_faces[e] = [i];\n\n\n", "file_path": "dependencies/PyMesh/python/pymesh/tests/test_selfintersection.py", "rank": 55, "score": 147775.58661375986 }, { "content": "struct RemoveConst<const T> { typedef T type; }; // NOLINT\n\n\n\n// MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above\n\n// definition to fail to remove the const in 'const int[3]' and 'const\n\n// char[3][4]'. The following specialization works around the bug.\n\ntemplate <typename T, size_t N>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/fused-src/gtest/gtest.h", "rank": 56, "score": 146629.3355975274 }, { "content": "class UniversalTersePrinter<const char*> {\n\n public:\n\n static void Print(const char* str, ::std::ostream* os) {\n\n if (str == NULL) {\n\n *os << \"NULL\";\n\n } else {\n\n UniversalPrint(string(str), os);\n\n }\n\n }\n\n};\n\ntemplate <>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/gtest-printers.h", "rank": 57, "score": 146421.74286273657 }, { "content": "class UniversalTersePrinter<const wchar_t*> {\n\n public:\n\n static void Print(const wchar_t* str, ::std::ostream* os) {\n\n if (str == NULL) {\n\n *os << \"NULL\";\n\n } else {\n\n UniversalPrint(::std::wstring(str), os);\n\n }\n\n }\n\n};\n\n#endif\n\n\n\ntemplate <>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/gtest-printers.h", "rank": 58, "score": 146421.74286273657 }, { "content": "import sys\n\nimport os.path\n\n\n\npackage_dir = os.path.abspath(os.path.dirname(__file__));\n\nsys.path.append(os.path.join(package_dir, \"lib\"));\n\n#sys.path.append(os.path.join(package_dir, \"swig\"));\n\n\n", "file_path": "dependencies/PyMesh/python/pymesh/PyMeshSetting.py", "rank": 59, "score": 146383.2425916887 }, { "content": "import PyMesh\n\nimport numpy as np\n\n\n\ndef is_colinear(v0, v1, v2):\n\n \"\"\" Return true if ``v0``, ``v1`` and ``v2`` are colinear.\n\n Colinear check is done using exact predicates.\n\n\n\n Args:\n\n v0 (``numpy.ndarray``): vector of size 2 or 3.\n\n v1 (``numpy.ndarray``): vector of size 2 or 3.\n\n v2 (``numpy.ndarray``): vector of size 2 or 3.\n\n\n\n Return:\n\n A boolean indicating whether ``v0``, ``v1`` and ``v2`` are colinear.\n\n \"\"\"\n\n dim = len(v0);\n\n if dim == 2:\n\n return PyMesh.is_colinear_2D(v0, v1, v2);\n\n elif dim == 3:\n\n return PyMesh.is_colinear_3D(v0, v1, v2);\n\n else:\n\n raise NotImplementedError(\"Supported dimention {}\".format(dim));\n\n\n\ndef get_degenerated_faces_raw(vertices, faces):\n\n \"\"\" Return indices of degenerated faces.\n\n A face is degenerated if all its 3 corners are colinear.\n\n\n\n Args:\n\n vertices (``numpy.ndarray``): Vertex matrix.\n\n faces (``numpy.ndarray``): Face matrix.\n\n\n\n Returns:\n\n A ``numpy.ndarray`` of indices of degenerated faces.\n\n \"\"\"\n\n return np.array(PyMesh.get_degenerated_faces(vertices, faces));\n\n\n\ndef get_degenerated_faces(mesh):\n\n \"\"\" A thin wrapper for :py:func:`get_degenerated_faces_raw`.\n\n \"\"\"\n\n return get_degenerated_faces_raw(mesh.vertices, mesh.faces);\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/face_utils.py", "rank": 60, "score": 144730.4603721215 }, { "content": " def test_tiny_triangle(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 0.1, 0.0, 0.0],\n\n [ 0.0, 0.1, 0.0],\n\n ], dtype=float);\n\n faces = np.array([\n\n [0, 1, 2],\n\n ], dtype=int);\n\n\n\n out_vertices, out_faces, __ = remove_duplicated_vertices_raw(\n\n vertices, faces, 1.0);\n\n\n\n self.assertEqual(1, len(out_vertices));\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/tests/test_remove_duplicated_vertices.py", "rank": 61, "score": 143167.52518257557 }, { "content": "class GTEST_API_ Matcher<const StringPiece&>\n\n : public internal::MatcherBase<const StringPiece&> {\n\n public:\n\n Matcher() {}\n\n\n\n explicit Matcher(const MatcherInterface<const StringPiece&>* impl)\n\n : internal::MatcherBase<const StringPiece&>(impl) {}\n\n\n\n // Allows the user to write str instead of Eq(str) sometimes, where\n\n // str is a string object.\n\n Matcher(const internal::string& s); // NOLINT\n\n\n\n // Allows the user to write \"foo\" instead of Eq(\"foo\") sometimes.\n\n Matcher(const char* s); // NOLINT\n\n\n\n // Allows the user to pass StringPieces directly.\n\n Matcher(StringPiece s); // NOLINT\n\n};\n\n\n\ntemplate <>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/include/gmock/gmock-matchers.h", "rank": 62, "score": 143021.94550902475 }, { "content": "from pymesh.TestCase import TestCase\n\n\n\nfrom pymesh import compute_winding_number\n\nfrom pymesh.meshutils import generate_box_mesh\n\n\n\nimport numpy as np\n\nfrom numpy.linalg import norm\n\n\n\nclass WindingNumberTest(TestCase):\n\n def test_cube(self):\n\n mesh = generate_box_mesh(\n\n np.array([0, 0, 0]), np.array([1, 1, 1]));\n\n queries = np.array([\n\n [-1, 0, 0],\n\n [0.0, 0.0, 0.0],\n\n [0.5, 0.0, 0.0],\n\n [0.5, 0.5, 0.0],\n\n [0.5, 0.5, 0.5],\n\n ]);\n\n\n\n winding_numbers = compute_winding_number(mesh, queries);\n\n\n\n self.assertEqual(len(queries), len(winding_numbers));\n\n self.assertAlmostEqual(0.0, norm(winding_numbers -\n\n np.array([0, 0.125, 0.25, 0.5, 1])));\n", "file_path": "dependencies/PyMesh/python/pymesh/tests/test_winding_number.py", "rank": 63, "score": 142994.89403569326 }, { "content": "from PyMesh import DegeneratedTriangleRemoval\n\nfrom ..meshio import form_mesh\n\n\n\ndef remove_degenerated_triangles_raw(vertices, faces, num_iterations=5):\n\n \"\"\" Remove degenerated triangles.\n\n\n\n Degenerated faces are faces with collinear vertices. It is impossible to\n\n compute face normal for them. This method get rid of all degenerated faces.\n\n No new vertices will be introduced. Only connectivity is changed.\n\n\n\n Args:\n\n vertices (``numpy.ndarray``): Vertex array with one vertex per row.\n\n faces (``numpy.ndarray``): Face array with one triangle per row.\n\n\n\n Returns:\n\n 3 values are returned.\n\n\n\n * ``output_vertices``: Output vertex array, one vertex per row.\n\n * ``output_faces``: Output face array, one face per row.\n\n * ``info``: Additional information dict.\n\n\n\n The following fields are defined in the ``info`` dict:\n\n * ``ori_face_indices``: index array that maps each output face\n\n to an input face that contains it.\n\n \"\"\"\n\n if (faces.shape[1] != 3):\n\n raise RuntimeError(\"Faces are not triangles!\");\n\n remover = DegeneratedTriangleRemoval(vertices, faces);\n\n remover.run(num_iterations);\n\n info = {\n\n \"ori_face_indices\": remover.get_ori_face_indices().squeeze(),\n\n };\n\n return remover.get_vertices(), remover.get_faces(), info;\n\n\n\ndef remove_degenerated_triangles(mesh, num_iterations=5):\n\n \"\"\" Wrapper function of :func:`remove_degenerated_triangles_raw`.\n\n\n\n Args:\n\n mesh (:class:`Mesh`): Input mesh.\n\n\n\n Returns:\n\n 2 values are returned.\n\n\n\n * ``mesh``: A :py:class:`Mesh` object without degenerated triangles.\n\n * ``info``: Additional information dictionary.\n\n \"\"\"\n\n vertices, faces, info = remove_degenerated_triangles_raw(\n\n mesh.vertices, mesh.faces, num_iterations);\n\n return form_mesh(vertices, faces), info;\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/remove_degenerated_triangles.py", "rank": 64, "score": 142907.18085226027 }, { "content": "from math import radians\n\n\n\nfrom .. import timethis\n\nfrom ..meshio import form_mesh\n\nfrom PyMesh import ObtuseTriangleRemoval\n\n\n\nclass ObtuseTriangleRemover:\n\n def __init__(self, vertices, faces):\n\n if vertices.shape[1] != 3:\n\n raise RuntimeError(\"Only 3D meshes are supported\");\n\n if faces.shape[1] != 3:\n\n raise RuntimeError(\"Only triangular meshes are supported\");\n\n\n\n self.vertices = vertices;\n\n self.faces = faces;\n\n\n\n def remove_obtuse_triangles(self, max_angle, max_num_iterations):\n\n max_angle = radians(max_angle);\n\n remover = ObtuseTriangleRemoval(self.vertices, self.faces);\n\n num_triangles_split = remover.run(\n\n max_angle, max_num_iterations);\n\n self.vertices = remover.get_vertices();\n\n self.faces = remover.get_faces();\n\n return num_triangles_split;\n\n\n\ndef remove_obtuse_triangles_raw(vertices, faces,\n\n max_angle=120,\n\n max_iterations=5):\n\n \"\"\" Remove all obtuse triangles.\n\n\n\n Args:\n\n vetices (``numpy.ndarray``): Vertex array with one vertex per row.\n\n faces (``numpy.ndarray``): Face array with one face per row.\n\n max_angle (``float``): (optional) Maximum obtuse angle in degrees\n\n allowed. All triangle with larger internal angle would be split.\n\n Default is 120 degrees.\n\n max_iterations (``int``): (optional) Number of iterations to run before\n\n quitting. Default is 5.\n\n\n\n Returns:\n\n 3 values are returned.\n\n\n\n * ``output_vertices``: Output vertex array with one vertex per row.\n\n * ``output_faces``: Output face array with one face per row.\n\n * ``information``: A ``dict`` of additinal informations.\n\n\n\n The following fields are defiend in ``information``:\n\n\n\n * ``num_triangle_split``: number of triangles split.\n\n \"\"\"\n\n if max_angle < 90:\n\n raise RuntimeError(\"max_angle must be greater than 90 degrees\");\n\n\n\n remover = ObtuseTriangleRemover(vertices, faces);\n\n num_split = remover.remove_obtuse_triangles(max_angle, max_iterations);\n\n info = {\n\n \"num_triangle_split\": num_split\n\n };\n\n return remover.vertices, remover.faces, info;\n\n\n\ndef remove_obtuse_triangles(mesh, max_angle=120, max_iterations=5):\n\n \"\"\" Wrapper function of :func:`remove_obtuse_triangles_raw`.\n\n\n\n Args:\n\n mesh (:class:`Mesh`): Input mesh.\n\n max_angle (``float``): (optional) Maximum obtuse angle in degrees\n\n allowed. All triangle with larger internal angle would be split.\n\n Default is 120 degrees.\n\n max_iterations (``int``): (optional) Number of iterations to run before\n\n quitting. Default is 5.\n\n\n\n Returns:\n\n 2 values are returned.\n\n\n\n * ``output_mesh`` (:class:`Mesh`): Output mesh.\n\n * ``information`` (:class:`dict`): A ``dict`` of additinal informations.\n\n\n\n The following fields are defiend in ``information``:\n\n\n\n * ``num_triangle_split``: number of triangles split.\n\n \"\"\"\n\n vertices, faces, info = remove_obtuse_triangles_raw(\n\n mesh.vertices, mesh.faces, max_angle, max_iterations);\n\n return form_mesh(vertices, faces), info;\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/remove_obtuse_triangles.py", "rank": 65, "score": 142907.18085226027 }, { "content": "import logging\n\nimport math\n\nimport numpy as np\n\n\n\nfrom .. import timethis\n\nfrom ..meshio import form_mesh\n\n\n\nfrom PyMesh import ShortEdgeRemoval, IsolatedVertexRemoval, FinFaceRemoval\n\n\n\nclass _EdgeCollapser(object):\n\n \"\"\" Wrapper class for C++ ShortEdgeRemoval class.\n\n\n\n Attributes:\n\n input_mesh: The input mesh.\n\n vertices (2D array): the output vertices.\n\n faces (2D array): the output faces.\n\n\n\n Examples:\n\n A common usage::\n\n\n\n collapser = _EdgeCollapser.create(mesh);\n\n collapser.keep_features();\n\n collapser.collapse(0.1, None);\n\n print(collapser.vertices);\n\n print(collapser.faces);\n\n \"\"\"\n\n @classmethod\n\n def create(cls, mesh):\n\n return _EdgeCollapser(mesh);\n\n\n\n @classmethod\n\n def create_raw(cls, vertices, faces):\n\n mesh = form_mesh(vertices, faces);\n\n return _EdgeCollapser(mesh);\n\n\n\n def __init__(self, mesh):\n\n self.input_mesh = mesh;\n\n if self.input_mesh.vertex_per_face != 3:\n\n raise RuntimeError(\"Only triangle mesh is supported! \"\n\n \"Input has {} vertices per face\".format(\n\n self.input_mesh.vertex_per_face));\n\n self.logger = logging.getLogger(__name__);\n\n self.importance = None;\n\n\n\n @timethis\n\n def keep_features(self):\n\n \"\"\" Preserve sharp edges and boundaries.\n\n \"\"\"\n\n if not self.input_mesh.has_attribute(\"vertex_dihedral_angle\"):\n\n self.input_mesh.add_attribute(\"vertex_dihedral_angle\");\n\n dihedral_angle = self.input_mesh.get_attribute(\"vertex_dihedral_angle\");\n\n self.importance = np.round(dihedral_angle * 4 / math.pi).astype(int);\n\n\n\n # keep boundary.\n\n bd_vertices = self.input_mesh.boundary_vertices;\n\n self.importance[bd_vertices] = 10;\n\n\n\n @timethis\n\n def collapse(self, abs_threshold, rel_threshold):\n\n \"\"\" Note this method remove all edges with length less than threshold.\n\n This could result in a non-manifold mesh.\n\n \"\"\"\n\n min_edge_length = abs_threshold;\n\n if rel_threshold is not None:\n\n ave_edge_len = self.__get_ave_edge_length()\n\n min_edge_length = rel_threshold * ave_edge_len;\n\n self.logger.info(\"Minimum edge threshold: {:.3}\".format(min_edge_length));\n\n\n\n num_collapsed = self.__collapse_C(min_edge_length);\n\n self.logger.info(\"{} edges collapsed\".format(num_collapsed));\n\n\n\n self.__remove_fin_faces();\n\n self.__remove_isolated_vertices();\n\n\n\n return num_collapsed;\n\n\n\n def __get_ave_edge_length(self):\n\n if not self.input_mesh.has_attribute(\"edge_length\"):\n\n self.input_mesh.add_attribute(\"edge_length\");\n\n edge_lengths = self.input_mesh.get_attribute(\"edge_length\");\n\n return np.mean(edge_lengths);\n\n\n\n @timethis\n\n def __collapse_C(self, min_edge_length):\n\n collapser = ShortEdgeRemoval(\n\n self.input_mesh.vertices, self.input_mesh.faces);\n\n if self.importance is not None:\n\n if len(self.importance) != self.input_mesh.num_vertices:\n\n raise RuntimeError(\"Invalid importance size!\");\n\n collapser.set_importance(self.importance);\n\n num_collapsed = collapser.run(min_edge_length);\n\n self.vertices = collapser.get_vertices();\n\n self.faces = collapser.get_faces();\n\n self.face_index_map = collapser.get_face_indices().ravel();\n\n return num_collapsed;\n\n\n\n @timethis\n\n def __remove_isolated_vertices(self):\n\n remover = IsolatedVertexRemoval(self.vertices, self.faces);\n\n remover.run();\n\n self.vertices = remover.get_vertices();\n\n self.faces = remover.get_faces();\n\n\n\n @timethis\n\n def __remove_fin_faces(self):\n\n remover = FinFaceRemoval(self.vertices, self.faces);\n\n remover.run();\n\n self.vertices = remover.get_vertices();\n\n self.faces = remover.get_faces();\n\n\n\ndef collapse_short_edges_raw(vertices, faces, abs_threshold=0.0,\n\n rel_threshold=None, preserve_feature=False):\n\n \"\"\" Convenient function for collapsing short edges.\n\n\n\n Args:\n\n vertices (``numpy.ndarray``): Vertex array. One vertex per row.\n\n faces (``numpy.ndarray``): Face array. One face per row.\n\n abs_threshold (``float``): (optional) All edge with length below or\n\n equal to this threshold will be collapsed. This value is ignored\n\n if ``rel_thresold`` is not ``None``.\n\n rel_threashold (``float``): (optional) Relative edge length threshold\n\n based on average edge length. e.g. ``rel_threshold=0.1`` means all\n\n edges with length less than ``0.1 * ave_edge_length`` will be collapsed.\n\n preserve_feature (``bool``): True if shape features should be preserved.\n\n Default is false.\n\n\n\n Returns:\n\n 3 values are returned.\n\n\n\n * ``output_vertices``: Output vertex array. One vertex per row.\n\n * ``output_faces``: Output face array. One face per row.\n\n * ``information``: A ``dict`` of additional informations.\n\n\n\n The following fields are defined in ``information``:\n\n\n\n * ``num_edge_collapsed``: Number of edge collapsed.\n\n * ``source_face_index``: An array tracks the source of each output face.\n\n That is face ``i`` of the ``output_faces`` comes from face\n\n ``source_face_index[i]`` of the input faces.\n\n \"\"\"\n\n collapser = _EdgeCollapser.create_raw(vertices, faces);\n\n if preserve_feature:\n\n collapser.keep_features();\n\n num_collapsed = collapser.collapse(abs_threshold, rel_threshold);\n\n info = {\n\n \"num_edge_collapsed\": num_collapsed,\n\n \"source_face_index\": collapser.face_index_map\n\n }\n\n return collapser.vertices, collapser.faces, info;\n\n\n\ndef collapse_short_edges(mesh,\n\n abs_threshold=0.0, rel_threshold=None, preserve_feature=False):\n\n \"\"\" Wrapper function of :func:`collapse_short_edges_raw`.\n\n\n\n Args:\n\n mesh (:class:`Mesh`): Input mesh.\n\n abs_threshold (``float``): (optional) All edge with length below or\n\n equal to this threshold will be collapsed. This value is ignored\n\n if ``rel_thresold`` is not ``None``.\n\n rel_threashold (``float``): (optional) Relative edge length threshold\n\n based on average edge length. e.g. ``rel_threshold=0.1`` means all\n\n edges with length less than ``0.1 * ave_edge_length`` will be collapsed.\n\n preserve_feature (``bool``): True if shape features should be preserved.\n\n Default is false.\n\n\n\n Returns:\n\n 2 values are returned.\n\n\n\n * ``output_Mesh`` (:class:`Mesh`): Output mesh.\n\n * ``information`` (:class:`dict`): A ``dict`` of additional informations.\n\n\n\n The following attribute are defined:\n\n\n\n * ``face_sources``: The index of input source face of each output face.\n\n\n\n The following fields are defined in ``information``:\n\n\n\n * ``num_edge_collapsed``: Number of edge collapsed.\n\n \"\"\"\n\n vertices, faces, info = collapse_short_edges_raw(mesh.vertices, mesh.faces,\n\n abs_threshold, rel_threshold, preserve_feature);\n\n result = form_mesh(vertices, faces);\n\n result.add_attribute(\"face_sources\")\n\n result.set_attribute(\"face_sources\", info[\"source_face_index\"]);\n\n del info[\"source_face_index\"]\n\n return result, info;\n\n\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/collapse_short_edges.py", "rank": 66, "score": 142904.76909236884 }, { "content": "import numpy as np\n\n\n\nfrom ..meshio import form_mesh\n\nfrom PyMesh import LongEdgeRemoval\n\n\n\ndef split_long_edges_raw(vertices, faces, max_edge_length):\n\n \"\"\" Split long edges.\n\n\n\n Args:\n\n vertices (``numpy.ndarray``): Vertex array with one vertex per row.\n\n faces (``numpy.ndarray``): Face array with one face per row.\n\n max_edge_length (``float``): Maximum edge length allowed. All edges\n\n longer than this will be split.\n\n\n\n Returns:\n\n 3 values are returned.\n\n\n\n * ``output_vertices``: Output vertex array with one vertex per row.\n\n * ``output_faces``: Output face array with one face per row.\n\n * ``information``: A dummy ``dict`` that is currently empty.\n\n It is here to ensure consistent interface across the module.\n\n \"\"\"\n\n remover = LongEdgeRemoval(vertices, faces);\n\n remover.run(max_edge_length);\n\n vertices = remover.get_vertices();\n\n faces = remover.get_faces();\n\n return vertices, faces, {};\n\n\n\ndef split_long_edges(mesh, max_edge_length):\n\n \"\"\" Wrapper function of :func:`split_long_edges_raw`.\n\n\n\n Args:\n\n mesh (:class:`Mesh`): Input mesh.\n\n max_edge_length (``float``): Maximum edge length allowed. All edges\n\n longer than this will be split.\n\n\n\n Returns:\n\n 2 values are returned.\n\n\n\n * ``output_mesh`` (:class:`Mesh`): Output mesh.\n\n * ``information``: A dummy ``dict`` that is currently empty.\n\n It is here to ensure consistent interface across the module.\n\n \"\"\"\n\n vertices, faces, info = split_long_edges_raw(\n\n mesh.vertices, mesh.faces, max_edge_length);\n\n return form_mesh(vertices, faces), info;\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/split_long_edges.py", "rank": 67, "score": 142904.76909236884 }, { "content": "class SetArgumentPointeeAction<N, Proto, true> {\n\n public:\n\n // Constructs an action that sets the variable pointed to by the\n\n // N-th function argument to 'proto'. Both ProtocolMessage and\n\n // proto2::Message have the CopyFrom() method, so the same\n\n // implementation works for both.\n\n explicit SetArgumentPointeeAction(const Proto& proto) : proto_(new Proto) {\n\n proto_->CopyFrom(proto);\n\n }\n\n\n\n template <typename Result, typename ArgumentTuple>\n\n void Perform(const ArgumentTuple& args) const {\n\n CompileAssertTypesEqual<void, Result>();\n\n ::std::tr1::get<N>(args)->CopyFrom(*proto_);\n\n }\n\n\n\n private:\n\n const internal::linked_ptr<Proto> proto_;\n\n\n\n GTEST_DISALLOW_ASSIGN_(SetArgumentPointeeAction);\n\n};\n\n\n\n// Implements the InvokeWithoutArgs(f) action. The template argument\n\n// FunctionImpl is the implementation type of f, which can be either a\n\n// function pointer or a functor. InvokeWithoutArgs(f) can be used as an\n\n// Action<F> as long as f's type is compatible with F (i.e. f can be\n\n// assigned to a tr1::function<F>).\n\ntemplate <typename FunctionImpl>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/fused-src/gmock/gmock.h", "rank": 68, "score": 141969.78061047563 }, { "content": "class FinFaceRemoval {\n\n public:\n\n FinFaceRemoval(const MatrixFr& vertices, const MatrixIr& faces);\n\n\n\n public:\n\n /**\n\n * Only remove fins. A fin is defined as a pair of faces with identical\n\n * vertices but opposite orientaiton.\n\n */\n\n void set_fins_only() {\n\n m_fins_only = true;\n\n }\n\n\n\n /**\n\n * When set_fins_only() is called:\n\n * Only fins are removed.\n\n *\n\n * Otherwise:\n\n *\n\n * For each set of duplicated faces, if there is a majority orientation,\n", "file_path": "dependencies/PyMesh/tools/MeshUtils/FinFaceRemoval.h", "rank": 69, "score": 140498.4946578307 }, { "content": "class LongEdgeRemoval {\n\n public:\n\n LongEdgeRemoval(const MatrixFr& vertices, const MatrixIr& faces) :\n\n m_vertices(vertices), m_faces(faces) {}\n\n\n\n public:\n\n void run(Float max_length, bool recursive=true);\n\n\n\n MatrixFr get_vertices() const { return m_vertices; }\n\n MatrixIr get_faces() const { return m_faces; }\n\n\n\n private:\n\n void init_edge_map();\n\n void split_long_edges(Float max_length);\n\n size_t retriangulate();\n\n void triangulate_chain(\n\n std::vector<VectorI>& faces,\n\n const std::vector<size_t>& chain,\n\n size_t v0_idx, size_t v1_idx, size_t v2_idx);\n\n std::vector<size_t> get_vertex_chain_around_triangle(\n", "file_path": "dependencies/PyMesh/tools/MeshUtils/LongEdgeRemoval.h", "rank": 70, "score": 140473.4816764854 }, { "content": "class ShortEdgeRemoval {\n\n public:\n\n ShortEdgeRemoval(const MatrixFr& vertices, const MatrixIr& faces);\n\n\n\n public:\n\n /**\n\n * Importance is an integer value per vertex. The vertex with higher\n\n * importance would keep its position during edge collapsing. Mid-point\n\n * is used when collapsing edge with same importance at each end.\n\n *\n\n * Vertex with negative importance is not considered during collapsing.\n\n * i.e. they will keep their original location.\n\n */\n\n void set_importance(const VectorI& importance) {\n\n m_importance = importance;\n\n }\n\n /**\n\n * Remove all edges that <= thresold\n\n * If thresold=0, remove all degenerated edges.\n\n */\n", "file_path": "dependencies/PyMesh/tools/MeshUtils/ShortEdgeRemoval.h", "rank": 71, "score": 140473.4816764854 }, { "content": "class GTEST_API_ Matcher<const internal::string&>\n\n : public internal::MatcherBase<const internal::string&> {\n\n public:\n\n Matcher() {}\n\n\n\n explicit Matcher(const MatcherInterface<const internal::string&>* impl)\n\n : internal::MatcherBase<const internal::string&>(impl) {}\n\n\n\n // Allows the user to write str instead of Eq(str) sometimes, where\n\n // str is a string object.\n\n Matcher(const internal::string& s); // NOLINT\n\n\n\n // Allows the user to write \"foo\" instead of Eq(\"foo\") sometimes.\n\n Matcher(const char* s); // NOLINT\n\n};\n\n\n\ntemplate <>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/include/gmock/gmock-matchers.h", "rank": 72, "score": 140117.35613349773 }, { "content": "from pymesh import remove_degenerated_triangles\n\nfrom pymesh import remove_degenerated_triangles_raw\n\nfrom pymesh import generate_box_mesh\n\nfrom pymesh.TestCase import TestCase\n\n\n\nimport numpy as np\n\n\n\nclass RemoveDegeneratedTrianglesTest(TestCase):\n\n def test_no_degeneracy(self):\n\n mesh = generate_box_mesh(np.ones(3)*-1, np.ones(3));\n\n\n\n result, info = remove_degenerated_triangles(mesh);\n\n self.assertEqual(8, result.num_vertices);\n\n self.assertEqual(12, result.num_faces);\n\n self.assert_array_equal(np.arange(12),\n\n sorted(info[\"ori_face_indices\"]));\n\n\n\n def test_simple(self):\n\n vertices = np.array([\n\n [0.0, 0.0, 0.0],\n\n [0.0, 0.0, 0.0],\n\n [1.0, 0.0, 0.0],\n\n ]);\n\n faces = np.array([\n\n [0, 1, 2]\n\n ], dtype=int);\n\n\n\n result_vertices, result_faces, info = \\\n\n remove_degenerated_triangles_raw(vertices, faces);\n\n\n\n self.assertEqual(0, len(result_vertices));\n\n self.assertEqual(0, len(result_faces));\n\n self.assertEqual(0, len(info[\"ori_face_indices\"]));\n\n\n\n def multiple_degeneracies(self):\n\n vertices = np.array([\n\n [0.0, 0.0, 0.0],\n\n [0.0, 0.0, 0.0],\n\n [1.0, 0.0, 0.0],\n\n [2.0, 0.0, 0.0],\n\n [4.0, 0.0, 0.0],\n\n [5.0, 0.0, 0.0],\n\n [0.0, 2.0, 0.0],\n\n ]);\n\n\n\n faces = np.array([\n\n [0, 1, 5],\n\n [1, 2, 5],\n\n [2, 3, 5],\n\n [3, 4, 5],\n\n [5, 6, 0],\n\n ], dtype=int);\n\n\n\n result_vertices, result_faces, info = \\\n\n remove_degenerated_triangles_raw(vertices, faces);\n\n\n\n self.assertEqual(6, len(result_vertices));\n\n self.assertEqual(4, len(result_faces));\n\n self.assertEqual(4, len(info[\"ori_face_indices\"]));\n\n self.assertTrue(np.all(info[\"ori_face_indices\"] == 4));\n\n\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/tests/test_remove_degenerated_triangles.py", "rank": 73, "score": 137996.76178373647 }, { "content": "from pymesh.meshutils import remove_obtuse_triangles_raw\n\nfrom pymesh.TestCase import TestCase\n\n\n\nimport numpy as np\n\nimport numpy.testing\n\nimport unittest\n\n\n\nclass ObtuseTriangleRemovalTest(TestCase):\n\n def test_nothing_to_remove(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n ]);\n\n\n\n faces = np.array([\n\n [0, 1, 2]\n\n ]);\n\n\n\n out_vertices, out_faces, info = remove_obtuse_triangles_raw(vertices, faces);\n\n\n\n numpy.testing.assert_array_equal(vertices, out_vertices);\n\n numpy.testing.assert_array_equal(faces, out_faces);\n\n\n\n def test_single_obtuse_triangle(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.1, 0.0],\n\n [-1.0, 0.1, 0.0],\n\n ]);\n\n\n\n faces = np.array([\n\n [0, 1, 2]\n\n ]);\n\n\n\n out_vertices, out_faces, info = remove_obtuse_triangles_raw(vertices, faces);\n\n self.assertEqual(2, len(out_faces));\n\n\n\n def test_double_obtuse_triangles_1(self):\n\n \"\"\" Check two obtuse triangles sharing the longest edges.\n\n \"\"\"\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.1, 0.0],\n\n [-1.0, 0.1, 0.0],\n\n [ 0.0, 0.2, 0.0],\n\n ]);\n\n\n\n faces = np.array([\n\n [0, 1, 2],\n\n [2, 1, 3],\n\n ]);\n\n\n\n out_vertices, out_faces, info = remove_obtuse_triangles_raw(vertices, faces);\n\n self.assertEqual(4, len(out_faces));\n\n\n\n def test_double_obtuse_triangles_2(self):\n\n \"\"\" Check two obtuse triangles that does not share the longest edge.\n\n \"\"\"\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.1, 0.0],\n\n [-1.0, 0.1, 0.0],\n\n [ 5.0, 0.2, 0.0],\n\n ]);\n\n\n\n faces = np.array([\n\n [0, 1, 2],\n\n [2, 1, 3],\n\n ]);\n\n\n\n out_vertices, out_faces, info = remove_obtuse_triangles_raw(vertices, faces);\n\n self.assertLess(4, len(out_faces));\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/tests/test_remove_obtuse_triangles.py", "rank": 74, "score": 137996.76178373647 }, { "content": "from pymesh import generate_icosphere\n\nfrom pymesh.meshutils import collapse_short_edges_raw, collapse_short_edges\n\nfrom pymesh.TestCase import TestCase\n\n\n\nimport numpy as np\n\nimport numpy.testing\n\nimport unittest\n\n\n\nclass CollapseShortEdgesTest(TestCase):\n\n def test_simple_3D(self):\n\n vertices = np.array([\n\n [0.0, 0.0, 0.0],\n\n [1.0, 0.0, 0.0],\n\n [0.0, 1.0, 0.0],\n\n ], dtype=float);\n\n faces = np.array([[0, 1, 2]], dtype=int);\n\n\n\n out_vertices, out_faces, info = collapse_short_edges_raw(\n\n vertices, faces, 0.1);\n\n\n\n numpy.testing.assert_array_equal(vertices, out_vertices);\n\n numpy.testing.assert_array_equal(faces, out_faces);\n\n self.assertEqual(0, info[\"num_edge_collapsed\"]);\n\n self.assert_array_equal([0], info[\"source_face_index\"]);\n\n\n\n def test_collapse_all_3D(self):\n\n vertices = np.array([\n\n [0.0, 0.0, 0.0],\n\n [1.0, 0.0, 0.0],\n\n [0.0, 1.0, 0.0],\n\n ], dtype=float);\n\n faces = np.array([[0, 1, 2]], dtype=int);\n\n\n\n out_vertices, out_faces, info = collapse_short_edges_raw(\n\n vertices, faces, 1.1);\n\n\n\n self.assertEqual(0, len(out_vertices));\n\n self.assertEqual(0, len(out_faces));\n\n self.assertEqual(1, info[\"num_edge_collapsed\"]);\n\n self.assert_array_equal([], info[\"source_face_index\"]);\n\n\n\n def test_slim_triangles(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n [-0.1,-0.1,-0.1],\n\n ], dtype=float);\n\n faces = np.array([\n\n [0, 1, 2],\n\n [0, 3, 1],\n\n [0, 2, 3],\n\n ], dtype=int);\n\n\n\n out_vertices, out_faces, info = collapse_short_edges_raw(\n\n vertices, faces, 0.5);\n\n\n\n self.assertEqual(3, len(out_vertices));\n\n self.assertEqual(1, len(out_faces));\n\n self.assertEqual(1, info[\"num_edge_collapsed\"]);\n\n self.assert_array_equal([0], info[\"source_face_index\"]);\n\n\n\n def test_degenerated_triangles(self):\n\n vertices = np.array([\n\n [ 0.0, 0.0, 0.0],\n\n [ 1.0, 0.0, 0.0],\n\n [ 0.0, 1.0, 0.0],\n\n [-0.1,-0.1,-0.1],\n\n ], dtype=float);\n\n faces = np.array([\n\n [0, 1, 2],\n\n [0, 3, 1],\n\n [0, 2, 3],\n\n [0, 0, 1],\n\n [2, 3, 3]\n\n ], dtype=int);\n\n\n\n out_vertices, out_faces, info = collapse_short_edges_raw(\n\n vertices, faces, 0.5);\n\n\n\n self.assertEqual(3, len(out_vertices));\n\n self.assertEqual(1, len(out_faces));\n\n self.assertEqual(3, info[\"num_edge_collapsed\"]);\n\n self.assert_array_equal([0], info[\"source_face_index\"]);\n\n\n\n def test_simple_2D(self):\n\n vertices = np.array([\n\n [0.0, 0.0],\n\n [1.0, 0.0],\n\n [0.0, 1.0],\n\n ], dtype=float);\n\n faces = np.array([[0, 1, 2]], dtype=int);\n\n\n\n out_vertices, out_faces, info = collapse_short_edges_raw(\n\n vertices, faces, 0.1);\n\n\n\n numpy.testing.assert_array_equal(vertices, out_vertices);\n\n numpy.testing.assert_array_equal(faces, out_faces);\n\n self.assertEqual(0, info[\"num_edge_collapsed\"]);\n\n self.assert_array_equal([0], info[\"source_face_index\"]);\n\n\n\n def test_tiny_mesh(self):\n\n \"\"\" Edge collapse performed on a tiny icosphere.\n\n \"\"\"\n\n mesh = generate_icosphere(1e-6, [0.0, 0.0, 0.0]);\n\n mesh, info = collapse_short_edges(mesh, 0.1);\n\n\n\n self.assertTrue(\"face_sources\" in mesh.attribute_names);\n\n self.assertEqual(0, mesh.num_vertices);\n\n self.assertEqual(0, mesh.num_faces);\n\n self.assertEqual(0, mesh.num_voxels);\n\n\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/tests/test_collapse_short_edges.py", "rank": 75, "score": 137994.43002778868 }, { "content": "from pymesh.meshutils import split_long_edges_raw\n\nfrom pymesh.TestCase import TestCase\n\n\n\nimport numpy as np\n\nimport numpy.testing\n\nimport unittest\n\n\n\nclass SplitLongEdgeTest(TestCase):\n\n def test_nothing_to_split(self):\n\n vertices = np.array([\n\n [0.0, 0.0, 0.0],\n\n [1.0, 0.0, 0.0],\n\n [0.0, 1.0, 0.0],\n\n ], dtype=float);\n\n faces = np.array([[0, 1, 2]], dtype=int);\n\n\n\n out_vertices, out_faces, __ = split_long_edges_raw(vertices, faces, 2.0);\n\n\n\n numpy.testing.assert_array_equal(vertices, out_vertices);\n\n numpy.testing.assert_array_equal(faces, out_faces);\n\n\n\n def test_simple_split(self):\n\n vertices = np.array([\n\n [0.0, 0.0, 0.0],\n\n [1.0, 0.0, 0.0],\n\n [0.0, 1.0, 0.0],\n\n ], dtype=float);\n\n faces = np.array([[0, 1, 2]], dtype=int);\n\n\n\n out_vertices, out_faces, __ = split_long_edges_raw(vertices, faces, 1.4);\n\n\n\n self.assertEqual(2, len(out_faces));\n\n\n\n def test_multiple_splits(self):\n\n vertices = np.array([\n\n [0.0, 0.0, 0.0],\n\n [1.0, 0.0, 0.0],\n\n [0.0, 1.0, 0.0],\n\n ], dtype=float);\n\n faces = np.array([[0, 1, 2]], dtype=int);\n\n\n\n out_vertices, out_faces, __ = split_long_edges_raw(vertices, faces, 0.9);\n\n\n\n self.assertLess(2, len(out_faces));\n\n\n", "file_path": "dependencies/PyMesh/python/pymesh/meshutils/tests/test_split_long_edges.py", "rank": 76, "score": 137994.43002778868 }, { "content": "struct TupleElement<true, 6, GTEST_10_TUPLE_(T) > {\n\n typedef T6 type;\n\n};\n\n\n\ntemplate <GTEST_10_TYPENAMES_(T)>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/internal/gtest-tuple.h", "rank": 77, "score": 136699.71416766342 }, { "content": "struct TupleElement<true, 9, GTEST_10_TUPLE_(T) > {\n\n typedef T9 type;\n\n};\n\n\n\n} // namespace gtest_internal\n\n\n\ntemplate <>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/internal/gtest-tuple.h", "rank": 78, "score": 136699.71416766342 }, { "content": "struct TupleElement<true, 2, GTEST_10_TUPLE_(T) > {\n\n typedef T2 type;\n\n};\n\n\n\ntemplate <GTEST_10_TYPENAMES_(T)>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/internal/gtest-tuple.h", "rank": 79, "score": 136699.71416766342 }, { "content": "struct TupleElement<true, 4, GTEST_10_TUPLE_(T) > {\n\n typedef T4 type;\n\n};\n\n\n\ntemplate <GTEST_10_TYPENAMES_(T)>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/internal/gtest-tuple.h", "rank": 80, "score": 136699.71416766342 }, { "content": "struct TupleElement<true, 8, GTEST_10_TUPLE_(T) > {\n\n typedef T8 type;\n\n};\n\n\n\ntemplate <GTEST_10_TYPENAMES_(T)>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/internal/gtest-tuple.h", "rank": 81, "score": 136699.71416766342 }, { "content": "struct TupleElement<true, 1, GTEST_10_TUPLE_(T) > {\n\n typedef T1 type;\n\n};\n\n\n\ntemplate <GTEST_10_TYPENAMES_(T)>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/internal/gtest-tuple.h", "rank": 82, "score": 136699.71416766342 }, { "content": "struct TupleElement<true, 7, GTEST_10_TUPLE_(T) > {\n\n typedef T7 type;\n\n};\n\n\n\ntemplate <GTEST_10_TYPENAMES_(T)>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/internal/gtest-tuple.h", "rank": 83, "score": 136699.71416766342 }, { "content": "struct TupleElement<true, 5, GTEST_10_TUPLE_(T) > {\n\n typedef T5 type;\n\n};\n\n\n\ntemplate <GTEST_10_TYPENAMES_(T)>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/internal/gtest-tuple.h", "rank": 84, "score": 136699.71416766342 }, { "content": "#!/usr/bin/env python\n\n\n\n\"\"\"\n\nRemove isolated vertices.\n\n\"\"\"\n\n\n\nimport argparse\n\nimport pymesh\n\n\n\ndef parse_args():\n\n parser = argparse.ArgumentParser(description=__doc__);\n\n parser.add_argument(\"input_mesh\", help=\"input mesh\");\n\n parser.add_argument(\"output_mesh\", help=\"output mesh\");\n\n return parser.parse_args();\n\n\n\ndef main():\n\n args = parse_args();\n\n mesh = pymesh.load_mesh(args.input_mesh);\n\n mesh, __ = pymesh.remove_isolated_vertices(mesh);\n\n pymesh.save_mesh(args.output_mesh, mesh);\n\n\n\nif __name__ == \"__main__\":\n\n main();\n", "file_path": "dependencies/PyMesh/scripts/remove_isolated_vertices.py", "rank": 85, "score": 135990.69832397185 }, { "content": "#!/usr/bin/env python\n\n\n\n\"\"\"\n\nRemove duplicated faces.\n\n\"\"\"\n\n\n\nimport argparse\n\nimport pymesh\n\n\n\ndef parse_args():\n\n parser = argparse.ArgumentParser(description=__doc__);\n\n parser.add_argument(\"input_mesh\", help=\"input mesh\");\n\n parser.add_argument(\"output_mesh\", help=\"output mesh\");\n\n return parser.parse_args();\n\n\n\ndef main():\n\n args = parse_args();\n\n mesh = pymesh.load_mesh(args.input_mesh);\n\n mesh, __ = pymesh.remove_duplicated_faces(mesh);\n\n pymesh.save_mesh(args.output_mesh, mesh);\n\n\n\nif __name__ == \"__main__\":\n\n main();\n", "file_path": "dependencies/PyMesh/scripts/remove_duplicated_faces.py", "rank": 86, "score": 135923.8668951813 }, { "content": "class ActionResultHolder<void> : public UntypedActionResultHolderBase {\n\n public:\n\n void GetValueAndDelete() const { delete this; }\n\n\n\n virtual void PrintAsActionResult(::std::ostream* /* os */) const {}\n\n\n\n // Performs the given mock function's default action and returns NULL;\n\n template <typename F>\n\n static ActionResultHolder* PerformDefaultAction(\n\n const FunctionMockerBase<F>* func_mocker,\n\n const typename Function<F>::ArgumentTuple& args,\n\n const string& call_description) {\n\n func_mocker->PerformDefaultAction(args, call_description);\n\n return NULL;\n\n }\n\n\n\n // Performs the given action and returns NULL.\n\n template <typename F>\n\n static ActionResultHolder* PerformAction(\n\n const Action<F>& action,\n\n const typename Function<F>::ArgumentTuple& args) {\n\n action.Perform(args);\n\n return NULL;\n\n }\n\n};\n\n\n\n// The base of the function mocker class for the given function type.\n\n// We put the methods in this class instead of its child to avoid code\n\n// bloat.\n\ntemplate <typename F>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/include/gmock/gmock-spec-builders.h", "rank": 87, "score": 134917.78135907854 }, { "content": "class FaceEdgeRatioAttribute : public MeshAttribute {\n\n public:\n\n FaceEdgeRatioAttribute(const std::string& name) : MeshAttribute(name) {}\n\n virtual ~FaceEdgeRatioAttribute() {}\n\n\n\n public:\n\n virtual void compute_from_mesh(Mesh& mesh);\n\n};\n\n\n\n}\n", "file_path": "dependencies/PyMesh/src/Attributes/FaceEdgeRatioAttribute.h", "rank": 88, "score": 134254.6943782677 }, { "content": "struct ByRef { typedef const T& type; }; // NOLINT\n\ntemplate <typename T>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/internal/gtest-tuple.h", "rank": 89, "score": 134185.72993183482 }, { "content": "class FinFaceRemovalTest : public TestBase {\n\n protected:\n\n void check_face_index(const MatrixIr& in_faces, \n\n const MatrixIr& out_faces, \n\n const VectorI& face_indices) {\n\n const size_t num_output_faces = out_faces.rows();\n\n ASSERT_EQ(num_output_faces, face_indices.size());\n\n for (size_t i=0; i<num_output_faces; i++) {\n\n const VectorI& input_f = in_faces.row(face_indices[i]);\n\n const VectorI& output_f = out_faces.row(i);\n\n ASSERT_TRUE((input_f.array() == output_f.array()).all());\n\n }\n\n }\n\n};\n\n\n\nTEST_F(FinFaceRemovalTest, zero_fin) {\n\n MatrixF vertices(4, 3);\n\n vertices << 0.0, 0.0, 0.0,\n\n 1.0, 0.0, 0.0,\n\n 0.0, 1.0, 0.0,\n", "file_path": "dependencies/PyMesh/tests/tools/MeshUtils/FinFaceRemovalTest.h", "rank": 90, "score": 131340.86002013297 }, { "content": "class ShortEdgeRemovalTest : public TestBase {\n\n protected:\n\n void check_num_faces_left(const ShortEdgeRemoval& remover, size_t n) {\n\n MatrixIr faces_left = remover.get_faces();\n\n ASSERT_EQ(n, faces_left.rows());\n\n }\n\n\n\n void check_face_validity(const ShortEdgeRemoval& remover) {\n\n MatrixFr vertices_left = remover.get_vertices();\n\n MatrixIr faces_left = remover.get_faces();\n\n const size_t num_vertices = vertices_left.rows();\n\n for (size_t i=0; i<faces_left.size(); i++) {\n\n ASSERT_LT(faces_left.data()[i], num_vertices);\n\n }\n\n }\n\n\n\n /**\n\n * Assert that v is either one of vertices left unchanged or is within\n\n * threshold away from a vertex after remove short edges.\n\n */\n", "file_path": "dependencies/PyMesh/tests/tools/MeshUtils/ShortEdgeRemovalTest.h", "rank": 91, "score": 131317.47737472053 }, { "content": "class LongEdgeRemovalTest : public TestBase {\n\n protected:\n\n void ASSERT_NO_LONG_EDGES(\n\n const MatrixFr& vertices,\n\n const MatrixIr& faces,\n\n Float max_length) {\n\n const size_t num_faces = faces.rows();\n\n const size_t vertex_per_face = faces.cols();\n\n for (size_t i=0; i<num_faces; i++) {\n\n const auto& f = faces.row(i);\n\n for (size_t j=0; j<vertex_per_face; j++) {\n\n const auto& curr_v = vertices.row(f[j]);\n\n const auto& next_v = vertices.row(f[(j+1)%vertex_per_face]);\n\n ASSERT_LT((curr_v - next_v).norm(), max_length);\n\n }\n\n }\n\n }\n\n};\n\n\n\nTEST_F(LongEdgeRemovalTest, SingleTraingle) {\n", "file_path": "dependencies/PyMesh/tests/tools/MeshUtils/LongEdgeRemovalTest.h", "rank": 92, "score": 131317.47737472053 }, { "content": "class FooTest : public ::testing::TestWithParam<const char*> {\n\n // You can implement all the usual class fixture members here.\n\n};\n\n\n\n// Then, use the TEST_P macro to define as many parameterized tests\n\n// for this fixture as you want. The _P suffix is for \"parameterized\"\n\n// or \"pattern\", whichever you prefer to think.\n\n\n\nTEST_P(FooTest, DoesBlah) {\n\n // Inside a test, access the test parameter with the GetParam() method\n\n // of the TestWithParam<T> class:\n\n EXPECT_TRUE(foo.Blah(GetParam()));\n\n ...\n\n}\n\n\n\nTEST_P(FooTest, HasBlahBlah) {\n\n ...\n\n}\n\n\n\n// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/gtest/include/gtest/gtest-param-test.h", "rank": 93, "score": 130984.04053206244 }, { "content": "struct LosslessArithmeticConvertibleImpl<kBool, bool, kBool, bool>\n\n : public true_type {}; // NOLINT\n\n\n\n// Converting bool to any integer type is lossless.\n\ntemplate <typename To>\n", "file_path": "dependencies/PyMesh/tests/external/gmock-1.7.0/fused-src/gmock/gmock.h", "rank": 94, "score": 129459.77695740892 }, { "content": " m_edge_adj_faces.insert(Triplet(f[1], f[2]), i);\n\n m_edge_adj_faces.insert(Triplet(f[2], f[0]), i);\n\n m_edge_adj_faces.insert(Triplet(f[0], f[1]), i);\n\n }\n\n}\n\n\n\nvoid EdgeSplitter::set_all_faces_as_valid() {\n\n const size_t num_faces = m_faces.rows();\n\n m_face_is_valid = std::vector<bool>(num_faces, true);\n\n}\n\n\n\nvoid EdgeSplitter::split_edge(const VectorI& edge,\n\n const std::vector<size_t>& adj_faces, Float max_length) {\n\n const auto v0 = m_vertices.row(edge[0]);\n\n const auto v1 = m_vertices.row(edge[1]);\n\n Float length = (v0 - v1).norm();\n\n if (length < max_length) return;\n\n\n\n bool adj_faces_are_valid = true;\n\n for (auto fi : adj_faces) {\n", "file_path": "dependencies/PyMesh/tools/MeshUtils/EdgeSplitter.cpp", "rank": 96, "score": 71.99981793630346 }, { "content": " finalize_geometry();\n\n if (num_split == 0) break;\n\n } while (count < max_iterations);\n\n\n\n return total_num_split;\n\n}\n\n\n\nvoid ObtuseTriangleRemoval::clear_intermediate_data() {\n\n m_face_angles.clear();\n\n m_opp_vertices.clear();\n\n m_edges.clear();\n\n m_valid.clear();\n\n m_edge_faces.clear();\n\n m_new_vertices.clear();\n\n m_new_faces.clear();\n\n}\n\n\n\nvoid ObtuseTriangleRemoval::set_all_faces_as_valid() {\n\n m_valid = std::vector<bool>(m_faces.rows(), true);\n\n}\n", "file_path": "dependencies/PyMesh/tools/MeshUtils/ObtuseTriangleRemoval.cpp", "rank": 98, "score": 68.61228084790953 } ]
C++
Sandbox/src/Sandbox2D.cpp
SunHailang/Hazel
1b4784c8d6bd2ad402ded34d677fd482a81a9d72
#include "Sandbox2D.h" #include <imgui/imgui.h> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> static const char* s_MapTiles = "lajksdasd"; Sandbox2D::Sandbox2D() :Hazel::Layer("Sandbox2D"), m_CameraController(1280.0f / 720.0f, true) { } void Sandbox2D::OnAttach() { HZ_PROFILE_FUNCTION(); m_texture = Hazel::Texture2D::Create("assets/textures/wall.jpg"); m_spriteSheet = Hazel::Texture2D::Create("assets/game/textures/RPGpack_sheet_2X.png"); m_textureStairs = Hazel::SubTexture2D::CreateFromCoords(m_spriteSheet, { 7, 6 }, { 128, 128 }); m_Particle.ColorBegin = { 254 / 255.0f, 109 / 255.0f, 41 / 255.0f, 1.0f }; m_Particle.ColorEnd = { 254 / 255.0f, 212 / 255.0f, 123 / 255.0f, 1.0f }; m_Particle.SizeBegin = 0.5f; m_Particle.SizeVariation = 0.3f; m_Particle.SizeEnd = 0.0f; m_Particle.LiftTime = 1.0f; m_Particle.Velocity = { 0.0f, 0.0f }; m_Particle.VelocityVariation = { 3.0f, 1.0f }; m_Particle.Position = { 0.0f, 0.0f }; m_CameraController.SetZoomLevel(5.0f); } void Sandbox2D::OnDetach() { } void Sandbox2D::OnUpdate(Hazel::Timestep ts) { HZ_PROFILE_FUNCTION(); m_CameraController.OnUpdate(ts); Hazel::Renderer2D::ResetStats(); { HZ_PROFILE_SCOPE("Renderer Prep"); Hazel::RendererCommand::SetClearColor(glm::vec4(0.2f, 0.2f, 0.2f, 1.0f)); Hazel::RendererCommand::Clear(); } { } if (Hazel::Input::IsMouseButtonPressed(HZ_MOUSE_BUTTON_LEFT)) { auto [x, y] = Hazel::Input::GetMousePosition(); auto width = Hazel::Application::Get().GetWindow().GetWidth(); auto height = Hazel::Application::Get().GetWindow().GetHeight(); auto bounds = m_CameraController.GetBounds(); auto pos = m_CameraController.GetCamera().GetPosition(); x = (x / width) * bounds.GetWidth() - bounds.GetWidth() * 0.5f; y = bounds.GetHeight() * 0.5f - (y / height) * bounds.GetHeight(); m_Particle.Position = { (x + pos.x), (y + pos.y) }; for (int i = 0; i < 5; i++) { m_ParticleSystem.Emit(m_Particle); } } m_ParticleSystem.OnUpdate(ts); m_ParticleSystem.OnRender(m_CameraController.GetCamera()); Hazel::Renderer2D::BeginScene(m_CameraController.GetCamera()); Hazel::Renderer2D::DrawQuad({ 0.0f, 0.0f, 0.3f }, { 1.0f, 1.0f }, m_textureStairs); Hazel::Renderer2D::EndScene(); } void Sandbox2D::OnImGuiRender() { HZ_PROFILE_FUNCTION(); ImGui::Begin("Setting"); auto stats = Hazel::Renderer2D::GetStats(); ImGui::Text("Renderer2D Stats:"); ImGui::Text("Draw Calls: %d", stats.DrawCalls); ImGui::Text("Quads: %d", stats.QuadCount); ImGui::Text("Vertics: %d", stats.GetTotalVertexCount()); ImGui::Text("Indices: %d", stats.GetTotalIndexCount()); ImGui::End(); } void Sandbox2D::OnEvent(Hazel::Event& event) { m_CameraController.OnEvent(event); }
#include "Sandbox2D.h" #include <imgui/imgui.h> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> static const char* s_MapTiles = "lajksdasd"; Sandbox2D::Sandbox2D() :Hazel::Layer("Sandbox2D"), m_CameraController(1280.0f / 720.0f, true) { } void Sandbox2D::OnAttach() { HZ_PROFILE_FUNCTION(); m_texture = Hazel::Texture2D::Create("assets/textures/wall.jpg"); m_spriteSheet = Hazel::Texture2D::Create("assets/game/textures/RPGpack_sheet_2X.png"); m_textureStairs = Hazel::SubTexture2D::CreateFromCoords(m_spriteSheet, { 7, 6 }, { 128, 128 }); m_Particle.ColorBegin = { 254 / 255.0f, 109 / 255.0f, 41 / 255.0f, 1.0f }; m_Particle.ColorEnd = { 254 / 255.0f, 212 / 255.0f, 123 / 255.0f, 1.0f }; m_Particle.SizeBegin = 0.5f; m_Particle.SizeVariation = 0.3f; m_Particle.SizeEnd = 0.0f; m_Particle.LiftTime = 1.0f; m_Particle.Velocity = { 0.0f, 0.0f }; m_Particle.VelocityVariation = { 3.0f, 1.0f }; m_Particle.Position = { 0.0f, 0.0f }; m_CameraController.SetZoomLevel(5.0f); } void Sandbox2D::OnDetach() { } void Sandbox2D::OnUpdate(Hazel::Timestep ts) { HZ_PROFILE_FUNCTION(); m_CameraController.
tWindow().GetWidth(); auto height = Hazel::Application::Get().GetWindow().GetHeight(); auto bounds = m_CameraController.GetBounds(); auto pos = m_CameraController.GetCamera().GetPosition(); x = (x / width) * bounds.GetWidth() - bounds.GetWidth() * 0.5f; y = bounds.GetHeight() * 0.5f - (y / height) * bounds.GetHeight(); m_Particle.Position = { (x + pos.x), (y + pos.y) }; for (int i = 0; i < 5; i++) { m_ParticleSystem.Emit(m_Particle); } } m_ParticleSystem.OnUpdate(ts); m_ParticleSystem.OnRender(m_CameraController.GetCamera()); Hazel::Renderer2D::BeginScene(m_CameraController.GetCamera()); Hazel::Renderer2D::DrawQuad({ 0.0f, 0.0f, 0.3f }, { 1.0f, 1.0f }, m_textureStairs); Hazel::Renderer2D::EndScene(); } void Sandbox2D::OnImGuiRender() { HZ_PROFILE_FUNCTION(); ImGui::Begin("Setting"); auto stats = Hazel::Renderer2D::GetStats(); ImGui::Text("Renderer2D Stats:"); ImGui::Text("Draw Calls: %d", stats.DrawCalls); ImGui::Text("Quads: %d", stats.QuadCount); ImGui::Text("Vertics: %d", stats.GetTotalVertexCount()); ImGui::Text("Indices: %d", stats.GetTotalIndexCount()); ImGui::End(); } void Sandbox2D::OnEvent(Hazel::Event& event) { m_CameraController.OnEvent(event); }
OnUpdate(ts); Hazel::Renderer2D::ResetStats(); { HZ_PROFILE_SCOPE("Renderer Prep"); Hazel::RendererCommand::SetClearColor(glm::vec4(0.2f, 0.2f, 0.2f, 1.0f)); Hazel::RendererCommand::Clear(); } { } if (Hazel::Input::IsMouseButtonPressed(HZ_MOUSE_BUTTON_LEFT)) { auto [x, y] = Hazel::Input::GetMousePosition(); auto width = Hazel::Application::Get().Ge
random
[ { "content": "#include \"hzpch.h\"\n\n#include \"OpenGLFramebuffer.h\"\n\n\n\n#include <glad/glad.h>\n\n\n\nnamespace Hazel\n\n{\n\n\n\n\tstatic const uint32_t s_MaxFramebufferSize = 8192;\n\n\n\n\tnamespace Utils {\n\n\n\n\t\tstatic GLenum TextureTarget(bool multisampled)\n\n\t\t{\n\n\t\t\treturn multisampled ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D;\n\n\t\t}\n\n\n\n\t\tstatic void CreateTextures(bool multisampled, uint32_t* outID, uint32_t count)\n\n\t\t{\n\n\t\t\tglCreateTextures(TextureTarget(multisampled), count, outID);\n", "file_path": "Hazel/src/Platform/OpenGL/OpenGLFramebuffer.cpp", "rank": 1, "score": 10.326714682624264 }, { "content": "#include \"EditorLayer.h\"\n\n\n\n#include <imgui/imgui.h>\n\n#include <glm/gtc/matrix_transform.hpp>\n\n#include <glm/gtc/type_ptr.hpp>\n\n\n\n#include \"ImGuizmo.h\"\n\n\n\nnamespace Hazel\n\n{\n\n\tEditorLayer::EditorLayer()\n\n\t\t:Hazel::Layer(\"EditorLayer\"), m_CameraController(1280.0f / 720.0f, true)\n\n\t{\n\n\n\n\t}\n\n\n\n\tvoid EditorLayer::OnAttach()\n\n\t{\n\n\t\tHZ_PROFILE_FUNCTION();\n\n\n", "file_path": "Hazel-Editor/src/EditorLayer.cpp", "rank": 2, "score": 10.001562629951499 }, { "content": "\t\t\tm_OutputStream << \"\\\"ph\\\":\\\"X\\\",\";\n\n\t\t\tm_OutputStream << \"\\\"pid\\\":0,\";\n\n\t\t\tm_OutputStream << \"\\\"tid\\\":\" << result.ThreadID << \",\";\n\n\t\t\tm_OutputStream << \"\\\"ts\\\":\" << result.Start;\n\n\t\t\tm_OutputStream << \"}\";\n\n\n\n\t\t\tm_OutputStream.flush();\n\n\t\t}\n\n\n\n\t\tvoid WriteHeader()\n\n\t\t{\n\n\t\t\tm_OutputStream << \"{\\\"otherData\\\": {},\\\"traceEvents\\\":[\";\n\n\t\t\tm_OutputStream.flush();\n\n\t\t}\n\n\n\n\t\tvoid WriteFooter()\n\n\t\t{\n\n\t\t\tm_OutputStream << \"]}\";\n\n\t\t\tm_OutputStream.flush();\n\n\t\t}\n\n\n\n\t\tstatic Instrumentor& Get()\n\n\t\t{\n\n\t\t\tstatic Instrumentor instance;\n\n\t\t\treturn instance;\n\n\t\t}\n\n\t};\n\n\n", "file_path": "Hazel/src/Hazel/Debug/Instrumentor.h", "rank": 3, "score": 9.544574479417442 }, { "content": "\t\t};\n\n\n\n\t\tstatic void ResetStats();\n\n\t\tstatic Statistics GetStats();\n\n\n\n\tprivate:\n\n\t\tstatic void StartBatch();\n\n\t\tstatic void NextBatch();\n\n\t};\n\n}", "file_path": "Hazel/src/Hazel/Renderer/Renderer2D.h", "rank": 4, "score": 9.455072850878782 }, { "content": "#include \"ParticleSystem.h\"\n\n\n\n#include \"Random.h\"\n\n\n\n#define GLM_ENABLE_EXPERIMENTAL\n\n#include <glm/gtx/compatibility.hpp>\n\n\n\nParticleSystem::ParticleSystem(uint32_t maxParticles/* = 1000*/)\n\n\t:m_PoolIndex(maxParticles - 1)\n\n{\n\n\tm_PariclePool.resize(maxParticles);\n\n}\n\n\n\nvoid ParticleSystem::OnUpdate(Hazel::Timestep ts)\n\n{\n\n\tfor (auto& particle : m_PariclePool)\n\n\t{\n\n\t\tif (!particle.Active) continue;\n\n\n\n\t\tif (particle.LiftRemaining <= 0.0f)\n", "file_path": "Sandbox/src/ParticleSystem.cpp", "rank": 6, "score": 9.089576522608775 }, { "content": "#include \"hzpch.h\"\n\n#include \"Hazel/Utils/PlatformUtils.h\"\n\n\n\n#include \"Hazel/Core/Application.h\"\n\n\n\n\n\n#include <commdlg.h>\n\n#include <GLFW/glfw3.h>\n\n#define GLFW_EXPOSE_NATIVE_WIN32\n\n#include <GLFW/glfw3native.h>\n\n\n\n\n\nnamespace Hazel\n\n{\n\n\n\n\tstd::string FileDialogs::OpenFile(const char* filter)\n\n\t{\n\n\t\tOPENFILENAMEA ofn;\n\n\t\tCHAR szFile[260] = { 0 };\n\n\t\tCHAR currentDir[256] = { 0 };\n", "file_path": "Hazel/src/Platform/Windows/WindowsPlatformUtils.cpp", "rank": 7, "score": 8.930104606437943 }, { "content": "\t\t}\n\n\n\n\t\tm_Framebuffer->Unbind();\n\n\t}\n\n\n\n\tvoid EditorLayer::OnImGuiRender()\n\n\t{\n\n\t\tHZ_PROFILE_FUNCTION();\n\n\n\n\t\tstatic bool dockspaceOpen = true;\n\n\t\tstatic bool opt_fullscreen = true;\n\n\t\tstatic bool opt_padding = false;\n\n\t\tstatic ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_None;\n\n\n\n\t\t// We are using the ImGuiWindowFlags_NoDocking flag to make the parent window not dockable into,\n\n\t\t// because it would be confusing to have two docking targets within each others.\n\n\t\tImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;\n\n\t\tif (opt_fullscreen)\n\n\t\t{\n\n\t\t\tImGuiViewport* viewport = ImGui::GetMainViewport();\n", "file_path": "Hazel-Editor/src/EditorLayer.cpp", "rank": 8, "score": 8.797356009832791 }, { "content": "#include \"hzpch.h\"\n\n\n\n#include \"OrthographicCameraController.h\"\n\n\n\n#include \"Hazel/Core/Input.h\"\n\n#include \"Hazel/Core/KeyCodes.h\"\n\n\n\nnamespace Hazel\n\n{\n\n\n\n\tOrthographicCameraController::OrthographicCameraController(float aspectRatio, bool rotation/* = false*/)\n\n\t\t:m_AspectRatio(aspectRatio),\n\n\t\tm_Bounds{ -m_AspectRatio * m_ZoomLevel, m_AspectRatio * m_ZoomLevel, -m_ZoomLevel, m_ZoomLevel },\n\n\t\tm_Camera(-m_AspectRatio * m_ZoomLevel, m_AspectRatio * m_ZoomLevel, -m_ZoomLevel, m_ZoomLevel),\n\n\t\tm_Rotation(rotation)\n\n\t{\n\n\n\n\t}\n\n\n\n\tvoid OrthographicCameraController::OnUpdate(Timestep ts)\n", "file_path": "Hazel/src/Hazel/Renderer/OrthographicCameraController.cpp", "rank": 9, "score": 8.31210150219377 }, { "content": "#include \"hzpch.h\"\n\n#include \"Renderer.h\"\n\n\n\n#include \"RendererCommand.h\"\n\n#include \"Platform/OpenGL/OpenGLShader.h\"\n\n#include \"Renderer2D.h\"\n\n\n\nnamespace Hazel\n\n{\n\n\tRenderer::SceneData* Renderer::m_SceneData = new Renderer::SceneData;\n\n\n\n\tvoid Renderer::Init()\n\n\t{\n\n\t\tHZ_PROFILE_FUNCTION();\n\n\n\n\t\tRendererCommand::Init();\n\n\t\tRenderer2D::Init();\n\n\t}\n\n\n\n\tvoid Renderer::Shutdown()\n", "file_path": "Hazel/src/Hazel/Renderer/Renderer.cpp", "rank": 10, "score": 7.929590523128617 }, { "content": "\tstatic void GLFWErrorCallback(int error, const char* description)\n\n\t{\n\n\t\tHZ_CORE_ERROR(\"GLFW_Error: ({0}, {1})\", error, description);\n\n\t}\n\n\n\n\tScope<Window> Window::Create(const WindowProps& props)\n\n\t{\n\n\t\treturn CreateScope<WindowsWindow>(props);\n\n\t}\n\n\n\n\tWindowsWindow::WindowsWindow(const WindowProps& props)\n\n\t{\n\n\t\tHZ_PROFILE_FUNCTION();\n\n\n\n\t\tInit(props);\n\n\t}\n\n\n\n\tWindowsWindow::~WindowsWindow()\n\n\t{\n\n\t\tif (m_Context != nullptr)\n", "file_path": "Hazel/src/Platform/Windows/WindowsWindow.cpp", "rank": 11, "score": 7.866503613818002 }, { "content": "\n\n\tm_Pillars.resize(5);\n\n\tfor (int i = 0; i < 5; i++)\n\n\t\tCreatePillar(i, i * 10.0f);\n\n}\n\n\n\nvoid Level::OnUpdate(Hazel::Timestep ts)\n\n{\n\n\tm_Player.OnUpdate(ts);\n\n\n\n\tif (CollisionTest())\n\n\t{\n\n\t\tGameOver();\n\n\t\treturn;\n\n\t}\n\n\n\n\tm_PillarHSV.x += 0.1f * ts;\n\n\tif (m_PillarHSV.x > 1.0f)\n\n\t\tm_PillarHSV.x = 0.0f;\n\n\n", "file_path": "Sandbox/src/Level.cpp", "rank": 12, "score": 7.70440045105941 }, { "content": "\t\t\t\t\ttranslation.x -= speed * ts;\n\n\t\t\t\tif (Input::IsKeyPressed(HZ_KEY_W))\n\n\t\t\t\t\ttranslation.y -= speed * ts;\n\n\t\t\t\tif (Input::IsKeyPressed(HZ_KEY_S))\n\n\t\t\t\t\ttranslation.y += speed * ts;\n\n\t\t\t}\n\n\t\t};\n\n\t\tm_CameraEntity.AddComponent<NativeScriptComponent>().Bind<CameraController>();\n\n#endif\n\n\t\t// Panels\n\n\t\tm_SceneHierarchyPanel.SetContext(m_ActiveScene);\n\n\t}\n\n\n\n\tvoid EditorLayer::OnDetach()\n\n\t{\n\n\t\tHZ_PROFILE_FUNCTION();\n\n\t}\n\n\n\n\tvoid EditorLayer::OnUpdate(Hazel::Timestep ts)\n\n\t{\n", "file_path": "Hazel-Editor/src/EditorLayer.cpp", "rank": 13, "score": 7.647660926271703 }, { "content": "#include \"hzpch.h\"\n\n#include \"WindowsWindow.h\"\n\n\n\n#include \"Hazel/Events/ApplicationEvent.h\"\n\n#include \"Hazel/Events/MouseEvent.h\"\n\n#include \"Hazel/Events/KeyEvent.h\"\n\n\n\n#include \"Hazel/Renderer/Renderer.h\"\n\n\n\n#include \"Platform/OpenGL/OpenGLContext.h\"\n\n\n\n#include <glad/glad.h>\n\n\n\n\n\n\n\n\n\nnamespace Hazel\n\n{\n\n\tstatic uint8_t s_GLFWWindowCount = 0;\n\n\n", "file_path": "Hazel/src/Platform/Windows/WindowsWindow.cpp", "rank": 14, "score": 7.634099466622118 }, { "content": "\t\tfor (auto& vert : playerTransformedVerts)\n\n\t\t{\n\n\t\t\tif (PointInTri({ vert.x, vert.y }, tri[0], tri[1], tri[2]))\n\n \t\t\t\treturn true;\n\n\t\t}\n\n\t}\n\n\n\n\treturn false;\n\n}\n\n\n\nvoid Level::GameOver()\n\n{\n\n\tm_GameOver = true;\n\n}\n", "file_path": "Sandbox/src/Level.cpp", "rank": 15, "score": 7.595071809448658 }, { "content": "\t\tstatic void DrawQuad(const glm::mat4& transform, const glm::vec4& color, int entityID = -1);\n\n\t\tstatic void DrawQuad(const glm::mat4& transform, const Ref<Texture2D>& texture, float tilingFactor = 1.0f, const glm::vec4& tintColor = glm::vec4(1.0f), int entityID = -1);\n\n\n\n\t\tstatic void DrawRotatedQuad(const glm::vec2& position, const glm::vec2& size, float rotation, const glm::vec4& color);\n\n\t\tstatic void DrawRotatedQuad(const glm::vec3& position, const glm::vec2& size, float rotation, const glm::vec4& color);\n\n\t\tstatic void DrawRotatedQuad(const glm::vec2& position, const glm::vec2& size, float rotation, const Ref<Texture2D>& texture, float tilingFactor = 1.0f, const glm::vec4& tintColor = glm::vec4(1.0f));\n\n\t\tstatic void DrawRotatedQuad(const glm::vec3& position, const glm::vec2& size, float rotation, const Ref<Texture2D>& texture, float tilingFactor = 1.0f, const glm::vec4& tintColor = glm::vec4(1.0f));\n\n\t\tstatic void DrawRotatedQuad(const glm::vec2& position, const glm::vec2& size, float rotation, const Ref<SubTexture2D>& subtexture, float tilingFactor = 1.0f, const glm::vec4& tintColor = glm::vec4(1.0f));\n\n\t\tstatic void DrawRotatedQuad(const glm::vec3& position, const glm::vec2& size, float rotation, const Ref<SubTexture2D>& subtexture, float tilingFactor = 1.0f, const glm::vec4& tintColor = glm::vec4(1.0f));\n\n\n\n\t\tstatic void DrawSprite(const glm::mat4& transform, SpriteRendererComponent& src, int entityID);\n\n\n\n\t\t// Stats\n\n\t\tstruct Statistics\n\n\t\t{\n\n\t\t\tuint32_t DrawCalls = 0;\n\n\t\t\tuint32_t QuadCount = 0;\n\n\n\n\t\t\tuint32_t GetTotalVertexCount() { return QuadCount * 4; }\n\n\t\t\tuint32_t GetTotalIndexCount() { return QuadCount * 6; }\n", "file_path": "Hazel/src/Hazel/Renderer/Renderer2D.h", "rank": 16, "score": 7.5747062616415715 }, { "content": "#include \"hzpch.h\"\n\n#include \"SceneSerializer.h\"\n\n\n\n#include \"Entity.h\"\n\n#include \"Components.h\"\n\n\n\n#include <fstream>\n\n#include <yaml-cpp/yaml.h>\n\n\n\nnamespace YAML\n\n{\n\n\ttemplate<>\n\n\tstruct convert<glm::vec3>\n\n\t{\n\n\t\tstatic Node encode(const glm::vec3& rsh)\n\n\t\t{\n\n\t\t\tNode node;\n\n\t\t\tnode.push_back(rsh.x);\n\n\t\t\tnode.push_back(rsh.y);\n\n\t\t\tnode.push_back(rsh.z);\n", "file_path": "Hazel/src/Hazel/Scene/SceneSerializer.cpp", "rank": 17, "score": 7.452936022838331 }, { "content": "#include \"hzpch.h\"\n\n#include \"OpenGLRendererAPI.h\"\n\n\n\n#include <glad/glad.h>\n\n#include <glm/glm.hpp>\n\n\n\nnamespace Hazel\n\n{\n\n\tvoid OpenGLRendererAPI::Init()\n\n\t{\n\n\t\tHZ_PROFILE_FUNCTION();\n\n\n\n\t\tglEnable(GL_BLEND);\n\n\t\tglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n\n\n\n\t\tglEnable(GL_DEPTH_TEST);\n\n\t}\n\n\n\n\n\n\tvoid OpenGLRendererAPI::SetViewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height)\n", "file_path": "Hazel/src/Platform/OpenGL/OpenGLRendererAPI.cpp", "rank": 18, "score": 7.264945962419464 }, { "content": "\t\t\t\tfor (length_t i = 0; i < 3; i++)\n\n\t\t\t\t{\n\n\t\t\t\t\tscale[i] *= static_cast<T>(-1);\n\n\t\t\t\t\tRow[i] *= static_cast<T>(-1);\n\n\t\t\t\t}\n\n\t\t\t}\n\n#endif\n\n\n\n\t\t\trotation.y = asin(-Row[0][2]);\n\n\t\t\tif (cos(rotation.y) != 0) {\n\n\t\t\t\trotation.x = atan2(Row[1][2], Row[2][2]);\n\n\t\t\t\trotation.z = atan2(Row[0][1], Row[0][0]);\n\n\t\t\t}\n\n\t\t\telse {\n\n\t\t\t\trotation.x = atan2(-Row[2][0], Row[1][1]);\n\n\t\t\t\trotation.z = 0;\n\n\t\t\t}\n\n\n\n\n\n\t\t\treturn true;\n\n\t\t}\n\n\t}\n\n}", "file_path": "Hazel/src/Hazel/Math/Math.cpp", "rank": 19, "score": 7.245567063002382 }, { "content": "#include \"hzpch.h\"\n\n#include \"OpenGLShader.h\"\n\n\n\n#include \"Hazel/Core/Core.h\"\n\n\n\n#include <glad/glad.h>\n\n#include <glm/gtc/type_ptr.hpp>\n\n\n\nnamespace Hazel\n\n{\n\n\n\n\tstatic GLenum ShaderTypeFromString(const std::string& type)\n\n\t{\n\n\t\tif (type == \"vertex\")\n\n\t\t\treturn GL_VERTEX_SHADER;\n\n\n\n\t\tif (type == \"fragment\" || type == \"pixel\")\n\n\t\t\treturn GL_FRAGMENT_SHADER;\n\n\n\n\t\tHZ_CORE_ASSERT(false, \"Unknow Shader type!\");\n", "file_path": "Hazel/src/Platform/OpenGL/OpenGLShader.cpp", "rank": 20, "score": 7.240998465253718 }, { "content": "\tm_Level.Init();\n\n\n\n\tImGuiIO io = ImGui::GetIO();\n\n\tm_Font = io.Fonts->AddFontFromFileTTF(\"assets/OpenSans-Regular.ttf\", 30.f);\n\n}\n\n\n\nvoid GameLayer::OnDetach()\n\n{\n\n\n\n}\n\n\n\nvoid GameLayer::OnUpdate(Hazel::Timestep ts)\n\n{\n\n\tm_Time += ts;\n\n\tif (((int)(m_Time * 10.0f)) % 8 > 4)\n\n\t\tm_Blink = !m_Blink;\n\n\n\n\tif (m_Level.IsGameOver())\n\n\t\tm_State = GameState::GameOver;\n\n\n", "file_path": "Sandbox/src/GameLayer.cpp", "rank": 21, "score": 7.114520280308195 }, { "content": "\t\t\ts_RendererAPI->Clear();\n\n\t\t}\n\n\n\n\t\tinline static void DrawIndexed(const Ref<VertexArray>& vertexArray, uint32_t indexCount = 0)\n\n\t\t{\n\n\t\t\ts_RendererAPI->DrawIndexed(vertexArray, indexCount);\n\n\t\t}\n\n\n\n\tprivate:\n\n\t\tstatic RendererAPI* s_RendererAPI;\n\n\t};\n\n\n\n}\n", "file_path": "Hazel/src/Hazel/Renderer/RendererCommand.h", "rank": 22, "score": 6.961845627764188 }, { "content": "#include \"hzpch.h\"\n\n\n\n#include \"LayerStack.h\"\n\n\n\nnamespace Hazel\n\n{\n\n\n\n\tLayerStack::LayerStack()\n\n\t{\n\n\t\t\n\n\t}\n\n\n\n\tLayerStack::~LayerStack()\n\n\t{\n\n\t\tfor (Layer* layer : m_Layers)\n\n\t\t\tdelete layer;\n\n\t}\n\n\n\n\tvoid LayerStack::PushLayer(Layer* layer)\n\n\t{\n", "file_path": "Hazel/src/Hazel/Core/LayerStack.cpp", "rank": 23, "score": 6.899483338282227 }, { "content": "#include \"GameLayer.h\"\n\n\n\n#include \"Random.h\"\n\n\n\n#include <imgui/imgui.h>\n\n\n\n#include <glm/gtc/matrix_transform.hpp>\n\n#include <glm/gtc/type_ptr.hpp>\n\n\n\nGameLayer::GameLayer()\n\n\t:Hazel::Layer(\"GameLayer\")\n\n{\n\n\tauto& window = Hazel::Application::Get().GetWindow();\n\n\tCreateCamera(window.GetWidth(), window.GetHeight());\n\n\n\n\tRandom::Init();\n\n}\n\n\n\nvoid GameLayer::OnAttach()\n\n{\n", "file_path": "Sandbox/src/GameLayer.cpp", "rank": 24, "score": 6.88527433202152 }, { "content": "#include \"hzpch.h\"\n\n#include \"OpenGLContext.h\"\n\n\n\n\n\n#include <GLFW/glfw3.h>\n\n#include <glad/glad.h>\n\n\n\nnamespace Hazel\n\n{\n\n\n\n\tOpenGLContext::OpenGLContext(GLFWwindow* windowHandle)\n\n\t\t: m_WindowHandle(windowHandle)\n\n\t{\n\n\t\tHZ_CORE_ASSERT(m_WindowHandle, \"Window Handle is null!\");\n\n\t}\n\n\n\n\tvoid OpenGLContext::Init()\n\n\t{\n\n\t\tHZ_PROFILE_FUNCTION();\n\n\n", "file_path": "Hazel/src/Platform/OpenGL/OpenGLContext.cpp", "rank": 25, "score": 6.829251790237164 }, { "content": "\tm_EngineParticle.Position = { 0.0f, 0.0f };\n\n\tm_SmokeParticle.Velocity = { -0.2f, 0.0f };\n\n\tm_SmokeParticle.VelocityVariation = { 3.0f, 1.0f };\n\n\tm_SmokeParticle.SizeBegin = 0.5f;\n\n\tm_SmokeParticle.SizeEnd = 0.0f;\n\n\tm_SmokeParticle.SizeVariation = 0.3f;\n\n\tm_SmokeParticle.ColorBegin = { 254 / 255.0f, 109 / 255.0f, 41 / 255.0f, 1.0f };\n\n\tm_SmokeParticle.ColorEnd = { 254 / 255.0f, 212 / 255.0f, 123 / 255.0f, 1.0f };\n\n\tm_SmokeParticle.LiftTime = 1.0f;\n\n}\n\n\n\nvoid Player::LoadAssets()\n\n{\n\n\tm_ShipTexture = Hazel::Texture2D::Create(\"assets/textures/Ship.png\");\n\n}\n\n\n\nvoid Player::OnUpdate(Hazel::Timestep ts)\n\n{\n\n\tm_Time += ts;\n\n\n", "file_path": "Sandbox/src/Player.cpp", "rank": 26, "score": 6.681893704376371 }, { "content": "\t\tm_Velcity.y -= m_Gravity;\n\n\t}\n\n\n\n\tm_Velcity.y = glm::clamp(m_Velcity.y, -20.0f, 20.0f);\n\n\tm_Position += m_Velcity * (float)ts;\n\n\tHZ_INFO(\"Player OnUpdate: m_VelcityX:{0} PositionX:{1}, ts:{2}\", m_Velcity.x, m_Position.x, (float)ts);\n\n\t// Particles\n\n\tif (m_Time > m_SmokeNextEmitTime)\n\n\t{\n\n\t\tm_SmokeParticle.Position = m_Position;\n\n\t\tm_ParticleSystem.Emit(m_SmokeParticle);\n\n\t\tm_SmokeNextEmitTime += m_SmokeEmitInterval;\n\n\t}\n\n\n\n\t//m_ParticleSystem.OnUpdate(ts);\n\n}\n\n\n\nvoid Player::OnRender()\n\n{\n\n\t//m_ParticleSystem.OnRender();\n", "file_path": "Sandbox/src/Player.cpp", "rank": 27, "score": 6.663964082923467 }, { "content": "\t\t\treturn node;\n\n\t\t}\n\n\n\n\t\tstatic bool decode(const Node& node, glm::vec3& rhs)\n\n\t\t{\n\n\t\t\tif (!node.IsSequence() || node.size() != 3)\n\n\t\t\t\treturn false;\n\n\t\t\trhs.x = node[0].as<float>();\n\n\t\t\trhs.y = node[1].as<float>();\n\n\t\t\trhs.z = node[2].as<float>();\n\n\t\t\treturn true;\n\n\t\t}\n\n\t};\n\n\ttemplate<>\n\n\tstruct convert<glm::vec4>\n\n\t{\n\n\t\tstatic Node encode(const glm::vec4& rhs)\n\n\t\t{\n\n\t\t\tNode node;\n\n\t\t\tnode.push_back(rhs.x);\n", "file_path": "Hazel/src/Hazel/Scene/SceneSerializer.cpp", "rank": 28, "score": 6.604816193523037 }, { "content": "\t\t{\n\n\t\t\tparticle.Active = false;\n\n\t\t\tcontinue;\n\n\t\t}\n\n\n\n\t\tparticle.LiftRemaining -= ts;\n\n\t\tparticle.Position += particle.Velocity * (float)ts;\n\n\t\tparticle.Rotation += 0.1f * ts;\n\n\t}\n\n}\n\n\n\nvoid ParticleSystem::OnRender(Hazel::OrthographicCamera& camera)\n\n{\n\n\tHazel::Renderer2D::BeginScene(camera);\n\n\tfor (auto& particle : m_PariclePool)\n\n\t{\n\n\t\tif (!particle.Active) continue;\n\n\n\n\t\t// Fade away particles\n\n\t\tfloat life = particle.LiftRemaining / particle.LiftTime;\n", "file_path": "Sandbox/src/ParticleSystem.cpp", "rank": 29, "score": 6.55468746441497 }, { "content": "#include \"hzpch.h\"\n\n#include \"SceneCamera.h\"\n\n\n\n#include <glm/gtc/matrix_transform.hpp>\n\n\n\nnamespace Hazel\n\n{\n\n\tSceneCamera::SceneCamera()\n\n\t{\n\n\t\tRecalculateProjection();\n\n\t}\n\n\n\n\n\n\tvoid SceneCamera::SetOrthographic(float size, float nearClip, float farClip)\n\n\t{\n\n\t\tm_ProjectionType = ProjectionType::Orthographic;\n\n\t\tm_OrthographicSize = size;\n\n\t\tm_OrthographicNear = nearClip;\n\n\t\tm_OrthographicFar = farClip;\n\n\n", "file_path": "Hazel/src/Hazel/Scene/SceneCamera.cpp", "rank": 30, "score": 6.3833105033719555 }, { "content": "\n\n\n\n\tvoid Application::Close()\n\n\t{\n\n\t\tm_Running = false;\n\n\t}\n\n\n\n\tbool Application::OnWindowClose(WindowCloseEvent& e)\n\n\t{\n\n\t\tm_Running = false;\n\n\t\treturn true;\n\n\t}\n\n\n\n\tbool Application::OnWindowResize(WindowResizeEvent& e)\n\n\t{\n\n\t\tHZ_PROFILE_FUNCTION();\n\n\n\n\t\tif (e.GetWidth() == 0 || e.GetHeight() == 0)\n\n\t\t{\n\n\t\t\tm_Minimized = true;\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\tm_Minimized = false;\n\n\t\tRenderer::OnWindowResize(e.GetWidth(), e.GetHeight());\n\n\t\treturn false;\n\n\t}\n\n\n\n}\n", "file_path": "Hazel/src/Hazel/Core/Application.cpp", "rank": 31, "score": 6.332785741110651 }, { "content": "#include \"hzpch.h\"\n\n#include \"WindowsInput.h\"\n\n\n\n#include \"Hazel/Core/Application.h\"\n\n\n\n#include <GLFW/glfw3.h>\n\n\n\nnamespace Hazel\n\n{\n\n\n\n\tInput* Input::s_Instance = new WindowsInput();\n\n\n\n\tbool WindowsInput::IsKeyPressedImpl(int keycode)\n\n\t{\n\n\t\tGLFWwindow* window = static_cast<GLFWwindow*>(Application::Get().GetWindow().GetNativeWindow());\n\n\t\tint state = glfwGetKey(window, keycode);\n\n\t\treturn state == GLFW_PRESS || state == GLFW_REPEAT;\n\n\t}\n\n\n\n\tbool WindowsInput::IsMouseButtonPressedImpl(int button)\n", "file_path": "Hazel/src/Platform/Windows/WindowsInput.cpp", "rank": 32, "score": 6.316393340615807 }, { "content": "\t{\n\n\t\tauto view = m_Registry.view<CameraComponent>();\n\n\t\tfor (auto entity : view)\n\n\t\t{\n\n\t\t\tconst auto& camera = view.get<CameraComponent>(entity);\n\n\t\t\tif (camera.Primary)\n\n\t\t\t\treturn Entity{ entity, this };\n\n\t\t}\n\n\t\treturn {};\n\n\t}\n\n\n\n\ttemplate<typename T>\n\n\tvoid Scene::OnComponentAdded(Entity entity, T& component)\n\n\t{\n\n\t\tstatic_assert(false);\n\n\t}\n\n\n\n\ttemplate<>\n\n\tvoid Scene::OnComponentAdded<TransformComponent>(Entity entity, TransformComponent& component)\n\n\t{\n", "file_path": "Hazel/src/Hazel/Scene/Scene.cpp", "rank": 33, "score": 6.069894363805872 }, { "content": "#include \"hzpch.h\"\n\n#include \"Log.h\"\n\n\n\n#include \"spdlog/sinks/stdout_color_sinks.h\"\n\n\n\nnamespace Hazel\n\n{\n\n\tRef<spdlog::logger> Log::s_CoreLogger;\n\n\tRef<spdlog::logger> Log::s_ClientLogger;\n\n\n\n\n\n\tvoid Log::Init()\n\n\t{\n\n\t\tspdlog::set_pattern(\"%^[%T] %n: %v%$\");\n\n\t\ts_CoreLogger = spdlog::stdout_color_mt(\"HAZEL\");\n\n\t\ts_CoreLogger->set_level(spdlog::level::trace);\n\n\n\n\t\ts_ClientLogger = spdlog::stdout_color_mt(\"APP\");\n\n\t\ts_ClientLogger->set_level(spdlog::level::trace);\n\n\t}\n\n\n\n}\n", "file_path": "Hazel/src/Hazel/Core/Log.cpp", "rank": 34, "score": 5.993687697302027 }, { "content": "#include \"Level.h\"\n\n\n\n#include <glm/gtc/matrix_transform.hpp>\n\n\n\n\n\nstatic glm::vec4 HSVtoRGB(const glm::vec3& hsv)\n\n{\n\n\tint H = (int)(hsv.x * 360.0f);\n\n\tdouble S = hsv.y;\n\n\tdouble V = hsv.z;\n\n\n\n\tdouble C = S * V;\n\n\tdouble X = C * (1 - abs(fmod(H / 60.0f, 2) - 1));\n\n\tdouble m = V - C;\n\n\tdouble Rs, Gs, Bs;\n\n\n\n\tif (H >= 0 && H < 60)\n\n\t{\n\n\t\tRs = C;\n\n\t\tGs = X;\n", "file_path": "Sandbox/src/Level.cpp", "rank": 35, "score": 5.986137734037028 }, { "content": "#include \"hzpch.h\"\n\n\n\n#include \"OpenGLVertexArray.h\"\n\n\n\n#include <glad/glad.h>\n\n\n\n\n\nnamespace Hazel\n\n{\n\n\n\n\tstatic GLenum ShaderDataTypeToOpenGLBaseType(ShaderDataType type)\n\n\t{\n\n\t\tswitch (type)\n\n\t\t{\n\n\t\tcase ShaderDataType::Float:\t\treturn GL_FLOAT;\n\n\t\tcase ShaderDataType::Float2:\treturn GL_FLOAT;\n\n\t\tcase ShaderDataType::Float3:\treturn GL_FLOAT;\n\n\t\tcase ShaderDataType::Float4:\treturn GL_FLOAT;\n\n\t\tcase ShaderDataType::Mat3:\t\treturn GL_FLOAT;\n\n\t\tcase ShaderDataType::Mat4:\t\treturn GL_FLOAT;\n", "file_path": "Hazel/src/Platform/OpenGL/OpenGLVertexArray.cpp", "rank": 36, "score": 5.859696505798498 }, { "content": "#include \"hzpch.h\"\n\n#include \"OrthographicCamera.h\"\n\n\n\n#include <glm/gtc/matrix_transform.hpp>\n\n\n\nnamespace Hazel\n\n{\n\n\tOrthographicCamera::OrthographicCamera(float left, float right, float bottom, float top)\n\n\t\t:m_ProjectionMatrix(glm::ortho(left, right, bottom, top, -1.0f, 1.0f)),\n\n\t\tm_ViewMatrix(1.0f),\n\n\t\tm_Position(glm::vec3(0.0f))\n\n\t{\n\n\t\tHZ_PROFILE_FUNCTION();\n\n\n\n\t\tm_ViewProjectionMatrix = m_ProjectionMatrix * m_ViewMatrix;\n\n\t}\n\n\n\n\tvoid OrthographicCamera::SetProjection(float left, float right, float bottom, float top)\n\n\t{\n\n\t\tHZ_PROFILE_FUNCTION();\n", "file_path": "Hazel/src/Hazel/Renderer/OrthographicCamera.cpp", "rank": 37, "score": 5.8332572790514075 }, { "content": "\t\tbool OnWindowClose(WindowCloseEvent& e);\n\n\t\tbool OnWindowResize(WindowResizeEvent& e);\n\n\n\n\tprivate:\n\n\t\tScope<Window> m_Window;\n\n\t\tImGuiLayer* m_ImGuiLayer;\n\n\t\tbool m_Running = true;\n\n\t\tbool m_Minimized = false;\n\n\n\n\t\tLayerStack m_LayerStack;\n\n\t\tTimestep m_Timestep;\n\n\t\tfloat m_LastTime = 0.0f;\n\n\n\n\tprivate:\n\n\t\tstatic Application* s_Instance;\n\n\n\n\t};\n\n\n\n\tApplication* CreateApplication();\n\n}\n\n\n", "file_path": "Hazel/src/Hazel/Core/Application.h", "rank": 38, "score": 5.544082451358816 }, { "content": "\t\t}\n\n\n\n\t\tstatic void BindTexture(bool multisampled, uint32_t id)\n\n\t\t{\n\n\t\t\tglBindTexture(TextureTarget(multisampled), id);\n\n\t\t}\n\n\n\n\t\tstatic void AttachColorTexture(uint32_t id, int samples, GLenum internalFormat, GLenum format, uint32_t width, uint32_t height, int index)\n\n\t\t{\n\n\t\t\tbool multisampled = samples > 1;\n\n\t\t\tif (multisampled)\n\n\t\t\t{\n\n\t\t\t\tglTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, samples, internalFormat, width, height, GL_FALSE);\n\n\t\t\t}\n\n\t\t\telse\n\n\t\t\t{\n\n\t\t\t\tglTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, GL_UNSIGNED_BYTE, nullptr);\n\n\n\n\t\t\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n\n\t\t\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n", "file_path": "Hazel/src/Platform/OpenGL/OpenGLFramebuffer.cpp", "rank": 39, "score": 5.423975416658351 }, { "content": "\n\n\tEntity Scene::CreateEntity(const std::string& name)\n\n\t{\n\n\t\tEntity entity = { m_Registry.create(), this };\n\n\t\tentity.AddComponent<TransformComponent>();\n\n\t\tauto& tag = entity.AddComponent<TagComponent>();\n\n\t\ttag.Tag = name.empty() ? \"Entity\" : name;\n\n\t\treturn entity;\n\n\t}\n\n\n\n\tvoid Scene::DestroyEntity(Entity entity)\n\n\t{\n\n\t\tm_Registry.destroy(entity);\n\n\t}\n\n\n\n\tvoid Scene::OnUpdateEditor(Timestep ts, EditorCamera& camera)\n\n\t{\n\n\t\tRenderer2D::BeginScene(camera);\n\n\n\n\t\tauto grop = m_Registry.group<TransformComponent>(entt::get<SpriteRendererComponent>);\n", "file_path": "Hazel/src/Hazel/Scene/Scene.cpp", "rank": 40, "score": 5.408079899890227 }, { "content": "\t\t\tnode.push_back(rhs.y);\n\n\t\t\tnode.push_back(rhs.z);\n\n\t\t\tnode.push_back(rhs.w);\n\n\t\t\tnode.SetStyle(EmitterStyle::Flow);\n\n\t\t\treturn node;\n\n\t\t}\n\n\n\n\t\tstatic bool decode(const Node& node, glm::vec4& rhs)\n\n\t\t{\n\n\t\t\tif (!node.IsSequence() || node.size() != 4)\n\n\t\t\t\treturn false;\n\n\n\n\t\t\trhs.x = node[0].as<float>();\n\n\t\t\trhs.y = node[1].as<float>();\n\n\t\t\trhs.z = node[2].as<float>();\n\n\t\t\trhs.w = node[3].as<float>();\n\n\t\t\treturn true;\n\n\t\t}\n\n\t};\n\n}\n", "file_path": "Hazel/src/Hazel/Scene/SceneSerializer.cpp", "rank": 41, "score": 5.400195524714958 }, { "content": "\t\t\tif (open)\n\n\t\t\t{\n\n\t\t\t\tuiFunction(component);\n\n\t\t\t\tImGui::TreePop();\n\n\t\t\t}\n\n\n\n\t\t\tif (removeComponent)\n\n\t\t\t\tentity.RemoveComponent<T>();\n\n\t\t}\n\n\t}\n\n\n\n\tvoid SceneHierarchyPanel::DrawComponent(Entity& entity)\n\n\t{\n\n\t\tif (entity.HasComponent<TagComponent>())\n\n\t\t{\n\n\t\t\tauto& tag = entity.GetComponent<TagComponent>().Tag;\n\n\n\n\t\t\tchar buffer[256];\n\n\t\t\tmemset(buffer, 0, sizeof(buffer));\n\n\t\t\tmemcpy(buffer, tag.c_str(), tag.size());\n", "file_path": "Hazel-Editor/src/Panels/SceneHierarchyPanel.cpp", "rank": 42, "score": 5.197739962966851 }, { "content": "\t\tCHAR szFile[260] = { 0 };\n\n\t\tCHAR currentDir[256] = { 0 };\n\n\t\tZeroMemory(&ofn, sizeof(OPENFILENAME));\n\n\t\tofn.lStructSize = sizeof(OPENFILENAME);\n\n\t\tofn.hwndOwner = glfwGetWin32Window((GLFWwindow*)Application::Get().GetWindow().GetNativeWindow());\n\n\t\tofn.lpstrFile = szFile;\n\n\t\tofn.nMaxFile = sizeof(szFile);\n\n\t\tif (GetCurrentDirectoryA(256, currentDir))\n\n\t\t\tofn.lpstrInitialDir = currentDir;\n\n\t\tofn.lpstrFilter = filter;\n\n\t\tofn.nFilterIndex = 1;\n\n\t\tofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;\n\n\n\n\t\tif (GetSaveFileNameA(&ofn) == TRUE)\n\n\t\t\treturn ofn.lpstrFile;\n\n\n\n\t\treturn std::string();\n\n\t}\n\n\n\n}\n", "file_path": "Hazel/src/Platform/Windows/WindowsPlatformUtils.cpp", "rank": 43, "score": 5.157545825550708 }, { "content": "\tvoid OpenGLVertexArray::AddVertexBuffer(Ref<VertexBuffer>& vertexBuffer)\n\n\t{\n\n\t\tHZ_PROFILE_FUNCTION();\n\n\n\n\t\tglBindVertexArray(m_RendererID);\n\n\t\tvertexBuffer->Bind();\n\n\n\n\t\tuint32_t index = 0;\n\n\t\tconst auto& layout = vertexBuffer->GetLayout();\n\n\t\tfor (const auto& element : layout)\n\n\t\t{\n\n\t\t\tglEnableVertexAttribArray(index);\n\n\t\t\tglVertexAttribPointer(index,\n\n\t\t\t\telement.GetComponetCount(),\n\n\t\t\t\tShaderDataTypeToOpenGLBaseType(element.Type),\n\n\t\t\t\telement.Normalized ? GL_TRUE : GL_FALSE,\n\n\t\t\t\tlayout.GetStride(),\n\n\t\t\t\t(const void*)(element.Offset));\n\n\t\t\tindex++;\n\n\t\t}\n", "file_path": "Hazel/src/Platform/OpenGL/OpenGLVertexArray.cpp", "rank": 44, "score": 5.117319812498209 }, { "content": "\n\n\t\tuint32_t indicesSquare[6] = { 0, 1, 2, 2, 3, 0 };\n\n\t\tHazel::Ref<Hazel::IndexBuffer> indexBufferSquare = Hazel::IndexBuffer::Create(indicesSquare, sizeof(indicesSquare) / sizeof(uint32_t));\n\n\t\tm_SquareVA->SetIndexBuffer(indexBufferSquare);\n\n\n\n\t\tauto textureShader = m_ShaderLibrary.Load(\"assets/shaders/Texture.glsl\");\n\n\n\n\n\n\n\n\t\tm_TextureWall = Hazel::Texture2D::Create(\"assets/textures/wall.jpg\");\n\n\t\tm_TextureBox = Hazel::Texture2D::Create(\"assets/textures/box.png\");\n\n\n\n\t}\n\n\n\n\tvoid OnUpdate(Hazel::Timestep ts) override\n\n\t{\n\n\t\t// Update\n\n\t\tm_CameraController.OnUpdate(ts);\n\n\n\n\t\tHazel::RendererCommand::SetClearColor(glm::vec4(0.2f, 0.2f, 0.2f, 1.0f));\n", "file_path": "Sandbox/src/SandboxApp.cpp", "rank": 45, "score": 5.020215109676801 }, { "content": "#include \"hzpch.h\"\n\n#include \"ImGuiLayer.h\"\n\n\n\n#include \"imgui.h\"\n\n\n\n//#define IMGUI_IMPL_API\n\n#include <examples/imgui_impl_opengl3.h>\n\n#include <examples/imgui_impl_glfw.h>\n\n\n\n#include \"Hazel/Core/Application.h\"\n\n\n\n// TEMPORARY\n\n#include <GLFW/glfw3.h>\n\n#include <glad/glad.h>\n\n\n\n#include \"ImGuizmo.h\"\n\n\n\n\n\nnamespace Hazel\n\n{\n", "file_path": "Hazel/src/Hazel/ImGui/ImGuiLayer.cpp", "rank": 46, "score": 4.936438350196774 }, { "content": "#include <Hazel.h>\n\n\n\n#include <Hazel/Core/EntryPoint.h>\n\n\n\n#include <imgui/imgui.h>\n\n#include <glm/gtc/matrix_transform.hpp>\n\n#include <glm/gtc/type_ptr.hpp>\n\n\n\n#include \"Sandbox2D.h\"\n\n#include \"GameLayer.h\"\n\n\n", "file_path": "Sandbox/src/SandboxApp.cpp", "rank": 47, "score": 4.924026578097971 }, { "content": "#pragma once\n\n\n\n#include \"OrthographicCamera.h\"\n\n#include \"Camera.h\"\n\n#include \"Texture.h\"\n\n#include \"SubTexture2D.h\"\n\n#include \"EditorCamera.h\"\n\n\n\n#include \"Hazel/Scene/Components.h\"\n\n\n\nnamespace Hazel\n\n{\n", "file_path": "Hazel/src/Hazel/Renderer/Renderer2D.h", "rank": 48, "score": 4.921526368840995 }, { "content": "\t{\n\n\t\t\"MultiProcessorCompile\"\n\n\t}\n\n\n\noutputdir = \"%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}\"\n\n\n\n-- Include directories relative to root folder (solution directory)\n\nIncludeDir = {}\n\nIncludeDir[\"GLFW\"] = \"%{wks.location}/Hazel/vendor/GLFW/include\"\n\nIncludeDir[\"Glad\"] = \"%{wks.location}/Hazel/vendor/Glad/include\"\n\nIncludeDir[\"ImGui\"] = \"%{wks.location}/Hazel/vendor/imgui\"\n\nIncludeDir[\"glm\"] = \"%{wks.location}/Hazel/vendor/glm\"\n\nIncludeDir[\"stb_image\"] = \"%{wks.location}/Hazel/vendor/stb_image\"\n\nIncludeDir[\"entt\"] = \"%{wks.location}/Hazel/vendor/entt/include\"\n\nIncludeDir[\"yaml_cpp\"] = \"%{wks.location}/Hazel/vendor/yaml-cpp/include\"\n\nIncludeDir[\"ImGuizmo\"] = \"%{wks.location}/Hazel/vendor/ImGuizmo\"\n\n\n\ngroup \"Dependencies\"\n\n\tinclude \"vendor/premake\"\n\n\tinclude \"Hazel/vendor/GLFW\"\n\n\tinclude \"Hazel/vendor/Glad\"\n\n\tinclude \"Hazel/vendor/imgui\"\n\n\tinclude \"Hazel/vendor/yaml-cpp\"\n\ngroup \"\"\n\n\n\ninclude \"Hazel\"\n\ninclude \"Sandbox\"\n\ninclude \"Hazel-Editor\"", "file_path": "premake5.lua", "rank": 49, "score": 4.908407273071825 }, { "content": "#include \"hzpch.h\"\n\n#include \"Scene.h\"\n\n\n\n#include \"Entity.h\"\n\n#include \"Components.h\"\n\n#include \"Hazel/Renderer/Renderer2D.h\"\n\n\n\n//#include <glm/glm.hpp>\n\n\n\nnamespace Hazel\n\n{\n\n\n\n\tScene::Scene()\n\n\t{\n\n\t}\n\n\n\n\tScene::~Scene()\n\n\t{\n\n\n\n\t}\n", "file_path": "Hazel/src/Hazel/Scene/Scene.cpp", "rank": 50, "score": 4.894566638033482 }, { "content": "#pragma once\n\n\n\n#include <Hazel.h>\n\n\n\n#include \"Color.h\"\n\n#include \"Random.h\"\n\n#include \"ParticleSystem.h\"\n\n\n", "file_path": "Sandbox/src/Player.h", "rank": 51, "score": 4.892619696021304 }, { "content": "#pragma once\n\n\n\n#include \"Hazel/Core/Core.h\"\n\n\n\n#include \"Window.h\"\n\n#include \"LayerStack.h\"\n\n#include \"Hazel/Events/Event.h\"\n\n#include \"Hazel/Events/ApplicationEvent.h\"\n\n\n\n#include \"Timestep.h\"\n\n\n\n#include \"Hazel/ImGui/ImGuiLayer.h\"\n\n\n\nnamespace Hazel \n\n{\n", "file_path": "Hazel/src/Hazel/Core/Application.h", "rank": 52, "score": 4.889383184989084 }, { "content": "#include \"hzpch.h\"\n\n\n\n#include \"Renderer2D.h\"\n\n#include \"VertexArray.h\"\n\n#include \"Shader.h\"\n\n#include \"Buffer.h\"\n\n#include \"RendererCommand.h\"\n\n#include \"Texture.h\"\n\n\n\n#include \"Platform/OpenGL/OpenGLShader.h\"\n\n\n\n#include <glm/gtc/matrix_transform.hpp>\n\n\n\nnamespace Hazel\n\n{\n\n\tstruct QuadVertex\n\n\t{\n\n\t\tglm::vec3 Position;\n\n\t\tglm::vec4 Color;\n\n\t\tglm::vec2 TexCoord;\n", "file_path": "Hazel/src/Hazel/Renderer/Renderer2D.cpp", "rank": 53, "score": 4.882488968284861 }, { "content": "#include <Hazel.h>\n\n\n\n#include <Hazel/Core/EntryPoint.h>\n\n\n\n#include <imgui/imgui.h>\n\n#include <glm/gtc/matrix_transform.hpp>\n\n#include <glm/gtc/type_ptr.hpp>\n\n\n\n#include \"EditorLayer.h\"\n\n\n", "file_path": "Hazel-Editor/src/HazelEditorApp.cpp", "rank": 54, "score": 4.8811972325335296 }, { "content": "\t\t\"vendor/ImGuizmo/ImGuizmo.h\",\n\n\t\t\"vendor/ImGuizmo/ImGuizmo.cpp\"\n\n\t}\n\n\n\n\tdefines\n\n\t{\n\n\t\t\"_CRT_SECURE_NO_WARNINGS\",\n\n\t\t\"GLFW_INCLUDE_NONE\"\n\n\t}\n\n\n\n\tincludedirs\n\n\t{\n\n\t\t\"src\",\n\n\t\t\"vendor/spdlog/include\",\n\n\t\t\"%{IncludeDir.GLFW}\",\n\n\t\t\"%{IncludeDir.Glad}\",\n\n\t\t\"%{IncludeDir.ImGui}\",\n\n\t\t\"%{IncludeDir.glm}\",\n\n\t\t\"%{IncludeDir.stb_image}\",\n\n\t\t\"%{IncludeDir.entt}\",\n", "file_path": "Hazel/premake5.lua", "rank": 55, "score": 4.826129351651299 }, { "content": "\t\t\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n\t\t\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);\n\n\t\t\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n\n\t\t\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n\n\t\t\t}\n\n\n\n\t\t\tglFramebufferTexture2D(GL_FRAMEBUFFER, attachmentType, TextureTarget(multisampled), id, 0);\n\n\t\t}\n\n\n\n\t\tstatic bool IsDepthFormat(FramebufferTextureFormat format)\n\n\t\t{\n\n\t\t\tswitch (format)\n\n\t\t\t{\n\n\t\t\tcase FramebufferTextureFormat::DEPTH24STENCIL8: return true;\n\n\t\t\t}\n\n\n\n\t\t\treturn false;\n\n\t\t}\n\n\n\n\t\tstatic GLenum HazelFBTextureFormatToGL(FramebufferTextureFormat format)\n", "file_path": "Hazel/src/Platform/OpenGL/OpenGLFramebuffer.cpp", "rank": 56, "score": 4.7946632836856224 }, { "content": "\t{\n\n\n\n\t}\n\n\n\n\tstatic void SerializerEntity(YAML::Emitter& out, Entity entity)\n\n\t{\n\n\t\tout << YAML::BeginMap; // Entity\n\n\t\tout << YAML::Key << \"Entity\" << YAML::Value << (uint32_t)entity; // TODO: Entity ID goes here\n\n\n\n\t\tif (entity.HasComponent<TagComponent>())\n\n\t\t{\n\n\t\t\tout << YAML::Key << \"TagComponent\";\n\n\t\t\tout << YAML::BeginMap; // TagComponent\n\n\n\n\t\t\tauto& tag = entity.GetComponent<TagComponent>().Tag;\n\n\t\t\tout << YAML::Key << \"Tag\" << YAML::Value << tag;\n\n\n\n\t\t\tout << YAML::EndMap; // TagComponent\n\n\t\t}\n\n\n", "file_path": "Hazel/src/Hazel/Scene/SceneSerializer.cpp", "rank": 57, "score": 4.7914879298459265 }, { "content": "#pragma once\n\n\n\n#include <Hazel.h>\n\n\n\n#include \"Level.h\"\n\n#include <imgui/imgui.h>\n\n\n", "file_path": "Sandbox/src/GameLayer.h", "rank": 58, "score": 4.773107696931341 }, { "content": "#pragma once\n\n\n\n#include \"Camera.h\"\n\n#include \"Hazel/Core/Timestep.h\"\n\n#include \"Hazel/Events/Event.h\"\n\n#include \"Hazel/Events/MouseEvent.h\"\n\n\n\nnamespace Hazel\n\n{\n", "file_path": "Hazel/src/Hazel/Renderer/EditorCamera.h", "rank": 59, "score": 4.736988543533212 }, { "content": "#pragma once\n\n\n\n#include \"Shader.h\"\n\n#include \"RendererCommand.h\"\n\n#include \"OrthographicCamera.h\"\n\n\n\nnamespace Hazel\n\n{\n\n\n", "file_path": "Hazel/src/Hazel/Renderer/Renderer.h", "rank": 60, "score": 4.697820624802768 }, { "content": "#pragma once\n\n\n\n#include \"Core.h\"\n\n\n\n#include \"spdlog/spdlog.h\"\n\n#include \"spdlog/fmt/ostr.h\"\n\n\t\n\nnamespace Hazel\n\n{\n\n\n", "file_path": "Hazel/src/Hazel/Core/Log.h", "rank": 61, "score": 4.673249958683749 }, { "content": "#pragma once\n\n\n\n#include \"Hazel/Core/Core.h\"\n\n#include \"Texture.h\"\n\n\n\n#include <glm/glm.hpp>\n\n\n\nnamespace Hazel\n\n{\n", "file_path": "Hazel/src/Hazel/Renderer/SubTexture2D.h", "rank": 62, "score": 4.648934975584767 }, { "content": "\t\tImGui::End();\n\n\t}\n\n\n\n\tvoid SceneHierarchyPanel::DrawEntityNode(Entity& entity)\n\n\t{\n\n\t\tauto& tag = entity.GetComponent<TagComponent>().Tag;\n\n\n\n\t\tImGuiTreeNodeFlags flags = ((m_SelectionContext == entity) ? ImGuiTreeNodeFlags_Selected : 0) | ImGuiTreeNodeFlags_OpenOnArrow;\n\n\t\tflags |= ImGuiTreeNodeFlags_SpanAvailWidth;\n\n\t\tbool opened = ImGui::TreeNodeEx((void*)((uint64_t)(uint32_t)entity), flags, tag.c_str());\n\n\t\tif (ImGui::IsItemClicked())\n\n\t\t{\n\n\t\t\tm_SelectionContext = entity;\n\n\t\t}\n\n\n\n\t\tbool entityDelete = false;\n\n\t\tif (ImGui::BeginPopupContextItem())\n\n\t\t{\n\n\t\t\tif (ImGui::MenuItem(\"Delete Entity\"))\n\n\t\t\t\tentityDelete = true;\n", "file_path": "Hazel-Editor/src/Panels/SceneHierarchyPanel.cpp", "rank": 63, "score": 4.629583990179634 }, { "content": "#pragma once\n\n\n\n#include \"Hazel/Core/Window.h\"\n\n#include \"Hazel/Renderer/GraphicsContext.h\"\n\n\n\n#include <GLFW/glfw3.h>\n\n\n\n\n\nnamespace Hazel\n\n{\n", "file_path": "Hazel/src/Platform/Windows/WindowsWindow.h", "rank": 64, "score": 4.601056258989728 }, { "content": "#pragma once\n\n\n\n#include \"Hazel/Core/Timestep.h\"\n\n#include \"Hazel/Renderer/EditorCamera.h\"\n\n\n\n#include \"entt.hpp\"\n\n\n\nnamespace Hazel\n\n{\n", "file_path": "Hazel/src/Hazel/Scene/Scene.h", "rank": 65, "score": 4.601056258989728 }, { "content": "\n\n\tOpenGLVertexBuffer::OpenGLVertexBuffer(float* vertices, uint32_t size)\n\n\t{\n\n\t\tHZ_PROFILE_FUNCTION();\n\n\n\n\t\tglCreateBuffers(1, &m_RendererID);\n\n\t\tglBindBuffer(GL_ARRAY_BUFFER, m_RendererID);\n\n\t\tglBufferData(GL_ARRAY_BUFFER, size, vertices, GL_STATIC_DRAW);\n\n\t}\n\n\n\n\n\n\tOpenGLVertexBuffer::~OpenGLVertexBuffer()\n\n\t{\n\n\t\tHZ_PROFILE_FUNCTION();\n\n\n\n\t\tglDeleteBuffers(1, &m_RendererID);\n\n\t}\n\n\n\n\tvoid OpenGLVertexBuffer::Bind() const\n\n\t{\n", "file_path": "Hazel/src/Platform/OpenGL/OpenGLBuffer.cpp", "rank": 66, "score": 4.5730185570421025 }, { "content": "#pragma once\n\n\n\n#include \"Hazel.h\"\n\n\n\n#include \"ParticleSystem.h\"\n\n\n", "file_path": "Sandbox/src/Sandbox2D.h", "rank": 67, "score": 4.550783749001534 }, { "content": "\t\tuint32_t QuadIndexCount = 0;\n\n\t\tQuadVertex* QuadVertexBufferBase = nullptr;\n\n\t\tQuadVertex* QuadVertexBufferPtr = nullptr;\n\n\n\n\t\tstd::array<Ref<Texture2D>, MaxTextureSlots> TextureSlots;\n\n\t\tuint32_t TextureSlotIndex = 1; // 0 = White texture\n\n\n\n\t\tglm::vec4 QuadVertexPositions[4];\n\n\n\n\t\tRenderer2D::Statistics Stats;\n\n\t};\n\n\n\n\tstatic Renderer2DStorage s_Data;\n\n\n\n\tvoid Renderer2D::Init()\n\n\t{\n\n\t\tHZ_PROFILE_FUNCTION();\n\n\n\n\t\ts_Data.QuadVertexArray = VertexArray::Create();\n\n\n", "file_path": "Hazel/src/Hazel/Renderer/Renderer2D.cpp", "rank": 68, "score": 4.538529282854405 }, { "content": "#pragma once\n\n\n\n#include \"hzpch.h\"\n\n#include \"Event.h\"\n\n\n\n\n\n\n\nnamespace Hazel\n\n{\n\n\n", "file_path": "Hazel/src/Hazel/Events/MouseEvent.h", "rank": 69, "score": 4.516280510865067 }, { "content": "#pragma once\n\n#include \"hzpch.h\"\n\n#include \"Event.h\"\n\n\n\n\n\nnamespace Hazel\n\n{\n", "file_path": "Hazel/src/Hazel/Events/KeyEvent.h", "rank": 70, "score": 4.516280510865067 }, { "content": "#pragma once\n\n\n\n#include <memory>\n\n#include \"Buffer.h\"\n\n\n\nnamespace Hazel\n\n{\n", "file_path": "Hazel/src/Hazel/Renderer/VertexArray.h", "rank": 71, "score": 4.516280510865067 }, { "content": "\t{\n\n\t\tHZ_PROFILE_FUNCTION();\n\n\n\n\t\tif (Input::IsKeyPressed(HZ_KEY_A))\n\n\t\t\tm_CameraPosition.x += m_CameraTranslationSpeed * ts;\n\n\t\telse if (Input::IsKeyPressed(HZ_KEY_D))\n\n\t\t\tm_CameraPosition.x -= m_CameraTranslationSpeed * ts;\n\n\n\n\t\tif (Input::IsKeyPressed(HZ_KEY_W))\n\n\t\t\tm_CameraPosition.y -= m_CameraTranslationSpeed * ts;\n\n\t\telse if (Input::IsKeyPressed(HZ_KEY_S))\n\n\t\t\tm_CameraPosition.y += m_CameraTranslationSpeed * ts;\n\n\n\n\t\tif (m_Rotation) \n\n\t\t{\n\n\t\t\tif (Input::IsKeyPressed(HZ_KEY_Q))\n\n\t\t\t\tm_CameraRotation += m_CameraRotationSpeed * ts;\n\n\t\t\telse if (Input::IsKeyPressed(HZ_KEY_E))\n\n\t\t\t\tm_CameraRotation -= m_CameraRotationSpeed * ts;\n\n\n", "file_path": "Hazel/src/Hazel/Renderer/OrthographicCameraController.cpp", "rank": 72, "score": 4.513161420932953 }, { "content": "#include \"hzpch.h\"\n\n\n\n#define IMGUI_IMPL_OPENGL_LOADER_GLAD\n\n#include <examples/imgui_impl_opengl3.cpp>\n\n#include <examples/imgui_impl_glfw.cpp>\n\n\n", "file_path": "Hazel/src/Hazel/ImGui/ImGuiBuild.cpp", "rank": 73, "score": 4.485565758033494 }, { "content": "#pragma once\n\n\n\n#include \"Scene.h\"\n\n\n\n#include \"entt.hpp\"\n\n\n\nnamespace Hazel\n\n{\n\n\n", "file_path": "Hazel/src/Hazel/Scene/Entity.h", "rank": 74, "score": 4.482296530714082 }, { "content": "\t\t\tif (epsilonEqual(LocalMatrix[3][3], static_cast<float>(0), epsilon<T>()))\n\n\t\t\t\treturn false;\n\n\n\n\t\t\t// First, isolate perspective. This is the messiest.\n\n\t\t\tif (\n\n\t\t\t\tepsilonNotEqual(LocalMatrix[0][3], static_cast<T>(0), epsilon<T>()) ||\n\n\t\t\t\tepsilonNotEqual(LocalMatrix[1][3], static_cast<T>(0), epsilon<T>()) ||\n\n\t\t\t\tepsilonNotEqual(LocalMatrix[2][3], static_cast<T>(0), epsilon<T>()))\n\n\t\t\t{\n\n\t\t\t\t// Clear the perspective partition\n\n\t\t\t\tLocalMatrix[0][3] = LocalMatrix[1][3] = LocalMatrix[2][3] = static_cast<T>(0);\n\n\t\t\t\tLocalMatrix[3][3] = static_cast<T>(1);\n\n\t\t\t}\n\n\n\n\t\t\t// Next take care of translation (easy).\n\n\t\t\ttranslation = vec3(LocalMatrix[3]);\n\n\t\t\tLocalMatrix[3] = vec4(0, 0, 0, LocalMatrix[3].w);\n\n\n\n\t\t\tvec3 Row[3], Pdum3;\n\n\n", "file_path": "Hazel/src/Hazel/Math/Math.cpp", "rank": 75, "score": 4.475995144329643 }, { "content": "#pragma once\n\n\n\n#include \"Hazel/Core/Core.h\"\n\n#include \"Scene.h\"\n\n\n\nnamespace Hazel\n\n{\n", "file_path": "Hazel/src/Hazel/Scene/SceneSerializer.h", "rank": 76, "score": 4.448820174200882 }, { "content": "\t\tfor (auto entity : grop)\n\n\t\t{\n\n\t\t\tauto [transform, sprite] = grop.get<TransformComponent, SpriteRendererComponent>(entity);\n\n\t\t\t//Renderer2D::DrawQuad(transform.GetTransform(), sprite.Color);\n\n\t\t\tRenderer2D::DrawSprite(transform.GetTransform(), sprite, (int)entity);\n\n\t\t}\n\n\n\n\t\tRenderer2D::EndScene();\n\n\t}\n\n\n\n\tvoid Scene::OnUpdateRuntime(Timestep ts)\n\n\t{\n\n\t\t// Update Script\n\n\t\t{\n\n\t\t\tm_Registry.view<NativeScriptComponent>().each([=](auto entity, auto& nsc)\n\n\t\t\t\t{\n\n\t\t\t\t\t// TODO: Move To Scene::OnScenePlay\n\n\t\t\t\t\tif (!nsc.Instance)\n\n\t\t\t\t\t{\n\n\t\t\t\t\t\tnsc.Instance = nsc.InstantiateScript();\n", "file_path": "Hazel/src/Hazel/Scene/Scene.cpp", "rank": 77, "score": 4.42453744156035 }, { "content": "#pragma once\n\n\n\n#include \"Hazel/Renderer/Texture.h\"\n\n#include <glad/glad.h>\n\n\n\nnamespace Hazel\n\n{\n", "file_path": "Hazel/src/Platform/OpenGL/OpenGLTexture.h", "rank": 78, "score": 4.415840151969048 }, { "content": "#pragma once\n\n\n\n#include <glm/glm.hpp>\n\n\n\n#include \"VertexArray.h\"\n\n\n\nnamespace Hazel\n\n{\n\n\n", "file_path": "Hazel/src/Hazel/Renderer/RendererAPI.h", "rank": 79, "score": 4.415840151969048 }, { "content": "#pragma once\n\n\n\n#include \"Hazel.h\"\n\n\n\n#include \"Panels/SceneHierarchyPanel.h\"\n\n\n\nnamespace Hazel\n\n{\n\n\n", "file_path": "Hazel-Editor/src/EditorLayer.h", "rank": 80, "score": 4.415840151969048 }, { "content": "#include \"hzpch.h\"\n\n#include \"EditorCamera.h\"\n\n\n\n#include \"Hazel/Core/Input.h\"\n\n#include \"Hazel/Core/KeyCodes.h\"\n\n#include \"Hazel/Core/MouseButtonCodes.h\"\n\n\n\n#include <glfw/glfw3.h>\n\n\n\n#define GLM_ENABLE_EXPERIMENTAL\n\n#include <glm/gtx/quaternion.hpp>\n\n\n\nnamespace Hazel {\n\n\n\n\tEditorCamera::EditorCamera(float fov, float aspectRatio, float nearClip, float farClip)\n\n\t\t: m_FOV(fov), m_AspectRatio(aspectRatio), m_NearClip(nearClip), m_FarClip(farClip), Camera(glm::perspective(glm::radians(fov), aspectRatio, nearClip, farClip))\n\n\t{\n\n\t\tUpdateView();\n\n\t}\n\n\n", "file_path": "Hazel/src/Hazel/Renderer/EditorCamera.cpp", "rank": 81, "score": 4.403960516471075 }, { "content": "#include \"SceneHierarchyPanel.h\"\n\n\n\n#include <imgui/imgui.h>\n\n#include <imgui/imgui_internal.h>\n\n#include <glm/gtc/type_ptr.hpp>\n\n\n\n#include <cstring>\n\n\n\n/* The Microsoft C++ compiler is non-compliant with the C++ standard and needs\n\n * the following definition to disable a security warning on std::strncpy().\n\n */\n\n#ifdef _MSVC_LANG\n\n#define _CRT_SECURE_NO_WARNINGS\n\n#endif\n\n\n\nnamespace Hazel\n\n{\n\n\n\n\tSceneHierarchyPanel::SceneHierarchyPanel(const Ref<Scene>& scene)\n\n\t{\n", "file_path": "Hazel-Editor/src/Panels/SceneHierarchyPanel.cpp", "rank": 82, "score": 4.3954535247075155 }, { "content": "#pragma once\n\n\n\n#include \"Hazel/Events/Event.h\"\n\n#include \"Hazel/Core/Timestep.h\"\n\n\n\nnamespace Hazel\n\n{\n\n\n", "file_path": "Hazel/src/Hazel/Core/Layer.h", "rank": 83, "score": 4.383345506960088 }, { "content": "#pragma once\n\n\n\n#include \"Hazel/Core/Core.h\"\n\n#include \"Hazel/Renderer/Framebuffer.h\"\n\n\n\nnamespace Hazel\n\n{\n", "file_path": "Hazel/src/Platform/OpenGL/OpenGLFramebuffer.h", "rank": 84, "score": 4.383345506960088 }, { "content": "\t/////////////////////////////////////////////////////////////////////\n\n\tOpenGLIndexBuffer::OpenGLIndexBuffer(uint32_t* indices, uint32_t count)\n\n\t\t: m_Count(count)\n\n\t{\n\n\t\tHZ_PROFILE_FUNCTION();\n\n\n\n\t\tglCreateBuffers(1, &m_RendererID);\n\n\t\tglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_RendererID);\n\n\t\tglBufferData(GL_ELEMENT_ARRAY_BUFFER, count * sizeof(uint32_t), indices, GL_STATIC_DRAW);\n\n\t}\n\n\n\n\tOpenGLIndexBuffer::~OpenGLIndexBuffer()\n\n\t{\n\n\t\tHZ_PROFILE_FUNCTION();\n\n\n\n\t\tglDeleteBuffers(1, &m_RendererID);\n\n\t}\n\n\n\n\tvoid OpenGLIndexBuffer::Bind() const\n\n\t{\n", "file_path": "Hazel/src/Platform/OpenGL/OpenGLBuffer.cpp", "rank": 85, "score": 4.373602786482774 }, { "content": "#include \"hzpch.h\"\n\n#include \"Application.h\"\n\n\n\n#include \"Hazel/Renderer/Renderer.h\"\n\n\n\n#include <glfw/glfw3.h>\n\n\n\nnamespace Hazel\n\n{\n\n\n\n\tApplication* Application::s_Instance = nullptr;\n\n\n\n\tApplication::Application(const std::string& name/* = \"\"*/)\n\n\t{\n\n\t\tHZ_PROFILE_FUNCTION();\n\n\n\n\t\tHZ_CORE_ASSERT(!s_Instance, \"Application already exists!\");\n\n\t\ts_Instance = this;\n\n\n\n\t\tm_Window = Window::Create(WindowProps(name));\n", "file_path": "Hazel/src/Hazel/Core/Application.cpp", "rank": 86, "score": 4.371933828599548 }, { "content": "#include \"hzpch.h\"\n\n#include \"RendererCommand.h\"\n\n\n\n#include \"Platform/OpenGL/OpenGLRendererAPI.h\"\n\n\n\nnamespace Hazel\n\n{\n\n\n\n\tRendererAPI* RendererCommand::s_RendererAPI = new OpenGLRendererAPI();\n\n\n\n}", "file_path": "Hazel/src/Hazel/Renderer/RendererCommand.cpp", "rank": 87, "score": 4.354406504100932 }, { "content": "#pragma once\n\n\n\n#include \"Hazel/Renderer/OrthographicCamera.h\"\n\n#include \"Hazel/Core/Timestep.h\"\n\n\n\n#include \"Hazel/Events/ApplicationEvent.h\"\n\n#include \"Hazel/Events/MouseEvent.h\"\n\n\n\nnamespace Hazel\n\n{\n\n\tstruct OrthographicCameraBounds\n\n\t{\n\n\t\tfloat Left, Right;\n\n\t\tfloat Bottom, Top;\n\n\n\n\t\tfloat GetWidth() { return Right - Left; }\n\n\t\tfloat GetHeight() { return Top - Bottom; }\n\n\t};\n\n\n", "file_path": "Hazel/src/Hazel/Renderer/OrthographicCameraController.h", "rank": 88, "score": 4.340079823461601 }, { "content": "\n\n\tvoid EditorCamera::OnUpdate(Timestep ts)\n\n\t{\n\n\t\tif (Input::IsKeyPressed(HZ_KEY_LEFT_ALT))\n\n\t\t{\n\n\t\t\tconst glm::vec2& mouse{ Input::GetMouseX(), Input::GetMouseY() };\n\n\t\t\tglm::vec2 delta = (mouse - m_InitialMousePosition) * 0.003f;\n\n\t\t\tm_InitialMousePosition = mouse;\n\n\n\n\t\t\tif (Input::IsMouseButtonPressed(HZ_MOUSE_BUTTON_MIDDLE))\n\n\t\t\t\tMousePan(delta);\n\n\t\t\telse if (Input::IsMouseButtonPressed(HZ_MOUSE_BUTTON_LEFT))\n\n\t\t\t\tMouseRotate(delta);\n\n\t\t\telse if (Input::IsMouseButtonPressed(HZ_MOUSE_BUTTON_RIGHT))\n\n\t\t\t\tMouseZoom(delta.y);\n\n\t\t}\n\n\n\n\t\tUpdateView();\n\n\t}\n\n\n", "file_path": "Hazel/src/Hazel/Renderer/EditorCamera.cpp", "rank": 90, "score": 4.298654825466244 }, { "content": "\t\t\tbool open = ImGui::TreeNodeEx((void*)typeid(T).hash_code(), treeNodeFlags, name.c_str());\n\n\t\t\tImGui::PopStyleVar();\n\n\n\n\t\t\tbool removeComponent = false;\n\n\t\t\tif (name != \"Transform\")\n\n\t\t\t{\n\n\t\t\t\tImGui::SameLine(contentRegionAvailable.x - lineHeight * 0.5f);\n\n\t\t\t\tif (ImGui::Button(\"+\", ImVec2{ lineHeight + panding / 2, lineHeight + panding / 2 }))\n\n\t\t\t\t{\n\n\t\t\t\t\tImGui::OpenPopup(\"ComponentSettings\");\n\n\t\t\t\t}\n\n\n\n\t\t\t\tif (ImGui::BeginPopup(\"ComponentSettings\"))\n\n\t\t\t\t{\n\n\t\t\t\t\tif (ImGui::MenuItem(\"Remove Component\"))\n\n\t\t\t\t\t\tremoveComponent = true;\n\n\n\n\t\t\t\t\tImGui::EndPopup();\n\n\t\t\t\t}\n\n\t\t\t}\n", "file_path": "Hazel-Editor/src/Panels/SceneHierarchyPanel.cpp", "rank": 91, "score": 4.2336124799529475 }, { "content": "#pragma once\n\n//\n\n// Basic instrumentation profiler by Cherno\n\n\n\n// Usage: include this header file somewhere in your code (eg. precompiled header), and then use like:\n\n//\n\n// Instrumentor::Get().BeginSession(\"Session Name\"); // Begin session \n\n// {\n\n// InstrumentationTimer timer(\"Profiled Scope Name\"); // Place code like this in scopes you'd like to include in profiling\n\n// // Code\n\n// }\n\n// Instrumentor::Get().EndSession(); // End Session\n\n//\n\n// You will probably want to macro-fy this, to switch on/off easily and use things like __FUNCSIG__ for the profile name.\n\n//\n\n#pragma once\n\n\n\n#include <string>\n\n#include <chrono>\n\n#include <algorithm>\n", "file_path": "Hazel/src/Hazel/Debug/Instrumentor.h", "rank": 92, "score": 4.233029207552987 }, { "content": "\t\t// TODO: color, texid\n\n\t\tfloat TexIndex;\n\n\t\tfloat TilingFactor;\n\n\n\n\t\t// Entity-only\n\n\t\tint EntityID;\n\n\t};\n\n\n\n\tstruct Renderer2DStorage\n\n\t{\n\n\t\tstatic const uint32_t MaxQuads = 100;\n\n\t\tstatic const uint32_t MaxVertices = MaxQuads * 4;\n\n\t\tstatic const uint32_t MaxIndices = MaxQuads * 6;\n\n\t\tstatic const uint32_t MaxTextureSlots = 32; // TODO: Render Caps\n\n\n\n\t\tRef<VertexArray> QuadVertexArray;\n\n\t\tRef<VertexBuffer> QuadVertexBuffer;\n\n\t\tRef<Shader> TextureShader;\n\n\t\tRef<Texture2D> WhiteTexture;\n\n\n", "file_path": "Hazel/src/Hazel/Renderer/Renderer2D.cpp", "rank": 93, "score": 4.2262773154492805 }, { "content": "\t{\n\n\t\tRenderer2D::Shutdown();\n\n\t}\n\n\n\n\tvoid Renderer::OnWindowResize(uint32_t width, uint32_t height)\n\n\t{\n\n\t\tRendererCommand::SetViewport(0, 0, width, height);\n\n\t}\n\n\n\n\tvoid Renderer::BeginScene(OrthographicCamera& camera)\n\n\t{\n\n\t\tm_SceneData->ViewProjectionMatrix = camera.GetViewProjectionMatrix();\n\n\t}\n\n\n\n\tvoid Renderer::EndScene()\n\n\t{\n\n\n\n\t}\n\n\n\n\tvoid Renderer::Submit(const Ref<Shader>& shader, \n", "file_path": "Hazel/src/Hazel/Renderer/Renderer.cpp", "rank": 94, "score": 4.189102055479687 }, { "content": "#include \"hzpch.h\"\n\n#include \"RendererAPI.h\"\n\n\n\n\n\nnamespace Hazel\n\n{\n\n\n\n\tRendererAPI::API RendererAPI::s_API = RendererAPI::API::OpenGL;\n\n\n\n}\n", "file_path": "Hazel/src/Hazel/Renderer/RendererAPI.cpp", "rank": 95, "score": 4.1686175719320335 }, { "content": "#include \"hzpch.h\"\n\n#include \"Entity.h\"\n\n\n\n\n\n\n\nnamespace Hazel\n\n{\n\n\tEntity::Entity(entt::entity handle, Scene* scene)\n\n\t\t:m_EntityHandle(handle), m_Scene(scene)\n\n\t{\n\n\t}\n\n}", "file_path": "Hazel/src/Hazel/Scene/Entity.cpp", "rank": 96, "score": 4.1686175719320335 }, { "content": "#include \"hzpch.h\"\n\n#include \"Layer.h\"\n\n\n\nnamespace Hazel\n\n{\n\n\n\n\tLayer::Layer(const std::string& debugName)\n\n\t\t:m_DebugName(debugName)\n\n\t{\n\n\n\n\t}\n\n\n\n\tLayer::~Layer()\n\n\t{\n\n\n\n\t}\n\n\n\n}\n", "file_path": "Hazel/src/Hazel/Core/Layer.cpp", "rank": 97, "score": 4.1686175719320335 }, { "content": "#include \"hzpch.h\"", "file_path": "Hazel/src/hzpch.cpp", "rank": 98, "score": 4.102849576387479 }, { "content": "\t\tZeroMemory(&ofn, sizeof(OPENFILENAME));\n\n\t\tofn.lStructSize = sizeof(OPENFILENAME);\n\n\t\tofn.hwndOwner = glfwGetWin32Window((GLFWwindow*)Application::Get().GetWindow().GetNativeWindow());\n\n\t\tofn.lpstrFile = szFile;\n\n\t\tofn.nMaxFile = sizeof(szFile);\n\n\t\tif (GetCurrentDirectoryA(256, currentDir))\n\n\t\t\tofn.lpstrInitialDir = currentDir;\n\n\t\tofn.lpstrFilter = filter;\n\n\t\tofn.nFilterIndex = 1;\n\n\t\tofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;\n\n\n\n\t\tif (GetOpenFileNameA(&ofn) == TRUE)\n\n\t\t\treturn ofn.lpstrFile;\n\n\n\n\t\treturn std::string();\n\n\t}\n\n\n\n\tstd::string FileDialogs::SaveFile(const char* filter)\n\n\t{\n\n\t\tOPENFILENAMEA ofn;\n", "file_path": "Hazel/src/Platform/Windows/WindowsPlatformUtils.cpp", "rank": 99, "score": 4.065298272570798 } ]
C++
src/vm/vm_detect.cpp
bouldev/libbouldev
afe0d5dca71d4f9c94b11273c4884a92f2549df8
#include <libbouldev.h> #include <string> #ifdef _WIN32 #include "stdafx.h" #include <iostream> #include <Wbemidl.h> #pragma comment(lib, "wbemuuid.lib") #endif #ifdef _WIN32 static bool InitWMI(IWbemServices **pSvc, IWbemLocator **pLoc, const TCHAR* szNetworkResource) { HRESULT hres; hres = CoInitializeEx(0, COINIT_MULTITHREADED); hres = CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL); hres = CoCreateInstance(CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(pLoc)); BSTR strNetworkResource = SysAllocString(szNetworkResource); if (strNetworkResource) { hres = (*pLoc)->ConnectServer(strNetworkResource, NULL, NULL, NULL, WBEM_FLAG_CONNECT_USE_MAX_WAIT, 0, 0, pSvc); SysFreeString(strNetworkResource); } hres = CoSetProxyBlanket(*pSvc, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE); return 1; } static bool ExecWMIQuery(IWbemServices **pSvc, IWbemLocator **pLoc, IEnumWbemClassObject **pEnumerator, const TCHAR* szQuery) { BSTR strQueryLanguage = SysAllocString(OLESTR("WQL")); BSTR strQuery = SysAllocString(szQuery); BOOL bQueryResult = TRUE; if (strQueryLanguage && strQuery) HRESULT hres = (*pSvc)->ExecQuery(strQueryLanguage, strQuery, WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, pEnumerator); if (strQueryLanguage) SysFreeString(strQueryLanguage); if (strQuery) SysFreeString(strQuery); return bQueryResult; } static int wmi_query_count(const _TCHAR* query) { IWbemServices *pSvc = NULL; IWbemLocator *pLoc = NULL; IEnumWbemClassObject* pEnumerator = NULL; BOOL bStatus = FALSE; HRESULT hRes; int count = 0; bStatus = InitWMI(&pSvc, &pLoc, _T("ROOT\\CIMV2")); if (bStatus) { bStatus = ExecWMIQuery(&pSvc, &pLoc, &pEnumerator, query); if (bStatus) { IWbemClassObject *pclsObj = NULL; ULONG uReturn = 0; while (pEnumerator) { hRes = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn); if (0 == uReturn) break; count++; pclsObj->Release(); } } pSvc->Release(); pLoc->Release(); CoUninitialize(); } else return -1; return count; } #endif #ifdef linux static bool under_qemu() { char *cmdline = NULL; char *out = NULL; int ret = 0; strcpy(cmdline, "cat /proc/cpuinfo | grep QEMU &> /dev/null"); boul_cmd buf = { cmdline, ret, out }; run_cmd(buf); if (ret == 0) return true; return false; } #endif static bool under_sandbox() { if (path_exists("/.dockerenv")) return true; #ifdef linux char *cmdline = NULL; char *out = NULL; int ret = 0; strcpy(cmdline, "grep -sq 'docker|lxc' /proc/1/cgroup &> /dev/null"); boul_cmd buf = { cmdline, ret, out }; run_cmd(buf); if (ret == 0) return true; #endif return false; } bool os_is_vm() { #ifdef _WIN32 return wmi_query_count(_T("SELECT * FROM Win32_PortConnector")) == 0 ? true : false; #elif defined(linux) return (under_qemu() || under_sandbox()); #elif defined(__APPLE__) return false; #endif }
#include <libbouldev.h> #include <string> #ifdef _WIN32 #include "stdafx.h" #include <iostream> #include <Wbemidl.h> #pragma comment(lib, "wbemuuid.lib") #endif #ifdef _WIN32 static bool InitWMI(IWbemServices **pSvc, IWbemLocator **pLoc, const TCHAR* szNetworkResource) { HRESULT hres; hres = CoInitializeEx(0, COINIT_MULTITHREADED); hres = CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL); hres = CoCreateInstance(CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(pLoc)); BSTR strNetworkResource = SysAllocString(szNetworkResource); if (strNetworkResource) { hres = (*pLoc)->ConnectServer(strNetworkResource, NULL, NULL, NULL, WBEM_FLAG_CONNECT_USE_MAX_WAIT, 0, 0, pSvc); SysFreeString(strNetworkResource); } hres = CoSetProxyBlanket(*pSvc, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE); return 1; } static bool ExecWMIQuery(IWbemServices **pSvc, IWbemLocator **pLoc, IEnumWbemClassObject **pEnumerator, const TCHAR* szQuery) { BSTR strQueryLanguage = SysAllocString(OLESTR("WQL")); BSTR strQuery = SysAllo
static int wmi_query_count(const _TCHAR* query) { IWbemServices *pSvc = NULL; IWbemLocator *pLoc = NULL; IEnumWbemClassObject* pEnumerator = NULL; BOOL bStatus = FALSE; HRESULT hRes; int count = 0; bStatus = InitWMI(&pSvc, &pLoc, _T("ROOT\\CIMV2")); if (bStatus) { bStatus = ExecWMIQuery(&pSvc, &pLoc, &pEnumerator, query); if (bStatus) { IWbemClassObject *pclsObj = NULL; ULONG uReturn = 0; while (pEnumerator) { hRes = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn); if (0 == uReturn) break; count++; pclsObj->Release(); } } pSvc->Release(); pLoc->Release(); CoUninitialize(); } else return -1; return count; } #endif #ifdef linux static bool under_qemu() { char *cmdline = NULL; char *out = NULL; int ret = 0; strcpy(cmdline, "cat /proc/cpuinfo | grep QEMU &> /dev/null"); boul_cmd buf = { cmdline, ret, out }; run_cmd(buf); if (ret == 0) return true; return false; } #endif static bool under_sandbox() { if (path_exists("/.dockerenv")) return true; #ifdef linux char *cmdline = NULL; char *out = NULL; int ret = 0; strcpy(cmdline, "grep -sq 'docker|lxc' /proc/1/cgroup &> /dev/null"); boul_cmd buf = { cmdline, ret, out }; run_cmd(buf); if (ret == 0) return true; #endif return false; } bool os_is_vm() { #ifdef _WIN32 return wmi_query_count(_T("SELECT * FROM Win32_PortConnector")) == 0 ? true : false; #elif defined(linux) return (under_qemu() || under_sandbox()); #elif defined(__APPLE__) return false; #endif }
cString(szQuery); BOOL bQueryResult = TRUE; if (strQueryLanguage && strQuery) HRESULT hres = (*pSvc)->ExecQuery(strQueryLanguage, strQuery, WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, pEnumerator); if (strQueryLanguage) SysFreeString(strQueryLanguage); if (strQuery) SysFreeString(strQuery); return bQueryResult; }
function_block-function_prefixed
[ { "content": "\tchar *out; // stdout buffer\n", "file_path": "src/common/libbouldev_private.h", "rank": 6, "score": 1.5771744743371818 } ]
C++
argos3/src/plugins/robots/generic/simulator/radios_default_sensor.cpp
yiftachn/krembot_sim_fork
d3d1b050f9fff4c96bded298eadde5a9ca4dab6b
#include "radios_default_sensor.h" #include <argos3/plugins/simulator/entities/radio_equipped_entity.h> namespace argos { CRadiosDefaultSensor::CRadiosDefaultSensor() : m_pcRadioEquippedEntity(nullptr), m_pcControllableEntity(nullptr), m_bShowRays(false) {} void CRadiosDefaultSensor::SetRobot(CComposableEntity& c_entity) { try { m_pcRadioEquippedEntity = &(c_entity.GetComponent<CRadioEquippedEntity>("radios")); m_vecInterfaces.reserve(m_pcRadioEquippedEntity->GetInstances().size()); for(CRadioEquippedEntity::SInstance& s_instance : m_pcRadioEquippedEntity->GetInstances()) { m_vecInterfaces.emplace_back(s_instance.Radio.GetId()); } m_pcControllableEntity = &(c_entity.GetComponent<CControllableEntity>("controller")); } catch(CARGoSException& ex) { THROW_ARGOSEXCEPTION_NESTED("Can't set robot for the radios default sensor", ex); } Enable(); } void CRadiosDefaultSensor::Init(TConfigurationNode& t_tree) { try { CCI_RadiosSensor::Init(t_tree); GetNodeAttributeOrDefault(t_tree, "show_rays", m_bShowRays, m_bShowRays); } catch(CARGoSException& ex) { THROW_ARGOSEXCEPTION_NESTED("Error initializing the radios default sensor", ex); } } void CRadiosDefaultSensor::Update() { if (IsDisabled()) { return; } for(size_t i = 0; i < m_pcRadioEquippedEntity->GetInstances().size(); ++i) { CRadioEntity& cRadio = m_pcRadioEquippedEntity->GetRadio(i); m_vecInterfaces[i].Data.clear(); for(const std::pair<CVector3, CByteArray>& c_data : cRadio.GetData()) { m_vecInterfaces[i].Data.emplace_back(c_data.second); if(m_bShowRays) { CRay3 cRay(c_data.first, cRadio.GetPosition()); m_pcControllableEntity->GetCheckedRays().emplace_back(!c_data.second.Empty(), cRay); } } cRadio.GetData().clear(); } } void CRadiosDefaultSensor::Reset() { for(SInterface& s_interface : m_vecInterfaces) { s_interface.Data.clear(); } } REGISTER_SENSOR(CRadiosDefaultSensor, "radios", "default", "Michael Allwright [[email protected]]", "1.0", "A generic radio sensor to receive messages from nearby radios.", "This radio sensor implementation allows an arbitary number of messages\n" "containing an arbitary number of bytes to be received from nearby robots. The\n" "implementation is very basic and any concepts such as throughput, addressing,\n" "or formatting of a message's contents is beyond the scope of this sensor's\n" "implementation\n\n" "This sensor is enabled by default.\n\n" "REQUIRED XML CONFIGURATION\n\n" " <controllers>\n" " ...\n" " <my_controller ...>\n" " ...\n" " <sensors>\n" " ...\n" " <radios implementation=\"default\" medium=\"radios\" />\n" " ...\n" " </sensors>\n" " ...\n" " </my_controller>\n" " ...\n" " </controllers>\n\n" "The 'medium' attribute sets the id of the radio medium declared in the <media>\n" "XML section.\n\n" "OPTIONAL XML CONFIGURATION\n\n" "None.\n", "Usable" ); }
#include "radios_default_sensor.h" #include <argos3/plugins/simulator/entities/radio_equipped_entity.h> namespace argos { CRadiosDefaultSensor::CRadiosDefaultSensor() : m_pcRadioEquippedEntity(nullptr), m_pcControllableEntity(nullptr), m_bShowRays(false) {} void CRadiosDefaultSensor::SetRobot(CComposableEntity& c_entity) { try { m_pcRadioEquippedEntity = &(c_entity.GetComponent<CRadioEquippedEntity>("radios")); m_vecInterfaces.reserve(m_pcRadioEquippedEntity->GetInstances().size()); for(CRadioEquippedEntity::SInstance& s_instance : m_pcRadioEquippedEntity->GetInstances()) { m_vecInterfaces.emplace_back(s_instance.Radio.GetId()); } m_pcControllableEntity = &(c_entity.GetComponent<CControllableEntity>("controller")); } catch(CARGoSException& ex) { THROW_ARGOSEXCEPTION_NESTED("Can't set robot for the radios default sensor", ex); } Enable(); } void CRadiosDefaultSensor::Init(TConfigurationNode& t_tree) { try { CCI_RadiosSensor::Init(t_tree); GetNodeAttributeOrDefault(t_tree, "show_rays", m_bShowRays, m_bShowRays); } catch(CARGoSException& ex) { THROW_ARGOSEXCEPTION_NESTED("Error initializing the radios default sensor", ex); } } void CRadiosDefaultSensor::Update() { if (IsDisabled()) { return; } for(size_t i = 0; i < m_pcRadioEquippedEntity->GetInstances().size(); ++i) { CRadioEntity& cRadio = m_pcRadioEquippedEntity->GetRadio(i); m_vecInterfaces[i].Data.clear(); for(const std::pair<CVector3, CByteArray>& c_data : cRadio.GetData()) { m_vecInterfaces[i].Data.emplace_back(c_data.second); if(m_bShowRays) { CRay3 cRay(c_data.first, cRadio.GetPosition()); m_pcControllableEntity->GetCheckedRays().emplace_back(!c_data.second.Empty(), cRay); } } cRadio.GetData().clear(); } } void
REGISTER_SENSOR(CRadiosDefaultSensor, "radios", "default", "Michael Allwright [[email protected]]", "1.0", "A generic radio sensor to receive messages from nearby radios.", "This radio sensor implementation allows an arbitary number of messages\n" "containing an arbitary number of bytes to be received from nearby robots. The\n" "implementation is very basic and any concepts such as throughput, addressing,\n" "or formatting of a message's contents is beyond the scope of this sensor's\n" "implementation\n\n" "This sensor is enabled by default.\n\n" "REQUIRED XML CONFIGURATION\n\n" " <controllers>\n" " ...\n" " <my_controller ...>\n" " ...\n" " <sensors>\n" " ...\n" " <radios implementation=\"default\" medium=\"radios\" />\n" " ...\n" " </sensors>\n" " ...\n" " </my_controller>\n" " ...\n" " </controllers>\n\n" "The 'medium' attribute sets the id of the radio medium declared in the <media>\n" "XML section.\n\n" "OPTIONAL XML CONFIGURATION\n\n" "None.\n", "Usable" ); }
CRadiosDefaultSensor::Reset() { for(SInterface& s_interface : m_vecInterfaces) { s_interface.Data.clear(); } }
function_block-function_prefixed
[ { "content": " class CRadiosDefaultSensor;\n\n}\n\n\n\n#include <argos3/core/simulator/sensor.h>\n\n#include <argos3/plugins/robots/generic/control_interface/ci_radios_sensor.h>\n\n#include <argos3/plugins/simulator/entities/radio_equipped_entity.h>\n\n\n\nnamespace argos {\n\n\n", "file_path": "argos3/src/plugins/robots/generic/simulator/radios_default_sensor.h", "rank": 0, "score": 278446.62080654135 }, { "content": " class CRadiosDefaultSensor : public CSimulatedSensor,\n\n public CCI_RadiosSensor {\n\n\n\n public:\n\n\n\n CRadiosDefaultSensor();\n\n\n\n virtual ~CRadiosDefaultSensor() {}\n\n\n\n virtual void SetRobot(CComposableEntity& c_entity);\n\n\n\n virtual void Init(TConfigurationNode& t_tree);\n\n\n\n virtual void Update();\n\n\n\n virtual void Reset();\n\n\n\n /**\n\n * Returns true if the rays must be shown in the GUI.\n\n * @return true if the rays must be shown in the GUI.\n", "file_path": "argos3/src/plugins/robots/generic/simulator/radios_default_sensor.h", "rank": 1, "score": 274672.9850432067 }, { "content": "/**\n\n * @file <argos3/plugins/robots/generic/simulator/radios_default_sensor.h>\n\n *\n\n * @author Michael Allwright - <[email protected]>\n\n */\n\n\n\n#ifndef RADIOS_DEFAULT_SENSOR_H\n\n#define RADIOS_DEFAULT_SENSOR_H\n\n\n\nnamespace argos {\n", "file_path": "argos3/src/plugins/robots/generic/simulator/radios_default_sensor.h", "rank": 2, "score": 250582.74120216788 }, { "content": " */\n\n inline bool IsShowRays() {\n\n return m_bShowRays;\n\n }\n\n\n\n /**\n\n * Sets whether or not the rays must be shown in the GUI.\n\n * @param b_show_rays true if the rays must be shown, false otherwise\n\n */\n\n inline void SetShowRays(bool b_show_rays) {\n\n m_bShowRays = b_show_rays;\n\n }\n\n\n\n protected:\n\n\n\n CRadioEquippedEntity* m_pcRadioEquippedEntity;\n\n CControllableEntity* m_pcControllableEntity;\n\n bool m_bShowRays;\n\n\n\n };\n\n}\n\n\n\n#endif\n", "file_path": "argos3/src/plugins/robots/generic/simulator/radios_default_sensor.h", "rank": 3, "score": 250560.25614876655 }, { "content": " class CRadiosDefaultActuator;\n\n}\n\n\n\n#include <argos3/core/simulator/actuator.h>\n\n#include <argos3/plugins/robots/generic/control_interface/ci_radios_actuator.h>\n\n#include <argos3/plugins/simulator/entities/radio_equipped_entity.h>\n\n#include <argos3/plugins/simulator/media/radio_medium.h>\n\n\n\nnamespace argos {\n\n\n", "file_path": "argos3/src/plugins/robots/generic/simulator/radios_default_actuator.h", "rank": 11, "score": 205377.70858307905 }, { "content": "\tclass CCI_RadiosSensor;\n\n}\n\n\n\n#include <argos3/core/control_interface/ci_sensor.h>\n\n#include <argos3/core/utility/datatypes/byte_array.h>\n\n\n\nnamespace argos {\n\n \n", "file_path": "argos3/src/plugins/robots/generic/control_interface/ci_radios_sensor.h", "rank": 12, "score": 205207.6654434374 }, { "content": " class CPositioningDefaultSensor;\n", "file_path": "argos3/src/plugins/robots/generic/simulator/positioning_default_sensor.h", "rank": 13, "score": 205036.23309779592 }, { "content": " class CLightDefaultSensor;\n", "file_path": "argos3/src/plugins/robots/generic/simulator/light_default_sensor.h", "rank": 14, "score": 205036.23309779592 }, { "content": " class CCameraDefaultSensor;\n", "file_path": "argos3/src/plugins/robots/generic/simulator/camera_default_sensor.h", "rank": 15, "score": 205036.23309779592 }, { "content": " class CProximityDefaultSensor;\n", "file_path": "argos3/src/plugins/robots/generic/simulator/proximity_default_sensor.h", "rank": 16, "score": 205036.23309779592 }, { "content": " class CBatteryDefaultSensor;\n", "file_path": "argos3/src/plugins/robots/generic/simulator/battery_default_sensor.h", "rank": 17, "score": 205036.23309779592 }, { "content": " class CCI_RadiosSensor: virtual public CCI_Sensor {\n\n \n\n public:\n\n \n\n struct SInterface {\n\n SInterface(const std::string& str_id,\n\n const std::vector<CByteArray>& vec_data = {}) :\n\n Id(str_id),\n\n Data(vec_data) {}\n\n std::string Id;\n\n std::vector<CByteArray> Data;\n\n using TVector = std::vector<SInterface>;\n\n };\n\n\n\n public:\n\n \n\n /**\n\n * Constructor\n\n */\n\n CCI_RadiosSensor() {}\n", "file_path": "argos3/src/plugins/robots/generic/control_interface/ci_radios_sensor.h", "rank": 18, "score": 203901.56540705002 }, { "content": " class CBatteryDefaultSensor : public CSimulatedSensor,\n\n public CCI_BatterySensor {\n\n\n\n public:\n\n\n\n CBatteryDefaultSensor();\n\n\n\n virtual ~CBatteryDefaultSensor() {}\n\n\n\n virtual void SetRobot(CComposableEntity& c_entity);\n\n\n\n virtual void Init(TConfigurationNode& t_tree);\n\n\n\n virtual void Update();\n\n\n\n virtual void Reset();\n\n\n\n protected:\n\n\n\n /** Reference to embodied entity associated to this sensor */\n", "file_path": "argos3/src/plugins/robots/generic/simulator/battery_default_sensor.h", "rank": 19, "score": 203735.9088870675 }, { "content": " class CPositioningDefaultSensor : public CSimulatedSensor,\n\n public CCI_PositioningSensor {\n\n\n\n public:\n\n\n\n CPositioningDefaultSensor();\n\n\n\n virtual ~CPositioningDefaultSensor() {}\n\n\n\n virtual void SetRobot(CComposableEntity& c_entity);\n\n\n\n virtual void Init(TConfigurationNode& t_tree);\n\n\n\n virtual void Update();\n\n\n\n virtual void Reset();\n\n\n\n protected:\n\n\n\n /** Reference to embodied entity associated to this sensor */\n", "file_path": "argos3/src/plugins/robots/generic/simulator/positioning_default_sensor.h", "rank": 20, "score": 203735.9088870675 }, { "content": " class CProximityDefaultSensor : public CSimulatedSensor,\n\n public CCI_ProximitySensor {\n\n\n\n public:\n\n\n\n CProximityDefaultSensor();\n\n\n\n virtual ~CProximityDefaultSensor() {}\n\n\n\n virtual void SetRobot(CComposableEntity& c_entity);\n\n\n\n virtual void Init(TConfigurationNode& t_tree);\n\n\n\n virtual void Update();\n\n\n\n virtual void Reset();\n\n\n\n /**\n\n * Calculates the proximity reading when the closest occluding object is located as the given distance.\n\n * @param f_distance The distance of the closest occluding object in meters\n", "file_path": "argos3/src/plugins/robots/generic/simulator/proximity_default_sensor.h", "rank": 21, "score": 203735.9088870675 }, { "content": " class CCameraDefaultSensor : public CSimulatedSensor,\n\n public CCI_CameraSensor {\n\n\n\n public:\n\n struct SSensor {\n\n SAnchor& Anchor;\n\n CTransformationMatrix3 Offset;\n\n CRange<Real> Range;\n\n CSquareMatrix<3> ProjectionMatrix;\n\n std::vector<CCameraSensorSimulatedAlgorithm*> Algorithms;\n\n Real NearPlaneWidth, NearPlaneHeight;\n\n Real FarPlaneWidth, FarPlaneHeight;\n\n /* constructor */\n\n SSensor(SAnchor& s_anchor,\n\n const CTransformationMatrix3& c_offset,\n\n const CRange<Real>& c_range,\n\n const CSquareMatrix<3>& c_projection_matrix,\n\n const CVector2& c_resolution,\n\n const std::vector<CCameraSensorSimulatedAlgorithm*>& vec_algorithms) :\n\n Anchor(s_anchor),\n", "file_path": "argos3/src/plugins/robots/generic/simulator/camera_default_sensor.h", "rank": 22, "score": 203735.9088870675 }, { "content": " class CLightDefaultSensor : public CSimulatedSensor,\n\n public CCI_LightSensor {\n\n\n\n public:\n\n\n\n CLightDefaultSensor();\n\n\n\n virtual ~CLightDefaultSensor() {}\n\n\n\n virtual void SetRobot(CComposableEntity& c_entity);\n\n\n\n virtual void Init(TConfigurationNode& t_tree);\n\n\n\n virtual void Update();\n\n\n\n virtual void Reset();\n\n\n\n /**\n\n * Calculates the light reading resulting from a light source at the given distance.\n\n * Denoting the intensity with <em>i</em> and the distance <em>x</em>, this function calculates <em>i</em> = (<em>I</em> / <em>x<em>)^2.\n", "file_path": "argos3/src/plugins/robots/generic/simulator/light_default_sensor.h", "rank": 23, "score": 203735.9088870675 }, { "content": " class CPrototypeJointsDefaultSensor;\n\n}\n\n\n\n#include <argos3/core/simulator/sensor.h>\n\n#include <argos3/plugins/robots/prototype/control_interface/ci_prototype_joints_sensor.h>\n\n#include <argos3/plugins/robots/prototype/simulator/prototype_entity.h>\n\n#include <argos3/plugins/robots/prototype/simulator/prototype_joint_equipped_entity.h>\n\n\n\nnamespace argos {\n\n\n", "file_path": "argos3/src/plugins/robots/prototype/simulator/prototype_joints_default_sensor.h", "rank": 24, "score": 200918.8121532871 }, { "content": " class CDifferentialSteeringDefaultSensor;\n", "file_path": "argos3/src/plugins/robots/generic/simulator/differential_steering_default_sensor.h", "rank": 25, "score": 200918.8121532871 }, { "content": " class CEPuckProximityDefaultSensor;\n", "file_path": "argos3/src/plugins/robots/e-puck/simulator/epuck_proximity_default_sensor.h", "rank": 26, "score": 200918.8121532871 }, { "content": " class CPrototypeJointsDefaultSensor : public CSimulatedSensor,\n\n public CCI_PrototypeJointsSensor {\n\n\n\n public:\n\n struct SSimulatedSensor : public SSensor {\n\n SSimulatedSensor(const std::string& str_id,\n\n CPrototypeJointEntity::SSensor& s_sensor) :\n\n SSensor(str_id),\n\n Instance(s_sensor) {}\n\n CPrototypeJointEntity::SSensor& Instance;\n\n };\n\n \n\n public:\n\n CPrototypeJointsDefaultSensor();\n\n\n\n virtual ~CPrototypeJointsDefaultSensor() {}\n\n\n\n virtual void SetRobot(CComposableEntity& c_entity);\n\n\n\n virtual void Init(TConfigurationNode& t_tree);\n", "file_path": "argos3/src/plugins/robots/prototype/simulator/prototype_joints_default_sensor.h", "rank": 27, "score": 200177.59681013745 }, { "content": " class CEPuckProximityDefaultSensor : public CSimulatedSensor,\n\n public CCI_EPuckProximitySensor {\n\n\n\n public:\n\n\n\n CEPuckProximityDefaultSensor();\n\n\n\n virtual ~CEPuckProximityDefaultSensor() {}\n\n\n\n virtual void SetRobot(CComposableEntity& c_entity);\n\n\n\n virtual void Init(TConfigurationNode& t_tree);\n\n\n\n virtual void Update();\n\n\n\n virtual void Reset();\n\n\n\n /**\n\n * Calculates the proximity reading when the closest occluding object is located as the given distance.\n\n * @param f_distance The distance of the closest occluding object in meters\n", "file_path": "argos3/src/plugins/robots/e-puck/simulator/epuck_proximity_default_sensor.h", "rank": 28, "score": 200177.59681013745 }, { "content": " class CDifferentialSteeringDefaultSensor : public CSimulatedSensor,\n\n public CCI_DifferentialSteeringSensor {\n\n\n\n public:\n\n\n\n CDifferentialSteeringDefaultSensor();\n\n\n\n virtual ~CDifferentialSteeringDefaultSensor() {}\n\n\n\n virtual void SetRobot(CComposableEntity& c_entity);\n\n\n\n virtual void Init(TConfigurationNode& t_tree);\n\n\n\n virtual void Update();\n\n\n\n virtual void Reset();\n\n\n\n protected:\n\n\n\n /** Reference to wheeled entity associated to this sensor */\n", "file_path": "argos3/src/plugins/robots/generic/simulator/differential_steering_default_sensor.h", "rank": 29, "score": 200177.59681013745 }, { "content": " class CRadiosDefaultActuator : public CSimulatedActuator,\n\n public CCI_RadiosActuator {\n\n\n\n public:\n\n\n\n CRadiosDefaultActuator();\n\n\n\n virtual ~CRadiosDefaultActuator() {}\n\n\n\n virtual void SetRobot(CComposableEntity& c_entity);\n\n\n\n virtual void Init(TConfigurationNode& t_tree);\n\n\n\n virtual void Update();\n\n\n\n virtual void Reset();\n\n\n\n private:\n\n\n\n CRadioEquippedEntity* m_pcRadioEquippedEntity;\n\n\n", "file_path": "argos3/src/plugins/robots/generic/simulator/radios_default_actuator.h", "rank": 30, "score": 197301.7967841988 }, { "content": " class CFootBotProximityDefaultSensor;\n\n}\n\n\n\n#include <argos3/plugins/robots/foot-bot/control_interface/ci_footbot_proximity_sensor.h>\n\n#include <argos3/plugins/robots/generic/simulator/proximity_default_sensor.h>\n\n\n\nnamespace argos {\n\n\n", "file_path": "argos3/src/plugins/robots/foot-bot/simulator/footbot_proximity_default_sensor.h", "rank": 31, "score": 196971.82614569613 }, { "content": " class CEyeBotProximityDefaultSensor;\n\n}\n\n\n\n#include <argos3/plugins/robots/eye-bot/control_interface/ci_eyebot_proximity_sensor.h>\n\n#include <argos3/plugins/robots/generic/simulator/proximity_default_sensor.h>\n\n\n\nnamespace argos {\n\n\n", "file_path": "argos3/src/plugins/robots/eye-bot/simulator/eyebot_proximity_default_sensor.h", "rank": 32, "score": 196971.82614569613 }, { "content": " class CProximitySensorImpl : public CProximityDefaultSensor {\n\n\n\n public:\n\n\n\n virtual Real CalculateReading(Real f_distance) {\n\n if(f_distance < 0.009889556) {\n\n return 1.0;\n\n }\n\n else {\n\n return 0.0100527 / (f_distance + 0.000163144);\n\n }\n\n }\n\n\n\n };\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n CEyeBotProximityDefaultSensor::CEyeBotProximityDefaultSensor() :\n\n m_pcProximityImpl(new CProximitySensorImpl()) {}\n", "file_path": "argos3/src/plugins/robots/eye-bot/simulator/eyebot_proximity_default_sensor.cpp", "rank": 33, "score": 196753.33581463736 }, { "content": " class CProximitySensorImpl : public CProximityDefaultSensor {\n\n\n\n public:\n\n\n\n virtual Real CalculateReading(Real f_distance) {\n\n return f_distance;\n\n }\n\n\n\n };\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n CFootBotProximityDefaultSensor::CFootBotProximityDefaultSensor() :\n\n m_pcProximityImpl(new CProximitySensorImpl()) {}\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n CFootBotProximityDefaultSensor::~CFootBotProximityDefaultSensor() {\n", "file_path": "argos3/src/plugins/robots/foot-bot/simulator/footbot_proximity_default_sensor.cpp", "rank": 34, "score": 196753.33581463736 }, { "content": " class CFootBotProximityDefaultSensor : public CCI_FootBotProximitySensor,\n\n public CSimulatedSensor {\n\n\n\n public:\n\n\n\n CFootBotProximityDefaultSensor();\n\n\n\n virtual ~CFootBotProximityDefaultSensor();\n\n\n\n virtual void SetRobot(CComposableEntity& c_entity);\n\n\n\n virtual void Init(TConfigurationNode& t_tree);\n\n\n\n virtual void Update();\n\n\n\n virtual void Reset();\n\n\n\n private:\n\n\n\n CProximityDefaultSensor* m_pcProximityImpl;\n\n\n\n };\n\n\n\n}\n\n\n\n#endif\n", "file_path": "argos3/src/plugins/robots/foot-bot/simulator/footbot_proximity_default_sensor.h", "rank": 35, "score": 193455.053094409 }, { "content": " class CEyeBotProximityDefaultSensor : public CCI_EyeBotProximitySensor,\n\n public CSimulatedSensor {\n\n\n\n public:\n\n\n\n CEyeBotProximityDefaultSensor();\n\n\n\n virtual ~CEyeBotProximityDefaultSensor();\n\n\n\n virtual void SetRobot(CComposableEntity& c_entity);\n\n\n\n virtual void Init(TConfigurationNode& t_tree);\n\n\n\n virtual void Update();\n\n\n\n virtual void Reset();\n\n\n\n private:\n\n\n\n CProximityDefaultSensor* m_pcProximityImpl;\n\n\n\n };\n\n\n\n}\n\n\n\n#endif\n", "file_path": "argos3/src/plugins/robots/eye-bot/simulator/eyebot_proximity_default_sensor.h", "rank": 36, "score": 193455.053094409 }, { "content": " class CFootBotTurretEncoderDefaultSensor;\n\n}\n\n\n\n#include <argos3/plugins/robots/foot-bot/control_interface/ci_footbot_turret_encoder_sensor.h>\n\n#include <argos3/plugins/robots/foot-bot/simulator/footbot_turret_encoder_default_sensor.h>\n\n#include <argos3/plugins/robots/foot-bot/simulator/footbot_turret_entity.h>\n\n#include <argos3/core/simulator/sensor.h>\n\n\n\nnamespace argos {\n\n\n", "file_path": "argos3/src/plugins/robots/foot-bot/simulator/footbot_turret_encoder_default_sensor.h", "rank": 37, "score": 193184.37208821767 }, { "content": " class CColoredBlobPerspectiveCameraDefaultSensor;\n", "file_path": "argos3/src/plugins/robots/generic/simulator/colored_blob_perspective_camera_default_sensor.h", "rank": 38, "score": 193184.37208821767 }, { "content": " class CLightSensorEquippedEntity;\n\n}\n\n\n\n#include <argos3/plugins/robots/generic/control_interface/ci_light_sensor.h>\n\n#include <argos3/core/utility/math/range.h>\n\n#include <argos3/core/utility/math/rng.h>\n\n#include <argos3/core/simulator/space/space.h>\n\n#include <argos3/core/simulator/sensor.h>\n\n\n\nnamespace argos {\n\n\n", "file_path": "argos3/src/plugins/robots/generic/simulator/light_default_sensor.h", "rank": 39, "score": 188754.4947490895 }, { "content": " class CProximitySensorEquippedEntity;\n\n}\n\n\n\n#include <argos3/plugins/robots/generic/control_interface/ci_proximity_sensor.h>\n\n#include <argos3/core/utility/math/range.h>\n\n#include <argos3/core/utility/math/rng.h>\n\n#include <argos3/core/simulator/space/space.h>\n\n#include <argos3/core/simulator/sensor.h>\n\n\n\nnamespace argos {\n\n\n", "file_path": "argos3/src/plugins/robots/generic/simulator/proximity_default_sensor.h", "rank": 40, "score": 188754.4947490895 }, { "content": " class CFootBotTurretEncoderDefaultSensor : public CCI_FootBotTurretEncoderSensor,\n\n public CSimulatedSensor {\n\n\n\n public:\n\n\n\n CFootBotTurretEncoderDefaultSensor();\n\n\n\n virtual ~CFootBotTurretEncoderDefaultSensor() {}\n\n\n\n virtual void SetRobot(CComposableEntity& c_entity);\n\n\n\n virtual void Update();\n\n\n\n virtual void Reset();\n\n\n\n virtual void Enable();\n\n\n\n virtual void Disable();\n\n\n\n private:\n\n\n\n CFootBotTurretEntity* m_pcTurretEntity;\n\n\n\n };\n\n\n\n}\n\n\n\n#endif\n", "file_path": "argos3/src/plugins/robots/foot-bot/simulator/footbot_turret_encoder_default_sensor.h", "rank": 41, "score": 188727.82842349893 }, { "content": " class CColoredBlobPerspectiveCameraDefaultSensor : public CCI_ColoredBlobPerspectiveCameraSensor,\n\n public CSimulatedSensor {\n\n\n\n public:\n\n\n\n CColoredBlobPerspectiveCameraDefaultSensor();\n\n\n\n virtual ~CColoredBlobPerspectiveCameraDefaultSensor();\n\n\n\n virtual void SetRobot(CComposableEntity& c_entity);\n\n\n\n virtual void Init(TConfigurationNode& t_tree);\n\n\n\n virtual void Update();\n\n\n\n virtual void Reset();\n\n\n\n virtual void Destroy();\n\n\n\n virtual void Enable();\n", "file_path": "argos3/src/plugins/robots/generic/simulator/colored_blob_perspective_camera_default_sensor.h", "rank": 42, "score": 188727.82842349893 }, { "content": "/*\n\n * @file <argos3/plugins/robots/generic/simulator/radios_default_actuator.h>\n\n *\n\n * @author Michael Allwright - <[email protected]>\n\n */\n\n\n\n#ifndef RADIOS_DEFAULT_ACTUATOR_H\n\n#define RADIOS_DEFAULT_ACTUATOR_H\n\n\n\nnamespace argos {\n", "file_path": "argos3/src/plugins/robots/generic/simulator/radios_default_actuator.h", "rank": 43, "score": 187952.79684239408 }, { "content": "/**\n\n * @file <argos3/plugins/simulator/sensors/positioning_default_sensor.h>\n\n *\n\n * @author Carlo Pinciroli - <[email protected]>\n\n */\n\n\n\n#ifndef POSITIONING_DEFAULT_SENSOR_H\n\n#define POSITIONING_DEFAULT_SENSOR_H\n\n\n\n#include <string>\n\n#include <map>\n\n\n\nnamespace argos {\n", "file_path": "argos3/src/plugins/robots/generic/simulator/positioning_default_sensor.h", "rank": 44, "score": 187661.29029730335 }, { "content": "/**\n\n * @file <argos3/plugins/simulator/sensors/light_default_sensor.h>\n\n *\n\n * @author Carlo Pinciroli - <[email protected]>\n\n */\n\n\n\n#ifndef LIGHT_DEFAULT_SENSOR_H\n\n#define LIGHT_DEFAULT_SENSOR_H\n\n\n\n#include <string>\n\n#include <map>\n\n\n\nnamespace argos {\n", "file_path": "argos3/src/plugins/robots/generic/simulator/light_default_sensor.h", "rank": 45, "score": 187661.29029730335 }, { "content": "/**\n\n * @file <argos3/plugins/simulator/sensors/battery_default_sensor.h>\n\n *\n\n * @author Adhavan Jayabalan <[email protected]>\n\n */\n\n\n\n#ifndef BATTERY_DEFAULT_SENSOR_H\n\n#define BATTERY_DEFAULT_SENSOR_H\n\n\n\n#include <string>\n\n#include <map>\n\n\n\nnamespace argos {\n", "file_path": "argos3/src/plugins/robots/generic/simulator/battery_default_sensor.h", "rank": 46, "score": 187661.29029730335 }, { "content": "/**\n\n * @file <argos3/plugins/simulator/sensors/proximity_default_sensor.h>\n\n *\n\n * @author Carlo Pinciroli - <[email protected]>\n\n */\n\n\n\n#ifndef PROXIMITY_DEFAULT_SENSOR_H\n\n#define PROXIMITY_DEFAULT_SENSOR_H\n\n\n\n#include <string>\n\n#include <map>\n\n\n\nnamespace argos {\n", "file_path": "argos3/src/plugins/robots/generic/simulator/proximity_default_sensor.h", "rank": 47, "score": 187661.29029730335 }, { "content": "/**\n\n * @file <argos3/plugins/robots/generic/simulator/camera_default_sensor.h>\n\n *\n\n * @author Michael Allwright - <[email protected]>\n\n */\n\n\n\n#ifndef CAMERAS_DEFAULT_SENSOR_H\n\n#define CAMERAS_DEFAULT_SENSOR_H\n\n\n\nnamespace argos {\n", "file_path": "argos3/src/plugins/robots/generic/simulator/camera_default_sensor.h", "rank": 48, "score": 187660.09753407145 }, { "content": " Offset(c_offset),\n\n Range(c_range),\n\n ProjectionMatrix(c_projection_matrix),\n\n Algorithms(vec_algorithms) {\n\n Real fWidthToDepthRatio = (0.5 * c_resolution.GetX()) / c_projection_matrix(0,0);\n\n Real fHeightToDepthRatio = (0.5 * c_resolution.GetY()) / c_projection_matrix(1,1);\n\n NearPlaneHeight = fHeightToDepthRatio * c_range.GetMin();\n\n NearPlaneWidth = fWidthToDepthRatio * c_range.GetMin();\n\n FarPlaneHeight = fHeightToDepthRatio * c_range.GetMax();\n\n FarPlaneWidth = fWidthToDepthRatio * c_range.GetMax();\n\n }\n\n };\n\n\n\n public:\n\n\n\n CCameraDefaultSensor();\n\n\n\n virtual ~CCameraDefaultSensor() {}\n\n\n\n virtual void SetRobot(CComposableEntity& c_entity);\n", "file_path": "argos3/src/plugins/robots/generic/simulator/camera_default_sensor.h", "rank": 49, "score": 187650.03955336683 }, { "content": " * @returns A value in the range [0:1], where 0 means that the object is too far to be sensed, and 1 means the object is so close that it saturates the sensor.\n\n */\n\n virtual Real CalculateReading(Real f_distance);\n\n\n\n /**\n\n * Returns true if the rays must be shown in the GUI.\n\n * @return true if the rays must be shown in the GUI.\n\n */\n\n inline bool IsShowRays() {\n\n return m_bShowRays;\n\n }\n\n\n\n /**\n\n * Sets whether or not the rays must be shown in the GUI.\n\n * @param b_show_rays true if the rays must be shown, false otherwise\n\n */\n\n inline void SetShowRays(bool b_show_rays) {\n\n m_bShowRays = b_show_rays;\n\n }\n\n\n", "file_path": "argos3/src/plugins/robots/generic/simulator/proximity_default_sensor.h", "rank": 50, "score": 187647.01803251563 }, { "content": " inline void SetShowRays(bool b_show_rays) {\n\n m_bShowRays = b_show_rays;\n\n }\n\n\n\n protected:\n\n\n\n /** Reference to light sensor equipped entity associated to this sensor */\n\n CLightSensorEquippedEntity* m_pcLightEntity;\n\n\n\n /** Reference to controllable entity associated to this sensor */\n\n CControllableEntity* m_pcControllableEntity;\n\n\n\n /** Flag to show rays in the simulator */\n\n bool m_bShowRays;\n\n\n\n /** Random number generator */\n\n CRandom::CRNG* m_pcRNG;\n\n\n\n /** Whether to add noise or not */\n\n bool m_bAddNoise;\n", "file_path": "argos3/src/plugins/robots/generic/simulator/light_default_sensor.h", "rank": 51, "score": 187644.1439066438 }, { "content": "\n\n virtual void Init(TConfigurationNode& t_tree);\n\n\n\n virtual void Update();\n\n\n\n protected:\n\n bool m_bShowFrustum;\n\n CEmbodiedEntity* m_pcEmbodiedEntity;\n\n CControllableEntity* m_pcControllableEntity;\n\n std::vector<SSensor> m_vecSensors;\n\n };\n\n}\n\n\n\n#endif\n", "file_path": "argos3/src/plugins/robots/generic/simulator/camera_default_sensor.h", "rank": 52, "score": 187641.93726317337 }, { "content": " * <em>I</em> is the reference intensity of the light, that is, the distance at which the light reading saturates.\n\n * It is dependent on the light entity being considered.\n\n * @param f_distance The distance of the considered light source.\n\n * @param f_intensity The reference intensity of the considered light source.\n\n * @returns A value in the range [0:1], where 0 means that the light is too far to be sensed, and 1 means the light is so close that it saturates the sensor.\n\n */\n\n virtual Real CalculateReading(Real f_distance, Real f_intensity);\n\n\n\n /**\n\n * Returns true if the rays must be shown in the GUI.\n\n * @return true if the rays must be shown in the GUI.\n\n */\n\n inline bool IsShowRays() {\n\n return m_bShowRays;\n\n }\n\n\n\n /**\n\n * Sets whether or not the rays must be shown in the GUI.\n\n * @param b_show_rays true if the rays must be shown, false otherwise\n\n */\n", "file_path": "argos3/src/plugins/robots/generic/simulator/light_default_sensor.h", "rank": 53, "score": 187639.9809619003 }, { "content": " protected:\n\n\n\n /** Reference to embodied entity associated to this sensor */\n\n CEmbodiedEntity* m_pcEmbodiedEntity;\n\n\n\n /** Reference to proximity sensor equipped entity associated to this sensor */\n\n CProximitySensorEquippedEntity* m_pcProximityEntity;\n\n\n\n /** Reference to controllable entity associated to this sensor */\n\n CControllableEntity* m_pcControllableEntity;\n\n\n\n /** Flag to show rays in the simulator */\n\n bool m_bShowRays;\n\n\n\n /** Random number generator */\n\n CRandom::CRNG* m_pcRNG;\n\n\n\n /** Whether to add noise or not */\n\n bool m_bAddNoise;\n\n\n", "file_path": "argos3/src/plugins/robots/generic/simulator/proximity_default_sensor.h", "rank": 54, "score": 187636.26174529057 }, { "content": " CEmbodiedEntity* m_pcEmbodiedEntity;\n\n\n\n /** Reference to battery sensor equipped entity associated to this sensor */\n\n CBatteryEquippedEntity* m_pcBatteryEntity;\n\n\n\n /** Random number generator */\n\n CRandom::CRNG* m_pcRNG;\n\n\n\n /** Whether to add noise or not */\n\n bool m_bAddNoise;\n\n\n\n /** Noise range on battery level */\n\n CRange<Real> m_cNoiseRange;\n\n };\n\n\n\n}\n\n\n\n#endif\n", "file_path": "argos3/src/plugins/robots/generic/simulator/battery_default_sensor.h", "rank": 55, "score": 187635.04119265653 }, { "content": " /** Noise range */\n\n CRange<Real> m_cNoiseRange;\n\n\n\n /** Reference to the space */\n\n CSpace& m_cSpace;\n\n };\n\n\n\n}\n\n\n\n#endif\n", "file_path": "argos3/src/plugins/robots/generic/simulator/proximity_default_sensor.h", "rank": 56, "score": 187628.74022750737 }, { "content": "\n\n /** Noise range */\n\n CRange<Real> m_cNoiseRange;\n\n\n\n /** Reference to the space */\n\n CSpace& m_cSpace;\n\n };\n\n\n\n}\n\n\n\n#endif\n", "file_path": "argos3/src/plugins/robots/generic/simulator/light_default_sensor.h", "rank": 57, "score": 187628.74022750737 }, { "content": " CEmbodiedEntity* m_pcEmbodiedEntity;\n\n\n\n /** Random number generator */\n\n CRandom::CRNG* m_pcRNG;\n\n\n\n /** Whether to add noise or not */\n\n bool m_bAddNoise;\n\n\n\n /** Noise range on position */\n\n CRange<Real> m_cPosNoiseRange;\n\n\n\n /** Noise range on angle */\n\n CRange<CRadians> m_cAngleNoiseRange;\n\n\n\n /** Noise range on axis */\n\n CRange<Real> m_cAxisNoiseRange;\n\n };\n\n\n\n}\n\n\n\n#endif\n", "file_path": "argos3/src/plugins/robots/generic/simulator/positioning_default_sensor.h", "rank": 58, "score": 187628.74022750737 }, { "content": " class CProximitySensorEquippedEntity;\n\n}\n\n\n\n#include <argos3/plugins/robots/e-puck/control_interface/ci_epuck_proximity_sensor.h>\n\n#include <argos3/core/utility/math/range.h>\n\n#include <argos3/core/utility/math/rng.h>\n\n#include <argos3/core/simulator/space/space.h>\n\n#include <argos3/core/simulator/sensor.h>\n\n\n\nnamespace argos {\n\n\n", "file_path": "argos3/src/plugins/robots/e-puck/simulator/epuck_proximity_default_sensor.h", "rank": 59, "score": 186539.0157425024 }, { "content": "/**\n\n * @file <argos3/plugins/robots/generic/simulator/radios_default_actuator.cpp>\n\n *\n\n * @author Michael Allwright - <[email protected]>\n\n */\n\n\n\n#include \"radios_default_actuator.h\"\n\n#include <argos3/plugins/simulator/media/radio_medium.h>\n\n#include <argos3/plugins/simulator/entities/radio_equipped_entity.h>\n\n\n\nnamespace argos {\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n CRadiosDefaultActuator::CRadiosDefaultActuator() :\n\n m_pcRadioEquippedEntity(nullptr) {\n\n }\n\n\n\n /****************************************/\n", "file_path": "argos3/src/plugins/robots/generic/simulator/radios_default_actuator.cpp", "rank": 60, "score": 185190.91596976135 }, { "content": " /****************************************/\n\n\n\n void CRadiosDefaultActuator::SetRobot(CComposableEntity& c_entity) {\n\n try {\n\n /* Get and enable omndirectional radio equipped entity */\n\n m_pcRadioEquippedEntity = &(c_entity.GetComponent<CRadioEquippedEntity>(\"radios\"));\n\n /* Create a configuration settings for each radio in the container */\n\n m_vecInterfaces.reserve(m_pcRadioEquippedEntity->GetInstances().size());\n\n /* Populate the descriptors */\n\n for(CRadioEquippedEntity::SInstance& s_instance : m_pcRadioEquippedEntity->GetInstances()) {\n\n m_vecInterfaces.emplace_back(s_instance.Radio.GetId());\n\n }\n\n }\n\n catch(CARGoSException& ex) {\n\n THROW_ARGOSEXCEPTION_NESTED(\"Can't set robot for the radios default actuator\", ex);\n\n }\n\n }\n\n\n\n /****************************************/\n\n /****************************************/\n", "file_path": "argos3/src/plugins/robots/generic/simulator/radios_default_actuator.cpp", "rank": 61, "score": 185190.6546351586 }, { "content": "\n\n void CRadiosDefaultActuator::Init(TConfigurationNode& t_tree) {\n\n try {\n\n /* Parent class init */\n\n CCI_RadiosActuator::Init(t_tree);\n\n }\n\n catch(CARGoSException& ex) {\n\n THROW_ARGOSEXCEPTION_NESTED(\"Error initializing the radios default actuator\", ex);\n\n }\n\n }\n\n \n\n /****************************************/\n\n /****************************************/\n\n\n\n void CRadiosDefaultActuator::Update() {\n\n for(size_t i = 0; i < m_vecInterfaces.size(); ++i) {\n\n CRadioEntity& cRadio = m_pcRadioEquippedEntity->GetRadio(i);\n\n /* Create operation instance */\n\n CTxOperation cTxOperation(cRadio, m_vecInterfaces[i].Data);\n\n /* Calculate the range of the transmitting radio */\n", "file_path": "argos3/src/plugins/robots/generic/simulator/radios_default_actuator.cpp", "rank": 62, "score": 185184.00587519378 }, { "content": " CVector3 cTxRange(1.0f,1.0f,1.0f);\n\n cTxRange *= (cRadio.GetRange() * 0.5f);\n\n /* Get positional index */\n\n CPositionalIndex<CRadioEntity>* pcRadioIndex =\n\n &(cRadio.GetMedium().GetIndex());\n\n /* Transmit the data to receiving radios in the space */\n\n pcRadioIndex->ForEntitiesInBoxRange(cRadio.GetPosition(), cTxRange, cTxOperation);\n\n /* Flush data from the control interface */\n\n m_vecInterfaces[i].Data.clear();\n\n }\n\n }\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n void CRadiosDefaultActuator::Reset() {\n\n for(SInterface& s_interface : m_vecInterfaces) {\n\n /* Clear any data in the interface */\n\n s_interface.Data.clear();\n\n }\n", "file_path": "argos3/src/plugins/robots/generic/simulator/radios_default_actuator.cpp", "rank": 63, "score": 185170.97555969114 }, { "content": " }\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n CRadiosDefaultActuator::CTxOperation::CTxOperation(const CRadioEntity& c_tx_radio,\n\n const std::vector<CByteArray>& c_tx_data) :\n\n m_cTxRadio(c_tx_radio),\n\n m_cTxData(c_tx_data) {}\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n bool CRadiosDefaultActuator::CTxOperation::operator()(CRadioEntity& c_rx_radio) {\n\n if(&c_rx_radio != &m_cTxRadio) {\n\n const CVector3& cRxRadioPosition = c_rx_radio.GetPosition();\n\n const CVector3& cTxRadioPosition = m_cTxRadio.GetPosition();\n\n Real fDistance = (cRxRadioPosition - cTxRadioPosition).Length();\n\n if(fDistance < m_cTxRadio.GetRange()) {\n\n for(const CByteArray& c_data : m_cTxData) {\n", "file_path": "argos3/src/plugins/robots/generic/simulator/radios_default_actuator.cpp", "rank": 64, "score": 185168.7493238804 }, { "content": " \"scope of this actuator's implementation.\\n\\n\"\n\n\n\n \"REQUIRED XML CONFIGURATION\\n\\n\"\n\n \" <controllers>\\n\"\n\n \" ...\\n\"\n\n \" <my_controller ...>\\n\"\n\n \" ...\\n\"\n\n \" <actuators>\\n\"\n\n \" ...\\n\"\n\n \" <radios implementation=\\\"default\\\" medium=\\\"radios\\\" />\\n\"\n\n \" ...\\n\"\n\n \" </actuators>\\n\"\n\n \" ...\\n\"\n\n \" </my_controller>\\n\"\n\n \" ...\\n\"\n\n \" </controllers>\\n\\n\"\n\n\n\n \"The 'medium' attribute sets the id of the radio medium declared in the <media>\\n\"\n\n \"XML section.\\n\\n\"\n\n\n", "file_path": "argos3/src/plugins/robots/generic/simulator/radios_default_actuator.cpp", "rank": 65, "score": 185167.91588825843 }, { "content": " c_rx_radio.ReceiveData(cTxRadioPosition, c_data);\n\n }\n\n }\n\n }\n\n return true;\n\n }\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n REGISTER_ACTUATOR(CRadiosDefaultActuator,\n\n \"radios\", \"default\",\n\n \"Michael Allwright [[email protected]]\",\n\n \"1.0\",\n\n\n\n \"A generic radio actuator to send messages to nearby radios.\",\n\n \"This radio actuator implementation allows an arbitary number of messages\\n\"\n\n \"containing an arbitary number of bytes to be sent to nearby radios. The\\n\" \n\n \"implementation of this actuator is very basic and any concepts such as\\n\"\n\n \"throughput, addressing, or formatting of a message's contents is beyond the\\n\"\n", "file_path": "argos3/src/plugins/robots/generic/simulator/radios_default_actuator.cpp", "rank": 66, "score": 185167.6820929863 }, { "content": " \"OPTIONAL XML CONFIGURATION\\n\\n\"\n\n\n\n \"None.\\n\",\n\n\n\n \"Usable\"\n\n );\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n}\n", "file_path": "argos3/src/plugins/robots/generic/simulator/radios_default_actuator.cpp", "rank": 67, "score": 185155.03807126769 }, { "content": "/**\n\n * @file <argos3/plugins/robots/generic/control_interface/ci_radios_sensor.cpp>\n\n *\n\n * @author Michael Allwright - <[email protected]>\n\n */\n\n\n\n#ifndef CI_RADIOS_SENSOR_H\n\n#define CI_RADIOS_SENSOR_H\n\n\n\nnamespace argos {\n", "file_path": "argos3/src/plugins/robots/generic/control_interface/ci_radios_sensor.h", "rank": 68, "score": 185042.4388109653 }, { "content": " \n\n /**\n\n * Destructor\n\n */\n\n virtual ~CCI_RadiosSensor() {}\n\n \n\n public:\n\n\n\n /**\n\n * Returns a const reference to the radio interfaces.\n\n * @return A const reference to the radio interfaces.\n\n */\n\n const SInterface::TVector& GetInterfaces() const;\n\n \n\n#ifdef ARGOS_WITH_LUA\n\n virtual void CreateLuaState(lua_State* pt_lua_state);\n\n \n\n virtual void ReadingsToLuaState(lua_State* pt_lua_state);\n\n#endif\n\n\n", "file_path": "argos3/src/plugins/robots/generic/control_interface/ci_radios_sensor.h", "rank": 69, "score": 185039.6295696094 }, { "content": " protected:\n\n \n\n SInterface::TVector m_vecInterfaces;\n\n \n\n };\n\n \n\n}\n\n\n\n#endif\n", "file_path": "argos3/src/plugins/robots/generic/control_interface/ci_radios_sensor.h", "rank": 70, "score": 185011.45088734615 }, { "content": " m_cNoiseRange.Set(-fNoiseLevel, fNoiseLevel);\n\n m_pcRNG = CRandom::CreateRNG(\"argos\");\n\n }\n\n m_tReadings.resize(m_pcLightEntity->GetNumSensors());\n\n }\n\n catch(CARGoSException& ex) {\n\n THROW_ARGOSEXCEPTION_NESTED(\"Initialization error in default light sensor\", ex);\n\n }\n\n /* sensor is enabled by default */\n\n Enable();\n\n }\n\n\n\n /****************************************/\n\n /****************************************/\n\n \n\n void CLightDefaultSensor::Update() {\n\n /* sensor is disabled--nothing to do */\n\n if (IsDisabled()) {\n\n return;\n\n }\n", "file_path": "argos3/src/plugins/robots/generic/simulator/light_default_sensor.cpp", "rank": 71, "score": 184908.9363847223 }, { "content": " m_bAddNoise = true;\n\n m_cNoiseRange.Set(-fNoiseLevel, fNoiseLevel);\n\n m_pcRNG = CRandom::CreateRNG(\"argos\");\n\n }\n\n m_tReadings.resize(m_pcProximityEntity->GetNumSensors());\n\n }\n\n catch(CARGoSException& ex) {\n\n THROW_ARGOSEXCEPTION_NESTED(\"Initialization error in default proximity sensor\", ex);\n\n }\n\n /* This sensor is enabled by default */\n\n Enable();\n\n }\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n void CProximityDefaultSensor::Update() {\n\n /* sensor is disabled--nothing to do */\n\n if (IsDisabled()) {\n\n return;\n", "file_path": "argos3/src/plugins/robots/generic/simulator/proximity_default_sensor.cpp", "rank": 72, "score": 184908.21958755923 }, { "content": " /****************************************/\n\n /****************************************/\n\n\n\n CBatteryDefaultSensor::CBatteryDefaultSensor() :\n\n m_pcEmbodiedEntity(nullptr),\n\n m_pcBatteryEntity(nullptr),\n\n m_pcRNG(nullptr),\n\n m_bAddNoise(false) {}\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n void CBatteryDefaultSensor::SetRobot(CComposableEntity& c_entity) {\n\n try {\n\n m_pcEmbodiedEntity = &(c_entity.GetComponent<CEmbodiedEntity>(\"body\"));\n\n m_pcBatteryEntity = &(c_entity.GetComponent<CBatteryEquippedEntity>(\"battery\"));\n\n m_pcBatteryEntity->Enable();\n\n }\n\n catch(CARGoSException& ex) {\n\n THROW_ARGOSEXCEPTION_NESTED(\"Can't set robot for the battery default sensor\", ex);\n", "file_path": "argos3/src/plugins/robots/generic/simulator/battery_default_sensor.cpp", "rank": 73, "score": 184903.8256227054 }, { "content": "/**\n\n * @file <argos3/plugins/robots/generic/simulator/camera_default_sensor.cpp>\n\n *\n\n * @author Michael Allwright - <[email protected]>\n\n */\n\n\n\n#include \"camera_default_sensor.h\"\n\n#include <argos3/core/simulator/simulator.h>\n\n#include <argos3/core/simulator/entity/composable_entity.h>\n\n#include <argos3/plugins/robots/generic/simulator/camera_sensor_algorithm.h>\n\n\n\nnamespace argos {\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n CCameraDefaultSensor::CCameraDefaultSensor() :\n\n m_bShowFrustum(false),\n\n m_pcEmbodiedEntity(nullptr),\n\n m_pcControllableEntity(nullptr) {}\n", "file_path": "argos3/src/plugins/robots/generic/simulator/camera_default_sensor.cpp", "rank": 74, "score": 184902.3572131068 }, { "content": " GetNodeAttributeOrDefault(t_tree, \"axis_noise_range\", m_cAxisNoiseRange, m_cAxisNoiseRange);\n\n if(m_cPosNoiseRange.GetSpan() != 0 ||\n\n m_cAngleNoiseRange.GetSpan() != CRadians::ZERO ||\n\n m_cAxisNoiseRange.GetSpan() != 0) {\n\n m_bAddNoise = true;\n\n m_pcRNG = CRandom::CreateRNG(\"argos\");\n\n }\n\n /* sensor is enabled by default */\n\n Enable();\n\n }\n\n catch(CARGoSException& ex) {\n\n THROW_ARGOSEXCEPTION_NESTED(\"Initialization error in default positioning sensor\", ex);\n\n }\n\n }\n\n\n\n /****************************************/\n\n /****************************************/\n\n \n\n void CPositioningDefaultSensor::Update() {\n\n /* sensor is disabled--nothing to do */\n", "file_path": "argos3/src/plugins/robots/generic/simulator/positioning_default_sensor.cpp", "rank": 75, "score": 184902.15375475987 }, { "content": "\n\n /****************************************/\n\n /****************************************/\n\n\n\n CLightDefaultSensor::CLightDefaultSensor() :\n\n m_bShowRays(false),\n\n m_pcRNG(nullptr),\n\n m_bAddNoise(false),\n\n m_cSpace(CSimulator::GetInstance().GetSpace()) {}\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n void CLightDefaultSensor::SetRobot(CComposableEntity& c_entity) {\n\n try {\n\n m_pcControllableEntity = &(c_entity.GetComponent<CControllableEntity>(\"controller\"));\n\n m_pcLightEntity = &(c_entity.GetComponent<CLightSensorEquippedEntity>(\"light_sensors\"));\n\n m_pcLightEntity->Enable();\n\n }\n\n catch(CARGoSException& ex) {\n", "file_path": "argos3/src/plugins/robots/generic/simulator/light_default_sensor.cpp", "rank": 76, "score": 184900.43476472795 }, { "content": "/**\n\n * @file <argos3/plugins/simulator/sensors/differential_steering_default_sensor.h>\n\n *\n\n * @author Carlo Pinciroli - <[email protected]>\n\n */\n\n\n\n#ifndef DIFFERENTIAL_STEERING_DEFAULT_SENSOR_H\n\n#define DIFFERENTIAL_STEERING_DEFAULT_SENSOR_H\n\n\n\n#include <string>\n\n#include <map>\n\n\n\nnamespace argos {\n", "file_path": "argos3/src/plugins/robots/generic/simulator/differential_steering_default_sensor.h", "rank": 77, "score": 184898.7037618062 }, { "content": "/**\n\n * @file <argos3/plugins/simulator/sensors/epuck_proximity_default_sensor.h>\n\n *\n\n * @author Danesh Tarapore - <[email protected]>\n\n */\n\n\n\n#ifndef EPUCK_PROXIMITY_DEFAULT_SENSOR_H\n\n#define EPUCK_PROXIMITY_DEFAULT_SENSOR_H\n\n\n\n#include <string>\n\n#include <map>\n\n\n\nnamespace argos {\n", "file_path": "argos3/src/plugins/robots/e-puck/simulator/epuck_proximity_default_sensor.h", "rank": 78, "score": 184898.7037618062 }, { "content": " }\n\n }\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n void CBatteryDefaultSensor::Init(TConfigurationNode& t_tree) {\n\n try {\n\n /* Execute standard logic */\n\n CCI_BatterySensor::Init(t_tree);\n\n /* Parse noise range */\n\n GetNodeAttributeOrDefault(t_tree, \"noise_range\", m_cNoiseRange, m_cNoiseRange);\n\n if(m_cNoiseRange.GetSpan() != 0) {\n\n m_bAddNoise = true;\n\n m_pcRNG = CRandom::CreateRNG(\"argos\");\n\n }\n\n }\n\n catch(CARGoSException& ex) {\n\n THROW_ARGOSEXCEPTION_NESTED(\"Initialization error in default battery sensor\", ex);\n\n }\n", "file_path": "argos3/src/plugins/robots/generic/simulator/battery_default_sensor.cpp", "rank": 79, "score": 184897.44657918456 }, { "content": "/**\n\n * @file <argos3/plugins/simulator/sensors/positioning_default_sensor.cpp>\n\n *\n\n * @author Carlo Pinciroli - <[email protected]>\n\n */\n\n\n\n#include <argos3/core/simulator/simulator.h>\n\n#include <argos3/core/simulator/entity/embodied_entity.h>\n\n#include <argos3/core/simulator/entity/composable_entity.h>\n\n\n\n#include \"positioning_default_sensor.h\"\n\n\n\nnamespace argos {\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n CPositioningDefaultSensor::CPositioningDefaultSensor() :\n\n m_pcEmbodiedEntity(nullptr),\n\n m_pcRNG(nullptr),\n", "file_path": "argos3/src/plugins/robots/generic/simulator/positioning_default_sensor.cpp", "rank": 80, "score": 184897.4352676829 }, { "content": "/**\n\n * @file <argos3/plugins/robots/prototype/simulator/prototype_joints_default_sensor.cpp>\n\n *\n\n * @author Michael Allwright - <[email protected]>\n\n */\n\n\n\n#ifndef PROTOTYPE_JOINTS_DEFAULT_SENSOR_H\n\n#define PROTOTYPE_JOINTS_DEFAULT_SENSOR_H\n\n\n\nnamespace argos {\n", "file_path": "argos3/src/plugins/robots/prototype/simulator/prototype_joints_default_sensor.h", "rank": 81, "score": 184897.2507024365 }, { "content": " catch(CARGoSException& ex) {\n\n THROW_ARGOSEXCEPTION_NESTED(\"Can't set robot for the proximity default sensor\", ex);\n\n }\n\n }\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n void CProximityDefaultSensor::Init(TConfigurationNode& t_tree) {\n\n try {\n\n CCI_ProximitySensor::Init(t_tree);\n\n /* Show rays? */\n\n GetNodeAttributeOrDefault(t_tree, \"show_rays\", m_bShowRays, m_bShowRays);\n\n /* Parse noise level */\n\n Real fNoiseLevel = 0.0f;\n\n GetNodeAttributeOrDefault(t_tree, \"noise_level\", fNoiseLevel, fNoiseLevel);\n\n if(fNoiseLevel < 0.0f) {\n\n THROW_ARGOSEXCEPTION(\"Can't specify a negative value for the noise level of the proximity sensor\");\n\n }\n\n else if(fNoiseLevel > 0.0f) {\n", "file_path": "argos3/src/plugins/robots/generic/simulator/proximity_default_sensor.cpp", "rank": 82, "score": 184896.65782760558 }, { "content": "/**\n\n * @file <argos3/plugins/simulator/sensors/proximity_default_sensor.cpp>\n\n *\n\n * @author Carlo Pinciroli - <[email protected]>\n\n */\n\n\n\n#include <argos3/core/simulator/simulator.h>\n\n#include <argos3/core/simulator/entity/embodied_entity.h>\n\n#include <argos3/core/simulator/entity/composable_entity.h>\n\n#include <argos3/plugins/simulator/entities/proximity_sensor_equipped_entity.h>\n\n\n\n#include \"proximity_default_sensor.h\"\n\n\n\nnamespace argos {\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n static CRange<Real> UNIT(0.0f, 1.0f);\n\n\n", "file_path": "argos3/src/plugins/robots/generic/simulator/proximity_default_sensor.cpp", "rank": 83, "score": 184896.25611726003 }, { "content": "/**\n\n * @file <argos3/plugins/simulator/sensors/battery_default_sensor.cpp>\n\n *\n\n * @author Adhavan Jayabalan <[email protected]>\n\n */\n\n\n\n#include <argos3/core/simulator/simulator.h>\n\n#include <argos3/core/simulator/entity/embodied_entity.h>\n\n#include <argos3/core/simulator/entity/composable_entity.h>\n\n#include <argos3/plugins/simulator/entities/battery_equipped_entity.h>\n\n\n\n#include \"battery_default_sensor.h\"\n\n\n\nnamespace argos {\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n static CRange<Real> UNIT(0.0f, 1.0f);\n\n\n", "file_path": "argos3/src/plugins/robots/generic/simulator/battery_default_sensor.cpp", "rank": 84, "score": 184895.90000734595 }, { "content": "/**\n\n * @file <argos3/plugins/simulator/sensors/light_default_sensor.cpp>\n\n *\n\n * @author Carlo Pinciroli - <[email protected]>\n\n */\n\n\n\n#include <argos3/core/simulator/simulator.h>\n\n#include <argos3/core/simulator/entity/embodied_entity.h>\n\n#include <argos3/core/simulator/entity/composable_entity.h>\n\n#include <argos3/plugins/simulator/entities/light_entity.h>\n\n#include <argos3/plugins/simulator/entities/light_sensor_equipped_entity.h>\n\n\n\n#include \"light_default_sensor.h\"\n\n\n\nnamespace argos {\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n static CRange<Real> UNIT(0.0f, 1.0f);\n", "file_path": "argos3/src/plugins/robots/generic/simulator/light_default_sensor.cpp", "rank": 85, "score": 184895.61924081508 }, { "content": " THROW_ARGOSEXCEPTION_NESTED(\"Can't set robot for the light default sensor\", ex);\n\n }\n\n }\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n void CLightDefaultSensor::Init(TConfigurationNode& t_tree) {\n\n try {\n\n CCI_LightSensor::Init(t_tree);\n\n /* Show rays? */\n\n GetNodeAttributeOrDefault(t_tree, \"show_rays\", m_bShowRays, m_bShowRays);\n\n /* Parse noise level */\n\n Real fNoiseLevel = 0.0f;\n\n GetNodeAttributeOrDefault(t_tree, \"noise_level\", fNoiseLevel, fNoiseLevel);\n\n if(fNoiseLevel < 0.0f) {\n\n THROW_ARGOSEXCEPTION(\"Can't specify a negative value for the noise level of the light sensor\");\n\n }\n\n else if(fNoiseLevel > 0.0f) {\n\n m_bAddNoise = true;\n", "file_path": "argos3/src/plugins/robots/generic/simulator/light_default_sensor.cpp", "rank": 86, "score": 184895.33068992328 }, { "content": " /****************************************/\n\n /****************************************/\n\n\n\n CProximityDefaultSensor::CProximityDefaultSensor() :\n\n m_pcEmbodiedEntity(nullptr),\n\n m_bShowRays(false),\n\n m_pcRNG(nullptr),\n\n m_bAddNoise(false),\n\n m_cSpace(CSimulator::GetInstance().GetSpace()) {}\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n void CProximityDefaultSensor::SetRobot(CComposableEntity& c_entity) {\n\n try {\n\n m_pcEmbodiedEntity = &(c_entity.GetComponent<CEmbodiedEntity>(\"body\"));\n\n m_pcControllableEntity = &(c_entity.GetComponent<CControllableEntity>(\"controller\"));\n\n m_pcProximityEntity = &(c_entity.GetComponent<CProximitySensorEquippedEntity>(\"proximity_sensors\"));\n\n m_pcProximityEntity->Enable();\n\n }\n", "file_path": "argos3/src/plugins/robots/generic/simulator/proximity_default_sensor.cpp", "rank": 87, "score": 184895.1622686897 }, { "content": " /****************************************/\n\n /****************************************/\n\n\n\n void CPositioningDefaultSensor::Reset() {\n\n m_sReading.Position = m_pcEmbodiedEntity->GetOriginAnchor().Position;\n\n m_sReading.Orientation = m_pcEmbodiedEntity->GetOriginAnchor().Orientation;\n\n }\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n REGISTER_SENSOR(CPositioningDefaultSensor,\n\n \"positioning\", \"default\",\n\n \"Carlo Pinciroli [[email protected]]\",\n\n \"1.0\",\n\n \"A generic positioning sensor.\",\n\n\n\n \"This sensor returns the current position and orientation of a robot. This sensor\\n\"\n\n \"can be used with any robot, since it accesses only the body component. In\\n\"\n\n \"controllers, you must include the ci_positioning_sensor.h header.\\n\\n\"\n", "file_path": "argos3/src/plugins/robots/generic/simulator/positioning_default_sensor.cpp", "rank": 88, "score": 184894.48669048309 }, { "content": "\n\n /****************************************/\n\n /****************************************/\n\n\n\n void CCameraDefaultSensor::SetRobot(CComposableEntity& c_entity) {\n\n /* Get the embodied and controllable entities */\n\n m_pcEmbodiedEntity = &(c_entity.GetComponent<CEmbodiedEntity>(\"body\"));\n\n m_pcControllableEntity = &(c_entity.GetComponent<CControllableEntity>(\"controller\"));\n\n }\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n void CCameraDefaultSensor::Init(TConfigurationNode& t_tree) {\n\n try {\n\n /* Parent class init */\n\n CCI_CameraSensor::Init(t_tree);\n\n /* Show the frustums */\n\n GetNodeAttributeOrDefault(t_tree, \"show_frustum\", m_bShowFrustum, m_bShowFrustum);\n\n /* For each camera */\n", "file_path": "argos3/src/plugins/robots/generic/simulator/camera_default_sensor.cpp", "rank": 89, "score": 184893.12973967852 }, { "content": " }\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n void CBatteryDefaultSensor::Reset() {\n\n /* TODO */\n\n }\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n REGISTER_SENSOR(CBatteryDefaultSensor,\n\n \"battery\", \"default\",\n\n \"Adhavan Jayabalan [[email protected]]\",\n\n \"1.0\",\n\n \"A generic battery level sensor.\",\n\n\n\n \"This sensor returns the current battery level of a robot. This sensor\\n\"\n\n \"can be used with any robot, since it accesses only the body component. In\\n\"\n", "file_path": "argos3/src/plugins/robots/generic/simulator/battery_default_sensor.cpp", "rank": 90, "score": 184892.66537863284 }, { "content": " /* sensor is enabled by default */\n\n Enable();\n\n }\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n void CBatteryDefaultSensor::Update() {\n\n /* sensor is disabled--nothing to do */\n\n if (IsDisabled()) {\n\n return;\n\n }\n\n /* Save old charge value (used later for time left estimation) */\n\n Real fOldCharge = m_sReading.AvailableCharge;\n\n /* Update available charge as seen by the robot */\n\n m_sReading.AvailableCharge =\n\n m_pcBatteryEntity->GetAvailableCharge() /\n\n m_pcBatteryEntity->GetFullCharge();\n\n /* Add noise */\n\n if(m_bAddNoise) {\n", "file_path": "argos3/src/plugins/robots/generic/simulator/battery_default_sensor.cpp", "rank": 91, "score": 184892.63450650347 }, { "content": "\n\n void CProximityDefaultSensor::Reset() {\n\n for(UInt32 i = 0; i < GetReadings().size(); ++i) {\n\n m_tReadings[i].val = 0.0f;\n\n m_tReadings[i].isRobot = false;\n\n }\n\n }\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n Real CProximityDefaultSensor::CalculateReading(Real f_distance) {\n\n // CHANGED FROM ORIGINAL FOOTBOT CODE\n\n return f_distance;\n\n }\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n REGISTER_SENSOR(CProximityDefaultSensor,\n", "file_path": "argos3/src/plugins/robots/generic/simulator/proximity_default_sensor.cpp", "rank": 92, "score": 184891.5401246428 }, { "content": " m_bAddNoise(false) {}\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n void CPositioningDefaultSensor::SetRobot(CComposableEntity& c_entity) {\n\n m_pcEmbodiedEntity = &(c_entity.GetComponent<CEmbodiedEntity>(\"body\"));\n\n m_sReading.Position = m_pcEmbodiedEntity->GetOriginAnchor().Position;\n\n m_sReading.Orientation = m_pcEmbodiedEntity->GetOriginAnchor().Orientation;\n\n }\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n void CPositioningDefaultSensor::Init(TConfigurationNode& t_tree) {\n\n try {\n\n CCI_PositioningSensor::Init(t_tree);\n\n /* Parse noise range */\n\n GetNodeAttributeOrDefault(t_tree, \"pos_noise_range\", m_cPosNoiseRange, m_cPosNoiseRange);\n\n GetNodeAttributeOrDefault(t_tree, \"angle_noise_range\", m_cAngleNoiseRange, m_cAngleNoiseRange);\n", "file_path": "argos3/src/plugins/robots/generic/simulator/positioning_default_sensor.cpp", "rank": 93, "score": 184891.27105636874 }, { "content": " \"proximity\", \"default\",\n\n \"Carlo Pinciroli [[email protected]]\",\n\n \"1.0\",\n\n \"A generic proximity sensor.\",\n\n\n\n \"This sensor accesses a set of proximity sensors. The sensors all return a value\\n\"\n\n \"between 0 and 1, where 0 means nothing within range and 1 means an external\\n\"\n\n \"object is touching the sensor. Values between 0 and 1 depend on the distance of\\n\"\n\n \"the occluding object, and are calculated as value=exp(-distance). In\\n\"\n\n \"controllers, you must include the ci_proximity_sensor.h header.\\n\\n\"\n\n\n\n \"This sensor is enabled by default.\\n\\n\"\n\n\n\n \"REQUIRED XML CONFIGURATION\\n\\n\"\n\n\n\n \" <controllers>\\n\"\n\n \" ...\\n\"\n\n \" <my_controller ...>\\n\"\n\n \" ...\\n\"\n\n \" <sensors>\\n\"\n", "file_path": "argos3/src/plugins/robots/generic/simulator/proximity_default_sensor.cpp", "rank": 94, "score": 184888.461969895 }, { "content": " \"the perceived light. Each reading R is calculated with R=(I/x)^2, where x is the\\n\"\n\n \"distance between a sensor and the light, and I is the reference intensity of the\\n\"\n\n \"perceived light. The reference intensity corresponds to the minimum distance at\\n\"\n\n \"which the light saturates a sensor. The reference intensity depends on the\\n\"\n\n \"individual light, and it is set with the \\\"intensity\\\" attribute of the light\\n\"\n\n \"entity. In case multiple lights are present in the environment, each sensor\\n\"\n\n \"reading is calculated as the sum of the individual readings due to each light.\\n\"\n\n \"In other words, light wave interference is not taken into account. In\\n\"\n\n \"controllers, you must include the ci_light_sensor.h header.\\n\\n\"\n\n\n\n \"This sensor is enabled by default.\\n\\n\"\n\n\n\n \"REQUIRED XML CONFIGURATION\\n\\n\"\n\n \" <controllers>\\n\"\n\n \" ...\\n\"\n\n \" <my_controller ...>\\n\"\n\n \" ...\\n\"\n\n \" <sensors>\\n\"\n\n \" ...\\n\"\n\n \" <light implementation=\\\"default\\\" />\\n\"\n", "file_path": "argos3/src/plugins/robots/generic/simulator/light_default_sensor.cpp", "rank": 95, "score": 184886.0881221864 }, { "content": " \"controllers, you must include the ci_battery_sensor.h header.\\n\\n\"\n\n\n\n \"This sensor is enabled by default.\\n\\n\"\n\n\n\n \"REQUIRED XML CONFIGURATION\\n\\n\"\n\n \" <controllers>\\n\"\n\n \" ...\\n\"\n\n \" <my_controller ...>\\n\"\n\n \" ...\\n\"\n\n \" <sensors>\\n\"\n\n \" ...\\n\"\n\n \" <battery implementation=\\\"default\\\" />\\n\"\n\n \" ...\\n\"\n\n \" </sensors>\\n\"\n\n \" ...\\n\"\n\n \" </my_controller>\\n\"\n\n \" ...\\n\"\n\n \" </controllers>\\n\\n\"\n\n\n\n \"OPTIONAL XML CONFIGURATION\\n\\n\"\n", "file_path": "argos3/src/plugins/robots/generic/simulator/battery_default_sensor.cpp", "rank": 96, "score": 184885.69489521778 }, { "content": " \" <sensors>\\n\"\n\n \" ...\\n\"\n\n \" <light implementation=\\\"default\\\"\\n\"\n\n \" noise_level=\\\"0.1\\\" />\\n\"\n\n \" ...\\n\"\n\n \" </sensors>\\n\"\n\n \" ...\\n\"\n\n \" </my_controller>\\n\"\n\n \" ...\\n\"\n\n \" </controllers>\\n\\n\"\n\n\n\n \"OPTIMIZATION HINTS\\n\\n\"\n\n\n\n \"1. For small swarms, enabling the light sensor (and therefore causing ARGoS to\\n\"\n\n \" update its readings each timestep) unconditionally does not impact performance too\\n\"\n\n \" much. For large swarms, it can impact performance, and selectively\\n\"\n\n \" enabling/disabling the light sensor according to when each individual robot needs it\\n\"\n\n \" (e.g., only when it is returning to the nest from foraging) can increase performance\\n\"\n\n \" by only requiring ARGoS to update the readings for a robot on the timesteps will be\\n\"\n\n \" used.\\n\",\n\n\n\n \"Usable\"\n\n\t\t );\n\n\n\n}\n", "file_path": "argos3/src/plugins/robots/generic/simulator/light_default_sensor.cpp", "rank": 97, "score": 184885.44623256396 }, { "content": "\n\n /****************************************/\n\n /****************************************/\n\n\n\n Real CLightDefaultSensor::CalculateReading(Real f_distance, Real f_intensity) {\n\n return (f_intensity * f_intensity) / (f_distance * f_distance);\n\n }\n\n\n\n /****************************************/\n\n /****************************************/\n\n\n\n REGISTER_SENSOR(CLightDefaultSensor,\n\n \"light\", \"default\",\n\n \"Carlo Pinciroli [[email protected]]\",\n\n \"1.0\",\n\n \"A generic light sensor.\",\n\n\n\n \"This sensor accesses a set of light sensors. The sensors all return a value\\n\"\n\n \"between 0 and 1, where 0 means nothing within range and 1 means the perceived\\n\"\n\n \"light saturates the sensor. Values between 0 and 1 depend on the distance of\\n\"\n", "file_path": "argos3/src/plugins/robots/generic/simulator/light_default_sensor.cpp", "rank": 98, "score": 184885.4076339252 }, { "content": " * @returns A value in the range [0:1], where 0 means that the object is too far to be sensed, and 1 means the object is so close that it saturates the sensor.\n\n */\n\n virtual Real CalculateReading(Real f_distance);\n\n\n\n /**\n\n * Returns true if the rays must be shown in the GUI.\n\n * @return true if the rays must be shown in the GUI.\n\n */\n\n inline bool IsShowRays() {\n\n return m_bShowRays;\n\n }\n\n\n\n /**\n\n * Sets whether or not the rays must be shown in the GUI.\n\n * @param b_show_rays true if the rays must be shown, false otherwise\n\n */\n\n inline void SetShowRays(bool b_show_rays) {\n\n m_bShowRays = b_show_rays;\n\n }\n\n\n", "file_path": "argos3/src/plugins/robots/e-puck/simulator/epuck_proximity_default_sensor.h", "rank": 99, "score": 184884.96844036411 } ]
C++
Studio/src/Application/Groom/GroomTool.cc
amylenz/ShapeWorks
78c2ee067a23e31f5b83d0121e60addb1b0bf462
#include <iostream> #include <QXmlStreamWriter> #include <QTemporaryFile> #include <QFileDialog> #include <QMessageBox> #include <QThread> #include <Groom/GroomTool.h> #include <Visualization/ShapeworksWorker.h> #include <Data/Project.h> #include <Data/Mesh.h> #include <Data/Shape.h> #include <ui_GroomTool.h> GroomTool::GroomTool(Preferences& prefs, std::vector<std::string>& files) : preferences_(prefs), files_(files) { this->ui_ = new Ui_GroomTool; this->ui_->setupUi(this); qRegisterMetaType<std::string>(); } GroomTool::~GroomTool() {} void GroomTool::on_antialias_checkbox_stateChanged(int state) { this->ui_->antialias_groupbox->setEnabled(state); } void GroomTool::on_blur_checkbox_stateChanged(int state) { this->ui_->blur_groupbox->setEnabled(state); } void GroomTool::on_autopad_checkbox_stateChanged(int state) { this->ui_->pad_groupbox->setEnabled(state); } void GroomTool::handle_error(std::string msg) { emit error_message(msg); this->ui_->run_groom_button->setEnabled(true); this->ui_->skipButton->setEnabled(true); } void GroomTool::handle_progress(int val) { emit progress(static_cast<size_t>(val)); } void GroomTool::on_restoreDefaults_clicked() { this->preferences_.delete_entry("groom_center"); this->preferences_.delete_entry("groom_antialias"); this->preferences_.delete_entry("groom_pad"); this->preferences_.delete_entry("groom_fastmarching"); this->preferences_.delete_entry("groom_blur"); this->preferences_.delete_entry("groom_isolate"); this->preferences_.delete_entry("groom_antialias_amount"); this->preferences_.delete_entry("groom_fill_holes"); this->preferences_.delete_entry("groom_blur_sigma"); this->preferences_.delete_entry("groom_pad_value"); this->preferences_.restore_defaults(); this->set_preferences(); qApp->processEvents(); this->preferences_.set_saved(false); } void GroomTool::set_preferences() { this->ui_->center_checkbox->setChecked( this->preferences_.get_preference("groom_center", this->ui_->center_checkbox->isChecked())); this->ui_->antialias_checkbox->setChecked( this->preferences_.get_preference("groom_antialias", this->ui_->antialias_checkbox->isChecked())); this->ui_->autopad_checkbox->setChecked( this->preferences_.get_preference("groom_pad", this->ui_->autopad_checkbox->isChecked())); this->ui_->fastmarching_checkbox->setChecked( this->preferences_.get_preference("groom_fastmarching", this->ui_->fastmarching_checkbox->isChecked())); this->ui_->blur_checkbox->setChecked( this->preferences_.get_preference("groom_blur", this->ui_->blur_checkbox->isChecked())); this->ui_->isolate_checkbox->setChecked( this->preferences_.get_preference("groom_isolate", this->ui_->isolate_checkbox->isChecked())); this->ui_->fill_holes_checkbox->setChecked( this->preferences_.get_preference("groom_fill_holes", this->ui_->fill_holes_checkbox->isChecked())); this->ui_->antialias_iterations->setValue( this->preferences_.get_preference("groom_antialias_amount", this->ui_->antialias_iterations->value())); this->ui_->blur_sigma->setValue( this->preferences_.get_preference("groom_blur_sigma", this->ui_->blur_sigma->value())); this->ui_->padding_amount->setValue( this->preferences_.get_preference("groom_pad_value", this->ui_->padding_amount->value())); } void GroomTool::disableActions() { this->ui_->skipButton->setEnabled(false); this->ui_->run_groom_button->setEnabled(false); } void GroomTool::enableActions() { this->ui_->skipButton->setEnabled(true); this->ui_->run_groom_button->setEnabled(true); } void GroomTool::update_preferences() { this->preferences_.set_preference("groom_center", this->ui_->center_checkbox->isChecked()); this->preferences_.set_preference("groom_antialias", this->ui_->antialias_checkbox->isChecked()); this->preferences_.set_preference("groom_pad", this->ui_->autopad_checkbox->isChecked()); this->preferences_.set_preference("groom_fastmarching", this->ui_->fastmarching_checkbox->isChecked()); this->preferences_.set_preference("groom_blur", this->ui_->blur_checkbox->isChecked()); this->preferences_.set_preference("groom_isolate", this->ui_->isolate_checkbox->isChecked()); this->preferences_.set_preference("groom_fill_holes", this->ui_->fill_holes_checkbox->isChecked()); this->preferences_.set_preference("groom_antialias_amount", this->ui_->antialias_iterations->value()); this->preferences_.set_preference("groom_blur_sigma", this->ui_->blur_sigma->value()); this->preferences_.set_preference("groom_pad_value", this->ui_->padding_amount->value()); } void GroomTool::on_run_groom_button_clicked() { this->update_preferences(); emit message("Please wait: running groom step..."); emit progress(5); auto shapes = this->project_->get_shapes(); std::vector<ImageType::Pointer> imgs; for (auto s : shapes) { imgs.push_back(s->get_original_image()); } this->groom_ = new QGroom(this, imgs, 0., 1., this->ui_->blur_sigma->value(), this->ui_->padding_amount->value(), this->ui_->antialias_iterations->value(), true); emit progress(15); if (this->ui_->center_checkbox->isChecked()) { this->groom_->queueTool("center"); } if (this->ui_->isolate_checkbox->isChecked()) { this->groom_->queueTool("isolate"); } if (this->ui_->fill_holes_checkbox->isChecked()) { this->groom_->queueTool("hole_fill"); } if (this->ui_->autopad_checkbox->isChecked()) { this->groom_->queueTool("auto_pad"); } if (this->ui_->antialias_checkbox->isChecked()) { this->groom_->queueTool("antialias"); } if (this->ui_->fastmarching_checkbox->isChecked()) { this->groom_->queueTool("fastmarching"); } if (this->ui_->blur_checkbox->isChecked()) { this->groom_->queueTool("blur"); } emit progress(10); this->ui_->run_groom_button->setEnabled(false); this->ui_->skipButton->setEnabled(false); QThread* thread = new QThread; ShapeworksWorker* worker = new ShapeworksWorker( ShapeworksWorker::GroomType, this->groom_, nullptr, this->project_); worker->moveToThread(thread); connect(thread, SIGNAL(started()), worker, SLOT(process())); connect(worker, SIGNAL(result_ready()), this, SLOT(handle_thread_complete())); connect(this->groom_, SIGNAL(progress(int)), this, SLOT(handle_progress(int))); connect(worker, SIGNAL(error_message(std::string)), this, SLOT(handle_error(std::string))); connect(worker, SIGNAL(finished()), worker, SLOT(deleteLater())); thread->start(); } void GroomTool::handle_thread_complete() { emit progress(95); this->project_->load_groomed_images(this->groom_->getImages(), this->ui_->fastmarching_checkbox->isChecked() ? 0. : 0.5); emit progress(100); emit message("Groom Complete"); emit groom_complete(); this->ui_->run_groom_button->setEnabled(true); this->ui_->skipButton->setEnabled(true); } void GroomTool::set_project(QSharedPointer<Project> project) { this->project_ = project; } void GroomTool::on_skipButton_clicked() { this->update_preferences(); auto shapes = this->project_->get_shapes(); std::vector<ImageType::Pointer> imgs; for (auto s : shapes) { imgs.push_back(s->get_original_image()); } this->project_->load_groomed_images(imgs, 0.); emit message("Skipped groom."); emit groom_complete(); }
#include <iostream> #include <QXmlStreamWriter> #include <QTemporaryFile> #include <QFileDialog> #include <QMessageBox> #include <QThread> #include <Groom/GroomTool.h> #include <Visualization/ShapeworksWorker.h> #include <Data/Project.h> #include <Data/Mesh.h> #include <Data/Shape.h> #include <ui_GroomTool.h>
GroomTool::~GroomTool() {} void GroomTool::on_antialias_checkbox_stateChanged(int state) { this->ui_->antialias_groupbox->setEnabled(state); } void GroomTool::on_blur_checkbox_stateChanged(int state) { this->ui_->blur_groupbox->setEnabled(state); } void GroomTool::on_autopad_checkbox_stateChanged(int state) { this->ui_->pad_groupbox->setEnabled(state); } void GroomTool::handle_error(std::string msg) { emit error_message(msg); this->ui_->run_groom_button->setEnabled(true); this->ui_->skipButton->setEnabled(true); } void GroomTool::handle_progress(int val) { emit progress(static_cast<size_t>(val)); } void GroomTool::on_restoreDefaults_clicked() { this->preferences_.delete_entry("groom_center"); this->preferences_.delete_entry("groom_antialias"); this->preferences_.delete_entry("groom_pad"); this->preferences_.delete_entry("groom_fastmarching"); this->preferences_.delete_entry("groom_blur"); this->preferences_.delete_entry("groom_isolate"); this->preferences_.delete_entry("groom_antialias_amount"); this->preferences_.delete_entry("groom_fill_holes"); this->preferences_.delete_entry("groom_blur_sigma"); this->preferences_.delete_entry("groom_pad_value"); this->preferences_.restore_defaults(); this->set_preferences(); qApp->processEvents(); this->preferences_.set_saved(false); } void GroomTool::set_preferences() { this->ui_->center_checkbox->setChecked( this->preferences_.get_preference("groom_center", this->ui_->center_checkbox->isChecked())); this->ui_->antialias_checkbox->setChecked( this->preferences_.get_preference("groom_antialias", this->ui_->antialias_checkbox->isChecked())); this->ui_->autopad_checkbox->setChecked( this->preferences_.get_preference("groom_pad", this->ui_->autopad_checkbox->isChecked())); this->ui_->fastmarching_checkbox->setChecked( this->preferences_.get_preference("groom_fastmarching", this->ui_->fastmarching_checkbox->isChecked())); this->ui_->blur_checkbox->setChecked( this->preferences_.get_preference("groom_blur", this->ui_->blur_checkbox->isChecked())); this->ui_->isolate_checkbox->setChecked( this->preferences_.get_preference("groom_isolate", this->ui_->isolate_checkbox->isChecked())); this->ui_->fill_holes_checkbox->setChecked( this->preferences_.get_preference("groom_fill_holes", this->ui_->fill_holes_checkbox->isChecked())); this->ui_->antialias_iterations->setValue( this->preferences_.get_preference("groom_antialias_amount", this->ui_->antialias_iterations->value())); this->ui_->blur_sigma->setValue( this->preferences_.get_preference("groom_blur_sigma", this->ui_->blur_sigma->value())); this->ui_->padding_amount->setValue( this->preferences_.get_preference("groom_pad_value", this->ui_->padding_amount->value())); } void GroomTool::disableActions() { this->ui_->skipButton->setEnabled(false); this->ui_->run_groom_button->setEnabled(false); } void GroomTool::enableActions() { this->ui_->skipButton->setEnabled(true); this->ui_->run_groom_button->setEnabled(true); } void GroomTool::update_preferences() { this->preferences_.set_preference("groom_center", this->ui_->center_checkbox->isChecked()); this->preferences_.set_preference("groom_antialias", this->ui_->antialias_checkbox->isChecked()); this->preferences_.set_preference("groom_pad", this->ui_->autopad_checkbox->isChecked()); this->preferences_.set_preference("groom_fastmarching", this->ui_->fastmarching_checkbox->isChecked()); this->preferences_.set_preference("groom_blur", this->ui_->blur_checkbox->isChecked()); this->preferences_.set_preference("groom_isolate", this->ui_->isolate_checkbox->isChecked()); this->preferences_.set_preference("groom_fill_holes", this->ui_->fill_holes_checkbox->isChecked()); this->preferences_.set_preference("groom_antialias_amount", this->ui_->antialias_iterations->value()); this->preferences_.set_preference("groom_blur_sigma", this->ui_->blur_sigma->value()); this->preferences_.set_preference("groom_pad_value", this->ui_->padding_amount->value()); } void GroomTool::on_run_groom_button_clicked() { this->update_preferences(); emit message("Please wait: running groom step..."); emit progress(5); auto shapes = this->project_->get_shapes(); std::vector<ImageType::Pointer> imgs; for (auto s : shapes) { imgs.push_back(s->get_original_image()); } this->groom_ = new QGroom(this, imgs, 0., 1., this->ui_->blur_sigma->value(), this->ui_->padding_amount->value(), this->ui_->antialias_iterations->value(), true); emit progress(15); if (this->ui_->center_checkbox->isChecked()) { this->groom_->queueTool("center"); } if (this->ui_->isolate_checkbox->isChecked()) { this->groom_->queueTool("isolate"); } if (this->ui_->fill_holes_checkbox->isChecked()) { this->groom_->queueTool("hole_fill"); } if (this->ui_->autopad_checkbox->isChecked()) { this->groom_->queueTool("auto_pad"); } if (this->ui_->antialias_checkbox->isChecked()) { this->groom_->queueTool("antialias"); } if (this->ui_->fastmarching_checkbox->isChecked()) { this->groom_->queueTool("fastmarching"); } if (this->ui_->blur_checkbox->isChecked()) { this->groom_->queueTool("blur"); } emit progress(10); this->ui_->run_groom_button->setEnabled(false); this->ui_->skipButton->setEnabled(false); QThread* thread = new QThread; ShapeworksWorker* worker = new ShapeworksWorker( ShapeworksWorker::GroomType, this->groom_, nullptr, this->project_); worker->moveToThread(thread); connect(thread, SIGNAL(started()), worker, SLOT(process())); connect(worker, SIGNAL(result_ready()), this, SLOT(handle_thread_complete())); connect(this->groom_, SIGNAL(progress(int)), this, SLOT(handle_progress(int))); connect(worker, SIGNAL(error_message(std::string)), this, SLOT(handle_error(std::string))); connect(worker, SIGNAL(finished()), worker, SLOT(deleteLater())); thread->start(); } void GroomTool::handle_thread_complete() { emit progress(95); this->project_->load_groomed_images(this->groom_->getImages(), this->ui_->fastmarching_checkbox->isChecked() ? 0. : 0.5); emit progress(100); emit message("Groom Complete"); emit groom_complete(); this->ui_->run_groom_button->setEnabled(true); this->ui_->skipButton->setEnabled(true); } void GroomTool::set_project(QSharedPointer<Project> project) { this->project_ = project; } void GroomTool::on_skipButton_clicked() { this->update_preferences(); auto shapes = this->project_->get_shapes(); std::vector<ImageType::Pointer> imgs; for (auto s : shapes) { imgs.push_back(s->get_original_image()); } this->project_->load_groomed_images(imgs, 0.); emit message("Skipped groom."); emit groom_complete(); }
GroomTool::GroomTool(Preferences& prefs, std::vector<std::string>& files) : preferences_(prefs), files_(files) { this->ui_ = new Ui_GroomTool; this->ui_->setupUi(this); qRegisterMetaType<std::string>(); }
function_block-full_function
[ { "content": "// Constrained Delaunay Triangulation types\n\n#include <CGAL/Constrained_Delaunay_triangulation_2.h>\n\n#include <CGAL/Constrained_triangulation_plus_2.h>\n\n\n\n// Axis-align boxes for all-pairs self-intersection detection\n\n#include <CGAL/point_generators_3.h>\n\n#include <CGAL/Bbox_3.h>\n\n#include <CGAL/box_intersection_d.h>\n\n#include <CGAL/function_objects.h>\n\n#include <CGAL/Join_input_iterator.h>\n\n#include <CGAL/algorithm.h>\n\n#include <vector>\n\n\n\n// Axis-aligned bounding box tree for tet tri intersection\n\n#include <CGAL/AABB_tree.h>\n\n#include <CGAL/AABB_traits.h>\n\n#include <CGAL/AABB_triangle_primitive.h>\n\n\n\n// Boolean operations\n\n#include <CGAL/Polyhedron_3.h>\n", "file_path": "Post/source/ShapeWorksPost-V1/include/igl/copyleft/cgal/CGAL_includes.hpp", "rank": 0, "score": 73865.9029288347 }, { "content": "// Is this actually used?\n\n//#include <CGAL/Nef_polyhedron_3.h>\n\n\n\n// Delaunay Triangulation in 3D\n\n#include <CGAL/Delaunay_triangulation_3.h>\n\n\n\n#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>\n\n#include <CGAL/Exact_predicates_exact_constructions_kernel.h>\n\n\n\n#endif\n", "file_path": "Post/source/ShapeWorksPost-V1/include/igl/copyleft/cgal/CGAL_includes.hpp", "rank": 1, "score": 73865.38533171169 }, { "content": "// This file is part of libigl, a simple c++ geometry processing library.\n\n// \n\n// Copyright (C) 2014 Alec Jacobson <[email protected]>\n\n// \n\n// This Source Code Form is subject to the terms of the Mozilla Public License \n\n// v. 2.0. If a copy of the MPL was not distributed with this file, You can \n\n// obtain one at http://mozilla.org/MPL/2.0/.\n\n#ifndef IGL_CGAL_INCLUDES_H\n\n#define IGL_CGAL_INCLUDES_H\n\n\n\n// This causes unknown bugs during intersection meshing:\n\n//// http://www.alecjacobson.com/weblog/?p=4291\n\n//#define CGAL_INTERSECTION_VERSION 1\n\n// Use this instead to mute errors resulting from bad CGAL assertions\n\n#define CGAL_KERNEL_NO_ASSERTIONS\n\n// Triangle triangle intersection\n\n#include <CGAL/intersections.h>\n\n// THIS CANNOT BE INCLUDED IN THE SAME FILE AS <CGAL/intersections.h>\n\n// #include <CGAL/Boolean_set_operations_2.h>\n\n\n", "file_path": "Post/source/ShapeWorksPost-V1/include/igl/copyleft/cgal/CGAL_includes.hpp", "rank": 2, "score": 73864.69994437615 }, { "content": "GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_include;\n", "file_path": "Post/source/ShapeWorksPost-V1/external/nanogui/ext/glew/include/GL/glew.h", "rank": 3, "score": 68466.86863569455 }, { "content": "\n\nAlso defines the utility functions sqr, cube, sgn, fract, clamp, mix,\n\nstep, smoothstep, faceforward, reflect, and refract\n\n*/\n\n\n\n\n\n// Windows defines these as macros, which prevents us from using the\n\n// type-safe versions from std::, as well as interfering with method defns\n\n#undef min\n\n#undef max\n\n\n\n\n\n#include <cmath>\n\n#include <iostream>\n\n#include <algorithm>\n\nusing std::min;\n\nusing std::max;\n\nusing std::swap;\n\nusing std::sqrt;\n\n\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 4, "score": 67340.98445279848 }, { "content": "#include \"Vec.h\"\n\n#include <cmath>\n\n#include <algorithm>\n\nusing std::fmod;\n\nusing std::floor;\n\nusing std::min;\n\nusing std::max;\n\n#ifndef M_PI\n\n# define M_PI 3.14159265358979323846\n\n#endif\n\n\n\n\n", "file_path": "ExternalLibs/trimesh2/include/Color.h", "rank": 5, "score": 67336.53854041098 }, { "content": "#ifndef NOISE3D_H\n\n#define NOISE3D_H\n\n/*\n\nSzymon Rusinkiewicz\n\nPrinceton University\n\n\n\nnoise3d.h\n\nA class for 3-D noise functions, including white noise and 1/f noise\n\n*/\n\n\n\n#include <math.h>\n\n#include <algorithm>\n\n#include <vector>\n\nusing std::max;\n\nusing std::swap;\n\nusing std::vector;\n\n\n\n\n\n// Quick 'n dirty portable random number generator \n\nstatic inline float tinyrnd()\n\n{\n\n\tstatic unsigned trand = 0;\n\n\ttrand = 1664525u * trand + 1013904223u;\n\n\treturn (float) trand / 4294967296.0f;\n\n}\n\n\n\n\n", "file_path": "ExternalLibs/trimesh2/include/noise3d.h", "rank": 6, "score": 67336.35232051015 }, { "content": "/*\n\n * Copyright (c) 2013 University of Utah\n\n */\n\n\n\n#ifndef __map_H\n\n#define __map_H\n\n\n\n#include \"MapFilter.h\"\n\n#include \"ReduceFilter.h\"\n\n\n\nnamespace bambam\n\n{\n\n\n\n/**\n\n * map is an abstraction of mapping over threads to simplify (and restrict) things a bit.\n\n *\n\n * the passed in functor should have an \n\n * void operator()(TInputImage::ConstPointer in, const TOutputImage::RegionType & threadRegion)\n\n *\n\n * with the idea of updating out with the results of the map and the functor will hold any state information you need as you go.\n\n */\n\ntemplate<class TInputImage,\n", "file_path": "ExternalLibs/trimesh2/include/map.h", "rank": 7, "score": 67334.98907264895 }, { "content": "#ifndef BSPHERE_H\n\n#define BSPHERE_H\n\n/*\n\nSzymon Rusinkiewicz\n\nPrinceton University\n\n\n\nbsphere.h\n\nBounding sphere computation, based on the \"miniball\" package by\n\nBernd Gaertner, based on algorithms by Welzl and Gaertner. The\n\noriginal code is distributed under the GPL, and is available from\n\nhttp://www.inf.ethz.ch/personal/gaertner/miniball.html\n\nThe original copyright notice can be found at the end of this file.\n\n*/\n\n\n\n\n\n#include \"Vec.h\"\n\n#include <list>\n\n\n\n\n\n// Class for a basis of points supporting a bounding sphere\n\ntemplate<int D, class T>\n", "file_path": "ExternalLibs/trimesh2/include/bsphere.h", "rank": 8, "score": 67334.98907264895 }, { "content": "\t\t\t\t// NOTE: scalar has to be the same type:\n\n\t\t\t\t// it won't work to do double * vec<float>\n\n\tv1 = min(v2,v3);\t// Componentwise min/max\n\n\tv1 = sin(v2);\t\t// Componentwise - all the usual functions...\n\n\tswap(v1,v2);\t\t// In-place swap\n\n\n\n\tv3 = v1 DOT v2;\t\t// Actually operator^\n\n\tv3 = v1 CROSS v2;\t// Actually operator%\n\n\n\n\tfloat f = v1[0];\t// Subscript\n\n\tfloat *fp = v1;\t\t// Implicit conversion to float *\n\n\n\n\tf = len(v1);\t\t// Length (also len2 == squared length)\n\n\tf = dist(p1, p2);\t// Distance (also dist2 == squared distance)\n\n\tnormalize(v1);\t\t// Normalize (i.e., make it unit length)\n\n\t\t\t\t// normalize(vec(0,0,0)) => vec(1,0,0)\n\n\tv1 = trinorm(p1,p2,p3); // Normal of triangle\n\n\n\n\tcout << v1 << endl;\t// iostream output in the form (1,2,3)\n\n\tcin >> v2;\t\t// iostream input using the same syntax\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 9, "score": 67334.35299268759 }, { "content": "\tfor (int i = 0; i < D; i++)\n\n\t\tresult[i] = x / v[i];\n\n\treturn result;\n\n}\n\n\n\ntemplate <int D, class T>\n\nstatic inline const Vec<D,T> operator / (const Vec<D,T> &v, const T &x)\n\n{\n\n\tVec<D,T> result(VEC_UNINITIALIZED);\n\n\tfor (int i = 0; i < D; i++)\n\n\t\tresult[i] = v[i] / x;\n\n\treturn result;\n\n}\n\n\n\n\n\n// iostream operators\n\ntemplate <int D, class T>\n\nstatic inline std::ostream &operator << (std::ostream &os, const Vec<D,T> &v)\n\n\n\n{\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 10, "score": 67333.80448238988 }, { "content": "#ifndef COLOR_H\n\n#define COLOR_H\n\n/*\n\nSzymon Rusinkiewicz\n\nPrinceton University\n\n\n\nColor.h\n\nRandom class for encapsulating colors...\n\n\n\nDue to all the possible colorspace variants, here's the documentation of\n\nwhat is actually implemented:\n\n - CIE 1931 2-degree observer\n\n - D65 illuminant (including for CIELAB - it's not D50)\n\n - Rec. 709 primaries\n\n - Range of [0..1] for all spaces except CIELAB and hue in HSV\n\n - \"RGB\" means linear-scaled RGB with the above illuminant and primaries\n\n - HSV is single-hexcone, sRGB\n\n - Y'CbCr is JFIF-standard (Rec. 601 scaling, full excursion) starting from sRGB\n\n*/\n\n\n", "file_path": "ExternalLibs/trimesh2/include/Color.h", "rank": 11, "score": 67333.32264172882 }, { "content": "#define DOT ^\n\n\n\n// Cross product - only in 3 dimensions\n\ntemplate <class T>\n\nstatic inline const Vec<3,T> operator % (const Vec<3,T> &v1, const Vec<3,T> &v2)\n\n{\n\n\treturn Vec<3,T>(v1[1]*v2[2] - v1[2]*v2[1],\n\n\t\t\tv1[2]*v2[0] - v1[0]*v2[2],\n\n\t\t\tv1[0]*v2[1] - v1[1]*v2[0]);\n\n}\n\n#define CROSS %\n\n\n\n\n\n// Component-wise equality and inequality (#include the usual caveats\n\n// about comparing floats for equality...)\n\ntemplate <int D, class T>\n\nstatic inline bool operator == (const Vec<D,T> &v1, const Vec<D,T> &v2)\n\n{\n\n\tfor (int i = 0; i < D; i++)\n\n\t\tif (v1[i] != v2[i])\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 12, "score": 67333.1851643283 }, { "content": "\t\t\treturn false;\n\n\treturn true;\n\n}\n\n\n\ntemplate <int D, class T>\n\nstatic inline bool operator != (const Vec<D,T> &v1, const Vec<D,T> &v2)\n\n{\n\n\tfor (int i = 0; i < D; i++)\n\n\t\tif (v1[i] != v2[i])\n\n\t\t\treturn true;\n\n\treturn false;\n\n}\n\n\n\n\n\n// Unary operators\n\ntemplate <int D, class T>\n\nstatic inline const Vec<D,T> &operator + (const Vec<D,T> &v)\n\n{\n\n\treturn v;\n\n}\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 13, "score": 67328.55996081686 }, { "content": " { \\\n\n\tVec<D,T> result(VEC_UNINITIALIZED); \\\n\n\tfor (int i = 0; i < D; i++) \\\n\n\t\tresult[i] = name(v[i]); \\\n\n\treturn result; \\\n\n }\n\n\n\n#define VEC_DECLARE_TWOARG(name) \\\n\n template <int D, class T> \\\n\n static inline Vec<D,T> name(const Vec<D,T> &v, const T &w) \\\n\n { \\\n\n\tVec<D,T> result(VEC_UNINITIALIZED); \\\n\n\tfor (int i = 0; i < D; i++) \\\n\n\t\tresult[i] = name(v[i], w); \\\n\n\treturn result; \\\n\n } \\\n\n template <int D, class T> \\\n\n static inline Vec<D,T> name(const Vec<D,T> &v, const Vec<D,T> &w) \\\n\n { \\\n\n\tVec<D,T> result(VEC_UNINITIALIZED); \\\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 14, "score": 67328.55996081686 }, { "content": "\n\n// Let gcc optimize conditional branches a bit better...\n\n#ifndef likely\n\n# if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)\n\n# define likely(x) (x)\n\n# define unlikely(x) (x)\n\n# else\n\n# define likely(x) (__builtin_expect((x), 1))\n\n# define unlikely(x) (__builtin_expect((x), 0))\n\n# endif\n\n#endif\n\n\n\n\n\n// Boost-like compile-time assertion checking\n\ntemplate <bool X> struct VEC_STATIC_ASSERTION_FAILURE;\n\ntemplate <> struct VEC_STATIC_ASSERTION_FAILURE<true>\n\n\t{ void operator () () {} };\n\n#define VEC_STATIC_CHECK(expr) VEC_STATIC_ASSERTION_FAILURE<bool(expr)>()\n\n\n\n\n\ntemplate <int D, class T = float>\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 15, "score": 67328.55996081686 }, { "content": "\n\n\t// Some partial compatibility with valarrays and vectors\n\n\ttypedef T value_type;\n\n\tsize_t size() const\n\n\t\t{ return D; }\n\n\tT sum() const\n\n\t\t{ T total = v[0];\n\n\t\t for (int i = 1; i < D; i++) total += v[i];\n\n\t\t return total; }\n\n\tT avg() const\n\n\t\t{ return sum() / D; }\n\n\tT product() const\n\n\t\t{ T total = v[0];\n\n\t\t for (int i = 1; i < D; i++) total *= v[i];\n\n\t\t return total; }\n\n\tT min() const\n\n\t\t{ T m = v[0];\n\n\t\t for (int i = 1; i < D; i++)\n\n\t\t\tif (v[i] < m) m = v[i];\n\n\t\t return m; }\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 16, "score": 67328.55996081686 }, { "content": "\tT max() const\n\n\t\t{ T m = v[0];\n\n\t\t for (int i = 1; i < D; i++)\n\n\t\t\tif (v[i] > m) m = v[i];\n\n\t\t return m; }\n\n\tT *begin() { return &(v[0]); }\n\n\tconst T *begin() const { return &(v[0]); }\n\n\tT *end() { return begin() + D; }\n\n\tconst T *end() const { return begin() + D; }\n\n\tvoid clear() { for (int i = 0; i < D; i++) v[i] = T(0); }\n\n\tbool empty() const\n\n\t\t{ for (int i = 0; i < D; i++)\n\n\t\t\tif (v[i]) return false;\n\n\t\t return true; }\n\n\tVec<D,T> apply(T func(T)) const\n\n\t\t{ Vec<D,T> result(VEC_UNINITIALIZED);\n\n\t\t for (int i = 0; i < D; i++) result[i] = func(v[i]);\n\n\t\t return result; }\n\n\tVec<D,T> apply(T func(const T&)) const\n\n\t\t{ Vec<D,T> result(VEC_UNINITIALIZED);\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 17, "score": 67328.55996081686 }, { "content": "\t\t\t\t\t inv_cielab_nonlinearity(v[2]));\n\n\t\t\tcase SRGB:\n\n\t\t\tcase YCBCR:\n\n\t\t\t\treturn Color(inv_srgb_nonlinearity(v[0]),\n\n\t\t\t\t\t inv_srgb_nonlinearity(v[1]),\n\n\t\t\t\t\t inv_srgb_nonlinearity(v[2]));\n\n\t\t\tdefault:\n\n\t\t\t\treturn Color(*this);\n\n\t\t}\n\n\t}\n\n\n\n\t// For backwards compatibility with earlier versions of Color.h,\n\n\t// this stays as a static method. New code should use convert().\n\n\tstatic Color hsv(float h, float s, float v)\n\n\t{\n\n\t\treturn Color(h,s,v).hsv2srgb();\n\n\t}\n\n};\n\n\n\n\n", "file_path": "ExternalLibs/trimesh2/include/Color.h", "rank": 18, "score": 67328.55996081686 }, { "content": "\t\t\tysize = 2;\n\n\n\n\t\tint i;\n\n\t\tint pxy = max(xsize, ysize);\n\n\t\tfor (i = 0; i < pxy; i++)\n\n\t\t\tp.push_back(i);\n\n\t\tfor (i = 0; i < pxy; i++) {\n\n\t\t\tint j = int(tinyrnd()*pxy);\n\n\t\t\tswap(p[i], p[j]);\n\n\t\t}\n\n\t\tfor (i = pxy; i < pxy+ysize; i++)\n\n\t\t\tp.push_back(p[i-pxy]);\n\n\t\tfor (i = 0; i < pxy + zsize; i++)\n\n\t\t\tr.push_back(tinyrnd());\n\n\t}\n\n\n\n\tvirtual float lookup(float x, float y, float z) const\n\n\t{\n\n\t\tx -= floor(x);\n\n\t\ty -= floor(y);\n", "file_path": "ExternalLibs/trimesh2/include/noise3d.h", "rank": 19, "score": 67328.55996081686 }, { "content": "\t{\n\n\t\tfloat fy = (v[0] + 16.0f) * (1.0f / 116.0f);\n\n\t\tfloat fx = fy + v[1] * 0.002f;\n\n\t\tfloat fz = fy - v[2] * 0.005f;\n\n\t\treturn Color(0.95047f * inv_cielab_nonlinearity(fx),\n\n\t\t\t inv_cielab_nonlinearity(fy),\n\n\t\t\t 1.08883f * inv_cielab_nonlinearity(fz));\n\n\t}\n\n\n\n\tconst Color xyz2rgb() const\n\n\t{\n\n\t\treturn col_transform(3.24071f, -1.53726f, -0.498571f,\n\n \t\t\t\t -0.969258f, 1.87599f, 0.0415557f,\n\n\t\t\t\t 0.0556352f, -0.203996f, 1.05707f);\n\n\t}\n\n\tconst Color rgb2xyz() const\n\n\t{\n\n\t\treturn col_transform(0.412424f, 0.357579f, 0.180464f,\n\n\t\t\t\t 0.212656f, 0.715158f, 0.0721856f,\n\n\t\t\t\t 0.0193324f, 0.119193f, 0.950444f);\n", "file_path": "ExternalLibs/trimesh2/include/Color.h", "rank": 20, "score": 67328.55996081686 }, { "content": "\tVec<D,T> &operator += (const Vec<D,T> &x)\n\n\t{\n\n\t\tfor (int i = 0; i < D; i++)\n\n#pragma omp atomic\n\n\t\t\tv[i] += x[i];\n\n\t\treturn *this;\n\n\t}\n\n\tVec<D,T> &operator -= (const Vec<D,T> &x)\n\n\t{\n\n\t\tfor (int i = 0; i < D; i++)\n\n#pragma omp atomic\n\n\t\t\tv[i] -= x[i];\n\n\t\treturn *this;\n\n\t}\n\n\tVec<D,T> &operator *= (const Vec<D,T> &x)\n\n\t{\n\n\t\tfor (int i = 0; i < D; i++)\n\n#pragma omp atomic\n\n\t\t\tv[i] *= x[i];\n\n\t\treturn *this;\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 21, "score": 67328.55996081686 }, { "content": "}\n\n\n\ntemplate <int D, class T>\n\nstatic inline const Vec<D,T> operator / (const Vec<D,T> &v1, const Vec<D,T> &v2)\n\n{\n\n\tVec<D,T> result(VEC_UNINITIALIZED);\n\n\tfor (int i = 0; i < D; i++)\n\n\t\tresult[i] = v1[i] / v2[i];\n\n\treturn result;\n\n}\n\n\n\n// Dot product in any dimension\n\ntemplate <int D, class T>\n\nstatic inline const T operator ^ (const Vec<D,T> &v1, const Vec<D,T> &v2)\n\n{\n\n\tT sum = v1[0] * v2[0];\n\n\tfor (int i = 1; i < D; i++)\n\n\t\tsum += v1[i] * v2[i];\n\n\treturn sum;\n\n}\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 22, "score": 67328.55996081686 }, { "content": "\t\tc[0][j] = 0;\n\n\tcurrent_c = c[0];\n\n\tcurrent_sqr_r = -1;\n\n}\n\n\n\n\n\ntemplate <int D, class T>\n\nbool Basis<D,T>::push(const Vec<D,T> &p)\n\n{\n\n\tint i, j;\n\n\tconst T eps = T(1.0e-13);\n\n\tif (m == 0) {\n\n\t\tfor (i = 0; i < D; i++)\n\n\t\t\tq0[i] = p[i];\n\n\t\tfor (i = 0; i < D; i++)\n\n\t\t\tc[0][i] = q0[i];\n\n\t\tsqr_r[0] = 0;\n\n\t} else {\n\n\t\t// set v_m to Q_m\n\n\t\tfor (i = 0; i < D; i++)\n", "file_path": "ExternalLibs/trimesh2/include/bsphere.h", "rank": 23, "score": 67328.55996081686 }, { "content": "\t\t for (int i = 0; i < D; i++) result[i] = func(v[i]);\n\n\t\t return result; }\n\n};\n\n\n\ntypedef Vec<3,float> vec;\n\ntypedef Vec<3,float> point;\n\ntypedef Vec<2,float> vec2;\n\ntypedef Vec<3,float> vec3;\n\ntypedef Vec<4,float> vec4;\n\ntypedef Vec<2,int> ivec2;\n\ntypedef Vec<3,int> ivec3;\n\ntypedef Vec<4,int> ivec4;\n\n\n\n\n\n// Nonmember operators that take two Vecs\n\ntemplate <int D, class T>\n\nstatic inline const Vec<D,T> operator + (const Vec<D,T> &v1, const Vec<D,T> &v2)\n\n{\n\n\tVec<D,T> result(VEC_UNINITIALIZED);\n\n\tfor (int i = 0; i < D; i++)\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 24, "score": 67328.55996081686 }, { "content": "\t}\n\n\tVec<D,T> &operator *= (const T &x)\n\n\t{\n\n\t\tfor (int i = 0; i < D; i++)\n\n#pragma omp atomic\n\n\t\t\tv[i] *= x;\n\n\t\treturn *this;\n\n\t}\n\n\tVec<D,T> &operator /= (const Vec<D,T> &x)\n\n\t{\n\n\t\tfor (int i = 0; i < D; i++)\n\n#pragma omp atomic\n\n\t\t\tv[i] /= x[i];\n\n\t\treturn *this;\n\n\t}\n\n\tVec<D,T> &operator /= (const T &x)\n\n\t{\n\n\t\tfor (int i = 0; i < D; i++)\n\n#pragma omp atomic\n\n\t\t\tv[i] /= x;\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 25, "score": 67328.55996081686 }, { "content": "{\n\n\tVec<D,T> result(VEC_UNINITIALIZED);\n\n\tfor (int i = 0; i < D; i++)\n\n\t\tresult[i] = x * v[i];\n\n\treturn result;\n\n}\n\n\n\ntemplate <int D, class T>\n\nstatic inline const Vec<D,T> operator * (const Vec<D,T> &v, const T &x)\n\n{\n\n\tVec<D,T> result(VEC_UNINITIALIZED);\n\n\tfor (int i = 0; i < D; i++)\n\n\t\tresult[i] = v[i] * x;\n\n\treturn result;\n\n}\n\n\n\ntemplate <int D, class T>\n\nstatic inline const Vec<D,T> operator / (const T &x, const Vec<D,T> &v)\n\n{\n\n\tVec<D,T> result(VEC_UNINITIALIZED);\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 26, "score": 67328.55996081686 }, { "content": "}\n\n\n\n// Square function moved up -- pm\n\n\n\ntemplate <class T>\n\nstatic inline T cube(const T &x)\n\n{\n\n\treturn x*x*x;\n\n}\n\n\n\n\n\n// Sign of a scalar\n\ntemplate <class T>\n\nstatic inline T sgn(const T &x)\n\n{\n\n\treturn (x < T(0)) ? T(-1) : T(1);\n\n}\n\n\n\n\n\n// Utility functions based on GLSL\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 27, "score": 67328.55996081686 }, { "content": "\t}\n\n\n\n\tif (c1 == '(' && c2 != ')')\n\n\t\tis.setstate(std::ios::failbit);\n\n\telse if (c1 == '[' && c2 != ']')\n\n\t\tis.setstate(std::ios::failbit);\n\n\n\n\treturn is;\n\n}\n\n\n\n// Utility functions for square and cube, to go along with sqrt and cbrt\n\ntemplate <class T>\n\nstatic inline T sqr(const T &x)\n\n{\n\n\treturn x*x;\n\n}\n\n\n\n\n\n// Functions on Vecs\n\ntemplate <int D, class T>\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 28, "score": 67328.55996081686 }, { "content": " }\n\n\n\nVEC_DECLARE_ONEARG(fabs)\n\nVEC_DECLARE_ONEARG(floor)\n\nVEC_DECLARE_ONEARG(ceil)\n\nVEC_DECLARE_ONEARG(round)\n\nVEC_DECLARE_ONEARG(trunc)\n\nVEC_DECLARE_ONEARG(sin)\n\nVEC_DECLARE_ONEARG(asin)\n\nVEC_DECLARE_ONEARG(cos)\n\nVEC_DECLARE_ONEARG(acos)\n\nVEC_DECLARE_ONEARG(tan)\n\nVEC_DECLARE_ONEARG(atan)\n\nVEC_DECLARE_ONEARG(exp)\n\nVEC_DECLARE_ONEARG(log)\n\nVEC_DECLARE_ONEARG(sqrt)\n\nVEC_DECLARE_ONEARG(sqr)\n\nVEC_DECLARE_ONEARG(cbrt)\n\nVEC_DECLARE_ONEARG(cube)\n\nVEC_DECLARE_ONEARG(sgn)\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 29, "score": 67328.55996081686 }, { "content": "\tos << \"(\";\n\n\tfor (int i = 0; i < D-1; i++)\n\n\t\tos << v[i] << \", \";\n\n\treturn os << v[D-1] << \")\";\n\n}\n\n\n\ntemplate <int D, class T>\n\nstatic inline std::istream &operator >> (std::istream &is, Vec<D,T> &v)\n\n{\n\n\tchar c1 = 0, c2 = 0;\n\n\n\n\tis >> c1;\n\n\tif (c1 == '(' || c1 == '[') {\n\n\t\tis >> v[0] >> std::ws >> c2;\n\n\t\tfor (int i = 1; i < D; i++) {\n\n\t\t\tif (c2 == ',')\n\n\t\t\t\tis >> v[i] >> std::ws >> c2;\n\n\t\t\telse\n\n\t\t\t\tis.setstate(std::ios::failbit);\n\n\t\t}\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 30, "score": 67328.55996081686 }, { "content": "\tColor &operator = (int c)\n\n\t\t{ return *this = Color(c); }\n\n\n\n\tstatic Color black()\n\n\t\t{ return Color(0.0f, 0.0f, 0.0f); }\n\n\tstatic Color white()\n\n\t\t{ return Color(1.0f, 1.0f, 1.0f); }\n\n\tstatic Color red()\n\n\t\t{ return Color(1.0f, 0.0f, 0.0f); }\n\n\tstatic Color green()\n\n\t\t{ return Color(0.0f, 1.0f, 0.0f); }\n\n\tstatic Color blue()\n\n\t\t{ return Color(0.0f, 0.0f, 1.0f); }\n\n\tstatic Color yellow()\n\n\t\t{ return Color(1.0f, 1.0f, 0.0f); }\n\n\tstatic Color cyan()\n\n\t\t{ return Color(0.0f, 1.0f, 1.0f); }\n\n\tstatic Color magenta()\n\n\t\t{ return Color(1.0f, 0.0f, 1.0f); }\n\n\n", "file_path": "ExternalLibs/trimesh2/include/Color.h", "rank": 31, "score": 67328.55996081686 }, { "content": "\t\tresult[i] = v1[i] + v2[i];\n\n\treturn result;\n\n}\n\n\n\ntemplate <int D, class T>\n\nstatic inline const Vec<D,T> operator - (const Vec<D,T> &v1, const Vec<D,T> &v2)\n\n{\n\n\tVec<D,T> result(VEC_UNINITIALIZED);\n\n\tfor (int i = 0; i < D; i++)\n\n\t\tresult[i] = v1[i] - v2[i];\n\n\treturn result;\n\n}\n\n\n\ntemplate <int D, class T>\n\nstatic inline const Vec<D,T> operator * (const Vec<D,T> &v1, const Vec<D,T> &v2)\n\n{\n\n\tVec<D,T> result(VEC_UNINITIALIZED);\n\n\tfor (int i = 0; i < D; i++)\n\n\t\tresult[i] = v1[i] * v2[i];\n\n\treturn result;\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 32, "score": 67328.55996081686 }, { "content": "\t\telse\n\n\t\t\treturn 4.0f / 29.0f + (841.0f / 108.0f) * x;\n\n\t}\n\n\tstatic inline float inv_cielab_nonlinearity(float x)\n\n\t{\n\n\t\tif (x > (6.0f / 29.0f))\n\n\t\t\treturn cube(x);\n\n\t\telse\n\n\t\t\treturn (x - 4.0f / 29.0f) * (108.0f / 841.0f);\n\n\t}\n\n\tconst Color xyz2cielab() const\n\n\t{\n\n\t\tfloat fx = cielab_nonlinearity(v[0] * (1.0f / 0.95047f));\n\n\t\tfloat fy = cielab_nonlinearity(v[1]);\n\n\t\tfloat fz = cielab_nonlinearity(v[2] * (1.0f / 1.08883f));\n\n\t\treturn Color(116.0f * fy - 16.0f,\n\n\t\t\t 500.0f * (fx - fy),\n\n\t\t\t 200.0f * (fy - fz));\n\n\t}\n\n\tconst Color cielab2xyz() const\n", "file_path": "ExternalLibs/trimesh2/include/Color.h", "rank": 33, "score": 67328.55996081686 }, { "content": "\t\tfor (int pass = 0 ; pass < passes; pass++, factor *= MAGIC_SCALE) {\n\n\t\t\tfloat r = 1.0f / factor;\n\n\t\t\tt += Noise3D::lookup(x*r,y*r,z*r) * factor;\n\n\t\t}\n\n\n\n\t\treturn t * correction;\n\n\t}\n\n};\n\n\n\n\n\n#endif\n", "file_path": "ExternalLibs/trimesh2/include/noise3d.h", "rank": 34, "score": 67328.55996081686 }, { "content": "\t\tfloat H = 0.0f;\n\n\t\tif (S == 0.0f)\n\n\t\t\treturn Color(H, S, V);\n\n\t\tif (V == v[0])\n\n\t\t\tH = (v[1] - v[2]) / diff;\n\n\t\telse if (V == v[1])\n\n\t\t\tH = (v[2] - v[0]) / diff + 2.0f;\n\n\t\telse\n\n\t\t\tH = (v[0] - v[1]) / diff + 4.0f;\n\n\t\tH *= float(M_PI / 3.0);\n\n\t\tif (H < 0.0f)\n\n\t\t\tH += float(2.0 * M_PI);\n\n\t\treturn Color(H, S, V);\n\n\t}\n\n\n\n\tstatic inline float cielab_nonlinearity(float x)\n\n\t{\n\n\t\tif (x > 216.0f / 24389.0f)\n\n\t\t\t//return cbrt(x);\n\n return (float)(std::pow( std::abs ( x ), 1.0f / 3.0f ));\n", "file_path": "ExternalLibs/trimesh2/include/Color.h", "rank": 35, "score": 67328.55996081686 }, { "content": "\n\ntemplate <int D, class T>\n\nstatic inline const Vec<D,T> operator - (const Vec<D,T> &v)\n\n{\n\n\tVec<D,T> result(VEC_UNINITIALIZED);\n\n\tfor (int i = 0; i < D; i++)\n\n\t\tresult[i] = -v[i];\n\n\treturn result;\n\n}\n\n\n\ntemplate <int D, class T>\n\nstatic inline bool operator ! (const Vec<D,T> &v)\n\n{\n\n\treturn v.empty();\n\n}\n\n\n\n\n\n// Vec/scalar operators\n\ntemplate <int D, class T>\n\nstatic inline const Vec<D,T> operator * (const T &x, const Vec<D,T> &v)\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 36, "score": 67328.55996081686 }, { "content": "\t\tH *= float(3.0 / M_PI);\n\n\t\tint i = int(floor(H));\n\n\t\tfloat f = H - i;\n\n\t\tfloat p = V * (1.0f - S);\n\n\t\tfloat q = V * (1.0f - (S*f));\n\n\t\tfloat t = V * (1.0f - (S*(1.0f-f)));\n\n\t\tswitch(i) {\n\n\t\t\tcase 0: return Color(V, t, p);\n\n\t\t\tcase 1: return Color(q, V, p);\n\n\t\t\tcase 2: return Color(p, V, t);\n\n\t\t\tcase 3: return Color(p, q, V);\n\n\t\t\tcase 4: return Color(t, p, V);\n\n\t\t\tdefault: return Color(V, p, q);\n\n\t\t}\n\n\t}\n\n\tconst Color srgb2hsv() const\n\n\t{\n\n\t\tfloat V = std::max(std::max(v[0], v[1]), v[2]);\n\n\t\tfloat diff = V - std::min(std::min(v[0], v[1]), v[2]);\n\n\t\tfloat S = diff / V;\n", "file_path": "ExternalLibs/trimesh2/include/Color.h", "rank": 37, "score": 67328.55996081686 }, { "content": "\t\t\t srgb_nonlinearity(v[2]));\n\n\t}\n\n\tconst Color srgb2rgb() const\n\n\t{\n\n\t\treturn Color(inv_srgb_nonlinearity(v[0]),\n\n\t\t\t inv_srgb_nonlinearity(v[1]),\n\n\t\t\t inv_srgb_nonlinearity(v[2]));\n\n\t}\n\n\n\n\tconst Color srgb2ycbcr() const\n\n\t{\n\n\t\treturn Color(0.0f, 0.5f, 0.5f) + col_transform(\n\n\t\t\t0.299f, 0.587f, 0.114f,\n\n\t\t\t-0.168736f, -0.331264f, 0.5f,\n\n\t\t\t0.5f, -0.418688f, -0.081312f);\n\n\t}\n\n\tconst Color ycbcr2srgb() const\n\n\t{\n\n\t\treturn Color(v[0], v[1] - 0.5f, v[2] - 0.5f).col_transform(\n\n\t\t\t 1.0f, 0.0f, 1.402f,\n", "file_path": "ExternalLibs/trimesh2/include/Color.h", "rank": 38, "score": 67328.55996081686 }, { "content": "\tfor (int i = 0; i < D; i++) \\\n\n\t\tresult[i] = name(v[i], w[i]); \\\n\n\treturn result; \\\n\n }\n\n#define VEC_DECLARE_THREEARG(name) \\\n\n template <int D, class T> \\\n\n static inline Vec<D,T> name(const Vec<D,T> &v, const T &w, const T &x) \\\n\n { \\\n\n\tVec<D,T> result(VEC_UNINITIALIZED); \\\n\n\tfor (int i = 0; i < D; i++) \\\n\n\t\tresult[i] = name(v[i], w, x); \\\n\n\treturn result; \\\n\n } \\\n\n template <int D, class T> \\\n\n static inline Vec<D,T> name(const Vec<D,T> &v, const Vec<D,T> &w, const Vec<D,T> &x) \\\n\n { \\\n\n\tVec<D,T> result(VEC_UNINITIALIZED); \\\n\n\tfor (int i = 0; i < D; i++) \\\n\n\t\tresult[i] = name(v[i], w[i], x[i]); \\\n\n\treturn result; \\\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 39, "score": 67328.55996081686 }, { "content": "#ifndef VEC_H\n\n#define VEC_H\n\n/*\n\nSzymon Rusinkiewicz\n\nPrinceton University\n\n\n\nVec.h\n\nClass for a constant-length vector\n\n\n\nSupports the following operations:\n\n\tvec v1;\t\t\t// Initialized to (0,0,0)\n\n\tvec v2(1,2,3);\t\t// Initialized to (1,2,3)\n\n\tvec v3(v2);\t\t// Copy constructor\n\n\tfloat farray[3];\n\n\tvec v4 = vec(farray);\t// Explicit: \"v4 = farray\" won't work\n\n\tVec<3,double> vd;\t// The \"vec\" used above is Vec<3,float>\n\n\tpoint p1, p2, p3;\t// Same as vec\n\n\n\n\tv3 = v1 + v2;\t\t// Also -, *, / (all componentwise)\n\n\tv3 = 3.5f * v1;\t\t// Also vec * scalar, vec / scalar\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 40, "score": 67328.55996081686 }, { "content": "\tT squared_radius() const { return B.squared_radius(); }\n\n};\n\n\n\n\n\ntemplate <int D, class T>\n\nT Basis<D,T>::excess(const Vec<D,T> &p) const\n\n{\n\n\tT e = -current_sqr_r;\n\n\tfor (int k = 0; k < D; k++)\n\n\t\te += sqr(p[k] - current_c[k]);\n\n\treturn e;\n\n}\n\n\n\n\n\ntemplate <int D, class T>\n\nvoid Basis<D,T>::reset()\n\n{\n\n\tm = s = 0;\n\n\t// we misuse c[0] for the center of the empty sphere\n\n\tfor (int j = 0; j < D; j++)\n", "file_path": "ExternalLibs/trimesh2/include/bsphere.h", "rank": 41, "score": 67328.55996081686 }, { "content": "\n\ntemplate <int D, class T>\n\nstatic inline const T dist2(const Vec<D,T> &v1, const Vec<D,T> &v2)\n\n{\n\n\tT d2 = sqr(v2[0]-v1[0]);\n\n\tfor (int i = 1; i < D; i++)\n\n\t\td2 += sqr(v2[i]-v1[i]);\n\n\treturn d2;\n\n}\n\n\n\ntemplate <int D, class T>\n\nstatic inline const T dist(const Vec<D,T> &v1, const Vec<D,T> &v2)\n\n{\n\n\treturn sqrt(dist2(v1,v2));\n\n}\n\n\n\ntemplate <int D, class T>\n\nstatic inline Vec<D,T> normalize(Vec<D,T> &v)\n\n{\n\n\tT l = len(v);\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 42, "score": 67328.55996081686 }, { "content": "\t\t{}\n\n\texplicit Color(double c) : Vec<3,float>((float)c, (float)c, (float)c)\n\n\t\t{}\n\n\tColor &operator = (float c)\n\n\t\t{ return *this = Color(c); }\n\n\tColor &operator = (double c)\n\n\t\t{ return *this = Color(c); }\n\n\n\n\t// Assigning from ints divides by 255\n\n\tColor(int r, int g, int b)\n\n\t{\n\n\t\tconst float mult = 1.0f / 255.0f;\n\n\t\t*this = Color(mult*r, mult*g, mult*b);\n\n\t}\n\n\texplicit Color(const int *rgb)\n\n\t\t{ *this = Color(rgb[0], rgb[1], rgb[2]); }\n\n\texplicit Color(const unsigned char *rgb)\n\n\t\t{ *this = Color(rgb[0], rgb[1], rgb[2]); }\n\n\texplicit Color(int c)\n\n\t\t{ *this = Color(c,c,c); }\n", "file_path": "ExternalLibs/trimesh2/include/Color.h", "rank": 43, "score": 67328.55996081686 }, { "content": "VEC_DECLARE_TWOARG(min)\n\nVEC_DECLARE_TWOARG(max)\n\nVEC_DECLARE_TWOARG(atan2)\n\nVEC_DECLARE_TWOARG(pow)\n\nVEC_DECLARE_TWOARG(fmod)\n\nVEC_DECLARE_TWOARG(step)\n\nVEC_DECLARE_THREEARG(smoothstep)\n\nVEC_DECLARE_THREEARG(clamp)\n\n\n\n#undef VEC_DECLARE_ONEARG\n\n#undef VEC_DECLARE_TWOARG\n\n#undef VEC_DECLARE_THREEARG\n\n\n\n\n\n// Both valarrays and GLSL use abs() on a vector to mean fabs().\n\n// Let's be compatible...\n\ntemplate <int D, class T>\n\nstatic inline Vec<D,T> abs(const Vec<D,T> &v)\n\n{\n\n\treturn fabs(v);\n\n}\n\n\n\n#endif\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 44, "score": 67328.55996081686 }, { "content": " void\n\n run( const InTypeP in, FType & functor , size_t numThreads = 1, OutRegion outRegion = OutRegion())\n\n {\n\n typedef MapFilter<FType,InType,OutType> MF;\n\n typename MF::Pointer mf = MF::New();\n\n mf->SetFunctor(&functor); // handles output\n\n if(numThreads>0)\n\n mf->SetNumberOfThreads(numThreads);\n\n mf->SetInput(in);\n\n if(outRegion.GetSize()[0] > 0)\n\n {\n\n mf->GetOutput()->SetRequestedRegion(outRegion);\n\n }\n\n else\n\n {\n\n mf->GetOutput()->SetRequestedRegion(in->GetLargestPossibleRegion());\n\n }\n\n\n\n mf->Update(); // throws\n\n }\n", "file_path": "ExternalLibs/trimesh2/include/map.h", "rank": 45, "score": 67328.55996081686 }, { "content": "static inline void swap(const Vec<D,T> &v1, const Vec<D,T> &v2)\n\n{\n\n\tfor (int i = 0; i < D; i++)\n\n\t\tswap(v1[i], v2[i]);\n\n}\n\n\n\ntemplate <int D, class T>\n\nstatic inline const T len2(const Vec<D,T> &v)\n\n{\n\n\tT l2 = v[0] * v[0];\n\n\tfor (int i = 1; i < D; i++)\n\n\t\tl2 += v[i] * v[i];\n\n\treturn l2;\n\n}\n\n\n\ntemplate <int D, class T>\n\nstatic inline const T len(const Vec<D,T> &v)\n\n{\n\n\treturn sqrt(len2(v));\n\n}\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 46, "score": 67328.55996081686 }, { "content": "static inline T reflect(const Vec<D,T> &I, const Vec<D,T> &N)\n\n{\n\n\treturn I - (T(2) * (N DOT I)) * N;\n\n}\n\n\n\ntemplate <int D, class T>\n\nstatic inline T refract(const Vec<D,T> &I, const Vec<D,T> &N,\n\n\t\t\tconst T &eta)\n\n{\n\n\tT NdotI = N DOT I;\n\n\tT k = T(1) - sqr(eta) * (T(1) - sqr(NdotI));\n\n\treturn (k < T(0)) ? T(0) : eta * I - (eta * NdotI * sqrt(k)) * N;\n\n}\n\n\n\n\n\n// Generic macros for declaring 1-, 2-, and 3- argument\n\n// componentwise functions on vecs\n\n#define VEC_DECLARE_ONEARG(name) \\\n\n template <int D, class T> \\\n\n static inline Vec<D,T> name(const Vec<D,T> &v) \\\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 47, "score": 67328.55996081686 }, { "content": "\t\tz -= floor(z);\n\n\n\n\t\tint X = int(x*xsize);\n\n\t\tint Y = int(y*ysize);\n\n\t\tint Z = int(z*zsize);\n\n\t\tint X1 = X+1; if (X1 == xsize) X1 = 0;\n\n\t\tint Y1 = Y+1; if (Y1 == ysize) Y1 = 0;\n\n\t\tint Z1 = Z+1; if (Z1 == zsize) Z1 = 0;\n\n\n\n\t\tfloat xf = x*xsize - X, xf1 = 1.0-xf;\n\n\t\tfloat yf = y*ysize - Y, yf1 = 1.0-yf;\n\n\t\tfloat zf = z*zsize - Z, zf1 = 1.0-zf;\n\n\n\n\t\treturn xf1*(yf1*(zf1*r[coord2index(X , Y , Z )] +\n\n\t\t\t\t zf *r[coord2index(X , Y , Z1)]) +\n\n\t\t\t yf *(zf1*r[coord2index(X , Y1, Z )] +\n\n\t\t\t\t zf *r[coord2index(X , Y1, Z1)])) +\n\n\t\t xf *(yf1*(zf1*r[coord2index(X1, Y , Z )] +\n\n\t\t\t\t zf *r[coord2index(X1, Y , Z1)]) +\n\n\t\t\t yf *(zf1*r[coord2index(X1, Y1, Z )] +\n\n\t\t\t\t zf *r[coord2index(X1, Y1, Z1)]));\n\n\t}\n\n\n\n\tvirtual ~Noise3D() {}\n\n};\n\n\n\n\n\n#define MAGIC_SCALE 1.5707963f\n\n\n", "file_path": "ExternalLibs/trimesh2/include/noise3d.h", "rank": 48, "score": 67328.55996081686 }, { "content": "\t\t\treturn;\n\n\t\tstd::vector<void *> v;\n\n\t\tvoid *p;\n\n\t\tfor (p = freelist; *(void **)p; p = *(void **)p)\n\n\t\t\tv.push_back(p);\n\n\t\tstd::sort(v.begin(), v.end());\n\n\t\tp = freelist = v[0];\n\n\t\tfor (size_t i = 1; i < v.size(); i++) {\n\n\t\t\t*(void **)p = v[i];\n\n\t\t\tp = *(void **)p;\n\n\t\t}\n\n\t\t*(void **)p = NULL;\n\n\t}\n\n};\n\n\n\n#endif\n", "file_path": "ExternalLibs/trimesh2/include/mempool.h", "rank": 49, "score": 67328.55996081686 }, { "content": "{\n\n\treturn x < a ? T(0) : T(1);\n\n}\n\n\n\ntemplate <class T>\n\nstatic inline T smoothstep(const T &x, const T &a, const T &b)\n\n{\n\n\tif (b <= a) return step(x,a);\n\n\tT t = (x - a) / (b - a);\n\n\treturn t <= T(0) ? T(0) : t >= T(1) ? T(1) : t * t * (T(3) - T(2) * t);\n\n}\n\n\n\ntemplate <int D, class T>\n\nstatic inline T faceforward(const Vec<D,T> &N, const Vec<D,T> &I,\n\n\t\t\t const Vec<D,T> &Nref)\n\n{\n\n\treturn ((Nref DOT I) < T(0)) ? N : -N;\n\n}\n\n\n\ntemplate <int D, class T>\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 50, "score": 67328.55996081686 }, { "content": "\t\t}\n\n\t}\n\n\n\n\t// Linear to nonlinear - raises values to the power of 1/g\n\n\tconst Color gamma(float g) const\n\n\t{\n\n\t\tfloat g1 = 1.0f / g;\n\n\t\treturn Color(pow(v[0],g1), pow(v[1],g1), pow(v[2],g1));\n\n\t}\n\n\n\n\t// Just apply the nonlinearity, not full colorspace conversion\n\n\tconst Color gamma(Colorspace dst) const\n\n\t{\n\n\t\tswitch (dst) {\n\n\t\t\tcase CIELAB:\n\n\t\t\t\treturn Color(cielab_nonlinearity(v[0]),\n\n\t\t\t\t\t cielab_nonlinearity(v[1]),\n\n\t\t\t\t\t cielab_nonlinearity(v[2]));\n\n\t\t\tcase SRGB:\n\n\t\t\tcase YCBCR:\n", "file_path": "ExternalLibs/trimesh2/include/Color.h", "rank": 51, "score": 67328.55996081686 }, { "content": "\t\t\t 1.0f, -0.344136f, -0.714136f,\n\n\t\t\t 1.0f, 1.772f, 0.0f);\n\n\t}\n\n\n\npublic:\n\n\tenum Colorspace { CIELAB, XYZ, RGB, SRGB, YCBCR, HSV };\n\n\tconst Color convert(Colorspace src, Colorspace dst) const\n\n\t{\n\n\t\tif (src == dst)\n\n\t\t\treturn Color(*this);\n\n\t\tif (src == HSV)\n\n\t\t\treturn Color::hsv(v[0],v[1],v[2]).convert(SRGB, dst);\n\n\t\telse if (dst == HSV)\n\n\t\t\treturn convert(src, SRGB).srgb2hsv();\n\n\t\t// Else we have a natural order in which to convert things\n\n\t\tint srcnum = int(src), dstnum = int(dst);\n\n\t\tif (srcnum < dstnum) switch (src) {\n\n\t\t\tcase CIELAB:\n\n\t\t\t\treturn (dst == XYZ) ? cielab2xyz() :\n\n\t\t\t\t\tcielab2xyz().convert(XYZ, dst);\n", "file_path": "ExternalLibs/trimesh2/include/Color.h", "rank": 52, "score": 67328.55996081686 }, { "content": "\tIt t = ++L.begin();\n\n\tmtf_mb(t);\n\n\tT max_e, old_sqr_r = T(0);\n\n\tdo {\n\n\t\tIt pivot;\n\n\t\tmax_e = max_excess(t, i, pivot);\n\n\t\tif (max_e > 0) {\n\n\t\t\tt = support_end;\n\n\t\t\tif (t == pivot)\n\n\t\t\t\tt++;\n\n\t\t\told_sqr_r = B.squared_radius();\n\n\t\t\tB.push(*pivot);\n\n\t\t\tmtf_mb(support_end);\n\n\t\t\tB.pop();\n\n\t\t\tmove_to_front(pivot);\n\n\t\t}\n\n\t} while (max_e > 0 && B.squared_radius() > old_sqr_r);\n\n}\n\n\n\n\n", "file_path": "ExternalLibs/trimesh2/include/bsphere.h", "rank": 53, "score": 67328.55996081686 }, { "content": "T Miniball<D,T>::max_excess(It t, It i, It &pivot) const\n\n{\n\n\tconst T *c = B.center(), sqr_r = B.squared_radius();\n\n\tT e, max_e = 0;\n\n\tfor (It k = t; k != i; k++) {\n\n\t\tconst Vec<D,T> &p = *k;\n\n\t\te = -sqr_r;\n\n\t\tfor (int j = 0; j < D; j++)\n\n\t\t\te += sqr(p[j] - c[j]);\n\n\t\tif (e > max_e) {\n\n\t\t\tmax_e = e;\n\n\t\t\tpivot = k;\n\n\t\t}\n\n\t}\n\n\treturn max_e;\n\n}\n\n\n\n\n\ntemplate <int D, class T>\n\nvoid Miniball<D,T>::mtf_mb(It i)\n", "file_path": "ExternalLibs/trimesh2/include/bsphere.h", "rank": 54, "score": 67328.55996081686 }, { "content": "#ifndef MEMPOOL_H\n\n#define MEMPOOL_H\n\n/*\n\nSzymon Rusinkiewicz\n\nPrinceton University\n\n\n\nmempool.h\n\nReplacement memory management for a class using a memory pool.\n\n\n\nSample usage:\n", "file_path": "ExternalLibs/trimesh2/include/mempool.h", "rank": 55, "score": 67328.55996081686 }, { "content": "\t// Constructor from anything that can be accessed using []\n\n\t// Pretty aggressive, so marked as explicit.\n\n\ttemplate <class S> explicit Vec(const S &x)\n\n\t\t{ for (int i = 0; i < D; i++) v[i] = T(x[i]); }\n\n\n\n\t// No destructor or assignment operator needed\n\n\n\n\t// Array reference and conversion to pointer - no bounds checking\n\n\tconst T &operator [] (int i) const\n\n\t\t{ return v[i]; }\n\n\tT &operator [] (int i)\n\n\t\t{ return v[i]; }\n\n\toperator const T * () const\n\n\t\t{ return v; }\n\n\toperator const T * ()\n\n\t\t{ return v; }\n\n\toperator T * ()\n\n\t\t{ return v; }\n\n\n\n\t// Member operators\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 56, "score": 67328.55996081686 }, { "content": "\t}\n\n\n\n\tstatic inline float srgb_nonlinearity(float x)\n\n\t{\n\n\t\tif (x > 0.0031308f)\n\n\t\t\treturn 1.055f * pow(x, 1.0f/2.4f) - 0.055f;\n\n\t\telse\n\n\t\t\treturn x * 12.92f;\n\n\t}\n\n\tstatic inline float inv_srgb_nonlinearity(float x)\n\n\t{\n\n\t\tif (x > (0.0031308f * 12.92f))\n\n\t\t\treturn pow((x + 0.055f) * (1.0f / 1.055f), 2.4f);\n\n\t\telse\n\n\t\t\treturn x * (1.0f / 12.92f);\n\n\t}\n\n\tconst Color rgb2srgb() const\n\n\t{\n\n\t\treturn Color(srgb_nonlinearity(v[0]),\n\n\t\t\t srgb_nonlinearity(v[1]),\n", "file_path": "ExternalLibs/trimesh2/include/Color.h", "rank": 57, "score": 67328.55996081686 }, { "content": "\t\tif (!freelist)\n\n\t\t\tgrow_freelist();\n\n\t\tvoid *next = freelist;\n\n\t\tfreelist = *(void **)next;\n\n\t\treturn next;\n\n\t}\n\n\tvoid free(void *p, size_t n)\n\n\t{\n\n\t\tif (!p)\n\n\t\t\treturn;\n\n\t\telse if (n != itemsize)\n\n\t\t\t::operator delete(p);\n\n\t\telse {\n\n\t\t\t*(void **)p = freelist;\n\n\t\t\tfreelist = p;\n\n\t\t}\n\n\t}\n\n\tvoid sort_freelist()\n\n\t{\n\n\t\tif (!freelist)\n", "file_path": "ExternalLibs/trimesh2/include/mempool.h", "rank": 58, "score": 67328.55996081686 }, { "content": "}\n\n \n\n\n\ntemplate <int D, class T>\n\nvoid Basis<D,T>::pop()\n\n{\n\n\tm--;\n\n}\n\n \n\n\n\ntemplate <int D, class T>\n\nvoid Miniball<D,T>::move_to_front(It j)\n\n{\n\n\tif (support_end == j)\n\n\t\tsupport_end++;\n\n\tL.splice(L.begin(), L, j);\n\n}\n\n\n\n\n\ntemplate <int D, class T>\n", "file_path": "ExternalLibs/trimesh2/include/bsphere.h", "rank": 59, "score": 67328.55996081686 }, { "content": "template <class T>\n\nstatic inline T fract(const T &x)\n\n{\n\n\treturn x - floor(x);\n\n}\n\n\n\ntemplate <class T>\n\nstatic inline T clamp(const T &x, const T &a, const T &b)\n\n{\n\n\treturn x > a ? x < b ? x : b : a; // returns a on NaN\n\n}\n\n\n\ntemplate <class T, class S>\n\nstatic inline T mix(const T &x, const T &y, const S &a)\n\n{\n\n\treturn (S(1)-a) * x + a * y;\n\n}\n\n\n\ntemplate <class T>\n\nstatic inline T step(const T &x, const T &a)\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 60, "score": 67328.55996081686 }, { "content": "// We pick up most of the operators and functions from vecs automatically.\n\n// The only ones we need to worry about are min and max,\n\n// since otherwise we'd get the ones from std::\n\nstatic inline const Color min(const Color &c1, const Color &c2)\n\n{\n\n\treturn Color(c1).min(c2);\n\n}\n\n\n\nstatic inline const Color max(const Color &c1, const Color &c2)\n\n{\n\n\treturn Color(c1).max(c2);\n\n}\n\n\n\n\n\n#endif\n", "file_path": "ExternalLibs/trimesh2/include/Color.h", "rank": 61, "score": 67328.55996081686 }, { "content": "};\n\n\n\n/**\n\n * reduce is an abstraction of mapping over threads to simplify (and restrict) things a bit.\n\n *\n\n * the passed in functor should have an:\n\n * TOutput operator()(TInputImage::ConstPointer in, const TOutputImage::RegionType & threadRegion)\n\n * and\n\n * TOutput operator()(const std::vector<TOutput> & in)\n\n *\n\n * where the reduce is two steps, first each thread reduces it's region to a single output object,\n\n * and the second step reduces a list (std::vector) of those objects to a single output object.\n\n *\n\n * For example to compute the mean, you might use a std::pair<float,size_t> obj, where obj.first = sum, obj.second = count,\n\n * then in the second step you would sum all the obj.first and obj.second and divide first by the scond to get the mean.\n\n */\n\ntemplate<class TInputImage,\n", "file_path": "ExternalLibs/trimesh2/include/map.h", "rank": 62, "score": 67328.55996081686 }, { "content": "// (at your option) any later version.\n\n//\n\n// This program is distributed in the hope that it will be useful,\n\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\n// GNU General Public License for more details.\n\n//\n\n// You should have received a copy of the GNU General Public License\n\n// along with this program; if not, write to the Free Software\n\n// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA,\n\n// or download the License terms from prep.ai.mit.edu/pub/gnu/COPYING-2.0.\n\n//\n\n// Contact:\n\n// --------\n\n// Bernd Gaertner\n\n// Institut f. Informatik\n\n// ETH Zuerich\n\n// ETH-Zentrum\n\n// CH-8092 Zuerich, Switzerland\n\n// http://www.inf.ethz.ch/personal/gaertner\n\n//\n\n\n\n#endif\n", "file_path": "ExternalLibs/trimesh2/include/bsphere.h", "rank": 63, "score": 67328.55996081686 }, { "content": "template <int D, class T>\n\nvoid Miniball<D,T>::build(bool pivoting /* = true */)\n\n{\n\n\tB.reset();\n\n\tsupport_end = L.begin();\n\n\tif (pivoting)\n\n\t\tpivot_mb(L.end());\n\n\telse\n\n\t\tmtf_mb(L.end());\n\n}\n\n\n\n\n\n//\n\n// Original copyright of miniball code follows:\n\n//\n\n// Copright (C) 1999\n\n//\n\n// This program is free software; you can redistribute it and/or modify\n\n// it under the terms of the GNU General Public License as published by\n\n// the Free Software Foundation; either version 2 of the License, or\n", "file_path": "ExternalLibs/trimesh2/include/bsphere.h", "rank": 64, "score": 67328.55996081686 }, { "content": "\t// 3x3 color transform - matrix given in *row-major* order\n\n\tconst Color col_transform(float m11, float m12, float m13,\n\n\t\t\t\t float m21, float m22, float m23,\n\n\t\t\t\t float m31, float m32, float m33) const\n\n\t{\n\n\t\treturn Color(m11*v[0]+m12*v[1]+m13*v[2],\n\n\t\t\t m21*v[0]+m22*v[1]+m23*v[2],\n\n\t\t\t m31*v[0]+m32*v[1]+m33*v[2]);\n\n\t}\n\n\n\nprivate:\n\n\tconst Color hsv2srgb() const\n\n\t{\n\n\t\t// From FvD\n\n\t\tfloat H = v[0], S = v[1], V = v[2];\n\n\t\tif (S <= 0.0f)\n\n\t\t\treturn Color(V,V,V);\n\n\t\tH = fmod(H, float(2.0 * M_PI));\n\n\t\tif (H < 0.0f)\n\n\t\t\tH += float(2.0 * M_PI);\n", "file_path": "ExternalLibs/trimesh2/include/Color.h", "rank": 65, "score": 67328.55996081686 }, { "content": "\t\treturn *this;\n\n\t}\n\n\n\n\t// Set each component to min/max of this and the other vector\n\n\tVec<D,T> &min(const Vec<D,T> &x)\n\n\t{\n\n#pragma omp critical\n\n\t\tfor (int i = 0; i < D; i++)\n\n\t\t\tif (x[i] < v[i]) v[i] = x[i];\n\n\t\treturn *this;\n\n\t}\n\n\tVec<D,T> &max(const Vec<D,T> &x)\n\n\t{\n\n#pragma omp critical\n\n\t\tfor (int i = 0; i < D; i++)\n\n\t\t\tif (x[i] > v[i]) v[i] = x[i];\n\n\t\treturn *this;\n\n\t}\n\n\n\n\t// Outside of class: + - * / % ^ << >>\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 66, "score": 67328.55996081686 }, { "content": "\t\t\tcase XYZ:\n\n\t\t\t\treturn (dst == RGB) ? xyz2rgb() :\n\n\t\t\t\t\txyz2rgb().convert(RGB, dst);\n\n\t\t\tcase RGB:\n\n\t\t\t\treturn (dst == SRGB) ? rgb2srgb() :\n\n\t\t\t\t\trgb2srgb().convert(SRGB, dst);\n\n\t\t\tdefault:\n\n\t\t\t\treturn srgb2ycbcr();\n\n\t\t} else switch (src) {\n\n\t\t\tcase YCBCR:\n\n\t\t\t\treturn (dst == SRGB) ? ycbcr2srgb() :\n\n\t\t\t\t\tycbcr2srgb().convert(SRGB, dst);\n\n\t\t\tcase SRGB:\n\n\t\t\t\treturn (dst == RGB) ? srgb2rgb() :\n\n\t\t\t\t\tsrgb2rgb().convert(RGB, dst);\n\n\t\t\tcase RGB:\n\n\t\t\t\treturn (dst == XYZ) ? rgb2xyz() :\n\n\t\t\t\t\trgb2xyz().convert(XYZ, dst);\n\n\t\t\tdefault:\n\n\t\t\t\treturn xyz2cielab();\n", "file_path": "ExternalLibs/trimesh2/include/Color.h", "rank": 67, "score": 67328.55996081686 }, { "content": "\t\tz[m] *= T(2);\n\n \n\n\t\t// reject push if z_m too small\n\n\t\tif (z[m] < eps*current_sqr_r)\n\n\t\t\treturn false;\n\n \n\n\t\t// update c, sqr_r\n\n\t\tT e = -sqr_r[m-1];\n\n\t\tfor (i = 0; i < D; i++)\n\n\t\t\te += sqr(p[i] - c[m-1][i]);\n\n\t\tf[m] = e / z[m];\n\n \n\n\t\tfor (i = 0; i < D; i++)\n\n\t\t\tc[m][i] = c[m-1][i] + f[m]*v[m][i];\n\n\t\tsqr_r[m] = sqr_r[m-1] + e*f[m]*T(0.5);\n\n }\n\n current_c = c[m];\n\n current_sqr_r = sqr_r[m];\n\n s = ++m;\n\n return true;\n", "file_path": "ExternalLibs/trimesh2/include/bsphere.h", "rank": 68, "score": 67328.55996081686 }, { "content": "\t\t\tv[m][i] = p[i] - q0[i];\n\n \n\n\t\t// compute the a_{m,i}, i < m\n\n\t\tfor (i = 1; i < m; i++) {\n\n\t\t\ta[m][i] = 0;\n\n\t\t\tfor (j = 0; j < D; j++)\n\n\t\t\t\ta[m][i] += v[i][j] * v[m][j];\n\n\t\t\ta[m][i] *= (T(2) / z[i]);\n\n\t\t}\n\n \n\n\t\t// update v_m to Q_m-\\bar{Q}_m\n\n\t\tfor (i = 1; i < m; i++) {\n\n\t\t\tfor (j = 0; j < D; j++)\n\n\t\t\t\tv[m][j] -= a[m][i] * v[i][j];\n\n\t\t}\n\n \n\n\t\t// compute z_m\n\n\t\tz[m] = 0;\n\n\t\tfor (j = 0; j < D; j++)\n\n\t\t\tz[m] += sqr(v[m][j]);\n", "file_path": "ExternalLibs/trimesh2/include/bsphere.h", "rank": 69, "score": 67328.55996081686 }, { "content": "{\n\n\tsupport_end = L.begin();\n\n\tif (B.size() == D+1)\n\n\t\treturn;\n\n\tfor (It k = L.begin(); k != i; ) {\n\n\t\tIt j = k++;\n\n\t\tif (B.excess(*j) > 0) {\n\n\t\t\tif (B.push(*j)) {\n\n\t\t\t\tmtf_mb(j);\n\n\t\t\t\tB.pop();\n\n\t\t\t\tmove_to_front(j);\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\n\n\n\n\ntemplate <int D, class T>\n\nvoid Miniball<D,T>::pivot_mb(It i)\n\n{\n", "file_path": "ExternalLibs/trimesh2/include/bsphere.h", "rank": 70, "score": 67328.55996081686 }, { "content": "\t\t\t\treturn Color(srgb_nonlinearity(v[0]),\n\n\t\t\t\t\t srgb_nonlinearity(v[1]),\n\n\t\t\t\t\t srgb_nonlinearity(v[2]));\n\n\t\t\tdefault:\n\n\t\t\t\treturn Color(*this);\n\n\t\t}\n\n\t}\n\n\n\n\t// Nonlinear to linear - raises values to the power of g\n\n\tconst Color ungamma(float g) const\n\n\t{\n\n\t\treturn Color(pow(v[0],g), pow(v[1],g), pow(v[2],g));\n\n\t}\n\n\n\n\tconst Color ungamma(Colorspace dst) const\n\n\t{\n\n\t\tswitch (dst) {\n\n\t\t\tcase CIELAB:\n\n\t\t\t\treturn Color(inv_cielab_nonlinearity(v[0]),\n\n\t\t\t\t\t inv_cielab_nonlinearity(v[1]),\n", "file_path": "ExternalLibs/trimesh2/include/Color.h", "rank": 71, "score": 67328.55996081686 }, { "content": "\tif (unlikely(l <= T(0))) {\n\n\t\tv[0] = T(1);\n\n\t\tfor (int i = 1; i < D; i++)\n\n\t\t\tv[i] = T(0);\n\n\t\treturn v;\n\n\t}\n\n\n\n\tl = T(1) / l;\n\n\tfor (int i = 0; i < D; i++)\n\n\t\tv[i] *= l;\n\n\n\n\treturn v;\n\n}\n\n\n\n\n\n// Area-weighted triangle face normal\n\ntemplate <class T>\n\nstatic inline T trinorm(const T &v0, const T &v1, const T &v2)\n\n{\n\n\treturn (typename T::value_type) 0.5 * ((v1 - v0) CROSS (v2 - v0));\n", "file_path": "ExternalLibs/trimesh2/include/Vec.h", "rank": 72, "score": 67328.55996081686 }, { "content": "#include \"math.h\"\n\n#include <vector>\n\n#include <list>\n\n#include <map>\n\n#include <limits>\n\n#include <iostream>\n\n#include <fstream>\n\n\n\n// SHIREEN\n\n#include <iterator> // -- PM\n\n#include <vnl/vnl_math.h>\n\n#include <vnl/vnl_sparse_matrix.h>\n\n#include <vnl/algo/vnl_svd.h>\n\n#include <vnl/algo/vnl_sparse_lu.h>\n\n#include <vcl_legacy_aliases.h>\n\n\n\n//#define SHOW_WARNING 1\n\n\n\n#define NUM_THREADS 8\n\n\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh.h", "rank": 73, "score": 66285.69894069678 }, { "content": "\txf=xf * xf2;\t\t\t// Matrix-matrix multiplication\n\n\txf=inv(xf2);\t\t\t// Inverse\n\n\tvec v = xf * vec(1,2,3);\t// Matrix-vector multiplication\n\n\txf2=rot_only(xf);\t\t// Just the upper 3x3 of xf\n\n\txf2=trans_only(xf);\t\t// Just the translation of xf\n\n\txf2=norm_xf(xf);\t\t// Inverse transpose, no translation\n\n\tinvert(xf);\t\t\t// Inverts xform in place\n\n\torthogonalize(xf);\t\t// Makes matrix orthogonal\n\n\txf(1,2)=3.0;\t\t\t// Access by row/column\n\n\txf[4]=5.0;\t\t\t// Access in column-major order\n\n\txfname(\"file.ply\")\t\t// Returns string(\"file.xf\")\n\n*/\n\n\n\n#include \"lineqn.h\"\n\n#include <cmath>\n\n#include <algorithm>\n\n#include <iostream>\n\n#include <fstream>\n\n#include <string>\n\nusing std::min;\n\nusing std::max;\n\nusing std::swap;\n\nusing std::sqrt;\n\n\n\ntemplate <class T>\n", "file_path": "ExternalLibs/trimesh2/include/XForm.h", "rank": 74, "score": 66283.50570538893 }, { "content": "#ifdef MP_USE_OPENMP\n\n#include <omp.h> // -- PM\n\n#endif\n\n\n\n// end SHIREEN\n\n\n\n// Praful\n\n#include <vgl/algo/vgl_homg_operators_2d.h>\n\n#include <vgl/vgl_conic.h>\n\n#include <vnl/vnl_matrix.h>\n\n#include <vnl/vnl_vector.h>\n\n#include <vnl/algo/vnl_matrix_inverse.h>\n\n#include <string>\n\n#include <fstream>\n\n#include <cstdlib>\n\n\n\n#include <vcl_compiler.h>\n\n\n\n// Praful end\n\n\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh.h", "rank": 75, "score": 66280.43747655174 }, { "content": "\n\n// itk files to generate Face Index -- PM\n\n#include \"itkImage.h\"\n\n#include \"itkImageRegionConstIteratorWithIndex.h\"\n\n#include \"itkImageRegionIteratorWithIndex.h\"\n\n#include \"itkImageFileWriter.h\"\n\n#include \"itkTimeProbe.h\"\n\n#include \"itkResampleImageFilter.h\"\n\n#include \"itkIdentityTransform.h\"\n\n#include \"itkLinearInterpolateImageFunction.h\"\n\n#include \"itkBSplineInterpolateImageFunction.h\"\n\n// sets for the face index set\n\n#include <set>\n\n\n\n// Danny Perry's functor\n\n#include \"map.h\"\n\n\n\n///* Prateep */\n\n//// include alglib headers\n\n//#include \"alglib/ap.h\"\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh.h", "rank": 76, "score": 66280.3815230725 }, { "content": "//#include \"alglibinternal.h\"\n\n//#include \"alglibmisc.h\"\n\n//#include \"solvers.h\"\n\n//#include \"optimization.h\"\n\n//#include \"interpolation.h\"\n\n\n\ntypedef float PixelType;\n\n\n\n//using std::set; // -- PM\n\n\n\n// end SHIREEN\n\n\n\nusing std::vector;\n\nusing std::map;\n\n\n\n// SHIREEN\n\n#include <algorithm>\n\n\n\n#define PI 3.141592653589793\n\n\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh.h", "rank": 77, "score": 66280.21224950379 }, { "content": "#ifndef TRIMESH_H\n\n#define TRIMESH_H\n\n/*\n\nSzymon Rusinkiewicz\n\nPrinceton University\n\n\n\nTriMesh.h\n\nClass for triangle meshes.\n\n*/\n\n\n\n#define LARGENUM 10000000.0\n\n#define ONE 1\n\n#define CURVATURE 2\n\n#define NOISE 3\n\n#define SPEEDTYPE NOISE\n\n\n\n#include \"Vec.h\"\n\n#include \"Color.h\"\n\n#include \"math.h\"\n\n#include <vector>\n\n#include <list>\n\nusing std::vector;\n\n\n\n#define PI 3.1415927\n\n\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh2.h", "rank": 78, "score": 66279.85519823593 }, { "content": "#ifndef TRIMESH_H\n\n#define TRIMESH_H\n\n/*\n\nSzymon Rusinkiewicz\n\nPrinceton University\n\n\n\nTriMesh.h\n\nClass for triangle meshes.\n\n*/\n\n\n\n#define LARGENUM 10000000.0\n\n#define ONE 1 \n\n#define CURVATURE 2 \n\n#define NOISE 3\n\n#define EPS 1e-6\n\n//#define SPEEDTYPE ONE\n\n\n\n#include \"Vec.h\"\n\n#include \"Color.h\"\n\n#include \"KDtree.h\"\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh.h", "rank": 79, "score": 66279.31483577761 }, { "content": "/*\n\n * Copyright (c) 2013 University of Utah\n\n */\n\n\n\n#ifndef __ReduceFilter_H\n\n#define __ReduceFilter_H\n\n\n\n#include <itkImageToImageFilter.h>\n\n\n\ntemplate< \n", "file_path": "ExternalLibs/trimesh2/include/ReduceFilter.h", "rank": 80, "score": 66277.96484696813 }, { "content": "/*\n\n * Copyright (c) 2013 University of Utah\n\n */\n\n\n\n#ifndef __MapFilter_H\n\n#define __MapFilter_H\n\n\n\n#include <itkImageToImageFilter.h>\n\n\n\ntemplate< \n", "file_path": "ExternalLibs/trimesh2/include/MapFilter.h", "rank": 81, "score": 66277.96484696813 }, { "content": "#ifndef KDTREE_H\n\n#define KDTREE_H\n\n/*\n\nSzymon Rusinkiewicz\n\nPrinceton University\n\n\n\nKDtree.h\n\nA K-D tree for points, with limited capabilities (find nearest point to \n\na given point, or to a ray). \n\n*/\n\n\n\n#include <vector>\n\n\n", "file_path": "ExternalLibs/trimesh2/include/KDtree.h", "rank": 82, "score": 66277.54235809873 }, { "content": "\tT h = xf[3]*v[0] + xf[7]*v[1] + xf[11]*v[2] + xf[15];\n\n\th = T(1) / h;\n\n\n\n\treturn S(float(h*(xf[0]*v[0] + xf[4]*v[1] + xf[8]*v[2] + xf[12])),\n\n\t\t float(h*(xf[1]*v[0] + xf[5]*v[1] + xf[9]*v[2] + xf[13])),\n\n\t\t float(h*(xf[2]*v[0] + xf[6]*v[1] + xf[10]*v[2] + xf[14])));\n\n}\n\n\n\n// iostream operators\n\ntemplate <class T>\n\nstatic inline std::ostream &operator << (std::ostream &os, const XForm<T> &m)\n\n{\n\n\tfor (int i = 0; i < 4; i++) {\n\n\t\tfor (int j = 0; j < 4; j++) {\n\n\t\t\tos << m[i+4*j];\n\n\t\t\tif (j == 3)\n\n\t\t\t\tos << std::endl;\n\n\t\t\telse\n\n\t\t\t\tos << \" \";\n\n\t\t}\n", "file_path": "ExternalLibs/trimesh2/include/XForm.h", "rank": 83, "score": 66276.93076362945 }, { "content": " void SetFunctor(FType * f) { m_functor = f; }\n\n const FType * GetFunctor() const { return m_functor; }\n\n FType * GetFunctor() { return m_functor; }\n\n void SetRequestedRegion( const OutRegion & outRegion ){ m_region = outRegion; }\n\n\n\nprotected:\n\n MapFilter();\n\n virtual void AllocateOutputs();\n\n virtual void ThreadedGenerateData(const OutRegion & outputRegionForThread,\n\n itk::ThreadIdType threadId);\n\n\n\nprivate:\n\n FType * m_functor;\n\n OutRegion m_region;\n\n \n\n};\n\n\n\n#include \"MapFilter.hxx\" // implementation\n\n\n\n#endif\n", "file_path": "ExternalLibs/trimesh2/include/MapFilter.h", "rank": 84, "score": 66276.49602396411 }, { "content": " FType * GetFunctor() { return m_functor; }\n\n\n\n const OutType & GetResult() const { return m_result; }\n\n OutType & GetResult() { return m_result; }\n\n\n\nprotected:\n\n ReduceFilter();\n\n\n\n virtual void BeforeThreadedGenerateData();\n\n virtual void AllocateOutputs();\n\n virtual void ThreadedGenerateData(const InRegion & outputRegionForThread,\n\n itk::ThreadIdType threadId);\n\n virtual void AfterThreadedGenerateData();\n\n\n\nprivate:\n\n FType * m_functor;\n\n OutList m_list;\n\n OutType m_result;\n\n};\n\n\n\n#include \"ReduceFilter.hxx\" // implementation\n\n\n\n#endif\n", "file_path": "ExternalLibs/trimesh2/include/ReduceFilter.h", "rank": 85, "score": 66276.46649495444 }, { "content": " }\n\n }\n\n }\n\n }\n\n else\n\n {\n\n#if SHOW_WARNING\n\n std::cout << \"warning: using kdtree for triangle info because there is no face index map !!! ...\\n\" ;\n\n#endif\n\n\n\n // get vertex closest to first point - x\n\n int vertX = this->FindNearestVertex(x);\n\n unsigned int fNumber;\n\n\n\n // scan all adjacent faces to see which face (f) includes point x\n\n triangleX = this->faces[ this->adjacentfaces[vertX][0] ];\n\n faceID = this->adjacentfaces[vertX][0];\n\n for (fNumber = 0; fNumber < this->adjacentfaces[vertX].size(); fNumber++)\n\n {\n\n // check if face contains x and store barycentric coordinates for x in face f\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh.h", "rank": 86, "score": 66276.40849648166 }, { "content": " }\n\n }\n\n }\n\n else\n\n {\n\n#if SHOW_WARNING\n\n std::cout << \"warning: using kdtree for triangle info because there is no face index map !!! ...\\n\" ;\n\n#endif\n\n\n\n // get vertex closest to first point - x\n\n vertX = this->FindNearestVertex(x);\n\n\n\n // scan all adjacent faces to see which face (f) includes point x\n\n triangleX = this->faces[ this->adjacentfaces[vertX][0] ];\n\n for (unsigned int fNumber = 0; fNumber < this->adjacentfaces[vertX].size(); fNumber++)\n\n {\n\n // check if face contains x and store barycentric coordinates for x in face f\n\n triangleX = this->faces[ this->adjacentfaces[vertX][fNumber] ];\n\n vec barycentric = this->ComputeBarycentricCoordinates(x,triangleX);\n\n alphaX = barycentric[0];\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh.h", "rank": 87, "score": 66276.13814055776 }, { "content": " // get vertex closest to first point - x\n\n vertX = this->FindNearestVertex(x);\n\n\n\n // scan all adjacent faces to see which face (f) includes point x\n\n triangleX = this->faces[ this->adjacentfaces[vertX][0] ];\n\n for (unsigned int fNumber = 0; fNumber < this->adjacentfaces[vertX].size(); fNumber++)\n\n {\n\n // check if face contains x and store barycentric coordinates for x in face f\n\n triangleX = this->faces[ this->adjacentfaces[vertX][fNumber] ];\n\n vec barycentric = this->ComputeBarycentricCoordinates(x,triangleX);\n\n alphaX = barycentric[0];\n\n betaX = barycentric[1];\n\n gammaX = barycentric[2];\n\n\n\n if ( ( ( barycentric[0] >= 0 ) && ( barycentric[0] <= 1 ) ) &&\n\n ( ( barycentric[1] >= 0 ) && ( barycentric[1] <= 1 ) ) &&\n\n ( ( barycentric[2] >= 0 ) && ( barycentric[2] <= 1 ) ) )\n\n {\n\n fNumber = this->adjacentfaces[vertX].size();\n\n }\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh.h", "rank": 88, "score": 66276.01409037704 }, { "content": " // get vertex closest to first point - x\n\n int vertX = this->FindNearestVertex(x);\n\n\n\n // scan all adjacent faces to see which face (f) includes point x\n\n triangleX = this->faces[ this->adjacentfaces[vertX][0] ];\n\n for (unsigned int fNumber = 0; fNumber < this->adjacentfaces[vertX].size(); fNumber++)\n\n {\n\n // check if face contains x and store barycentric coordinates for x in face f\n\n triangleX = this->faces[ this->adjacentfaces[vertX][fNumber] ];\n\n faceID = this->adjacentfaces[vertX][fNumber] ;\n\n vec barycentric = this->ComputeBarycentricCoordinates(x,triangleX);\n\n alphaX = barycentric[0];\n\n betaX = barycentric[1];\n\n gammaX = barycentric[2];\n\n\n\n if ( ( ( barycentric[0] >= 0 ) && ( barycentric[0] <= 1 ) ) &&\n\n ( ( barycentric[1] >= 0 ) && ( barycentric[1] <= 1 ) ) &&\n\n ( ( barycentric[2] >= 0 ) && ( barycentric[2] <= 1 ) ) )\n\n {\n\n fNumber = this->adjacentfaces[vertX].size();\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh.h", "rank": 89, "score": 66275.85143416877 }, { "content": "\t\txf1[ 1]*xf2[ 4]+xf1[ 5]*xf2[ 5]+xf1[ 9]*xf2[ 6]+xf1[13]*xf2[ 7],\n\n\t\txf1[ 2]*xf2[ 4]+xf1[ 6]*xf2[ 5]+xf1[10]*xf2[ 6]+xf1[14]*xf2[ 7],\n\n\t\txf1[ 3]*xf2[ 4]+xf1[ 7]*xf2[ 5]+xf1[11]*xf2[ 6]+xf1[15]*xf2[ 7],\n\n\t\txf1[ 0]*xf2[ 8]+xf1[ 4]*xf2[ 9]+xf1[ 8]*xf2[10]+xf1[12]*xf2[11],\n\n\t\txf1[ 1]*xf2[ 8]+xf1[ 5]*xf2[ 9]+xf1[ 9]*xf2[10]+xf1[13]*xf2[11],\n\n\t\txf1[ 2]*xf2[ 8]+xf1[ 6]*xf2[ 9]+xf1[10]*xf2[10]+xf1[14]*xf2[11],\n\n\t\txf1[ 3]*xf2[ 8]+xf1[ 7]*xf2[ 9]+xf1[11]*xf2[10]+xf1[15]*xf2[11],\n\n\t\txf1[ 0]*xf2[12]+xf1[ 4]*xf2[13]+xf1[ 8]*xf2[14]+xf1[12]*xf2[15],\n\n\t\txf1[ 1]*xf2[12]+xf1[ 5]*xf2[13]+xf1[ 9]*xf2[14]+xf1[13]*xf2[15],\n\n\t\txf1[ 2]*xf2[12]+xf1[ 6]*xf2[13]+xf1[10]*xf2[14]+xf1[14]*xf2[15],\n\n\t\txf1[ 3]*xf2[12]+xf1[ 7]*xf2[13]+xf1[11]*xf2[14]+xf1[15]*xf2[15]\n\n\t);\n\n}\n\n\n\n\n\n// Component-wise equality and inequality (#include the usual caveats\n\n// about comparing floats for equality...)\n\ntemplate <class T>\n\nstatic inline bool operator == (const XForm<T> &xf1, const XForm<T> &xf2)\n\n{\n", "file_path": "ExternalLibs/trimesh2/include/XForm.h", "rank": 90, "score": 66275.23895274666 }, { "content": " {}\n\n\n\n // Mark invalid\n\n void clear()\n\n {\n\n min = point(std::numeric_limits<float>::max(),\n\n std::numeric_limits<float>::max(),\n\n std::numeric_limits<float>::max());\n\n max = point(std::numeric_limits<float>::min(),\n\n std::numeric_limits<float>::min(),\n\n std::numeric_limits<float>::min());\n\n valid = false;\n\n }\n\n\n\n // Return center point and (vector) diagonal\n\n point center() const { return 0.5f * (min+max); }\n\n vec size() const { return max - min; }\n\n\n\n // Grow a bounding box to encompass a point\n\n BBox &operator += (const point &p)\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh.h", "rank": 91, "score": 66271.6173335092 }, { "content": "\n\n std::cout << \"Iteratio : \" << ITER_BLOCK << std::endl;\n\n\n\n typedef itk::ImageRegionConstIteratorWithIndex<TIn> It;\n\n It itI(in, threadRegion);\n\n\n\n for(itI.GoToBegin(); !itI.IsAtEnd(); ++itI)\n\n {\n\n if(itI.Get() == 1)\n\n {\n\n point tmPoint;\n\n itk::Image<PixelType, 3>::PointType itkPoint;\n\n in->TransformIndexToPhysicalPoint(itI.GetIndex(), itkPoint);\n\n for(int i = 0; i < 3; i++) { tmPoint[i] = itkPoint[i]; }\n\n\n\n // Get neartest vertex\n\n const float *match = kd->closest_to_pt( tmPoint, 10.0 * sqr( mesh.getMaximumEdgeLength() ) );\n\n if(!match)\n\n {\n\n out_->SetPixel(itI.GetIndex(), -1);\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh.h", "rank": 92, "score": 66271.6173335092 }, { "content": " }\n\n out_->SetPixel(itI.GetIndex(), fid);\n\n adjFaces.clear();\n\n }\n\n } else {\n\n out_->SetPixel(itI.GetIndex(), -1);\n\n }\n\n\n\n }\n\n }\n\n};\n\n\n\n\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh.h", "rank": 93, "score": 66271.6173335092 }, { "content": " vector<int> adjFaces; adjFaces.clear();\n\n vector<int>::iterator adjFacesIt;\n\n // find triangles enclosed inside each supervoxel\n\n int tmpInd = mesh.physicalPointToLinearIndex(tmPoint, supVoxelOrigin, supVoxelSpacing, supVoxelSize);\n\n\n\n for(vector<int>::iterator it = superVoxelFaceList[tmpInd].begin(); it != superVoxelFaceList[tmpInd].end(); it++) {\n\n adjFaces.push_back((*it));\n\n }\n\n\n\n // std::cout << \"Number of neighbors : \" << adjFaces.size() << std::endl;\n\n if(adjFaces.empty() )\n\n {\n\n // We can either abort here or ignore the voxel\n\n // typename TIn::IndexType ind = itI.GetIndex();\n\n // std::cout << \"-1 : \" << ind[0] << ' ' << ind[1] << ' ' << ind[2] << std::endl;\n\n out_->SetPixel(itI.GetIndex(), -1);\n\n } else {\n\n\n\n //std::cout << \"Adjacent faces : \" << this->adjacentfaces[imatch].size() << std::endl;\n\n double minDist = LARGENUM;\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh.h", "rank": 94, "score": 66271.6173335092 }, { "content": " int fid = -1;\n\n for(adjFacesIt = adjFaces.begin(); adjFacesIt != adjFaces.end(); adjFacesIt++) {\n\n point projPoint;\n\n double dist = mesh.pointTriangleDistance(tmPoint, mesh.faces[*(adjFacesIt)], projPoint);\n\n if(dist + EPS <= minDist) {\n\n minDist = dist;\n\n fid = *(adjFacesIt);\n\n }\n\n }\n\n out_->SetPixel(itI.GetIndex(), fid);\n\n adjFaces.clear();\n\n }\n\n\n\n } else {\n\n // typename TIn::IndexType ind = itI.GetIndex();\n\n // std::cout << \"-1 : \" << ind[0] << ' ' << ind[1] << ' ' << ind[2] << std::endl;\n\n out_->SetPixel(itI.GetIndex(), -1);\n\n }\n\n\n\n }\n\n }\n\n};\n\n\n\n/* Prateep */\n\ntemplate<class TIn, class TOut, class Mesh>\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh.h", "rank": 95, "score": 66271.6173335092 }, { "content": "#ifndef MIN\n\n#define MIN(a,b) ((a)<(b))?(a):(b)\n\n#endif\n\n\n\n#ifndef MAX\n\n#define MAX(a,b) ((a)>(b))?(a):(b)\n\n#endif\n\n\n\nstatic int ITER_BLOCK = 0;\n\n\n\n/*Prateep */\n\ntemplate<class TIn, class TOut, class Mesh>\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh.h", "rank": 96, "score": 66271.6173335092 }, { "content": " } else {\n\n int imatch = (match - (const float*) &(mesh.vertices[0][0])) / 3;\n\n //std::cout << \"Adjacent faces : \" << mesh.adjacentfaces[imatch].size() << std::endl;\n\n vector<int> adjFaces; adjFaces.clear();\n\n vector<int>::iterator adjFacesIt;\n\n // Check one-ring to get list of adjacent faces\n\n for(size_t f = 0; f < mesh.adjacentfaces[imatch].size(); f++)\n\n {\n\n adjFaces.push_back(mesh.adjacentfaces[imatch][f]);\n\n }\n\n\n\n int fid = 0;\n\n double minDist = LARGENUM;\n\n for(adjFacesIt = adjFaces.begin(); adjFacesIt != adjFaces.end(); adjFacesIt++) {\n\n point projPoint;\n\n double dist = mesh.pointTriangleDistance(tmPoint, mesh.faces[*(adjFacesIt)], projPoint);\n\n if(dist + EPS <= minDist) {\n\n minDist = dist;\n\n fid = *(adjFacesIt);\n\n }\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh.h", "rank": 97, "score": 66271.6173335092 }, { "content": " }\n\n int &operator[] (int i) { return v[i]; }\n\n const int &operator[] (int i) const { return v[i]; }\n\n operator const int * () const { return &(v[0]); }\n\n operator const int * () { return &(v[0]); }\n\n operator int * () { return &(v[0]); }\n\n int indexof(int v_) const\n\n {\n\n return (v[0] == v_) ? 0 :\n\n (v[1] == v_) ? 1 :\n\n (v[2] == v_) ? 2 : -1;\n\n }\n\n };\n\n\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh.h", "rank": 98, "score": 66271.6173335092 }, { "content": "\n\n void operator()(const TInP &in, const OutRegion & threadRegion)\n\n {\n\n ITER_BLOCK = ITER_BLOCK + 1;\n\n\n\n std::cout << \"Iteration : \" << ITER_BLOCK << std::endl;\n\n\n\n typedef itk::ImageRegionConstIteratorWithIndex<TIn> It;\n\n It itI(in, threadRegion);\n\n\n\n for(itI.GoToBegin(); !itI.IsAtEnd(); ++itI) {\n\n\n\n if(itI.Get() == 1)\n\n {\n\n point tmPoint;\n\n typename TIn::PointType itkPoint;\n\n in->TransformIndexToPhysicalPoint(itI.GetIndex(), itkPoint);\n\n for(int i = 0; i < 3; i++) { tmPoint[i] = itkPoint[i]; }\n\n\n\n // Get neartest k vertices\n", "file_path": "ExternalLibs/trimesh2/include/TriMesh.h", "rank": 99, "score": 66271.6173335092 } ]
C++
owGame/M2/M2_AnimatorComponent.cpp
Chaos192/OpenWow
1d91a51fafeedadc67122a3e9372ec4637a48434
#include "stdafx.h" #include "M2.h" #include "M2_Base_Instance.h" #include "M2_AnimatorComponent.h" CM2AnimatorComponent::CM2AnimatorComponent(const CM2_Base_Instance& OwnerNode) : CSceneNodeComponentBase(OwnerNode) , m_CurrentAnimationID(EAnimationID::Stand) , m_CurrentAnimation(nullptr) , m_IsLoop(false) , m_IsStopped(false) , m_AnimTime(0.0) , m_CurrentTime(0) { } CM2AnimatorComponent::~CM2AnimatorComponent() { } void CM2AnimatorComponent::LoadAnimations() { const auto& sequences = GetM2OwnerNode().GetM2().getSkeleton().GetSequences(); for (uint16 j = 0; j < sequences.size(); j++) { const auto& sequence = sequences[j]; if (sequence.variationIndex == 0) { const DBC_AnimationDataRecord* dbcAnimationRecord = GetBaseManager().GetManager<CDBCStorage>()->DBC_AnimationData()[sequence.__animID]; if (dbcAnimationRecord == nullptr) throw CException("CM2AnimatorComponent::CM2AnimatorComponent: Sequence '%d' not found in 'DBC_AnimationData'.", sequence.__animID); m_Animations.insert(std::make_pair(sequence.__animID, MakeShared(CM2_Animation, GetM2OwnerNode().GetM2(), sequence, dbcAnimationRecord->Get_Name(), j))); } } _ASSERT(m_Animations.size() > 0); PlayAnimation(m_CurrentAnimationID, true); } void CM2AnimatorComponent::PlayAnimation(EAnimationID AnimationId, bool Loop) { if (Loop && m_CurrentAnimationID == AnimationId && m_CurrentAnimation && m_CurrentAnimation->getAnimID() == AnimationId) return; const auto& animIt = m_Animations.find((uint16)AnimationId); if (animIt != m_Animations.end()) { m_CurrentAnimationID = AnimationId; m_CurrentAnimation = animIt->second.get(); } else { m_CurrentAnimationID = EAnimationID::Stand; m_CurrentAnimation = m_Animations.begin()->second.get(); } m_IsLoop = Loop; m_IsStopped = false; m_AnimTime = 0.0; m_CurrentTime = m_CurrentAnimation->getStart(); } void CM2AnimatorComponent::SetAnimationEventListener(std::shared_ptr<IM2AnimationEventsListener> M2AnimationEventListener) { m_M2AnimationEventListener = M2AnimationEventListener; } void CM2AnimatorComponent::PrintList() { for (auto& it : m_Animations) { Log::Warn("[%d] is [%s]", it.first, it.second->getAnimationName().c_str()); } } void CM2AnimatorComponent::Update(const UpdateEventArgs & e) { if (m_CurrentAnimation == nullptr) return; if (m_IsStopped) return; m_AnimTime += e.DeltaTime; m_CurrentTime = m_CurrentAnimation->getStart() + static_cast<uint32>(m_AnimTime); if (m_CurrentTime < m_CurrentAnimation->getEnd()) { return; } if (auto animationEventListener = m_M2AnimationEventListener.lock()) animationEventListener->OnAnimationEnded(m_CurrentAnimationID); if (m_IsLoop) { m_IsStopped = false; m_AnimTime = 0.0; m_CurrentTime = m_CurrentAnimation->getStart(); } else { m_IsStopped = true; m_AnimTime = 0.0; m_CurrentTime = m_CurrentAnimation->getEnd() - 1; } } const CM2_Base_Instance & CM2AnimatorComponent::GetM2OwnerNode() const { return dynamic_cast<const CM2_Base_Instance&>(GetOwnerNode()); }
#include "stdafx.h" #include "M2.h" #include "M2_Base_Instance.h" #include "M2_AnimatorComponent.h" CM2AnimatorComponent::CM2AnimatorComponent(const CM2_Base_Instance& OwnerNode) : CSceneNodeComponentBase(OwnerNode) , m_CurrentAnimationID(EAnimationID::Stand) , m_CurrentAnimation(nullptr) , m_IsLoop(false) , m_IsStopped(false) , m_AnimTime(0.0) , m_CurrentTime(0) { } CM2AnimatorComponent::~CM2AnimatorComponent() { } void CM2AnimatorComponent::LoadAnimations() { const auto& sequences = GetM2OwnerNode().GetM2().getSkeleton().GetSequences(); for (uint16 j = 0; j < sequences.size(); j++) { const auto& sequence = sequences[j]; if (sequence.variationIndex == 0) { const DBC_AnimationDataRecord* dbcAnimationRecord = GetBaseManager().GetManager<CDBCStorage>()->DBC_AnimationData()[sequence.__animID]; if (dbcAnimationRecord == nullptr) throw CException("CM2AnimatorComponent::CM2AnimatorComponent: Sequence '%d' not found in 'DBC_AnimationData'.", sequence.__animID); m_Animations.insert(std::make_pair(sequence.__animID, MakeShared(CM2_Animation, GetM2OwnerNode().GetM2(), sequence, dbcAnimationRecord->Get_Name(), j))); } } _ASSERT(m_Animations.size() > 0); PlayAnimation(m_CurrentAnimationID, true); } void CM2AnimatorComponent::PlayAnimation(EAnimationID AnimationId, bool Loop) { if (Loop && m_CurrentAnimationID == AnimationId && m_CurrentAnimation && m_CurrentAnimation->getAnimID() == AnimationId) return; const auto& animIt = m_Animations.find((uint16)AnimationId); if (animIt != m_Animations.end()) { m_CurrentAnimationID = AnimationId; m_CurrentAnimation = animIt->second.get(); } else { m_CurrentAnimationID = EAnimationID::Stand; m_CurrentAnimation = m_Animations.begin()->second.get(); } m_IsLoop = Loop; m_IsStopped = false; m_AnimTime = 0.0; m_CurrentTime = m_CurrentAnimation->getStart(); } void CM2AnimatorComponent::SetAnimationEventListener(std::shared_ptr<IM2AnimationEventsListener> M2AnimationEventListener) { m_M2AnimationEventListener = M2AnimationEventListener; } void CM2AnimatorComponent::PrintList() { for (auto& it : m_Animations) { Log::Warn("[%d] is [%s]", it.first, it.second->getAnimationName().c_str()); } }
const CM2_Base_Instance & CM2AnimatorComponent::GetM2OwnerNode() const { return dynamic_cast<const CM2_Base_Instance&>(GetOwnerNode()); }
void CM2AnimatorComponent::Update(const UpdateEventArgs & e) { if (m_CurrentAnimation == nullptr) return; if (m_IsStopped) return; m_AnimTime += e.DeltaTime; m_CurrentTime = m_CurrentAnimation->getStart() + static_cast<uint32>(m_AnimTime); if (m_CurrentTime < m_CurrentAnimation->getEnd()) { return; } if (auto animationEventListener = m_M2AnimationEventListener.lock()) animationEventListener->OnAnimationEnded(m_CurrentAnimationID); if (m_IsLoop) { m_IsStopped = false; m_AnimTime = 0.0; m_CurrentTime = m_CurrentAnimation->getStart(); } else { m_IsStopped = true; m_AnimTime = 0.0; m_CurrentTime = m_CurrentAnimation->getEnd() - 1; } }
function_block-full_function
[ { "content": "enum Opcodes : uint16\n\n{\n\n\tNULL_ACTION = 0x000,\n\n\tCMSG_BOOTME = 0x001,\n\n\tCMSG_DBLOOKUP = 0x002,\n\n\tSMSG_DBLOOKUP = 0x003,\n\n\tCMSG_QUERY_OBJECT_POSITION = 0x004,\n\n\tSMSG_QUERY_OBJECT_POSITION = 0x005,\n\n\tCMSG_QUERY_OBJECT_ROTATION = 0x006,\n\n\tSMSG_QUERY_OBJECT_ROTATION = 0x007,\n\n\tCMSG_WORLD_TELEPORT = 0x008,\n\n\tCMSG_TELEPORT_TO_UNIT = 0x009,\n\n\tCMSG_ZONE_MAP = 0x00A,\n\n\tSMSG_ZONE_MAP = 0x00B,\n\n\tCMSG_DEBUG_CHANGECELLZONE = 0x00C,\n\n\tCMSG_MOVE_CHARACTER_CHEAT = 0x00D,\n\n\tSMSG_MOVE_CHARACTER_CHEAT = 0x00E,\n\n\tCMSG_RECHARGE = 0x00F,\n\n\tCMSG_LEARN_SPELL = 0x010,\n\n\tCMSG_CREATEMONSTER = 0x011,\n\n\tCMSG_DESTROYMONSTER = 0x012,\n\n\tCMSG_CREATEITEM = 0x013,\n\n\tCMSG_CREATEGAMEOBJECT = 0x014,\n\n\tSMSG_CHECK_FOR_BOTS = 0x015,\n\n\tCMSG_MAKEMONSTERATTACKGUID = 0x016,\n\n\tCMSG_BOT_DETECTED2 = 0x017,\n\n\tCMSG_FORCEACTION = 0x018,\n\n\tCMSG_FORCEACTIONONOTHER = 0x019,\n\n\tCMSG_FORCEACTIONSHOW = 0x01A,\n\n\tSMSG_FORCEACTIONSHOW = 0x01B,\n\n\tCMSG_PETGODMODE = 0x01C,\n\n\tSMSG_PETGODMODE = 0x01D,\n\n\tSMSG_REFER_A_FRIEND_EXPIRED = 0x01E,\n\n\tCMSG_WEATHER_SPEED_CHEAT = 0x01F,\n\n\tCMSG_UNDRESSPLAYER = 0x020,\n\n\tCMSG_BEASTMASTER = 0x021,\n\n\tCMSG_GODMODE = 0x022,\n\n\tSMSG_GODMODE = 0x023,\n\n\tCMSG_CHEAT_SETMONEY = 0x024,\n\n\tCMSG_LEVEL_CHEAT = 0x025,\n\n\tCMSG_PET_LEVEL_CHEAT = 0x026,\n\n\tCMSG_SET_WORLDSTATE = 0x027,\n\n\tCMSG_COOLDOWN_CHEAT = 0x028,\n\n\tCMSG_USE_SKILL_CHEAT = 0x029,\n\n\tCMSG_FLAG_QUEST = 0x02A,\n\n\tCMSG_FLAG_QUEST_FINISH = 0x02B,\n\n\tCMSG_CLEAR_QUEST = 0x02C,\n\n\tCMSG_SEND_EVENT = 0x02D,\n\n\tCMSG_DEBUG_AISTATE = 0x02E,\n\n\tSMSG_DEBUG_AISTATE = 0x02F,\n\n\tCMSG_DISABLE_PVP_CHEAT = 0x030,\n\n\tCMSG_ADVANCE_SPAWN_TIME = 0x031,\n\n\tSMSG_DESTRUCTIBLE_BUILDING_DAMAGE = 0x032,\n\n\tCMSG_AUTH_SRP6_BEGIN = 0x033,\n\n\tCMSG_AUTH_SRP6_PROOF = 0x034,\n\n\tCMSG_AUTH_SRP6_RECODE = 0x035,\n\n\tCMSG_CHAR_CREATE = 0x036,\n\n\tCMSG_CHAR_ENUM = 0x037,\n\n\tCMSG_CHAR_DELETE = 0x038,\n\n\tSMSG_AUTH_SRP6_RESPONSE = 0x039,\n\n\tSMSG_CHAR_CREATE = 0x03A,\n\n\tSMSG_CHAR_ENUM = 0x03B,\n\n\tSMSG_CHAR_DELETE = 0x03C,\n\n\tCMSG_PLAYER_LOGIN = 0x03D,\n\n\tSMSG_NEW_WORLD = 0x03E,\n\n\tSMSG_TRANSFER_PENDING = 0x03F,\n\n\tSMSG_TRANSFER_ABORTED = 0x040,\n\n\tSMSG_CHARACTER_LOGIN_FAILED = 0x041,\n\n\tSMSG_LOGIN_SET_TIME_SPEED = 0x042,\n\n\tSMSG_GAMETIME_UPDATE = 0x043,\n\n\tCMSG_GAMETIME_SET = 0x044,\n\n\tSMSG_GAMETIME_SET = 0x045,\n\n\tCMSG_GAMESPEED_SET = 0x046,\n\n\tSMSG_GAMESPEED_SET = 0x047,\n\n\tCMSG_SERVERTIME = 0x048,\n\n\tSMSG_SERVERTIME = 0x049,\n\n\tCMSG_PLAYER_LOGOUT = 0x04A,\n\n\tCMSG_LOGOUT_REQUEST = 0x04B,\n\n\tSMSG_LOGOUT_RESPONSE = 0x04C,\n\n\tSMSG_LOGOUT_COMPLETE = 0x04D,\n\n\tCMSG_LOGOUT_CANCEL = 0x04E,\n\n\tSMSG_LOGOUT_CANCEL_ACK = 0x04F,\n\n\tCMSG_NAME_QUERY = 0x050,\n\n\tSMSG_NAME_QUERY_RESPONSE = 0x051,\n\n\tCMSG_PET_NAME_QUERY = 0x052,\n\n\tSMSG_PET_NAME_QUERY_RESPONSE = 0x053,\n\n\tCMSG_GUILD_QUERY = 0x054,\n\n\tSMSG_GUILD_QUERY_RESPONSE = 0x055,\n\n\tCMSG_ITEM_QUERY_SINGLE = 0x056,\n\n\tCMSG_ITEM_QUERY_MULTIPLE = 0x057,\n\n\tSMSG_ITEM_QUERY_SINGLE_RESPONSE = 0x058,\n\n\tSMSG_ITEM_QUERY_MULTIPLE_RESPONSE = 0x059,\n\n\tCMSG_PAGE_TEXT_QUERY = 0x05A,\n\n\tSMSG_PAGE_TEXT_QUERY_RESPONSE = 0x05B,\n\n\tCMSG_QUEST_QUERY = 0x05C,\n\n\tSMSG_QUEST_QUERY_RESPONSE = 0x05D,\n\n\tCMSG_GAMEOBJECT_QUERY = 0x05E,\n\n\tSMSG_GAMEOBJECT_QUERY_RESPONSE = 0x05F,\n\n\tCMSG_CREATURE_QUERY = 0x060,\n\n\tSMSG_CREATURE_QUERY_RESPONSE = 0x061,\n\n\tCMSG_WHO = 0x062,\n\n\tSMSG_WHO = 0x063,\n\n\tCMSG_WHOIS = 0x064,\n\n\tSMSG_WHOIS = 0x065,\n\n\tCMSG_CONTACT_LIST = 0x066,\n\n\tSMSG_CONTACT_LIST = 0x067,\n\n\tSMSG_FRIEND_STATUS = 0x068,\n\n\tCMSG_ADD_FRIEND = 0x069,\n\n\tCMSG_DEL_FRIEND = 0x06A,\n\n\tCMSG_SET_CONTACT_NOTES = 0x06B,\n\n\tCMSG_ADD_IGNORE = 0x06C,\n\n\tCMSG_DEL_IGNORE = 0x06D,\n\n\tCMSG_GROUP_INVITE = 0x06E,\n\n\tSMSG_GROUP_INVITE = 0x06F,\n\n\tCMSG_GROUP_CANCEL = 0x070,\n\n\tSMSG_GROUP_CANCEL = 0x071,\n\n\tCMSG_GROUP_ACCEPT = 0x072,\n\n\tCMSG_GROUP_DECLINE = 0x073,\n\n\tSMSG_GROUP_DECLINE = 0x074,\n\n\tCMSG_GROUP_UNINVITE = 0x075,\n\n\tCMSG_GROUP_UNINVITE_GUID = 0x076,\n\n\tSMSG_GROUP_UNINVITE = 0x077,\n\n\tCMSG_GROUP_SET_LEADER = 0x078,\n\n\tSMSG_GROUP_SET_LEADER = 0x079,\n\n\tCMSG_LOOT_METHOD = 0x07A,\n\n\tCMSG_GROUP_DISBAND = 0x07B,\n\n\tSMSG_GROUP_DESTROYED = 0x07C,\n\n\tSMSG_GROUP_LIST = 0x07D,\n\n\tSMSG_PARTY_MEMBER_STATS = 0x07E,\n\n\tSMSG_PARTY_COMMAND_RESULT = 0x07F,\n\n\tUMSG_UPDATE_GROUP_MEMBERS = 0x080,\n\n\tCMSG_GUILD_CREATE = 0x081,\n\n\tCMSG_GUILD_INVITE = 0x082,\n\n\tSMSG_GUILD_INVITE = 0x083,\n\n\tCMSG_GUILD_ACCEPT = 0x084,\n\n\tCMSG_GUILD_DECLINE = 0x085,\n\n\tSMSG_GUILD_DECLINE = 0x086,\n\n\tCMSG_GUILD_INFO = 0x087,\n\n\tSMSG_GUILD_INFO = 0x088,\n\n\tCMSG_GUILD_ROSTER = 0x089,\n\n\tSMSG_GUILD_ROSTER = 0x08A,\n\n\tCMSG_GUILD_PROMOTE = 0x08B,\n\n\tCMSG_GUILD_DEMOTE = 0x08C,\n\n\tCMSG_GUILD_LEAVE = 0x08D,\n\n\tCMSG_GUILD_REMOVE = 0x08E,\n\n\tCMSG_GUILD_DISBAND = 0x08F,\n\n\tCMSG_GUILD_LEADER = 0x090,\n\n\tCMSG_GUILD_MOTD = 0x091,\n\n\tSMSG_GUILD_EVENT = 0x092,\n\n\tSMSG_GUILD_COMMAND_RESULT = 0x093,\n\n\tUMSG_UPDATE_GUILD = 0x094,\n\n\tCMSG_MESSAGECHAT = 0x095,\n\n\tSMSG_MESSAGECHAT = 0x096,\n\n\tCMSG_JOIN_CHANNEL = 0x097,\n\n\tCMSG_LEAVE_CHANNEL = 0x098,\n\n\tSMSG_CHANNEL_NOTIFY = 0x099,\n\n\tCMSG_CHANNEL_LIST = 0x09A,\n\n\tSMSG_CHANNEL_LIST = 0x09B,\n\n\tCMSG_CHANNEL_PASSWORD = 0x09C,\n\n\tCMSG_CHANNEL_SET_OWNER = 0x09D,\n\n\tCMSG_CHANNEL_OWNER = 0x09E,\n\n\tCMSG_CHANNEL_MODERATOR = 0x09F,\n\n\tCMSG_CHANNEL_UNMODERATOR = 0x0A0,\n\n\tCMSG_CHANNEL_MUTE = 0x0A1,\n\n\tCMSG_CHANNEL_UNMUTE = 0x0A2,\n\n\tCMSG_CHANNEL_INVITE = 0x0A3,\n\n\tCMSG_CHANNEL_KICK = 0x0A4,\n\n\tCMSG_CHANNEL_BAN = 0x0A5,\n\n\tCMSG_CHANNEL_UNBAN = 0x0A6,\n\n\tCMSG_CHANNEL_ANNOUNCEMENTS = 0x0A7,\n\n\tCMSG_CHANNEL_MODERATE = 0x0A8,\n\n\tSMSG_UPDATE_OBJECT = 0x0A9,\n\n\tSMSG_DESTROY_OBJECT = 0x0AA,\n\n\tCMSG_USE_ITEM = 0x0AB,\n\n\tCMSG_OPEN_ITEM = 0x0AC,\n\n\tCMSG_READ_ITEM = 0x0AD,\n\n\tSMSG_READ_ITEM_OK = 0x0AE,\n\n\tSMSG_READ_ITEM_FAILED = 0x0AF,\n\n\tSMSG_ITEM_COOLDOWN = 0x0B0,\n\n\tCMSG_GAMEOBJ_USE = 0x0B1,\n\n\tCMSG_DESTROY_ITEMS = 0x0B2,\n\n\tSMSG_GAMEOBJECT_CUSTOM_ANIM = 0x0B3,\n\n\tCMSG_AREATRIGGER = 0x0B4,\n\n\tMSG_MOVE_START_FORWARD = 0x0B5,\n\n\tMSG_MOVE_START_BACKWARD = 0x0B6,\n\n\tMSG_MOVE_STOP = 0x0B7,\n\n\tMSG_MOVE_START_STRAFE_LEFT = 0x0B8,\n\n\tMSG_MOVE_START_STRAFE_RIGHT = 0x0B9,\n\n\tMSG_MOVE_STOP_STRAFE = 0x0BA,\n\n\tMSG_MOVE_JUMP = 0x0BB,\n\n\tMSG_MOVE_START_TURN_LEFT = 0x0BC,\n\n\tMSG_MOVE_START_TURN_RIGHT = 0x0BD,\n\n\tMSG_MOVE_STOP_TURN = 0x0BE,\n\n\tMSG_MOVE_START_PITCH_UP = 0x0BF,\n\n\tMSG_MOVE_START_PITCH_DOWN = 0x0C0,\n\n\tMSG_MOVE_STOP_PITCH = 0x0C1,\n\n\tMSG_MOVE_SET_RUN_MODE = 0x0C2,\n\n\tMSG_MOVE_SET_WALK_MODE = 0x0C3,\n\n\tMSG_MOVE_TOGGLE_LOGGING = 0x0C4,\n\n\tMSG_MOVE_TELEPORT = 0x0C5,\n\n\tMSG_MOVE_TELEPORT_CHEAT = 0x0C6,\n\n\tMSG_MOVE_TELEPORT_ACK = 0x0C7,\n\n\tMSG_MOVE_TOGGLE_FALL_LOGGING = 0x0C8,\n\n\tMSG_MOVE_FALL_LAND = 0x0C9,\n\n\tMSG_MOVE_START_SWIM = 0x0CA,\n\n\tMSG_MOVE_STOP_SWIM = 0x0CB,\n\n\tMSG_MOVE_SET_RUN_SPEED_CHEAT = 0x0CC,\n\n\tMSG_MOVE_SET_RUN_SPEED = 0x0CD,\n\n\tMSG_MOVE_SET_RUN_BACK_SPEED_CHEAT = 0x0CE,\n\n\tMSG_MOVE_SET_RUN_BACK_SPEED = 0x0CF,\n\n\tMSG_MOVE_SET_WALK_SPEED_CHEAT = 0x0D0,\n\n\tMSG_MOVE_SET_WALK_SPEED = 0x0D1,\n\n\tMSG_MOVE_SET_SWIM_SPEED_CHEAT = 0x0D2,\n\n\tMSG_MOVE_SET_SWIM_SPEED = 0x0D3,\n\n\tMSG_MOVE_SET_SWIM_BACK_SPEED_CHEAT = 0x0D4,\n\n\tMSG_MOVE_SET_SWIM_BACK_SPEED = 0x0D5,\n\n\tMSG_MOVE_SET_ALL_SPEED_CHEAT = 0x0D6,\n\n\tMSG_MOVE_SET_TURN_RATE_CHEAT = 0x0D7,\n\n\tMSG_MOVE_SET_TURN_RATE = 0x0D8,\n\n\tMSG_MOVE_TOGGLE_COLLISION_CHEAT = 0x0D9,\n\n\tMSG_MOVE_SET_FACING = 0x0DA,\n\n\tMSG_MOVE_SET_PITCH = 0x0DB,\n\n\tMSG_MOVE_WORLDPORT_ACK = 0x0DC,\n\n\tSMSG_MONSTER_MOVE = 0x0DD,\n\n\tSMSG_MOVE_WATER_WALK = 0x0DE,\n\n\tSMSG_MOVE_LAND_WALK = 0x0DF,\n\n\tCMSG_MOVE_CHARM_PORT_CHEAT = 0x0E0,\n\n\tCMSG_MOVE_SET_RAW_POSITION = 0x0E1,\n\n\tSMSG_FORCE_RUN_SPEED_CHANGE = 0x0E2,\n\n\tCMSG_FORCE_RUN_SPEED_CHANGE_ACK = 0x0E3,\n\n\tSMSG_FORCE_RUN_BACK_SPEED_CHANGE = 0x0E4,\n\n\tCMSG_FORCE_RUN_BACK_SPEED_CHANGE_ACK = 0x0E5,\n\n\tSMSG_FORCE_SWIM_SPEED_CHANGE = 0x0E6,\n\n\tCMSG_FORCE_SWIM_SPEED_CHANGE_ACK = 0x0E7,\n\n\tSMSG_FORCE_MOVE_ROOT = 0x0E8,\n\n\tCMSG_FORCE_MOVE_ROOT_ACK = 0x0E9,\n\n\tSMSG_FORCE_MOVE_UNROOT = 0x0EA,\n\n\tCMSG_FORCE_MOVE_UNROOT_ACK = 0x0EB,\n\n\tMSG_MOVE_ROOT = 0x0EC,\n\n\tMSG_MOVE_UNROOT = 0x0ED,\n\n\tMSG_MOVE_HEARTBEAT = 0x0EE,\n\n\tSMSG_MOVE_KNOCK_BACK = 0x0EF,\n\n\tCMSG_MOVE_KNOCK_BACK_ACK = 0x0F0,\n\n\tMSG_MOVE_KNOCK_BACK = 0x0F1,\n\n\tSMSG_MOVE_FEATHER_FALL = 0x0F2,\n\n\tSMSG_MOVE_NORMAL_FALL = 0x0F3,\n\n\tSMSG_MOVE_SET_HOVER = 0x0F4,\n\n\tSMSG_MOVE_UNSET_HOVER = 0x0F5,\n\n\tCMSG_MOVE_HOVER_ACK = 0x0F6,\n\n\tMSG_MOVE_HOVER = 0x0F7,\n\n\tCMSG_TRIGGER_CINEMATIC_CHEAT = 0x0F8,\n\n\tCMSG_OPENING_CINEMATIC = 0x0F9,\n\n\tSMSG_TRIGGER_CINEMATIC = 0x0FA,\n\n\tCMSG_NEXT_CINEMATIC_CAMERA = 0x0FB,\n\n\tCMSG_COMPLETE_CINEMATIC = 0x0FC,\n\n\tSMSG_TUTORIAL_FLAGS = 0x0FD,\n\n\tCMSG_TUTORIAL_FLAG = 0x0FE,\n\n\tCMSG_TUTORIAL_CLEAR = 0x0FF,\n\n\tCMSG_TUTORIAL_RESET = 0x100,\n\n\tCMSG_STANDSTATECHANGE = 0x101,\n\n\tCMSG_EMOTE = 0x102,\n\n\tSMSG_EMOTE = 0x103,\n\n\tCMSG_TEXT_EMOTE = 0x104,\n\n\tSMSG_TEXT_EMOTE = 0x105,\n\n\tCMSG_AUTOEQUIP_GROUND_ITEM = 0x106,\n\n\tCMSG_AUTOSTORE_GROUND_ITEM = 0x107,\n\n\tCMSG_AUTOSTORE_LOOT_ITEM = 0x108,\n\n\tCMSG_STORE_LOOT_IN_SLOT = 0x109,\n\n\tCMSG_AUTOEQUIP_ITEM = 0x10A,\n\n\tCMSG_AUTOSTORE_BAG_ITEM = 0x10B,\n\n\tCMSG_SWAP_ITEM = 0x10C,\n\n\tCMSG_SWAP_INV_ITEM = 0x10D,\n\n\tCMSG_SPLIT_ITEM = 0x10E,\n\n\tCMSG_AUTOEQUIP_ITEM_SLOT = 0x10F,\n\n\tCMSG_UNCLAIM_LICENSE = 0x110,\n\n\tCMSG_DESTROYITEM = 0x111,\n\n\tSMSG_INVENTORY_CHANGE_FAILURE = 0x112,\n\n\tSMSG_OPEN_CONTAINER = 0x113,\n\n\tCMSG_INSPECT = 0x114,\n\n\tSMSG_INSPECT_RESULTS_UPDATE = 0x115,\n\n\tCMSG_INITIATE_TRADE = 0x116,\n\n\tCMSG_BEGIN_TRADE = 0x117,\n\n\tCMSG_BUSY_TRADE = 0x118,\n\n\tCMSG_IGNORE_TRADE = 0x119,\n\n\tCMSG_ACCEPT_TRADE = 0x11A,\n\n\tCMSG_UNACCEPT_TRADE = 0x11B,\n\n\tCMSG_CANCEL_TRADE = 0x11C,\n\n\tCMSG_SET_TRADE_ITEM = 0x11D,\n\n\tCMSG_CLEAR_TRADE_ITEM = 0x11E,\n\n\tCMSG_SET_TRADE_GOLD = 0x11F,\n\n\tSMSG_TRADE_STATUS = 0x120,\n\n\tSMSG_TRADE_STATUS_EXTENDED = 0x121,\n\n\tSMSG_INITIALIZE_FACTIONS = 0x122,\n\n\tSMSG_SET_FACTION_VISIBLE = 0x123,\n\n\tSMSG_SET_FACTION_STANDING = 0x124,\n\n\tCMSG_SET_FACTION_ATWAR = 0x125,\n\n\tCMSG_SET_FACTION_CHEAT = 0x126,\n\n\tSMSG_SET_PROFICIENCY = 0x127,\n\n\tCMSG_SET_ACTION_BUTTON = 0x128,\n\n\tSMSG_ACTION_BUTTONS = 0x129,\n\n\tSMSG_INITIAL_SPELLS = 0x12A,\n\n\tSMSG_LEARNED_SPELL = 0x12B,\n\n\tSMSG_SUPERCEDED_SPELL = 0x12C,\n\n\tCMSG_NEW_SPELL_SLOT = 0x12D,\n\n\tCMSG_CAST_SPELL = 0x12E,\n\n\tCMSG_CANCEL_CAST = 0x12F,\n\n\tSMSG_CAST_FAILED = 0x130,\n\n\tSMSG_SPELL_START = 0x131,\n\n\tSMSG_SPELL_GO = 0x132,\n\n\tSMSG_SPELL_FAILURE = 0x133,\n\n\tSMSG_SPELL_COOLDOWN = 0x134,\n\n\tSMSG_COOLDOWN_EVENT = 0x135,\n\n\tCMSG_CANCEL_AURA = 0x136,\n\n\tSMSG_EQUIPMENT_SET_SAVED = 0x137,\n\n\tSMSG_PET_CAST_FAILED = 0x138,\n\n\tMSG_CHANNEL_START = 0x139,\n\n\tMSG_CHANNEL_UPDATE = 0x13A,\n\n\tCMSG_CANCEL_CHANNELLING = 0x13B,\n\n\tSMSG_AI_REACTION = 0x13C,\n\n\tCMSG_SET_SELECTION = 0x13D,\n\n\tCMSG_DELETEEQUIPMENT_SET = 0x13E,\n\n\tCMSG_INSTANCE_LOCK_RESPONSE = 0x13F,\n\n\tCMSG_DEBUG_PASSIVE_AURA = 0x140,\n\n\tCMSG_ATTACK_SWING = 0x141,\n\n\tCMSG_ATTACK_STOP = 0x142,\n\n\tSMSG_ATTACK_START = 0x143,\n\n\tSMSG_ATTACK_STOP = 0x144,\n\n\tSMSG_ATTACK_SWING_NOT_IN_RANGE = 0x145,\n\n\tSMSG_ATTACK_SWING_BAD_FACING = 0x146,\n\n\tSMSG_INSTANCE_LOCK_WARNING_QUERY = 0x147,\n\n\tSMSG_ATTACK_SWING_DEAD_TARGET = 0x148,\n\n\tSMSG_ATTACK_SWING_CANT_ATTACK = 0x149,\n\n\tSMSG_ATTACKERSTATEUPDATE = 0x14A,\n\n\tSMSG_BATTLEFIELD_PORT_DENIED = 0x14B,\n\n\tCMSG_PERFORM_ACTION_SET = 0x14C,\n\n\tSMSG_RESUME_CAST_BAR = 0x14D,\n\n\tSMSG_CANCEL_COMBAT = 0x14E,\n\n\tSMSG_SPELLBREAKLOG = 0x14F,\n\n\tSMSG_SPELLHEALLOG = 0x150,\n\n\tSMSG_SPELLENERGIZELOG = 0x151,\n\n\tSMSG_BREAK_TARGET = 0x152,\n\n\tCMSG_SAVE_PLAYER = 0x153,\n\n\tCMSG_SETDEATHBINDPOINT = 0x154,\n\n\tSMSG_BIND_POINT_UPDATE = 0x155,\n\n\tCMSG_GETDEATHBINDZONE = 0x156,\n\n\tSMSG_BINDZONEREPLY = 0x157,\n\n\tSMSG_PLAYER_BOUND = 0x158,\n\n\tSMSG_CLIENT_CONTROL_UPDATE = 0x159,\n\n\tCMSG_REPOP_REQUEST = 0x15A,\n\n\tSMSG_RESURRECT_REQUEST = 0x15B,\n\n\tCMSG_RESURRECT_RESPONSE = 0x15C,\n\n\tCMSG_LOOT = 0x15D,\n\n\tCMSG_LOOT_MONEY = 0x15E,\n\n\tCMSG_LOOT_RELEASE = 0x15F,\n\n\tSMSG_LOOT_RESPONSE = 0x160,\n\n\tSMSG_LOOT_RELEASE_RESPONSE = 0x161,\n\n\tSMSG_LOOT_REMOVED = 0x162,\n\n\tSMSG_LOOT_MONEY_NOTIFY = 0x163,\n\n\tSMSG_LOOT_ITEM_NOTIFY = 0x164,\n\n\tSMSG_LOOT_CLEAR_MONEY = 0x165,\n\n\tSMSG_ITEM_PUSH_RESULT = 0x166,\n\n\tSMSG_DUEL_REQUESTED = 0x167,\n\n\tSMSG_DUEL_OUTOFBOUNDS = 0x168,\n\n\tSMSG_DUEL_INBOUNDS = 0x169,\n\n\tSMSG_DUEL_COMPLETE = 0x16A,\n\n\tSMSG_DUEL_WINNER = 0x16B,\n\n\tCMSG_DUEL_ACCEPTED = 0x16C,\n\n\tCMSG_DUEL_CANCELLED = 0x16D,\n\n\tSMSG_MOUNTRESULT = 0x16E,\n\n\tSMSG_DISMOUNTRESULT = 0x16F,\n\n\tSMSG_REMOVED_FROM_PVP_QUEUE = 0x170,\n\n\tCMSG_MOUNTSPECIAL_ANIM = 0x171,\n\n\tSMSG_MOUNTSPECIAL_ANIM = 0x172,\n\n\tSMSG_PET_TAME_FAILURE = 0x173,\n\n\tCMSG_PET_SET_ACTION = 0x174,\n\n\tCMSG_PET_ACTION = 0x175,\n\n\tCMSG_PET_ABANDON = 0x176,\n\n\tCMSG_PET_RENAME = 0x177,\n\n\tSMSG_PET_NAME_INVALID = 0x178,\n\n\tSMSG_PET_SPELLS = 0x179,\n\n\tSMSG_PET_MODE = 0x17A,\n\n\tCMSG_GOSSIP_HELLO = 0x17B,\n\n\tCMSG_GOSSIP_SELECT_OPTION = 0x17C,\n\n\tSMSG_GOSSIP_MESSAGE = 0x17D,\n\n\tSMSG_GOSSIP_COMPLETE = 0x17E,\n\n\tCMSG_NPC_TEXT_QUERY = 0x17F,\n\n\tSMSG_NPC_TEXT_UPDATE = 0x180,\n\n\tSMSG_NPC_WONT_TALK = 0x181,\n\n\tCMSG_QUESTGIVER_STATUS_QUERY = 0x182,\n\n\tSMSG_QUESTGIVER_STATUS = 0x183,\n\n\tCMSG_QUESTGIVER_HELLO = 0x184,\n\n\tSMSG_QUESTGIVER_QUEST_LIST = 0x185,\n\n\tCMSG_QUESTGIVER_QUERY_QUEST = 0x186,\n\n\tCMSG_QUESTGIVER_QUEST_AUTOLAUNCH = 0x187,\n\n\tSMSG_QUESTGIVER_QUEST_DETAILS = 0x188,\n\n\tCMSG_QUESTGIVER_ACCEPT_QUEST = 0x189,\n\n\tCMSG_QUESTGIVER_COMPLETE_QUEST = 0x18A,\n\n\tSMSG_QUESTGIVER_REQUEST_ITEMS = 0x18B,\n\n\tCMSG_QUESTGIVER_REQUEST_REWARD = 0x18C,\n\n\tSMSG_QUESTGIVER_OFFER_REWARD = 0x18D,\n\n\tCMSG_QUESTGIVER_CHOOSE_REWARD = 0x18E,\n\n\tSMSG_QUESTGIVER_QUEST_INVALID = 0x18F,\n\n\tCMSG_QUESTGIVER_CANCEL = 0x190,\n\n\tSMSG_QUESTGIVER_QUEST_COMPLETE = 0x191,\n\n\tSMSG_QUESTGIVER_QUEST_FAILED = 0x192,\n\n\tCMSG_QUESTLOG_SWAP_QUEST = 0x193,\n\n\tCMSG_QUESTLOG_REMOVE_QUEST = 0x194,\n\n\tSMSG_QUESTLOG_FULL = 0x195,\n\n\tSMSG_QUESTUPDATE_FAILED = 0x196,\n\n\tSMSG_QUESTUPDATE_FAILEDTIMER = 0x197,\n\n\tSMSG_QUESTUPDATE_COMPLETE = 0x198,\n\n\tSMSG_QUESTUPDATE_ADD_KILL = 0x199,\n\n\tSMSG_QUESTUPDATE_ADD_ITEM = 0x19A,\n\n\tCMSG_QUEST_CONFIRM_ACCEPT = 0x19B,\n\n\tSMSG_QUEST_CONFIRM_ACCEPT = 0x19C,\n\n\tCMSG_PUSHQUESTTOPARTY = 0x19D,\n\n\tCMSG_LIST_INVENTORY = 0x19E,\n\n\tSMSG_LIST_INVENTORY = 0x19F,\n\n\tCMSG_SELL_ITEM = 0x1A0,\n\n\tSMSG_SELL_ITEM = 0x1A1,\n\n\tCMSG_BUY_ITEM = 0x1A2,\n\n\tCMSG_BUY_ITEM_IN_SLOT = 0x1A3,\n\n\tSMSG_BUY_ITEM = 0x1A4,\n\n\tSMSG_BUY_FAILED = 0x1A5,\n\n\tCMSG_TAXICLEARALLNODES = 0x1A6,\n\n\tCMSG_TAXIENABLEALLNODES = 0x1A7,\n\n\tCMSG_TAXISHOWNODES = 0x1A8,\n\n\tSMSG_SHOWTAXINODES = 0x1A9,\n\n\tCMSG_TAXINODE_STATUS_QUERY = 0x1AA,\n\n\tSMSG_TAXINODE_STATUS = 0x1AB,\n\n\tCMSG_TAXIQUERYAVAILABLENODES = 0x1AC,\n\n\tCMSG_ACTIVATETAXI = 0x1AD,\n\n\tSMSG_ACTIVATETAXIREPLY = 0x1AE,\n\n\tSMSG_NEW_TAXI_PATH = 0x1AF,\n\n\tCMSG_TRAINER_LIST = 0x1B0,\n\n\tSMSG_TRAINER_LIST = 0x1B1,\n\n\tCMSG_TRAINER_BUY_SPELL = 0x1B2,\n\n\tSMSG_TRAINER_BUY_SUCCEEDED = 0x1B3,\n\n\tSMSG_TRAINER_BUY_FAILED = 0x1B4,\n\n\tCMSG_BINDER_ACTIVATE = 0x1B5,\n\n\tSMSG_PLAYERBINDERROR = 0x1B6,\n\n\tCMSG_BANKER_ACTIVATE = 0x1B7,\n\n\tSMSG_SHOW_BANK = 0x1B8,\n\n\tCMSG_BUY_BANK_SLOT = 0x1B9,\n\n\tSMSG_BUY_BANK_SLOT_RESULT = 0x1BA,\n\n\tCMSG_PETITION_SHOWLIST = 0x1BB,\n\n\tSMSG_PETITION_SHOWLIST = 0x1BC,\n\n\tCMSG_PETITION_BUY = 0x1BD,\n\n\tCMSG_PETITION_SHOW_SIGNATURES = 0x1BE,\n\n\tSMSG_PETITION_SHOW_SIGNATURES = 0x1BF,\n\n\tCMSG_PETITION_SIGN = 0x1C0,\n\n\tSMSG_PETITION_SIGN_RESULTS = 0x1C1,\n\n\tMSG_PETITION_DECLINE = 0x1C2,\n\n\tCMSG_OFFER_PETITION = 0x1C3,\n\n\tCMSG_TURN_IN_PETITION = 0x1C4,\n\n\tSMSG_TURN_IN_PETITION_RESULTS = 0x1C5,\n\n\tCMSG_PETITION_QUERY = 0x1C6,\n\n\tSMSG_PETITION_QUERY_RESPONSE = 0x1C7,\n\n\tSMSG_FISH_NOT_HOOKED = 0x1C8,\n\n\tSMSG_FISH_ESCAPED = 0x1C9,\n\n\tCMSG_BUG = 0x1CA,\n\n\tSMSG_NOTIFICATION = 0x1CB,\n\n\tCMSG_PLAYED_TIME = 0x1CC,\n\n\tSMSG_PLAYED_TIME = 0x1CD,\n\n\tCMSG_QUERY_TIME = 0x1CE,\n\n\tSMSG_QUERY_TIME_RESPONSE = 0x1CF,\n\n\tSMSG_LOG_XPGAIN = 0x1D0,\n\n\tSMSG_AURACASTLOG = 0x1D1,\n\n\tCMSG_RECLAIM_CORPSE = 0x1D2,\n\n\tCMSG_WRAP_ITEM = 0x1D3,\n\n\tSMSG_LEVELUP_INFO = 0x1D4,\n\n\tMSG_MINIMAP_PING = 0x1D5,\n\n\tSMSG_RESISTLOG = 0x1D6,\n\n\tSMSG_ENCHANTMENTLOG = 0x1D7,\n\n\tCMSG_SET_SKILL_CHEAT = 0x1D8,\n\n\tSMSG_START_MIRROR_TIMER = 0x1D9,\n\n\tSMSG_PAUSE_MIRROR_TIMER = 0x1DA,\n\n\tSMSG_STOP_MIRROR_TIMER = 0x1DB,\n\n\tCMSG_PING = 0x1DC,\n\n\tSMSG_PONG = 0x1DD,\n\n\tSMSG_CLEAR_COOLDOWN = 0x1DE,\n\n\tSMSG_GAMEOBJECT_PAGETEXT = 0x1DF,\n\n\tCMSG_SETSHEATHED = 0x1E0,\n\n\tSMSG_COOLDOWN_CHEAT = 0x1E1,\n\n\tSMSG_SPELL_DELAYED = 0x1E2,\n\n\tCMSG_QUEST_POI_QUERY = 0x1E3,\n\n\tSMSG_QUEST_POI_QUERY_RESPONSE = 0x1E4,\n\n\tCMSG_GHOST = 0x1E5,\n\n\tCMSG_GM_INVIS = 0x1E6,\n\n\tSMSG_INVALID_PROMOTION_CODE = 0x1E7,\n\n\tMSG_GM_BIND_OTHER = 0x1E8,\n\n\tMSG_GM_SUMMON = 0x1E9,\n\n\tSMSG_ITEM_TIME_UPDATE = 0x1EA,\n\n\tSMSG_ITEM_ENCHANT_TIME_UPDATE = 0x1EB,\n\n\tSMSG_AUTH_CHALLENGE = 0x1EC,\n\n\tCMSG_AUTH_SESSION = 0x1ED,\n\n\tSMSG_AUTH_RESPONSE = 0x1EE,\n\n\tMSG_GM_SHOWLABEL = 0x1EF,\n\n\tCMSG_PET_CAST_SPELL = 0x1F0,\n\n\tMSG_SAVE_GUILD_EMBLEM = 0x1F1,\n\n\tMSG_TABARDVENDOR_ACTIVATE = 0x1F2,\n\n\tSMSG_PLAY_SPELL_VISUAL = 0x1F3,\n\n\tCMSG_ZONEUPDATE = 0x1F4,\n\n\tSMSG_PARTYKILLLOG = 0x1F5,\n\n\tSMSG_COMPRESSED_UPDATE_OBJECT = 0x1F6,\n\n\tSMSG_PLAY_SPELL_IMPACT = 0x1F7,\n\n\tSMSG_EXPLORATION_EXPERIENCE = 0x1F8,\n\n\tCMSG_GM_SET_SECURITY_GROUP = 0x1F9,\n\n\tCMSG_GM_NUKE = 0x1FA,\n\n\tMSG_RANDOM_ROLL = 0x1FB,\n\n\tSMSG_ENVIRONMENTALDAMAGELOG = 0x1FC,\n\n\tCMSG_CHANGEPLAYER_DIFFICULTY = 0x1FD,\n\n\tSMSG_RWHOIS = 0x1FE,\n\n\tSMSG_LFG_PLAYER_REWARD = 0x1FF, // uint32, uint8, uint32, uint32, uint32, uint32, uint32, uint8, for (uint8) {uint32, uint32, uint32}\n\n\tSMSG_LFG_TELEPORT_DENIED = 0x200, // uint32 (1, 2, 4, 6;0, 5, 7)\n\n\tCMSG_UNLEARN_SPELL = 0x201,\n\n\tCMSG_UNLEARN_SKILL = 0x202,\n\n\tSMSG_REMOVED_SPELL = 0x203,\n\n\tCMSG_DECHARGE = 0x204,\n\n\tCMSG_GMTICKET_CREATE = 0x205,\n\n\tSMSG_GMTICKET_CREATE = 0x206,\n\n\tCMSG_GMTICKET_UPDATETEXT = 0x207,\n\n\tSMSG_GMTICKET_UPDATETEXT = 0x208,\n\n\tSMSG_ACCOUNT_DATA_TIMES = 0x209,\n\n\tCMSG_REQUEST_ACCOUNT_DATA = 0x20A,\n\n\tCMSG_UPDATE_ACCOUNT_DATA = 0x20B,\n\n\tSMSG_UPDATE_ACCOUNT_DATA = 0x20C,\n\n\tSMSG_CLEAR_FAR_SIGHT_IMMEDIATE = 0x20D,\n\n\tSMSG_CHANGEPLAYER_DIFFICULTY_RESULT = 0x20E,\n\n\tCMSG_GM_TEACH = 0x20F,\n\n\tCMSG_GM_CREATE_ITEM_TARGET = 0x210,\n\n\tCMSG_GMTICKET_GETTICKET = 0x211,\n\n\tSMSG_GMTICKET_GETTICKET = 0x212,\n\n\tCMSG_UNLEARN_TALENTS = 0x213,\n\n\tSMSG_UPDATE_INSTANCE_ENCOUNTER_UNIT = 0x214,\n\n\tSMSG_GAMEOBJECT_DESPAWN_ANIM = 0x215,\n\n\tMSG_CORPSE_QUERY = 0x216,\n\n\tCMSG_GMTICKET_DELETETICKET = 0x217,\n\n\tSMSG_GMTICKET_DELETETICKET = 0x218,\n\n\tSMSG_CHAT_WRONG_FACTION = 0x219,\n\n\tCMSG_GMTICKET_SYSTEMSTATUS = 0x21A,\n\n\tSMSG_GMTICKET_SYSTEMSTATUS = 0x21B,\n\n\tCMSG_SPIRIT_HEALER_ACTIVATE = 0x21C,\n\n\tCMSG_SET_STAT_CHEAT = 0x21D,\n\n\tSMSG_QUEST_FORCE_REMOVE = 0x21E, // uint32 questid\n\n\tCMSG_SKILL_BUY_STEP = 0x21F,\n\n\tCMSG_SKILL_BUY_RANK = 0x220,\n\n\tCMSG_XP_CHEAT = 0x221,\n\n\tSMSG_SPIRIT_HEALER_CONFIRM = 0x222,\n\n\tCMSG_CHARACTER_POINT_CHEAT = 0x223,\n\n\tSMSG_GOSSIP_POI = 0x224,\n\n\tCMSG_CHAT_IGNORED = 0x225,\n\n\tCMSG_GM_VISION = 0x226,\n\n\tCMSG_SERVER_COMMAND = 0x227,\n\n\tCMSG_GM_SILENCE = 0x228,\n\n\tCMSG_GM_REVEALTO = 0x229,\n\n\tCMSG_GM_RESURRECT = 0x22A,\n\n\tCMSG_GM_SUMMONMOB = 0x22B,\n\n\tCMSG_GM_MOVECORPSE = 0x22C,\n\n\tCMSG_GM_FREEZE = 0x22D,\n\n\tCMSG_GM_UBERINVIS = 0x22E,\n\n\tCMSG_GM_REQUEST_PLAYER_INFO = 0x22F,\n\n\tSMSG_GM_PLAYER_INFO = 0x230,\n\n\tCMSG_GUILD_RANK = 0x231,\n\n\tCMSG_GUILD_ADD_RANK = 0x232,\n\n\tCMSG_GUILD_DEL_RANK = 0x233,\n\n\tCMSG_GUILD_SET_PUBLIC_NOTE = 0x234,\n\n\tCMSG_GUILD_SET_OFFICER_NOTE = 0x235,\n\n\tSMSG_LOGIN_VERIFY_WORLD = 0x236,\n\n\tCMSG_CLEAR_EXPLORATION = 0x237,\n\n\tCMSG_SEND_MAIL = 0x238,\n\n\tSMSG_SEND_MAIL_RESULT = 0x239,\n\n\tCMSG_GET_MAIL_LIST = 0x23A,\n\n\tSMSG_MAIL_LIST_RESULT = 0x23B,\n\n\tCMSG_BATTLEFIELD_LIST = 0x23C,\n\n\tSMSG_BATTLEFIELD_LIST = 0x23D,\n\n\tCMSG_BATTLEFIELD_JOIN = 0x23E,\n\n\tSMSG_FORCE_SET_VEHICLE_REC_ID = 0x23F,\n\n\tCMSG_SET_VEHICLE_REC_ID_ACK = 0x240,\n\n\tCMSG_TAXICLEARNODE = 0x241,\n\n\tCMSG_TAXIENABLENODE = 0x242,\n\n\tCMSG_ITEM_TEXT_QUERY = 0x243,\n\n\tSMSG_ITEM_TEXT_QUERY_RESPONSE = 0x244,\n\n\tCMSG_MAIL_TAKE_MONEY = 0x245,\n\n\tCMSG_MAIL_TAKE_ITEM = 0x246,\n\n\tCMSG_MAIL_MARK_AS_READ = 0x247,\n\n\tCMSG_MAIL_RETURN_TO_SENDER = 0x248,\n\n\tCMSG_MAIL_DELETE = 0x249,\n\n\tCMSG_MAIL_CREATE_TEXT_ITEM = 0x24A,\n\n\tSMSG_SPELLLOGMISS = 0x24B,\n\n\tSMSG_SPELLLOGEXECUTE = 0x24C,\n\n\tSMSG_DEBUGAURAPROC = 0x24D,\n\n\tSMSG_PERIODICAURALOG = 0x24E,\n\n\tSMSG_SPELLDAMAGESHIELD = 0x24F,\n\n\tSMSG_SPELLNONMELEEDAMAGELOG = 0x250,\n\n\tCMSG_LEARN_TALENT = 0x251,\n\n\tSMSG_RESURRECT_FAILED = 0x252,\n\n\tCMSG_TOGGLE_PVP = 0x253,\n\n\tSMSG_ZONE_UNDER_ATTACK = 0x254,\n\n\tMSG_AUCTION_HELLO = 0x255,\n\n\tCMSG_AUCTION_SELL_ITEM = 0x256,\n\n\tCMSG_AUCTION_REMOVE_ITEM = 0x257,\n\n\tCMSG_AUCTION_LIST_ITEMS = 0x258,\n\n\tCMSG_AUCTION_LIST_OWNER_ITEMS = 0x259,\n\n\tCMSG_AUCTION_PLACE_BID = 0x25A,\n\n\tSMSG_AUCTION_COMMAND_RESULT = 0x25B,\n\n\tSMSG_AUCTION_LIST_RESULT = 0x25C,\n\n\tSMSG_AUCTION_OWNER_LIST_RESULT = 0x25D,\n\n\tSMSG_AUCTION_BIDDER_NOTIFICATION = 0x25E,\n\n\tSMSG_AUCTION_OWNER_NOTIFICATION = 0x25F,\n\n\tSMSG_PROCRESIST = 0x260,\n\n\tSMSG_COMBAT_EVENT_FAILED = 0x261,\n\n\tSMSG_DISPEL_FAILED = 0x262,\n\n\tSMSG_SPELLORDAMAGE_IMMUNE = 0x263,\n\n\tCMSG_AUCTION_LIST_BIDDER_ITEMS = 0x264,\n\n\tSMSG_AUCTION_BIDDER_LIST_RESULT = 0x265,\n\n\tSMSG_SET_FLAT_SPELL_MODIFIER = 0x266,\n\n\tSMSG_SET_PCT_SPELL_MODIFIER = 0x267,\n\n\tCMSG_SET_AMMO = 0x268,\n\n\tSMSG_CORPSE_RECLAIM_DELAY = 0x269,\n\n\tCMSG_SET_ACTIVE_MOVER = 0x26A,\n\n\tCMSG_PET_CANCEL_AURA = 0x26B,\n\n\tCMSG_PLAYER_AI_CHEAT = 0x26C,\n\n\tCMSG_CANCEL_AUTO_REPEAT_SPELL = 0x26D,\n\n\tMSG_GM_ACCOUNT_ONLINE = 0x26E,\n\n\tMSG_LIST_STABLED_PETS = 0x26F,\n\n\tCMSG_STABLE_PET = 0x270,\n\n\tCMSG_UNSTABLE_PET = 0x271,\n\n\tCMSG_BUY_STABLE_SLOT = 0x272,\n\n\tSMSG_STABLE_RESULT = 0x273,\n\n\tCMSG_STABLE_REVIVE_PET = 0x274,\n\n\tCMSG_STABLE_SWAP_PET = 0x275,\n\n\tMSG_QUEST_PUSH_RESULT = 0x276,\n\n\tSMSG_PLAY_MUSIC = 0x277,\n\n\tSMSG_PLAY_OBJECT_SOUND = 0x278,\n\n\tCMSG_REQUEST_PET_INFO = 0x279,\n\n\tCMSG_FAR_SIGHT = 0x27A,\n\n\tSMSG_SPELLDISPELLOG = 0x27B,\n\n\tSMSG_DAMAGE_CALC_LOG = 0x27C,\n\n\tCMSG_ENABLE_DAMAGE_LOG = 0x27D,\n\n\tCMSG_GROUP_CHANGE_SUB_GROUP = 0x27E,\n\n\tCMSG_REQUEST_PARTY_MEMBER_STATS = 0x27F,\n\n\tCMSG_GROUP_SWAP_SUB_GROUP = 0x280,\n\n\tCMSG_RESET_FACTION_CHEAT = 0x281,\n\n\tCMSG_AUTOSTORE_BANK_ITEM = 0x282,\n\n\tCMSG_AUTOBANK_ITEM = 0x283,\n\n\tMSG_QUERY_NEXT_MAIL_TIME = 0x284,\n\n\tSMSG_RECEIVED_MAIL = 0x285,\n\n\tSMSG_RAID_GROUP_ONLY = 0x286,\n\n\tCMSG_SET_DURABILITY_CHEAT = 0x287,\n\n\tCMSG_SET_PVP_RANK_CHEAT = 0x288,\n\n\tCMSG_ADD_PVP_MEDAL_CHEAT = 0x289,\n\n\tCMSG_DEL_PVP_MEDAL_CHEAT = 0x28A,\n\n\tCMSG_SET_PVP_TITLE = 0x28B,\n\n\tSMSG_PVP_CREDIT = 0x28C,\n\n\tSMSG_AUCTION_REMOVED_NOTIFICATION = 0x28D,\n\n\tCMSG_GROUP_RAID_CONVERT = 0x28E,\n\n\tCMSG_GROUP_ASSISTANT_LEADER = 0x28F,\n\n\tCMSG_BUYBACK_ITEM = 0x290,\n\n\tSMSG_SERVER_MESSAGE = 0x291,\n\n\tCMSG_SET_SAVED_INSTANCE_EXTEND = 0x292,\n\n\tSMSG_LFG_OFFER_CONTINUE = 0x293,\n\n\tCMSG_TEST_DROP_RATE = 0x294,\n\n\tSMSG_TEST_DROP_RATE_RESULT = 0x295,\n\n\tCMSG_LFG_GET_STATUS = 0x296,\n\n\tSMSG_SHOW_MAILBOX = 0x297,\n\n\tSMSG_RESET_RANGED_COMBAT_TIMER = 0x298,\n\n\tSMSG_CHAT_NOT_IN_PARTY = 0x299, // uint32, errors: ERR_NOT_IN_GROUP (2, 51) and ERR_NOT_IN_RAID (3, 39, 40)\n\n\tCMSG_GMTICKETSYSTEM_TOGGLE = 0x29A,\n\n\tCMSG_CANCEL_GROWTH_AURA = 0x29B,\n\n\tSMSG_CANCEL_AUTO_REPEAT = 0x29C,\n\n\tSMSG_STANDSTATE_UPDATE = 0x29D,\n\n\tSMSG_LOOT_ALL_PASSED = 0x29E,\n\n\tSMSG_LOOT_ROLL_WON = 0x29F,\n\n\tCMSG_LOOT_ROLL = 0x2A0,\n\n\tSMSG_LOOT_START_ROLL = 0x2A1,\n\n\tSMSG_LOOT_ROLL = 0x2A2,\n\n\tCMSG_LOOT_MASTER_GIVE = 0x2A3,\n\n\tSMSG_LOOT_MASTER_LIST = 0x2A4,\n\n\tSMSG_SET_FORCED_REACTIONS = 0x2A5,\n\n\tSMSG_SPELL_FAILED_OTHER = 0x2A6,\n\n\tSMSG_GAMEOBJECT_RESET_STATE = 0x2A7,\n\n\tCMSG_REPAIR_ITEM = 0x2A8,\n\n\tSMSG_CHAT_PLAYER_NOT_FOUND = 0x2A9,\n\n\tMSG_TALENT_WIPE_CONFIRM = 0x2AA,\n\n\tSMSG_SUMMON_REQUEST = 0x2AB,\n\n\tCMSG_SUMMON_RESPONSE = 0x2AC,\n\n\tMSG_DEV_SHOWLABEL = 0x2AD,\n\n\tSMSG_MONSTER_MOVE_TRANSPORT = 0x2AE,\n\n\tSMSG_PET_BROKEN = 0x2AF,\n\n\tMSG_MOVE_FEATHER_FALL = 0x2B0,\n\n\tMSG_MOVE_WATER_WALK = 0x2B1,\n\n\tCMSG_SERVER_BROADCAST = 0x2B2,\n\n\tCMSG_SELF_RES = 0x2B3,\n\n\tSMSG_FEIGN_DEATH_RESISTED = 0x2B4,\n\n\tCMSG_RUN_SCRIPT = 0x2B5,\n\n\tSMSG_SCRIPT_MESSAGE = 0x2B6,\n\n\tSMSG_DUEL_COUNTDOWN = 0x2B7,\n\n\tSMSG_AREA_TRIGGER_MESSAGE = 0x2B8,\n\n\tCMSG_SHOWING_HELM = 0x2B9,\n\n\tCMSG_SHOWING_CLOAK = 0x2BA,\n\n\tSMSG_LFG_ROLE_CHOSEN = 0x2BB,\n\n\tSMSG_PLAYER_SKINNED = 0x2BC,\n\n\tSMSG_DURABILITY_DAMAGE_DEATH = 0x2BD,\n\n\tCMSG_SET_EXPLORATION = 0x2BE,\n\n\tCMSG_SET_ACTIONBAR_TOGGLES = 0x2BF,\n\n\tUMSG_DELETE_GUILD_CHARTER = 0x2C0,\n\n\tMSG_PETITION_RENAME = 0x2C1,\n\n\tSMSG_INIT_WORLD_STATES = 0x2C2,\n\n\tSMSG_UPDATE_WORLD_STATE = 0x2C3,\n\n\tCMSG_ITEM_NAME_QUERY = 0x2C4,\n\n\tSMSG_ITEM_NAME_QUERY_RESPONSE = 0x2C5,\n\n\tSMSG_PET_ACTION_FEEDBACK = 0x2C6,\n\n\tCMSG_CHAR_RENAME = 0x2C7,\n\n\tSMSG_CHAR_RENAME = 0x2C8,\n\n\tCMSG_MOVE_SPLINE_DONE = 0x2C9,\n\n\tCMSG_MOVE_FALL_RESET = 0x2CA,\n\n\tSMSG_INSTANCE_SAVE_CREATED = 0x2CB,\n\n\tSMSG_RAID_INSTANCE_INFO = 0x2CC,\n\n\tCMSG_REQUEST_RAID_INFO = 0x2CD,\n\n\tCMSG_MOVE_TIME_SKIPPED = 0x2CE,\n\n\tCMSG_MOVE_FEATHER_FALL_ACK = 0x2CF,\n\n\tCMSG_MOVE_WATER_WALK_ACK = 0x2D0,\n\n\tCMSG_MOVE_NOT_ACTIVE_MOVER = 0x2D1,\n\n\tSMSG_PLAY_SOUND = 0x2D2,\n\n\tCMSG_BATTLEFIELD_STATUS = 0x2D3,\n\n\tSMSG_BATTLEFIELD_STATUS = 0x2D4,\n\n\tCMSG_BATTLEFIELD_PORT = 0x2D5,\n\n\tMSG_INSPECT_HONOR_STATS = 0x2D6,\n\n\tCMSG_BATTLEMASTER_HELLO = 0x2D7,\n\n\tCMSG_MOVE_START_SWIM_CHEAT = 0x2D8,\n\n\tCMSG_MOVE_STOP_SWIM_CHEAT = 0x2D9,\n\n\tSMSG_FORCE_WALK_SPEED_CHANGE = 0x2DA,\n\n\tCMSG_FORCE_WALK_SPEED_CHANGE_ACK = 0x2DB,\n\n\tSMSG_FORCE_SWIM_BACK_SPEED_CHANGE = 0x2DC,\n\n\tCMSG_FORCE_SWIM_BACK_SPEED_CHANGE_ACK = 0x2DD,\n\n\tSMSG_FORCE_TURN_RATE_CHANGE = 0x2DE,\n\n\tCMSG_FORCE_TURN_RATE_CHANGE_ACK = 0x2DF,\n\n\tMSG_PVP_LOG_DATA = 0x2E0,\n\n\tCMSG_LEAVE_BATTLEFIELD = 0x2E1,\n\n\tCMSG_AREA_SPIRIT_HEALER_QUERY = 0x2E2,\n\n\tCMSG_AREA_SPIRIT_HEALER_QUEUE = 0x2E3,\n\n\tSMSG_AREA_SPIRIT_HEALER_TIME = 0x2E4,\n\n\tCMSG_GM_UNTEACH = 0x2E5,\n\n\tSMSG_WARDEN_DATA = 0x2E6,\n\n\tCMSG_WARDEN_DATA = 0x2E7,\n\n\tSMSG_GROUP_JOINED_BATTLEGROUND = 0x2E8,\n\n\tMSG_BATTLEGROUND_PLAYER_POSITIONS = 0x2E9,\n\n\tCMSG_PET_STOP_ATTACK = 0x2EA,\n\n\tSMSG_BINDER_CONFIRM = 0x2EB,\n\n\tSMSG_BATTLEGROUND_PLAYER_JOINED = 0x2EC,\n\n\tSMSG_BATTLEGROUND_PLAYER_LEFT = 0x2ED,\n\n\tCMSG_BATTLEMASTER_JOIN = 0x2EE,\n\n\tSMSG_ADDON_INFO = 0x2EF,\n\n\tCMSG_PET_UNLEARN = 0x2F0, // Deprecated 3.x\n\n\tSMSG_PET_UNLEARN_CONFIRM = 0x2F1, // Deprecated 3.x\n\n\tSMSG_PARTY_MEMBER_STATS_FULL = 0x2F2,\n\n\tCMSG_PET_SPELL_AUTOCAST = 0x2F3,\n\n\tSMSG_WEATHER = 0x2F4,\n\n\tSMSG_PLAY_TIME_WARNING = 0x2F5,\n\n\tSMSG_MINIGAME_SETUP = 0x2F6,\n\n\tSMSG_MINIGAME_STATE = 0x2F7,\n\n\tCMSG_MINIGAME_MOVE = 0x2F8,\n\n\tSMSG_MINIGAME_MOVE_FAILED = 0x2F9,\n\n\tSMSG_RAID_INSTANCE_MESSAGE = 0x2FA,\n\n\tSMSG_COMPRESSED_MOVES = 0x2FB,\n\n\tCMSG_GUILD_INFO_TEXT = 0x2FC,\n\n\tSMSG_CHAT_RESTRICTED = 0x2FD,\n\n\tSMSG_SPLINE_SET_RUN_SPEED = 0x2FE,\n\n\tSMSG_SPLINE_SET_RUN_BACK_SPEED = 0x2FF,\n\n\tSMSG_SPLINE_SET_SWIM_SPEED = 0x300,\n\n\tSMSG_SPLINE_SET_WALK_SPEED = 0x301,\n\n\tSMSG_SPLINE_SET_SWIM_BACK_SPEED = 0x302,\n\n\tSMSG_SPLINE_SET_TURN_RATE = 0x303,\n\n\tSMSG_SPLINE_MOVE_UNROOT = 0x304,\n\n\tSMSG_SPLINE_MOVE_FEATHER_FALL = 0x305,\n\n\tSMSG_SPLINE_MOVE_NORMAL_FALL = 0x306,\n\n\tSMSG_SPLINE_MOVE_SET_HOVER = 0x307,\n\n\tSMSG_SPLINE_MOVE_UNSET_HOVER = 0x308,\n\n\tSMSG_SPLINE_MOVE_WATER_WALK = 0x309,\n\n\tSMSG_SPLINE_MOVE_LAND_WALK = 0x30A,\n\n\tSMSG_SPLINE_MOVE_START_SWIM = 0x30B,\n\n\tSMSG_SPLINE_MOVE_STOP_SWIM = 0x30C,\n\n\tSMSG_SPLINE_MOVE_SET_RUN_MODE = 0x30D,\n\n\tSMSG_SPLINE_MOVE_SET_WALK_MODE = 0x30E,\n\n\tCMSG_GM_NUKE_ACCOUNT = 0x30F,\n\n\tMSG_GM_DESTROY_CORPSE = 0x310,\n\n\tCMSG_GM_DESTROY_ONLINE_CORPSE = 0x311,\n\n\tCMSG_ACTIVATETAXIEXPRESS = 0x312,\n\n\tSMSG_SET_FACTION_ATWAR = 0x313,\n\n\tSMSG_GAMETIMEBIAS_SET = 0x314,\n\n\tCMSG_DEBUG_ACTIONS_START = 0x315,\n\n\tCMSG_DEBUG_ACTIONS_STOP = 0x316,\n\n\tCMSG_SET_FACTION_INACTIVE = 0x317,\n\n\tCMSG_SET_WATCHED_FACTION = 0x318,\n\n\tMSG_MOVE_TIME_SKIPPED = 0x319,\n\n\tSMSG_SPLINE_MOVE_ROOT = 0x31A,\n\n\tCMSG_SET_EXPLORATION_ALL = 0x31B,\n\n\tSMSG_INVALIDATE_PLAYER = 0x31C,\n\n\tCMSG_RESET_INSTANCES = 0x31D,\n\n\tSMSG_INSTANCE_RESET = 0x31E,\n\n\tSMSG_INSTANCE_RESET_FAILED = 0x31F,\n\n\tSMSG_UPDATE_LAST_INSTANCE = 0x320,\n\n\tMSG_RAID_TARGET_UPDATE = 0x321,\n\n\tMSG_RAID_READY_CHECK = 0x322,\n\n\tCMSG_LUA_USAGE = 0x323,\n\n\tSMSG_PET_ACTION_SOUND = 0x324,\n\n\tSMSG_PET_DISMISS_SOUND = 0x325,\n\n\tSMSG_GHOSTEE_GONE = 0x326,\n\n\tCMSG_GM_UPDATE_TICKET_STATUS = 0x327,\n\n\tSMSG_GM_TICKET_STATUS_UPDATE = 0x328,\n\n\tMSG_SET_DUNGEON_DIFFICULTY = 0x329,\n\n\tCMSG_GMSURVEY_SUBMIT = 0x32A,\n\n\tSMSG_UPDATE_INSTANCE_OWNERSHIP = 0x32B,\n\n\tCMSG_IGNORE_KNOCKBACK_CHEAT = 0x32C,\n\n\tSMSG_CHAT_PLAYER_AMBIGUOUS = 0x32D,\n\n\tMSG_DELAY_GHOST_TELEPORT = 0x32E,\n\n\tSMSG_SPELLINSTAKILLLOG = 0x32F,\n\n\tSMSG_SPELL_UPDATE_CHAIN_TARGETS = 0x330,\n\n\tCMSG_CHAT_FILTERED = 0x331,\n\n\tSMSG_EXPECTED_SPAM_RECORDS = 0x332,\n\n\tSMSG_SPELLSTEALLOG = 0x333,\n\n\tCMSG_LOTTERY_QUERY_OBSOLETE = 0x334,\n\n\tSMSG_LOTTERY_QUERY_RESULT_OBSOLETE = 0x335,\n\n\tCMSG_BUY_LOTTERY_TICKET_OBSOLETE = 0x336,\n\n\tSMSG_LOTTERY_RESULT_OBSOLETE = 0x337,\n\n\tSMSG_CHARACTER_PROFILE = 0x338,\n\n\tSMSG_CHARACTER_PROFILE_REALM_CONNECTED = 0x339,\n\n\tSMSG_DEFENSE_MESSAGE = 0x33A,\n\n\tSMSG_INSTANCE_DIFFICULTY = 0x33B,\n\n\tMSG_GM_RESETINSTANCELIMIT = 0x33C,\n\n\tSMSG_MOTD = 0x33D,\n\n\tSMSG_MOVE_SET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY = 0x33E,\n\n\tSMSG_MOVE_UNSET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY = 0x33F,\n\n\tCMSG_MOVE_SET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY_ACK = 0x340,\n\n\tMSG_MOVE_START_SWIM_CHEAT = 0x341,\n\n\tMSG_MOVE_STOP_SWIM_CHEAT = 0x342,\n\n\tSMSG_MOVE_SET_CAN_FLY = 0x343,\n\n\tSMSG_MOVE_UNSET_CAN_FLY = 0x344,\n\n\tCMSG_MOVE_SET_CAN_FLY_ACK = 0x345,\n\n\tCMSG_MOVE_SET_FLY = 0x346,\n\n\tCMSG_SOCKET_GEMS = 0x347,\n\n\tCMSG_ARENA_TEAM_CREATE = 0x348,\n\n\tSMSG_ARENA_TEAM_COMMAND_RESULT = 0x349,\n\n\tMSG_MOVE_UPDATE_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY = 0x34A,\n\n\tCMSG_ARENA_TEAM_QUERY = 0x34B,\n\n\tSMSG_ARENA_TEAM_QUERY_RESPONSE = 0x34C,\n\n\tCMSG_ARENA_TEAM_ROSTER = 0x34D,\n\n\tSMSG_ARENA_TEAM_ROSTER = 0x34E,\n\n\tCMSG_ARENA_TEAM_INVITE = 0x34F,\n\n\tSMSG_ARENA_TEAM_INVITE = 0x350,\n\n\tCMSG_ARENA_TEAM_ACCEPT = 0x351,\n\n\tCMSG_ARENA_TEAM_DECLINE = 0x352,\n\n\tCMSG_ARENA_TEAM_LEAVE = 0x353,\n\n\tCMSG_ARENA_TEAM_REMOVE = 0x354,\n\n\tCMSG_ARENA_TEAM_DISBAND = 0x355,\n\n\tCMSG_ARENA_TEAM_LEADER = 0x356,\n\n\tSMSG_ARENA_TEAM_EVENT = 0x357,\n\n\tCMSG_BATTLEMASTER_JOIN_ARENA = 0x358,\n\n\tMSG_MOVE_START_ASCEND = 0x359,\n\n\tMSG_MOVE_STOP_ASCEND = 0x35A,\n\n\tSMSG_ARENA_TEAM_STATS = 0x35B,\n\n\tCMSG_LFG_JOIN = 0x35C,\n\n\tCMSG_LFG_LEAVE = 0x35D,\n\n\tCMSG_SEARCH_LFG_JOIN = 0x35E,\n\n\tCMSG_SEARCH_LFG_LEAVE = 0x35F,\n\n\tSMSG_UPDATE_LFG_LIST = 0x360, // uint32, uint32, if (uint8) { uint32 count, for (count) { uint64} }, uint32 count2, uint32, for (count2) { uint64, uint32 flags, if (flags & 0x2) {string}, if (flags & 0x10) {for (3) uint8}, if (flags & 0x80) {uint64, uint32}}, uint32 count3, uint32, for (count3) {uint64, uint32 flags, if (flags & 0x1) {uint8, uint8, uint8, for (3) uint8, uint32, uint32, uint32, uint32, uint32, uint32, float, float, uint32, uint32, uint32, uint32, uint32, float, uint32, uint32, uint32, uint32, uint32, uint32}, if (flags&0x2) string, if (flags&0x4) uint8, if (flags&0x8) uint64, if (flags&0x10) uint8, if (flags&0x20) uint32, if (flags&0x40) uint8, if (flags& 0x80) {uint64, uint32}}\n\n\tSMSG_LFG_PROPOSAL_UPDATE = 0x361, // uint32, uint8, uint32, uint32, uint8, for (uint8) {uint32, uint8, uint8, uint8, uint8}\n\n\tCMSG_LFG_PROPOSAL_RESULT = 0x362,\n\n\tSMSG_LFG_ROLE_CHECK_UPDATE = 0x363, // uint32, uint8, for (uint8) uint32, uint8, for (uint8) { uint64, uint8, uint32, uint8, }\n\n\tSMSG_LFG_JOIN_RESULT = 0x364, // uint32 unk, uint32, if (unk == 6) { uint8 count, for (count) uint64 }\n\n\tSMSG_LFG_QUEUE_STATUS = 0x365, // uint32 dungeon, uint32 lfgtype, uint32, uint32, uint32, uint32, uint8, uint8, uint8, uint8\n\n\tCMSG_SET_LFG_COMMENT = 0x366,\n\n\tSMSG_LFG_UPDATE_PLAYER = 0x367, // uint8, if (uint8) { uint8, uint8, uint8, uint8, if (uint8) for (uint8) uint32, string}\n\n\tSMSG_LFG_UPDATE_PARTY = 0x368, // uint8, if (uint8) { uint8, uint8, uint8, for (3) uint8, uint8, if (uint8) for (uint8) uint32, string}\n\n\tSMSG_LFG_UPDATE_SEARCH = 0x369, // uint8\n\n\tCMSG_LFG_SET_ROLES = 0x36A,\n\n\tCMSG_LFG_SET_NEEDS = 0x36B,\n\n\tCMSG_LFG_SET_BOOT_VOTE = 0x36C,\n\n\tSMSG_LFG_BOOT_PROPOSAL_UPDATE = 0x36D, // uint8, uint8, uint8, uint64, uint32, uint32, uint32, uint32\n\n\tCMSG_LFD_PLAYER_LOCK_INFO_REQUEST = 0x36E,\n\n\tSMSG_LFG_PLAYER_INFO = 0x36F, // uint8, for (uint8) { uint32, uint8, uint32, uint32, uint32, uint32, uint8, for (uint8) {uint32, uint32, uint32}}, uint32, for (uint32) {uint32, uint32}\n\n\tCMSG_LFG_TELEPORT = 0x370,\n\n\tCMSG_LFD_PARTY_LOCK_INFO_REQUEST = 0x371,\n\n\tSMSG_LFG_PARTY_INFO = 0x372, // uint8, for (uint8) uint64\n\n\tSMSG_TITLE_EARNED = 0x373,\n\n\tCMSG_SET_TITLE = 0x374,\n\n\tCMSG_CANCEL_MOUNT_AURA = 0x375,\n\n\tSMSG_ARENA_ERROR = 0x376,\n\n\tMSG_INSPECT_ARENA_TEAMS = 0x377,\n\n\tSMSG_DEATH_RELEASE_LOC = 0x378,\n\n\tCMSG_CANCEL_TEMP_ENCHANTMENT = 0x379,\n\n\tSMSG_FORCED_DEATH_UPDATE = 0x37A,\n\n\tCMSG_CHEAT_SET_HONOR_CURRENCY = 0x37B,\n\n\tCMSG_CHEAT_SET_ARENA_CURRENCY = 0x37C,\n\n\tMSG_MOVE_SET_FLIGHT_SPEED_CHEAT = 0x37D,\n\n\tMSG_MOVE_SET_FLIGHT_SPEED = 0x37E,\n\n\tMSG_MOVE_SET_FLIGHT_BACK_SPEED_CHEAT = 0x37F,\n\n\tMSG_MOVE_SET_FLIGHT_BACK_SPEED = 0x380,\n\n\tSMSG_FORCE_FLIGHT_SPEED_CHANGE = 0x381,\n\n\tCMSG_FORCE_FLIGHT_SPEED_CHANGE_ACK = 0x382,\n\n\tSMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE = 0x383,\n\n\tCMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK = 0x384,\n\n\tSMSG_SPLINE_SET_FLIGHT_SPEED = 0x385,\n\n\tSMSG_SPLINE_SET_FLIGHT_BACK_SPEED = 0x386,\n\n\tCMSG_MAELSTROM_INVALIDATE_CACHE = 0x387,\n\n\tSMSG_FLIGHT_SPLINE_SYNC = 0x388,\n\n\tCMSG_SET_TAXI_BENCHMARK_MODE = 0x389,\n\n\tSMSG_JOINED_BATTLEGROUND_QUEUE = 0x38A,\n\n\tSMSG_REALM_SPLIT = 0x38B,\n\n\tCMSG_REALM_SPLIT = 0x38C,\n\n\tCMSG_MOVE_CHNG_TRANSPORT = 0x38D,\n\n\tMSG_PARTY_ASSIGNMENT = 0x38E,\n\n\tSMSG_OFFER_PETITION_ERROR = 0x38F,\n\n\tSMSG_TIME_SYNC_REQ = 0x390,\n\n\tCMSG_TIME_SYNC_RESP = 0x391,\n\n\tCMSG_SEND_LOCAL_EVENT = 0x392,\n\n\tCMSG_SEND_GENERAL_TRIGGER = 0x393,\n\n\tCMSG_SEND_COMBAT_TRIGGER = 0x394,\n\n\tCMSG_MAELSTROM_GM_SENT_MAIL = 0x395,\n\n\tSMSG_RESET_FAILED_NOTIFY = 0x396,\n\n\tSMSG_REAL_GROUP_UPDATE = 0x397,\n\n\tSMSG_LFG_DISABLED = 0x398,\n\n\tCMSG_ACTIVE_PVP_CHEAT = 0x399,\n\n\tCMSG_CHEAT_DUMP_ITEMS_DEBUG_ONLY = 0x39A,\n\n\tSMSG_CHEAT_DUMP_ITEMS_DEBUG_ONLY_RESPONSE = 0x39B,\n\n\tSMSG_CHEAT_DUMP_ITEMS_DEBUG_ONLY_RESPONSE_WRITE_FILE = 0x39C,\n\n\tSMSG_UPDATE_COMBO_POINTS = 0x39D,\n\n\tSMSG_VOICE_SESSION_ROSTER_UPDATE = 0x39E,\n\n\tSMSG_VOICE_SESSION_LEAVE = 0x39F,\n\n\tSMSG_VOICE_SESSION_ADJUST_PRIORITY = 0x3A0,\n\n\tCMSG_VOICE_SET_TALKER_MUTED_REQUEST = 0x3A1,\n\n\tSMSG_VOICE_SET_TALKER_MUTED = 0x3A2,\n\n\tSMSG_INIT_EXTRA_AURA_INFO_OBSOLETE = 0x3A3,\n\n\tSMSG_SET_EXTRA_AURA_INFO_OBSOLETE = 0x3A4,\n\n\tSMSG_SET_EXTRA_AURA_INFO_NEED_UPDATE_OBSOLETE = 0x3A5,\n\n\tSMSG_CLEAR_EXTRA_AURA_INFO_OBSOLETE = 0x3A6,\n\n\tMSG_MOVE_START_DESCEND = 0x3A7,\n\n\tCMSG_IGNORE_REQUIREMENTS_CHEAT = 0x3A8,\n\n\tSMSG_IGNORE_REQUIREMENTS_CHEAT = 0x3A9,\n\n\tSMSG_SPELL_CHANCE_PROC_LOG = 0x3AA,\n\n\tCMSG_MOVE_SET_RUN_SPEED = 0x3AB,\n\n\tSMSG_DISMOUNT = 0x3AC,\n\n\tMSG_MOVE_UPDATE_CAN_FLY = 0x3AD,\n\n\tMSG_RAID_READY_CHECK_CONFIRM = 0x3AE,\n\n\tCMSG_VOICE_SESSION_ENABLE = 0x3AF,\n\n\tSMSG_VOICE_SESSION_ENABLE = 0x3B0,\n\n\tSMSG_VOICE_PARENTAL_CONTROLS = 0x3B1,\n\n\tCMSG_GM_WHISPER = 0x3B2,\n\n\tSMSG_GM_MESSAGECHAT = 0x3B3,\n\n\tMSG_GM_GEARRATING = 0x3B4,\n\n\tCMSG_COMMENTATOR_ENABLE = 0x3B5,\n\n\tSMSG_COMMENTATOR_STATE_CHANGED = 0x3B6,\n\n\tCMSG_COMMENTATOR_GET_MAP_INFO = 0x3B7,\n\n\tSMSG_COMMENTATOR_MAP_INFO = 0x3B8,\n\n\tCMSG_COMMENTATOR_GET_PLAYER_INFO = 0x3B9,\n\n\tSMSG_COMMENTATOR_GET_PLAYER_INFO = 0x3BA,\n\n\tSMSG_COMMENTATOR_PLAYER_INFO = 0x3BB,\n\n\tCMSG_COMMENTATOR_ENTER_INSTANCE = 0x3BC,\n\n\tCMSG_COMMENTATOR_EXIT_INSTANCE = 0x3BD,\n\n\tCMSG_COMMENTATOR_INSTANCE_COMMAND = 0x3BE,\n\n\tSMSG_CLEAR_TARGET = 0x3BF,\n\n\tCMSG_BOT_DETECTED = 0x3C0,\n\n\tSMSG_CROSSED_INEBRIATION_THRESHOLD = 0x3C1,\n\n\tCMSG_CHEAT_PLAYER_LOGIN = 0x3C2,\n\n\tCMSG_CHEAT_PLAYER_LOOKUP = 0x3C3,\n\n\tSMSG_CHEAT_PLAYER_LOOKUP = 0x3C4,\n\n\tSMSG_KICK_REASON = 0x3C5,\n\n\tMSG_RAID_READY_CHECK_FINISHED = 0x3C6,\n\n\tCMSG_COMPLAIN = 0x3C7,\n\n\tSMSG_COMPLAIN_RESULT = 0x3C8,\n\n\tSMSG_FEATURE_SYSTEM_STATUS = 0x3C9,\n\n\tCMSG_GM_SHOW_COMPLAINTS = 0x3CA,\n\n\tCMSG_GM_UNSQUELCH = 0x3CB,\n\n\tCMSG_CHANNEL_SILENCE_VOICE = 0x3CC,\n\n\tCMSG_CHANNEL_SILENCE_ALL = 0x3CD,\n\n\tCMSG_CHANNEL_UNSILENCE_VOICE = 0x3CE,\n\n\tCMSG_CHANNEL_UNSILENCE_ALL = 0x3CF,\n\n\tCMSG_TARGET_CAST = 0x3D0,\n\n\tCMSG_TARGET_SCRIPT_CAST = 0x3D1,\n\n\tCMSG_CHANNEL_DISPLAY_LIST = 0x3D2,\n\n\tCMSG_SET_ACTIVE_VOICE_CHANNEL = 0x3D3,\n\n\tCMSG_GET_CHANNEL_MEMBER_COUNT = 0x3D4,\n\n\tSMSG_CHANNEL_MEMBER_COUNT = 0x3D5,\n\n\tCMSG_CHANNEL_VOICE_ON = 0x3D6,\n\n\tCMSG_CHANNEL_VOICE_OFF = 0x3D7,\n\n\tCMSG_DEBUG_LIST_TARGETS = 0x3D8,\n\n\tSMSG_DEBUG_LIST_TARGETS = 0x3D9,\n\n\tSMSG_AVAILABLE_VOICE_CHANNEL = 0x3DA,\n\n\tCMSG_ADD_VOICE_IGNORE = 0x3DB,\n\n\tCMSG_DEL_VOICE_IGNORE = 0x3DC,\n\n\tCMSG_PARTY_SILENCE = 0x3DD,\n\n\tCMSG_PARTY_UNSILENCE = 0x3DE,\n\n\tMSG_NOTIFY_PARTY_SQUELCH = 0x3DF,\n\n\tSMSG_COMSAT_RECONNECT_TRY = 0x3E0,\n\n\tSMSG_COMSAT_DISCONNECT = 0x3E1,\n\n\tSMSG_COMSAT_CONNECT_FAIL = 0x3E2,\n\n\tSMSG_VOICE_CHAT_STATUS = 0x3E3,\n\n\tCMSG_REPORT_PVP_AFK = 0x3E4,\n\n\tSMSG_REPORT_PVP_AFK_RESULT = 0x3E5,\n\n\tCMSG_GUILD_BANKER_ACTIVATE = 0x3E6,\n\n\tCMSG_GUILD_BANK_QUERY_TAB = 0x3E7,\n\n\tSMSG_GUILD_BANK_LIST = 0x3E8,\n\n\tCMSG_GUILD_BANK_SWAP_ITEMS = 0x3E9,\n\n\tCMSG_GUILD_BANK_BUY_TAB = 0x3EA,\n\n\tCMSG_GUILD_BANK_UPDATE_TAB = 0x3EB,\n\n\tCMSG_GUILD_BANK_DEPOSIT_MONEY = 0x3EC,\n\n\tCMSG_GUILD_BANK_WITHDRAW_MONEY = 0x3ED,\n\n\tMSG_GUILD_BANK_LOG_QUERY = 0x3EE,\n\n\tCMSG_SET_CHANNEL_WATCH = 0x3EF,\n\n\tSMSG_USERLIST_ADD = 0x3F0,\n\n\tSMSG_USERLIST_REMOVE = 0x3F1,\n\n\tSMSG_USERLIST_UPDATE = 0x3F2,\n\n\tCMSG_CLEAR_CHANNEL_WATCH = 0x3F3,\n\n\tSMSG_INSPECT_TALENT = 0x3F4,\n\n\tSMSG_GOGOGO_OBSOLETE = 0x3F5,\n\n\tSMSG_ECHO_PARTY_SQUELCH = 0x3F6,\n\n\tCMSG_SET_TITLE_SUFFIX = 0x3F7,\n\n\tCMSG_SPELLCLICK = 0x3F8,\n\n\tSMSG_LOOT_LIST = 0x3F9,\n\n\tCMSG_GM_CHARACTER_RESTORE = 0x3FA,\n\n\tCMSG_GM_CHARACTER_SAVE = 0x3FB,\n\n\tSMSG_VOICESESSION_FULL = 0x3FC,\n\n\tMSG_GUILD_PERMISSIONS = 0x3FD,\n\n\tMSG_GUILD_BANK_MONEY_WITHDRAWN = 0x3FE,\n\n\tMSG_GUILD_EVENT_LOG_QUERY = 0x3FF,\n\n\tCMSG_MAELSTROM_RENAME_GUILD = 0x400,\n\n\tCMSG_GET_MIRRORIMAGE_DATA = 0x401,\n\n\tSMSG_MIRRORIMAGE_DATA = 0x402,\n\n\tSMSG_FORCE_DISPLAY_UPDATE = 0x403,\n\n\tSMSG_SPELL_CHANCE_RESIST_PUSHBACK = 0x404,\n\n\tCMSG_IGNORE_DIMINISHING_RETURNS_CHEAT = 0x405,\n\n\tSMSG_IGNORE_DIMINISHING_RETURNS_CHEAT = 0x406,\n\n\tCMSG_KEEP_ALIVE = 0x407,\n\n\tSMSG_RAID_READY_CHECK_ERROR = 0x408,\n\n\tCMSG_OPT_OUT_OF_LOOT = 0x409,\n\n\tMSG_QUERY_GUILD_BANK_TEXT = 0x40A,\n\n\tCMSG_SET_GUILD_BANK_TEXT = 0x40B,\n\n\tCMSG_SET_GRANTABLE_LEVELS = 0x40C,\n\n\tCMSG_GRANT_LEVEL = 0x40D,\n\n\tCMSG_REFER_A_FRIEND = 0x40E,\n\n\tMSG_GM_CHANGE_ARENA_RATING = 0x40F,\n\n\tCMSG_DECLINE_CHANNEL_INVITE = 0x410,\n\n\tSMSG_GROUPACTION_THROTTLED = 0x411,\n\n\tSMSG_OVERRIDE_LIGHT = 0x412, // uint32 defaultMapLight, uint32 overrideLight, uint32 transitionTimeMs\n\n\tSMSG_TOTEM_CREATED = 0x413,\n\n\tCMSG_TOTEM_DESTROYED = 0x414,\n\n\tCMSG_EXPIRE_RAID_INSTANCE = 0x415,\n\n\tCMSG_NO_SPELL_VARIANCE = 0x416,\n\n\tCMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY = 0x417,\n\n\tSMSG_QUESTGIVER_STATUS_MULTIPLE = 0x418,\n\n\tCMSG_SET_PLAYER_DECLINED_NAMES = 0x419,\n\n\tSMSG_SET_PLAYER_DECLINED_NAMES_RESULT = 0x41A,\n\n\tCMSG_QUERY_SERVER_BUCK_DATA = 0x41B,\n\n\tCMSG_CLEAR_SERVER_BUCK_DATA = 0x41C,\n\n\tSMSG_SERVER_BUCK_DATA = 0x41D,\n\n\tSMSG_SEND_UNLEARN_SPELLS = 0x41E,\n\n\tSMSG_PROPOSE_LEVEL_GRANT = 0x41F,\n\n\tCMSG_ACCEPT_LEVEL_GRANT = 0x420,\n\n\tSMSG_REFER_A_FRIEND_FAILURE = 0x421,\n\n\tSMSG_SPLINE_MOVE_SET_FLYING = 0x422,\n\n\tSMSG_SPLINE_MOVE_UNSET_FLYING = 0x423,\n\n\tSMSG_SUMMON_CANCEL = 0x424,\n\n\tCMSG_CHANGE_PERSONAL_ARENA_RATING = 0x425,\n\n\tCMSG_ALTER_APPEARANCE = 0x426,\n\n\tSMSG_ENABLE_BARBER_SHOP = 0x427,\n\n\tSMSG_BARBER_SHOP_RESULT = 0x428,\n\n\tCMSG_CALENDAR_GET_CALENDAR = 0x429,\n\n\tCMSG_CALENDAR_GET_EVENT = 0x42A,\n\n\tCMSG_CALENDAR_GUILD_FILTER = 0x42B,\n\n\tCMSG_CALENDAR_ARENA_TEAM = 0x42C,\n\n\tCMSG_CALENDAR_ADD_EVENT = 0x42D,\n\n\tCMSG_CALENDAR_UPDATE_EVENT = 0x42E,\n\n\tCMSG_CALENDAR_REMOVE_EVENT = 0x42F,\n\n\tCMSG_CALENDAR_COPY_EVENT = 0x430,\n\n\tCMSG_CALENDAR_EVENT_INVITE = 0x431,\n\n\tCMSG_CALENDAR_EVENT_RSVP = 0x432,\n\n\tCMSG_CALENDAR_EVENT_REMOVE_INVITE = 0x433,\n\n\tCMSG_CALENDAR_EVENT_STATUS = 0x434,\n\n\tCMSG_CALENDAR_EVENT_MODERATOR_STATUS = 0x435,\n\n\tSMSG_CALENDAR_SEND_CALENDAR = 0x436,\n\n\tSMSG_CALENDAR_SEND_EVENT = 0x437,\n\n\tSMSG_CALENDAR_FILTER_GUILD = 0x438,\n\n\tSMSG_CALENDAR_ARENA_TEAM = 0x439,\n\n\tSMSG_CALENDAR_EVENT_INVITE = 0x43A,\n\n\tSMSG_CALENDAR_EVENT_INVITE_REMOVED = 0x43B,\n\n\tSMSG_CALENDAR_EVENT_STATUS = 0x43C,\n\n\tSMSG_CALENDAR_COMMAND_RESULT = 0x43D,\n\n\tSMSG_CALENDAR_RAID_LOCKOUT_ADDED = 0x43E,\n\n\tSMSG_CALENDAR_RAID_LOCKOUT_REMOVED = 0x43F,\n\n\tSMSG_CALENDAR_EVENT_INVITE_ALERT = 0x440,\n\n\tSMSG_CALENDAR_EVENT_INVITE_REMOVED_ALERT = 0x441,\n\n\tSMSG_CALENDAR_EVENT_INVITE_STATUS_ALERT = 0x442,\n\n\tSMSG_CALENDAR_EVENT_REMOVED_ALERT = 0x443,\n\n\tSMSG_CALENDAR_EVENT_UPDATED_ALERT = 0x444,\n\n\tSMSG_CALENDAR_EVENT_MODERATOR_STATUS_ALERT = 0x445,\n\n\tCMSG_CALENDAR_COMPLAIN = 0x446,\n\n\tCMSG_CALENDAR_GET_NUM_PENDING = 0x447,\n\n\tSMSG_CALENDAR_SEND_NUM_PENDING = 0x448,\n\n\tCMSG_SAVE_DANCE = 0x449,\n\n\tSMSG_NOTIFY_DANCE = 0x44A,\n\n\tCMSG_PLAY_DANCE = 0x44B,\n\n\tSMSG_PLAY_DANCE = 0x44C,\n\n\tCMSG_LOAD_DANCES = 0x44D,\n\n\tCMSG_STOP_DANCE = 0x44E,\n\n\tSMSG_STOP_DANCE = 0x44F,\n\n\tCMSG_SYNC_DANCE = 0x450,\n\n\tCMSG_DANCE_QUERY = 0x451,\n\n\tSMSG_DANCE_QUERY_RESPONSE = 0x452,\n\n\tSMSG_INVALIDATE_DANCE = 0x453,\n\n\tCMSG_DELETE_DANCE = 0x454,\n\n\tSMSG_LEARNED_DANCE_MOVES = 0x455,\n\n\tCMSG_LEARN_DANCE_MOVE = 0x456,\n\n\tCMSG_UNLEARN_DANCE_MOVE = 0x457,\n\n\tCMSG_SET_RUNE_COUNT = 0x458,\n\n\tCMSG_SET_RUNE_COOLDOWN = 0x459,\n\n\tMSG_MOVE_SET_PITCH_RATE_CHEAT = 0x45A,\n\n\tMSG_MOVE_SET_PITCH_RATE = 0x45B,\n\n\tSMSG_FORCE_PITCH_RATE_CHANGE = 0x45C,\n\n\tCMSG_FORCE_PITCH_RATE_CHANGE_ACK = 0x45D,\n\n\tSMSG_SPLINE_SET_PITCH_RATE = 0x45E,\n\n\tCMSG_CALENDAR_EVENT_INVITE_NOTES = 0x45F,\n\n\tSMSG_CALENDAR_EVENT_INVITE_NOTES = 0x460,\n\n\tSMSG_CALENDAR_EVENT_INVITE_NOTES_ALERT = 0x461,\n\n\tCMSG_UPDATE_MISSILE_TRAJECTORY = 0x462,\n\n\tSMSG_UPDATE_ACCOUNT_DATA_COMPLETE = 0x463,\n\n\tSMSG_TRIGGER_MOVIE = 0x464,\n\n\tCMSG_COMPLETE_MOVIE = 0x465,\n\n\tCMSG_SET_GLYPH_SLOT = 0x466,\n\n\tCMSG_SET_GLYPH = 0x467,\n\n\tSMSG_ACHIEVEMENT_EARNED = 0x468,\n\n\tSMSG_DYNAMIC_DROP_ROLL_RESULT = 0x469,\n\n\tSMSG_CRITERIA_UPDATE = 0x46A,\n\n\tCMSG_QUERY_INSPECT_ACHIEVEMENTS = 0x46B,\n\n\tSMSG_RESPOND_INSPECT_ACHIEVEMENTS = 0x46C,\n\n\tCMSG_DISMISS_CONTROLLED_VEHICLE = 0x46D,\n\n\tCMSG_COMPLETE_ACHIEVEMENT_CHEAT = 0x46E,\n\n\tSMSG_QUESTUPDATE_ADD_PVP_KILL = 0x46F,\n\n\tCMSG_SET_CRITERIA_CHEAT = 0x470,\n\n\tSMSG_CALENDAR_RAID_LOCKOUT_UPDATED = 0x471,\n\n\tCMSG_UNITANIMTIER_CHEAT = 0x472,\n\n\tCMSG_CHAR_CUSTOMIZE = 0x473,\n\n\tSMSG_CHAR_CUSTOMIZE = 0x474,\n\n\tSMSG_PET_RENAMEABLE = 0x475,\n\n\tCMSG_REQUEST_VEHICLE_EXIT = 0x476,\n\n\tCMSG_REQUEST_VEHICLE_PREV_SEAT = 0x477,\n\n\tCMSG_REQUEST_VEHICLE_NEXT_SEAT = 0x478,\n\n\tCMSG_REQUEST_VEHICLE_SWITCH_SEAT = 0x479,\n\n\tCMSG_PET_LEARN_TALENT = 0x47A,\n\n\tCMSG_PET_UNLEARN_TALENTS = 0x47B,\n\n\tSMSG_SET_PHASE_SHIFT = 0x47C,\n\n\tSMSG_ALL_ACHIEVEMENT_DATA = 0x47D,\n\n\tCMSG_FORCE_SAY_CHEAT = 0x47E,\n\n\tSMSG_HEALTH_UPDATE = 0x47F,\n\n\tSMSG_POWER_UPDATE = 0x480,\n\n\tCMSG_GAMEOBJ_REPORT_USE = 0x481,\n\n\tSMSG_HIGHEST_THREAT_UPDATE = 0x482,\n\n\tSMSG_THREAT_UPDATE = 0x483,\n\n\tSMSG_THREAT_REMOVE = 0x484,\n\n\tSMSG_THREAT_CLEAR = 0x485,\n\n\tSMSG_CONVERT_RUNE = 0x486,\n\n\tSMSG_RESYNC_RUNES = 0x487,\n\n\tSMSG_ADD_RUNE_POWER = 0x488,\n\n\tCMSG_START_QUEST = 0x489,\n\n\tCMSG_REMOVE_GLYPH = 0x48A,\n\n\tCMSG_DUMP_OBJECTS = 0x48B,\n\n\tSMSG_DUMP_OBJECTS_DATA = 0x48C,\n\n\tCMSG_DISMISS_CRITTER = 0x48D,\n\n\tSMSG_NOTIFY_DEST_LOC_SPELL_CAST = 0x48E,\n\n\tCMSG_AUCTION_LIST_PENDING_SALES = 0x48F,\n\n\tSMSG_AUCTION_LIST_PENDING_SALES = 0x490,\n\n\tSMSG_MODIFY_COOLDOWN = 0x491,\n\n\tSMSG_PET_UPDATE_COMBO_POINTS = 0x492,\n\n\tCMSG_ENABLETAXI = 0x493,\n\n\tSMSG_PRE_RESURRECT = 0x494,\n\n\tSMSG_AURA_UPDATE_ALL = 0x495,\n\n\tSMSG_AURA_UPDATE = 0x496,\n\n\tCMSG_FLOOD_GRACE_CHEAT = 0x497,\n\n\tSMSG_SERVER_FIRST_ACHIEVEMENT = 0x498,\n\n\tSMSG_PET_LEARNED_SPELL = 0x499,\n\n\tSMSG_PET_REMOVED_SPELL = 0x49A,\n\n\tCMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE = 0x49B,\n\n\tCMSG_HEARTH_AND_RESURRECT = 0x49C,\n\n\tSMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA = 0x49D,\n\n\tSMSG_CRITERIA_DELETED = 0x49E,\n\n\tSMSG_ACHIEVEMENT_DELETED = 0x49F,\n\n\tCMSG_SERVER_INFO_QUERY = 0x4A0,\n\n\tSMSG_SERVER_INFO_RESPONSE = 0x4A1,\n\n\tCMSG_CHECK_LOGIN_CRITERIA = 0x4A2,\n\n\tSMSG_SERVER_BUCK_DATA_START = 0x4A3,\n\n\tCMSG_SET_BREATH = 0x4A4,\n\n\tCMSG_QUERY_VEHICLE_STATUS = 0x4A5,\n\n\tSMSG_BATTLEGROUND_INFO_THROTTLED = 0x4A6, // empty, \"You can't do that yet\"\n\n\tSMSG_PLAYER_VEHICLE_DATA = 0x4A7, // guid+uint32 (vehicle)\n\n\tCMSG_PLAYER_VEHICLE_ENTER = 0x4A8, // uint64\n\n\tCMSG_CONTROLLER_EJECT_PASSENGER = 0x4A9, // uint64\n\n\tSMSG_PET_GUIDS = 0x4AA,\n\n\tSMSG_CLIENTCACHE_VERSION = 0x4AB,\n\n\tCMSG_CHANGE_GDF_ARENA_RATING = 0x4AC,\n\n\tCMSG_SET_ARENA_TEAM_RATING_BY_INDEX = 0x4AD,\n\n\tCMSG_SET_ARENA_TEAM_WEEKLY_GAMES = 0x4AE,\n\n\tCMSG_SET_ARENA_TEAM_SEASON_GAMES = 0x4AF,\n\n\tCMSG_SET_ARENA_MEMBER_WEEKLY_GAMES = 0x4B0,\n\n\tCMSG_SET_ARENA_MEMBER_SEASON_GAMES = 0x4B1,\n\n\tSMSG_ITEM_REFUND_INFO_RESPONSE = 0x4B2,\n\n\tCMSG_ITEM_REFUND_INFO = 0x4B3,\n\n\tCMSG_ITEM_REFUND = 0x4B4, // lua: ContainerRefundItemPurchase\n\n\tSMSG_ITEM_REFUND_RESULT = 0x4B5,\n\n\tCMSG_CORPSE_MAP_POSITION_QUERY = 0x4B6, // uint32\n\n\tSMSG_CORPSE_MAP_POSITION_QUERY_RESPONSE = 0x4B7, // 3*float+float\n\n\tCMSG_UNUSED5 = 0x4B8,\n\n\tCMSG_UNUSED6 = 0x4B9,\n\n\tCMSG_CALENDAR_EVENT_SIGNUP = 0x4BA, // uint64\n\n\tSMSG_CALENDAR_CLEAR_PENDING_ACTION = 0x4BB,\n\n\tSMSG_EQUIPMENT_SET_LIST = 0x4BC, // equipment manager list?\n\n\tCMSG_EQUIPMENT_SET_SAVE = 0x4BD,\n\n\tCMSG_UPDATE_PROJECTILE_POSITION = 0x4BE,\n\n\tSMSG_SET_PROJECTILE_POSITION = 0x4BF,\n\n\tSMSG_TALENTS_INFO = 0x4C0,\n\n\tCMSG_LEARN_PREVIEW_TALENTS = 0x4C1,\n\n\tCMSG_LEARN_PREVIEW_TALENTS_PET = 0x4C2,\n\n\tCMSG_SET_ACTIVE_TALENT_GROUP_OBSOLETE = 0x4C3,\n\n\tCMSG_GM_GRANT_ACHIEVEMENT = 0x4C4,\n\n\tCMSG_GM_REMOVE_ACHIEVEMENT = 0x4C5,\n\n\tCMSG_GM_SET_CRITERIA_FOR_PLAYER = 0x4C6,\n\n\tSMSG_ARENA_UNIT_DESTROYED = 0x4C7,\n\n\tSMSG_ARENA_TEAM_CHANGE_FAILED_QUEUED = 0x4C8, // uint32 \"Can't modify arena team while queued or in a match.\"\n\n\tCMSG_PROFILEDATA_REQUEST = 0x4C9,\n\n\tSMSG_PROFILEDATA_RESPONSE = 0x4CA,\n\n\tCMSG_START_BATTLEFIELD_CHEAT = 0x4CB,\n\n\tCMSG_END_BATTLEFIELD_CHEAT = 0x4CC,\n\n\tSMSG_MULTIPLE_PACKETS = 0x4CD,\n\n\tSMSG_MOVE_GRAVITY_DISABLE = 0x4CE,\n\n\tCMSG_MOVE_GRAVITY_DISABLE_ACK = 0x4CF,\n\n\tSMSG_MOVE_GRAVITY_ENABLE = 0x4D0,\n\n\tCMSG_MOVE_GRAVITY_ENABLE_ACK = 0x4D1,\n\n\tMSG_MOVE_GRAVITY_CHNG = 0x4D2,\n\n\tSMSG_SPLINE_MOVE_GRAVITY_DISABLE = 0x4D3,\n\n\tSMSG_SPLINE_MOVE_GRAVITY_ENABLE = 0x4D4,\n\n\tCMSG_EQUIPMENT_SET_USE = 0x4D5,\n\n\tSMSG_EQUIPMENT_SET_USE_RESULT = 0x4D6,\n\n\tCMSG_FORCE_ANIM = 0x4D7,\n\n\tSMSG_FORCE_ANIM = 0x4D8,\n\n\tCMSG_CHAR_FACTION_CHANGE = 0x4D9,\n\n\tSMSG_CHAR_FACTION_CHANGE = 0x4DA,\n\n\tCMSG_PVP_QUEUE_STATS_REQUEST = 0x4DB,\n\n\tSMSG_PVP_QUEUE_STATS = 0x4DC,\n\n\tCMSG_SET_PAID_SERVICE_CHEAT = 0x4DD,\n\n\tSMSG_BATTLEFIELD_MGR_ENTRY_INVITE = 0x4DE, // uint32\n\n\tCMSG_BATTLEFIELD_MGR_ENTRY_INVITE_RESPONSE = 0x4DF,\n\n\tSMSG_BATTLEFIELD_MGR_ENTERED = 0x4E0, // uint32, uint8, uint8\n\n\tSMSG_BATTLEFIELD_MGR_QUEUE_INVITE = 0x4E1, // uint32\n\n\tCMSG_BATTLEFIELD_MGR_QUEUE_INVITE_RESPONSE = 0x4E2,\n\n\tCMSG_BATTLEFIELD_MGR_QUEUE_REQUEST = 0x4E3,\n\n\tSMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE = 0x4E4, // uint32, uint8\n\n\tSMSG_BATTLEFIELD_MGR_EJECT_PENDING = 0x4E5, // uint32\n\n\tSMSG_BATTLEFIELD_MGR_EJECTED = 0x4E6, // uint32, uint32, uint8\n\n\tCMSG_BATTLEFIELD_MGR_EXIT_REQUEST = 0x4E7,\n\n\tSMSG_BATTLEFIELD_MGR_STATE_CHANGE = 0x4E8, // uint32, uint32\n\n\tCMSG_BATTLEFIELD_MANAGER_ADVANCE_STATE = 0x4E9,\n\n\tCMSG_BATTLEFIELD_MANAGER_SET_NEXT_TRANSITION_TIME = 0x4EA,\n\n\tMSG_SET_RAID_DIFFICULTY = 0x4EB,\n\n\tCMSG_TOGGLE_XP_GAIN = 0x4EC,\n\n\tSMSG_TOGGLE_XP_GAIN = 0x4ED, // enable/disable XP gain console message\n\n\tSMSG_GMRESPONSE_DB_ERROR = 0x4EE, // empty\n\n\tSMSG_GMRESPONSE_RECEIVED = 0x4EF, // uint32, uint32, string[2000], string[4000][4]\n\n\tCMSG_GMRESPONSE_RESOLVE = 0x4F0,\n\n\tSMSG_GMRESPONSE_STATUS_UPDATE = 0x4F1, // uint8 (1 - EVENT_GMSURVEY_DISPLAY, 0 - EVENT_UPDATE_TICKET)\n\n\tSMSG_GMRESPONSE_CREATE_TICKET = 0x4F2,\n\n\tCMSG_GMRESPONSE_CREATE_TICKET = 0x4F3,\n\n\tCMSG_SERVERINFO = 0x4F4,\n\n\tSMSG_SERVERINFO = 0x4F5,\n\n\tCMSG_WORLD_STATE_UI_TIMER_UPDATE = 0x4F6,\n\n\tSMSG_WORLD_STATE_UI_TIMER_UPDATE = 0x4F7,\n\n\tCMSG_CHAR_RACE_CHANGE = 0x4F8,\n\n\tMSG_VIEW_PHASE_SHIFT = 0x4F9,\n\n\tSMSG_TALENTS_INVOLUNTARILY_RESET = 0x4FA, // uint8\n\n\tCMSG_DEBUG_SERVER_GEO = 0x4FB,\n\n\tSMSG_DEBUG_SERVER_GEO = 0x4FC,\n\n\tSMSG_LOOT_SLOT_CHANGED = 0x4FD,\n\n\tUMSG_UPDATE_GROUP_INFO = 0x4FE,\n\n\tCMSG_READY_FOR_ACCOUNT_DATA_TIMES = 0x4FF,\n\n\tCMSG_QUERY_QUESTS_COMPLETED = 0x500,\n\n\tSMSG_QUERY_QUESTS_COMPLETED_RESPONSE = 0x501,\n\n\tCMSG_GM_REPORT_LAG = 0x502,\n\n\tCMSG_AFK_MONITOR_INFO_REQUEST = 0x503,\n\n\tSMSG_AFK_MONITOR_INFO_RESPONSE = 0x504,\n\n\tCMSG_AFK_MONITOR_INFO_CLEAR = 0x505,\n\n\tSMSG_CORPSE_NOT_IN_INSTANCE = 0x506,\n\n\tCMSG_GM_NUKE_CHARACTER = 0x507,\n\n\tCMSG_SET_ALLOW_LOW_LEVEL_RAID1 = 0x508,\n\n\tCMSG_SET_ALLOW_LOW_LEVEL_RAID2 = 0x509,\n\n\tSMSG_CAMERA_SHAKE = 0x50A, // uint32 SpellEffectCameraShakes.dbc index, uint32\n\n\tSMSG_SOCKET_GEMS_RESULT = 0x50B,\n\n\tCMSG_SET_CHARACTER_MODEL = 0x50C,\n\n\tSMSG_REDIRECT_CLIENT = 0x50D, // uint32 ip, uint16 port, uint32 unk, uint8[20] hash (ip + port, seed=sessionkey)\n\n\tCMSG_REDIRECTION_FAILED = 0x50E, // something with networking\n\n\tSMSG_SUSPEND_COMMS = 0x50F,\n\n\tCMSG_SUSPEND_COMMS_ACK = 0x510,\n\n\tSMSG_FORCE_SEND_QUEUED_PACKETS = 0x511,\n\n\tCMSG_REDIRECTION_AUTH_PROOF = 0x512,\n\n\tCMSG_DROP_NEW_CONNECTION = 0x513,\n\n\tSMSG_SEND_ALL_COMBAT_LOG = 0x514,\n\n\tSMSG_OPEN_LFG_DUNGEON_FINDER = 0x515,\n\n\tSMSG_MOVE_SET_COLLISION_HGT = 0x516,\n\n\tCMSG_MOVE_SET_COLLISION_HGT_ACK = 0x517,\n\n\tMSG_MOVE_SET_COLLISION_HGT = 0x518,\n\n\tCMSG_CLEAR_RANDOM_BG_WIN_TIME = 0x519,\n\n\tCMSG_CLEAR_HOLIDAY_BG_WIN_TIME = 0x51A,\n\n\tCMSG_COMMENTATOR_SKIRMISH_QUEUE_COMMAND = 0x51B,\n\n\tSMSG_COMMENTATOR_SKIRMISH_QUEUE_RESULT1 = 0x51C,\n\n\tSMSG_COMMENTATOR_SKIRMISH_QUEUE_RESULT2 = 0x51D,\n\n\tSMSG_MULTIPLE_MOVES = 0x51E, // uncompressed version of SMSG_COMPRESSED_MOVES\n\n\tNUM_MSG_TYPES = 0x51F\n", "file_path": "owClient/WorldSocket/Opcodes.h", "rank": 0, "score": 88797.40201669149 }, { "content": "#define SN_netscape_cert_sequence \"nsCertSequence\"\n", "file_path": "Externals/OpenSSL/include/openssl/obj_mac.h", "rank": 1, "score": 75441.28331141104 }, { "content": "#define NID_netscape_cert_sequence 79\n", "file_path": "Externals/OpenSSL/include/openssl/obj_mac.h", "rank": 2, "score": 75441.28331141104 }, { "content": "#define OBJ_netscape_cert_sequence OBJ_netscape_data_type,5L\n\n\n", "file_path": "Externals/OpenSSL/include/openssl/obj_mac.h", "rank": 3, "score": 75441.28331141104 }, { "content": "#define LN_netscape_cert_sequence \"Netscape Certificate Sequence\"\n", "file_path": "Externals/OpenSSL/include/openssl/obj_mac.h", "rank": 4, "score": 75441.28331141104 }, { "content": "#define NID_id_cmc_dataReturn 330\n", "file_path": "Externals/OpenSSL/include/openssl/obj_mac.h", "rank": 5, "score": 73547.06373468976 }, { "content": "#define OBJ_id_cmc_dataReturn OBJ_id_cmc,4L\n\n\n", "file_path": "Externals/OpenSSL/include/openssl/obj_mac.h", "rank": 6, "score": 73547.06373468976 }, { "content": "#define SN_id_cmc_dataReturn \"id-cmc-dataReturn\"\n", "file_path": "Externals/OpenSSL/include/openssl/obj_mac.h", "rank": 7, "score": 73547.06373468976 }, { "content": "#define __DBC_TVALUE(type, _name, _field) \\\n\ntype CONCAT_GET(_name)() const \\\n\n{ \\\n\n\treturn getValue<type>(static_cast<uint32>(_field - 1)); \\\n\n}\n\n\n\n#define __DBC_TARRAY(_type, _name, _field, _size) \\\n\n_type CONCAT_GET(_name)(uint8 _index) const \\\n\n{ \\\n\n _ASSERT(_index < _size); \\\n\n\treturn getValue<_type>(static_cast<uint32>(_field - 1 + _index)); \\\n\n}\n\n\n\n#define __DBC_STRING(_name, _field) \\\n\nstd::string CONCAT_GET(_name)() const \\\n\n{ \\\n\n\treturn getString(static_cast<uint32>(_field - 1)); \\\n\n}\n\n\n\n#define __DBC_STRARR(_name, _field, _size) \\\n\nstd::string CONCAT_GET(_name)(uint8 _index) const \\\n", "file_path": "owGame/DBC/DBC__Macros.h", "rank": 8, "score": 68140.65998280243 }, { "content": "enum class EWoWObjectHighGuid : uint16\n\n{\n\n Item = 0x4000, // blizz 4000\n\n Container = 0x4000, // blizz 4000\n\n Player = 0x0000, // blizz 0000\n\n GameObject = 0xF110, // blizz F110\n\n Transport = 0xF120, // blizz F120 (for GAMEOBJECT_TYPE_TRANSPORT)\n\n Unit = 0xF130, // blizz F130\n\n Pet = 0xF140, // blizz F140\n\n Vehicle = 0xF150, // blizz F550\n\n DynamicObject = 0xF100, // blizz F100\n\n Corpse = 0xF101, // blizz F100\n\n Mo_Transport = 0x1FC0, // blizz 1FC0 (for GAMEOBJECT_TYPE_MO_TRANSPORT)\n\n Instance = 0x1F40, // blizz 1F40\n\n Group = 0x1F50,\n\n};\n\n\n", "file_path": "owClient/World/WoWGUID.h", "rank": 9, "score": 63004.6695290205 }, { "content": "struct SM2_Loop\n\n{\n\n\tuint32 timestamp;\n", "file_path": "owGame/M2/M2_Types.h", "rank": 10, "score": 44571.486098594636 }, { "content": "struct SM2_Sequence\n\n{\n\n\tFOREIGN_KEY_ID(uint16, DBC_AnimationData, animID); // Animation id in AnimationData.dbc\t\n\n\tuint16 variationIndex;\t\t\t// Sub-animation id: Which number in a row of animations this one is.\n\n\n\n#if WOW_CLIENT_VERSION <= WOW_BC_2_4_3\n\n\tuint32_t start_timestamp;\n\n\tuint32_t end_timestamp;\n\n#else\n\n\tuint32_t duration;\n\n#endif\n\n\n\n\tfloat movespeed;\t\t\t\t// This is the speed the character moves with in this animation.\n\n\n\n\tstruct Flags\n\n\t{\n\n\t\tuint32 unk0x01 : 1;\n\n\t\tuint32 unk0x02 : 1;\n\n\t\tuint32 unk0x04 : 1;\n\n\t\tuint32 unk0x08 : 1;\n\n\t\tuint32 LowPrioritySeq : 1;\n\n\t\tuint32 DataInM2 : 1; // If set, the animation data is in the .m2 file. If not set, the animation data is in an .anim file.\n\n\t\tuint32 HasNext : 1; // (To find the animation data, the client skips these by following aliasNext until an animation without 0x40 is found.)\n\n\t\tuint32 IsBlended : 1; // (if either side of a transition has 0x80, lerp between end->start states, unless end==start by comparing bone values)\n\n\t\tuint32 : 24;\n\n\t} flags;\n\n\tint16\t\tfrequency;\t\t\t\t// This is used to determine how often the animation is played. For all animations of the same type, this adds up to 0x7FFF (32767).\n\n\tuint16\t\tunk0;\n\n\tM2Range\t\treplay;\t\t\t\t\t// May both be 0 to not repeat. Client will pick a random number of repetitions within bounds if given.\n\n\tuint32\t\tblendTime;\n\n\n\n\tM2Bounds\tbounds;\n\n\tint16\t\tvariationNext;\t\t\t// id of the following animation of this AnimationID, points to an Index or is -1 if none.\n\n\tuint16\t\taliasNext;\t\t\t\t// id in the list of animations. Used to find actual animation if this sequence is an alias (flags & 0x40)\n", "file_path": "owGame/M2/M2_Types.h", "rank": 11, "score": 44566.94643720141 }, { "content": " int16\t\t\t\t\t\t\t\tglobal_sequence;\n", "file_path": "owGame/M2/M2_CommonTypes.h", "rank": 12, "score": 43321.11626601458 }, { "content": "const float C_ChunkSize = C_TileSize / 16.0f;\n", "file_path": "owGame/Utils/WowConsts.h", "rank": 13, "score": 43316.86666275927 }, { "content": "const float C_UnitSize = C_ChunkSize / 8.0f;\n", "file_path": "owGame/Utils/WowConsts.h", "rank": 14, "score": 43316.86666275927 }, { "content": "const uint32 C_RenderedTiles = 1u;\n", "file_path": "owGame/Utils/WowConsts.h", "rank": 15, "score": 43316.86666275927 }, { "content": "const uint32 C_TilesInMap = 64u;\n", "file_path": "owGame/Utils/WowConsts.h", "rank": 16, "score": 43316.86666275927 }, { "content": "const float C_ZeroPoint = 32.0f * C_TileSize; // 17066.66656\n", "file_path": "owGame/Utils/WowConsts.h", "rank": 17, "score": 43316.86666275927 }, { "content": "const int32 C_ChunksInTile = 16;\n", "file_path": "owGame/Utils/WowConsts.h", "rank": 18, "score": 43316.86666275927 }, { "content": "const float C_DetailSize = 8.0f;\n", "file_path": "owGame/Utils/WowConsts.h", "rank": 19, "score": 43316.86666275927 }, { "content": "const float C_TileSize = 533.3333333333f;\n", "file_path": "owGame/Utils/WowConsts.h", "rank": 20, "score": 43316.86666275927 }, { "content": "const float C_AlphaSize = 1.0f;\n", "file_path": "owGame/Utils/WowConsts.h", "rank": 21, "score": 43316.86666275927 }, { "content": "DBC_DEF_BEGIN(DBC_CinematicSequences)\n\n\n", "file_path": "owGame/DBC/Tables/DBC_CinematicSequences.h", "rank": 22, "score": 42143.04417151918 }, { "content": "const int32 C_ChunksInTileGlobal = C_ChunksInTile * C_ChunksInTile;\n", "file_path": "owGame/Utils/WowConsts.h", "rank": 23, "score": 42138.91013174513 }, { "content": "const uint32 C_TilesCacheSize = ((C_RenderedTiles + 1u) * (C_RenderedTiles + 1u));\n", "file_path": "owGame/Utils/WowConsts.h", "rank": 24, "score": 42138.91013174513 }, { "content": "const int32 C_MapBufferSize = 9 * 9 + 8 * 8;\n", "file_path": "owGame/Utils/WowConsts.h", "rank": 25, "score": 42138.91013174513 }, { "content": " DES_cblock h, hh;\n", "file_path": "Externals/OpenSSL/include/openssl/mdc2.h", "rank": 26, "score": 40723.64097802318 }, { "content": " ASN1_TIME *notBefore;\n", "file_path": "Externals/OpenSSL/include/openssl/x509.h", "rank": 27, "score": 40723.64097802318 }, { "content": " union {\n\n SHA_LONG64 d[SHA_LBLOCK];\n\n unsigned char p[SHA512_CBLOCK];\n", "file_path": "Externals/OpenSSL/include/openssl/sha.h", "rank": 28, "score": 40723.64097802318 }, { "content": " MD4_LONG A, B, C, D;\n", "file_path": "Externals/OpenSSL/include/openssl/md4.h", "rank": 29, "score": 40723.64097802318 }, { "content": " ASN1_ITEM_EXP *it;\n", "file_path": "Externals/OpenSSL/include/openssl/x509v3.h", "rank": 30, "score": 40723.64097802318 }, { "content": " int (*check_purpose) (const struct x509_purpose_st *, const X509 *, int);\n", "file_path": "Externals/OpenSSL/include/openssl/x509v3.h", "rank": 31, "score": 40723.64097802318 }, { "content": " unsigned char *out;\n", "file_path": "Externals/OpenSSL/include/openssl/evp.h", "rank": 32, "score": 40723.64097802318 }, { "content": " int (*adb_cb)(long *psel); /* Application callback */\n", "file_path": "Externals/OpenSSL/include/openssl/asn1t.h", "rank": 33, "score": 40723.64097802318 }, { "content": " RIPEMD160_LONG A, B, C, D, E;\n", "file_path": "Externals/OpenSSL/include/openssl/ripemd.h", "rank": 34, "score": 40723.64097802318 }, { "content": " union {\n\n double d; /* ensures 64-bit align */\n\n KEY_TABLE_TYPE rd_key;\n", "file_path": "Externals/OpenSSL/include/openssl/camellia.h", "rank": 35, "score": 40723.64097802318 }, { "content": " union {\n\n ASN1_NULL *inherit;\n\n IPAddressOrRanges *addressesOrRanges;\n", "file_path": "Externals/OpenSSL/include/openssl/x509v3.h", "rank": 36, "score": 40723.64097802318 }, { "content": " const BIGNUM *g;\n", "file_path": "Externals/OpenSSL/include/openssl/srp.h", "rank": 37, "score": 40723.64097802318 }, { "content": " BIGNUM *s;\n", "file_path": "Externals/OpenSSL/include/openssl/srp.h", "rank": 38, "score": 40723.64097802318 }, { "content": " MD5_LONG A, B, C, D;\n", "file_path": "Externals/OpenSSL/include/openssl/md5.h", "rank": 39, "score": 40723.64097802318 }, { "content": " SHA_LONG64 h[8];\n", "file_path": "Externals/OpenSSL/include/openssl/sha.h", "rank": 40, "score": 40723.64097802318 }, { "content": " RC4_INT x, y;\n", "file_path": "Externals/OpenSSL/include/openssl/rc4.h", "rank": 41, "score": 40723.64097802318 }, { "content": " ASN1_GENERALIZEDTIME *notAfter;\n", "file_path": "Externals/OpenSSL/include/openssl/x509v3.h", "rank": 42, "score": 40723.64097802318 }, { "content": " BIGNUM *v;\n", "file_path": "Externals/OpenSSL/include/openssl/srp.h", "rank": 43, "score": 40723.64097802318 }, { "content": " int (*load) (CONF *conf, const char *name, long *eline);\n", "file_path": "Externals/OpenSSL/include/openssl/conf.h", "rank": 44, "score": 40723.64097802318 }, { "content": " ASN1_GENERALIZEDTIME *notBefore;\n", "file_path": "Externals/OpenSSL/include/openssl/x509v3.h", "rank": 45, "score": 40723.64097802318 }, { "content": " union {\n\n ASN1_IA5STRING *cpsuri;\n\n USERNOTICE *usernotice;\n\n ASN1_TYPE *other;\n", "file_path": "Externals/OpenSSL/include/openssl/x509v3.h", "rank": 46, "score": 40723.64097802318 }, { "content": " int (*check_trust) (struct x509_trust_st *, X509 *, int);\n", "file_path": "Externals/OpenSSL/include/openssl/x509.h", "rank": 47, "score": 40723.64097802318 }, { "content": " BIO *out;\n", "file_path": "Externals/OpenSSL/include/openssl/asn1t.h", "rank": 48, "score": 40723.64097802318 }, { "content": " ASN1_TIME *notAfter;\n", "file_path": "Externals/OpenSSL/include/openssl/x509.h", "rank": 49, "score": 40723.64097802318 }, { "content": " union {\n\n char *ptr;\n\n /* NID_pkcs7_data */\n\n ASN1_OCTET_STRING *data;\n\n /* NID_pkcs7_signed */\n\n PKCS7_SIGNED *sign;\n\n /* NID_pkcs7_enveloped */\n\n PKCS7_ENVELOPE *enveloped;\n\n /* NID_pkcs7_signedAndEnveloped */\n\n PKCS7_SIGN_ENVELOPE *signed_and_enveloped;\n\n /* NID_pkcs7_digest */\n\n PKCS7_DIGEST *digest;\n\n /* NID_pkcs7_encrypted */\n\n PKCS7_ENCRYPT *encrypted;\n\n /* Anything else */\n\n ASN1_TYPE *other;\n", "file_path": "Externals/OpenSSL/include/openssl/pkcs7.h", "rank": 50, "score": 40723.64097802318 }, { "content": " int (*status) (void);\n", "file_path": "Externals/OpenSSL/include/openssl/rand.h", "rank": 51, "score": 40723.64097802318 }, { "content": " long plen; /* length */\n", "file_path": "Externals/OpenSSL/include/openssl/asn1t.h", "rank": 52, "score": 39558.11710804085 }, { "content": " const void *funcs; /* functions that handle this type */\n", "file_path": "Externals/OpenSSL/include/openssl/asn1t.h", "rank": 53, "score": 39557.91970742002 }, { "content": " long tcount; /* Number of templates if SEQUENCE or CHOICE */\n", "file_path": "Externals/OpenSSL/include/openssl/asn1t.h", "rank": 54, "score": 39557.91970742002 }, { "content": " long utype; /* underlying type */\n", "file_path": "Externals/OpenSSL/include/openssl/asn1t.h", "rank": 55, "score": 39557.74866401569 }, { "content": " int bitnum;\n", "file_path": "Externals/OpenSSL/include/openssl/asn1.h", "rank": 56, "score": 39552.50909168249 }, { "content": " unsigned char *enc; /* DER encoding */\n", "file_path": "Externals/OpenSSL/include/openssl/asn1.h", "rank": 57, "score": 39552.50909168249 }, { "content": " int modified; /* set to 1 if 'enc' is invalid */\n", "file_path": "Externals/OpenSSL/include/openssl/asn1.h", "rank": 58, "score": 39552.50909168249 }, { "content": " int type;\n", "file_path": "Externals/OpenSSL/include/openssl/asn1.h", "rank": 59, "score": 39552.50909168249 }, { "content": " const char *lname;\n", "file_path": "Externals/OpenSSL/include/openssl/asn1.h", "rank": 60, "score": 39552.50909168249 }, { "content": " unsigned long flags; /* Various flags */\n", "file_path": "Externals/OpenSSL/include/openssl/asn1t.h", "rank": 61, "score": 39552.50909168249 }, { "content": " union {\n\n char *ptr;\n\n ASN1_BOOLEAN boolean;\n\n ASN1_STRING *asn1_string;\n\n ASN1_OBJECT *object;\n\n ASN1_INTEGER *integer;\n\n ASN1_ENUMERATED *enumerated;\n\n ASN1_BIT_STRING *bit_string;\n\n ASN1_OCTET_STRING *octet_string;\n\n ASN1_PRINTABLESTRING *printablestring;\n\n ASN1_T61STRING *t61string;\n\n ASN1_IA5STRING *ia5string;\n\n ASN1_GENERALSTRING *generalstring;\n\n ASN1_BMPSTRING *bmpstring;\n\n ASN1_UNIVERSALSTRING *universalstring;\n\n ASN1_UTCTIME *utctime;\n\n ASN1_GENERALIZEDTIME *generalizedtime;\n\n ASN1_VISIBLESTRING *visiblestring;\n\n ASN1_UTF8STRING *utf8string;\n\n /*\n\n * set and sequence are left complete and still contain the set or\n\n * sequence bytes\n\n */\n\n ASN1_STRING *set;\n\n ASN1_STRING *sequence;\n\n ASN1_VALUE *asn1_value;\n", "file_path": "Externals/OpenSSL/include/openssl/asn1.h", "rank": 62, "score": 39552.50909168249 }, { "content": " unsigned long offset; /* Offset of this field in structure */\n", "file_path": "Externals/OpenSSL/include/openssl/asn1t.h", "rank": 63, "score": 39552.50909168249 }, { "content": " unsigned long flags;\n", "file_path": "Externals/OpenSSL/include/openssl/asn1.h", "rank": 64, "score": 39552.50909168249 }, { "content": " const char *sname;\n", "file_path": "Externals/OpenSSL/include/openssl/asn1.h", "rank": 65, "score": 39552.50909168249 }, { "content": " long maxsize;\n", "file_path": "Externals/OpenSSL/include/openssl/asn1.h", "rank": 66, "score": 39552.50909168249 }, { "content": " long tag; /* tag, not used if no tagging */\n", "file_path": "Externals/OpenSSL/include/openssl/asn1t.h", "rank": 67, "score": 39552.50909168249 }, { "content": " int nid;\n", "file_path": "Externals/OpenSSL/include/openssl/asn1.h", "rank": 68, "score": 39552.50909168249 }, { "content": " long minsize;\n", "file_path": "Externals/OpenSSL/include/openssl/asn1.h", "rank": 69, "score": 39552.50909168249 }, { "content": " unsigned char *data;\n", "file_path": "Externals/OpenSSL/include/openssl/asn1.h", "rank": 70, "score": 39552.50909168249 }, { "content": " long len; /* Length of encoding */\n", "file_path": "Externals/OpenSSL/include/openssl/asn1.h", "rank": 71, "score": 39552.50909168249 }, { "content": " int length;\n", "file_path": "Externals/OpenSSL/include/openssl/asn1.h", "rank": 72, "score": 39552.50909168249 }, { "content": " unsigned long mask;\n", "file_path": "Externals/OpenSSL/include/openssl/asn1.h", "rank": 73, "score": 39552.50909168249 }, { "content": "\t\tif (SequenceIndex < GetCount())\n\n\t\t{\n\n\t\t\tif (m_Values[SequenceIndex].empty())\n\n\t\t\t\treturn false;\n\n\n\n\t\t\treturn true;\n\n\t\t}\n\n\n\n\t\treturn false;\n\n\t}\n\n\n\n\tinline T GetValue(uint16 SequenceIndex, uint32 time, const std::vector<SM2_Loop>& GlobalLoop, const uint32 GlobalTime, bool ForceLinear = false) const\n\n\t{\n\n\t\tif (IsStaticValue())\n\n\t\t{\n\n\t\t\treturn m_Values.at(0).at(0);\n\n\t\t}\n\n\n\n\t\t// obtain a time value and a values range\n\n\t\tif (m_GlobalSecIndex != -1)\n", "file_path": "owGame/M2/M2_Animated.h", "rank": 75, "score": 19.57350032290633 }, { "content": "void CM2_Comp_Skeleton::Load(const SM2_Header& M2Header, const std::shared_ptr<IByteBuffer>& File)\n\n{\n\n\tif (M2Header.global_loops.size > 0)\n\n\t{\n\n\t\tconst SM2_Loop* GlobalLoops = (const SM2_Loop*)(File->getData() + M2Header.global_loops.offset);\n\n\t\tfor (uint32 i = 0; i < M2Header.global_loops.size; i++)\n\n\t\t\tm_GlobalLoops.push_back(GlobalLoops[i]);\n\n\t}\n\n\n\n\t// Sequences\n\n\tif (M2Header.sequences.size > 0)\n\n\t{\n\n\t\tconst SM2_Sequence* Sequences = (const SM2_Sequence*)(File->getData() + M2Header.sequences.offset);\n\n\t\tfor (uint32 i = 0; i < M2Header.sequences.size; i++)\n\n\t\t{\n\n\t\t\tm_Sequences.push_back(Sequences[i]);\n\n\n\n\t\t\tif (Sequences[i].flags.DataInM2)\n\n\t\t\t{\n\n\t\t\t\tanimFiles.push_back(nullptr);\n", "file_path": "owGame/M2/M2_Comp_Skeleton.cpp", "rank": 77, "score": 16.850029349490654 }, { "content": "\t\t\t\t\t\tm_ValuesHermiteIn[j].push_back(fixfunc(Conv::conv(values[i * 3 + 1])));\n\n\t\t\t\t\t\tm_ValuesHermiteOut[j].push_back(fixfunc(Conv::conv(values[i * 3 + 2])));\n\n\t\t\t\t\t\tbreak;\n\n\n\n\t\t\t\t\t\t//default:\n\n\t\t\t\t\t\t//\t_ASSERT_EXPR(false, \"M2_Animated: Unknown interpolation type.\");\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\n\n\tinline bool IsUsesBySequence(uint16 SequenceIndex) const\n\n\t{\n\n\t\tif (IsStaticValue())\n\n\t\t\treturn true;\n\n\n\n\t\t// Global sec always use\n\n\t\tif (m_GlobalSecIndex != -1)\n\n\t\t\treturn true;\n\n\n", "file_path": "owGame/M2/M2_Animated.h", "rank": 78, "score": 15.727656540650248 }, { "content": "\t_ASSERT(M2Instance != nullptr);\n\n\n\n\tif (const auto& animator = M2Instance->GetAnimatorComponent())\n\n\t\tif (m_ColorAnimated.IsUsesBySequence(animator->getSequenceIndex()))\n\n\t\t\treturn m_ColorAnimated.GetValue(animator->getSequenceIndex(), animator->getCurrentTime(), m_M2Object.getSkeleton().getGlobalLoops(), GlobalTime);\n\n\treturn glm::vec3(1.0f, 0.0f, 0.0f);\n\n}\n\n\n\nfloat CM2_Part_Color::GetAlpha(const CM2_Base_Instance* M2Instance, uint32 GlobalTime) const\n\n{\n\n\t_ASSERT(M2Instance != nullptr);\n\n\n\n\tif (const auto& animator = M2Instance->GetAnimatorComponent())\n\n\t\tif (m_AlphaAnimated.IsUsesBySequence(animator->getSequenceIndex()))\n\n\t\t\treturn m_AlphaAnimated.GetValue(animator->getSequenceIndex(), animator->getCurrentTime(), m_M2Object.getSkeleton().getGlobalLoops(), GlobalTime);\n\n\treturn 0.5f;\n\n}\n", "file_path": "owGame/M2/M2_Part_Color.cpp", "rank": 79, "score": 15.295830860716789 }, { "content": "\t\tfloat horizontalRangeValue = horizontalRange.GetValue(sequence, sequenceTime, m_M2Object.getSkeleton().getGlobalLoops(), globalTime);\n\n\n\n\t\tbool enabledValue = true;\n\n\t\tif (enabled.IsUsesBySequence(sequence))\n\n\t\t\tenabledValue = enabled.GetValue(sequence, sequenceTime, m_M2Object.getSkeleton().getGlobalLoops(), globalTime) != 0;\n\n\n\n\t\tif (false == enabledValue)\n\n\t\t\treturn;\n\n\n\n\t\tfor (int i = 0; i < tospawn; i++)\n\n\t\t{\n\n\t\t\tsize_t freeIndex = -1;\n\n\t\t\tfor (size_t ind = 0; ind < MAX_PARTICLES; ind++)\n\n\t\t\t{\n\n\t\t\t\tif (false == Particles[ind].Active)\n\n\t\t\t\t{\n\n\t\t\t\t\tfreeIndex = ind;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n", "file_path": "owGame/M2/M2_Part_ParticleSystem.cpp", "rank": 80, "score": 15.009433618092208 }, { "content": "\n\n\t\tif (m_GlobalSecIndex == -1 && m_Ranges.size() <= SequenceIndex)\n\n\t\t\treturn false;\n\n\n\n\t\tif (m_Values.empty())\n\n\t\t\treturn false; // ????\n\n\n\n\t\treturn true;\n\n\t}\n\n\n\n\tinline T GetValue(uint16 SequenceIndex, uint32 time, const std::vector<SM2_Loop>& GlobalLoop, const uint32 GlobalTime) const\n\n\t{\n\n\t\t_ASSERT(m_Values.empty() == false);\n\n\t\tif (m_Values.size() == 1)\n\n\t\t\treturn m_Values[0];\n\n\n\n std::pair<uint32, uint32> range = std::make_pair(0, m_Values.size() - 1);\n\n\n\n\t\t// obtain a time value and a values range\n\n\t\tif (m_GlobalSecIndex != -1)\n", "file_path": "owGame/M2/M2_Animated.h", "rank": 81, "score": 14.46424231463656 }, { "content": "\n\n\n\n\n\n\n\n\n\n\n\nvoid CWorldSocket::AddHandler(Opcodes Opcode, std::function<void(CServerPacket&)> Handler)\n\n{\n\n\t_ASSERT(Handler != nullptr);\n\n\tm_Handlers.insert(std::make_pair(Opcode, Handler));\n\n}\n\n\n\nbool CWorldSocket::ProcessPacket(CServerPacket& ServerPacket)\n\n{\n\n\tServerPacket.seek(0);\n\n\n\n\tconst auto& handler = m_Handlers.find(ServerPacket.GetPacketOpcode());\n\n\tif (handler != m_Handlers.end())\n\n\t{\n\n\t\t_ASSERT(handler->second != nullptr);\n", "file_path": "owClient/WorldSocket/WorldSocket.cpp", "rank": 82, "score": 14.363836726913515 }, { "content": "#include \"stdafx.h\"\n\n\n\n// Include\n\n#include \"M2.h\"\n\n\n\n// General\n\n#include \"M2_Animation.h\"\n\n\n\nCM2_Animation::CM2_Animation(const CM2& M2Model, const SM2_Sequence& Sequence, std::string AnimationName, uint16 IndexIntoSeq)\n\n\t: m_AnimID((EAnimationID)Sequence.__animID)\n\n\t, m_AnimationName(AnimationName + \"_\" + std::to_string(IndexIntoSeq))\n\n\t, m_SequenceIndex(IndexIntoSeq)\n\n#if WOW_CLIENT_VERSION <= WOW_BC_2_4_3\n\n\t, m_StartTimeStamp(Sequence.start_timestamp)\n\n , m_EndTimeStamp(Sequence.end_timestamp)\n\n#else\n\n\t, m_Duration(Sequence.duration)\n\n#endif\n\n{\n\n\tif (Sequence.variationNext != -1)\n", "file_path": "owGame/M2/M2_Animation.cpp", "rank": 83, "score": 13.811921717620134 }, { "content": "}\n\n\n\nbool CWMO_Base_Instance::IsDoodadInSet(uint16 doodadIndex) const\n\n{\n\n\tif (GetWMO().IsDoodadInSet(0, doodadIndex))\n\n\t\treturn true;\n\n\n\n\tif (GetDoodadSetIndex() != 0)\n\n\t\treturn GetWMO().IsDoodadInSet(GetDoodadSetIndex(), doodadIndex);\n\n\n\n\treturn false;\n\n}\n\n\n\n\n\n\n\n//\n\n// ISceneNode\n\n//\n\nvoid CWMO_Base_Instance::Initialize()\n\n{\n", "file_path": "owGame/WMO/WMO_Base_Instance.cpp", "rank": 84, "score": 13.767590745128237 }, { "content": "void CWorldServer::AddHandler(Opcodes Opcode, std::function<void(CServerPacket&)> Handler)\n\n{\n\n\t_ASSERT(Handler != nullptr);\n\n\tm_Handlers.insert(std::make_pair(Opcode, Handler));\n\n}\n\n\n\nbool CWorldServer::ProcessPacket(CServerPacket& ServerPacket)\n\n{\n\n\tconst auto& handler = m_Handlers.find(ServerPacket.GetPacketOpcode());\n\n\tif (handler != m_Handlers.end())\n\n\t{\n\n\t\t_ASSERT(handler->second != nullptr);\n\n\t\t(handler->second).operator()(ServerPacket);\n\n\n\n\t\tif (ServerPacket.getPos() != ServerPacket.getSize())\n\n\t\t\tthrow CException(\"CWorldServer::ProcessPacket: Packet '%d' is not fully readed. %d of %d.\", ServerPacket.GetPacketOpcode(), ServerPacket.getPos(), ServerPacket.getSize());\n\n\n\n\t\treturn true;\n\n\t}\n\n\n", "file_path": "owClient/World/WorldServer.cpp", "rank": 85, "score": 13.725974297212709 }, { "content": "\t\t}\n\n\t}\n\n}\n\n\n\nMinimapDir* CMinimapProvider::getMinimap(std::string _name)\n\n{\n\n\tfor (auto& it : m_Minimaps)\n\n\t{\n\n\t\tif (it->name == _name)\n\n\t\t{\n\n\t\t\treturn it;\n\n\t\t}\n\n\t}\n\n\t\n\n\treturn nullptr;\n\n}\n\n\n\nvoid MinimapDir::Load()\n\n{\n\n\t/*for (auto& it : data)\n", "file_path": "owGame/Map/MinimapProvider.cpp", "rank": 86, "score": 13.623692228570713 }, { "content": "\tvoid Update(const UpdateEventArgs& e) override;\n\n\n\nprotected:\n\n\tconst CM2_Base_Instance& GetM2OwnerNode() const;\n\n\n\nprivate:\n\n\tstd::unordered_map<uint16, std::shared_ptr<CM2_Animation>>\tm_Animations;\n\n\n\n\tEAnimationID m_CurrentAnimationID;\n\n\tconst CM2_Animation*\t\tm_CurrentAnimation;\n\n\n\n\tbool\t\t\t\t\t\tm_IsLoop;\n\n\tbool\t\t\t\t\t\tm_IsStopped;\n\n\n\n\tstd::weak_ptr<IM2AnimationEventsListener> m_M2AnimationEventListener;\n\n\n\n\tdouble\t\t\t\t\t\tm_AnimTime;\n\n\tuint32\t\t\t\t\t\tm_CurrentTime;\n\n};\n", "file_path": "owGame/M2/M2_AnimatorComponent.h", "rank": 87, "score": 13.088700064197528 }, { "content": "#include \"stdafx.h\"\n\n\n\n // General\n\n#include \"AuthCrypt.h\"\n\n\n\n // Additional\n\n#include \"HMACSHA1.h\"\n\n\n\n#if WOW_CLIENT_VERSION < WOW_WOTLK_3_3_5\n\n\n\nAuthCrypt::AuthCrypt()\n\n{\n\n _initialized = false;\n\n}\n\n\n\nvoid AuthCrypt::Init()\n\n{\n\n _send_i = _send_j = _recv_i = _recv_j = 0;\n\n _initialized = true;\n\n}\n", "file_path": "owClient/AuthSocket/Cryptography/AuthCrypt.cpp", "rank": 88, "score": 13.05176087623277 }, { "content": "#include \"stdafx.h\"\n\n\n\n// General\n\n#include \"WDBCreatureCache.h\"\n\n\n\nCowWDBCreatureCache::CowWDBCreatureCache(IFilesManager * FilesManager)\n\n\t: CowWDBFile(FilesManager, \"creaturecache.wdb\")\n\n{\n\n\tauto file = LoadFile();\n\n\tif (file == nullptr)\n\n\t{\n\n\t\tLog::Warn(\"CowWDBCreatureCache:: File '%s' not found.\", m_FileName.c_str());\n\n\t}\n\n\n\n\twhile (false == file->isEof())\n\n\t{\n\n\t\tuint32 entry;\n\n\t\tfile->read(&entry);\n\n\n\n\t\tuint32 entrySize;\n", "file_path": "owClient/Client/WDB/WDBCreatureCache.cpp", "rank": 89, "score": 13.037761915916448 }, { "content": "#include \"stdafx.h\"\n\n\n\n// General\n\n#include \"WDBItemCache.h\"\n\n\n\nCowWDBItemCache::CowWDBItemCache(IFilesManager * FilesManager)\n\n\t: CowWDBFile(FilesManager, \"itemcache.wdb\")\n\n{\n\n\tauto file = LoadFile();\n\n\tif (file == nullptr)\n\n\t{\n\n\t\tLog::Warn(\"CowWDBItemCache:: File '%s' not found.\", m_FileName.c_str());\n\n\t}\n\n\n\n\twhile (false == file->isEof())\n\n\t{\n\n\t\tuint32 entry;\n\n\t\tfile->read(&entry);\n\n\n\n\t\tuint32 entrySize;\n", "file_path": "owClient/Client/WDB/WDBItemCache.cpp", "rank": 90, "score": 13.037761915916448 }, { "content": "\t}\n\n\n\n\t// kill stuff from the end\n\n\tfloat l = 0;\n\n\tbool erasemode = false;\n\n\tfor (auto it = m_Segments.begin(); it != m_Segments.end(); )\n\n\t{\n\n\t\tif (!erasemode)\n\n\t\t{\n\n\t\t\tl += it->len;\n\n\t\t\tif (l > length)\n\n\t\t\t{\n\n\t\t\t\tit->len = l - length;\n\n\t\t\t\terasemode = true;\n\n\t\t\t}\n\n\t\t\t++it;\n\n\t\t}\n\n\t\telse\n\n\t\t{\n\n\t\t\tm_Segments.erase(it++);\n", "file_path": "owGame/M2/M2_RibbonEmitters.cpp", "rank": 91, "score": 12.880766528519281 }, { "content": "", "file_path": "owClient/AuthSocket/AuthSocket.cpp", "rank": 92, "score": 12.772791024735021 }, { "content": "\tm_Targets.Initialize(M2Camera.target_position, ByteBuffer, M2Object.getSkeleton().GetAnimFiles(), Fix_From_XZmY_To_XYZ);\n\n\tm_Rolls.Initialize(M2Camera.roll, ByteBuffer, M2Object.getSkeleton().GetAnimFiles());\n\n}\n\n\n\nCM2_Part_Camera::~CM2_Part_Camera()\n\n{\n\n}\n\n\n\nbool CM2_Part_Camera::Calculate(const CM2_Base_Instance& M2Instance, uint32 globalTime, float AspectRatio, const glm::mat4& OriginMatrix, glm::vec3 * Position, glm::vec3 * Direction, glm::mat4 * Projection, glm::mat4 * View) const\n\n{\n\n\tconst auto& animator = M2Instance.GetAnimatorComponent();\n\n\tif (animator == nullptr)\n\n\t\treturn false;\n\n\n\n\tglm::vec3 position = m_PositionBase;\n\n\tif (m_Positions.IsUsesBySequence(animator->getSequenceIndex()))\n\n\t\tposition += m_Positions.GetValue(animator->getSequenceIndex(), animator->getCurrentTime(), m_M2Object.getSkeleton().getGlobalLoops(), globalTime, true);\n\n\tposition = OriginMatrix * glm::vec4(position, 1.0f);\n\n\t*Position = position;\n\n\n", "file_path": "owGame/M2/M2_Part_Camera.cpp", "rank": 93, "score": 12.749172517017621 }, { "content": "#include \"stdafx.h\"\n\n\n\n// General\n\n#include \"WDBGameObjectCache.h\"\n\n\n\nCowWDBGameObjectCache::CowWDBGameObjectCache(IFilesManager * FilesManager)\n\n\t: CowWDBFile(FilesManager, \"gameobjectcache.wdb\")\n\n{\n\n\tauto file = LoadFile();\n\n\tif (file == nullptr)\n\n\t{\n\n\t\tLog::Warn(\"CowWDBGameObjectCache:: File '%s' not found.\", m_FileName.c_str());\n\n\t}\n\n\n\n\twhile (false == file->isEof())\n\n\t{\n\n\t\tuint32 entry;\n\n\t\tfile->read(&entry);\n\n\n\n\t\tuint32 entrySize;\n", "file_path": "owClient/Client/WDB/WDBGameObjectCache.cpp", "rank": 94, "score": 12.625567202353478 }, { "content": "CWorldSocket::~CWorldSocket()\n\n{\n\n\tDisconnect();\n\n\n\n\tm_UpdateThreadExiter.set_value();\n\n\t//while (false == m_UpdateThread.joinable());\n\n\t//m_UpdateThread.join();\n\n}\n\n\n\nvoid CWorldSocket::Open(std::string Host, uint16 Port)\n\n{\n\n\tif (false == Connect(Host, Port))\n\n\t\tthrow CException(\"CWorldSocket: Unable to connect to '%s:%d'\", Host.c_str(), Port);\n\n\n\n\tSetBlocking(true);\n\n}\n\n\n\nvoid CWorldSocket::Update()\n\n{\n\n\twhile (const auto& packet = m_PacketsQueue.GetNextItem())\n", "file_path": "owClient/WorldSocket/WorldSocket.cpp", "rank": 95, "score": 12.593837785289615 }, { "content": "}\n\n\n\n\n\n\n\n//\n\n// CM2_Base_Instance\n\n//\n\nbool CMapM2Instance::IsInstansingEnabled() const\n\n{\n\n\treturn true;\n\n}\n\n\n\n\n\n\n\n//\n\n// ISceneNode\n\n//\n\nvoid CMapM2Instance::Initialize()\n\n{\n\n\t__super::Initialize();\n", "file_path": "owGame/Map/Instances/MapM2Instance.cpp", "rank": 96, "score": 12.541153021974955 }, { "content": "\t\tcollisonIndexBuffer = m_RenderDevice.GetObjectsFactory().CreateIndexBuffer(collisionTrianglesArray);\n\n\t}\n\n\n\n\tif (collisonVertexBuffer != nullptr && collisonIndexBuffer != nullptr)\n\n\t{\n\n\t\tauto collisionGeometry = GetRenderDevice().GetObjectsFactory().CreateGeometry();\n\n\t\tcollisionGeometry->SetVertexBuffer(collisonVertexBuffer);\n\n\t\tcollisionGeometry->SetIndexBuffer(collisonIndexBuffer);\n\n\t\tm_CollisionGeom = collisionGeometry;\n\n\t}\n\n\telse\n\n\t{\n\n\t\tm_CollisionGeom = nullptr;\n\n\t}\n\n#endif\n\n\n\n\tm_IsAnimated = getSkeleton().isAnimBones() || getSkeleton().isBillboard() || getMaterials().IsAnimTextures() || getMiscellaneous().IsAnimated() || true;\n\n\t_ASSERT(m_Bytes.use_count() == 1);\n\n\tm_Bytes.reset();\n\n\n\n\treturn true;\n\n}\n\n\n\nbool CM2::Delete()\n\n{\n\n\treturn false;\n\n}\n", "file_path": "owGame/M2/M2.cpp", "rank": 97, "score": 12.534620813200263 }, { "content": "\n\nvoid CWorldSocket::OnDisconnected()\n\n{\n\n\tLog::Warn(\"CWorldSocket::OnDisconnected.\");\n\n}\n\n\n\nvoid CWorldSocket::SendPacket(CClientPacket& Packet)\n\n{\n\n Packet.Complete();\n\n\n\n m_WoWCryptoUtils.EncryptSend(Packet.getDataEx(), sizeof(uint16) /*Size*/ + sizeof(uint32) /*Opcode*/);\n\n\n\n Send(Packet.getDataEx(), Packet.getSize());\n\n}\n\n\n\nvoid CWorldSocket::SetExternalHandler(std::function<bool(CServerPacket&)> Handler)\n\n{\n\n\t_ASSERT(Handler != nullptr);\n\n\tm_ExternalHandler = Handler;\n\n}\n", "file_path": "owClient/WorldSocket/WorldSocket.cpp", "rank": 98, "score": 12.50950048003238 }, { "content": "#include \"stdafx.h\"\n\n\n\n// Include\n\n#include \"M2.h\"\n\n#include \"M2_Base_Instance.h\"\n\n\n\n// General\n\n#include \"M2_Part_TextureWeight.h\"\n\n\n\nCM2_Part_TextureWeight::CM2_Part_TextureWeight(const CM2& M2Object, const std::shared_ptr<IByteBuffer>& File, const SM2_TextureWeight& M2TextureWeight)\n\n\t: m_M2Object(M2Object)\n\n{\n\n\tm_WeightAnimated.Initialize(M2TextureWeight.weight, File, M2Object.getSkeleton().GetAnimFiles());\n\n}\n\n\n\nCM2_Part_TextureWeight::~CM2_Part_TextureWeight()\n\n{\n\n}\n\n\n\nfloat CM2_Part_TextureWeight::GetWeight(const CM2_Base_Instance* M2Instance, uint32 GlobalTime) const\n\n{\n\n\tif (const auto& animator = M2Instance->GetAnimatorComponent())\n\n\t\tif (m_WeightAnimated.IsUsesBySequence(animator->getSequenceIndex()))\n\n\t\t\treturn m_WeightAnimated.GetValue(animator->getSequenceIndex(), animator->getCurrentTime(), m_M2Object.getSkeleton().getGlobalLoops(), GlobalTime);\n\n\treturn 1.0f;\n\n}\n", "file_path": "owGame/M2/M2_Part_TextureWeight.cpp", "rank": 99, "score": 12.25106216636241 } ]
C++
src/mame/audio/dsbz80.cpp
Robbbert/messui
49b756e2140d8831bc81335298ee8c5471045e79
#include "emu.h" #include "audio/dsbz80.h" #include "machine/clock.h" #define Z80_TAG "mpegcpu" void dsbz80_device::dsbz80_map(address_map &map) { map(0x0000, 0x7fff).rom().region(":mpegcpu", 0); map(0x8000, 0xffff).ram(); } void dsbz80_device::dsbz80io_map(address_map &map) { map.global_mask(0xff); map(0xe0, 0xe0).w(FUNC(dsbz80_device::mpeg_trigger_w)); map(0xe2, 0xe4).rw(FUNC(dsbz80_device::mpeg_pos_r), FUNC(dsbz80_device::mpeg_start_w)); map(0xe5, 0xe7).w(FUNC(dsbz80_device::mpeg_end_w)); map(0xe8, 0xe8).w(FUNC(dsbz80_device::mpeg_volume_w)); map(0xe9, 0xe9).w(FUNC(dsbz80_device::mpeg_stereo_w)); map(0xf0, 0xf1).rw("uart", FUNC(i8251_device::read), FUNC(i8251_device::write)); } DEFINE_DEVICE_TYPE(DSBZ80, dsbz80_device, "dsbz80_device", "Sega Z80-based Digital Sound Board") void dsbz80_device::device_add_mconfig(machine_config &config) { Z80(config, m_ourcpu, 4000000); m_ourcpu->set_addrmap(AS_PROGRAM, &dsbz80_device::dsbz80_map); m_ourcpu->set_addrmap(AS_IO, &dsbz80_device::dsbz80io_map); I8251(config, m_uart, 4000000); m_uart->rxrdy_handler().set_inputline(m_ourcpu, INPUT_LINE_IRQ0); m_uart->txd_handler().set(FUNC(dsbz80_device::output_txd)); clock_device &uart_clock(CLOCK(config, "uart_clock", 500000)); uart_clock.signal_handler().set("uart", FUNC(i8251_device::write_rxc)); uart_clock.signal_handler().append("uart", FUNC(i8251_device::write_txc)); } dsbz80_device::dsbz80_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, DSBZ80, tag, owner, clock), device_sound_interface(mconfig, *this), m_ourcpu(*this, Z80_TAG), m_uart(*this, "uart"), m_rxd_handler(*this) { } void dsbz80_device::device_start() { m_rxd_handler.resolve_safe(); uint8_t *rom_base = machine().root_device().memregion("mpeg")->base(); decoder = new mpeg_audio(rom_base, mpeg_audio::L2, false, 0); stream_alloc(0, 2, 32000); } void dsbz80_device::device_reset() { start = end = 0; audio_pos = audio_avail = 0; memset(audio_buf, 0, sizeof(audio_buf)); mp_state = 0; m_uart->write_cts(0); } WRITE_LINE_MEMBER(dsbz80_device::write_txd) { m_uart->write_rxd(state); } WRITE_LINE_MEMBER(dsbz80_device::output_txd) { m_rxd_handler(state); } void dsbz80_device::mpeg_trigger_w(uint8_t data) { mp_state = data; if (data == 0) { mp_state = 0; audio_pos = audio_avail = 0; } else if (data == 1) { mp_pos = mp_start*8; } else if (data == 2) { mp_pos = mp_start*8; } } uint8_t dsbz80_device::mpeg_pos_r(offs_t offset) { int mp_prg = mp_pos >> 3; switch (offset) { case 0: return (mp_prg>>16)&0xff; case 1: return (mp_prg>>8)&0xff; case 2: return mp_prg&0xff; } return 0; } void dsbz80_device::mpeg_start_w(offs_t offset, uint8_t data) { switch (offset) { case 0: start &= 0x00ffff; start |= (int)data<<16; break; case 1: start &= 0xff00ff; start |= (int)data<<8; break; case 2: start &= 0xffff00; start |= data; if (mp_state == 0) { mp_start = start; } else { lp_start = start; if (lp_end == 0) { } else { } } break; } } void dsbz80_device::mpeg_end_w(offs_t offset, uint8_t data) { switch (offset) { case 0: end &= 0x00ffff; end |= (int)data<<16; break; case 1: end &= 0xff00ff; end |= (int)data<<8; break; case 2: end &= 0xffff00; end |= data; if (mp_state == 0) { mp_end = end; } else { lp_end = end; } break; } } void dsbz80_device::mpeg_volume_w(uint8_t data) { mp_vol = 0x7f - data; } void dsbz80_device::mpeg_stereo_w(uint8_t data) { mp_pan = data & 3; } void dsbz80_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { auto &out_l = outputs[0]; auto &out_r = outputs[1]; int samples = out_l.samples(); int sampindex = 0; for(;;) { while(samples && audio_pos < audio_avail) { switch (mp_pan) { case 0: out_l.put_int(sampindex, audio_buf[audio_pos*2], 32768); out_r.put_int(sampindex, audio_buf[audio_pos*2+1], 32768); sampindex++; break; case 1: out_l.put_int(sampindex, audio_buf[audio_pos*2], 32768); out_r.put_int(sampindex, audio_buf[audio_pos*2], 32768); sampindex++; break; case 2: out_l.put_int(sampindex, audio_buf[audio_pos*2+1], 32768); out_r.put_int(sampindex, audio_buf[audio_pos*2+1], 32768); sampindex++; break; } audio_pos++; samples--; } if(!samples) { break; } if(mp_state == 0) { out_l.fill(0, sampindex); out_r.fill(0, sampindex); break; } else { int sample_rate, channel_count; bool ok = decoder->decode_buffer(mp_pos, mp_end*8, audio_buf, audio_avail, sample_rate, channel_count); if (ok) { audio_pos = 0; } else { if(mp_state == 2) { if (mp_pos == lp_start*8) { mp_state = 0; } mp_pos = lp_start*8; if (lp_end) { mp_end = lp_end; } } else { mp_state = 0; } } } } }
#include "emu.h" #include "audio/dsbz80.h" #include "machine/clock.h" #define Z80_TAG "mpegcpu" void dsbz80_device::dsbz80_map(address_map &map) { map(0x0000, 0x7fff).rom().region(":mpegcpu", 0); map(0x8000, 0xffff).ram(); } void dsbz80_device::dsbz80io_map(address_map &map) { map.global_mask(0xff); map(0xe0, 0xe0).w(FUNC(dsbz80_device::mpeg_trigger_w)); map(0xe2, 0xe4).rw(FUNC(dsbz80_device::mpeg_pos_r), FUNC(dsbz80_device::mpeg_start_w)); map(0xe5, 0xe7).w(FUNC(dsbz80_device::mpeg_end_w)); map(0xe8, 0xe8).w(FUNC(dsbz80_device::mpeg_volume_w)); map(0xe9, 0xe9).w(FUNC(dsbz80_device::mpeg_stereo_w)); map(0xf0, 0xf1).rw("uart", FUNC(i8251_device::read), FUNC(i8251_device::write)); } DEFINE_DEVICE_TYPE(DSBZ80, dsbz80_device, "dsbz80_device", "Sega Z80-based Digital Sound Board") void dsbz80_device::device_add_mconfig(machine_config &config) { Z80(config, m_ourcpu, 4000000); m_ourcpu->set_addrmap(AS_PROGRAM, &dsbz80_device::dsbz80_map); m_ourcpu->set_addrmap(AS_IO, &dsbz80_device::dsbz80io_map); I8251(config, m_uart, 4000000); m_uart->rxrdy_handler().set_inputline(m_ourcpu, INPUT_LINE_IRQ0); m_uart->txd_handler().set(FUNC(dsbz80_device::output_txd)); clock_device &uart_clock(CLOCK(config, "uart_clock", 500000)); uart_clock.signal_handler().set("uart", FUNC(i8251_device::write_rxc)); uart_clock.signal_handler().append("uart", FUNC(i8251_device::write_txc)); } dsbz80_device::dsbz80_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, DSBZ80, tag, owner, clock), device_sound_interface(mconfig, *this), m_ourcpu(*this, Z80_TAG), m_uart(*this, "uart"), m_rxd_handler(*this) { } void dsbz80_device::device_start() { m_rxd_handler.resolve_safe(); uint8_t *rom_base = machine().root_device().memregion("mpeg")->base(); decoder = new mpeg_audio(rom_base, mpeg_audio::L2, false, 0); stream_alloc(0, 2, 32000); } void dsbz80_device::device_reset() { start = end = 0; audio_pos = audio_avail = 0; memset(audio_buf, 0, sizeof(audio_buf)); mp_state = 0; m_uart->write_cts(0); } WRITE_LINE_MEMBER(dsbz80_device::write_txd) { m_uart->write_rxd(state); } WRITE_LINE_MEMBER(dsbz80_device::output_txd) { m_rxd_handler(state); } void dsbz80_device::mpeg_trigger_w(uint8_t data) { mp_state = data; if (data == 0) { mp_state = 0; audio_pos = audio_avail = 0; } else if (data == 1) { mp_pos = mp_start*8; } else if (data == 2) { mp_pos = mp_start*8; } } uint8_t dsbz80_device::mpeg_pos_r(offs_t offset) { int mp_prg = mp_pos >> 3; switch (offset) { case 0: return (mp_prg>>16)&0xff; case 1: return (mp_prg>>8)&0xff; case 2: return mp_prg&0xff; } return 0; } void dsbz80_device::mpeg_start_w(offs_t offset, uint8_t data) { switch (offset) { case 0: start &= 0x00ffff; start |= (int)data<<16; break; case 1: start &= 0xff00ff; start |= (int)data<<8; break; case 2: start &= 0xffff00; start |= data; if (mp_state == 0) { mp_start = start; } else { lp_start = start; if (lp_end == 0) { } else { } } break; } } void dsbz80_device::mpeg_end_w(offs_t offset, uint8_t data) { switch (offset) { case 0: end &= 0x00ffff; end |= (int)data<<16; break; case 1: end &= 0xff00ff; end |= (int)data<<8; break; case 2: end &= 0xffff00; end |= data; if (mp_state == 0) { mp_end = end; } else { lp_end = end; } break; } } void dsbz80_device::mpeg_volume_w(uint8_t data) { mp_vol = 0x7f - data; } void dsbz80_device::mpeg_stereo_w(uint8_t data) { mp_pan = data & 3; } void dsbz80_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { auto &out_l = outputs[0]; auto &out_r = outputs[1]; int samples = out_l.samples(); int sampindex = 0; for(;;) { while(samples && audio_pos < audio_avail) { switch (mp_pan) { case 0: out_l.put_int(sampindex, audio_buf[audio_pos*2], 32768); out_r.put_int(sampindex, audio_buf[audio_pos*2+1], 32768); sampindex++; break; case 1: out_l.put_int(sampindex, audio_buf[audio_pos*2], 32768); out_r.put_int(sampindex, audio_buf[audio_pos*2], 32768); sampindex++;
ampindex++; break; } audio_pos++; samples--; } if(!samples) { break; } if(mp_state == 0) { out_l.fill(0, sampindex); out_r.fill(0, sampindex); break; } else { int sample_rate, channel_count; bool ok = decoder->decode_buffer(mp_pos, mp_end*8, audio_buf, audio_avail, sample_rate, channel_count); if (ok) { audio_pos = 0; } else { if(mp_state == 2) { if (mp_pos == lp_start*8) { mp_state = 0; } mp_pos = lp_start*8; if (lp_end) { mp_end = lp_end; } } else { mp_state = 0; } } } } }
break; case 2: out_l.put_int(sampindex, audio_buf[audio_pos*2+1], 32768); out_r.put_int(sampindex, audio_buf[audio_pos*2+1], 32768); s
random
[]
C++
Charts/Core/Testing/Cxx/TestPlotBarRangeHandlesItem.cxx
cclauss/VTK
f62a52cce9044159efb4adb7cc0cfd7ec0bc8b6d
#include <vtkAxis.h> #include <vtkChartXY.h> #include <vtkContextInteractorStyle.h> #include <vtkContextScene.h> #include <vtkIntArray.h> #include <vtkInteractorEventRecorder.h> #include <vtkNew.h> #include <vtkPlotBar.h> #include <vtkPlotBarRangeHandlesItem.h> #include <vtkRenderWindow.h> #include <vtkRenderWindowInteractor.h> #include <vtkTable.h> #include <iostream> #include <map> class vtkRangeHandlesCallBack : public vtkCommand { public: static vtkRangeHandlesCallBack* New() { return new vtkRangeHandlesCallBack; } void Execute(vtkObject* caller, unsigned long event, void* vtkNotUsed(callData)) override { vtkPlotRangeHandlesItem* self = vtkPlotRangeHandlesItem::SafeDownCast(caller); if (!self) { return; } if (event == vtkCommand::EndInteractionEvent) { self->GetHandlesRange(this->Range); } if (this->EventSpy.count(event) == 0) { this->EventSpy[event] = 0; } ++this->EventSpy[event]; std::cout << "InvokedEvent: " << event << this->EventSpy[event] << std::endl; } std::map<unsigned long, int> EventSpy; double Range[2]; }; int TestPlotBarRangeHandlesItem(int, char*[]) { vtkNew<vtkTable> table; vtkNew<vtkIntArray> arrMonth; arrMonth->SetName("Months"); arrMonth->SetNumberOfComponents(1); arrMonth->SetNumberOfTuples(12); for (int i = 0; i < arrMonth->GetNumberOfTuples(); ++i) { arrMonth->SetValue(i, i); } table->AddColumn(arrMonth); constexpr int books[12] = { 5675, 5902, 6388, 5990, 5575, 7393, 9878, 8082, 6417, 5946, 5526, 5166 }; vtkNew<vtkIntArray> arrBooks; arrBooks->SetName("Books"); arrBooks->SetNumberOfComponents(1); arrBooks->SetNumberOfTuples(12); for (int i = 0; i < arrBooks->GetNumberOfTuples(); ++i) { arrBooks->SetValue(i, books[i]); } table->AddColumn(arrBooks); vtkNew<vtkChartXY> chart; chart->GetAxis(vtkAxis::BOTTOM)->SetRange(-5, 15); chart->GetAxis(vtkAxis::LEFT)->SetRange(-5, 15); vtkNew<vtkContextScene> scene; scene->AddItem(chart); vtkNew<vtkContextInteractorStyle> interactorStyle; interactorStyle->SetScene(scene); vtkNew<vtkRenderWindowInteractor> iren; iren->SetInteractorStyle(interactorStyle); vtkNew<vtkInteractorEventRecorder> recorder; recorder->SetInteractor(iren); recorder->ReadFromInputStringOn(); vtkPlotBar* barPlot = vtkPlotBar::SafeDownCast(chart->AddPlot(vtkChart::BAR)); barPlot->SetInputData(table, "Months", "Books"); chart->SetBarWidthFraction(1.0); vtkNew<vtkPlotBarRangeHandlesItem> rangeItem; rangeItem->SetPlotBar(barPlot); rangeItem->SetExtent(0, 12, 0, 1); chart->AddPlot(rangeItem); rangeItem->ComputeHandlesDrawRange(); chart->RaisePlot(rangeItem); chart->Update(); vtkNew<vtkRangeHandlesCallBack> cbk; rangeItem->AddObserver(vtkCommand::StartInteractionEvent, cbk); rangeItem->AddObserver(vtkCommand::InteractionEvent, cbk); rangeItem->AddObserver(vtkCommand::EndInteractionEvent, cbk); double range[2]; rangeItem->GetHandlesRange(range); if (range[0] != 0 || range[1] != 12) { std::cerr << "Initialization: Unexpected range for vertical handle: [" << range[0] << ", " << range[1] << "]. Expecting: [0, 12]." << std::endl; return EXIT_FAILURE; } const char leftEvents[] = "# StreamVersion 1\n" "LeftButtonPressEvent 0 10 0 0 0 0 0\n" "MouseMoveEvent 3 10 0 0 0 0 0\n" "LeftButtonReleaseEvent 3 10 0 0 0 0 0\n"; recorder->SetInputString(leftEvents); recorder->Play(); if (cbk->EventSpy[vtkCommand::StartInteractionEvent] != 1 || cbk->EventSpy[vtkCommand::InteractionEvent] != 1 || cbk->EventSpy[vtkCommand::EndInteractionEvent] != 1) { std::cerr << "Move left handle: Wrong number of fired events : " << cbk->EventSpy[vtkCommand::StartInteractionEvent] << " " << cbk->EventSpy[vtkCommand::InteractionEvent] << " " << cbk->EventSpy[vtkCommand::EndInteractionEvent] << std::endl; return EXIT_FAILURE; } rangeItem->ComputeHandlesDrawRange(); rangeItem->GetHandlesRange(range); if (fabs(range[0] - 2.5) > 1e-3 || range[1] != 12) { std::cerr << "Unexpected range for vertical handle: [" << range[0] << ", " << range[1] << "]. Expecting: [2.5, 12]." << std::endl; return EXIT_FAILURE; } cbk->EventSpy.clear(); const char rightEvents[] = "# StreamVersion 1\n" "LeftButtonPressEvent 12 10 0 0 0 0 0\n" "MouseMoveEvent 10 10 0 0 0 0 0\n" "LeftButtonReleaseEvent 10 10 0 0 0 0 0\n"; recorder->SetInputString(rightEvents); recorder->Play(); if (cbk->EventSpy[vtkCommand::StartInteractionEvent] != 1 || cbk->EventSpy[vtkCommand::InteractionEvent] != 1 || cbk->EventSpy[vtkCommand::EndInteractionEvent] != 1) { std::cerr << "Move right handle: Wrong number of fired events : " << cbk->EventSpy[vtkCommand::StartInteractionEvent] << " " << cbk->EventSpy[vtkCommand::InteractionEvent] << " " << cbk->EventSpy[vtkCommand::EndInteractionEvent] << std::endl; return EXIT_FAILURE; } rangeItem->ComputeHandlesDrawRange(); rangeItem->GetHandlesRange(range); if (fabs(range[0] - 2.5) > 1e-3 || fabs(range[1] - 10.5) > 1e-3) { std::cerr << "Unexpected range for vertical handle: [" << range[0] << ", " << range[1] << "]. Expecting: [2.5, 10.5]." << std::endl; return EXIT_FAILURE; } barPlot->SetOrientation(vtkPlotBar::HORIZONTAL); rangeItem->SetHandleOrientationToHorizontal(); rangeItem->SetExtent(0, 12, 0, 1); rangeItem->ComputeHandlesDrawRange(); rangeItem->GetHandlesRange(range); if (range[0] != 0 || range[1] != 12) { std::cerr << "Unexpected range in horizontal range handle: [" << range[0] << ", " << range[1] << "]. Expecting: [0, 12]." << std::endl; return EXIT_FAILURE; } cbk->EventSpy.clear(); const char hRightEvents[] = "# StreamVersion 1\n" "LeftButtonPressEvent 1 12 0 0 0 0 0\n" "MouseMoveEvent 1 5 0 0 0 0 0\n" "LeftButtonReleaseEvent 1 5 0 0 0 0 0\n"; recorder->SetInputString(hRightEvents); recorder->Play(); if (cbk->EventSpy[vtkCommand::StartInteractionEvent] != 1 || cbk->EventSpy[vtkCommand::InteractionEvent] != 1 || cbk->EventSpy[vtkCommand::EndInteractionEvent] != 1) { std::cerr << "Move horizontal handle: Wrong number of fired events : " << cbk->EventSpy[vtkCommand::StartInteractionEvent] << " " << cbk->EventSpy[vtkCommand::InteractionEvent] << " " << cbk->EventSpy[vtkCommand::EndInteractionEvent] << std::endl; return EXIT_FAILURE; } rangeItem->ComputeHandlesDrawRange(); rangeItem->GetHandlesRange(range); if (range[0] != 0 || fabs(range[1] - 5.5) > 1e-3) { std::cerr << "Unexpected range for horizontal handle : [" << range[0] << ", " << range[1] << "]. Expecting : [0, 5.5]." << std::endl; return EXIT_FAILURE; } return EXIT_SUCCESS; }
#include <vtkAxis.h> #include <vtkChartXY.h> #include <vtkContextInteractorStyle.h> #include <vtkContextScene.h> #include <vtkIntArray.h> #include <vtkInteractorEventRecorder.h> #include <vtkNew.h> #include <vtkPlotBar.h> #include <vtkPlotBarRangeHandlesItem.h> #include <vtkRenderWindow.h> #include <vtkRenderWindowInteractor.h> #include <vtkTable.h> #include <iostream> #include <map> class vtkRangeHandlesCallBack : public vtkCommand { public: static vtkRangeHandlesCallBack* New() { return new vtkRangeHandlesCallBack; } void Execute(vtkObject* caller, unsigned long event, void* vtkNotUsed(callData)) override { vtkPlotRangeHandlesItem* self = vtkPlotRangeH
ventSpy[event] = 0; } ++this->EventSpy[event]; std::cout << "InvokedEvent: " << event << this->EventSpy[event] << std::endl; } std::map<unsigned long, int> EventSpy; double Range[2]; }; int TestPlotBarRangeHandlesItem(int, char*[]) { vtkNew<vtkTable> table; vtkNew<vtkIntArray> arrMonth; arrMonth->SetName("Months"); arrMonth->SetNumberOfComponents(1); arrMonth->SetNumberOfTuples(12); for (int i = 0; i < arrMonth->GetNumberOfTuples(); ++i) { arrMonth->SetValue(i, i); } table->AddColumn(arrMonth); constexpr int books[12] = { 5675, 5902, 6388, 5990, 5575, 7393, 9878, 8082, 6417, 5946, 5526, 5166 }; vtkNew<vtkIntArray> arrBooks; arrBooks->SetName("Books"); arrBooks->SetNumberOfComponents(1); arrBooks->SetNumberOfTuples(12); for (int i = 0; i < arrBooks->GetNumberOfTuples(); ++i) { arrBooks->SetValue(i, books[i]); } table->AddColumn(arrBooks); vtkNew<vtkChartXY> chart; chart->GetAxis(vtkAxis::BOTTOM)->SetRange(-5, 15); chart->GetAxis(vtkAxis::LEFT)->SetRange(-5, 15); vtkNew<vtkContextScene> scene; scene->AddItem(chart); vtkNew<vtkContextInteractorStyle> interactorStyle; interactorStyle->SetScene(scene); vtkNew<vtkRenderWindowInteractor> iren; iren->SetInteractorStyle(interactorStyle); vtkNew<vtkInteractorEventRecorder> recorder; recorder->SetInteractor(iren); recorder->ReadFromInputStringOn(); vtkPlotBar* barPlot = vtkPlotBar::SafeDownCast(chart->AddPlot(vtkChart::BAR)); barPlot->SetInputData(table, "Months", "Books"); chart->SetBarWidthFraction(1.0); vtkNew<vtkPlotBarRangeHandlesItem> rangeItem; rangeItem->SetPlotBar(barPlot); rangeItem->SetExtent(0, 12, 0, 1); chart->AddPlot(rangeItem); rangeItem->ComputeHandlesDrawRange(); chart->RaisePlot(rangeItem); chart->Update(); vtkNew<vtkRangeHandlesCallBack> cbk; rangeItem->AddObserver(vtkCommand::StartInteractionEvent, cbk); rangeItem->AddObserver(vtkCommand::InteractionEvent, cbk); rangeItem->AddObserver(vtkCommand::EndInteractionEvent, cbk); double range[2]; rangeItem->GetHandlesRange(range); if (range[0] != 0 || range[1] != 12) { std::cerr << "Initialization: Unexpected range for vertical handle: [" << range[0] << ", " << range[1] << "]. Expecting: [0, 12]." << std::endl; return EXIT_FAILURE; } const char leftEvents[] = "# StreamVersion 1\n" "LeftButtonPressEvent 0 10 0 0 0 0 0\n" "MouseMoveEvent 3 10 0 0 0 0 0\n" "LeftButtonReleaseEvent 3 10 0 0 0 0 0\n"; recorder->SetInputString(leftEvents); recorder->Play(); if (cbk->EventSpy[vtkCommand::StartInteractionEvent] != 1 || cbk->EventSpy[vtkCommand::InteractionEvent] != 1 || cbk->EventSpy[vtkCommand::EndInteractionEvent] != 1) { std::cerr << "Move left handle: Wrong number of fired events : " << cbk->EventSpy[vtkCommand::StartInteractionEvent] << " " << cbk->EventSpy[vtkCommand::InteractionEvent] << " " << cbk->EventSpy[vtkCommand::EndInteractionEvent] << std::endl; return EXIT_FAILURE; } rangeItem->ComputeHandlesDrawRange(); rangeItem->GetHandlesRange(range); if (fabs(range[0] - 2.5) > 1e-3 || range[1] != 12) { std::cerr << "Unexpected range for vertical handle: [" << range[0] << ", " << range[1] << "]. Expecting: [2.5, 12]." << std::endl; return EXIT_FAILURE; } cbk->EventSpy.clear(); const char rightEvents[] = "# StreamVersion 1\n" "LeftButtonPressEvent 12 10 0 0 0 0 0\n" "MouseMoveEvent 10 10 0 0 0 0 0\n" "LeftButtonReleaseEvent 10 10 0 0 0 0 0\n"; recorder->SetInputString(rightEvents); recorder->Play(); if (cbk->EventSpy[vtkCommand::StartInteractionEvent] != 1 || cbk->EventSpy[vtkCommand::InteractionEvent] != 1 || cbk->EventSpy[vtkCommand::EndInteractionEvent] != 1) { std::cerr << "Move right handle: Wrong number of fired events : " << cbk->EventSpy[vtkCommand::StartInteractionEvent] << " " << cbk->EventSpy[vtkCommand::InteractionEvent] << " " << cbk->EventSpy[vtkCommand::EndInteractionEvent] << std::endl; return EXIT_FAILURE; } rangeItem->ComputeHandlesDrawRange(); rangeItem->GetHandlesRange(range); if (fabs(range[0] - 2.5) > 1e-3 || fabs(range[1] - 10.5) > 1e-3) { std::cerr << "Unexpected range for vertical handle: [" << range[0] << ", " << range[1] << "]. Expecting: [2.5, 10.5]." << std::endl; return EXIT_FAILURE; } barPlot->SetOrientation(vtkPlotBar::HORIZONTAL); rangeItem->SetHandleOrientationToHorizontal(); rangeItem->SetExtent(0, 12, 0, 1); rangeItem->ComputeHandlesDrawRange(); rangeItem->GetHandlesRange(range); if (range[0] != 0 || range[1] != 12) { std::cerr << "Unexpected range in horizontal range handle: [" << range[0] << ", " << range[1] << "]. Expecting: [0, 12]." << std::endl; return EXIT_FAILURE; } cbk->EventSpy.clear(); const char hRightEvents[] = "# StreamVersion 1\n" "LeftButtonPressEvent 1 12 0 0 0 0 0\n" "MouseMoveEvent 1 5 0 0 0 0 0\n" "LeftButtonReleaseEvent 1 5 0 0 0 0 0\n"; recorder->SetInputString(hRightEvents); recorder->Play(); if (cbk->EventSpy[vtkCommand::StartInteractionEvent] != 1 || cbk->EventSpy[vtkCommand::InteractionEvent] != 1 || cbk->EventSpy[vtkCommand::EndInteractionEvent] != 1) { std::cerr << "Move horizontal handle: Wrong number of fired events : " << cbk->EventSpy[vtkCommand::StartInteractionEvent] << " " << cbk->EventSpy[vtkCommand::InteractionEvent] << " " << cbk->EventSpy[vtkCommand::EndInteractionEvent] << std::endl; return EXIT_FAILURE; } rangeItem->ComputeHandlesDrawRange(); rangeItem->GetHandlesRange(range); if (range[0] != 0 || fabs(range[1] - 5.5) > 1e-3) { std::cerr << "Unexpected range for horizontal handle : [" << range[0] << ", " << range[1] << "]. Expecting : [0, 5.5]." << std::endl; return EXIT_FAILURE; } return EXIT_SUCCESS; }
andlesItem::SafeDownCast(caller); if (!self) { return; } if (event == vtkCommand::EndInteractionEvent) { self->GetHandlesRange(this->Range); } if (this->EventSpy.count(event) == 0) { this->E
random
[]
C++
uuv_gazebo_plugins/uuv_gazebo_ros_plugins/src/ThrusterROSPlugin.cpp
MoMagDii/VAUV-simulator
56f55f9349e38e0a327a40feb5a437fcad511b00
#include <uuv_gazebo_ros_plugins/ThrusterROSPlugin.h> #include <string> #include <gazebo/physics/Base.hh> #include <gazebo/physics/Link.hh> #include <gazebo/physics/Model.hh> #include <gazebo/physics/World.hh> #include <uuv_gazebo_ros_plugins_msgs/msg/float_stamped.hpp> namespace uuv_simulator_ros { ThrusterROSPlugin::ThrusterROSPlugin() { this->rosPublishPeriod = gazebo::common::Time(0.05); this->lastRosPublishTime = gazebo::common::Time(0.0); } ThrusterROSPlugin::~ThrusterROSPlugin() { #if GAZEBO_MAJOR_VERSION >= 8 this->rosPublishConnection.reset(); #else gazebo::event::Events::DisconnectWorldUpdateBegin( this->rosPublishConnection); #endif } void ThrusterROSPlugin::SetThrustReference( const uuv_gazebo_ros_plugins_msgs::msg::FloatStamped::SharedPtr _msg) { if (std::isnan(_msg->data)) { RCLCPP_WARN(myRosNode->get_logger(), "ThrusterROSPlugin: Ignoring nan command"); return; } this->inputCommand = _msg->data; } gazebo::common::Time ThrusterROSPlugin::GetRosPublishPeriod() { return this->rosPublishPeriod; } void ThrusterROSPlugin::SetRosPublishRate(double _hz) { if (_hz > 0.0) this->rosPublishPeriod = 1.0 / _hz; else this->rosPublishPeriod = 0.; } void ThrusterROSPlugin::Init() { ThrusterPlugin::Init(); } void ThrusterROSPlugin::Reset() { this->lastRosPublishTime.Set(0, 0); } void ThrusterROSPlugin::Load(gazebo::physics::ModelPtr _parent, sdf::ElementPtr _sdf) { using std::placeholders::_1; using std::placeholders::_2; try { ThrusterPlugin::Load(_parent, _sdf); } catch(gazebo::common::Exception &_e) { gzerr << "Error loading plugin." << "Please ensure that your model is correct." << '\n'; return; } if (!rclcpp::is_initialized()) { gzerr << "Not loading plugin since ROS has not been " << "properly initialized. Try starting gazebo with ros plugin:\n" << " gazebo -s libgazebo_ros_api_plugin.so\n"; return; } try { myRosNode = gazebo_ros::Node::CreateWithArgs(_sdf->Get<std::string>("name")); gzmsg << "[ThrusterROSPlugin] Node created with name: " << myRosNode->get_name() << ", with ns: " << myRosNode->get_namespace() << "\n"; mySet_thrust_force_efficiencySrv = myRosNode->create_service<uuv_gazebo_ros_plugins_msgs::srv::SetThrusterEfficiency>( myTopicPrefix + "set_thrust_force_efficiency", std::bind(&ThrusterROSPlugin::SetThrustForceEfficiency, this, _1, _2)); myGet_thrust_force_efficiencySrv = myRosNode->create_service<uuv_gazebo_ros_plugins_msgs::srv::GetThrusterEfficiency>( myTopicPrefix + "get_thrust_force_efficiency", std::bind(&ThrusterROSPlugin::GetThrustForceEfficiency, this, _1, _2)); mySet_dynamic_state_efficiencySrv = myRosNode->create_service<uuv_gazebo_ros_plugins_msgs::srv::SetThrusterEfficiency>( myTopicPrefix + "set_dynamic_state_efficiency", std::bind(&ThrusterROSPlugin::SetDynamicStateEfficiency, this, _1, _2)); myGet_dynamic_state_efficiency = myRosNode->create_service<uuv_gazebo_ros_plugins_msgs::srv::GetThrusterEfficiency>( myTopicPrefix + "get_dynamic_state_efficiency", std::bind(&ThrusterROSPlugin::GetDynamicStateEfficiency, this, _1, _2)); mySet_thruster_state = myRosNode->create_service<uuv_gazebo_ros_plugins_msgs::srv::SetThrusterState>( myTopicPrefix + "set_thruster_state", std::bind(&ThrusterROSPlugin::SetThrusterState, this, _1, _2)); myGet_thruster_state = myRosNode->create_service<uuv_gazebo_ros_plugins_msgs::srv::GetThrusterState>( myTopicPrefix + "get_thruster_state", std::bind(&ThrusterROSPlugin::GetThrusterState, this, _1, _2)); myGet_thruster_conversion_fcn = myRosNode->create_service<uuv_gazebo_ros_plugins_msgs::srv::GetThrusterConversionFcn>( myTopicPrefix + "get_thruster_conversion_fcn", std::bind(&ThrusterROSPlugin::GetThrusterConversionFcn, this, _1, _2)); mySubThrustReference = myRosNode->create_subscription< uuv_gazebo_ros_plugins_msgs::msg::FloatStamped >(this->commandSubscriber->GetTopic(), 10, std::bind(&ThrusterROSPlugin::SetThrustReference, this, _1)); myPubThrust = myRosNode->create_publisher< uuv_gazebo_ros_plugins_msgs::msg::FloatStamped >(this->thrustTopicPublisher->GetTopic(), 10); myPubThrustWrench = myRosNode->create_publisher<geometry_msgs::msg::WrenchStamped>( this->thrustTopicPublisher->GetTopic() + "_wrench", 10); myPubThrusterState = myRosNode->create_publisher<std_msgs::msg::Bool>( myTopicPrefix + "is_on", 1); myPubThrustForceEff = myRosNode->create_publisher<std_msgs::msg::Float64>( myTopicPrefix + "thrust_efficiency", 1); myPubDynamicStateEff = myRosNode->create_publisher<std_msgs::msg::Float64>( myTopicPrefix + "dynamic_state_efficiency", 1); gzmsg << "Thruster #" << this->thrusterID << " initialized" << std::endl << "\t- Link: " << this->thrusterLink->GetName() << std::endl << "\t- Robot model: " << _parent->GetName() << std::endl << "\t- Input command topic: " << this->commandSubscriber->GetTopic() << std::endl << "\t- Thrust output topic: " << this->thrustTopicPublisher->GetTopic() << std::endl; this->rosPublishConnection = gazebo::event::Events::ConnectWorldUpdateBegin( std::bind(&ThrusterROSPlugin::RosPublishStates, this)); } catch(std::exception& e) { gzerr << "Exception when loading plugin: " << e.what() << "\n"; } } void ThrusterROSPlugin::RosPublishStates() { if (this->thrustForceStamp - this->lastRosPublishTime >= this->rosPublishPeriod) { this->lastRosPublishTime = this->thrustForceStamp; uuv_gazebo_ros_plugins_msgs::msg::FloatStamped thrustMsg; thrustMsg.header.stamp = myRosNode->now(); thrustMsg.header.frame_id = this->thrusterLink->GetName(); thrustMsg.data = this->thrustForce; myPubThrust->publish(thrustMsg); geometry_msgs::msg::WrenchStamped thrustWrenchMsg; thrustWrenchMsg.header.stamp = myRosNode->now(); thrustWrenchMsg.header.frame_id = this->thrusterLink->GetName(); ignition::math::Vector3d thrustVector = this->thrustForce * this->thrusterAxis; thrustWrenchMsg.wrench.force.x = thrustVector.X(); thrustWrenchMsg.wrench.force.y = thrustVector.Y(); thrustWrenchMsg.wrench.force.z = thrustVector.Z(); myPubThrustWrench->publish(thrustWrenchMsg); std_msgs::msg::Bool isOnMsg; isOnMsg.data = this->isOn; myPubThrusterState->publish(isOnMsg); std_msgs::msg::Float64 thrustEffMsg; thrustEffMsg.data = this->thrustEfficiency; myPubThrustForceEff->publish(thrustEffMsg); std_msgs::msg::Float64 dynStateEffMsg; dynStateEffMsg.data = this->propellerEfficiency; myPubDynamicStateEff->publish(dynStateEffMsg); } } void ThrusterROSPlugin::SetThrustForceEfficiency( const uuv_gazebo_ros_plugins_msgs::srv::SetThrusterEfficiency::Request::SharedPtr _req, uuv_gazebo_ros_plugins_msgs::srv::SetThrusterEfficiency::Response::SharedPtr _res) { if (_req->efficiency < 0.0 || _req->efficiency > 1.0) { _res->success = false; } else { this->thrustEfficiency = _req->efficiency; _res->success = true; gzmsg << "Setting thrust efficiency at thruster " << this->thrusterLink->GetName() << "=" << _req->efficiency * 100 << "%" << std::endl; } } void ThrusterROSPlugin::GetThrustForceEfficiency( const uuv_gazebo_ros_plugins_msgs::srv::GetThrusterEfficiency::Request::SharedPtr , uuv_gazebo_ros_plugins_msgs::srv::GetThrusterEfficiency::Response::SharedPtr _res) { _res->efficiency = this->thrustEfficiency; } void ThrusterROSPlugin::SetDynamicStateEfficiency( const uuv_gazebo_ros_plugins_msgs::srv::SetThrusterEfficiency::Request::SharedPtr _req, uuv_gazebo_ros_plugins_msgs::srv::SetThrusterEfficiency::Response::SharedPtr _res) { if (_req->efficiency < 0.0 || _req->efficiency > 1.0) { _res->success = false; } else { this->propellerEfficiency = _req->efficiency; _res->success = true; gzmsg << "Setting propeller efficiency at thruster " << this->thrusterLink->GetName() << "=" << _req->efficiency * 100 << "%" << std::endl; } } void ThrusterROSPlugin::GetDynamicStateEfficiency( const uuv_gazebo_ros_plugins_msgs::srv::GetThrusterEfficiency::Request::SharedPtr , uuv_gazebo_ros_plugins_msgs::srv::GetThrusterEfficiency::Response::SharedPtr _res) { _res->efficiency = this->propellerEfficiency; } void ThrusterROSPlugin::SetThrusterState( const uuv_gazebo_ros_plugins_msgs::srv::SetThrusterState::Request::SharedPtr _req, uuv_gazebo_ros_plugins_msgs::srv::SetThrusterState::Response::SharedPtr _res) { this->isOn = _req->on; gzmsg << "Turning thruster " << this->thrusterLink->GetName() << " " << (this->isOn ? "ON" : "OFF") << std::endl; _res->success = true; } void ThrusterROSPlugin::GetThrusterState( const uuv_gazebo_ros_plugins_msgs::srv::GetThrusterState::Request::SharedPtr , uuv_gazebo_ros_plugins_msgs::srv::GetThrusterState::Response::SharedPtr _res) { _res->is_on = this->isOn; } void ThrusterROSPlugin::GetThrusterConversionFcn( const uuv_gazebo_ros_plugins_msgs::srv::GetThrusterConversionFcn::Request::SharedPtr , uuv_gazebo_ros_plugins_msgs::srv::GetThrusterConversionFcn::Response::SharedPtr _res) { _res->fcn.function_name = this->conversionFunction->GetType(); double param; if (!_res->fcn.function_name.compare("Basic")) { gzmsg << "ThrusterROSPlugin::GetThrusterConversionFcn::Basic" << std::endl; _res->fcn.tags.push_back("rotor_constant"); this->conversionFunction->GetParam("rotor_constant", param); _res->fcn.data.push_back(param); } else if (!_res->fcn.function_name.compare("Bessa")) { gzmsg << "ThrusterROSPlugin::GetThrusterConversionFcn::Bessa" << std::endl; _res->fcn.tags.push_back("rotor_constant_l"); this->conversionFunction->GetParam("rotor_constant_l", param); _res->fcn.data.push_back(param); _res->fcn.tags.push_back("rotor_constant_r"); this->conversionFunction->GetParam("rotor_constant_r", param); _res->fcn.data.push_back(param); _res->fcn.tags.push_back("delta_l"); this->conversionFunction->GetParam("delta_l", param); _res->fcn.data.push_back(param); _res->fcn.tags.push_back("delta_r"); this->conversionFunction->GetParam("delta_r", param); _res->fcn.data.push_back(param); } else if (!_res->fcn.function_name.compare("LinearInterp")) { gzmsg << "ThrusterROSPlugin::GetThrusterConversionFcn::LinearInterp" << std::endl; std::map<double, double> table = this->conversionFunction->GetTable(); for (auto& item : table) { gzmsg << item.first << " " << item.second << std::endl; _res->fcn.lookup_table_input.push_back(item.first); _res->fcn.lookup_table_output.push_back(item.second); } } } GZ_REGISTER_MODEL_PLUGIN(ThrusterROSPlugin) }
#include <uuv_gazebo_ros_plugins/ThrusterROSPlugin.h> #include <string> #include <gazebo/physics/Base.hh> #include <gazebo/physics/Link.hh> #include <gazebo/physics/Model.hh> #include <gazebo/physics/World.hh> #include <uuv_gazebo_ros_plugins_msgs/msg/float_stamped.hpp> namespace uuv_simulator_ros { ThrusterROSPlugin::ThrusterROSPlugin() { this->rosPublishPeriod = gazebo::common::Time(0.05); this->lastRosPublishTime = gazebo::common::Time(0.0); } ThrusterROSPlugin::~ThrusterROSPlugin() { #if GAZEBO_MAJOR_VERSION >= 8 this->rosPublishConnection.reset(); #else gazebo::event::Events::DisconnectWorldUpdateBegin( this->rosPublishConnection); #endif } void ThrusterROSPlugin::SetThrustReference( const uuv_gazebo_ros_plugins_msgs::msg::FloatStamped::SharedPtr _msg) { if (std::isnan(_msg->data)) { RCLCPP_WARN(myRosNode->get_logger(), "ThrusterROSPlugin: Ignoring nan command"); return; } this->inputCommand = _msg->data; } gazebo::common::Time ThrusterROSPlugin::GetRosPublishPeriod() { return this->rosPublishPeriod; } void ThrusterROSPlugin::SetRosPublishRate(double _hz) { if (_hz > 0.0) this->rosPublishPeriod = 1.0 / _hz; else this->rosPublishPeriod = 0.; } void ThrusterROSPlugin::Init() { ThrusterPlugin::Init(); } void ThrusterROSPlugin::Reset() { this->lastRosPublishTime.Set(0, 0); } void ThrusterROSPlugin::Load(gazebo::physics::ModelPtr _parent, sdf::ElementPtr _sdf) { using std::placeholders::_1; using std::placeholders::_2; try { ThrusterPlugin::Load(_parent, _sdf); } catch(gazebo::common::Exception &_e) { gzerr << "Error loading plugin." << "Please ensure that your model is correct." << '\n'; return; } if (!rclcpp::is_initialized()) { gzerr << "Not loading plugin since ROS has not been " << "properly initialized. Try starting gazebo with ros plugin:\n" << " gazebo -s libgazebo_ros_api_plugin.so\n"; return; } try { myRosNode = gazebo_ros::Node::CreateWithArgs(_sdf->Get<std::string>("name")); gzmsg << "[ThrusterROSPlugin] Node created with name: " << myRosNode->get_name() << ", with ns: " << myRosNode->get_namespace() << "\n"; mySet_thrust_force_efficiencySrv = myRosNode->create_service<uuv_gazebo_ros_plugins_msgs::srv::SetThrusterEfficiency>( myTopicPrefix + "set_thrust_force_efficiency", std::bind(&ThrusterROSPlugin::SetThrustForceEfficiency, this, _1, _2)); myGet_thrust_force_efficiencySrv = myRosNode->create_service<uuv_gazebo_ros_plugins_msgs::srv::GetThrusterEfficiency>( myTopicPrefix + "get_thrust_force_efficiency", std::bind(&ThrusterROSPlugin::GetThrustForceEfficiency, this, _1, _2)); mySet_dynamic_state_efficiencySrv = myRosNode->create_service<uuv_gazebo_ros_plugins_msgs::srv::SetThrusterEfficiency>( myTopicPrefix + "set_dynamic_state_efficiency", std::bind(&ThrusterROSPlugin::SetDynamicStateEfficiency, this, _1, _2)); myGet_dynamic_state_efficiency = myRosNode->create_service<uuv_gazebo_ros_plugins_msgs::srv::GetThrusterEfficiency>( myTopicPrefix + "get_dynamic_state_efficiency", std::bind(&ThrusterROSPlugin::GetDynamicStateEfficiency, this, _1, _2)); mySet_thruster_state = myRosNode->create_service<uuv_gazebo_ros_plugins_msgs::srv::SetThrusterState>( myTopicPrefix + "set_thruster_state", std::bind(&ThrusterROSPlugin::SetThrusterState, this, _1, _2)); myGet_thruster_state = myRosNode->create_service<uuv_gazebo_ros_plugins_msgs::srv::GetThrusterState>( myTopicPrefix + "get_thruster_state", std::bind(&ThrusterROSPlugin::GetThrusterState, this, _1, _2)); myGet_thruster_conversion_fcn = myRosNode->create_service<uuv_gazebo_ros_plugins_msgs::srv::GetThrusterConversionFcn>( myTopicPrefix + "get_thruster_conversion_fcn", std::bind(&ThrusterROSPlugin::GetThrusterConversionFcn, this, _1, _2)); mySubThrustReference =
; myPubThrust = myRosNode->create_publisher< uuv_gazebo_ros_plugins_msgs::msg::FloatStamped >(this->thrustTopicPublisher->GetTopic(), 10); myPubThrustWrench = myRosNode->create_publisher<geometry_msgs::msg::WrenchStamped>( this->thrustTopicPublisher->GetTopic() + "_wrench", 10); myPubThrusterState = myRosNode->create_publisher<std_msgs::msg::Bool>( myTopicPrefix + "is_on", 1); myPubThrustForceEff = myRosNode->create_publisher<std_msgs::msg::Float64>( myTopicPrefix + "thrust_efficiency", 1); myPubDynamicStateEff = myRosNode->create_publisher<std_msgs::msg::Float64>( myTopicPrefix + "dynamic_state_efficiency", 1); gzmsg << "Thruster #" << this->thrusterID << " initialized" << std::endl << "\t- Link: " << this->thrusterLink->GetName() << std::endl << "\t- Robot model: " << _parent->GetName() << std::endl << "\t- Input command topic: " << this->commandSubscriber->GetTopic() << std::endl << "\t- Thrust output topic: " << this->thrustTopicPublisher->GetTopic() << std::endl; this->rosPublishConnection = gazebo::event::Events::ConnectWorldUpdateBegin( std::bind(&ThrusterROSPlugin::RosPublishStates, this)); } catch(std::exception& e) { gzerr << "Exception when loading plugin: " << e.what() << "\n"; } } void ThrusterROSPlugin::RosPublishStates() { if (this->thrustForceStamp - this->lastRosPublishTime >= this->rosPublishPeriod) { this->lastRosPublishTime = this->thrustForceStamp; uuv_gazebo_ros_plugins_msgs::msg::FloatStamped thrustMsg; thrustMsg.header.stamp = myRosNode->now(); thrustMsg.header.frame_id = this->thrusterLink->GetName(); thrustMsg.data = this->thrustForce; myPubThrust->publish(thrustMsg); geometry_msgs::msg::WrenchStamped thrustWrenchMsg; thrustWrenchMsg.header.stamp = myRosNode->now(); thrustWrenchMsg.header.frame_id = this->thrusterLink->GetName(); ignition::math::Vector3d thrustVector = this->thrustForce * this->thrusterAxis; thrustWrenchMsg.wrench.force.x = thrustVector.X(); thrustWrenchMsg.wrench.force.y = thrustVector.Y(); thrustWrenchMsg.wrench.force.z = thrustVector.Z(); myPubThrustWrench->publish(thrustWrenchMsg); std_msgs::msg::Bool isOnMsg; isOnMsg.data = this->isOn; myPubThrusterState->publish(isOnMsg); std_msgs::msg::Float64 thrustEffMsg; thrustEffMsg.data = this->thrustEfficiency; myPubThrustForceEff->publish(thrustEffMsg); std_msgs::msg::Float64 dynStateEffMsg; dynStateEffMsg.data = this->propellerEfficiency; myPubDynamicStateEff->publish(dynStateEffMsg); } } void ThrusterROSPlugin::SetThrustForceEfficiency( const uuv_gazebo_ros_plugins_msgs::srv::SetThrusterEfficiency::Request::SharedPtr _req, uuv_gazebo_ros_plugins_msgs::srv::SetThrusterEfficiency::Response::SharedPtr _res) { if (_req->efficiency < 0.0 || _req->efficiency > 1.0) { _res->success = false; } else { this->thrustEfficiency = _req->efficiency; _res->success = true; gzmsg << "Setting thrust efficiency at thruster " << this->thrusterLink->GetName() << "=" << _req->efficiency * 100 << "%" << std::endl; } } void ThrusterROSPlugin::GetThrustForceEfficiency( const uuv_gazebo_ros_plugins_msgs::srv::GetThrusterEfficiency::Request::SharedPtr , uuv_gazebo_ros_plugins_msgs::srv::GetThrusterEfficiency::Response::SharedPtr _res) { _res->efficiency = this->thrustEfficiency; } void ThrusterROSPlugin::SetDynamicStateEfficiency( const uuv_gazebo_ros_plugins_msgs::srv::SetThrusterEfficiency::Request::SharedPtr _req, uuv_gazebo_ros_plugins_msgs::srv::SetThrusterEfficiency::Response::SharedPtr _res) { if (_req->efficiency < 0.0 || _req->efficiency > 1.0) { _res->success = false; } else { this->propellerEfficiency = _req->efficiency; _res->success = true; gzmsg << "Setting propeller efficiency at thruster " << this->thrusterLink->GetName() << "=" << _req->efficiency * 100 << "%" << std::endl; } } void ThrusterROSPlugin::GetDynamicStateEfficiency( const uuv_gazebo_ros_plugins_msgs::srv::GetThrusterEfficiency::Request::SharedPtr , uuv_gazebo_ros_plugins_msgs::srv::GetThrusterEfficiency::Response::SharedPtr _res) { _res->efficiency = this->propellerEfficiency; } void ThrusterROSPlugin::SetThrusterState( const uuv_gazebo_ros_plugins_msgs::srv::SetThrusterState::Request::SharedPtr _req, uuv_gazebo_ros_plugins_msgs::srv::SetThrusterState::Response::SharedPtr _res) { this->isOn = _req->on; gzmsg << "Turning thruster " << this->thrusterLink->GetName() << " " << (this->isOn ? "ON" : "OFF") << std::endl; _res->success = true; } void ThrusterROSPlugin::GetThrusterState( const uuv_gazebo_ros_plugins_msgs::srv::GetThrusterState::Request::SharedPtr , uuv_gazebo_ros_plugins_msgs::srv::GetThrusterState::Response::SharedPtr _res) { _res->is_on = this->isOn; } void ThrusterROSPlugin::GetThrusterConversionFcn( const uuv_gazebo_ros_plugins_msgs::srv::GetThrusterConversionFcn::Request::SharedPtr , uuv_gazebo_ros_plugins_msgs::srv::GetThrusterConversionFcn::Response::SharedPtr _res) { _res->fcn.function_name = this->conversionFunction->GetType(); double param; if (!_res->fcn.function_name.compare("Basic")) { gzmsg << "ThrusterROSPlugin::GetThrusterConversionFcn::Basic" << std::endl; _res->fcn.tags.push_back("rotor_constant"); this->conversionFunction->GetParam("rotor_constant", param); _res->fcn.data.push_back(param); } else if (!_res->fcn.function_name.compare("Bessa")) { gzmsg << "ThrusterROSPlugin::GetThrusterConversionFcn::Bessa" << std::endl; _res->fcn.tags.push_back("rotor_constant_l"); this->conversionFunction->GetParam("rotor_constant_l", param); _res->fcn.data.push_back(param); _res->fcn.tags.push_back("rotor_constant_r"); this->conversionFunction->GetParam("rotor_constant_r", param); _res->fcn.data.push_back(param); _res->fcn.tags.push_back("delta_l"); this->conversionFunction->GetParam("delta_l", param); _res->fcn.data.push_back(param); _res->fcn.tags.push_back("delta_r"); this->conversionFunction->GetParam("delta_r", param); _res->fcn.data.push_back(param); } else if (!_res->fcn.function_name.compare("LinearInterp")) { gzmsg << "ThrusterROSPlugin::GetThrusterConversionFcn::LinearInterp" << std::endl; std::map<double, double> table = this->conversionFunction->GetTable(); for (auto& item : table) { gzmsg << item.first << " " << item.second << std::endl; _res->fcn.lookup_table_input.push_back(item.first); _res->fcn.lookup_table_output.push_back(item.second); } } } GZ_REGISTER_MODEL_PLUGIN(ThrusterROSPlugin) }
myRosNode->create_subscription< uuv_gazebo_ros_plugins_msgs::msg::FloatStamped >(this->commandSubscriber->GetTopic(), 10, std::bind(&ThrusterROSPlugin::SetThrustReference, this, _1))
call_expression
[ { "content": "/// \\brief Gazebo model plugin class for underwater objects\n\nclass UnderwaterObjectPlugin : public gazebo::ModelPlugin\n\n{\n\n /// \\brief Constructor\n\n public: UnderwaterObjectPlugin();\n\n\n\n /// \\brief Destructor\n\n public: virtual ~UnderwaterObjectPlugin();\n\n\n\n // Documentation inherited.\n\n public: virtual void Load(gazebo::physics::ModelPtr _model,\n\n sdf::ElementPtr _sdf);\n\n\n\n // Documentation inherited.\n\n public: virtual void Init();\n\n\n\n /// \\brief Update the simulation state.\n\n /// \\param[in] _info Information used in the update event.\n\n public: virtual void Update(const gazebo::common::UpdateInfo &_info);\n\n\n\n /// \\brief Connects the update event callback\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/UnderwaterObjectPlugin.h", "rank": 0, "score": 229703.75870389285 }, { "content": "/// \\brief Gazebo model plugin class for underwater objects\n\nclass AccelerationsTestPlugin : public gazebo::ModelPlugin\n\n{\n\n /// \\brief Constructor\n\n public: AccelerationsTestPlugin();\n\n\n\n /// \\brief Destructor\n\n public: virtual ~AccelerationsTestPlugin();\n\n\n\n // Documentation inherited.\n\n public: virtual void Load(gazebo::physics::ModelPtr _model,\n\n sdf::ElementPtr _sdf);\n\n\n\n // Documentation inherited.\n\n public: virtual void Init();\n\n\n\n /// \\brief Update the simulation state.\n\n /// \\param[in] _info Information used in the update event.\n\n public: void Update(const gazebo::common::UpdateInfo &_info);\n\n\n\n /// \\brief Connects the update event callback\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/AccelerationsTestPlugin.h", "rank": 1, "score": 226678.4903163004 }, { "content": "class JointStatePublisher : public gazebo::ModelPlugin\n\n{\n\n public: JointStatePublisher();\n\n\n\n public: ~JointStatePublisher();\n\n\n\n public: void Load(gazebo::physics::ModelPtr _parent, sdf::ElementPtr _sdf);\n\n\n\n public: void OnUpdate(const gazebo::common::UpdateInfo &_info);\n\n\n\n public: void PublishJointStates();\n\n\n\n private: bool IsIgnoredJoint(std::string _jointName);\n\n\n\n private: gazebo::physics::WorldPtr world;\n\n\n\n private: gazebo::physics::ModelPtr myModel;\n\n\n\n private: gazebo::event::ConnectionPtr updateConnection;\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/JointStatePublisher.h", "rank": 2, "score": 223237.38392002412 }, { "content": "class UmbilicalModel\n\n{\n\n /// \\brief Protected constructor: Use the factory instead\n\n protected: UmbilicalModel() {}\n\n\n\n /// \\brief Destructor.\n\n public: virtual ~UmbilicalModel() {}\n\n\n\n /// \\brief Initialize model.\n\n public: virtual void Init();\n\n\n\n /// \\brief Update Umbilical (and apply forces)\n\n public: virtual void OnUpdate(const common::UpdateInfo &_info,\n\n const ignition::math::Vector3d& _flow) = 0;\n\n\n\n /// \\brief Gazebo model to which this umbilical belongs.\n\n protected: physics::ModelPtr model;\n\n\n\n /// \\brief Moving connector link of this umbilical.\n\n protected: physics::LinkPtr connector;\n\n};\n\n\n\n/// \\brief Function pointer to create a certain conversion function.\n\ntypedef UmbilicalModel* (*UmbilicalModelCreator)(sdf::ElementPtr,\n\n physics::ModelPtr);\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/UmbilicalModel.h", "rank": 3, "score": 215031.93064528142 }, { "content": " class ThrusterROSPlugin : public gazebo::ThrusterPlugin\n\n {\n\n /// \\brief Constrcutor.\n\n public: ThrusterROSPlugin();\n\n\n\n /// \\brief Destructor.\n\n public: ~ThrusterROSPlugin();\n\n\n\n /// \\brief Load module and read parameters from SDF.\n\n public: void Load(gazebo::physics::ModelPtr _parent, sdf::ElementPtr _sdf);\n\n\n\n /// \\brief Publish thruster state via ROS.\n\n public: void RosPublishStates();\n\n\n\n /// \\brief Set new set point (desired thrust [N]) for thruster.\n\n public: void SetThrustReference(\n\n const uuv_gazebo_ros_plugins_msgs::msg::FloatStamped::SharedPtr _msg);\n\n\n\n /// \\brief Return the ROS publish period.\n\n public: gazebo::common::Time GetRosPublishPeriod();\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/ThrusterROSPlugin.h", "rank": 4, "score": 213665.06149332743 }, { "content": "class UmbilicalModelBerg : public UmbilicalModel\n\n{\n\n /// \\brief Protected constructor: Use the factory instead\n\n protected: UmbilicalModelBerg(sdf::ElementPtr _sdf,\n\n physics::ModelPtr _model);\n\n\n\n /// \\brief Create UmbilicalModel according to its description.\n\n public: static UmbilicalModel* create(sdf::ElementPtr _sdf,\n\n physics::ModelPtr _model);\n\n\n\n /// \\brief Update Umbilical (and apply forces)\n\n public: virtual void OnUpdate(const common::UpdateInfo &_info,\n\n const ignition::math::Vector3d& _flow);\n\n\n\n /// \\brief Register this UmbilicalModel function with the factory.\n\n private: REGISTER_UMBILICALMODEL(UmbilicalModelBerg);\n\n\n\n /// \\brief The unique identifier of this UmbilicalModel.\n\n private: static const std::string IDENTIFIER;\n\n\n\n /// \\brief Umbilical diameter.\n\n private: double diameter;\n\n\n\n /// \\brief Water density.\n\n private: double rho;\n\n};\n\n}\n\n\n\n#endif // __UUV_GAZEBO_PLUGINS_UMBILICAL_MODEL_HH__\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/UmbilicalModel.h", "rank": 5, "score": 213306.7062644014 }, { "content": "/// \\brief Factory singleton class that creates a HydrodynamicModel from sdf.\n\nclass HydrodynamicModelFactory\n\n{\n\n /// \\brief Create HydrodynamicModel object according to its sdf Description.\n\n public: HydrodynamicModel* CreateHydrodynamicModel(sdf::ElementPtr _sdf,\n\n physics::LinkPtr _link);\n\n\n\n /// \\brief Returns the singleton instance of this factory.\n\n public: static HydrodynamicModelFactory& GetInstance();\n\n\n\n /// \\brief Register a class with its creator.\n\n public: bool RegisterCreator(const std::string& _identifier,\n\n HydrodynamicModelCreator _creator);\n\n\n\n /// \\brief Constructor is private since this is a singleton.\n\n private: HydrodynamicModelFactory() {}\n\n\n\n /// \\brief Map of each registered identifier to its corresponding creator.\n\n private: std::map<std::string, HydrodynamicModelCreator> creators_;\n\n};\n\n\n\n/// Use the following macro within a HydrodynamicModel declaration:\n\n#define REGISTER_HYDRODYNAMICMODEL(type) static const bool registeredWithFactory\n\n\n\n/// Use the following macro before a HydrodynamicModel's definition:\n\n#define REGISTER_HYDRODYNAMICMODEL_CREATOR(type, creator) \\\n\n const bool type::registeredWithFactory = \\\n\n HydrodynamicModelFactory::GetInstance().RegisterCreator( \\\n\n type::IDENTIFIER, creator);\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 6, "score": 213242.29465609614 }, { "content": "/// \\brief Factory singleton class that creates an UmbilicalModel from sdf.\n\nclass UmbilicalModelFactory\n\n{\n\n /// \\brief Create a ConversionFunction object according to its sdf Description\n\n public: UmbilicalModel* CreateUmbilicalModel(sdf::ElementPtr _sdf,\n\n physics::ModelPtr _model);\n\n\n\n /// \\brief Return the singleton instance of this factory.\n\n public: static UmbilicalModelFactory& GetInstance();\n\n\n\n /// \\brief Register an UmbilicalModel class with its creator.\n\n public: bool RegisterCreator(const std::string& _identifier,\n\n UmbilicalModelCreator _creator);\n\n\n\n /// \\brief Constructor is private since this is a singleton.\n\n private: UmbilicalModelFactory() {}\n\n\n\n /// \\brief Map of each registered identifiers to its corresponding creator\n\n private: std::map<std::string, UmbilicalModelCreator> creators_;\n\n};\n\n\n\n/// Use the following macro within a ThrusterDynamics declaration:\n\n#define REGISTER_UMBILICALMODEL(type) \\\n\n static const bool registeredWithFactory\n\n\n\n/// Use the following macro before a ThrusterDynamics's definition:\n\n#define REGISTER_UMBILICALMODEL_CREATOR(type, creator) \\\n\n const bool type::registeredWithFactory = \\\n\n UmbilicalModelFactory::GetInstance().RegisterCreator( \\\n\n type::IDENTIFIER, creator);\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/UmbilicalModel.h", "rank": 7, "score": 213242.29465609614 }, { "content": "//////////////////////////////////////////////////////////////////////////////\n\n/// \\brief Class containting the methods and attributes\n\n/// for a Fossen robot-like hydrodynamic model. The restoring\n\n/// forces are applied by the BuoyantObject class methods. Using the\n\n/// plugin for UUV models will use both this and the buoyant object\n\n/// class definitions, therefore the restoring forces were not\n\n/// inherited here.\n\n/// References:\n\n/// - Fossen, Thor, \"Handbook of Marine Craft and Hydrodynamics and Motion\n\n/// Control\", 2011\n\nclass HMFossen : public HydrodynamicModel\n\n{\n\n /// \\brief Create model of this type with parameter values from sdf.\n\n public: static HydrodynamicModel* create(sdf::ElementPtr _sdf,\n\n physics::LinkPtr _link);\n\n\n\n /// \\brief Return (derived) type of hydrodynamic model\n\n public: virtual std::string GetType() { return IDENTIFIER; }\n\n\n\n /// \\brief Prints parameters\n\n public: virtual void Print(std::string _paramName,\n\n std::string _message = std::string());\n\n\n\n /// \\brief Return paramater in vector form for the given tag\n\n public: virtual bool GetParam(std::string _tag,\n\n std::vector<double>& _output);\n\n\n\n /// \\brief Return paramater in scalar form for the given tag\n\n public: virtual bool GetParam(std::string _tag, double& _output);\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 8, "score": 209745.98553800624 }, { "content": "class HydrodynamicModel : public BuoyantObject\n\n{\n\n /// \\brief Protected constructor: Use the factory for object creation.\n\n protected: HydrodynamicModel(sdf::ElementPtr _sdf, physics::LinkPtr _link);\n\n\n\n /// \\brief Returns type of model\n\n public: virtual std::string GetType() = 0;\n\n\n\n /// \\brief Computation of the hydrodynamic forces\n\n public: virtual void ApplyHydrodynamicForces(\n\n double time, const ignition::math::Vector3d &_flowVelWorld) = 0;\n\n\n\n /// \\brief Prints parameters\n\n public: virtual void Print(std::string _paramName,\n\n std::string _message = std::string()) = 0;\n\n\n\n /// \\brief Return paramater in vector form for the given tag\n\n public: virtual bool GetParam(std::string _tag,\n\n std::vector<double>& _output) = 0;\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 9, "score": 209732.51851454776 }, { "content": "\n\n/// \\file UmbilicalModel.hh\n\n/// \\brief Various umbilical models.\n\n\n\n#ifndef __UUV_GAZEBO_PLUGINS_UMBILICAL_MODEL_HH__\n\n#define __UUV_GAZEBO_PLUGINS_UMBILICAL_MODEL_HH__\n\n\n\n#include <string>\n\n#include <map>\n\n#include <gazebo/gazebo.hh>\n\n#include <gazebo/common/UpdateInfo.hh>\n\n#include <gazebo/physics/Link.hh>\n\n#include <gazebo/physics/Model.hh>\n\n#include <sdf/sdf.hh>\n\n\n\nnamespace gazebo\n\n{\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/UmbilicalModel.h", "rank": 10, "score": 208197.62172536948 }, { "content": "\n\n/// \\file HydrodynamicModel.hh\n\n/// \\brief This file contains the definition for different classes of\n\n/// hydrodynamic models for submerged objects\n\n\n\n#ifndef __UUV_GAZEBO_HYDRO_MODEL_HH__\n\n#define __UUV_GAZEBO_HYDRO_MODEL_HH__\n\n\n\n#include <gazebo/gazebo.hh>\n\n#include <gazebo/physics/Link.hh>\n\n#include <gazebo/physics/Model.hh>\n\n#include <gazebo/physics/Collision.hh>\n\n#include <gazebo/physics/Shape.hh>\n\n\n\n#include <eigen3/Eigen/Core>\n\n#include <eigen3/Eigen/Geometry>\n\n\n\n#include <string>\n\n#include <vector>\n\n#include <map>\n\n\n\n#include <uuv_gazebo_plugins/Def.h>\n\n#include <uuv_gazebo_plugins/BuoyantObject.h>\n\n\n\n\n\nnamespace gazebo\n\n{\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 11, "score": 208196.14206107333 }, { "content": "\n\n /// \\brief Filtered linear & angular acceleration vector in link frame.\n\n /// This is used to prevent the model to become unstable given that Gazebo\n\n /// only calls the update function at the beginning or at the end of a\n\n /// iteration of the physics engine\n\n protected: Eigen::Vector6d filteredAcc;\n\n\n\n /// \\brief Last timestamp (in seconds) at which ApplyHydrodynamicForces was\n\n /// called\n\n protected: double lastTime;\n\n\n\n /// \\brief Last body-fixed relative velocity (nu_R in Fossen's equations)\n\n protected: Eigen::Vector6d lastVelRel;\n\n\n\n /// \\brief List of parameters needed from the SDF element\n\n protected: std::vector<std::string> params;\n\n\n\n /// \\brief Reynolds number (not used by all models)\n\n protected: double Re;\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 12, "score": 208182.86126923567 }, { "content": " /// \\brief Temperature (not used by all models)\n\n protected: double temperature;\n\n};\n\n\n\n/// \\brief Pointer to model\n\ntypedef boost::shared_ptr<HydrodynamicModel> HydrodynamicModelPtr;\n\n\n\n/// \\brief Function pointer to create a certain a model\n\ntypedef HydrodynamicModel* (*HydrodynamicModelCreator)(sdf::ElementPtr, \\\n\n physics::LinkPtr);\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 13, "score": 208182.15593407315 }, { "content": " /// \\brief Return paramater in vector form for the given tag\n\n public: virtual bool GetParam(std::string _tag,\n\n double& _output) = 0;\n\n\n\n /// \\brief Set a scalar parameters\n\n public: virtual bool SetParam(std::string _tag, double _input) = 0;\n\n\n\n /// \\brief Filter acceleration (fix due to the update structure of Gazebo)\n\n protected: void ComputeAcc(Eigen::Vector6d _velRel,\n\n double _time,\n\n double _alpha = 0.3);\n\n\n\n /// \\brief Returns true if all parameters are available from the SDF element\n\n protected: bool CheckParams(sdf::ElementPtr _sdf);\n\n\n\n /// \\brief Convert vector to comply with the NED reference frame\n\n protected: ignition::math::Vector3d ToNED(ignition::math::Vector3d _vec);\n\n\n\n /// \\brief Convert vector to comply with the NED reference frame\n\n protected: ignition::math::Vector3d FromNED(ignition::math::Vector3d _vec);\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 14, "score": 208181.59790110108 }, { "content": " /// \\brief Set scalar parameter\n\n public: virtual bool SetParam(std::string _tag, double _input);\n\n\n\n /// \\brief Register this model with the factory.\n\n protected: REGISTER_HYDRODYNAMICMODEL(HMFossen);\n\n\n\n /// \\brief Unique identifier for this geometry\n\n protected: static const std::string IDENTIFIER;\n\n\n\n protected: HMFossen(sdf::ElementPtr _sdf, physics::LinkPtr _link);\n\n\n\n /// \\brief Computation of the hydrodynamic forces\n\n public: virtual void ApplyHydrodynamicForces(double time,\n\n const ignition::math::Vector3d &_flowVelWorld);\n\n\n\n /// \\brief Computes the added-mass Coriolis matrix Ca.\n\n protected: void ComputeAddedCoriolisMatrix(const Eigen::Vector6d& _vel,\n\n const Eigen::Matrix6d& _Ma,\n\n Eigen::Matrix6d &_Ca) const;\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 15, "score": 208179.4563187558 }, { "content": " protected: HMBox(sdf::ElementPtr _sdf, physics::LinkPtr _link);\n\n\n\n /// \\brief Drag coefficient\n\n protected: double Cd;\n\n\n\n /// \\brief Length of the box\n\n protected: double length;\n\n\n\n /// \\brief Width of the box\n\n protected: double width;\n\n\n\n /// \\brief Height of the box\n\n protected: double height;\n\n};\n\n}\n\n\n\n#endif // __UUV_GAZEBO_HYDRO_MODEL_HH__\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 16, "score": 208175.88941683003 }, { "content": "\n\n /// \\brief Length of the cylinder\n\n protected: double length;\n\n\n\n /// \\brief Sphere radius\n\n protected: double radius;\n\n\n\n /// \\brief Name of the unit rotation axis (just a tag for x, y or z)\n\n protected: std::string axis;\n\n\n\n /// \\brief Ratio between length and diameter\n\n protected: double dimRatio;\n\n\n\n /// \\brief Approximated drag coefficient for the circular area\n\n protected: double cdCirc;\n\n\n\n /// \\brief Approximated drag coefficient for the rectangular section\n\n protected: double cdLength;\n\n};\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 17, "score": 208175.46453211282 }, { "content": " /// \\brief Updates the damping matrix for the current velocity\n\n protected: void ComputeDampingMatrix(const Eigen::Vector6d& _vel,\n\n Eigen::Matrix6d &_D) const;\n\n\n\n /// \\brief Returns the added-mass matrix with the scaling and offset\n\n protected: Eigen::Matrix6d GetAddedMass() const;\n\n\n\n /// \\brief Added-mass matrix\n\n protected: Eigen::Matrix6d Ma;\n\n\n\n /// \\brief Scaling of the added-mass matrix\n\n protected: double scalingAddedMass;\n\n\n\n /// \\brief Offset for the added-mass matrix\n\n protected: double offsetAddedMass;\n\n\n\n /// \\brief Added-mass associated Coriolis matrix\n\n protected: Eigen::Matrix6d Ca;\n\n\n\n /// \\brief Damping matrix\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 18, "score": 208174.56356041788 }, { "content": " protected: Eigen::Matrix6d D;\n\n\n\n /// \\brief Scaling of the damping matrix\n\n protected: double scalingDamping;\n\n\n\n /// \\brief Offset for the linear damping matrix\n\n protected: double offsetLinearDamping;\n\n\n\n /// \\brief Offset for the linear damping matrix\n\n protected: double offsetLinForwardSpeedDamping;\n\n\n\n /// \\brief Offset for the linear damping matrix\n\n protected: double offsetNonLinDamping;\n\n\n\n /// \\brief Linear damping matrix\n\n protected: Eigen::Matrix6d DLin;\n\n\n\n /// \\brief Linear damping matrix proportional only to the forward speed\n\n /// (useful for modeling AUVs). From [1], according to Newman (1977), there\n\n /// is a damping force component that linearly increases with the presence\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 19, "score": 208174.45599156266 }, { "content": " /// of forward speed, particularly so for slender bodies.\n\n ///\n\n /// References:\n\n /// [1] Refsnes - 2007 - Nonlinear model-based control of slender body AUVs\n\n protected: Eigen::Matrix6d DLinForwardSpeed;\n\n\n\n /// \\brief Nonlinear damping coefficients\n\n protected: Eigen::Matrix6d DNonLin;\n\n\n\n /// \\brief Linear damping coefficients\n\n protected: std::vector<double> linearDampCoef;\n\n\n\n /// \\brief Quadratic damping coefficients\n\n protected: std::vector<double> quadDampCoef;\n\n};\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 20, "score": 208171.6415204728 }, { "content": "// Copyright (c) 2020 The Plankton Authors.\n\n// All rights reserved.\n\n//\n\n// This source code is derived from UUV Simulator\n\n// (https://github.com/uuvsimulator/uuv_simulator)\n\n// Copyright (c) 2016-2019 The UUV Simulator Authors\n\n// licensed under the Apache license, Version 2.0\n\n// cf. 3rd-party-licenses.txt file in the root directory of this source tree.\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 21, "score": 208171.06960784958 }, { "content": "// Copyright (c) 2020 The Plankton Authors.\n\n// All rights reserved.\n\n//\n\n// This source code is derived from UUV Simulator\n\n// (https://github.com/uuvsimulator/uuv_simulator)\n\n// Copyright (c) 2016-2019 The UUV Simulator Authors\n\n// licensed under the Apache license, Version 2.0\n\n// cf. 3rd-party-licenses.txt file in the root directory of this source tree.\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/UmbilicalModel.h", "rank": 22, "score": 208171.06960784958 }, { "content": "\n\n /// \\brief Sphere radius\n\n protected: double radius;\n\n\n\n /// \\brief Drag coefficient\n\n protected: double Cd;\n\n\n\n /// \\brief Area of the cross section\n\n protected: double areaSection;\n\n};\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 23, "score": 208168.14362957745 }, { "content": "\n\n/// \\file LiftDragModel.hh\n\n/// \\brief Various Lift&Drag models for Fins.\n\n\n\n#ifndef __UUV_GAZEBO_PLUGINS_LIFT_DRAG_MODEL_HH__\n\n#define __UUV_GAZEBO_PLUGINS_LIFT_DRAG_MODEL_HH__\n\n\n\n#include <map>\n\n#include <string>\n\n\n\n#include <gazebo/gazebo.hh>\n\n\n\n#include <sdf/sdf.hh>\n\n\n\nnamespace gazebo\n\n{\n\n/// \\brief Abstract base class for Lift&Drag models.\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/LiftDragModel.h", "rank": 24, "score": 206172.46506608912 }, { "content": " public: virtual bool GetParam(std::string _tag,\n\n double& _output) = 0;\n\n\n\n /// \\brief Return list of all parameters\n\n public: virtual std::map<std::string, double> GetListParams() = 0;\n\n\n\n /// \\brief Time of last state update.\n\n protected: double prevTime;\n\n\n\n /// \\brief Latest state.\n\n protected: double state;\n\n};\n\n\n\n/// \\brief Function pointer to create a certain LiftDrag object.\n\ntypedef LiftDrag* (*LiftDragCreator)(sdf::ElementPtr);\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/LiftDragModel.h", "rank": 25, "score": 206155.04095646768 }, { "content": " /// \\brief Unique identifier for this dynamical model\n\n private: static const std::string IDENTIFIER;\n\n\n\n /// \\brief Lift constant\n\n protected: double liftConstant;\n\n\n\n /// \\brief Drag constant\n\n protected: double dragConstant;\n\n\n\n /// \\brief Constructor.\n\n private: LiftDragQuadratic(double _liftConstant, double _dragConstant)\n\n : LiftDrag(), liftConstant(_liftConstant), dragConstant(_dragConstant) {}\n\n};\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/LiftDragModel.h", "rank": 26, "score": 206150.76012799895 }, { "content": " /// \\brief Return list of all parameters\n\n public: virtual std::map<std::string, double> GetListParams();\n\n\n\n /// \\brief Airfoil area.\n\n protected: double area;\n\n\n\n /// \\brief Fluid density.\n\n protected: double fluidDensity;\n\n\n\n /// \\brief Original zero angle of attack location.\n\n protected: double a0;\n\n\n\n /// \\brief Stall angle.\n\n protected: double alphaStall;\n\n\n\n /// \\brief Lift coefficient without stall.\n\n protected: double cla;\n\n\n\n /// \\brief Lift coefficient with stall.\n\n protected: double claStall;\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/LiftDragModel.h", "rank": 27, "score": 206150.29875892683 }, { "content": "// Copyright (c) 2020 The Plankton Authors.\n\n// All rights reserved.\n\n//\n\n// This source code is derived from UUV Simulator\n\n// (https://github.com/uuvsimulator/uuv_simulator)\n\n// Copyright (c) 2016-2019 The UUV Simulator Authors\n\n// licensed under the Apache license, Version 2.0\n\n// cf. 3rd-party-licenses.txt file in the root directory of this source tree.\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/LiftDragModel.h", "rank": 28, "score": 206146.2602845685 }, { "content": "\n\n /// \\brief Drag coefficient without stall.\n\n protected: double cda;\n\n\n\n /// \\brief Drag coefficient with stall.\n\n protected: double cdaStall;\n\n\n\n /// \\brief Constructor.\n\n private: LiftDragTwoLines(double _area, double _fluidDensity, double _a0,\n\n double _alphaStall, double _cla, double _claStall,\n\n double _cda, double _cdaStall)\n\n : LiftDrag(), area(_area), fluidDensity(_fluidDensity),\n\n a0(_a0), alphaStall(_alphaStall),\n\n cla(_cla), claStall(_claStall),\n\n cda(_cda), cdaStall(_cdaStall) {}\n\n};\n\n}\n\n\n\n#endif\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/LiftDragModel.h", "rank": 29, "score": 206143.33430629637 }, { "content": "/// \\brief Class for the thruster plugin\n\nclass ThrusterPlugin : public ModelPlugin\n\n{\n\n /// \\brief Constructor\n\n public: ThrusterPlugin();\n\n\n\n /// \\brief Destructor\n\n public: virtual ~ThrusterPlugin();\n\n\n\n // Documentation inherited.\n\n public: virtual void Load(physics::ModelPtr _model,\n\n sdf::ElementPtr _sdf);\n\n\n\n // Documentation inherited.\n\n public: virtual void Init();\n\n\n\n /// \\brief Custom plugin reset behavior.\n\n public: virtual void Reset();\n\n\n\n /// \\brief Update the simulation state.\n\n /// \\param[in] _info Information used in the update event.\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/ThrusterPlugin.h", "rank": 30, "score": 204340.16545998768 }, { "content": "class UmbilicalPlugin : public ModelPlugin\n\n{\n\n /// \\brief Destructor.\n\n public: UmbilicalPlugin();\n\n\n\n /// \\brief Constructor.\n\n public: ~UmbilicalPlugin();\n\n\n\n /// \\brief Load plugin and its configuration from sdf\n\n protected: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);\n\n\n\n /// \\brief Update callback from simulation.\n\n protected: virtual void OnUpdate(const common::UpdateInfo&);\n\n\n\n /// \\brief Reads flow velocity topic\n\n protected: void UpdateFlowVelocity(ConstVector3dPtr &_msg);\n\n\n\n /// \\brief Pointer to the update event connection.\n\n protected: event::ConnectionPtr updateConnection;\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/UmbilicalPlugin.h", "rank": 31, "score": 204335.1378728117 }, { "content": "class FinPlugin : public ModelPlugin\n\n{\n\n /// \\brief Constructor\n\n public: FinPlugin();\n\n\n\n /// \\brief Destructor\n\n public: virtual ~FinPlugin();\n\n\n\n // Documentation inherited.\n\n public: virtual void Load(physics::ModelPtr _model,\n\n sdf::ElementPtr _sdf);\n\n\n\n // Documentation inherited.\n\n public: virtual void Init();\n\n\n\n /// \\brief Update the simulation state.\n\n /// \\param[in] _info Information used in the update event.\n\n public: void OnUpdate(const common::UpdateInfo &_info);\n\n\n\n /// \\brief Callback for the input topic subscriber\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/FinPlugin.h", "rank": 32, "score": 204335.13787281167 }, { "content": "/// \\brief Abstract base class for Lift&Drag models.\n\nclass LiftDrag\n\n{\n\n /// \\brief Protected constructor: Use the factory for object creation.\n\n protected: LiftDrag() : prevTime(-10.), state(0.) {}\n\n\n\n /// \\brief Check for element. Complain and return 0 if it is missing.\n\n public: static bool CheckForElement(sdf::ElementPtr _sdf,\n\n const std::string& element);\n\n\n\n /// \\brief Destructor.\n\n public: virtual ~LiftDrag() {}\n\n\n\n /// \\brief Return (derived) type of lift&drag model.\n\n public: virtual std::string GetType() = 0;\n\n\n\n /// \\brief Compute the lift and drag force.\n\n public: virtual ignition::math::Vector3d compute(\n\n const ignition::math::Vector3d &_velL) = 0;\n\n\n\n /// \\brief Return paramater in vector form for the given tag\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/LiftDragModel.h", "rank": 33, "score": 202232.0940684559 }, { "content": "namespace gazebo\n\n{\n\n// Pi\n\n#define PI 3.14159265359\n\n\n\n/// \\brief Conversion of a string to a double vector\n\ninline std::vector<double> Str2Vector(std::string _input)\n\n{\n\n std::vector<double> output;\n\n std::string buf;\n\n std::stringstream ss(_input);\n\n while (ss >> buf)\n\n output.push_back(std::stod(buf));\n\n return output;\n\n}\n\n\n\n/// \\brief Returns the cross product operator matrix\n\n/// for Eigen vectors\n\ninline Eigen::Matrix3d CrossProductOperator(Eigen::Vector3d _x)\n\n{\n\n Eigen::Matrix3d output;\n\n output << 0.0, -_x[2], _x[1], _x[2], 0.0, -_x[0], -_x[1], _x[0], 0.0;\n\n return output;\n\n}\n\n\n\n/// \\brief Returns the cross product operator matrix\n\n/// for Gazebo vectors\n\ninline Eigen::Matrix3d CrossProductOperator(ignition::math::Vector3d _x)\n\n{\n\n Eigen::Matrix3d output;\n\n output << 0.0, -_x[2], _x[1], _x[2], 0.0, -_x[0], -_x[1], _x[0], 0.0;\n\n return output;\n\n}\n\n\n\ninline Eigen::Vector3d ToEigen(const ignition::math::Vector3d &_x)\n\n{\n\n return Eigen::Vector3d(_x[0], _x[1], _x[2]);\n\n}\n\n\n\ninline Eigen::Matrix3d ToEigen(const ignition::math::Matrix3d &_x)\n\n{\n\n Eigen::Matrix3d m;\n\n m << _x(0, 0), _x(0, 1), _x(0, 2),\n\n _x(1, 0), _x(1, 1), _x(1, 2),\n\n _x(2, 0), _x(2, 1), _x(2, 2);\n\n return m;\n\n}\n\n\n\ninline Eigen::Vector6d EigenStack(const ignition::math::Vector3d &_x,\n\n const ignition::math::Vector3d &_y)\n\n{\n\n Eigen::Vector3d xe = ToEigen(_x);\n\n Eigen::Vector3d ye = ToEigen(_y);\n\n Eigen::Vector6d out;\n\n out << xe, ye;\n\n return out;\n\n}\n\n\n\ninline ignition::math::Vector3d Vec3dToGazebo(const Eigen::Vector3d &_x)\n\n{\n\n return ignition::math::Vector3d(_x[0], _x[1], _x[2]);\n\n}\n\n\n\ninline ignition::math::Matrix3d Mat3dToGazebo(const Eigen::Matrix3d &_x)\n\n{\n\n return ignition::math::Matrix3d(_x(0, 0), _x(0, 1), _x(0, 2),\n\n _x(1, 0), _x(1, 1), _x(1, 2),\n\n _x(2, 0), _x(2, 1), _x(2, 2));\n\n}\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/Def.h", "rank": 34, "score": 201943.9174409903 }, { "content": "/// \\brief Factory singleton class that creates a LiftDrag from sdf.\n\nclass LiftDragFactory\n\n{\n\n /// \\brief Create LiftDrag object according to its sdf Description.\n\n public: LiftDrag* CreateLiftDrag(sdf::ElementPtr _sdf);\n\n\n\n /// \\brief Returns the singleton instance of this factory.\n\n public: static LiftDragFactory& GetInstance();\n\n\n\n /// \\brief Register a LiftDrag class with its creator.\n\n public: bool RegisterCreator(const std::string& _identifier,\n\n LiftDragCreator _creator);\n\n\n\n /// \\brief Constructor is private since this is a singleton.\n\n private: LiftDragFactory() {}\n\n\n\n /// \\brief Map of each registered identifier to its corresponding creator.\n\n private: std::map<std::string, LiftDragCreator> creators_;\n\n};\n\n\n\n/// Use the following macro within a LiftDrag declaration:\n\n#define REGISTER_LIFTDRAG(type) static const bool registeredWithFactory\n\n\n\n/// Use the following macro before a LiftDrag's definition:\n\n#define REGISTER_LIFTDRAG_CREATOR(type, creator) \\\n\n const bool type::registeredWithFactory = \\\n\n LiftDragFactory::GetInstance().RegisterCreator( \\\n\n type::IDENTIFIER, creator);\n\n\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/LiftDragModel.h", "rank": 35, "score": 200337.60200787074 }, { "content": "//////////////////////////////////////////////////////////////////////////////\n\n/// \\brief Class containing the methods and attributes for a hydrodynamic model\n\n/// for a cylinder in the fluid\n\nclass HMCylinder : public HMFossen\n\n{\n\n /// \\brief Create model of this type with parameter values from sdf.\n\n public: static HydrodynamicModel* create(sdf::ElementPtr _sdf,\n\n physics::LinkPtr _link);\n\n\n\n /// \\brief Return (derived) type of hydrodynamic model\n\n public: virtual std::string GetType() { return IDENTIFIER; }\n\n\n\n /// \\brief Prints parameters\n\n public: virtual void Print(std::string _paramName,\n\n std::string _message = std::string());\n\n\n\n /// \\brief Register this model with the factory.\n\n private: REGISTER_HYDRODYNAMICMODEL(HMCylinder);\n\n\n\n /// \\brief Unique identifier for this geometry\n\n protected: static const std::string IDENTIFIER;\n\n\n\n protected: HMCylinder(sdf::ElementPtr _sdf, physics::LinkPtr _link);\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 36, "score": 198483.24670590056 }, { "content": "//////////////////////////////////////////////////////////////////////////////\n\n/// \\brief Class containing the methods and attributes for a hydrodynamic model\n\n/// for a sphere in the fluid\n\nclass HMSphere : public HMFossen\n\n{\n\n /// \\brief Create model of this type with parameter values from sdf.\n\n public: static HydrodynamicModel* create(sdf::ElementPtr _sdf,\n\n physics::LinkPtr _link);\n\n\n\n /// \\brief Return (derived) type of hydrodynamic model\n\n public: virtual std::string GetType() { return IDENTIFIER; }\n\n\n\n /// \\brief Prints parameters\n\n public: virtual void Print(std::string _paramName,\n\n std::string _message = std::string());\n\n\n\n /// \\brief Register this model with the factory.\n\n protected: REGISTER_HYDRODYNAMICMODEL(HMSphere);\n\n\n\n /// \\brief Unique identifier for this geometry\n\n protected: static const std::string IDENTIFIER;\n\n\n\n protected: HMSphere(sdf::ElementPtr _sdf, physics::LinkPtr _link);\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 37, "score": 198483.24670590056 }, { "content": "//////////////////////////////////////////////////////////////////////////////\n\n/// \\brief Class containing the methods and attributes for a hydrodynamic model\n\n/// for a box in the fluid\n\nclass HMBox : public HMFossen\n\n{\n\n /// \\brief Create model of this type with parameter values from sdf.\n\n public: static HydrodynamicModel* create(sdf::ElementPtr _sdf,\n\n physics::LinkPtr _link);\n\n\n\n /// \\brief Return (derived) type of hydrodynamic model\n\n public: virtual std::string GetType() { return IDENTIFIER; }\n\n\n\n /// \\brief Prints parameters\n\n public: virtual void Print(std::string _paramName,\n\n std::string _message = std::string());\n\n\n\n /// \\brief Register this model with the factory.\n\n private: REGISTER_HYDRODYNAMICMODEL(HMBox);\n\n\n\n /// \\brief Unique identifier for this geometry\n\n protected: static const std::string IDENTIFIER;\n\n\n\n /// \\brief Constructor\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 38, "score": 198483.24670590056 }, { "content": "//////////////////////////////////////////////////////////////////////////////\n\n/// \\brief Class containing the methods and attributes for a hydrodynamic model\n\n/// for a spheroid in the fluid\n\n/// Reference: Antonelli - Underwater Robots\n\nclass HMSpheroid : public HMFossen\n\n{\n\n /// \\brief Create model of this type with parameter values from sdf.\n\n public: static HydrodynamicModel* create(sdf::ElementPtr _sdf,\n\n physics::LinkPtr _link);\n\n\n\n /// \\brief Return (derived) type of hydrodynamic model\n\n public: virtual std::string GetType() { return IDENTIFIER; }\n\n\n\n /// \\brief Prints parameters\n\n public: virtual void Print(std::string _paramName,\n\n std::string _message = std::string());\n\n\n\n /// \\brief Register this model with the factory.\n\n private: REGISTER_HYDRODYNAMICMODEL(HMSpheroid);\n\n\n\n /// \\brief Unique identifier for this geometry\n\n protected: static const std::string IDENTIFIER;\n\n\n\n protected: HMSpheroid(sdf::ElementPtr _sdf, physics::LinkPtr _link);\n\n\n\n /// \\brief Length of the sphroid\n\n protected: double length;\n\n\n\n /// \\brief Prolate spheroid's smaller radius\n\n protected: double radius;\n\n};\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/HydrodynamicModel.h", "rank": 39, "score": 198483.07418312918 }, { "content": "/// \\brief Basic quadratic (Hugin) lift&drag model, page 18 from [1].\n\n/// [1] Engelhardtsen, Øystein. \"3D AUV Collision Avoidance.\" (2007).\n\nclass LiftDragQuadratic : public LiftDrag\n\n{\n\n /// \\brief Create thruster model of this type with parameter values from sdf.\n\n public: static LiftDrag* create(sdf::ElementPtr _sdf);\n\n\n\n /// \\brief Return (derived) type of dynamic system.\n\n public: virtual std::string GetType() { return IDENTIFIER; }\n\n\n\n /// \\brief Compute the lift and drag force.\n\n public: virtual ignition::math::Vector3d compute(const ignition::math::Vector3d &velL);\n\n\n\n /// \\brief Register this model with the factory.\n\n private: REGISTER_LIFTDRAG(LiftDragQuadratic);\n\n\n\n /// \\brief Return paramater in scalar form for the given tag\n\n public: virtual bool GetParam(std::string _tag, double& _output);\n\n\n\n /// \\brief Return list of all parameters\n\n public: virtual std::map<std::string, double> GetListParams();\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/LiftDragModel.h", "rank": 40, "score": 194890.10908560507 }, { "content": "/// \\brief Lift&drag model that models lift/drag coeffs using two lines.\n\n/// This is based on Gazebo's LiftDragPlugin but implemented as a derived\n\n/// LiftDrag model to allow using it in combination with the dynamics of a\n\n/// Fin.\n\nclass LiftDragTwoLines: public LiftDrag\n\n{\n\n /// \\brief Create thruster model of this type with parameter values from sdf.\n\n public: static LiftDrag* create(sdf::ElementPtr _sdf);\n\n\n\n /// \\brief Return (derived) type of dynamic system.\n\n public: virtual std::string GetType() { return IDENTIFIER; }\n\n\n\n /// \\brief Compute the lift and drag force.\n\n public: virtual ignition::math::Vector3d compute(const ignition::math::Vector3d &_velL);\n\n\n\n /// \\brief Register this model with the factory.\n\n private: REGISTER_LIFTDRAG(LiftDragTwoLines);\n\n\n\n /// \\brief Unique identifier for this dynamical model.\n\n private: static const std::string IDENTIFIER;\n\n\n\n /// \\brief Return paramater in scalar form for the given tag\n\n public: virtual bool GetParam(std::string _tag, double& _output);\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/LiftDragModel.h", "rank": 41, "score": 193163.31436877613 }, { "content": "class CustomBatteryConsumerROSPlugin : public ModelPlugin\n\n{\n\n /// \\brief Constructor\n\n public: CustomBatteryConsumerROSPlugin();\n\n\n\n /// \\brief Destructor\n\n public: virtual ~CustomBatteryConsumerROSPlugin();\n\n\n\n /// \\brief Load module and read parameters from SDF.\n\n public: void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf);\n\n\n\n /// \\brief Callback for the device state topic subscriber\n\n protected: void UpdateDeviceState(const std_msgs::msg::Bool::SharedPtr _msg);\n\n\n\n /// \\brief Update power load\n\n protected: void UpdatePowerLoad(double _powerLoad = 0.0);\n\n\n\n /// \\brief Pointer to this ROS node's handle.\n\n protected: gazebo_ros::Node::SharedPtr myRosNode;\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/CustomBatteryConsumerROSPlugin.h", "rank": 42, "score": 191771.59720822316 }, { "content": " class FinROSPlugin : public gazebo::FinPlugin\n\n {\n\n using GetListParam = uuv_gazebo_ros_plugins_msgs::srv::GetListParam;\n\n using FloatStamped = uuv_gazebo_ros_plugins_msgs::msg::FloatStamped;\n\n\n\n /// \\brief Constrcutor.\n\n public: FinROSPlugin();\n\n\n\n /// \\brief Destructor.\n\n public: ~FinROSPlugin();\n\n\n\n /// \\brief Load module and read parameters from SDF.\n\n public: void Load(gazebo::physics::ModelPtr _parent, sdf::ElementPtr _sdf);\n\n\n\n /// \\brief Publish state via ROS.\n\n public: void RosPublishStates();\n\n\n\n /// \\brief Set new set point.\n\n public: void SetReference(\n\n const uuv_gazebo_ros_plugins_msgs::msg::FloatStamped::SharedPtr _msg);\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/FinROSPlugin.h", "rank": 43, "score": 186391.3221754486 }, { "content": " class UnderwaterObjectROSPlugin : public gazebo::UnderwaterObjectPlugin\n\n {\n\n /// \\brief Constructor\n\n public: UnderwaterObjectROSPlugin();\n\n\n\n /// \\brief Destructor\n\n public: virtual ~UnderwaterObjectROSPlugin();\n\n\n\n /// \\brief Load module and read parameters from SDF.\n\n public: void Load(gazebo::physics::ModelPtr _parent, sdf::ElementPtr _sdf);\n\n\n\n /// \\brief Initialize Module.\n\n public: virtual void Init();\n\n\n\n /// \\brief Reset Module.\n\n public: virtual void Reset();\n\n\n\n /// \\brief Update the simulation state.\n\n /// \\param[in] _info Information used in the update event.\n\n public: virtual void Update(const gazebo::common::UpdateInfo &_info);\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/UnderwaterObjectROSPlugin.h", "rank": 44, "score": 183523.4143394485 }, { "content": " protected: void UpdateInput(ConstDoublePtr &_msg);\n\n\n\n /// \\brief Reads current velocity topic\n\n protected: void UpdateCurrentVelocity(ConstVector3dPtr &_msg);\n\n\n\n /// \\brief Helper function that builds and return the plugin's topic prefix\n\n protected: std::string BuildTopicPrefix(const std::string& rosNamespace, int id);\n\n\n\n /// \\brief Fin dynamic model\n\n protected: std::shared_ptr<Dynamics> dynamics;\n\n\n\n /// \\brief Lift&Drag model\n\n protected: std::shared_ptr<LiftDrag> liftdrag;\n\n\n\n /// \\brief Update event\n\n protected: event::ConnectionPtr updateConnection;\n\n\n\n /// \\brief Gazebo node\n\n protected: transport::NodePtr node;\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/FinPlugin.h", "rank": 45, "score": 164648.13158803846 }, { "content": "\n\n/// \\file UmbilicalPlugin.hh\n\n/// \\brief Model plugin for the umbilical (tether) of an ROV.\n\n\n\n#ifndef __UUV_GAZEBO_PLUGINS_UMBILICAL_PLUGIN_HH__\n\n#define __UUV_GAZEBO_PLUGINS_UMBILICAL_PLUGIN_HH__\n\n\n\n#include <memory>\n\n#include <string>\n\n\n\n#include <gazebo/gazebo.hh>\n\n#include <gazebo/common/UpdateInfo.hh>\n\n#include <gazebo/common/Plugin.hh>\n\n#include <gazebo/physics/World.hh>\n\n#include <gazebo/transport/TransportTypes.hh>\n\n\n\n#include <uuv_gazebo_plugins/UmbilicalModel.h>\n\n\n\nnamespace gazebo\n\n{\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/UmbilicalPlugin.h", "rank": 46, "score": 164646.12501589928 }, { "content": "\n\n/// \\file FinPlugin.hh\n\n/// \\brief Model plugin for description of a submarine's fin.\n\n\n\n#ifndef __UUV_GAZEBO_PLUGINS_FIN_PLUGIN_HH__\n\n#define __UUV_GAZEBO_PLUGINS_FIN_PLUGIN_HH__\n\n\n\n#include <boost/shared_ptr.hpp>\n\n#include <gazebo/gazebo.hh>\n\n#include <sdf/sdf.hh>\n\n\n\n#include <gazebo/msgs/msgs.hh>\n\n#include <uuv_gazebo_plugins/Dynamics.h>\n\n#include <uuv_gazebo_plugins/LiftDragModel.h>\n\n\n\n#include \"Double.pb.h\"\n\n\n\nnamespace gazebo {\n\n\n\n/// \\brief Definition of a pointer to the floating point message\n\ntypedef const boost::shared_ptr<const uuv_gazebo_plugins_msgs::msgs::Double>\n\nConstDoublePtr;\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/FinPlugin.h", "rank": 47, "score": 164644.9124000323 }, { "content": "\n\n/// \\file ThrusterPlugin.hh\n\n/// \\brief Model plugin for description of the thruster dynamics\n\n\n\n#ifndef __UUV_GAZEBO_PLUGINS_THRUSTER_PLUGIN_HH__\n\n#define __UUV_GAZEBO_PLUGINS_THRUSTER_PLUGIN_HH__\n\n\n\n#include <boost/shared_ptr.hpp>\n\n\n\n#include <map>\n\n#include <string>\n\n#include <memory>\n\n\n\n#include <gazebo/gazebo.hh>\n\n#include <gazebo/transport/TransportTypes.hh>\n\n\n\n#include <sdf/sdf.hh>\n\n\n\n#include <uuv_gazebo_plugins/ThrusterConversionFcn.h>\n\n#include <uuv_gazebo_plugins/Dynamics.h>\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/ThrusterPlugin.h", "rank": 48, "score": 164641.5549979386 }, { "content": " /// \\brief Pointer to the model structure\n\n protected: gazebo::physics::ModelPtr model;\n\n\n\n /// \\brief Pointer to the world plugin\n\n protected: gazebo::physics::WorldPtr world;\n\n\n\n /// \\brief Gazebo node\n\n protected: gazebo::transport::NodePtr node;\n\n\n\n /// \\brief Subcriber to flow message\n\n protected: gazebo::transport::SubscriberPtr flowSubscriber;\n\n\n\n /// \\brief Flow velocity vector read from topic\n\n protected: ignition::math::Vector3d flowVelocity;\n\n\n\n /// \\brief Pointer to UmbilicalModel used in this plugin.\n\n protected: std::shared_ptr<UmbilicalModel> umbilical;\n\n};\n\n}\n\n\n\n#endif\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/UmbilicalPlugin.h", "rank": 49, "score": 164641.04727561132 }, { "content": " public: void Update(const common::UpdateInfo &_info);\n\n\n\n /// \\brief Callback for the input topic subscriber\n\n protected: void UpdateInput(ConstDoublePtr &_msg);\n\n\n\n /// \\brief Builds the topic prefix name\n\n protected: std::string BuildTopicPrefix(const std::string& pluginNamespace, int id);\n\n\n\n /// \\brief Thruster dynamic model\n\n protected: std::shared_ptr<Dynamics> thrusterDynamics;\n\n\n\n /// \\brief Thruster conversion function\n\n protected: std::shared_ptr<ConversionFunction> conversionFunction;\n\n\n\n /// \\brief Update event\n\n protected: event::ConnectionPtr updateConnection;\n\n\n\n /// \\brief Pointer to the thruster link\n\n protected: physics::LinkPtr thrusterLink;\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/ThrusterPlugin.h", "rank": 50, "score": 164640.88450023532 }, { "content": "\n\n#include \"Double.pb.h\"\n\n\n\nnamespace gazebo\n\n{\n\n/// \\brief Definition of a pointer to the floating point message\n\ntypedef const boost::shared_ptr<const uuv_gazebo_plugins_msgs::msgs::Double>\n\nConstDoublePtr;\n\n\n\n/// \\brief Class for the thruster plugin\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/ThrusterPlugin.h", "rank": 51, "score": 164639.7574392675 }, { "content": " /// \\brief Gazebo node\n\n protected: transport::NodePtr node;\n\n\n\n /// \\brief Subscriber to the reference signal topic.\n\n protected: transport::SubscriberPtr commandSubscriber;\n\n\n\n /// \\brief Publisher to the output thrust topic\n\n protected: transport::PublisherPtr thrustTopicPublisher;\n\n\n\n /// \\brief Input command, typically desired angular velocity of the\n\n /// rotor.\n\n protected: double inputCommand;\n\n\n\n /// \\brief Latest thrust force in [N]\n\n protected: double thrustForce;\n\n\n\n /// \\brief Time stamp of latest thrust force\n\n protected: common::Time thrustForceStamp;\n\n\n\n /// \\brief Optional: The rotor joint, used for visualization\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/ThrusterPlugin.h", "rank": 52, "score": 164636.8162397408 }, { "content": " protected: physics::JointPtr joint;\n\n\n\n /// \\brief: Optional: Commands less than this value will be clamped.\n\n protected: double clampMin;\n\n\n\n /// \\brief: Optional: Commands greater than this value will be clamped.\n\n protected: double clampMax;\n\n\n\n /// \\brief: Optional: Minimum thrust force output\n\n protected: double thrustMin;\n\n\n\n /// \\brief: Optional: Maximum thrust force output\n\n protected: double thrustMax;\n\n\n\n /// \\brief Thruster ID, used to generated topic names automatically\n\n protected: int thrusterID;\n\n\n\n /// \\brief Thruster topics prefix\n\n protected: std::string myTopicPrefix;\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/ThrusterPlugin.h", "rank": 53, "score": 164631.3632123606 }, { "content": " /// \\brief: Optional: Gain factor: Desired angular velocity = command * gain\n\n protected: double gain;\n\n\n\n /// \\brief Optional: Flag to indicate if the thruster is turned on or off\n\n protected: bool isOn;\n\n\n\n /// \\brief Optional: Output thrust efficiency factor of the thruster\n\n protected: double thrustEfficiency;\n\n\n\n /// \\brief Optional: Propeller angular velocity efficiency term\n\n protected: double propellerEfficiency;\n\n\n\n /// \\brief The axis about which the thruster rotates\n\n protected: ignition::math::Vector3d thrusterAxis;\n\n};\n\n}\n\n#endif // __UUV_GAZEBO_PLUGINS_THRUSTER_PLUGIN_HH__\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/ThrusterPlugin.h", "rank": 54, "score": 164628.4042333008 }, { "content": " /// \\brief The fin joint\n\n protected: physics::JointPtr joint;\n\n\n\n /// \\brief The fin link\n\n protected: physics::LinkPtr link;\n\n\n\n /// \\brief Subscriber to the reference signal topic.\n\n protected: transport::SubscriberPtr commandSubscriber;\n\n\n\n /// \\brief Publisher to the output thrust topic\n\n protected: transport::PublisherPtr anglePublisher;\n\n\n\n /// \\brief Force component calculated from the lift and drag module\n\n protected: ignition::math::Vector3d finForce;\n\n\n\n /// \\brief Latest input command.\n\n protected: double inputCommand;\n\n\n\n /// \\brief Fin ID\n\n protected: int finID;\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/FinPlugin.h", "rank": 55, "score": 164622.2128653757 }, { "content": "\n\n /// \\brief Topic prefix\n\n protected: std::string myTopicPrefix;\n\n\n\n /// \\brief Latest fin angle in [rad].\n\n protected: double angle;\n\n\n\n /// \\brief Time stamp of latest thrust force\n\n protected: common::Time angleStamp;\n\n\n\n /// \\brief Subcriber to current message\n\n protected: transport::SubscriberPtr currentSubscriber;\n\n\n\n /// \\brief Current velocity vector read from topic\n\n protected: ignition::math::Vector3d currentVelocity;\n\n};\n\n}\n\n\n\n#endif\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/FinPlugin.h", "rank": 56, "score": 164620.6327574573 }, { "content": "// Copyright (c) 2020 The Plankton Authors.\n\n// All rights reserved.\n\n//\n\n// This source code is derived from UUV Simulator\n\n// (https://github.com/uuvsimulator/uuv_simulator)\n\n// Copyright (c) 2016-2019 The UUV Simulator Authors\n\n// licensed under the Apache license, Version 2.0\n\n// cf. 3rd-party-licenses.txt file in the root directory of this source tree.\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/FinPlugin.h", "rank": 57, "score": 164619.85566904393 }, { "content": "// Copyright (c) 2020 The Plankton Authors.\n\n// All rights reserved.\n\n//\n\n// This source code is derived from UUV Simulator\n\n// (https://github.com/uuvsimulator/uuv_simulator)\n\n// Copyright (c) 2016-2019 The UUV Simulator Authors\n\n// licensed under the Apache license, Version 2.0\n\n// cf. 3rd-party-licenses.txt file in the root directory of this source tree.\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/UmbilicalPlugin.h", "rank": 58, "score": 164619.85566904393 }, { "content": "// Copyright (c) 2020 The Plankton Authors.\n\n// All rights reserved.\n\n//\n\n// This source code is derived from UUV Simulator\n\n// (https://github.com/uuvsimulator/uuv_simulator)\n\n// Copyright (c) 2016-2019 The UUV Simulator Authors\n\n// licensed under the Apache license, Version 2.0\n\n// cf. 3rd-party-licenses.txt file in the root directory of this source tree.\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/ThrusterPlugin.h", "rank": 59, "score": 164619.85566904393 }, { "content": "\n\n/// \\file Dynamics.hh\n\n/// \\brief 1D dynamic models\n\n\n\n#ifndef __UUV_GAZEBO_PLUGINS_THRUSTER_DYNAMICS_HH__\n\n#define __UUV_GAZEBO_PLUGINS_THRUSTER_DYNAMICS_HH__\n\n\n\n#include <map>\n\n#include <string>\n\n\n\n#include <sdf/sdf.hh>\n\n\n\nnamespace gazebo\n\n{\n\n/// \\brief Abstract base class for thruster dynamics.\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/Dynamics.h", "rank": 60, "score": 163581.07510939677 }, { "content": "\n\n /// \\brief Motor-shaft-propeller inertia.\n\n private: double Jmsp;\n\n\n\n /// \\brief Empirically-determined model parameter.\n\n private: double Kv1;\n\n\n\n /// \\brief Empirically-determined model parameter.\n\n private: double Kv2;\n\n\n\n /// \\brief Motor torque constant.\n\n private: double Kt;\n\n\n\n /// \\brief Winding resistance.\n\n private: double Rm;\n\n};\n\n}\n\n\n\n#endif\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/Dynamics.h", "rank": 61, "score": 163558.5322860184 }, { "content": "// Copyright (c) 2020 The Plankton Authors.\n\n// All rights reserved.\n\n//\n\n// This source code is derived from UUV Simulator\n\n// (https://github.com/uuvsimulator/uuv_simulator)\n\n// Copyright (c) 2016-2019 The UUV Simulator Authors\n\n// licensed under the Apache license, Version 2.0\n\n// cf. 3rd-party-licenses.txt file in the root directory of this source tree.\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/Dynamics.h", "rank": 62, "score": 163556.42558817993 }, { "content": "\n\n/// \\file UnderwaterObjectPlugin.hh\n\n/// \\brief Class declaration for the underwater objects subject to buoyancy,\n\n/// lift and drag forces.\n\n\n\n#ifndef __UUV_GAZEBO_PLUGINS_UNDERWATER_OBJECT_HH__\n\n#define __UUV_GAZEBO_PLUGINS_UNDERWATER_OBJECT_HH__\n\n\n\n#include <map>\n\n#include <string>\n\n\n\n#include <gazebo/gazebo.hh>\n\n#include <gazebo/msgs/msgs.hh>\n\n\n\n#include <uuv_gazebo_plugins/HydrodynamicModel.h>\n\n#include <uuv_gazebo_plugins/Def.h>\n\n\n\nnamespace gazebo\n\n{\n\n/// \\brief Gazebo model plugin class for underwater objects\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/UnderwaterObjectPlugin.h", "rank": 63, "score": 163334.21256632352 }, { "content": " HydrodynamicModelPtr> models;\n\n\n\n /// \\brief Flow velocity vector read from topic\n\n protected: ignition::math::Vector3d flowVelocity;\n\n\n\n /// \\brief Update event\n\n protected: gazebo::event::ConnectionPtr updateConnection;\n\n\n\n /// \\brief Pointer to the world plugin\n\n protected: gazebo::physics::WorldPtr world;\n\n\n\n /// \\brief Pointer to the model structure\n\n protected: gazebo::physics::ModelPtr model;\n\n\n\n /// \\brief Gazebo node\n\n protected: gazebo::transport::NodePtr node;\n\n\n\n /// \\brief Name of vehicle's base_link\n\n protected: std::string baseLinkName;\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/UnderwaterObjectPlugin.h", "rank": 64, "score": 163332.66728183758 }, { "content": " protected: virtual void PublishHydrodynamicWrenches(\n\n gazebo::physics::LinkPtr _link);\n\n\n\n /// \\brief Returns the wrench message for debugging topics\n\n /// \\param[in] _force Force vector\n\n /// \\param[in] _torque Torque vector\n\n /// \\param[in] _output Stamped wrench message to be updated\n\n protected: virtual void GenWrenchMsg(\n\n ignition::math::Vector3d _force, ignition::math::Vector3d _torque,\n\n gazebo::msgs::WrenchStamped &_output);\n\n\n\n /// \\brief Sets the topics used for publishing the intermediate data during\n\n /// the simulation\n\n /// \\param[in] _link Pointer to the link\n\n /// \\param[in] _hydro Pointer to the hydrodynamic model\n\n protected: virtual void InitDebug(gazebo::physics::LinkPtr _link,\n\n gazebo::HydrodynamicModelPtr _hydro);\n\n\n\n /// \\brief Pairs of links & corresponding hydrodynamic models\n\n protected: std::map<gazebo::physics::LinkPtr,\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/UnderwaterObjectPlugin.h", "rank": 65, "score": 163325.24000489627 }, { "content": " /// \\brief Subcriber to flow message\n\n protected: gazebo::transport::SubscriberPtr flowSubscriber;\n\n\n\n /// \\brief Flag to use the global current velocity or the individually\n\n /// assigned current velocity\n\n protected: bool useGlobalCurrent;\n\n\n\n /// \\brief Publishers of hydrodynamic and hydrostatic forces and torques in\n\n /// the case the debug flag is on\n\n protected: std::map<std::string, gazebo::transport::PublisherPtr> hydroPub;\n\n};\n\n}\n\n\n\n#endif // __UUV_GAZEBO_PLUGINS_UNDERWATER_OBJECT_HH__\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/UnderwaterObjectPlugin.h", "rank": 66, "score": 163322.20276152485 }, { "content": " protected: virtual void Connect();\n\n\n\n /// \\brief Reads flow velocity topic\n\n protected: void UpdateFlowVelocity(ConstVector3dPtr &_msg);\n\n\n\n /// \\brief Publish current velocity marker\n\n protected: virtual void PublishCurrentVelocityMarker();\n\n\n\n /// \\brief Publishes the state of the vehicle (is submerged)\n\n protected: virtual void PublishIsSubmerged();\n\n\n\n /// \\brief Publish restoring force\n\n /// \\param[in] _link Pointer to the link where the force information will\n\n /// be extracted from\n\n protected: virtual void PublishRestoringForce(\n\n gazebo::physics::LinkPtr _link);\n\n\n\n /// \\brief Publish hydrodynamic wrenches\n\n /// \\param[in] _link Pointer to the link where the force information will\n\n /// be extracted from\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/UnderwaterObjectPlugin.h", "rank": 67, "score": 163317.10127482205 }, { "content": "// Copyright (c) 2020 The Plankton Authors.\n\n// All rights reserved.\n\n//\n\n// This source code is derived from UUV Simulator\n\n// (https://github.com/uuvsimulator/uuv_simulator)\n\n// Copyright (c) 2016-2019 The UUV Simulator Authors\n\n// licensed under the Apache license, Version 2.0\n\n// cf. 3rd-party-licenses.txt file in the root directory of this source tree.\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/UnderwaterObjectPlugin.h", "rank": 68, "score": 163308.21535441114 }, { "content": " class UnderwaterCurrentROSPlugin : public gazebo::UnderwaterCurrentPlugin\n\n {\n\n /// \\brief Class constructor\n\n public: UnderwaterCurrentROSPlugin();\n\n\n\n /// \\brief Class destructor\n\n public: virtual ~UnderwaterCurrentROSPlugin();\n\n\n\n /// \\brief Load module and read parameters from SDF.\n\n public: void Load(gazebo::physics::WorldPtr _world,\n\n sdf::ElementPtr _sdf);\n\n\n\n /// \\brief Service call to update the parameters for the velocity\n\n /// Gauss-Markov process model\n\n public: void UpdateCurrentVelocityModel(\n\n const uuv_world_ros_plugins_msgs::srv::SetCurrentModel::Request::SharedPtr _req,\n\n uuv_world_ros_plugins_msgs::srv::SetCurrentModel::Response::SharedPtr _res);\n\n\n\n /// \\brief Service call to update the parameters for the horizontal angle\n\n /// Gauss-Markov process model\n", "file_path": "uuv_world_plugins/uuv_world_ros_plugins/include/uuv_world_ros_plugins/UnderwaterCurrentROSPlugin.h", "rank": 69, "score": 163010.5229603382 }, { "content": "\n\n/// \\file BuoyantObject.hh\n\n/// \\brief Description of a buoyant object\n\n\n\n#ifndef __UUV_GAZEBO_PLUGINS_BUOYANT_OBJECT_HH__\n\n#define __UUV_GAZEBO_PLUGINS_BUOYANT_OBJECT_HH__\n\n\n\n#include <string>\n\n#include <map>\n\n\n\n#include <gazebo/gazebo.hh>\n\n#include <gazebo/physics/Link.hh>\n\n#include <gazebo/physics/Collision.hh>\n\n#include <gazebo/physics/Shape.hh>\n\n\n\n#define RESTORING_FORCE \"restoring_force\"\n\n\n\nnamespace gazebo\n\n{\n\n/// \\brief Class describing the dynamics of a buoyant object, useful for simple\n\n/// representations of underwater structures\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/BuoyantObject.h", "rank": 70, "score": 162174.37894061618 }, { "content": " /// \\brief Sets bounding box\n\n public: void SetBoundingBox(const ignition::math::Box &_bBox);\n\n\n\n /// \\brief Adds a field in the hydroWrench map\n\n public: void SetStoreVector(std::string _tag);\n\n\n\n /// \\brief Get vector from the hydroWrench map\n\n public: ignition::math::Vector3d GetStoredVector(std::string _tag);\n\n\n\n /// \\brief Set debug flag to store intermediate forces and torques\n\n public: void SetDebugFlag(bool _debugOn = true);\n\n\n\n /// \\brief Returns true if the robot is completely submerged\n\n public: bool IsSubmerged();\n\n\n\n /// \\brief Returns true if the link was set to be neutrally buoyant\n\n public: bool IsNeutrallyBuoyant();\n\n\n\n /// \\brief Returns the debug flag\n\n public: bool GetDebugFlag();\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/BuoyantObject.h", "rank": 71, "score": 162161.81243149246 }, { "content": "\n\n /// \\brief Sets this link as neutrally buoyant\n\n public: void SetNeutrallyBuoyant();\n\n\n\n /// \\brief Store vector in the hydroWrench map if the field has been created\n\n protected: void StoreVector(std::string _tag, ignition::math::Vector3d _vec);\n\n\n\n /// \\brief Volume of fluid displaced by the submerged object\n\n protected: double volume;\n\n\n\n /// \\brief Scaling factor for the volume\n\n protected: double scalingVolume;\n\n\n\n /// \\brief Offset for the volume\n\n protected: double offsetVolume;\n\n\n\n /// \\brief Fluid density\n\n protected: double fluidDensity;\n\n\n\n /// \\brief Acceleration of gravity\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/BuoyantObject.h", "rank": 72, "score": 162159.58987276116 }, { "content": " public: double GetVolume();\n\n\n\n /// \\brief Sets the fluid density in kg/m^3\n\n public: void SetFluidDensity(double _fluidDensity);\n\n\n\n /// \\brief Returns the stored fluid density\n\n public: double GetFluidDensity();\n\n\n\n /// \\brief Sets the position of the center of buoyancy on the body frame\n\n public: void SetCoB(const ignition::math::Vector3d &_centerOfBuoyancy);\n\n\n\n /// \\brief Returns the stored center of buoyancy\n\n public: ignition::math::Vector3d GetCoB();\n\n\n\n /// \\brief Set acceleration of gravity\n\n public: void SetGravity(double _g);\n\n\n\n /// \\brief Get stored acceleration of gravity\n\n public: double GetGravity();\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/BuoyantObject.h", "rank": 73, "score": 162157.51202924954 }, { "content": " protected: physics::LinkPtr link;\n\n\n\n /// \\brief If true, the restoring force will be equal to the gravitational\n\n // force\n\n protected: bool neutrallyBuoyant;\n\n\n\n // \\brief Metacentric width of the robot, used only for surface vessels and\n\n // floating objects\n\n protected: double metacentricWidth;\n\n\n\n /// \\brief Metacentric length of the robot, used only for surface vessels and\n\n /// floating objects\n\n protected: double metacentricLength;\n\n\n\n /// \\brief If the cross section area around water level of the surface vessel\n\n /// is not given, it will be computed from the object's bounding box\n\n protected: double waterLevelPlaneArea;\n\n\n\n /// \\brief Height of the robot that is submerged (only for surface vessels)\n\n protected: double submergedHeight;\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/BuoyantObject.h", "rank": 74, "score": 162152.58736305241 }, { "content": " protected: double g;\n\n\n\n /// \\brief Center of buoyancy in the body frame\n\n protected: ignition::math::Vector3d centerOfBuoyancy;\n\n\n\n /// \\brief TEMP for calculation of the buoyancy\n\n /// force close to the surface\n\n protected: ignition::math::Box boundingBox;\n\n\n\n /// \\brief Storage for hydrodynamic and hydrostatic forces and torques\n\n /// for debugging purposes\n\n protected: std::map<std::string, ignition::math::Vector3d> hydroWrench;\n\n\n\n /// \\brief Debug flag, storing all intermediate forces and torques\n\n protected: bool debugFlag;\n\n\n\n /// \\brief Is submerged flag\n\n protected: bool isSubmerged;\n\n\n\n /// \\brief Pointer to the correspondent robot link\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/BuoyantObject.h", "rank": 75, "score": 162151.5074362226 }, { "content": "// Copyright (c) 2020 The Plankton Authors.\n\n// All rights reserved.\n\n//\n\n// This source code is derived from UUV Simulator\n\n// (https://github.com/uuvsimulator/uuv_simulator)\n\n// Copyright (c) 2016-2019 The UUV Simulator Authors\n\n// licensed under the Apache license, Version 2.0\n\n// cf. 3rd-party-licenses.txt file in the root directory of this source tree.\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/BuoyantObject.h", "rank": 76, "score": 162151.12649086784 }, { "content": "\n\n /// \\brief Flag set to true if the information about the metacentric width and\n\n /// height is available\n\n protected: bool isSurfaceVessel;\n\n\n\n /// \\brief Flag set to true if the vessel has reached its submerged height\n\n protected: bool isSurfaceVesselFloating;\n\n};\n\n}\n\n\n\n#endif\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/BuoyantObject.h", "rank": 77, "score": 162148.2005125957 }, { "content": "/// \\brief Abstract base class for thruster dynamics.\n\nclass Dynamics\n\n{\n\n /// \\brief Protected constructor: Use the factory for object creation.\n\n protected: Dynamics() { Reset(); }\n\n\n\n /// \\brief Destructor.\n\n public: virtual ~Dynamics() {}\n\n\n\n /// \\brief Return (derived) type of thruster dynamics.\n\n public: virtual std::string GetType() = 0;\n\n\n\n /// \\brief Update the dynamic model.\n\n /// \\param[in] _cmd The commanded value.\n\n /// \\param[in] _t Time stamp of command.\n\n public: virtual double update(double _cmd, double _t) = 0;\n\n\n\n // \\brief Reset state.\n\n public: virtual void Reset();\n\n\n\n /// \\brief Time of last state update.\n\n protected: double prevTime;\n\n\n\n /// \\brief Latest state.\n\n protected: double state;\n\n};\n\n\n\n/// \\brief Function pointer to create a certain thruster dynamics object.\n\ntypedef Dynamics* (*DynamicsCreator)(sdf::ElementPtr);\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/Dynamics.h", "rank": 78, "score": 162148.2005125957 }, { "content": "class UmbilicalSegment\n\n{\n\n public:\n\n UmbilicalSegment() { initSdfSegment(); }\n\n\n\n UmbilicalSegment(const std::string& _name,\n\n const std::string& _fromLink,\n\n const ignition::math::Pose3d& _fromPose,\n\n const ignition::math::Pose3d& _toPose,\n\n physics::ModelPtr _model);\n\n\n\n void initSdfSegment();\n\n\n\n physics::LinkPtr link;\n\n physics::LinkPtr linkA;\n\n physics::JointPtr jointA;\n\n physics::JointPtr jointB;\n\n\n\n std::shared_ptr<UmbilicalSegment> prev, next;\n\n\n\n static sdf::SDFPtr sdfSegment;\n\n};\n\n\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/UmbilicalPlugin.h", "rank": 79, "score": 162019.10142476164 }, { "content": "\n\n/// \\file ThrusterConversionFcn.hh\n\n/// \\brief Description of the conversion function fo a thruster.\n\n\n\n#ifndef __UUV_GAZEBO_PLUGINS_CONVERSION_FUNCTION_HH__\n\n#define __UUV_GAZEBO_PLUGINS_CONVERSION_FUNCTION_HH__\n\n\n\n#include <map>\n\n#include <string>\n\n#include <vector>\n\n\n\n#include <sdf/sdf.hh>\n\n\n\nnamespace gazebo\n\n{\n\n/// \\brief Abstact base class for a thruster conversion function.\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/ThrusterConversionFcn.h", "rank": 80, "score": 160794.151169951 }, { "content": "\n\n#ifndef __UUV_GAZEBO_PLUGINS_ACCELERATIONS_TEST_PLUGIN_H__\n\n#define __UUV_GAZEBO_PLUGINS_ACCELERATIONS_TEST_PLUGIN_H__\n\n\n\n#include <map>\n\n#include <string>\n\n\n\n#include <gazebo/gazebo.hh>\n\n#include <gazebo/msgs/msgs.hh>\n\n\n\n#include <gazebo_ros/node.hpp>\n\n\n\n#include <uuv_gazebo_plugins/HydrodynamicModel.h>\n\n#include <uuv_gazebo_plugins/Def.h>\n\n\n\n#include <rclcpp/rclcpp.hpp>\n\n#include <geometry_msgs/msg/accel.hpp>\n\n\n\n#include <memory>\n\n\n\nnamespace gazebo\n\n{\n\n/// \\brief Gazebo model plugin class for underwater objects\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/AccelerationsTestPlugin.h", "rank": 81, "score": 160789.84524700046 }, { "content": "\n\n#ifndef __THRUSTER_ROS_PLUGIN_HH__\n\n#define __THRUSTER_ROS_PLUGIN_HH__\n\n\n\n#include <map>\n\n#include <string>\n\n#include <vector>\n\n\n\n#include <rclcpp/rclcpp.hpp>\n\n#include <geometry_msgs/msg/wrench_stamped.hpp>\n\n#include <std_msgs/msg/bool.hpp>\n\n#include <std_msgs/msg/float64.hpp>\n\n\n\n#include <gazebo/common/Plugin.hh>\n\n\n\n#include <gazebo_ros/node.hpp>\n\n\n\n#include <uuv_gazebo_plugins/ThrusterPlugin.h>\n\n\n\n#include <uuv_gazebo_ros_plugins_msgs/msg/float_stamped.hpp>\n\n#include <uuv_gazebo_ros_plugins_msgs/srv/set_thruster_state.hpp>\n\n#include <uuv_gazebo_ros_plugins_msgs/srv/get_thruster_state.hpp>\n\n#include <uuv_gazebo_ros_plugins_msgs/srv/set_thruster_efficiency.hpp>\n\n#include <uuv_gazebo_ros_plugins_msgs/srv/get_thruster_efficiency.hpp>\n\n#include <uuv_gazebo_ros_plugins_msgs/srv/get_thruster_conversion_fcn.hpp>\n\n\n\nnamespace uuv_simulator_ros\n\n{\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/ThrusterROSPlugin.h", "rank": 82, "score": 160782.20935490236 }, { "content": "\n\n /// \\brief Return the list of paramaters of the lift and drag model\n\n public: void GetLiftDragParams(\n\n const GetListParam::Request::SharedPtr _req,\n\n GetListParam::Response::SharedPtr _res); \n\n\n\n /// \\brief Return the ROS publish period.\n\n public: gazebo::common::Time GetRosPublishPeriod();\n\n\n\n /// \\brief Set the ROS publish frequency (Hz).\n\n public: void SetRosPublishRate(double _hz);\n\n\n\n /// \\brief Initialize Module.\n\n public: virtual void Init();\n\n\n\n /// \\brief Reset Module.\n\n public: virtual void Reset();\n\n\n\n /// \\brief Pointer to this ROS node's handle.\n\n protected: gazebo_ros::Node::SharedPtr myRosNode;\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/FinROSPlugin.h", "rank": 83, "score": 160782.03553159724 }, { "content": "\n\n#ifndef __FIN_ROS_PLUGIN_HH__\n\n#define __FIN_ROS_PLUGIN_HH__\n\n\n\n#include <uuv_gazebo_plugins/FinPlugin.h>\n\n#include <uuv_gazebo_ros_plugins_msgs/msg/float_stamped.hpp>\n\n#include <uuv_gazebo_ros_plugins_msgs/srv/get_list_param.hpp>\n\n\n\n#include <gazebo/common/Plugin.hh>\n\n\n\n#include <gazebo_ros/node.hpp>\n\n\n\n#include <rclcpp/rclcpp.hpp>\n\n#include <geometry_msgs/msg/wrench_stamped.hpp>\n\n\n\n#include <map>\n\n#include <memory>\n\n\n\nnamespace uuv_simulator_ros\n\n{\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/FinROSPlugin.h", "rank": 84, "score": 160781.48628431265 }, { "content": " protected: virtual void Connect();\n\n\n\n /// \\brief Update event\n\n protected: gazebo::event::ConnectionPtr updateConnection;\n\n\n\n /// \\brief Pointer to the world plugin\n\n protected: gazebo::physics::WorldPtr world;\n\n\n\n /// \\brief Pointer to the model structure\n\n protected: gazebo::physics::ModelPtr model;\n\n\n\n /// \\brief Gazebo node\n\n protected: gazebo::transport::NodePtr node;\n\n\n\n /// \\brief Link of test object\n\n protected: physics::LinkPtr link;\n\n\n\n // ROS things\n\n private: gazebo_ros::Node::SharedPtr myRosNode;\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/AccelerationsTestPlugin.h", "rank": 85, "score": 160781.07319393876 }, { "content": " /// \\brief Get thruster conversion function parameters\n\n public: void GetThrusterConversionFcn(\n\n const uuv_gazebo_ros_plugins_msgs::srv::GetThrusterConversionFcn::Request::SharedPtr _req,\n\n uuv_gazebo_ros_plugins_msgs::srv::GetThrusterConversionFcn::Response::SharedPtr _res);\n\n\n\n /// \\brief Map of thruster services\n\n //TODO Replace with map<string, ServiceBase::SharedPtr>\n\n //private: std::map<std::string, rclcpp::Service:: ::ServiceServer> services;\n\n rclcpp::Service<uuv_gazebo_ros_plugins_msgs::srv::SetThrusterEfficiency>::SharedPtr mySet_thrust_force_efficiencySrv;\n\n rclcpp::Service<uuv_gazebo_ros_plugins_msgs::srv::GetThrusterEfficiency>::SharedPtr myGet_thrust_force_efficiencySrv;\n\n rclcpp::Service<uuv_gazebo_ros_plugins_msgs::srv::SetThrusterEfficiency>::SharedPtr mySet_dynamic_state_efficiencySrv;\n\n rclcpp::Service<uuv_gazebo_ros_plugins_msgs::srv::GetThrusterEfficiency>::SharedPtr myGet_dynamic_state_efficiency;\n\n rclcpp::Service<uuv_gazebo_ros_plugins_msgs::srv::SetThrusterState>::SharedPtr mySet_thruster_state;\n\n rclcpp::Service<uuv_gazebo_ros_plugins_msgs::srv::GetThrusterState>::SharedPtr myGet_thruster_state;\n\n rclcpp::Service<uuv_gazebo_ros_plugins_msgs::srv::GetThrusterConversionFcn>::SharedPtr myGet_thruster_conversion_fcn;\n\n\n\n /// \\brief Pointer to this ROS node's handle.\n\n protected: gazebo_ros::Node::SharedPtr myRosNode;\n\n\n\n /// \\brief Subscriber reacting to new reference thrust set points.\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/ThrusterROSPlugin.h", "rank": 86, "score": 160775.9493560737 }, { "content": "/// \\brief Factory singleton class that creates a ThrusterDynamics from sdf.\n\nclass DynamicsFactory\n\n{\n\n /// \\brief Create ThrusterDynamics object according to its sdf Description.\n\n public: Dynamics* CreateDynamics(sdf::ElementPtr _sdf);\n\n\n\n /// \\brief Returns the singleton instance of this factory.\n\n public: static DynamicsFactory& GetInstance();\n\n\n\n /// \\brief Register a ThrusterDynamic class with its creator.\n\n public: bool RegisterCreator(const std::string& _identifier,\n\n DynamicsCreator _creator);\n\n\n\n /// \\brief Constructor is private since this is a singleton.\n\n private: DynamicsFactory() {}\n\n\n\n /// \\brief Map of each registered identifier to its corresponding creator.\n\n private: std::map<std::string, DynamicsCreator> creators_;\n\n};\n\n\n\n/// Use the following macro within a ThrusterDynamics declaration:\n\n#define REGISTER_DYNAMICS(type) static const bool registeredWithFactory\n\n\n\n/// Use the following macro before a ThrusterDynamics's definition:\n\n#define REGISTER_DYNAMICS_CREATOR(type, creator) \\\n\n const bool type::registeredWithFactory = \\\n\n DynamicsFactory::GetInstance().RegisterCreator( \\\n\n type::IDENTIFIER, creator);\n\n\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/Dynamics.h", "rank": 87, "score": 160775.89838966803 }, { "content": "\n\n /// \\brief Set the ROS publish frequency (Hz).\n\n public: void SetRosPublishRate(double _hz);\n\n\n\n /// \\brief Initialize Module.\n\n public: virtual void Init();\n\n\n\n /// \\brief Reset Module.\n\n public: virtual void Reset();\n\n\n\n /// \\brief Set the thrust efficiency factor\n\n public: void SetThrustForceEfficiency(\n\n const uuv_gazebo_ros_plugins_msgs::srv::SetThrusterEfficiency::Request::SharedPtr _req,\n\n uuv_gazebo_ros_plugins_msgs::srv::SetThrusterEfficiency::Response::SharedPtr _res);\n\n\n\n /// \\brief Get the thrust efficiency factor\n\n public: void GetThrustForceEfficiency(\n\n const uuv_gazebo_ros_plugins_msgs::srv::GetThrusterEfficiency::Request::SharedPtr _req,\n\n uuv_gazebo_ros_plugins_msgs::srv::GetThrusterEfficiency::Response::SharedPtr _res);\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/ThrusterROSPlugin.h", "rank": 88, "score": 160775.24453336725 }, { "content": " /// \\brief The unique identifier of this conversion function.\n\n private: static const std::string IDENTIFIER;\n\n\n\n /// \\brief Constructor.\n\n private: ConversionFunctionLinearInterp(const std::vector<double> &_input,\n\n const std::vector<double> &_output);\n\n\n\n /// \\brief Lookup table maps input values -> output values.\n\n private: std::map<double, double> lookupTable;\n\n};\n\n}\n\n\n\n#endif\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/ThrusterConversionFcn.h", "rank": 89, "score": 160774.7862438726 }, { "content": "// Copyright (c) 2020 The Plankton Authors.\n\n// All rights reserved.\n\n//\n\n// This source code is derived from UUV Simulator\n\n// (https://github.com/uuvsimulator/uuv_simulator)\n\n// Copyright (c) 2016-2019 The UUV Simulator Authors\n\n// licensed under the Apache license, Version 2.0\n\n// cf. 3rd-party-licenses.txt file in the root directory of this source tree.\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/ThrusterConversionFcn.h", "rank": 90, "score": 160773.84567984412 }, { "content": " /// \\brief Set the dynamic state efficiency factor\n\n public: void SetDynamicStateEfficiency(\n\n const uuv_gazebo_ros_plugins_msgs::srv::SetThrusterEfficiency::Request::SharedPtr _req,\n\n uuv_gazebo_ros_plugins_msgs::srv::SetThrusterEfficiency::Response::SharedPtr _res);\n\n\n\n /// \\brief Get the dynamic state efficiency factor\n\n public: void GetDynamicStateEfficiency(\n\n const uuv_gazebo_ros_plugins_msgs::srv::GetThrusterEfficiency::Request::SharedPtr _req,\n\n uuv_gazebo_ros_plugins_msgs::srv::GetThrusterEfficiency::Response::SharedPtr _res);\n\n\n\n /// \\brief Turn thruster on/off\n\n public: void SetThrusterState(\n\n const uuv_gazebo_ros_plugins_msgs::srv::SetThrusterState::Request::SharedPtr _req,\n\n uuv_gazebo_ros_plugins_msgs::srv::SetThrusterState::Response::SharedPtr _res);\n\n\n\n /// \\brief Get thruster state\n\n public: void GetThrusterState(\n\n const uuv_gazebo_ros_plugins_msgs::srv::GetThrusterState::Request::SharedPtr _req,\n\n uuv_gazebo_ros_plugins_msgs::srv::GetThrusterState::Response::SharedPtr _res);\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/ThrusterROSPlugin.h", "rank": 91, "score": 160772.70784540157 }, { "content": " /// \\brief Constructor.\n\n private: ConversionFunctionBessa(double _rotorConstantL,\n\n double _rotorConstantR,\n\n double _deltaL, double _deltaR);\n\n\n\n /// \\brief Rotor constant for omega < 0.\n\n private: double rotorConstantL;\n\n\n\n /// \\brief Rotor constant for omega > 0.\n\n private: double rotorConstantR;\n\n\n\n /// \\brief Dead-zone for omega < 0.\n\n private: double deltaL;\n\n\n\n /// \\brief Dead-zone for omega > 0.\n\n private: double deltaR;\n\n};\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_plugins/include/uuv_gazebo_plugins/ThrusterConversionFcn.h", "rank": 92, "score": 160770.91970157198 }, { "content": "\n\n /// \\brief Subscriber reacting to new reference set points.\n\n private: rclcpp::Subscription<uuv_gazebo_ros_plugins_msgs::msg::FloatStamped>::SharedPtr mySubReference;\n\n\n\n /// \\brief Publisher for current state.\n\n private: rclcpp::Publisher<uuv_gazebo_ros_plugins_msgs::msg::FloatStamped>::SharedPtr myPubState;\n\n\n\n /// \\brief Publisher for current actual thrust.\n\n private: rclcpp::Publisher<geometry_msgs::msg::WrenchStamped>::SharedPtr myPubFinForce;\n\n\n\n /// \\brief Connection for callbacks on update world.\n\n private: gazebo::event::ConnectionPtr rosPublishConnection;\n\n\n\n /// \\brief Period after which we should publish a message via ROS.\n\n private: gazebo::common::Time rosPublishPeriod;\n\n\n\n /// \\brief Map of services\n\n private: std::map<std::string, \n\n rclcpp::Service<uuv_gazebo_ros_plugins_msgs::srv::GetListParam>::SharedPtr> myServicesById;\n\n\n\n /// \\brief Last time we published a message via ROS.\n\n private: gazebo::common::Time lastRosPublishTime;\n\n };\n\n}\n\n\n\n#endif\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/FinROSPlugin.h", "rank": 93, "score": 160769.37926608554 }, { "content": " /// \\brief Period after which we should publish a message via ROS.\n\n private: gazebo::common::Time rosPublishPeriod;\n\n\n\n /// \\brief Last time we published a message via ROS.\n\n private: gazebo::common::Time lastRosPublishTime;\n\n };\n\n}\n\n\n\n#endif // __THRUSTER_ROS_PLUGIN_HH__\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/ThrusterROSPlugin.h", "rank": 94, "score": 160766.55286658258 }, { "content": " protected: rclcpp::Publisher<geometry_msgs::msg::Accel>::SharedPtr myPub_accel_b_gazebo;\n\n protected: rclcpp::Publisher<geometry_msgs::msg::Accel>::SharedPtr myPub_accel_b_numeric;\n\n\n\n protected: rclcpp::Publisher<geometry_msgs::msg::Accel>::SharedPtr myPub_accel_w_gazebo;\n\n protected: rclcpp::Publisher<geometry_msgs::msg::Accel>::SharedPtr myPub_accel_w_numeric;\n\n\n\n /// \\brief Velocity of link with respect to world frame in previous time step.\n\n Eigen::Vector6d last_w_v_w_b;\n\n\n\n /// \\brief Time stamp of previous time step.\n\n common::Time lastTime;\n\n};\n\n}\n\n\n\n#endif // __UUV_GAZEBO_PLUGINS_ACCELERATIONS_TEST_PLUGIN_H__\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/AccelerationsTestPlugin.h", "rank": 95, "score": 160766.45404709195 }, { "content": " private: rclcpp::Subscription<uuv_gazebo_ros_plugins_msgs::msg::FloatStamped>::SharedPtr mySubThrustReference;\n\n\n\n /// \\brief Publisher for current actual thrust.\n\n private: rclcpp::Publisher<uuv_gazebo_ros_plugins_msgs::msg::FloatStamped>::SharedPtr myPubThrust;\n\n\n\n /// \\brief Publisher for current actual thrust as wrench.\n\n private: rclcpp::Publisher<geometry_msgs::msg::WrenchStamped>::SharedPtr myPubThrustWrench;\n\n\n\n /// \\brief Publisher for the thruster state\n\n private: rclcpp::Publisher<std_msgs::msg::Bool>::SharedPtr myPubThrusterState;\n\n\n\n /// \\brief Publisher for the thrust force efficiency\n\n private: rclcpp::Publisher<std_msgs::msg::Float64>::SharedPtr myPubThrustForceEff;\n\n\n\n /// \\brief Publisher for the dynamic state efficiency\n\n private: rclcpp::Publisher<std_msgs::msg::Float64>::SharedPtr myPubDynamicStateEff;\n\n\n\n /// \\brief Connection for callbacks on update world.\n\n private: gazebo::event::ConnectionPtr rosPublishConnection;\n\n\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/ThrusterROSPlugin.h", "rank": 96, "score": 160765.34936376638 }, { "content": "// Copyright (c) 2020 The Plankton Authors.\n\n// All rights reserved.\n\n//\n\n// This source code is derived from UUV Simulator\n\n// (https://github.com/uuvsimulator/uuv_simulator)\n\n// Copyright (c) 2016-2019 The UUV Simulator Authors\n\n// licensed under the Apache license, Version 2.0\n\n// cf. 3rd-party-licenses.txt file in the root directory of this source tree.\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/ThrusterROSPlugin.h", "rank": 97, "score": 160760.42739854258 }, { "content": "// Copyright (c) 2020 The Plankton Authors.\n\n// All rights reserved.\n\n//\n\n// This source code is derived from UUV Simulator\n\n// (https://github.com/uuvsimulator/uuv_simulator)\n\n// Copyright (c) 2016-2019 The UUV Simulator Authors\n\n// licensed under the Apache license, Version 2.0\n\n// cf. 3rd-party-licenses.txt file in the root directory of this source tree.\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/AccelerationsTestPlugin.h", "rank": 98, "score": 160760.42739854258 }, { "content": "// Copyright (c) 2020 The Plankton Authors.\n\n// All rights reserved.\n\n//\n\n// This source code is derived from UUV Simulator\n\n// (https://github.com/uuvsimulator/uuv_simulator)\n\n// Copyright (c) 2016-2019 The UUV Simulator Authors\n\n// licensed under the Apache license, Version 2.0\n\n// cf. 3rd-party-licenses.txt file in the root directory of this source tree.\n\n//\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n\n// you may not use this file except in compliance with the License.\n\n// You may obtain a copy of the License at\n\n//\n\n// http://www.apache.org/licenses/LICENSE-2.0\n\n//\n\n// Unless required by applicable law or agreed to in writing, software\n\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n// See the License for the specific language governing permissions and\n\n// limitations under the License.\n", "file_path": "uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/FinROSPlugin.h", "rank": 99, "score": 160760.42739854258 } ]
C++
src/publishers/EnviroDIYPublisher.cpp
ssuttles-usgs/ModularSensors
8bc62eb7705729e47e4a47a6b2f02dab955b63f8
#include "EnviroDIYPublisher.h" const char *EnviroDIYPublisher::postEndpoint = "/api/data-stream/"; const char *EnviroDIYPublisher::enviroDIYHost = "data.envirodiy.org"; const int EnviroDIYPublisher::enviroDIYPort = 80; const char *EnviroDIYPublisher::tokenHeader = "\r\nTOKEN: "; const char *EnviroDIYPublisher::contentLengthHeader = "\r\nContent-Length: "; const char *EnviroDIYPublisher::contentTypeHeader = "\r\nContent-Type: application/json\r\n\r\n"; const char *EnviroDIYPublisher::samplingFeatureTag = "{\"sampling_feature\":\""; const char *EnviroDIYPublisher::timestampTag = "\",\"timestamp\":\""; EnviroDIYPublisher::EnviroDIYPublisher() : dataPublisher() { } EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, uint8_t sendEveryX, uint8_t sendOffset) : dataPublisher(baseLogger, sendEveryX, sendOffset) { } EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, Client *inClient, uint8_t sendEveryX, uint8_t sendOffset) : dataPublisher(baseLogger, inClient, sendEveryX, sendOffset) { } EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, const char *registrationToken, const char *samplingFeatureUUID, uint8_t sendEveryX, uint8_t sendOffset) : dataPublisher(baseLogger, sendEveryX, sendOffset) { setToken(registrationToken); _baseLogger->setSamplingFeatureUUID(samplingFeatureUUID); } EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, Client *inClient, const char *registrationToken, const char *samplingFeatureUUID, uint8_t sendEveryX, uint8_t sendOffset) : dataPublisher(baseLogger, inClient, sendEveryX, sendOffset) { setToken(registrationToken); _baseLogger->setSamplingFeatureUUID(samplingFeatureUUID); } EnviroDIYPublisher::~EnviroDIYPublisher(){} void EnviroDIYPublisher::setToken(const char *registrationToken) { _registrationToken = registrationToken; } uint16_t EnviroDIYPublisher::calculateJsonSize() { uint16_t jsonLength = 21; jsonLength += 36; jsonLength += 15; jsonLength += 25; jsonLength += 2; for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++) { jsonLength += 1; jsonLength += 36; jsonLength += 2; jsonLength += _baseLogger->getValueStringAtI(i).length(); if (i + 1 != _baseLogger->getArrayVarCount()) { jsonLength += 1; } } jsonLength += 1; return jsonLength; } void EnviroDIYPublisher::printSensorDataJSON(Stream *stream) { stream->print(samplingFeatureTag); stream->print(_baseLogger->getSamplingFeatureUUID()); stream->print(timestampTag); stream->print(_baseLogger->formatDateTime_ISO8601(Logger::markedEpochTime)); stream->print(F("\",")); for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++) { stream->print('"'); stream->print(_baseLogger->getVarUUIDAtI(i)); stream->print(F("\":")); stream->print(_baseLogger->getValueStringAtI(i)); if (i + 1 != _baseLogger->getArrayVarCount()) { stream->print(','); } } stream->print('}'); } void EnviroDIYPublisher::printEnviroDIYRequest(Stream *stream) { stream->print(postHeader); stream->print(postEndpoint); stream->print(HTTPtag); stream->print(hostHeader); stream->print(enviroDIYHost); stream->print(tokenHeader); stream->print(_registrationToken); stream->print(contentLengthHeader); stream->print(calculateJsonSize()); stream->print(contentTypeHeader); printSensorDataJSON(stream); } void EnviroDIYPublisher::begin(Logger& baseLogger, Client *inClient, const char *registrationToken, const char *samplingFeatureUUID) { setToken(registrationToken); dataPublisher::begin(baseLogger, inClient); _baseLogger->setSamplingFeatureUUID(samplingFeatureUUID); } void EnviroDIYPublisher::begin(Logger& baseLogger, const char *registrationToken, const char *samplingFeatureUUID) { setToken(registrationToken); dataPublisher::begin(baseLogger); _baseLogger->setSamplingFeatureUUID(samplingFeatureUUID); } int16_t EnviroDIYPublisher::publishData(Client *_outClient) { char tempBuffer[37] = ""; uint16_t did_respond = 0; MS_DBG(F("Outgoing JSON size:"), calculateJsonSize()); MS_DBG(F("Connecting client")); MS_START_DEBUG_TIMER; if (_outClient->connect(enviroDIYHost, enviroDIYPort)) { MS_DBG(F("Client connected after"), MS_PRINT_DEBUG_TIMER, F("ms\n")); strcpy(txBuffer, postHeader); strcat(txBuffer, postEndpoint); strcat(txBuffer, HTTPtag); if (bufferFree() < 28) printTxBuffer(_outClient); strcat(txBuffer, hostHeader); strcat(txBuffer, enviroDIYHost); if (bufferFree() < 47) printTxBuffer(_outClient); strcat(txBuffer, tokenHeader); strcat(txBuffer, _registrationToken); if (bufferFree() < 26) printTxBuffer(_outClient); strcat(txBuffer, contentLengthHeader); itoa(calculateJsonSize(), tempBuffer, 10); strcat(txBuffer, tempBuffer); if (bufferFree() < 42) printTxBuffer(_outClient); strcat(txBuffer, contentTypeHeader); if (bufferFree() < 21) printTxBuffer(_outClient); strcat(txBuffer, samplingFeatureTag); if (bufferFree() < 36) printTxBuffer(_outClient); strcat(txBuffer, _baseLogger->getSamplingFeatureUUID()); if (bufferFree() < 42) printTxBuffer(_outClient); strcat(txBuffer, timestampTag); _baseLogger->formatDateTime_ISO8601(Logger::markedEpochTime).toCharArray(tempBuffer, 37); strcat(txBuffer, tempBuffer); txBuffer[strlen(txBuffer)] = '"'; txBuffer[strlen(txBuffer)] = ','; for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++) { if (bufferFree() < 47) printTxBuffer(_outClient); txBuffer[strlen(txBuffer)] = '"'; _baseLogger->getVarUUIDAtI(i).toCharArray(tempBuffer, 37); strcat(txBuffer, tempBuffer); txBuffer[strlen(txBuffer)] = '"'; txBuffer[strlen(txBuffer)] = ':'; _baseLogger->getValueStringAtI(i).toCharArray(tempBuffer, 37); strcat(txBuffer, tempBuffer); if (i + 1 != _baseLogger->getArrayVarCount()) { txBuffer[strlen(txBuffer)] = ','; } else { txBuffer[strlen(txBuffer)] = '}'; } } printTxBuffer(_outClient, true); uint32_t start = millis(); while ((millis() - start) < 10000L && _outClient->available() < 12) {delay(10);} did_respond = _outClient->readBytes(tempBuffer, 12); MS_DBG(F("Stopping client")); MS_RESET_DEBUG_TIMER; _outClient->stop(); MS_DBG(F("Client stopped after"), MS_PRINT_DEBUG_TIMER, F("ms")); } else { PRINTOUT(F("\n -- Unable to Establish Connection to EnviroDIY Data Portal --")); } int16_t responseCode = 0; if (did_respond > 0) { char responseCode_char[4]; for (uint8_t i = 0; i < 3; i++) { responseCode_char[i] = tempBuffer[i+9]; } responseCode = atoi(responseCode_char); } else { responseCode=504; } PRINTOUT(F("-- Response Code --")); PRINTOUT(responseCode); return responseCode; }
#include "EnviroDIYPublisher.h" const char *EnviroDIYPublisher::postEndpoint = "/api/data-stream/"; const char *EnviroDIYPublisher::enviroDIYHost = "data.envirodiy.org"; const int EnviroDIYPublisher::enviroDIYPort = 80; const char *EnviroDIYPublisher::tokenHeader = "\r\nTOKEN: "; const char *EnviroDIYPublisher::contentLengthHeader = "\r\nContent-Length: "; const char *EnviroDIYPublisher::contentTypeHeader = "\r\nContent-Type: application/json\r\n\r\n"; const char *EnviroDIYPublisher::samplingFeatureTag = "{\"sampling_feature\":\""; const char *EnviroDIYPublisher::timestampTag = "\",\"timestamp\":\""; EnviroDIYPublisher::EnviroDIYPublisher() : dataPublisher() { } EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, uint8_t sendEveryX, uint8_t sendOffset) : dataPublisher(baseLogger, sendEveryX, sendOffset) { } EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, Client *inClient, uint8_t sendEveryX, uint8_t sendOffset) : dataPublisher(baseLogger, inClient, sendEveryX, sendOffset) { } EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, const char *registrationToken, const char *samplingFeatureUUID, uint8_t sendEveryX, uint8_t sendOffset) : dataPublisher(baseLogger, sendEveryX, sendOffset) { setToken(registrationToken); _baseLogger->setSamplingFeatureUUID(samplingFeatureUUID); } EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, Client *inClient, const char *registrationToken, const char *samplingFeatureUUID, uint8_t sendEveryX, uint8_t sendOffset) : dataPublisher(baseLogger, inClient, sendEveryX, sendOffset) { setToken(registrationToken); _baseLogger->setSamplingFeatureUUID(samplingFeatureUUID); } EnviroDIYPublisher::~EnviroDIYPublisher(){} void EnviroDIYPublisher::setToken(const char *registrationToken) { _registrationToken = registrationToken; } uint16_t EnviroDIYPublisher::calculateJsonSize() { uint16_t jsonLength = 21; jsonLength += 36; jsonLength += 15; jsonLength += 25; jsonLength += 2; for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++) { jsonLength += 1; jsonLength += 36; jsonLength += 2; jsonLength += _baseLogger->getValueStringAtI(i).length(); if (i + 1 != _baseLogger->getArrayVarCount()) { jsonLength += 1; } } jsonLength += 1; return jsonLength; } void EnviroDIYPublisher::printSensorDataJSON(Stream *stream) { stream->print(samplingFeatureTag); stream->print(_baseLogger->getSamplingFeatureUUID()); stream->print(timestampTag); stream->print(_baseLogger->formatDateTime_ISO8601(Logger::markedEpochTime)); stream->print(F("\",")); for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++) { stream->print('"'); stream->print(_baseLogger->getVarUUIDAtI(i)); stream->print(F("\":")); stream->print(_baseLogger->getValueStringAtI(i)); if (i + 1 != _baseLogger->getArrayVarCount()) { stream->print(','); } } stream->print('}'); } void EnviroDIYPublisher::printEnviroDIYRequest(Stream *stream) { stream->print(postHeader); stream->print(postEndpoint); stream->print(HTTPtag); stream->print(hostHeader); stream->print(enviroDIYHost); stream->print(tokenHeader); stream->print(_registrationToken); stream->print(contentLengthHeader); stream->print(calculateJsonSize()); stream->print(contentTypeHeader); printSensorDataJSON(stream); } void EnviroDIYPublisher::begin(Logger& baseLogger, Client *inClient, const char *registrationToken, const char *samplingFeatureUUID) { setToken(registrationToken); dataPublisher::begin(baseLogger, inClient); _baseLogger->setSamplingFeatureUUID(samplingFeatureUUID); } void EnviroDIYPublisher::begin(Logger& baseLogger, const char *registrationToken, const char *samplingFeatureUUID) { setToken(registrationToken); dataPublisher::begin(baseLogger); _baseLogger->setSamplingFeatureUUID(samplingFeatureUUID); } int16_t EnviroDIYPublisher::publishData(Client *_outClient) { char tempBuffer[37] = ""; uint16_t did_respond = 0; MS_DBG(F("Outgoing JSON size:"), calculateJsonSize()); MS_DBG(F("Connecting client")); MS_START_DEBUG_TIMER; if (_outClient->connect(enviroDIYHost, enviroDIYPort)) { MS_DBG(F("Client connected after"), MS_PRINT_DEBUG_TIMER, F("ms\n")); strcpy(txBuffer, postHeader); strcat(txBuffer, postEndpoint); strcat(txBuffer, HTTPtag); if (bufferFree() < 28) printTxBuffer(_outClient); strcat(txBuffer, hostHeader); strcat(txBuffer, enviroDIYHost); if (bufferFree() < 47) printTxBuffer(_outClient); strcat(txBuffer, tokenHeader); strcat(txBuffer, _registrationToken); if (bufferFree() < 26) printTxBuffer(_outClient); strcat(txBuffer, contentLengthHeader); itoa(calculateJsonSize(), tempBuffer, 10); strcat(txBuffer, tempBuffer); if (bufferFree() < 42) printTxBuffer(_outClient); strcat(txBuffer, contentTypeHeader); if (bufferFree() < 21) printTxBuffer(_outClient); strcat(txBuffer, samplingFeatureTag); if (bufferFree() < 36) printTxBuffer(_outClient); strcat(txBuffer, _baseLogger->getSamplingFeatureUUID()); if (bufferFree() < 42) printTxBuffer(_outClient); strcat(txBuffer, timestampTag); _baseLogger->formatDateTime_ISO8601(Logger::markedEpochTime).toCharArray(tempBuffer, 37); strcat(txBuffer, tempBuffer); txBuffer[strlen(txBuffer)] = '"'; txBuffer[strlen(txBuffer)] = ','; for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++) { if (bufferFree() < 47) printTxBuffer(_outClient); txBuffer[strlen(txBuffer)] = '"'; _baseLogger->getVarUUIDAtI(i).toCharArray(tempBuffer, 37); strcat(txBuffer, tempBuffer);
- Response Code --")); PRINTOUT(responseCode); return responseCode; }
txBuffer[strlen(txBuffer)] = '"'; txBuffer[strlen(txBuffer)] = ':'; _baseLogger->getValueStringAtI(i).toCharArray(tempBuffer, 37); strcat(txBuffer, tempBuffer); if (i + 1 != _baseLogger->getArrayVarCount()) { txBuffer[strlen(txBuffer)] = ','; } else { txBuffer[strlen(txBuffer)] = '}'; } } printTxBuffer(_outClient, true); uint32_t start = millis(); while ((millis() - start) < 10000L && _outClient->available() < 12) {delay(10);} did_respond = _outClient->readBytes(tempBuffer, 12); MS_DBG(F("Stopping client")); MS_RESET_DEBUG_TIMER; _outClient->stop(); MS_DBG(F("Client stopped after"), MS_PRINT_DEBUG_TIMER, F("ms")); } else { PRINTOUT(F("\n -- Unable to Establish Connection to EnviroDIY Data Portal --")); } int16_t responseCode = 0; if (did_respond > 0) { char responseCode_char[4]; for (uint8_t i = 0; i < 3; i++) { responseCode_char[i] = tempBuffer[i+9]; } responseCode = atoi(responseCode_char); } else { responseCode=504; } PRINTOUT(F("-
random
[ { "content": " // Returns the data destination\n\n virtual String getEndpoint(void){return String(enviroDIYHost);}\n\n\n\n // Adds the site registration token\n\n void setToken(const char *registrationToken);\n\n\n\n // Calculates how long the JSON will be\n\n uint16_t calculateJsonSize();\n\n // Calculates how long the full post request will be, including headers\n\n // uint16_t calculatePostSize();\n\n\n\n // This generates a properly formatted JSON for EnviroDIY\n\n void printSensorDataJSON(Stream *stream);\n\n\n\n // This prints a fully structured post request for WikiWatershed/EnviroDIY\n\n // to the specified stream.\n\n void printEnviroDIYRequest(Stream *stream);\n\n\n\n // A way to begin with everything already set\n\n void begin(Logger& baseLogger, Client *inClient,\n", "file_path": "src/publishers/EnviroDIYPublisher.h", "rank": 0, "score": 32.17999685936584 }, { "content": " const char *registrationToken,\n\n const char *samplingFeatureUUID);\n\n void begin(Logger& baseLogger,\n\n const char *registrationToken,\n\n const char *samplingFeatureUUID);\n\n\n\n // This utilizes an attached modem to make a TCP connection to the\n\n // EnviroDIY/ODM2DataSharingPortal and then streams out a post request\n\n // over that connection.\n\n // The return is the http status code of the response.\n\n // int16_t postDataEnviroDIY(void);\n\n virtual int16_t publishData(Client *_outClient);\n\n\n\nprotected:\n\n\n\n // portions of the POST request\n\n static const char *postEndpoint;\n\n static const char *enviroDIYHost;\n\n static const int enviroDIYPort;\n\n static const char *tokenHeader;\n", "file_path": "src/publishers/EnviroDIYPublisher.h", "rank": 2, "score": 24.53143885601537 }, { "content": " // over that connection.\n\n // The return is the http status code of the response.\n\n // int16_t postDataDreamHost(void);\n\n int16_t publishData(Client *_outClient);\n\n\n\nprotected:\n\n // portions of the GET request\n\n static const char *dreamhostHost;\n\n static const int dreamhostPort;\n\n static const char *loggerTag;\n\n static const char *timestampTagDH;\n\n\n\n\n\nprivate:\n\n const char *_DreamHostPortalRX;\n\n bool _dualPost = true;\n\n};\n\n\n\n#endif // Header Guard\n", "file_path": "src/publishers/DreamHostPublisher.h", "rank": 3, "score": 24.460661049608365 }, { "content": " virtual String getEndpoint(void){return String(dreamhostHost);}\n\n\n\n // Functions for private SWRC server\n\n void setDreamHostPortalRX(const char *dhUrl);\n\n\n\n // This creates all of the URL parameters\n\n void printSensorDataDreamHost(Stream *stream);\n\n\n\n // This prints a fully structured GET request for DreamHost to the\n\n // specified stream.\n\n void printDreamHostRequest(Stream *stream);\n\n\n\n // A way to begin with everything already set\n\n void begin(Logger& baseLogger, Client *inClient,\n\n const char *dhUrl);\n\n void begin(Logger& baseLogger,\n\n const char *dhUrl);\n\n\n\n // This utilizes an attached modem to make a TCP connection to the\n\n // DreamHost URL and then streams out a get request\n", "file_path": "src/publishers/DreamHostPublisher.h", "rank": 4, "score": 22.599926395645127 }, { "content": " virtual int16_t publishData(Client *_outClient) = 0;\n\n virtual int16_t publishData();\n\n // These are duplicates of the above functions for backwards compatibility\n\n virtual int16_t sendData(Client *_outClient);\n\n virtual int16_t sendData();\n\n\n\n // This spits out a string description of the PubSubClient codes\n\n String parseMQTTState(int state);\n\n\n\n\n\nprotected:\n\n // The internal logger instance\n\n Logger *_baseLogger;\n\n // The internal client\n\n Client *_inClient;\n\n\n\n static char txBuffer[MS_SEND_BUFFER_SIZE];\n\n // This returns the number of empty spots in the buffer\n\n static int bufferFree(void);\n\n // This fills the TX buffer with nulls ('\\0')\n", "file_path": "src/dataPublisherBase.h", "rank": 7, "score": 19.57542693015288 }, { "content": "\n\n\n\n// Empties the outgoing buffer\n\nvoid dataPublisher::emptyTxBuffer(void)\n\n{\n\n MS_DBG(F(\"Dumping the TX Buffer\"));\n\n for (int i = 0; i < MS_SEND_BUFFER_SIZE; i++)\n\n {\n\n txBuffer[i] = '\\0';\n\n }\n\n}\n\n\n\n\n\n// Returns how much space is left in the buffer\n\nint dataPublisher::bufferFree(void)\n\n{\n\n MS_DBG(F(\"Current TX Buffer Size:\"), strlen(txBuffer));\n\n return MS_SEND_BUFFER_SIZE - strlen(txBuffer);\n\n}\n\n\n", "file_path": "src/dataPublisherBase.cpp", "rank": 9, "score": 18.39006492527985 }, { "content": " stream->print(dreamhostHost);\n\n stream->print(F(\"\\r\\n\\r\\n\"));\n\n}\n\n\n\n\n\n// A way to begin with everything already set\n\nvoid DreamHostPublisher::begin(Logger& baseLogger, Client *inClient,\n\n const char *dhUrl)\n\n{\n\n setDreamHostPortalRX(dhUrl);\n\n dataPublisher::begin(baseLogger, inClient);\n\n}\n\nvoid DreamHostPublisher::begin(Logger& baseLogger,\n\n const char *dhUrl)\n\n{\n\n setDreamHostPortalRX(dhUrl);\n\n dataPublisher::begin(baseLogger);\n\n}\n\n\n\n\n", "file_path": "src/publishers/DreamHostPublisher.cpp", "rank": 10, "score": 18.062825779343115 }, { "content": " const char *thingSpeakMQTTKey,\n\n const char *thingSpeakChannelID,\n\n const char *thingSpeakChannelKey);\n\n void begin(Logger& baseLogger,\n\n const char *thingSpeakMQTTKey,\n\n const char *thingSpeakChannelID,\n\n const char *thingSpeakChannelKey);\n\n\n\n // This sends the data to ThingSpeak\n\n // bool mqttThingSpeak(void);\n\n virtual int16_t publishData(Client *_outClient);\n\n\n\nprotected:\n\n static const char *mqttServer;\n\n static const int mqttPort;\n\n static const char *mqttClient;\n\n static const char *mqttUser;\n\n\n\nprivate:\n\n // Keys for ThingSpeak\n\n const char *_thingSpeakMQTTKey;\n\n const char *_thingSpeakChannelID;\n\n const char *_thingSpeakChannelKey;\n\n PubSubClient _mqttClient;\n\n};\n\n\n\n#endif // Header Guard\n", "file_path": "src/publishers/ThingSpeakPublisher.h", "rank": 12, "score": 17.868425081164503 }, { "content": " virtual ~ThingSpeakPublisher();\n\n\n\n // Returns the data destination\n\n virtual String getEndpoint(void){return String(mqttServer);}\n\n\n\n // Adds the MQTT API Key from Account > MyProfile\n\n void setMQTTKey(const char *thingSpeakMQTTKey);\n\n\n\n // Adds the channel ID\n\n void setChannelID(const char *thingSpeakChannelID);\n\n\n\n // Adds the channel Write API Key.\n\n void setChannelKey(const char *thingSpeakChannelKey);\n\n\n\n // Sets all 3 ThingSpeak parameters\n\n void setThingSpeakParams(const char *MQTTKey, const char *channelID,\n\n const char *channelKey);\n\n\n\n // A way to begin with everything already set\n\n void begin(Logger& baseLogger, Client *inClient,\n", "file_path": "src/publishers/ThingSpeakPublisher.h", "rank": 13, "score": 17.67449302038462 }, { "content": " // static const char *cacheHeader;\n\n // static const char *connectionHeader;\n\n static const char *contentLengthHeader;\n\n static const char *contentTypeHeader;\n\n\n\n // portions of the JSON\n\n static const char *samplingFeatureTag;\n\n static const char *timestampTag;\n\n\n\nprivate:\n\n // Tokens and UUID's for EnviroDIY\n\n const char *_registrationToken;\n\n};\n\n\n\n#endif // Header Guard\n", "file_path": "src/publishers/EnviroDIYPublisher.h", "rank": 14, "score": 17.592894556741083 }, { "content": " uint32_t getNISTTime(void) override;\n\n\n\n #ifdef MS_DIGIXBEE3GBYPASS_DEBUG_DEEP\n\n StreamDebugger _modemATDebugger;\n\n #endif\n\n\n\n TinyGsm gsmModem;\n\n TinyGsmClient gsmClient;\n\n\n\nprotected:\n\n bool didATRespond(void) override;\n\n bool isInternetAvailable(void) override;\n\n bool verifyMeasurementComplete(bool debug=false) override;\n\n bool extraModemSetup(void) override;\n\n\n\nprivate:\n\n const char *_apn;\n\n\n\n};\n\n\n\n#endif // Header Guard\n", "file_path": "src/modems/DigiXBee3GBypass.h", "rank": 15, "score": 16.854918042446645 }, { "content": " uint32_t getNISTTime(void) override;\n\n\n\n #ifdef MS_DIGIXBEELTEBYPASS_DEBUG_DEEP\n\n StreamDebugger _modemATDebugger;\n\n #endif\n\n\n\n TinyGsm gsmModem;\n\n TinyGsmClient gsmClient;\n\n\n\nprotected:\n\n bool didATRespond(void) override;\n\n bool isInternetAvailable(void) override;\n\n bool verifyMeasurementComplete(bool debug=false) override;\n\n bool extraModemSetup(void) override;\n\n\n\nprivate:\n\n const char *_apn;\n\n\n\n};\n\n\n\n#endif // Header Guard\n", "file_path": "src/modems/DigiXBeeLTEBypass.h", "rank": 16, "score": 16.85491804244665 }, { "content": " {\n\n MS_DBG(F(\"Response Byte\"), i, ':', (char)nistBytes[i],\n\n '=', nistBytes[i], '=', String(nistBytes[i], BIN));\n\n secFrom1900 += 0x000000FF & nistBytes[i];\n\n /* MS_DBG(F(\"\\nseconds from 1900 after byte:\"),String(secFrom1900, BIN)); */\n\n if (i + 1 < 4)\n\n {\n\n secFrom1900 = secFrom1900 << 8;\n\n }\n\n }\n\n MS_DBG(F(\"Seconds from Jan 1, 1900 returned by NIST (UTC):\"),\n\n secFrom1900, '=', String(secFrom1900, BIN));\n\n\n\n /* Close the TCP connection, just in case */\n\n /* Don't close connection! It takes too long and then the time stamp is out of date! */\n\n /*gsmClient.stop(15000L);*/\n\n\n\n /* Return the timestamp */\n\n uint32_t unixTimeStamp = secFrom1900 - 2208988800;\n\n MS_DBG(F(\"Unix Timestamp returned by NIST (UTC):\"), unixTimeStamp);\n", "file_path": "src/LoggerModem.cpp", "rank": 17, "score": 16.764558089948963 }, { "content": " bool getModemBatteryStats(uint8_t &chargeState, int8_t &percent, uint16_t &milliVolts) override;\n\n float getModemTemperature(void) override;\n\n\n\n uint32_t getNISTTime(void) override;\n\n\n\n #ifdef MS_DIGIXBEEWIFI_DEBUG_DEEP\n\n StreamDebugger _modemATDebugger;\n\n #endif\n\n\n\n TinyGsm gsmModem;\n\n TinyGsmClient gsmClient;\n\n\n\nprotected:\n\n bool didATRespond(void) override;\n\n bool isInternetAvailable(void) override;\n\n bool verifyMeasurementComplete(bool debug=false) override;\n\n bool extraModemSetup(void) override;\n\n\n\nprivate:\n\n const char *_ssid;\n\n const char *_pwd;\n\n\n\n};\n\n\n\n#endif // Header Guard\n", "file_path": "src/modems/DigiXBeeWifi.h", "rank": 18, "score": 16.698117003001045 }, { "content": "// Send Buffer\n\n// This determines how many characters to set out at once over the TCP/UDP\n\n// connection. Increasing this may decrease data use by a loger, while\n\n// decreasing it will save memory. Do not make it smaller than 47 (to keep all\n\n// variable values with their UUID's) or bigger than 1500 (a typical TCP/UDP\n\n// Maximum Transmission Unit).\n\n#ifndef MS_SEND_BUFFER_SIZE\n\n#define MS_SEND_BUFFER_SIZE 750\n\n#endif\n\n\n\n// Included Dependencies\n\n#include \"ModSensorDebugger.h\"\n\n#undef MS_DEBUGGING_STD\n\n#include \"LoggerBase.h\"\n\n#include \"Client.h\"\n\n\n", "file_path": "src/dataPublisherBase.h", "rank": 19, "score": 16.69035446327213 }, { "content": " uint32_t getNISTTime(void) override;\n\n\n\n #ifdef MS_SEQUANSMONARCH_DEBUG_DEEP\n\n StreamDebugger _modemATDebugger;\n\n #endif\n\n\n\n TinyGsm gsmModem;\n\n TinyGsmClient gsmClient;\n\n\n\nprotected:\n\n bool didATRespond(void) override;\n\n bool isInternetAvailable(void) override;\n\n bool verifyMeasurementComplete(bool debug=false) override;\n\n bool modemSleepFxn(void) override;\n\n bool modemWakeFxn(void) override;\n\n bool extraModemSetup(void)override;\n\n\n\nprivate:\n\n const char *_apn;\n\n\n\n};\n\n\n\n#endif // Header Guard\n", "file_path": "src/modems/SequansMonarch.h", "rank": 20, "score": 16.362239264802074 }, { "content": " uint32_t getNISTTime(void) override;\n\n\n\n #ifdef MS_SODAQUBEEU201_DEBUG_DEEP\n\n StreamDebugger _modemATDebugger;\n\n #endif\n\n\n\n TinyGsm gsmModem;\n\n TinyGsmClient gsmClient;\n\n\n\nprotected:\n\n bool didATRespond(void) override;\n\n bool isInternetAvailable(void) override;\n\n bool verifyMeasurementComplete(bool debug=false) override;\n\n bool modemSleepFxn(void) override;\n\n bool modemWakeFxn(void) override;\n\n bool extraModemSetup(void)override;\n\n\n\nprivate:\n\n const char *_apn;\n\n\n\n};\n\n\n\n#endif // Header Guard\n", "file_path": "src/modems/SodaqUBeeU201.h", "rank": 21, "score": 16.362239264802074 }, { "content": " uint32_t getNISTTime(void) override;\n\n\n\n void modemPowerUp(void) override;\n\n\n\n #ifdef MS_SIMCOMSIM7000_DEBUG_DEEP\n\n StreamDebugger _modemATDebugger;\n\n #endif\n\n\n\n TinyGsm gsmModem;\n\n TinyGsmClient gsmClient;\n\n\n\nprotected:\n\n bool didATRespond(void) override;\n\n bool isInternetAvailable(void) override;\n\n bool verifyMeasurementComplete(bool debug=false) override;\n\n bool modemSleepFxn(void) override;\n\n bool modemWakeFxn(void) override;\n\n bool extraModemSetup(void)override;\n\n\n\nprivate:\n\n const char *_apn;\n\n\n\n};\n\n\n\n#endif // Header Guard\n", "file_path": "src/modems/SIMComSIM7000.h", "rank": 22, "score": 16.268988767805173 }, { "content": " uint32_t getNISTTime(void) override;\n\n\n\n #ifdef MS_SIMCOMSIM800_DEBUG_DEEP\n\n StreamDebugger _modemATDebugger;\n\n #endif\n\n\n\n TinyGsm gsmModem;\n\n TinyGsmClient gsmClient;\n\n\n\n void modemPowerUp(void) override;\n\n\n\nprotected:\n\n bool didATRespond(void) override;\n\n bool isInternetAvailable(void) override;\n\n bool verifyMeasurementComplete(bool debug=false) override;\n\n bool modemSleepFxn(void) override;\n\n bool modemWakeFxn(void) override;\n\n bool extraModemSetup(void)override;\n\n\n\nprivate:\n\n const char *_apn;\n\n\n\n};\n\n\n\n#endif // Header Guard\n", "file_path": "src/modems/SIMComSIM800.h", "rank": 23, "score": 16.268988767805173 }, { "content": " uint32_t getNISTTime(void) override;\n\n\n\n void modemPowerUp(void) override;\n\n\n\n #ifdef MS_QUECTELBG96_DEBUG_DEEP\n\n StreamDebugger _modemATDebugger;\n\n #endif\n\n\n\n TinyGsm gsmModem;\n\n TinyGsmClient gsmClient;\n\n\n\nprotected:\n\n bool didATRespond(void) override;\n\n bool isInternetAvailable(void) override;\n\n bool verifyMeasurementComplete(bool debug=false) override;\n\n bool modemSleepFxn(void) override;\n\n bool modemWakeFxn(void) override;\n\n bool extraModemSetup(void)override;\n\n\n\nprivate:\n\n const char *_apn;\n\n\n\n};\n\n\n\n#endif // Header Guard\n", "file_path": "src/modems/QuectelBG96.h", "rank": 24, "score": 16.268988767805173 }, { "content": " virtual void disconnectInternet(void) = 0;\n\n\n\n // Get values by other names\n\n virtual bool getModemSignalQuality(int16_t &rssi, int16_t &percent) = 0;\n\n virtual bool getModemBatteryStats(uint8_t &chargeState, int8_t &percent, uint16_t &milliVolts) = 0;\n\n virtual float getModemTemperature(void) = 0;\n\n\n\n // This has the same functionality as Client->connect with debugging text\n\n // int16_t openTCP(const char *host, uint16_t port);\n\n // This has the same functionality as Client->connect with debugging text\n\n // int16_t openTCP(IPAddress ip, uint16_t port);\n\n // This has the same functionality as Client->close with debugging text\n\n // void closeTCP(void);\n\n\n\n // Special sleep and power function for the modem\n\n // Note: modemPowerDown() simply kills power, while modemSleepPowerDown()\n\n // allows for graceful shut down. You should use modemSleepPowerDown()\n\n // whenever possible.\n\n virtual void modemPowerUp(void);\n\n virtual void modemPowerDown(void);\n", "file_path": "src/LoggerModem.h", "rank": 25, "score": 16.20371852762566 }, { "content": "// Post the data to dream host.\n\n// int16_t DreamHostPublisher::postDataDreamHost(void)\n\nint16_t DreamHostPublisher::publishData(Client *_outClient)\n\n{\n\n // Create a buffer for the portions of the request and response\n\n char tempBuffer[37] = \"\";\n\n uint16_t did_respond = 0;\n\n\n\n // Open a TCP/IP connection to DreamHost\n\n MS_DBG(F(\"Connecting client\"));\n\n MS_START_DEBUG_TIMER ;\n\n if (_outClient->connect(dreamhostHost, dreamhostPort))\n\n {\n\n MS_DBG(F(\"Client connected after\"), MS_PRINT_DEBUG_TIMER, F(\"ms\\n\"));\n\n\n\n // copy the initial post header into the tx buffer\n\n strcpy(txBuffer, getHeader);\n\n\n\n // add in the dreamhost receiver URL\n\n strcat(txBuffer, _DreamHostPortalRX);\n", "file_path": "src/publishers/DreamHostPublisher.cpp", "rank": 27, "score": 15.959095946784327 }, { "content": " static void emptyTxBuffer(void);\n\n // This writes the TX buffer to a stream and also to the debugging port\n\n static void printTxBuffer(Stream *stream, bool addNewLine = false);\n\n\n\n uint8_t _sendEveryX;\n\n uint8_t _sendOffset;\n\n\n\n // Basic chunks of HTTP\n\n static const char *getHeader;\n\n static const char *postHeader;\n\n static const char *HTTPtag;\n\n static const char *hostHeader;\n\n\n\n};\n\n\n\n#endif // Header Guard\n", "file_path": "src/dataPublisherBase.h", "rank": 28, "score": 15.524654278413461 }, { "content": "// Functions for private SWRC server\n\nvoid DreamHostPublisher::setDreamHostPortalRX(const char *dhUrl)\n\n{\n\n _DreamHostPortalRX = dhUrl;\n\n // MS_DBG(F(\"Dreamhost portal URL set!\"));\n\n}\n\n\n\n\n\n// This prints the URL out to an Arduino stream\n\nvoid DreamHostPublisher::printSensorDataDreamHost(Stream *stream)\n\n{\n\n stream->print(_DreamHostPortalRX);\n\n stream->print(loggerTag);\n\n stream->print(_baseLogger->getLoggerID());\n\n stream->print(timestampTagDH);\n\n stream->print(String(Logger::markedEpochTime - 946684800)); // Correct time from epoch to y2k\n\n\n\n for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++)\n\n {\n\n stream->print('&');\n", "file_path": "src/publishers/DreamHostPublisher.cpp", "rank": 29, "score": 15.468793489145343 }, { "content": " // Sets the parameters for frequency of sending and any offset, if needed\n\n // NOTE: These parameters are not currently used!!\n\n void setSendFrequency(uint8_t sendEveryX, uint8_t sendOffset);\n\n\n\n // \"Begins\" the publisher - attaches client and logger\n\n // Not doing this in the constructor because we expect the publishers to be\n\n // created in the \"global scope\" and we cannot control the order in which\n\n // objects in that global scope will be created. That is, we cannot\n\n // guarantee that the logger will actually be created before the publisher\n\n // that wants to attach to it unless we wait to attach the publisher until\n\n // in the setup or loop function of the main program.\n\n void begin(Logger& baseLogger, Client *inClient);\n\n void begin(Logger& baseLogger);\n\n\n\n // Returns the data destination\n\n virtual String getEndpoint(void) = 0;\n\n\n\n // This opens a socket to the correct receiver and sends out the formatted data\n\n // This depends on an internet connection already being made and a client\n\n // being available\n", "file_path": "src/dataPublisherBase.h", "rank": 30, "score": 15.38245267880804 }, { "content": " arrayOfVars[i]->parentSensor->averageMeasurements();\n\n MS_DBG(F(\"--- Notifying variables from\"),\n\n arrayOfVars[i]->getParentSensorNameAndLocation(), F(\"---\"));\n\n arrayOfVars[i]->parentSensor->notifyVariables();\n\n }\n\n }\n\n MS_DBG(F(\"... Complete. <<-----\"));\n\n\n\n return success;\n\n}\n\n\n\n\n\n// This function prints out the results for any connected sensors to a stream\n\n// Calculated variable results will be included\n\nvoid VariableArray::printSensorData(Stream *stream)\n\n{\n\n for (uint8_t i = 0; i < _variableCount; i++)\n\n {\n\n if (arrayOfVars[i]->isCalculated)\n\n {\n", "file_path": "src/VariableArray.cpp", "rank": 31, "score": 15.136111407615282 }, { "content": " bool getModemSignalQuality(int16_t &rssi, int16_t &percent) override;\n\n bool getModemBatteryStats(uint8_t &chargeState, int8_t &percent, uint16_t &milliVolts) override;\n\n float getModemTemperature(void) override;\n\n\n\n uint32_t getNISTTime(void) override;\n\n\n\n #ifdef MS_DIGIXBEECELLULARTRANSPARENT_DEBUG_DEEP\n\n StreamDebugger _modemATDebugger;\n\n #endif\n\n\n\n TinyGsm gsmModem;\n\n TinyGsmClient gsmClient;\n\n\n\nprotected:\n\n bool didATRespond(void) override;\n\n bool isInternetAvailable(void) override;\n\n bool verifyMeasurementComplete(bool debug=false) override;\n\n bool extraModemSetup(void) override;\n\n\n\nprivate:\n\n const char *_apn;\n\n\n\n};\n\n\n\n#endif // Header Guard\n", "file_path": "src/modems/DigiXBeeCellularTransparent.h", "rank": 32, "score": 15.06032583927012 }, { "content": " // very long string objects which can crash the logger\n\n virtual void printFileHeader(Stream *stream);\n\n\n\n // This prints a comma separated list of volues of sensor data - including the\n\n // time - out over an Arduino stream\n\n void printSensorDataCSV(Stream *stream);\n\n\n\n // These functions create a file on an SD card and set the created/modified/\n\n // accessed timestamps in that file.\n\n // The filename may either be the one automatically generated by the logger\n\n // id and the date, the one set by setFileName(String), or can be specified\n\n // in the function.\n\n // If asked to, these functions will also write a header to the file based\n\n // on the variable information from the variable array.\n\n // This can be used to force a logger to create a file with a secondary file name.\n\n bool createLogFile(String& filename, bool writeDefaultHeader = false);\n\n bool createLogFile(bool writeDefaultHeader = false);\n\n\n\n // These functions create a file on an SD card and set the modified/accessed\n\n // timestamps in that file.\n", "file_path": "src/LoggerBase.h", "rank": 33, "score": 14.79451162481104 }, { "content": " bool getModemBatteryStats(uint8_t &chargeState, int8_t &percent, uint16_t &milliVolts) override;\n\n float getModemTemperature(void) override;\n\n\n\n uint32_t getNISTTime(void) override;\n\n\n\n #ifdef MS_ESPRESSIFESP8266_DEBUG_DEEP\n\n StreamDebugger _modemATDebugger;\n\n #endif\n\n\n\n TinyGsm gsmModem;\n\n TinyGsmClient gsmClient;\n\n\n\n // Need the stream for tossing junk on boot\n\n Stream *_modemStream;\n\n\n\nprotected:\n\n bool didATRespond(void) override;\n\n bool isInternetAvailable(void) override;\n\n bool verifyMeasurementComplete(bool debug=false) override;\n\n bool modemSleepFxn(void) override;\n", "file_path": "src/modems/EspressifESP8266.h", "rank": 34, "score": 14.583016654028008 }, { "content": "{\n\n return publishData(_outClient);\n\n}\n\nint16_t dataPublisher::sendData()\n\n{\n\n return publishData();\n\n}\n\n\n\n\n\n// This spits out a string description of the PubSubClient codes\n\nString dataPublisher::parseMQTTState(int state)\n\n{\n\n // // Possible values for client.state()\n\n // #define MQTT_CONNECTION_TIMEOUT -4\n\n // #define MQTT_CONNECTION_LOST -3\n\n // #define MQTT_CONNECT_FAILED -2\n\n // #define MQTT_DISCONNECTED -1\n\n // #define MQTT_CONNECTED 0\n\n // #define MQTT_CONNECT_BAD_PROTOCOL 1\n\n // #define MQTT_CONNECT_BAD_CLIENT_ID 2\n", "file_path": "src/dataPublisherBase.cpp", "rank": 35, "score": 14.551130339155081 }, { "content": "\n\n### Example for the CUAHSI Workshop\n\n\n\n### To Do:\n\n\n\n1. Give your logger a name in line 49 by replacing the x's with your own logger id:\n\n\n\n```cpp\n\nconst char *LoggerID = \"XXXXX\";\n\n```\n\n\n\n2. Fill in the correct WiFi Id and Password in lines 119 and 120:\n\n\n\n```cpp\n\nconst char *wifiId = \"xxxxx\"; // The WiFi access point, unnecessary for gprs\n\nconst char *wifiPwd = \"xxxxx\"; // The password for connecting to WiFi, unnecessary for gprs\n\n```\n\n\n\n\n\n3. Verify your sensor attachment pins:\n\n - CTD is connected to the D6-7 plug (line 159, SDI-12 data on pin 7)\n\n - Maxim DS18 is connected to the D4-5 plug (line 212, OneWire bus on pin 4)\n\n - Ultrasonic is connected to the D10-11 plug (line 79, software data Rx on pin 11)\n\n\n\n4. If using ultrasonic, and interested in water depth instead of distance to the water, create a calculated variable for water depth by uncommenting lines 211, 236-259 and 281-282 and commenting out line 275.\n\n\n\n5. Fill out all of the variable UUID's\n\n - lines 269 - 280, 211, and 253 as applicable\n\n\n\n6. Fill out your registration token and sampling feature UUID in lines 305-306:\n\n\n\n```cpp\n\nconst char *registrationToken = \"12345678-abcd-1234-ef00-1234567890ab\"; // Device registration token\n\nconst char *samplingFeature = \"12345678-abcd-1234-ef00-1234567890ab\"; // Sampling feature UUID\n\n```\n\n\n\n7. Compile and upload!\n", "file_path": "examples/cuahsi_workshop/ReadMe.md", "rank": 36, "score": 14.403650727707806 }, { "content": "#include \"ModSensorDebugger.h\"\n\n#undef MS_DEBUGGING_STD\n\n#include \"LoggerModem.h\"\n\n#include \"TinyGsmClient.h\"\n\n\n\n#ifdef MS_SIMCOMSIM7000_DEBUG_DEEP\n\n#include <StreamDebugger.h>\n\n#endif\n\n\n\n\n", "file_path": "src/modems/SIMComSIM7000.h", "rank": 37, "score": 14.392747915698276 }, { "content": "// Included Dependencies\n\n#include \"ModSensorDebugger.h\"\n\n#undef MS_DEBUGGING_STD\n\n#include \"LoggerModem.h\"\n\n#include \"TinyGsmClient.h\"\n\n\n\n#ifdef MS_SEQUANSMONARCH_DEBUG_DEEP\n\n#include <StreamDebugger.h>\n\n#endif\n\n\n\n\n", "file_path": "src/modems/SequansMonarch.h", "rank": 38, "score": 14.386751697516274 }, { "content": "// Included Dependencies\n\n#include \"ModSensorDebugger.h\"\n\n#undef MS_DEBUGGING_STD\n\n#include \"LoggerModem.h\"\n\n#include \"TinyGsmClient.h\"\n\n\n\n#ifdef MS_QUECTELBG96_DEBUG_DEEP\n\n#include <StreamDebugger.h>\n\n#endif\n\n\n\n\n", "file_path": "src/modems/QuectelBG96.h", "rank": 39, "score": 14.386751697516274 }, { "content": " // TempI\n\n\n\n // NOTE ALSO: Depending on what type of serial stream you are using, there\n\n // may also be a bunch of junk in the buffer that this will clear out.\n\n MS_DBG(F(\"Dumping Header Lines from MaxBotix on\"), getSensorLocation());\n\n for(int i = 0; i < 6; i++)\n\n {\n\n String headerLine = _stream->readStringUntil('\\r');\n\n MS_DBG(i, '-', headerLine);\n\n }\n\n // Clear anything else out of the stream buffer\n\n uint8_t junkChars = _stream->available();\n\n if (junkChars)\n\n {\n\n MS_DBG(F(\"Dumping\"), junkChars, F(\"characters from MaxBotix stream buffer\"));\n\n for (uint8_t i = 0; i < junkChars; i++)\n\n {\n\n #ifdef MS_MAXBOTIXSONAR_DEBUG\n\n DEBUGGING_SERIAL_OUTPUT.print(_stream->read());\n\n #else\n", "file_path": "src/sensors/MaxBotixSonar.cpp", "rank": 41, "score": 13.91668680881705 }, { "content": "#define S2GBR6_SIGNALQUALITY_TIME_MS 15000L\n\n\n\n// Included Dependencies\n\n#include \"ModSensorDebugger.h\"\n\n#undef MS_DEBUGGING_STD\n\n#include \"LoggerModem.h\"\n\n#include \"TinyGsmClient.h\"\n\n\n\n#ifdef MS_SODAQ2GBEER6_DEBUG_DEEP\n\n#include <StreamDebugger.h>\n\n#endif\n\n\n", "file_path": "src/modems/Sodaq2GBeeR6.h", "rank": 42, "score": 13.85234204236172 }, { "content": "#define R410M_SIGNALQUALITY_TIME_MS 15000L\n\n\n\n// Included Dependencies\n\n#include \"ModSensorDebugger.h\"\n\n#undef MS_DEBUGGING_STD\n\n#include \"LoggerModem.h\"\n\n#include \"TinyGsmClient.h\"\n\n\n\n#ifdef MS_SODAQUBEER410M_DEBUG_DEEP\n\n#include <StreamDebugger.h>\n\n#endif\n\n\n", "file_path": "src/modems/SodaqUBeeR410M.h", "rank": 43, "score": 13.85234204236172 }, { "content": " TinyGsmClient gsmClient;\n\n\n\nprotected:\n\n bool didATRespond(void) override;\n\n bool isInternetAvailable(void) override;\n\n bool verifyMeasurementComplete(bool debug=false) override;\n\n bool modemSleepFxn(void) override;\n\n bool modemWakeFxn(void) override;\n\n bool extraModemSetup(void)override;\n\n\n\nprivate:\n\n const char *_apn;\n\n int8_t _vRefPin;\n\n\n\n};\n\n\n\n#endif // Header Guard\n", "file_path": "src/modems/Sodaq2GBeeR6.h", "rank": 44, "score": 13.816562906266036 }, { "content": " itoa(i+1, tempBuffer, 10); // BASE 10\n\n strcat(txBuffer, tempBuffer);\n\n txBuffer[strlen(txBuffer)] = '=';\n\n _baseLogger->getValueStringAtI(i).toCharArray(tempBuffer, 26);\n\n strcat(txBuffer, tempBuffer);\n\n if (i + 1 != numChannels)\n\n {\n\n txBuffer[strlen(txBuffer)] = '&';\n\n }\n\n }\n\n MS_DBG(F(\"Message [\"), strlen(txBuffer), F(\"]:\"), String(txBuffer));\n\n\n\n // Set the client connection parameters\n\n _mqttClient.setClient(*_outClient);\n\n _mqttClient.setServer(mqttServer, mqttPort);\n\n\n\n // Make sure any previous TCP connections are closed\n\n // NOTE: The PubSubClient library used for MQTT connect assumes that as\n\n // long as the client is connected, it must be connected to the right place.\n\n // Closing any stray client sockets here ensures that a new client socket\n", "file_path": "src/publishers/ThingSpeakPublisher.cpp", "rank": 45, "score": 13.788915598814771 }, { "content": "\n\n\n\n// A way to begin with everything already set\n\nvoid ThingSpeakPublisher::begin(Logger& baseLogger, Client *inClient,\n\n const char *thingSpeakMQTTKey,\n\n const char *thingSpeakChannelID,\n\n const char *thingSpeakChannelKey)\n\n{\n\n setMQTTKey(thingSpeakMQTTKey);\n\n setChannelID(thingSpeakChannelID);\n\n setChannelKey(thingSpeakChannelKey);\n\n dataPublisher::begin(baseLogger, inClient);\n\n}\n\nvoid ThingSpeakPublisher::begin(Logger& baseLogger,\n\n const char *thingSpeakMQTTKey,\n\n const char *thingSpeakChannelID,\n\n const char *thingSpeakChannelKey)\n\n{\n\n setMQTTKey(thingSpeakMQTTKey);\n\n setChannelID(thingSpeakChannelID);\n", "file_path": "src/publishers/ThingSpeakPublisher.cpp", "rank": 46, "score": 13.692568082525069 }, { "content": " TinyGsmClient gsmClient;\n\n\n\n #if F_CPU == 8000000L\n\n HardwareSerial *_modemSerial;\n\n #endif\n\n\n\nprotected:\n\n bool didATRespond(void) override;\n\n bool isInternetAvailable(void) override;\n\n bool verifyMeasurementComplete(bool debug=false) override;\n\n bool modemSleepFxn(void) override;\n\n bool modemWakeFxn(void) override;\n\n bool extraModemSetup(void)override;\n\n\n\nprivate:\n\n const char *_apn;\n\n\n\n};\n\n\n\n#endif // Header Guard\n", "file_path": "src/modems/SodaqUBeeR410M.h", "rank": 47, "score": 13.593736049755433 }, { "content": " // This also un-sets the _millisPowerOn timestamp.\n\n virtual void powerDown(void);\n\n\n\n // This wakes the sensor up, if necessary - that is, does whatever it takes to\n\n // get a sensor in the proper state to begin a measurement after the power is on.\n\n // This *may* require a waitForWarmUp() before wake commands can be sent.\n\n // The wait is NOT included in this function!\n\n // This also sets the _millisSensorActivated timestamp.\n\n // By default, verifies the power is on and returns true\n\n virtual bool wake(void);\n\n // This puts the sensor to sleep, if necessary.\n\n // This also un-sets the _millisSensorActivated timestamp.\n\n // Does NOT power down the sensor!\n\n virtual bool sleep(void);\n\n\n\n // This tells the sensor to start a single measurement, if needed\n\n // This also sets the _millisMeasurementRequested timestamp.\n\n // This *may* require a waitForWarmUp() before measurement commands can be sent.\n\n // This *may* also require a waitForStability() before returned measurements will be any good.\n\n // The waits are NOT included in this function!\n", "file_path": "src/SensorBase.h", "rank": 48, "score": 13.473881064018546 }, { "content": " // The \"isMeasurementComplete()\" function checks whether or not enough time\n\n // has passed between when the sensor was asked to take a single measurement\n\n // and when that measurement should be complete. The\n\n // \"waitForMeasurementCompletion()\" function delays until the time passes.\n\n virtual bool isMeasurementComplete(bool debug=false);\n\n void waitForMeasurementCompletion(void);\n\n\n\n\n\nprotected:\n\n\n\n int8_t _dataPin; // SIGNED int, to allow negative numbers for unused pins\n\n int8_t _powerPin; // SIGNED int, to allow negative numbers for unused pins\n\n const char *_sensorName;\n\n const uint8_t _numReturnedVars;\n\n uint8_t _measurementsToAverage;\n\n uint8_t numberGoodMeasurementsMade[MAX_NUMBER_VARS];\n\n\n\n // This is the time needed from the when a sensor has power until it's ready to talk\n\n // The _millisPowerOn value is set in the powerUp() function. It is\n\n // un-set in the powerDown() function.\n", "file_path": "src/SensorBase.h", "rank": 49, "score": 13.464426389653275 }, { "content": "\n\n// How long we're willing to wait to get signal quality\n\n#define SIM800_SIGNALQUALITY_TIME_MS 15000L\n\n\n\n// Included Dependencies\n\n#include \"ModSensorDebugger.h\"\n\n#undef MS_DEBUGGING_STD\n\n#include \"LoggerModem.h\"\n\n#include \"TinyGsmClient.h\"\n\n\n\n#ifdef MS_SIMCOMSIM800_DEBUG_DEEP\n\n#include <StreamDebugger.h>\n\n#endif\n\n\n\n\n", "file_path": "src/modems/SIMComSIM800.h", "rank": 50, "score": 13.431795686753512 }, { "content": "\n\n// How long we're willing to wait to get signal quality\n\n#define U201_SIGNALQUALITY_TIME_MS 15000L\n\n\n\n// Included Dependencies\n\n#include \"ModSensorDebugger.h\"\n\n#undef MS_DEBUGGING_STD\n\n#include \"LoggerModem.h\"\n\n#include \"TinyGsmClient.h\"\n\n\n\n#ifdef MS_SODAQUBEEU201_DEBUG_DEEP\n\n#include <StreamDebugger.h>\n\n#endif\n\n\n\n\n", "file_path": "src/modems/SodaqUBeeU201.h", "rank": 51, "score": 13.431795686753512 }, { "content": "\n\n // This gives power to each sensor\n\n void sensorsPowerUp(void);\n\n\n\n // This verifies sensors have power and sends a wake command, if necesary\n\n bool sensorsWake(void);\n\n\n\n // This sends sensors a sleep command, but does not power them down\n\n bool sensorsSleep(void);\n\n\n\n // This cuts sensor power\n\n void sensorsPowerDown(void);\n\n\n\n // This function updates the values for any connected sensors.\n\n bool updateAllSensors(void);\n\n\n\n // This function powers, wakes, updates values, sleeps and powers down.\n\n bool completeUpdate(void);\n\n\n\n // This function prints out the results for any connected sensors to a stream\n", "file_path": "src/VariableArray.h", "rank": 52, "score": 13.392599630738523 }, { "content": "void DigiXBeeWifi::disconnectInternet(void)\n\n{\n\n // Wifi XBee doesn't like to disconnect AT ALL, so we're doing nothing\n\n // If you do disconnect, you must power cycle before you can reconnect\n\n // to the same access point.\n\n}\n\n\n\n\n\n// Get the time from NIST via TIME protocol (rfc868)\n\nuint32_t DigiXBeeWifi::getNISTTime(void)\n\n{\n\n /* bail if not connected to the internet */\n\n if (!isInternetAvailable())\n\n {\n\n MS_DBG(F(\"No internet connection, cannot connect to NIST.\"));\n\n return 0;\n\n }\n\n\n\n gsmClient.stop();\n\n\n", "file_path": "src/modems/DigiXBeeWifi.cpp", "rank": 53, "score": 13.37017059341785 }, { "content": "\n\n#define TINY_GSM_MODEM_XBEE\n\n#ifndef TINY_GSM_RX_BUFFER\n\n#define TINY_GSM_RX_BUFFER 64\n\n#endif\n\n\n\n// Included Dependencies\n\n#include \"ModSensorDebugger.h\"\n\n#undef MS_DEBUGGING_STD\n\n#include \"DigiXBee.h\"\n\n#include \"TinyGsmClient.h\"\n\n\n\n#ifdef MS_DIGIXBEEWIFI_DEBUG_DEEP\n\n#include <StreamDebugger.h>\n\n#endif\n\n\n", "file_path": "src/modems/DigiXBeeWifi.h", "rank": 54, "score": 13.23311215094699 }, { "content": "\n\n#define TINY_GSM_MODEM_SARAR4\n\n#ifndef TINY_GSM_RX_BUFFER\n\n#define TINY_GSM_RX_BUFFER 64\n\n#endif\n\n\n\n// Included Dependencies\n\n#include \"ModSensorDebugger.h\"\n\n#undef MS_DEBUGGING_STD\n\n#include \"DigiXBee.h\"\n\n#include \"TinyGsmClient.h\"\n\n\n\n#ifdef MS_DIGIXBEELTEBYPASS_DEBUG_DEEP\n\n#include <StreamDebugger.h>\n\n#endif\n\n\n", "file_path": "src/modems/DigiXBeeLTEBypass.h", "rank": 55, "score": 13.23311215094699 }, { "content": "\n\n#define TINY_GSM_MODEM_UBLOX\n\n#ifndef TINY_GSM_RX_BUFFER\n\n#define TINY_GSM_RX_BUFFER 64\n\n#endif\n\n\n\n// Included Dependencies\n\n#include \"ModSensorDebugger.h\"\n\n#undef MS_DEBUGGING_STD\n\n#include \"DigiXBee.h\"\n\n#include \"TinyGsmClient.h\"\n\n\n\n#ifdef MS_DIGIXBEE3GBYPASS_DEBUG_DEEP\n\n#include <StreamDebugger.h>\n\n#endif\n\n\n", "file_path": "src/modems/DigiXBee3GBypass.h", "rank": 56, "score": 13.23311215094699 }, { "content": "\n\n#define TINY_GSM_MODEM_XBEE\n\n#ifndef TINY_GSM_RX_BUFFER\n\n#define TINY_GSM_RX_BUFFER 64\n\n#endif\n\n\n\n// Included Dependencies\n\n#include \"ModSensorDebugger.h\"\n\n#undef MS_DEBUGGING_STD\n\n#include \"DigiXBee.h\"\n\n#include \"TinyGsmClient.h\"\n\n\n\n#ifdef MS_DIGIXBEECELLULARTRANSPARENT_DEBUG_DEEP\n\n#include <StreamDebugger.h>\n\n#endif\n\n\n", "file_path": "src/modems/DigiXBeeCellularTransparent.h", "rank": 57, "score": 13.23311215094699 }, { "content": "ProcessorStats::~ProcessorStats(){}\n\n\n\n\n\nString ProcessorStats::getSensorLocation(void) {return BOARD;}\n\n\n\n\n\n#if defined(ARDUINO_ARCH_SAMD)\n\n extern \"C\" char *sbrk(int i);\n\n\n\n int16_t FreeRam () {\n\n char stack_dummy = 0;\n\n return &stack_dummy - sbrk(0);\n\n }\n\n#endif\n\n\n\n\n\nbool ProcessorStats::addSingleMeasurementResult(void)\n\n{\n\n // Get the battery voltage\n\n MS_DBG(F(\"Getting battery voltage\"));\n", "file_path": "src/sensors/ProcessorStats.cpp", "rank": 61, "score": 12.815884773002898 }, { "content": "// Time until system and digital pins are operational\n\n#define ESP8266_ATRESPONSE_TIME_MS 350\n\n\n\n// How long we're willing to wait to get signal quality\n\n#define ESP8266_SIGNALQUALITY_TIME_MS 15000L\n\n\n\n// Included Dependencies\n\n#include \"ModSensorDebugger.h\"\n\n#undef MS_DEBUGGING_STD\n\n#include \"LoggerModem.h\"\n\n#include \"TinyGsmClient.h\"\n\n\n\n#ifdef MS_ESPRESSIFESP8266_DEBUG_DEEP\n\n#include <StreamDebugger.h>\n\n#endif\n\n\n\n\n", "file_path": "src/modems/EspressifESP8266.h", "rank": 62, "score": 12.796491210741507 }, { "content": "/*\n\n *DigiXBeeWifi.cpp\n\n *This file is part of the EnviroDIY modular sensors library for Arduino\n\n *\n\n *Initial library developement done by Sara Damiano ([email protected]).\n\n *\n\n *This file is for Digi S6B Wifi XBee's\n\n*/\n\n\n\n// Included DependenciesV\n\n#include \"DigiXBeeWifi.h\"\n\n#include \"modems/LoggerModemMacros.h\"\n\n\n\n\n\n// Constructor/Destructor\n\nDigiXBeeWifi::DigiXBeeWifi(Stream* modemStream,\n\n int8_t powerPin, int8_t statusPin, bool useCTSStatus,\n\n int8_t modemResetPin, int8_t modemSleepRqPin,\n\n const char *ssid, const char *pwd,\n\n uint8_t measurementsToAverage)\n", "file_path": "src/modems/DigiXBeeWifi.cpp", "rank": 63, "score": 12.793859947930567 }, { "content": " void printSensorData(Stream *stream = &Serial);\n\n\n\nprotected:\n\n uint8_t _variableCount;\n\n uint8_t _sensorCount;\n\n uint8_t _maxSamplestoAverage;\n\n\n\nprivate:\n\n bool isLastVarFromSensor(int arrayIndex);\n\n uint8_t countMaxToAverage(void);\n\n bool checkVariableUUIDs(void);\n\n\n\n#ifdef MS_VARIABLEARRAY_DEBUG_DEEP\n\n template<typename T>\n\n void prettyPrintArray(T arrayToPrint[])\n\n {\n\n DEEP_DEBUGGING_SERIAL_OUTPUT.print(\"[,\\t\");\n\n for (uint8_t i = 0; i < _variableCount; i++)\n\n {\n\n DEEP_DEBUGGING_SERIAL_OUTPUT.print(arrayToPrint[i]);\n", "file_path": "src/VariableArray.h", "rank": 64, "score": 12.685448423120109 }, { "content": " ~SodaqUBeeR410M();\n\n\n\n bool connectInternet(uint32_t maxConnectionTime = 50000L) override;\n\n void disconnectInternet(void) override;\n\n\n\n // Get values by other names\n\n bool getModemSignalQuality(int16_t &rssi, int16_t &percent) override;\n\n bool getModemBatteryStats(uint8_t &chargeState, int8_t &percent, uint16_t &milliVolts) override;\n\n float getModemTemperature(void) override;\n\n\n\n uint32_t getNISTTime(void) override;\n\n\n\n void modemHardReset(void) override;\n\n void modemPowerUp(void) override;\n\n\n\n #ifdef MS_SODAQUBEER410M_DEBUG_DEEP\n\n StreamDebugger _modemATDebugger;\n\n #endif\n\n\n\n TinyGsm gsmModem;\n", "file_path": "src/modems/SodaqUBeeR410M.h", "rank": 65, "score": 12.5889922793545 }, { "content": "/*\n\n *SequansMonarch.cpp\n\n *This file is part of the EnviroDIY modular sensors library for Arduino\n\n *\n\n *Initial library developement done by Sara Damiano ([email protected]).\n\n *\n\n *This file is for the Botletics and other modules based on the SIMCOM BG96.\n\n*/\n\n\n\n// Included Dependencies\n\n#include \"SequansMonarch.h\"\n\n#include \"modems/LoggerModemMacros.h\"\n\n\n\n\n\n// Constructor\n\nSequansMonarch::SequansMonarch(Stream* modemStream,\n\n int8_t powerPin, int8_t statusPin,\n\n int8_t modemResetPin, int8_t modemSleepRqPin,\n\n const char *apn,\n\n uint8_t measurementsToAverage)\n", "file_path": "src/modems/SequansMonarch.cpp", "rank": 66, "score": 12.51433383088842 }, { "content": "/*\n\n *QuectelBG96.cpp\n\n *This file is part of the EnviroDIY modular sensors library for Arduino\n\n *\n\n *Initial library developement done by Sara Damiano ([email protected]).\n\n *\n\n *This file is for the Botletics and other modules based on the SIMCOM BG96.\n\n*/\n\n\n\n// Included Dependencies\n\n#include \"QuectelBG96.h\"\n\n#include \"modems/LoggerModemMacros.h\"\n\n\n\n\n\n// Constructor\n\nQuectelBG96::QuectelBG96(Stream* modemStream,\n\n int8_t powerPin, int8_t statusPin,\n\n int8_t modemResetPin, int8_t modemSleepRqPin,\n\n const char *apn,\n\n uint8_t measurementsToAverage)\n", "file_path": "src/modems/QuectelBG96.cpp", "rank": 67, "score": 12.51433383088842 }, { "content": "/*\n\n *Sodaq2GBeeR6.cpp\n\n *This file is part of the EnviroDIY modular sensors library for Arduino\n\n *\n\n *Initial library developement done by Sara Damiano ([email protected]).\n\n *\n\n *This file is the Sodaq 2GBee revisions 6 and higher - these are based on\n\n *the SIMCOM SIM800h.\n\n*/\n\n\n\n// Included Dependencies\n\n#include \"Sodaq2GBeeR6.h\"\n\n#include \"modems/LoggerModemMacros.h\"\n\n\n\n\n\n// Constructor\n\nSodaq2GBeeR6::Sodaq2GBeeR6(Stream *modemStream,\n\n int8_t powerPin, int8_t statusPin,\n\n const char *apn,\n\n uint8_t measurementsToAverage)\n", "file_path": "src/modems/Sodaq2GBeeR6.cpp", "rank": 68, "score": 12.357497634309837 }, { "content": "/*\n\n *SIMComSIM7000.cpp\n\n *This file is part of the EnviroDIY modular sensors library for Arduino\n\n *\n\n *Initial library developement done by Sara Damiano ([email protected]).\n\n *\n\n *This file is for the Botletics and other modules based on the SIMCOM SIM7000.\n\n*/\n\n\n\n// Included Dependencies\n\n#include \"SIMComSIM7000.h\"\n\n#include \"modems/LoggerModemMacros.h\"\n\n\n\n\n\n// Constructor\n\nSIMComSIM7000::SIMComSIM7000(Stream* modemStream,\n\n int8_t powerPin, int8_t statusPin,\n\n int8_t modemResetPin, int8_t modemSleepRqPin,\n\n const char *apn,\n\n uint8_t measurementsToAverage)\n", "file_path": "src/modems/SIMComSIM7000.cpp", "rank": 69, "score": 12.306152924293865 }, { "content": " uint8_t measurementsToAverage = 1);\n\n ~Sodaq2GBeeR6();\n\n\n\n bool connectInternet(uint32_t maxConnectionTime = 50000L) override;\n\n void disconnectInternet(void) override;\n\n\n\n // Get values by other names\n\n bool getModemSignalQuality(int16_t &rssi, int16_t &percent) override;\n\n bool getModemBatteryStats(uint8_t &chargeState, int8_t &percent, uint16_t &milliVolts) override;\n\n float getModemTemperature(void) override;\n\n\n\n uint32_t getNISTTime(void) override;\n\n\n\n void setVRefPin(int8_t vRefPin);\n\n\n\n #ifdef MS_SODAQ2GBEER6_DEBUG_DEEP\n\n StreamDebugger _modemATDebugger;\n\n #endif\n\n\n\n TinyGsm gsmModem;\n", "file_path": "src/modems/Sodaq2GBeeR6.h", "rank": 71, "score": 12.181131531809609 }, { "content": " {\n\n dtRowHeader += _loggerTimeZone;\n\n }\n\n STREAM_CSV_ROW(dtRowHeader, getVarCodeAtI(i));\n\n}\n\n\n\n\n\n// This prints a comma separated list of volues of sensor data - including the\n\n// time - out over an Arduino stream\n\nvoid Logger::printSensorDataCSV(Stream *stream)\n\n{\n\n String csvString = \"\";\n\n dtFromEpoch(Logger::markedEpochTime).addToString(csvString);\n\n csvString += ',';\n\n stream->print(csvString);\n\n for (uint8_t i = 0; i < getArrayVarCount(); i++)\n\n {\n\n stream->print(getValueStringAtI(i));\n\n if (i + 1 != getArrayVarCount())\n\n {\n", "file_path": "src/LoggerBase.cpp", "rank": 72, "score": 11.868140886923143 }, { "content": "/*\n\n *SodaqUBeeU201.cpp\n\n *This file is part of the EnviroDIY modular sensors library for Arduino\n\n *\n\n *Initial library developement done by Sara Damiano ([email protected]).\n\n *\n\n *This file is the Sodaq UBee based on the u-blox SARA U201 3G Cellular Module\n\n*/\n\n\n\n// Included Dependencies\n\n#include \"SodaqUBeeU201.h\"\n\n#include \"modems/LoggerModemMacros.h\"\n\n\n\n\n\n// Constructor\n\nSodaqUBeeU201::SodaqUBeeU201(Stream* modemStream,\n\n int8_t powerPin, int8_t statusPin,\n\n int8_t modemResetPin, int8_t modemSleepRqPin,\n\n const char *apn,\n\n uint8_t measurementsToAverage)\n", "file_path": "src/modems/SodaqUBeeU201.cpp", "rank": 73, "score": 11.816754448477917 }, { "content": " return true;\n\n }\n\n}\n\n\n\n\n\nbool SodaqUBeeR410M::extraModemSetup(void)\n\n{\n\n gsmModem.init();\n\n gsmClient.init(&gsmModem);\n\n _modemName = gsmModem.getModemName();\n\n // Set to only use LTE-M, which should cause connection more quickly\n\n gsmModem.sendAT(GF(\"+URAT=7\"));\n\n gsmModem.waitResponse();\n\n return true;\n\n}\n\n\n\n\n\nvoid SodaqUBeeR410M::modemHardReset(void)\n\n{\n\n if (_modemResetPin >= 0)\n", "file_path": "src/modems/SodaqUBeeR410M.cpp", "rank": 74, "score": 11.658268959404687 }, { "content": " gsmModem.commandMode();\n\n if (!gsmModem.isNetworkConnected())\n\n {\n\n MS_DBG(F(\"No internet connection, cannot connect to NIST.\"));\n\n gsmModem.exitCommand();\n\n return 0;\n\n }\n\n\n\n // We can get the NIST timestamp directly from the XBee\n\n gsmModem.sendAT(GF(\"DT0\"));\n\n String res = gsmModem.readResponseString();\n\n gsmModem.exitCommand();\n\n MS_DBG(F(\"Raw hex response from XBee:\"), res);\n\n char buf[9] = {0,};\n\n res.toCharArray(buf, 9);\n\n uint32_t secFrom2000 = strtol(buf, 0, 16);\n\n MS_DBG(F(\"Seconds from Jan 1, 2000 from XBee (UTC):\"), secFrom2000);\n\n\n\n // Convert from seconds since Jan 1, 2000 to 1970\n\n uint32_t unixTimeStamp = secFrom2000 + 946684800 ;\n", "file_path": "src/modems/DigiXBeeCellularTransparent.cpp", "rank": 75, "score": 11.655615167045275 }, { "content": "/*\n\n *dataPublisherBase.cpp\n\n *This file is part of the EnviroDIY modular sensors library for Arduino\n\n *\n\n *Initial library developement done by Sara Damiano ([email protected]).\n\n *\n\n *This file is a skeleton for sending out remote data.\n\n*/\n\n#include \"dataPublisherBase.h\"\n\n\n\nchar dataPublisher::txBuffer[MS_SEND_BUFFER_SIZE] = {'\\0'};\n\n\n\n// Basic chunks of HTTP\n\nconst char *dataPublisher::getHeader = \"GET \";\n\nconst char *dataPublisher::postHeader = \"POST \";\n\nconst char *dataPublisher::HTTPtag = \" HTTP/1.1\";\n\nconst char *dataPublisher::hostHeader = \"\\r\\nHost: \";\n\n\n\n// Constructors\n\ndataPublisher::dataPublisher()\n", "file_path": "src/dataPublisherBase.cpp", "rank": 76, "score": 11.62540503940601 }, { "content": " /* Try up to 12 times to get a timestamp from NIST */\n\n for (uint8_t i = 0; i < 12; i++)\n\n {\n\n\n\n /* Must ensure that we do not ping the daylight more than once every 4 seconds */\n\n /* NIST clearly specifies here that this is a requirement for all software */\n\n /* that accesses its servers: https://tf.nist.gov/tf-cgi/servers.cgi */\n\n while (millis() < _lastNISTrequest + 4000)\n\n {\n\n }\n\n\n\n /* Make TCP connection */\n\n MS_DBG(F(\"\\nConnecting to NIST daytime Server\"));\n\n bool connectionMade = false;\n\n\n\n /* This is the IP address of time-e-wwv.nist.gov */\n\n /* XBee's address lookup falters on time.nist.gov */\n\n IPAddress ip(132, 163, 97, 6);\n\n connectionMade = gsmClient.connect(ip, 37);\n\n /* Wait again so NIST doesn't refuse us! */\n", "file_path": "src/modems/DigiXBeeWifi.cpp", "rank": 77, "score": 11.565867710203573 }, { "content": "const int ThingSpeakPublisher::mqttPort = 1883;\n\nconst char *ThingSpeakPublisher::mqttClient = THING_SPEAK_CLIENT_NAME;\n\nconst char *ThingSpeakPublisher::mqttUser = THING_SPEAK_USER_NAME;\n\n\n\n\n\n// Constructors\n\nThingSpeakPublisher::ThingSpeakPublisher()\n\n : dataPublisher()\n\n{\n\n // MS_DBG(F(\"ThingSpeakPublisher object created\"));\n\n}\n\nThingSpeakPublisher::ThingSpeakPublisher(Logger& baseLogger,\n\n uint8_t sendEveryX, uint8_t sendOffset)\n\n : dataPublisher(baseLogger, sendEveryX, sendOffset)\n\n{\n\n // MS_DBG(F(\"ThingSpeakPublisher object created\"));\n\n}\n\nThingSpeakPublisher::ThingSpeakPublisher(Logger& baseLogger, Client *inClient,\n\n uint8_t sendEveryX, uint8_t sendOffset)\n\n : dataPublisher(baseLogger, inClient, sendEveryX, sendOffset)\n", "file_path": "src/publishers/ThingSpeakPublisher.cpp", "rank": 78, "score": 11.524530397554717 }, { "content": " // Do NOT unset any status bits or timestamps if we didn't really power down!\n\n }\n\n}\n\n\n\n\n\n// The function to set up connection to a sensor.\n\n// By default, sets pin modes and returns true\n\nbool Sensor::setup(void)\n\n{\n\n MS_DBG(F(\"Setting up\"), getSensorName(), F(\"attached at\"),\n\n getSensorLocation(), F(\"which can return up to\"), _numReturnedVars,\n\n F(\"variable[s].\"));\n\n\n\n MS_DBG(F(\"It warms up in\"), _warmUpTime_ms, F(\"ms, is stable after\"),\n\n _stabilizationTime_ms, F(\"ms, and takes a single measurement in\"),\n\n _measurementTime_ms, F(\"ms.\"));\n\n\n\n MS_DBG(_measurementsToAverage, F(\"individual measurements will be averaged for each reading.\"));\n\n\n\n if (_powerPin >= 0) pinMode(_powerPin, OUTPUT); // NOTE: Not setting value\n", "file_path": "src/SensorBase.cpp", "rank": 79, "score": 11.469748428919587 }, { "content": " // is opened to the right place.\n\n // client is connected when a different socket is open\n\n if (_outClient->connected())\n\n {\n\n _outClient->stop();\n\n }\n\n\n\n // Make the MQTT connection\n\n // Note: the client id and the user name do not mean anything for ThingSpeak\n\n MS_DBG(F(\"Opening MQTT Connection\"));\n\n MS_START_DEBUG_TIMER;\n\n if (_mqttClient.connect(mqttClient, mqttUser, _thingSpeakMQTTKey))\n\n {\n\n MS_DBG(F(\"MQTT connected after\"), MS_PRINT_DEBUG_TIMER, F(\"ms\"));\n\n\n\n if (_mqttClient.publish(topicBuffer, txBuffer))\n\n {\n\n PRINTOUT(F(\"ThingSpeak topic published! Current state:\"),\n\n parseMQTTState(_mqttClient.state()));\n\n retVal = true;\n", "file_path": "src/publishers/ThingSpeakPublisher.cpp", "rank": 80, "score": 11.405952825927713 }, { "content": " MS_DBG(F(\"Unix Timestamp returned by NIST (UTC):\"), unixTimeStamp);\n\n\n\n // If before Jan 1, 2019 or after Jan 1, 2030, most likely an error\n\n if (unixTimeStamp < 1546300800)\n\n {\n\n return 0;\n\n }\n\n else if (unixTimeStamp > 1893456000)\n\n {\n\n return 0;\n\n }\n\n else\n\n {\n\n return unixTimeStamp;\n\n }\n\n}*/\n\nuint32_t DigiXBeeCellularTransparent::getNISTTime(void)\n\n{\n\n /* bail if not connected to the internet */\n\n if (!isInternetAvailable())\n", "file_path": "src/modems/DigiXBeeCellularTransparent.cpp", "rank": 81, "score": 11.253429386052051 }, { "content": "/*\n\n *DigiXBeeCellularTransparent.cpp\n\n *This file is part of the EnviroDIY modular sensors library for Arduino\n\n *\n\n *Initial library developement done by Sara Damiano ([email protected]).\n\n *\n\n *This file is for Digi Cellular XBee's\n\n*/\n\n\n\n// Included Dependencies\n\n#include \"DigiXBeeCellularTransparent.h\"\n\n#include \"modems/LoggerModemMacros.h\"\n\n\n\n// Constructor/Destructor\n\nDigiXBeeCellularTransparent::DigiXBeeCellularTransparent(Stream* modemStream,\n\n int8_t powerPin, int8_t statusPin, bool useCTSStatus,\n\n int8_t modemResetPin, int8_t modemSleepRqPin,\n\n const char *apn,\n\n uint8_t measurementsToAverage)\n\n : DigiXBee(powerPin, statusPin, useCTSStatus,\n", "file_path": "src/modems/DigiXBeeCellularTransparent.cpp", "rank": 82, "score": 11.23920674240296 }, { "content": " : Sensor(sensorName, numReturnedVars,\n\n warmUpTime_ms, stabilizationTime_ms, measurementTime_ms,\n\n powerPin, dataPin, measurementsToAverage),\n\n _SDI12Internal(dataPin)\n\n{\n\n _SDI12address = SDI12address;\n\n}\n\nSDI12Sensors::SDI12Sensors(char *SDI12address, int8_t powerPin, int8_t dataPin, uint8_t measurementsToAverage,\n\n const char *sensorName, const uint8_t numReturnedVars,\n\n uint32_t warmUpTime_ms, uint32_t stabilizationTime_ms, uint32_t measurementTime_ms)\n\n : Sensor(sensorName, numReturnedVars,\n\n warmUpTime_ms, stabilizationTime_ms, measurementTime_ms,\n\n powerPin, dataPin, measurementsToAverage),\n\n _SDI12Internal(dataPin)\n\n{\n\n _SDI12address = *SDI12address;\n\n}\n\nSDI12Sensors::SDI12Sensors(int SDI12address, int8_t powerPin, int8_t dataPin, uint8_t measurementsToAverage,\n\n const char *sensorName, const uint8_t numReturnedVars,\n\n uint32_t warmUpTime_ms, uint32_t stabilizationTime_ms, uint32_t measurementTime_ms)\n", "file_path": "src/sensors/SDI12Sensors.cpp", "rank": 83, "score": 11.068128517546015 }, { "content": "/*\n\n *DigiXBee3GBypass.cpp\n\n *This file is part of the EnviroDIY modular sensors library for Arduino\n\n *\n\n *Initial library developement done by Sara Damiano ([email protected]).\n\n *\n\n *This file is for Digi Cellular XBee's BASED ON UBLOX CHIPS in bypass mode\n\n*/\n\n\n\n// Included Dependencies\n\n#include \"DigiXBee3GBypass.h\"\n\n#include \"modems/LoggerModemMacros.h\"\n\n\n\n// Constructor/Destructor\n\nDigiXBee3GBypass::DigiXBee3GBypass(Stream* modemStream,\n\n int8_t powerPin, int8_t statusPin, bool useCTSStatus,\n\n int8_t modemResetPin, int8_t modemSleepRqPin,\n\n const char *apn,\n\n uint8_t measurementsToAverage)\n\n : DigiXBee(powerPin, statusPin, useCTSStatus,\n", "file_path": "src/modems/DigiXBee3GBypass.cpp", "rank": 84, "score": 11.032679949672184 }, { "content": "/*\n\n *DigiXBeeLTEBypass.cpp\n\n *This file is part of the EnviroDIY modular sensors library for Arduino\n\n *\n\n *Initial library developement done by Sara Damiano ([email protected]).\n\n *\n\n *This file is for Digi Cellular XBee's BASED ON UBLOX CHIPS in bypass mode\n\n*/\n\n\n\n// Included Dependencies\n\n#include \"DigiXBeeLTEBypass.h\"\n\n#include \"modems/LoggerModemMacros.h\"\n\n\n\n// Constructor/Destructor\n\nDigiXBeeLTEBypass::DigiXBeeLTEBypass(Stream* modemStream,\n\n int8_t powerPin, int8_t statusPin, bool useCTSStatus,\n\n int8_t modemResetPin, int8_t modemSleepRqPin,\n\n const char *apn,\n\n uint8_t measurementsToAverage)\n\n : DigiXBee(powerPin, statusPin, useCTSStatus,\n", "file_path": "src/modems/DigiXBeeLTEBypass.cpp", "rank": 85, "score": 11.032679949672184 }, { "content": " const char *ssid, const char *pwd,\n\n uint8_t measurementsToAverage,\n\n int8_t espSleepRqPin, int8_t espStatusPin)\n\n : loggerModem(powerPin, statusPin, HIGH,\n\n modemResetPin, modemSleepRqPin, true,\n\n ESP8266_STATUS_TIME_MS, ESP8266_DISCONNECT_TIME_MS,\n\n ESP8266_WARM_UP_TIME_MS, ESP8266_ATRESPONSE_TIME_MS,\n\n ESP8266_SIGNALQUALITY_TIME_MS,\n\n measurementsToAverage),\n\n #ifdef MS_ESPRESSIFESP8266_DEBUG_DEEP\n\n _modemATDebugger(*modemStream, DEEP_DEBUGGING_SERIAL_OUTPUT),\n\n gsmModem(_modemATDebugger),\n\n #else\n\n gsmModem(*modemStream),\n\n #endif\n\n gsmClient(gsmModem)\n\n{\n\n _ssid = ssid;\n\n _pwd = pwd;\n\n\n", "file_path": "src/modems/EspressifESP8266.cpp", "rank": 86, "score": 10.979233903032014 }, { "content": "- Find this information for your ThingSpeak account and channel and put it into logging_to_ThingSpeak.ino:\n\n\n\n```cpp\n\nconst char *thingSpeakMQTTKey = \"XXXXXXXXXXXXXXXX\"; // Your MQTT API Key from Account > MyProfile.\n\nconst char *thingSpeakChannelID = \"######\"; // The numeric channel id for your channel\n\nconst char *thingSpeakChannelKey = \"XXXXXXXXXXXXXXXX\"; // The Write API Key for your channel\n\n```\n\n\n", "file_path": "examples/logging_to_ThingSpeak/ReadMe.md", "rank": 87, "score": 10.973758547643714 }, { "content": " // - Use the isMeasurementComplete() to check if enough time has passed\n\n // for a measurement to have been completed.\n\n // Bit 7 - 0=No known errors, 1=Some sort of error has occurred\n\n uint8_t getStatus(void);\n\n\n\n // This does any one-time preparations needed before the sensor will be able\n\n // to take readings. May not require any action.\n\n // Generally, the sensor must be powered on for setup.\n\n virtual bool setup(void);\n\n\n\n // This updates the sensor's values\n\n // This clears the values array, starts and averages as many measurement\n\n // readings as requested, and then notifies the registered variables\n\n // of the new results. All possible waits are included in this function!\n\n virtual bool update(void);\n\n\n\n // This turns on the sensor power, if applicable\n\n // This also sets the _millisPowerOn timestamp.\n\n virtual void powerUp(void);\n\n // This turns off the sensor power, if applicable\n", "file_path": "src/SensorBase.h", "rank": 88, "score": 10.930131579724844 }, { "content": " #if defined(ARDUINO_ARCH_SAMD)\n\n extendedWatchDogSAMD watchDogTimer;\n\n #else\n\n extendedWatchDogAVR watchDogTimer;\n\n #endif\n\n\n\n // ===================================================================== //\n\n // Public functions for logging data to an SD card\n\n // ===================================================================== //\n\n\n\npublic:\n\n // This sets a file name, if you want to decide on it in advance\n\n void setFileName(const char *fileName);\n\n // Same as above, with a string (overload function)\n\n void setFileName(String& fileName);\n\n\n\n // This returns the current filename. Must be run after setFileName.\n\n String getFileName(void){return _fileName;}\n\n\n\n // This prints a header onto a stream - this removes need to pass around\n", "file_path": "src/LoggerBase.h", "rank": 89, "score": 10.928850761474958 }, { "content": " // MS_DBG(F(\"Using a Google IP to test connection...\"));\n\n // gsmClient.stop();\n\n // IPAddress ip(8, 8, 8, 8); // This is one of Google's IP's\n\n // success &= gsmClient.connect(ip, 80);\n\n // }\n\n // else\n\n // {\n\n // MS_DBG(F(\"Using last connected IP to test connection:\"));\n\n // }\n\n // gsmClient.print('!'); // Need to send something before connection is made\n\n\n\n MS_DBG(F(\"Opening connection to NIST to check connection strength...\"));\n\n // This is the IP address of time-e-wwv.nist.gov\n\n // XBee's address lookup falters on time.nist.gov\n\n IPAddress ip(132, 163, 97, 6);\n\n gsmClient.connect(ip, 37);\n\n\n\n // Unfortunately, using a ping doesn't work\n\n // gsmModem.commandMode();\n\n // gsmModem.sendAT(GF(\"PG8.8.8.8\"));\n", "file_path": "src/modems/DigiXBeeWifi.cpp", "rank": 90, "score": 10.88488831121483 }, { "content": " /* This is the IP address of time-e-wwv.nist.gov */\n\n /* XBee's address lookup falters on time.nist.gov */\n\n IPAddress ip(132, 163, 97, 6);\n\n connectionMade = gsmClient.connect(ip, 37, 15);\n\n /* Wait again so NIST doesn't refuse us! */\n\n delay(4000L);\n\n /* Try sending something to ensure connection */\n\n gsmClient.println('!');\n\n\n\n /* Wait up to 5 seconds for a response */\n\n if (connectionMade)\n\n {\n\n uint32_t start = millis();\n\n while (gsmClient && gsmClient.available() < 4 && millis() - start < 5000L)\n\n {\n\n }\n\n\n\n if (gsmClient.available() >= 4)\n\n {\n\n MS_DBG(F(\"NIST responded after\"), millis() - start, F(\"ms\"));\n", "file_path": "src/modems/DigiXBeeCellularTransparent.cpp", "rank": 91, "score": 10.820129393242055 }, { "content": "/*\n\n *SensorBase.cpp\n\n *This file is part of the EnviroDIY modular sensors library for Arduino\n\n *\n\n *Initial library developement done by Sara Damiano ([email protected]).\n\n *\n\n *This file is for the sensor base class.\n\n*/\n\n\n\n#include \"SensorBase.h\"\n\n#include \"VariableBase.h\"\n\n\n\n// ============================================================================\n\n// The class and functions for interfacing with a sensor\n\n// ============================================================================\n\n\n\n// The constructor\n\nSensor::Sensor(const char *sensorName, const uint8_t numReturnedVars,\n\n uint32_t warmUpTime_ms, uint32_t stabilizationTime_ms, uint32_t measurementTime_ms,\n\n int8_t powerPin, int8_t dataPin, uint8_t measurementsToAverage)\n", "file_path": "src/SensorBase.cpp", "rank": 92, "score": 10.815179032717628 }, { "content": " : dataPublisher(baseLogger, inClient, sendEveryX, sendOffset)\n\n{\n\n setMQTTKey(thingSpeakMQTTKey);\n\n setChannelID(thingSpeakChannelID);\n\n setChannelKey(thingSpeakChannelKey);\n\n // MS_DBG(F(\"ThingSpeakPublisher object created\"));\n\n}\n\n// Destructor\n\nThingSpeakPublisher::~ThingSpeakPublisher(){}\n\n\n\n\n\nvoid ThingSpeakPublisher::setMQTTKey(const char *thingSpeakMQTTKey)\n\n{\n\n _thingSpeakMQTTKey = thingSpeakMQTTKey;\n\n // MS_DBG(F(\"MQTT Key set!\"));\n\n}\n\n\n\n\n\nvoid ThingSpeakPublisher::setChannelID(const char *thingSpeakChannelID)\n\n{\n", "file_path": "src/publishers/ThingSpeakPublisher.cpp", "rank": 93, "score": 10.812328014474778 }, { "content": " uint8_t junkChars = _stream->available();\n\n if (junkChars)\n\n {\n\n MS_DBG(F(\"Dumping\"), junkChars, F(\"characters from MaxBotix stream buffer:\"));\n\n for (uint8_t i = 0; i < junkChars; i++)\n\n {\n\n #ifdef MS_MAXBOTIXSONAR_DEBUG\n\n DEBUGGING_SERIAL_OUTPUT.print(_stream->read());\n\n #else\n\n _stream->read();\n\n #endif\n\n }\n\n #ifdef MS_MAXBOTIXSONAR_DEBUG\n\n DEBUGGING_SERIAL_OUTPUT.println();\n\n #endif\n\n }\n\n\n\n // Check a measurement was *successfully* started (status bit 6 set)\n\n // Only go on to get a result if it was\n\n if (bitRead(_sensorStatus, 6))\n", "file_path": "src/sensors/MaxBotixSonar.cpp", "rank": 94, "score": 10.81138687077984 }, { "content": "// MQTT User Name\n\n// The user name doesn't actually mean anything for ThingSpeak\n\n#define THING_SPEAK_USER_NAME \"MS\"\n\n\n\n// MQTT Client Name\n\n// The client name doesn't actually mean anything for ThingSpeak\n\n#define THING_SPEAK_CLIENT_NAME \"MS\"\n\n\n\n// Included Dependencies\n\n#include \"ModSensorDebugger.h\"\n\n#undef MS_DEBUGGING_STD\n\n#include \"dataPublisherBase.h\"\n\n#include <PubSubClient.h>\n\n\n\n\n\n// ============================================================================\n\n// Functions for the EnviroDIY data portal receivers.\n\n// ============================================================================\n", "file_path": "src/publishers/ThingSpeakPublisher.h", "rank": 95, "score": 10.739933531600148 }, { "content": "AtlasParent::AtlasParent(int8_t powerPin, uint8_t i2cAddressHex, uint8_t measurementsToAverage,\n\n const char *sensorName, const uint8_t numReturnedVars,\n\n uint32_t warmUpTime_ms, uint32_t stabilizationTime_ms, uint32_t measurementTime_ms)\n\n : Sensor(sensorName, numReturnedVars,\n\n warmUpTime_ms, stabilizationTime_ms, measurementTime_ms,\n\n powerPin, -1, measurementsToAverage),\n\n _i2cAddressHex(i2cAddressHex)\n\n{}\n\nAtlasParent::~AtlasParent(){}\n\n\n\n\n\nString AtlasParent::getSensorLocation(void)\n\n{\n\n String address = F(\"I2C_0x\");\n\n address += String(_i2cAddressHex, HEX);\n\n return address;\n\n}\n\n\n\n\n\nbool AtlasParent::setup(void)\n", "file_path": "src/sensors/AtlasParent.cpp", "rank": 96, "score": 10.723655853466227 }, { "content": " virtual void powerUp(void) override;\n\n virtual void powerDown(void) override;\n\n\n\n virtual bool addSingleMeasurementResult(void);\n\n\n\nprivate:\n\n yosemitech sensor;\n\n yosemitechModel _model;\n\n byte _modbusAddress;\n\n Stream* _stream;\n\n int8_t _RS485EnablePin;\n\n int8_t _powerPin2;\n\n};\n\n\n\n#endif // Header Guard\n", "file_path": "src/sensors/YosemitechParent.h", "rank": 97, "score": 10.633412473811397 }, { "content": " int16_t signalQual = -9999;\n\n percent = -9999;\n\n rssi = -9999;\n\n\n\n // The WiFi XBee needs to make an actual TCP connection and get some sort\n\n // of response on that connection before it knows the signal quality.\n\n // Connecting to the Google DNS servers - this doesn't really work\n\n // MS_DBG(F(\"Opening connection to check connection strength...\"));\n\n // bool usedGoogle = false;\n\n // if (!gsmModem.gotIPforSavedHost())\n\n // {\n\n // usedGoogle = true;\n\n // IPAddress ip(8, 8, 8, 8); // This is one of Google's IP's\n\n // gsmClient.stop();\n\n // success &= gsmClient.connect(ip, 80);\n\n // }\n\n // gsmClient.print('!'); // Need to send something before connection is made\n\n // delay(100); // Need this delay! Can get away with 50, but 100 is safer.\n\n\n\n MS_DBG(F(\"Opening connection to NIST to check connection strength...\"));\n", "file_path": "src/modems/DigiXBeeWifi.cpp", "rank": 98, "score": 10.522345503499363 }, { "content": "/*\n\n *DreamHostPublisher.cpp\n\n *This file is part of the EnviroDIY modular sensors library for Arduino\n\n *\n\n *Initial library developement done by Sara Damiano ([email protected]).\n\n *\n\n *This file is for the EnviroDIY logging functions - ie, sending get requests to DreamHost\n\n*/\n\n\n\n#include \"DreamHostPublisher.h\"\n\n\n\n\n\n// ============================================================================\n\n// Functions for the SWRC Sensors DreamHost data receivers.\n\n// ============================================================================\n\n\n\n// Constant portions of the requests\n\nconst char *DreamHostPublisher::dreamhostHost = \"swrcsensors.dreamhosters.com\";\n\nconst int DreamHostPublisher::dreamhostPort = 80;\n\nconst char *DreamHostPublisher::loggerTag = \"?LoggerID=\";\n", "file_path": "src/publishers/DreamHostPublisher.cpp", "rank": 99, "score": 10.488442831837137 } ]
C++
third_party/blink/renderer/core/layout/ng/ng_relative_utils_test.cc
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
#include "third_party/blink/renderer/core/layout/ng/ng_relative_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/core/layout/geometry/physical_offset.h" #include "third_party/blink/renderer/core/layout/geometry/physical_size.h" #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { namespace { const LayoutUnit kLeft{3}; const LayoutUnit kRight{5}; const LayoutUnit kTop{7}; const LayoutUnit kBottom{9}; const LayoutUnit kAuto{-1}; const LayoutUnit kZero{0}; class NGRelativeUtilsTest : public testing::Test { protected: void SetUp() override { style_ = ComputedStyle::CreateInitialStyleSingleton(); style_->SetPosition(EPosition::kRelative); } void SetTRBL(LayoutUnit top, LayoutUnit right, LayoutUnit bottom, LayoutUnit left) { style_->SetTop(top == kAuto ? Length::Auto() : Length::Fixed(top.ToInt())); style_->SetRight(right == kAuto ? Length::Auto() : Length::Fixed(right.ToInt())); style_->SetBottom(bottom == kAuto ? Length::Auto() : Length::Fixed(bottom.ToInt())); style_->SetLeft(left == kAuto ? Length::Auto() : Length::Fixed(left.ToInt())); } scoped_refptr<ComputedStyle> style_; LogicalSize container_size_; }; TEST_F(NGRelativeUtilsTest, HorizontalTB) { LogicalOffset offset; SetTRBL(kAuto, kAuto, kAuto, kAuto); offset = ComputeRelativeOffset( *style_, {WritingMode::kHorizontalTb, TextDirection::kLtr}, container_size_); EXPECT_EQ(offset.inline_offset, kZero); EXPECT_EQ(offset.block_offset, kZero); SetTRBL(kTop, kRight, kBottom, kLeft); offset = ComputeRelativeOffset( *style_, {WritingMode::kHorizontalTb, TextDirection::kLtr}, container_size_); EXPECT_EQ(offset.inline_offset, kLeft); EXPECT_EQ(offset.block_offset, kTop); offset = ComputeRelativeOffset( *style_, {WritingMode::kHorizontalTb, TextDirection::kRtl}, container_size_); EXPECT_EQ(offset.inline_offset, kRight); EXPECT_EQ(offset.block_offset, kTop); SetTRBL(kAuto, kRight, kBottom, kAuto); offset = ComputeRelativeOffset( *style_, {WritingMode::kHorizontalTb, TextDirection::kLtr}, container_size_); EXPECT_EQ(offset.inline_offset, -kRight); EXPECT_EQ(offset.block_offset, -kBottom); } TEST_F(NGRelativeUtilsTest, VerticalRightLeft) { LogicalOffset offset; SetTRBL(kTop, kRight, kBottom, kLeft); offset = ComputeRelativeOffset( *style_, {WritingMode::kVerticalRl, TextDirection::kLtr}, container_size_); EXPECT_EQ(offset.inline_offset, kTop); EXPECT_EQ(offset.block_offset, kRight); offset = ComputeRelativeOffset( *style_, {WritingMode::kVerticalRl, TextDirection::kRtl}, container_size_); EXPECT_EQ(offset.inline_offset, kBottom); EXPECT_EQ(offset.block_offset, kRight); SetTRBL(kAuto, kAuto, kBottom, kLeft); offset = ComputeRelativeOffset( *style_, {WritingMode::kVerticalRl, TextDirection::kLtr}, container_size_); EXPECT_EQ(offset.inline_offset, -kBottom); EXPECT_EQ(offset.block_offset, -kLeft); } TEST_F(NGRelativeUtilsTest, VerticalLeftRight) { LogicalOffset offset; SetTRBL(kTop, kRight, kBottom, kLeft); offset = ComputeRelativeOffset( *style_, {WritingMode::kVerticalLr, TextDirection::kLtr}, container_size_); EXPECT_EQ(offset.inline_offset, kTop); EXPECT_EQ(offset.block_offset, kLeft); offset = ComputeRelativeOffset( *style_, {WritingMode::kVerticalLr, TextDirection::kRtl}, container_size_); EXPECT_EQ(offset.inline_offset, kBottom); EXPECT_EQ(offset.block_offset, kLeft); SetTRBL(kAuto, kRight, kBottom, kAuto); offset = ComputeRelativeOffset( *style_, {WritingMode::kVerticalLr, TextDirection::kLtr}, container_size_); EXPECT_EQ(offset.inline_offset, -kBottom); EXPECT_EQ(offset.block_offset, -kRight); } } }
#include "third_party/blink/renderer/core/layout/ng/ng_relative_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/core/layout/geometry/physical_offset.h" #include "third_party/blink/renderer/core/layout/geometry/physical_size.h" #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { namespace { const LayoutUnit kLeft{3}; const LayoutUnit kRight{5}; const LayoutUnit kTop{7}; const LayoutUnit kBottom{9}; const LayoutUnit kAuto{-1}; const LayoutUnit kZero{0}; class NGRelativeUtilsTest : public testing::Test { protected: void SetUp() override { style_ = ComputedStyle::CreateInitialStyleSingleton(); style_->SetPosition(EPosition::kRelative); }
scoped_refptr<ComputedStyle> style_; LogicalSize container_size_; }; TEST_F(NGRelativeUtilsTest, HorizontalTB) { LogicalOffset offset; SetTRBL(kAuto, kAuto, kAuto, kAuto); offset = ComputeRelativeOffset( *style_, {WritingMode::kHorizontalTb, TextDirection::kLtr}, container_size_); EXPECT_EQ(offset.inline_offset, kZero); EXPECT_EQ(offset.block_offset, kZero); SetTRBL(kTop, kRight, kBottom, kLeft); offset = ComputeRelativeOffset( *style_, {WritingMode::kHorizontalTb, TextDirection::kLtr}, container_size_); EXPECT_EQ(offset.inline_offset, kLeft); EXPECT_EQ(offset.block_offset, kTop); offset = ComputeRelativeOffset( *style_, {WritingMode::kHorizontalTb, TextDirection::kRtl}, container_size_); EXPECT_EQ(offset.inline_offset, kRight); EXPECT_EQ(offset.block_offset, kTop); SetTRBL(kAuto, kRight, kBottom, kAuto); offset = ComputeRelativeOffset( *style_, {WritingMode::kHorizontalTb, TextDirection::kLtr}, container_size_); EXPECT_EQ(offset.inline_offset, -kRight); EXPECT_EQ(offset.block_offset, -kBottom); } TEST_F(NGRelativeUtilsTest, VerticalRightLeft) { LogicalOffset offset; SetTRBL(kTop, kRight, kBottom, kLeft); offset = ComputeRelativeOffset( *style_, {WritingMode::kVerticalRl, TextDirection::kLtr}, container_size_); EXPECT_EQ(offset.inline_offset, kTop); EXPECT_EQ(offset.block_offset, kRight); offset = ComputeRelativeOffset( *style_, {WritingMode::kVerticalRl, TextDirection::kRtl}, container_size_); EXPECT_EQ(offset.inline_offset, kBottom); EXPECT_EQ(offset.block_offset, kRight); SetTRBL(kAuto, kAuto, kBottom, kLeft); offset = ComputeRelativeOffset( *style_, {WritingMode::kVerticalRl, TextDirection::kLtr}, container_size_); EXPECT_EQ(offset.inline_offset, -kBottom); EXPECT_EQ(offset.block_offset, -kLeft); } TEST_F(NGRelativeUtilsTest, VerticalLeftRight) { LogicalOffset offset; SetTRBL(kTop, kRight, kBottom, kLeft); offset = ComputeRelativeOffset( *style_, {WritingMode::kVerticalLr, TextDirection::kLtr}, container_size_); EXPECT_EQ(offset.inline_offset, kTop); EXPECT_EQ(offset.block_offset, kLeft); offset = ComputeRelativeOffset( *style_, {WritingMode::kVerticalLr, TextDirection::kRtl}, container_size_); EXPECT_EQ(offset.inline_offset, kBottom); EXPECT_EQ(offset.block_offset, kLeft); SetTRBL(kAuto, kRight, kBottom, kAuto); offset = ComputeRelativeOffset( *style_, {WritingMode::kVerticalLr, TextDirection::kLtr}, container_size_); EXPECT_EQ(offset.inline_offset, -kBottom); EXPECT_EQ(offset.block_offset, -kRight); } } }
void SetTRBL(LayoutUnit top, LayoutUnit right, LayoutUnit bottom, LayoutUnit left) { style_->SetTop(top == kAuto ? Length::Auto() : Length::Fixed(top.ToInt())); style_->SetRight(right == kAuto ? Length::Auto() : Length::Fixed(right.ToInt())); style_->SetBottom(bottom == kAuto ? Length::Auto() : Length::Fixed(bottom.ToInt())); style_->SetLeft(left == kAuto ? Length::Auto() : Length::Fixed(left.ToInt())); }
function_block-full_function
[]
C++
v8bridge/userland/userland_class.hpp
QuartzTechnologies/v8bridge
5e2f2d6b93adae25295b88c0c4e0eb4f93e22057
#ifndef BOOST_PP_IS_ITERATING # ifndef v8bridge_userland_class_hpp # define v8bridge_userland_class_hpp # include <stdexcept> # include <v8bridge/detail/prefix.hpp> # include <v8bridge/conversion.hpp> # include <v8bridge/userland/userland_instance.hpp> # include <boost/preprocessor/repetition.hpp> # include <boost/preprocessor/iteration/iterate.hpp> # include <boost/shared_ptr.hpp> namespace v8 { namespace bridge { using namespace v8; class V8_DECL UserlandClass { public: UserlandClass(Isolate *isolationScope, Handle<Value> functionHandle) : m_isolationScope(isolationScope), m_function(isolationScope, Handle<Function>::Cast(functionHandle)) , m_instances(new TInstancesList()) { }; UserlandClass(Isolate *isolationScope, Handle<Function> functionHandle) : m_isolationScope(isolationScope), m_function(isolationScope, functionHandle) , m_instances(new TInstancesList()) { }; ~UserlandClass() { this->m_function.Reset(); for (TInstancesList::iterator it = this->m_instances->begin(); it != this->m_instances->end(); ++it) { (*it).reset(); } this->m_instances->clear(); } inline Local<Function> getCtorFunction() { return Local<Function>::New(this->m_isolationScope, this->m_function); } inline Local<Value> getHandle(std::string key) { EscapableHandleScope handle_scope(this->m_isolationScope); return handle_scope.Escape( this->getCtorFunction()->Get(String::NewFromUtf8(this->m_isolationScope, key.c_str())) ); } template <class TType> inline TType getValue(std::string key) { Local<Value> value = this->getCtorFunction()->Get(String::NewFromUtf8(this->m_isolationScope, key.c_str())); TType result; if (!JsToNative(this->m_isolationScope, result, value)) { std::stringstream io; io << "The requested variable (" << key << ")" << " does not match the specified TType (" << TypeId<TType>().name() << ")."; throw std::runtime_error(io.str()); } return result; } inline UserlandInstance *newInstance() { Handle<Value> argv[] = { }; Handle<Value> v8Instance = this->getCtorFunction()->NewInstance(0, argv); UserlandInstance *instance = new UserlandInstance(this->m_isolationScope, v8Instance); boost::shared_ptr<UserlandInstance> adapter(instance); this->m_instances->push_back(adapter); return instance; } template <class TResult> inline typename boost::disable_if< boost::is_same<TResult, void>, TResult >::type invoke() { HandleScope handle_scope(this->m_isolationScope); Local<Function> callback = this->getCtorFunction(); Handle<Value> argv[] = {}; TResult result; if (!JsToNative(this->m_isolationScope, result, callback->Call(callback, 0, argv))) { std::stringstream io; io << "The function returned value does not match the specified TResult (" << TypeId<TResult>().name() << ")."; throw std::runtime_error(io.str()); } return result; } template <class TResult> inline typename boost::enable_if< boost::is_same<TResult, void>, TResult >::type invoke() { HandleScope handle_scope(this->m_isolationScope); Local<Function> callback = this->getCtorFunction(); Handle<Value> argv[] = {}; callback->Call(callback, 0, argv); } inline Handle<Value> rawInvoke() { HandleScope handle_scope(this->m_isolationScope); Local<Function> callback = this->getCtorFunction(); Handle<Value> argv[] = {}; return callback->Call(callback, 0, argv); } # define BOOST_PP_ITERATION_PARAMS_1 (3, (1, V8_MAX_ARITY, <v8bridge/userland/userland_class.hpp>)) # include BOOST_PP_ITERATE() private: typedef std::list<boost::shared_ptr<UserlandInstance> > TInstancesList; Isolate *m_isolationScope; Persistent<Function> m_function; TInstancesList *m_instances; }; } } # endif #else # if BOOST_PP_ITERATION_DEPTH() == 1 # define N BOOST_PP_ITERATION() # define V8_BRIDGE_CALL_CONCAT_ARG(z, n, data) BOOST_PP_CAT(TClass, n) BOOST_PP_CAT(arg, n) # define V8_BRIDGE_CALL_CONVERT_TO_V8_ARG_TYPE(z, n, data) NativeToJs<BOOST_PP_CAT(TClass, n)>(this->m_isolationScope, BOOST_PP_CAT(arg, n)) template <BOOST_PP_ENUM_PARAMS(N, class TClass) > UserlandInstance *newInstance(BOOST_PP_ENUM(N, V8_BRIDGE_CALL_CONCAT_ARG, ~)) { Handle<Value> argv[] = { BOOST_PP_ENUM(N, V8_BRIDGE_CALL_CONVERT_TO_V8_ARG_TYPE, ~) }; Handle<Value> v8Instance = this->getCtorFunction()->NewInstance(N, argv); UserlandInstance *instance = new UserlandInstance(this->m_isolationScope, v8Instance); boost::shared_ptr<UserlandInstance> adapter(instance); this->m_instances->push_back(adapter); return instance; } template <class TResult, BOOST_PP_ENUM_PARAMS(N, class TClass) > inline typename boost::disable_if< boost::is_same<TResult, void>, TResult >::type invoke(BOOST_PP_ENUM(N, V8_BRIDGE_CALL_CONCAT_ARG, ~)) { HandleScope handle_scope(this->m_isolationScope); Local<Function> callback = this->getCtorFunction(); Handle<Value> argv[] = { BOOST_PP_ENUM(N, V8_BRIDGE_CALL_CONVERT_TO_V8_ARG_TYPE, ~) }; TResult result; if (!JsToNative(this->m_isolationScope, result, callback->Call(callback, N, argv))) { std::stringstream io; io << "The function returned value does not match the specified TResult (" << TypeId<TResult>().name() << ")."; throw std::runtime_error(io.str()); } return result; } template <class TResult, BOOST_PP_ENUM_PARAMS(N, class TClass) > inline typename boost::enable_if< boost::is_same<TResult, void>, TResult >::type invoke(BOOST_PP_ENUM(N, V8_BRIDGE_CALL_CONCAT_ARG, ~)) { HandleScope handle_scope(this->m_isolationScope); Local<Function> callback = this->getCtorFunction(); Handle<Value> argv[] = { BOOST_PP_ENUM(N, V8_BRIDGE_CALL_CONVERT_TO_V8_ARG_TYPE, ~) }; callback->Call(callback, N, argv); } template <BOOST_PP_ENUM_PARAMS(N, class TClass) > inline Handle<Value> rawInvoke(BOOST_PP_ENUM(N, V8_BRIDGE_CALL_CONCAT_ARG, ~)) { HandleScope handle_scope(this->m_isolationScope); Local<Function> callback = this->getCtorFunction(); Handle<Value> argv[] = { BOOST_PP_ENUM(N, V8_BRIDGE_CALL_CONVERT_TO_V8_ARG_TYPE, ~) }; return callback->Call(callback, N, argv); } # endif #endif
#ifndef BOOST_PP_IS_ITERATING # ifndef v8bridge_userland_class_hpp # define v8bridge_userland_class_hpp # include <stdexcept> # include <v8bridge/detail/prefix.hpp> # include <v8bridge/conversion.hpp> # include <v8bridge/userland/userland_instance.hpp> # include <boost/preprocessor/repetition.hpp> # include <boost/preprocessor/iteration/iterate.hpp> # include <boost/shared_ptr.hpp> namespace v8 { namespace bridge { using namespace v8; class V8_DECL UserlandClass { public: UserlandClass(Isolate *isolationScope, Handle<Value> functionHandle) : m_isolationScope(isolationScope), m_function(isolationScope, Handle<Function>::Cast(functionHandle)) , m_instances(new TInstancesList()) { }; UserlandClass(Isolate *isolationScope, Handle<Function> functionHandle) : m_isolationScope(isolationScope), m_function(isolationScope, functionHandle) , m_instances(new TInstancesList()) { }; ~UserlandClass() { this->m_function.Reset();
function returned value does not match the specified TResult (" << TypeId<TResult>().name() << ")."; throw std::runtime_error(io.str()); } return result; } template <class TResult, BOOST_PP_ENUM_PARAMS(N, class TClass) > inline typename boost::enable_if< boost::is_same<TResult, void>, TResult >::type invoke(BOOST_PP_ENUM(N, V8_BRIDGE_CALL_CONCAT_ARG, ~)) { HandleScope handle_scope(this->m_isolationScope); Local<Function> callback = this->getCtorFunction(); Handle<Value> argv[] = { BOOST_PP_ENUM(N, V8_BRIDGE_CALL_CONVERT_TO_V8_ARG_TYPE, ~) }; callback->Call(callback, N, argv); } template <BOOST_PP_ENUM_PARAMS(N, class TClass) > inline Handle<Value> rawInvoke(BOOST_PP_ENUM(N, V8_BRIDGE_CALL_CONCAT_ARG, ~)) { HandleScope handle_scope(this->m_isolationScope); Local<Function> callback = this->getCtorFunction(); Handle<Value> argv[] = { BOOST_PP_ENUM(N, V8_BRIDGE_CALL_CONVERT_TO_V8_ARG_TYPE, ~) }; return callback->Call(callback, N, argv); } # endif #endif
for (TInstancesList::iterator it = this->m_instances->begin(); it != this->m_instances->end(); ++it) { (*it).reset(); } this->m_instances->clear(); } inline Local<Function> getCtorFunction() { return Local<Function>::New(this->m_isolationScope, this->m_function); } inline Local<Value> getHandle(std::string key) { EscapableHandleScope handle_scope(this->m_isolationScope); return handle_scope.Escape( this->getCtorFunction()->Get(String::NewFromUtf8(this->m_isolationScope, key.c_str())) ); } template <class TType> inline TType getValue(std::string key) { Local<Value> value = this->getCtorFunction()->Get(String::NewFromUtf8(this->m_isolationScope, key.c_str())); TType result; if (!JsToNative(this->m_isolationScope, result, value)) { std::stringstream io; io << "The requested variable (" << key << ")" << " does not match the specified TType (" << TypeId<TType>().name() << ")."; throw std::runtime_error(io.str()); } return result; } inline UserlandInstance *newInstance() { Handle<Value> argv[] = { }; Handle<Value> v8Instance = this->getCtorFunction()->NewInstance(0, argv); UserlandInstance *instance = new UserlandInstance(this->m_isolationScope, v8Instance); boost::shared_ptr<UserlandInstance> adapter(instance); this->m_instances->push_back(adapter); return instance; } template <class TResult> inline typename boost::disable_if< boost::is_same<TResult, void>, TResult >::type invoke() { HandleScope handle_scope(this->m_isolationScope); Local<Function> callback = this->getCtorFunction(); Handle<Value> argv[] = {}; TResult result; if (!JsToNative(this->m_isolationScope, result, callback->Call(callback, 0, argv))) { std::stringstream io; io << "The function returned value does not match the specified TResult (" << TypeId<TResult>().name() << ")."; throw std::runtime_error(io.str()); } return result; } template <class TResult> inline typename boost::enable_if< boost::is_same<TResult, void>, TResult >::type invoke() { HandleScope handle_scope(this->m_isolationScope); Local<Function> callback = this->getCtorFunction(); Handle<Value> argv[] = {}; callback->Call(callback, 0, argv); } inline Handle<Value> rawInvoke() { HandleScope handle_scope(this->m_isolationScope); Local<Function> callback = this->getCtorFunction(); Handle<Value> argv[] = {}; return callback->Call(callback, 0, argv); } # define BOOST_PP_ITERATION_PARAMS_1 (3, (1, V8_MAX_ARITY, <v8bridge/userland/userland_class.hpp>)) # include BOOST_PP_ITERATE() private: typedef std::list<boost::shared_ptr<UserlandInstance> > TInstancesList; Isolate *m_isolationScope; Persistent<Function> m_function; TInstancesList *m_instances; }; } } # endif #else # if BOOST_PP_ITERATION_DEPTH() == 1 # define N BOOST_PP_ITERATION() # define V8_BRIDGE_CALL_CONCAT_ARG(z, n, data) BOOST_PP_CAT(TClass, n) BOOST_PP_CAT(arg, n) # define V8_BRIDGE_CALL_CONVERT_TO_V8_ARG_TYPE(z, n, data) NativeToJs<BOOST_PP_CAT(TClass, n)>(this->m_isolationScope, BOOST_PP_CAT(arg, n)) template <BOOST_PP_ENUM_PARAMS(N, class TClass) > UserlandInstance *newInstance(BOOST_PP_ENUM(N, V8_BRIDGE_CALL_CONCAT_ARG, ~)) { Handle<Value> argv[] = { BOOST_PP_ENUM(N, V8_BRIDGE_CALL_CONVERT_TO_V8_ARG_TYPE, ~) }; Handle<Value> v8Instance = this->getCtorFunction()->NewInstance(N, argv); UserlandInstance *instance = new UserlandInstance(this->m_isolationScope, v8Instance); boost::shared_ptr<UserlandInstance> adapter(instance); this->m_instances->push_back(adapter); return instance; } template <class TResult, BOOST_PP_ENUM_PARAMS(N, class TClass) > inline typename boost::disable_if< boost::is_same<TResult, void>, TResult >::type invoke(BOOST_PP_ENUM(N, V8_BRIDGE_CALL_CONCAT_ARG, ~)) { HandleScope handle_scope(this->m_isolationScope); Local<Function> callback = this->getCtorFunction(); Handle<Value> argv[] = { BOOST_PP_ENUM(N, V8_BRIDGE_CALL_CONVERT_TO_V8_ARG_TYPE, ~) }; TResult result; if (!JsToNative(this->m_isolationScope, result, callback->Call(callback, N, argv))) { std::stringstream io; io << "The
random
[ { "content": " class V8_DECL NativeClass : public NativeEndpoint\n\n {\n\n public:\n\n NativeClass(Isolate *isolationScope) : NativeEndpoint(isolationScope),\n\n m_ctor(new NativeCtor(isolationScope)),\n\n m_methods(new TMethodsMap()),\n\n m_staticMethods(new TMethodsMap()),\n\n m_accessors(new TMethodsMap()),\n\n m_staticAccessors(new TMethodsMap()),\n\n m_gc(new GC(isolationScope)),\n\n m_customDtorHandler(NULL)\n\n {\n\n HandleScope handle_scope(isolationScope);\n\n \n\n this->m_isAbstract = false;\n\n Local<FunctionTemplate> templ = FunctionTemplate::New(\n\n /* isolate: */this->m_isolationScope,\n\n /* callback (used as constructor) */ &NativeClass<TClass>::internalConstructorInvocationCallback,\n\n /* data: */External::New(isolationScope, (void *)this));\n\n \n", "file_path": "v8bridge/native/native_class.hpp", "rank": 0, "score": 124495.73461887747 }, { "content": " class ctor : public ctor_base<ctor<V8_BRIDGE_OVERLOAD_ARGS> >\n\n {\n\n private:\n\n typedef ctor_base<ctor<V8_BRIDGE_OVERLOAD_ARGS> > base;\n\n public:\n\n ctor() { }\n\n \n\n \n\n typedef detail::type_list<V8_BRIDGE_OVERLOAD_ARGS> signature_;\n\n \n\n typedef detail::is_optional<\n\n typename mpl::eval_if<\n\n mpl::empty<signature_>\n\n , mpl::false_\n\n , mpl::back<signature_>\n\n >::type\n\n > back_is_optional;\n\n \n\n typedef typename mpl::eval_if<\n\n back_is_optional\n", "file_path": "v8bridge/detail/ctor.hpp", "rank": 1, "score": 115683.58796522274 }, { "content": " class V8_DECL NativeFunction : public NativeEndpoint\n\n {\n\n public:\n\n NativeFunction(Isolate *isolationScope) : NativeEndpoint(isolationScope), m_overloads(new TOverloadsList())\n\n {\n\n HandleScope handle_scope(isolationScope);\n\n Local<FunctionTemplate> templ = FunctionTemplate::New(\n\n this->m_isolationScope,\n\n &NativeFunction::internalFunctionInvocationCallback,\n\n External::New(this->m_isolationScope, this)\n\n );\n\n \n\n this->m_templateDecl = new Eternal<FunctionTemplate>(this->m_isolationScope, templ);\n\n \n\n }\n\n \n\n ~NativeFunction()\n\n {\n\n for (TOverloadsList::iterator it = this->m_overloads->begin(); it != this->m_overloads->end(); ++it)\n\n {\n", "file_path": "v8bridge/native/native_function.hpp", "rank": 3, "score": 108854.82887776976 }, { "content": " class V8_DECL NativeCtor : public NativeFunction\n\n {\n\n public:\n\n NativeCtor(Isolate *isolationScope) : NativeFunction(isolationScope)\n\n {\n\n }\n\n \n\n template <class TFunction, class TSignature>\n\n inline NativeFunction *addOverload(TFunction functionPointer, TSignature signature)\n\n {\n\n /* Instead of registering NativeFunctionConcrete, we should register NativeCtorConcrete */\n\n NativeCtorConcrete<TFunction, TSignature> *ctorDecl = new NativeCtorConcrete<TFunction, TSignature>(this->m_isolationScope, functionPointer, signature);\n\n \n\n boost::shared_ptr< NativeCtorConcrete<TFunction, TSignature> > adapter(ctorDecl);\n\n this->m_overloads->push_back(adapter);\n\n \n\n return this;\n\n }\n\n };\n\n }\n\n}\n\n\n\n#endif\n", "file_path": "v8bridge/native/native_ctor.hpp", "rank": 4, "score": 108854.82887776976 }, { "content": " class V8_DECL NativeFunctionConcreteBase : public NativeEndpoint\n\n {\n\n public:\n\n NativeFunctionConcreteBase(Isolate *isolationScope)\n\n : NativeEndpoint(isolationScope) { }\n\n \n\n virtual bool canInvokeCall(const FunctionCallbackInfo<Value>& info) = 0;\n\n virtual void invokeCall(const FunctionCallbackInfo<Value>& info) = 0;\n\n virtual std::string getFormattedSignature() = 0;\n\n virtual bool isDirectArgsFunction() = 0;\n\n };\n\n \n\n //-------------------------------------------------\n\n // Generic implementation\n\n //-------------------------------------------------\n\n template <class TFunction, class TSignature>\n", "file_path": "v8bridge/native/native_function_concrete.hpp", "rank": 5, "score": 101631.17078570646 }, { "content": " class V8_DECL NativeFunctionConcrete : public NativeFunctionConcreteBase\n\n {\n\n public:\n\n NativeFunctionConcrete(Isolate *isolationScope, TFunction function, TSignature signature)\n\n : NativeFunctionConcreteBase(isolationScope), m_function(function), m_signature(signature)\n\n {\n\n \n\n }\n\n \n\n inline bool canInvokeCall(const FunctionCallbackInfo<Value>& info)\n\n {\n\n return this->forwardCanInvokeCall<TSignature>(info);\n\n }\n\n \n\n inline void invokeCall(const FunctionCallbackInfo<Value>& info)\n\n {\n\n this->forwardInvokeCall<TSignature>(info);\n\n }\n\n \n\n inline std::string getFormattedSignature()\n", "file_path": "v8bridge/native/native_function_concrete.hpp", "rank": 6, "score": 99531.42147604769 }, { "content": " class V8_DECL NativeCtorConcrete : /*public NativeFunctionConcrete<TFunction, TSignature>,*/ public NativeFunctionConcreteBase\n\n {\n\n public:\n\n NativeCtorConcrete(Isolate *isolationScope, TFunction function, TSignature signature)\n\n : NativeFunctionConcreteBase(isolationScope), m_function(function), m_signature(signature)\n\n {\n\n \n\n }\n\n \n\n inline bool canInvokeCall(const FunctionCallbackInfo<Value>& info)\n\n {\n\n return this->forwardCanInvokeCall<TSignature>(info);\n\n }\n\n \n\n inline void invokeCall(const FunctionCallbackInfo<Value>& info)\n\n {\n\n this->forwardInvokeCall<TSignature>(info);\n\n }\n\n \n\n inline std::string getFormattedSignature()\n", "file_path": "v8bridge/native/native_ctor_concrete.hpp", "rank": 7, "score": 91700.30334785064 }, { "content": " class V8_DECL GC\n\n {\n\n public:\n\n GC(Isolate *isolate) : m_isolationScope(isolate), m_map(new TCleanupMap()) { }\n\n ~GC()\n\n {\n\n this->collect(); // collect and release any remaining instances on the cleanup list.\n\n }\n\n \n\n typedef void (*TDtor)(void *ptr);\n\n \n\n /**\n\n * Queue the given object instance in the internal GC clearup instances list.\n\n * For more details about this method, see the second overload above.\n\n *\n\n * Note that this method make use of the GCGenericInstanceDestructor<TType>::dtor destructor implementation\n\n * in order to remove the object.\n\n * This is the default and typical implementation for destructors, which only deletes the instance from the memoory.\n\n * Thus, this implementation will fire the instance class dtor.\n\n */\n", "file_path": "v8bridge/detail/internal_gc.hpp", "rank": 8, "score": 84288.15763339221 }, { "content": " class V8_DECL ScriptingEngine\n\n {\n\n public:\n\n ScriptingEngine(bool registerBuiltinDeclaration = true) :\n\n m_registeredContractsMap(new TNativeContractMap()),\n\n m_registeredNativeClassesMap(new TNativeClassesContractMap())\n\n {\n\n //-------------------------------------------------\n\n // Create new isolation scope\n\n //-------------------------------------------------\n\n this->m_activeIsolationScope = Isolate::GetCurrent();\n\n //this->m_activeIsolationScope->Enter();\n\n \n\n //-------------------------------------------------\n\n // Create a temp scope\n\n //-------------------------------------------------\n\n HandleScope handle_scope(this->m_activeIsolationScope);\n\n \n\n //-------------------------------------------------\n\n // Create the active context\n", "file_path": "v8bridge/scripting_engine.hpp", "rank": 9, "score": 84288.15763339221 }, { "content": " class V8_DECL UserlandInstance\n\n {\n\n public:\n\n UserlandInstance(Isolate *isolationScope, Handle<Value> objectHandle) :\n\n m_isolationScope(isolationScope), m_object(isolationScope, Handle<Object>::Cast(objectHandle)) // will result in an error if the handle is not a object\n\n {\n\n };\n\n \n\n UserlandInstance(Isolate *isolationScope, Handle<Object> objectHandle) :\n\n m_isolationScope(isolationScope), m_object(isolationScope, objectHandle)\n\n {\n\n \n\n };\n\n \n\n ~UserlandInstance()\n\n {\n\n this->m_object.Reset();\n\n }\n\n \n\n inline Local<Object> getObjectHandle() { return Local<Object>::New(this->m_isolationScope, this->m_object); }\n", "file_path": "v8bridge/userland/userland_instance.hpp", "rank": 10, "score": 81962.15222658451 }, { "content": " class V8_DECL NativeEndpoint\n\n {\n\n public:\n\n inline Isolate *getIsolationScope() { return this->m_isolationScope; }\n\n protected:\n\n NativeEndpoint(Isolate *isolationScope) : m_isolationScope(isolationScope) { }\n\n Isolate *m_isolationScope;\n\n \n\n template <class TSignature>\n\n struct resolve_directly_passed_args : boost::is_same<\n\n const v8::FunctionCallbackInfo<Value> &,\n\n typename boost::mpl::at_c<TSignature, 1>::type > {};\n\n };\n\n }\n\n}\n\n\n\n#endif /* defined(__V8Bridge__NativeEndpoint__) */\n", "file_path": "v8bridge/native/native_endpoint.hpp", "rank": 11, "score": 81962.15222658451 }, { "content": " class V8_DECL UserlandFunction\n\n {\n\n public:\n\n //=======================================================================\n\n // ctor & dtor\n\n //=======================================================================\n\n \n\n UserlandFunction(Isolate *isolationScope, Handle<Value> functionHandle) :\n\n m_isolationScope(isolationScope), m_function(isolationScope, Handle<Function>::Cast(functionHandle)) // will result in an error if the handle is not a function\n\n {\n\n };\n\n \n\n UserlandFunction(Isolate *isolationScope, Handle<Function> functionHandle) :\n\n m_isolationScope(isolationScope), m_function(isolationScope, Handle<Function>::Cast(functionHandle))\n\n {\n\n \n\n };\n\n \n\n ~UserlandFunction()\n\n {\n", "file_path": "v8bridge/userland/userland_function.hpp", "rank": 12, "score": 81962.15222658451 }, { "content": "class Car\n\n{\n\npublic:\n\n Car() : m_color(\"\"), m_km(0) { };\n\n Car(std::string color) : m_color(color), m_km(0) { };\n\n Car(int km) : m_color(\"\"), m_km(km) { };\n\n Car(std::string color, int km) : m_color(color), m_km(km) { };\n\n \n\n Car(const FunctionCallbackInfo<Value> &info)\n\n {\n\n /* This constructor requires at least one argument.\n\n Calling Signature:\n\n Car(string format [, int km [, int ... ]] )\n\n \n\n It can reminds us the add() method in the functions_v8_args.cpp example.\n\n */\n\n \n\n if (info.Length() == 0)\n\n {\n\n throw std::runtime_error(\"The add function must receive at least one argument.\");\n", "file_path": "samples/cpp_classes_ctor.cpp", "rank": 13, "score": 54103.593479696916 }, { "content": "class Car\n\n{\n\npublic:\n\n Car() { };\n\n \n\n void setColor(std::string color)\n\n {\n\n this->m_color = color;\n\n }\n\n \n\n std::string getColor()\n\n {\n\n return this->m_color;\n\n }\n\n \n\n void drive()\n\n {\n\n std::cout << \"** I'm driving a \" << this->getColor() << \" car! **\" << std::endl;\n\n }\n\nprivate:\n", "file_path": "samples/cpp_classes_basics.cpp", "rank": 14, "score": 54103.593479696916 }, { "content": "class FileUtils\n\n{\n\npublic:\n\n static bool FileExists(std::string const filePath)\n\n {\n\n std::ifstream f(filePath.c_str());\n\n if (f.good()) {\n\n f.close();\n\n return true;\n\n } else {\n\n f.close();\n\n return false;\n\n }\n\n };\n\n \n\n static std::string Read(std::string const filePath)\n\n {\n\n std::ifstream f(filePath.c_str());\n\n if (f.good()) {\n\n return \"\";\n", "file_path": "samples/cpp_classes_static.cpp", "rank": 15, "score": 52901.14552443195 }, { "content": "\t\tclass TypeId\n\n\t\t{\n\n\t\tpublic:\n\n\t\t\tTypeId() { }\n\n \n\n\t\t\tbool operator!=(TypeId const& other) const\n\n\t\t\t{\n\n\t\t\t\treturn this->name() != other->name();\n\n\t\t\t}\n\n \n\n\t\t\tbool operator==(TypeId const& other) const\n\n\t\t\t{\n\n\t\t\t\treturn this->name() == other->name();\n\n\t\t\t}\n\n \n\n\t\t\tinline std::string name() const\n\n\t\t\t{\n\n\t\t\t\treturn this->getClassName(__FUNCTION__);\n\n\t\t\t}\n\n \n", "file_path": "v8bridge/detail/typeid.hpp", "rank": 16, "score": 44433.99412122423 }, { "content": " class TypeId\n\n {\n\n public:\n\n TypeId() : id(&typeid(TClass))\n\n {}\n\n \n\n bool operator!=(TypeId const& other) const\n\n {\n\n return *id != *other.id;\n\n }\n\n \n\n bool operator==(TypeId const& other) const\n\n {\n\n return *id == *other.id;\n\n }\n\n \n\n inline char const* name() const\n\n {\n\n return id->name();\n\n }\n\n \n\n private:\n\n type_info const* id;\n\n };\n\n#endif\n\n }\n\n}\n\n\n\n#endif\n", "file_path": "v8bridge/detail/typeid.hpp", "rank": 17, "score": 44433.99412122423 }, { "content": " class ctor; // forward declaration\n\n \n\n \n\n template <V8_BRIDGE_OVERLOAD_TYPES_WITH_DEFAULT_VALUE>\n\n struct optional; // forward declaration\n\n \n\n namespace detail\n\n {\n\n template <class TClass>\n\n struct is_optional\n\n : mpl::false_\n\n {};\n\n \n\n template <V8_BRIDGE_OVERLOAD_TYPES>\n\n struct is_optional<optional<V8_BRIDGE_OVERLOAD_ARGS> >\n\n : mpl::true_\n\n {};\n\n \n\n template <class S>\n\n struct step_backward : mpl::iterator_range<\n", "file_path": "v8bridge/detail/ctor.hpp", "rank": 18, "score": 40151.62982851073 }, { "content": "// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n\n/**\n\n * This is an sample file for v8bridge API interaction.\n\n *\n\n * This file provides a simple demonstration of defining JS \"class\" and accessing it by C++ using the Userland API.\n\n * In this demo, we're declaring a simple Car JS class. Then, by using UserlandClass we're creating a new instance,\n\n * calling it's method(s) and changing its ivar value.\n\n */\n\n\n\n#include <iostream>\n\n#include <sstream>\n\n\n\n#define V8BRIDGE_DEBUG 1\n\n#include <v8bridge/v8bridge.hpp>\n", "file_path": "samples/js_classes.cpp", "rank": 19, "score": 33442.31354356685 }, { "content": "\n\nusing namespace v8;\n\nusing namespace v8::bridge;\n\n\n\nint main(int argc, const char * argv[])\n\n{\n\n /* Create a scripting engine */\n\n ScriptingEngine *engine = new ScriptingEngine();\n\n HandleScope handle_scope(engine->getActiveIsolationScope());\n\n \n\n /* Create a new \"JS class\" */\n\n std::stringstream io;\n\n io << \"var Car = (function () {\" << std::endl;\n\n io << \" function Car(color) {\" << std::endl;\n\n io << \" this.color = color;\" << std::endl;\n\n io << \" };\" << std::endl;\n\n io << \" Car.prototype.getColor = function () {\" << std::endl;\n\n io << \" return this.color;\" << std::endl;\n\n io << \" };\" << std::endl;\n\n io << \" Car.prototype.setColor = function (color) {\" << std::endl;\n", "file_path": "samples/js_classes.cpp", "rank": 20, "score": 33439.50098724983 }, { "content": " io << \" this.color = color;\" << std::endl;\n\n io << \" };\" << std::endl;\n\n io << \" Car.prototype.drive = function () {\" << std::endl;\n\n io << \" return 'I\\\\'m driving in ' + this.color + ' car!';\" << std::endl;\n\n io << \" };\" << std::endl;\n\n io << \" return Car;\" << std::endl;\n\n io << \"})();\" << std::endl;\n\n \n\n engine->execute(io.str(), /* fileName: */ \"car.js\");\n\n \n\n /** To access the JS class, we should use the UserlandClass class which\n\n provides us basic interface for interaction with the defined class.\n\n \n\n Note that UserlandClass ctor requires an Handle<Function> (there's an overload for Handle<Value>)\n\n which represents the JS class ctor. To get it, as shown below, we can use the ScriptingEngine::getFromGlobalScope method,\n\n which retrives an handle that's been stored on the global scope. The handle we wish to request is the class representing variable - Car. **/\n\n UserlandClass *carJsClass = new UserlandClass(engine->getActiveIsolationScope(), engine->getFromGlobalScope(\"Car\"));\n\n \n\n /** Now, lets create a new instance of the JS class. The C++ type that will hold the created type\n\n is UserlandInstance. UserlandInstance provides us simple interface to execute instance-related actions.\n", "file_path": "samples/js_classes.cpp", "rank": 21, "score": 33433.5235010281 }, { "content": " \n\n Note that the created instance is been stored as boost::shared_ptr in UserlandClass and will be released when\n\n the UserlandClass object will be disposed. */\n\n UserlandInstance *carInstance = carJsClass->newInstance( /* color: */ \"Red\");\n\n \n\n // Print the current driving state (driving with red car, because of JS ctor)\n\n std::cout << carInstance->invoke<std::string>(\"drive\") << std::endl;\n\n \n\n // Set the car color using the defined setter\n\n carInstance->invoke<void>(\"setColor\", \"Blue\");\n\n \n\n // Print the current driving state (driving with blue car)\n\n std::cout << carInstance->invoke<std::string>(\"drive\") << std::endl;\n\n \n\n // Set the car color by (in a very hacky way!) accessing the class member directly\n\n carInstance->setValue(\"color\", \"Yellow\");\n\n \n\n // Print the current driving state (driving with yellow car)\n\n std::cout << carInstance->invoke<std::string>(\"drive\") << std::endl;\n\n \n\n /* Free */\n\n delete carJsClass;\n\n delete engine;\n\n \n\n /* Done. */\n\n return 0;\n\n}\n", "file_path": "samples/js_classes.cpp", "rank": 22, "score": 33432.36024523415 }, { "content": "// Copyright 2014 Quartz Technologies, Ltd. All rights reserved.\n\n// Redistribution and use in source and binary forms, with or without\n\n// modification, are permitted provided that the following conditions are\n\n// met:\n\n//\n\n// * Redistributions of source code must retain the above copyright\n\n// notice, this list of conditions and the following disclaimer.\n\n// * Redistributions in binary form must reproduce the above\n\n// copyright notice, this list of conditions and the following\n\n// disclaimer in the documentation and/or other materials provided\n\n// with the distribution.\n\n// * Neither the name of Quartz Technologies Ltd. nor the names of its\n\n// contributors may be used to endorse or promote products derived\n\n// from this software without specific prior written permission.\n\n//\n\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n", "file_path": "samples/js_classes.cpp", "rank": 23, "score": 33431.85850182063 }, { "content": "\n\nusing namespace v8;\n\nusing namespace v8::bridge;\n\n\n\nint add(const FunctionCallbackInfo<Value> &info)\n\n{\n\n if (info.Length() == 0)\n\n {\n\n throw std::runtime_error(\"The add function must receive at least one argument.\");\n\n }\n\n \n\n int result = 0;\n\n for (int i = 0; i < info.Length(); i++)\n\n {\n\n if (!info[i]->IsInt32())\n\n {\n\n throw std::runtime_error(\"All of the function passed arguments should be integers.\");\n\n }\n\n \n\n result += info[i]->Int32Value();\n", "file_path": "samples/functions_v8_args.cpp", "rank": 24, "score": 33017.783390380675 }, { "content": "// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n\n/**\n\n * This is an sample file for v8bridge API interaction.\n\n *\n\n * This file provides a simple demonstration of accepting directly V8 args info.\n\n * In this demo, we're declaring a simple add function. However, we're not using the Conversion API\n\n * to convert the args into native types. We're accepting raw-V8 args and adding all of them.\n\n */\n\n\n\n#include <iostream>\n\n#include <sstream>\n\n\n\n#define V8BRIDGE_DEBUG 1\n\n#include <v8bridge/v8bridge.hpp>\n", "file_path": "samples/functions_v8_args.cpp", "rank": 25, "score": 33017.376043192 }, { "content": "// Copyright 2014 Quartz Technologies, Ltd. All rights reserved.\n\n// Redistribution and use in source and binary forms, with or without\n\n// modification, are permitted provided that the following conditions are\n\n// met:\n\n//\n\n// * Redistributions of source code must retain the above copyright\n\n// notice, this list of conditions and the following disclaimer.\n\n// * Redistributions in binary form must reproduce the above\n\n// copyright notice, this list of conditions and the following\n\n// disclaimer in the documentation and/or other materials provided\n\n// with the distribution.\n\n// * Neither the name of Quartz Technologies Ltd. nor the names of its\n\n// contributors may be used to endorse or promote products derived\n\n// from this software without specific prior written permission.\n\n//\n\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n", "file_path": "samples/functions_v8_args.cpp", "rank": 26, "score": 33008.34155101271 }, { "content": " }\n\n \n\n return result;\n\n}\n\n\n\nint main(int argc, const char * argv[])\n\n{\n\n /* Create a scripting engine */\n\n ScriptingEngine *engine = new ScriptingEngine();\n\n \n\n /* Create the add function */\n\n NativeFunction *addFunction = new NativeFunction(engine->getActiveIsolationScope());\n\n addFunction->addOverload(add);\n\n engine->exposeFunction(addFunction, \"add\");\n\n \n\n /* Execute! */ \n\n std::cout << \"add(1): \" << engine->eval<int>(\"add(1)\") << std::endl;\n\n std::cout << \"add(1, 1): \" << engine->eval<int>(\"add(1, 1)\") << std::endl;\n\n std::cout << \"add(1, 2): \" << engine->eval<int>(\"add(1, 2)\") << std::endl;\n\n std::cout << \"add(1, 2, 3): \" << engine->eval<int>(\"add(1, 2, 3)\") << std::endl;\n", "file_path": "samples/functions_v8_args.cpp", "rank": 27, "score": 33002.610990873545 }, { "content": " std::cout << \"add(1, 2, 2, 3): \" << engine->eval<int>(\"add(1, 2, 2, 3)\") << std::endl;\n\n \n\n /* Free */\n\n delete addFunction;\n\n delete engine;\n\n \n\n /* Done. */\n\n return 0;\n\n}\n", "file_path": "samples/functions_v8_args.cpp", "rank": 28, "score": 33002.610990873545 }, { "content": "#include <sstream>\n\n#include <fstream>\n\n\n\n#define V8BRIDGE_DEBUG 1\n\n#include <v8bridge/v8bridge.hpp>\n\n\n\nusing namespace v8;\n\nusing namespace v8::bridge;\n\n\n\n/* Declare a file-utils class */\n", "file_path": "samples/cpp_classes_static.cpp", "rank": 29, "score": 31799.012713414428 }, { "content": "// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n\n/**\n\n * This is an sample file for v8bridge API interaction.\n\n *\n\n * This file provides a simple demonstration of binding a C++ class to JS.\n\n * In this demo, we're declaring a simple Car with one ivar (m_color) and three methods - getter, setter and standard method.\n\n * Then, we're expsoing the Car class using v8bridge NativeClass interface.\n\n * Finally, we're creating in JS a new instance of Car, setting its color using the \"color\" property and invoking drive().\n\n * \n\n * Note: when \"delete carClass;\" is been called, the \"car\" instance that we've defined in JS is been removed\n\n * by v8bridge internal GC. For more details on why is this happing and why we need this, see internal_gc.hpp.\n\n */\n\n\n\n#include <iostream>\n\n#include <sstream>\n\n\n\n#define V8BRIDGE_DEBUG 1\n\n#include <v8bridge/v8bridge.hpp>\n\n\n\nusing namespace v8;\n\nusing namespace v8::bridge;\n\n\n\n/* Declare a simple class */\n", "file_path": "samples/cpp_classes_basics.cpp", "rank": 30, "score": 31797.11984287624 }, { "content": "#include <v8bridge/native/native_function.hpp>\n\n#include <v8bridge/native/native_ctor.hpp>\n\n#include <v8bridge/detail/internal_gc.hpp>\n\n#include <v8bridge/conversion.hpp>\n\n\n\n#include <boost/shared_ptr.hpp>\n\n#include <boost/mpl/if.hpp>\n\n#include <boost/type_traits/is_same.hpp>\n\n\n\nnamespace v8\n\n{\n\n namespace bridge\n\n {\n\n /**\n\n * Specific class used to provide interface for binding C++ classes to JS function (classes).\n\n * This class also automaticly connects the C++ type with JsToNative and NativeToJs conversion API\n\n * so the class instances can be passed between C++ and JS.\n\n *\n\n * Simple usage:\n\n * C++:\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 32, "score": 31792.842402340146 }, { "content": "/* Macro shortcut that evaluates a given script and echo its result */\n\n#define JS_PRINT_HANDLE(jsCode) do \\\n\n { \\\n\n String::Utf8Value utf8(engine->v8Eval(jsCode)); \\\n\n std::cout << *utf8 << std::endl; \\\n\n } while (false);\n\n\n\nusing namespace v8;\n\nusing namespace v8::bridge;\n\n\n\n/* Declare a simple class */\n", "file_path": "samples/cpp_classes_ctor.cpp", "rank": 33, "score": 31792.231607752416 }, { "content": "// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n\n/**\n\n * This is an sample file for v8bridge API interaction.\n\n *\n\n * This file provides a simple demonstration of binding a C++ class to JS.\n\n * In this demo, we're defining 4 constructors in the Car class. Then, we're exposing them to JS and using them.\n\n */\n\n\n\n#include <iostream>\n\n#include <sstream>\n\n\n\n#define V8BRIDGE_DEBUG 1\n\n#include <v8bridge/v8bridge.hpp>\n\n\n", "file_path": "samples/cpp_classes_ctor.cpp", "rank": 35, "score": 31790.02486793672 }, { "content": " \n\n if (self->m_isAbstract)\n\n {\n\n std::stringstream io;\n\n io << \"Could not create an instance of the class \" << TypeId<typename TypeResolver<TClass>::type >().name() << \" since it was marked as abstract class.\" << std::endl;\n\n#if V8BRIDGE_DEBUG\n\n io << \"In order to allow the class instantiation, you should call the NativeClass<TClass>::declareAsAbstract with false argument.\";\n\n#endif\n\n self->m_isolationScope->ThrowException(\n\n v8::Exception::TypeError(String::NewFromUtf8(self->m_isolationScope, io.str().c_str()))\n\n );\n\n return;\n\n }\n\n \n\n //-------------------------------------------------\n\n // We got two cases to deal with.\n\n // - The first one is in which we're trying to instansiate plain new object (e.g. from JS)\n\n // In this case, we should allocate a new coresponding CPP object (i.e. \"var p = new Point(x, y);\" in JS will allocate new CPP Point).\n\n // - The second one is case in which we're trying to Convert Existing CPP Object to JS (i.e. by using NativeToJs interface).\n\n // in this case we still should create a new JS object, but We Shouldn't Allocate a new CPP object but using the Existing one.\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 36, "score": 31788.449120047142 }, { "content": "// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n\n#ifndef v8bridge_native_class_hpp\n\n#define v8bridge_native_class_hpp\n\n\n\n#include <boost/shared_ptr.hpp>\n\n#include <v8bridge/detail/prefix.hpp>\n\n\n\n#include <v8bridge/detail/typeid.hpp>\n\n#include <v8bridge/conversion/type_resolver.hpp>\n\n\n\n#include <v8bridge/detail/signature.hpp>\n\n#include <v8bridge/detail/ctor.hpp>\n\n#include <v8bridge/native/invoke_native_ctor.hpp>\n\n#include <v8bridge/native/native_endpoint.hpp>\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 39, "score": 31787.83319507332 }, { "content": " }\n\n \n\n // Builds ctor function which inserts the given Holder type\n\n // in a wrapped C++ class instance. ArgList is an MPL type sequence\n\n // describing the C++ argument types to be passed to Holder's\n\n // constructor.\n\n //\n\n // Holder and ArgList are intended to be explicitly specified.\n\n template <class TArgList, class TArity>\n\n inline NativeClass<TClass> *exposeCtor(TArgList* = 0, TArity* = 0)\n\n {\n\n return this->_exposeCtor(\n\n ::v8::bridge::detail::invoke_native_ctor<TArity::value>::template apply<TClass, TArgList>::execute,\n\n get_signature(::v8::bridge::detail::invoke_native_ctor<TArity::value>::template apply<TClass, TArgList>::execute)\n\n );\n\n }\n\n \n\n //=======================================================================\n\n // Exposing Class Member(s)\n\n //=======================================================================\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 40, "score": 31787.42360880064 }, { "content": "// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n\n/**\n\n * This is an sample file for v8bridge API interaction.\n\n *\n\n * This file provides a simple demonstration of binding a C++ class to JS.\n\n * In this demo, we're declaring a simple Car with one ivar (m_color) and three methods - getter, setter and standard method.\n\n * Then, we're expsoing the Car class using v8bridge NativeClass interface.\n\n * Finally, we're creating in JS a new instance of Car, setting its color using the \"color\" property and invoking drive().\n\n *\n\n * Note: when \"delete carClass;\" is been called, the \"car\" instance that we've defined in JS is been removed\n\n * by v8bridge internal GC. For more details on why is this happing and why we need this, see internal_gc.hpp.\n\n */\n\n\n\n#include <iostream>\n", "file_path": "samples/cpp_classes_static.cpp", "rank": 41, "score": 31787.04180149356 }, { "content": " \n\n Local<Object> obj = this->getTemplate()\n\n ->GetFunction()\n\n ->NewInstance(1, argv);\n\n \n\n return handle_scope.Escape(obj);\n\n }\n\n \n\n inline TClass *unwrap(Handle<Object> object)\n\n {\n\n return static_cast<TClass *>(object->GetAlignedPointerFromInternalField(object->InternalFieldCount() - 2));\n\n }\n\n \n\n //=======================================================================\n\n // V8 API related\n\n //=======================================================================\n\n \n\n /**\n\n * Use this method to setup the allocated memory adjustment that should be make in\n\n * V8 when creating new instance.\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 42, "score": 31786.988578273245 }, { "content": " bool m_isAbstract;\n\n int m_internalFieldsCount = 0;\n\n \n\n mutable Eternal<FunctionTemplate> *m_templateDecl;\n\n \n\n size_t m_allocatedMemoryAdjustment = sizeof(TClass);\n\n GC *m_gc;\n\n GC::TDtor m_customDtorHandler;\n\n \n\n inline static void internalConstructorInvocationCallback(const FunctionCallbackInfo<Value>& info)\n\n {\n\n using namespace boost;\n\n \n\n NativeClass<TClass> *self = static_cast<NativeClass<TClass> *>(External::Cast(*info.Data())->Value());\n\n \n\n EscapableHandleScope handle_scope(self->m_isolationScope);\n\n \n\n //-------------------------------------------------\n\n // Firstly, make sure that this class wasn't marked as abstract\n\n //-------------------------------------------------\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 45, "score": 31786.207665752547 }, { "content": " //\n\n // As a result, we can't forward the constructor directly to the CPP ctor but create a constructor that discrimiate between these cases.\n\n // The solution that came up is to pass the native instance as an External value when using NativeToJs. Here, we should check whether or not we've recevived as ctor args only 1 arg of type External.\n\n // if so, this is NativeToJs. Otherwise - we're dealing with new instansiation.\n\n //\n\n // For more details, see: http://create.tpsitulsa.com/blog/2009/01/29/v8-objects/\n\n //-------------------------------------------------\n\n External *externalInstance;\n\n TClass *instance;\n\n if (!info[0]->IsExternal())\n\n {\n\n //-------------------------------------------------\n\n // Do we got at least one constructor?\n\n // If not, we shall use a default one\n\n //-------------------------------------------------\n\n \n\n if (self->m_ctor->getOverloadsCount() < 1)\n\n {\n\n /* There's no constructor, so just create the object */\n\n try\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 46, "score": 31784.962192439347 }, { "content": " *\n\n * For more details about the memory adjustment, see Isolate::AdjustAmountOfExternalAllocatedMemory\n\n * \n\n * You should call this method only when setting-up the NativeClass with fixed value. Otherwise, it may lead to memory-leak mistakes.\n\n *\n\n * Default adjustment:\n\n * If you wouldn't call this method at all, the default implementation use sizeof(TClass), which should be just fine for most cases.\n\n * \n\n * Zero:\n\n * Passing zero will cause to no memory ajustment been made at all.\n\n */\n\n inline NativeClass<TClass> *setAllocatedMemoryAdjustment(size_t cost)\n\n {\n\n this->m_allocatedMemoryAdjustment = cost;\n\n }\n\n \n\n /**\n\n * Set the number of internal fields the native class should reserve.\n\n * For basic knowladge on internal fields,\n\n please see V8's SetInternalFieldCount, SetAlignedPointerAtInternalField, GetIntenralPointerFromInternalField, SetInternalField and GetIntenralField.\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 47, "score": 31784.867089699943 }, { "content": " inline NativeClass<TClass> *exposeStaticConstant(std::string name, int value)\n\n {\n\n this->getTemplate()->GetFunction()->Set(String::NewFromUtf8(this->m_isolationScope, name.c_str()),\n\n Number::New(this->m_isolationScope, value),\n\n static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete));\n\n return this;\n\n }\n\n \n\n /**\n\n * Expose a specific method or method overload to JavaScript.\n\n * Note: sending the same methodName will allow to register an overload.\n\n *\n\n * @param std::string methodName - The JS method name.\n\n * @param TMethod method - reference to the C++ method.\n\n * @return NativeClass<TClass>\n\n *\n\n * Example:\n\n * C++:\n\n * carClass->exposeMethod(\"drive\", &Car::drive);\n\n * carClass->exposeStaticMethod(\"foo\", &Car::foo);\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 48, "score": 31784.45948414152 }, { "content": " \n\n /* Expose the car to JS global scope. */\n\n engine->exposeClass(carClass);\n\n \n\n /* Execute! */\n\n HandleScope handle_scope(engine->getActiveIsolationScope()); // JS_PRINT_HANDLE uses ScriptingEngine::v8Eval which requires an handle scope since it returns raw v8 values\n\n \n\n // Fires Car(). should print blank/zero values since color and km was not set.\n\n JS_PRINT_HANDLE(\"var car = new Car(); 'Color: ' + car.color + '; KM: ' + car.km;\");\n\n std::cout << \"=========================================\" << std::endl;\n\n \n\n // Fires Car(std::string color). Should print 0 as KM since it was not set and \"Red\" as color.\n\n JS_PRINT_HANDLE(\"var car = new Car('Red'); 'Color: ' + car.color + '; KM: ' + car.km;\");\n\n std::cout << \"=========================================\" << std::endl;\n\n \n\n // Fires Car(int km). Should print blank color since it was not set and 10 as KM.\n\n JS_PRINT_HANDLE(\"var car = new Car(10); 'Color: ' + car.color + '; KM: ' + car.km;\");\n\n std::cout << \"=========================================\" << std::endl;\n\n \n\n // Fires Car(std::string color, int km). Should print \"Red\" as color and 10 as KM.\n", "file_path": "samples/cpp_classes_ctor.cpp", "rank": 49, "score": 31783.9629476724 }, { "content": " std::string m_color;\n\n};\n\n\n\nint main(int argc, const char * argv[])\n\n{\n\n /* Create a scripting engine */\n\n ScriptingEngine *engine = new ScriptingEngine();\n\n \n\n /* Create a new NativeClass which will be our endpoint for a native C++ class.\n\n The TClass template arg representing the class that you wish to expose.\n\n When exposing a class, it's been automaticly added to the Conversion API. */\n\n NativeClass<Car> *carClass = new NativeClass<Car>(engine->getActiveIsolationScope());\n\n \n\n /* We want to expose the \"getColor\" and \"setColor\" getter/setter\n\n and the drive method. Since the constructor is default, we don't need\n\n to explicity expose it.\n\n \n\n Note: If you don't want to allow to use the default constructor, you got two options:\n\n 1. You can use the exposeCtor with a ctor that requires an arguments. In this case,\n\n v8bridge won't allow the non-args ctor.\n", "file_path": "samples/cpp_classes_basics.cpp", "rank": 50, "score": 31783.895339106777 }, { "content": " /* Create persistent object so we can make this object accessable outside the handle-scope ?*/\n\n v8::Persistent<v8::Object> handle(self->m_isolationScope, info.This());\n\n \n\n /* Setup weak connection */\n\n handle.SetWeak(instance, &NativeClass<TClass>::WeakObjectsDeletionCallback);\n\n handle.MarkIndependent();\n\n \n\n /* Expose to the class GC */\n\n if (self->m_customDtorHandler == NULL)\n\n {\n\n self->m_gc->queue(instance); // we can not send null, otherwise even the default dtor wont be run, thus, the object won't be released.\n\n }\n\n else\n\n {\n\n self->m_gc->queue(instance, self->m_customDtorHandler);\n\n }\n\n }\n\n \n\n //=======================================================================\n\n // Private methods\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 52, "score": 31783.410368248005 }, { "content": " * Declares a custom destructor implementation.\n\n * The given dtor will be called when the object should be free'd (for instance, by the GC).\n\n *\n\n * Note that if you will not specify any custom dtor, the default implementation (GCGenericInstanceDestructor declared in internal_gc.hpp)\n\n * will attempt to dispose the instance using \"delete\" (and as a result will call the class destructor.\n\n */\n\n inline NativeClass<TClass> *declareCustomDtor(GC::TDtor dtor)\n\n {\n\n this->m_customDtorHandler = dtor;\n\n }\n\n \n\n //=======================================================================\n\n // Exposing Ctor(s)\n\n //=======================================================================\n\n \n\n template <class TCtor>\n\n inline NativeClass<TClass> *exposeCtor(TCtor const& constructor)\n\n {\n\n constructor.define(*this);\n\n return this;\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 53, "score": 31783.21032496911 }, { "content": " 2. You can use the declareAsAbstract() method to declare the class as abstract.\n\n */\n\n \n\n // drive - expose a method:\n\n carClass->exposeMethod(\"drive\", &Car::drive);\n\n \n\n // getColor and setColor - expose as property accessor:\n\n carClass->exposePropertyAccessor(\"color\", &Car::getColor, &Car::setColor);\n\n \n\n /* Expose the car to JS global scope.\n\n NOTE: just like in NativeFunction, you MUST call this method,\n\n and you MUST do it AFTER FINISHING TO CONFIGURE YOUR ENDPOINT. */\n\n engine->exposeClass(carClass);\n\n \n\n /* Execute! */\n\n std::stringstream io;\n\n io << \"var car = new Car();\" << std::endl;\n\n io << \"car.color = 'red';\" << std::endl;\n\n io << \"car.drive();\";\n\n \n", "file_path": "samples/cpp_classes_basics.cpp", "rank": 54, "score": 31783.059054560792 }, { "content": " //=======================================================================\n\n \n\n /**\n\n * Expose a specific property to JavaScript.\n\n *\n\n * For details, please see: NativeClass<TClass>::exposePropertyAccessor<TGetter, TSetter>(std::string, TGetter, TSetter, std::string, std::string)\n\n *\n\n * Note: This version expose a \"read-only\" property.\n\n * For read-and-write you should use exposePropertyAccessor<TGetter, TSetter>(std::string, TGetter, TSetter)\n\n *\n\n * @param std::string propertyName - the name of the property (variable) in JS.\n\n * @param TGetter getter - a reference to the getter method.\n\n * @param std::string getterMethodName [optional] - If specified, in addition to the property accessor declaration,\n\n * we're also binding the referenced TGetter to the given method name (i.e. one can access using the C++ method by \"x\" and \"getX\").\n\n */\n\n template<typename TGetter>\n\n inline NativeClass<TClass> *exposePropertyAccessor(std::string propertyName, TGetter getter, std::string getterMethodName = \"\")\n\n {\n\n return this->_exposePropertyAccessor(propertyName, getter, getterMethodName, /* isStatic: */false);\n\n }\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 55, "score": 31782.900613024518 }, { "content": " this->m_isolationScope->AdjustAmountOfExternalAllocatedMemory(this->m_allocatedMemoryAdjustment * -1);\n\n \n\n return this;\n\n }\n\n \n\n /**\n\n * Dispose the given object handle instance and free the underlaying C++ binded instance.\n\n */\n\n inline NativeClass<TClass> *disposeInstance(Handle<Value> handle)\n\n {\n\n if (handle.IsEmpty() || ! handle->IsObject()) { return this; }\n\n return this->disposeInstance(Handle<Object>(Object::Cast(*handle)));\n\n }\n\n \n\n \n\n /**\n\n * Static callback used with Persistent<T>.SetWeak in order to\n\n * delete references.\n\n */\n\n template <typename T, typename P>\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 56, "score": 31782.825896325827 }, { "content": " }\n\n else\n\n {\n\n /* Get the v8::External instance */\n\n externalInstance = External::Cast(*info[0]);\n\n \n\n /* Get the TClass instance */\n\n instance = (TClass *)externalInstance->Value();\n\n }\n\n \n\n /* Save the TClass instance in the new created JS object */\n\n info.This()->SetAlignedPointerInInternalField(info.This()->InternalFieldCount() - 2, (void *)instance);\n\n \n\n /* Basic memory adjustment */\n\n self->m_isolationScope->AdjustAmountOfExternalAllocatedMemory(self->m_allocatedMemoryAdjustment);\n\n \n\n /* Save an pointer to \"this\" (self variable) since\n\n we can't access it in the SetWeak() callback. */\n\n info.This()->SetAlignedPointerInInternalField(info.This()->InternalFieldCount() - 1, (void *)self);\n\n \n", "file_path": "v8bridge/native/native_class.hpp", "rank": 57, "score": 31782.74711982896 }, { "content": " \n\n /**\n\n * Dispose the given object handle instance and free the underlaying C++ binded instance.\n\n */\n\n inline NativeClass<TClass> *disposeInstance(Handle<Object> handle)\n\n {\n\n v8::HandleScope handle_scope(this->m_isolationScope);\n\n Persistent<Object> p(this->m_isolationScope, handle);\n\n \n\n void* ptr = handle->GetAlignedPointerFromInternalField(handle->InternalFieldCount() - 2);\n\n \n\n this->m_gc->disposeAndDequeue(ptr);\n\n \n\n for (int i = 0; i < handle->InternalFieldCount(); i++)\n\n {\n\n handle->SetAlignedPointerInInternalField(i, NULL);\n\n }\n\n p.Reset();\n\n \n\n /* Memory adjustment */\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 58, "score": 31782.496913945146 }, { "content": " *\n\n * You should note that the internal fields count is the number of fields that you wish to reserve in order to been used BY YOU, not by v8bridge.\n\n * v8bridge reserves 2 internal fields, so in case you're not reserving anything (0) the number of internal fields will be 2,\n\n * in case you reserve 2 fields the internal fields count will be 4 and so on.\n\n *\n\n * v8bridge internal fields description:\n\n * 1'th field (N + 0'th index): A pointer to the binded (connected) C++ class instance.\n\n * 2'th field (N + 1'th index): A pointer to the owner NativeClass instance.\n\n */\n\n inline NativeClass<TClass> *setInternalFieldsCount(int fieldsCount)\n\n {\n\n this->m_templateDecl->Get(this->m_isolationScope)->InstanceTemplate()->SetInternalFieldCount(fieldsCount + 2);\n\n this->m_templateDecl->Get(this->m_isolationScope)->PrototypeTemplate()->SetInternalFieldCount(fieldsCount + 2);\n\n \n\n return this;\n\n }\n\n \n\n //=======================================================================\n\n // Helpers\n\n //=======================================================================\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 59, "score": 31782.298670884567 }, { "content": " \n\n // Properties (We're exposing read-only properties)\n\n carClass->exposePropertyAccessor(\"color\", &Car::getColor)\n\n ->exposePropertyAccessor(\"km\", &Car::getKm); \n\n \n\n /* Expose the class ctors. Since we can't receive from C++ the singature of a ctor (or dtor)\n\n we should use an alternative approch. Based on boost python binding approch, I've created a\n\n ctor types-list which is representing a ctor singature. You may send it to NativeClass<TClass>::exposeCtor()\n\n to declare a class.\n\n \n\n Examples:\n\n exposeCtor(ctor<>()) - empty (default) ctor. Note: you should not declare it unless you got another constructor overload.\n\n exposeCtor(ctor<int>()) - ctor that accepts an int.\n\n exposeCtor(ctor<int, int>()) - ctor that accepts two ints.\n\n */\n\n carClass->exposeCtor(ctor<>()) // Car()\n\n ->exposeCtor(ctor<std::string>()) // Car(std::string color)\n\n ->exposeCtor(ctor<int>()) // Car(int km)\n\n ->exposeCtor(ctor<std::string, int>()) // Car(std::string color, int km)\n\n ->exposeCtor(ctor<const FunctionCallbackInfo<Value> &>()); // fallback ctor - Car(const FunctionCallbackInfo<Value> &info)\n", "file_path": "samples/cpp_classes_ctor.cpp", "rank": 60, "score": 31781.905079955202 }, { "content": "// Copyright 2014 Quartz Technologies, Ltd. All rights reserved.\n\n// Redistribution and use in source and binary forms, with or without\n\n// modification, are permitted provided that the following conditions are\n\n// met:\n\n//\n\n// * Redistributions of source code must retain the above copyright\n\n// notice, this list of conditions and the following disclaimer.\n\n// * Redistributions in binary form must reproduce the above\n\n// copyright notice, this list of conditions and the following\n\n// disclaimer in the documentation and/or other materials provided\n\n// with the distribution.\n\n// * Neither the name of Quartz Technologies Ltd. nor the names of its\n\n// contributors may be used to endorse or promote products derived\n\n// from this software without specific prior written permission.\n\n//\n\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n", "file_path": "samples/cpp_classes_static.cpp", "rank": 61, "score": 31781.786226607946 }, { "content": "// Copyright 2014 Quartz Technologies, Ltd. All rights reserved.\n\n// Redistribution and use in source and binary forms, with or without\n\n// modification, are permitted provided that the following conditions are\n\n// met:\n\n//\n\n// * Redistributions of source code must retain the above copyright\n\n// notice, this list of conditions and the following disclaimer.\n\n// * Redistributions in binary form must reproduce the above\n\n// copyright notice, this list of conditions and the following\n\n// disclaimer in the documentation and/or other materials provided\n\n// with the distribution.\n\n// * Neither the name of Quartz Technologies Ltd. nor the names of its\n\n// contributors may be used to endorse or promote products derived\n\n// from this software without specific prior written permission.\n\n//\n\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n", "file_path": "samples/cpp_classes_ctor.cpp", "rank": 62, "score": 31781.786226607946 }, { "content": "// Copyright 2014 Quartz Technologies, Ltd. All rights reserved.\n\n// Redistribution and use in source and binary forms, with or without\n\n// modification, are permitted provided that the following conditions are\n\n// met:\n\n//\n\n// * Redistributions of source code must retain the above copyright\n\n// notice, this list of conditions and the following disclaimer.\n\n// * Redistributions in binary form must reproduce the above\n\n// copyright notice, this list of conditions and the following\n\n// disclaimer in the documentation and/or other materials provided\n\n// with the distribution.\n\n// * Neither the name of Quartz Technologies Ltd. nor the names of its\n\n// contributors may be used to endorse or promote products derived\n\n// from this software without specific prior written permission.\n\n//\n\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n", "file_path": "samples/cpp_classes_basics.cpp", "rank": 63, "score": 31781.786226607946 }, { "content": "// Copyright 2014 Quartz Technologies, Ltd. All rights reserved.\n\n// Redistribution and use in source and binary forms, with or without\n\n// modification, are permitted provided that the following conditions are\n\n// met:\n\n//\n\n// * Redistributions of source code must retain the above copyright\n\n// notice, this list of conditions and the following disclaimer.\n\n// * Redistributions in binary form must reproduce the above\n\n// copyright notice, this list of conditions and the following\n\n// disclaimer in the documentation and/or other materials provided\n\n// with the distribution.\n\n// * Neither the name of Quartz Technologies Ltd. nor the names of its\n\n// contributors may be used to endorse or promote products derived\n\n// from this software without specific prior written permission.\n\n//\n\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 64, "score": 31781.786226607946 }, { "content": " * C++ doesn't have \"properties\" (unlike C#) but we still use getters and setters.\n\n * Using this API you can attach specific getter and setter to a \"property\" (i.e. variable).\n\n *\n\n * @param std::string propertyName - the name of the property (variable) in JS.\n\n * @param TGetter getter - a reference to the getter method.\n\n * @param TSetter setter - a reference to the setter method.\n\n * @param std::string getterMethodName [optional] - If specified, in addition to the property accessor declaration,\n\n * we're also binding the referenced TGetter to the given method name (i.e. one can access using the C++ method by \"x\" and \"getX\").\n\n * @param std::string setterMethodName [optional] - If specified, in addition to the property accessor declaration,\n\n * we're also binding the referenced TSetter to the given method name.\n\n *\n\n * Example:\n\n * C++:\n\n * carClass->exposePropertyAccessor(\"color\", &Car::getColor, &Car::setColor);\n\n * JS:\n\n * var car = new Car();\n\n * car.color = \"Red\"; // Invokes C++'s Car::setColor\n\n * console.log( car.color ); // Invokes C++'s Car::getColor\n\n */\n\n template<typename TGetter, typename TSetter>\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 66, "score": 31781.464980447763 }, { "content": " template<typename TType>\n\n inline NativeClass<TClass> *setStaticClassMember(const char *memberName, TType value)\n\n {\n\n this->setStaticClassMember(memberName, NativeToJs(value, this->m_isolationScope));\n\n return this;\n\n }\n\n \n\n \n\n inline NativeClass<TClass> *setClassMember(const char *memberName, Handle<Value> value)\n\n {\n\n this->getTemplate()\n\n ->InstanceTemplate()\n\n ->Set(String::NewFromUtf8(this->m_isolationScope, memberName), value);\n\n \n\n return this;\n\n }\n\n \n\n inline NativeClass<TClass> *setStaticClassMember(const char *memberName, Handle<Value> value)\n\n {\n\n this->getTemplate()\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 67, "score": 31781.262464992302 }, { "content": " \n\n /**\n\n * Add a class member (ivar) to the class.\n\n *\n\n * Example:\n\n * C++:\n\n * obj->setClassMember(\"x\", 10);\n\n *\n\n * JS:\n\n * log(obj.x)\n\n * obj.x = 5;\n\n */\n\n template<typename TType>\n\n inline NativeClass<TClass> *setClassMember(const char *memberName, TType value)\n\n {\n\n this->setClassMember(memberName, NativeToJs(value, this->m_isolationScope));\n\n return this;\n\n }\n\n \n\n \n", "file_path": "v8bridge/native/native_class.hpp", "rank": 68, "score": 31781.083721457588 }, { "content": " * JS:\n\n * var myCar = new Car();\n\n * myCar.drive();\n\n * Car.foo();\n\n */\n\n template<typename TMethod>\n\n inline NativeClass<TClass> *exposeMethod(std::string methodName, TMethod method)\n\n {\n\n return this->_exposeMethod(methodName, method, /* isStatic: */false);\n\n }\n\n \n\n template<typename TMethod>\n\n inline NativeClass<TClass> *exposeStaticMethod(std::string methodName, TMethod method)\n\n {\n\n return this->_exposeMethod(methodName, method, /* isStatic: */true);\n\n }\n\n \n\n inline NativeClass<TClass> *exposeMethod(std::string methodName, NativeFunction *funcDecl)\n\n {\n\n assert(this->m_methods->find(methodName) == this->m_methods->end());\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 69, "score": 31780.87137395059 }, { "content": " * NativeClass<Car> *carClass = new NativeClass<Car>();\n\n * carClass\n\n * ->setConst(\"WHEELS\", 4)\n\n * ->exposeMethod(\"drive\", &Car::drive)\n\n * ->exposeMethod(\"stop\", &Car::stop)\n\n * ->exposeStaticMethod(\"Factory\", &Car::Factory);\n\n * ->exposePropertyAccessor(\"color\", &Car::getColor, &Car::setColor);\n\n *\n\n * JS:\n\n * var car = new Car();\n\n * car.color = 'Red';\n\n * car.drive();\n\n * car.stop();\n\n * console.log(\"This is %s car which has %d wheels.\", car.color, Car.WHEELS);\n\n */\n\n template <class TClass>\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 70, "score": 31780.869175288193 }, { "content": " printFunction->addOverload(print);\n\n engine->exposeFunction(printFunction, \"print\");\n\n \n\n /* Create a new NativeClass which will be our endpoint for a native C++ class. */\n\n NativeClass<FileUtils> *fileUtilsClass = new NativeClass<FileUtils>(engine->getActiveIsolationScope());\n\n \n\n /* Expose some static methods */\n\n fileUtilsClass->exposeStaticMethod(\"FileExists\", &FileUtils::FileExists)\n\n ->exposeStaticMethod(\"Read\", &FileUtils::Read);\n\n \n\n /* Expose the car to JS global scope. */\n\n engine->exposeClass(fileUtilsClass);\n\n \n\n /* Execute! */\n\n std::stringstream io;\n\n io << \"var filePath = './foo.txt';\" << std::endl;\n\n io << \"if (FileUtils.FileExists(filePath)) {\" << std::endl;\n\n io << \" var contents = FileUtils.Read(filePath);\" << std::endl;\n\n io << \" print('File Path: ' + filePath + '. Contents:');\" << std::endl;\n\n io << \" print(contents);\" << std::endl;\n", "file_path": "samples/cpp_classes_static.cpp", "rank": 71, "score": 31780.797188453944 }, { "content": " * Get the class JS function template\n\n */\n\n inline Handle<FunctionTemplate> getTemplate() { return this->m_templateDecl->Get(this->m_isolationScope); }\n\n \n\n /**\n\n * Test if a given handle is an instance of this class.\n\n */\n\n inline bool isInstanceOf(Handle<Value> value)\n\n {\n\n return this->getTemplate()->HasInstance(value);\n\n }\n\n \n\n /**\n\n * Set the function client-side class name (e.g. \"Foo\" will result in [object Foo])\n\n */\n\n inline NativeClass<TClass> *setClientClassName(std::string name)\n\n {\n\n this->getTemplate()->SetClassName(String::NewFromUtf8(this->m_isolationScope, name.c_str()));\n\n return this;\n\n }\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 72, "score": 31780.66691385685 }, { "content": " {\n\n return this->m_color;\n\n }\n\n \n\n int getKm()\n\n {\n\n return this->m_km;\n\n }\n\nprivate:\n\n std::string m_color;\n\n int m_km;\n\n};\n\n\n\nint main(int argc, const char * argv[])\n\n{\n\n /* Create a scripting engine */\n\n ScriptingEngine *engine = new ScriptingEngine();\n\n \n\n /* Setup our endpoint */\n\n NativeClass<Car> *carClass = new NativeClass<Car>(engine->getActiveIsolationScope());\n", "file_path": "samples/cpp_classes_ctor.cpp", "rank": 73, "score": 31780.658148480732 }, { "content": " \n\n template<typename TGetter>\n\n inline NativeClass<TClass> *exposeStaticPropertyAccessor(std::string propertyName, TGetter getter, std::string getterMethodName = \"\")\n\n {\n\n return this->_exposePropertyAccessor(propertyName, getter, getterMethodName, /* isStatic: */true);\n\n }\n\n \n\n inline NativeClass<TClass> *exposePropertyAccessor(std::string propertyName, NativeFunction *getterMethod, std::string getterMethodName = \"\")\n\n {\n\n return this->_exposePropertyAccessor(propertyName, getterMethod, getterMethodName, /* isStatic: */false);\n\n }\n\n \n\n inline NativeClass<TClass> *exposeStaticPropertyAccessor(std::string propertyName, NativeFunction *getterMethod, std::string getterMethodName = \"\")\n\n {\n\n return this->_exposePropertyAccessor(propertyName, getterMethod, getterMethodName, /* isStatic: */true);\n\n }\n\n \n\n /**\n\n * Expose a specific property to JavaScript.\n\n *\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 74, "score": 31780.645872811958 }, { "content": " this->m_templateDecl = new Eternal<FunctionTemplate>(this->m_isolationScope, templ);\n\n this->setInternalFieldsCount(0);\n\n this->setClientClassName(TypeId< typename TypeResolver<TClass>::type >().name());\n\n }\n\n \n\n ~NativeClass()\n\n {\n\n /* Registered ctor */\n\n delete this->m_ctor;\n\n \n\n /* Registered methods */\n\n for (TMethodsMap::iterator it = this->m_methods->begin(); it != this->m_methods->end(); ++it)\n\n {\n\n (*it).second.reset();\n\n }\n\n \n\n this->m_methods->clear();\n\n delete this->m_methods;\n\n \n\n \n", "file_path": "v8bridge/native/native_class.hpp", "rank": 75, "score": 31780.5848208492 }, { "content": " {\n\n instance = new TClass();\n\n }\n\n catch (...)\n\n {\n\n delete instance;\n\n throw;\n\n }\n\n \n\n /* Save the binded C++ instance in the new created JS object */\n\n info.This()->SetAlignedPointerInInternalField(info.This()->InternalFieldCount() - 2, (void *)instance);\n\n }\n\n else\n\n {\n\n /* Invoke the actual class constructor */\n\n self->m_ctor->invoke(info);\n\n \n\n /* Get the TClass instance */\n\n instance = (TClass *)info.This()->GetAlignedPointerFromInternalField(info.This()->InternalFieldCount() - 2);\n\n }\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 76, "score": 31780.55613988484 }, { "content": " //=======================================================================\n\n \n\n template <typename TCtor, typename TCtorSignature>\n\n inline NativeClass<TClass> *_exposeCtor(TCtor callback, TCtorSignature signature)\n\n {\n\n this->m_ctor->template addOverload<TCtor, TCtorSignature>(callback, signature);\n\n return this;\n\n }\n\n \n\n template<typename TMethod>\n\n inline NativeClass<TClass> *_exposeMethod(std::string methodName, TMethod method, bool isStatic = false)\n\n {\n\n HandleScope handle_scope(this->m_isolationScope);\n\n \n\n //-------------------------------------------------\n\n // Do we got a registered method with the same name\n\n //-------------------------------------------------\n\n \n\n TMethodsMap *map = isStatic ? this->m_staticMethods : this->m_methods;\n\n \n", "file_path": "v8bridge/native/native_class.hpp", "rank": 77, "score": 31780.557380593455 }, { "content": " \n\n /**\n\n * Declare this JS class as non-instanciatable.\n\n */\n\n inline NativeClass<TClass> declareAsAbstract(bool status = true)\n\n {\n\n this->m_isAbstract = status;\n\n return this;\n\n }\n\n \n\n \n\n /**\n\n * Check if the native class was declared as abstract class\n\n */\n\n inline bool isDeclaredAsAbstract()\n\n {\n\n return this->m_isAbstract;\n\n }\n\n \n\n /**\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 78, "score": 31780.53241042587 }, { "content": " inline NativeClass<TClass> *exposePropertyAccessor(std::string propertyName, TGetter getter, TSetter setter, std::string getterMethodName = \"\", std::string setterMethodName = \"\")\n\n {\n\n return this->_exposePropertyAccessor(propertyName, getter, setter, getterMethodName, setterMethodName, /* isStatic: */false);\n\n }\n\n \n\n template<typename TGetter, typename TSetter>\n\n inline NativeClass<TClass> *exposeStaticPropertyAccessor(std::string propertyName, TGetter getter, TSetter setter, std::string getterMethodName = \"\", std::string setterMethodName = \"\")\n\n {\n\n return this->_exposePropertyAccessor(propertyName, getter, setter, getterMethodName, setterMethodName, /* isStatic: */true);\n\n }\n\n \n\n inline NativeClass<TClass> *exposePropertyAccessor(std::string propertyName, NativeFunction *getterMethod, NativeFunction *setterMethod, std::string getterMethodName = \"\", std::string setterMethodName = \"\")\n\n {\n\n return this->_exposePropertyAccessor(propertyName, getterMethod, setterMethod, getterMethodName, setterMethodName, /* isStatic: */false);\n\n }\n\n \n\n inline NativeClass<TClass> *exposeStaticPropertyAccessor(std::string propertyName, NativeFunction *getterMethod, NativeFunction *setterMethod, std::string getterMethodName = \"\", std::string setterMethodName = \"\")\n\n {\n\n return this->_exposePropertyAccessor(propertyName, getterMethod, setterMethod, getterMethodName, setterMethodName, /* isStatic: */true);\n\n }\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 79, "score": 31780.449607550465 }, { "content": " inline static void WeakObjectsDeletionCallback(const WeakCallbackData<T, P>& data)\n\n {\n\n Local<Object> pobj = data.GetValue();\n\n NativeClass<TClass> *self = static_cast<NativeClass<TClass> *>(pobj->GetAlignedPointerFromInternalField(pobj->InternalFieldCount() - 1));\n\n \n\n self->disposeInstance(pobj);\n\n }\n\n \n\n \n\n private:\n\n typedef std::list<boost::shared_ptr<NativeFunction> > TMethodsList;\n\n typedef std::map<std::string, boost::shared_ptr<NativeFunction> > TMethodsMap;\n\n \n\n NativeCtor *m_ctor;\n\n \n\n TMethodsMap *m_methods;\n\n TMethodsMap *m_staticMethods;\n\n TMethodsMap *m_accessors;\n\n TMethodsMap *m_staticAccessors;\n\n \n", "file_path": "v8bridge/native/native_class.hpp", "rank": 80, "score": 31780.4025017671 }, { "content": " engine->execute(io.str());\n\n \n\n /* Free */\n\n delete carClass;\n\n delete engine;\n\n \n\n /* Done. */\n\n return 0;\n\n}\n", "file_path": "samples/cpp_classes_basics.cpp", "rank": 81, "score": 31780.12226821657 }, { "content": " {\n\n /* Add to the instance template */\n\n this->getTemplate()\n\n ->SetAccessorProperty(\n\n /* name: */ String::NewFromUtf8(this->m_isolationScope, propertyName.c_str()),\n\n /* getter: */ getterMethod->getTemplate(),\n\n /* setter: */ Local<FunctionTemplate>(),\n\n /* PropertyAttributes: */ReadOnly\n\n );\n\n }\n\n \n\n return this;\n\n }\n\n \n\n inline NativeClass<TClass> *_exposePropertyAccessor(std::string propertyName, NativeFunction *getterMethod, std::string getterMethodName = \"\", bool isStatic = false)\n\n {\n\n HandleScope handle_scope(this->m_isolationScope);\n\n \n\n //-------------------------------------------------\n\n // Do we got a registered accesso with the same name\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 82, "score": 31779.851044275176 }, { "content": " \n\n /* Add to the global template */\n\n this->getTemplate()\n\n ->Set(String::NewFromUtf8(this->m_isolationScope, methodName.c_str()), funcDecl->getTemplate()->GetFunction());\n\n }\n\n }\n\n \n\n return this;\n\n }\n\n \n\n template<typename TGetter>\n\n inline NativeClass<TClass> *_exposePropertyAccessor(std::string propertyName, TGetter getter, std::string getterMethodName = \"\", bool isStatic = false)\n\n {\n\n HandleScope handle_scope(this->m_isolationScope);\n\n \n\n //-------------------------------------------------\n\n // Do we got a registered accesso with the same name\n\n //-------------------------------------------------\n\n \n\n TMethodsMap *map = isStatic ? this->m_staticAccessors : this->m_accessors;\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 83, "score": 31779.83590330473 }, { "content": " \n\n /* Create a shared pointer */\n\n boost::shared_ptr<NativeFunction> adapter(funcDecl);\n\n \n\n /* Store */\n\n this->m_methods->insert(std::make_pair(methodName, adapter));\n\n \n\n /* Add to the instance template */\n\n this->getTemplate()\n\n ->InstanceTemplate()\n\n ->Set(String::NewFromUtf8(this->m_isolationScope, methodName.c_str()), funcDecl->getTemplate()->GetFunction());\n\n \n\n return this;\n\n }\n\n \n\n inline NativeClass<TClass> *exposeStaticMethod(std::string methodName, NativeFunction *funcDecl)\n\n {\n\n assert(this->m_staticMethods->find(methodName) == this->m_staticMethods->end());\n\n \n\n /* Create a shared pointer */\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 84, "score": 31779.82088265858 }, { "content": " /* name: */ String::NewFromUtf8(this->m_isolationScope, propertyName.c_str()),\n\n /* getter: */ getterMethod->getTemplate(),\n\n /* setter: */ setterMethod->getTemplate()\n\n );\n\n }\n\n else\n\n {\n\n this->getTemplate()\n\n ->SetAccessorProperty(\n\n /* name: */ String::NewFromUtf8(this->m_isolationScope, propertyName.c_str()),\n\n /* getter: */ getterMethod->getTemplate(),\n\n /* setter: */ setterMethod->getTemplate()\n\n );\n\n }\n\n \n\n return this;\n\n }\n\n \n\n \n\n inline NativeClass<TClass> *exposePropertyAccessor(std::string propertyName, NativeFunction *getterMethod, NativeFunction *setterMethod, std::string getterMethodName = \"\", std::string setterMethodName = \"\", bool isStatic = false)\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 86, "score": 31779.663203919223 }, { "content": " inline NativeClass<TClass> *_exposePropertyAccessor(std::string propertyName, TGetter getter, TSetter setter, std::string getterMethodName = \"\", std::string setterMethodName = \"\", bool isStatic = false)\n\n {\n\n HandleScope handle_scope(this->m_isolationScope);\n\n \n\n //-------------------------------------------------\n\n // Do we got a registered accesso with the same name\n\n //-------------------------------------------------\n\n \n\n TMethodsMap *map = isStatic ? this->m_staticAccessors : this->m_accessors;\n\n assert(map->find(propertyName) == map->end());\n\n \n\n //-------------------------------------------------\n\n // Create a new pair\n\n //-------------------------------------------------\n\n \n\n /* New function instances */\n\n NativeFunction *getterMethod = new NativeFunction(this->m_isolationScope);\n\n NativeFunction *setterMethod = new NativeFunction(this->m_isolationScope);\n\n \n\n /* Add the initial overlaod */\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 87, "score": 31779.582639383003 }, { "content": " io << \"} else {\" << std::endl;\n\n io << \" print('The requested file path (' + filePath + ') does not exists.');\" << std::endl;\n\n io << \"}\" << std::endl;\n\n \n\n \n\n \n\n engine->execute(io.str());\n\n \n\n /* Free */\n\n delete printFunction;\n\n delete fileUtilsClass;\n\n delete engine;\n\n \n\n /* Done. */\n\n return 0;\n\n}\n", "file_path": "samples/cpp_classes_static.cpp", "rank": 88, "score": 31779.578074530746 }, { "content": " JS_PRINT_HANDLE(\"var car = new Car('Red', 10); 'Color: ' + car.color + '; KM: ' + car.km;\");\n\n std::cout << \"=========================================\" << std::endl;\n\n \n\n // Fires Car(const FunctionCallbackInfo<Value> &info). Should print \"Red\" as color and 16 as KM.\n\n JS_PRINT_HANDLE(\"var car = new Car('Red', 10, 1, 2, 3); 'Color: ' + car.color + '; KM: ' + car.km;\");\n\n std::cout << \"=========================================\" << std::endl;\n\n \n\n /* Free */\n\n delete carClass;\n\n delete engine;\n\n \n\n /* Done. */\n\n return 0;\n\n}\n\n \n\n#undef JS_PRINT_HANDLE\n", "file_path": "samples/cpp_classes_ctor.cpp", "rank": 90, "score": 31779.026003360657 }, { "content": " inline NativeFunction *getExposedStaticSetterAccessor(std::string propertyName)\n\n {\n\n propertyName = \"__set_accessor_\" + propertyName;\n\n \n\n if (this->m_staticAccessors->find(propertyName) == this->m_accessors->end())\n\n {\n\n return NULL;\n\n }\n\n \n\n return this->m_staticAccessors->find(propertyName).second;\n\n }\n\n \n\n //=======================================================================\n\n // Wrapping & Unwrapping objects\n\n //=======================================================================\n\n inline Local<Object> wrap(TClass *connectedInstance)\n\n {\n\n EscapableHandleScope handle_scope(this->m_isolationScope);\n\n \n\n Handle<Value> argv[] = { External::New(this->m_isolationScope, (void*)connectedInstance) };\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 92, "score": 31778.953338472522 }, { "content": " {\n\n return NULL;\n\n }\n\n \n\n return this->m_methods->find(methodName).second;\n\n }\n\n \n\n inline NativeFunction *getExposedStaticMethod(std::string methodName)\n\n {\n\n if (this->m_staticMethods->find(methodName) == this->m_staticMethods->end())\n\n {\n\n return NULL;\n\n }\n\n \n\n return this->m_staticMethods->find(methodName).second;\n\n }\n\n \n\n \n\n //=======================================================================\n\n // Exposing Accessor(s)\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 93, "score": 31776.055666468783 }, { "content": " boost::shared_ptr<NativeFunction> adapter(funcDecl);\n\n \n\n /* Store */\n\n this->m_staticMethods->insert(std::make_pair(methodName, adapter));\n\n \n\n /* Add to the instance template */\n\n this->getTemplate()\n\n ->Set(String::NewFromUtf8(this->m_isolationScope, methodName.c_str()), funcDecl->getTemplate()->GetFunction());\n\n \n\n return this;\n\n }\n\n \n\n /**\n\n * Retrieve the registered NativeFunction instance for the given method name\n\n * @param std::string methodName - the method name.\n\n * @return NativeFunction - the native function data to expose.\n\n */\n\n inline NativeFunction *getExposedMethod(std::string methodName)\n\n {\n\n if (this->m_methods->find(methodName) == this->m_methods->end())\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 94, "score": 31776.055666468783 }, { "content": " ->Set(String::NewFromUtf8(this->m_isolationScope, memberName), value);\n\n \n\n return this;\n\n }\n\n \n\n \n\n //=======================================================================\n\n // Exposing Method(s)\n\n //=======================================================================\n\n \n\n /**\n\n * Expose a static constant to JavaScript.\n\n *\n\n * Example:\n\n * C++:\n\n * obj->exposeStaticConstant(\"WHEELS\", 4);\n\n *\n\n * JS:\n\n * log(obj.WHEELS);\n\n */\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 95, "score": 31776.055666468783 }, { "content": " \n\n inline NativeFunction *getExposedGetterAccessor(std::string propertyName)\n\n {\n\n propertyName = \"__get_accessor_\" + propertyName;\n\n \n\n if (this->m_accessors->find(propertyName) == this->m_accessors->end())\n\n {\n\n return NULL;\n\n }\n\n \n\n return this->m_accessors->find(propertyName).second;\n\n }\n\n \n\n \n\n inline NativeFunction *getExposedStaticGetterAccessor(std::string propertyName)\n\n {\n\n propertyName = \"__get_accessor_\" + propertyName;\n\n \n\n if (this->m_staticAccessors->find(propertyName) == this->m_accessors->end())\n\n {\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 96, "score": 31776.055666468783 }, { "content": " /* Registered static methods */\n\n for (TMethodsMap::iterator it = this->m_staticMethods->begin(); it != this->m_staticMethods->end(); ++it)\n\n {\n\n (*it).second.reset();\n\n }\n\n \n\n this->m_staticMethods->clear();\n\n delete this->m_staticMethods;\n\n \n\n /* Registered accessors */\n\n for (TMethodsMap::iterator it = this->m_accessors->begin(); it != this->m_accessors->end(); ++it)\n\n {\n\n (*it).second.reset();\n\n }\n\n \n\n this->m_accessors->clear();\n\n delete this->m_accessors;\n\n \n\n \n\n /* Registered static accessors */\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 97, "score": 31776.055666468783 }, { "content": " for (TMethodsMap::iterator it = this->m_staticAccessors->begin(); it != this->m_staticAccessors->end(); ++it)\n\n {\n\n (*it).second.reset();\n\n }\n\n \n\n this->m_staticAccessors->clear();\n\n delete this->m_staticAccessors;\n\n \n\n /* GC */\n\n delete this->m_gc;\n\n \n\n /* Ctor */\n\n delete this->m_templateDecl;\n\n }\n\n \n\n //=======================================================================\n\n // General\n\n //=======================================================================\n\n \n\n /**\n", "file_path": "v8bridge/native/native_class.hpp", "rank": 98, "score": 31776.055666468783 }, { "content": "# include <boost/preprocessor/enum_params.hpp>\n\n\n\n# define V8_BRIDGE_OVERLOAD_TYPES_WITH_DEFAULT_VALUE BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(V8_MAX_ARITY, class TClass, mpl::void_)\n\n\n\n# define V8_BRIDGE_OVERLOAD_TYPES BOOST_PP_ENUM_PARAMS_Z(1, V8_MAX_ARITY, class TClass)\n\n\n\n# define V8_BRIDGE_OVERLOAD_ARGS BOOST_PP_ENUM_PARAMS_Z(1, V8_MAX_ARITY, TClass)\n\n\n\nnamespace v8\n\n{\n\n namespace bridge\n\n {\n\n using namespace boost;\n\n \n\n template <V8_BRIDGE_OVERLOAD_TYPES_WITH_DEFAULT_VALUE>\n", "file_path": "v8bridge/detail/ctor.hpp", "rank": 99, "score": 23.401130365096655 } ]
C++
ModelTakuzu.cpp
Ezryuk/Takuzu
6dd94470c15c0071ca210a9655eb85d8458163c3
#include "ModelTakuzu.h" #include <cassert> #include <iostream> #include <QtAlgorithms> #include <QFile> #include <QTextStream> ModelTakuzu::ModelTakuzu() { _nbMaps = -1; _sizeMap = -1; _grids = nullptr; } ModelTakuzu::~ModelTakuzu() { delete[] _grids; } Pawn ModelTakuzu::permuteR(Pawn p) { if (p == Black) { return White; } else if (p == White) { return Empty; } else { return Black; } } Pawn ModelTakuzu::permuteL(Pawn p) { if (p == Black) { return Empty; } else if (p == Empty) { return White; } else { return Black; } } void ModelTakuzu::loadFile(const QString &name) { QFile file(":/resources/"+name); if (!(file.open(QIODevice::ReadOnly | QIODevice::Text))) { std::cerr << "Error while opening new file: " << name.toStdString() << " .\n"; } else { QString line; QTextStream in(&file); bool ok = true; _nbMaps = in.readLine().toInt(&ok); if (!ok) { std::cerr << "Issue when reading new line. \n"\ << "Make sure the file has the same path as the executable.\n"; } _grids = new Grid_[_nbMaps]; for (int i = 0; i < _nbMaps; ++i) { _grids[i] = Grid_(_sizeMap * _sizeMap); } int i = 0; while (!in.atEnd()) { line = in.readLine(); int letterIndex = 0; QChar letter; foreach(letter, line) { if (letterIndex < _sizeMap * _sizeMap) { _grids[i][letterIndex++] = ModelTakuzu::toPawn(letter); } } i++; } } } void ModelTakuzu::chooseMapPool(ModelTakuzu::Difficulty difficulty, int size) { QString name = QString::number(size); if (difficulty == Easy) { name.append("_easy.txt"); } else { name.append("_hard.txt"); } _difficulty = difficulty; _sizeMap = size; loadFile(QString(name)); setRandomMap(); emit notifyNumberMap(_difficulty, _sizeMap, _chosenMap, _nbMaps); } int ModelTakuzu::setMap(int chosenMap) { assert((_nbMaps != -1 || _sizeMap != -1) && \ "Choose a map pool before using setRandomMap()."); _chosenMap = chosenMap; _currentGrid = _grids[chosenMap]; _countPawn = { std::vector<int>(_sizeMap), std::vector<int>(_sizeMap), std::vector<int>(_sizeMap), std::vector<int>(_sizeMap) }; for(int i = 0; i < _sizeMap; ++i) { for (int j = 0; j < _sizeMap; ++j) { emit notifyInitialPawn(i, j, _grids[chosenMap][i * _sizeMap + j]); } } initCount(); return _chosenMap; } int ModelTakuzu::setRandomMap() { int randomGridIndex = (rand() % _nbMaps); _chosenMap = setMap(randomGridIndex); return randomGridIndex; } void ModelTakuzu::playAt(int i, int j, Pawn pawn) { assert((!_currentGrid.empty()) && \ "Set a map using setRandomMap() before calling playAt()."); Pawn oldPawn = pawnAt(i, j); Pawn newPawn = pawn; updateCount(i, j, oldPawn, newPawn); pawnAt(i, j) = newPawn; positionIsValid(i, j); emit notifyNewPawn(i, j, pawn); } bool ModelTakuzu::positionIsValid(int i, int j) { const bool isVertical = true; const bool isOK = true; bool repetitionInRow = isBBBorWWWpresentIn(getRow(i)); bool repetitionInCol = isBBBorWWWpresentIn(getCol(j)); if (repetitionInRow) { emit notifyOverThreeAdjacentPawns(i, !isVertical, !isOK); } else { emit notifyOverThreeAdjacentPawns(i, !isVertical, isOK); } if (repetitionInCol) { emit notifyOverThreeAdjacentPawns(j, isVertical, !isOK); } else { emit notifyOverThreeAdjacentPawns(j, isVertical, isOK); } int oneOtherIdenticalRow = findFirstIdenticalRowTo(i); int oneOtherIdenticalCol = findFirstIdenticalColTo(j); static auto oneOtherIdenticalRowColIsFound = [this](int index) -> bool { return (index != _sizeMap); }; if (oneOtherIdenticalRowColIsFound(oneOtherIdenticalRow)) { emit notifyCommonPatterns(i, oneOtherIdenticalRow, !isVertical, isOK); } else { emit notifyCommonPatterns(i, oneOtherIdenticalRow, !isVertical, !isOK); } if (oneOtherIdenticalRowColIsFound(oneOtherIdenticalCol)) { emit notifyCommonPatterns(j, oneOtherIdenticalCol, isVertical, isOK); } else { emit notifyCommonPatterns(j, oneOtherIdenticalCol, isVertical, !isOK); } return (!repetitionInRow && !repetitionInCol && (oneOtherIdenticalRow == _sizeMap) && (oneOtherIdenticalCol == _sizeMap)); } bool ModelTakuzu::rowIsValid(int i) { static auto forAll = [](bool tab[], int length) -> bool { for (int i = 0; i < length; ++i) { if (!tab[i]) return false; } return true; }; bool tab[_sizeMap]; for (int j = 0; j < _sizeMap; ++j) { tab[j] = positionIsValid(i, j); } return forAll(tab, _sizeMap) && (_countPawn._Brow[i] == _countPawn._Wrow[i]); } bool ModelTakuzu::colIsValid(int j) { static auto forAll = [](bool tab[], int length) -> bool { for (int i = 0; i < length; ++i) { if (!tab[i]) return false; } return true; }; bool tab[_sizeMap]; for (int i = 0; i < _sizeMap; ++i) { tab[i] = positionIsValid(i, j); } return forAll(tab, _sizeMap) && (_countPawn._Bcol[j] == _countPawn._Wcol[j]); } void ModelTakuzu::initCount() { for (int i = 0; i < _sizeMap; ++i) { for (int j = 0; j < _sizeMap; ++j) { updateCount(i, j, Empty, _grids[_chosenMap][i * _sizeMap + j]); } } } void ModelTakuzu::updateCount(int i, int j, Pawn oldPawn, Pawn newPawn) { if (oldPawn != newPawn) { switch (oldPawn) { case Black: _countPawn._Brow[i]--; _countPawn._Bcol[j]--; break; case White: _countPawn._Wrow[i]--; _countPawn._Wcol[j]--; break; case Empty: break; } switch (newPawn) { case Black: _countPawn._Brow[i]++; _countPawn._Bcol[j]++; break; case White: _countPawn._Wrow[i]++; _countPawn._Wcol[j]++; break; case Empty: break; } } emit notifyCount(i, j, _countPawn._Brow[i], _countPawn._Bcol[j], _countPawn._Wrow[i], _countPawn._Wcol[j]); } Pawn ModelTakuzu::getPawn(int i, int j) const { return _currentGrid[i * _sizeMap + j]; } bool ModelTakuzu::doFinalCheck() { std::vector<bool> isValid; for(int i = 0; i < _sizeMap; ++i) { for(int j = 0; j < _sizeMap; ++j) { isValid.push_back(positionIsValid(i, j)); } } std::vector<std::vector<Pawn>> rowsAndCols; for (int i = 0; i < _sizeMap; ++i) { rowsAndCols.push_back(getRow(i)); rowsAndCols.push_back(getCol(i)); } std::vector<int> counterOcc; std::for_each(rowsAndCols.begin(), rowsAndCols.end(), [&counterOcc](std::vector<Pawn> &vec) -> void { counterOcc.push_back(std::count(vec.begin(), vec.end(), Black)); counterOcc.push_back(std::count(vec.begin(), vec.end(), White)); }); return (std::all_of(_currentGrid.begin(), _currentGrid.end(), [](Pawn p)->bool { return (p != Empty);}) && std::all_of(isValid.begin(), isValid.end(), [](bool b)-> bool {return b;}) && std::all_of(counterOcc.begin(), counterOcc.end(), [this](int v) -> bool {return (_sizeMap == 2 * v);})); } void ModelTakuzu::registerPlayAt(int i, int j) { Pawn nextPawn = permuteR(pawnAt(i, j)); playAt(i, j, nextPawn); } void ModelTakuzu::registerChooseMapPool(ModelTakuzu::Difficulty difficulty, int size) { chooseMapPool(difficulty, size); } void ModelTakuzu::registerSizeMapPicked(ModelTakuzu::Difficulty difficulty, int size) { QString name = QString::number(size); if (difficulty == Easy) { name.append("_easy.txt"); } else { name.append("_hard.txt"); } _difficulty = difficulty; _sizeMap = size; loadFile(QString(name)); emit notifyNbMaps(_nbMaps); } void ModelTakuzu::registerChooseMapPicked(int mapPicked) { _chosenMap = mapPicked; setMap(_chosenMap); emit notifyNumberMap(_difficulty, _sizeMap, _chosenMap, _nbMaps); } void ModelTakuzu::registerAttemptToEndGame() { bool win = doFinalCheck(); emit notifyEndGame(win); } QChar ModelTakuzu::toQChar(Pawn pawn) { switch (pawn) { case Black: return QChar('B'); case White: return QChar('W'); case Empty: return QChar('.'); default: return QChar('.'); } } Pawn ModelTakuzu::toPawn(QChar letter) { switch (letter.unicode()) { case 'B': return Black; case 'W': return White; case '.': return Empty; default: return Empty; } } Pawn &ModelTakuzu::pawnAt(int i, int j) { assert(_chosenMap != -1 && "A map should be chosen before trying to access to _currentGrid."); return _currentGrid[i * _sizeMap + j]; } Pawn ModelTakuzu::pawnAt(int i, int j) const { assert(_chosenMap != -1 && "A map should be chosen before trying to access to _currentGrid."); return _currentGrid[i * _sizeMap + j]; } std::vector<Pawn> ModelTakuzu::getRow(int i) const { return std::vector<Pawn>(_currentGrid.begin() + i * _sizeMap, _currentGrid.begin() + (i + 1) * _sizeMap); } std::vector<Pawn> ModelTakuzu::getCol(int j) const { std::vector<Pawn> column; for (int row = 0; row < _sizeMap; ++row) { column.push_back(pawnAt(row, j)); } return column; } bool ModelTakuzu::isBBBorWWWpresentIn(std::vector<Pawn> vec) { static std::vector<Pawn> vecBBB = {Black, Black, Black}; static std::vector<Pawn> vecWWW = {White, White, White}; auto itB = std::search(vec.cbegin(), vec.cend(), vecBBB.cbegin(), vecBBB.cend()); auto itW = std::search(vec.cbegin(), vec.cend(), vecWWW.cbegin(), vecWWW.cend()); return (itB != vec.cend() || itW != vec.cend()); } int ModelTakuzu::findFirstIdenticalRowTo(int i) const { std::vector<Pawn> rowToScan = getRow(i); for (int rowIndex = 0; rowIndex < _sizeMap;++rowIndex) { if (rowIndex != i) { if (std::equal(_currentGrid.cbegin() + rowIndex * _sizeMap, _currentGrid.cbegin() + (rowIndex + 1) * _sizeMap, rowToScan.cbegin())) { return rowIndex; } } } return _sizeMap; } int ModelTakuzu::findFirstIdenticalColTo(int j) const { std::vector<Pawn> colToScan = getCol(j); for (int colIndex = 0; colIndex < _sizeMap; ++colIndex) { if (colIndex != j) { std::vector<Pawn> otherCol = getCol(colIndex); if (std::equal(colToScan.begin(), colToScan.end(), otherCol.begin(), otherCol.end())) { return colIndex; } } } return _sizeMap; }
#include "ModelTakuzu.h" #include <cassert> #include <iostream> #include <QtAlgorithms> #include <QFile> #include <QTextStream> ModelTakuzu::ModelTakuzu() { _nbMaps = -1; _sizeMap = -1; _grids = nullptr; } ModelTakuzu::~ModelTakuzu() { delete[] _grids; } Pawn ModelTakuzu::permuteR(Pawn p) { if (p == Black) { return White; } else if (p == White) { return Empty; } else { return Black; } } Pawn ModelTakuzu::permuteL(Pawn p) { if (p == Black) { return Empty; } else if (p == Empty) { return White; } else { return Black; } } void ModelTakuzu::loadFile(const QString &name) { QFile file(":/resources/"+name); if (!(file.open(QIODevice::ReadOnly | QIODevice::Text))) { std::cerr << "Error while opening new file: " << name.toStdString() << " .\n"; } else { QString line; QTextStream in(&file); bool ok = true; _nbMaps = in.readLine().toInt(&ok); if (!ok) { std::cerr << "Issue when reading new line. \n"\ << "Make sure the file has the same path as the executable.\n"; } _grids = new Grid_[_nbMaps]; for (int i = 0; i < _nbMaps; ++i) { _grids[i] = Grid_(_sizeMap * _sizeMap); } int i = 0; while (!in.atEnd()) { line = in.readLine(); int letterIndex = 0; QChar letter; foreach(letter, line) { if (letterIndex < _sizeMap * _sizeMap) { _grids[i][letterIndex++] = ModelTakuzu::toPawn(letter); } } i++; } } } void ModelTakuzu::chooseMapPool(ModelTakuzu::Difficulty difficulty, int size) { QString name = QString::number(size); if (difficulty == Easy) { name.append("_easy.txt"); } else { name.append("_hard.txt"); } _difficulty = difficulty; _sizeMap = size; loadFile(QString(name)); setRandomMap(); emit notifyNumberMap(_difficulty, _sizeMap, _chosenMap, _nbMaps); } int ModelTakuzu::setMap(int chosenMap) { assert((_nbMaps != -1 || _sizeMap != -1) && \ "Choose a map pool before using setRandomMap()."); _chosenMap = chosenMap; _currentGrid = _grids[chosenMap]; _countPawn = { std::vector<int>(_sizeMap), std::vector<int>(_sizeMap), std::vector<int>(_sizeMap), std::vector<int>(_sizeMap) }; for(int i = 0; i < _sizeMap; ++i) { for (int j = 0; j < _sizeMap; ++j) { emit notifyInitialPawn(i, j, _grids[chosenMap][i * _sizeMap + j]); } } initCount(); return _chosenMap; } int ModelTakuzu::setRandomMap() { int randomGridIndex = (rand() % _nbMaps); _chosenMap = setMap(randomGridIndex); return randomGridIndex; } void ModelTakuzu::playAt(int i, int j, Pawn pawn) { assert((!_currentGrid.empty()) && \ "Set a map using setRandomMap() before calling playAt()."); Pawn oldPawn = pawnAt(i, j); Pawn newPawn = pawn; updateCount(i, j, oldPawn, newPawn); pawnAt(i, j) = newPawn; positionIsValid(i, j); emit notifyNewPawn(i, j, pawn); } bool ModelTakuzu::positionIsValid(int i, int j) { const bool isVertical = true; const bool isOK = true; bool repetitionInRow = isBBBorWWWpresentIn(getRow(i)); bool repetitionInCol = isBBBorWWWpresentIn(getCol(j)); if (repetitionInRow) { emit notifyOverThreeAdjacentPawns(i, !isVertical, !isOK); } else { emit notifyOverThreeAdjacentPawns(i, !isVertical, isOK); } if (repetitionInCol) { emit notifyOverThreeAdjacentPawns(j, isVertical, !isOK); } else { emit notifyOverThreeAdjacentPawns(j, isVertical, isOK); } int oneOtherIdenticalRow = findFirstIdenticalRowTo(i); int oneOtherIdenticalCol = findFirstIdenticalColTo(j); static auto oneOtherIdenticalRowColIsFound = [this](int index) -> bool { return (index != _sizeMap); }; if (oneOtherIdenticalRowColIsFound(oneOtherIdenticalRow)) { emit notifyCommonPatterns(i, oneOtherIdenticalRow, !isVertical, isOK); } else { emit notifyCommonPatterns(i, oneOtherIdenticalRow, !isVertical, !isOK); } if (oneOtherIdenticalRowColIsFound(oneOtherIdenticalCol)) { emit notifyCommonPatterns(j, oneOtherIdenticalCol, isVertical, isOK); } else { emit notifyCommonPatterns(j, oneOtherIdenticalCol, isVertical, !isOK); } return (!repetitionInRow && !repetitionInCol && (oneOtherIdenticalRow == _sizeMap) && (oneOtherIdenticalCol == _sizeMap)); } bool ModelTakuzu::rowIsValid(int i) { static auto forAll = [](bool tab[], int length) -> bool { for (int i = 0; i < length; ++i) { if (!tab[i]) return false; } return true; }; bool tab[_sizeMap]; for (int j = 0; j < _sizeMap; ++j) { tab[j] = positionIsValid(i, j); } return forAll(tab, _sizeMap) && (_countPawn._Brow[i] == _countPawn._Wrow[i]); } bool ModelTakuzu::colIsValid(int j) { static auto forAll = [](bool tab[], int length) -> bool { for (int i = 0; i < length; ++i) { if (!tab[i]) return false; } return true; }; bool tab[_sizeMap]; for (int i = 0; i < _sizeMap; ++i) { tab[i] = positionIsValid(i, j); } return forAll(tab, _sizeMap) && (_countPawn._Bcol[j] == _countPawn._Wcol[j]); } void ModelTakuzu::initCount() { for (int i = 0; i < _sizeMap; ++i) { for (int j = 0; j < _sizeMap; ++j) { updateCount(i, j, Empty, _grids[_chosenMap][i * _sizeMap + j]); } } } void ModelTakuzu::updateCount(int i, int j, Pawn oldPawn, Pawn newPawn) { if (oldPawn != newPawn) { switch (oldPawn) { case Black: _countPawn._Brow[i]--; _countPawn._Bcol[j]--; break; case White: _countPawn._Wrow[i]--; _countPawn._Wcol[j]--; break; case Empty: break; } switch (newPawn) { case Black: _countPawn._Brow[i]++; _countPawn._Bcol[j]++; break; case White: _countPawn._Wrow[i]++; _countPawn._Wcol[j]++; break; case Empty: break; } } emit notifyCount(i, j, _countPawn._Brow[i], _countPawn._Bcol[j], _countPawn._Wrow[i], _countPawn._Wcol[j]); } Pawn ModelTakuzu::getPawn(int i, int j) const { return _currentGrid[i * _sizeMap + j]; } bool ModelTakuzu::doFinalCheck() { std::vector<bool> isValid; for(int i = 0; i < _sizeMap; ++i) { for(int j = 0; j < _sizeMap; ++j) { isValid.push_back(positionIsValid(i, j)); } } std::vector<std::vector<Pawn>> rowsAndCols; for (int i = 0; i < _sizeMap; ++i) { rowsAndCols.push_back(getRow(i)); rowsAndCols.push_back(getCol(i)); } std::vector<int> counterOcc;
; return (std::all_of(_currentGrid.begin(), _currentGrid.end(), [](Pawn p)->bool { return (p != Empty);}) && std::all_of(isValid.begin(), isValid.end(), [](bool b)-> bool {return b;}) && std::all_of(counterOcc.begin(), counterOcc.end(), [this](int v) -> bool {return (_sizeMap == 2 * v);})); } void ModelTakuzu::registerPlayAt(int i, int j) { Pawn nextPawn = permuteR(pawnAt(i, j)); playAt(i, j, nextPawn); } void ModelTakuzu::registerChooseMapPool(ModelTakuzu::Difficulty difficulty, int size) { chooseMapPool(difficulty, size); } void ModelTakuzu::registerSizeMapPicked(ModelTakuzu::Difficulty difficulty, int size) { QString name = QString::number(size); if (difficulty == Easy) { name.append("_easy.txt"); } else { name.append("_hard.txt"); } _difficulty = difficulty; _sizeMap = size; loadFile(QString(name)); emit notifyNbMaps(_nbMaps); } void ModelTakuzu::registerChooseMapPicked(int mapPicked) { _chosenMap = mapPicked; setMap(_chosenMap); emit notifyNumberMap(_difficulty, _sizeMap, _chosenMap, _nbMaps); } void ModelTakuzu::registerAttemptToEndGame() { bool win = doFinalCheck(); emit notifyEndGame(win); } QChar ModelTakuzu::toQChar(Pawn pawn) { switch (pawn) { case Black: return QChar('B'); case White: return QChar('W'); case Empty: return QChar('.'); default: return QChar('.'); } } Pawn ModelTakuzu::toPawn(QChar letter) { switch (letter.unicode()) { case 'B': return Black; case 'W': return White; case '.': return Empty; default: return Empty; } } Pawn &ModelTakuzu::pawnAt(int i, int j) { assert(_chosenMap != -1 && "A map should be chosen before trying to access to _currentGrid."); return _currentGrid[i * _sizeMap + j]; } Pawn ModelTakuzu::pawnAt(int i, int j) const { assert(_chosenMap != -1 && "A map should be chosen before trying to access to _currentGrid."); return _currentGrid[i * _sizeMap + j]; } std::vector<Pawn> ModelTakuzu::getRow(int i) const { return std::vector<Pawn>(_currentGrid.begin() + i * _sizeMap, _currentGrid.begin() + (i + 1) * _sizeMap); } std::vector<Pawn> ModelTakuzu::getCol(int j) const { std::vector<Pawn> column; for (int row = 0; row < _sizeMap; ++row) { column.push_back(pawnAt(row, j)); } return column; } bool ModelTakuzu::isBBBorWWWpresentIn(std::vector<Pawn> vec) { static std::vector<Pawn> vecBBB = {Black, Black, Black}; static std::vector<Pawn> vecWWW = {White, White, White}; auto itB = std::search(vec.cbegin(), vec.cend(), vecBBB.cbegin(), vecBBB.cend()); auto itW = std::search(vec.cbegin(), vec.cend(), vecWWW.cbegin(), vecWWW.cend()); return (itB != vec.cend() || itW != vec.cend()); } int ModelTakuzu::findFirstIdenticalRowTo(int i) const { std::vector<Pawn> rowToScan = getRow(i); for (int rowIndex = 0; rowIndex < _sizeMap;++rowIndex) { if (rowIndex != i) { if (std::equal(_currentGrid.cbegin() + rowIndex * _sizeMap, _currentGrid.cbegin() + (rowIndex + 1) * _sizeMap, rowToScan.cbegin())) { return rowIndex; } } } return _sizeMap; } int ModelTakuzu::findFirstIdenticalColTo(int j) const { std::vector<Pawn> colToScan = getCol(j); for (int colIndex = 0; colIndex < _sizeMap; ++colIndex) { if (colIndex != j) { std::vector<Pawn> otherCol = getCol(colIndex); if (std::equal(colToScan.begin(), colToScan.end(), otherCol.begin(), otherCol.end())) { return colIndex; } } } return _sizeMap; }
std::for_each(rowsAndCols.begin(), rowsAndCols.end(), [&counterOcc](std::vector<Pawn> &vec) -> void { counterOcc.push_back(std::count(vec.begin(), vec.end(), Black)); counterOcc.push_back(std::count(vec.begin(), vec.end(), White)); })
call_expression
[ { "content": "enum Pawn : unsigned char { Empty, Black, White};\n\nusing Grid_ = std::vector<Pawn>;\n\n\n", "file_path": "ModelTakuzu.h", "rank": 0, "score": 86767.76155417053 }, { "content": " void updateCount(int i, int j, Pawn oldPawn, Pawn newPawn);\n\n Pawn getPawn(int i, int j) const;\n\n bool doFinalCheck(); // no const because positionIsValid(int,int) no const\n\n\n\nsignals:\n\n void notifyNewPawn(int i, int j, Pawn newPawn);\n\n void notifyCount(int i, int j, int Brow, int Bcol, int Wrow, int Wcol);\n\n void notifyPositionIsValid(int i, int j, bool isValid);\n\n void notifyInitialPawn(int i, int j, Pawn readOnlyPawn);\n\n void notifyOverThreeAdjacentPawns(int index, bool isVertical, bool isOK); // \"!isVertical = isHorizontal\"\n\n void notifyCommonPatterns(int first, int second, bool isVertical, bool isOK);\n\n void notifyEndGame(bool win);\n\n void notifyNumberMap(ModelTakuzu::Difficulty difficulty, int sizeMap, int chosenMap, int nbMaps);\n\n void notifyNbMaps(int nbMaps);\n\npublic slots:\n\n void registerPlayAt(int i, int j);\n\n void registerChooseMapPool(ModelTakuzu::Difficulty difficulty, int size);\n\n void registerSizeMapPicked(ModelTakuzu::Difficulty difficulty, int size);\n\n void registerChooseMapPicked(int mapPicked);\n\n void registerAttemptToEndGame();\n", "file_path": "ModelTakuzu.h", "rank": 6, "score": 20.87064822446603 }, { "content": "\n\nvoid MainWindow::registerNewGamePicked()\n\n{\n\n QString size;\n\n ModelTakuzu::Difficulty difficulty;\n\n if (setGame(difficulty, size) == QMessageBox::Yes) {\n\n _ui->gridWidget->setRows(size.toInt());\n\n emit notifySizeMapPicked(difficulty, size.toInt());\n\n }\n\n}\n\n\n\nQMessageBox::StandardButton MainWindow::setGame(ModelTakuzu::Difficulty &difficulty, QString &size)\n\n{\n\n bool ok;\n\n QStringList sizes;\n\n sizes << \"6\" << \"8\" << \"10\";\n\n size = QInputDialog::getItem(this, \"Choose map size\", \"Size :\", sizes, 0, false, &ok);\n\n if (ok && !size.isEmpty()) {\n\n QStringList levels;\n\n levels << \"Easy\" << \"Hard\";\n", "file_path": "MainWindow.cpp", "rank": 9, "score": 18.952007009000894 }, { "content": "}\n\n\n\nvoid Grid::paintPawn(int row, int column, Pawn p) {\n\n QRect rect = _rects[row][column];\n\n int width = rect.width()/2-3;\n\n QPoint center(rect.center().x()+1.8, rect.center().y()+1.8);\n\n switch(p) {\n\n case Black:\n\n _painter->setBrush(Qt::black);\n\n _painter->drawEllipse(center, width, width);\n\n break;\n\n case White:\n\n _painter->setBrush(Qt::white);\n\n _painter->drawEllipse(center, width, width);\n\n break;\n\n case Empty:\n\n _painter->eraseRect(rect.x()+3, rect.y()+3, rect.width()-3, rect.height()-3);\n\n break;\n\n }\n\n // If initial pawns, the pawn is surrounded in blue\n", "file_path": "Grid.cpp", "rank": 15, "score": 17.291659462959835 }, { "content": " connect(_ui->actionShortcuts, SIGNAL(triggered()), this, SLOT(registerShortcutsPressed()));\n\n}\n\n\n\nMainWindow::~MainWindow()\n\n{\n\n delete _ui;\n\n delete _time;\n\n}\n\n\n\nvoid MainWindow::registerSetNewGame()\n\n{\n\n QString size;\n\n ModelTakuzu::Difficulty difficulty;\n\n if (setGame(difficulty, size) == QMessageBox::Yes) {\n\n _ui->gridWidget->setRows(size.toInt());\n\n emit notifyMapChosen(difficulty, size.toInt());\n\n startChrono();\n\n _ui->submitButton->setEnabled(true);\n\n }\n\n}\n", "file_path": "MainWindow.cpp", "rank": 16, "score": 17.11969036747967 }, { "content": "\n\nprivate: // methods\n\n void loadFile(const QString &name);\n\n static QChar toQChar(Pawn pawn);\n\n static Pawn toPawn(QChar letter);\n\n Pawn &pawnAt(int i, int j);\n\n Pawn pawnAt(int i, int j) const;\n\n std::vector<Pawn> getRow(int i) const;\n\n std::vector<Pawn> getCol(int j) const;\n\n static bool isBBBorWWWpresentIn(std::vector<Pawn> vec);\n\n int findFirstIdenticalRowTo(int i) const;\n\n int findFirstIdenticalColTo(int j) const;\n\n\n\nprivate: // attributes\n\n int _nbMaps;\n\n int _sizeMap;\n\n Difficulty _difficulty;\n\n Grid_ *_grids;\n\n int _chosenMap;\n\n Grid_ _currentGrid;\n", "file_path": "ModelTakuzu.h", "rank": 17, "score": 16.509531782716103 }, { "content": " QString level = QInputDialog::getItem(this, \"Choose difficulty level\", \"Level :\", levels, 0, false, &ok);\n\n difficulty = level==\"Easy\"?ModelTakuzu::Difficulty::Easy:ModelTakuzu::Difficulty::Hard;\n\n if (ok && !level.isEmpty()) {\n\n QMessageBox::StandardButton button;\n\n button = QMessageBox::question(this, \"Choices\",\n\n \"You have chosen a \"+size+\"x\"+size+\" grid with the difficulty '\"+level+\"'.\\n\"\n\n \"Are you sure ?\",\n\n QMessageBox::Yes | QMessageBox::No, QMessageBox::No);\n\n return button;\n\n }\n\n }\n\n}\n\n\n\nvoid MainWindow::registerPickMap(int nbMaps)\n\n{\n\n bool ok;\n\n QStringList maps;\n\n for (int i = 1; i <= nbMaps; i++) {\n\n maps << QString::number(i);\n\n }\n", "file_path": "MainWindow.cpp", "rank": 18, "score": 15.999713801770596 }, { "content": " void registerNewGamePicked();\n\n void registerPickMap(int nbMaps);\n\n void registerChronoChanged();\n\n void registerQuitPressed();\n\n void registerRulesPressed();\n\n void registerAboutPressed();\n\n void registerEndGame(bool win);\n\n void registerShortcutsPressed();\n\n void registerNumberMap(ModelTakuzu::Difficulty difficulty, int sizeMap, int chosenMap, int nbMaps);\n\n\n\nprivate:\n\n Ui::MainWindow* _ui;\n\n QTime* _time;\n\n QTimer* _chrono;\n\n\n\n QMessageBox::StandardButton setGame(ModelTakuzu::Difficulty &difficulty, QString &size);\n\n void startChrono();\n\n};\n\n\n\n#endif // MAINWINDOW_H*/\n", "file_path": "MainWindow.h", "rank": 23, "score": 14.061166003018428 }, { "content": " if (_initPawns[row*_rows+column]) {\n\n QPen penInit(Qt::blue);\n\n penInit.setWidth(3);\n\n _painter->setPen(penInit);\n\n _painter->drawEllipse(center, width, width);\n\n _painter->setPen(*_pen);\n\n }\n\n}\n\n\n\nvoid Grid::paintCount(bool isRow, int index, int black, int white)\n\n{\n\n QRect countAreaBlack;\n\n QRect countAreaWhite;\n\n if (isRow) {\n\n countAreaBlack = _rowCountArea[index*2];\n\n countAreaWhite = _rowCountArea[index*2+1];\n\n } else {\n\n countAreaBlack = _columnCountArea[index*2];\n\n countAreaWhite = _columnCountArea[index*2+1];\n\n }\n", "file_path": "Grid.cpp", "rank": 24, "score": 14.009984111766732 }, { "content": " repaint();\n\n}\n\n\n\nvoid Grid::registerOverThreeAdjacentPawns(int index, bool isVertical, bool isOk)\n\n{\n\n if (isVertical) {\n\n _invalidVertical[index] = !isOk;\n\n } else {\n\n _invalidHorizontal[index] = !isOk;\n\n }\n\n}\n\n\n\nvoid Grid::registerCommonPatterns(int first, int second, bool isVertical, bool isOK)\n\n{\n\n if (isVertical) {\n\n if (isOK) {\n\n _commonColumns[second*_rows+first] = isOK;\n\n _commonColumns[first*_rows+second] = isOK;\n\n } else {\n\n for (int i = 0; i < _rows; i++) {\n", "file_path": "Grid.cpp", "rank": 25, "score": 13.442872966134868 }, { "content": "#include \"PresenterTakuzu.h\"\n\n#include \"PlayCommand.h\"\n\n\n\nPresenterTakuzu::PresenterTakuzu(QObject *parent) : QObject(parent)\n\n{\n\n _model = new ModelTakuzu();\n\n _view = new MainWindow();\n\n _view->show();\n\n connect(_view, SIGNAL(notifyMapChosen(ModelTakuzu::Difficulty,int)), _model, SLOT(registerChooseMapPool(ModelTakuzu::Difficulty,int)));\n\n connect(_view, SIGNAL(notifySizeMapPicked(ModelTakuzu::Difficulty,int)), _model, SLOT(registerSizeMapPicked(ModelTakuzu::Difficulty,int)));\n\n connect(_model, SIGNAL(notifyNbMaps(int)), _view, SLOT(registerPickMap(int)));\n\n connect(_view, SIGNAL(notifMapPicked(int)), _model, SLOT(registerChooseMapPicked(int)));\n\n connect(_model, SIGNAL(notifyNumberMap(ModelTakuzu::Difficulty,int,int,int)), _view, SLOT(registerNumberMap(ModelTakuzu::Difficulty,int,int,int)));\n\n connect(_view->getGrid(), SIGNAL(notifyCoordinatesClicked(int,int)), _model, SLOT(registerPlayAt(int,int)));\n\n connect(_model, SIGNAL(notifyCount(int,int,int,int,int,int)), _view->getGrid(), SLOT(registerCount(int,int,int,int,int,int)));\n\n connect(_model, SIGNAL(notifyInitialPawn(int,int,Pawn)), _view->getGrid(), SLOT(registerInitialPawn(int,int,Pawn)));\n\n connect(_model, SIGNAL(notifyNewPawn(int,int,Pawn)), _view->getGrid(), SLOT(registerNewPawn(int,int,Pawn)));\n\n _undoStack = new QUndoStack(this);\n\n _undoStack->setUndoLimit(10);\n\n _view->getUndoButton()->setDefaultAction(_undoStack->createUndoAction(this, tr(\"&Undo\")));\n", "file_path": "PresenterTakuzu.cpp", "rank": 26, "score": 13.334162790176283 }, { "content": " QString mapPicked = QInputDialog::getItem(this, \"Choose one grid\", \"Grid number :\", maps, 0, false, &ok);\n\n if (ok && !mapPicked.isEmpty()) {\n\n emit notifMapPicked(mapPicked.toInt()-1);\n\n startChrono();\n\n _ui->submitButton->setEnabled(true);\n\n }\n\n}\n\n\n\nvoid MainWindow::startChrono()\n\n{\n\n _chrono = new QTimer(this);\n\n _chrono->start(1000);\n\n _time = new QTime;\n\n _time->start();\n\n connect(_chrono, SIGNAL(timeout()), this, SLOT(registerChronoChanged()));\n\n}\n\n\n\nvoid MainWindow::registerChronoChanged()\n\n{\n\n _ui->timeEdit->setTime(QTime(0,0).addMSecs(_time->elapsed()));\n", "file_path": "MainWindow.cpp", "rank": 27, "score": 13.2217442976837 }, { "content": " if (event->button() == Qt::LeftButton) {\n\n int x = (event->x()-_margin) / _widthRect;\n\n int y = event->y() / _widthRect;\n\n if (x < _rows && event->x()-_margin > 0) {\n\n if (y < _rows) {\n\n if (!_initPawns[x*_rows+y]) {\n\n emit notifyCoordinatesClicked(y,x);\n\n }\n\n }\n\n }\n\n }\n\n}\n\n\n\nvoid Grid::setRows(int rows)\n\n{\n\n _rows = rows;\n\n _rowCounts = new int[_rows*2]();\n\n _colCounts = new int[_rows*2]();\n\n _initPawns = new bool[_rows*_rows];\n\n _pawns = new Pawn[_rows*_rows];\n", "file_path": "Grid.cpp", "rank": 29, "score": 12.375313841914393 }, { "content": "{\n\n _rowCounts[i*2] = Brow;\n\n _rowCounts[i*2+1] = Wrow;\n\n _colCounts[j*2] = Bcol;\n\n _colCounts[j*2+1] = Wcol;\n\n repaint();\n\n}\n\n\n\nvoid Grid::registerInitialPawn(int i, int j, Pawn p)\n\n{\n\n if (p != Empty) {\n\n _initPawns[j*_rows+i] = true;\n\n }\n\n _pawns[j*_rows+i] = p;\n\n repaint();\n\n}\n\n\n\nvoid Grid::registerNewPawn(int i, int j, Pawn p)\n\n{\n\n _pawns[j*_rows+i] = p;\n", "file_path": "Grid.cpp", "rank": 31, "score": 11.966793557273151 }, { "content": " void registerOverThreeAdjacentPawns(int index, bool isVertical, bool isOk);\n\n void registerCommonPatterns(int first, int second, bool isVertical, bool isOK);\n\n\n\nprivate:\n\n int _rows = 0;\n\n int _widthRect;\n\n int _margin;\n\n QPen* _pen;\n\n QPainter* _painter;\n\n QRect** _rects;\n\n QRect* _rowCountArea;\n\n QRect* _columnCountArea;\n\n int* _rowCounts;\n\n int* _colCounts;\n\n bool* _initPawns;\n\n Pawn* _pawns;\n\n bool* _invalidVertical;\n\n bool* _invalidHorizontal;\n\n bool* _commonRows;\n\n bool* _commonColumns;\n\n};\n\n\n\n#endif // GRID_H\n", "file_path": "Grid.h", "rank": 32, "score": 11.931595113983484 }, { "content": "}\n\n\n\nvoid MainWindow::registerNumberMap(ModelTakuzu::Difficulty difficulty, int sizeMap, int chosenMap, int nbMaps)\n\n{\n\n _ui->mapLabel->setText(\"Grid : \" + QString::number(sizeMap)+ \"x\" + QString::number(sizeMap)\n\n + \" \" + QString(difficulty) + \" \"\n\n + QString::number(chosenMap+1) + \"/\" + QString::number(nbMaps));\n\n}\n\n\n\nvoid MainWindow::registerQuitPressed()\n\n{\n\n QMessageBox::StandardButton button;\n\n button = QMessageBox::question(this, \"You want to quit...\",\n\n \"Are you sure that you want to quit\"\n\n \" this application ?\",\n\n QMessageBox::Yes | QMessageBox::No, QMessageBox::No);\n\n if (button == QMessageBox::Yes) {\n\n close();\n\n }\n\n}\n", "file_path": "MainWindow.cpp", "rank": 33, "score": 11.796303724538369 }, { "content": " _invalidHorizontal = new bool[_rows];\n\n _invalidVertical = new bool[_rows];\n\n _commonRows = new bool[_rows*_rows];\n\n _commonColumns = new bool[_rows*_rows];\n\n\n\n for (int i = 0; i < _rows; i++) {\n\n _invalidHorizontal[i] = false;\n\n _invalidVertical[i] = false;\n\n for (int j = 0; j < _rows; j++) {\n\n _commonRows[i*_rows+j] = false;\n\n _commonColumns[i*_rows+j] = false;\n\n _initPawns[i*_rows+j] = false;\n\n _pawns[i*_rows+j] = Empty;\n\n }\n\n }\n\n\n\n repaint();\n\n}\n\n\n\nvoid Grid::registerCount(int i, int j, int Brow, int Bcol, int Wrow, int Wcol)\n", "file_path": "Grid.cpp", "rank": 34, "score": 11.437677377937561 }, { "content": "#include \"PlayCommand.h\"\n\n#include <assert.h>\n\n\n\nPlayCommand::PlayCommand(ModelTakuzu *m, int i, int j, Pawn p)\n\n{\n\n _model = m;\n\n assert(i >= 0 && \"Row index should be >= 0\");\n\n assert(j >= 0 && \"Col index should be >= 0\");\n\n _row = i;\n\n _col = j;\n\n _pawn = p;\n\n}\n\n\n\nPlayCommand::~PlayCommand()\n\n{\n\n\n\n}\n\n\n\nvoid PlayCommand::undo()\n\n{\n\n Pawn oldPawn = ModelTakuzu::permuteL(_pawn);\n\n _model->playAt(_row, _col, oldPawn);\n\n}\n\n\n\nvoid PlayCommand::redo()\n\n{\n\n _model->playAt(_row, _col, _pawn);\n\n}\n", "file_path": "PlayCommand.cpp", "rank": 36, "score": 10.147338298040584 }, { "content": " _view->getRedoButton()->setDefaultAction(_undoStack->createRedoAction(this, tr(\"&Redo\")));\n\n connect(_view->getGrid(), SIGNAL(notifyCoordinatesClicked(int, int)), this, SLOT(registerCommand(int, int)));\n\n connect(_model, SIGNAL(notifyOverThreeAdjacentPawns(int,bool,bool)), _view->getGrid(), SLOT(registerOverThreeAdjacentPawns(int,bool,bool)));\n\n connect(_model, SIGNAL(notifyCommonPatterns(int,int,bool,bool)), _view->getGrid(), SLOT(registerCommonPatterns(int,int,bool,bool)));\n\n connect(_view->getUndoButton(), SIGNAL(triggered(QAction*)), this, SLOT(registerUndoRedoTriggered()));\n\n connect(_view->getRedoButton(), SIGNAL(triggered(QAction*)), this, SLOT(registerUndoRedoTriggered()));\n\n connect(_view->getSubmitButton(), SIGNAL(clicked()), _model, SLOT(registerAttemptToEndGame()));\n\n connect(_model, SIGNAL(notifyEndGame(bool)), _view, SLOT(registerEndGame(bool)));\n\n}\n\n\n\nPresenterTakuzu::~PresenterTakuzu()\n\n{\n\n delete _model;\n\n}\n\n\n\nvoid PresenterTakuzu::registerCommand(int i, int j)\n\n{\n\n _undoStack->push(new PlayCommand(_model, i, j, _model->getPawn(i, j)));\n\n _view->getLabelNbUndo()->setText(\"Number of undo done : \"+QString::number(0));\n\n}\n\n\n\nvoid PresenterTakuzu::registerUndoRedoTriggered()\n\n{\n\n _view->getLabelNbUndo()->setText(\"Number of undo done : \"+QString::number(_undoStack->count()-_undoStack->index()));\n\n}\n\n\n", "file_path": "PresenterTakuzu.cpp", "rank": 38, "score": 9.680357061072735 }, { "content": "\n\nvoid MainWindow::registerRulesPressed()\n\n{\n\n QMessageBox::information(this, \"Rules of Takuzu\", \"To win the game, you must fill the grid with black and white pawns respecting three rules:\\n\\n\"\n\n \"-Same number of black and white pawns on each row and each column;\\n\"\n\n \"-No more than 2 pawns of the same color in a raw;\\n\"\n\n \"-2 rows or 2 columns must not be the same.\");\n\n}\n\n\n\nvoid MainWindow::registerAboutPressed()\n\n{\n\n QMessageBox::information(this, \"About this application\", \"Takuzu\\n\"\n\n \"(c) 2020 Christian Zheng and Quentin Derambure\");\n\n}\n\n\n\nvoid MainWindow::registerEndGame(bool winStatus)\n\n{\n\n if (winStatus) {\n\n _chrono->stop();\n\n QTime endTime = QTime(0,0).addMSecs(_time->elapsed());\n", "file_path": "MainWindow.cpp", "rank": 39, "score": 8.614771455463329 }, { "content": "#include \"Grid.h\"\n\n\n\nGrid::Grid(QWidget *parent) : QWidget(parent)\n\n{\n\n\n\n}\n\n\n\nvoid Grid::paintEvent(QPaintEvent *)\n\n{\n\n _painter = new QPainter(this);\n\n _pen = new QPen(Qt::black);\n\n _pen->setWidth(3);\n\n _painter->setPen(*_pen);\n\n\n\n int width = (QWidget::width()<QWidget::height())?QWidget::width():QWidget::height();\n\n _widthRect = width/(_rows+2);\n\n _margin = (QWidget::width()-width+2*_widthRect)/2;\n\n\n\n _rects = new QRect*[_rows];\n\n _rowCountArea = new QRect[_rows*2];\n", "file_path": "Grid.cpp", "rank": 40, "score": 8.499665599052825 }, { "content": "\n\n if (black == _rows/2 && white == _rows/2) {\n\n _painter->fillRect(countAreaBlack, Qt::green);\n\n _painter->fillRect(countAreaWhite, Qt::green);\n\n _painter->drawText(countAreaBlack, Qt::AlignCenter, \"O\");\n\n _painter->drawText(countAreaWhite, Qt::AlignCenter, \"K\");\n\n } else {\n\n _painter->fillRect(countAreaBlack, Qt::black);\n\n _painter->fillRect(countAreaWhite, Qt::white);\n\n QPen penWhite(Qt::white);\n\n penWhite.setWidth(3);\n\n _painter->setPen(penWhite);\n\n _painter->drawText(countAreaBlack, Qt::AlignCenter, QString::number(black));\n\n _painter->setPen(*_pen);\n\n _painter->drawText(countAreaWhite, Qt::AlignCenter, QString::number(white));\n\n }\n\n}\n\n\n\nvoid Grid::mousePressEvent(QMouseEvent* event)\n\n{\n", "file_path": "Grid.cpp", "rank": 41, "score": 8.236653281390847 }, { "content": "#include \"MainWindow.h\"\n\n#include \"ui_MainWindow.h\"\n\n#include <QGraphicsEffect>\n\n#include <QInputDialog>\n\n#include <QPropertyAnimation>\n\n#include <QTimer>\n\n\n\nMainWindow::MainWindow(QWidget *parent) :\n\n QMainWindow(parent),\n\n _ui(new Ui::MainWindow)\n\n{\n\n _ui->setupUi(this);\n\n\n\n _ui->submitButton->setEnabled(false);\n\n\n\n connect(_ui->newGame, SIGNAL(triggered()), this, SLOT(registerSetNewGame()));\n\n connect(_ui->newGamePicked, SIGNAL(triggered()), this, SLOT(registerNewGamePicked()));\n\n connect(_ui->actionQuit, SIGNAL(triggered()), this, SLOT(registerQuitPressed()));\n\n connect(_ui->actionRules, SIGNAL(triggered()), this, SLOT(registerRulesPressed()));\n\n connect(_ui->actionAbout, SIGNAL(triggered()), this, SLOT(registerAboutPressed()));\n", "file_path": "MainWindow.cpp", "rank": 43, "score": 6.402113165648233 }, { "content": "#include <QApplication>\n\n\n\n#include \"PresenterTakuzu.h\"\n\n\n\nint main(int argc, char *argv[])\n\n{\n\n srand((unsigned)time(0));\n\n QApplication a(argc, argv);\n\n PresenterTakuzu *presenter = new PresenterTakuzu();\n\n presenter = presenter;\n\n return a.exec();\n\n\n\n}\n", "file_path": "main.cpp", "rank": 44, "score": 6.2893227478539515 }, { "content": " if (_commonColumns[i*_rows+j]) {\n\n rect = _rects[i][0];\n\n _painter->drawRect(rect.x(), rect.y(), _widthRect, _rows*_widthRect);\n\n rect = _rects[j][0];\n\n _painter->drawRect(rect.x(), rect.y(), _widthRect, _rows*_widthRect);\n\n }\n\n }\n\n _painter->setPen(*_pen);\n\n }\n\n\n\n // Draws pawns and counts\n\n for (int i = 0; i < _rows; i++) {\n\n paintCount(true, i, _rowCounts[i*2], _rowCounts[i*2+1]);\n\n paintCount(false, i, _colCounts[i*2], _colCounts[i*2+1]);\n\n for (int j = 0; j < _rows; j++) {\n\n paintPawn(i, j, _pawns[i*_rows+j]);\n\n }\n\n }\n\n\n\n _painter->end();\n", "file_path": "Grid.cpp", "rank": 45, "score": 6.27242596781086 }, { "content": " QMessageBox::information(this, \"Victory !\", \"You won the game in \"\n\n + QString::number(endTime.minute()) + \" minutes and \"\n\n + QString::number(endTime.second()) + \" seconds !\");\n\n } else {\n\n _ui->incorrectLabel->setText(\"The grid is not correctly filled.\");\n\n QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect();\n\n _ui->incorrectLabel->setGraphicsEffect(effect);\n\n QPropertyAnimation *animation = new QPropertyAnimation(effect,\"opacity\");\n\n animation->setDuration(3000);\n\n animation->setStartValue(1.0);\n\n animation->setEndValue(0.0);\n\n animation->setEasingCurve(QEasingCurve::OutQuad);\n\n connect(animation, &QPropertyAnimation::finished, [=](){\n\n _ui->incorrectLabel->setText(\"\");\n\n });\n\n animation->start(QAbstractAnimation::DeleteWhenStopped);\n\n }\n\n}\n\n\n\nvoid MainWindow::registerShortcutsPressed()\n", "file_path": "MainWindow.cpp", "rank": 46, "score": 5.9779931217556115 }, { "content": "#ifndef MODELTAKUZU_H\n\n#define MODELTAKUZU_H\n\n\n\n#include <algorithm>\n\n#include <set>\n\n#include <string>\n\n#include <vector>\n\n#include <QObject>\n\n#include <QString>\n\n\n", "file_path": "ModelTakuzu.h", "rank": 47, "score": 5.418712404912995 }, { "content": " if (_commonColumns[i*_rows+first]) {\n\n _commonColumns[i*_rows+first] = isOK;\n\n }\n\n _commonColumns[first*_rows+i] = isOK;\n\n }\n\n }\n\n } else {\n\n if (isOK) {\n\n _commonRows[second*_rows+first] = isOK;\n\n _commonRows[first*_rows+second] = isOK;\n\n } else {\n\n for (int i = 0; i < _rows; i++) {\n\n if (_commonRows[i*_rows+first]) {\n\n _commonRows[i*_rows+first] = isOK;\n\n }\n\n _commonRows[first*_rows+i] = isOK;\n\n }\n\n }\n\n }\n\n}\n\n\n", "file_path": "Grid.cpp", "rank": 48, "score": 4.432540251471329 }, { "content": " struct {\n\n std::vector<int> _Wrow;\n\n std::vector<int> _Brow;\n\n std::vector<int> _Wcol;\n\n std::vector<int> _Bcol;\n\n } _countPawn;\n\n};\n\n\n\n#endif // MODELTAKUZU_H\n", "file_path": "ModelTakuzu.h", "rank": 49, "score": 4.269919091211319 }, { "content": "{\n\n QMessageBox::information(this, \"Shortcuts\", \"New Random Game : CTRL + N\\n\"\n\n \"Pick One Grid : CTRL + P\\n\"\n\n \"Quit : CTRL + Q\\n\"\n\n \"Undo : CTRL + Z\\n\"\n\n \"Redo : CTRL + SHIFT + Z\\n\"\n\n \"Submit : Space\");\n\n}\n\n\n\nQWidget *MainWindow::getGrid() const\n\n{\n\n return _ui->gridWidget;\n\n}\n\n\n\nQToolButton *MainWindow::getRedoButton() const\n\n{\n\n return _ui->redoButton;\n\n}\n\n\n\nQToolButton *MainWindow::getUndoButton() const\n", "file_path": "MainWindow.cpp", "rank": 50, "score": 4.22835517290401 }, { "content": "# Takuzu board game - Qt GUI project\n\n_last edit: 10 April 2020_\n\n\n\n----\n\n__Authors__:\n\n- *Quentin DERAMBURE <[email protected]>*\n\n- *Christian ZHENG <[email protected]>*\n\n\n\n## Description\n\n\n\nThis project is part of the practical work [Graphic interface design](http://livretpedagogique.ensicaen.fr/pages/afficherMatiere.php?s=1&m=0&u=73&mo=178&ma=253&) taught by Mr. Fourey at [ENSICAEN](https://www.ensicaen.fr/)(France).\n\n\n\nThe objective is to recreate the game of [Takuzu](https://en.wikipedia.org/wiki/Takuzu).\n\n\n\n## Implemented core features\n\n\n\n- [x] Choice of size and level of difficulty\n\n- [x] Indication of correct lines/columns\n\n- [x] Stopwatch indicating game time\n\n- [x] Highlighting of errors (more than three contiguous pawns of the same colour, identical rows/columns)\n\n- [x] Numerical indication of the number of cells of each colour on each row/column\n\n- [x] Counting the number of rewind made by the player\n\n- [ ] Customizing the display of checkbox states (other than by disks)\n\n- [ ] Different modes of assistance\n\n\n\n## Choices made regarding ergonomics\n\n\n\nSome useful keyboard shortcuts are implemented. A comprehensive list is accessible throught the interface.\n\nThe window is easily resizable, and the grid stays at the center.\n\n\n\n![Screenshot](screenshot_Takuzu.png)\n\n\n\n\n\n## Modeling choices\n\n\n\nFor the architecture of our software, we have proceeded to a three-thirds division, Model-View-Presentation, coupled with a design-pattern Command(management of undo/redo).\n\n\n\n![UML Diagram](uml.png)\n\n\n\nMost of the communication between the classes of our software takes place with the system of Slots that pick up Signals, allowed by Qt.\n\n![Sequence Diagram](seqDiag.svg)\n\n\n", "file_path": "README.md", "rank": 51, "score": 3.907435307413937 }, { "content": "#ifndef MAINWINDOW_H\n\n#define MAINWINDOW_H\n\n\n\n#include <QMainWindow>\n\n#include <QToolButton>\n\n#include <QLabel>\n\n#include <QPushButton>\n\n#include <ModelTakuzu.h>\n\n#include <QMessageBox>\n\n\n\nnamespace Ui {\n", "file_path": "MainWindow.h", "rank": 52, "score": 3.2937738010174327 }, { "content": "#ifndef GRID_H\n\n#define GRID_H\n\n\n\n#include <QWidget>\n\n#include <QPainter>\n\n#include <QMouseEvent>\n\n#include \"ModelTakuzu.h\"\n\n\n", "file_path": "Grid.h", "rank": 53, "score": 3.244338062850887 }, { "content": "#ifndef PRESENTERTAKUZU_H\n\n#define PRESENTERTAKUZU_H\n\n\n\n#include <QObject>\n\n#include <QUndoStack>\n\n\n\n#include \"ModelTakuzu.h\"\n\n#include \"MainWindow.h\"\n\n\n", "file_path": "PresenterTakuzu.h", "rank": 54, "score": 3.244338062850887 }, { "content": " _columnCountArea = new QRect[_rows*2];\n\n\n\n // Draws grid\n\n for (int i = 0; i < _rows; ++i) {\n\n _rects[i] = new QRect[_rows];\n\n for (int j = 0; j < _rows; ++j) {\n\n _rects[i][j] = QRect(i*_widthRect+_margin, j*_widthRect, _widthRect, _widthRect);\n\n _painter->drawRect(_rects[i][j]);\n\n }\n\n _rowCountArea[i*2] = QRect(_rows*_widthRect+_margin+5, i*_widthRect, _widthRect, _widthRect);\n\n _columnCountArea[i*2] = QRect(i*_widthRect+_margin, _rows*_widthRect+5, _widthRect, _widthRect);\n\n _rowCountArea[i*2+1] = QRect((_rows+1)*_widthRect+_margin+5, i*_widthRect, _widthRect, _widthRect);\n\n _columnCountArea[i*2+1] = QRect(i*_widthRect+_margin, (_rows+1)*_widthRect+5, _widthRect, _widthRect);\n\n }\n\n\n\n // Draws in red invalid rows and highlights common rows in orange\n\n QRect rect;\n\n for (int i = 0; i < _rows; i++) {\n\n if (_invalidHorizontal[i]) {\n\n for (int j = 0; j < _rows; j++) {\n", "file_path": "Grid.cpp", "rank": 55, "score": 3.0129583238315805 }, { "content": " rect = _rects[j][i];\n\n _painter->fillRect(rect.x()+3, rect.y()+3, rect.width()-3, rect.height()-3, QBrush(Qt::red));\n\n }\n\n }\n\n if (_invalidVertical[i]) {\n\n for (int j = 0; j < _rows; j++) {\n\n rect = _rects[i][j];\n\n _painter->fillRect(rect.x()+3, rect.y()+3, rect.width()-3, rect.height()-3, QBrush(Qt::red));\n\n }\n\n }\n\n QPen penOrange(QColor(\"#ffb000\"));\n\n penOrange.setWidth(3);\n\n _painter->setPen(penOrange);\n\n for (int j = 0; j < _rows; j++) {\n\n if (_commonRows[i*_rows+j]) {\n\n rect = _rects[0][i];\n\n _painter->drawRect(rect.x(), rect.y(), _rows*_widthRect, _widthRect);\n\n rect = _rects[0][j];\n\n _painter->drawRect(rect.x(), rect.y(), _rows*_widthRect, _widthRect);\n\n }\n", "file_path": "Grid.cpp", "rank": 56, "score": 2.9848185082476437 }, { "content": "#ifndef PLAYCOMMAND_H\n\n#define PLAYCOMMAND_H\n\n\n\n#include <QUndoCommand>\n\n#include \"ModelTakuzu.h\"\n\n\n", "file_path": "PlayCommand.h", "rank": 57, "score": 2.9434491058389725 } ]
C++
hardware/interface/power/Power.cpp
aospwhatawurst/aosp_android_device_samsung_exynos9820-common
77fe612901d6133d2734619cd3d1e86f6e7f0200
#define LOG_TAG "[email protected]" #include <android-base/logging.h> #include <android-base/file.h> #include <android-base/properties.h> #include <android-base/strings.h> #include "Power.h" #include <tsp.h> #include <iostream> namespace android { namespace hardware { namespace power { namespace V1_0 { namespace implementation { using ::android::hardware::power::V1_0::Feature; using ::android::hardware::power::V1_0::PowerHint; using ::android::hardware::power::V1_0::PowerStatePlatformSleepState; using ::android::hardware::power::V1_0::Status; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) static std::string interactive_node_paths[] = { "/sys/class/sec/tsp/input/enabled", "/sys/class/sec/tsp1/input/enabled", "/sys/class/sec/tsp2/input/enabled", "/sys/class/sec/sec_epen/input/enabled", "/sys/class/sec/sec_touchkey/input/enabled", "/sys/class/sec/sec_sidekey/input/enabled", "/sys/class/power_supply/battery/lcd" }; template <typename T> static void writeNode(const std::string& path, const T& value) { std::ofstream node(path); if (!node) { PLOG(ERROR) << "Failed to open: " << path; return; } LOG(DEBUG) << "writeNode node: " << path << " value: " << value; node << value << std::endl; if (!node) { PLOG(ERROR) << "Failed to write: " << value; } } static bool doesNodeExist(const std::string& path) { std::ifstream f(path.c_str()); if (f.good()) { LOG(DEBUG) << "Found node: " << path; } return f.good(); } Power::Power() { size_t inode_size = ARRAY_SIZE(interactive_node_paths); mInteractionHandler.Init(); mEpic.Init(); tsp_init(); LOG(DEBUG) << "Looking for touchsceen/lcd nodes"; for (size_t i = 0; i < inode_size; i++) { std::string node_path = interactive_node_paths[i]; if (doesNodeExist(node_path)) { mInteractiveNodes.push_back(node_path); } } } Return<void> Power::setInteractive(bool interactive) { writeNode("/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq", interactive ? "1950000" : "1053000"); if (mDoubleTapEnabled && !interactive) { tsp_enable_doubletap(); } for (size_t i = 0; i < mInteractiveNodes.size(); i++) { writeNode(mInteractiveNodes[i], interactive ? "1" : "0"); } if (mDoubleTapEnabled && interactive) { tsp_disable_doubletap(); } return Void(); } Return<void> Power::powerHint(PowerHint hint, int32_t data __unused) { switch (hint) { #if 0 case PowerHint::INTERACTION: mInteractionHandler.Acquire(data); break; #endif case PowerHint::VIDEO_ENCODE: { mEpic.videoEncode(hint); break; } default: return Void(); } return Void(); } Return<void> Power::setFeature(Feature feature, bool activate) { switch (feature) { case Feature::POWER_FEATURE_DOUBLE_TAP_TO_WAKE: if (activate) { LOG(INFO) << "Enable double tap to wake"; mDoubleTapEnabled = true; } else { LOG(INFO) << "Disable double tap to wake"; mDoubleTapEnabled = false; } break; default: break; } return Void(); } Return<void> Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) { hidl_vec<PowerStatePlatformSleepState> states; _hidl_cb(states, Status::SUCCESS); return Void(); } } } } } }
#define LOG_TAG "[email protected]" #include <android-base/logging.h> #include <android-base/file.h> #include <android-base/properties.h> #include <android-base/strings.h> #include "Power.h" #include <tsp.h> #include <iostream> namespace android { namespace hardware { namespace power { namespace V1_0 { namespace implementation { using ::android::hardware::power::V1_0::Feature; using ::android::hardware::power::V1_0::PowerHint; using ::android::hardware::power::V1_0::PowerStatePlatformSleepState; using ::android::hardware::power::V1_0::Status; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) static std::string interactive_node_paths[] = { "/sys/class/sec/tsp/input/enabled", "/sys/class/sec/tsp1/input/enabled", "/sys/class/sec/tsp2/input/enabled", "/sys/class/sec/sec_epen/input/enabled", "/sys/class/sec/sec_touchkey/input/enabled", "/sys/class/sec/sec_sidekey/input/enabled", "/sys/class/power_supply/battery/lcd" }; template <typename T> static void writeNode(const std::string& path, const T& value) { std::ofstream node(path); if (!node) { PLOG(ERROR) << "Failed to open: " << path; return; } LOG(DEBUG) << "writeNode node: " << path << " value: " << value; node << value << std::endl; if (!node) { PLOG(ERROR) << "Failed to write: " << value; } } static bool doesNodeExist(const std::string& path) { std::ifstream f(path.c_str()); if (f.good()) { LOG(DEBUG) << "Found node: " << path; } return f.good(); }
Return<void> Power::setInteractive(bool interactive) { writeNode("/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq", interactive ? "1950000" : "1053000"); if (mDoubleTapEnabled && !interactive) { tsp_enable_doubletap(); } for (size_t i = 0; i < mInteractiveNodes.size(); i++) { writeNode(mInteractiveNodes[i], interactive ? "1" : "0"); } if (mDoubleTapEnabled && interactive) { tsp_disable_doubletap(); } return Void(); } Return<void> Power::powerHint(PowerHint hint, int32_t data __unused) { switch (hint) { #if 0 case PowerHint::INTERACTION: mInteractionHandler.Acquire(data); break; #endif case PowerHint::VIDEO_ENCODE: { mEpic.videoEncode(hint); break; } default: return Void(); } return Void(); } Return<void> Power::setFeature(Feature feature, bool activate) { switch (feature) { case Feature::POWER_FEATURE_DOUBLE_TAP_TO_WAKE: if (activate) { LOG(INFO) << "Enable double tap to wake"; mDoubleTapEnabled = true; } else { LOG(INFO) << "Disable double tap to wake"; mDoubleTapEnabled = false; } break; default: break; } return Void(); } Return<void> Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) { hidl_vec<PowerStatePlatformSleepState> states; _hidl_cb(states, Status::SUCCESS); return Void(); } } } } } }
Power::Power() { size_t inode_size = ARRAY_SIZE(interactive_node_paths); mInteractionHandler.Init(); mEpic.Init(); tsp_init(); LOG(DEBUG) << "Looking for touchsceen/lcd nodes"; for (size_t i = 0; i < inode_size; i++) { std::string node_path = interactive_node_paths[i]; if (doesNodeExist(node_path)) { mInteractiveNodes.push_back(node_path); } } }
function_block-full_function
[ { "content": "namespace android {\n\nnamespace hardware {\n\nnamespace power {\n\nnamespace V1_0 {\n\nnamespace implementation {\n\n\n\nusing ::android::hardware::power::V1_0::Feature;\n\nusing ::android::hardware::power::V1_0::PowerHint;\n\nusing ::android::hardware::power::V1_0::IPower;\n\nusing ::android::hardware::Return;\n\nusing ::android::hardware::Void;\n\n\n\nstruct Power : public IPower {\n\n // Methods from ::android::hardware::power::V1_0::IPower follow.\n\n\n\n Power();\n\n\n\n Return<void> setInteractive(bool interactive) override;\n\n Return<void> powerHint(PowerHint hint, int32_t data) override;\n\n Return<void> setFeature(Feature feature, bool activate) override;\n\n Return<void> getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) override;\n\n\n\n private:\n\n bool mDoubleTapEnabled;\n\n\n\n InteractionHandler mInteractionHandler;\n\n Epic mEpic;\n\n std::vector<std::string> mInteractiveNodes;\n\n};\n\n\n\n} // namespace implementation\n\n} // namespace V1_0\n\n} // namespace power\n\n} // namespace hardware\n", "file_path": "hardware/interface/power/Power.h", "rank": 0, "score": 87571.69437301318 }, { "content": "namespace android {\n\nnamespace hardware {\n\nnamespace usb {\n\nnamespace V1_1 {\n\nnamespace implementation {\n\n\n\nusing ::android::hardware::usb::V1_0::PortRole;\n\nusing ::android::hardware::usb::V1_0::PortRoleType;\n\nusing ::android::hardware::usb::V1_0::PortDataRole;\n\nusing ::android::hardware::usb::V1_0::PortPowerRole;\n\nusing ::android::hardware::usb::V1_0::Status;\n\nusing ::android::hardware::usb::V1_1::IUsb;\n\nusing ::android::hardware::usb::V1_1::IUsbCallback;\n\nusing ::android::hardware::usb::V1_1::PortMode_1_1;\n\nusing ::android::hardware::usb::V1_1::PortStatus_1_1;\n\nusing ::android::hidl::base::V1_0::DebugInfo;\n\nusing ::android::hidl::base::V1_0::IBase;\n\nusing ::android::hardware::hidl_array;\n\nusing ::android::hardware::hidl_memory;\n\nusing ::android::hardware::hidl_string;\n\nusing ::android::hardware::hidl_vec;\n\nusing ::android::hardware::Return;\n\nusing ::android::hardware::Void;\n\nusing ::android::sp;\n\n\n\nstruct Usb : public IUsb {\n\n Usb();\n\n\n\n Return<void> switchRole(const hidl_string& portName, const PortRole& role) override;\n\n Return<void> setCallback(const sp<V1_0::IUsbCallback>& callback) override;\n\n Return<void> queryPortStatus() override;\n\n\n\n\n\n sp<V1_0::IUsbCallback> mCallback_1_0;\n\n // Protects mCallback variable\n\n pthread_mutex_t mLock;\n\n // Protects roleSwitch operation\n\n pthread_mutex_t mRoleSwitchLock;\n\n // Threads waiting for the partner to come back wait here\n\n pthread_cond_t mPartnerCV;\n\n // lock protecting mPartnerCV\n\n pthread_mutex_t mPartnerLock;\n\n // Variable to signal partner coming back online after type switch\n\n bool mPartnerUp;\n\n\n\n private:\n\n pthread_t mPoll;\n\n};\n\n\n\n} // namespace implementation\n\n} // namespace V1_0\n\n} // namespace usb\n\n} // namespace hardware\n", "file_path": "hardware/interface/usb/Usb.h", "rank": 1, "score": 58523.600119122064 }, { "content": "namespace android {\n\nnamespace hardware {\n\nnamespace sensors {\n\nnamespace V1_0 {\n\nnamespace implementation {\n\n\n\n\n\nstruct Sensors : public ::android::hardware::sensors::V1_0::ISensors {\n\n Sensors();\n\n\n\n status_t initCheck() const;\n\n\n\n Return<void> getSensorsList(getSensorsList_cb _hidl_cb) override;\n\n\n\n Return<Result> setOperationMode(OperationMode mode) override;\n\n\n\n Return<Result> activate(\n\n int32_t sensor_handle, bool enabled) override;\n\n\n\n Return<void> poll(int32_t maxCount, poll_cb _hidl_cb) override;\n\n\n\n Return<Result> batch(\n\n int32_t sensor_handle,\n\n int64_t sampling_period_ns,\n\n int64_t max_report_latency_ns) override;\n\n\n\n Return<Result> flush(int32_t sensor_handle) override;\n\n\n\n Return<Result> injectSensorData(const Event& event) override;\n\n\n\n Return<void> registerDirectChannel(\n\n const SharedMemInfo& mem, registerDirectChannel_cb _hidl_cb) override;\n\n\n\n Return<Result> unregisterDirectChannel(int32_t channelHandle) override;\n\n\n\n Return<void> configDirectReport(\n\n int32_t sensorHandle, int32_t channelHandle, RateLevel rate,\n\n configDirectReport_cb _hidl_cb) override;\n\n\n\nprivate:\n\n static constexpr int32_t kPollMaxBufferSize = 128;\n\n status_t mInitCheck;\n\n sensors_module_t *mSensorModule;\n\n sensors_poll_device_1_t *mSensorDevice;\n\n std::mutex mPollLock;\n\n\n\n int getHalDeviceVersion() const;\n\n\n\n static void convertFromSensorEvents(\n\n size_t count, const sensors_event_t *src, hidl_vec<Event> *dst);\n\n\n\n DISALLOW_COPY_AND_ASSIGN(Sensors);\n\n};\n\n\n\nextern \"C\" ISensors *HIDL_FETCH_ISensors(const char *name);\n\n\n\n} // namespace implementation\n\n} // namespace V1_0\n\n} // namespace sensors\n\n} // namespace hardware\n", "file_path": "hardware/interface/sensors/Sensors.h", "rank": 2, "score": 58523.600119122064 }, { "content": " void (*_epic_release)(void);\n", "file_path": "hardware/interface/power/Epic.h", "rank": 3, "score": 53776.525640143336 }, { "content": "#define TSP_PATH \"/sys/class/sec/tsp/\"\n\n\n", "file_path": "hardware/libtsp/tsp.c", "rank": 4, "score": 53629.19093586313 }, { "content": "static void sysfs_write(const char *path, char *s)\n\n{\n\n char errno_str[64];\n\n int len;\n\n int fd;\n\n\n\n fd = open(path, O_WRONLY);\n\n if (fd < 0) {\n\n strerror_r(errno, errno_str, sizeof(errno_str));\n\n ALOGE(\"Error opening %s: %s\", path, errno_str);\n\n return;\n\n }\n\n\n\n len = write(fd, s, strlen(s));\n\n if (len < 0) {\n\n strerror_r(errno, errno_str, sizeof(errno_str));\n\n ALOGE(\"Error writing to %s: %s\", path, errno_str);\n\n }\n\n\n\n close(fd);\n", "file_path": "hardware/libtsp/tsp.c", "rank": 5, "score": 53629.19093586313 }, { "content": "#ifndef EPIC_H\n\n#define EPIC_H\n\n\n\n#include <android/hardware/power/1.0/IPower.h>\n\n\n\nusing ::android::hardware::power::V1_0::PowerHint;\n\n\n\nstruct Epic {\n\n bool Init(void);\n\n void videoEncode(PowerHint hint);\n\n\n\n private:\n\n void *(*_epic_alloc_request)(uint32_t hint);\n\n void (*_epic_free_request)(void);\n\n void (*_epic_acquire)(void *request);\n\n void (*_epic_release)(void);\n\n\n\n bool mEpicAvailable;\n\n};\n\n\n", "file_path": "hardware/interface/power/Epic.h", "rank": 6, "score": 52120.11100860382 }, { "content": " bool Init(void);\n", "file_path": "hardware/interface/power/Epic.h", "rank": 7, "score": 52115.406786481435 }, { "content": " std::condition_variable mCond;\n", "file_path": "hardware/interface/power/InteractionHandler.h", "rank": 8, "score": 52115.406786481435 }, { "content": "#define CMD_STATE_FAIL \"FAIL\"\n\n\n", "file_path": "hardware/libtsp/tsp.c", "rank": 9, "score": 52022.260104230285 }, { "content": "#define LOG_TAG \"libtsp\"\n\n\n", "file_path": "hardware/libtsp/tsp.c", "rank": 10, "score": 50721.46875728568 }, { "content": " void Routine();\n", "file_path": "hardware/interface/power/InteractionHandler.h", "rank": 11, "score": 50553.834580992836 }, { "content": " bool mHandled;\n", "file_path": "hardware/interface/power/InteractionHandler.h", "rank": 12, "score": 50553.834580992836 }, { "content": " void videoEncode(PowerHint hint);\n", "file_path": "hardware/interface/power/Epic.h", "rank": 13, "score": 50553.834580992836 }, { "content": " void Exit();\n", "file_path": "hardware/interface/power/InteractionHandler.h", "rank": 14, "score": 50553.834580992836 }, { "content": " void Acquire(int32_t duration);\n", "file_path": "hardware/interface/power/InteractionHandler.h", "rank": 15, "score": 50553.834580992836 }, { "content": " bool Init();\n", "file_path": "hardware/interface/power/InteractionHandler.h", "rank": 16, "score": 50553.834580992836 }, { "content": " enum interaction_state mState;\n", "file_path": "hardware/interface/power/InteractionHandler.h", "rank": 17, "score": 50553.834580992836 }, { "content": " bool mEpicAvailable;\n", "file_path": "hardware/interface/power/Epic.h", "rank": 18, "score": 50553.834580992836 }, { "content": "#ifndef INTERACTIONHANDLER_H\n\n#define INTERACTIONHANDLER_H\n\n\n\n#include <condition_variable>\n\n#include <mutex>\n\n#include <thread>\n\n\n\nenum interaction_state {\n\n INTERACTION_STATE_UNINITIALIZED,\n\n INTERACTION_STATE_IDLE,\n\n INTERACTION_STATE_INTERACTION,\n\n};\n\n\n\nstruct InteractionHandler {\n\n InteractionHandler();\n\n ~InteractionHandler();\n\n bool Init();\n\n void Exit();\n\n void Acquire(int32_t duration);\n\n\n\n private:\n\n void Release();\n\n void Routine();\n\n\n\n void PerfLock();\n\n void PerfRel();\n\n\n\n long long CalcTimespecDiffMs(struct timespec start, struct timespec end);\n\n\n\n enum interaction_state mState;\n\n\n\n int32_t mMinDurationMs;\n\n int32_t mMaxDurationMs;\n\n int32_t mDurationMs;\n\n\n\n struct timespec mLastTimespec;\n\n\n\n bool mHandled;\n\n\n\n std::unique_ptr<std::thread> mThread;\n\n std::mutex mLock;\n\n std::condition_variable mCond;\n\n};\n\n\n", "file_path": "hardware/interface/power/InteractionHandler.h", "rank": 27, "score": 49088.352302784 }, { "content": " void PerfRel();\n", "file_path": "hardware/interface/power/InteractionHandler.h", "rank": 28, "score": 49083.120981884436 }, { "content": " struct timespec mLastTimespec;\n", "file_path": "hardware/interface/power/InteractionHandler.h", "rank": 29, "score": 49083.120981884436 }, { "content": " int32_t mDurationMs;\n", "file_path": "hardware/interface/power/InteractionHandler.h", "rank": 30, "score": 49083.120981884436 }, { "content": " void PerfLock();\n", "file_path": "hardware/interface/power/InteractionHandler.h", "rank": 31, "score": 49083.120981884436 }, { "content": " int32_t mMinDurationMs;\n", "file_path": "hardware/interface/power/InteractionHandler.h", "rank": 32, "score": 47695.560377516675 }, { "content": " int32_t mMaxDurationMs;\n", "file_path": "hardware/interface/power/InteractionHandler.h", "rank": 33, "score": 47695.560377516675 }, { "content": " long long CalcTimespecDiffMs(struct timespec start, struct timespec end);\n", "file_path": "hardware/interface/power/InteractionHandler.h", "rank": 34, "score": 46384.29453954723 }, { "content": "/*\n\n * Copyright (C) 2018-2020 The LineageOS Project\n\n * Copyright (C) 2020 Andreas Schneider <[email protected]>\n\n * SPDX-License-Identifier: Apache-2.0\n\n */\n\n\n\n#define LOG_TAG \"[email protected]\"\n\n//#define LOG_NDEBUG 0\n\n\n\n#include <android-base/logging.h>\n\n#include <android-base/file.h>\n\n#include <cutils/properties.h>\n\n\n\n#include <dlfcn.h>\n\n\n\n#include \"Epic.h\"\n\n\n\nusing ::android::hardware::power::V1_0::PowerHint;\n\n\n\nbool Epic::Init(void)\n", "file_path": "hardware/interface/power/Epic.cpp", "rank": 35, "score": 42139.844459037755 }, { "content": "/*\n\n * Copyright (C) 2018-2020 The LineageOS Project\n\n * Copyright (C) 2020 Andreas Schneider <[email protected]>\n\n * SPDX-License-Identifier: Apache-2.0\n\n */\n\n\n\n#define LOG_TAG \"[email protected]\"\n\n\n\n#include <android-base/logging.h>\n\n\n\n#include <hidl/HidlTransportSupport.h>\n\n#include <hardware/power.h>\n\n#include \"Power.h\"\n\n\n\nusing android::sp;\n\nusing android::status_t;\n\nusing android::OK;\n\n\n\n// libhwbinder:\n\nusing android::hardware::configureRpcThreadpool;\n", "file_path": "hardware/interface/power/service.cpp", "rank": 36, "score": 42139.003725448434 }, { "content": "using android::hardware::joinRpcThreadpool;\n\n\n\n// Generated HIDL files\n\nusing android::hardware::power::V1_0::IPower;\n\nusing android::hardware::power::V1_0::implementation::Power;\n\n\n\nint main() {\n\n\n\n status_t status;\n\n android::sp<IPower> service = nullptr;\n\n\n\n LOG(INFO) << \"Power HAL Service 1.0 for exynos9820 is starting.\";\n\n\n\n service = new Power();\n\n if (service == nullptr) {\n\n ALOGE(\"Can not create an instance of Power HAL Iface, exiting.\");\n\n\n\n goto shutdown;\n\n }\n\n\n", "file_path": "hardware/interface/power/service.cpp", "rank": 37, "score": 42138.12501845911 }, { "content": " }\n\n\n\n LOG(INFO) << \"Epic is ready\";\n\n\n\n mEpicAvailable = true;\n\n return true;\n\n}\n\n\n\nvoid Epic::videoEncode(PowerHint hint)\n\n{\n\n int preview;\n\n void *request = NULL;\n\n\n\n if (!mEpicAvailable) {\n\n return;\n\n }\n\n\n\n request = _epic_alloc_request((uint32_t)hint);\n\n\n\n preview = property_get_int32(\"persist.vendor.sys.camera.preview\", 0);\n\n if (preview != 2) {\n\n _epic_acquire(request);\n\n }\n\n}\n", "file_path": "hardware/interface/power/Epic.cpp", "rank": 38, "score": 42128.391892867294 }, { "content": "{\n\n void *handle = NULL;\n\n\n\n handle = dlopen(\"libepic_helper.so\", RTLD_NOW);\n\n if (handle == nullptr) {\n\n LOG(ERROR) << \"Failed to load libepic_helper.so\";\n\n return false;\n\n }\n\n\n\n _epic_alloc_request = reinterpret_cast<typeof(_epic_alloc_request)>(dlsym(handle, \"epic_alloc_request\"));\n\n _epic_free_request = reinterpret_cast<typeof(_epic_free_request)>(dlsym(handle, \"epic_free_request\"));\n\n _epic_acquire = reinterpret_cast<typeof(_epic_acquire)>(dlsym(handle, \"epic_acquire\"));\n\n _epic_release = reinterpret_cast<typeof(_epic_release)>(dlsym(handle, \"epic_release\"));\n\n\n\n if (_epic_alloc_request == nullptr ||\n\n _epic_free_request == nullptr ||\n\n _epic_acquire == nullptr ||\n\n _epic_release == nullptr) {\n\n LOG(ERROR) << \"Failed to bind symbols from libepic_helper.so\";\n\n return false;\n", "file_path": "hardware/interface/power/Epic.cpp", "rank": 39, "score": 42127.171159888894 }, { "content": " configureRpcThreadpool(1, true /*callerWillJoin*/);\n\n\n\n status = service->registerAsService();\n\n if (status != OK) {\n\n ALOGE(\"Could not register service for Power HAL Iface (%d).\", status);\n\n goto shutdown;\n\n }\n\n\n\n LOG(INFO) << \"Power Service is ready\";\n\n joinRpcThreadpool();\n\n //Should not pass this line\n\n\n\nshutdown:\n\n // In normal operation, we don't expect the thread pool to exit\n\n\n\n LOG(ERROR) << \"Power Service is shutting down\";\n\n return 1;\n\n}\n", "file_path": "hardware/interface/power/service.cpp", "rank": 40, "score": 42127.0194558676 }, { "content": "/*\n\n * Copyright (C) 2018-2020 The LineageOS Project\n\n * Copyright (C) 2020 Andreas Schneider <[email protected]>\n\n * SPDX-License-Identifier: Apache-2.0\n\n */\n\n\n\n#define LOG_TAG \"[email protected]\"\n\n//#define LOG_NDEBUG 0\n\n\n\n#include <android-base/logging.h>\n\n#include <android-base/file.h>\n\n\n\n#include <fcntl.h>\n\n#include <poll.h>\n\n#include <time.h>\n\n#include <unistd.h>\n\n\n\n#include \"InteractionHandler.h\"\n\n\n\n#define MSINSEC 1000L\n", "file_path": "hardware/interface/power/InteractionHandler.cpp", "rank": 41, "score": 40471.84481658367 }, { "content": "#define USINMS 1000000L\n\n\n\nusing android::base::WriteStringToFile;\n\n\n\nInteractionHandler::InteractionHandler()\n\n : mState(INTERACTION_STATE_UNINITIALIZED),\n\n mMinDurationMs(1400),\n\n mMaxDurationMs(5650),\n\n mDurationMs(0)\n\n{\n\n}\n\n\n\nInteractionHandler::~InteractionHandler()\n\n{\n\n Exit();\n\n}\n\n\n\nbool InteractionHandler::Init()\n\n{\n\n std::lock_guard<std::mutex> lk(mLock);\n", "file_path": "hardware/interface/power/InteractionHandler.cpp", "rank": 42, "score": 40471.30197819652 }, { "content": " mCond.notify_all();\n\n mThread->join();\n\n}\n\n\n\nvoid InteractionHandler::PerfLock()\n\n{\n\n LOG(VERBOSE) << \"Acquiring perf lock\";\n\n WriteStringToFile(\"1378000\", \"/sys/power/cpufreq_min_limit\", false);\n\n}\n\n\n\nvoid InteractionHandler::PerfRel()\n\n{\n\n LOG(VERBOSE) << \"Releasing perf lock\";\n\n WriteStringToFile(\"520000\", \"/sys/power/cpufreq_min_limit\", false);\n\n}\n\n\n\nlong long InteractionHandler::CalcTimespecDiffMs(struct timespec start,\n\n struct timespec end)\n\n{\n\n long long diff_in_us = 0;\n", "file_path": "hardware/interface/power/InteractionHandler.cpp", "rank": 43, "score": 40470.77099400912 }, { "content": " mState = INTERACTION_STATE_INTERACTION;\n\n }\n\n\n\n mHandled = false;\n\n mCond.notify_one();\n\n}\n\n\n\nvoid InteractionHandler::Release()\n\n{\n\n std::lock_guard<std::mutex> lk(mLock);\n\n PerfRel();\n\n mState = INTERACTION_STATE_IDLE;\n\n}\n\n\n\nvoid InteractionHandler::Routine()\n\n{\n\n std::unique_lock<std::mutex> lk(mLock, std::defer_lock);\n\n\n\n while (true) {\n\n lk.lock();\n\n mCond.wait(lk, [&] { return mState == INTERACTION_STATE_INTERACTION; });\n\n mHandled = true;\n\n lk.unlock();\n\n\n\n std::this_thread::sleep_for(std::chrono::milliseconds(mDurationMs));\n\n if (mHandled) Release();\n\n }\n\n}\n", "file_path": "hardware/interface/power/InteractionHandler.cpp", "rank": 44, "score": 40466.00441121062 }, { "content": "\n\n if (mState != INTERACTION_STATE_UNINITIALIZED)\n\n return true;\n\n\n\n mState = INTERACTION_STATE_IDLE;\n\n mThread = std::unique_ptr<std::thread>(\n\n new std::thread(&InteractionHandler::Routine, this));\n\n\n\n return true;\n\n}\n\n\n\nvoid InteractionHandler::Exit()\n\n{\n\n std::unique_lock<std::mutex> lk(mLock);\n\n if (mState == INTERACTION_STATE_UNINITIALIZED)\n\n return;\n\n\n\n mState = INTERACTION_STATE_UNINITIALIZED;\n\n lk.unlock();\n\n\n", "file_path": "hardware/interface/power/InteractionHandler.cpp", "rank": 45, "score": 40465.621255438404 }, { "content": " diff_in_us += (end.tv_sec - start.tv_sec) * MSINSEC;\n\n diff_in_us += (end.tv_nsec - start.tv_nsec) / USINMS;\n\n return diff_in_us;\n\n}\n\n\n\nvoid InteractionHandler::Acquire(int32_t duration)\n\n{\n\n std::lock_guard<std::mutex> lk(mLock);\n\n if (mState == INTERACTION_STATE_UNINITIALIZED) {\n\n LOG(WARNING) << \"Called while uninitialized\";\n\n return;\n\n }\n\n\n\n int inputDuration = duration + 650;\n\n int finalDuration;\n\n if (inputDuration > mMaxDurationMs)\n\n finalDuration = mMaxDurationMs;\n\n else if (inputDuration > mMinDurationMs)\n\n finalDuration = inputDuration;\n\n else\n", "file_path": "hardware/interface/power/InteractionHandler.cpp", "rank": 46, "score": 40465.284698585056 }, { "content": " finalDuration = mMinDurationMs;\n\n\n\n struct timespec cur_timespec;\n\n clock_gettime(CLOCK_MONOTONIC, &cur_timespec);\n\n if (mState != INTERACTION_STATE_IDLE && finalDuration <= mDurationMs) {\n\n long long elapsed_time = CalcTimespecDiffMs(mLastTimespec, cur_timespec);\n\n // don't hint if previous hint's duration covers this hint's duration\n\n if (elapsed_time <= (mDurationMs - finalDuration)) {\n\n LOG(VERBOSE) << \"Previous duration (\" << mDurationMs << \") \"\n\n << \"cover this (\" << finalDuration << \") elapsed: \" << elapsed_time;\n\n return;\n\n }\n\n }\n\n mLastTimespec = cur_timespec;\n\n mDurationMs = finalDuration;\n\n\n\n LOG(VERBOSE) << \"input: \" << duration << \" final duration: \" << finalDuration;\n\n\n\n if (mState == INTERACTION_STATE_IDLE) {\n\n PerfLock();\n", "file_path": "hardware/interface/power/InteractionHandler.cpp", "rank": 47, "score": 40463.90063584359 }, { "content": "bool tsp_init(void)\n\n{\n\n double_tap_supported = check_tsp_has_cmd(TSP_CMD_DT2W_CTL);\n\n\n\n return true;\n", "file_path": "hardware/libtsp/tsp.c", "rank": 48, "score": 31250.496984040434 }, { "content": "static int sysfs_read(char *path, char *s, int num_bytes)\n\n{\n\n char errno_str[64];\n\n int len;\n\n int ret = 0;\n\n int fd;\n\n\n\n fd = open(path, O_RDONLY);\n\n if (fd < 0) {\n\n strerror_r(errno, errno_str, sizeof(errno_str));\n\n ALOGE(\"Error opening %s: %s\", path, errno_str);\n\n\n\n return -1;\n\n }\n\n\n\n len = read(fd, s, num_bytes - 1);\n\n if (len < 0) {\n\n strerror_r(errno, errno_str, sizeof(errno_str));\n\n ALOGE(\"Error reading from %s: %s\", path, errno_str);\n\n\n\n ret = -1;\n\n } else {\n\n // do not store newlines, but terminate the string instead\n\n if (s[len-1] == '\\n') {\n\n s[len-1] = '\\0';\n\n } else {\n\n s[len] = '\\0';\n\n }\n\n }\n\n\n\n close(fd);\n\n\n\n return ret;\n", "file_path": "hardware/libtsp/tsp.c", "rank": 49, "score": 31250.496984040434 }, { "content": "bool tsp_disable_doubletap(void)\n\n{\n\n return tsp_set_doubletap(false);\n", "file_path": "hardware/libtsp/tsp.c", "rank": 50, "score": 30314.115393507756 }, { "content": "#define CMD_STATE_LEN 16\n", "file_path": "hardware/libtsp/tsp.c", "rank": 51, "score": 30314.115393507756 }, { "content": "static bool check_tsp_has_cmd(const char *cmd)\n\n{\n\n char *line = NULL;\n\n size_t len = 0;\n\n ssize_t nread;\n\n bool found = false;\n\n FILE *fp = NULL;\n\n\n\n fp = fopen(TSP_PATH TSP_CMD_LIST_FILE, \"r\");\n\n if (fp == NULL) {\n\n ALOGE(\"Failed to open TSP command list: %s\", strerror(errno));\n\n return false;\n\n }\n\n\n\n while ((nread = getline(&line, &len, fp)) != -1) {\n\n if (strncmp(line, cmd, strlen(cmd)) == 0) {\n\n ALOGI(\"tsp has cmd: %s\", cmd);\n\n found = true;\n\n break;\n\n }\n\n }\n\n\n\n if (!found)\n\n ALOGI(\"tsp doesn't ahve cmd: %s\", cmd);\n\n\n\n free(line);\n\n fclose(fp);\n\n return found;\n", "file_path": "hardware/libtsp/tsp.c", "rank": 52, "score": 30314.115393507756 }, { "content": "char *tsp_get_result(void)\n\n{\n\n char inbuf[TSP_CMD_RES_LEN];\n\n char *res;\n\n char *retbuf;\n\n\n\n if (sysfs_read(TSP_PATH TSP_CMD_RES_FILE, inbuf, TSP_CMD_RES_LEN) < 0) {\n\n ALOGI(\"tsp get result failed\");\n\n return NULL;\n\n }\n\n\n\n ALOGI(\"Got result: %s\", inbuf);\n\n\n\n if ((res = strstr(inbuf, \":\")) == NULL) {\n\n ALOGI(\"no strstr\");\n\n return NULL;\n\n }\n\n\n\n retbuf = calloc(strlen(res)+1, sizeof(char));\n\n if (retbuf == NULL)\n\n return NULL;\n\n\n\n strcpy(retbuf, res+1);\n\n\n\n ALOGD(\"res: %s\", retbuf);\n\n\n\n return retbuf;\n", "file_path": "hardware/libtsp/tsp.c", "rank": 53, "score": 30314.115393507756 }, { "content": "#define TSP_CMD_LEN 64\n", "file_path": "hardware/libtsp/tsp.c", "rank": 54, "score": 30314.115393507756 }, { "content": "#define CMD_STATE_WAITING \"WAITING\"\n", "file_path": "hardware/libtsp/tsp.c", "rank": 55, "score": 30314.115393507756 }, { "content": "static bool tsp_set_doubletap(bool state)\n\n{\n\n char buf[TSP_CMD_LEN] = {0};\n\n bool ok;\n\n\n\n if (!double_tap_supported) {\n\n return false;\n\n }\n\n\n\n /* set DT2W en/disable */\n\n snprintf(buf, TSP_CMD_LEN, \"%s,%d\", TSP_CMD_DT2W_CTL, !!state);\n\n\n\n ALOGI(\"%s\", buf);\n\n\n\n sysfs_write(TSP_PATH TSP_CMD_EXEC_FILE, buf);\n\n ok = tsp_wait_for_cmd(TSP_CMD_DT2W_CTL);\n\n if (!ok) {\n\n return false;\n\n }\n\n\n\n ALOGV(\"dt2w %s\", state ? \"enabled\" : \"disabled\");\n\n\n\n return true;\n", "file_path": "hardware/libtsp/tsp.c", "rank": 56, "score": 30314.115393507756 }, { "content": "#define CMD_STATE_RUNNING \"RUNNING\"\n", "file_path": "hardware/libtsp/tsp.c", "rank": 57, "score": 30314.115393507756 }, { "content": "static bool tsp_wait_for_cmd(const char *cmd)\n\n{\n\n char buf[CMD_STATE_LEN];\n\n int count = 0;\n\n\n\n while (count++ < 10) {\n\n if (sysfs_read(TSP_PATH TSP_CMD_STATE_FILE, buf, CMD_STATE_LEN) < 0) {\n\n ALOGE(\"%s: sysfs read failed\", cmd);\n\n return false;\n\n }\n\n\n\n ALOGI(\"state: %s - want %s\", buf, CMD_STATE_OK);\n\n /* TSP enters \"ok\" state once command result is ready to be read */\n\n if (!strncmp(buf, CMD_STATE_OK, strlen(CMD_STATE_OK)))\n\n return true;\n\n /* some commands skip the OK state and go straight to waiting. */\n\n if (!strncmp(buf, CMD_STATE_WAITING, strlen(CMD_STATE_WAITING)))\n\n return true;\n\n\n\n usleep(100);\n\n }\n\n\n\n ALOGE(\"%s: TSP timeout expired!\", cmd);\n\n /* FIXME: if the TSP ends up in a weird state,\n\n * we should read the result file to cause it to\n\n * exit the state */\n\n return false;\n", "file_path": "hardware/libtsp/tsp.c", "rank": 58, "score": 30314.115393507756 }, { "content": "bool tsp_enable_doubletap(void)\n\n{\n\n return tsp_set_doubletap(true);\n", "file_path": "hardware/libtsp/tsp.c", "rank": 59, "score": 30314.115393507756 }, { "content": "#define CMD_STATE_OK \"OK\"\n", "file_path": "hardware/libtsp/tsp.c", "rank": 60, "score": 30314.115393507756 }, { "content": "#define CMD_STATE_NA \"NOT_APPLICABLE\"\n", "file_path": "hardware/libtsp/tsp.c", "rank": 61, "score": 30314.115393507756 }, { "content": "static bool double_tap_supported;\n", "file_path": "hardware/libtsp/tsp.c", "rank": 62, "score": 30314.115393507756 }, { "content": "#define TSP_CMD_RES_LEN ((TSP_CMD_LEN)+8)\n\n\n", "file_path": "hardware/libtsp/tsp.c", "rank": 63, "score": 29432.216282912184 }, { "content": "#define TSP_CMD_STATE_FILE \"cmd_status\"\n\n\n", "file_path": "hardware/libtsp/tsp.c", "rank": 64, "score": 29432.216282912184 }, { "content": "#define TSP_CMD_LIST_FILE \"cmd_list\"\n", "file_path": "hardware/libtsp/tsp.c", "rank": 65, "score": 29432.216282912184 }, { "content": "#define TSP_CMD_EXEC_FILE \"cmd\"\n", "file_path": "hardware/libtsp/tsp.c", "rank": 66, "score": 29432.216282912184 }, { "content": "#define TSP_CMD_DT2W_CTL \"aot_enable\"\n\n\n", "file_path": "hardware/libtsp/tsp.c", "rank": 67, "score": 29432.216282912184 }, { "content": "#define TSP_CMD_RES_FILE \"cmd_result\"\n", "file_path": "hardware/libtsp/tsp.c", "rank": 68, "score": 29432.216282912184 }, { "content": "#!/bin/env python3\n\n#\n\n# Copyright (C) 2009 The Android Open Source Project\n\n# Copyright (C) 2019 The Mokee Open Source Project\n\n# Copyright (C) 2019-2020 The LineageOS Open Source Project\n\n#\n\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n\n# you may not use this file except in compliance with the License.\n\n# You may obtain a copy of the License at\n\n#\n\n# http://www.apache.org/licenses/LICENSE-2.0\n\n#\n\n# Unless required by applicable law or agreed to in writing, software\n\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n# See the License for the specific language governing permissions and\n\n# limitations under the License.\n\n\n\nimport common\n\nimport re\n\n\n\ndef FullOTA_InstallEnd(info):\n\n OTA_InstallEnd(info)\n\n return\n\n\n\ndef IncrementalOTA_InstallEnd(info):\n\n OTA_InstallEnd(info)\n\n return\n\n\n\ndef AddImage(info, basename, dest):\n\n name = basename\n\n data = info.input_zip.read(\"IMAGES/\" + basename)\n\n common.ZipWriteStr(info.output_zip, name, data)\n\n info.script.AppendExtra('package_extract_file(\"%s\", \"%s\");' % (name, dest))\n\n\n\ndef OTA_InstallEnd(info):\n\n info.script.Print(\"Patching firmware images...\")\n\n AddImage(info, \"dtbo.img\", \"/dev/block/by-name/dtbo\")\n\n return\n", "file_path": "releasetools/releasetools.py", "rank": 69, "score": 21744.137156175075 }, { "content": "def AddImage(info, basename, dest):\n\n name = basename\n\n data = info.input_zip.read(\"IMAGES/\" + basename)\n\n common.ZipWriteStr(info.output_zip, name, data)\n", "file_path": "releasetools/releasetools.py", "rank": 70, "score": 20400.81511159248 }, { "content": "def OTA_InstallEnd(info):\n\n info.script.Print(\"Patching firmware images...\")\n\n AddImage(info, \"dtbo.img\", \"/dev/block/by-name/dtbo\")\n", "file_path": "releasetools/releasetools.py", "rank": 71, "score": 19789.53050667526 }, { "content": "def FullOTA_InstallEnd(info):\n\n OTA_InstallEnd(info)\n", "file_path": "releasetools/releasetools.py", "rank": 72, "score": 19213.812920118915 }, { "content": "def IncrementalOTA_InstallEnd(info):\n\n OTA_InstallEnd(info)\n", "file_path": "releasetools/releasetools.py", "rank": 73, "score": 19213.812920118915 }, { "content": "# LineageOS platform tree for the Samsung Exynos 9820\n", "file_path": "README.md", "rank": 74, "score": 17671.512482920247 }, { "content": " static uint32_t effectToMs(Effect effect, Status* status);\n\n\n\n bool mIsTimedOutVibriator;\n\n};\n\n\n\n} // namespace implementation\n\n} // namespace V1_0\n\n} // namespace vibrator\n\n} // namespace hardware\n\n} // namespace android\n\n\n\n#endif // ANDROID_HARDWARE_VIBRATOR_V1_0_VIBRATOR_H\n", "file_path": "hardware/interface/vibrator/Vibrator.h", "rank": 75, "score": 15043.6356416965 }, { "content": "#include <android/hardware/vibrator/1.0/IVibrator.h>\n\n#include <hidl/Status.h>\n\n\n\n#include <fstream>\n\n\n\nnamespace android {\n\nnamespace hardware {\n\nnamespace vibrator {\n\nnamespace V1_0 {\n\nnamespace implementation {\n\n\n", "file_path": "hardware/interface/vibrator/Vibrator.h", "rank": 76, "score": 15043.536429374419 }, { "content": "/*\n\n * Copyright (C) 2019-2020 The LineageOS Project\n\n * Copyright (C) 2020 Andreas Schneider <[email protected]>\n\n *\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#ifndef ANDROID_HARDWARE_VIBRATOR_V1_0_VIBRATOR_H\n\n#define ANDROID_HARDWARE_VIBRATOR_V1_0_VIBRATOR_H\n\n\n", "file_path": "hardware/interface/vibrator/Vibrator.h", "rank": 77, "score": 15034.194989078456 }, { "content": "#define VIBRATOR_INTENSITY_PATH \"/sys/class/timed_output/vibrator/intensity\"\n\n\n\nnamespace android {\n\nnamespace hardware {\n\nnamespace vibrator {\n\nnamespace V1_0 {\n\nnamespace implementation {\n\n\n\n/*\n\n * Write value to path and close file.\n\n */\n\ntemplate <typename T>\n\nstatic Return<Status> writeNode(const std::string& path, const T& value)\n\n{\n\n std::ofstream node(path);\n\n if (!node) {\n\n LOG(ERROR) << \"Failed to open: \" << path;\n\n return Status::UNKNOWN_ERROR;\n\n }\n\n\n", "file_path": "hardware/interface/vibrator/Vibrator.cpp", "rank": 78, "score": 14439.22288313481 }, { "content": " LOG(DEBUG) << \"writeNode node: \" << path << \" value: \" << value;\n\n\n\n node << value << std::endl;\n\n if (!node) {\n\n LOG(ERROR) << \"Failed to write: \" << value;\n\n return Status::UNKNOWN_ERROR;\n\n }\n\n\n\n return Status::OK;\n\n}\n\n\n\nstatic bool doesNodeExist(const std::string& path)\n\n{\n\n std::ifstream f(path.c_str());\n\n return f.good();\n\n}\n\n\n\nVibrator::Vibrator()\n\n{\n\n bool ok;\n", "file_path": "hardware/interface/vibrator/Vibrator.cpp", "rank": 79, "score": 14430.19516147314 }, { "content": "#include <android-base/logging.h>\n\n\n\n#include <sys/stat.h>\n\n\n\nnamespace android {\n\nnamespace hardware {\n\nnamespace sensors {\n\nnamespace V1_0 {\n\nnamespace implementation {\n\n\n\n/*\n\n * If a multi-hal configuration file exists in the proper location,\n\n * return true indicating we need to use multi-hal functionality.\n\n */\n\nstatic bool UseMultiHal() {\n\n const std::string& name = MULTI_HAL_CONFIG_FILE_PATH;\n\n struct stat buffer;\n\n return (stat (name.c_str(), &buffer) == 0);\n\n}\n\n\n", "file_path": "hardware/interface/sensors/Sensors.cpp", "rank": 80, "score": 14430.098283164496 }, { "content": " * function to consume USB device plugin events (on receiving a\n\n * USB device path string), and enable autosupend on the USB device if\n\n * necessary.\n\n */\n\nvoid checkUsbDeviceAutoSuspend(const std::string& devicePath) {\n\n /*\n\n * Currently we only actively enable devices that should be autosuspended, and leave others\n\n * to the defualt.\n\n */\n\n if (canUsbDeviceAutoSuspend(devicePath)) {\n\n ALOGI(\"auto suspend usb device %s\", devicePath.c_str());\n\n writeFile(devicePath + \"/power/control\", \"auto\");\n\n }\n\n}\n\n\n\n} // namespace implementation\n\n} // namespace V1_0\n\n} // namespace usb\n\n} // namespace hardware\n\n} // namespace android\n", "file_path": "hardware/interface/usb/Usb.cpp", "rank": 81, "score": 14425.86307153398 }, { "content": "#include <hidl/HidlSupport.h>\n\n#include <hidl/HidlTransportSupport.h>\n\n#include <utils/Errors.h>\n\n#include <utils/StrongPointer.h>\n\n\n\n#include \"Vibrator.h\"\n\n\n\nusing android::hardware::configureRpcThreadpool;\n\nusing android::hardware::joinRpcThreadpool;\n\nusing android::hardware::vibrator::V1_0::IVibrator;\n\nusing android::hardware::vibrator::V1_0::implementation::Vibrator;\n\n\n\nusing android::OK;\n\nusing android::sp;\n\nusing android::status_t;\n\n\n\nint main() {\n\n status_t status;\n\n sp<IVibrator> vibrator;\n\n\n", "file_path": "hardware/interface/vibrator/service.cpp", "rank": 82, "score": 14425.701388923691 }, { "content": " }\n\n setAmplitude(amplitude);\n\n\n\n ms = effectToMs(effect, &status);\n\n if (status != Status::OK) {\n\n _hidl_cb(status, 0);\n\n return Void();\n\n }\n\n status = activate(ms);\n\n\n\n _hidl_cb(status, ms);\n\n\n\n return Void();\n\n}\n\n\n\n} // namespace implementation\n\n} // namespace V1_0\n\n} // namespace vibrator\n\n} // namespace hardware\n\n} // namespace android\n", "file_path": "hardware/interface/vibrator/Vibrator.cpp", "rank": 83, "score": 14423.25894880706 }, { "content": "#include <android-base/stringprintf.h>\n\n\n\n#include <hardware/hardware.h>\n\n#include <hardware/vibrator.h>\n\n\n\n#include \"Vibrator.h\"\n\n\n\n#include <cinttypes>\n\n#include <cmath>\n\n#include <fstream>\n\n#include <iostream>\n\n\n\n#define INTENSITY_MIN 1000\n\n#define INTENSITY_MAX 10000\n\n#define INENSITY_DEFAULT INTENSITY_MAX\n\n\n\n#define CLICK_TIMING_MS 20\n\n\n\n#define VIBRATOR_TIMEOUT_PATH \"/sys/class/timed_output/vibrator/enable\"\n\n#define VIBRATOR_HAPTIC_PATH \"/sys/class/timed_output/vibrator/haptic_engine\"\n", "file_path": "hardware/interface/vibrator/Vibrator.cpp", "rank": 84, "score": 14423.069053237665 }, { "content": "\n\nusing android::sp;\n\n\n\n// libhwbinder:\n\nusing android::hardware::configureRpcThreadpool;\n\nusing android::hardware::joinRpcThreadpool;\n\n\n\n// Generated HIDL files\n\nusing android::hardware::usb::V1_1::IUsb;\n\nusing android::hardware::usb::V1_1::implementation::Usb;\n\n\n\nusing android::status_t;\n\nusing android::OK;\n\n\n\nint main() {\n\n android::sp<IUsb> service = new Usb();\n\n\n\n configureRpcThreadpool(1, true /*callerWillJoin*/);\n\n status_t status = service->registerAsService();\n\n\n", "file_path": "hardware/interface/usb/service.cpp", "rank": 85, "score": 14422.530083019146 }, { "content": "#include <chrono>\n\n#include <dirent.h>\n\n#include <pthread.h>\n\n#include <regex>\n\n#include <stdio.h>\n\n#include <sys/types.h>\n\n#include <thread>\n\n#include <unistd.h>\n\n#include <unordered_map>\n\n\n\n#include <cutils/uevent.h>\n\n#include <sys/epoll.h>\n\n#include <utils/Errors.h>\n\n#include <utils/StrongPointer.h>\n\n\n\n#include \"Usb.h\"\n\n\n\nnamespace android {\n\nnamespace hardware {\n\nnamespace usb {\n", "file_path": "hardware/interface/usb/Usb.cpp", "rank": 86, "score": 14421.80168054838 }, { "content": " uevent_fd = uevent_open_socket(64 * 1024, true);\n\n\n\n if (uevent_fd < 0) {\n\n ALOGE(\"uevent_init: uevent_open_socket failed\\n\");\n\n return NULL;\n\n }\n\n\n\n payload.uevent_fd = uevent_fd;\n\n payload.usb = (android::hardware::usb::V1_1::implementation::Usb *)param;\n\n\n\n fcntl(uevent_fd, F_SETFL, O_NONBLOCK);\n\n\n\n ev.events = EPOLLIN;\n\n ev.data.ptr = (void *)uevent_event;\n\n\n\n epoll_fd = epoll_create(64);\n\n if (epoll_fd == -1) {\n\n ALOGE(\"epoll_create failed; errno=%d\", errno);\n\n goto error;\n\n }\n", "file_path": "hardware/interface/usb/Usb.cpp", "rank": 87, "score": 14421.450427649981 }, { "content": "\n\n intensity = std::lround((amplitude - 1) * 10000.0 / 254.0);\n\n if (intensity > INTENSITY_MAX) {\n\n intensity = INTENSITY_MAX;\n\n }\n\n LOG(DEBUG) << \"setting intensity: \" << intensity;\n\n\n\n if (doesNodeExist(VIBRATOR_INTENSITY_PATH)) {\n\n return writeNode(VIBRATOR_INTENSITY_PATH, intensity);\n\n }\n\n\n\n if (doesNodeExist(VIBRATOR_HAPTIC_PATH)) {\n\n std::string haptic = android::base::StringPrintf(\"4 %u %u %u %u\",\n\n CLICK_TIMING_MS,\n\n intensity,\n\n 2000,\n\n 1);\n\n\n\n return writeNode(VIBRATOR_HAPTIC_PATH, haptic);\n\n }\n", "file_path": "hardware/interface/vibrator/Vibrator.cpp", "rank": 88, "score": 14421.360221928411 }, { "content": " }\n\n}\n\n\n\nISensors *HIDL_FETCH_ISensors(const char * /* hal */) {\n\n Sensors *sensors = new Sensors;\n\n if (sensors->initCheck() != OK) {\n\n delete sensors;\n\n sensors = nullptr;\n\n\n\n return nullptr;\n\n }\n\n\n\n return sensors;\n\n}\n\n\n\n} // namespace implementation\n\n} // namespace V1_0\n\n} // namespace sensors\n\n} // namespace hardware\n\n} // namespace android\n", "file_path": "hardware/interface/sensors/Sensors.cpp", "rank": 89, "score": 14420.883336120743 }, { "content": "namespace V1_1 {\n\nnamespace implementation {\n\n\n\nconst char GOOGLE_USB_VENDOR_ID_STR[] = \"18d1\";\n\nconst char GOOGLE_USBC_35_ADAPTER_UNPLUGGED_ID_STR[] = \"5029\";\n\n\n\n// Set by the signal handler to destroy the thread\n\nvolatile bool destroyThread;\n\n\n\nstatic void checkUsbDeviceAutoSuspend(const std::string& devicePath);\n\n\n\nstatic int32_t readFile(const std::string &filename, std::string *contents) {\n\n FILE *fp;\n\n ssize_t read = 0;\n\n char *line = NULL;\n\n size_t len = 0;\n\n\n\n fp = fopen(filename.c_str(), \"r\");\n\n if (fp != NULL) {\n\n if ((read = getline(&line, &len, fp)) != -1) {\n", "file_path": "hardware/interface/usb/Usb.cpp", "rank": 90, "score": 14420.851364743068 }, { "content": " if (readFile(filename, accessory)) {\n\n ALOGE(\"getAccessoryConnected: Failed to open filesystem node: %s\",\n\n filename.c_str());\n\n return Status::ERROR;\n\n }\n\n\n\n return Status::SUCCESS;\n\n}\n\n\n\nStatus getCurrentRoleHelper(const std::string &portName, bool connected,\n\n PortRoleType type, uint32_t *currentRole) {\n\n std::string filename;\n\n std::string roleName;\n\n std::string accessory;\n\n\n\n // Mode\n\n\n\n if (type == PortRoleType::POWER_ROLE) {\n\n filename = \"/sys/class/typec/\" + portName + \"/power_role\";\n\n *currentRole = static_cast<uint32_t>(PortPowerRole::NONE);\n", "file_path": "hardware/interface/usb/Usb.cpp", "rank": 91, "score": 14420.756532358211 }, { "content": "\n\n ok = doesNodeExist(VIBRATOR_TIMEOUT_PATH);\n\n if (ok) {\n\n mIsTimedOutVibriator = true;\n\n }\n\n}\n\n\n\nStatus Vibrator::activate(uint32_t timeoutMs)\n\n{\n\n if (!mIsTimedOutVibriator) {\n\n return Status::UNSUPPORTED_OPERATION;\n\n }\n\n\n\n return writeNode(VIBRATOR_TIMEOUT_PATH, timeoutMs);\n\n}\n\n\n\nReturn<Status> Vibrator::on(uint32_t timeoutMs)\n\n{\n\n return activate(timeoutMs);\n\n}\n", "file_path": "hardware/interface/vibrator/Vibrator.cpp", "rank": 92, "score": 9.351055497116633 }, { "content": " *currentRole = static_cast<uint32_t>(PortMode_1_1::DEBUG_ACCESSORY);\n\n return Status::SUCCESS;\n\n }\n\n }\n\n\n\n if (readFile(filename, &roleName)) {\n\n ALOGE(\"getCurrentRole: Failed to open filesystem node: %s\",\n\n filename.c_str());\n\n return Status::ERROR;\n\n }\n\n\n\n extractRole(&roleName);\n\n\n\n if (roleName == \"source\") {\n\n *currentRole = static_cast<uint32_t>(PortPowerRole::SOURCE);\n\n } else if (roleName == \"sink\") {\n\n *currentRole = static_cast<uint32_t>(PortPowerRole::SINK);\n\n } else if (roleName == \"host\") {\n\n if (type == PortRoleType::DATA_ROLE)\n\n *currentRole = static_cast<uint32_t>(PortDataRole::HOST);\n", "file_path": "hardware/interface/usb/Usb.cpp", "rank": 93, "score": 9.102107156091838 }, { "content": "/*\n\n * Copyright (C) 2016 The Android Open Source Project\n\n *\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#include \"Sensors.h\"\n\n#include <sensors/convert.h>\n\n#include \"multihal.h\"\n\n\n", "file_path": "hardware/interface/sensors/Sensors.cpp", "rank": 94, "score": 8.900452448740023 }, { "content": "/*\n\n * Copyright (C) 2017 The Android Open Source Project\n\n *\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#define LOG_TAG \"ExynosUSB HAL\"\n\n\n\n#include <android-base/logging.h>\n\n#include <assert.h>\n", "file_path": "hardware/interface/usb/Usb.cpp", "rank": 95, "score": 8.812354530975313 }, { "content": "/*\n\n * Copyright (C) 2019 The LineageOS Project\n\n *\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#define LOG_TAG \"[email protected]\"\n\n\n\n#include <android-base/logging.h>\n\n#include <android/hardware/vibrator/1.0/IVibrator.h>\n", "file_path": "hardware/interface/vibrator/service.cpp", "rank": 96, "score": 8.71013574466843 }, { "content": " case PortRoleType::DATA_ROLE:\n\n return node + \"/data_role\";\n\n case PortRoleType::POWER_ROLE:\n\n return node + \"/power_role\";\n\n case PortRoleType::MODE:\n\n return node + \"/port_type\";\n\n default:\n\n return \"\";\n\n }\n\n}\n\n\n\nstd::string convertRoletoString(PortRole role) {\n\n if (role.type == PortRoleType::POWER_ROLE) {\n\n if (role.role == static_cast<uint32_t>(PortPowerRole::SOURCE))\n\n return \"source\";\n\n else if (role.role == static_cast<uint32_t>(PortPowerRole::SINK))\n\n return \"sink\";\n\n } else if (role.type == PortRoleType::DATA_ROLE) {\n\n if (role.role == static_cast<uint32_t>(PortDataRole::HOST)) return \"host\";\n\n if (role.role == static_cast<uint32_t>(PortDataRole::DEVICE))\n", "file_path": "hardware/interface/usb/Usb.cpp", "rank": 97, "score": 8.057076944390644 }, { "content": "/*\n\n * Copyright (C) 2016 The Android Open Source Project\n\n *\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICENSE-2.0\n\n *\n\n * Unless required by applicable law or agreed to in writing, software\n\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n * See the License for the specific language governing permissions and\n\n * limitations under the License.\n\n */\n\n\n\n#define LOG_TAG \"ExynosUSB HAL\"\n\n\n\n#include <hidl/HidlTransportSupport.h>\n\n#include \"Usb.h\"\n", "file_path": "hardware/interface/usb/service.cpp", "rank": 98, "score": 8.026830973698901 }, { "content": " if (mSensorDevice->inject_sensor_data == nullptr) {\n\n LOG(ERROR) << \"HAL specifies version 1.4, but does not implement inject_sensor_data()\";\n\n }\n\n if (mSensorModule->set_operation_mode == nullptr) {\n\n LOG(ERROR) << \"HAL specifies version 1.4, but does not implement set_operation_mode()\";\n\n }\n\n }\n\n\n\n /* Get us all sensors */\n\n setOperationMode(static_cast<hardware::sensors::V1_0::OperationMode>(5555));\n\n\n\n mInitCheck = OK;\n\n}\n\n\n\nstatus_t Sensors::initCheck() const {\n\n return mInitCheck;\n\n}\n\n\n\nReturn<void> Sensors::getSensorsList(getSensorsList_cb _hidl_cb) {\n\n sensor_t const *list;\n", "file_path": "hardware/interface/sensors/Sensors.cpp", "rank": 99, "score": 7.815839895550766 } ]
C++
Src/Qt/qwt/src/qwt_spline.cpp
iclosure/smartsoft
62eaed49efd8306642b928ef4f2d96e36aca6527
#include "precomp.h" #include "qwt_spline.h" #include "qwt_math.h" class QwtSpline::PrivateData { public: PrivateData(): splineType( QwtSpline::Natural ) { } QwtSpline::SplineType splineType; QVector<double> a; QVector<double> b; QVector<double> c; QPolygonF points; }; static int lookup( double x, const QPolygonF &values ) { #if 0 #endif int i1; const int size = values.size(); if ( x <= values[0].x() ) i1 = 0; else if ( x >= values[size - 2].x() ) i1 = size - 2; else { i1 = 0; int i2 = size - 2; int i3 = 0; while ( i2 - i1 > 1 ) { i3 = i1 + ( ( i2 - i1 ) >> 1 ); if ( values[i3].x() > x ) i2 = i3; else i1 = i3; } } return i1; } QwtSpline::QwtSpline() { d_data = new PrivateData; } QwtSpline::QwtSpline( const QwtSpline& other ) { d_data = new PrivateData( *other.d_data ); } QwtSpline &QwtSpline::operator=( const QwtSpline & other ) { *d_data = *other.d_data; return *this; } QwtSpline::~QwtSpline() { delete d_data; } void QwtSpline::setSplineType( SplineType splineType ) { d_data->splineType = splineType; } QwtSpline::SplineType QwtSpline::splineType() const { return d_data->splineType; } bool QwtSpline::setPoints( const QPolygonF& points ) { const int size = points.size(); if ( size <= 2 ) { reset(); return false; } d_data->points = points; d_data->a.resize( size - 1 ); d_data->b.resize( size - 1 ); d_data->c.resize( size - 1 ); bool ok; if ( d_data->splineType == Periodic ) ok = buildPeriodicSpline( points ); else ok = buildNaturalSpline( points ); if ( !ok ) reset(); return ok; } QPolygonF QwtSpline::points() const { return d_data->points; } const QVector<double> &QwtSpline::coefficientsA() const { return d_data->a; } const QVector<double> &QwtSpline::coefficientsB() const { return d_data->b; } const QVector<double> &QwtSpline::coefficientsC() const { return d_data->c; } void QwtSpline::reset() { d_data->a.resize( 0 ); d_data->b.resize( 0 ); d_data->c.resize( 0 ); d_data->points.resize( 0 ); } bool QwtSpline::isValid() const { return d_data->a.size() > 0; } double QwtSpline::value( double x ) const { if ( d_data->a.size() == 0 ) return 0.0; const int i = lookup( x, d_data->points ); const double delta = x - d_data->points[i].x(); return( ( ( ( d_data->a[i] * delta ) + d_data->b[i] ) * delta + d_data->c[i] ) * delta + d_data->points[i].y() ); } bool QwtSpline::buildNaturalSpline( const QPolygonF &points ) { int i; const QPointF *p = points.data(); const int size = points.size(); double *a = d_data->a.data(); double *b = d_data->b.data(); double *c = d_data->c.data(); QVector<double> h( size - 1 ); for ( i = 0; i < size - 1; i++ ) { h[i] = p[i+1].x() - p[i].x(); if ( h[i] <= 0 ) return false; } QVector<double> d( size - 1 ); double dy1 = ( p[1].y() - p[0].y() ) / h[0]; for ( i = 1; i < size - 1; i++ ) { b[i] = c[i] = h[i]; a[i] = 2.0 * ( h[i-1] + h[i] ); const double dy2 = ( p[i+1].y() - p[i].y() ) / h[i]; d[i] = 6.0 * ( dy1 - dy2 ); dy1 = dy2; } for ( i = 1; i < size - 2; i++ ) { c[i] /= a[i]; a[i+1] -= b[i] * c[i]; } QVector<double> s( size ); s[1] = d[1]; for ( i = 2; i < size - 1; i++ ) s[i] = d[i] - c[i-1] * s[i-1]; s[size - 2] = - s[size - 2] / a[size - 2]; for ( i = size - 3; i > 0; i-- ) s[i] = - ( s[i] + b[i] * s[i+1] ) / a[i]; s[size - 1] = s[0] = 0.0; for ( i = 0; i < size - 1; i++ ) { a[i] = ( s[i+1] - s[i] ) / ( 6.0 * h[i] ); b[i] = 0.5 * s[i]; c[i] = ( p[i+1].y() - p[i].y() ) / h[i] - ( s[i+1] + 2.0 * s[i] ) * h[i] / 6.0; } return true; } bool QwtSpline::buildPeriodicSpline( const QPolygonF &points ) { int i; const QPointF *p = points.data(); const int size = points.size(); double *a = d_data->a.data(); double *b = d_data->b.data(); double *c = d_data->c.data(); QVector<double> d( size - 1 ); QVector<double> h( size - 1 ); QVector<double> s( size ); for ( i = 0; i < size - 1; i++ ) { h[i] = p[i+1].x() - p[i].x(); if ( h[i] <= 0.0 ) return false; } const int imax = size - 2; double htmp = h[imax]; double dy1 = ( p[0].y() - p[imax].y() ) / htmp; for ( i = 0; i <= imax; i++ ) { b[i] = c[i] = h[i]; a[i] = 2.0 * ( htmp + h[i] ); const double dy2 = ( p[i+1].y() - p[i].y() ) / h[i]; d[i] = 6.0 * ( dy1 - dy2 ); dy1 = dy2; htmp = h[i]; } a[0] = qSqrt( a[0] ); c[0] = h[imax] / a[0]; double sum = 0; for ( i = 0; i < imax - 1; i++ ) { b[i] /= a[i]; if ( i > 0 ) c[i] = - c[i-1] * b[i-1] / a[i]; a[i+1] = qSqrt( a[i+1] - qwtSqr( b[i] ) ); sum += qwtSqr( c[i] ); } b[imax-1] = ( b[imax-1] - c[imax-2] * b[imax-2] ) / a[imax-1]; a[imax] = qSqrt( a[imax] - qwtSqr( b[imax-1] ) - sum ); s[0] = d[0] / a[0]; sum = 0; for ( i = 1; i < imax; i++ ) { s[i] = ( d[i] - b[i-1] * s[i-1] ) / a[i]; sum += c[i-1] * s[i-1]; } s[imax] = ( d[imax] - b[imax-1] * s[imax-1] - sum ) / a[imax]; s[imax] = - s[imax] / a[imax]; s[imax-1] = -( s[imax-1] + b[imax-1] * s[imax] ) / a[imax-1]; for ( i = imax - 2; i >= 0; i-- ) s[i] = - ( s[i] + b[i] * s[i+1] + c[i] * s[imax] ) / a[i]; s[size-1] = s[0]; for ( i = 0; i < size - 1; i++ ) { a[i] = ( s[i+1] - s[i] ) / ( 6.0 * h[i] ); b[i] = 0.5 * s[i]; c[i] = ( p[i+1].y() - p[i].y() ) / h[i] - ( s[i+1] + 2.0 * s[i] ) * h[i] / 6.0; } return true; }
#include "precomp.h" #include "qwt_spline.h" #include "qwt_math.h" class QwtSpline::PrivateData { public: PrivateData(): splineType( QwtSpline::Natural ) { } QwtSpline::SplineType splineType; QVector<double> a; QVector<double> b; QVector<double> c; QPolygonF points; }; static int lookup( double x, const QPolygonF &values ) { #if 0 #endif int i1; const int size = values.size(); if ( x <= values[0].x() ) i1 = 0; else if ( x >= values[size - 2].x() ) i1 = size - 2; else {
QwtSpline::QwtSpline() { d_data = new PrivateData; } QwtSpline::QwtSpline( const QwtSpline& other ) { d_data = new PrivateData( *other.d_data ); } QwtSpline &QwtSpline::operator=( const QwtSpline & other ) { *d_data = *other.d_data; return *this; } QwtSpline::~QwtSpline() { delete d_data; } void QwtSpline::setSplineType( SplineType splineType ) { d_data->splineType = splineType; } QwtSpline::SplineType QwtSpline::splineType() const { return d_data->splineType; } bool QwtSpline::setPoints( const QPolygonF& points ) { const int size = points.size(); if ( size <= 2 ) { reset(); return false; } d_data->points = points; d_data->a.resize( size - 1 ); d_data->b.resize( size - 1 ); d_data->c.resize( size - 1 ); bool ok; if ( d_data->splineType == Periodic ) ok = buildPeriodicSpline( points ); else ok = buildNaturalSpline( points ); if ( !ok ) reset(); return ok; } QPolygonF QwtSpline::points() const { return d_data->points; } const QVector<double> &QwtSpline::coefficientsA() const { return d_data->a; } const QVector<double> &QwtSpline::coefficientsB() const { return d_data->b; } const QVector<double> &QwtSpline::coefficientsC() const { return d_data->c; } void QwtSpline::reset() { d_data->a.resize( 0 ); d_data->b.resize( 0 ); d_data->c.resize( 0 ); d_data->points.resize( 0 ); } bool QwtSpline::isValid() const { return d_data->a.size() > 0; } double QwtSpline::value( double x ) const { if ( d_data->a.size() == 0 ) return 0.0; const int i = lookup( x, d_data->points ); const double delta = x - d_data->points[i].x(); return( ( ( ( d_data->a[i] * delta ) + d_data->b[i] ) * delta + d_data->c[i] ) * delta + d_data->points[i].y() ); } bool QwtSpline::buildNaturalSpline( const QPolygonF &points ) { int i; const QPointF *p = points.data(); const int size = points.size(); double *a = d_data->a.data(); double *b = d_data->b.data(); double *c = d_data->c.data(); QVector<double> h( size - 1 ); for ( i = 0; i < size - 1; i++ ) { h[i] = p[i+1].x() - p[i].x(); if ( h[i] <= 0 ) return false; } QVector<double> d( size - 1 ); double dy1 = ( p[1].y() - p[0].y() ) / h[0]; for ( i = 1; i < size - 1; i++ ) { b[i] = c[i] = h[i]; a[i] = 2.0 * ( h[i-1] + h[i] ); const double dy2 = ( p[i+1].y() - p[i].y() ) / h[i]; d[i] = 6.0 * ( dy1 - dy2 ); dy1 = dy2; } for ( i = 1; i < size - 2; i++ ) { c[i] /= a[i]; a[i+1] -= b[i] * c[i]; } QVector<double> s( size ); s[1] = d[1]; for ( i = 2; i < size - 1; i++ ) s[i] = d[i] - c[i-1] * s[i-1]; s[size - 2] = - s[size - 2] / a[size - 2]; for ( i = size - 3; i > 0; i-- ) s[i] = - ( s[i] + b[i] * s[i+1] ) / a[i]; s[size - 1] = s[0] = 0.0; for ( i = 0; i < size - 1; i++ ) { a[i] = ( s[i+1] - s[i] ) / ( 6.0 * h[i] ); b[i] = 0.5 * s[i]; c[i] = ( p[i+1].y() - p[i].y() ) / h[i] - ( s[i+1] + 2.0 * s[i] ) * h[i] / 6.0; } return true; } bool QwtSpline::buildPeriodicSpline( const QPolygonF &points ) { int i; const QPointF *p = points.data(); const int size = points.size(); double *a = d_data->a.data(); double *b = d_data->b.data(); double *c = d_data->c.data(); QVector<double> d( size - 1 ); QVector<double> h( size - 1 ); QVector<double> s( size ); for ( i = 0; i < size - 1; i++ ) { h[i] = p[i+1].x() - p[i].x(); if ( h[i] <= 0.0 ) return false; } const int imax = size - 2; double htmp = h[imax]; double dy1 = ( p[0].y() - p[imax].y() ) / htmp; for ( i = 0; i <= imax; i++ ) { b[i] = c[i] = h[i]; a[i] = 2.0 * ( htmp + h[i] ); const double dy2 = ( p[i+1].y() - p[i].y() ) / h[i]; d[i] = 6.0 * ( dy1 - dy2 ); dy1 = dy2; htmp = h[i]; } a[0] = qSqrt( a[0] ); c[0] = h[imax] / a[0]; double sum = 0; for ( i = 0; i < imax - 1; i++ ) { b[i] /= a[i]; if ( i > 0 ) c[i] = - c[i-1] * b[i-1] / a[i]; a[i+1] = qSqrt( a[i+1] - qwtSqr( b[i] ) ); sum += qwtSqr( c[i] ); } b[imax-1] = ( b[imax-1] - c[imax-2] * b[imax-2] ) / a[imax-1]; a[imax] = qSqrt( a[imax] - qwtSqr( b[imax-1] ) - sum ); s[0] = d[0] / a[0]; sum = 0; for ( i = 1; i < imax; i++ ) { s[i] = ( d[i] - b[i-1] * s[i-1] ) / a[i]; sum += c[i-1] * s[i-1]; } s[imax] = ( d[imax] - b[imax-1] * s[imax-1] - sum ) / a[imax]; s[imax] = - s[imax] / a[imax]; s[imax-1] = -( s[imax-1] + b[imax-1] * s[imax] ) / a[imax-1]; for ( i = imax - 2; i >= 0; i-- ) s[i] = - ( s[i] + b[i] * s[i+1] + c[i] * s[imax] ) / a[i]; s[size-1] = s[0]; for ( i = 0; i < size - 1; i++ ) { a[i] = ( s[i+1] - s[i] ) / ( 6.0 * h[i] ); b[i] = 0.5 * s[i]; c[i] = ( p[i+1].y() - p[i].y() ) / h[i] - ( s[i+1] + 2.0 * s[i] ) * h[i] / 6.0; } return true; }
i1 = 0; int i2 = size - 2; int i3 = 0; while ( i2 - i1 > 1 ) { i3 = i1 + ( ( i2 - i1 ) >> 1 ); if ( values[i3].x() > x ) i2 = i3; else i1 = i3; } } return i1; }
function_block-function_prefix_line
[ { "content": "class BCGCBPRODLLEXPORT CBCGPPointsArray : public CArray<CBCGPPoint, const CBCGPPoint&>\n\n{\n\npublic:\n\n\tCBCGPPointsArray() {}\n\n\tCBCGPPointsArray(int nNewSize, int nGrowBy = -1)\n\n\t{\n\n\t\tSetSize(nNewSize, nGrowBy);\n\n\t}\n\n\n\n\t~CBCGPPointsArray() {}\n\n\n\n\tCBCGPRect GetBoundsRect() const;\n\n\tCBCGPPoint GetBoundsCenter() const\n\n\t{\n\n\t\treturn GetBoundsRect ().CenterPoint ();\n\n\t}\n\n\n\n\tvoid StoreBoundsRect(const CBCGPRect& rect) {m_rectBounds = rect;}\n\n\n\n\tvoid Multiply(double value)\n", "file_path": "Src/VC/bcgcbpro/BCGPGraphicsManager.h", "rank": 0, "score": 368564.94461664476 }, { "content": "// This class provides access to the information contained in an HTTP request submitted to a web server.\n\n//\n\n// CHttpRequest provides access to the query string parameters, form fields, cookies, and files\n\n// that make up an HTTP request, as well as many other important properties of the request.\n\nclass CHttpRequest : public IHttpRequestLookup\n\n{\n\nprotected:\n\n\t// Implementation: Array used to map an HTTP request method (for example, \"GET\" or \"POST\")\n\n\t// from a string to a numeric constant from the HTTP_METHOD enum (HTTP_METHOD_GET or HTTP_METHOD_HEAD).\n\n\tstatic const char* const m_szMethodStrings[];\n\n\n\n\t// Implementation: The server context.\n\n\tCComPtr<IHttpServerContext> m_spServerContext;\n\n\n\n\t// Implementation: The number of bytes read from the body of the request.\n\n\tDWORD m_dwBytesRead;\n\n\n\n\t// Implementation: TRUE if the request method was POST and the encoding was\n\n\t// multipart/form-data, FALSE otherwise.\n\n\tBOOL m_bMultiPart;\n\n\n\n\tCCookie m_EmptyCookie;\n\n\n\n\t// Implementation: Constructor function used to reinitialize all data members.\n", "file_path": "Src/VC/atlserver/include/atlisapi.h", "rank": 1, "score": 368382.38445469784 }, { "content": "//\n\n//CPerfStatClass\n\n// Description\n\n// This class provides the implementation of a cache statistics gathering class\n\n// with PerfMon support\n\nclass CPerfStatClass : public CStdStatClass\n\n{\n\n\tCPerfStatObject * m_pPerfObject;\n\n\tCCachePerfMon m_PerfMon;\n\n\n\npublic:\n\n\n\n\tHRESULT Initialize(__in_z_opt LPWSTR szName=NULL)\n\n\t{\n\n\t\tHRESULT hr;\n\n\t\tWCHAR szPath[MAX_PATH];\n\n\n\n\t\tif (!szName)\n\n\t\t{\n\n\t\t\t// default name is the name of the module\n\n\t\t\t// we don't care about possible truncation if longer than max_path\n\n\t\t\t// we just need an identifier\n\n\t\t\tHINSTANCE hInst = _AtlBaseModule.GetModuleInstance();\n\n\t\t\tif (::GetModuleFileNameW(hInst, szPath, MAX_PATH) == 0)\n\n\t\t\t{\n", "file_path": "Src/VC/atlserver/include/atlcache.h", "rank": 2, "score": 343471.37192045397 }, { "content": "class BCGCBPRODLLEXPORT CBCGPStatic : public CStatic\n\n{\n\n\tDECLARE_DYNAMIC(CBCGPStatic)\n\n\n\n// Construction\n\npublic:\n\n\tCBCGPStatic();\n\n\n\n// Attributes\n\npublic:\n\n\tBOOL\t\tm_bOnGlass;\n\n\tBOOL\t\tm_bVisualManagerStyle;\n\n\tBOOL\t\tm_bBackstageMode;\n\n\tCOLORREF\tm_clrText;\n\n\tHFONT\t\tm_hFont;\n\n\n\n// Operations\n\npublic:\n\n\n\n// Overrides\n", "file_path": "Src/VC/bcgcbpro/BCGPStatic.h", "rank": 3, "score": 333519.84909499175 }, { "content": "class CHtmlStencil : public CStencil\n\n{\n\nprivate:\n\n\n\n\tATL_NOINLINE HTTP_CODE RenderInclude(\n\n\t\tITagReplacer *pReplacer, \n\n\t\tconst StencilToken *pToken, \n\n\t\tIWriteStream *pWriteStream, \n\n\t\tCStencilState *pState) const\n\n\t{\n\n\t\tATLASSUME(m_spServiceProvider);\n\n\t\tCComPtr<IHttpServerContext> spServerContext;\n\n\t\tCComPtr<IHttpRequestLookup> spLookup;\n\n\t\tif (FAILED(pReplacer->GetContext(__uuidof(IHttpServerContext), (VOID**) &spServerContext)))\n\n\t\t{\n\n\t\t\treturn AtlsHttpError(500, 0);\n\n\t\t}\n\n\t\tif (FAILED(pReplacer->GetContext(__uuidof(IHttpRequestLookup), (VOID**) &spLookup)))\n\n\t\t{\n\n\t\t\treturn AtlsHttpError(500, 0);\n", "file_path": "Src/VC/atlserver/include/atlstencil.h", "rank": 4, "score": 332182.75735660584 }, { "content": "class CSessionCookie : public CCookie\n\n{\n\npublic:\n\n\tCSessionCookie() throw(...)\n\n\t{\n\n\t\tif (!SetName(SESSION_COOKIE_NAME) ||\n\n\t\t\t!SetPath(\"/\"))\n\n\t\t\tAtlThrow(E_OUTOFMEMORY);\n\n\t}\n\n\n\n\tCSessionCookie(LPCSTR szSessionID) throw(...)\n\n\t{\n\n\t\tif (!SetName(SESSION_COOKIE_NAME) ||\n\n\t\t\t!SetPath(\"/\") ||\n\n\t\t\t!SetSessionID(szSessionID) )\n\n\t\t\tAtlThrow(E_OUTOFMEMORY);\n\n\t}\n\n\n\n\tBOOL SetSessionID(LPCSTR szSessionID) throw()\n\n\t{\n\n\t\tATLASSERT(szSessionID && szSessionID[0]);\n\n\t\treturn SetValue(szSessionID);\n\n\t}\n\n}; // class CSessionCookie\n\n\n\ntemplate<>\n", "file_path": "Src/VC/atlserver/include/atlisapi.h", "rank": 5, "score": 332182.75735660584 }, { "content": "// This class represents the response that the web server will send back to the client.\n\n//\n\n// CHttpResponse provides friendly functions for building up the headers, cookies, and body of an HTTP response.\n\n// The class derives from IWriteStream and CWriteStreamHelper, allowing you to call those classes' methods\n\n// to build up the body of the response. By default, the class improves performance by buffering the response until it is complete before sending it back to the client.\n\nclass CHttpResponse : public IWriteStream, public CWriteStreamHelper\n\n{\n\nprivate:\n\n\n\n\t// Implementation: A map of HTTP response headers.\n\n\t// The key is the name of the response header.\n\n\t// The value is the data for the response header.\n\n\tCSimpleMap<CStringA, CStringA> m_headers;\n\n\n\n\t// Implementation: Determines whether the response is currently being buffered.\n\n\tBOOL m_bBufferOutput;\n\n\n\n\t// Implementation: Determines whether any output should be sent to the client.\n\n\t// Intended mainly for HEAD requests, where the client should get the same headers\n\n\t// (i.e. Content-Length) as for a GET request\n\n\tBOOL m_bSendOutput;\n\n\n\n\t// Implementation: The limit in bytes of the response buffer.\n\n\t// When the limit is reached, the buffer is automatically flushed\n\n\t// and data is sent to the client. You can set this to ULONG_MAX\n", "file_path": "Src/VC/atlserver/include/atlisapi.h", "rank": 6, "score": 328227.9365329944 }, { "content": "// CMimeMessage - the MIME message class. Represents a full MIME message\n\nclass CMimeMessage : public CMimeHeader\n\n{\n\nprotected:\n\n\n\n\t// The list of the MIME body parts\n\n\tCAutoPtrList<CMimeBodyPart> m_BodyParts;\n\n\n\n\t// The display name of the message\n\n\tchar m_szDisplayName[MAX_PATH+1];\n\n\n\npublic:\n\n\tCMimeMessage(IMultiLanguage *pMultiLanguage = NULL) throw()\n\n\t{\n\n\t\tInitialize(pMultiLanguage);\n\n\t\tChecked::memcpy_s(m_szDisplayName, MAX_PATH+1, ATLMIME_EMAIL, sizeof(ATLMIME_EMAIL));\n\n\t}\n\n\n\n\tvirtual ~CMimeMessage() throw()\n\n\t{\n\n\t\tRemoveParts();\n", "file_path": "Src/VC/atlserver/include/atlmime.h", "rank": 7, "score": 327105.07518547366 }, { "content": "class CLifetimeCuller : public CExpireCuller\n\n{\n\npublic:\n\n\tvoid Add(CCullerCacheData * pItem)\n\n\t{\n\n\t\tATLENSURE(pItem);\n\n\t\tpItem->nLifespan = 0;\n\n\t\tCExpireCuller::Add(pItem);\n\n\t}\n\n\n\n\tvoid Commit(CCullerCacheData * pItem)\n\n\t{ \n\n\t\tATLENSURE(pItem);\n\n\t\tif (pItem->nLifespan == 0)\n\n\t\t\tpItem->cftExpireTime = 0;\n\n\t\telse\n\n\t\t\tpItem->cftExpireTime = CFileTime(CFileTime::GetCurrentTime().GetTime() + pItem->nLifespan);\n\n\t\tCExpireCuller::Commit(pItem);\n\n\t}\n\n\n", "file_path": "Src/VC/atlserver/include/atlcache.h", "rank": 8, "score": 327090.53787240916 }, { "content": "// CMimeAttachment is an abstract base class for MIME message attachments.\n\n// It serves as a base class for CMimeFileAttachment and CMimeRawAttachment\n\nclass CMimeAttachment : public CMimeBodyPart\n\n{\n\nprotected:\n\n\n\n\t// the encoding scheme (ATLSMTP_BASE64_ENCODE, ATLSMTP_UUENCODE, ATLSMTP_QP_ENCODE)\n\n\tint m_nEncodingScheme;\n\n\n\n\t// the content type of the attachment\n\n\tCStringA m_ContentType;\n\n\n\n\t// the character set\n\n\tchar m_szCharset[ATL_MAX_ENC_CHARSET_LENGTH];\n\n\n\n\t// the encode string (\"base64\", \"quoted-printable\", \"uuencode\")\n\n\tchar *m_pszEncodeString;\n\n\n\n\t// the display name of the attachment\n\n\tTCHAR m_szDisplayName[_MAX_FNAME];\n\n\n\npublic:\n", "file_path": "Src/VC/atlserver/include/atlmime.h", "rank": 9, "score": 322220.881920272 }, { "content": "// CMimeHeader describes the basic RFC 822 message header.\n\n// It also serves as the base class for the CMimeMessage object.\n\nclass CMimeHeader : public CMimeBodyPart\n\n{\n\nprotected:\n\n\n\n\t// Pointer to MLANG's IMultiLanguage interface.\n\n\t// This is used in doing conversion from code pages\n\n\t// to MIME-compatible character sets.\n\n\tCComPtr<IMultiLanguage> m_spMultiLanguage;\n\n\n\n\t//Basic Header Parts\n\n\tCStringA m_strFrom;\n\n\tCStringA m_strTo;\n\n\tCStringA m_strCc;\n\n\tCStringA m_strBcc;\n\n\tCStringA m_strSubject;\n\n\n\n\t//Extended Header Parts\n\n\tATL_MIME_PRIORITY m_nPriority;\n\n\tCStringA m_XHeader;\n\n\n", "file_path": "Src/VC/atlserver/include/atlmime.h", "rank": 10, "score": 322219.1871838087 }, { "content": "// class CCryptMD2Hash\n\n// RSA's MD2 hash\n\nclass CCryptMD2Hash : public CCryptHash\n\n{\n\npublic:\n\n\n\n\tHRESULT Initialize(CCryptProv &Prov, LPCTSTR szText = NULL) throw();\n\n}; // class CCryptMD2Hash\n\n\n\n\n", "file_path": "Src/VC/atlserver/include/atlcrypt.h", "rank": 11, "score": 322218.8116072236 }, { "content": "// class CCryptMD4Hash\n\n// RSA's MD4 hash\n\nclass CCryptMD4Hash : public CCryptHash\n\n{\n\npublic:\n\n\n\n\tHRESULT Initialize(CCryptProv &Prov, LPCTSTR szText = NULL) throw();\n\n}; // class CCryptMD4Hash\n\n\n\n\n", "file_path": "Src/VC/atlserver/include/atlcrypt.h", "rank": 12, "score": 322218.8116072236 }, { "content": "// class CCryptImportKey\n\n// Forms a key from an imported key blob\n\nclass CCryptImportKey : public CCryptKey\n\n{\n\npublic:\n\n\tHRESULT Initialize(\n\n\t\tCCryptProv &Prov,\n\n\t\tBYTE * pbData,\n\n\t\tDWORD dwDataLen,\n\n\t\tCCryptKey &PubKey,\n\n\t\tDWORD dwFlags) throw();\n\n}; // class CCryptImportKey\n\n\n\n\n", "file_path": "Src/VC/atlserver/include/atlcrypt.h", "rank": 13, "score": 322218.5569306549 }, { "content": "// class CCryptHash\n\n// A generic hash that may or may not take a key. \n\nclass CCryptKeyedHash : public CCryptHash\n\n{\n\npublic:\n\n\n\n\tHRESULT Initialize(CCryptProv &Prov, ALG_ID Algid, CCryptKey &Key, DWORD dwFlags) throw();\n\n}; // class CCryptKeyedHash\n\n\n", "file_path": "Src/VC/atlserver/include/atlcrypt.h", "rank": 14, "score": 322218.5569306549 }, { "content": "// class CCryptMD5Hash\n\n// RSA's MD5 hash (RSA's most recent hash as of 9/7/99);\n\nclass CCryptMD5Hash : public CCryptHash\n\n{\n\npublic:\n\n\n\n\tHRESULT Initialize(CCryptProv &Prov, LPCTSTR szText = NULL) throw();\n\n}; // class CCryptMD5Hash\n\n\n", "file_path": "Src/VC/atlserver/include/atlcrypt.h", "rank": 15, "score": 322218.4328529139 }, { "content": "// class CCryptSSL3SHAMD5Hash\n\n// Hash algorithm used by Secure Socket Layer\n\nclass CCryptSSL3SHAMD5Hash : public CCryptHash\n\n{\n\npublic:\n\n\tHRESULT Initialize(CCryptProv &Prov, CCryptKey &Key, LPCTSTR szText = NULL) throw();\n\n}; // class CCryptSSl3SHAMD5Hash\n\n\n\n}; // namespace ATL\n\n \n\n\n\n#include <atlcrypt.inl>\n\n#pragma pack(pop)\n\n#endif // __ATLCRYPT_H__\n", "file_path": "Src/VC/atlserver/include/atlcrypt.h", "rank": 16, "score": 322218.4328529139 }, { "content": "// class CCryptHMACHash\n\n// Hash-base Message Authentication Code keyed hash\n\nclass CCryptHMACHash : public CCryptHash\n\n{\n\npublic:\n\n\tHRESULT Initialize(CCryptProv &Prov, CCryptKey &Key, LPCTSTR szText = NULL) throw();\n\n}; // class CCryptHMACHash\n\n\n", "file_path": "Src/VC/atlserver/include/atlcrypt.h", "rank": 17, "score": 322218.31087528553 }, { "content": "// class CCryptSHAHash\n\n// The Secure Hash Algorithm hash, from NIST and NSA. Technically, SHA-1.\n\nclass CCryptSHAHash : public CCryptHash\n\n{\n\npublic:\n\n\n\n\tHRESULT Initialize(CCryptProv &Prov, LPCTSTR szText = NULL) throw();\n\n}; // class CCryptSHAHash\n\n\n\n// The Secure Hash Algorithm, from NIST and NSA. Identical to CCryptSHA\n\ntypedef CCryptSHAHash CCryptSHA1Hash;\n\n\n\n\n", "file_path": "Src/VC/atlserver/include/atlcrypt.h", "rank": 18, "score": 322218.1909448982 }, { "content": "// class CCryptMACHash\n\n// Message Authentication Code keyed hash. Believed to be less secure than HMAC\n\nclass CCryptMACHash : public CCryptHash\n\n{\n\npublic:\n\n\tHRESULT Initialize(CCryptProv &Prov, CCryptKey &Key, LPCTSTR szText = NULL) throw();\n\n}; // class CCryptMACHash\n\n\n", "file_path": "Src/VC/atlserver/include/atlcrypt.h", "rank": 19, "score": 322218.0730106401 }, { "content": "// class CCryptDerivedKey\n\n// A key that is derived from a hashed password. Two keys derived \n\n// from the same password will be identical.\n\nclass CCryptDerivedKey : public CCryptKey\n\n{\n\npublic:\n\n\tHRESULT Initialize(\n\n\t\tCCryptProv &Prov,\n\n\t\tCCryptHash &Hash,\n\n\t\tALG_ID algid = CALG_RC4,\n\n\t\tDWORD dwFlags = CRYPT_EXPORTABLE) throw();\n\n}; // class CCryptDerivedKey\n\n\n", "file_path": "Src/VC/atlserver/include/atlcrypt.h", "rank": 20, "score": 322217.9570230872 }, { "content": "// class CCryptRandomKey\n\n// A randomly generated key. Can be used internally by a program \n\n// to protect data during execution, or can be exported with Crypt.Export\n\n//\n\n// Currently it is possible to pass in AT_KEYEXCHANGE or AT_SIGNATURE \n\n// for algid, but these two will generate keys for the current key set, and \n\n// the resulting handle can only be used for exporting and importing keys or \n\n// signing hashes.\n\nclass CCryptRandomKey : public CCryptKey\n\n{\n\npublic:\n\n\tHRESULT Initialize(\n\n\t\tCCryptProv &Prov,\n\n\t\tALG_ID algid = CALG_RC4,\n\n\t\tDWORD dwFlags = CRYPT_EXPORTABLE) throw();\n\n}; // class CCryptRandomKey\n\n\n", "file_path": "Src/VC/atlserver/include/atlcrypt.h", "rank": 21, "score": 322215.49463316705 }, { "content": "// CCachePerfMon - the interface to CPerfMon, with associated definitions\n\nclass CCachePerfMon : public CPerfMon\n\n{\n\npublic:\n\n\tBEGIN_PERF_MAP(_T(\"ATL Server:Cache\"))\n\n\t\tCHAIN_PERF_CATEGORY(CPerfStatObject)\n\n\tEND_PERF_MAP()\n\n};\n\n\n", "file_path": "Src/VC/atlserver/include/atlcache.h", "rank": 22, "score": 322212.37525679986 }, { "content": "// CMimeText - represents a text body part in MIME body\n\nclass CMimeText : public CMimeBodyPart\n\n{\n\nprotected:\n\n\n\n\t// the text\n\n\tCHeapPtr<char> m_szText;\n\n\n\n\t// the character set\n\n\tchar m_szCharset[ATL_MAX_ENC_CHARSET_LENGTH];\n\n\n\n\t// the text length\n\n\tint m_nTextLen;\n\n\n\npublic:\n\n\tCMimeText() throw()\n\n\t\t:m_nTextLen(0)\n\n\t{\n\n\t\tChecked::strcpy_s(m_szCharset, ATL_MAX_ENC_CHARSET_LENGTH, ATLSMTP_DEFAULT_CSET);\n\n\t}\n\n\n", "file_path": "Src/VC/atlserver/include/atlmime.h", "rank": 23, "score": 322211.1962703657 }, { "content": "// CMimeFileAttachment represents a MIME file attachment body part\n\nclass CMimeFileAttachment : public CMimeAttachment\n\n{\n\n\n\nprotected:\n\n\t// The filename\n\n\tTCHAR m_szFileName[MAX_PATH+1];\n\n\n\npublic:\n\n\tCMimeFileAttachment() throw()\n\n\t{\n\n\t\tm_szFileName[0] = 0;\n\n\t}\n\n\n\n\tvirtual ATL_NOINLINE CMimeBodyPart* Copy() throw( ... )\n\n\t{\n\n\t\tCAutoPtr<CMimeFileAttachment> pNewAttachment;\n\n\t\tATLTRY(pNewAttachment.Attach(new CMimeFileAttachment));\n\n\t\tif (pNewAttachment)\n\n\t\t\t*pNewAttachment = *this;\n\n\n", "file_path": "Src/VC/atlserver/include/atlmime.h", "rank": 24, "score": 322211.13448945084 }, { "content": "// CMimeRawAttachment represents a file attachment MIME body part.\n\n// The data provided is not a file, but a blob of raw data.\n\nclass CMimeRawAttachment : public CMimeAttachment\n\n{\n\nprotected:\n\n\n\n\t//the raw data\n\n\tvoid* m_pvRaw;\n\n\n\n\t//the length\n\n\tDWORD m_dwLength;\n\n\n\n\t//whether or not we own it\n\n\tbool m_bShared;\n\n\n\npublic:\n\n\tCMimeRawAttachment() throw()\n\n\t\t:m_dwLength(0), m_bShared(false), m_pvRaw(NULL)\n\n\t{\n\n\t}\n\n\n\n\t~CMimeRawAttachment() throw()\n", "file_path": "Src/VC/atlserver/include/atlmime.h", "rank": 25, "score": 322210.7850444329 }, { "content": "class CWriteStreamOnCString : public IWriteStream\n\n{\n\n\n\npublic:\n\n\tCStringA m_str;\n\n\n\n\tvirtual ~CWriteStreamOnCString()\n\n\t{\n\n\t}\n\n\n\n\tHRESULT WriteStream(LPCSTR szOut, int nLen, LPDWORD pdwWritten)\n\n\t{\n\n\t\tATLENSURE_RETURN( szOut != NULL );\n\n\n\n\t\tif (nLen < 0)\n\n\t\t{\n\n\t\t\tnLen = (int) strlen(szOut);\n\n\t\t}\n\n\n\n\t\t_ATLTRY\n", "file_path": "Src/VC/atlserver/include/atlsoap.h", "rank": 26, "score": 322204.01961759035 }, { "content": "class CHtmlGenBase : public CStreamFormatter\n\n{\n\npublic:\n\n\tT* GetOuter()\n\n\t{\n\n\t\treturn static_cast<T*>(this);\n\n\t}\n\n\n\n\tenum ATL_HTML_FORM_METHOD { ATL_HTML_FORM_METHOD_NONE=0, ATL_HTML_FORM_METHOD_GET, ATL_HTML_FORM_METHOD_POST, ATL_HTML_FORM_METHOD_MULTIPART };\n\n\n\n\tCHtmlGenBase()\n\n\t{\n\n\t\tm_nWidthPercent = -1;\n\n\t\tm_nHeightPercent = -1;\n\n\t\tm_nFormMethod = ATL_HTML_FORM_METHOD_NONE;\n\n\t\tm_pScheme = NULL;\n\n\t}\n\n\n\n\tvoid SetScheme(HTML_SCHEME *pScheme)\n\n\t{\n", "file_path": "Src/VC/atlserver/include/atlhtml.h", "rank": 27, "score": 322204.01961759035 }, { "content": "class CRequestPerfMon : public CPerfMon\n\n{\n\npublic:\n\n\tBEGIN_PERF_MAP(_T(\"ATL Server:Request\"))\n\n\t\tCHAIN_PERF_CATEGORY(CPerfRequestStatObject)\n\n\tEND_PERF_MAP()\n\n};\n\n\n", "file_path": "Src/VC/atlserver/include/atlisapi.h", "rank": 28, "score": 322204.01961759035 }, { "content": "class CStdRequestStats : public CRequestStats\n\n{\n\n\n\npublic:\n\n\tHRESULT Initialize() throw()\n\n\t{\n\n\t\treturn S_OK;\n\n\t}\n\n\n\n\tvoid Uninitialize() throw()\n\n\t{\n\n\t}\n\n};\n\n\n\n#define PERF_REQUEST_OBJECT 100\n\n \n", "file_path": "Src/VC/atlserver/include/atlisapi.h", "rank": 29, "score": 322204.01961759035 }, { "content": "class CFixedLifetimeCuller : public CExpireCuller\n\n{\n\npublic:\n\n\tvoid Commit(CCullerCacheData * pItem)\n\n\t{\n\n\t\tATLASSERT(pItem);\n\n\t\t__int64 nLifeSpan = ftLifespan;\n\n\t\tif (nLifeSpan == 0)\n\n\t\t\tpItem->cftExpireTime = 0;\n\n\t\telse\n\n\t\t\tpItem->cftExpireTime = CFileTime::GetCurrentTime() + CFileTimeSpan(ftLifespan);\n\n\n\n\t\tCExpireCuller::Commit(pItem);\n\n\t}\n\n\n\n\tvoid Access(CCullerCacheData * pItem)\n\n\t{\n\n\t\tATLASSERT(pItem);\n\n\t\tCExpireCuller::Remove(pItem);\n\n\t\tCommit(pItem);\n\n\t}\n\n\n\n\tCCullerCacheData * GetExpired() \n\n\t{ \n\n\t\treturn static_cast<CCullerCacheData *>(CExpireCuller::GetExpired());\n\n\t}\n\n};\n\n\n\n\n\ntemplate <class CFirst, class CSecond>\n", "file_path": "Src/VC/atlserver/include/atlcache.h", "rank": 30, "score": 322204.01961759035 }, { "content": "\tclass CRpcEncodedGenerator : public CResponseGenerator\n\n\t{\n\n\tpublic:\n\n\n\n\t\tHRESULT StartBody(IWriteStream *pStream)\n\n\t\t{\n\n\t\t\tATLENSURE_RETURN( pStream != NULL );\n\n\n\n\t\t\treturn pStream->WriteStream(\n\n\t\t\t\t\"<soap:Body soap:encodingStyle=\\\"\" SOAPENC_NAMESPACEA \"\\\">\", \n\n\t\t\t\tsizeof(\"<soap:Body soap:encodingStyle=\\\"\" SOAPENC_NAMESPACEA \"\\\">\")-1, NULL);\n\n\t\t}\n\n\n\n\t\tHRESULT StartMap(IWriteStream *pStream, const _soapmap *pMap, bool bClient)\n\n\t\t{\n\n\t\t\tATLENSURE_RETURN( pStream != NULL );\n\n\t\t\tATLENSURE_RETURN( pMap != NULL );\n\n\n\n\t\t\t(bClient); // unused for rpc/encoded\n\n\n", "file_path": "Src/VC/atlserver/include/atlsoap.h", "rank": 31, "score": 322204.01961759035 }, { "content": "\tclass CDocLiteralGenerator : public CResponseGenerator\n\n\t{\n\n\tpublic:\n\n\n\n\t\tHRESULT StartMap(IWriteStream *pStream, const _soapmap *pMap, bool bClient)\n\n\t\t{\n\n\t\t\tATLENSURE_RETURN( pStream != NULL );\n\n\t\t\tATLENSURE_RETURN( pMap != NULL );\n\n\n\n\t\t\tHRESULT hr = S_OK;\n\n\t\t\t// output type name\n\n\t\t\thr = pStream->WriteStream(\"<\", 1, NULL);\n\n\t\t\tif (SUCCEEDED(hr))\n\n\t\t\t{\n\n\t\t\t\thr = pStream->WriteStream(pMap->szName, pMap->cchName, NULL);\n\n\t\t\t\tif (SUCCEEDED(hr))\n\n\t\t\t\t{\n\n\t\t\t\t\tif ((pMap->mapType == SOAPMAP_FUNC) && \n\n\t\t\t\t\t\t(bClient == false) && \n\n\t\t\t\t\t\t(pMap->dwCallFlags & SOAPFLAG_PID))\n", "file_path": "Src/VC/atlserver/include/atlsoap.h", "rank": 32, "score": 322204.01961759035 }, { "content": "// class CCryptUserSigKey\n\n// Obtains the user's signature key pair\n\nclass CCryptUserSigKey : public CCryptKey\n\n{\n\npublic:\n\n\tHRESULT Initialize(CCryptProv &Prov) throw();\n\n\tHRESULT Create(CCryptProv &Prov) throw();\n\n}; // class CCryptUserSigKey\n\n\n", "file_path": "Src/VC/atlserver/include/atlcrypt.h", "rank": 33, "score": 317525.11420211906 }, { "content": "// class CCryptUserExKey\n\n// Obtains the user's key exchange key pair.\n\nclass CCryptUserExKey : public CCryptKey\n\n{\n\npublic:\n\n\tHRESULT Initialize(CCryptProv &Prov) throw();\n\n\tHRESULT Create(CCryptProv &Prov) throw();\n\n}; // class CCryptUserExKey\n\n\n", "file_path": "Src/VC/atlserver/include/atlcrypt.h", "rank": 34, "score": 317524.9922244907 }, { "content": "// Use to update the value of a session variable\n\nclass CSessionDataUpdator : public CSessionDataBase\n\n{\n\npublic:\n\n\tBEGIN_PARAM_MAP(CSessionDataUpdator) \n\n\t\tSET_PARAM_TYPE(DBPARAMIO_INPUT)\n\n\t\tCOLUMN_ENTRY_LENGTH(1, m_VariableValue, m_VariableLen)\n\n\t\tCOLUMN_ENTRY(2, m_szSessionID)\n\n\t\tCOLUMN_ENTRY(3, m_VariableName)\n\n\tEND_PARAM_MAP()\n\n};\n\n\n", "file_path": "Src/VC/atlserver/include/atlsession.h", "rank": 35, "score": 317518.4051406988 }, { "content": "// Use to select all session variables given the name of\n\n// of a session.\n\nclass CAllSessionDataSelector : public CSessionDataBase\n\n{\n\npublic:\n\n\tBEGIN_COLUMN_MAP(CAllSessionDataSelector) \n\n\t\tCOLUMN_ENTRY(1, m_szSessionID)\n\n\t\tCOLUMN_ENTRY(2, m_VariableName)\n\n\t\tCOLUMN_ENTRY_LENGTH(3, m_VariableValue, m_VariableLen)\n\n\tEND_COLUMN_MAP()\n\n\tBEGIN_PARAM_MAP(CAllSessionDataSelector) \n\n\t\tSET_PARAM_TYPE(DBPARAMIO_INPUT)\n\n\t\tCOLUMN_ENTRY(1, m_szSessionID)\n\n\tEND_PARAM_MAP()\n\n};\n\n\n", "file_path": "Src/VC/atlserver/include/atlsession.h", "rank": 36, "score": 317510.70096679556 }, { "content": "// Use to select a session variable given the name\n\n// of a session and the name of a variable.\n\nclass CSessionDataSelector : public CSessionDataBase\n\n{\n\npublic:\n\n\tBEGIN_COLUMN_MAP(CSessionDataSelector) \n\n\t\tCOLUMN_ENTRY(1, m_szSessionID)\n\n\t\tCOLUMN_ENTRY(2, m_VariableName)\n\n\t\tCOLUMN_ENTRY_LENGTH(3, m_VariableValue, m_VariableLen)\n\n\tEND_COLUMN_MAP()\n\n\tBEGIN_PARAM_MAP(CSessionDataSelector) \n\n\t\tSET_PARAM_TYPE(DBPARAMIO_INPUT)\n\n\t\tCOLUMN_ENTRY(1, m_szSessionID)\n\n\t\tCOLUMN_ENTRY(2, m_VariableName)\n\n\tEND_PARAM_MAP()\n\n};\n\n\n", "file_path": "Src/VC/atlserver/include/atlsession.h", "rank": 37, "score": 317510.70096679556 }, { "content": "class CSecBuffer : public SecBuffer\n\n{\n\npublic:\n\n\tCSecBuffer() throw()\n\n\t{\n\n\t\tcbBuffer = 0;\n\n\t\tBufferType = 0;\n\n\t\tpvBuffer = NULL;\n\n\t\tm_cbAlloc = 0;\n\n\t}\n\n\n\n\t~CSecBuffer() throw()\n\n\t{\n\n\t\tdelete [] static_cast<unsigned char*>(pvBuffer);\n\n\t}\n\n\n\n\tbool SetSize(unsigned long nSize) throw()\n\n\t{\n\n\t\tif (!nSize)\n\n\t\t\treturn false;\n", "file_path": "Src/VC/atlserver/include/atlhttp.h", "rank": 38, "score": 315266.5866452913 }, { "content": "class CStreamOnWriteStream : public IStream\n\n{\n\npublic:\n\n\tIWriteStream *m_pWriteStream;\n\n\n\n\tCStreamOnWriteStream()\n\n\t{\n\n\t\tm_pWriteStream = NULL;\n\n\t}\n\n\n\n\tvoid Init(IWriteStream *pWriteStream)\n\n\t{\n\n\t\tm_pWriteStream = pWriteStream;\n\n\t}\n\n\n\n\t// IUnknown methods\n\n\tSTDMETHOD(QueryInterface)(REFIID riid, void **ppv)\n\n\t{\n\n\t\tif (!ppv)\n\n\t\t\treturn E_POINTER;\n", "file_path": "Src/VC/atlserver/include/atlhtml.h", "rank": 39, "score": 315266.5866452913 }, { "content": "class CDllCache : public IDllCache, \n\n\tpublic IWorkerThreadClient\n\n{\n\nprotected:\n\n\tCComCriticalSection m_critSec;\n\n\tCSimpleArray<DLL_CACHE_ENTRY> m_Dlls;\n\n\tCSimpleArray<typename Peer::DllInfo> m_DllInfos;\n\n\tMonitorClass m_Monitor;\n\n\tHANDLE m_hTimer;\n\n\n\n\tvoid RemoveDllEntry(DLL_CACHE_ENTRY& entry)\n\n\t{\n\n\t\t::FreeLibrary(entry.hInstDll);\n\n\t\tentry.hInstDll = NULL;\n\n\t\tm_Dlls.RemoveAt(m_Dlls.GetSize()-1);\n\n\t}\n\n\n\npublic:\n\n\tPeer m_Peer;\n\n\n", "file_path": "Src/VC/atlserver/include/atlcache.h", "rank": 40, "score": 315266.5866452913 }, { "content": "// Least recently used flusher -- the item that was accessed the longest time ago is flushed\n\nclass CLRUFlusher : public COldFlusher\n\n{\n\npublic:\n\n\t// Move it to the tail of the list\n\n\tvoid Access(CFlusherCacheData * pItem)\n\n\t{\n\n\t\tATLASSERT(pItem);\n\n\n\n\t\tRemove(pItem);\n\n\t\tAdd(pItem);\n\n\t}\n\n};\n\n\n", "file_path": "Src/VC/atlserver/include/atlcache.h", "rank": 41, "score": 315266.5866452913 }, { "content": "// Least often used flusher\n\nclass CLOUFlusher : public COldFlusher\n\n{\n\npublic:\n\n\t// Adds to the tail of the list\n\n\tvoid Add(CFlusherCacheData * pItem)\n\n\t{\n\n\t\tATLENSURE(pItem);\n\n\t\tpItem->dwAccessed = 1;\n\n\t\tCOldFlusher::Add(pItem);\n\n\t}\n\n\n\n\tvoid Access(CFlusherCacheData * pItem)\n\n\t{\n\n\t\tATLENSURE(pItem);\n\n\t\tpItem->dwAccessed++;\n\n\n\n\t\tCFlusherCacheData * pMark = static_cast<CFlusherCacheData *>(pItem->pPrev);\n\n\t\tif (!pMark) // The item is already at the head\n\n\t\t\treturn;\n\n\n", "file_path": "Src/VC/atlserver/include/atlcache.h", "rank": 42, "score": 315266.5866452913 }, { "content": "class CHtmlGen : public CHtmlGenBase<CHtmlGen>\n\n{\n\npublic:\n\n};\n\n\n\n} // namespace ATL\n\n#pragma pack(pop)\n\n\n\n#endif // __ATLHTML_H__\n", "file_path": "Src/VC/atlserver/include/atlhtml.h", "rank": 43, "score": 310578.643491805 }, { "content": "\tclass CBrowserCaps : public IBrowserCaps, public CComObjectRootEx<CComSingleThreadModel>\n\n\t{\n\n\tpublic:\n\n\n\n\t\tBEGIN_COM_MAP(CBrowserCaps)\n\n\t\t\tCOM_INTERFACE_ENTRY(IBrowserCaps)\n\n\t\tEND_COM_MAP()\n\n\n\n\t\tCBrowserCaps()\n\n\t\t{\n\n\t\t}\n\n\n\n\t\tHRESULT Initialize(__in CBrowserCapsSvc::BrowserCaps * pCaps)\n\n\t\t{\n\n\t\t\tm_pCaps = pCaps;\n\n\t\t\treturn S_OK;\n\n\t\t}\n\n\n\n\t\t__checkReturn HRESULT GetPropertyString(__in BSTR bstrProperty, __out BSTR * pbstrOut)\n\n\t\t{\n", "file_path": "Src/VC/atlserver/include/atlsiface.h", "rank": 44, "score": 310292.780393124 }, { "content": "// This class represents the information about a file that has been uploaded to the web server.\n\nclass CHttpRequestFile : public IHttpFile\n\n{\n\nprivate:\n\n\n\n\t// The name of the form field used to upload the file.\n\n\tCHAR m_szParamName[MAX_TOKEN_LENGTH];\n\n\n\n\t// The original file name of the uploaded file as set by the client.\n\n\tCHAR m_szFileName[MAX_PATH];\n\n\n\n\t// The original path and file name of the uploaded file as set by the client.\n\n\tCHAR m_szFullFileName[MAX_PATH];\n\n\n\n\t// The MIME type of the uploaded file.\n\n\tCHAR m_szContentType[MAX_TOKEN_LENGTH];\n\n\n\n\t// The name of the uploaded file on the server.\n\n\tCHAR m_szTempFileName[MAX_PATH];\n\n\n\n\t// The size of the file in bytes.\n", "file_path": "Src/VC/atlserver/include/atlisapi.h", "rank": 45, "score": 309955.6746761324 }, { "content": "class CStreamOnServerContext : public IStreamImpl\n\n{\n\npublic:\n\n\n\n\tHRESULT __stdcall QueryInterface(REFIID riid, void **ppv)\n\n\t{\n\n\t\tif (ppv == NULL)\n\n\t\t{\n\n\t\t\treturn E_POINTER;\n\n\t\t}\n\n\n\n\t\t*ppv = NULL;\n\n\n\n\t\tif (InlineIsEqualGUID(riid, IID_IUnknown) ||\n\n\t\t\tInlineIsEqualGUID(riid, IID_IStream) ||\n\n\t\t\tInlineIsEqualGUID(riid, IID_ISequentialStream))\n\n\t\t{\n\n\t\t\t*ppv = static_cast<IStream *>(this);\n\n\t\t\treturn S_OK;\n\n\t\t}\n", "file_path": "Src/VC/atlserver/include/atlsoap.h", "rank": 46, "score": 309948.0554627043 }, { "content": "\tclass CPADGenerator : public CDocLiteralGenerator\n\n\t{\n\n\tpublic:\n\n\n\n\t\tvirtual HRESULT StartEntry(IWriteStream *pStream, const _soapmap *pMap, const _soapmapentry *pEntry)\n\n\t\t{\n\n\t\t\tATLENSURE_RETURN( pStream != NULL );\n\n\t\t\tATLENSURE_RETURN( pEntry != NULL );\n\n\n\n\t\t\tHRESULT hr = __super::StartEntry(pStream, pMap, pEntry);\n\n\t\t\tif (SUCCEEDED(hr) && (pMap->dwCallFlags & SOAPFLAG_PAD))\n\n\t\t\t{\n\n\t\t\t\thr = pStream->WriteStream(\" xmlns=\\\"\", sizeof(\" xmlns=\\\"\")-1, NULL);\n\n\t\t\t\tif (SUCCEEDED(hr))\n\n\t\t\t\t{\n\n\t\t\t\t\thr = pStream->WriteStream(pMap->szNamespace, pMap->cchNamespace, NULL);\n\n\t\t\t\t\tif (SUCCEEDED(hr))\n\n\t\t\t\t\t{\n\n\t\t\t\t\t\thr = pStream->WriteStream(\"\\\"\", sizeof(\"\\\"\")-1, NULL);\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\n\t\t\treturn hr;\n\n\t\t}\n\n\t}; // class CPADGenerator\n\n\n", "file_path": "Src/VC/atlserver/include/atlsoap.h", "rank": 47, "score": 309948.0554627043 }, { "content": "\tclass CPIDGenerator : public CDocLiteralGenerator\n\n\t{\n\n\t};\n\n\n", "file_path": "Src/VC/atlserver/include/atlsoap.h", "rank": 48, "score": 309948.0554627043 }, { "content": "class _CComObjectHeapNoLock : public Base\n\n{\n\n\tpublic:\n\n\ttypedef Base _BaseClass;\n\n\tHANDLE m_hHeap;\n\n\n\n\t_CComObjectHeapNoLock(void* = NULL, HANDLE hHeap = NULL)\n\n\t{\n\n\t\tm_hHeap = hHeap;\n\n\t}\n\n\t// Set refcount to -(LONG_MAX/2) to protect destruction and \n\n\t// also catch mismatched Release in debug builds\n\n\t~_CComObjectHeapNoLock()\n\n\t{\n\n\t\tm_dwRef = -(LONG_MAX/2);\n\n\t\tFinalRelease();\n\n#ifdef _ATL_DEBUG_INTERFACES\n\n\t\t_AtlDebugInterfacesModule.DeleteNonAddRefThunk(_GetRawUnknown());\n\n#endif\n\n\t}\n", "file_path": "Src/VC/atlserver/include/atlisapi.h", "rank": 49, "score": 309948.0554627043 }, { "content": "class CReadStreamOnSocket : public IStreamImpl\n\n{\n\npublic:\n\n\n\n\tHRESULT __stdcall QueryInterface(REFIID riid, void **ppv)\n\n\t{\n\n\t\tif (ppv == NULL)\n\n\t\t{\n\n\t\t\treturn E_POINTER;\n\n\t\t}\n\n\n\n\t\t*ppv = NULL;\n\n\n\n\t\tif (InlineIsEqualGUID(riid, IID_IUnknown) ||\n\n\t\t\tInlineIsEqualGUID(riid, IID_IStream) ||\n\n\t\t\tInlineIsEqualGUID(riid, IID_ISequentialStream))\n\n\t\t{\n\n\t\t\t*ppv = static_cast<IStream *>(this);\n\n\t\t\treturn S_OK;\n\n\t\t}\n", "file_path": "Src/VC/atlserver/include/atlsoap.h", "rank": 50, "score": 309948.0554627043 }, { "content": "class CReadStreamOnInet : public IStreamImpl\n\n{\n\npublic:\n\n\n\n\tHRESULT __stdcall QueryInterface(REFIID riid, void **ppv)\n\n\t{\n\n\t\tif (ppv == NULL)\n\n\t\t{\n\n\t\t\treturn E_POINTER;\n\n\t\t}\n\n\n\n\t\t*ppv = NULL;\n\n\n\n\t\tif (InlineIsEqualGUID(riid, IID_IUnknown) ||\n\n\t\t\tInlineIsEqualGUID(riid, IID_IStream) ||\n\n\t\t\tInlineIsEqualGUID(riid, IID_ISequentialStream))\n\n\t\t{\n\n\t\t\t*ppv = static_cast<IStream *>(this);\n\n\t\t\treturn S_OK;\n\n\t\t}\n", "file_path": "Src/VC/atlserver/include/atlsoap.h", "rank": 51, "score": 309948.0554627043 }, { "content": "class CBrowserCapsSvc : public IBrowserCapsSvc, \n\n\t\t\t\t\t\tpublic CComObjectRootEx<CComSingleThreadModel>\n\n{\n\npublic:\n\n\tvirtual ~CBrowserCapsSvc()\n\n\t{\n\n\t}\n\n\t\n\n\tBEGIN_COM_MAP(CBrowserCapsSvc)\n\n\t\tCOM_INTERFACE_ENTRY(IBrowserCapsSvc)\n\n\tEND_COM_MAP()\n\n\n\n\t__success(SUCCEEDED(return)) __checkReturn HRESULT GetCaps(__in IHttpServerContext * pContext, __deref_out_opt IBrowserCaps ** ppOut)\n\n\t{\n\n\t\tif (!pContext)\n\n\t\t\treturn E_POINTER;\n\n\n\n\t\tif (!ppOut)\n\n\t\t\treturn E_POINTER;\n\n\n", "file_path": "Src/VC/atlserver/include/atlsiface.h", "rank": 52, "score": 304861.95354555815 }, { "content": "class CSkipHandler : public ISAXContentHandlerImpl\n\n{\n\npublic:\n\n\tvirtual ~CSkipHandler()\n\n\t{\n\n\t}\n\n\t\n\n\tHRESULT __stdcall QueryInterface(REFIID riid, void **ppv)\n\n\t{\n\n\t\tif (ppv == NULL)\n\n\t\t{\n\n\t\t\treturn E_POINTER;\n\n\t\t}\n\n\n\n\t\t*ppv = NULL;\n\n\n\n\t\tif (InlineIsEqualGUID(riid, IID_IUnknown) ||\n\n\t\t\tInlineIsEqualGUID(riid, IID_ISAXContentHandler))\n\n\t\t{\n\n\t\t\t*ppv = static_cast<ISAXContentHandler *>(this);\n", "file_path": "Src/VC/atlserver/include/atlsoap.h", "rank": 53, "score": 304861.95354555815 }, { "content": "class CSecBufferDesc : public SecBufferDesc\n\n{\n\npublic:\n\n\tCSecBufferDesc() throw()\n\n\t{\n\n\t\tulVersion = SECBUFFER_VERSION;\n\n\t\tcBuffers = 0;\n\n\t\tpBuffers = NULL;\n\n\t}\n\n\n\n\t~CSecBufferDesc() throw()\n\n\t{\n\n\t\tcBuffers = 0;\n\n\n\n\t\tif (pBuffers)\n\n\t\t{\n\n\t\t\tCSecBuffer *psb = (CSecBuffer*)pBuffers;\n\n\t\t\tdelete [] psb;\n\n\t\t}\n\n\t}\n", "file_path": "Src/VC/atlserver/include/atlhttp.h", "rank": 54, "score": 304861.95354555815 }, { "content": "class CAtlNavigateData : public ATL_NAVIGATE_DATA\n\n{\n\npublic:\n\n\tCAtlNavigateData() throw(); // public construction\n\n\tCAtlNavigateData(const CAtlNavigateData &rhs);\n\n\tCAtlNavigateData(const ATL_NAVIGATE_DATA &rhs);\n\n\tCAtlNavigateData& operator=(const CAtlNavigateData &rhs);\n\n\tCAtlNavigateData& operator=(const ATL_NAVIGATE_DATA &rhs);\n\n\tDWORD SetFlags(DWORD dwNewFlags) throw(); // set all flags\n\n\tDWORD GetFlags() throw(); // get value of flags\n\n\tDWORD AddFlags(DWORD dwFlagsToAdd) throw(); // add one or more flags to existing flags\n\n\tDWORD RemoveFlags(DWORD dwFlagsToRemove) throw(); // remove one or more flags from existing flags\n\n\tLPCTSTR SetExtraHeaders(LPCTSTR szNewHeaders) throw(); // set the extra request headers\n\n\tLPCTSTR GetExtraHeaders() throw(); // get the extra request headers\n\n\tLPCTSTR SetMethod(LPCTSTR szNewMethod) throw(); // set the HTTP request method\n\n\tLPCTSTR GetMethod() throw(); // get the HTTP request method\n\n\tshort SetPort(short newPort) throw(); // set the TCP port for this request\n\n\tshort GetPort() throw(); // get the TCP port for this request\n\n\tvoid SetPostData(BYTE *pData, DWORD dwDataLen, LPCTSTR szDataType) throw(); // Set data to be sent as the reqeust entity body\n\n\tDWORD SetSocketTimeout(DWORD dwNewTimeout) throw(); // Set the timeout for this socket\n", "file_path": "Src/VC/atlserver/include/atlhttp.h", "rank": 55, "score": 304861.95354555803 }, { "content": "class CBlobCache : public CMemoryCache<void*, StatClass, FlushClass, CFixedStringKey, \n\n\tCStringElementTraits<CFixedStringKey >, SyncObj, CullClass>,\n\n\tpublic IMemoryCache,\n\n\tpublic IMemoryCacheControl,\n\n\tpublic IMemoryCacheStats,\n\n\tpublic IWorkerThreadClient\n\n{\n\n\ttypedef CMemoryCache<void*, StatClass, FlushClass, CFixedStringKey, \n\n\t\tCStringElementTraits<CFixedStringKey>, SyncObj, CullClass> cacheBase;\n\n\n\n\tMonitorClass m_Monitor;\n\n\n\nprotected:\n\n\tHANDLE m_hTimer;\n\n\n\npublic:\n\n\tCBlobCache() : m_hTimer(NULL)\n\n\t{\n\n\t}\n\n\n", "file_path": "Src/VC/atlserver/include/atlcache.h", "rank": 56, "score": 304428.098232622 }, { "content": "class CSoapFaultParser : public ISAXContentHandlerImpl\n\n{\n\nprivate:\n\n\n\n\tCSoapFault *m_pFault;\n\n\n\n\tDWORD m_dwState;\n\n\n\n\tconst static DWORD STATE_ERROR = 0;\n\n\tconst static DWORD STATE_ENVELOPE = 1;\n\n\tconst static DWORD STATE_BODY = 2;\n\n\tconst static DWORD STATE_START = 4;\n\n\tconst static DWORD STATE_FAULTCODE = 8;\n\n\tconst static DWORD STATE_FAULTSTRING = 16;\n\n\tconst static DWORD STATE_FAULTACTOR = 32;\n\n\tconst static DWORD STATE_DETAIL = 64;\n\n\tconst static DWORD STATE_RESET = 128;\n\n\tconst static DWORD STATE_SKIP = 256;\n\n\n\n\n", "file_path": "Src/VC/atlserver/include/atlsoap.h", "rank": 57, "score": 299993.37034460105 }, { "content": "class CSoapRootHandler : public ISAXContentHandlerImpl\n\n{\n\nprivate:\n\n\n\n\tfriend class _CSDLGenerator;\n\n\n\n\t//\n\n\t// state constants\n\n\t//\n\n\tconst static DWORD SOAP_START = 0;\n\n\tconst static DWORD SOAP_ENVELOPE = 1;\n\n\tconst static DWORD SOAP_HEADERS = 2;\n\n\tconst static DWORD SOAP_BODY = 3;\n\n\tconst static DWORD SOAP_PARAMS = 4;\n\n\tconst static DWORD SOAP_CALLED = 5;\n\n\tconst static DWORD SOAP_RESPONSE = 6;\n\n\tconst static DWORD SOAP_HEADERS_DONE = 7;\n\n\n\n\t//\n\n\t// hash values for SOAP namespaces and elements\n", "file_path": "Src/VC/atlserver/include/atlsoap.h", "rank": 58, "score": 299993.370344601 }, { "content": "class BCGCBPRODLLEXPORT CBCGPAnimCtrl : public CStatic\n\n{\n\n\tDECLARE_DYNAMIC(CBCGPAnimCtrl)\n\n\n\n// Construction\n\npublic:\n\n\tCBCGPAnimCtrl();\n\n\n\n// Attributes\n\npublic:\n\n\tBOOL IsRunning () const\n\n\t{\n\n\t\treturn m_bIsRunning;\n\n\t}\n\n\n\nprotected:\n\n\tCSize\t\tm_sizeFrame;\n\n\tCOLORREF\tm_clrBack;\n\n\tCImageList\tm_imagesAnim;\n\n\tCImageList*\tm_pImagesAnim;\n", "file_path": "Src/VC/bcgcbpro/BCGPAnimCtrl.h", "rank": 59, "score": 298167.39847499575 }, { "content": "\tclass CParseErrorProvider : public ITagReplacerImpl<CParseErrorProvider>,\n\n\t\tpublic CComObjectRootEx<CComSingleThreadModel>\n\n\t{\n\n\tpublic:\n\n\t\tBEGIN_COM_MAP(CParseErrorProvider)\n\n\t\t\tCOM_INTERFACE_ENTRY(ITagReplacer)\n\n\t\tEND_COM_MAP()\n\n\t\tCSimpleArray<ParseError> *m_pErrors;\n\n\t\tint m_nCurrentError;\n\n\n\n\t\tCParseErrorProvider() throw() :\n\n\t\t\tm_pErrors(NULL),\n\n\t\t\tm_nCurrentError(-1)\n\n\t\t{\n\n\t\t}\n\n\n\n\t\tvoid Initialize(CSimpleArray<ParseError> *pErrors) throw()\n\n\t\t{\n\n\t\t\tm_pErrors = pErrors;\n\n\t\t}\n", "file_path": "Src/VC/atlserver/include/atlstencil.h", "rank": 60, "score": 297507.3195771926 }, { "content": "\tclass CParseStateElementTraits : public CDefaultElementTraits<ParseState>\n\n\t{\n\n\tpublic:\n\n\t\t// CBitVector relocate fixup\n\n\t\tstatic void RelocateElements( ParseState* pDest, ParseState* pSrc, size_t nElements )\n\n\t\t{\n\n\t\t\tCDefaultElementTraits<ParseState>::RelocateElements(pDest, pSrc, nElements);\n\n\n\n\t\t\t// fixup CBitVector\n\n\t\t\tfor (size_t i=0; i<nElements; i++)\n\n\t\t\t{\n\n\t\t\t\tpDest[i].RelocateFixup();\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n\n", "file_path": "Src/VC/atlserver/include/atlsoap.h", "rank": 61, "score": 297507.3195771926 }, { "content": "//\n\n// Security Service Provider Interface (sspi) Helper classes\n\n// These classes are used as helpers for structures used in \n\n// SSPI functions.\n\n//\n\nclass CSecAuthIdentity : public SEC_WINNT_AUTH_IDENTITY_EX\n\n{\n\npublic:\n\n\tCSecAuthIdentity() throw()\n\n\t{\n\n\t\tVersion = SEC_WINNT_AUTH_IDENTITY_VERSION;\n\n\t\tLength = sizeof(SEC_WINNT_AUTH_IDENTITY_EX);\n\n#ifdef _UNICODE\n\n\t\tFlags = SEC_WINNT_AUTH_IDENTITY_UNICODE;\n\n#else\n\n\t\tFlags = SEC_WINNT_AUTH_IDENTITY_ANSI;\n\n#endif\n\n\t}\n\n\n\n\n\n\tbool Init(IAuthInfo *pAuthInfo) throw()\n\n\t{\n\n\t\tif (!pAuthInfo)\n\n\t\t\treturn false;\n\n\n", "file_path": "Src/VC/atlserver/include/atlhttp.h", "rank": 62, "score": 295337.188063456 }, { "content": "class CTransferServerContext : public CComObjectRootEx<CComMultiThreadModel>,\n\n\tpublic CWrappedServerContext\n\n{\n\npublic:\n\n\tchar m_szFileName[MAX_PATH];\n\n\tchar m_szQueryString[ATL_URL_MAX_PATH_LENGTH+1];\n\n\tCStringA m_strUrl;\n\n\tIWriteStream *m_pStream;\n\n\n\n\tBEGIN_COM_MAP(CTransferServerContext)\n\n\t\tCOM_INTERFACE_ENTRY(IHttpServerContext)\n\n\tEND_COM_MAP()\n\n\n\n\tCTransferServerContext() throw()\n\n\t{\n\n\t\tm_pStream = NULL;\n\n\t}\n\n\n\n\tBOOL Initialize(__in CTransferServerContext *pOtherContext)\n\n\t{\n", "file_path": "Src/VC/atlserver/include/atlisapi.h", "rank": 63, "score": 295282.3584714876 }, { "content": "class BCGCBPRODLLEXPORT CBCGPBaseVisualCtrl : public CStatic\n\n{\n\n\tDECLARE_DYNAMIC(CBCGPBaseVisualCtrl)\n\n\n\n// Construction\n\npublic:\n\n\tCBCGPBaseVisualCtrl();\n\n\n\n// Operations\n\npublic:\n\n\tvoid SetGraphicsManager(CBCGPGraphicsManager::BCGP_GRAPHICS_MANAGER manager, CBCGPGraphicsManagerParams* pParams = NULL);\n\n\tvoid SetGraphicsManager(CRuntimeClass* pRTI);\n\n\n\n\tvoid EnableTooltip(BOOL bEnable = TRUE, BOOL bTooltipTrackingMode = FALSE);\n\n\tBOOL IsTooltipEnabled() const {return m_bIsTooltip;}\n\n\n\n\tBOOL CreatePopup(const CRect& rect, BYTE nTransparency = 255 /* from 0 to 255 */, CWnd* pWndOwner = NULL);\n\n\tstatic BOOL HasActivePopup()\n\n\t{\n\n\t\treturn m_hwndHookedPopup != NULL;\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualCtrl.h", "rank": 64, "score": 293292.8792399687 }, { "content": "class PerThreadWrapper : public CComObjectNoLock<T>\n\n{\n\npublic:\n\n\tvoid *operator new(size_t /*size*/, void *p) throw()\n\n\t{\n\n\t\treturn p;\n\n\t}\n\n\n\n\tvoid operator delete(void * /*p*/) throw()\n\n\t{\n\n\t}\n\n\n\n\tSTDMETHOD_(ULONG, Release)() throw()\n\n\t{\n\n\t\tULONG l = InternalRelease();\n\n\t\tif (l == 0)\n\n\t\t{\n\n\t\t\tT *pT = static_cast<T*>(this);\n\n\t\t\tATLASSERT(pT->m_spExtension != NULL);\n\n\t\t\tCIsapiWorker *pWorker = pT->m_spExtension->GetThreadWorker();\n", "file_path": "Src/VC/atlserver/include/atlisapi.h", "rank": 65, "score": 293021.2182488964 }, { "content": "class BCGCBPRODLLEXPORT CBCGPEditListBase : public CStatic\n\n{\n\n// Construction\n\nprotected:\n\n\tCBCGPEditListBase();\n\n\n\n\tCList<CBCGPButton*, CBCGPButton*>\tm_lstButtons;\n\n\tCList<DWORD, DWORD>\t\t\t\tm_lstKeyAccell;\n\n\tCMap<int,int,UINT,UINT>\t\t\tm_mapButtonIDs;\n\n\tCSize\t\t\t\t\t\t\tm_sizeButton;\n\n\tCRect\t\t\t\t\t\t\tm_rectCaption;\n\n\tUINT\t\t\t\t\t\t\tm_uiStandardBtns;\n\n\tBOOL\t\t\t\t\t\t\tm_bNewItem;\n\n\tCFont\t\t\t\t\t\t\tm_font;\n\n\tBOOL\t\t\t\t\t\t\tm_bIsActualDelete;\t// Indicated that Items is really deletd, not moved\n\n\tBOOL\t\t\t\t\t\t\tm_bBrowseButton;\n\n\tBOOL\t\t\t\t\t\t\tm_bGrayDisabledButtons;\n\n\tCString\t\t\t\t\t\t\tm_strCaption;\n\n\tBOOL\t\t\t\t\t\t\tm_bDefaultCaption;\n\n\tBOOL\t\t\t\t\t\t\tm_bVisualManagerStyle;\n", "file_path": "Src/VC/bcgcbpro/BCGPEditListBox.h", "rank": 66, "score": 288622.46539098845 }, { "content": "class BCGCBPRODLLEXPORT CBCGPRibbonTreeCtrl : public CStatic\n\n{\n\n\t// Construction\n\npublic:\n\n\tCBCGPRibbonTreeCtrl(CBCGPRibbonCustomizationData* /*pCustomizationData*/, CBCGPRibbonBar* /*pRibbonBar*/)\n\n\t{\n\n\t}\n\n\n\n\tvoid RebuildItems(int /*nRibbonTabsDest*/, LPCTSTR /*lpszMainTabsCaption*/) {}\n\n\tvoid RebuildItems(const CArray<CBCGPBaseRibbonElement*, CBCGPBaseRibbonElement*>& /*arElements*/) {}\n\n\t\n\n\tBOOL MoveSelection(BOOL /*bMoveNext*/) { return FALSE; }\n\n};\n\n\n\n#endif\n\n#endif\n\n\n\n/////////////////////////////////////////////////////////////////////////////\n\n\n\n//{{AFX_INSERT_LOCATION}}\n\n// Microsoft Visual C++ will insert additional declarations immediately before the previous line.\n\n\n\n#endif // !defined(AFX_BCGPRIBBONTREECTRL_H__C48070ED_1185_47B5_9CBF_786C88E122A6__INCLUDED_)\n", "file_path": "Src/VC/bcgcbpro/BCGPRibbonTreeCtrl.h", "rank": 67, "score": 288622.46539098845 }, { "content": "//\n\n// The base parser class\n\n//\n\nclass CParserBase : public ISAXContentHandler, public CDummy1, public CDummy2\n\n{\n\nprivate:\n\n\t\n\n\tCComPtr<CParserBase> m_spParent;\n\n\tCComPtr<ISAXXMLReader> m_spReader;\n\n\tCComPtr<ISAXLocator> m_spLocator;\n\n\n\n\t//\n\n\t// how many levels deep\n\n\t//\n\n\tDWORD m_dwLevel;\n\n\n\n\t//\n\n\t// reset to parent handler on endElement\n\n\t//\n\n\tDWORD m_dwReset;\n\n\n\n\t//\n\n\t// get only top-level attributes\n", "file_path": "Src/VC/atlserver/source/SProxy/Parser.h", "rank": 68, "score": 281261.6563486251 }, { "content": "class QWT_EXPORT QwtCPointerData: public QwtSeriesData<QPointF>\n\n{\n\npublic:\n\n QwtCPointerData( const double *x, const double *y, size_t size );\n\n\n\n virtual QRectF boundingRect() const;\n\n virtual size_t size() const;\n\n virtual QPointF sample( size_t i ) const;\n\n\n\n const double *xData() const;\n\n const double *yData() const;\n\n\n\nprivate:\n\n const double *d_x;\n\n const double *d_y;\n\n size_t d_size;\n\n};\n\n\n\n/*!\n\n \\brief Synthetic point data\n", "file_path": "Src/Qt/qwt/src/qwt_point_data.h", "rank": 69, "score": 280289.07382992667 }, { "content": "class CAssertValidField< PERF_SIZE_LARGE >\n\n{\n\npublic:\n\n\ttemplate< class C > static void AssertValidFieldType( ULONGLONG C::* ) throw() { }\n\n\ttemplate< class C > static void AssertValidFieldType( LONGLONG C::* ) throw() { }\n\n};\n\n\n\n#define DEFINE_COUNTER_EX(member, dwCounterId, namestring, helpstring, detail, countertype, maxcountersize, defscale) \\\n\n\t\t\tCAssertValidField< (countertype) & ATLPERF_SIZE_MASK >::AssertValidFieldType( &_PerfCounterClass::member ); \\\n\n\t\t\thr = pPerf->RegisterCounter(wLanguage, hResInstance, dwCounterId, namestring, helpstring, detail, countertype, maxcountersize, (ULONG) offsetof(_PerfCounterClass, member), defscale); \\\n\n\t\t\tif (FAILED(hr)) \\\n\n\t\t\t\treturn hr;\n\n\n\n#define END_PERF_MAP() \\\n\n\t\t\treturn S_OK; \\\n\n\t\t}\n\n\n\n#define END_COUNTER_MAP() \\\n\n\t\t\treturn S_OK; \\\n\n\t\t}\n", "file_path": "Src/VC/atlserver/include/atlperf.h", "rank": 70, "score": 274773.4125642808 }, { "content": "class CAssertValidField< PERF_SIZE_DWORD >\n\n{\n\npublic:\n\n\ttemplate< class C > static void AssertValidFieldType( ULONG C::* ) throw() { }\n\n\ttemplate< class C > static void AssertValidFieldType( LONG C::* ) throw() { }\n\n};\n\n\n\ntemplate<>\n", "file_path": "Src/VC/atlserver/include/atlperf.h", "rank": 71, "score": 274773.4125642808 }, { "content": "class CHttpPtrMap : public CHttpMap<K, V, KTraits, VTraits>\n\n{\n\npublic:\n\n\ttypedef CHttpMap<K, V, KTraits, VTraits> Base;\n\n\n\n\tvoid RemoveAll()\n\n\t{\n\n\t\tif (!IsShared())\n\n\t\t{\n\n\t\t\tPOSITION pos = GetStartPosition();\n\n\t\t\twhile (pos)\n\n\t\t\t{\n\n\t\t\t\tGetNextValue(pos)->Free();\n\n\t\t\t}\n\n\t\t}\n\n\t\tBase::RemoveAll();\n\n\t}\n\n\n\n\t~CHttpPtrMap()\n\n\t{\n\n\t\tRemoveAll();\n\n\t}\n\n};\n\n\n", "file_path": "Src/VC/atlserver/include/atlisapi.h", "rank": 72, "score": 274627.5157434441 }, { "content": "class CCodeTypedElement : public CCodeElement, public CCodeType\n\n{\n\nprivate:\n\n\n\n\tCXSDElement * m_pElement;\n\n\tCAtlArray<int> m_arrDims;\n\n\t\n\n\tCStringA m_strSizeIs;\n\n\t\n\n\tCStringW m_strNamespace;\n\n\t\n\npublic:\n\n\n\n\tCCodeTypedElement()\n\n\t\t:m_pElement(NULL)\n\n\t{\n\n\t}\n\n\t\n\n\tinline HRESULT SetNamespace(const CStringW& strNamespace)\n\n\t{\n", "file_path": "Src/VC/atlserver/source/SProxy/CodeTypes.h", "rank": 73, "score": 272855.5193449348 }, { "content": "class CButtonsList : public CButton\n\n{\n\n// Construction\n\npublic:\n\n\tCButtonsList();\n\n\n\n// Operations\n\npublic:\n\n\tvoid SetImages (CBCGPToolBarImages* pImages);\n\n\tvoid AddButton (CBCGPToolbarButton* pButton);\n\n\tvoid RemoveButtons ();\n\n\n\n\tCBCGPToolbarButton* GetSelectedButton () const\n\n\t{\n\n\t\treturn m_pSelButton;\n\n\t}\n\n\n\n\tBOOL SelectButton (int iImage);\n\n\tvoid EnableDragFromList (BOOL bEnable = TRUE)\n\n\t{\n", "file_path": "Src/VC/bcgcbpro/ButtonsList.h", "rank": 74, "score": 272726.7623854439 }, { "content": "\tclass XElementGroup: public XElement\n\n\t{\n\n\tpublic:\n\n\t\tXElementGroup();\n\n\t\tvirtual ~XElementGroup();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tXImage\t\t\tm_Images;\n\n\t\tXArrayElement\tm_arButtons;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPRibbonInfo.h", "rank": 75, "score": 269043.9832029231 }, { "content": "\tclass XElementSeparator: public XElement\n\n\t{\n\n\tpublic:\n\n\t\tXElementSeparator();\n\n\t\tvirtual ~XElementSeparator();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\t\tBOOL\t\t\tm_bIsHoriz;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPRibbonInfo.h", "rank": 76, "score": 269043.9832029231 }, { "content": "\tclass XElementButton: public XElement\n\n\t{\n\n\tprotected:\n\n\t\tXElementButton(const CString& strElementName);\n\n\n\n\tpublic:\n\n\t\tXElementButton();\n\n\t\tvirtual ~XElementButton();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tint\t\t\t\tm_nSmallImageIndex;\n\n\t\tint\t\t\t\tm_nLargeImageIndex;\n\n\t\tBOOL\t\t\tm_bIsDefaultCommand;\n\n\t\tBOOL\t\t\tm_bIsAlwaysShowDescription;\n\n\t\tCBCGPRibbonButton::RibbonButtonOnQAT\n\n\t\t\t\t\t\tm_QATType;\n\n\t\tXArrayElement\tm_arSubItems;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPRibbonInfo.h", "rank": 77, "score": 269043.9832029231 }, { "content": "\tclass XDiagramElement: public XElement\n\n\t{\n\n\tprotected:\n\n\t\tXDiagramElement(const CString& strElementName);\n\n\n\n\tpublic:\n\n\t\tvirtual ~XDiagramElement();\n\n\n\n\t\tstatic XDiagramElement* CreateFromName (const CString& name);\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tXDiagramID\tm_idItem;\n\n\t\tXArrayData\tm_arDataObjects;\n\n\t\tCBCGPBrush\tm_brFill;\n\n\t\tCBCGPBrush\tm_brOutline;\n\n\t\tCBCGPBrush\tm_brShadow;\n\n\n\n\t\tCString\t\tm_strCustomName;\n\n\t\tCString\t\tm_strCustomProps;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualInfo.h", "rank": 78, "score": 269043.9832029231 }, { "content": "\tclass XElementSlider: public XElement\n\n\t{\n\n\tpublic:\n\n\t\tXElementSlider();\n\n\t\tvirtual ~XElementSlider();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tDWORD\t\t\tm_dwStyle;\n\n\t\tint\t\t\t\tm_nWidth;\n\n\t\tint\t\t\t\tm_nMin;\n\n\t\tint\t\t\t\tm_nMax;\n\n\t\tint\t\t\t\tm_nPos;\n\n\t\tBOOL\t\t\tm_bZoomButtons;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPRibbonInfo.h", "rank": 79, "score": 269043.9832029231 }, { "content": "\tclass XGaugeData : public XData\n\n\t{\n\n\tpublic:\n\n\t\tvirtual ~XGaugeData ();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tprotected:\n\n\t\tXGaugeData (const CString& strName);\n\n\n\n\tpublic:\n\n\t\tint\t\t\tm_nScale;\n\n\t\tCBCGPBrush\tm_brFill;\n\n\t\tCBCGPBrush\tm_brOutline;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualInfo.h", "rank": 80, "score": 269043.9832029231 }, { "content": "\tclass XGaugeElement: public XElement\n\n\t{\n\n\tprotected:\n\n\t\tXGaugeElement(const CString& strElementName);\n\n\n\n\tpublic:\n\n\t\tvirtual ~XGaugeElement();\n\n\n\n\t\tstatic XGaugeElement* CreateFromName (const CString& name);\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tprotected:\n\n\t\tvirtual BOOL ColorsFromTag (const CString& strTag) = 0;\n\n\t\tvirtual void ColorsToTag (CString& strTag) const = 0;\n\n\n\n\tpublic:\n\n\t\tint\t\t\t\t\t\tm_nFrameSize;\n\n\t\tCBCGPGaugeImpl::BCGP_SUB_GAUGE_POS\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualInfo.h", "rank": 81, "score": 269043.9832029231 }, { "content": "\tclass XElementTagCloud: public XElement\n\n\t{\n\n\tpublic:\n\n\t\tXElementTagCloud();\n\n\t\tvirtual ~XElementTagCloud();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tCBCGPTagCloud::SortOrder\tm_SortOrder;\n\n\t\tBOOL\t\t\t\t\t\tm_bDescending;\n\n\t\tint\t\t\t\t\t\t\tm_nMaxWeight;\n\n\t\tdouble\t\t\t\t\t\tm_dblFontSizeStep;\n\n\t\tCBCGPSize\t\t\t\t\tm_szMargin;\n\n\t\tCBCGPTextFormat\t\t\t\tm_fmtBase;\n\n\t\tCBCGPBrush\t\t\t\t\tm_brFill;\n\n\t\tCBCGPColor\t\t\t\t\tm_clrText;\n\n\t\tCBCGPColor\t\t\t\t\tm_clrTextHighlighted;\n\n\n\n\t\tXArrayTagCloudData\t\t\tm_arDataObjects;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualInfo.h", "rank": 82, "score": 265426.4517287825 }, { "content": "\tclass XDiagramTextData : public XData\n\n\t{\n\n\tpublic:\n\n\t\tXDiagramTextData ();\n\n\t\tvirtual ~XDiagramTextData ();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tCString\t\t\tm_strText;\n\n\t\tCBCGPBrush\t\tm_brText;\n\n\t\tCBCGPTextFormat\tm_fmtText;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualInfo.h", "rank": 83, "score": 265426.4517287825 }, { "content": "\tclass XElementKnob: public XElementCircular\n\n\t{\n\n\tpublic:\n\n\t\tXElementKnob ();\n\n\t\tvirtual ~XElementKnob ();\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualInfo.h", "rank": 84, "score": 265426.4517287825 }, { "content": "\tclass XElementTreeMap: public XElement\n\n\t{\n\n\tpublic:\n\n\t\tXElementTreeMap();\n\n\t\tvirtual ~XElementTreeMap();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tCBCGPTreeMap::LayoutType\tm_LayoutType;\n\n\t\tXTreeMapGroup\t\t\t\tm_Root;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualInfo.h", "rank": 85, "score": 265426.4517287825 }, { "content": "\tclass XCircularPointer: public XGaugeData\n\n\t{\n\n\tpublic:\n\n\t\tXCircularPointer ();\n\n\t\tvirtual ~XCircularPointer ();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tdouble\t\tm_dblSize;\n\n\t\tdouble\t\tm_dblWidth;\n\n\t\tBOOL\t\tm_bExtraLen;\n\n\t\tCBCGPCircularGaugePointer::BCGP_GAUGE_POINTER_STYLE\n\n\t\t\t\t\tm_Style;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualInfo.h", "rank": 86, "score": 265426.4517287825 }, { "content": "\tclass XElementText: public XGaugeElement\n\n\t{\n\n\tpublic:\n\n\t\tXElementText();\n\n\t\tvirtual ~XElementText();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tprotected:\n\n\t\tvirtual BOOL ColorsFromTag (const CString& strTag);\n\n\t\tvirtual void ColorsToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tCBCGPBrush\t\tm_brText;\n\n\t\tCBCGPTextFormat\tm_fmtText;\n\n\t\tCString\t\t\tm_strText;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualInfo.h", "rank": 87, "score": 265426.4517287825 }, { "content": "\tclass XCircularScale: public XGaugeScale\n\n\t{\n\n\tpublic:\n\n\t\tXCircularScale ();\n\n\t\tvirtual ~XCircularScale ();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tdouble\t\t\tm_dblStartAngle;\n\n\t\tdouble\t\t\tm_dblFinishAngle;\n\n\t\tBOOL\t\t\tm_bRotateLabels;\n\n\t\tBOOL\t\t\tm_bIsClosed;\n\n\t\tBOOL\t\t\tm_bDrawLastTickMark;\n\n\t\tBOOL\t\t\tm_bAnimationThroughStart;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualInfo.h", "rank": 88, "score": 265426.4517287825 }, { "content": "\tclass XElementLinear: public XGaugeElement\n\n\t{\n\n\tpublic:\n\n\t\tXElementLinear();\n\n\t\tvirtual ~XElementLinear();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tprotected:\n\n\t\tvirtual BOOL ColorsFromTag (const CString& strTag);\n\n\t\tvirtual void ColorsToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tCBCGPLinearGaugeColors\t\tm_Colors;\n\n\t\tCBCGPTextFormat\t\t\t\tm_fmtText;\n\n\t\tBOOL\t\t\t\t\t\tm_bIsVertical;\n\n\n\n\t\tXArrayData\t\t\t\t\tm_arPointers;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualInfo.h", "rank": 89, "score": 265426.4517287825 }, { "content": "\tclass XLinearScale: public XGaugeScale\n\n\t{\n\n\tpublic:\n\n\t\tXLinearScale ();\n\n\t\tvirtual ~XLinearScale ();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualInfo.h", "rank": 90, "score": 265426.4517287825 }, { "content": "\tclass XElementEdit: public XElementButton\n\n\t{\n\n\tprotected:\n\n\t\tXElementEdit(const CString& strElementName);\n\n\n\n\tpublic:\n\n\t\tXElementEdit();\n\n\t\tvirtual ~XElementEdit();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tint\t\t\t\tm_nWidth;\n\n\t\tint\t\t\t\tm_nWidthFloaty;\n\n\t\tint\t\t\t\tm_nTextAlign;\n\n\t\tBOOL m_bHasSpinButtons;\n\n\t\tint\t\t\t\tm_nMin;\n\n\t\tint\t\t\t\tm_nMax;\n\n\t\tCString\t\t\tm_strValue;\n\n\t\tBOOL\t\t\tm_bSearchMode;\n\n\t\tCString\t\t\tm_strSearchPrompt;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPRibbonInfo.h", "rank": 91, "score": 265426.4517287825 }, { "content": "\tclass XElementColor: public XGaugeElement\n\n\t{\n\n\tpublic:\n\n\t\tXElementColor();\n\n\t\tvirtual ~XElementColor();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tprotected:\n\n\t\tvirtual BOOL ColorsFromTag (const CString& strTag);\n\n\t\tvirtual void ColorsToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tCBCGPColorIndicatorColors\tm_Colors;\n\n\t\tCBCGPColorIndicatorImpl::BCGPColorIndicatorStyle\n\n\t\t\t\t\t\t\t\t\tm_Style;\n\n\t\tBOOL\t\t\t\t\t\tm_bStretched;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualInfo.h", "rank": 92, "score": 265426.4517287825 }, { "content": "\tclass XElementLabel: public XElementButton\n\n\t{\n\n\tpublic:\n\n\t\tXElementLabel();\n\n\t\tvirtual ~XElementLabel();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPRibbonInfo.h", "rank": 93, "score": 265426.4517287825 }, { "content": "\tclass XKnobPointer: public XGaugeData\n\n\t{\n\n\tpublic:\n\n\t\tXKnobPointer ();\n\n\t\tvirtual ~XKnobPointer ();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tdouble\t\tm_dblOffsetFromCenter;\n\n\t\tdouble\t\tm_dblWidth;\n\n\t\tCBCGPKnobPointer::BCGP_KNOB_POINTER_STYLE\n\n\t\t\t\t\tm_Style;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualInfo.h", "rank": 94, "score": 265426.4517287825 }, { "content": "\tclass XElementNumeric: public XGaugeElement\n\n\t{\n\n\tpublic:\n\n\t\tXElementNumeric();\n\n\t\tvirtual ~XElementNumeric();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tprotected:\n\n\t\tvirtual BOOL ColorsFromTag (const CString& strTag);\n\n\t\tvirtual void ColorsToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tCBCGPNumericIndicatorColors\tm_Colors;\n\n\t\tCBCGPTextFormat\t\t\t\tm_fmtText;\n\n\t\tCBCGPNumericIndicatorImpl::BCGPNumericIndicatorStyle\n\n\t\t\t\t\t\t\t\t\tm_Style;\n\n\t\tint\t\t\t\t\t\t\tm_nCells;\n\n\t\tint\t\t\t\t\t\t\tm_nDecimals;\n\n\t\tint\t\t\t\t\t\t\tm_nSeparatorWidth;\n\n\t\tBOOL\t\t\t\t\t\tm_bDrawSign;\n\n\t\tBOOL\t\t\t\t\t\tm_bDrawDecimalPoint;\n\n\t\tBOOL\t\t\t\t\t\tm_bDrawLeadingZeros;\n\n\t\tdouble\t\t\t\t\t\tm_dblValue;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualInfo.h", "rank": 95, "score": 265426.4517287825 }, { "content": "\tclass XElementProgressBar: public XElement\n\n\t{\n\n\tpublic:\n\n\t\tXElementProgressBar();\n\n\t\tvirtual ~XElementProgressBar();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tint\t\t\t\tm_nWidth;\n\n\t\tint\t\t\t\tm_nHeight;\n\n\t\tint\t\t\t\tm_nMin;\n\n\t\tint\t\t\t\tm_nMax;\n\n\t\tint\t\t\t\tm_nPos;\n\n\t\tBOOL\t\t\tm_bInfinite;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPRibbonInfo.h", "rank": 96, "score": 265426.4517287825 }, { "content": "\tclass XElementCircular: public XGaugeElement\n\n\t{\n\n\tprotected:\n\n\t\tXElementCircular(const CString& strElementName);\n\n\n\n\tpublic:\n\n\t\tXElementCircular();\n\n\t\tvirtual ~XElementCircular();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tprotected:\n\n\t\tvirtual BOOL ColorsFromTag (const CString& strTag);\n\n\t\tvirtual void ColorsToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tCBCGPCircularGaugeColors\tm_Colors;\n\n\t\tCBCGPTextFormat\t\t\t\tm_fmtText;\n\n\t\tdouble\t\t\t\t\t\tm_dblCapSize;\n\n\t\tBOOL\t\t\t\t\t\tm_bShapeByTicksArea;\n\n\n\n\t\tXArrayData\t\t\t\t\tm_arPointers;\n\n\t\tXArrayGaugeElement\t\t\tm_arSubGauges;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualInfo.h", "rank": 97, "score": 265426.4517287825 }, { "content": "\tclass XElementImage: public XGaugeElement\n\n\t{\n\n\tpublic:\n\n\t\tXElementImage();\n\n\t\tvirtual ~XElementImage();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tprotected:\n\n\t\tvirtual BOOL ColorsFromTag (const CString& strTag);\n\n\t\tvirtual void ColorsToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tXImage\tm_Image;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualInfo.h", "rank": 98, "score": 265426.4517287825 }, { "content": "\tclass XLinearPointer: public XGaugeData\n\n\t{\n\n\tpublic:\n\n\t\tXLinearPointer ();\n\n\t\tvirtual ~XLinearPointer ();\n\n\n\n\t\tvirtual BOOL FromTag (const CString& strTag);\n\n\t\tvirtual void ToTag (CString& strTag) const;\n\n\n\n\tpublic:\n\n\t\tdouble\t\tm_dblSize;\n\n\t\tdouble\t\tm_dblWidth;\n\n\t\tCBCGPLinearGaugePointer::BCGP_GAUGE_POINTER_STYLE\n\n\t\t\t\t\tm_Style;\n\n\t};\n\n\n", "file_path": "Src/VC/bcgcbpro/BCGPVisualInfo.h", "rank": 99, "score": 265426.4517287825 } ]
C++
src/client/commands/CmdBase.cpp
lclc/opentxs
0bc847c6601d20e3346bb2faf81feda3a14ab303
#include "CmdBase.hpp" #include "../ot_made_easy_ot.hpp" #include <opentxs/client/ot_otapi_ot.hpp> #include "../ot_utility_ot.hpp" #include <opentxs/client/OpenTransactions.hpp> #include <opentxs/client/OTAPI.hpp> #include <opentxs/client/OTWallet.hpp> #include <opentxs/core/Account.hpp> #include <opentxs/core/AssetContract.hpp> #include <opentxs/core/OTLog.hpp> #include <opentxs/core/OTPseudonym.hpp> #include <opentxs/core/OTServerContract.hpp> #include <map> #include <sstream> using namespace opentxs; using namespace std; CmdBase::CmdBase() : category(catError) , command(nullptr) , help(nullptr) , usage(nullptr) { for (int i = 0; i < MAX_ARGS; i++) { args[i] = nullptr; } } CmdBase::~CmdBase() { } bool CmdBase::checkAccount(const char* name, string& account) const { if (!checkMandatory(name, account)) { return false; } OTWallet* wallet = getWallet(); Account* theAccount = wallet->GetAccount(account); if (theAccount == nullptr) { theAccount = wallet->GetAccountPartialMatch(account); if (theAccount == nullptr) { otOut << "Error: " << name << ": unknown account: " << account << "\n"; return false; } } String tmp; theAccount->GetPurportedAccountID().GetString(tmp); account = tmp.Get(); otOut << "Using " << name << ": " << account << "\n"; return true; } int64_t CmdBase::checkAmount(const char* name, const string& amount, const string& myacct) const { if (!checkMandatory(name, amount)) { return OT_ERROR_AMOUNT; } string assetType = getAccountAssetType(myacct); if ("" == assetType) { return OT_ERROR_AMOUNT; } int64_t value = OTAPI_Wrap::StringToAmount(assetType, amount); if (OT_ERROR_AMOUNT == value) { otOut << "Error: " << name << ": invalid amount: " << amount << "\n"; return OT_ERROR_AMOUNT; } return value; } bool CmdBase::checkFlag(const char* name, const string& value) const { if (!checkMandatory(name, value)) { return false; } if (value != "false" && value != "true") { otOut << "Error: " << name << ": expected 'false' or 'true'.\n"; return false; } return true; } int32_t CmdBase::checkIndex(const char* name, const string& index, int32_t items) const { if (!checkValue(name, index)) { return -1; } if (!checkIndicesRange(name, index, items)) { return -1; } return stoi(index); } bool CmdBase::checkIndices(const char* name, const string& indices) const { if (!checkMandatory(name, indices)) { return false; } if ("all" == indices) { return true; } for (string::size_type i = 0; i < indices.length(); i++) { if (!isdigit(indices[i])) { otOut << "Error: " << name << ": not a value: " << indices << "\n"; return false; } for (i++; i < indices.length() && isdigit(indices[i]); i++) { } if (i < indices.length() && ',' != indices[i]) { otOut << "Error: " << name << ": not a value: " << indices << "\n"; return false; } } return true; } bool CmdBase::checkIndicesRange(const char* name, const string& indices, int32_t items) const { if ("all" == indices) { return true; } for (string::size_type i = 0; i < indices.length(); i++) { int32_t value = 0; for (; isdigit(indices[i]); i++) { value = value * 10 + indices[i] - '0'; } if (0 > value || value >= items) { otOut << "Error: " << name << ": value (" << value << ") out of range (must be < " << items << ")\n"; return false; } } return true; } bool CmdBase::checkMandatory(const char* name, const string& value) const { if ("" == value) { otOut << "Error: " << name << ": mandatory parameter not specified.\n"; return false; } return true; } bool CmdBase::checkNym(const char* name, string& nym) const { if (!checkMandatory(name, nym)) { return false; } OTWallet* wallet = getWallet(); OTPseudonym* theNym = wallet->GetNymByID(nym); if (theNym == nullptr) { theNym = wallet->GetNymByIDPartialMatch(nym); if (theNym == nullptr) { otOut << "Error: " << name << ": unknown nymm: " << nym << "\n"; return false; } } String tmp; theNym->GetIdentifier(tmp); nym = tmp.Get(); otOut << "Using " << name << ": " << nym << "\n"; return true; } bool CmdBase::checkPurse(const char* name, string& purse) const { if (!checkMandatory(name, purse)) { return false; } OTWallet* wallet = getWallet(); AssetContract* thePurse = wallet->GetAssetContract(purse); if (thePurse == nullptr) { thePurse = wallet->GetAssetContractPartialMatch(purse); if (thePurse == nullptr) { otOut << "Error: " << name << ": unknown purse: " << purse << "\n"; return false; } } String tmp; thePurse->GetIdentifier(tmp); purse = tmp.Get(); otOut << "Using " << name << ": " << purse << "\n"; return true; } bool CmdBase::checkServer(const char* name, string& server) const { if (!checkMandatory(name, server)) { return false; } OTWallet* wallet = getWallet(); OTServerContract* theServer = wallet->GetServerContract(server); if (theServer == nullptr) { theServer = wallet->GetServerContractPartialMatch(server); if (theServer == nullptr) { otOut << "Error: " << name << ": unknown server: " << server << "\n"; return false; } } String tmp; theServer->GetIdentifier(tmp); server = tmp.Get(); otOut << "Using " << name << ": " << server << "\n"; return true; } int64_t CmdBase::checkTransNum(const char* name, const string& id) const { if (!checkMandatory(name, id)) { return -1; } for (string::size_type i = 0; i < id.length(); i++) { if (!isdigit(id[i])) { otOut << "Error: " << name << ": not a value: " << id << "\n"; return -1; } } int64_t value = stoll(id); if (0 >= value) { otOut << "Error: " << name << ": invalid value: " << id << "\n"; return -1; } return value; } bool CmdBase::checkValue(const char* name, const string& value) const { if (!checkMandatory(name, value)) { return false; } for (string::size_type i = 0; i < value.length(); i++) { if (!isdigit(value[i])) { otOut << "Error: " << name << ": not a value: " << value << "\n"; return false; } } return true; } void CmdBase::dashLine() const { cout << "--------------------------------------" "--------------------------------------\n"; } const vector<string>& CmdBase::extractArgumentNames() { if (0 != argNames.size()) { return argNames; } for (int i = 0; i < MAX_ARGS && args[i] != nullptr; i++) { const char* arg = args[i]; while ('[' == *arg || '-' == *arg) { arg++; } string argName = ""; for (; isalpha(*arg); arg++) { argName += *arg; } argNames.push_back(argName); } return argNames; } string CmdBase::formatAmount(const string& assetType, int64_t amount) const { if (OT_ERROR_AMOUNT == amount) { return "UNKNOWN_AMOUNT"; } if ("" == assetType) { return to_string(amount); } return OTAPI_Wrap::FormatAmount(assetType, amount); } Category CmdBase::getCategory() const { return category; } const char* CmdBase::getCommand() const { return command; } const char* CmdBase::getHelp() const { return help; } string CmdBase::getAccountAssetType(const string& myacct) const { string assetType = OTAPI_Wrap::GetAccountWallet_AssetTypeID(myacct); if ("" == assetType) { otOut << "Error: cannot load asset type from myacct.\n"; } return assetType; } string CmdBase::getAccountNym(const string& myacct) const { string mynym = OTAPI_Wrap::GetAccountWallet_NymID(myacct); if ("" == mynym) { otOut << "Error: cannot determine mynym from myacct.\n"; } return mynym; } string CmdBase::getAccountServer(const string& myacct) const { string server = OTAPI_Wrap::GetAccountWallet_ServerID(myacct); if ("" == server) { otOut << "Error: cannot determine server from myacct.\n"; } return server; } string CmdBase::getOption(string optionName) const { auto result = options.find(optionName); if (result == options.end()) { otWarn << "Option " << optionName << " not found.\n"; return ""; } otInfo << "Option " << result->first << ": " << result->second << "\n"; return result->second; } string CmdBase::getUsage() const { stringstream ss; ss << "Usage: " << command; for (int i = 0; i < MAX_ARGS && args[i] != nullptr; i++) { ss << " " << args[i]; } ss << "\n\n" << help << "\n\n"; if (usage != nullptr) { ss << usage << "\n\n"; } return ss.str(); } OTWallet* CmdBase::getWallet() const { OTWallet* wallet = OTAPI_Wrap::OTAPI()->GetWallet(); OT_ASSERT_MSG(wallet != nullptr, "Cannot load wallet->\n"); return wallet; } int32_t CmdBase::harvestTxNumbers(const string& contract, const string& mynym) { OTAPI_Wrap::Msg_HarvestTransactionNumbers(contract, mynym, false, false, false, false, false); return -1; } string CmdBase::inputLine() { return OT_CLI_ReadLine(); } string CmdBase::inputText(const char* what) { cout << "Please paste " << what << ",\n" << "followed by an EOF or a ~ on a line by itself:\n"; string input = OT_CLI_ReadUntilEOF(); if ("" == input) { otOut << "Error: you did not paste " << what << ".\n"; } return input; } int32_t CmdBase::processResponse(const string& response, const char* what) const { switch (responseStatus(response)) { case 1: break; case 0: otOut << "Error: failed to " << what << ".\n"; return -1; default: otOut << "Error: cannot " << what << ".\n"; return -1; } cout << response << "\n"; return 1; } int32_t CmdBase::processTxResponse(const string& server, const string& mynym, const string& myacct, const string& response, const char* what) const { if (1 != responseStatus(response)) { otOut << "Error: cannot " << what << ".\n"; return -1; } if (1 != VerifyMsgBalanceAgrmntSuccess(server, mynym, myacct, response)) { otOut << "Error: " << what << " balance agreement failed.\n"; return -1; } if (1 != VerifyMsgTrnxSuccess(server, mynym, myacct, response)) { otOut << "Error: " << what << " transaction failed.\n"; return -1; } cout << response << "\n"; return 1; } int32_t CmdBase::responseReply(const string& response, const string& server, const string& mynym, const string& myacct, const char* function) const { return InterpretTransactionMsgReply(server, mynym, myacct, function, response); } int32_t CmdBase::responseStatus(const string& response) const { return VerifyMessageSuccess(response); } bool CmdBase::run(const map<string, string>& _options) { options = _options; int32_t returnValue = runWithOptions(); options.empty(); switch (returnValue) { case 0: return true; case 1: return true; case -1: return false; default: otOut << "Error: undefined error code: " << returnValue << ".\n"; break; } return false; } vector<string> CmdBase::tokenize(const string& str, char delim, bool noEmpty) const { vector<string> tokens; const char* p = str.c_str(); int begin = 0; while (true) { int next = begin; while (p[next] != delim && '\0' != p[next]) { next++; } if (next != begin || !noEmpty) { tokens.push_back(str.substr(begin, next - begin)); } if ('\0' == p[next]) { break; } begin = next + 1; } return tokens; }
#include "CmdBase.hpp" #include "../ot_made_easy_ot.hpp" #include <opentxs/client/ot_otapi_ot.hpp> #include "../ot_utility_ot.hpp" #include <opentxs/client/OpenTransactions.hpp> #include <opentxs/client/OTAPI.hpp> #include <opentxs/client/OTWallet.hpp> #include <opentxs/core/Account.hpp> #include <opentxs/core/AssetContract.hpp> #include <opentxs/core/OTLog.hpp> #include <opentxs/core/OTPseudonym.hpp> #include <opentxs/core/OTServerContract.hpp> #include <map> #include <sstream> using namespace opentxs; using namespace std; CmdBase::CmdBase() : category(catError) , command(nullptr) , help(nullptr) , usage(nullptr) { for (int i = 0; i < MAX_ARGS; i++) { args[i] = nullptr; } } CmdBase::~CmdBase() { } bool CmdBase::checkAccount(const char* name, string& account) const { if (!checkMandatory(name, account)) { return false; } OTWallet* wallet = getWallet(); Account* theAccount = wallet->GetAccount(account); if (theAccount == nullptr) { theAccount = wallet->GetAccountPartialMatch(account); if (theAccount == nullptr) { otOut << "Error: " << name << ": unknown account: " << account << "\n"; return false; } } String tmp; theAccount->GetPurportedAccountID().GetString(tmp); account = tmp.Get(); otOut << "Using " << name << ": " << account << "\n"; return true; } int64_t CmdBase::checkAmount(const char* name, const string& amount, const string& myacct) const { if (!checkMandatory(name, amount)) { return OT_ERROR_AMOUNT; } string assetType = getAccountAssetType(myacct); if ("" == assetType) { return OT_ERROR_AMOUNT; } int64_t value = OTAPI_Wrap::StringToAmount(assetType, amount); if (OT_ERROR_AMOUNT == value) { otOut << "Error: " << name << ": invalid amount: " << amount << "\n"; return OT_ERROR_AMOUNT; } return value; } bool CmdBase::checkFlag(const char* name, const string& value) const { if (!checkMandatory(name, value)) { return false; } if (value != "false" && value != "true") { otOut << "Error: " << name << ": expected 'false' or 'true'.\n"; return false; } return true; } int32_t CmdBase::checkIndex(const char* name, const string& index, int32_t items) const { if (!checkValue(name, index)) { return -1; } if (!checkIndicesRange(name, index, items)) { return -1; } return stoi(index); } bool CmdBase::checkIndices(const char* name, const string& indices) const { if (!checkMandatory(name, indices)) { return false; } if ("all" == indices) { return true; } for (string::size_type i = 0; i < indices.length(); i++) { if (!isdigit(indices[i])) { otOut << "Error: " << name << ": not a value: " << indices << "\n"; return false; } for (i++; i < indices.length() && isdigit(indices[i]); i++) { } if (i < indices.length() && ',' != indices[i]) { otOut << "Error: " << name << ": not a value: " << indices << "\n"; return false; } } return true; } bool CmdBase::checkIndicesRange(const char* name, const string& indices, int32_t items) const { if ("all" == indices) { return true; } for (string::size_type i = 0; i < indices.length(); i++) { int32_t value = 0; for (; isdigit(indices[i]); i++) { value = value * 10 + indices[i] - '0'; } if (0 > value || value >= items) { otOut << "Error: " << name << ": value (" << value << ") out of range (must be < " << items << ")\n"; return false; } } return true; } bool CmdBase::checkMandatory(const char* name, const string& value) const { if ("" == value) { otOut << "Error: " << name << ": mandatory parameter not specified.\n"; return false; } return true; } bool CmdBase::checkNym(const char* name, string& nym) const { if (!checkMandatory(name, nym)) { return false; } OTWallet* wallet = getWallet(); OTPseudonym* theNym = wallet->GetNymByID(nym); if (theNym == nullptr) { theNym = wallet->GetNymByIDPartialMatch(nym); if (theNym == nullptr) { otOut << "Error: " << name << ": unknown nymm: " << nym << "\n"; return false; } } String tmp; theNym->GetIdentifier(tmp); nym = tmp.Get(); otOut << "Using " << name << ": " << nym << "\n"; return true; } bool CmdBase::checkPurse(const char* name, string& purse) const { if (!checkMandatory(name, purse)) { return false; } OTWallet* wallet = getWallet(); AssetContract* thePurse = wallet->GetAssetContract(purse); if (thePurse == nullptr) { thePurse = wallet->GetAssetContractPartialMatch(purse); if (thePurse == nullptr) { otOut << "Error: " << name << ": unknown purse: " << purse << "\n"; return false; } } String tmp; thePurse->GetIdentifier(tmp); purse = tmp.Get(); otOut << "Using " << name << ": " << purse << "\n"; return true; } bool CmdBase::checkServer(const char* name, string& server) const { if (!checkMandatory(name, server)) { return false; } OTWallet* wallet = getWallet(); OTServerContract* theServer = wallet->GetServerContract(server); if (theServer == nullptr) { theServer = wallet->GetServerContractPartialMatch(server); if (theServer == nullptr) { otOut << "Error: " << name << ": unknown server: " << server << "\n"; return false; } } String tmp; theServer->GetIdentifier(tmp); server = tmp.Get(); otOut << "Using " << name << ": " << server << "\n"; return true; } int64_t CmdBase::checkTransNum(const char* name, const string& id) const { if (!checkMandatory(name, id)) { return -1; } for (string::size_type i = 0; i < id.length(); i++) { if (!isdigit(id[i])) { otOut << "Error: " << name << ": not a value: " << id << "\n"; return -1; } } int64_t value = stoll(id); if (0 >= value) { otOut << "Error: " << name << ": invalid value: " << id << "\n"; return -1; } return value; } bool CmdBase::checkValue(const char* name, const string& value) const { if (!checkMandatory(name, value)) { return false; } for (string::size_type i = 0; i < value.length(); i++) { if (!isdigit(value[i])) { otOut << "Error: " << name << ": not a value: " << value << "\n"; return false; } } return true; } void CmdBase::dashLine() const { cout << "--------------------------------------" "--------------------------------------\n"; } const vector<string>& CmdBase::extractArgumentNames() { if (0 != argNames.size()) { return argNames; } for (int i = 0; i < MAX_ARGS && args[i] != nullptr; i++) { const char* arg = args[i]; while ('[' == *arg || '-' == *arg) { arg++; } string argName = ""; for (; isalpha(*arg); arg++) { argName += *arg; } argNames.push_back(argName); } return argNames; }
Category CmdBase::getCategory() const { return category; } const char* CmdBase::getCommand() const { return command; } const char* CmdBase::getHelp() const { return help; } string CmdBase::getAccountAssetType(const string& myacct) const { string assetType = OTAPI_Wrap::GetAccountWallet_AssetTypeID(myacct); if ("" == assetType) { otOut << "Error: cannot load asset type from myacct.\n"; } return assetType; } string CmdBase::getAccountNym(const string& myacct) const { string mynym = OTAPI_Wrap::GetAccountWallet_NymID(myacct); if ("" == mynym) { otOut << "Error: cannot determine mynym from myacct.\n"; } return mynym; } string CmdBase::getAccountServer(const string& myacct) const { string server = OTAPI_Wrap::GetAccountWallet_ServerID(myacct); if ("" == server) { otOut << "Error: cannot determine server from myacct.\n"; } return server; } string CmdBase::getOption(string optionName) const { auto result = options.find(optionName); if (result == options.end()) { otWarn << "Option " << optionName << " not found.\n"; return ""; } otInfo << "Option " << result->first << ": " << result->second << "\n"; return result->second; } string CmdBase::getUsage() const { stringstream ss; ss << "Usage: " << command; for (int i = 0; i < MAX_ARGS && args[i] != nullptr; i++) { ss << " " << args[i]; } ss << "\n\n" << help << "\n\n"; if (usage != nullptr) { ss << usage << "\n\n"; } return ss.str(); } OTWallet* CmdBase::getWallet() const { OTWallet* wallet = OTAPI_Wrap::OTAPI()->GetWallet(); OT_ASSERT_MSG(wallet != nullptr, "Cannot load wallet->\n"); return wallet; } int32_t CmdBase::harvestTxNumbers(const string& contract, const string& mynym) { OTAPI_Wrap::Msg_HarvestTransactionNumbers(contract, mynym, false, false, false, false, false); return -1; } string CmdBase::inputLine() { return OT_CLI_ReadLine(); } string CmdBase::inputText(const char* what) { cout << "Please paste " << what << ",\n" << "followed by an EOF or a ~ on a line by itself:\n"; string input = OT_CLI_ReadUntilEOF(); if ("" == input) { otOut << "Error: you did not paste " << what << ".\n"; } return input; } int32_t CmdBase::processResponse(const string& response, const char* what) const { switch (responseStatus(response)) { case 1: break; case 0: otOut << "Error: failed to " << what << ".\n"; return -1; default: otOut << "Error: cannot " << what << ".\n"; return -1; } cout << response << "\n"; return 1; } int32_t CmdBase::processTxResponse(const string& server, const string& mynym, const string& myacct, const string& response, const char* what) const { if (1 != responseStatus(response)) { otOut << "Error: cannot " << what << ".\n"; return -1; } if (1 != VerifyMsgBalanceAgrmntSuccess(server, mynym, myacct, response)) { otOut << "Error: " << what << " balance agreement failed.\n"; return -1; } if (1 != VerifyMsgTrnxSuccess(server, mynym, myacct, response)) { otOut << "Error: " << what << " transaction failed.\n"; return -1; } cout << response << "\n"; return 1; } int32_t CmdBase::responseReply(const string& response, const string& server, const string& mynym, const string& myacct, const char* function) const { return InterpretTransactionMsgReply(server, mynym, myacct, function, response); } int32_t CmdBase::responseStatus(const string& response) const { return VerifyMessageSuccess(response); } bool CmdBase::run(const map<string, string>& _options) { options = _options; int32_t returnValue = runWithOptions(); options.empty(); switch (returnValue) { case 0: return true; case 1: return true; case -1: return false; default: otOut << "Error: undefined error code: " << returnValue << ".\n"; break; } return false; } vector<string> CmdBase::tokenize(const string& str, char delim, bool noEmpty) const { vector<string> tokens; const char* p = str.c_str(); int begin = 0; while (true) { int next = begin; while (p[next] != delim && '\0' != p[next]) { next++; } if (next != begin || !noEmpty) { tokens.push_back(str.substr(begin, next - begin)); } if ('\0' == p[next]) { break; } begin = next + 1; } return tokens; }
string CmdBase::formatAmount(const string& assetType, int64_t amount) const { if (OT_ERROR_AMOUNT == amount) { return "UNKNOWN_AMOUNT"; } if ("" == assetType) { return to_string(amount); } return OTAPI_Wrap::FormatAmount(assetType, amount); }
function_block-function_prefix_line
[ { "content": "class String;\n", "file_path": "include/opentxs/core/Account.hpp", "rank": 0, "score": 273173.24958394736 }, { "content": "class Account;\n", "file_path": "include/opentxs/server/Transactor.hpp", "rank": 1, "score": 272706.39791854477 }, { "content": "class Account;\n", "file_path": "include/opentxs/server/Notary.hpp", "rank": 2, "score": 272706.39791854477 }, { "content": "class String;\n", "file_path": "include/opentxs/client/OTWallet.hpp", "rank": 3, "score": 266694.9121079102 }, { "content": "class Account;\n", "file_path": "include/opentxs/client/OTWallet.hpp", "rank": 4, "score": 266691.9714894188 }, { "content": "class Account;\n", "file_path": "include/opentxs/core/OTItem.hpp", "rank": 5, "score": 266631.055292542 }, { "content": "class String;\n", "file_path": "include/opentxs/server/ClientConnection.hpp", "rank": 6, "score": 266195.50986694166 }, { "content": "class String;\n", "file_path": "include/opentxs/server/MainFile.hpp", "rank": 7, "score": 266195.50986694166 }, { "content": "class String;\n\n\n", "file_path": "include/opentxs/server/ConfigLoader.hpp", "rank": 8, "score": 266195.50986694166 }, { "content": "class String;\n\n\n", "file_path": "include/opentxs/server/PayDividendVisitor.hpp", "rank": 9, "score": 260036.22396174306 }, { "content": "class String;\n\n\n", "file_path": "include/opentxs/core/OTServerContract.hpp", "rank": 10, "score": 260036.22396174306 }, { "content": "class String;\n", "file_path": "include/opentxs/server/UserCommandProcessor.hpp", "rank": 11, "score": 260036.22396174306 }, { "content": "class Account;\n", "file_path": "include/opentxs/server/PayDividendVisitor.hpp", "rank": 12, "score": 260034.02987552408 }, { "content": "class String;\n\n\n", "file_path": "include/opentxs/core/cron/OTCronItem.hpp", "rank": 13, "score": 254619.17468964605 }, { "content": "class OTWallet;\n\n\n", "file_path": "include/opentxs/client/OTServerConnection.hpp", "rank": 14, "score": 254264.5690144083 }, { "content": "class OTServerContract;\n", "file_path": "include/opentxs/client/OTWallet.hpp", "rank": 15, "score": 254261.9819435165 }, { "content": "class String;\n", "file_path": "include/opentxs/core/crypto/OTNymOrSymmetricKey.hpp", "rank": 16, "score": 249092.80678867066 }, { "content": "\tfunction withdraw_cash($SERVER_ID,$NYM_ID,$ACCT_ID,$AMOUNT) {\n\n\t\treturn OTMadeEasy_withdraw_cash($this->_cPtr,$SERVER_ID,$NYM_ID,$ACCT_ID,$AMOUNT);\n\n\t}\n\n\n", "file_path": "scripts/demo/php/otapi.php", "rank": 17, "score": 238161.2389114491 }, { "content": "\tfunction withdraw_voucher($SERVER_ID,$NYM_ID,$ACCT_ID,$RECIP_NYM_ID,$STR_MEMO,$AMOUNT) {\n\n\t\treturn OTMadeEasy_withdraw_voucher($this->_cPtr,$SERVER_ID,$NYM_ID,$ACCT_ID,$RECIP_NYM_ID,$STR_MEMO,$AMOUNT);\n\n\t}\n\n\n", "file_path": "scripts/demo/php/otapi.php", "rank": 18, "score": 236825.08549811906 }, { "content": "// Exception class representing an error occurred during UTF-8 conversion.\n\nclass utf8_conversion_error : public std::runtime_error\n\n{\n\npublic:\n\n //\n\n // Naming convention note:\n\n //\n\n // This exception class is derived from std::runtime_error class,\n\n // so I chose to use the same naming convention of STL classes\n\n // (e.g. do_something_intersting() instead of DoSomethingInteresting()).\n\n //\n\n\n\n // Error code type\n\n // (a DWORD, as the return value type from ::GetLastError())\n\n typedef unsigned long error_code_type;\n\n\n\n // Type of conversion\n\n enum conversion_type {\n\n conversion_utf8_from_utf16, // UTF-16 ---> UTF-8\n\n conversion_utf16_from_utf8 // UTF-8 ---> UTF-16\n\n };\n", "file_path": "include/opentxs/core/util/win32_utf8conv.hpp", "rank": 19, "score": 231473.33340646318 }, { "content": "class String\n\n{\n\npublic:\n\n typedef std::list<std::string> List;\n\n typedef std::map<std::string, std::string> Map;\n\n\n\npublic:\n\n EXPORT friend std::ostream& operator<<(std::ostream& os, const String& obj);\n\n\n\n EXPORT String();\n\n EXPORT String(const String& value);\n\n EXPORT String(const OTASCIIArmor& value);\n\n String(const OTSignature& value);\n\n EXPORT String(const OTContract& value);\n\n EXPORT String(const OTIdentifier& value);\n\n String(OTPseudonym& value);\n\n EXPORT String(const char* value);\n\n String(const char* value, size_t size);\n\n EXPORT String(const std::string& value);\n\n EXPORT virtual ~String();\n", "file_path": "include/opentxs/core/String.hpp", "rank": 20, "score": 228475.28850034688 }, { "content": "class Account;\n\n\n\ntypedef std::map<std::string, Account*> mapOfAccounts;\n\n\n", "file_path": "include/opentxs/core/AccountVisitor.hpp", "rank": 21, "score": 223954.33775651504 }, { "content": "\tfunction retrieve_account($SERVER_ID,$NYM_ID,$ACCOUNT_ID,$bForceDownload=null) {\n\n\t\tswitch (func_num_args()) {\n\n\t\tcase 3: $r=OTMadeEasy_retrieve_account($this->_cPtr,$SERVER_ID,$NYM_ID,$ACCOUNT_ID); break;\n\n\t\tdefault: $r=OTMadeEasy_retrieve_account($this->_cPtr,$SERVER_ID,$NYM_ID,$ACCOUNT_ID,$bForceDownload);\n\n\t\t}\n\n\t\treturn $r;\n\n\t}\n\n\n", "file_path": "scripts/demo/php/otapi.php", "rank": 22, "score": 222810.73548131844 }, { "content": "class OTServerContract;\n\n\n", "file_path": "include/opentxs/server/OTServer.hpp", "rank": 23, "score": 222047.85837788472 }, { "content": "\tfunction send_transfer($SERVER_ID,$NYM_ID,$ACCT_FROM,$ACCT_TO,$AMOUNT,$NOTE) {\n\n\t\treturn OTMadeEasy_send_transfer($this->_cPtr,$SERVER_ID,$NYM_ID,$ACCT_FROM,$ACCT_TO,$AMOUNT,$NOTE);\n\n\t}\n\n\n", "file_path": "scripts/demo/php/otapi.php", "rank": 24, "score": 221832.54192932945 }, { "content": "class OTWallet\n\n{\n\npublic:\n\n EXPORT OTWallet();\n\n ~OTWallet();\n\n\n\n EXPORT bool IsNymOnCachedKey(const OTIdentifier& needle) const; // needle\n\n // and\n\n // haystack.\n\n EXPORT bool ConvertNymToCachedKey(OTPseudonym& theNym);\n\n\n\n EXPORT OTPseudonym* GetOrLoadNym(const OTIdentifier& NYM_ID,\n\n bool bChecking = false,\n\n const char* szFuncName = nullptr,\n\n const OTPasswordData* pPWData = nullptr);\n\n EXPORT OTPseudonym* GetOrLoadPublicNym(const OTIdentifier& NYM_ID,\n\n const char* szFuncName = nullptr);\n\n EXPORT OTPseudonym* GetOrLoadPrivateNym(\n\n const OTIdentifier& NYM_ID, bool bChecking = false,\n\n const char* szFuncName = nullptr,\n", "file_path": "include/opentxs/client/OTWallet.hpp", "rank": 25, "score": 219740.3406255503 }, { "content": "class Account;\n", "file_path": "include/opentxs/core/script/OTPartyAccount.hpp", "rank": 26, "score": 215578.3034546057 }, { "content": "class String;\n\n\n\ntypedef std::map<int32_t, OTASCIIArmor*> mapOfPrototokens;\n\n\n\n/*\n\n Here's a rough sketch of the protocol:\n\n\n\n Client requests Mint for withdrawal of 100 ithica work hours.\n\n\n\n1) Client blinds and sends N tokens to the server, each worth 100 hours. Client\n\nretains the keys.\n\n2) Server responds with a single index, the one the server has chosen for\n\nsigning.\n\n3) Client replies with 99 keys.\n\n4) Server unblinds 99 tokens (or some randomly-chosen % of those) and verifies\n\nthem.\n\n He signs the last one and returns it.\n\n5) Client receives signed token, unblinds it, stores it for later.\n\n6) When token is redeemed, it has already been unblinded. So Server simply\n\nverifies it.\n", "file_path": "include/opentxs/cash/Token.hpp", "rank": 27, "score": 214411.09510851186 }, { "content": "class String;\n\n\n\nEXPORT int32_t OT_CLI_GetArgsCount(const std::string& str_Args);\n\nEXPORT std::string OT_CLI_GetValueByKey(const std::string& str_Args,\n\n const std::string& str_key);\n\nEXPORT std::string OT_CLI_GetValueByIndex(const std::string& str_Args,\n\n int32_t nIndex);\n\nEXPORT std::string OT_CLI_GetKeyByIndex(const std::string& str_Args,\n\n int32_t nIndex);\n\nEXPORT std::string OT_CLI_ReadLine();\n\nEXPORT std::string OT_CLI_ReadUntilEOF();\n\n\n", "file_path": "include/opentxs/client/OT_ME.hpp", "rank": 28, "score": 214411.09510851186 }, { "content": "class Account;\n", "file_path": "include/opentxs/cash/Mint.hpp", "rank": 29, "score": 214407.36488991822 }, { "content": "class OTServerContract;\n", "file_path": "include/opentxs/client/OTServerConnection.hpp", "rank": 30, "score": 211159.01369183935 }, { "content": "\tfunction process_inbox($SERVER_ID,$NYM_ID,$ACCOUNT_ID,$RESPONSE_LEDGER) {\n\n\t\treturn OTMadeEasy_process_inbox($this->_cPtr,$SERVER_ID,$NYM_ID,$ACCOUNT_ID,$RESPONSE_LEDGER);\n\n\t}\n\n\n", "file_path": "scripts/demo/php/otapi.php", "rank": 31, "score": 210578.26735114722 }, { "content": "class OTPseudonym;\n", "file_path": "include/opentxs/core/String.hpp", "rank": 32, "score": 209536.13183260825 }, { "content": "class String;\n\n\n\n// transaction ID is a int64_t, assigned by the server. Each transaction has\n\n// one.\n\n// FIRST the server issues the ID. THEN we create the blank transaction object\n\n// with the\n\n// ID in it and store it in our inbox. THEN if we want to send a transaction, we\n\n// use\n\n// the blank to do so. If there is no blank available, we message the server and\n\n// request one.\n\n\n\ntypedef std::map<int64_t, OTTransaction*> mapOfTransactions;\n\n\n", "file_path": "include/opentxs/core/OTLedger.hpp", "rank": 33, "score": 209530.97975047881 }, { "content": "class String;\n\n\n", "file_path": "include/opentxs/core/AssetContract.hpp", "rank": 34, "score": 209530.97975047881 }, { "content": "class String;\n", "file_path": "include/opentxs/core/transaction/Helpers.hpp", "rank": 35, "score": 209530.97975047881 }, { "content": "class String;\n", "file_path": "include/opentxs/core/OTIdentifier.hpp", "rank": 36, "score": 209530.97975047881 }, { "content": "class Account;\n", "file_path": "include/opentxs/core/OTLedger.hpp", "rank": 37, "score": 209528.03913198746 }, { "content": "class Account;\n", "file_path": "include/opentxs/client/OTClient.hpp", "rank": 38, "score": 209528.03913198746 }, { "content": "class Account;\n", "file_path": "include/opentxs/core/AssetContract.hpp", "rank": 39, "score": 209528.03913198746 }, { "content": "class Account;\n", "file_path": "include/opentxs/client/OpenTransactions.hpp", "rank": 40, "score": 209528.03913198746 }, { "content": "class OTPseudonym;\n\n\n", "file_path": "include/opentxs/core/Account.hpp", "rank": 41, "score": 209508.75817763002 }, { "content": "class AssetContract;\n", "file_path": "include/opentxs/server/Transactor.hpp", "rank": 42, "score": 209092.04269735026 }, { "content": "class OTPseudonym;\n", "file_path": "include/opentxs/server/Notary.hpp", "rank": 43, "score": 209058.62105172954 }, { "content": "class OTPseudonym;\n", "file_path": "include/opentxs/server/Transactor.hpp", "rank": 44, "score": 209058.62105172954 }, { "content": "// The most useful generic data object... a map of strings, key/value pairs.\n\n//\n\nclass StringMap : public Storable\n\n{\n\n // You never actually get an instance of this, only its subclasses.\n\n // Therefore, I don't allow you to access the constructor except through the\n\n // factory.\n\nprotected:\n\n StringMap()\n\n : Storable()\n\n {\n\n m_Type = \"StringMap\";\n\n }\n\n\n\npublic:\n\n virtual ~StringMap()\n\n {\n\n }\n\n\n\n std::map<std::string, std::string> the_map;\n\n\n\n void SetValue(const std::string& strKey, const std::string& strValue)\n", "file_path": "include/opentxs/core/OTStorage.hpp", "rank": 45, "score": 208872.58979606268 }, { "content": "\tfunction query_asset_types($SERVER_ID,$NYM_ID,$ENCODED_MAP) {\n\n\t\treturn OTMadeEasy_query_asset_types($this->_cPtr,$SERVER_ID,$NYM_ID,$ENCODED_MAP);\n\n\t}\n\n\n", "file_path": "scripts/demo/php/otapi.php", "rank": 46, "score": 206772.11004126142 }, { "content": "class OTWallet;\n\n\n\n// This class represents the \"test client\"\n\n//\n\n// I have it separate from the wallet because I would like to be\n\n// able to use the wallet in a \"nice client\" too, so I'm forcing\n\n// the separation to keep it designed that way.\n\n//\n\n\n", "file_path": "include/opentxs/client/OTClient.hpp", "rank": 47, "score": 204978.20858836995 }, { "content": "class OTWallet;\n", "file_path": "include/opentxs/client/OpenTransactions.hpp", "rank": 48, "score": 204978.20858836995 }, { "content": "class AssetContract;\n", "file_path": "include/opentxs/client/OTWallet.hpp", "rank": 49, "score": 204976.9128405369 }, { "content": "class OTPseudonym;\n", "file_path": "include/opentxs/client/OTWallet.hpp", "rank": 50, "score": 204943.4911949162 }, { "content": "class String;\n\n\n", "file_path": "include/opentxs/core/crypto/OTSignature.hpp", "rank": 51, "score": 204917.04467496008 }, { "content": "class String;\n\n\n", "file_path": "include/opentxs/core/OTNumList.hpp", "rank": 52, "score": 204917.04467496008 }, { "content": "class String;\n", "file_path": "include/opentxs/core/crypto/OTEnvelope.hpp", "rank": 53, "score": 204917.04467496008 }, { "content": "class String;\n", "file_path": "include/opentxs/core/crypto/OTKeyring.hpp", "rank": 54, "score": 204917.04467496008 }, { "content": "class String;\n\n\n\ntypedef std::map<std::string, OTStashItem*> mapOfStashItems;\n\n\n", "file_path": "include/opentxs/core/script/OTStash.hpp", "rank": 55, "score": 204917.04467496008 }, { "content": "class String;\n", "file_path": "include/opentxs/core/crypto/OTMasterkey.hpp", "rank": 56, "score": 204917.04467496008 }, { "content": "class String;\n", "file_path": "include/opentxs/core/script/OTScript.hpp", "rank": 57, "score": 204917.04467496008 }, { "content": "class String;\n\n\n", "file_path": "include/opentxs/core/OTTransactionType.hpp", "rank": 58, "score": 204917.04467496008 }, { "content": "class String;\n\n\n", "file_path": "include/opentxs/core/crypto/OTSubcredential.hpp", "rank": 59, "score": 204917.04467496008 }, { "content": "class String;\n\n\n\ntypedef std::list<OTAsymmetricKey*> listOfAsymmetricKeys;\n\n\n", "file_path": "include/opentxs/core/crypto/OTKeypair.hpp", "rank": 60, "score": 204917.04467496008 }, { "content": "class String;\n\n\n", "file_path": "include/opentxs/client/OTMessageBuffer.hpp", "rank": 61, "score": 204917.04467496008 }, { "content": "class Account;\n", "file_path": "include/opentxs/core/script/OTParty.hpp", "rank": 62, "score": 204914.85058874113 }, { "content": "class Account;\n", "file_path": "include/opentxs/core/script/OTAgent.hpp", "rank": 63, "score": 204914.85058874113 }, { "content": "class Account;\n", "file_path": "include/opentxs/core/script/OTScriptable.hpp", "rank": 64, "score": 204914.85058874113 }, { "content": "class OTPseudonym;\n\n\n", "file_path": "include/opentxs/core/AccountList.hpp", "rank": 65, "score": 204895.56963438372 }, { "content": "class OTPseudonym;\n", "file_path": "include/opentxs/core/OTItem.hpp", "rank": 66, "score": 204884.2363000071 }, { "content": "class OTStringXML : public String\n\n{\n\npublic:\n\n EXPORT OTStringXML();\n\n EXPORT OTStringXML(const String& value);\n\n EXPORT OTStringXML(const OTStringXML& value);\n\n\n\n EXPORT virtual ~OTStringXML();\n\n\n\n EXPORT operator irr::io::IFileReadCallBack*();\n\n\n\n EXPORT OTStringXML& operator=(const String& rhs);\n\n EXPORT OTStringXML& operator=(const OTStringXML& rhs);\n\n\n\n int32_t read(void* buffer, uint32_t sizeToRead);\n\n int32_t getSize();\n\n\n\nprivate:\n", "file_path": "include/opentxs/core/OTStringXML.hpp", "rank": 67, "score": 201314.58545937695 }, { "content": "class Account : public OTTransactionType\n\n{\n\n friend OTTransactionType* OTTransactionType::TransactionFactory(\n\n String input);\n\n\n\npublic:\n\n // If you add any types to this list, update the list of strings at the\n\n // top of the .cpp file.\n\n enum AccountType {\n\n simple, // used by users\n\n issuer, // used by issuers (these can only go negative.)\n\n basket, // issuer acct used by basket currencies (these can only go\n\n // negative)\n\n basketsub, // used by the server (to store backing reserves for basket\n\n // sub-accounts)\n\n mint, // used by mints (to store backing reserves for cash)\n\n voucher, // used by the server (to store backing reserves for\n\n // vouchers)\n\n stash, // used by the server (to store backing reserves for stashes,\n\n // for smart contracts.)\n", "file_path": "include/opentxs/core/Account.hpp", "rank": 68, "score": 200915.42912221633 }, { "content": "class String;\n\n\n\n/*\n\n To use:\n\n\n\n OTPassword thePass;\n\n (Or...)\n\n OTPassword thePass(strPassword, strPassword.length());\n\n\n\n const char * szPassword = thePass.getPassword();\n\n const int32_t nPassLength = thePass.getPasswordSize();\n\n\n\n If the instance of OTPassword is not going to be destroyed immediately\n\n after the password is used, then make sure to call zeroMemory() after\n\n using the password. (Otherwise the destructor will handle this anyway.)\n\n\n\n (The primary purpose of this class is that it zeros its memory out when\n\n it is destructed.)\n\n\n\n This class gives me a safe way to hand-off a password, and off-load the\n", "file_path": "include/opentxs/core/crypto/OTPasswordData.hpp", "rank": 69, "score": 200548.09028935677 }, { "content": "class String;\n", "file_path": "include/opentxs/core/crypto/OTCachedKey.hpp", "rank": 70, "score": 200548.09028935677 }, { "content": "class String;\n\n\n", "file_path": "include/opentxs/core/crypto/OTSymmetricKey.hpp", "rank": 71, "score": 200548.09028935677 }, { "content": "class String;\n\n\n\ntypedef std::list<OTAsymmetricKey*> listOfAsymmetricKeys;\n\n\n\n// Todo:\n\n// 1. Add this value to the config file so it becomes merely a default value\n\n// here.\n\n// 2. This timer solution isn't the full solution but only a stopgap measure.\n\n// See notes in ReleaseKeyLowLevel for more -- ultimate solution will involve\n\n// the callback itself, and some kind of encrypted storage of hashed\n\n// passwords,\n\n// using session keys, as well as an option to use ssh-agent and other\n\n// standard\n\n// APIs for protected memory.\n\n//\n\n// UPDATE: Am in the process now of adding the actual Master key. Therefore\n\n// OT_MASTER_KEY_TIMEOUT\n\n// was added for the actual mechanism, while OT_KEY_TIMER (a stopgap measure)\n\n// was set to 0, which\n\n// makes it of no effect. Probably OT_KEY_TIMER will be removed entirely (we'll\n", "file_path": "include/opentxs/core/crypto/OTAsymmetricKey.hpp", "rank": 72, "score": 200548.09028935677 }, { "content": "class Account;\n", "file_path": "include/opentxs/core/script/OTSmartContract.hpp", "rank": 73, "score": 200546.60309766326 }, { "content": "class RippleServer : public Server\n\n{\n\n // You never actually get an instance of this, only its subclasses.\n\n // Therefore, I don't allow you to access the constructor except through\n\n // factory.\n\nprotected:\n\n RippleServer()\n\n : Server()\n\n {\n\n m_Type = \"RippleServer\";\n\n }\n\n\n\npublic:\n\n virtual ~RippleServer()\n\n {\n\n }\n\n\n\n using Displayable::gui_label; // The label that appears in the GUI\n\n\n\n using ServerInfo::server_id; // in base class\n", "file_path": "include/opentxs/core/OTStorage.hpp", "rank": 74, "score": 200388.28698654432 }, { "content": "class BitcoinServer : public Server\n\n{\n\n // You never actually get an instance of this, only its subclasses.\n\n // Therefore, I don't allow you to access the constructor except through\n\n // factory.\n\nprotected:\n\n BitcoinServer()\n\n : Server()\n\n {\n\n m_Type = \"BitcoinServer\";\n\n }\n\n\n\npublic:\n\n virtual ~BitcoinServer()\n\n {\n\n }\n\n\n\n using Displayable::gui_label; // The label that appears in the GUI\n\n\n\n using ServerInfo::server_id; // in base class\n", "file_path": "include/opentxs/core/OTStorage.hpp", "rank": 75, "score": 200388.28698654432 }, { "content": "class LoomServer : public Server\n\n{\n\n // You never actually get an instance of this, only its subclasses.\n\n // Therefore, I don't allow you to access the constructor except through\n\n // factory.\n\nprotected:\n\n LoomServer()\n\n : Server()\n\n {\n\n m_Type = \"LoomServer\";\n\n }\n\n\n\npublic:\n\n virtual ~LoomServer()\n\n {\n\n }\n\n\n\n using Displayable::gui_label; // The label that appears in the GUI\n\n\n\n using ServerInfo::server_id; // in base class\n", "file_path": "include/opentxs/core/OTStorage.hpp", "rank": 76, "score": 200388.28698654432 }, { "content": "class Server : public ServerInfo\n\n{\n\n // You never actually get an instance of this, only its subclasses.\n\n // Therefore, I don't allow you to access the constructor except through\n\n // factory.\n\nprotected:\n\n Server()\n\n : ServerInfo()\n\n {\n\n m_Type = \"Server\";\n\n }\n\n\n\npublic:\n\n virtual ~Server()\n\n {\n\n }\n\n\n\n using Displayable::gui_label; // The label that appears in the GUI\n\n\n\n using ServerInfo::server_id; // in base class\n\n using ServerInfo::server_type; // in base class\n\n\n\n std::string server_host;\n\n std::string server_port;\n\n\n\n DEFINE_OT_DYNAMIC_CAST(Server)\n\n};\n\n\n", "file_path": "include/opentxs/core/OTStorage.hpp", "rank": 77, "score": 200388.28698654432 }, { "content": "class OTServerContract;\n", "file_path": "include/opentxs/client/OpenTransactions.hpp", "rank": 78, "score": 200133.2157420871 }, { "content": "class OTServerContract;\n", "file_path": "include/opentxs/client/OTClient.hpp", "rank": 79, "score": 200133.2157420871 }, { "content": "class OTServerContract;\n", "file_path": "include/opentxs/client/TransportCallback.hpp", "rank": 80, "score": 200133.2157420871 }, { "content": "class OTPseudonym;\n", "file_path": "include/opentxs/client/OTServerConnection.hpp", "rank": 81, "score": 200101.08541952516 }, { "content": "class OTPseudonym;\n", "file_path": "include/opentxs/server/UserCommandProcessor.hpp", "rank": 82, "score": 200101.08541952516 }, { "content": "\tfunction activate_smart_contract($SERVER_ID,$NYM_ID,$ACCT_ID,$AGENT_NAME,$THE_SMART_CONTRACT) {\n\n\t\treturn OTMadeEasy_activate_smart_contract($this->_cPtr,$SERVER_ID,$NYM_ID,$ACCT_ID,$AGENT_NAME,$THE_SMART_CONTRACT);\n\n\t}\n\n\n", "file_path": "scripts/demo/php/otapi.php", "rank": 83, "score": 199304.50549452732 }, { "content": "\tfunction get_payment_instrument($SERVER_ID,$NYM_ID,$nIndex,$PRELOADED_INBOX=null) {\n\n\t\tswitch (func_num_args()) {\n\n\t\tcase 3: $r=OTMadeEasy_get_payment_instrument($this->_cPtr,$SERVER_ID,$NYM_ID,$nIndex); break;\n\n\t\tdefault: $r=OTMadeEasy_get_payment_instrument($this->_cPtr,$SERVER_ID,$NYM_ID,$nIndex,$PRELOADED_INBOX);\n\n\t\t}\n\n\t\treturn $r;\n\n\t}\n\n\n", "file_path": "scripts/demo/php/otapi.php", "rank": 84, "score": 198427.46170454597 }, { "content": "class OTPseudonym;\n", "file_path": "include/opentxs/core/script/OTPartyAccount.hpp", "rank": 85, "score": 196385.01218720095 }, { "content": "class OTPseudonym;\n", "file_path": "include/opentxs/core/cron/OTCronItem.hpp", "rank": 86, "score": 196374.26504342764 }, { "content": "\tfunction trigger_clause($SERVER_ID,$NYM_ID,$TRANS_NUM,$CLAUSE_NAME,$STR_PARAM) {\n\n\t\treturn OTMadeEasy_trigger_clause($this->_cPtr,$SERVER_ID,$NYM_ID,$TRANS_NUM,$CLAUSE_NAME,$STR_PARAM);\n\n\t}\n\n\n", "file_path": "scripts/demo/php/otapi.php", "rank": 87, "score": 194520.85947666047 }, { "content": "// Note: from OTAssetContract.h and .cpp.\n\n// This is a subclass of AccountVisitor, which is used whenever OTAssetContract\n\n// needs to\n\n// loop through all the accounts for a given asset type (its own.) This subclass\n\n// needs to\n\n// call OTServer method to do its job, so it can't be defined in otlib, but must\n\n// be defined\n\n// here in otserver (so it can see the methods that it needs...)\n\n//\n\nclass PayDividendVisitor : public AccountVisitor\n\n{\n\n OTIdentifier* m_pUserID;\n\n OTIdentifier* m_pPayoutAssetID;\n\n OTIdentifier* m_pVoucherAcctID;\n\n String* m_pstrMemo; // contains the original payDividend item from the\n\n // payDividend transaction request. (Stored in the\n\n // memo field for each voucher.)\n\n OTServer* m_pServer; // no need to cleanup. It's here for convenience only.\n\n int64_t m_lPayoutPerShare;\n\n int64_t m_lAmountPaidOut; // as we pay each voucher out, we keep a running\n\n // count.\n\n int64_t m_lAmountReturned; // as we pay each voucher out, we keep a running\n\n // count.\n\n\n\npublic:\n\n PayDividendVisitor(const OTIdentifier& theServerID,\n\n const OTIdentifier& theUserID,\n\n const OTIdentifier& thePayoutAssetID,\n\n const OTIdentifier& theVoucherAcctID,\n", "file_path": "include/opentxs/server/PayDividendVisitor.hpp", "rank": 88, "score": 193328.38732898136 }, { "content": "class String;\n\n\n\n// Todo:\n\n// 1. Add this value to the config file so it becomes merely a default value\n\n// here.\n\n// 2. This timer solution isn't the full solution but only a stopgap measure.\n\n// See notes in ReleaseKeyLowLevel for more -- ultimate solution will involve\n\n// the callback itself, and some kind of encrypted storage of hashed\n\n// passwords,\n\n// using session keys, as well as an option to use ssh-agent and other\n\n// standard\n\n// APIs for protected memory.\n\n//\n\n// UPDATE: Am in the process now of adding the actual Master key. Therefore\n\n// OT_MASTER_KEY_TIMEOUT\n\n// was added for the actual mechanism, while OT_KEY_TIMER (a stopgap measure)\n\n// was set to 0, which\n\n// makes it of no effect. Probably OT_KEY_TIMER will be removed entirely (we'll\n\n// see.)\n\n//\n", "file_path": "include/opentxs/core/crypto/OTAsymmetricKeyOpenSSL.hpp", "rank": 89, "score": 192471.01379715896 }, { "content": "class OTPseudonym;\n", "file_path": "include/opentxs/core/crypto/OTNymOrSymmetricKey.hpp", "rank": 90, "score": 192455.66258696612 }, { "content": "\tfunction pay_dividend($SERVER_ID,$NYM_ID,$SOURCE_ACCT_ID,$SHARES_ASSET_ID,$STR_MEMO,$AMOUNT_PER_SHARE) {\n\n\t\treturn OTMadeEasy_pay_dividend($this->_cPtr,$SERVER_ID,$NYM_ID,$SOURCE_ACCT_ID,$SHARES_ASSET_ID,$STR_MEMO,$AMOUNT_PER_SHARE);\n\n\t}\n\n\n", "file_path": "scripts/demo/php/otapi.php", "rank": 91, "score": 191659.18024920247 }, { "content": "class OTLogStream : public std::ostream, std::streambuf\n\n{\n\nprivate:\n\n int logLevel;\n\n int next;\n\n char* pBuffer;\n\n\n\npublic:\n\n OTLogStream(int _logLevel);\n\n ~OTLogStream();\n\n\n\n virtual int overflow(int c);\n\n};\n\n\n", "file_path": "include/opentxs/core/OTLog.hpp", "rank": 92, "score": 191170.05434549606 }, { "content": "#define DeclareBasedInterface(name, base) \\\n\n class name : public base \\\n\n { \\\n\n public: \\\n\n virtual ~name() \\\n\n { \\\n\n }\n\n\n\n#define EndInterface \\\n\n } \\\n\n ;\n\n\n\n#define implements public\n\n\n\n#endif // (not) SWIG\n\n\n\nnamespace opentxs\n\n{\n\n\n\nnamespace OTDB\n\n{\n\n\n\n// ENUMS: PackType, StorageType, and StoredObjectType.\n\n\n", "file_path": "include/opentxs/core/OTStorage.hpp", "rank": 93, "score": 189909.4704551223 }, { "content": "class OTServerContract : public OTContract\n\n{\n\npublic:\n\n EXPORT OTServerContract();\n\n EXPORT OTServerContract(String& name, String& foldername, String& filename,\n\n String& strID);\n\n EXPORT virtual ~OTServerContract();\n\n\n\n EXPORT bool GetConnectInfo(String& strHostname, int32_t& nPort) const;\n\n EXPORT virtual void CreateContents(); // Only used when first generating an\n\n // asset or server contract. Meant for\n\n // contracts which never change after\n\n // that point. Otherwise does the\n\n // same thing as UpdateContents. (But\n\n // meant for a different purpose.)\n\n virtual bool SaveContractWallet(String& strContents) const;\n\n virtual bool DisplayStatistics(String& strContents) const;\n\n\n\nprotected:\n\n // return -1 if error, 0 if nothing, and 1 if the node was processed.\n", "file_path": "include/opentxs/core/OTServerContract.hpp", "rank": 94, "score": 189735.11957604348 }, { "content": "\n\n EXPORT void ActivateCron();\n\n void ProcessCron();\n\n\n\nprivate:\n\n bool SendInstrumentToNym(const OTIdentifier& serverId,\n\n const OTIdentifier& senderUserId,\n\n const OTIdentifier& recipientUserId,\n\n OTMessage* msg = nullptr,\n\n const OTPayment* payment = nullptr,\n\n const char* command = nullptr);\n\n\n\n // Note: SendInstrumentToNym and SendMessageToNym CALL THIS.\n\n // They are higher-level, this is lower-level.\n\n bool DropMessageToNymbox(const OTIdentifier& serverId,\n\n const OTIdentifier& senderUserId,\n\n const OTIdentifier& recipientUserId,\n\n OTTransaction::transactionType transactionType,\n\n OTMessage* msg = nullptr,\n\n const String* messageString = nullptr,\n", "file_path": "include/opentxs/server/OTServer.hpp", "rank": 95, "score": 187573.7789880954 }, { "content": " const char* command = nullptr);\n\n\n\nprivate:\n\n MainFile mainFile_;\n\n Notary notary_;\n\n Transactor transactor_;\n\n UserCommandProcessor userCommandProcessor_;\n\n\n\n String m_strWalletFilename;\n\n // Used at least for whether or not to write to the PID.\n\n bool m_bReadOnly;\n\n // If the server wants to be shut down, it can set\n\n // this flag so the caller knows to do so.\n\n bool m_bShutdownFlag;\n\n\n\n // A hash of the server contract\n\n String m_strServerID;\n\n // A hash of the public key that signed the server contract\n\n String m_strServerUserID;\n\n // This is the server's own contract, containing its public key and\n", "file_path": "include/opentxs/server/OTServer.hpp", "rank": 96, "score": 187570.4144847993 }, { "content": " }\n\n\n\n static int64_t __min_market_scale;\n\n\n\n static int32_t __heartbeat_no_requests;\n\n static int32_t __heartbeat_ms_between_beats;\n\n\n\n // The Nym who's allowed to do certain commands even if they are turned off.\n\n static std::string __override_nym_id;\n\n // Are usage credits REQUIRED in order to use this server?\n\n static bool __admin_usage_credits;\n\n // Is server currently locked to non-override Nyms?\n\n static bool __admin_server_locked;\n\n\n\n static bool __cmd_usage_credits;\n\n static bool __cmd_issue_asset;\n\n static bool __cmd_get_contract;\n\n static bool __cmd_check_server_id;\n\n\n\n static bool __cmd_create_user_acct;\n", "file_path": "include/opentxs/server/ServerSettings.hpp", "rank": 97, "score": 187564.28069358604 }, { "content": " }\n\n\n\n static int32_t GetHeartbeatMsBetweenBeats()\n\n {\n\n return __heartbeat_ms_between_beats;\n\n }\n\n\n\n static void SetHeartbeatMsBetweenBeats(int32_t value)\n\n {\n\n __heartbeat_ms_between_beats = value;\n\n }\n\n\n\n static const std::string& GetOverrideNymID()\n\n {\n\n return __override_nym_id;\n\n }\n\n\n\n static void SetOverrideNymID(const std::string& id)\n\n {\n\n __override_nym_id = id;\n", "file_path": "include/opentxs/server/ServerSettings.hpp", "rank": 98, "score": 187563.7275992242 }, { "content": " static bool __transact_transfer;\n\n static bool __transact_withdrawal;\n\n static bool __transact_deposit;\n\n static bool __transact_withdraw_voucher;\n\n static bool __transact_deposit_cheque;\n\n static bool __transact_pay_dividend;\n\n\n\n static bool __cmd_get_mint;\n\n static bool __transact_withdraw_cash;\n\n static bool __transact_deposit_cash;\n\n\n\n static bool __cmd_get_market_list;\n\n static bool __cmd_get_market_offers;\n\n static bool __cmd_get_market_recent_trades;\n\n static bool __cmd_get_nym_market_offers;\n\n\n\n static bool __transact_market_offer;\n\n static bool __transact_payment_plan;\n\n static bool __transact_cancel_cron_item;\n\n static bool __transact_smart_contract;\n\n static bool __cmd_trigger_clause;\n\n};\n\n\n\n} // namespace opentxs\n\n\n\n#endif // OPENTXS_SERVER_SERVERSETTINGS_HPP\n", "file_path": "include/opentxs/server/ServerSettings.hpp", "rank": 99, "score": 187553.47998610587 } ]