text:
#pragma once

#include <Eigen/Eigen>

namespace boost {
   namespace serialization {
      template<class Archive>
      void serialize(Archive &ar, Eigen::Vector3f &vec, const unsigned int version) {
         ar & vec[0];
         ar & vec[1];
         ar & vec[2];
      }

      template<class Archive>
      void serialize(Archive &ar, Eigen::Matrix<float, 3, 3> &var, const unsigned int version) {
         ar & var(0, 0); ar & var(0, 1); ar & var(0, 2);
         ar & var(1, 0); ar & var(1, 1); ar & var(1, 2);
         ar & var(2, 0); ar & var(2, 1); ar & var(2, 2);
      }

      template<class Archive>
      void serialize(Archive &ar, Eigen::Matrix<float, 7, 1> &vec, const unsigned int version) {
         for (int i = 0; i < 7; i++) {
            ar & vec[i];
         }
      }

      template<class Archive>
      void serialize(Archive &ar, Eigen::Matrix<float, 7, 7> &var, const unsigned int version) {
         for (int row = 0; row < 7; row++) {
            for (int col = 0; col < 7; col++) {
               ar & var(row, col);
            }
         }
      }
   }
}

ext: hpp

max_stars_repo_name: pedrohsreis/boulos

max_issues_repo_name: pedrohsreis/boulos

max_forks_repo_name: pedrohsreis/boulos


text:
// This file is part of SWGANH which is released under the MIT license.
// See file LICENSE or go to http://swganh.com/LICENSE

#include "swganh/plugin/plugin_manager.h"

#include <algorithm>
#include <fstream>
#include <iostream>

#include <boost/filesystem.hpp>
#include "swganh/logger.h"
#include <boost/program_options.hpp>

#include "swganh/app/kernel_interface.h"

#include "swganh/plugin/platform/library_interface.h"

#ifdef WIN32
#include "swganh/plugin/platform/win32_library.h"
typedef swganh::plugin::platform::Win32Library DynamicLibrary;
#else
#include <dlfcn.h>
#include "swganh/plugin/platform/posix_library.h"
typedef swganh::plugin::platform::PosixLibrary DynamicLibrary;
#endif

#if defined(WIN32)
static std::string library_extension(".dll");
#else
static std::string library_extension(".so");
#endif

using namespace swganh::app;
using namespace swganh::plugin;
using namespace boost::program_options;
using namespace std;

PluginManager::PluginManager(KernelInterface* kernel)
    : kernel_(kernel)
{
#ifndef WIN32
    dlopen(NULL,RTLD_NOW|RTLD_GLOBAL);
#endif
}

PluginManager::~PluginManager()
{
    std::for_each(
        begin(exit_funcs_),
        end(exit_funcs_),
        [] (ExitFunc exit_func)
    {
        try
        {
            (*exit_func)();
        }
        catch(...)
        {
            // Report error here.
        }
    });
}

void PluginManager::LoadPlugin(const std::string& path, std::string plugin_directory)
{
    if (library_map_.find(path) != library_map_.end())
    {
        throw PluginLoadingError("Plugin has already been loaded ["+ path + "]");
    }

    auto library = LoadLibrary_(plugin_directory + path + library_extension);
    if (!library)
    {
        throw PluginLoadingError("Plugin failed to load ["+ path + "]");
    }

    if (ConfigFunc config_func = library->GetSymbol<ConfigFunc>("ConfigurePlugin"))
    {
        ConfigurePlugin(path, config_func);
    }

    InitFunc init_func = library->GetSymbol<InitFunc>("InitializePlugin");
    if (!InitializePlugin(init_func))
    {
        throw PluginLoadingError("Plugin failed to initialize ["+ path + "]");
    }

    library_map_[path] = library;
}

void PluginManager::LoadAllPlugins(const std::string& directory)
{
    boost::filesystem::path plugin_dir(directory);

    try
    {
        if (!boost::filesystem::exists(plugin_dir) ||
                !boost::filesystem::is_directory(plugin_dir))
        {
            throw PluginLoadingError("Plugin failed to load ["+ directory + "]");
        }

        std::for_each(boost::filesystem::directory_iterator(plugin_dir),
                      boost::filesystem::directory_iterator(),
                      [this] (const boost::filesystem::directory_entry& entry)
        {
            if (entry.path().extension() != library_extension)
            {
                return;
            }

            auto native_path = entry.path().native();

            this->LoadPlugin(string(native_path.begin(), native_path.end()));
        });

    }
    catch(const std::exception& e)
    {
        LOG(fatal) << e.what();
    }
}

void PluginManager::ConfigurePlugin(std::string plugin_name, ConfigFunc config_func)
{
    if (!config_func)
    {
        throw runtime_error("Missing configuration function.");
    }

    ifstream config_file("config/plugins/" + plugin_name + ".cfg");

    if (!config_file.is_open())
    {
        DLOG(warning) << "No configuration loaded for plugin: " + plugin_name;
        return;
    }

    variables_map vm;
    options_description description;

    config_func(description);

    try
    {
        store(parse_config_file(config_file, description, true), vm);
    }
    catch(const std::exception& e)
    {
        throw runtime_error("Unable to parse the configuration file at: config/plugins/" + plugin_name + ".cfg: " + std::string(e.what()));
    }

    notify(vm);
    config_file.close();
}

bool PluginManager::InitializePlugin(InitFunc init_func)
{
    if (!init_func)
    {
        return false;
    }

    ExitFunc exit_func = init_func(kernel_);

    if (!exit_func)
    {
        return false;
    }

    exit_funcs_.push_back(exit_func);

    return true;
}

bool PluginManager::RegisterObject(const std::string& name, const ObjectRegistration* registration)
{
    if (name.empty())
    {
        return false;
    }

    if (!registration || !registration->CreateObject || !registration->DestroyObject)
    {
        return false;
    }

    swganh::app::Version version = kernel_->GetVersion();
    if (version.major != registration->version.major)
    {
        return false;
    }

    if (registration_map_.find(name) != registration_map_.end())
    {
        return false;
    }

    registration_map_[name] = *registration;

    return true;
}

const RegistrationMap& PluginManager::registration_map()
{
    return registration_map_;
}

std::shared_ptr<platform::LibraryInterface> PluginManager::LoadLibrary_(const std::string& path)
{
    auto library = DynamicLibrary::Load(path);

    if (!library)
    {
        return nullptr;
    }

    return library;
}

ext: cc

max_stars_repo_name: obi-two/GameServer

max_issues_repo_name: obi-two/GameServer

max_forks_repo_name: obi-two/GameServer


text:
#ifndef UUID_565BAB59_6F52_4619_B355_104317D0EEE7
#define UUID_565BAB59_6F52_4619_B355_104317D0EEE7

#include <boost/asio/error.hpp>
#include <boost/system/system_error.hpp>
#include <ce/socket_session.hpp>

#include <boost/asio/io_context.hpp>
#include <boost/asio/strand.hpp>
#include <boost/asio/write.hpp>
#include <boost/beast/core/tcp_stream.hpp>

namespace ce
{
    using socket_executor_t = ba::strand<ba::io_context::executor_type>;
    using tcp_socket = ba::basic_stream_socket<ba::ip::tcp,socket_executor_t>;
    using tcp_stream = bb::basic_stream<ba::ip::tcp,
        socket_executor_t,
        bb::simple_rate_policy>;

    class chat;

    class chat_session final : public socket_session<chat_session,tcp_stream>
    {
        constexpr static std::size_t text_limit_ = 1024,
                                     bytes_per_second_limit = 1024;
    public:
        chat_session(ba::io_context::executor_type ex,chat& c);
        ~chat_session() override;

        void start_protocol();

        template<typename CompletionToken>
        decltype(auto) async_write(std::string_view message,CompletionToken&& token)
        {
            return boost::asio::async_write(this->stream_,
                boost::asio::const_buffer{message.data(),message.size()},
                [token=std::forward<CompletionToken>(token)]
                        (boost::system::error_code ec,std::size_t /*n*/) mutable {
                    if(ec){
                        if(ec==boost::asio::error::operation_aborted)
                            return;
                        throw boost::system::system_error{ec};
                    }
                    boost::asio::dispatch(token);
                });
        }
    private:
        chat& c_;
        std::string in_buf_;

        void read_line();
    };
}

#endif


