Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/crillab/nacre_mini
05 April 2024, 19:25:22 UTC
  • Code
  • Branches (7)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    • refs/tags/1.0.5
    • refs/tags/v1.0
    • refs/tags/v1.0.1
    • refs/tags/v1.0.2
    • refs/tags/v1.0.3
    • refs/tags/v1.0.4
    • 221f423ad4e9ad4dccf8b0c416d032b28b044139
    No releases to show
  • f797b78
  • /
  • XCSP3-CPP-Parser-master
  • /
  • include
  • /
  • XCSP3Variable.h
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:da50740c1eeb1ec25051642125dc9ca8fbca788e
origin badgedirectory badge
swh:1:dir:422521f5b70fcd02b9ab3fc41a24a295ba83601a
origin badgerevision badge
swh:1:rev:221f423ad4e9ad4dccf8b0c416d032b28b044139
origin badgesnapshot badge
swh:1:snp:20a942cf0ee7eee7dc11f4ddfcf6953b4057c492

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: 221f423ad4e9ad4dccf8b0c416d032b28b044139 authored by Gaël Glorian on 17 June 2019, 12:01:24 UTC
keepOnlyValues bypass fix
Tip revision: 221f423
XCSP3Variable.h
/*=============================================================================
 * parser for CSP instances represented in XCSP3 Format
 * 
 * Copyright (c) 2015 xcsp.org (contact <at> xcsp.org)
 * 
 * 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.
 *=============================================================================
 */
#ifndef XVARIABLE_H
#define    XVARIABLE_H

#include "XCSP3Domain.h"
#include <vector>
#include <sstream>


namespace XCSP3Core {

    class XInterval {
    public :
        int min, max;
        XInterval(int mn, int mx) : min(mn), max(mx) { }
        friend ostream &operator<<(ostream &f, const XInterval &ie);
    };


    class XEntity {
    public :
        std::string id;

        XEntity();
        XEntity(std::string lid);
        virtual ~XEntity();


        virtual void fake() { }  // Fake function to allow use of dynamic_cast !!

    };

    class XVariable : public XEntity {
    public :
        string classes;
        XDomainInteger *domain;

        XVariable(std::string idd, XDomainInteger *dom);
        XVariable(std::string idd, XDomainInteger *dom, std::vector<int> indexes);
        virtual ~XVariable();
        friend ostream &operator<<(ostream &f, const XVariable &ie);
    };




        /*
         * This is a fake variable used for representing an integer
         */

    class XInteger : public XVariable {
    public :
        int value;


        XInteger(std::string lid, int n) : XVariable(lid, NULL), value(n) { }

    };

    /*
     * This is a fake variable used for representing a Tree
     */
    class XTree : public XVariable {
    public:
        XTree(std::string lid) : XVariable(lid, NULL) { }
    };


    class XEInterval : public XVariable {
    public :
        int min, max;


        XEInterval(std::string lid, int mn, int mx) : XVariable(lid, NULL), min(mn), max(mx) { }
    };


    // Check if a XEntity is an integer
    // If yes, the value is set to its integer
    bool isInteger(XEntity *xe, int &value);

    // Check if a XEntity is an integer
    // If yes, the value is set to its integer
    bool isInterval(XEntity *xe, int &min, int &max);


    bool isVariable(XEntity *xe, XVariable * &v);

    /**
     * This is a fake variable used as parameter for group constraint
     */
    class XParameterVariable : public XVariable {
    public :
        int number; // -1 if %...
        XParameterVariable(std::string lid);
    };

    class XVariableArray : public XEntity {
    public :
        string classes;
        std::vector<XVariable *> variables; // The flat (one-dimensional) array
        std::vector<int> sizes; // The size of the array, as defined in XCSP3.


        /**
         * Builds an array of variables with the specified id, type and size. 
         * All variables are directly defined with the specified domain. 
         *
         */
        XVariableArray(std::string id, std::vector<int> szs);


        /**
         * 
         * Copy constructor 
         * @param domain
         */
        XVariableArray(std::string idd, XVariableArray *as);

        virtual ~XVariableArray();



        /** Transforms a flat index 
         * into a multi-dimensional index. 
         */
        void indexesFor(int flatIndex, std::vector<int> &indexes);



        int flatIndexFor(vector<int> indexes);


        bool incrementIndexes(vector<int> &indexes, vector<XIntegerEntity *> &ranges);



        /** Returns the list of variables that match the specified compact form. For example, for x[1..3], the list will contain x[1] x[2] and x[3]. */
        void getVarsFor(vector<XVariable *> &list, string compactForm, vector<int> *flatIndexes = NULL, bool storeIndexes = false);


        /** 
         * Builds a variable with the specified domain 
         *  for each unoccupied cell of the flat array. 
         */
        void buildVarsWith(XDomainInteger *domain);


    };
}

#endif	/* XVARIABLE_H */

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API