text:
/****************************************************************************
Copyright (c) 2019 Cognitics, Inc.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
****************************************************************************/
//#pragma optimize("", off)
#pragma warning ( disable : 4996 )        // deprecated access()

#include <ccl/ObjLog.h>
#include <ccl/LogStream.h>

#include "ccl/FileInfo.h"
#include "ccl/StringUtils.h"
#include <boost/algorithm/string.hpp>
#include <boost/foreach.hpp>
#include <fstream>
#ifdef WIN32
#include <io.h>
#include <direct.h>
#include <Windows.h>
#else
#include <sys/types.h>
#include <dirent.h>
#include <sys/stat.h>

#endif

namespace ccl
{
    FileInfo::~FileInfo(void)
    {
    }

    FileInfo::FileInfo(const std::string &filename) : filename(filename)
    {
        for(size_t i=0;i<filename.size();i++)
            if(filename[i]=='\\')
                this->filename[i]= '/';
    }

    FileInfo::FileInfo(const std::string &basePath, const std::string &filepart)
    {
        filename = joinPaths(basePath,filepart);
        filename = standardizeSlashes(filename);
    }

    std::string FileInfo::getFileName() const
    {
        return filename;
    }

    std::string FileInfo::getDirName(void)
    {
        std::string filecopy = standardizeSlashes(filename);
        std::string::size_type pos = filecopy.rfind('/');
        return (pos == std::string::npos) ? "" : filename.substr(0, pos);
    }

    std::string FileInfo::getBaseName(bool withoutSuffix) const
    {
        std::string::size_type pos = filename.rfind('/');
        if(pos == std::string::npos)
            pos = filename.rfind('\\');
        std::string basename = (pos == std::string::npos) ? filename : filename.substr(pos + 1);
        if(!withoutSuffix)
            return basename;
        pos = basename.rfind('.');
        return (pos == std::string::npos) ? basename : basename.substr(0, pos);
    }

    std::string FileInfo::getSuffix(void)
    {
        std::string basename = getBaseName();
        std::string::size_type pos = basename.rfind('.');
        return (pos == std::string::npos) ? "" : basename.substr(pos + 1);
    }

    std::vector<FileInfo> FileInfo::getAllFiles(const std::string &basepath, const std::string &searchpattern, bool subdir_search)
    {
        std::vector<FileInfo> ret;
        std::vector<std::string> directory_frontier;
        directory_frontier.push_back(basepath);

        while (directory_frontier.size() > 0)
        {
            std::string basedir = directory_frontier.back();
            directory_frontier.pop_back();
            FileInfo searchPath(basedir, searchpattern);
#ifdef WIN32
            struct _finddata_t c_file;
            intptr_t hFile;

            if ((hFile = _findfirst(searchPath.getFileName().c_str(), &c_file)) == -1L)
            {
                return ret;
            }
            do
            {
                if (c_file.attrib & _A_SUBDIR)
                {
                    if (subdir_search)
                    {
                        if (strcmpi(c_file.name, "..") != 0 &&
                            strcmpi(c_file.name, ".") != 0)
                        {
                            directory_frontier.push_back(ccl::joinPaths(basedir, c_file.name));
                        }
                    }
                }
                else
                {
                    FileInfo file(basedir, c_file.name);
                    ret.push_back(file);
                }
            }while(_findnext( hFile, &c_file ) == 0 );
            _findclose(hFile);
#else
            DIR *dp = opendir(basedir.c_str());
            if(dp)
            {
                dirent *dirp;
                while((dirp = readdir(dp)) != NULL)
                {
                  if(dirp->d_type==DT_DIR && subdir_search)
                    {
                                      if(strcmp(dirp->d_name,"..")!=0 && strcmp(dirp->d_name,".")!=0)
                                        {
                                          directory_frontier.push_back(ccl::joinPaths(basedir, dirp->d_name));
                                        }
                    }
                  else
                    {
                        if(strcmp(dirp->d_name,"..")!=0 && strcmp(dirp->d_name,".")!=0)
                        {
                            FileInfo file(basedir,dirp->d_name);
                            ret.push_back(file);
                        }
                    }
                }
                closedir(dp);
            }
#endif
        }
        return ret;
    }

    std::vector<std::string> FileInfo::getSubDirectories(const std::string &basepath)
    {
        std::vector<std::string> ret;

        FileInfo searchPath(basepath, "*.*");
#ifdef WIN32
        struct _finddata_t c_file;
        intptr_t hFile;

        if ((hFile = _findfirst(searchPath.getFileName().c_str(), &c_file)) == -1L)
            return ret;

        do
        {
            if (c_file.attrib & _A_SUBDIR)
            {
                FileInfo file(basepath, c_file.name);
                ret.push_back(file.getFileName());
            }
        } while (_findnext(hFile, &c_file) == 0);
        _findclose(hFile);
#else
        DIR *dp = opendir(basepath.c_str());
        if (dp)
        {
            dirent *dirp;
            while ((dirp = readdir(dp)) != NULL)
            {
                FileInfo file(basepath, dirp->d_name);
                ret.push_back(file.getFileName());
            }
            closedir(dp);
        }
#endif

        ret.erase(std::remove_if(ret.begin(), ret.end(), [](const std::string& dirname) { return (dirname.empty() || (ccl::FileInfo(dirname).getBaseName() == ".") || (ccl::FileInfo(dirname).getBaseName() == "..")); }), ret.end());
        return ret;
    }

    bool directoryExists(const std::string &directory)
    {
#ifdef WIN32
        DWORD ftyp = GetFileAttributes(directory.c_str());
        if( ftyp == INVALID_FILE_ATTRIBUTES)
            return false;
        if (ftyp & FILE_ATTRIBUTE_DIRECTORY)
            return true;
#else
    struct stat st;
    if(stat(directory.c_str(),&st) == 0)
        return S_ISDIR(st.st_mode);
#endif
        return false;
    }

    bool fileExists(const std::string filename)
    {
        if( access( filename.c_str(), 0 ) != -1 )
        {
            // file exists
            return true;
        }
        else
        {
            // file doesn't exist
            return false;
        }
    }

    bool FileInfo::fileExists(const std::string filename)
    {
        return ccl::fileExists(filename);
    }

    std::string joinPaths(const std::string &path1, const std::string &path2)
    {
        if(path1.empty())
            return path2;
        std::string newpath = path1;
        if((path1[path1.length()-1]!='\\')&&(path1[path1.length()-1]!='/'))
            newpath += "/";
        newpath += path2;
        return newpath;
    }

    std::string standardizeSlashes(const std::string &path)
    {
        std::string newpath = path;
        while(newpath.find("\\") != newpath.npos)
                newpath.replace(newpath.find("\\"), 1, "/");
        return newpath;
    }

    std::vector<std::string> splitPath(const std::string &path)
    {
        std::vector<std::string> ret;
        boost::split(ret, path, boost::is_any_of("\\/"));
        //Handle the special case where the path begins with a / (unix absolute paths)
        if(ret.size() > 0 && ret[0].empty())
            ret[0] = "/";
        return ret;
    }