text:
/*  Sirikata liboh -- Object Host
 *  HostedObject.hpp
 *
 *  Copyright (c) 2009, Patrick Reiter Horn
 *  All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are
 *  met:
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name of Sirikata nor the names of its contributors may
 *    be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
#ifndef _SIRIKATA_HOSTED_OBJECT_HPP_
#define _SIRIKATA_HOSTED_OBJECT_HPP_

#include <sirikata/core/util/SpaceObjectReference.hpp>
#include <sirikata/proxyobject/ProxyObject.hpp>
#include <sirikata/proxyobject/VWObject.hpp>
#include <sirikata/core/util/Platform.hpp>
#include <sirikata/core/odp/DelegateService.hpp>
#include <sirikata/oh/ObjectScriptManager.hpp>

#include <utility>

#include <sirikata/core/network/ObjectMessage.hpp>
#include <sirikata/core/odp/SSTDecls.hpp>

#include <sirikata/core/transfer/URI.hpp>

#include <sirikata/oh/ObjectHost.hpp>
#include <sirikata/oh/SimulationFactory.hpp>

//here
#include <sirikata/core/util/Platform.hpp>

#include <sirikata/core/service/Service.hpp>
#include <sirikata/core/util/Timer.hpp>
#include <sirikata/core/service/Context.hpp>

#include <sirikata/core/network/Message.hpp>

#include <boost/lexical_cast.hpp>
#include <boost/asio.hpp> //htons, ntohs

#include <sirikata/core/transfer/TransferData.hpp>
#include <sirikata/core/transfer/RemoteFileMetadata.hpp>
#include <sirikata/core/transfer/TransferPool.hpp>
#include <sirikata/core/transfer/TransferMediator.hpp>

namespace Sirikata {

class LocUpdate;

namespace Protocol {
namespace Loc {
class LocationUpdate;
class BulkLocationUpdate;
}
namespace Prox {
class ProximityUpdate;
}
}

class ProxyObject;
class ProxyObject;
struct LightInfo;
typedef std::tr1::shared_ptr<ProxyObject> ProxyObjectPtr;

class ObjectScript;
class HostedObject;
class PerPresenceData;
typedef std::tr1::weak_ptr<HostedObject> HostedObjectWPtr;
typedef std::tr1::shared_ptr<HostedObject> HostedObjectPtr;

class QueryDataLookup;

class SIRIKATA_OH_EXPORT HostedObject
    : public VWObject,
      public Service
{
private:
  struct PrivateCallbacks;

    // Public to give access to OHConnectInfo to QueryDataLookup impls
  public:
    typedef struct OHConnectInfo{
    public:
      SpaceID spaceID;
      Location startingLocation;
      BoundingSphere3f meshBounds;
      String mesh;
      String physics;
      String query;
      ObjectReference orefID;
      int64 token;
      String query_data;
      } OHConnectInfo;
    typedef std::tr1::shared_ptr<OHConnectInfo> OHConnectInfoPtr;

protected:

    ObjectHostContext* mContext;
    const UUID mID;

    ObjectHost *mObjectHost;
    ObjectScript *mObjectScript;
    typedef std::map<SpaceObjectReference, PerPresenceData*> PresenceDataMap;
    PresenceDataMap mPresenceData;

    bool destroyed;

    ODP::DelegateService* mDelegateODPService;

    typedef boost::mutex Mutex;
    Mutex presenceDataMutex;
    Mutex notifyMutex;

    friend class ::Sirikata::SelfWeakPtr<VWObject>;
    friend class PerPresenceData;
    AtomicValue<int> mNumOutstandingConnections;
    bool mDestroyWhenConnected;

public:
    typedef ODPSST::Endpoint EndPointType;
    typedef ODPSST::BaseDatagramLayerPtr BaseDatagramLayerPtr;
    typedef ODPSST::ConnectionPtr SSTConnectionPtr;
    typedef ODPSST::StreamPtr SSTStreamPtr;

    /// Destructor: will only be called from shared_ptr::~shared_ptr.
    virtual ~HostedObject();

    /** Get a unique identifier for this object on this object host. This is for
     *  internal use only -- it has nothing to do with any space or presences in
     *  the space. It is *not* a public value.
     */
    const UUID& id() const;

    // Sirikata::Service interface
    virtual void start();
    virtual void stop();

    bool stopped() const;

    /** Get a set of spaces the object is currently connected to.
     *  NOTE: Be very careful with this. It reports everything connected,
     *  including presences where we haven't established the SST stream with the
     *  space, which lots of listeners (including SessionEventListeners) rely
     *  on.
     */
    typedef std::vector<SpaceObjectReference> SpaceObjRefVec;
    void getSpaceObjRefs(SpaceObjRefVec& ss) const;

    ObjectHostContext* context() { return mContext; }
    const ObjectHostContext* context() const { return mContext; }

    /** \see ObjectHost::spaceTime */
    Time spaceTime(const SpaceID& space, const Time& t);
    /** \see ObjectHost::currentSpaceTime */
    Time currentSpaceTime(const SpaceID& space);
    /** \see ObjectHost::localTime */
    Time localTime(const SpaceID& space, const Time& t);
    /** \see ObjectHost::currentLocalTime */
    Time currentLocalTime();

    ///makes a new objects with objectName startingLocation mesh and connect to some interesting space
    void initializeScript(const String& script_type, const String& args, const String& script);

    /** Removes this HostedObject from the ObjectHost, and destroys the internal shared pointer
      * Safe to reuse for another connection, as long as you hold a shared_ptr to this object.
      */
    void destroy(bool need_self = true);
    /** Gets the ObjectHost (usually one per host).
        See getProxy(space)->getProxyManger() for the per-space object.
    */
    ObjectHost *getObjectHost()const {return mObjectHost;}

    /// Gets the proxy object representing this HostedObject inside space.
    ProxyObjectPtr getProxy(const SpaceID& space, const ObjectReference& oref);

    Simulation* runSimulation(
        const SpaceObjectReference& sporef, const String& simName,
        Network::IOStrandPtr simStrand);

    void killSimulation(
        const SpaceObjectReference& sporef, const String& simName);

    virtual ProxyManagerPtr getProxyManager(const SpaceID& space,const ObjectReference& oref);

    typedef int64 PresenceToken;
    const static PresenceToken DEFAULT_PRESENCE_TOKEN = -1;

    /** Initiate connection process to a space, but do not send any messages yet.
        After calling connectToSpace, it is immediately possible to send() a NewObj
        message, however any other message must wait until you receive the RetObj
        for that space.
        @param spaceID  The UUID of the space you connect to.
        @param startingLocation  The initial location of this object. Must be known at connection time?
        @param meshBounds  The size of this mesh. If set incorrectly, mesh will
        be scaled to these bounds.
        @param mesh the URL of the mesh for this object
        @param physics Physical parameters, serialized to a string. The exact
        format depends on the physics implementation the server is using.
        @param query if non-empty, query parameters
        @param token  When connection completes, notifies all session
        listeners.  Provides token to these listeners so they can distinguish
        which presence may have connected, etc.
    */
    bool connect(
        const SpaceID&spaceID,
        const Location&startingLocation,
        const BoundingSphere3f &meshBounds,
        const String& mesh,
        const String& physics,
        const String& query,
        const ObjectReference& orefID = ObjectReference::null(),
        PresenceToken token = DEFAULT_PRESENCE_TOKEN);

    // May be called asynchronously, self ptr ensures liveness.
    void objectHostConnectIndirect(HostedObjectPtr self, QueryDataLookup* lookup, OHConnectInfoPtr oci);

    bool objectHostConnect(
        const SpaceID spaceID,
        const Location startingLocation,
        const BoundingSphere3f meshBounds,
        const String mesh,
        const String physics,
        const String query,
        const String query_data,
        const ObjectReference orefID,
        PresenceToken token = DEFAULT_PRESENCE_TOKEN);

    /// Disconnects from the given space by terminating the corresponding substream.
    void disconnectFromSpace(const SpaceID &spaceID, const ObjectReference& oref);

    /// Receive an ObjectMessage from the space via the ObjectHost. Translate it
    /// to our runtime ODP structure and deliver it.
    void receiveMessage(const SpaceID& space, const Protocol::Object::ObjectMessage* msg);

    HostedObjectPtr getSharedPtr() {
        return std::tr1::static_pointer_cast<HostedObject>(this->VWObject::getSharedPtr());
    }
    HostedObjectWPtr getWeakPtr() {
        return std::tr1::static_pointer_cast<HostedObject>(this->VWObject::getSharedPtr());
    }

    // Identification
    virtual ProxyManagerPtr presence(const SpaceObjectReference& sor);
    virtual SequencedPresencePropertiesPtr presenceRequestedLocation(const SpaceObjectReference& sor);
    virtual uint64 presenceLatestEpoch(const SpaceObjectReference& sor);

    virtual ProxyObjectPtr self(const SpaceObjectReference& sor);

    // ODP::Service Interface
    virtual ODP::Port* bindODPPort(const SpaceID& space, const ObjectReference& objref, ODP::PortID port);
    virtual ODP::Port* bindODPPort(const SpaceObjectReference& sor, ODP::PortID port);
    virtual ODP::Port* bindODPPort(const SpaceID& space, const ObjectReference& objref);
    virtual ODP::Port* bindODPPort(const SpaceObjectReference& sor);
    virtual ODP::PortID unusedODPPort(const SpaceID& space, const ObjectReference& objref);
    virtual ODP::PortID unusedODPPort(const SpaceObjectReference& sor);
    virtual void registerDefaultODPHandler(const ODP::Service::MessageHandler& cb);

    // Access to SST for this object
    ODPSST::StreamPtr getSpaceStream(const SpaceObjectReference& sor);

    // Movement Interface
    //note: location update services both position and velocity

    virtual void requestLocationUpdate(const SpaceID& space, const ObjectReference& oref,const TimedMotionVector3f& loc);
    virtual void requestOrientationUpdate(const SpaceID& space, const ObjectReference& oref, const TimedMotionQuaternion& orient);
    virtual void requestBoundsUpdate(const SpaceID& space, const ObjectReference& oref, const BoundingSphere3f& bounds);
    virtual void requestMeshUpdate(const SpaceID& space, const ObjectReference& oref, const String& mesh);
    // This version is a callback used when looking up query data that is
    // collected based on the mesh itself.
    virtual void requestMeshUpdateAfterQueryDataLookup(HostedObjectPtr self, QueryDataLookup* lookup, const SpaceID& space, const ObjectReference& oref, const String& mesh, bool with_query_data, const String& query_data);
    virtual void requestPhysicsUpdate(const SpaceID& space, const ObjectReference& oref, const String& phy);

    virtual void requestQueryUpdate(const SpaceID& space, const ObjectReference& oref, const String& new_query);
    // Shortcut for requestQueryUpdate("")
    virtual void requestQueryRemoval(const SpaceID& space, const ObjectReference& oref);
    virtual String requestQuery(const SpaceID& space, const ObjectReference& oref);

    // ObjectQuerier Interface
    void handleProximityUpdate(const SpaceObjectReference& spaceobj, const Sirikata::Protocol::Prox::ProximityUpdate& update);
    void handleLocationUpdate(const SpaceObjectReference& spaceobj, const LocUpdate& lu);

    // Commands
    void commandPresences(
        const Command::Command& cmd, Command::Commander* cmdr, Command::CommandID cmdid);
    // Tries to pass a command to the object script to be handled by the script
    // and completes the handling by indicating success or failure. The command,
    // with 'oh.objects.command' as the 'command' field, is passed to the
    // script. Some scripts may not be setup to handle commands and some may not
    // even have scripts, in which case the command will automatically fail.
    void commandObjectCommand(
        const Command::Command& cmd, Command::Commander* cmdr, Command::CommandID cmdid);

  private:
    /// Private: Use "SelfWeakPtr<HostedObject>::construct(ObjectHost*)"
    /** Create a new HostedObject.
     * \param _id A unique identifier for this object within this object
     * host. You can specify it at construction so that objects can be restored
     * from permanent storage.  You should always specify a non-null value, even
     * if you need to manually allocate a new random identifier.
     */
    HostedObject(ObjectHostContext* ctx, ObjectHost*parent, const UUID &_id);

    // Because IOStrand->wrap() can't handle > 5 parameters (because the
    // underlying boost impementation doesnt), we need to handle wrapping
    // connection callbacks manually.

    void iHandleDisconnected(
        const HostedObjectWPtr& weakSelf, const SpaceObjectReference& spaceobj,
        Disconnect::Code cc);

    static void handleConnected(const HostedObjectWPtr &weakSelf, ObjectHost* parentOH, const SpaceID& space, const ObjectReference& obj, ObjectHost::ConnectionInfo info);
    static void handleConnectedIndirect(const HostedObjectWPtr &weakSelf, ObjectHost* parentOH, const SpaceID& space, const ObjectReference& obj, ObjectHost::ConnectionInfo info, const BaseDatagramLayerPtr&);

//    static bool handleEntityCreateMessage(const HostedObjectWPtr &weakSelf, const ODP::Endpoint& src, const ODP::Endpoint& dst, MemoryReference bodyData);
    static void handleMigrated(const HostedObjectWPtr &weakSelf, const SpaceID& space, const ObjectReference& obj, ServerID server);
    static void handleStreamCreated(const HostedObjectWPtr &weakSelf, const SpaceObjectReference& spaceobj, SessionManager::ConnectionEvent after, PresenceToken token);
    static void handleDisconnected(const HostedObjectWPtr &weakSelf, const SpaceObjectReference& spaceobj, Disconnect::Code cc);

    // Helper that disconnects presences that were completed after the
    // HostedObject was stopped/destroyed. Only invoke indirectly (via posting)
    // since we don't want to muck with the connection within the connection
    // callback.
    static void disconnectDeadPresence(ObjectHost* parentOH, const SpaceID& space, const ObjectReference& obj);

    ODP::DelegatePort* createDelegateODPPort(ODP::DelegateService* parentService, const SpaceObjectReference& spaceobj, ODP::PortID port);
    bool delegateODPPortSend(const ODP::Endpoint& source_ep, const ODP::Endpoint& dest_ep, MemoryReference payload);

    // Handlers for core space-managed updates
    void processLocationUpdate(const SpaceObjectReference& sporef, ProxyObjectPtr proxy_obj, const LocUpdate& update);
    void processLocationUpdate(
        const SpaceID& space, ProxyObjectPtr proxy_obj, bool predictive,
        TimedMotionVector3f* loc, uint64 loc_seqno,
        TimedMotionQuaternion* orient, uint64 orient_seqno,
        AggregateBoundingInfo* bounds, uint64 bounds_seqno,
        String* mesh, uint64 mesh_seqno,
        String* phy, uint64 phy_seqno
    );

    // Helper for creating the correct type of proxy
    ProxyObjectPtr createProxy(const SpaceObjectReference& objref, const SpaceObjectReference& owner_objref, const Transfer::URI& meshuri, TimedMotionVector3f& tmv, TimedMotionQuaternion& tmvq, const AggregateBoundingInfo& bounds, const String& physics, const String& query, bool isAggregate, uint64 seqNo);

    // Helper for constructing and sending location update
    void updateLocUpdateRequest(const SpaceID& space, const ObjectReference& oref, const TimedMotionVector3f* const loc, const TimedMotionQuaternion* const orient, const BoundingSphere3f* const bounds, const String* const mesh, const String* const phy, const String* query_data);
    void sendLocUpdateRequest(const SpaceID& space, const ObjectReference& oref);

}; // class HostedObject

class SIRIKATA_OH_EXPORT QueryDataLookup {
public:
    virtual ~QueryDataLookup();

