Beispiel #1
0
MonomDRL::MonomDRL(const std::string& str)
    : Monom()
    , Next(0)
{
    std::stringstream tmpStream(str); 
    tmpStream >> *this;
}
void ProxyGroup::startLoading(void)
{
#ifdef OSG_OLD_RENDER_ACTION
    if(getConcurrentLoad() == false)
    {
        if(getMFInline()->size() == 0)
        {
            _loadedRoot = SceneFileHandler::the()->read(
                getAbsoluteUrl().c_str());
        }
        else
        {
            std::stringstream tmpStream(std::ios_base::in    |
                                        std::ios_base::out   |
                                        std::ios_base::binary);

            tmpStream.write(
                reinterpret_cast<const char*>(&getMFInline()->front()), 
                getMFInline()->size ());

            _loadedRoot = SceneFileHandler::the()->read(tmpStream, "osb");
        }

        setState(LOAD_THREAD_FINISHED);
    }
    else
    {
        if(_loadLock == NULL)
        {
            _loadLock = Lock::get("ProxyGroupLoadLock");
        }

        _loadLock->acquire();
        
        bool noThread = _loadQueue.empty();
        
        _loadQueue.push(this);

        setState(LOAD_THREAD_RUNNING);
        
        _loadLock->release();
        
        if(noThread)
        {
            if(_loadThread)
                BaseThread::join(_loadThread);

            _loadThread = dynamic_cast<Thread *>(
                ThreadManager::the()->getThread(NULL));

            _loadThread->runFunction(loadProc, 
                                     Thread::getCurrentAspect(),
                                     NULL                     );
        }
    }
#endif
}
Beispiel #3
0
  void InfoBitRanker::writeTopBitsToFile(std::string fileName) const {
    std::ofstream tmpStream(fileName.c_str());
    if ((!tmpStream) || (tmpStream.bad()) ) {
      std::ostringstream errout;
      errout << "Bad output file " << fileName;
      throw RDKit::FileParseException(errout.str());
    }

    std::ostream &outStream = static_cast<std::ostream &>(tmpStream);
    this->writeTopBitsToStream(&outStream);
  }
void ProxyGroup::loadProc(void *)
{
#ifdef OSG_OLD_RENDER_ACTION
    bool stopThread = false;

    ProxyGroup *g;

    _loadLock->acquire();

    g = _loadQueue.front();

    _loadLock->release();

    while(!stopThread)
    {
        if(g->getMFInline()->size() == 0) 
        {
            g->_loadedRoot=SceneFileHandler::the()->read(
                g->getAbsoluteUrl().c_str());
        }
        else
        {
            std::stringstream tmpStream(std::ios_base::in    |
                                        std::ios_base::out   |
                                        std::ios_base::binary);

            tmpStream.write(
                reinterpret_cast<const char *>(&g->getMFInline()->front()),
                g->getMFInline()->size());

            g->_loadedRoot = SceneFileHandler::the()->read(tmpStream, "osb");
        }

        g->setState(LOAD_THREAD_FINISHED);
        
        _loadLock->acquire();

        _loadQueue.pop();

        if(_loadQueue.empty())
        {
            stopThread=true;
        }
        else
        {
            g=_loadQueue.front();
        }

        _loadLock->release();
    }
#endif
}
Beispiel #5
0
VOID TempFileTest()
{
   CHAR tmpl[18] = "/tmp/test.XXXXXX";
   CHAR* filename = CreateTmpFileName(tmpl);

   fstream tmpStream(filename);
   TEST(tmpStream.is_open(), "Fail to open "+string(filename)+"\n");
   //printf("%s is now opened\n", filename);

   tmpStream.close();

   INT32 removed = remove(filename);
   TEST(removed == 0, "Can't remove tmp file "+string(filename)+"\n");
   //printf("%s is now removed\n", filename);
}
/*!
   Sets EAP configuration value for given configuration identifier.
   See ConfigurationId for further details about the data types in QVariant.

   @param [in] confId Configuration Identifier do to be set
   @param [in] value  Value for configuration.
 */
void EapWizardPrivate::setConfigurations(
    ConfigurationId confId, const QVariant &value)
{
    OstTraceFunctionEntry0( EAPWIZARDPRIVATE_SETCONFIGURATIONS_ENTRY );
#ifdef OST_TRACE_COMPILER_IN_USE
    QString tmp;
    QDebug tmpStream(&tmp );
    tmpStream << value;
    TPtrC16 string( tmp.utf16(), tmp.length() );

    OstTraceExt2( 
        TRACE_NORMAL, 
        EAPWIZARDPRIVATE_SETCONFIGURATIONS, 
        "EapWizardPrivate::setConfigurations;confId=%{ConfigurationId};string=%S", 
        (TUint)confId, string );
#endif

    mConfigurations[confId] = value;
    OstTraceFunctionExit0( EAPWIZARDPRIVATE_SETCONFIGURATIONS_EXIT );
}
/*!
   Reader method for eap configurations.

   See ConfigurationId for further details about the data types in QVariant.

   @param [in] confId Defines what configuration is read.

   @return configuration value.
 */
QVariant EapWizardPrivate::configurations(ConfigurationId confId) const
{
    OstTraceFunctionEntry0( EAPWIZARDPRIVATE_CONFIGURATIONS_ENTRY );
    Q_ASSERT(mConfigurations.contains(confId));

#ifdef OST_TRACE_COMPILER_IN_USE
    QString tmp;
    QDebug tmpStream(&tmp );
    tmpStream << mConfigurations[confId];
    TPtrC16 string(tmp.utf16(), tmp.length() );

    OstTraceExt2( 
        TRACE_NORMAL, 
        EAPWIZARDPRIVATE_CONFIGURATIONS, 
        "EapWizardPrivate::configurations;confId=%{ConfigurationId};string=%S", 
        (TUint)confId, string );
#endif

    OstTraceFunctionExit0( EAPWIZARDPRIVATE_CONFIGURATIONS_EXIT );
    return mConfigurations[confId];
}
bool LocalSocketConnection::send(const PacketType &packet,
                                 const EndpointIdType &endpoint)
{
  Q_UNUSED(endpoint);

  // Because of a possible bug with Qt 5.8 and 5.9 on Windows,
  // (*m_dataStream) << packet
  // sends two packets instead of one. The packets will fail to get read
  // correctly on the other side of the message. To fix this, we write the
  // message to a byte array and send it in all together as a single raw data
  // packet. If this bug gets fixed in the future, we will not need the
  // Windows section...
  // See https://bugreports.qt.io/browse/QTBUG-61097 for the bug report.
#ifdef _WIN32
  PacketType byteArray;
  QDataStream tmpStream(&byteArray, QIODevice::WriteOnly);
  tmpStream << packet;
  m_dataStream->writeRawData(byteArray, byteArray.size());
#else
  (*m_dataStream) << packet;
#endif

  return true;
}
bool libwpg::WPGraphics::parse(const unsigned char* data, const size_t size, libwpg::WPGPaintInterface* painter)
{
	WPGInternalInputStream tmpStream(data, size);
	return libwpg::WPGraphics::parse(&tmpStream, painter);
}