    bool makeDirectory(const std::string &dir, bool makeIntermediate)
    {
        if(!makeIntermediate)
        {
#ifdef WIN32
            return 0==_mkdir(dir.c_str());
#else
            return 0==mkdir(dir.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
#endif
        }
        bool ret = true;
        std::vector<std::string> paths = splitPath(dir);
        std::string iterativePath;
        BOOST_FOREACH(std::string path,paths)
        {
            if(iterativePath.length())
                iterativePath = joinPaths(iterativePath,path);
            else
                iterativePath = path;
            if(!directoryExists(iterativePath))
            {
                ret &= makeDirectory(iterativePath,false);
            }
        }
        return ret;
    }

    bool deleteFile(const std::string &filename)
    {
#ifdef WIN32
      _unlink(filename.c_str());
#else
      unlink(filename.c_str());
#endif
      return true;
    }

  bool copyFile(const std::string &src, const std::string &dest)
  {
    try {
        std::ifstream source(src.c_str(), std::ios::binary);
        std::ofstream destf(dest.c_str(), std::ios::binary);

        destf << source.rdbuf();

        source.close();
        destf.close();
      return true;
    }
    catch(std::exception const &)
      {
    return false;
      }
  }

  bool copyFilesRecursive(const std::string &srcDir, const std::string &destDir)
  {
      std::vector<FileInfo> files = FileInfo::getAllFiles(srcDir, "*.*", true);
      for (auto&& fi : files)
      {
          std::string relativeFilename = fi.getDirName();
          //Strip out the source directory
          if (ccl::stringStartsWith(fi.getFileName(),srcDir))
          {
              relativeFilename = relativeFilename.substr(srcDir.length());
          }
          std::string destPath = ccl::joinPaths(destDir, relativeFilename);
          //Make sure the directory exists for each file
          makeDirectory(destPath, true);

          std::string destFilePath = ccl::joinPaths(destPath, fi.getBaseName());
          if (!copyFile(fi.getFileName(), destFilePath))
          {
              return false;
          }
      }

      return true;
  }

  uint64_t getFileSize(const std::string &filePath)
    {
        uint64_t flen = 0;
        FILE *file = fopen(filePath.c_str(),"rb");
        if(!file)
        return 0;
        fseek(file,0,SEEK_END);
        flen = ftell(file);
        fclose(file);
        return flen;
    }

  bool copyFilesRecursive(const std::string &srcDir, const std::string &destDir, const std::vector<std::string>& extensions)
  {
      std::vector<FileInfo> files = FileInfo::getAllFiles(srcDir, "*.*", true);
      for (auto&& fi : files)
      {
          std::string relativeFilename = fi.getFileName().substr(srcDir.length());

          if (relativeFilename.empty())
          {
              continue;
          }

          if (std::find(extensions.begin(), extensions.end(), fi.getSuffix()) == extensions.end())
          {
              continue;
          }

          std::string destFilePath = ccl::joinPaths(destDir, relativeFilename);
          if (!copyFile(fi.getFileName(), destFilePath))
          {
              return false;
          }
      }

      return true;
  }

  // Helper function to parse a table name after a GeoPackage filename
  // Returns true if a table name was detected after the .gpkg: string
  bool GetFilenameAndTable(const std::string &path, std::string &file, std::string &table)
  {
      const auto pos = path.find(".gpkg:");
      if (std::string::npos != pos)
      {
          //This is a geopackage file with the tablename included
          table = path.substr(pos + 6);
          file = path.substr(0, pos + 5);
          return true;
      }
      file = path;
      table = std::string();
      return false;
  }
}

max_stars_repo_name: mikedig/cdb-productivity-api

max_issues_repo_name: mikedig/cdb-productivity-api

max_forks_repo_name: mikedig/cdb-productivity-api


text:
//=======================================================================
// Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
//
// 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)
//=======================================================================
#include <boost/graph/graph_concepts.hpp>
#include <boost/graph/graph_archetypes.hpp>
#include <boost/graph/stanford_graph.hpp>

int main(int,char*[])
{
  using namespace boost;
  // Check Stanford GraphBase Graph
  {
    typedef Graph* Graph;
    typedef graph_traits<Graph>::vertex_descriptor Vertex;
    typedef graph_traits<Graph>::edge_descriptor Edge;
    function_requires< VertexListGraphConcept<Graph> >();
    function_requires< IncidenceGraphConcept<Graph> >();
    function_requires< AdjacencyGraphConcept<Graph> >();
    function_requires< PropertyGraphConcept<Graph, Edge, edge_length_t > >();
    function_requires<
      PropertyGraphConcept<Graph, Vertex, u_property<Vertex> > >();
    function_requires<
      PropertyGraphConcept<Graph, Edge, a_property<Vertex> > >();
  }
  {
    typedef const Graph* Graph;
    typedef graph_traits<Graph>::vertex_descriptor Vertex;
    typedef graph_traits<Graph>::edge_descriptor Edge;
    function_requires< VertexListGraphConcept<Graph> >();
    function_requires< IncidenceGraphConcept<Graph> >();
    function_requires< AdjacencyGraphConcept<Graph> >();
    function_requires<
      ReadablePropertyGraphConcept<Graph, Edge, edge_length_t > >();
    function_requires<
      ReadablePropertyGraphConcept<Graph, Vertex, u_property<Vertex> > >();
    function_requires<
      ReadablePropertyGraphConcept<Graph, Edge, a_property<Vertex> > >();
  }
  return 0;
}

ext: cpp

max_stars_repo_name: zyiacas/boost-doc-zh

max_issues_repo_name: sdfict/boost-doc-zh

max_forks_repo_name: sdfict/boost-doc-zh


text:
#include "walterTranslator.h"

#include <ai_array.h>
#include <ai_nodes.h>
#include <ai_ray.h>

#include <boost/algorithm/string.hpp>
#include <boost/regex.hpp>
#include <vector>

#include "attributes/AttrHelper.h"
#include "common/UtilityFunctions.h"
#include "mayaUtils.h"

#include <maya/MBoundingBox.h>
#include <maya/MDagPath.h>
#include <maya/MFileObject.h>
#include <maya/MFnDependencyNode.h>
#include <maya/MFnStringArrayData.h>
#include <maya/MPlugArray.h>
#include <maya/MRenderUtil.h>
#include <maya/MSelectionList.h>
#include <sstream>

#ifdef _WIN32
    #include <platform/win32/dirent.h>
    #define LIBEXT MString(".dll")
#else
    #include <sys/types.h>
    #include <dirent.h>
    #include <dlfcn.h>
#endif

CWalterStandinTranslator::CWalterStandinTranslator() :
    m_arnoldRootNode(NULL)
{
}

AtNode* CWalterStandinTranslator::GetArnoldRootNode()
{
    return m_arnoldRootNode;
}

AtNode*  CWalterStandinTranslator::CreateArnoldNodes()
{
    m_arnoldRootNode = AddArnoldNode("walter");
    return m_arnoldRootNode;
}

void CWalterStandinTranslator::ProcessRenderFlagsCustom(AtNode* node)
{
    AiNodeSetByte(node, "visibility", ComputeVisibility());

    MPlug plug;

    if(m_DagNode.findPlug("aiSelfShadows").asBool() == false)
          ProcessParameter(node, "self_shadows", AI_TYPE_BOOLEAN, "aiSelfShadows");

    if(m_DagNode.findPlug("aiOpaque").asBool() == false)
          ProcessParameter(node, "opaque", AI_TYPE_BOOLEAN, "aiOpaque");

        if(m_DagNode.findPlug("aiMatte").asBool() == true)
          ProcessParameter(node, "matte", AI_TYPE_BOOLEAN, "aiMatte");

    if(m_DagNode.findPlug("receiveShadows").asBool() == false)
          ProcessParameter(node, "receive_shadows", AI_TYPE_BOOLEAN, "receiveShadows");
    MStatus status;

    plug = FindMayaPlug("aiSssSetname", &status);
    if (status && !plug.isNull())
    {
        MString setname = plug.asString();
        if (setname != "")
        {
            AiNodeDeclareConstant(node, "sss_setname", AI_TYPE_STRING);
            AiNodeSetStr(node, "sss_setname", setname.asChar());
        }
    }

    ExportTraceSets(node, FindMayaPlug("aiTraceSets"));
}

void CWalterStandinTranslator::Export(AtNode* procedural)
{
    ExportProcedural(procedural, false);
}

void CWalterStandinTranslator::ExportProcedural(AtNode* procedural, bool update)
{
    MStatus stat;
    m_DagNode.setObject(m_dagPath.node());

    ExportMatrix(procedural);

    ProcessRenderFlagsCustom(procedural);

    if (!update)
    {
        // Export material assigned on the node.
        ExportStandinsShaders(procedural);

        AiNodeSetStr(procedural, "name", m_dagPath.partialPathName().asChar());

        // Try to find the procedural name on the standin node.
        MString procLib = m_DagNode.findPlug("arnoldProcedural").asString();
        if (!procLib.length())
        {
            // Use the standard name if not found.
            procLib = MString("walterProcedural") + LIBEXT;
        }

        // Split the string with ":" symbol, expand all the filenames and join
        // it back.
        std::string cacheFileName(
                m_DagNode.findPlug("cacheFileName").asString().asChar());

        // Split the line with ":" symbol and put everything to Alembic. We
        // don't use MString::split() because it skips empty lines. We need
        // everything, otherwise we have errors in matching visibilities and
        // layers.
        std::vector<std::string> archives;
        // TODO: Windows paths
        boost::split(archives, cacheFileName, boost::is_any_of(":"));

        MString abcfiles;
        MPlug renderables = m_DagNode.findPlug("renderables");
        for (unsigned i=0; i<archives.size(); i++)
        {
            MString archive(archives[i].c_str());

            if (!renderables.isNull())
            {
                // Skip it if it's not renderable
                MPlug renderable = renderables.elementByLogicalIndex(i);
                if (!renderable.asBool())
                {
                    continue;
                }
            }

            // Compute the resolved filename
            MFileObject fileObject;
            fileObject.setRawFullName(archive);
            fileObject.setResolveMethod(MFileObject::kInputFile);

            if (abcfiles.length())
            {
                abcfiles += ":";
            }

            MString resolved = fileObject.resolvedFullName();
            if (resolved.length())
            {
                abcfiles += resolved.expandEnvironmentVariablesAndTilde();
            }
            else
            {
                abcfiles += archive.expandEnvironmentVariablesAndTilde();
            }
        }

        // TODO: do we still need this block? We export nodes directly from our
        // connections. We might need this for compatibility with the first
        // versions.
        MPlug shaders = m_DagNode.findPlug("shaders", &stat);
        if(stat == MS::kSuccess)
        {
            for (unsigned int i=0;i<shaders.numElements();++i)
            {
                MPlug plug = shaders.elementByPhysicalIndex(i, &stat);
                if(stat == MS::kSuccess)
                {
                    MPlugArray connections;
                    plug.connectedTo(connections, true, false, &stat);
                    if(stat == MS::kSuccess)
                        for (unsigned int k=0; k<connections.length(); ++k)
                        {
                            MPlug sgPlug = connections[k];
                            if (sgPlug.node().apiType() == MFn::kShadingEngine || sgPlug.node().apiType() == MFn::kDisplacementShader)
                            {
                                ExportConnectedNode(sgPlug);
                            }
                        }
                }

            }
        }

        MPlug usdSessionLayer = m_DagNode.findPlug("USDSessionLayer");
        MPlug usdVariantsLayer = m_DagNode.findPlug("USDVariantsLayer");
        MPlug usdMayaStateLayer = m_DagNode.findPlug("USDMayaStateLayer");
        MPlug usdPurposeLayer = m_DagNode.findPlug("USDPurposeLayer");
        MPlug usdVisibilityLayer = m_DagNode.findPlug("USDVisibilityLayer");

        ExportMayaShadingGraph();

        // It's a list of materials from the Alembic file.
        // We don't use MStringArray because MStringArray::indexOf() absent in
        // our Maya SDK for unknown reason.
        std::vector<MString> embeddedShaderList;
        const MPlug embeddedShaders = m_DagNode.findPlug("embeddedShaders");
        if (!embeddedShaders.isNull())
        {
            unsigned int numElements = embeddedShaders.numElements();
            embeddedShaderList.reserve(numElements);
            for (unsigned int i=0; i<numElements; i++)
            {
                embeddedShaderList.push_back(
                        embeddedShaders.elementByLogicalIndex(i).asString());
            }
        }

        ExportFrame(procedural);

        AiNodeSetStr(procedural, "objectPath", "/");

        static const MTime sec(1.0, MTime::kSeconds);
        float fps = sec.as(MTime::uiUnit());
        AiNodeDeclare(procedural, "fps", "constant FLOAT");
        AiNodeSetFlt(procedural, "fps", fps);
        AiNodeSetStr(procedural, "filePaths", abcfiles.asChar());

        // Output the USD session layer if exists.
        if (!usdSessionLayer.isNull())
        {
            MString sessionLayer = usdSessionLayer.asString();
            if (sessionLayer.length())
            {
                AiNodeSetStr(procedural, "sessionLayer", sessionLayer.asChar());
            }
        }

        // Output the USD variants layer if exists.
        if (!usdVariantsLayer.isNull())
        {
            MString variantsLayer = usdVariantsLayer.asString();
            if (variantsLayer.length())
            {
                AiNodeSetStr(procedural, "variantsLayer", variantsLayer.asChar());
            }
        }

        // Output the USD puropse layer if exists.
        if (!usdPurposeLayer.isNull())
        {
            MString purposeLayer = usdPurposeLayer.asString();
            if (purposeLayer.length())
            {
                AiNodeSetStr(procedural, "purposeLayer", purposeLayer.asChar());
            }
        }

        // Output the USD session layer if exists.
        if (!usdMayaStateLayer.isNull())
        {
            MString mayaStateLayer = usdMayaStateLayer.asString();
            if (mayaStateLayer.length())
            {
                AiNodeSetStr(
                    procedural, "mayaStateLayer", mayaStateLayer.asChar());
            }
        }

        // Output the USD visiblity layer if exists.
        if (!usdVisibilityLayer.isNull())
        {
            MString visibilityLayer = usdVisibilityLayer.asString();
            if (visibilityLayer.length())
            {
                AiNodeSetStr(procedural, "visibilityLayer", visibilityLayer.asChar());
            }
        }

        // MTOA does this for every node.
        if (RequiresMotionData())
        {
            double motionStart, motionEnd;
            GetSessionOptions().GetMotionRange(motionStart, motionEnd);
            AiNodeSetFlt(procedural, "motion_start", (float)motionStart);
            AiNodeSetFlt(procedural, "motion_end", (float)motionEnd);
        }
    }
}

void CWalterStandinTranslator::ExportShaders()
{
  ExportStandinsShaders(GetArnoldRootNode());
}

void CWalterStandinTranslator::ExportStandinsShaders(AtNode* procedural)
{
    int instanceNum = m_dagPath.isInstanced() ? m_dagPath.instanceNumber() : 0;

    MPlug shadingGroupPlug = GetNodeShadingGroup(m_dagPath.node(), instanceNum);
    if (!shadingGroupPlug.isNull())
    {

        AtNode *shader = ExportConnectedNode(shadingGroupPlug);
        if (shader != NULL)
        {
            // We can't put it to "shader" attribute because in this way we will
            // not be able to assign different shader.
            const char* shaderAttribute = "walterStandinShader";
            const AtNodeEntry* nodeEntry = AiNodeGetNodeEntry(procedural);
            const AtParamEntry* paramEntry =
                AiNodeEntryLookUpParameter(nodeEntry, shaderAttribute);

            if (!paramEntry)
            {
                // The param doesn't exists, add it!
                AiNodeDeclare(
                        procedural,
                        shaderAttribute,
                        "constant NODE");
            }

            AiNodeSetPtr(procedural, shaderAttribute, shader);
        }
    }
}

void CWalterStandinTranslator::ExportMotion(AtNode* anode)
{
    // Check if motionblur is enabled and early out if it's not.
    if (!IsMotionBlurEnabled())
    {
        return;
    }

    ExportMatrix(anode);
    ExportFrame(anode);
}

void CWalterStandinTranslator::NodeInitializer(CAbTranslator context)
{
    CExtensionAttrHelper helper(context.maya, "walter");
    CShapeTranslator::MakeCommonAttributes(helper);
}

bool CWalterStandinTranslator::ExportMayaShadingGraph()
{
    const MPlug layersAssignation = m_DagNode.findPlug("layersAssignation");
    if (layersAssignation.isNull())
    {
        AiMsgWarning(
                "[mtoa] [%s] Can't find %s.layersAssignation.",
                GetTranslatorName().asChar(),
                m_DagNode.name().asChar());
        return false;
    }

    if (layersAssignation.numElements() <= 0)
    {
        return false;
    }

    for (unsigned i=0; i<layersAssignation.numElements(); i++)
    {
        // Get walterStandin.layersAssignation[i]
        const MPlug currentLayerCompound =
            layersAssignation.elementByPhysicalIndex(i);
        // Get walterStandin.layersAssignation[i].layer
        MPlug layerPlug;
        if (!GetChildMPlug(currentLayerCompound, "layer", layerPlug))
        {
            continue;
        }

        MPlugArray connections;
        if (!layerPlug.connectedTo(connections, true, false) ||
            !connections.length())
        {
            continue;
        }

        // The layer is the first connected node. We consider we have only one
        // connection.
        const MFnDependencyNode layer(connections[0].node());
        const std::string layerName = layer.name().asChar();
        bool mainLayer = layerName == "defaultRenderLayer";

        MPlug shadersPlug;
        if (!GetChildMPlug(
                    currentLayerCompound, "shaderConnections", shadersPlug))
        {
            continue;
        }

        for (unsigned j=0; j<shadersPlug.numElements(); j++)
        {
            // Get walterStandin.layersAssignation[i].shaderConnections[j]
            const MPlug shadersCompound = shadersPlug.elementByPhysicalIndex(j);
            // Get walterStandin.layersAssignation[].shaderConnections[].abcnode
            MPlug abcnodePlug;
            if (!GetChildMPlug(shadersCompound, "abcnode", abcnodePlug))
            {
                continue;
            }

            const MString abcnode = abcnodePlug.asString().asChar();
            if (!abcnode.length())
            {
                continue;
            }

            // Get walterStandin.layersAssignation[].shaderConnections[].shader
            MPlug shaderPlug;
            if (GetChildMPlug(shadersCompound, "shader", shaderPlug))
            {
                ExportConnections(
                        abcnode.asChar(), shaderPlug);
            }

            // The same for displacement
            MPlug dispPlug;
            if (GetChildMPlug(shadersCompound, "displacement", dispPlug))
            {
                ExportConnections(abcnode.asChar(), dispPlug);
            }
        }
    }

    return true;
}

void CWalterStandinTranslator::ExportConnections(
        const char* abcnode, const MPlug& shaderPlug)
{
    MPlugArray connections;
    if (!shaderPlug.connectedTo(connections, true, false) ||
        !connections.length())
    {
        return;
    }

    // Push this connection to the shader to Arnold.
    ExportConnectedNode(connections[0]);
}

int CWalterStandinTranslator::ComputeWalterVisibility(
        const MFnDependencyNode& node)const
{
    unsigned visibility = AI_RAY_ALL;
    bool exists = false;
    MPlug plug;

    plug = node.findPlug("walterVisibility");

    if (!plug.isNull())
    {
        exists = true;
        if (!plug.asBool())
        {
            return 0;
        }
    }

    plug = node.findPlug("walterCastsShadows");
    if (!plug.isNull())
    {
        exists = true;
        if(!plug.asBool())
        {
            visibility &= ~AI_RAY_SHADOW;
        }
    }

    plug = node.findPlug("walterPrimaryVisibility");
    MString plugName = plug.name();
    if (!plug.isNull())
    {
        exists = true;
        if (!plug.asBool())
        {
            visibility &= ~AI_RAY_CAMERA;
        }
    }

    plug = node.findPlug("walterVisibleInReflections");
    if (!plug.isNull())
    {
        exists = true;
        if (!plug.asBool())
        {
            visibility &= ~AI_RAY_ALL_REFLECT;
        }
    }

    plug = node.findPlug("walterVisibleInRefractions");
    if (!plug.isNull())
    {
        exists = true;
        if (!plug.asBool())
        {
            visibility &= ~AI_RAY_ALL_TRANSMIT;
        }
    }

    plug = node.findPlug("walterVisibleInDiffuse");
    if (!plug.isNull())
    {
        exists = true;
        if (!plug.asBool())
        {
            visibility &= ~AI_RAY_ALL_DIFFUSE;
        }
    }

    plug = node.findPlug("walterVisibleInGlossy");
    if (!plug.isNull())
    {
        exists = true;
        if (!plug.asBool())
        {
            visibility &= ~AI_RAY_ALL_SPECULAR;
        }
    }

    if (!exists)
    {
        return -1;
    }

    return visibility;
}

void CWalterStandinTranslator::ExportFrame(AtNode* node)
{
    // The reference implementation is CDagTranslator::ExportMatrix.
    MTime time = m_DagNode.findPlug("time").asMTime() +
        m_DagNode.findPlug("timeOffset").asMTime();
    float frame = time.as(time.unit());

    if (!IsExportingMotion())
    {
        // We are here because it's called from Export.
        if (RequiresMotionData())
        {
            int step = GetMotionStep();

            AiNodeDeclare(node, "frame", "constant ARRAY FLOAT");

            AtArray* frames =
                AiArrayAllocate(1, GetNumMotionSteps(), AI_TYPE_FLOAT);
            AiArraySetFlt(frames, step, frame);
            AiNodeSetArray(node, "frame", frames);
        }
        else
        {
            AiNodeDeclare(node, "frame", "constant FLOAT");

            AiNodeSetFlt(node, "frame", frame);
        }
    }
    else if (IsMotionBlurEnabled(MTOA_MBLUR_OBJECT) && RequiresMotionData())
    {
        // We are here because it's called from ExportMotion. Everything should
        // be delared. We need to set specific keys in the Arnold attribute.
        AtArray* frames = AiNodeGetArray(node, "frame");
        if (frames)
        {
            int step = GetMotionStep();

            int arraySize = AiArrayGetNumKeys(frames) * AiArrayGetNumElements(frames);
            if (step >= arraySize)

            {
                AiMsgError(
                    "Time steps are not set properly for %s",
                    m_dagPath.partialPathName().asChar());
            }
            else
            {
                AiArraySetFlt(frames, step, frame);
            }
        }
    }
}

max_stars_repo_name: all-in-one-of/OpenWalter

max_issues_repo_name: all-in-one-of/OpenWalter

max_forks_repo_name: all-in-one-of/OpenWalter


text:
//  (C) Copyright Gennadiy Rozental 2001-2002.
//  Permission to copy, use, modify, sell and distribute this software
//  is granted provided this copyright notice appears in all copies.
//  This software is provided "as is" without express or implied warranty,
//  and with no claim as to its suitability for any purpose.

//  See http://www.boost.org for most recent version including documentation.
//
//  File        : $RCSfile: test_exec_monitor.hpp,v $
//
//  Version     : $Id: test_exec_monitor.hpp,v 1.2 2002/11/02 19:31:05 rogeeff Exp $
//
//  Description : included (vs. linked) version of Test Execution Monitor
// ***************************************************************************

#ifndef BOOST_INCLUDED_TEST_EXEC_MONITOR_HPP
#define BOOST_INCLUDED_TEST_EXEC_MONITOR_HPP

#include <boost/test/detail/unit_test_config.hpp> //!! for borland workaround
#include <libs/test/src/execution_monitor.cpp>

#include <libs/test/src/test_tools.cpp>

#include <libs/test/src/unit_test_result.cpp>
#include <libs/test/src/unit_test_suite.cpp>
#include <libs/test/src/unit_test_parameters.cpp>
#include <libs/test/src/unit_test_log.cpp>
#include <libs/test/src/unit_test_monitor.cpp>

#include <libs/test/src/test_main.cpp>

// ***************************************************************************
//  Revision History :
//
//  $Log: test_exec_monitor.hpp,v $
//  Revision 1.2  2002/11/02 19:31:05  rogeeff
//  merged into the main trank
//
//  Revision 1.1.2.1  2002/10/01 17:25:29  rogeeff
//  borland bug workaround
//
//  Revision 1.1  2002/08/26 09:09:00  rogeeff
//  Initial commit
//

// ***************************************************************************

#endif // BOOST_INCLUDED_TEST_EXEC_MONITOR_HPP

ext: hpp


text:
// This file is auto-generated, don't edit it. Thanks.

#ifndef ALIBABACLOUD_CAS20200407_H_
#define ALIBABACLOUD_CAS20200407_H_

#include <alibabacloud/open_api.hpp>
#include <boost/throw_exception.hpp>
#include <darabonba/core.hpp>
#include <darabonba/util.hpp>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

namespace Alibabacloud_Cas20200407 {
class CancelCertificateForPackageRequestRequest : public Darabonba::Model {
public:
  shared_ptr<long> orderId{};