    /** Lookup query data for this object. Should invoke
     *  HostedObject::objectHostConnectIndirect on the main thread when it has
     *  filled in query_data, if it needs to. The callback may be invoked
     *  immediately if the data can be filled in synchronously.
     */
    virtual void lookup(HostedObjectPtr ho, HostedObject::OHConnectInfoPtr ci) = 0;
    /** Lookup query data for this object based on mesh only. Should invoke
     *  HostedObject::requestMeshUpdateAfterQueryDataLookup. That method uses locks, so
     *  it can safely be invoked from any thread.
     */
    virtual void lookup(HostedObjectPtr ho, const SpaceID& space, const ObjectReference& oref, const String& mesh) = 0;
};

class SIRIKATA_OH_EXPORT QueryDataLookupFactory
    : public AutoSingleton<QueryDataLookupFactory>,
      public Factory1<QueryDataLookup*, const String&>
{
public:
    static QueryDataLookupFactory& getSingleton();
    static void destroy();
};

}

#endif

max_stars_repo_name: sirikata/sirikata

max_issues_repo_name: sirikata/sirikata

max_forks_repo_name: sirikata/sirikata


text:
/*
 * Copyright 2021 Assured Information Security, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#include <introvirt/core/exception/InvalidMethodException.hh>
#include <introvirt/windows/libraries/ws2_32/functions/WSAConnect.hh>

#include <boost/io/ios_state.hpp>

#include "../../helpers.hh"

namespace introvirt {
namespace windows {
namespace ws2_32 {

/* Input arguments */
DEFINE_VALUE_GETTER_SETTER(WSAConnect, s, 0, SOCKET);
DEFINE_ADDRESS_GETTER_SETTER(WSAConnect, pName, 1);
DEFINE_VALUE_GETTER_SETTER(WSAConnect, namelen, 2, int32_t);
DEFINE_ADDRESS_GETTER_SETTER(WSAConnect, lpCallerData, 3);
DEFINE_ADDRESS_GETTER_SETTER(WSAConnect, lpCalleeData, 4);
DEFINE_ADDRESS_GETTER_SETTER(WSAConnect, lpSQOS, 5);
DEFINE_ADDRESS_GETTER_SETTER(WSAConnect, lpGQOS, 6);

/* Helpers */
const SOCKADDR* WSAConnect::name() const {
    if (!name_ && pName_) {
        name_ = SOCKADDR::make_unique(pName(), x64());
    }
    return name_.get();
}
SOCKADDR* WSAConnect::name() {
    const auto* const_this = this;
    return const_cast<SOCKADDR*>(const_this->name());
}

int32_t WSAConnect::result() const { return raw_return_value(); }

const std::string& WSAConnect::function_name() const { return FunctionName; }
const std::string& WSAConnect::library_name() const { return LibraryName; }
void WSAConnect::write(std::ostream& os) const {
    boost::io::ios_flags_saver ifs(os);
    // TODO
}

WSAConnect::WSAConnect(Event& event) : WindowsFunctionCall(event, ArgumentCount) {
    s_ = get_argument(0);
    pName_ = get_address_argument(1);
    namelen_ = get_argument(2);
    lpCallerData_ = get_address_argument(3);
    lpCalleeData_ = get_address_argument(4);
    lpSQOS_ = get_address_argument(5);
    lpGQOS_ = get_address_argument(6);
}

WSAConnect::~WSAConnect() = default;

} // namespace ws2_32
} // namespace windows
} // namespace introvirt

max_stars_repo_name: srpape/IntroVirt

max_issues_repo_name: srpape/IntroVirt

max_forks_repo_name: srpape/IntroVirt


text:
#ifndef PYTHONIC_NUMPY_ISPOSINF_HPP
#define PYTHONIC_NUMPY_ISPOSINF_HPP

#include "pythonic/include/numpy/isposinf.hpp"

#include "pythonic/utils/functor.hpp"
#include "pythonic/types/ndarray.hpp"
#include "pythonic/utils/numpy_traits.hpp"

#include <boost/simd/function/is_inf.hpp>
#include <boost/simd/function/is_positive.hpp>

PYTHONIC_NS_BEGIN

namespace numpy
{
  namespace wrapper
  {
    template <class T>
    bool isposinf(T const &t)
    {
      return boost::simd::is_inf(t) && boost::simd::is_positive(t);
    }
  }
#define NUMPY_NARY_FUNC_NAME isposinf
#define NUMPY_NARY_FUNC_SYM wrapper::isposinf
#include "pythonic/types/numpy_nary_expr.hpp"
}
PYTHONIC_NS_END

#endif

max_stars_repo_name: SylvainCorlay/pythran

max_issues_repo_name: SylvainCorlay/pythran

max_forks_repo_name: SylvainCorlay/pythran


text:
/**********************************************************************
*  Copyright (c) 2008-2014, Alliance for Sustainable Energy.
*  All rights reserved.
*
*  This library is free software; you can redistribute it and/or
*  modify it under the terms of the GNU Lesser General Public
*  License as published by the Free Software Foundation; either
*  version 2.1 of the License, or (at your option) any later version.
*
*  This library is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
*  Lesser General Public License for more details.
*
*  You should have received a copy of the GNU Lesser General Public
*  License along with this library; if not, write to the Free Software
*  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
**********************************************************************/

#include <gtest/gtest.h>

#include <utilities/sql/Test/SqlFileFixture.hpp>

#include <utilities/time/Date.hpp>
#include <utilities/time/Calendar.hpp>
#include <utilities/core/Optional.hpp>
#include <utilities/data/DataEnums.hpp>
#include <utilities/data/TimeSeries.hpp>
#include <utilities/document/Table.hpp>
#include <utilities/filetypes/EpwFile.hpp>
#include <utilities/plot/AnnotatedTimeline.hpp>
#include <utilities/plot/FloodPlot.hpp>
#include <utilities/plot/LinePlot.hpp>
#include <utilities/units/UnitFactory.hpp>

#include <resources.hxx>

#include <iostream>

#include <boost/foreach.hpp>

using namespace std;
using namespace boost;
using namespace openstudio;

TEST_F(SqlFileFixture, SummaryValues)
{
  // check values
  ASSERT_TRUE(sqlFile.netSiteEnergy());
  ASSERT_TRUE(sqlFile.totalSiteEnergy());
  ASSERT_TRUE(sqlFile.netSourceEnergy());
  ASSERT_TRUE(sqlFile.totalSourceEnergy());

  EXPECT_NEAR(224.91, *(sqlFile.netSiteEnergy()), 2);     // for 6.0, was 222.69
  EXPECT_NEAR(224.91, *(sqlFile.totalSiteEnergy()), 2);   // for 6.0, was 222.69
  EXPECT_NEAR(570.38, *(sqlFile.netSourceEnergy()), 2);   // for 6.0, was 564.41
  EXPECT_NEAR(570.38, *(sqlFile.totalSourceEnergy()), 2); // for 6.0, was 564.41
}

TEST_F(SqlFileFixture, EnvPeriods)
{
  std::vector<std::string> availableEnvPeriods = sqlFile.availableEnvPeriods();
  ASSERT_FALSE(availableEnvPeriods.empty());
  EXPECT_EQ(static_cast<unsigned>(1), availableEnvPeriods.size());
  //EXPECT_EQ("Chicago Ohare Intl Ap IL USA TMY3 WMO#=725300", availableEnvPeriods[0]);
  EXPECT_EQ("CHICAGO OHARE INTL AP IL USA TMY3 WMO#=725300", availableEnvPeriods[0]);
}

TEST_F(SqlFileFixture, TimeSeriesValues)
{
  std::vector<std::string> availableEnvPeriods = sqlFile.availableEnvPeriods();
  ASSERT_FALSE(availableEnvPeriods.empty());
  EXPECT_EQ(static_cast<unsigned>(1), availableEnvPeriods.size());
  //EXPECT_EQ("Chicago Ohare Intl Ap IL USA TMY3 WMO#=725300", availableEnvPeriods[0]);
  EXPECT_EQ("CHICAGO OHARE INTL AP IL USA TMY3 WMO#=725300", availableEnvPeriods[0]);

  openstudio::OptionalTimeSeries ts = sqlFile.timeSeries(availableEnvPeriods[0], "Hourly", "Site Outdoor Air Drybulb Temperature",  "Environment");
  ASSERT_TRUE(ts);
//  ASSERT_EQ(static_cast<unsigned>(8760), ts->dateTimes().size());
  ASSERT_EQ(static_cast<unsigned>(8760), ts->daysFromFirstReport().size());
  ASSERT_EQ(static_cast<unsigned>(8760), ts->values().size());
//  EXPECT_EQ(DateTime(Date(MonthOfYear::Jan, 1), Time(0,1,0,0)), ts->dateTimes().front());
  EXPECT_EQ(DateTime(Date(MonthOfYear::Jan, 1), Time(0,1,0,0)), ts->firstReportDateTime());
  EXPECT_DOUBLE_EQ(-8.2625, ts->values()[0]);
  EXPECT_DOUBLE_EQ(ts->outOfRangeValue(), ts->value(DateTime(Date(MonthOfYear::Jan, 1), Time(0,0,0,0))));
  // DLM: there is commented out code in openstudio::OptionalTime SqlFile_Impl::timeSeriesInterval(const DataDictionaryItem& dataDictionary)
  // that does not recognize hourly as an interval type, so the following line is not expected to work
  //EXPECT_DOUBLE_EQ(-8.2625, ts->value(DateTime(Date(MonthOfYear::Jan, 1), Time(0,0,0,1))));
  EXPECT_DOUBLE_EQ(-8.2625, ts->value(DateTime(Date(MonthOfYear::Jan, 1), Time(0,1,0,0))));
  EXPECT_DOUBLE_EQ(-11.8875, ts->value(DateTime(Date(MonthOfYear::Jan, 1), Time(0,1,0,1))));
//  EXPECT_EQ(DateTime(Date(MonthOfYear::Dec, 31), Time(0,24,0,0)), ts->dateTimes().back());
  EXPECT_EQ(DateTime(Date(MonthOfYear::Dec, 31), Time(0,24,0,0)), ts->firstReportDateTime()+Time(ts->daysFromFirstReport(ts->daysFromFirstReport().size()-1)));
  EXPECT_DOUBLE_EQ(-5.6875, ts->values()[8759]);
  EXPECT_DOUBLE_EQ(-4.775, ts->value(DateTime(Date(MonthOfYear::Dec, 31), Time(0,22,59,59))));
  EXPECT_DOUBLE_EQ(-4.775, ts->value(DateTime(Date(MonthOfYear::Dec, 31), Time(0,23,0,0))));
  EXPECT_DOUBLE_EQ(-5.6875, ts->value(DateTime(Date(MonthOfYear::Dec, 31), Time(0,23,0,1))));
  EXPECT_DOUBLE_EQ(-5.6875, ts->value(DateTime(Date(MonthOfYear::Dec, 31), Time(0,24,0,0))));
  EXPECT_DOUBLE_EQ(ts->outOfRangeValue(), ts->value(DateTime(Date(MonthOfYear::Dec, 31), Time(0,24,0,1))));

  ts = sqlFile.timeSeries(availableEnvPeriods[0], "HVAC System Timestep", "Site Outdoor Air Drybulb Temperature",  "Environment");
  ASSERT_TRUE(ts);
//  EXPECT_EQ(DateTime(Date(MonthOfYear::Jan, 1), Time(0,0,15,0)), ts->dateTimes().front());
  EXPECT_EQ(DateTime(Date(MonthOfYear::Jan, 1), Time(0,0,15,0)), ts->firstReportDateTime());
  EXPECT_DOUBLE_EQ(ts->outOfRangeValue(), ts->value(DateTime(Date(MonthOfYear::Jan, 1), Time(0,0,0,0))));
  EXPECT_DOUBLE_EQ(ts->outOfRangeValue(), ts->value(DateTime(Date(MonthOfYear::Jan, 1), Time(0,0,0,1))));
  EXPECT_DOUBLE_EQ(ts->outOfRangeValue(), ts->value(DateTime(Date(MonthOfYear::Jan, 1), Time(0,0,0,14))));
  EXPECT_DOUBLE_EQ(-4.325, ts->value(DateTime(Date(MonthOfYear::Jan, 1), Time(0,0,15,0))));
  EXPECT_DOUBLE_EQ(-6.95, ts->value(DateTime(Date(MonthOfYear::Jan, 1), Time(0,0,15,1))));
  EXPECT_DOUBLE_EQ(-6.95, ts->value(DateTime(Date(MonthOfYear::Jan, 1), Time(0,0,30,0))));
  EXPECT_DOUBLE_EQ(-12.2 , ts->value(DateTime(Date(MonthOfYear::Jan, 1), Time(0,1,0,0))));
//  EXPECT_EQ(DateTime(Date(MonthOfYear::Dec, 31), Time(0,24,0,0)), ts->dateTimes().back());
  EXPECT_EQ(DateTime(Date(MonthOfYear::Dec, 31), Time(0,24,0,0)), ts->firstReportDateTime()+Time(ts->daysFromFirstReport(ts->daysFromFirstReport().size()-1)));
  EXPECT_DOUBLE_EQ(-5.0  , ts->value(DateTime(Date(MonthOfYear::Dec, 31), Time(0,22,59,59))));
  EXPECT_DOUBLE_EQ(-5.0  , ts->value(DateTime(Date(MonthOfYear::Dec, 31), Time(0,23,0,0))));
  EXPECT_DOUBLE_EQ(-5.275, ts->value(DateTime(Date(MonthOfYear::Dec, 31), Time(0,23,0,1))));
  EXPECT_DOUBLE_EQ(-5.275, ts->value(DateTime(Date(MonthOfYear::Dec, 31), Time(0,23,15,0))));
  EXPECT_DOUBLE_EQ(-6.1  , ts->value(DateTime(Date(MonthOfYear::Dec, 31), Time(0,24,0,0))));
  EXPECT_DOUBLE_EQ(ts->outOfRangeValue(), ts->value(DateTime(Date(MonthOfYear::Dec, 31), Time(0,24,0,1))));
}

