Exemple #1
0
Output & IndigoOutput::get (IndigoObject &obj)
{
   if (obj.type == OUTPUT)
   {
      Output *ptr = ((IndigoOutput &)obj).ptr;

      if (ptr == 0)
         throw IndigoError("output stream has been closed");
      return *ptr;
   }
   throw IndigoError("%s is not an output", obj.debugInfo());
}
Exemple #2
0
static void indigoSetMaxEmbeddings (int value)
{
   Indigo &self = indigoGetInstance();
   if (value <= 0)
      throw IndigoError("Maximum allowed embeddings limit must be positive.");
   self.max_embeddings = value;
}
Exemple #3
0
void IndigoOutput::toString (Array<char> &str)
{
   if (_own_buf)
      str.copy(_buf);
   else
      throw IndigoError("can not convert %s to string", debugInfo());
}
Exemple #4
0
static void indigoSetFilenameEncoding (const char *encoding)
{
   Indigo &self = indigoGetInstance();
   if (strcasecmp(encoding, "ASCII") == 0)
      self.filename_encoding = ENCODING_ASCII;
   else if (strcasecmp(encoding, "UTF-8") == 0)
      self.filename_encoding = ENCODING_UTF8;
   else
      throw IndigoError("unknown value: %s", encoding);
}
Exemple #5
0
static void indigoSetAromaticityModel (const char *model)
{
   Indigo &self = indigoGetInstance();
   if (strcasecmp(model, "basic") == 0)
      self.arom_options.method = AromaticityOptions::BASIC;
   else if (strcasecmp(model, "generic") == 0)
      self.arom_options.method = AromaticityOptions::GENERIC;
   else
      throw IndigoError("unknown value: %s. Allowed values are \"basic\", \"generic\"", model);
}
void indigoProductEnumeratorSetOneTubeMode (const char *mode_string)
{
   Indigo &self = indigoGetInstance();
   if (strcmp(mode_string, "one-tube") == 0)
      self.rpe_params.is_one_tube = true;
   else if (strcmp(mode_string, "grid") == 0)
      self.rpe_params.is_one_tube = false;
   else
      throw IndigoError("%s is bad reaction product enumerator mode string", mode_string);
}
Exemple #7
0
static void indigoSetMolfileSavingMode (const char *mode)
{
   Indigo &self = indigoGetInstance();
   if (strcasecmp(mode, "2000") == 0)
      self.molfile_saving_mode = MolfileSaver::MODE_2000;
   else if (strcasecmp(mode, "3000") == 0)
      self.molfile_saving_mode = MolfileSaver::MODE_3000;
   else if (strcasecmp(mode, "auto") == 0)
      self.molfile_saving_mode = MolfileSaver::MODE_AUTO;
   else
      throw IndigoError("unknown value: %s", mode);
}
Exemple #8
0
const char * IndigoRdfReaction::getName ()
{
   if (_loaded)
      return _rxn.name.ptr();

   Indigo &self = indigoGetInstance();

   BufferScanner scanner(_data);
   scanner.readLine(self.tmp_string, true);
   if (strcmp(self.tmp_string.ptr(), "$RXN") != 0)
      throw IndigoError("IndigoRdfReaction::getName(): unexpected first line in the files with reactions."
         "'%s' has been found but '$RXN' has been expected.");
   // Read next line with the name
   scanner.readLine(self.tmp_string, true);
   return self.tmp_string.ptr();
}
Exemple #9
0
static void indigoSetEmbeddingUniqueness (const char *mode)
{
   Indigo &self = indigoGetInstance();
   if (strcasecmp(mode, "atoms") == 0)
   {
      self.embedding_edges_uniqueness = false;
      self.find_unique_embeddings = true;
   }
   else if (strcasecmp(mode, "bonds") == 0)
   {
      self.embedding_edges_uniqueness = true;
      self.find_unique_embeddings = true;
   }
   else if (strcasecmp(mode, "none") == 0)
   {
      self.find_unique_embeddings = false;
   }
   else
      throw IndigoError("unknown value: %s", mode);
}
Exemple #10
0
Scanner & IndigoScanner::get (IndigoObject &obj)
{
   if (obj.type == SCANNER)
      return *((IndigoScanner &)obj).ptr;
   throw IndigoError("%s is not a scanner", obj.debugInfo());
}