  CancelCertificateForPackageRequestRequest() {}

  explicit CancelCertificateForPackageRequestRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (orderId) {
      res["OrderId"] = boost::any(*orderId);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("OrderId") != m.end() && !m["OrderId"].empty()) {
      orderId = make_shared<long>(boost::any_cast<long>(m["OrderId"]));
    }
  }

  virtual ~CancelCertificateForPackageRequestRequest() = default;
};
class CancelCertificateForPackageRequestResponseBody : public Darabonba::Model {
public:
  shared_ptr<string> requestId{};

  CancelCertificateForPackageRequestResponseBody() {}

  explicit CancelCertificateForPackageRequestResponseBody(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (requestId) {
      res["RequestId"] = boost::any(*requestId);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("RequestId") != m.end() && !m["RequestId"].empty()) {
      requestId = make_shared<string>(boost::any_cast<string>(m["RequestId"]));
    }
  }

  virtual ~CancelCertificateForPackageRequestResponseBody() = default;
};
class CancelCertificateForPackageRequestResponse : public Darabonba::Model {
public:
  shared_ptr<map<string, string>> headers{};
  shared_ptr<CancelCertificateForPackageRequestResponseBody> body{};

  CancelCertificateForPackageRequestResponse() {}

  explicit CancelCertificateForPackageRequestResponse(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!headers) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("headers is required.")));
    }
    if (!body) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("body is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (headers) {
      res["headers"] = boost::any(*headers);
    }
    if (body) {
      res["body"] = body ? boost::any(body->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("headers") != m.end() && !m["headers"].empty()) {
      map<string, string> map1 = boost::any_cast<map<string, string>>(m["headers"]);
      map<string, string> toMap1;
      for (auto item:map1) {
         toMap1[item.first] = item.second;
      }
      headers = make_shared<map<string, string>>(toMap1);
    }
    if (m.find("body") != m.end() && !m["body"].empty()) {
      if (typeid(map<string, boost::any>) == m["body"].type()) {
        CancelCertificateForPackageRequestResponseBody model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["body"]));
        body = make_shared<CancelCertificateForPackageRequestResponseBody>(model1);
      }
    }
  }

  virtual ~CancelCertificateForPackageRequestResponse() = default;
};
class CancelOrderRequestRequest : public Darabonba::Model {
public:
  shared_ptr<long> orderId{};