TEST_F(SqlFileFixture, TimeSeriesCount)
{
  std::vector<std::string> availableTimeSeries = sqlFile.availableTimeSeries();
  ASSERT_FALSE(availableTimeSeries.empty());

  std::vector<std::string> availableEnvPeriods = sqlFile.availableEnvPeriods();
  ASSERT_FALSE(availableEnvPeriods.empty());

  // check that "Electricity:Facility" is available
  ASSERT_EQ(1, std::count(availableTimeSeries.begin(), availableTimeSeries.end(), "Electricity:Facility"));
  openstudio::OptionalTimeSeries ts = sqlFile.timeSeries(availableEnvPeriods[0], "Hourly", "Electricity:Facility",  "");
  ASSERT_TRUE(ts);

  // check that "Gas:Facility" is available
  ASSERT_EQ(1, std::count(availableTimeSeries.begin(), availableTimeSeries.end(), "Gas:Facility"));
  ts = sqlFile.timeSeries(availableEnvPeriods[0], "Hourly", "Gas:Facility",  "");
  ASSERT_TRUE(ts);

  // check that "NotAVariable:Facility" is not available
  EXPECT_TRUE(availableTimeSeries.end() == std::find(availableTimeSeries.begin(), availableTimeSeries.end(), "NotAVariable:Facility"));
  ts = sqlFile.timeSeries(availableEnvPeriods[0], "Hourly", "NotAVariable:Facility",  "");
  EXPECT_FALSE(ts);

  // check that "Electricity:Facility" is available
  ASSERT_EQ(1, std::count(availableTimeSeries.begin(), availableTimeSeries.end(), "Electricity:Facility"));
  ts = sqlFile.timeSeries(availableEnvPeriods[0], "Run Period", "Electricity:Facility",  "");
  ASSERT_TRUE(ts);

  // check that "Gas:Facility" is available
  ASSERT_EQ(1, std::count(availableTimeSeries.begin(), availableTimeSeries.end(), "Gas:Facility"));
  ts = sqlFile.timeSeries(availableEnvPeriods[0], "Run Period", "Gas:Facility",  "");
  ASSERT_TRUE(ts);

  // check that "NotAVariable:Facility" is not available
  EXPECT_TRUE(availableTimeSeries.end() == std::find(availableTimeSeries.begin(), availableTimeSeries.end(), "NotAVariable:Facility"));
  ts = sqlFile.timeSeries(availableEnvPeriods[0], "Run Period", "NotAVariable:Facility",  "");
  EXPECT_FALSE(ts);
}

TEST_F(SqlFileFixture, AnnotatedTimeline)
{
  std::vector<std::string> availableEnvPeriods = sqlFile.availableEnvPeriods();
  ASSERT_FALSE(availableEnvPeriods.empty());

  // make a timeline
  openstudio::AnnotatedTimeline annotatedTimeline;

  // populate it
  openstudio::OptionalTimeSeries ts = sqlFile.timeSeries(availableEnvPeriods[0], "Hourly", "Electricity:Facility",  "");
  ASSERT_TRUE(ts);
  annotatedTimeline.addTimeSeries("Electricity:Facility", *ts);

  ts = sqlFile.timeSeries(availableEnvPeriods[0], "Hourly", "Gas:Facility",  "");
  ASSERT_TRUE(ts);
  annotatedTimeline.addTimeSeries("Gas:Facility", *ts);

  // save it
  annotatedTimeline.save(toPath("Building.html"));
  EXPECT_TRUE(true);
}

TEST_F(SqlFileFixture, FloodPlot)
{
  std::vector<std::string> availableEnvPeriods = sqlFile.availableEnvPeriods();
  ASSERT_FALSE(availableEnvPeriods.empty());

  // make a timeseries
  openstudio::OptionalTimeSeries ts = sqlFile.timeSeries(availableEnvPeriods[0], "Hourly", "Electricity:Facility",  "");
  ASSERT_TRUE(ts);

  // should have 365 days minus 1 hour
//  Time duration = ts->dateTimes().back() - ts->dateTimes().front();
  Time duration = ts->firstReportDateTime() + Time(ts->daysFromFirstReport(ts->daysFromFirstReport().size()-1)) - ts->firstReportDateTime();
  EXPECT_DOUBLE_EQ(365-1.0/24.0, duration.totalDays());

  // plot it
  FloodPlot::Ptr fp = FloodPlot::create();
  fp->timeseriesData(*ts);
  fp->generateImage(toPath("testFP.png"));
  EXPECT_TRUE(true);
}

TEST_F(SqlFileFixture, LinePlot)
{
  std::vector<std::string> availableEnvPeriods = sqlFile.availableEnvPeriods();
  ASSERT_FALSE(availableEnvPeriods.empty());

  // make a timeseries
  openstudio::OptionalTimeSeries ts = sqlFile.timeSeries(availableEnvPeriods[0], "Hourly", "Electricity:Facility",  "");
  ASSERT_TRUE(ts);

  // plot it
  LinePlot::Ptr lp = LinePlot::create();
  lp->timeseriesData(*ts, "Electricity:Facility");
  lp->generateImage(toPath("testLP.png"));
  EXPECT_TRUE(true);
}

TEST_F(SqlFileFixture, BadStatement)
{
  OptionalDouble result = sqlFile.execAndReturnFirstDouble("SELECT * FROM NonExistantTable");
  EXPECT_FALSE(result);
}

TEST_F(SqlFileFixture, CreateSqlFile)
{
  openstudio::path outfile = openstudio::tempDir() / openstudio::toPath("OpenStudioSqlFileTest.sql");
  if (boost::filesystem::exists(outfile))
  {
    boost::filesystem::remove(outfile);
  }

  openstudio::Calendar c(2012);
  c.standardHolidays();

  std::vector<double> values;
  values.push_back(100);
  values.push_back(10);
  values.push_back(1);
  values.push_back(100.5);

  TimeSeries timeSeries(c.startDate(), openstudio::Time(0,1), openstudio::createVector(values), "lux");

  {
    openstudio::SqlFile sql(outfile,
        openstudio::EpwFile(resourcesPath() / toPath("runmanager/USA_CO_Golden-NREL.724666_TMY3.epw")),
        openstudio::DateTime::now(),
        c);

    EXPECT_TRUE(sql.connectionOpen());

    sql.insertTimeSeriesData("Sum", "Zone", "Zone", "DAYLIGHTING WINDOW", "Daylight Luminance", openstudio::ReportingFrequency::Hourly,
        boost::optional<std::string>(), "lux", timeSeries);

    sql.insertZone("CLASSROOM",
        0,
        0,0,0,
        1,1,1,
        3,
        1,
        1,
        0, 2,
        0, 2,
        0, 2,
        2,
        8,
        3,
        3,
        4,
        4,
        2,
        2,
        true);

    std::vector<double> xs;
    std::vector<double> ys;
    xs.push_back(1.1);
    xs.push_back(2.2);
    xs.push_back(3.3);

    ys.push_back(2.8);
    ys.push_back(3.9);

    std::vector<DateTime> dates;
    dates.push_back(DateTime("2012-09-01 1:00"));
    dates.push_back(DateTime("2012-09-01 2:00"));

    std::vector<Matrix> maps;

    Matrix m1(3, 2);
    m1(0,0) = 0;
    m1(1,0) = 0.1;
    m1(2,0) = 0.2;
    m1(0,1) = 0.3;
    m1(1,1) = 0.4;
    m1(2,1) = 0.5;

    maps.push_back(m1);
    Matrix m2(3, 2);
    m1(0,0) = 2;
    m1(1,0) = 2.1;
    m1(2,0) = 2.2;
    m1(0,1) = 2.3;
    m1(1,1) = 2.4;
    m1(2,1) = 2.5;
    maps.push_back(m2);

    sql.insertIlluminanceMap("CLASSROOM", "CLASSROOM DAYLIGHT MAP", "GOLDEN",
      dates, xs, ys, 3.8, maps);
  }

  {
    openstudio::SqlFile sql(outfile);
    EXPECT_TRUE(sql.connectionOpen());
    std::vector<std::string> envPeriods = sql.availableEnvPeriods();
    ASSERT_EQ(envPeriods.size(), 1u);
    std::vector<std::string> reportingFrequencies = sql.availableReportingFrequencies(envPeriods[0]);
    ASSERT_EQ(reportingFrequencies.size(), 1u);
    std::vector<std::string> timeSeriesNames = sql.availableTimeSeries();
    ASSERT_EQ(reportingFrequencies.size(), 1u);
    std::vector<std::string> keyValues = sql.availableKeyValues(envPeriods[0], reportingFrequencies[0], timeSeriesNames[0]);
    ASSERT_EQ(keyValues.size(), 1u);

    boost::optional<TimeSeries> ts = sql.timeSeries(envPeriods[0], reportingFrequencies[0], timeSeriesNames[0], keyValues[0]);
    ASSERT_TRUE(ts);

    EXPECT_EQ(openstudio::toStandardVector(ts->values()), openstudio::toStandardVector(timeSeries.values()));
    EXPECT_EQ(openstudio::toStandardVector(ts->daysFromFirstReport()), openstudio::toStandardVector(timeSeries.daysFromFirstReport()));
  }

}