  CancelOrderRequestRequest() {}

  explicit CancelOrderRequestRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (orderId) {
      res["OrderId"] = boost::any(*orderId);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("OrderId") != m.end() && !m["OrderId"].empty()) {
      orderId = make_shared<long>(boost::any_cast<long>(m["OrderId"]));
    }
  }

  virtual ~CancelOrderRequestRequest() = default;
};
class CancelOrderRequestResponseBody : public Darabonba::Model {
public:
  shared_ptr<string> requestId{};

  CancelOrderRequestResponseBody() {}

  explicit CancelOrderRequestResponseBody(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (requestId) {
      res["RequestId"] = boost::any(*requestId);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("RequestId") != m.end() && !m["RequestId"].empty()) {
      requestId = make_shared<string>(boost::any_cast<string>(m["RequestId"]));
    }
  }

  virtual ~CancelOrderRequestResponseBody() = default;
};
class CancelOrderRequestResponse : public Darabonba::Model {
public:
  shared_ptr<map<string, string>> headers{};
  shared_ptr<CancelOrderRequestResponseBody> body{};

  CancelOrderRequestResponse() {}

  explicit CancelOrderRequestResponse(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!headers) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("headers is required.")));
    }
    if (!body) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("body is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (headers) {
      res["headers"] = boost::any(*headers);
    }
    if (body) {
      res["body"] = body ? boost::any(body->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("headers") != m.end() && !m["headers"].empty()) {
      map<string, string> map1 = boost::any_cast<map<string, string>>(m["headers"]);
      map<string, string> toMap1;
      for (auto item:map1) {
         toMap1[item.first] = item.second;
      }
      headers = make_shared<map<string, string>>(toMap1);
    }
    if (m.find("body") != m.end() && !m["body"].empty()) {
      if (typeid(map<string, boost::any>) == m["body"].type()) {
        CancelOrderRequestResponseBody model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["body"]));
        body = make_shared<CancelOrderRequestResponseBody>(model1);
      }
    }
  }

  virtual ~CancelOrderRequestResponse() = default;
};
class CreateCertificateForPackageRequestRequest : public Darabonba::Model {
public:
  shared_ptr<string> companyName{};
  shared_ptr<string> csr{};
  shared_ptr<string> domain{};
  shared_ptr<string> email{};
  shared_ptr<string> phone{};
  shared_ptr<string> productCode{};
  shared_ptr<string> username{};
  shared_ptr<string> validateType{};

  CreateCertificateForPackageRequestRequest() {}

  explicit CreateCertificateForPackageRequestRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (companyName) {
      res["CompanyName"] = boost::any(*companyName);
    }
    if (csr) {
      res["Csr"] = boost::any(*csr);
    }
    if (domain) {
      res["Domain"] = boost::any(*domain);
    }
    if (email) {
      res["Email"] = boost::any(*email);
    }
    if (phone) {
      res["Phone"] = boost::any(*phone);
    }
    if (productCode) {
      res["ProductCode"] = boost::any(*productCode);
    }
    if (username) {
      res["Username"] = boost::any(*username);
    }
    if (validateType) {
      res["ValidateType"] = boost::any(*validateType);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("CompanyName") != m.end() && !m["CompanyName"].empty()) {
      companyName = make_shared<string>(boost::any_cast<string>(m["CompanyName"]));
    }
    if (m.find("Csr") != m.end() && !m["Csr"].empty()) {
      csr = make_shared<string>(boost::any_cast<string>(m["Csr"]));
    }
    if (m.find("Domain") != m.end() && !m["Domain"].empty()) {
      domain = make_shared<string>(boost::any_cast<string>(m["Domain"]));
    }
    if (m.find("Email") != m.end() && !m["Email"].empty()) {
      email = make_shared<string>(boost::any_cast<string>(m["Email"]));
    }
    if (m.find("Phone") != m.end() && !m["Phone"].empty()) {
      phone = make_shared<string>(boost::any_cast<string>(m["Phone"]));
    }
    if (m.find("ProductCode") != m.end() && !m["ProductCode"].empty()) {
      productCode = make_shared<string>(boost::any_cast<string>(m["ProductCode"]));
    }
    if (m.find("Username") != m.end() && !m["Username"].empty()) {
      username = make_shared<string>(boost::any_cast<string>(m["Username"]));
    }
    if (m.find("ValidateType") != m.end() && !m["ValidateType"].empty()) {
      validateType = make_shared<string>(boost::any_cast<string>(m["ValidateType"]));
    }
  }

  virtual ~CreateCertificateForPackageRequestRequest() = default;
};
class CreateCertificateForPackageRequestResponseBody : public Darabonba::Model {
public:
  shared_ptr<long> orderId{};
  shared_ptr<string> requestId{};

  CreateCertificateForPackageRequestResponseBody() {}

  explicit CreateCertificateForPackageRequestResponseBody(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (orderId) {
      res["OrderId"] = boost::any(*orderId);
    }
    if (requestId) {
      res["RequestId"] = boost::any(*requestId);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("OrderId") != m.end() && !m["OrderId"].empty()) {
      orderId = make_shared<long>(boost::any_cast<long>(m["OrderId"]));
    }
    if (m.find("RequestId") != m.end() && !m["RequestId"].empty()) {
      requestId = make_shared<string>(boost::any_cast<string>(m["RequestId"]));
    }
  }

  virtual ~CreateCertificateForPackageRequestResponseBody() = default;
};
class CreateCertificateForPackageRequestResponse : public Darabonba::Model {
public:
  shared_ptr<map<string, string>> headers{};
  shared_ptr<CreateCertificateForPackageRequestResponseBody> body{};

  CreateCertificateForPackageRequestResponse() {}

  explicit CreateCertificateForPackageRequestResponse(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!headers) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("headers is required.")));
    }
    if (!body) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("body is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (headers) {
      res["headers"] = boost::any(*headers);
    }
    if (body) {
      res["body"] = body ? boost::any(body->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("headers") != m.end() && !m["headers"].empty()) {
      map<string, string> map1 = boost::any_cast<map<string, string>>(m["headers"]);
      map<string, string> toMap1;
      for (auto item:map1) {
         toMap1[item.first] = item.second;
      }
      headers = make_shared<map<string, string>>(toMap1);
    }
    if (m.find("body") != m.end() && !m["body"].empty()) {
      if (typeid(map<string, boost::any>) == m["body"].type()) {
        CreateCertificateForPackageRequestResponseBody model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["body"]));
        body = make_shared<CreateCertificateForPackageRequestResponseBody>(model1);
      }
    }
  }

  virtual ~CreateCertificateForPackageRequestResponse() = default;
};
class CreateCertificateRequestRequest : public Darabonba::Model {
public:
  shared_ptr<string> domain{};
  shared_ptr<string> email{};
  shared_ptr<string> phone{};
  shared_ptr<string> productCode{};
  shared_ptr<string> username{};
  shared_ptr<string> validateType{};

  CreateCertificateRequestRequest() {}

  explicit CreateCertificateRequestRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (domain) {
      res["Domain"] = boost::any(*domain);
    }
    if (email) {
      res["Email"] = boost::any(*email);
    }
    if (phone) {
      res["Phone"] = boost::any(*phone);
    }
    if (productCode) {
      res["ProductCode"] = boost::any(*productCode);
    }
    if (username) {
      res["Username"] = boost::any(*username);
    }
    if (validateType) {
      res["ValidateType"] = boost::any(*validateType);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("Domain") != m.end() && !m["Domain"].empty()) {
      domain = make_shared<string>(boost::any_cast<string>(m["Domain"]));
    }
    if (m.find("Email") != m.end() && !m["Email"].empty()) {
      email = make_shared<string>(boost::any_cast<string>(m["Email"]));
    }
    if (m.find("Phone") != m.end() && !m["Phone"].empty()) {
      phone = make_shared<string>(boost::any_cast<string>(m["Phone"]));
    }
    if (m.find("ProductCode") != m.end() && !m["ProductCode"].empty()) {
      productCode = make_shared<string>(boost::any_cast<string>(m["ProductCode"]));
    }
    if (m.find("Username") != m.end() && !m["Username"].empty()) {
      username = make_shared<string>(boost::any_cast<string>(m["Username"]));
    }
    if (m.find("ValidateType") != m.end() && !m["ValidateType"].empty()) {
      validateType = make_shared<string>(boost::any_cast<string>(m["ValidateType"]));
    }
  }

  virtual ~CreateCertificateRequestRequest() = default;
};
class CreateCertificateRequestResponseBody : public Darabonba::Model {
public:
  shared_ptr<long> orderId{};
  shared_ptr<string> requestId{};

  CreateCertificateRequestResponseBody() {}

  explicit CreateCertificateRequestResponseBody(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (orderId) {
      res["OrderId"] = boost::any(*orderId);
    }
    if (requestId) {
      res["RequestId"] = boost::any(*requestId);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("OrderId") != m.end() && !m["OrderId"].empty()) {
      orderId = make_shared<long>(boost::any_cast<long>(m["OrderId"]));
    }
    if (m.find("RequestId") != m.end() && !m["RequestId"].empty()) {
      requestId = make_shared<string>(boost::any_cast<string>(m["RequestId"]));
    }
  }

  virtual ~CreateCertificateRequestResponseBody() = default;
};
class CreateCertificateRequestResponse : public Darabonba::Model {
public:
  shared_ptr<map<string, string>> headers{};
  shared_ptr<CreateCertificateRequestResponseBody> body{};

  CreateCertificateRequestResponse() {}

  explicit CreateCertificateRequestResponse(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!headers) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("headers is required.")));
    }
    if (!body) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("body is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (headers) {
      res["headers"] = boost::any(*headers);
    }
    if (body) {
      res["body"] = body ? boost::any(body->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("headers") != m.end() && !m["headers"].empty()) {
      map<string, string> map1 = boost::any_cast<map<string, string>>(m["headers"]);
      map<string, string> toMap1;
      for (auto item:map1) {
         toMap1[item.first] = item.second;
      }
      headers = make_shared<map<string, string>>(toMap1);
    }
    if (m.find("body") != m.end() && !m["body"].empty()) {
      if (typeid(map<string, boost::any>) == m["body"].type()) {
        CreateCertificateRequestResponseBody model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["body"]));
        body = make_shared<CreateCertificateRequestResponseBody>(model1);
      }
    }
  }

  virtual ~CreateCertificateRequestResponse() = default;
};
class CreateCertificateWithCsrRequestRequest : public Darabonba::Model {
public:
  shared_ptr<string> csr{};
  shared_ptr<string> email{};
  shared_ptr<string> phone{};
  shared_ptr<string> productCode{};
  shared_ptr<string> username{};
  shared_ptr<string> validateType{};

  CreateCertificateWithCsrRequestRequest() {}

  explicit CreateCertificateWithCsrRequestRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (csr) {
      res["Csr"] = boost::any(*csr);
    }
    if (email) {
      res["Email"] = boost::any(*email);
    }
    if (phone) {
      res["Phone"] = boost::any(*phone);
    }
    if (productCode) {
      res["ProductCode"] = boost::any(*productCode);
    }
    if (username) {
      res["Username"] = boost::any(*username);
    }
    if (validateType) {
      res["ValidateType"] = boost::any(*validateType);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("Csr") != m.end() && !m["Csr"].empty()) {
      csr = make_shared<string>(boost::any_cast<string>(m["Csr"]));
    }
    if (m.find("Email") != m.end() && !m["Email"].empty()) {
      email = make_shared<string>(boost::any_cast<string>(m["Email"]));
    }
    if (m.find("Phone") != m.end() && !m["Phone"].empty()) {
      phone = make_shared<string>(boost::any_cast<string>(m["Phone"]));
    }
    if (m.find("ProductCode") != m.end() && !m["ProductCode"].empty()) {
      productCode = make_shared<string>(boost::any_cast<string>(m["ProductCode"]));
    }
    if (m.find("Username") != m.end() && !m["Username"].empty()) {
      username = make_shared<string>(boost::any_cast<string>(m["Username"]));
    }
    if (m.find("ValidateType") != m.end() && !m["ValidateType"].empty()) {
      validateType = make_shared<string>(boost::any_cast<string>(m["ValidateType"]));
    }
  }

  virtual ~CreateCertificateWithCsrRequestRequest() = default;
};
class CreateCertificateWithCsrRequestResponseBody : public Darabonba::Model {
public:
  shared_ptr<long> orderId{};
  shared_ptr<string> requestId{};

  CreateCertificateWithCsrRequestResponseBody() {}

  explicit CreateCertificateWithCsrRequestResponseBody(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (orderId) {
      res["OrderId"] = boost::any(*orderId);
    }
    if (requestId) {
      res["RequestId"] = boost::any(*requestId);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("OrderId") != m.end() && !m["OrderId"].empty()) {
      orderId = make_shared<long>(boost::any_cast<long>(m["OrderId"]));
    }
    if (m.find("RequestId") != m.end() && !m["RequestId"].empty()) {
      requestId = make_shared<string>(boost::any_cast<string>(m["RequestId"]));
    }
  }

  virtual ~CreateCertificateWithCsrRequestResponseBody() = default;
};
class CreateCertificateWithCsrRequestResponse : public Darabonba::Model {
public:
  shared_ptr<map<string, string>> headers{};
  shared_ptr<CreateCertificateWithCsrRequestResponseBody> body{};

  CreateCertificateWithCsrRequestResponse() {}

  explicit CreateCertificateWithCsrRequestResponse(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!headers) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("headers is required.")));
    }
    if (!body) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("body is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (headers) {
      res["headers"] = boost::any(*headers);
    }
    if (body) {
      res["body"] = body ? boost::any(body->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("headers") != m.end() && !m["headers"].empty()) {
      map<string, string> map1 = boost::any_cast<map<string, string>>(m["headers"]);
      map<string, string> toMap1;
      for (auto item:map1) {
         toMap1[item.first] = item.second;
      }
      headers = make_shared<map<string, string>>(toMap1);
    }
    if (m.find("body") != m.end() && !m["body"].empty()) {
      if (typeid(map<string, boost::any>) == m["body"].type()) {
        CreateCertificateWithCsrRequestResponseBody model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["body"]));
        body = make_shared<CreateCertificateWithCsrRequestResponseBody>(model1);
      }
    }
  }

  virtual ~CreateCertificateWithCsrRequestResponse() = default;
};
class DeleteCertificateRequestRequest : public Darabonba::Model {
public:
  shared_ptr<long> orderId{};