TEST_F(SqlFileFixture,MonthlyEndUsesTable) {
  Table electricity = monthlyEndUsesTable(sqlFile,EndUseFuelType::Electricity,createUnit("kWh").get());
  EXPECT_TRUE(electricity.nRows() > 2u);
  EXPECT_EQ("kWh",electricity.units(1));
  LOG(Info,"Electricity End Uses Table: " << std::endl
      << electricity.print(TableFormat::CSV) << std::endl
      << electricity.print(TableFormat::JSON));

  Table naturalGas = monthlyEndUsesTable(sqlFile,EndUseFuelType::Gas,createUnit("MBtu").get());
  EXPECT_TRUE(naturalGas.nRows() > 2u);
  EXPECT_EQ("MBtu",naturalGas.units(1));
  LOG(Info,"Natural Gas End Uses Table: " << std::endl
      << naturalGas.print(TableFormat::CSV) << std::endl
      << naturalGas.print(TableFormat::JSON));

  Table districtHeating = monthlyEndUsesTable(sqlFile,EndUseFuelType::DistrictHeating,createUnit("MBtu").get());
  EXPECT_TRUE(districtHeating.nRows() > 2u);
  EXPECT_EQ("MBtu",districtHeating.units(1));
  LOG(Info,"Natural Gas End Uses Table: " << std::endl
      << districtHeating.print(TableFormat::CSV) << std::endl
      << districtHeating.print(TableFormat::JSON));

  Table districtCooling = monthlyEndUsesTable(sqlFile,EndUseFuelType::DistrictCooling,createUnit("MBtu").get());
  EXPECT_TRUE(districtCooling.nRows() > 2u);
  EXPECT_EQ("MBtu",districtCooling.units(1));
  LOG(Info,"Natural Gas End Uses Table: " << std::endl
      << districtCooling.print(TableFormat::CSV) << std::endl
      << districtCooling.print(TableFormat::JSON));
}

ext: cpp

max_stars_repo_name: ORNL-BTRIC/OpenStudio

max_issues_repo_name: ORNL-BTRIC/OpenStudio

max_forks_repo_name: ORNL-BTRIC/OpenStudio


text:
/*=============================================================================
    Copyright (c) 2001-2010 Hartmut Kaiser
    Copyright (c) 2001-2010 Joel de Guzman

    Distributed under the Boost Software License, Version 1.0. (See accompanying
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_SPIRIT_ATTRIBUTES_FWD_OCT_01_2009_0715AM)
#define BOOST_SPIRIT_ATTRIBUTES_FWD_OCT_01_2009_0715AM

#if defined(_MSC_VER)
#pragma once
#endif

#include <boost/config.hpp>
#if (defined(__GNUC__) && (__GNUC__ < 4)) || \
    (defined(__APPLE__) && defined(__INTEL_COMPILER))
#include <boost/utility/enable_if.hpp>
#endif

///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit { namespace result_of
{
    // forward declaration only
    template <typename Exposed, typename Attribute>
    struct extract_from;

    template <typename Exposed, typename Transformed, typename Domain>
    struct pre_transform;

    template <typename T>
    struct optional_value;

    template <typename Container>
    struct begin;

    template <typename Container>
    struct end;

    template <typename Iterator>
    struct deref;
}}}

///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit { namespace traits
{
    ///////////////////////////////////////////////////////////////////////////
    // Determine if T is a proxy
    ///////////////////////////////////////////////////////////////////////////
    template <typename T, typename Enable = void>
    struct is_proxy;

    ///////////////////////////////////////////////////////////////////////////
    // Retrieve the attribute type to use from the given type
    //
    // This is needed to extract the correct attribute type from proxy classes
    // as utilized in FUSION_ADAPT_ADT et. al.
    ///////////////////////////////////////////////////////////////////////////
    template <typename Attribute, typename Enable = void>
    struct attribute_type;

    ///////////////////////////////////////////////////////////////////////////
    // Determines how we pass attributes to semantic actions. This
    // may be specialized. By default, all attributes are wrapped in
    // a fusion sequence, because the attribute has to be treated as being
    // a single value in any case (even if it actually already is a fusion
    // sequence in its own).
    ///////////////////////////////////////////////////////////////////////////
    template <typename Component, typename Attribute, typename Enable = void>
    struct pass_attribute;

    ///////////////////////////////////////////////////////////////////////////
    template <typename T, typename Enable = void>
    struct optional_attribute;

    ///////////////////////////////////////////////////////////////////////////
    // Sometimes the user needs to transform the attribute types for certain
    // attributes. This template can be used as a customization point, where
    // the user is able specify specific transformation rules for any attribute
    // type.
    ///////////////////////////////////////////////////////////////////////////
    template <typename Exposed, typename Transformed, typename Domain
      , typename Enable = void>
    struct transform_attribute;

    ///////////////////////////////////////////////////////////////////////////
    // Qi only
    template <typename Attribute, typename Iterator, typename Enable = void>
    struct assign_to_attribute_from_iterators;

    template <typename Iterator, typename Attribute>
    void assign_to(Iterator const& first, Iterator const& last, Attribute& attr);

    template <typename Iterator>
    void assign_to(Iterator const&, Iterator const&, unused_type);

    template <typename Attribute, typename T, typename Enable = void>
    struct assign_to_attribute_from_value;

    template <typename T, typename Attribute>
    void assign_to(T const& val, Attribute& attr);

    template <typename T>
    void assign_to(T const&, unused_type);

    ///////////////////////////////////////////////////////////////////////////
    // Karma only
    template <typename Attribute, typename Exposed, typename Enable = void>
    struct extract_from_attribute;

    template <typename Exposed, typename Attribute, typename Context>
    typename spirit::result_of::extract_from<Exposed, Attribute>::type
    extract_from(Attribute const& attr, Context& ctx
#if (defined(__GNUC__) && (__GNUC__ < 4)) || \
    (defined(__APPLE__) && defined(__INTEL_COMPILER))
      , typename enable_if<traits::not_is_unused<Attribute> >::type* = NULL
#endif
    );

    ///////////////////////////////////////////////////////////////////////////
    // return the type currently stored in the given variant
    ///////////////////////////////////////////////////////////////////////////
    template <typename T, typename Enable = void>
    struct variant_which;

    ///////////////////////////////////////////////////////////////////////////
    // Determine, whether T is a variant like type
    ///////////////////////////////////////////////////////////////////////////
    template <typename T, typename Domain = void>
    struct not_is_variant;

    ///////////////////////////////////////////////////////////////////////////
    // Clear data efficiently
    ///////////////////////////////////////////////////////////////////////////
    template <typename T, typename Enable = void>
    struct clear_value;

    ///////////////////////////////////////////////////////////////////////
    // Determine the value type of the given container type
    ///////////////////////////////////////////////////////////////////////
    template <typename Container, typename Enable = void>
    struct container_value;

    template <typename Container, typename Enable = void>
    struct container_iterator;

    template <typename T, typename Enable = void>
    struct is_container;

    ///////////////////////////////////////////////////////////////////////////
    // Qi only
    template <typename Container, typename T, typename Enable = void>
    struct push_back_container;

    template <typename Container, typename Enable = void>
    struct is_empty_container;

    ///////////////////////////////////////////////////////////////////////
    // Determine the iterator type of the given container type
    // Karma only
    ///////////////////////////////////////////////////////////////////////
    template <typename Container, typename Enable = void>
    struct begin_container;

    template <typename Container, typename Enable = void>
    struct end_container;

    template <typename Iterator, typename Enable = void>
    struct deref_iterator;

    template <typename Iterator, typename Enable = void>
    struct next_iterator;

    template <typename Iterator, typename Enable = void>
    struct compare_iterators;

    ///////////////////////////////////////////////////////////////////////////
    // Print the given attribute of type T to the stream given as Out
    ///////////////////////////////////////////////////////////////////////////
    template <typename Out, typename T, typename Enable = void>
    struct print_attribute_debug;

    template <typename Out, typename T>
    void print_attribute(Out&, T const&);

    template <typename Out>
    void print_attribute(Out&, unused_type);

    ///////////////////////////////////////////////////////////////////////////
    template <typename Char, typename Enable = void>
    struct token_printer_debug;

    template<typename Out, typename T>
    void print_token(Out&, T const&);

}}}

#endif


text:
/*=============================================================================
    Copyright (c) 2015 Paul Fultz II
    flow.h
    Distributed under the Boost Software License, Version 1.0. (See accompanying
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/

#ifndef BOOST_HOF_GUARD_FUNCTION_FLOW_H
#define BOOST_HOF_GUARD_FUNCTION_FLOW_H

/// flow
/// ====
///
/// Description
/// -----------
///
/// The `flow` function adaptor provides function composition. It is useful as
/// an alternative to using the pipe operator `|` when chaining functions. It is
/// similiar to [`compose`](compose.md) except the evaluation order is
/// reversed. So, `flow(f, g)(0)` is equivalent to `g(f(0))`.
///
///
/// Synopsis
/// --------
///
///     template<class... Fs>
///     constexpr flow_adaptor<Fs...> flow(Fs... fs);
///
/// Semantics
/// ---------
///
///     assert(flow(f, g)(xs...) == g(f(xs...)));
///
/// Requirements
/// ------------
///
/// Fs must be:
///
/// * [ConstInvocable](ConstInvocable)
/// * MoveConstructible
///
/// Example
/// -------
///
///     #include <boost/hof.hpp>
///     #include <cassert>
///     using namespace boost::hof;
///
///     struct increment
///     {
///         template<class T>
///         T operator()(T x) const
///         {
///             return x + 1;
///         }
///     };
///
///     struct decrement
///     {
///         template<class T>
///         T operator()(T x) const
///         {
///             return x - 1;
///         }
///     };
///
///     int main() {
///         int r = flow(increment(), decrement(), increment())(3);
///         assert(r == 4);
///     }
///
/// References
/// ----------
///
/// * [Function composition](https://en.wikipedia.org/wiki/Function_composition)
///

#include <boost/hof/detail/callable_base.hpp>
#include <boost/hof/always.hpp>
#include <boost/hof/detail/delegate.hpp>
#include <boost/hof/detail/compressed_pair.hpp>
#include <boost/hof/detail/join.hpp>
#include <tuple>
#include <boost/hof/detail/move.hpp>
#include <boost/hof/detail/make.hpp>
#include <boost/hof/detail/result_type.hpp>
#include <boost/hof/detail/static_const_var.hpp>

namespace boost { namespace hof { namespace detail {

template<class F1, class F2>
struct flow_kernel : detail::compressed_pair<detail::callable_base<F1>, detail::callable_base<F2>>, compose_function_result_type<F2, F1>
{
    typedef detail::compressed_pair<detail::callable_base<F1>, detail::callable_base<F2>> base_type;

    BOOST_HOF_INHERIT_CONSTRUCTOR(flow_kernel, base_type)

    BOOST_HOF_RETURNS_CLASS(flow_kernel);

    template<class... Ts>
    constexpr BOOST_HOF_SFINAE_RESULT(const detail::callable_base<F2>&, result_of<const detail::callable_base<F1>&, id_<Ts>...>)
    operator()(Ts&&... xs) const BOOST_HOF_SFINAE_RETURNS
    (
        BOOST_HOF_MANGLE_CAST(const detail::callable_base<F2>&)(BOOST_HOF_CONST_THIS->second(xs...))(
            BOOST_HOF_MANGLE_CAST(const detail::callable_base<F1>&)(BOOST_HOF_CONST_THIS->first(xs...))(BOOST_HOF_FORWARD(Ts)(xs)...)
        )
    );
};
}

template<class F, class... Fs>
struct flow_adaptor : detail::flow_kernel<F, BOOST_HOF_JOIN(flow_adaptor, Fs...)>
{
    typedef flow_adaptor fit_rewritable_tag;
    typedef BOOST_HOF_JOIN(flow_adaptor, Fs...) tail;
    typedef detail::flow_kernel<F, tail> base_type;

    BOOST_HOF_INHERIT_DEFAULT(flow_adaptor, base_type)

    template<class X, class... Xs,
        BOOST_HOF_ENABLE_IF_CONSTRUCTIBLE(detail::callable_base<F>, X),
        BOOST_HOF_ENABLE_IF_CONSTRUCTIBLE(tail, Xs...)
    >
    constexpr flow_adaptor(X&& f1, Xs&& ... fs)
    BOOST_HOF_NOEXCEPT(BOOST_HOF_IS_NOTHROW_CONSTRUCTIBLE(base_type, X&&, tail) && BOOST_HOF_IS_NOTHROW_CONSTRUCTIBLE(tail, Xs&&...))
    : base_type(BOOST_HOF_FORWARD(X)(f1), tail(BOOST_HOF_FORWARD(Xs)(fs)...))
    {}

    template<class X,
        BOOST_HOF_ENABLE_IF_CONSTRUCTIBLE(detail::callable_base<F>, X)
    >
    constexpr flow_adaptor(X&& f1)
    BOOST_HOF_NOEXCEPT_CONSTRUCTIBLE(base_type, X&&)
    : base_type(BOOST_HOF_FORWARD(X)(f1))
    {}
};

template<class F>
struct flow_adaptor<F> : detail::callable_base<F>
{
    typedef flow_adaptor fit_rewritable_tag;
    BOOST_HOF_INHERIT_DEFAULT(flow_adaptor, detail::callable_base<F>)

    template<class X, BOOST_HOF_ENABLE_IF_CONVERTIBLE(X, detail::callable_base<F>)>
    constexpr flow_adaptor(X&& f1)
    BOOST_HOF_NOEXCEPT_CONSTRUCTIBLE(detail::callable_base<F>, X&&)
    : detail::callable_base<F>(BOOST_HOF_FORWARD(X)(f1))
    {}

};

template<class F1, class F2>
struct flow_adaptor<F1, F2>
: detail::flow_kernel<detail::callable_base<F1>, detail::callable_base<F2>>
{
    typedef flow_adaptor fit_rewritable_tag;
    typedef detail::flow_kernel<detail::callable_base<F1>, detail::callable_base<F2>> base_type;

    BOOST_HOF_INHERIT_CONSTRUCTOR(flow_adaptor, base_type)
};

BOOST_HOF_DECLARE_STATIC_VAR(flow, detail::make<flow_adaptor>);

}} // namespace boost::hof

#endif


text:
#include <Python.h>

#include <boost/test/unit_test.hpp>

#include <ackward/core/Exceptions.hpp>
#include <ackward/datetime/Time.hpp>
#include <ackward/datetime/TimeDelta.hpp>

using namespace ackward::core;
using namespace ackward::datetime;

BOOST_AUTO_TEST_SUITE( timedelta )
BOOST_AUTO_TEST_SUITE( time )

BOOST_AUTO_TEST_CASE( constructor )
{
    Time t(1);
    t = Time(1,2);
    t = Time(1,2,3);
    t = Time(1,2,3,4);

    BOOST_CHECK_THROW(
        Time(24),
        ValueError);

    BOOST_CHECK_THROW(
        Time(1, 60),
        ValueError);

    BOOST_CHECK_THROW(
        Time(1,1,60),
        ValueError);

    BOOST_CHECK_THROW(
        Time(1,1,1,1000000),
        ValueError);
}

BOOST_AUTO_TEST_CASE( min )
{
    Time t = Time::min();
}

BOOST_AUTO_TEST_CASE( max )
{
    Time t = Time::max();
}

BOOST_AUTO_TEST_CASE( resolution )
{
    TimeDelta t = Time::resolution();
}

BOOST_AUTO_TEST_CASE( hour )
{
    for (unsigned int i = 0; i < 24; ++i) {
        Time t(i);
        BOOST_CHECK(t.hour == i);
    }
}

BOOST_AUTO_TEST_CASE( minute )
{
    for (unsigned int i = 0; i < 60; ++i)
    {
        Time t(1, i);
        BOOST_CHECK(t.minute == i);
    }
}

BOOST_AUTO_TEST_CASE( second )
{
    for (unsigned int i = 0; i < 60; ++i)
    {
        Time t(1, 1, i);
        BOOST_CHECK(t.second == i);
    }
}

BOOST_AUTO_TEST_CASE( microsecond )
{
    for (unsigned int i = 0; i < 1000000; i += 1000)
    {
        Time t(1,1,1,i);
        BOOST_CHECK(t.microsecond == i);
    }
}

BOOST_AUTO_TEST_CASE( lt )
{
    Time t1(1);
    Time t2(2);
    BOOST_CHECK( t1 < t2 );
}

BOOST_AUTO_TEST_CASE( replace )
{
    Time t(1,1,1,1);
    BOOST_CHECK( t.replace(2) == Time(2,1,1,1) );
}

BOOST_AUTO_TEST_CASE( isoformat )
{
    Time t(1, 2, 3, 4);
    std::string f = t.isoformat();
}

BOOST_AUTO_TEST_CASE( strftime )
{
    Time t(1,2,3,4);
    std::wstring s =
        t.strftime(L"%c");
}

BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE_END()

max_stars_repo_name: abingham/ackward

max_issues_repo_name: abingham/ackward

max_forks_repo_name: abingham/ackward


text:
/*
 * Copyright (c) 2015-2017, Intel Corporation
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *  * Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *  * Neither the name of Intel Corporation nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

/** \file
 * \brief Build code for McClellan DFA.
 */