  DeleteCertificateRequestRequest() {}

  explicit DeleteCertificateRequestRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (orderId) {
      res["OrderId"] = boost::any(*orderId);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("OrderId") != m.end() && !m["OrderId"].empty()) {
      orderId = make_shared<long>(boost::any_cast<long>(m["OrderId"]));
    }
  }

  virtual ~DeleteCertificateRequestRequest() = default;
};
class DeleteCertificateRequestResponseBody : public Darabonba::Model {
public:
  shared_ptr<string> requestId{};

  DeleteCertificateRequestResponseBody() {}

  explicit DeleteCertificateRequestResponseBody(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (requestId) {
      res["RequestId"] = boost::any(*requestId);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("RequestId") != m.end() && !m["RequestId"].empty()) {
      requestId = make_shared<string>(boost::any_cast<string>(m["RequestId"]));
    }
  }

  virtual ~DeleteCertificateRequestResponseBody() = default;
};
class DeleteCertificateRequestResponse : public Darabonba::Model {
public:
  shared_ptr<map<string, string>> headers{};
  shared_ptr<DeleteCertificateRequestResponseBody> body{};

  DeleteCertificateRequestResponse() {}

  explicit DeleteCertificateRequestResponse(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!headers) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("headers is required.")));
    }
    if (!body) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("body is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (headers) {
      res["headers"] = boost::any(*headers);
    }
    if (body) {
      res["body"] = body ? boost::any(body->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("headers") != m.end() && !m["headers"].empty()) {
      map<string, string> map1 = boost::any_cast<map<string, string>>(m["headers"]);
      map<string, string> toMap1;
      for (auto item:map1) {
         toMap1[item.first] = item.second;
      }
      headers = make_shared<map<string, string>>(toMap1);
    }
    if (m.find("body") != m.end() && !m["body"].empty()) {
      if (typeid(map<string, boost::any>) == m["body"].type()) {
        DeleteCertificateRequestResponseBody model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["body"]));
        body = make_shared<DeleteCertificateRequestResponseBody>(model1);
      }
    }
  }

  virtual ~DeleteCertificateRequestResponse() = default;
};
class DescribeCertificateStateRequest : public Darabonba::Model {
public:
  shared_ptr<long> orderId{};

  DescribeCertificateStateRequest() {}

  explicit DescribeCertificateStateRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (orderId) {
      res["OrderId"] = boost::any(*orderId);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("OrderId") != m.end() && !m["OrderId"].empty()) {
      orderId = make_shared<long>(boost::any_cast<long>(m["OrderId"]));
    }
  }

  virtual ~DescribeCertificateStateRequest() = default;
};
class DescribeCertificateStateResponseBody : public Darabonba::Model {
public:
  shared_ptr<string> certificate{};
  shared_ptr<string> content{};
  shared_ptr<string> domain{};
  shared_ptr<string> privateKey{};
  shared_ptr<string> recordDomain{};
  shared_ptr<string> recordType{};
  shared_ptr<string> recordValue{};
  shared_ptr<string> requestId{};
  shared_ptr<string> type{};
  shared_ptr<string> uri{};
  shared_ptr<string> validateType{};

  DescribeCertificateStateResponseBody() {}

  explicit DescribeCertificateStateResponseBody(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (certificate) {
      res["Certificate"] = boost::any(*certificate);
    }
    if (content) {
      res["Content"] = boost::any(*content);
    }
    if (domain) {
      res["Domain"] = boost::any(*domain);
    }
    if (privateKey) {
      res["PrivateKey"] = boost::any(*privateKey);
    }
    if (recordDomain) {
      res["RecordDomain"] = boost::any(*recordDomain);
    }
    if (recordType) {
      res["RecordType"] = boost::any(*recordType);
    }
    if (recordValue) {
      res["RecordValue"] = boost::any(*recordValue);
    }
    if (requestId) {
      res["RequestId"] = boost::any(*requestId);
    }
    if (type) {
      res["Type"] = boost::any(*type);
    }
    if (uri) {
      res["Uri"] = boost::any(*uri);
    }
    if (validateType) {
      res["ValidateType"] = boost::any(*validateType);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("Certificate") != m.end() && !m["Certificate"].empty()) {
      certificate = make_shared<string>(boost::any_cast<string>(m["Certificate"]));
    }
    if (m.find("Content") != m.end() && !m["Content"].empty()) {
      content = make_shared<string>(boost::any_cast<string>(m["Content"]));
    }
    if (m.find("Domain") != m.end() && !m["Domain"].empty()) {
      domain = make_shared<string>(boost::any_cast<string>(m["Domain"]));
    }
    if (m.find("PrivateKey") != m.end() && !m["PrivateKey"].empty()) {
      privateKey = make_shared<string>(boost::any_cast<string>(m["PrivateKey"]));
    }
    if (m.find("RecordDomain") != m.end() && !m["RecordDomain"].empty()) {
      recordDomain = make_shared<string>(boost::any_cast<string>(m["RecordDomain"]));
    }
    if (m.find("RecordType") != m.end() && !m["RecordType"].empty()) {
      recordType = make_shared<string>(boost::any_cast<string>(m["RecordType"]));
    }
    if (m.find("RecordValue") != m.end() && !m["RecordValue"].empty()) {
      recordValue = make_shared<string>(boost::any_cast<string>(m["RecordValue"]));
    }
    if (m.find("RequestId") != m.end() && !m["RequestId"].empty()) {
      requestId = make_shared<string>(boost::any_cast<string>(m["RequestId"]));
    }
    if (m.find("Type") != m.end() && !m["Type"].empty()) {
      type = make_shared<string>(boost::any_cast<string>(m["Type"]));
    }
    if (m.find("Uri") != m.end() && !m["Uri"].empty()) {
      uri = make_shared<string>(boost::any_cast<string>(m["Uri"]));
    }
    if (m.find("ValidateType") != m.end() && !m["ValidateType"].empty()) {
      validateType = make_shared<string>(boost::any_cast<string>(m["ValidateType"]));
    }
  }

  virtual ~DescribeCertificateStateResponseBody() = default;
};
class DescribeCertificateStateResponse : public Darabonba::Model {
public:
  shared_ptr<map<string, string>> headers{};
  shared_ptr<DescribeCertificateStateResponseBody> body{};

  DescribeCertificateStateResponse() {}

  explicit DescribeCertificateStateResponse(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!headers) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("headers is required.")));
    }
    if (!body) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("body is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (headers) {
      res["headers"] = boost::any(*headers);
    }
    if (body) {
      res["body"] = body ? boost::any(body->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("headers") != m.end() && !m["headers"].empty()) {
      map<string, string> map1 = boost::any_cast<map<string, string>>(m["headers"]);
      map<string, string> toMap1;
      for (auto item:map1) {
         toMap1[item.first] = item.second;
      }
      headers = make_shared<map<string, string>>(toMap1);
    }
    if (m.find("body") != m.end() && !m["body"].empty()) {
      if (typeid(map<string, boost::any>) == m["body"].type()) {
        DescribeCertificateStateResponseBody model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["body"]));
        body = make_shared<DescribeCertificateStateResponseBody>(model1);
      }
    }
  }

  virtual ~DescribeCertificateStateResponse() = default;
};
class DescribePackageStateRequest : public Darabonba::Model {
public:
  shared_ptr<string> productCode{};

  DescribePackageStateRequest() {}

  explicit DescribePackageStateRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (productCode) {
      res["ProductCode"] = boost::any(*productCode);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("ProductCode") != m.end() && !m["ProductCode"].empty()) {
      productCode = make_shared<string>(boost::any_cast<string>(m["ProductCode"]));
    }
  }

  virtual ~DescribePackageStateRequest() = default;
};
class DescribePackageStateResponseBody : public Darabonba::Model {
public:
  shared_ptr<long> issuedCount{};
  shared_ptr<string> productCode{};
  shared_ptr<string> requestId{};
  shared_ptr<long> totalCount{};
  shared_ptr<long> usedCount{};

  DescribePackageStateResponseBody() {}

  explicit DescribePackageStateResponseBody(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (issuedCount) {
      res["IssuedCount"] = boost::any(*issuedCount);
    }
    if (productCode) {
      res["ProductCode"] = boost::any(*productCode);
    }
    if (requestId) {
      res["RequestId"] = boost::any(*requestId);
    }
    if (totalCount) {
      res["TotalCount"] = boost::any(*totalCount);
    }
    if (usedCount) {
      res["UsedCount"] = boost::any(*usedCount);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("IssuedCount") != m.end() && !m["IssuedCount"].empty()) {
      issuedCount = make_shared<long>(boost::any_cast<long>(m["IssuedCount"]));
    }
    if (m.find("ProductCode") != m.end() && !m["ProductCode"].empty()) {
      productCode = make_shared<string>(boost::any_cast<string>(m["ProductCode"]));
    }
    if (m.find("RequestId") != m.end() && !m["RequestId"].empty()) {
      requestId = make_shared<string>(boost::any_cast<string>(m["RequestId"]));
    }
    if (m.find("TotalCount") != m.end() && !m["TotalCount"].empty()) {
      totalCount = make_shared<long>(boost::any_cast<long>(m["TotalCount"]));
    }
    if (m.find("UsedCount") != m.end() && !m["UsedCount"].empty()) {
      usedCount = make_shared<long>(boost::any_cast<long>(m["UsedCount"]));
    }
  }

  virtual ~DescribePackageStateResponseBody() = default;
};
class DescribePackageStateResponse : public Darabonba::Model {
public:
  shared_ptr<map<string, string>> headers{};
  shared_ptr<DescribePackageStateResponseBody> body{};

  DescribePackageStateResponse() {}

  explicit DescribePackageStateResponse(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!headers) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("headers is required.")));
    }
    if (!body) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("body is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (headers) {
      res["headers"] = boost::any(*headers);
    }
    if (body) {
      res["body"] = body ? boost::any(body->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("headers") != m.end() && !m["headers"].empty()) {
      map<string, string> map1 = boost::any_cast<map<string, string>>(m["headers"]);
      map<string, string> toMap1;
      for (auto item:map1) {
         toMap1[item.first] = item.second;
      }
      headers = make_shared<map<string, string>>(toMap1);
    }
    if (m.find("body") != m.end() && !m["body"].empty()) {
      if (typeid(map<string, boost::any>) == m["body"].type()) {
        DescribePackageStateResponseBody model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["body"]));
        body = make_shared<DescribePackageStateResponseBody>(model1);
      }
    }
  }

  virtual ~DescribePackageStateResponse() = default;
};
class ListUserCertificateOrderRequest : public Darabonba::Model {
public:
  shared_ptr<long> currentPage{};
  shared_ptr<string> keyword{};
  shared_ptr<string> orderType{};
  shared_ptr<long> showSize{};
  shared_ptr<string> status{};

  ListUserCertificateOrderRequest() {}

  explicit ListUserCertificateOrderRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (currentPage) {
      res["CurrentPage"] = boost::any(*currentPage);
    }
    if (keyword) {
      res["Keyword"] = boost::any(*keyword);
    }
    if (orderType) {
      res["OrderType"] = boost::any(*orderType);
    }
    if (showSize) {
      res["ShowSize"] = boost::any(*showSize);
    }
    if (status) {
      res["Status"] = boost::any(*status);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("CurrentPage") != m.end() && !m["CurrentPage"].empty()) {
      currentPage = make_shared<long>(boost::any_cast<long>(m["CurrentPage"]));
    }
    if (m.find("Keyword") != m.end() && !m["Keyword"].empty()) {
      keyword = make_shared<string>(boost::any_cast<string>(m["Keyword"]));
    }
    if (m.find("OrderType") != m.end() && !m["OrderType"].empty()) {
      orderType = make_shared<string>(boost::any_cast<string>(m["OrderType"]));
    }
    if (m.find("ShowSize") != m.end() && !m["ShowSize"].empty()) {
      showSize = make_shared<long>(boost::any_cast<long>(m["ShowSize"]));
    }
    if (m.find("Status") != m.end() && !m["Status"].empty()) {
      status = make_shared<string>(boost::any_cast<string>(m["Status"]));
    }
  }

  virtual ~ListUserCertificateOrderRequest() = default;
};
class ListUserCertificateOrderResponseBodyCertificateOrderList : public Darabonba::Model {
public:
  shared_ptr<string> algorithm{};
  shared_ptr<long> aliyunOrderId{};
  shared_ptr<long> buyDate{};
  shared_ptr<long> certEndTime{};
  shared_ptr<long> certStartTime{};
  shared_ptr<string> certType{};
  shared_ptr<string> domain{};
  shared_ptr<long> domainCount{};
  shared_ptr<string> domainType{};
  shared_ptr<string> instanceId{};
  shared_ptr<long> orderId{};
  shared_ptr<string> partnerOrderId{};
  shared_ptr<string> productCode{};
  shared_ptr<string> productName{};
  shared_ptr<string> rootBrand{};
  shared_ptr<string> sourceType{};
  shared_ptr<string> status{};
  shared_ptr<string> trusteeStatus{};
  shared_ptr<long> wildDomainCount{};

  ListUserCertificateOrderResponseBodyCertificateOrderList() {}

  explicit ListUserCertificateOrderResponseBodyCertificateOrderList(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (algorithm) {
      res["Algorithm"] = boost::any(*algorithm);
    }
    if (aliyunOrderId) {
      res["AliyunOrderId"] = boost::any(*aliyunOrderId);
    }
    if (buyDate) {
      res["BuyDate"] = boost::any(*buyDate);
    }
    if (certEndTime) {
      res["CertEndTime"] = boost::any(*certEndTime);
    }
    if (certStartTime) {
      res["CertStartTime"] = boost::any(*certStartTime);
    }
    if (certType) {
      res["CertType"] = boost::any(*certType);
    }
    if (domain) {
      res["Domain"] = boost::any(*domain);
    }
    if (domainCount) {
      res["DomainCount"] = boost::any(*domainCount);
    }
    if (domainType) {
      res["DomainType"] = boost::any(*domainType);
    }
    if (instanceId) {
      res["InstanceId"] = boost::any(*instanceId);
    }
    if (orderId) {
      res["OrderId"] = boost::any(*orderId);
    }
    if (partnerOrderId) {
      res["PartnerOrderId"] = boost::any(*partnerOrderId);
    }
    if (productCode) {
      res["ProductCode"] = boost::any(*productCode);
    }
    if (productName) {
      res["ProductName"] = boost::any(*productName);
    }
    if (rootBrand) {
      res["RootBrand"] = boost::any(*rootBrand);
    }
    if (sourceType) {
      res["SourceType"] = boost::any(*sourceType);
    }
    if (status) {
      res["Status"] = boost::any(*status);
    }
    if (trusteeStatus) {
      res["TrusteeStatus"] = boost::any(*trusteeStatus);
    }
    if (wildDomainCount) {
      res["WildDomainCount"] = boost::any(*wildDomainCount);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("Algorithm") != m.end() && !m["Algorithm"].empty()) {
      algorithm = make_shared<string>(boost::any_cast<string>(m["Algorithm"]));
    }
    if (m.find("AliyunOrderId") != m.end() && !m["AliyunOrderId"].empty()) {
      aliyunOrderId = make_shared<long>(boost::any_cast<long>(m["AliyunOrderId"]));
    }
    if (m.find("BuyDate") != m.end() && !m["BuyDate"].empty()) {
      buyDate = make_shared<long>(boost::any_cast<long>(m["BuyDate"]));
    }
    if (m.find("CertEndTime") != m.end() && !m["CertEndTime"].empty()) {
      certEndTime = make_shared<long>(boost::any_cast<long>(m["CertEndTime"]));
    }
    if (m.find("CertStartTime") != m.end() && !m["CertStartTime"].empty()) {
      certStartTime = make_shared<long>(boost::any_cast<long>(m["CertStartTime"]));
    }
    if (m.find("CertType") != m.end() && !m["CertType"].empty()) {
      certType = make_shared<string>(boost::any_cast<string>(m["CertType"]));
    }
    if (m.find("Domain") != m.end() && !m["Domain"].empty()) {
      domain = make_shared<string>(boost::any_cast<string>(m["Domain"]));
    }
    if (m.find("DomainCount") != m.end() && !m["DomainCount"].empty()) {
      domainCount = make_shared<long>(boost::any_cast<long>(m["DomainCount"]));
    }
    if (m.find("DomainType") != m.end() && !m["DomainType"].empty()) {
      domainType = make_shared<string>(boost::any_cast<string>(m["DomainType"]));
    }
    if (m.find("InstanceId") != m.end() && !m["InstanceId"].empty()) {
      instanceId = make_shared<string>(boost::any_cast<string>(m["InstanceId"]));
    }
    if (m.find("OrderId") != m.end() && !m["OrderId"].empty()) {
      orderId = make_shared<long>(boost::any_cast<long>(m["OrderId"]));
    }
    if (m.find("PartnerOrderId") != m.end() && !m["PartnerOrderId"].empty()) {
      partnerOrderId = make_shared<string>(boost::any_cast<string>(m["PartnerOrderId"]));
    }
    if (m.find("ProductCode") != m.end() && !m["ProductCode"].empty()) {
      productCode = make_shared<string>(boost::any_cast<string>(m["ProductCode"]));
    }
    if (m.find("ProductName") != m.end() && !m["ProductName"].empty()) {
      productName = make_shared<string>(boost::any_cast<string>(m["ProductName"]));
    }
    if (m.find("RootBrand") != m.end() && !m["RootBrand"].empty()) {
      rootBrand = make_shared<string>(boost::any_cast<string>(m["RootBrand"]));
    }
    if (m.find("SourceType") != m.end() && !m["SourceType"].empty()) {
      sourceType = make_shared<string>(boost::any_cast<string>(m["SourceType"]));
    }
    if (m.find("Status") != m.end() && !m["Status"].empty()) {
      status = make_shared<string>(boost::any_cast<string>(m["Status"]));
    }
    if (m.find("TrusteeStatus") != m.end() && !m["TrusteeStatus"].empty()) {
      trusteeStatus = make_shared<string>(boost::any_cast<string>(m["TrusteeStatus"]));
    }
    if (m.find("WildDomainCount") != m.end() && !m["WildDomainCount"].empty()) {
      wildDomainCount = make_shared<long>(boost::any_cast<long>(m["WildDomainCount"]));
    }
  }

  virtual ~ListUserCertificateOrderResponseBodyCertificateOrderList() = default;
};
class ListUserCertificateOrderResponseBody : public Darabonba::Model {
public:
  shared_ptr<vector<ListUserCertificateOrderResponseBodyCertificateOrderList>> certificateOrderList{};
  shared_ptr<long> currentPage{};
  shared_ptr<string> requestId{};
  shared_ptr<long> showSize{};
  shared_ptr<long> totalCount{};

  ListUserCertificateOrderResponseBody() {}