#include "ng_mcclellan.h"

#include "grey.h"
#include "nfa/dfa_min.h"
#include "nfa/rdfa.h"
#include "ng_holder.h"
#include "ng_mcclellan_internal.h"
#include "ng_squash.h"
#include "ng_util.h"
#include "ue2common.h"
#include "util/bitfield.h"
#include "util/determinise.h"
#include "util/flat_containers.h"
#include "util/graph_range.h"
#include "util/hash.h"
#include "util/hash_dynamic_bitset.h"
#include "util/make_unique.h"
#include "util/report_manager.h"

#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <unordered_map>
#include <vector>

#include <boost/dynamic_bitset.hpp>

using namespace std;
using boost::dynamic_bitset;

namespace ue2 {

#define FINAL_DFA_STATE_LIMIT 16383
#define DFA_STATE_LIMIT 1024
#define NFA_STATE_LIMIT 256

u16 buildAlphabetFromEquivSets(const std::vector<CharReach> &esets,
                               array<u16, ALPHABET_SIZE> &alpha,
                               array<u16, ALPHABET_SIZE> &unalpha) {
    u16 i = 0;
    for (; i < esets.size(); i++) {
        const CharReach &cr = esets[i];

#ifdef DEBUG
        DEBUG_PRINTF("eq set: ");
        for (size_t s = cr.find_first(); s != CharReach::npos;
             s = cr.find_next(s)) {
            printf("%02hhx ", (u8)s);
        }
        printf("-> %u\n", i);
#endif
        u16 leader = cr.find_first();
        for (size_t s = cr.find_first(); s != CharReach::npos;
             s = cr.find_next(s)) {
            alpha[s] = i;
        }
        unalpha[i] = leader;
    }

    for (u16 j = N_CHARS; j < ALPHABET_SIZE; j++, i++) {
        alpha[j] = i;
        unalpha[i] = j;
    }

    return i; // alphabet size
}

void calculateAlphabet(const NGHolder &g, array<u16, ALPHABET_SIZE> &alpha,
                       array<u16, ALPHABET_SIZE> &unalpha, u16 *alphasize) {
    vector<CharReach> esets(1, CharReach::dot());

    for (auto v : vertices_range(g)) {
        if (is_special(v, g)) {
            continue;
        }

        const CharReach &cr = g[v].char_reach;

        for (size_t i = 0; i < esets.size(); i++) {
            if (esets[i].count() == 1) {
                continue;
            }

            CharReach t = cr & esets[i];
            if (t.any() && t != esets[i]) {
                esets[i] &= ~t;
                esets.push_back(t);
            }
        }
    }
    // for deterministic compiles
    sort(esets.begin(), esets.end());

    assert(alphasize);
    *alphasize = buildAlphabetFromEquivSets(esets, alpha, unalpha);
}

static
bool allExternalReports(const ReportManager &rm,
                        const flat_set<ReportID> &reports) {
    for (auto report_id : reports) {
        if (!isExternalReport(rm.getReport(report_id))) {
            return false;
        }
    }

    return true;
}

static
dstate_id_t successor(const vector<dstate> &dstates, dstate_id_t c,
                      const array<u16, ALPHABET_SIZE> &alpha, symbol_t s) {
    return dstates[c].next[alpha[s]];
}

void getFullTransitionFromState(const raw_dfa &n, dstate_id_t state,
                                dstate_id_t *out_table) {
    for (u32 i = 0; i < ALPHABET_SIZE; i++) {
        out_table[i] = successor(n.states, state, n.alpha_remap, i);
    }
}

template<typename stateset>
static
void populateInit(const NGHolder &g, const flat_set<NFAVertex> &unused,
                  stateset *init, stateset *init_deep,
                  vector<NFAVertex> *v_by_index) {
    for (auto v : vertices_range(g)) {
        if (contains(unused, v)) {
            continue;
        }

        u32 vert_id = g[v].index;
        assert(vert_id < init->size());

        if (is_any_start(v, g)) {
            init->set(vert_id);
            if (hasSelfLoop(v, g) || is_triggered(g)) {
                DEBUG_PRINTF("setting %u\n", vert_id);
                init_deep->set(vert_id);
            }
        }
    }

    v_by_index->clear();
    v_by_index->resize(num_vertices(g), NGHolder::null_vertex());

    for (auto v : vertices_range(g)) {
        u32 vert_id = g[v].index;
        assert((*v_by_index)[vert_id] == NGHolder::null_vertex());
        (*v_by_index)[vert_id] = v;
    }

    if (is_triggered(g)) {
        *init_deep = *init;
    }
}

template<typename StateSet>
void populateAccepts(const NGHolder &g, const flat_set<NFAVertex> &unused,
                     StateSet *accept, StateSet *acceptEod) {
    for (auto v : inv_adjacent_vertices_range(g.accept, g)) {
        if (contains(unused, v)) {
            continue;
        }
        accept->set(g[v].index);
    }
    for (auto v : inv_adjacent_vertices_range(g.acceptEod, g)) {
        if (v == g.accept) {
            continue;
        }
        if (contains(unused, v)) {
            continue;
        }
        acceptEod->set(g[v].index);
    }
}

static
bool canPruneEdgesFromAccept(const ReportManager &rm, const NGHolder &g) {
    bool seen = false;
    u32 ekey = 0;

    for (auto v : inv_adjacent_vertices_range(g.accept, g)) {
        if (is_special(v, g)) {
            continue;
        }

        for (auto report_id : g[v].reports) {
            const Report &ir = rm.getReport(report_id);

            if (!isSimpleExhaustible(ir)) {
                return false;
            }

            if (!seen) {
                seen = true;
                ekey = ir.ekey;
            } else if (ekey != ir.ekey) {
                return false;
            }
        }
    }

    /* need to check accept eod does not have any unseen reports as well */
    for (auto v : inv_adjacent_vertices_range(g.acceptEod, g)) {
        if (is_special(v, g)) {
            continue;
        }

        for (auto report_id : g[v].reports) {
            const Report &ir = rm.getReport(report_id);

            if (!isSimpleExhaustible(ir)) {
                return false;
            }

            if (!seen) {
                seen = true;
                ekey = ir.ekey;
            } else if (ekey != ir.ekey) {
                return false;
            }
        }
    }

    return true;
}

static
bool overhangMatchesTrigger(const vector<vector<CharReach> > &all_triggers,
                            vector<CharReach>::const_reverse_iterator itb,
                            vector<CharReach>::const_reverse_iterator ite) {
    for (const auto &trigger : all_triggers) {
        vector<CharReach>::const_reverse_iterator it = itb;
        vector<CharReach>::const_reverse_iterator kt = trigger.rbegin();
        for (; it != ite && kt != trigger.rend(); ++it, ++kt) {
            if ((*it & *kt).none()) {
                /* this trigger does not match the overhang, try next */
                goto try_next_trigger;
            }
        }

        return true;
    try_next_trigger:;
    }

    return false; /* no trigger matches the over hang */
}

static
bool triggerAllowed(const NGHolder &g, const NFAVertex v,
                    const vector<vector<CharReach> > &all_triggers,
                    const vector<CharReach> &trigger) {
    flat_set<NFAVertex> curr({v});
    flat_set<NFAVertex> next;

    for (auto it = trigger.rbegin(); it != trigger.rend(); ++it) {
        next.clear();

        for (auto u : curr) {
            assert(u != g.startDs); /* triggered graphs should not use sds */
            if (u == g.start) {
                if (overhangMatchesTrigger(all_triggers, it, trigger.rend())) {
                    return true;
                }
                continue;
            }

            if ((g[u].char_reach & *it).none()) {
                continue;
            }
            insert(&next, inv_adjacent_vertices(u, g));
        }

        if (next.empty()) {
            return false;
        }

        next.swap(curr);
    }

    return true;
}

void markToppableStarts(const NGHolder &g, const flat_set<NFAVertex> &unused,
                        bool single_trigger,
                        const vector<vector<CharReach>> &triggers,
                        dynamic_bitset<> *out) {
    if (single_trigger) {
        return; /* no live states can lead to new states */
    }

    for (auto v : vertices_range(g)) {
        if (contains(unused, v)) {
            continue;
        }
        for (const auto &trigger : triggers) {
            if (triggerAllowed(g, v, triggers, trigger)) {
                DEBUG_PRINTF("idx %zu is valid location for top\n", g[v].index);
                out->set(g[v].index);
                break;
            }
        }
    }

    assert(out->test(g[g.start].index));
}

namespace {

template<typename Automaton_Traits>
class Automaton_Base {
public:
    using StateSet = typename Automaton_Traits::StateSet;
    using StateMap = typename Automaton_Traits::StateMap;