  explicit ListUserCertificateOrderResponseBody(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (certificateOrderList) {
      vector<boost::any> temp1;
      for(auto item1:*certificateOrderList){
        temp1.push_back(boost::any(item1.toMap()));
      }
      res["CertificateOrderList"] = boost::any(temp1);
    }
    if (currentPage) {
      res["CurrentPage"] = boost::any(*currentPage);
    }
    if (requestId) {
      res["RequestId"] = boost::any(*requestId);
    }
    if (showSize) {
      res["ShowSize"] = boost::any(*showSize);
    }
    if (totalCount) {
      res["TotalCount"] = boost::any(*totalCount);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("CertificateOrderList") != m.end() && !m["CertificateOrderList"].empty()) {
      if (typeid(vector<boost::any>) == m["CertificateOrderList"].type()) {
        vector<ListUserCertificateOrderResponseBodyCertificateOrderList> expect1;
        for(auto item1:boost::any_cast<vector<boost::any>>(m["CertificateOrderList"])){
          if (typeid(map<string, boost::any>) == item1.type()) {
            ListUserCertificateOrderResponseBodyCertificateOrderList model2;
            model2.fromMap(boost::any_cast<map<string, boost::any>>(item1));
            expect1.push_back(model2);
          }
        }
        certificateOrderList = make_shared<vector<ListUserCertificateOrderResponseBodyCertificateOrderList>>(expect1);
      }
    }
    if (m.find("CurrentPage") != m.end() && !m["CurrentPage"].empty()) {
      currentPage = make_shared<long>(boost::any_cast<long>(m["CurrentPage"]));
    }
    if (m.find("RequestId") != m.end() && !m["RequestId"].empty()) {
      requestId = make_shared<string>(boost::any_cast<string>(m["RequestId"]));
    }
    if (m.find("ShowSize") != m.end() && !m["ShowSize"].empty()) {
      showSize = make_shared<long>(boost::any_cast<long>(m["ShowSize"]));
    }
    if (m.find("TotalCount") != m.end() && !m["TotalCount"].empty()) {
      totalCount = make_shared<long>(boost::any_cast<long>(m["TotalCount"]));
    }
  }

  virtual ~ListUserCertificateOrderResponseBody() = default;
};
class ListUserCertificateOrderResponse : public Darabonba::Model {
public:
  shared_ptr<map<string, string>> headers{};
  shared_ptr<ListUserCertificateOrderResponseBody> body{};

  ListUserCertificateOrderResponse() {}

  explicit ListUserCertificateOrderResponse(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!headers) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("headers is required.")));
    }
    if (!body) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("body is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (headers) {
      res["headers"] = boost::any(*headers);
    }
    if (body) {
      res["body"] = body ? boost::any(body->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("headers") != m.end() && !m["headers"].empty()) {
      map<string, string> map1 = boost::any_cast<map<string, string>>(m["headers"]);
      map<string, string> toMap1;
      for (auto item:map1) {
         toMap1[item.first] = item.second;
      }
      headers = make_shared<map<string, string>>(toMap1);
    }
    if (m.find("body") != m.end() && !m["body"].empty()) {
      if (typeid(map<string, boost::any>) == m["body"].type()) {
        ListUserCertificateOrderResponseBody model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["body"]));
        body = make_shared<ListUserCertificateOrderResponseBody>(model1);
      }
    }
  }

  virtual ~ListUserCertificateOrderResponse() = default;
};
class RenewCertificateOrderForPackageRequestRequest : public Darabonba::Model {
public:
  shared_ptr<string> csr{};
  shared_ptr<long> orderId{};

  RenewCertificateOrderForPackageRequestRequest() {}

  explicit RenewCertificateOrderForPackageRequestRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (csr) {
      res["Csr"] = boost::any(*csr);
    }
    if (orderId) {
      res["OrderId"] = boost::any(*orderId);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("Csr") != m.end() && !m["Csr"].empty()) {
      csr = make_shared<string>(boost::any_cast<string>(m["Csr"]));
    }
    if (m.find("OrderId") != m.end() && !m["OrderId"].empty()) {
      orderId = make_shared<long>(boost::any_cast<long>(m["OrderId"]));
    }
  }

  virtual ~RenewCertificateOrderForPackageRequestRequest() = default;
};
class RenewCertificateOrderForPackageRequestResponseBody : public Darabonba::Model {
public:
  shared_ptr<long> orderId{};
  shared_ptr<string> requestId{};

  RenewCertificateOrderForPackageRequestResponseBody() {}

  explicit RenewCertificateOrderForPackageRequestResponseBody(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (orderId) {
      res["OrderId"] = boost::any(*orderId);
    }
    if (requestId) {
      res["RequestId"] = boost::any(*requestId);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("OrderId") != m.end() && !m["OrderId"].empty()) {
      orderId = make_shared<long>(boost::any_cast<long>(m["OrderId"]));
    }
    if (m.find("RequestId") != m.end() && !m["RequestId"].empty()) {
      requestId = make_shared<string>(boost::any_cast<string>(m["RequestId"]));
    }
  }

  virtual ~RenewCertificateOrderForPackageRequestResponseBody() = default;
};
class RenewCertificateOrderForPackageRequestResponse : public Darabonba::Model {
public:
  shared_ptr<map<string, string>> headers{};
  shared_ptr<RenewCertificateOrderForPackageRequestResponseBody> body{};

  RenewCertificateOrderForPackageRequestResponse() {}

  explicit RenewCertificateOrderForPackageRequestResponse(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!headers) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("headers is required.")));
    }
    if (!body) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("body is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (headers) {
      res["headers"] = boost::any(*headers);
    }
    if (body) {
      res["body"] = body ? boost::any(body->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("headers") != m.end() && !m["headers"].empty()) {
      map<string, string> map1 = boost::any_cast<map<string, string>>(m["headers"]);
      map<string, string> toMap1;
      for (auto item:map1) {
         toMap1[item.first] = item.second;
      }
      headers = make_shared<map<string, string>>(toMap1);
    }
    if (m.find("body") != m.end() && !m["body"].empty()) {
      if (typeid(map<string, boost::any>) == m["body"].type()) {
        RenewCertificateOrderForPackageRequestResponseBody model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["body"]));
        body = make_shared<RenewCertificateOrderForPackageRequestResponseBody>(model1);
      }
    }
  }

  virtual ~RenewCertificateOrderForPackageRequestResponse() = default;
};
class Client : Alibabacloud_OpenApi::Client {
public:
  explicit Client(const shared_ptr<Alibabacloud_OpenApi::Config>& config);
  string getEndpoint(shared_ptr<string> productId,
                     shared_ptr<string> regionId,
                     shared_ptr<string> endpointRule,
                     shared_ptr<string> network,
                     shared_ptr<string> suffix,
                     shared_ptr<map<string, string>> endpointMap,
                     shared_ptr<string> endpoint);
  CancelCertificateForPackageRequestResponse cancelCertificateForPackageRequestWithOptions(shared_ptr<CancelCertificateForPackageRequestRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  CancelCertificateForPackageRequestResponse cancelCertificateForPackageRequest(shared_ptr<CancelCertificateForPackageRequestRequest> request);
  CancelOrderRequestResponse cancelOrderRequestWithOptions(shared_ptr<CancelOrderRequestRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  CancelOrderRequestResponse cancelOrderRequest(shared_ptr<CancelOrderRequestRequest> request);
  CreateCertificateForPackageRequestResponse createCertificateForPackageRequestWithOptions(shared_ptr<CreateCertificateForPackageRequestRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  CreateCertificateForPackageRequestResponse createCertificateForPackageRequest(shared_ptr<CreateCertificateForPackageRequestRequest> request);
  CreateCertificateRequestResponse createCertificateRequestWithOptions(shared_ptr<CreateCertificateRequestRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  CreateCertificateRequestResponse createCertificateRequest(shared_ptr<CreateCertificateRequestRequest> request);
  CreateCertificateWithCsrRequestResponse createCertificateWithCsrRequestWithOptions(shared_ptr<CreateCertificateWithCsrRequestRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  CreateCertificateWithCsrRequestResponse createCertificateWithCsrRequest(shared_ptr<CreateCertificateWithCsrRequestRequest> request);
  DeleteCertificateRequestResponse deleteCertificateRequestWithOptions(shared_ptr<DeleteCertificateRequestRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  DeleteCertificateRequestResponse deleteCertificateRequest(shared_ptr<DeleteCertificateRequestRequest> request);
  DescribeCertificateStateResponse describeCertificateStateWithOptions(shared_ptr<DescribeCertificateStateRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  DescribeCertificateStateResponse describeCertificateState(shared_ptr<DescribeCertificateStateRequest> request);
  DescribePackageStateResponse describePackageStateWithOptions(shared_ptr<DescribePackageStateRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  DescribePackageStateResponse describePackageState(shared_ptr<DescribePackageStateRequest> request);
  ListUserCertificateOrderResponse listUserCertificateOrderWithOptions(shared_ptr<ListUserCertificateOrderRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  ListUserCertificateOrderResponse listUserCertificateOrder(shared_ptr<ListUserCertificateOrderRequest> request);
  RenewCertificateOrderForPackageRequestResponse renewCertificateOrderForPackageRequestWithOptions(shared_ptr<RenewCertificateOrderForPackageRequestRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  RenewCertificateOrderForPackageRequestResponse renewCertificateOrderForPackageRequest(shared_ptr<RenewCertificateOrderForPackageRequestRequest> request);

  virtual ~Client() = default;
};
} // namespace Alibabacloud_Cas20200407

#endif


text:
--- lib/src/tokenizer.cc.orig	2019-12-12 09:56:44 UTC
+++ lib/src/tokenizer.cc
@@ -5,7 +5,7 @@
 #include <internal/values/config_double.hpp>
 #include <internal/values/config_long.hpp>
 #include <internal/values/config_string.hpp>
-#include <boost/nowide/fstream.hpp>
+#include <boost/nowide/convert.hpp>
 #include <boost/lexical_cast.hpp>
 #include <leatherman/locale/locale.hpp>

ext: cc

max_stars_repo_name: jrmarino/ravensource

max_issues_repo_name: jrmarino/ravensource

max_forks_repo_name: jrmarino/ravensource