    Automaton_Base(const ReportManager *rm_in, const NGHolder &graph_in,
                   bool single_trigger,
                   const vector<vector<CharReach>> &triggers, bool prunable_in)
        : rm(rm_in), graph(graph_in), numStates(num_vertices(graph)),
          unused(getRedundantStarts(graph_in)),
          init(Automaton_Traits::init_states(numStates)),
          initDS(Automaton_Traits::init_states(numStates)),
          squash(Automaton_Traits::init_states(numStates)),
          accept(Automaton_Traits::init_states(numStates)),
          acceptEod(Automaton_Traits::init_states(numStates)),
          toppable(Automaton_Traits::init_states(numStates)),
          dead(Automaton_Traits::init_states(numStates)),
          prunable(prunable_in) {
        populateInit(graph, unused, &init, &initDS, &v_by_index);
        populateAccepts(graph, unused, &accept, &acceptEod);

        start_anchored = DEAD_STATE + 1;
        if (initDS == init) {
            start_floating = start_anchored;
        } else if (initDS.any()) {
            start_floating = start_anchored + 1;
        } else {
            start_floating = DEAD_STATE;
        }

        calculateAlphabet(graph, alpha, unalpha, &alphasize);

        for (const auto &sq : findSquashers(graph)) {
            NFAVertex v = sq.first;
            u32 vert_id = graph[v].index;
            squash.set(vert_id);
            squash_mask[vert_id]
                = Automaton_Traits::copy_states(std::move(sq.second),
                                                numStates);
        }

        cr_by_index = populateCR(graph, v_by_index, alpha);
        if (is_triggered(graph)) {
            dynamic_bitset<> temp(numStates);
            markToppableStarts(graph, unused, single_trigger, triggers,
                               &temp);
            toppable = Automaton_Traits::copy_states(std::move(temp),
                                                     numStates);
        }
    }

public:
    void transition(const StateSet &in, StateSet *next) {
        transition_graph(*this, v_by_index, in, next);
    }

    const vector<StateSet> initial() {
        vector<StateSet> rv = {init};
        if (start_floating != DEAD_STATE && start_floating != start_anchored) {
            rv.push_back(initDS);
        }
        return rv;
    }

private:
    void reports_i(const StateSet &in, bool eod, flat_set<ReportID> &rv) {
        StateSet acc = in & (eod ? acceptEod : accept);
        for (size_t i = acc.find_first(); i != StateSet::npos;
             i = acc.find_next(i)) {
            NFAVertex v = v_by_index[i];
            DEBUG_PRINTF("marking report\n");
            const auto &my_reports = graph[v].reports;
            rv.insert(my_reports.begin(), my_reports.end());
        }
    }

public:
    void reports(const StateSet &in, flat_set<ReportID> &rv) {
        reports_i(in, false, rv);
    }
    void reportsEod(const StateSet &in, flat_set<ReportID> &rv) {
        reports_i(in, true, rv);
    }

    bool canPrune(const flat_set<ReportID> &test_reports) const {
        if (!rm || !prunable || !canPruneEdgesFromAccept(*rm, graph)) {
            return false;
        }
        return allExternalReports(*rm, test_reports);
    }

private:
    const ReportManager *rm;
public:
    const NGHolder &graph;
    u32 numStates;
    const flat_set<NFAVertex> unused;
    vector<NFAVertex> v_by_index;
    vector<CharReach> cr_by_index; /* pre alpha'ed */
    StateSet init;
    StateSet initDS;
    StateSet squash; /* states which allow us to mask out other states */
    StateSet accept;
    StateSet acceptEod;
    StateSet toppable; /* states which are allowed to be on when a top arrives,
                        * triggered dfas only */
    StateSet dead;
    map<u32, StateSet> squash_mask;
    bool prunable;
    array<u16, ALPHABET_SIZE> alpha;
    array<u16, ALPHABET_SIZE> unalpha;
    u16 alphasize;

    u16 start_anchored;
    u16 start_floating;
};

struct Big_Traits {
    using StateSet = dynamic_bitset<>;
    using StateMap = unordered_map<StateSet, dstate_id_t, hash_dynamic_bitset>;

    static StateSet init_states(u32 num) {
        return StateSet(num);
    }

    static StateSet copy_states(dynamic_bitset<> in, UNUSED u32 num) {
        assert(in.size() == num);
        return in;
    }
};

class Automaton_Big : public Automaton_Base<Big_Traits> {
public:
    Automaton_Big(const ReportManager *rm_in, const NGHolder &graph_in,
                  bool single_trigger,
                  const vector<vector<CharReach>> &triggers, bool prunable_in)
        : Automaton_Base(rm_in, graph_in, single_trigger, triggers,
                         prunable_in) {}
};

struct Graph_Traits {
    using StateSet = bitfield<NFA_STATE_LIMIT>;
    using StateMap = unordered_map<StateSet, dstate_id_t>;

    static StateSet init_states(UNUSED u32 num) {
        assert(num <= NFA_STATE_LIMIT);
        return StateSet();
    }

    static StateSet copy_states(const dynamic_bitset<> &in, u32 num) {
        StateSet out = init_states(num);
        for (size_t i = in.find_first(); i != in.npos && i < out.size();
             i = in.find_next(i)) {
            out.set(i);
        }
        return out;
    }
};

class Automaton_Graph : public Automaton_Base<Graph_Traits> {
public:
    Automaton_Graph(const ReportManager *rm_in, const NGHolder &graph_in,
                    bool single_trigger,
                    const vector<vector<CharReach>> &triggers, bool prunable_in)
        : Automaton_Base(rm_in, graph_in, single_trigger, triggers,
                         prunable_in) {}
};

} // namespace

static
bool startIsRedundant(const NGHolder &g) {
    set<NFAVertex> start;
    set<NFAVertex> startDs;

    insert(&start, adjacent_vertices(g.start, g));
    insert(&startDs, adjacent_vertices(g.startDs, g));

    return start == startDs;
}

flat_set<NFAVertex> getRedundantStarts(const NGHolder &g) {
    flat_set<NFAVertex> dead;
    if (startIsRedundant(g)) {
        dead.insert(g.start);
    }
    if (proper_out_degree(g.startDs, g) == 0) {
        dead.insert(g.startDs);
    }
    return dead;
}

unique_ptr<raw_dfa> buildMcClellan(const NGHolder &graph,
                                   const ReportManager *rm, bool single_trigger,
                                   const vector<vector<CharReach>> &triggers,
                                   const Grey &grey, bool finalChance) {
    if (!grey.allowMcClellan) {
        return nullptr;
    }

    DEBUG_PRINTF("attempting to build ?%d? mcclellan\n", (int)graph.kind);
    assert(allMatchStatesHaveReports(graph));

    bool prunable = grey.highlanderPruneDFA && has_managed_reports(graph);
    assert(rm || !has_managed_reports(graph));
    if (!has_managed_reports(graph)) {
        rm = nullptr;
    }

    assert(triggers.empty() == !is_triggered(graph));

    /* We must be getting desperate if it is an outfix, so use the final chance
     * state limit logic */
    u32 state_limit
        = (graph.kind == NFA_OUTFIX || finalChance) ? FINAL_DFA_STATE_LIMIT
                                                    : DFA_STATE_LIMIT;

    const u32 numStates = num_vertices(graph);
    DEBUG_PRINTF("determinising nfa with %u vertices\n", numStates);

    if (numStates > FINAL_DFA_STATE_LIMIT) {
        DEBUG_PRINTF("rejecting nfa as too many vertices\n");
        return nullptr;
    }

    auto rdfa = ue2::make_unique<raw_dfa>(graph.kind);

    if (numStates <= NFA_STATE_LIMIT) {
        /* Fast path. Automaton_Graph uses a bitfield internally to represent
         * states and is quicker than Automaton_Big. */
        Automaton_Graph n(rm, graph, single_trigger, triggers, prunable);
        if (!determinise(n, rdfa->states, state_limit)) {
            DEBUG_PRINTF("state limit exceeded\n");
            return nullptr; /* over state limit */
        }

        rdfa->start_anchored = n.start_anchored;
        rdfa->start_floating = n.start_floating;
        rdfa->alpha_size = n.alphasize;
        rdfa->alpha_remap = n.alpha;
    } else {
        /* Slow path. Too many states to use Automaton_Graph. */
        Automaton_Big n(rm, graph, single_trigger, triggers, prunable);
        if (!determinise(n, rdfa->states, state_limit)) {
            DEBUG_PRINTF("state limit exceeded\n");
            return nullptr; /* over state limit */
        }

        rdfa->start_anchored = n.start_anchored;
        rdfa->start_floating = n.start_floating;
        rdfa->alpha_size = n.alphasize;
        rdfa->alpha_remap = n.alpha;
    }

    minimize_hopcroft(*rdfa, grey);

    DEBUG_PRINTF("after determinised into %zu states, building impl dfa "
                 "(a,f) = (%hu,%hu)\n", rdfa->states.size(),
                 rdfa->start_anchored, rdfa->start_floating);

    return rdfa;
}

unique_ptr<raw_dfa> buildMcClellan(const NGHolder &g, const ReportManager *rm,
                                   const Grey &grey) {
    assert(!is_triggered(g));
    vector<vector<CharReach>> triggers;
    return buildMcClellan(g, rm, false, triggers, grey);
}

} // namespace ue2


text:
#ifndef _EULERIVPODESOLVERTEST_HPP_
#define _EULERIVPODESOLVERTEST_HPP_

#include "ChasteSerialization.hpp"
#include <boost/serialization/base_object.hpp>
#include <iostream>
#include "AbstractOneStepIvpOdeSolver.hpp"

/**
 * A concrete one step ODE solver class that employs the forward Euler
 * method. This numerical method is explicit.
 */
class EulerIvpOdeSolver_test : public AbstractOneStepIvpOdeSolver
{
private:

    /** Needed for serialization. */
    friend class boost::serialization::access;
    /**
     * Archive the abstract IVP Solver, never used directly - boost uses this.
     *
     * @param archive the archive
     * @param version the current version of this class
     */
    template<class Archive>
    void serialize(Archive & archive, const unsigned int version)
    {
        // This calls serialize on the base class.
        archive & boost::serialization::base_object<AbstractOneStepIvpOdeSolver>(*this);
    }

protected:

    /**
     * Calculate the solution to the ODE system at the next timestep.
     *
     * A usage example:
     *     EulerIvpOdeSolver_test mySolver;
     *     OdeSolution solution = mySolver.Solve(pMyOdeSystem, yInit, StartTime, EndTime, TimeStep, SamplingTime);
     *
     * @param pAbstractOdeSystem  the ODE system to solve
     * @param timeStep  dt
     * @param time  the current time
     * @param rCurrentYValues  the current (initial) state
     * @param rNextYValues  the state at the next timestep
     */
    void CalculateNextYValue(AbstractOdeSystem* pAbstractOdeSystem,
                             double timeStep,
                             double time,
                             std::vector<double>& rCurrentYValues,
                             std::vector<double>& rNextYValues);

public:

    /**
     * Constructor.
     */
    EulerIvpOdeSolver_test()
    {}

    /**
     * Destructor.
     */
    virtual ~EulerIvpOdeSolver_test()
    {}
};

#endif //_EulerIvpOdeSolver_test_HPP_

max_stars_repo_name: OSS-Lab/ChemChaste

max_issues_repo_name: OSS-Lab/ChemChaste

max_forks_repo_name: OSS-Lab/ChemChaste


text:
// Copyright (C) 2006 Douglas Gregor <doug.gregor -at- gmail.com>

// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

/** @file environment.hpp
 *
 *  This header provides the @c environment class, which provides
 *  routines to initialize, finalization, and query the status of the
 *  Boost MPI environment.
 */
#ifndef BOOST_MPI_ENVIRONMENT_HPP
#define BOOST_MPI_ENVIRONMENT_HPP

#include <boost/mpi/config.hpp>
#include <boost/noncopyable.hpp>
#include <boost/optional.hpp>
#include <string>
#include <iosfwd>

namespace boost { namespace mpi {
namespace threading {
/** @brief specify the supported threading level.
 *
 * Based on MPI 2 standard/8.7.3
 */
enum level {
  /** Only one thread will execute.
   */
  single     = MPI_THREAD_SINGLE,
  /** Only main thread will do MPI calls.
   *
   * The process may be multi-threaded, but only the main
   * thread will make MPI calls (all MPI calls are ``funneled''
   * to the main thread).
   */
  funneled   = MPI_THREAD_FUNNELED,
  /** Only one thread at the time do MPI calls.
   *
   * The process may be multi-threaded, and multiple
   * threads may make MPI calls, but only one at a time:
   * MPI calls are not made concurrently from two distinct
   * threads (all MPI calls are ``serialized'').
   */
  serialized = MPI_THREAD_SERIALIZED,
  /** Multiple thread may do MPI calls.
   *
   * Multiple threads may call MPI, with no restrictions.
   */
  multiple   = MPI_THREAD_MULTIPLE
};

/** Formated output for threading level. */
std::ostream& operator<<(std::ostream& out, level l);

/** Formated input for threading level. */
std::istream& operator>>(std::istream& in, level& l);
} // namespace threading
/** @brief Initialize, finalize, and query the MPI environment.
 *
 *  The @c environment class is used to initialize, finalize, and
 *  query the MPI environment. It will typically be used in the @c
 *  main() function of a program, which will create a single instance
 *  of @c environment initialized with the arguments passed to the
 *  program:
 *
 *  @code
 *  int main(int argc, char* argv[])
 *  {
 *    mpi::environment env(argc, argv);
 *  }
 *  @endcode
 *
 *  The instance of @c environment will initialize MPI (by calling @c
 *  MPI_Init) in its constructor and finalize MPI (by calling @c
 *  MPI_Finalize for normal termination or @c MPI_Abort for an
 *  uncaught exception) in its destructor.
 *
 *  The use of @c environment is not mandatory. Users may choose to
 *  invoke @c MPI_Init and @c MPI_Finalize manually. In this case, no
 *  @c environment object is needed. If one is created, however, it
 *  will do nothing on either construction or destruction.
 */
class BOOST_MPI_DECL environment : noncopyable {
public:
#ifdef BOOST_MPI_HAS_NOARG_INITIALIZATION
  /** Initialize the MPI environment.
   *
   *  If the MPI environment has not already been initialized,
   *  initializes MPI with a call to @c MPI_Init. Since this
   *  constructor does not take command-line arguments (@c argc and @c
   *  argv), it is only available when the underlying MPI
   *  implementation supports calling @c MPI_Init with @c NULL
   *  arguments, indicated by the macro @c
   *  BOOST_MPI_HAS_NOARG_INITIALIZATION.
   *
   *  @param abort_on_exception When true, this object will abort the
   *  program if it is destructed due to an uncaught exception.
   */
  explicit environment(bool abort_on_exception = true);
  /** Initialize the MPI environment.
   *
   *  If the MPI environment has not already been initialized,
   *  initializes MPI with a call to @c MPI_Init_thread. Since this
   *  constructor does not take command-line arguments (@c argc and @c
   *  argv), it is only available when the underlying MPI
   *  implementation supports calling @c MPI_Init with @c NULL
   *  arguments, indicated by the macro @c
   *  BOOST_MPI_HAS_NOARG_INITIALIZATION.
   *
   *  @param mt_level the required level of threading support.
   *
   *  @param abort_on_exception When true, this object will abort the
   *  program if it is destructed due to an uncaught exception.
   */
  explicit environment(threading::level mt_level, bool abort_on_exception = true);
#endif

  /** Initialize the MPI environment.
   *
   *  If the MPI environment has not already been initialized,
   *  initializes MPI with a call to @c MPI_Init.
   *
   *  @param argc The number of arguments provided in @p argv, as
   *  passed into the program's @c main function.
   *
   *  @param argv The array of argument strings passed to the program
   *  via @c main.
   *
   *  @param abort_on_exception When true, this object will abort the
   *  program if it is destructed due to an uncaught exception.
   */
  environment(int& argc, char** &argv, bool abort_on_exception = true);

  /** Initialize the MPI environment.
   *
   *  If the MPI environment has not already been initialized,
   *  initializes MPI with a call to @c MPI_Init_thread.
   *
   *  @param argc The number of arguments provided in @p argv, as
   *  passed into the program's @c main function.
   *
   *  @param argv The array of argument strings passed to the program
   *  via @c main.
   *
   *  @param mt_level the required level of threading support
   *
   *  @param abort_on_exception When true, this object will abort the
   *  program if it is destructed due to an uncaught exception.
   */
  environment(int& argc, char** &argv, threading::level mt_level,
              bool abort_on_exception = true);

  /** Shuts down the MPI environment.
   *
   *  If this @c environment object was used to initialize the MPI
   *  environment, and the MPI environment has not already been shut
   *  down (finalized), this destructor will shut down the MPI
   *  environment. Under normal circumstances, this only involves
   *  invoking @c MPI_Finalize. However, if destruction is the result
   *  of an uncaught exception and the @c abort_on_exception parameter
   *  of the constructor had the value @c true, this destructor will
   *  invoke @c MPI_Abort with @c MPI_COMM_WORLD to abort the entire
   *  MPI program with a result code of -1.
   */
  ~environment();

  /** Abort all MPI processes.
   *
   *  Aborts all MPI processes and returns to the environment. The
   *  precise behavior will be defined by the underlying MPI
   *  implementation. This is equivalent to a call to @c MPI_Abort
   *  with @c MPI_COMM_WORLD.
   *
   *  @param errcode The error code to return to the environment.
   *  @returns Will not return.
   */
  static void abort(int errcode);

  /** Determine if the MPI environment has already been initialized.
   *
   *  This routine is equivalent to a call to @c MPI_Initialized.
   *
   *  @returns @c true if the MPI environment has been initialized.
   */
  static bool initialized();

  /** Determine if the MPI environment has already been finalized.
   *
   *  The routine is equivalent to a call to @c MPI_Finalized.
   *
   *  @returns @c true if the MPI environment has been finalized.
   */
  static bool finalized();

  /** Retrieves the maximum tag value.
   *
   *  Returns the maximum value that may be used for the @c tag
   *  parameter of send/receive operations. This value will be
   *  somewhat smaller than the value of @c MPI_TAG_UB, because the
   *  Boost.MPI implementation reserves some tags for collective
   *  operations.
   *
   *  @returns the maximum tag value.
   */
  static int max_tag();

  /** The tag value used for collective operations.
   *
   *  Returns the reserved tag value used by the Boost.MPI
   *  implementation for collective operations. Although users are not
   *  permitted to use this tag to send or receive messages, it may be
   *  useful when monitoring communication patterns.
   *
   * @returns the tag value used for collective operations.
   */
  static int collectives_tag();

  /** Retrieves the rank of the host process, if one exists.
   *
   *  If there is a host process, this routine returns the rank of
   *  that process. Otherwise, it returns an empty @c
   *  optional<int>. MPI does not define the meaning of a "host"
   *  process: consult the documentation for the MPI
   *  implementation. This routine examines the @c MPI_HOST attribute
   *  of @c MPI_COMM_WORLD.
   *
   *  @returns The rank of the host process, if one exists.
   */
  static optional<int> host_rank();

  /** Retrieves the rank of a process that can perform input/output.
   *
   *  This routine returns the rank of a process that can perform
   *  input/output via the standard C and C++ I/O facilities. If every
   *  process can perform I/O using the standard facilities, this
   *  routine will return @c any_source; if no process can perform
   *  I/O, this routine will return no value (an empty @c
   *  optional). This routine examines the @c MPI_IO attribute of @c
   *  MPI_COMM_WORLD.
   *
   *  @returns the rank of the process that can perform I/O, @c
   *  any_source if every process can perform I/O, or no value if no
   *  process can perform I/O.
   */
  static optional<int> io_rank();

  /** Retrieve the name of this processor.
   *
   *  This routine returns the name of this processor. The actual form
   *  of the name is unspecified, but may be documented by the
   *  underlying MPI implementation. This routine is implemented as a
   *  call to @c MPI_Get_processor_name.
   *
   *  @returns the name of this processor.
   */
  static std::string processor_name();

  /** Query the current level of thread support.
   */
  static threading::level thread_level();

  /** Are we in the main thread?
   */
  static bool is_main_thread();

  /** @brief MPI version.
   *
   * Returns a pair with the version and sub-version number.
   */
  static std::pair<int, int> version();

private:
  /// Whether this environment object called MPI_Init
  bool i_initialized;

  /// Whether we should abort if the destructor is
  bool abort_on_exception;

  /// The number of reserved tags.
  static const int num_reserved_tags = 1;
};

} } // end namespace boost::mpi

#endif // BOOST_MPI_ENVIRONMENT_HPP

max_stars_repo_name: kindlychung/mediasoup-sfu-cpp

max_issues_repo_name: kindlychung/mediasoup-sfu-cpp

max_forks_repo_name: kindlychung/mediasoup-sfu-cpp


text:
// generate by pypp
// original source code: ISOBMFF/IROT.hpp

#include <boost/python.hpp>

#include "ISOBMFF/IROT.hpp"
#include "ISOBMFF/Parser.hpp"

class IROTWrapper :
    public ISOBMFF::IROT,
    public boost::python::wrapper<ISOBMFF::IROT>
{
public:
    using ISOBMFF::IROT::IROT;
    void ReadData (ISOBMFF::Parser & parser, ISOBMFF::BinaryStream & stream) override {
        if ( auto ReadData = this->get_override("ReadData") ) {
            ReadData(parser, stream);
        } else {
            IROT::ReadData(parser, stream);
        }
    }
    std::vector<std::pair<std::string, std::string> > GetDisplayableProperties () const override {
        if ( auto GetDisplayableProperties = this->get_override("GetDisplayableProperties") ) {
            return GetDisplayableProperties();
        } else {
            return IROT::GetDisplayableProperties();
        }
    }
};

void init_ISOBMFF_IROT_hpp() {
    boost::python::class_<IROTWrapper, boost::python::bases<ISOBMFF::Box>, std::shared_ptr<ISOBMFF::IROT>>("IROT")
        .def("ReadData", &ISOBMFF::IROT::ReadData)
        .def("GetDisplayableProperties", &ISOBMFF::IROT::GetDisplayableProperties)
        .def("GetAngle", &ISOBMFF::IROT::GetAngle)
        .def("SetAngle", &ISOBMFF::IROT::SetAngle)
        ;
}

max_stars_repo_name: mugwort-rc/python-ISOBMFF

max_issues_repo_name: mugwort-rc/python-ISOBMFF

max_forks_repo_name: mugwort-rc/python-ISOBMFF