|
degate 0.1.1
|
The namespace 'degate' is the namespace for everything that belongs to libdegate. More...
Classes | |||
| class | AbstractShape | ||
| Represents an abstract shape. More... | |||
| class | Annotation | ||
| An annotation is a descriptive meta object that can be placed on a logic model's layer to mark a region of interest. More... | |||
| class | AutoNameGates | ||
| This class helps to generate names for gates depending on their position. More... | |||
| class | BackgroundClassifierBase | ||
| class | BackgroundClassifier | ||
| class | BoundingBox | ||
| class | CannyEdgeDetection | ||
| class | Circle | ||
| class | CodeTemplateGenerator | ||
| Base class for code generators. More... | |||
| class | ColoredObject | ||
| Represents an object that has a frame and a fill color. More... | |||
| class | Configuration | ||
| class | ConnectedLogicModelObject | ||
| Represents a logic model object, that can be electrically connected to other logic model objects. More... | |||
| class | DegateRuntimeException | ||
| Generic runtime exception in libdegate. More... | |||
| class | DegateInconsistencyException | ||
| Represents a runtime exception, that reflects an inconsistency in the logic model or gate library. More... | |||
| class | DegateLogicException | ||
| Represents a this-should-not-happen problem and indicates a programming error. More... | |||
| class | InvalidPointerException | ||
| This exception is raised if a code fragment receives a null pointer where this should not happen. More... | |||
| class | InvalidObjectIDException | ||
| This exception is raised if a method detects an invalid Object ID. More... | |||
| class | InvalidXMLException | ||
| Indicates a runtime exception from the XML parser. More... | |||
| class | XMLAttributeParseException | ||
| This exception is thrown if a XML importer failed to parse a value of an XML attribute. More... | |||
| class | XMLAttributeMissingException | ||
| This exception is thrown if a XML importer detects a missing XML attribute and this XML attribute must be present. More... | |||
| class | CollectionLookupException | ||
| This exception is thrown if a method failed to lookup an object in a collection type, such as in a std::map or list. More... | |||
| class | SystemException | ||
| This exception indicates, that a system operation failed. More... | |||
| class | FileSystemException | ||
| This exception indicates, that a file system operation failed. More... | |||
| class | InvalidPathException | ||
| This exception indicates an invalid path in the file system. More... | |||
| class | InvalidFileFormatException | ||
| This exception indicates, that libdegate is unable to handle the image file format. More... | |||
| class | ZipException | ||
| This exception is thrown if a ZIP archive cannot be exported. More... | |||
| class | XMLRPCException | ||
| Indicates a runtime exception from the XML parser. More... | |||
| class | DOTAttributes | ||
| Helper class to handle attributes for the dot language. More... | |||
| class | DOTExporter | ||
| Base class for a .dot exporter. More... | |||
| class | EdgeDetection | ||
| class | EMarker | ||
| Representation of an electrically connectable marker object. More... | |||
| class | ERCNet | ||
| Electrical Rule Checks that detects unusual net configurations. More... | |||
| class | ERCOpenPorts | ||
| Electrical Rule Checks that detects open ports, that means if a port is electrically unconnected. More... | |||
| class | Exporter | ||
| This is the base class for exporter classes. More... | |||
| class | ExternalMatching | ||
| Run an external program, that analyzes images. More... | |||
| class | FilterKernel | ||
| The class FilterKernel implemements a container for 2D filter kernel data. More... | |||
| class | SobelXOperator | ||
| class | SobelYOperator | ||
| class | SobelOperator | ||
| class | GaussianBlur | ||
| class | LoG | ||
| Implements a Laplacian of Gaussian. More... | |||
| class | Gate | ||
| The class Gate defines and implements a physically placed gate. More... | |||
| class | GateLibrary | ||
| This class represents a library of template cells. More... | |||
| class | GateLibraryExporter | ||
| The GateLibraryExporter exports a gate library. More... | |||
| class | GateLibraryImporter | ||
| The GateLibraryImporter imports a gate library. More... | |||
| class | GatePort | ||
| This class represents a port of a gate. More... | |||
| class | GateTemplate | ||
| A gate template is a container for common properties, that physically placed gates of that type share. More... | |||
| class | GateTemplatePort | ||
| This class represents a port of a gate template. More... | |||
| class | Grid | ||
| Base class for grid types. More... | |||
| class | HlObjectSet | ||
| This class represents a collection of highlighted objects. More... | |||
| class | ImageBase | ||
| class | Image | ||
| The generic templated class for image objects. More... | |||
| class | Image< PixelPolicy, StoragePolicy_PersistentFile > | ||
| Partial template specialization for the storage policy StoragePolicy_PersistentFile. More... | |||
| class | Image< PixelPolicy, StoragePolicy_Tile > | ||
| Partial template specialization for the storage policy StoragePolicy_Tile. More... | |||
| class | ImageHistogram | ||
| class | HueImageHistogram | ||
| class | SaturationImageHistogram | ||
| class | LightnessImageHistogram | ||
| class | RedChannelImageHistogram | ||
| class | GreenChannelImageHistogram | ||
| class | BlueChannelImageHistogram | ||
| class | ImageProcessorBase | ||
| Abstract base class for an image processor. More... | |||
| class | ImageReaderBase | ||
| The base class for image readers. More... | |||
| class | ImageReaderFactory | ||
| A factory for creating image reader objects. More... | |||
| class | ImageWriterBase | ||
| The base class for image readers. More... | |||
| class | Importer | ||
| The base class for importers that can parse text files. More... | |||
| class | IPConvolve | ||
| Processor: Convolve an image. More... | |||
| class | IPCopy | ||
| Processor: Copy an image with auto conversion. More... | |||
| class | IPImageWriter | ||
| Processor: Write an image to file. More... | |||
| class | IPMedianFilter | ||
| Processor: Median filter a single channel image. More... | |||
| class | IPNormalize | ||
| Processor: Normalize a single channel image. More... | |||
| class | IPPipe | ||
| Represents an image processing pipe for multiple image processors. More... | |||
| class | IPThresholding | ||
| Processor: Create a binary image from a single channel image. More... | |||
| class | IrregularGrid | ||
| This class represents a grid type with non equidistant spacing between grid lines. More... | |||
| class | JPEGReader | ||
| The JPEGReader parses jpeg images. More... | |||
| class | Layer | ||
| Representation of a chip layer. More... | |||
| class | Line | ||
| class | LinearPrimitive | ||
| Lineare primitive. More... | |||
| class | LineSegment | ||
| Line segment. More... | |||
| class | LineSegmentMap | ||
| Line segment map. More... | |||
| class | LineSegmentExtraction | ||
| class | LogicModel | ||
| This class represents the logic model. More... | |||
| class | LogicModelDOTExporter | ||
| The LogicModelDOTExporter exports the logic model or a part of the logic model as a dot graph. More... | |||
| class | LogicModelExporter | ||
| The LogicModelExporter exports a logic model. More... | |||
| class | LogicModelImporter | ||
| This class implements a logic model loader. More... | |||
| class | LogicModelObjectBase | ||
| The class LogicModelObjectBase is the base class for basically every class that represents a logic model object. More... | |||
| class | LookupSubcircuit | ||
| struct | CalculateImageMedianPolicy | ||
| Policy class for image region median calculation. More... | |||
| struct | CalculateImageMedianPolicy< ImageType, rgba_pixel_t > | ||
| Policy class for image region median calculation for RGB(A) images. More... | |||
| class | MemoryMap | ||
| class | MemoryMapBase | ||
| class | Module | ||
| Implements a container to build up higher level entities. More... | |||
| struct | ErodeImagePolicy | ||
| Policy class for image erosion. More... | |||
| struct | DilateImagePolicy | ||
| Policy class for image dilation. More... | |||
| class | Net | ||
| The net class represents an electrical potential that is shared between electrically adjacent objects. More... | |||
| class | ObjectIDRewriter | ||
| This class is used to defragment object IDs from a logic model. More... | |||
| class | ObjectSet | ||
| class | PixelPolicy_Base | ||
| Base class for image policies. More... | |||
| class | PixelPolicy_RGBA | ||
| class | PixelPolicy_GS_DOUBLE | ||
| Represents a greyscale image pixel policy. More... | |||
| class | PixelPolicy_GS_BYTE | ||
| Represents a greyscale image pixel policy. More... | |||
| class | PlacedLogicModelObject | ||
| Represents a placeable object. More... | |||
| class | PluginManager | ||
| The plugin manager that handles complex image processing plugins. More... | |||
| class | Point | ||
| class | PortColorManager | ||
| The PortColorManager manages color definitions based on common port names. More... | |||
| class | ProgressControl | ||
| class | Project | ||
| The project class is a container for project related data. More... | |||
| class | ProjectArchiver | ||
| Export a project directory as a ZIP archive. More... | |||
| class | ProjectExporter | ||
| The ProjectExporter exports a degate project. More... | |||
| class | ProjectImporter | ||
| Parser for degate's project files. More... | |||
| struct | get_bbox_trait_selector | ||
| struct | get_bbox_trait_selector< true > | ||
| class | QuadTree | ||
| Quad tree to store objects and to accesss them with a two dimensional access path. More... | |||
| class | down_iterator | ||
| class | region_iterator | ||
| class | RCBase | ||
| Base class for Rule Checks. More... | |||
| class | RCVBlacklistExporter | ||
| The RCVBlacklistExporter exports a set of RC Violations, which should be ignored. More... | |||
| class | RCVBlacklistImporter | ||
| The RCVBlacklistImporter imports a list of RC violations, which should be ignored. More... | |||
| class | RCVContainer | ||
| Representation for a container type, which holds a list of Rule Check Violations. More... | |||
| class | RCViolation | ||
| class | Rectangle | ||
| class | RegularGrid | ||
| Represents a grid with equidistant spacing between grid lines. More... | |||
| class | RemoteObject | ||
| class | RuleChecker | ||
| class | ScalingManager | ||
| The ScalingManager creates prescaled images for a master image. More... | |||
| class | SingletonBase | ||
| This is a base class for singletons. More... | |||
| class | StoragePolicy_Base | ||
| Base class for the storage policy of an image. More... | |||
| class | StoragePolicy_Memory | ||
| Storage policy for image objects that resists in memory. More... | |||
| class | StoragePolicy_File | ||
| Storage policy for image objects that are stored in a file. More... | |||
| class | StoragePolicy_TempFile | ||
| Storage policy for image objects that are stored in a temporary file. More... | |||
| class | StoragePolicy_PersistentFile | ||
| Storage policy for image objects that are stored in a persistent file. More... | |||
| class | SubImageAnalyzer | ||
| class | SubProjectAnnotation | ||
| An annotation for subprojects. More... | |||
| struct | TemplateMatchingStatistics | ||
| Helper structure for the collection of statistical values. More... | |||
| class | Matching | ||
| Base class for matching alorithms. More... | |||
| class | TemplateMatching | ||
| This class implements the matching of gate representing images on a background image. More... | |||
| class | TemplateMatchingNormal | ||
| This class implements a template matching that basically scans line by line to detect gate placements. More... | |||
| class | TemplateMatchingAlongGrid | ||
| This class is the base class for template matching along a grid. More... | |||
| class | TemplateMatchingInRows | ||
| This class implements matching for gate template that are aligned in a row. More... | |||
| class | TemplateMatchingInCols | ||
| This class implements matching for gate template that are aligned in a column. More... | |||
| class | TIFFReader | ||
| The TIFFReader parses tiff images. More... | |||
| class | TIFFWriter | ||
| The TIFFWriter parses tiff images. More... | |||
| class | TileCacheBase | ||
| class | GlobalTileCache | ||
| class | TileCache | ||
| The TileCache class handles caching of image tiles. More... | |||
| class | StoragePolicy_Tile | ||
| Storage policy for image objects that consists of tiles. More... | |||
| struct | assert_is_single_channel_image | ||
| Compile time check for single channel image types. More... | |||
| struct | assert_is_multi_channel_image | ||
| Compile time check for multi channel image types. More... | |||
| struct | is_pointer | ||
| A pointer trait for the generic type T. More... | |||
| struct | is_pointer< T * > | ||
| A pointer trait for the generic type T *. More... | |||
| struct | is_pointer< std::tr1::shared_ptr< T > > | ||
| A pointer trait for the special shared pointer of type T. More... | |||
| struct | call_trait | ||
| Method parameter type trait for pointer and shared pointer. More... | |||
| struct | call_trait< T, false > | ||
| Method parameter type trait for normal object that should be passed via reference. More... | |||
| struct | is_single_channel_image | ||
| Type trait for multi channel images. More... | |||
| struct | is_single_channel_image< rgba_pixel_t > | ||
| Type trait for single channel images. More... | |||
| class | VerilogCodeTemplateGenerator | ||
| A code template generator for Verilog. More... | |||
| class | VerilogModuleGenerator | ||
| class | VerilogTBCodeTemplateGenerator | ||
| A code template generator for Verilog. More... | |||
| class | VHDLCodeTemplateGenerator | ||
| A code template generator for VHDL. More... | |||
| class | VHDLTBCodeTemplateGenerator | ||
| A code template generator for VHDL. More... | |||
| class | Via | ||
| Representation of a via that interconnects layers of a chip. More... | |||
| class | ViaMatching | ||
| class | Wire | ||
| Represents a wire. More... | |||
| class | WireMatching | ||
| class | XMLExporter | ||
| A base class for XML exporter. More... | |||
| class | XMLImporter | ||
| class | ZeroCrossingEdgeDetection | ||
Typedefs | |||
| typedef std::pair< unsigned int, unsigned int > | coord_type | ||
| typedef std::list< coord_type > | coord_list | ||
| typedef std::vector < Classifier< coord_type > * > | classifier_list_type | ||
| typedef std::tr1::shared_ptr < CodeTemplateGenerator > | CodeTemplateGenerator_shptr | ||
| typedef std::tr1::shared_ptr < ExternalMatching > | ExternalMatching_shptr | ||
| typedef std::tr1::shared_ptr < FilterKernel > | FilterKernel_shptr | ||
| typedef std::tr1::shared_ptr < SobelXOperator > | SobelXOperator_shptr | ||
| typedef std::tr1::shared_ptr < SobelYOperator > | SobelYOperator_shptr | ||
| typedef std::tr1::shared_ptr < SobelOperator > | SobelOperator_shptr | ||
| typedef std::tr1::shared_ptr< LoG > | LoG_shptr | ||
| typedef std::tr1::shared_ptr < Gate > | Gate_shptr | ||
| typedef std::tr1::shared_ptr < GateTemplatePort > | GateTemplatePort_shptr | ||
| typedef std::tr1::shared_ptr < Circle > | Circle_shptr | ||
| typedef std::tr1::shared_ptr < Line > | Line_shptr | ||
| typedef std::tr1::shared_ptr < Rectangle > | Rectangle_shptr | ||
| typedef std::tr1::shared_ptr < ConnectedLogicModelObject > | ConnectedLogicModelObject_shptr | ||
| typedef std::tr1::shared_ptr < PlacedLogicModelObject > | PlacedLogicModelObject_shptr | ||
| typedef std::tr1::shared_ptr < RemoteObject > | RemoteObject_shptr | ||
| typedef std::tr1::shared_ptr< Net > | Net_shptr | ||
| typedef std::tr1::shared_ptr < GatePort > | GatePort_shptr | ||
| typedef std::tr1::shared_ptr < GateTemplate > | GateTemplate_shptr | ||
| typedef std::tr1::shared_ptr < GateLibrary > | GateLibrary_shptr | ||
| typedef std::tr1::shared_ptr < Layer > | Layer_shptr | ||
| typedef std::tr1::shared_ptr < Wire > | Wire_shptr | ||
| typedef std::tr1::shared_ptr< Via > | Via_shptr | ||
| typedef std::tr1::shared_ptr < EMarker > | EMarker_shptr | ||
| typedef std::tr1::shared_ptr < Annotation > | Annotation_shptr | ||
| typedef std::tr1::shared_ptr < Module > | Module_shptr | ||
| typedef std::tr1::shared_ptr < LogicModel > | LogicModel_shptr | ||
| typedef unsigned int | layer_position_t | ||
| typedef uint32_t | color_t | ||
| defines the type for colors | |||
| typedef unsigned long long | object_id_t | ||
| typedef unsigned long long | layer_id_t | ||
| typedef unsigned long long | transaction_id_t | ||
| typedef unsigned int | diameter_t | ||
| typedef unsigned int | length_t | ||
| typedef int | pos_t | ||
| typedef std::map< ENTITY_COLOR, color_t > | default_colors_t | ||
| typedef std::tr1::shared_ptr < Grid > | Grid_shptr | ||
| typedef std::tr1::shared_ptr < ImageBase > | ImageBase_shptr | ||
| typedef Image < PixelPolicy_RGBA, StoragePolicy_Tile > | TileImage_RGBA | ||
| Typedefs for common types of virtual images. | |||
| typedef Image < PixelPolicy_GS_DOUBLE, StoragePolicy_Tile > | TileImage_GS_DOUBLE | ||
| typedef Image < PixelPolicy_GS_BYTE, StoragePolicy_Tile > | TileImage_GS_BYTE | ||
| typedef std::tr1::shared_ptr < TileImage_RGBA > | TileImage_RGBA_shptr | ||
| typedef std::tr1::shared_ptr < TileImage_GS_DOUBLE > | TileImage_GS_DOUBLE_shptr | ||
| typedef std::tr1::shared_ptr < TileImage_GS_BYTE > | TileImage_GS_BYTE_shptr | ||
| typedef Image < PixelPolicy_RGBA, StoragePolicy_Tile > | BackgroundImage | ||
| typedef std::tr1::shared_ptr < BackgroundImage > | BackgroundImage_shptr | ||
| typedef Image < PixelPolicy_RGBA, StoragePolicy_TempFile > | TempImage_RGBA | ||
| typedef Image < PixelPolicy_GS_DOUBLE, StoragePolicy_TempFile > | TempImage_GS_DOUBLE | ||
| typedef Image < PixelPolicy_GS_BYTE, StoragePolicy_TempFile > | TempImage_GS_BYTE | ||
| typedef std::tr1::shared_ptr < TempImage_RGBA > | TempImage_RGBA_shptr | ||
| typedef std::tr1::shared_ptr < TempImage_GS_DOUBLE > | TempImage_GS_DOUBLE_shptr | ||
| typedef std::tr1::shared_ptr < TempImage_GS_BYTE > | TempImage_GS_BYTE_shptr | ||
| typedef Image < PixelPolicy_RGBA, StoragePolicy_PersistentFile > | PersistentImage_RGBA | ||
| typedef std::tr1::shared_ptr < PersistentImage_RGBA > | PersistentImage_RGBA_shptr | ||
| typedef Image < PixelPolicy_RGBA, StoragePolicy_Memory > | MemoryImage | ||
| typedef std::tr1::shared_ptr < MemoryImage > | MemoryImage_shptr | ||
| typedef Image < PixelPolicy_GS_BYTE, StoragePolicy_Memory > | MemoryImage_GS_BYTE | ||
| typedef Image < PixelPolicy_GS_DOUBLE, StoragePolicy_Memory > | MemoryImage_GS_DOUBLE | ||
| typedef Image < PixelPolicy_RGBA, StoragePolicy_Memory > | MemoryImage_RGBA | ||
| typedef std::tr1::shared_ptr < MemoryImage_GS_BYTE > | MemoryImage_GS_BYTE_shptr | ||
| typedef std::tr1::shared_ptr < MemoryImage_GS_DOUBLE > | MemoryImage_GS_DOUBLE_shptr | ||
| typedef MemoryImage | RendererImage | ||
| typedef MemoryImage_shptr | RendererImage_shptr | ||
| typedef MemoryImage | GateTemplateImage | ||
| typedef MemoryImage_shptr | GateTemplateImage_shptr | ||
| typedef std::tr1::shared_ptr < ImageProcessorBase > | ImageProcessorBase_shptr | ||
| typedef std::list< std::string > | file_format_collection | ||
| typedef std::tr1::shared_ptr < IrregularGrid > | IrregularGrid_shptr | ||
| typedef std::tr1::shared_ptr < LinearPrimitive > | LinearPrimitive_shptr | ||
| typedef std::tr1::shared_ptr < LineSegment > | LineSegment_shptr | ||
| typedef std::tr1::shared_ptr < LineSegmentMap > | LineSegmentMap_shptr | ||
| typedef std::tr1::shared_ptr < LogicModelObjectBase > | LogicModelObjectBase_shptr | ||
| typedef std::tr1::shared_ptr < ObjectIDRewriter > | ObjectIDRewriter_shptr | ||
| typedef uint8_t | gs_byte_pixel_t | ||
| typedef double | gs_double_pixel_t | ||
| typedef uint32_t | rgba_pixel_t | ||
| typedef std::tr1::shared_ptr < Point > | Point_shptr | ||
| typedef std::tr1::shared_ptr < PortColorManager > | PortColorManager_shptr | ||
| Typedef for a shared pointer on PortColorManager objects. | |||
| typedef std::tr1::shared_ptr < ProgressControl > | ProgressControl_shptr | ||
| typedef std::list < std::tr1::shared_ptr < Project > > | ProjectList | ||
| typedef std::tr1::shared_ptr < Project > | Project_shptr | ||
| typedef std::tr1::shared_ptr < RCBase > | RCBase_shptr | ||
| typedef std::tr1::shared_ptr < RCViolation > | RCViolation_shptr | ||
| typedef std::tr1::shared_ptr < RegularGrid > | RegularGrid_shptr | ||
| typedef std::tr1::shared_ptr < ScalingManager < BackgroundImage > > | ScalingManager_shptr | ||
| A typedef for scaling managers that handle background images. | |||
| typedef std::tr1::shared_ptr < SubProjectAnnotation > | SubProjectAnnotation_shptr | ||
| typedef std::tr1::shared_ptr < TemplateMatching > | TemplateMatching_shptr | ||
| typedef std::tr1::shared_ptr < TemplateMatchingNormal > | TemplateMatchingNormal_shptr | ||
| typedef std::tr1::shared_ptr < TemplateMatchingInRows > | TemplateMatchingInRows_shptr | ||
| typedef std::tr1::shared_ptr < TemplateMatchingInCols > | TemplateMatchingInCols_shptr | ||
| typedef std::tr1::shared_ptr < VerilogCodeTemplateGenerator > | VerilogCodeTemplateGenerator_shptr | ||
| typedef std::tr1::shared_ptr < VerilogTBCodeTemplateGenerator > | VerilogTBCodeTemplateGenerator_shptr | ||
| typedef std::tr1::shared_ptr < VHDLCodeTemplateGenerator > | VHDLCodeTemplateGenerator_shptr | ||
| typedef std::tr1::shared_ptr < VHDLTBCodeTemplateGenerator > | VHDLTBCodeTemplateGenerator_shptr | ||
| typedef std::tr1::shared_ptr < ViaMatching > | ViaMatching_shptr | ||
| typedef std::tr1::shared_ptr < WireMatching > | WireMatching_shptr | ||
Enumerations | |||
| enum | ret_t { RET_OK = 0, RET_ERR = 1, RET_INV_PTR = 2, RET_MALLOC_FAILED = 3, RET_INV_PATH = 4, RET_MATH_ERR = 5, RET_CANCEL = 6 } | ||
| enum | ENTITY_COLOR { DEFAULT_COLOR_WIRE, DEFAULT_COLOR_VIA_UP, DEFAULT_COLOR_VIA_DOWN, DEFAULT_COLOR_GRID, DEFAULT_COLOR_ANNOTATION, DEFAULT_COLOR_ANNOTATION_FRAME, DEFAULT_COLOR_GATE, DEFAULT_COLOR_GATE_FRAME, DEFAULT_COLOR_GATE_PORT, DEFAULT_COLOR_TEXT, DEFAULT_COLOR_EMARKER } | ||
| enum | MAP_STORAGE_TYPE { MAP_STORAGE_TYPE_MEM = 0, MAP_STORAGE_TYPE_PERSISTENT_FILE = 1, MAP_STORAGE_TYPE_TEMP_FILE = 2 } | ||
| enum | IMAGE_TYPE { IMAGE_TYPE_GS_BYTE = 1, IMAGE_TYPE_GS_DOUBLE = 2, IMAGE_TYPE_RGBA = 3 } | ||
| enum | RC_SEVERITY { RC_UNDEFINED = 0, RC_ERROR = 1, RC_WARNING = 2 } | ||
| An enum for several types of Rule Check problem types. More... | |||
Functions | |||
| std::string | get_temp_directory () | ||
| Get the temp directory. | |||
| template<typename IntegerType > | |||
| IntegerType | next_power_of_two (IntegerType i) | ||
Calculate the next higher power of two for a value i with i > 0. | |||
| std::vector< std::string > | tokenize (std::string const &str) | ||
| Tokenize a string. | |||
| std::string | write_string_to_temp_file (std::string const &dir, std::string const &content) | ||
| Write a string to a temp file. | |||
| void | write_string_to_file (std::string const &path, std::string const &content) | ||
| Write a string to a file. | |||
| int | execute_command (std::string const &command, std::list< std::string > const ¶ms) | ||
| Execute a command. | |||
| bool | is_directory (std::string const &path) | ||
| Check if a path is a directory. | |||
| bool | is_file (std::string const &path) | ||
| Check if a path is a regular file. | |||
| bool | is_symlink (std::string const &path) | ||
| Check if a path is a symlink. | |||
| bool | file_exists (std::string const &path) | ||
| Check if a file or directory exists. | |||
| std::string | get_basedir (std::string const &path) | ||
| Get the base directory for file or directory. | |||
| std::string | get_realpath (std::string const &path) | ||
| Get the canonicalized absolute pathname. | |||
| std::string | get_file_suffix (std::string const &path) | ||
| Get a file suffix without the dot, e.g. | |||
| std::string | get_filename_from_path (std::string const &path) | ||
| Get filename part of a path. | |||
| std::string | get_basename (std::string const &path) | ||
| Get the basename of a file. | |||
| void | remove_file (std::string const &filename) | ||
| Unlink a file. | |||
| void | remove_directory (std::string const &path) | ||
| Unlink a directory with all files in it. | |||
| void | create_directory (std::string const &directory, mode_t mode=0700) | ||
| Create a directory. | |||
| std::string | create_temp_directory () | ||
| Create a temp directory. | |||
| std::string | create_temp_directory (std::string const &directory_pattern) | ||
| Create a temporary directory based on a path pattern specification. | |||
| std::string | generate_temp_file_pattern (std::string const &basedir) | ||
| Generate a pattern within a basedir for temp files. | |||
| std::list< std::string > | read_directory (std::string const &path, bool prefix_path=false) | ||
| Read all entries from a directory, but not from subdirectories. | |||
| std::string | join_pathes (std::string const &base_path, std::string const &extension_path) | ||
| Join path specifications. | |||
| std::string | get_relative_path (std::string const &path, std::string const &relative_to) | ||
| Make a path specification relative to another. | |||
| boost::filesystem::path | strip_path (boost::filesystem::path const &strip_from, boost::filesystem::path const &strip_what) | ||
| Strip the leading directory part from a path. | |||
| std::string | gen_tabs (int n) | ||
| template<typename ImageType > | |||
| std::tr1::shared_ptr< ImageType > | load_image (std::string const &path) | ||
| Load an image in a common image format, such as tiff. | |||
| template<typename ImageType > | |||
| void | load_image (std::string const &path, std::tr1::shared_ptr< ImageType > img) | ||
| Load an image in a common image format, such as tiff, into an existing degate image. | |||
| template<typename ImageType > | |||
| void | save_image (std::string const &path, std::tr1::shared_ptr< ImageType > img) | ||
| Store an image in a common file format. | |||
| template<typename ImageType > | |||
| void | save_part_of_image (std::string const &path, std::tr1::shared_ptr< ImageType > img, BoundingBox const &bounding_box) | ||
| Save a part of an image. | |||
| template<typename ImageType > | |||
| void | save_normalized_image (std::string const &path, std::tr1::shared_ptr< ImageType > img) | ||
| Normalize a single channel image and store it in a common file format. | |||
| template<typename ImageType > | |||
| std::tr1::shared_ptr< ImageType > | merge_images (std::list< std::tr1::shared_ptr< ImageType > > const &images) | ||
| Merge a set of images by averaging them. | |||
| template<typename ImageType > | |||
| void | flip_left_right (std::tr1::shared_ptr< ImageType > img) | ||
| Flip image in place from left to right. | |||
| template<typename ImageType > | |||
| void | flip_up_down (std::tr1::shared_ptr< ImageType > img) | ||
| Flip image in place from top to down. | |||
| template<typename ImageType > | |||
| void | flip_both (std::tr1::shared_ptr< ImageType > img) | ||
| Flip image in place from top to down and from left to right. | |||
| double | rgba_to_hue (rgba_pixel_t p) | ||
| Convert an RGBA pixel to a hue value. | |||
| double | rgba_to_saturation (rgba_pixel_t p) | ||
| Convert an RGBA pixel to a saturation value. | |||
| double | rgba_to_lightness (rgba_pixel_t p) | ||
| Convert an RGBA pixel to a lightness value. | |||
| template<typename PixelTypeDst , typename PixelTypeSrc > | |||
| PixelTypeDst | convert_pixel (PixelTypeSrc p) | ||
| Convert a pixel from a source type to a destination type. | |||
| template<> | |||
| gs_byte_pixel_t | convert_pixel< gs_byte_pixel_t, rgba_pixel_t > (rgba_pixel_t p) | ||
| Convert pixel value from from rgba -> byte. | |||
| template<> | |||
| gs_double_pixel_t | convert_pixel< gs_double_pixel_t, rgba_pixel_t > (rgba_pixel_t p) | ||
| Convert pixel value from from rgba -> double. | |||
| template<> | |||
| rgba_pixel_t | convert_pixel< rgba_pixel_t, gs_byte_pixel_t > (gs_byte_pixel_t p) | ||
| Convert pixel value from from byte -> rgba. | |||
| template<> | |||
| rgba_pixel_t | convert_pixel< rgba_pixel_t, gs_double_pixel_t > (gs_double_pixel_t p) | ||
| Convert pixel value from from double -> rgba. | |||
| template<typename PixelTypeDst , typename ImageTypeSrc > | |||
| PixelTypeDst | get_pixel_as (typename std::tr1::shared_ptr< ImageTypeSrc > img, unsigned int x, unsigned int y) | ||
| template<typename PixelTypeSrc , typename ImageTypeDst > | |||
| void | set_pixel_as (typename std::tr1::shared_ptr< ImageTypeDst > img, unsigned int x, unsigned int y, PixelTypeSrc p) | ||
| template<typename ImageTypeDst , typename ImageTypeSrc > | |||
| void | copy_image (std::tr1::shared_ptr< ImageTypeDst > dst, std::tr1::shared_ptr< ImageTypeSrc > src) | ||
| Copy an image. | |||
| template<typename ImageTypeDst , typename ImageTypeSrc > | |||
| void | extract_partial_image (std::tr1::shared_ptr< ImageTypeDst > dst, std::tr1::shared_ptr< ImageTypeSrc > src, unsigned int min_x, unsigned int max_x, unsigned int min_y, unsigned int max_y) | ||
Extract a partial image from src with the region defined by the parameters into a destination image dst. | |||
| template<typename ImageTypeDst , typename ImageTypeSrc > | |||
| void | extract_partial_image (std::tr1::shared_ptr< ImageTypeDst > dst, std::tr1::shared_ptr< ImageTypeSrc > src, BoundingBox const &bounding_box) | ||
| Extract a partial image. | |||
| template<typename ImageTypeDst , typename ImageTypeSrc > | |||
| void | convert_to_greyscale (std::tr1::shared_ptr< ImageTypeDst > dst, std::tr1::shared_ptr< ImageTypeSrc > src) | ||
| Convert an image to greyscale. | |||
| template<typename ImageType > | |||
| void | convert_to_greyscale (std::tr1::shared_ptr< ImageType > img) | ||
| In place conversion to a greyscale image. | |||
| template<typename ImageTypeDst , typename ImageTypeSrc > | |||
| void | scale_down_by_2 (std::tr1::shared_ptr< ImageTypeDst > dst, std::tr1::shared_ptr< ImageTypeSrc > src) | ||
| Scale a source image down by factor 2. | |||
| template<typename ImageTypeDst , typename ImageTypeSrc > | |||
| void | scale_down_by_power_of_2 (std::tr1::shared_ptr< ImageTypeDst > dst, std::tr1::shared_ptr< ImageTypeSrc > src) | ||
| Scale a source image down by factor 2. | |||
| template<typename ImageType > | |||
| void | clear_image (std::tr1::shared_ptr< ImageType > img) | ||
| Clear an image. | |||
| template<typename ImageType > | |||
| std::tr1::shared_ptr< ImageType > | load_degate_image (unsigned int width, unsigned int height, std::string const &path) | ||
| Helper function to load existing images in a degate image format. | |||
| template<typename ImageTypeDst , typename ImageTypeSrc > | |||
| void | normalize (std::tr1::shared_ptr< ImageTypeDst > dst, std::tr1::shared_ptr< ImageTypeSrc > src, double lower_bound=0, double upper_bound=1) | ||
| Normalize a single channel image. | |||
| template<typename ImageType > | |||
| void | normalize (std::tr1::shared_ptr< ImageType > img, double lower_bound=0, double upper_bound=1) | ||
| Normalize a single channel image in place. | |||
| template<typename ImageTypeDst , typename ImageTypeSrc > | |||
| void | thresholding_image (std::tr1::shared_ptr< ImageTypeDst > dst, std::tr1::shared_ptr< ImageTypeSrc > src, double threshold) | ||
| Thresholding a single channel image. | |||
| template<typename ImageTypeDst , typename ImageTypeSrc > | |||
| void | convolve (std::tr1::shared_ptr< ImageTypeDst > dst, std::tr1::shared_ptr< ImageTypeSrc > src, FilterKernel_shptr kernel) | ||
| Convolve a single channel source image with a filter kernel and write it into a destination image. | |||
| template<typename ImageTypeDst , typename ImageTypeSrc , typename FunctionPolicy > | |||
| void | filter_image (std::tr1::shared_ptr< ImageTypeDst > dst, std::tr1::shared_ptr< ImageTypeSrc > src, unsigned int kernel_width=3, unsigned int threshold=3) | ||
| Filter an (RBGA) image. | |||
| template<typename ImageType > | |||
| ImageType::pixel_type | get_minimum (std::tr1::shared_ptr< ImageType > img) | ||
| Get the minimum pixel value of a single channel image. | |||
| template<typename ImageType > | |||
| ImageType::pixel_type | get_maximum (std::tr1::shared_ptr< ImageType > img) | ||
| Get the maximum pixel value of a single channel image. | |||
| template<typename ImageType > | |||
| double | average (std::tr1::shared_ptr< ImageType > img) | ||
| Calculate the average pixel value of a single channel image. | |||
| template<typename ImageType > | |||
| double | average (std::tr1::shared_ptr< ImageType > img, unsigned int start_x, unsigned int start_y, unsigned int width, unsigned int height) | ||
| Calculate the average pixel value of a single channel image. | |||
| template<typename ImageType > | |||
| void | average_and_stddev (std::tr1::shared_ptr< ImageType > img, unsigned int start_x, unsigned int start_y, unsigned int width, unsigned int height, double *avg, double *stddev) | ||
| Calculate the average pixel value of a single channel image. | |||
| Layer_shptr | get_first_layer (LogicModel_shptr lmodel, Layer::LAYER_TYPE layer_type) | ||
| Get the first layer of a layer type. | |||
| Layer_shptr | get_first_logic_layer (LogicModel_shptr lmodel) | ||
| Get the first layer that is a logic layer. | |||
| Gate_shptr | get_gate_by_name (LogicModel_shptr lmodel, std::string const &gate_name) | ||
| Lookup a gate by it's name. | |||
| void | apply_colors_to_gate_ports (LogicModel_shptr lmodel, PortColorManager_shptr pcm) | ||
| Get the color definition for port names from the PortColorManager and apply it to gate ports. | |||
| std::list< Layer_shptr > | get_available_standard_layers (LogicModel_shptr lmodel) | ||
| Get layer pointers for the first transistor layer and M1 and M2, if they are available. | |||
| template<typename ImageType > | |||
| std::tr1::shared_ptr< ImageType > | grab_image (LogicModel_shptr lmodel, Layer_shptr layer, BoundingBox const &bounding_box) | ||
| Extract a partial image from the background image for a layer. | |||
| void | merge_gate_images (LogicModel_shptr lmodel, Layer_shptr layer, GateTemplate_shptr tmpl, std::list< Gate_shptr > const &gates) | ||
| Merge images. | |||
| void | merge_gate_images (LogicModel_shptr lmodel, ObjectSet gates) | ||
| Merge images. | |||
| void | grab_template_images (LogicModel_shptr lmodel, GateTemplate_shptr gate_template, BoundingBox const &bounding_box, Gate::ORIENTATION orientation=Gate::ORIENTATION_NORMAL) | ||
| Extract a partial image from the background images for several layers and set the extracted images as master images for a gate template. | |||
| template<class InputIterator > | |||
| std::set< Net_shptr > | collect_nets (InputIterator first, InputIterator last) | ||
Collect nets that are used by the objects from first to last. | |||
| template<class InputIterator > | |||
| void | isolate_objects (LogicModel_shptr lmodel, InputIterator first, InputIterator last) | ||
| Isolate objects. | |||
| void | remove_entire_net (LogicModel_shptr lmodel, Net_shptr net) | ||
| Remove net from the logic model and remove it from all objects, which share a net. | |||
| void | connect_objects (LogicModel_shptr lmodel, ConnectedLogicModelObject_shptr o1, ConnectedLogicModelObject_shptr o2) | ||
| Connect objects. | |||
| template<class InputIterator > | |||
| void | connect_objects (LogicModel_shptr lmodel, InputIterator first, InputIterator last) | ||
| Connect objects. | |||
| void | autoconnect_objects (LogicModel_shptr lmodel, Layer_shptr layer, BoundingBox const &search_bbox) | ||
| Autoconnect objects that tangent each other from a layer within the bounding box. | |||
| void | autoconnect_interlayer_objects (LogicModel_shptr lmodel, Layer_shptr layer, BoundingBox const &search_bbox) | ||
| Autoconnect vias on adjacent enabled layers. | |||
| void | load_background_image (Layer_shptr layer, std::string const &project_dir, std::string const &image_file) | ||
| Load an image in a common image format as background image for a layer. | |||
| void | clear_logic_model (LogicModel_shptr lmodel, Layer_shptr layer) | ||
| Clear the logic model for a layer. | |||
| Layer_shptr | get_first_enabled_layer (LogicModel_shptr lmodel) | ||
Get first enabled layer
| |||
| Layer_shptr | get_next_enabled_layer (LogicModel_shptr lmodel) | ||
| Get next enabled layer. | |||
| Layer_shptr | get_next_enabled_layer (LogicModel_shptr lmodel, Layer_shptr layer) | ||
Get the next enabled layer, that is above layer. | |||
| Layer_shptr | get_prev_enabled_layer (LogicModel_shptr lmodel) | ||
| Get previous enabled layer. | |||
| Layer_shptr | get_prev_enabled_layer (LogicModel_shptr lmodel, Layer_shptr layer) | ||
Get the previous enabled layer, that is below layer. | |||
| Layer_shptr | get_current_layer (Project_shptr project) | ||
| Get the current layer. | |||
| bool | is_logic_class (Gate_shptr gate, std::string const &logic_class) | ||
| Check if a gate is of a specific logic class. | |||
| GateTemplatePort::PORT_TYPE | get_port_type (GatePort_shptr gate_port) | ||
| Get the port type of a gate port. | |||
| std::string | get_template_port_name (GatePort_shptr gate_port) | ||
| Get the name of a corresponding template port. | |||
| void | apply_port_color_settings (LogicModel_shptr lmodel, PortColorManager_shptr pcm) | ||
| Apply port color definitions to all gate template ports. | |||
| void | update_port_diameters (LogicModel_shptr lmodel, diameter_t new_size) | ||
| Resize all gate ports from the logic model to the new size. | |||
| template<typename ImageTypeDst , typename ImageTypeSrc > | |||
| void | median_filter (std::tr1::shared_ptr< ImageTypeDst > dst, std::tr1::shared_ptr< ImageTypeSrc > src, unsigned int kernel_width=3) | ||
| Filter an image with a median filter. | |||
| void | determine_module_ports_for_root (LogicModel_shptr lmodel) | ||
| Determine ports of a root module. | |||
| template<typename ImageTypeDst , typename ImageTypeSrc > | |||
| void | erode_image (std::tr1::shared_ptr< ImageTypeDst > dst, std::tr1::shared_ptr< ImageTypeSrc > src, unsigned int kernel_width=3, unsigned int erosion_threshold=3) | ||
| Filter an image with an erosion filter. | |||
| template<typename ImageTypeDst , typename ImageTypeSrc > | |||
| void | dilate_image (std::tr1::shared_ptr< ImageTypeDst > dst, std::tr1::shared_ptr< ImageTypeSrc > src, unsigned int kernel_width=3, unsigned int dilation_threshold=3) | ||
| Filter an image with an erosion filter. | |||
| template<typename ImageTypeDst , typename ImageTypeSrc > | |||
| void | morphological_open (std::tr1::shared_ptr< ImageTypeDst > dst, std::tr1::shared_ptr< ImageTypeSrc > src, unsigned int kernel_width=3, unsigned int threshold_dilate=1, unsigned int threshold_erode=3) | ||
| Morphological open. | |||
| template<typename ImageTypeDst , typename ImageTypeSrc > | |||
| void | morphological_close (std::tr1::shared_ptr< ImageTypeDst > dst, std::tr1::shared_ptr< ImageTypeSrc > src, unsigned int kernel_width=3, unsigned int threshold_dilate=1, unsigned int threshold_erode=3) | ||
| Morphological close. | |||
| template<typename ImageType > | |||
| bool | zhang_suen_thinning_iteration (std::tr1::shared_ptr< ImageType > img, bool condition_switch) | ||
| Helper function for the Zhang-Suen-Thinning. | |||
| template<typename ImageType > | |||
| void | thinning (std::tr1::shared_ptr< ImageType > img) | ||
| Zhang-Suen-Thinning of an image. | |||
| bool | is_removable (PlacedLogicModelObject_shptr o) | ||
| Returns true if the object can be removed from the Logic Model. | |||
| bool | is_interconnectable (PlacedLogicModelObject_shptr o) | ||
| Check if an object can be electrically interconnected with another object. | |||
| template<typename Type > | |||
| bool | is_of_object_type (PlacedLogicModelObject_shptr o) | ||
| template<typename T > | |||
| T | median (std::vector< T > &v) | ||
| Calculate the median of a vector. | |||
| template<typename T > | |||
| T | average (std::vector< T > const &v) | ||
| Calculate the average of a vector. | |||
| template<typename T > | |||
| T | standard_deviation (std::vector< T > const &v) | ||
| Calculate the standard deviation of a vector. | |||
| bool | check_object_tangency (PlacedLogicModelObject_shptr o1, PlacedLogicModelObject_shptr o2) | ||
| Check if two objects are tangent. | |||
| bool | check_object_tangency (Circle_shptr o1, Circle_shptr o2) | ||
| bool | check_object_tangency (Line_shptr o1, Line_shptr o2) | ||
| bool | check_object_tangency (Rectangle_shptr o1, Rectangle_shptr o2) | ||
| bool | check_object_tangency (Circle_shptr o1, Line_shptr o2) | ||
| bool | check_object_tangency (Circle_shptr o1, Rectangle_shptr o2) | ||
| bool | check_object_tangency (Line_shptr l, Rectangle_shptr r) | ||
| template<class T > | |||
| void | ignore_unused_variable_warning (T const &) | ||
| A dummy method to get rid of compiler warnings. | |||
| xmlrpc_c::value | remote_method_call (std::string const &server_url, std::string const &method_name, xmlrpc_c::paramList const ¶ms) | ||
| Convinience method to call remote methods. | |||
| void | push_changes_to_server (std::string const &server_url, LogicModel_shptr lmodel) | ||
| Push objects from the logic model to a remote server. | |||
| transaction_id_t | pull_changes_from_server (std::string const &server_url, LogicModel_shptr lmodel, transaction_id_t start_tid) | ||
| Pull objects from a remote server into the logic model. | |||
| void | process_changelog_command (LogicModel_shptr lmodel, transaction_id_t transaction_id, std::vector< xmlrpc_c::value > const &command) | ||
| Parse an execute a command. | |||
The namespace 'degate' is the namespace for everything that belongs to libdegate.
| typedef std::tr1::shared_ptr<Annotation> degate::Annotation_shptr |
| typedef std::tr1::shared_ptr<BackgroundImage> degate::BackgroundImage_shptr |
| typedef std::tr1::shared_ptr<Circle> degate::Circle_shptr |
| typedef std::vector<Classifier<coord_type> *> degate::classifier_list_type |
Definition at line 54 of file BackgroundClassifier.h.
| typedef std::tr1::shared_ptr<CodeTemplateGenerator> degate::CodeTemplateGenerator_shptr |
Definition at line 122 of file CodeTemplateGenerator.h.
| typedef uint32_t degate::color_t |
| typedef std::tr1::shared_ptr<ConnectedLogicModelObject> degate::ConnectedLogicModelObject_shptr |
| typedef std::list<coord_type> degate::coord_list |
Definition at line 42 of file BackgroundClassifier.h.
| typedef std::pair<unsigned int, unsigned int> degate::coord_type |
Definition at line 41 of file BackgroundClassifier.h.
| typedef std::map<ENTITY_COLOR, color_t> degate::default_colors_t |
| typedef unsigned int degate::diameter_t |
| typedef std::tr1::shared_ptr<EMarker> degate::EMarker_shptr |
| typedef std::tr1::shared_ptr<ExternalMatching> degate::ExternalMatching_shptr |
Definition at line 103 of file ExternalMatching.h.
| typedef std::list<std::string> degate::file_format_collection |
Definition at line 39 of file ImageReaderFactory.h.
| typedef std::tr1::shared_ptr<FilterKernel> degate::FilterKernel_shptr |
Definition at line 90 of file FilterKernel.h.
| typedef std::tr1::shared_ptr<Gate> degate::Gate_shptr |
| typedef std::tr1::shared_ptr<GateLibrary> degate::GateLibrary_shptr |
| typedef std::tr1::shared_ptr<GatePort> degate::GatePort_shptr |
| typedef std::tr1::shared_ptr<GateTemplate> degate::GateTemplate_shptr |
| typedef MemoryImage degate::GateTemplateImage |
| typedef std::tr1::shared_ptr<GateTemplatePort> degate::GateTemplatePort_shptr |
Definition at line 189 of file GateTemplatePort.h.
| typedef std::tr1::shared_ptr<Grid> degate::Grid_shptr |
| typedef uint8_t degate::gs_byte_pixel_t |
Definition at line 36 of file PixelPolicies.h.
| typedef double degate::gs_double_pixel_t |
Definition at line 37 of file PixelPolicies.h.
| typedef std::tr1::shared_ptr<ImageBase> degate::ImageBase_shptr |
| typedef std::tr1::shared_ptr<ImageProcessorBase> degate::ImageProcessorBase_shptr |
Definition at line 117 of file ImageProcessorBase.h.
| typedef std::tr1::shared_ptr<IrregularGrid> degate::IrregularGrid_shptr |
Definition at line 88 of file IrregularGrid.h.
| typedef unsigned long long degate::layer_id_t |
| typedef unsigned int degate::layer_position_t |
| typedef std::tr1::shared_ptr<Layer> degate::Layer_shptr |
| typedef unsigned int degate::length_t |
| typedef std::tr1::shared_ptr<Line> degate::Line_shptr |
| typedef std::tr1::shared_ptr<LinearPrimitive> degate::LinearPrimitive_shptr |
Definition at line 43 of file LineSegmentExtraction.h.
| typedef std::tr1::shared_ptr<LineSegment> degate::LineSegment_shptr |
Definition at line 47 of file LineSegmentExtraction.h.
| typedef std::tr1::shared_ptr<LineSegmentMap> degate::LineSegmentMap_shptr |
Definition at line 265 of file LineSegmentExtraction.h.
| typedef std::tr1::shared_ptr<LoG> degate::LoG_shptr |
Definition at line 204 of file FilterKernel.h.
| typedef std::tr1::shared_ptr<LogicModel> degate::LogicModel_shptr |
| typedef std::tr1::shared_ptr<LogicModelObjectBase> degate::LogicModelObjectBase_shptr |
Definition at line 147 of file LogicModelObjectBase.h.
| typedef std::tr1::shared_ptr<MemoryImage_GS_BYTE> degate::MemoryImage_GS_BYTE_shptr |
| typedef std::tr1::shared_ptr<MemoryImage_GS_DOUBLE> degate::MemoryImage_GS_DOUBLE_shptr |
| typedef std::tr1::shared_ptr< MemoryImage_RGBA > degate::MemoryImage_shptr |
| typedef std::tr1::shared_ptr<Module> degate::Module_shptr |
| typedef std::tr1::shared_ptr<Net> degate::Net_shptr |
| typedef unsigned long long degate::object_id_t |
| typedef std::tr1::shared_ptr<ObjectIDRewriter> degate::ObjectIDRewriter_shptr |
Definition at line 87 of file ObjectIDRewriter.h.
| typedef std::tr1::shared_ptr<PersistentImage_RGBA> degate::PersistentImage_RGBA_shptr |
| typedef std::tr1::shared_ptr<PlacedLogicModelObject> degate::PlacedLogicModelObject_shptr |
| typedef std::tr1::shared_ptr<Point> degate::Point_shptr |
| typedef std::tr1::shared_ptr<PortColorManager> degate::PortColorManager_shptr |
Typedef for a shared pointer on PortColorManager objects.
Definition at line 129 of file PortColorManager.h.
| typedef int degate::pos_t |
| typedef std::tr1::shared_ptr<ProgressControl> degate::ProgressControl_shptr |
Definition at line 212 of file ProgressControl.h.
| typedef std::tr1::shared_ptr<Project> degate::Project_shptr |
| typedef std::list<std::tr1::shared_ptr<Project> > degate::ProjectList |
| typedef std::tr1::shared_ptr<RCBase> degate::RCBase_shptr |
| typedef std::tr1::shared_ptr<RCViolation> degate::RCViolation_shptr |
Definition at line 33 of file RCVContainer.h.
| typedef std::tr1::shared_ptr<Rectangle> degate::Rectangle_shptr |
| typedef std::tr1::shared_ptr<RegularGrid> degate::RegularGrid_shptr |
Definition at line 78 of file RegularGrid.h.
| typedef std::tr1::shared_ptr<RemoteObject> degate::RemoteObject_shptr |
| typedef MemoryImage degate::RendererImage |
| typedef uint32_t degate::rgba_pixel_t |
Definition at line 38 of file PixelPolicies.h.
| typedef std::tr1::shared_ptr<ScalingManager<BackgroundImage> > degate::ScalingManager_shptr |
A typedef for scaling managers that handle background images.
Definition at line 197 of file ScalingManager.h.
| typedef std::tr1::shared_ptr<SobelOperator> degate::SobelOperator_shptr |
Definition at line 151 of file FilterKernel.h.
| typedef std::tr1::shared_ptr<SobelXOperator> degate::SobelXOperator_shptr |
Definition at line 110 of file FilterKernel.h.
| typedef std::tr1::shared_ptr<SobelYOperator> degate::SobelYOperator_shptr |
Definition at line 130 of file FilterKernel.h.
| typedef std::tr1::shared_ptr<SubProjectAnnotation> degate::SubProjectAnnotation_shptr |
Definition at line 66 of file SubProjectAnnotation.h.
| typedef std::tr1::shared_ptr<TempImage_GS_BYTE> degate::TempImage_GS_BYTE_shptr |
| typedef std::tr1::shared_ptr<TempImage_GS_DOUBLE> degate::TempImage_GS_DOUBLE_shptr |
| typedef std::tr1::shared_ptr<TempImage_RGBA> degate::TempImage_RGBA_shptr |
| typedef std::tr1::shared_ptr<TemplateMatching> degate::TemplateMatching_shptr |
Definition at line 337 of file TemplateMatching.h.
| typedef std::tr1::shared_ptr<TemplateMatchingInCols> degate::TemplateMatchingInCols_shptr |
Definition at line 412 of file TemplateMatching.h.
| typedef std::tr1::shared_ptr<TemplateMatchingInRows> degate::TemplateMatchingInRows_shptr |
Definition at line 395 of file TemplateMatching.h.
| typedef std::tr1::shared_ptr<TemplateMatchingNormal> degate::TemplateMatchingNormal_shptr |
Definition at line 353 of file TemplateMatching.h.
| typedef std::tr1::shared_ptr<TileImage_GS_BYTE> degate::TileImage_GS_BYTE_shptr |
| typedef std::tr1::shared_ptr<TileImage_GS_DOUBLE> degate::TileImage_GS_DOUBLE_shptr |
| typedef std::tr1::shared_ptr<TileImage_RGBA> degate::TileImage_RGBA_shptr |
| typedef unsigned long long degate::transaction_id_t |
| typedef std::tr1::shared_ptr<VerilogCodeTemplateGenerator> degate::VerilogCodeTemplateGenerator_shptr |
Definition at line 85 of file VerilogCodeTemplateGenerator.h.
| typedef std::tr1::shared_ptr<VerilogTBCodeTemplateGenerator> degate::VerilogTBCodeTemplateGenerator_shptr |
Definition at line 57 of file VerilogTBCodeTemplateGenerator.h.
| typedef std::tr1::shared_ptr<VHDLCodeTemplateGenerator> degate::VHDLCodeTemplateGenerator_shptr |
Definition at line 92 of file VHDLCodeTemplateGenerator.h.
| typedef std::tr1::shared_ptr<VHDLTBCodeTemplateGenerator> degate::VHDLTBCodeTemplateGenerator_shptr |
Definition at line 63 of file VHDLTBCodeTemplateGenerator.h.
| typedef std::tr1::shared_ptr<Via> degate::Via_shptr |
| typedef std::tr1::shared_ptr<ViaMatching> degate::ViaMatching_shptr |
Definition at line 91 of file ViaMatching.h.
| typedef std::tr1::shared_ptr<Wire> degate::Wire_shptr |
| typedef std::tr1::shared_ptr<WireMatching> degate::WireMatching_shptr |
Definition at line 62 of file WireMatching.h.
| enum degate::ENTITY_COLOR |
| enum degate::IMAGE_TYPE |
Definition at line 30 of file PixelPolicies.h.
{
IMAGE_TYPE_GS_BYTE = 1,
IMAGE_TYPE_GS_DOUBLE = 2,
IMAGE_TYPE_RGBA = 3
};
Definition at line 45 of file MemoryMap.h.
{
MAP_STORAGE_TYPE_MEM = 0,
MAP_STORAGE_TYPE_PERSISTENT_FILE = 1,
MAP_STORAGE_TYPE_TEMP_FILE = 2,
};
| enum degate::RC_SEVERITY |
An enum for several types of Rule Check problem types.
Definition at line 36 of file RCBase.h.
{
RC_UNDEFINED = 0,
RC_ERROR = 1,
RC_WARNING = 2
};
| enum degate::ret_t |
Definition at line 42 of file globals.h.
{
RET_OK = 0,
RET_ERR = 1,
RET_INV_PTR = 2,
RET_MALLOC_FAILED = 3,
RET_INV_PATH = 4,
RET_MATH_ERR = 5,
RET_CANCEL = 6
};
| void degate::apply_colors_to_gate_ports | ( | LogicModel_shptr | lmodel, |
| PortColorManager_shptr | pcm | ||
| ) |
Get the color definition for port names from the PortColorManager and apply it to gate ports.
Definition at line 78 of file LogicModelHelper.cc.
{
// iterate over gates
for(LogicModel::gate_collection::iterator iter = lmodel->gates_begin();
iter != lmodel->gates_end(); ++iter) {
Gate_shptr gate = (*iter).second;
// iterate over gate ports
for(Gate::port_iterator iter = gate->ports_begin();
iter != gate->ports_end(); ++iter) {
GatePort_shptr gate_port = *iter;
if(gate_port->has_template_port()) {
GateTemplatePort_shptr tmpl_port = gate_port->get_template_port();
std::string port_name = tmpl_port->get_name();
if(pcm->has_color_definition(port_name)) {
color_t fill_c = pcm->get_fill_color(port_name);
color_t frame_c = pcm->get_frame_color(port_name);
gate_port->set_fill_color(fill_c);
gate_port->set_frame_color(frame_c);
}
}
}
}
}
| void degate::apply_port_color_settings | ( | LogicModel_shptr | lmodel, |
| PortColorManager_shptr | pcm | ||
| ) |
Apply port color definitions to all gate template ports.
Definition at line 386 of file LogicModelHelper.cc.
{
if(lmodel == NULL || pcm == NULL)
throw InvalidPointerException("Invalid parameter for apply_port_color_settings()");
// iterate over gates
for(LogicModel::gate_collection::iterator gate_iter = lmodel->gates_begin();
gate_iter != lmodel->gates_end(); ++gate_iter) {
Gate_shptr gate = gate_iter->second;
// iterate over ports
for(Gate::port_iterator iter = gate->ports_begin(); iter != gate->ports_end(); ++iter) {
GatePort_shptr port = *iter;
if(port->has_template_port()) {
GateTemplatePort_shptr tmpl_port = port->get_template_port();
std::string port_name = tmpl_port->get_name();
if(pcm->has_color_definition(port_name)) {
tmpl_port->set_frame_color(pcm->get_frame_color(port_name));
tmpl_port->set_fill_color(pcm->get_fill_color(port_name));
}
}
}
}
}
| void degate::autoconnect_interlayer_objects | ( | LogicModel_shptr | lmodel, |
| Layer_shptr | layer, | ||
| BoundingBox const & | search_bbox | ||
| ) |
Autoconnect vias on adjacent enabled layers.
| InvalidPointerException | If you pass an invalid shared pointer for the logic model, then this exception is raised. |
Definition at line 615 of file LogicModelHelper.cc.
References autoconnect_interlayer_objects_via_gport(), autoconnect_interlayer_objects_via_via(), degate::Via::DIRECTION_DOWN, degate::Via::DIRECTION_UP, degate::BoundingBox::get_bounding_box(), get_next_enabled_layer(), and get_prev_enabled_layer().
{
if(lmodel == NULL || layer == NULL)
throw InvalidPointerException("You passed an invalid shared pointer.");
Layer_shptr
layer_above = get_next_enabled_layer(lmodel, layer),
layer_below = get_prev_enabled_layer(lmodel, layer);
Via_shptr v1;
// iterate over objects
for(Layer::qt_region_iterator iter = layer->region_begin(search_bbox);
iter != layer->region_end(); ++iter) {
if((v1 = std::tr1::dynamic_pointer_cast<Via>(*iter)) != NULL) {
BoundingBox const& bb = v1->get_bounding_box();
/* Iterate over vias one layer above and one layer below
in the region identified by bounding box bb. */
if(layer_above != NULL)
autoconnect_interlayer_objects_via_via(lmodel, layer_above, bb, v1,
Via::DIRECTION_UP, Via::DIRECTION_DOWN);
if(layer_below != NULL) {
autoconnect_interlayer_objects_via_via(lmodel, layer_below, bb, v1,
Via::DIRECTION_DOWN, Via::DIRECTION_UP);
autoconnect_interlayer_objects_via_gport(lmodel, layer_below, bb, v1,
Via::DIRECTION_DOWN);
}
}
}
}

| void degate::autoconnect_objects | ( | LogicModel_shptr | lmodel, |
| Layer_shptr | layer, | ||
| BoundingBox const & | search_bbox | ||
| ) |
Autoconnect objects that tangent each other from a layer within the bounding box.
| InvalidPointerException | If you pass an invalid shared pointer for the logic model, then this exception is raised. |
Definition at line 520 of file LogicModelHelper.cc.
References check_object_tangency(), connect_objects(), and degate::BoundingBox::get_bounding_box().
{
if(lmodel == NULL || layer == NULL)
throw InvalidPointerException("You passed an invalid shared pointer.");
// iterate over connectable objects
for(Layer::qt_region_iterator iter = layer->region_begin(search_bbox);
iter != layer->region_end(); ++iter) {
ConnectedLogicModelObject_shptr clmo1;
if((clmo1 = std::tr1::dynamic_pointer_cast<ConnectedLogicModelObject>(*iter)) != NULL) {
BoundingBox const& bb = clmo1->get_bounding_box();
/* Iterate over connectable objects in the region identified
by bounding box bb.
*/
for(Layer::qt_region_iterator siter = layer->region_begin(bb);
siter != layer->region_end(); ++siter) {
ConnectedLogicModelObject_shptr clmo2;
if((clmo2 =
std::tr1::dynamic_pointer_cast<ConnectedLogicModelObject>(*siter)) != NULL) {
if((clmo1->get_net() == NULL ||
clmo2->get_net() == NULL ||
clmo1->get_net() != clmo2->get_net()) && // excludes identical objects, too
check_object_tangency(std::tr1::dynamic_pointer_cast<PlacedLogicModelObject>(clmo1),
std::tr1::dynamic_pointer_cast<PlacedLogicModelObject>(clmo2)))
connect_objects(lmodel, clmo1, clmo2);
}
}
}
}
}

| double degate::average | ( | std::tr1::shared_ptr< ImageType > | img | ) |
Calculate the average pixel value of a single channel image.
If the input image is a multi-channel image, data will be converted on-the-fly.
Definition at line 75 of file ImageStatistics.h.
Referenced by degate::TemplateMatching::subtract_mean().
{
return average(img, 0, 0, img->get_width(), img->get_height());
}

| double degate::average | ( | std::tr1::shared_ptr< ImageType > | img, |
| unsigned int | start_x, | ||
| unsigned int | start_y, | ||
| unsigned int | width, | ||
| unsigned int | height | ||
| ) |
Calculate the average pixel value of a single channel image.
If the input image is a multi-channel image, data will be converted on-the-fly.
| DegateRuntimeException | This exception is thrown, if the image area is 0. |
Definition at line 85 of file ImageStatistics.h.
{
double sum = 0;
if(height == 0 || width == 0) throw DegateRuntimeException("Can't calculate average for an image.");
for(unsigned int y = start_y; y < height; y++)
for(unsigned int x = start_x; x < width; x++) {
sum += img->get_pixel_as<double>(x, y);
}
return sum / (double)(height * width);
}
| T degate::average | ( | std::vector< T > const & | v | ) | [inline] |
Calculate the average of a vector.
| DegateRuntimeException | This exception is thrown if vector's size is 0. |
Definition at line 59 of file Statistics.h.
{
if(v.empty())
throw DegateRuntimeException("Error in average(): The vector is empty.");
double _sum = 0;
for(typename std::vector<T>::const_iterator iter = v.begin();
iter != v.end(); ++iter)
_sum += *iter;
return _sum / (double)v.size();
}
| void degate::average_and_stddev | ( | std::tr1::shared_ptr< ImageType > | img, |
| unsigned int | start_x, | ||
| unsigned int | start_y, | ||
| unsigned int | width, | ||
| unsigned int | height, | ||
| double * | avg, | ||
| double * | stddev | ||
| ) |
Calculate the average pixel value of a single channel image.
If the input image is a multi-channel image, data will be converted on-the-fly.
| DegateRuntimeException | This exception is thrown, if the image area is 0. |
Definition at line 107 of file ImageStatistics.h.
Referenced by degate::ViaMatching::scan().
{
double sum = 0;
if(height == 0 || width == 0)
throw DegateRuntimeException("Can't calculate average for an image.");
for(unsigned int y = start_y; y < start_y + height; y++)
for(unsigned int x = start_x; x < start_x + width; x++) {
sum += img->get_pixel_as<gs_double_pixel_t>(x, y);
}
*avg = sum / (double)(height * width);
sum = 0;
for(unsigned int y = start_y; y < start_y + height; y++)
for(unsigned int x = start_x; x < start_x + width; x++) {
sum += pow(*avg - img->get_pixel_as<gs_double_pixel_t>(x, y), 2);
}
*stddev = sqrt(sum/(double)(height * width));
}

| bool degate::check_object_tangency | ( | PlacedLogicModelObject_shptr | o1, |
| PlacedLogicModelObject_shptr | o2 | ||
| ) |
Check if two objects are tangent.
It is assumed that both objects are on the same layer.
Definition at line 199 of file TangencyCheck.cc.
Referenced by autoconnect_interlayer_objects_via_gport(), autoconnect_interlayer_objects_via_via(), autoconnect_objects(), and check_object_tangency().
{
if(o1 == NULL || o2 == NULL)
throw InvalidPointerException("You passed an invalid shared pointer.");
if(!o1->get_bounding_box().intersects(o2->get_bounding_box()))
return false;
Circle_shptr c1, c2;
Line_shptr l1, l2;
Rectangle_shptr r1, r2;
c1 = std::tr1::dynamic_pointer_cast<Circle>(o1);
l1 = std::tr1::dynamic_pointer_cast<Line>(o1);
r1 = std::tr1::dynamic_pointer_cast<Rectangle>(o1);
c2 = std::tr1::dynamic_pointer_cast<Circle>(o2);
l2 = std::tr1::dynamic_pointer_cast<Line>(o2);
r2 = std::tr1::dynamic_pointer_cast<Rectangle>(o2);
if(c1 && c2)
return check_object_tangency(c1, c2);
else if(l1 && l2) {
bool ret= check_object_tangency(l1, l2);
std::cout << "Check l1/l2: " << ret << std::endl;
return ret;
}
else if(r1 && r2)
return check_object_tangency(r1, r2);
else if(c1 && l2)
return check_object_tangency(c1, l2);
else if(l1 && c2)
return check_object_tangency(c2, l1);
else if(c1 && r2)
return check_object_tangency(c1, r2);
else if(r1 && c2)
return check_object_tangency(c2, r1);
else if(l1 && r2)
return check_object_tangency(l1, r2);
else if(r1 && l2)
return check_object_tangency(l2, r1);
assert(1==0);
}

| bool degate::check_object_tangency | ( | Circle_shptr | o1, |
| Circle_shptr | o2 | ||
| ) |
Definition at line 46 of file TangencyCheck.cc.
{
int dx = o1->get_x() - o1->get_x();
int dy = o2->get_y() - o1->get_y();
return (sqrt(dx*dx + dy*dy) <= (o1->get_diameter() + o2->get_diameter()) / 2.0);
}
| bool degate::check_object_tangency | ( | Line_shptr | o1, |
| Line_shptr | o2 | ||
| ) |
Definition at line 54 of file TangencyCheck.cc.
References degate::BoundingBox::get_bounding_box(), get_line_function_for_wire(), degate::BoundingBox::get_max_x(), degate::BoundingBox::get_max_y(), degate::BoundingBox::get_min_x(), and degate::BoundingBox::get_min_y().
{
double m1, n1, m2, n2;
bool ret1 = get_line_function_for_wire(o1, &m1, &n1);
bool ret2 = get_line_function_for_wire(o2, &m2, &n2);
if(ret1 && ret2) {
double xi = - (n1 - n2) / (m1 - m2);
double yi = n1 + m1 * xi;
return( (o1->get_from_x() - xi)*(xi - o1->get_to_x()) >= 0 &&
(o2->get_from_x() - xi)*(xi - o2->get_to_x()) >= 0 &&
(o1->get_from_y() - yi)*(yi - o1->get_to_y()) >= 0 &&
(o2->get_from_y() - yi)*(yi - o2->get_to_y()) >= 0);
}
else if(!ret1 && !ret2) {
return o1->get_from_x() == o2->get_from_x();
}
else {
Line_shptr v = ret1 ? o2 : o1;
Line_shptr l = ret1 ? o1 : o2;
BoundingBox const & b = v->get_bounding_box();
if((l->get_from_x() > b.get_max_x() &&
l->get_to_x() > b.get_max_x()) ||
// no intersection (line is to right of rectangle).
(l->get_from_x() > b.get_min_x() &&
l->get_to_x() > b.get_min_x()) ||
// no intersection (line is to left of rectangle).
(l->get_from_y() > b.get_min_y() &&
l->get_to_y() > b.get_min_y()) ||
// no intersection (line is above rectangle).
(l->get_from_y() > b.get_max_y() &&
l->get_to_y() > b.get_max_y())
//no intersection (line is below rectangle).
)
return false;
else
return true;
}
return false;
}

| bool degate::check_object_tangency | ( | Rectangle_shptr | o1, |
| Rectangle_shptr | o2 | ||
| ) |
Definition at line 104 of file TangencyCheck.cc.
{
return o1->get_bounding_box().intersects(o2->get_bounding_box());
}
| bool degate::check_object_tangency | ( | Circle_shptr | o1, |
| Line_shptr | o2 | ||
| ) |
Definition at line 109 of file TangencyCheck.cc.
References check_object_tangency(), degate::BoundingBox::get_bounding_box(), degate::BoundingBox::get_max_x(), degate::BoundingBox::get_max_y(), degate::BoundingBox::get_min_x(), and degate::BoundingBox::get_min_y().
{
BoundingBox const & b = o1->get_bounding_box();
Rectangle_shptr r(new Rectangle(b.get_min_x(), b.get_max_x(),
b.get_min_y(), b.get_max_y()));
return check_object_tangency(o2, r);
}

| bool degate::check_object_tangency | ( | Circle_shptr | o1, |
| Rectangle_shptr | o2 | ||
| ) |
Definition at line 119 of file TangencyCheck.cc.
{
return o1->get_bounding_box().intersects(o2->get_bounding_box());
}
| bool degate::check_object_tangency | ( | Line_shptr | l, |
| Rectangle_shptr | r | ||
| ) |
Definition at line 124 of file TangencyCheck.cc.
{
// http://stackoverflow.com/questions/99353/how-to-test-if-a-line-segment-intersects-an-axis-aligned-rectange-in-2d
// Let the segment endpoints be p1=(x1 y1) and p2=(x2 y2).
// Let the rectangle's corners be (xBL yBL) and (xTR yTR).
int x1, x2, y1, y2;
if(l->get_from_x() < l->get_to_x()) {
x1 = l->get_from_x();
y1 = l->get_from_y();
x2 = l->get_to_x();
y2 = l->get_to_y();
}
else {
x2 = l->get_from_x();
y2 = l->get_from_y();
x1 = l->get_to_x();
y1 = l->get_to_y();
}
// F(x y) = (y2-y1)x + (x1-x2)y + (x2*y1-x1*y2)
int dy = y2 - y1;
int dx = x1 - x2;
int i = x2 * y1 - x1 * y2;
// Calculate F(x,y) for each corner of the rectangle.
// If any of the values f[i] is 0, the corner is on the line.
int f1 = dy * r->get_min_x() + dx * r->get_min_y() + i;
if(f1 == 0) return true;
int f2 = dy * r->get_min_x() + dx * r->get_max_y() + i;
if(f2 == 0) return true;
int f3 = dy * r->get_max_x() + dx * r->get_min_y() + i;
if(f3 == 0) return true;
int f4 = dy * r->get_max_x() + dx * r->get_max_y() + i;
if(f4 == 0) return true;
/* If all corners are "below" or "above" the line, the
objects can't intersect. */
if((f1 < 0 && f2 < 0 && f3 < 0 && f4 < 0) ||
(f1 > 0 && f2 > 0 && f3 > 0 && f4 > 0)) {
return false;
}
/*
Project the endpoint onto the x axis, and check if the
segment's shadow intersects the polygon's shadow. Repeat on the y axis:
*/
if( (x1 > r->get_max_x() &&
x2 > r->get_max_x()) &&
// no intersection (line is to right of rectangle).
!(x1 > r->get_min_x() &&
x2 > r->get_min_x()) &&
// no intersection (line is to left of rectangle).
!(y1 > r->get_max_y() &&
y2 > r->get_max_y()) &&
// no intersection (line is above rectangle).
!(y1 < r->get_min_y() &&
y2 < r->get_min_y())
//no intersection (line is below rectangle).
) {
return false;
}
else // there is an intersection
return true;
}
| void degate::clear_image | ( | std::tr1::shared_ptr< ImageType > | img | ) |
Clear an image.
Definition at line 405 of file ImageManipulation.h.
{
for(unsigned int y = 0; y < img->get_height(); y++)
for(unsigned int x = 0; x < img->get_width(); x++)
img->set_pixel(x, y, 0);
}
| void degate::clear_logic_model | ( | LogicModel_shptr | lmodel, |
| Layer_shptr | layer | ||
| ) |
Clear the logic model for a layer.
| InvalidPointerException | If you pass an invalid shared pointer for lmodel or layer, then this exception is raised. |
Definition at line 216 of file LogicModelHelper.cc.
{
if(lmodel == NULL || layer == NULL)
throw InvalidPointerException("Error: you passed an invalid pointer to clear_logc_model()");
// iterate over all objects that are placed on a specific layer and remove them
for(LogicModel::object_collection::iterator iter = lmodel->objects_begin();
iter != lmodel->objects_end(); ++iter) {
PlacedLogicModelObject_shptr lmo = (*iter).second;
if(lmo->get_layer() == layer) {
lmodel->remove_object(lmo);
}
}
}
| std::set<Net_shptr> degate::collect_nets | ( | InputIterator | first, |
| InputIterator | last | ||
| ) |
Collect nets that are used by the objects from first to last.
| DegateRuntimeException | This exception is thrown if one of the objects is not of type ConnectedLogicModelObject. This means that the object cannot be connected with anything. |
Definition at line 146 of file LogicModelHelper.h.
{
std::set<Net_shptr> nets;
for(InputIterator it = first; it != last; ++it) {
ConnectedLogicModelObject_shptr clo =
std::tr1::dynamic_pointer_cast<ConnectedLogicModelObject>(*it);
if(clo == NULL) {
throw DegateRuntimeException("Error in collect_nets(). One of the objects "
"cannot be connected with anything.");
}
else {
Net_shptr net = clo->get_net();
if(net != NULL) nets.insert(net);
}
}
return nets;
}
| void degate::connect_objects | ( | LogicModel_shptr | lmodel, |
| ConnectedLogicModelObject_shptr | o1, | ||
| ConnectedLogicModelObject_shptr | o2 | ||
| ) |
Connect objects.
Definition at line 509 of file LogicModelHelper.cc.
Referenced by autoconnect_interlayer_objects_via_gport(), autoconnect_interlayer_objects_via_via(), and autoconnect_objects().
{
std::list<ConnectedLogicModelObject_shptr> v;
v.push_back(o1);
v.push_back(o2);
connect_objects(lmodel, v.begin(), v.end());
}

| void degate::connect_objects | ( | LogicModel_shptr | lmodel, |
| InputIterator | first, | ||
| InputIterator | last | ||
| ) |
Connect objects.
Unused nets are removed from the logic model.
| DegateRuntimeException | This exception is thrown if one of the objects is not of type ConnectedLogicModelObject. This means that the object cannot be connected with anything. |
| InvalidPointerException | If you pass an invalid shared pointer for the logic model, then this exception is raised. |
Definition at line 243 of file LogicModelHelper.h.
{
if(lmodel == NULL)
throw InvalidPointerException("You passed an invalid shared pointer for lmodel");
std::set<Net_shptr> nets;
try {
nets = collect_nets<InputIterator>(first, last);
}
catch(DegateRuntimeException const& ex) {
throw;
}
// collect objects we want to join
std::set<ConnectedLogicModelObject_shptr> objects;
for(InputIterator it = first; it != last; ++it) {
objects.insert(std::tr1::dynamic_pointer_cast<ConnectedLogicModelObject>(*it));
}
for(std::set<Net_shptr>::iterator iter = nets.begin(); iter != nets.end(); ++iter) {
Net_shptr net = *iter;
for(Net::connection_iterator ci = net->begin(); ci != net->end(); ++ci) {
PlacedLogicModelObject_shptr plo = lmodel->get_object(*ci);
ConnectedLogicModelObject_shptr clo =
std::tr1::dynamic_pointer_cast<ConnectedLogicModelObject>(plo);
assert(clo != NULL);
objects.insert(clo);
}
}
Net_shptr new_net(new Net());
// set new net
for(std::set<ConnectedLogicModelObject_shptr>::iterator iter = objects.begin();
iter != objects.end(); ++iter) {
ConnectedLogicModelObject_shptr clo = *iter;
clo->set_net(new_net);
}
// remove nets from the logic model
for(std::set<Net_shptr>::iterator iter = nets.begin(); iter != nets.end(); ++iter) {
assert((*iter)->size() == 0);
lmodel->remove_net(*iter);
}
lmodel->add_net(new_net);
}
| PixelTypeDst degate::convert_pixel | ( | PixelTypeSrc | p | ) | [inline] |
Convert a pixel from a source type to a destination type.
The default implementation will just make a copy of the pixel.
Definition at line 136 of file ImageManipulation.h.
{
return p;
}
| gs_byte_pixel_t degate::convert_pixel< gs_byte_pixel_t, rgba_pixel_t > | ( | rgba_pixel_t | p | ) | [inline] |
Convert pixel value from from rgba -> byte.
Definition at line 145 of file ImageManipulation.h.
References RGBA_TO_GS_BY_VAL.
{
return RGBA_TO_GS_BY_VAL(p);
}
| gs_double_pixel_t degate::convert_pixel< gs_double_pixel_t, rgba_pixel_t > | ( | rgba_pixel_t | p | ) | [inline] |
Convert pixel value from from rgba -> double.
Definition at line 153 of file ImageManipulation.h.
References RGBA_TO_GS_BY_VAL.
{
return RGBA_TO_GS_BY_VAL(p);
}
| rgba_pixel_t degate::convert_pixel< rgba_pixel_t, gs_byte_pixel_t > | ( | gs_byte_pixel_t | p | ) | [inline] |
Convert pixel value from from byte -> rgba.
Definition at line 163 of file ImageManipulation.h.
References MERGE_CHANNELS.
{
return MERGE_CHANNELS(p, p, p, 255);
}
| rgba_pixel_t degate::convert_pixel< rgba_pixel_t, gs_double_pixel_t > | ( | gs_double_pixel_t | p | ) | [inline] |
Convert pixel value from from double -> rgba.
Definition at line 171 of file ImageManipulation.h.
References MERGE_CHANNELS.
{
gs_byte_pixel_t b = p;
return MERGE_CHANNELS(b, b, b, 255);
}
| void degate::convert_to_greyscale | ( | std::tr1::shared_ptr< ImageType > | img | ) |
In place conversion to a greyscale image.
Definition at line 297 of file ImageManipulation.h.
{
convert_to_greyscale<ImageType, ImageType>(img, img);
}
| void degate::convert_to_greyscale | ( | std::tr1::shared_ptr< ImageTypeDst > | dst, |
| std::tr1::shared_ptr< ImageTypeSrc > | src | ||
| ) |
Convert an image to greyscale.
You can get the same effect if you copy_image() an RGBA into a greyscale image and implicitly use the auto conversion. This function is useful, if you don't have two different image types. Then there would be no auto conversion. You can use that function with dst = src . Then the image is converted in place. Like copy_image() this function works only on the region, in which both images intersect.
Definition at line 278 of file ImageManipulation.h.
{
unsigned int h = std::min(src->get_height(), dst->get_height());
unsigned int w = std::min(src->get_width(), dst->get_width());
for(unsigned int y = 0; y < h; y++)
for(unsigned int x = 0; x < w; x++) {
gs_byte_pixel_t p = src->get_pixel_as<gs_byte_pixel_t>(x, y);
dst->set_pixel_as<gs_byte_pixel_t>(x, y, p);
}
}
| void degate::convolve | ( | std::tr1::shared_ptr< ImageTypeDst > | dst, |
| std::tr1::shared_ptr< ImageTypeSrc > | src, | ||
| FilterKernel_shptr | kernel | ||
| ) |
Convolve a single channel source image with a filter kernel and write it into a destination image.
Depending on the filter kernel size there is a region next to the image boundary that you cannot use for further processing.
Definition at line 538 of file ImageManipulation.h.
Referenced by degate::TemplateMatching::prepare_background_images().
{
assert_is_single_channel_image<ImageTypeSrc>();
clear_image<ImageTypeDst>(dst);
unsigned int h = std::min(src->get_height(), dst->get_height());
unsigned int w = std::min(src->get_width(), dst->get_width());
unsigned int x, y, i, j;
for(y = kernel->get_center_row(); y < h - kernel->get_center_row(); y++) {
for(x = kernel->get_center_column(); x < w - kernel->get_center_column(); x++) {
double accu = 0;
for(i = 0; i < kernel->get_columns(); i++ ) {
for(j = 0; j < kernel->get_rows(); j++ ) {
typename ImageTypeSrc::pixel_type p =
src->get_pixel(x - kernel->get_center_column() + i,
y - kernel->get_center_row() + j);
double k = kernel->get(kernel->get_columns() - 1 - i,
kernel->get_rows() - 1 - j);
accu += k * p;
}
}
dst->set_pixel_as<double>(x, y, accu);
}
}
}

| void degate::copy_image | ( | std::tr1::shared_ptr< ImageTypeDst > | dst, |
| std::tr1::shared_ptr< ImageTypeSrc > | src | ||
| ) |
Copy an image.
Copy the source image into the destination image. If the images differ in pixel types, the pixel values will be converted. The images can also differ in size. Only the region is copied, which is present in both images. It is possible that the image dst is not completely overwritten, if the image src is not large enough.
Definition at line 209 of file ImageManipulation.h.
Referenced by degate::ProjectImporter::load_background_image(), degate::TemplateMatching::prepare_template(), and degate::ViaMatching::run().
{
unsigned int h = std::min(src->get_height(), dst->get_height());
unsigned int w = std::min(src->get_width(), dst->get_width());
for(unsigned int y = 0; y < h; y++)
for(unsigned int x = 0; x < w; x++)
dst->set_pixel(x, y, src->get_pixel_as<typename ImageTypeDst::pixel_type>(x, y));
}

| void degate::create_directory | ( | std::string const & | directory, |
| mode_t | mode = 0700 |
||
| ) |
Create a directory.
Definition at line 132 of file FileSystem.cc.
Referenced by degate::ScalingManager< ImageType >::create_scalings(), and degate::StoragePolicy_Tile< PixelPolicy >::StoragePolicy_Tile().
{
if(mkdir(directory.c_str(), mode) != 0) {
throw degate::FileSystemException(strerror(errno));
}
}

| std::string degate::create_temp_directory | ( | ) |
Create a temp directory.
Definition at line 140 of file FileSystem.cc.
References generate_temp_file_pattern(), and get_temp_directory().
Referenced by degate::ExternalMatching::run().
{
return create_temp_directory(generate_temp_file_pattern(get_temp_directory()));
}


| std::string degate::create_temp_directory | ( | std::string const & | directory_pattern | ) |
Create a temporary directory based on a path pattern specification.
The directory is created with mode 0700.
| directory_pattern | A pattern of the form e.g. "/tmp/temp.XXXXXXXXX". |
Definition at line 144 of file FileSystem.cc.
{
char template_str[PATH_MAX];
strncpy(template_str, directory_pattern.c_str(), sizeof(template_str));
char * dirname = mkdtemp(template_str);
return std::string(dirname);
}
| void degate::determine_module_ports_for_root | ( | LogicModel_shptr | lmodel | ) |
Determine ports of a root module.
Note: It would b more nice to have this function as a member function of class Module. But this would intorduce a dependency of LogicModel. The lmodel is neccessary for looking up objects, because main module's ports are modelled by having a special emarker in the net. I have no idea how the main module's ports could be identified else. (Using all ports is obviously not an option.)
Definition at line 366 of file Module.cc.
{
debug(TM, "Check for module ports.");
/*
Iterate over all gate and check their ports.
Get the net for a port.
Iterate over net.
If a net contains a emarker with a description of 'module-port', use
gate port as module port.
*/
Module_shptr main_module = lmodel->get_main_module();
main_module->ports.clear(); // reset ports
for(Module::gate_collection::iterator g_iter = main_module->gates_begin();
g_iter != main_module->gates_end(); ++g_iter) {
Gate_shptr gate = *g_iter;
assert(gate != NULL);
for(Gate::port_const_iterator p_iter = gate->ports_begin(); p_iter != gate->ports_end(); ++p_iter) {
GatePort_shptr gate_port = *p_iter;
assert(gate_port != NULL);
Net_shptr net = gate_port->get_net();
bool is_a_port = false;
if(net != NULL) {
for(Net::connection_iterator c_iter = net->begin(); c_iter != net->end() && !is_a_port; ++c_iter) {
object_id_t oid = *c_iter;
assert(oid != 0);
PlacedLogicModelObject_shptr lmo = lmodel->get_object(oid);
if(EMarker_shptr em = std::tr1::dynamic_pointer_cast<EMarker>(lmo)) {
debug(TM, "Connected with emarker");
if(em->get_description() == "module-port") {
GateTemplatePort_shptr tmpl_port = gate_port->get_template_port();
assert(tmpl_port != NULL); // if a gate has no standard cell type, the gate cannot have a port
main_module->ports[em->get_name()] = gate_port;
is_a_port = true;
}
}
}
} // end of net-object-iteration
} // end of gate-portiteration
} // end of gate-iteration
}

| void degate::dilate_image | ( | std::tr1::shared_ptr< ImageTypeDst > | dst, |
| std::tr1::shared_ptr< ImageTypeSrc > | src, | ||
| unsigned int | kernel_width = 3, |
||
| unsigned int | dilation_threshold = 3 |
||
| ) |
Filter an image with an erosion filter.
Definition at line 113 of file MorphologicalFilter.h.
References filter_image().
{
filter_image<ImageTypeDst, ImageTypeSrc,
DilateImagePolicy<ImageTypeSrc, typename ImageTypeSrc::pixel_type> >
(dst, src, kernel_width, dilation_threshold);
}

| void degate::erode_image | ( | std::tr1::shared_ptr< ImageTypeDst > | dst, |
| std::tr1::shared_ptr< ImageTypeSrc > | src, | ||
| unsigned int | kernel_width = 3, |
||
| unsigned int | erosion_threshold = 3 |
||
| ) |
Filter an image with an erosion filter.
Definition at line 65 of file MorphologicalFilter.h.
References filter_image().
{
filter_image<ImageTypeDst, ImageTypeSrc,
ErodeImagePolicy<ImageTypeSrc, typename ImageTypeSrc::pixel_type> >
(dst, src, kernel_width, erosion_threshold);
}

| int degate::execute_command | ( | std::string const & | command, |
| std::list< std::string > const & | params | ||
| ) |
Execute a command.
| command | The command to execute. |
| params | list of parameters. |
Definition at line 69 of file DegateHelper.cc.
{
pid_t pid = fork();
if(pid == 0) {
// child
std::cout << "Execute command " << command << " ";
char const ** argv = new char const *[params.size()+2];
int i = 1;
BOOST_FOREACH(std::string const& s, params) {
argv[i] = s.c_str();
i++;
std::cout << s << " ";
}
argv[0] = command.c_str();
argv[i] = NULL;
std::cout << std::endl;
if(execvp(command.c_str(), const_cast<char* const*>(argv)) == -1) {
std::cout << "exec failed" << std::endl;
}
std::cout << "sth. failed" << std::endl;
exit(0);
}
else if(pid < 0) {
// fork failed
throw SystemException("fork() failed");
}
else {
// parent
int exit_code;
if(waitpid(pid, &exit_code, 0) != pid)
throw SystemException("waitpid() failed");
else {
if(WEXITSTATUS(exit_code) != 0) {
std::string errmsg("Failed to execute command: " + command);
BOOST_FOREACH(std::string const& s, params) {
errmsg += " ";
errmsg += s;
}
errmsg += ". Error: ";
errmsg += strerror(errno);
throw SystemException(errmsg);
}
return exit_code;
}
}
}
| void degate::extract_partial_image | ( | std::tr1::shared_ptr< ImageTypeDst > | dst, |
| std::tr1::shared_ptr< ImageTypeSrc > | src, | ||
| unsigned int | min_x, | ||
| unsigned int | max_x, | ||
| unsigned int | min_y, | ||
| unsigned int | max_y | ||
| ) |
Extract a partial image from src with the region defined by the parameters into a destination image dst.
Clipping occurs, if the destination image is smaller than the region or the image src.
Definition at line 228 of file ImageManipulation.h.
Referenced by degate::TemplateMatching::prepare_background_images(), degate::IPCopy< ImageTypeIn, ImageTypeOut >::run(), and save_part_of_image().
{
assert(min_x < max_x);
assert(min_y < max_y);
unsigned int h = std::min(std::min(std::min(src->get_height(), max_y), dst->get_height()), max_y - min_y);
unsigned int w = std::min(std::min(std::min(src->get_width(), max_x), dst->get_width()), max_x - min_x);
unsigned int dst_x = 0, dst_y = 0, x, y;
for(y = min_y; y < min_y + h; y++, dst_y++) {
for(x = min_x, dst_x = 0; x < min_x + w; x++, dst_x++)
dst->set_pixel(dst_x, dst_y,
src->get_pixel_as<typename ImageTypeDst::pixel_type>(x, y));
}
}

| void degate::extract_partial_image | ( | std::tr1::shared_ptr< ImageTypeDst > | dst, |
| std::tr1::shared_ptr< ImageTypeSrc > | src, | ||
| BoundingBox const & | bounding_box | ||
| ) |
Extract a partial image.
Definition at line 253 of file ImageManipulation.h.
References degate::BoundingBox::get_max_x(), degate::BoundingBox::get_max_y(), degate::BoundingBox::get_min_x(), and degate::BoundingBox::get_min_y().
{
extract_partial_image<ImageTypeDst, ImageTypeSrc>(dst, src,
bounding_box.get_min_x(),
bounding_box.get_max_x(),
bounding_box.get_min_y(),
bounding_box.get_max_y());
}

| bool degate::file_exists | ( | std::string const & | path | ) |
Check if a file or directory exists.
Definition at line 73 of file FileSystem.cc.
Referenced by degate::ScalingManager< ImageType >::create_scalings(), get_basedir(), degate::ProjectImporter::import_all(), degate::ProjectImporter::load_background_image(), load_degate_image(), load_image(), degate::ScalingManager< ImageType >::ScalingManager(), and degate::StoragePolicy_Tile< PixelPolicy >::StoragePolicy_Tile().
{
struct stat stat_buf;
return stat(path.c_str(), &stat_buf) == 0 ? true : false;
}

| void degate::filter_image | ( | std::tr1::shared_ptr< ImageTypeDst > | dst, |
| std::tr1::shared_ptr< ImageTypeSrc > | src, | ||
| unsigned int | kernel_width = 3, |
||
| unsigned int | threshold = 3 |
||
| ) |
Filter an (RBGA) image.
| threshold | The threshold parameter is directly passed to the calculate() method of the calculation policy class. |
| DegateRuntimeException | This exception is thrown if your images are to small for the kernel or if the width of the kernel is to small. |
Definition at line 585 of file ImageManipulation.h.
Referenced by dilate_image(), erode_image(), median_filter(), morphological_close(), and morphological_open().
{
if(kernel_width <= 1)
throw DegateRuntimeException("Error in filter_image(). Kernel width is to small.");
unsigned int width = std::min(src->get_width(), dst->get_width());
unsigned int height = std::min(src->get_height(), dst->get_height());
if(width < kernel_width || height < kernel_width)
throw DegateRuntimeException("Error in filter_image(). One of the images is to small.");
unsigned int kernel_center = kernel_width / 2;
width -= (kernel_width - kernel_center);
height -= (kernel_width - kernel_center);
for(unsigned int y = kernel_center; y < height; y++) {
for(unsigned x = kernel_center; x < width; x++) {
typename ImageTypeSrc::pixel_type out =
FunctionPolicy::calculate(src,
x, y,
x - kernel_center,
x - kernel_center + kernel_width,
y - kernel_center,
y - kernel_center + kernel_width,
threshold);
dst->set_pixel_as<typename ImageTypeSrc::pixel_type>(x, y, out);
}
}
}

| void degate::flip_both | ( | std::tr1::shared_ptr< ImageType > | img | ) |
Flip image in place from top to down and from left to right.
Definition at line 73 of file ImageManipulation.h.
Referenced by degate::TemplateMatching::prepare_template().
{
flip_up_down<ImageType>(img);
flip_left_right<ImageType>(img);
}

| void degate::flip_left_right | ( | std::tr1::shared_ptr< ImageType > | img | ) |
Flip image in place from left to right.
Definition at line 39 of file ImageManipulation.h.
Referenced by degate::TemplateMatching::prepare_template().
{
if(img->get_width() == 1) return;
for(unsigned int y = 0; y < img->get_height(); y++)
for(unsigned int x = 0; x < (img->get_width() >> 1); x++) {
unsigned int other_x = img->get_width() - 1 - x;
typename ImageType::pixel_type p1 = img->get_pixel(x, y);
typename ImageType::pixel_type p2 = img->get_pixel(other_x, y);
img->set_pixel(x, y, p2);
img->set_pixel(other_x, y, p1);
}
}

| void degate::flip_up_down | ( | std::tr1::shared_ptr< ImageType > | img | ) |
Flip image in place from top to down.
Definition at line 56 of file ImageManipulation.h.
Referenced by degate::TemplateMatching::prepare_template().
{
if(img->get_height() == 1) return;
for(unsigned int y = 0; y < (img->get_height() >> 1); y++)
for(unsigned int x = 0; x < img->get_width(); x++) {
unsigned int other_y = img->get_height() - 1 - y;
typename ImageType::pixel_type p1 = img->get_pixel(x, y);
typename ImageType::pixel_type p2 = img->get_pixel(x, other_y);
img->set_pixel(x, y, p2);
img->set_pixel(x, other_y, p1);
}
}

| std::string degate::gen_tabs | ( | int | n | ) |
Definition at line 45 of file debug.cc.
Referenced by degate::Via::print(), degate::QuadTree< T >::print(), degate::GatePort::print(), degate::Gate::print(), degate::EMarker::print(), degate::BoundingBox::print(), and degate::Annotation::print().
{
std::string ret;
for(int i = 0; i < n; i++)
ret += "\t";
return ret;
}

| std::string degate::generate_temp_file_pattern | ( | std::string const & | basedir | ) |
Generate a pattern within a basedir for temp files.
The pattern is in the form of e.g. "/tmp/temp.XXXXXXXX" that can be passed to mkstemp(). Only the pattern is generated.
Definition at line 152 of file FileSystem.cc.
Referenced by create_temp_directory(), and write_string_to_temp_file().
{
return basedir + std::string("/temp.XXXXXXXXXXX");
}

| std::list< Layer_shptr > degate::get_available_standard_layers | ( | LogicModel_shptr | lmodel | ) |
Get layer pointers for the first transistor layer and M1 and M2, if they are available.
Definition at line 109 of file LogicModelHelper.cc.
References debug(), get_first_layer(), get_first_logic_layer(), degate::Layer::METAL, TM, and degate::Layer::TRANSISTOR.
Referenced by grab_template_images(), and merge_gate_images().
{
std::list<Layer_shptr> layers;
Layer_shptr l;
try {
l = get_first_layer(lmodel, Layer::TRANSISTOR);
if(l != NULL) layers.push_back(l);
}
catch(CollectionLookupException const& ex) {
debug(TM, "Got an exception. A layer is not available. I will ignore it: %s", ex.what());
}
try {
l = get_first_logic_layer(lmodel);
if(l != NULL) layers.push_back(l);
}
catch(CollectionLookupException const& ex) {
debug(TM, "Got an exception. A layer is not available. I will ignore it: %s", ex.what());
}
try {
l = get_first_layer(lmodel, Layer::METAL);
if(l != NULL) layers.push_back(l);
}
catch(CollectionLookupException const& ex) {
debug(TM, "Got an exception. A layer is not available. I will ignore it: %s", ex.what());
}
return layers;
}


| std::string degate::get_basedir | ( | std::string const & | path | ) |
Get the base directory for file or directory.
It is no problem if you request the basedir for a symlink on a directory, because the path is internally expanded via get_realpath(), but only if the file exist. If you use get_basedir() on a non existing path, the path is treated as a path to a file. Then the file name part is stripped.
| Throws | an InvalidPathException if the path does not exists. |
Definition at line 78 of file FileSystem.cc.
References file_exists(), get_realpath(), and is_directory().
Referenced by degate::GateLibraryExporter::export_data(), degate::ProjectImporter::import(), degate::GateLibraryImporter::import(), degate::ProjectImporter::import_all(), and degate::RCVBlacklistImporter::import_into().
{
std::string resolved_path;
if(file_exists(path)) {
resolved_path = get_realpath(path);
if(is_directory(resolved_path)) return resolved_path;
else {
return resolved_path.substr(0, resolved_path.find_last_of('/'));
}
}
else {
// treat it as a file name
size_t last_pos = path.find_last_of('/');
if(last_pos != 0)
return path.substr(0, last_pos);
else return "/";
}
}


| std::string degate::get_basename | ( | std::string const & | path | ) |
Get the basename of a file.
That is the substring without the directory part, the suffix and the dot.
Definition at line 195 of file FileSystem.cc.
References get_filename_from_path().
Referenced by degate::LogicModelDOTExporter::export_data().
{
std::string filename(get_filename_from_path(path));
size_t last_occurance = filename.rfind(".", filename.size());
if(last_occurance < filename.size())
return filename.substr(0, last_occurance);
else return filename;
}


| Layer_shptr degate::get_current_layer | ( | Project_shptr | project | ) |
Get the current layer.
Definition at line 332 of file LogicModelHelper.cc.
{
if(project == NULL)
throw InvalidPointerException("Invalid parameter for get_curent_layer()");
LogicModel_shptr lmodel = project->get_logic_model();
assert(lmodel != NULL);
return lmodel->get_current_layer();
}
| std::string degate::get_file_suffix | ( | std::string const & | path | ) |
Get a file suffix without the dot, e.g.
"xml" from a file named "foobar.xml".
Definition at line 112 of file FileSystem.cc.
Referenced by degate::ImageReaderFactory< ImageType >::get_reader().
{
size_t last_occurance = path.rfind(".", path.size());
if(last_occurance < path.size()) {
return path.substr(last_occurance + 1, path.size() - last_occurance);
}
else return std::string();
}

| std::string degate::get_filename_from_path | ( | std::string const & | path | ) |
Get filename part of a path.
Definition at line 187 of file FileSystem.cc.
Referenced by degate::ProjectArchiver::add_directory(), and get_basename().
{
size_t last_occurance = path.rfind("/", path.size());
if(last_occurance < path.size()) {
return path.substr(last_occurance + 1, path.size() - last_occurance);
}
else return path;
}

| Layer_shptr degate::get_first_enabled_layer | ( | LogicModel_shptr | lmodel | ) |
Get first enabled layer
| InvalidPointerException | If you pass an invalid shared pointer for layer, then this exception is raised. |
| CollectionLookupException | Is thrown, if all layers are disabled. |
Definition at line 232 of file LogicModelHelper.cc.
{
if(lmodel == NULL)
throw InvalidPointerException("Error: you passed an invalid pointer to get_first_enabled_layer()");
for(LogicModel::layer_collection::iterator iter = lmodel->layers_begin();
iter != lmodel->layers_end(); ++iter) {
Layer_shptr layer = *iter;
if(layer->is_enabled()) return layer;
}
throw InvalidPointerException("Error: all layers are disabled.");
}
| Layer_shptr degate::get_first_layer | ( | LogicModel_shptr | lmodel, |
| Layer::LAYER_TYPE | layer_type | ||
| ) |
Get the first layer of a layer type.
The search order is from bottom to top (lower layer position numbers to higher). Method ignores disabled layers.
| InvalidPointerException | Is thrown if you passed an invalid pointer for lmodel . |
| DegateLogicException | This exception is thrown if you passed an invalid layer_type. |
| CollectionLookupException | Is thrown if there is no layer of the requested type. |
Definition at line 33 of file LogicModelHelper.cc.
References degate::Layer::get_layer_type_as_string(), and degate::Layer::UNDEFINED.
Referenced by get_available_standard_layers(), and get_first_logic_layer().
{
if(layer_type == Layer::UNDEFINED)
throw DegateLogicException("Invalid layer type.");
if(lmodel == NULL)
throw InvalidPointerException("Error: you passed an invalid pointer to get_first_layer()");
for(LogicModel::layer_collection::iterator iter = lmodel->layers_begin();
iter != lmodel->layers_end(); ++iter) {
Layer_shptr layer = *iter;
if(layer->is_enabled() && layer->get_layer_type() == layer_type)
return layer;
}
boost::format fmter("Can't lookup layer of type %1% in logic model.");
fmter % Layer::get_layer_type_as_string(layer_type);
throw CollectionLookupException(fmter.str());
}


| Layer_shptr degate::get_first_logic_layer | ( | LogicModel_shptr | lmodel | ) |
Get the first layer that is a logic layer.
The search order is from bottom to top (lower layer position numbers to higher). Method ignores disabled layers.
| InvalidPointerException | Is thrown if you passed an invalid pointer for lmodel . |
| CollectionLookupException | Is thrown if there is no logc layer. |
Definition at line 54 of file LogicModelHelper.cc.
References get_first_layer(), and degate::Layer::LOGIC.
Referenced by degate::AutoNameGates::AutoNameGates(), and get_available_standard_layers().
{
if(lmodel == NULL)
throw InvalidPointerException("Error: you passed an invalid pointer to get_first_logic_layer()");
try {
return get_first_layer(lmodel, Layer::LOGIC);
}
catch(CollectionLookupException const& ex) {
throw;
}
}


| Gate_shptr degate::get_gate_by_name | ( | LogicModel_shptr | lmodel, |
| std::string const & | gate_name | ||
| ) |
Lookup a gate by it's name.
The name should be unique. If there is more then one gate with that name, the first one is returned.
Definition at line 67 of file LogicModelHelper.cc.
{
for(LogicModel::gate_collection::iterator iter = lmodel->gates_begin();
iter != lmodel->gates_end(); ++iter) {
Gate_shptr gate = (*iter).second;
if(gate->get_name() == gate_name) return gate;
}
return Gate_shptr();
}
| ImageType::pixel_type degate::get_maximum | ( | std::tr1::shared_ptr< ImageType > | img | ) |
Get the maximum pixel value of a single channel image.
Definition at line 56 of file ImageStatistics.h.
{
assert_is_single_channel_image<ImageType>();
typename ImageType::pixel_type maximum = img->get_pixel(0, 0);
for(unsigned int y = 0; y < img->get_height(); y++)
for(unsigned int x = 0; x < img->get_width(); x++) {
typename ImageType::pixel_type p = img->get_pixel(x, y);
if(p > maximum) maximum = p;
}
return maximum;
}
| ImageType::pixel_type degate::get_minimum | ( | std::tr1::shared_ptr< ImageType > | img | ) |
Get the minimum pixel value of a single channel image.
Definition at line 39 of file ImageStatistics.h.
{
assert_is_single_channel_image<ImageType>();
typename ImageType::pixel_type minimum = img->get_pixel(0, 0);
for(unsigned int y = 0; y < img->get_height(); y++)
for(unsigned int x = 0; x < img->get_width(); x++) {
typename ImageType::pixel_type p = img->get_pixel(x, y);
if(p < minimum) minimum = p;
}
return minimum;
}
| Layer_shptr degate::get_next_enabled_layer | ( | LogicModel_shptr | lmodel, |
| Layer_shptr | layer | ||
| ) |
Get the next enabled layer, that is above layer.
The method will not turn around in the layer stack.
| InvalidPointerException | If you pass an invalid shared pointer, then this exception is raised. |
Definition at line 274 of file LogicModelHelper.cc.
{
if(lmodel == NULL || layer == NULL)
throw InvalidPointerException("Error: you passed an invalid pointer to get_next_enabled_layer()");
for(unsigned int l_pos = layer->get_layer_pos() + 1;
l_pos < lmodel->get_num_layers(); l_pos++) {
Layer_shptr l = lmodel->get_layer(l_pos);
if(l->is_enabled()) return l;
}
return Layer_shptr();
}
| Layer_shptr degate::get_next_enabled_layer | ( | LogicModel_shptr | lmodel | ) |
Get next enabled layer.
| InvalidPointerException | If you pass an invalid shared pointer for layer, then this exception is raised. |
| CollectionLookupException | Is thrown, if all layers are disabled. |
| DegateRuntimeException | Is thrown, if there is no current layer. |
Definition at line 245 of file LogicModelHelper.cc.
Referenced by autoconnect_interlayer_objects().
{
if(lmodel == NULL)
throw InvalidPointerException("Error: you passed an invalid pointer to get_next_enabled_layer()");
Layer_shptr curr_layer = lmodel->get_current_layer();
if(curr_layer == NULL)
throw DegateRuntimeException("Error: there is no current layer.");
for(unsigned int l_pos = curr_layer->get_layer_pos() + 1;
l_pos < lmodel->get_num_layers(); l_pos++) {
Layer_shptr layer = lmodel->get_layer(l_pos);
if(layer->is_enabled()) return layer;
}
return curr_layer;
/*
for(unsigned int l_pos = curr_layer->get_layer_pos() + 1;
l_pos <= curr_layer->get_layer_pos() + lmodel->get_num_layers(); l_pos++) {
Layer_shptr layer = lmodel->get_layer(l_pos % lmodel->get_num_layers());
if(layer->is_enabled()) return layer;
}
throw InvalidPointerException("Error: all layers are disabled.");
return Layer_shptr(); // to avoid compiler warning
*/
}

| PixelTypeDst degate::get_pixel_as | ( | typename std::tr1::shared_ptr< ImageTypeSrc > | img, |
| unsigned int | x, | ||
| unsigned int | y | ||
| ) | [inline] |
Definition at line 184 of file ImageManipulation.h.
{
return convert_pixel<PixelTypeDst, typename ImageTypeSrc::pixel_type>(img->get_pixel(x, y));
}
| GateTemplatePort::PORT_TYPE degate::get_port_type | ( | GatePort_shptr | gate_port | ) |
Get the port type of a gate port.
Definition at line 359 of file LogicModelHelper.cc.
References degate::GateTemplatePort::PORT_TYPE_UNDEFINED.
Referenced by degate::LookupSubcircuit::filter_connected_gates().
{
if(gate_port == NULL)
throw InvalidPointerException("Invalid parameter for get_port_type()");
if(gate_port->has_template_port()) {
GateTemplatePort_shptr tmpl_port = gate_port->get_template_port();
return tmpl_port->get_port_type();
}
return GateTemplatePort::PORT_TYPE_UNDEFINED;
}

| Layer_shptr degate::get_prev_enabled_layer | ( | LogicModel_shptr | lmodel | ) |
Get previous enabled layer.
| InvalidPointerException | If you pass an invalid shared pointer for layer, then this exception is raised. |
| CollectionLookupException | Is thrown, if all layers are disabled. |
| DegateRuntimeException | Is thrown, if there is no current layer. |
Definition at line 288 of file LogicModelHelper.cc.
Referenced by autoconnect_interlayer_objects().
{
if(lmodel == NULL)
throw InvalidPointerException("Error: you passed an invalid pointer to get_prev_enabled_layer()");
Layer_shptr curr_layer = lmodel->get_current_layer();
if(curr_layer == NULL)
throw DegateRuntimeException("Error: there is no current layer.");
if(curr_layer->get_layer_pos() == 0) return curr_layer;
for(int l_pos = curr_layer->get_layer_pos() - 1; l_pos >= 0; l_pos--) {
Layer_shptr layer = lmodel->get_layer(l_pos);
if(layer->is_enabled()) return layer;
}
return curr_layer;
/*
if(lmodel->get_num_layers() == 1) return curr_layer;
for(unsigned int l_pos = curr_layer->get_layer_pos() + lmodel->get_num_layers() - 1;
l_pos > 0; l_pos--) {
Layer_shptr layer = lmodel->get_layer(l_pos % lmodel->get_num_layers());
if(layer->is_enabled()) return layer;
}
throw InvalidPointerException("Error: all layers are disabled.");
return Layer_shptr(); // to avoid compiler warning
*/
}

| Layer_shptr degate::get_prev_enabled_layer | ( | LogicModel_shptr | lmodel, |
| Layer_shptr | layer | ||
| ) |
Get the previous enabled layer, that is below layer.
The method will not turn around in the layer stack.
| InvalidPointerException | If you pass an invalid shared pointer, then this exception is raised. |
Definition at line 319 of file LogicModelHelper.cc.
{
if(lmodel == NULL || layer == NULL)
throw InvalidPointerException("Error: you passed an invalid pointer to get_prev_enabled_layer()");
for(unsigned int l_pos = layer->get_layer_pos(); l_pos > 0; l_pos--) {
Layer_shptr l = lmodel->get_layer(l_pos - 1);
if(l->is_enabled()) return l;
}
return Layer_shptr();
}
| std::string degate::get_realpath | ( | std::string const & | path | ) |
Get the canonicalized absolute pathname.
| Throws | an InvalidPathException if the path does not exists. |
Definition at line 101 of file FileSystem.cc.
Referenced by get_basedir(), degate::Configuration::get_temp_directory(), and read_directory().
{
char resolved_path[PATH_MAX];
if(realpath(path.c_str(), resolved_path) == NULL) {
boost::format fmter("Error in get_realpath(). Can't get real path for %1%.");
fmter % path;
throw degate::InvalidPathException(fmter.str());
}
else return std::string(resolved_path);
}

| std::string degate::get_relative_path | ( | std::string const & | path, |
| std::string const & | relative_to | ||
| ) |
Make a path specification relative to another.
Definition at line 335 of file FileSystem.cc.
References _get_relative_path().
Referenced by degate::ProjectExporter::add_layers().
{
//boost::format fmter("\npath=%1%\nrelative_to=%2%");
//fmter % path % relative_to;
//std::cout << fmter.str() << std::endl;
char * rel_path = _get_relative_path(path.c_str(), relative_to.c_str());
std::string ret(rel_path);
//std::cout << "rel_path=" << ret << std::endl;
free(rel_path);
return ret;
}


| std::string degate::get_temp_directory | ( | ) |
Get the temp directory.
This is a shortcut for (Configuration::get_instance()).get_temp_directory() .
Definition at line 29 of file Configuration.cc.
References degate::SingletonBase< Configuration >::get_instance(), and degate::Configuration::get_temp_directory().
Referenced by create_temp_directory().
{
Configuration const & conf = Configuration::get_instance();
return conf.get_temp_directory();
}


| std::string degate::get_template_port_name | ( | GatePort_shptr | gate_port | ) |
Get the name of a corresponding template port.
Definition at line 373 of file LogicModelHelper.cc.
Referenced by degate::LookupSubcircuit::filter_connected_gates().
{
if(gate_port == NULL)
throw InvalidPointerException("Invalid parameter for get_template_port_name()");
if(gate_port->has_template_port()) {
GateTemplatePort_shptr tmpl_port = gate_port->get_template_port();
return tmpl_port->get_name();
}
return "";
}

| std::tr1::shared_ptr<ImageType> degate::grab_image | ( | LogicModel_shptr | lmodel, |
| Layer_shptr | layer, | ||
| BoundingBox const & | bounding_box | ||
| ) |
Extract a partial image from the background image for a layer.
| DegateLogicException | Is thrown if the layer has no background image set. |
Definition at line 90 of file LogicModelHelper.h.
References degate::BoundingBox::get_height(), and degate::BoundingBox::get_width().
{
// create empty image with the size of the bounding box
std::tr1::shared_ptr<ImageType> new_img(new ImageType(bounding_box.get_width(),
bounding_box.get_height()));
BackgroundImage_shptr bg_image = layer->get_image();
if(bg_image == NULL) throw DegateLogicException("The layer has no background image");
extract_partial_image<ImageType, BackgroundImage>(new_img, bg_image, bounding_box);
//save_image<ImageType>("/tmp/zzz.tif", new_img);
return new_img;
}

| void degate::grab_template_images | ( | LogicModel_shptr | lmodel, |
| GateTemplate_shptr | gate_template, | ||
| BoundingBox const & | bounding_box, | ||
| Gate::ORIENTATION | orientation = Gate::ORIENTATION_NORMAL |
||
| ) |
Extract a partial image from the background images for several layers and set the extracted images as master images for a gate template.
This operation happens for the first transistor layer, for the first logic layer and for the first metal layer, but only if a layer of a type exists. With the paramter orientation you can specify that a flipping of the image is necessary.
Definition at line 142 of file LogicModelHelper.cc.
References debug(), get_available_standard_layers(), degate::Gate::ORIENTATION_FLIPPED_BOTH, degate::Gate::ORIENTATION_FLIPPED_LEFT_RIGHT, degate::Gate::ORIENTATION_FLIPPED_UP_DOWN, TM, and degate::Layer::UNDEFINED.
Referenced by degate::ProjectImporter::import_all().
{
std::list<Layer_shptr> layers = get_available_standard_layers(lmodel);
for(std::list<Layer_shptr>::iterator iter = layers.begin();
iter != layers.end(); ++iter) {
Layer_shptr layer = *iter;
assert(layer->get_layer_type() != Layer::UNDEFINED);
debug(TM, "grab image from %s layer",
layer->get_layer_type_as_string().c_str());
// extract image
GateTemplateImage_shptr tmpl_img =
grab_image<GateTemplateImage>(lmodel, layer, bounding_box);
assert(tmpl_img != NULL);
// flip
switch(orientation) {
case Gate::ORIENTATION_FLIPPED_UP_DOWN:
flip_up_down<GateTemplateImage>(tmpl_img);
break;
case Gate::ORIENTATION_FLIPPED_LEFT_RIGHT:
flip_left_right<GateTemplateImage>(tmpl_img);
break;
case Gate::ORIENTATION_FLIPPED_BOTH:
flip_up_down<GateTemplateImage>(tmpl_img);
flip_left_right<GateTemplateImage>(tmpl_img);
break;
default:
// do nothing
break;
}
// set as master image
gate_template->set_image(layer->get_layer_type(), tmpl_img);
}
}


| void degate::ignore_unused_variable_warning | ( | T const & | ) | [inline] |
A dummy method to get rid of compiler warnings.
Definition at line 35 of file TypeConstraints.h.
Referenced by degate::assert_is_multi_channel_image< ImageType >::assert_is_multi_channel_image(), and degate::assert_is_single_channel_image< ImageType >::assert_is_single_channel_image().
{}

| bool degate::is_directory | ( | std::string const & | path | ) |
Check if a path is a directory.
Definition at line 49 of file FileSystem.cc.
Referenced by degate::ProjectArchiver::add_directory(), degate::ScalingManager< ImageType >::create_scalings(), degate::ProjectExporter::export_all(), get_basedir(), degate::ProjectImporter::get_project_filename(), degate::ProjectImporter::load_background_image(), and degate::ExternalMatching::run().
{
struct stat stat_buf;
if(stat(path.c_str(), &stat_buf) == 0) {
return S_ISDIR(stat_buf.st_mode) ? true : false;
}
return false;
}

| bool degate::is_file | ( | std::string const & | path | ) |
Check if a path is a regular file.
Definition at line 57 of file FileSystem.cc.
Referenced by degate::Importer::check_file(), and degate::ProjectImporter::load_background_image().
{
struct stat stat_buf;
if(stat(path.c_str(), &stat_buf) == 0) {
return S_ISREG(stat_buf.st_mode) ? true : false;
}
return false;
}

| bool degate::is_interconnectable | ( | PlacedLogicModelObject_shptr | o | ) |
Check if an object can be electrically interconnected with another object.
Definition at line 34 of file ObjectSet.cc.
{
return std::tr1::dynamic_pointer_cast<ConnectedLogicModelObject>(o) != NULL;
}
| bool degate::is_logic_class | ( | Gate_shptr | gate, |
| std::string const & | logic_class | ||
| ) |
Check if a gate is of a specific logic class.
Definition at line 341 of file LogicModelHelper.cc.
Referenced by degate::LookupSubcircuit::filter_connected_gates(), and degate::LookupSubcircuit::initialize_openlist().
{
if(gate == NULL)
throw InvalidPointerException("Invalid parameter for is_logic_class()");
if(gate->has_template()) {
GateTemplate_shptr gate_tmpl = gate->get_gate_template();
std::string const& lclass = gate_tmpl->get_logic_class();
if(logic_class == lclass) return true;
if(logic_class.size() < lclass.size()) {
if(lclass.substr(0, logic_class.size()) == logic_class) return true;
}
}
return false;
}

| bool degate::is_of_object_type | ( | PlacedLogicModelObject_shptr | o | ) |
Definition at line 44 of file ObjectSet.h.
{
return std::tr1::dynamic_pointer_cast<Type>(o) != NULL;
}
| bool degate::is_removable | ( | PlacedLogicModelObject_shptr | o | ) |
Returns true if the object can be removed from the Logic Model.
Definition at line 30 of file ObjectSet.cc.
{
return std::tr1::dynamic_pointer_cast<GatePort>(o) == NULL;
}
| bool degate::is_symlink | ( | std::string const & | path | ) |
Check if a path is a symlink.
Definition at line 65 of file FileSystem.cc.
{
struct stat stat_buf;
if(stat(path.c_str(), &stat_buf) == 0) {
return S_ISLNK(stat_buf.st_mode) ? true : false;
}
return false;
}
| void degate::isolate_objects | ( | LogicModel_shptr | lmodel, |
| InputIterator | first, | ||
| InputIterator | last | ||
| ) |
Isolate objects.
Unused nets are removed from the logic model.
| DegateRuntimeException | This exception is thrown if one of the objects is not of type ConnectedLogicModelObject. This means that the object cannot be connected with anything. |
| InvalidPointerException | If you pass an invalid shared pointer for the logic model, then this exception is raised. |
Definition at line 181 of file LogicModelHelper.h.
{
if(lmodel == NULL)
throw InvalidPointerException("You passed an invalid shared pointer for lmodel");
// collect nets
std::set<Net_shptr> nets;
try {
nets = collect_nets<InputIterator>(first, last);
}
catch(DegateRuntimeException const& ex) {
throw;
}
// unconnect objects
for(InputIterator it = first; it != last; ++it) {
ConnectedLogicModelObject_shptr clo =
std::tr1::dynamic_pointer_cast<ConnectedLogicModelObject>(*it);
if(clo == NULL) {
throw DegateRuntimeException("Error in isolate_objecs(). One of the object "
"cannot be connected with anything");
}
else clo->remove_net();
}
// check nets: remove them from the logic model if they are not in use
for(std::set<Net_shptr>::iterator iter = nets.begin(); iter != nets.end(); ++iter)
if((*iter)->size() == 0) lmodel->remove_net(*iter);
}
| std::string degate::join_pathes | ( | std::string const & | base_path, |
| std::string const & | extension_path | ||
| ) |
Join path specifications.
This is a helper function to create path names. E.g. if you call this function with parameter "/etc" and "hosts", you will get a path "/etc/hosts". You don't have to deal with path seperator in the first or second parameter.
Definition at line 182 of file FileSystem.cc.
Referenced by degate::GateLibraryExporter::add_images(), degate::GateLibraryExporter::add_implementations(), degate::ScalingManager< ImageType >::create_scalings(), degate::ProjectExporter::export_all(), degate::EdgeDetection::get_edge_image(), degate::EdgeDetection::get_edge_magnitude_image(), degate::ProjectImporter::get_project_filename(), degate::TileCache< PixelPolicy >::load(), degate::ProjectImporter::load_background_image(), load_background_image(), degate::CannyEdgeDetection::non_maximum_supression(), degate::ZeroCrossingEdgeDetection::overlay_result(), degate::GateLibraryImporter::parse_template_images_element(), degate::GateLibraryImporter::parse_template_implementations_element(), read_directory(), degate::ZeroCrossingEdgeDetection::run(), degate::ViaMatching::run(), degate::CannyEdgeDetection::run(), and degate::EdgeDetection::run_edge_detection().
{
return base_path + std::string("/") + extension_path;
}

| void degate::load_background_image | ( | Layer_shptr | layer, |
| std::string const & | project_dir, | ||
| std::string const & | image_file | ||
| ) |
Load an image in a common image format as background image for a layer.
If there is already a background image, it will be unset and removed from the project directory.
| InvalidPointerException | If you pass an invalid shared pointer for layer, then this exception is raised. |
Definition at line 187 of file LogicModelHelper.cc.
References debug(), join_pathes(), and TM.
Referenced by degate::ProjectImporter::parse_layers_element().
{
if(layer == NULL)
throw InvalidPointerException("Error: you passed an invalid pointer to load_background_image()");
boost::format fmter("layer_%1%.dimg");
fmter % layer->get_layer_id(); // was get_layer_pos()
std::string dir(join_pathes(project_dir, fmter.str()));
if(layer->has_background_image())
layer->unset_image();
debug(TM, "Create background image in %s", dir.c_str());
BackgroundImage_shptr bg_image(new BackgroundImage(layer->get_width(),
layer->get_height(),
dir));
debug(TM, "Load image %s", image_file.c_str());
load_image<BackgroundImage>(image_file, bg_image);
debug(TM, "Set image to layer.");
layer->set_image(bg_image);
debug(TM, "Done.");
}


| std::tr1::shared_ptr<ImageType> degate::load_degate_image | ( | unsigned int | width, |
| unsigned int | height, | ||
| std::string const & | path | ||
| ) |
Helper function to load existing images in a degate image format.
We assume that the file or directory, where the image is stored, exists.
| InvalidPathException | This exception is thrown, if the path doen't exists. |
Definition at line 423 of file ImageManipulation.h.
References file_exists().
{
if(!file_exists(path)) {
boost::format fmter("Error in load_degate_image(): The image file or directory %1% does not exist.");
fmter % path;
throw InvalidPathException(fmter.str());
}
return std::tr1::shared_ptr<ImageType>(new ImageType(width, height, path));
}

| void degate::load_image | ( | std::string const & | path, |
| std::tr1::shared_ptr< ImageType > | img | ||
| ) |
Load an image in a common image format, such as tiff, into an existing degate image.
| InvalidPointerException | This exception is thrown, if parameter img represents an invalid pointer. |
Definition at line 85 of file ImageHelper.h.
{
if(img == NULL) throw InvalidPointerException("invalid image pointer");
std::tr1::shared_ptr<ImageType> i = load_image<ImageType>(path);
copy_image<ImageType, ImageType>(img, i);
}
| std::tr1::shared_ptr<ImageType> degate::load_image | ( | std::string const & | path | ) |
Load an image in a common image format, such as tiff.
| InvalidPathException | Thrown if, path does not exists. |
| DegateRuntimeException | This exception is thrown, if there is no matching image importer or if the import failed. |
Definition at line 47 of file ImageHelper.h.
References debug(), file_exists(), degate::ImageReaderFactory< ImageType >::get_reader(), and TM.
{
if(!file_exists(path)) {
boost::format fmter("Error in load_image(): file %1% does not exist.");
fmter % path;
throw InvalidPathException(fmter.str());
}
else {
boost::format fmter("Error in load_image(): The image file %1% cannot be loaded.");
fmter % path;
// get a reader
ImageReaderFactory<ImageType> ir_factory;
std::tr1::shared_ptr<ImageReaderBase<ImageType> > reader = ir_factory.get_reader(path);
if(reader->read() == false) {
throw DegateRuntimeException(fmter.str());
}
else {
debug(TM, "reading image file: %s", path.c_str());
// create an empty image
std::tr1::shared_ptr<ImageType> img(new ImageType(reader->get_width(),
reader->get_height()));
if(reader->get_image(img) == true)
return img;
else
throw DegateRuntimeException(fmter.str());
}
}
}

| T degate::median | ( | std::vector< T > & | v | ) | [inline] |
Calculate the median of a vector.
| DegateRuntimeException | This exception is thrown if vector's size is 0. |
Definition at line 36 of file Statistics.h.
{
if(v.empty())
throw DegateRuntimeException("Error in median(): The vector is empty.");
std::sort(v.begin(), v.end());
unsigned int center = v.size()/2;
if(v.size() % 2 == 0) {
return (v[center - 1] + v[center + 1]) / 2;
}
else
return v[center];
}
| void degate::median_filter | ( | std::tr1::shared_ptr< ImageTypeDst > | dst, |
| std::tr1::shared_ptr< ImageTypeSrc > | src, | ||
| unsigned int | kernel_width = 3 |
||
| ) |
Filter an image with a median filter.
Definition at line 115 of file MedianFilter.h.
References filter_image().
Referenced by degate::TemplateMatching::prepare_background_images(), and degate::EdgeDetection::setup_pipe().
{
filter_image<ImageTypeDst, ImageTypeSrc,
CalculateImageMedianPolicy<ImageTypeSrc, typename ImageTypeSrc::pixel_type> >(dst, src, kernel_width);
}


| void degate::merge_gate_images | ( | LogicModel_shptr | lmodel, |
| Layer_shptr | layer, | ||
| GateTemplate_shptr | tmpl, | ||
| std::list< Gate_shptr > const & | gates | ||
| ) |
Merge images.
Definition at line 418 of file LogicModelHelper.cc.
References degate::Gate::ORIENTATION_FLIPPED_BOTH, degate::Gate::ORIENTATION_FLIPPED_LEFT_RIGHT, and degate::Gate::ORIENTATION_FLIPPED_UP_DOWN.
Referenced by merge_gate_images().
{
if(gates.empty()) return;
std::list<GateTemplateImage_shptr> images;
BOOST_FOREACH(const Gate_shptr g, gates) {
GateTemplateImage_shptr tmpl_img =
grab_image<GateTemplateImage>(lmodel, layer, g->get_bounding_box());
assert(tmpl_img != NULL);
// flip
switch(g->get_orientation()) {
case Gate::ORIENTATION_FLIPPED_UP_DOWN:
flip_up_down<GateTemplateImage>(tmpl_img);
break;
case Gate::ORIENTATION_FLIPPED_LEFT_RIGHT:
flip_left_right<GateTemplateImage>(tmpl_img);
break;
case Gate::ORIENTATION_FLIPPED_BOTH:
flip_up_down<GateTemplateImage>(tmpl_img);
flip_left_right<GateTemplateImage>(tmpl_img);
break;
default:
// do nothing
break;
}
images.push_back(tmpl_img);
}
GateTemplateImage_shptr merged_img = merge_images<GateTemplateImage>(images);
tmpl->set_image(layer->get_layer_type(), merged_img);
}

| void degate::merge_gate_images | ( | LogicModel_shptr | lmodel, |
| ObjectSet | gates | ||
| ) |
Merge images.
| lmodel | |
| gates | A set of objects. It can contain non-gate types too. |
Definition at line 458 of file LogicModelHelper.cc.
References get_available_standard_layers(), and merge_gate_images().
{
/*
* Classify gates by their standard cell object ID.
*/
typedef std::map<object_id_t, std::list<Gate_shptr> > gate_sets_type;
gate_sets_type gate_sets;
BOOST_FOREACH(PlacedLogicModelObject_shptr plo, gates) {
if(Gate_shptr gate = std::tr1::dynamic_pointer_cast<Gate>(plo)) {
GateTemplate_shptr tmpl = gate->get_gate_template();
if(tmpl) // ignore gates, that have no standard cell
gate_sets[tmpl->get_object_id()].push_back(gate);
}
}
/*
* Iterate over layers.
*/
BOOST_FOREACH(Layer_shptr layer, get_available_standard_layers(lmodel)) {
/*
* Iterate over standard cell classes.
*/
for(gate_sets_type::iterator iter = gate_sets.begin(); iter != gate_sets.end(); ++iter) {
Gate_shptr g = iter->second.front();
assert(g != NULL);
merge_gate_images(lmodel, layer, g->get_gate_template(), iter->second);
}
}
}

| std::tr1::shared_ptr<ImageType> degate::merge_images | ( | std::list< std::tr1::shared_ptr< ImageType > > const & | images | ) |
Merge a set of images by averaging them.
| DegateRuntimeException | This exception is thrown, if images differ in size. |
images contains elements, this function returns a valid merged image. If the collection is empty, a NULL pointer is returned. Definition at line 157 of file ImageHelper.h.
References MASK_A, MASK_B, MASK_G, MASK_R, and MERGE_CHANNELS.
Referenced by degate::ViaMatching::run().
{
std::tr1::shared_ptr<ImageType> new_img;
if(images.empty()) return new_img;
const std::tr1::shared_ptr<ImageType> img = images.front();
unsigned int w = img->get_width(), h = img->get_height();
std::vector<double> i_tmp(4 * w * h);
BOOST_FOREACH(const std::tr1::shared_ptr<ImageType> i, images) {
// verify that all images have the same dimensions
if(w != i->get_width() || h != i->get_height())
throw DegateRuntimeException("merge_images() failed, because images differ in size.");
for(unsigned int y = 0; y < h; y++)
for(unsigned int x = 0; x < w; x++) {
color_t pix = i->get_pixel_as<color_t>(x, y);
unsigned int offs = 4 * (y * w + x);
i_tmp[offs] += MASK_R(pix);
i_tmp[offs+1] += MASK_G(pix);
i_tmp[offs+2] += MASK_B(pix);
i_tmp[offs+3] += MASK_A(pix);
}
}
const double elems = images.size();
new_img = std::tr1::shared_ptr<ImageType>(new GateTemplateImage(w, h));
assert(new_img != NULL);
for(unsigned int y = 0; y < h; y++)
for(unsigned int x = 0; x < w; x++) {
unsigned int offs = 4 * (y * w + x);
color_t pix = MERGE_CHANNELS(lround(i_tmp[offs] / elems),
lround(i_tmp[offs+1] / elems),
lround(i_tmp[offs+2] / elems),
lround(i_tmp[offs+3] / elems));
new_img->set_pixel(x, y, pix);
}
return new_img;
}

| void degate::morphological_close | ( | std::tr1::shared_ptr< ImageTypeDst > | dst, |
| std::tr1::shared_ptr< ImageTypeSrc > | src, | ||
| unsigned int | kernel_width = 3, |
||
| unsigned int | threshold_dilate = 1, |
||
| unsigned int | threshold_erode = 3 |
||
| ) |
Morphological close.
Definition at line 146 of file MorphologicalFilter.h.
References filter_image().
{
filter_image<ImageTypeDst, ImageTypeSrc,
DilateImagePolicy<ImageTypeSrc, typename ImageTypeSrc::pixel_type> >(dst, src, kernel_width, threshold_dilate);
filter_image<ImageTypeDst, ImageTypeSrc,
ErodeImagePolicy<ImageTypeSrc, typename ImageTypeSrc::pixel_type> >(dst, src, kernel_width, threshold_erode);
}

| void degate::morphological_open | ( | std::tr1::shared_ptr< ImageTypeDst > | dst, |
| std::tr1::shared_ptr< ImageTypeSrc > | src, | ||
| unsigned int | kernel_width = 3, |
||
| unsigned int | threshold_dilate = 1, |
||
| unsigned int | threshold_erode = 3 |
||
| ) |
Morphological open.
Definition at line 128 of file MorphologicalFilter.h.
References filter_image().
{
filter_image<ImageTypeDst, ImageTypeSrc,
ErodeImagePolicy<ImageTypeSrc, typename ImageTypeSrc::pixel_type> >(dst, src, kernel_width, threshold_erode);
filter_image<ImageTypeDst, ImageTypeSrc,
DilateImagePolicy<ImageTypeSrc, typename ImageTypeSrc::pixel_type> >(dst, src, kernel_width, threshold_dilate);
}

| IntegerType degate::next_power_of_two | ( | IntegerType | i | ) |
Calculate the next higher power of two for a value i with i > 0.
Definition at line 34 of file DegateHelper.h.
{
IntegerType rval = 1;
while(rval < i) rval <<= 1;
return rval;
}
| void degate::normalize | ( | std::tr1::shared_ptr< ImageTypeDst > | dst, |
| std::tr1::shared_ptr< ImageTypeSrc > | src, | ||
| double | lower_bound = 0, |
||
| double | upper_bound = 1 |
||
| ) |
Normalize a single channel image.
Source and destination image can be the same image.
Definition at line 440 of file ImageManipulation.h.
{
assert_is_single_channel_image<ImageTypeSrc>();
typename ImageTypeSrc::pixel_type src_min = get_minimum<ImageTypeSrc>(src);
typename ImageTypeSrc::pixel_type src_max = get_maximum<ImageTypeSrc>(src);
if(src_max - src_min == 0) return;
double shift = -src_min;
double factor = (double)(upper_bound - lower_bound) / (double)(src_max - src_min);
/*
std::cout
<< "lower bound: " << lower_bound << std::endl
<< "upper bound: " << upper_bound << std::endl
<< std::endl
<< "min val : " << src_min << std::endl
<< "max val : " << src_max << std::endl
<< std::endl
<< "factor : " << factor << std::endl
<< std::endl
;
*/
unsigned int h = std::min(src->get_height(), dst->get_height());
unsigned int w = std::min(src->get_width(), dst->get_width());
for(unsigned int y = 0; y < h; y++) {
for(unsigned int x = 0; x < w; x++) {
typename ImageTypeDst::pixel_type p =
src->get_pixel_as<typename ImageTypeDst::pixel_type>(x, y);
double d = ((double)p + shift) * factor + lower_bound;
if(d < lower_bound) {
if(abs(lower_bound - d) < 0.001)
d = lower_bound;
std::cout << "transformed value "<< p << " beyond lower bound: " << d << std::endl;
//d = lower_bound;
}
else if(d > upper_bound) {
if(abs(d - upper_bound) < 0.001)
d = upper_bound;
std::cout << "transformed value "<< p << " beyond upper bound: " << d << std::endl;
}
assert(d >= lower_bound);
assert(d <= upper_bound);
dst->set_pixel_as<double>(x, y, d);
}
}
}
| void degate::normalize | ( | std::tr1::shared_ptr< ImageType > | img, |
| double | lower_bound = 0, |
||
| double | upper_bound = 1 |
||
| ) |
Normalize a single channel image in place.
Definition at line 501 of file ImageManipulation.h.
{
normalize<ImageType, ImageType>(img, img, lower_bound, upper_bound);
}
| void degate::process_changelog_command | ( | LogicModel_shptr | lmodel, |
| transaction_id_t | transaction_id, | ||
| std::vector< xmlrpc_c::value > const & | command | ||
| ) |
Parse an execute a command.
| XMLRPCException | This exception is thrown, if commands cannot be parsed. |
Definition at line 83 of file XmlRpc.cc.
References debug(), degate::Via::get_via_direction_from_string(), and TM.
Referenced by pull_changes_from_server().
{
debug(TM, "XMLRPC: process received command for transaction %d", transaction_id);
if(lmodel->get_local_oid_for_roid(transaction_id) != 0) {
debug(TM, "XMLRPC: transaction %d aready known.", transaction_id);
return;
}
if(command.size() < 2) throw XMLRPCException("Command has not enough parameters.");
if(command[0].type() != xmlrpc_c::value::TYPE_STRING)
throw XMLRPCException("Command parameter is not a string");
const std::string command_str = xmlrpc_c::value_string(command[0]);
std::cout << " cmd: " << command_str << std::endl;
if(!command_str.compare("remove")) {
if(command.size() < 2)
throw XMLRPCException("Command wire add has less then 8 parameters.");
int ro_id = xmlrpc_c::value_int(command[1]);
lmodel->remove_remote_object(ro_id);
}
else if( !command_str.compare("add")) {
const std::string obj_type_str = xmlrpc_c::value_string(command[1]);
if(!obj_type_str.compare("wire")) {
if(command.size() < 8)
throw XMLRPCException("Command wire add has less then 8 parameters.");
int layer_id = xmlrpc_c::value_int(command[2]);
int from_x = xmlrpc_c::value_int(command[3]);
int from_y = xmlrpc_c::value_int(command[4]);
int to_x = xmlrpc_c::value_int(command[5]);
int to_y = xmlrpc_c::value_int(command[6]);
unsigned int diameter = xmlrpc_c::value_int(command[7]);
Wire_shptr w(new Wire(from_x, from_y, to_x, to_y, diameter));
w->set_remote_object_id(transaction_id);
Layer_shptr layer = lmodel->get_layer_by_id(layer_id);
lmodel->add_object(layer, w);
}
else if(!obj_type_str.compare("via")) {
if(command.size() < 7)
throw XMLRPCException("Command via add has less then 8 parameters.");
int layer_id = xmlrpc_c::value_int(command[2]);
int x = xmlrpc_c::value_int(command[3]);
int y = xmlrpc_c::value_int(command[4]);
unsigned int diameter = xmlrpc_c::value_int(command[5]);
const std::string direction = xmlrpc_c::value_string(command[6]);
Via_shptr v(new Via(x, y, diameter, Via::get_via_direction_from_string(direction)));
v->set_remote_object_id(transaction_id);
Layer_shptr layer = lmodel->get_layer_by_id(layer_id);
lmodel->add_object(layer, v);
}
}
/*
for(std::vector<xmlrpc_c::value>::const_iterator iter = command.begin();
iter != command.end(); ++iter)
std::cout << "\ttype " << (*iter).type() << std::endl;
}
*/
}


| transaction_id_t degate::pull_changes_from_server | ( | std::string const & | server_url, |
| LogicModel_shptr | lmodel, | ||
| transaction_id_t | start_tid | ||
| ) |
Pull objects from a remote server into the logic model.
| XMLRPCException | This exception is thrown, if the XMLRPC fails for some reason. |
Definition at line 156 of file XmlRpc.cc.
References debug(), process_changelog_command(), remote_method_call(), and TM.
{
try {
xmlrpc_c::paramList params;
params.add(xmlrpc_c::value_int(start_tid));
xmlrpc_c::value_array ret(remote_method_call(server_url, "degate.pull", params));
std::vector<xmlrpc_c::value> v(ret.vectorValueValue());
if(start_tid == 0) ++start_tid;
debug(TM, "Received %d changes since transaction %ld", v.size(), start_tid);
unsigned int pos = 0;
for(std::vector<xmlrpc_c::value>::const_iterator iter = v.begin();
iter != v.end(); ++iter, pos++) {
xmlrpc_c::value_array const& command(*iter);
process_changelog_command(lmodel, start_tid + pos, command.vectorValueValue());
/* If the process_changelog_command() fails with an exception, changes
were already made to the logic model. That is no problem, because
process_changelog_command() checks this case.
*/
}
return start_tid + v.size();
}
catch(XMLRPCException const& e) {
throw;
}
catch(exception const& e) {
cerr << "Client threw error: " << e.what() << endl;
throw XMLRPCException(e.what());
}
catch(...) {
cerr << "Client threw unexpected error." << endl;
throw XMLRPCException("Client threw unexpected error.");
}
return start_tid;
}

| void degate::push_changes_to_server | ( | std::string const & | server_url, |
| LogicModel_shptr | lmodel | ||
| ) |
Push objects from the logic model to a remote server.
Definition at line 50 of file XmlRpc.cc.
References debug(), remote_method_call(), and TM.
{
// iterate over gates
for(LogicModel::object_collection::iterator iter = lmodel->objects_begin();
iter != lmodel->objects_end(); ++iter) {
object_id_t local_oid = iter->second->get_object_id();
if(RemoteObject_shptr ro = std::tr1::dynamic_pointer_cast<RemoteObject>((*iter).second)) {
if(!ro->has_remote_object_id()) {
std::cout << "Push object to server." << std::endl;
object_id_t remote_oid = ro->push(server_url);
lmodel->update_roid_mapping(remote_oid, local_oid);
}
}
}
BOOST_FOREACH(object_id_t id, lmodel->get_removed_remote_objetcs_list()) {
xmlrpc_c::paramList params;
params.add(xmlrpc_c::value_string("remove"));
params.add(xmlrpc_c::value_int(id));
remote_method_call(server_url, "degate.push", params);
debug(TM, "Send remove message for object with remote ID %d", id);
}
lmodel->reset_removed_remote_objetcs_list();
}

| std::list< std::string > degate::read_directory | ( | std::string const & | path, |
| bool | prefix_path = false |
||
| ) |
Read all entries from a directory, but not from subdirectories.
The path is expanded first with get_realpath().
| path | The directory you want to read. |
| prefix_path | Control whether you will get file names relative to path or absolute file names. |
Definition at line 157 of file FileSystem.cc.
References get_realpath(), and join_pathes().
{
DIR * dir = NULL;
struct dirent * dir_ent = NULL;
std::string rpth = get_realpath(path);
if((dir = opendir(rpth.c_str())) == NULL)
throw degate::FileSystemException(strerror(errno));
std::list<std::string> retlist;
while((dir_ent = readdir(dir)) != NULL)
if(!(!strcmp(dir_ent->d_name, ".") ||
!strcmp(dir_ent->d_name, "..")))
retlist.push_back(prefix_path ? join_pathes(path, dir_ent->d_name) : dir_ent->d_name);
closedir(dir);
return retlist;
}

| xmlrpc_c::value degate::remote_method_call | ( | std::string const & | server_url, |
| std::string const & | method_name, | ||
| xmlrpc_c::paramList const & | params | ||
| ) |
Convinience method to call remote methods.
Definition at line 32 of file XmlRpc.cc.
Referenced by pull_changes_from_server(), push_changes_to_server(), degate::Wire::push_object_to_server(), degate::Via::push_object_to_server(), and degate::EMarker::push_object_to_server().
{
xmlrpc_c::clientXmlTransport_curl myTransport;
xmlrpc_c::client_xml myClient(&myTransport);
xmlrpc_c::rpcPtr myRpcP(method_name, params);
xmlrpc_c::carriageParm_curl0 myCarriageParam(server_url);
myRpcP->call(&myClient, &myCarriageParam);
assert(myRpcP->isFinished());
return myRpcP->getResult();
}

| void degate::remove_directory | ( | std::string const & | path | ) |
Unlink a directory with all files in it.
Because this function is only for degate. We make some sanity checks.
Definition at line 127 of file FileSystem.cc.
Referenced by degate::ExternalMatching::run(), degate::Layer::unset_image(), and degate::StoragePolicy_Tile< PixelPolicy >::~StoragePolicy_Tile().
{
boost::filesystem::path p(path);
boost::filesystem::remove_all(path);
}

| void degate::remove_entire_net | ( | LogicModel_shptr | lmodel, |
| Net_shptr | net | ||
| ) |
Remove net from the logic model and remove it from all objects, which share a net.
Definition at line 496 of file LogicModelHelper.cc.
{
BOOST_FOREACH(object_id_t oid, *net) {
PlacedLogicModelObject_shptr plo = lmodel->get_object(oid);
assert(plo != NULL);
if(ConnectedLogicModelObject_shptr clmo =
std::tr1::dynamic_pointer_cast<ConnectedLogicModelObject>(plo))
clmo->remove_net();
}
lmodel->remove_net(net);
}
| void degate::remove_file | ( | std::string const & | filename | ) |
Unlink a file.
Definition at line 121 of file FileSystem.cc.
{
if(unlink(path.c_str()) != 0) {
throw degate::FileSystemException(strerror(errno));
}
}
| double degate::rgba_to_hue | ( | rgba_pixel_t | p | ) | [inline] |
Convert an RGBA pixel to a hue value.
Definition at line 81 of file ImageManipulation.h.
References MASK_B, MASK_G, and MASK_R.
Referenced by degate::HueImageHistogram::add_area(), and degate::HueImageHistogram::get_for_rgb().
{
int red = MASK_R(p);
int green = MASK_G(p);
int blue = MASK_B(p);
int max = std::max(red, std::max(green, blue));
int min = std::min(red, std::min(green, blue));
double delta = max - min;
double h = 0;
if(max == min) h = 0;
else if(max == red) h = 60.0 * (double)(green-blue)/delta;
else if(max == green) h = 60.0 * (2.0 +(double)(blue-red)/delta);
else if(max == blue) h = 60.0 * (4.0 + (double)(red-green)/delta);
if(h < 0) h+=360;
//h *= 255.0/360.0;
return h;
}

| double degate::rgba_to_lightness | ( | rgba_pixel_t | p | ) | [inline] |
Convert an RGBA pixel to a lightness value.
Definition at line 122 of file ImageManipulation.h.
References MASK_B, MASK_G, and MASK_R.
Referenced by degate::LightnessImageHistogram::add_area(), and degate::LightnessImageHistogram::get_for_rgb().
{
int red = MASK_R(p);
int green = MASK_G(p);
int blue = MASK_B(p);
return std::max(red, std::max(green, blue));
}

| double degate::rgba_to_saturation | ( | rgba_pixel_t | p | ) | [inline] |
Convert an RGBA pixel to a saturation value.
Definition at line 106 of file ImageManipulation.h.
References MASK_B, MASK_G, and MASK_R.
Referenced by degate::SaturationImageHistogram::add_area(), and degate::SaturationImageHistogram::get_for_rgb().
{
int red = MASK_R(p);
int green = MASK_G(p);
int blue = MASK_B(p);
double max = std::max(red, std::max(green, blue));
double min = std::min(red, std::min(green, blue));
if(max == 0) return 0;
else return (max - min) / max;
}

| void degate::save_image | ( | std::string const & | path, |
| std::tr1::shared_ptr< ImageType > | img | ||
| ) |
Store an image in a common file format.
Only the tiff file format is supported.
| DegateRuntimeException | This exception is thrown, if the writer failed to save the image. |
| InvalidPointerException | This exception is thrown, if parameter img represents an invalid pointer. |
Definition at line 102 of file ImageHelper.h.
Referenced by degate::ViaMatching::run(), and save_part_of_image().
{
if(img == NULL) throw InvalidPointerException("invalid image pointer");
TIFFWriter<ImageType> tiff_writer(img->get_width(),
img->get_height(), path);
if(tiff_writer.write_image(img) != true) {
boost::format fmter("Error in save_image(): Cannot write file %1%.");
fmter % path;
throw DegateRuntimeException(fmter.str());
}
}

| void degate::save_normalized_image | ( | std::string const & | path, |
| std::tr1::shared_ptr< ImageType > | img | ||
| ) |
Normalize a single channel image and store it in a common file format.
Only the tiff file format is supported.
| InvalidPointerException | This exception is thrown, if parameter img represents an invalid pointer. |
Definition at line 138 of file ImageHelper.h.
{
if(img == NULL) throw InvalidPointerException("invalid image pointer");
std::tr1::shared_ptr<ImageType> normalized_img(new ImageType(img->get_width(),
img->get_height()));
normalize<ImageType, ImageType>(normalized_img, img, 0, 255);
save_image<ImageType>(path, normalized_img);
}
| void degate::save_part_of_image | ( | std::string const & | path, |
| std::tr1::shared_ptr< ImageType > | img, | ||
| BoundingBox const & | bounding_box | ||
| ) |
Save a part of an image.
| InvalidPointerException | This exception is thrown, if parameter img represents an invalid pointer. |
Definition at line 119 of file ImageHelper.h.
References extract_partial_image(), degate::BoundingBox::get_height(), degate::BoundingBox::get_width(), and save_image().
Referenced by degate::ExternalMatching::run().
{
if(img == NULL) throw InvalidPointerException("invalid image pointer");
std::tr1::shared_ptr<ImageType> part(new ImageType(bounding_box.get_width(),
bounding_box.get_height()));
extract_partial_image(part, img, bounding_box);
save_image(path, part);
}


| void degate::scale_down_by_2 | ( | std::tr1::shared_ptr< ImageTypeDst > | dst, |
| std::tr1::shared_ptr< ImageTypeSrc > | src | ||
| ) |
Scale a source image down by factor 2.
You can scale images in place.
Definition at line 307 of file ImageManipulation.h.
References MASK_A, MASK_B, MASK_G, MASK_R, and MERGE_CHANNELS.
{
unsigned int dst_x, dst_y, src_x, src_y;
for(dst_y = 0; dst_y < dst->get_height(); dst_y++) {
src_y = dst_y * 2;
for(dst_x = 0; dst_x < dst->get_width(); dst_x++) {
src_x = dst_x * 2;
// 1 2
// 3 4
int i = 1;
unsigned int r = 0, g = 0, b = 0, a = 0;
rgba_pixel_t pix = src->get_pixel_as<rgba_pixel_t>(src_x, src_y);
r += MASK_R(pix);
g += MASK_G(pix);
b += MASK_B(pix);
a += MASK_A(pix);
if(src_x + 1 < src->get_width()) {
pix = src->get_pixel_as<rgba_pixel_t>(src_x + 1, src_y);
i++;
r += MASK_R(pix);
g += MASK_G(pix);
b += MASK_B(pix);
a += MASK_A(pix);
}
if(src_y + 1 < src->get_height()) {
pix = src->get_pixel_as<rgba_pixel_t>(src_x, src_y + 1);
i++;
r += MASK_R(pix);
g += MASK_G(pix);
b += MASK_B(pix);
a += MASK_A(pix);
}
if(src_x + 1 < src->get_width() && src_y + 1 < src->get_height()) {
pix = src->get_pixel_as<rgba_pixel_t>(src_x + 1, src_y + 1);
i++;
r += MASK_R(pix);
g += MASK_G(pix);
b += MASK_B(pix);
a += MASK_A(pix);
}
r /= i;
g /= i;
b /= i;
a /= i;
dst->set_pixel_as<rgba_pixel_t>(dst_x, dst_y, MERGE_CHANNELS(r, g, b, a));
}
}
}
| void degate::scale_down_by_power_of_2 | ( | std::tr1::shared_ptr< ImageTypeDst > | dst, |
| std::tr1::shared_ptr< ImageTypeSrc > | src | ||
| ) |
Scale a source image down by factor 2.
| DegateRuntimeException | This excpetion is thrown if the destination image has no dimension definition. |
Definition at line 377 of file ImageManipulation.h.
Referenced by degate::TemplateMatching::prepare_template().
{
if(dst->get_width() == 0) throw DegateRuntimeException("Invalid image dimension for destination image.");
unsigned int scaling = lrint((double)src->get_width() / (double)dst->get_width());
if(scaling == 1)
copy_image<ImageTypeDst, ImageTypeSrc>(dst, src);
else if(scaling == 2)
scale_down_by_2<ImageTypeDst, ImageTypeSrc>(dst, src);
else {
std::tr1::shared_ptr<ImageTypeDst> tmp(new ImageTypeDst(src->get_width(), src->get_height()));
copy_image<ImageTypeDst, ImageTypeSrc>(tmp, src);
scaling >>= 1;
for(unsigned int i = 0; i < scaling - 1; i*=2) {
scale_down_by_2<ImageTypeDst, ImageTypeDst>(tmp, tmp);
}
scale_down_by_2<ImageTypeDst, ImageTypeDst>(dst, tmp);
}
}

| void degate::set_pixel_as | ( | typename std::tr1::shared_ptr< ImageTypeDst > | img, |
| unsigned int | x, | ||
| unsigned int | y, | ||
| PixelTypeSrc | p | ||
| ) | [inline] |
Definition at line 193 of file ImageManipulation.h.
{
img->get_pixel(x, y, convert_pixel<typename ImageTypeDst::pixel_type, PixelTypeSrc>(p));
}
| T degate::standard_deviation | ( | std::vector< T > const & | v | ) | [inline] |
Calculate the standard deviation of a vector.
| DegateRuntimeException | This exception is thrown if vector's size is 0. |
Definition at line 80 of file Statistics.h.
{
if(v.empty())
throw DegateRuntimeException("Error in standard_deviation(): The vector is empty.");
T avg = average<T>(v);
double sum = 0;
for(typename std::vector<T>::const_iterator iter = v.begin(); iter != v.end(); ++iter)
sum += pow(avg - *iter, 2);
return sqrt(sum/(double)v.size());
}
| boost::filesystem::path degate::strip_path | ( | boost::filesystem::path const & | strip_from, |
| boost::filesystem::path const & | strip_what | ||
| ) |
Strip the leading directory part from a path.
| strip_from | Is the path. |
| strip_what | Is the base directory that should be removed. |
Definition at line 354 of file FileSystem.cc.
Referenced by degate::ProjectArchiver::add_directory(), and degate::ProjectArchiver::add_single_file().
{
path::iterator src_path_iter = strip_what.begin();
path::iterator src_path_end = strip_what.end();
path stripped;
BOOST_FOREACH(path s, strip_from) {
if(src_path_iter != src_path_end && *src_path_iter == s)
++src_path_iter;
else
stripped /= s;
}
return stripped;
}

| void degate::thinning | ( | std::tr1::shared_ptr< ImageType > | img | ) |
Zhang-Suen-Thinning of an image.
Definition at line 233 of file MorphologicalFilter.h.
References zhang_suen_thinning_iteration().
{
assert_is_single_channel_image<ImageType>();
bool running = true;
do {
running = zhang_suen_thinning_iteration(img, true);
running = zhang_suen_thinning_iteration(img, false);
}while(running);
}

| void degate::thresholding_image | ( | std::tr1::shared_ptr< ImageTypeDst > | dst, |
| std::tr1::shared_ptr< ImageTypeSrc > | src, | ||
| double | threshold | ||
| ) |
Thresholding a single channel image.
Source and destination image can be the same image. The thresholding sets a pixel value to 0 if it is below the threshold or to a non-0 value if it is greater or equal than the trheshold.
Definition at line 513 of file ImageManipulation.h.
{
assert_is_single_channel_image<ImageTypeSrc>();
unsigned int h = std::min(src->get_height(), dst->get_height());
unsigned int w = std::min(src->get_width(), dst->get_width());
for(unsigned int y = 0; y < h; y++) {
for(unsigned int x = 0; x < w; x++) {
typename ImageTypeDst::pixel_type p =
src->get_pixel_as<typename ImageTypeDst::pixel_type>(x, y);
dst->set_pixel_as<double>(x, y, p >= threshold ? 1 : 0);
}
}
}
| std::vector< std::string > degate::tokenize | ( | std::string const & | str | ) |
Tokenize a string.
| str | That is the string to tokenize, e.g. "hello world. \"foo bar"". This would result in three tokens. |
Definition at line 16 of file DegateHelper.cc.
Referenced by degate::ExternalMatching::parse_line().
{
/* This implementation is more or less directly derived from
this posting http://www.gamedev.net/community/forums/topic.asp?topic_id=320087
*/
vector<string> result;
string item;
stringstream ss(str);
while(ss >> item){
if (item[0]=='"') {
int lastItemPosition = item.length() - 1;
if (item[lastItemPosition]!='"') {
// read the rest of the double-quoted item
string restOfItem;
getline(ss, restOfItem, '"');
item += restOfItem;
}
// otherwise, we had a single word that was quoted. In any case, we now
// have the item in quotes; remove them
item = item.substr(1, lastItemPosition-1);
}
// item is "fully cooked" now
result.push_back(item);
}
return result;
}

| void degate::update_port_diameters | ( | LogicModel_shptr | lmodel, |
| diameter_t | new_size | ||
| ) |
Resize all gate ports from the logic model to the new size.
Definition at line 654 of file LogicModelHelper.cc.
{
// iterate over gates
for(LogicModel::gate_collection::iterator iter = lmodel->gates_begin();
iter != lmodel->gates_end(); ++iter) {
Gate_shptr gate = (*iter).second;
assert(gate != NULL);
// iterate over gate ports
for(Gate::port_iterator iter = gate->ports_begin();
iter != gate->ports_end(); ++iter) {
GatePort_shptr gate_port = *iter;
if(gate_port->get_diameter() != new_size) {
gate_port->set_diameter(new_size);
}
}
}
}
| void degate::write_string_to_file | ( | std::string const & | path, |
| std::string const & | content | ||
| ) |
Write a string to a file.
| path | Path to file. |
| content | The file content. |
Definition at line 60 of file DegateHelper.cc.
Referenced by degate::GateLibraryExporter::add_implementations(), and write_string_to_temp_file().
{
std::ofstream file;
file.open(path.c_str(), std::ios::trunc | std:: ios::out);
file << content;
file.close();
}

| std::string degate::write_string_to_temp_file | ( | std::string const & | dir, |
| std::string const & | content | ||
| ) |
Write a string to a temp file.
| dir | The directory, where the temp file should be created. |
| content | The file content. |
Definition at line 46 of file DegateHelper.cc.
References generate_temp_file_pattern(), and write_string_to_file().
{
char filename[PATH_MAX];
std::string pattern = generate_temp_file_pattern(dir);
strncpy(filename, pattern.c_str(), sizeof(filename));
if(!mktemp(filename)) // should never return NULL
throw DegateRuntimeException("mktemp() failed");
write_string_to_file(filename, content);
return filename;
}

| bool degate::zhang_suen_thinning_iteration | ( | std::tr1::shared_ptr< ImageType > | img, |
| bool | condition_switch | ||
| ) |
Helper function for the Zhang-Suen-Thinning.
| img | The image. |
| condition_switch | If true, the first condition set is checked. If false, the second condition set is checked. |
Definition at line 168 of file MorphologicalFilter.h.
Referenced by thinning().
{
assert_is_single_channel_image<ImageType>();
bool running = false;
unsigned int x, y;
for(y = 1; y < img->get_height() - 1; y++) {
for(x = 1; x < img->get_width() - 1; x++) {
unsigned int
p1 = img->get_pixel(x, y) > 0 ? 1 : 0;
if(p1 > 0) {
unsigned int
p2 = img->get_pixel(x, y-1) > 0 ? 1 : 0,
p3 = img->get_pixel(x+1, y-1) > 0 ? 1 : 0,
p4 = img->get_pixel(x+1, y) > 0 ? 1 : 0,
p5 = img->get_pixel(x+1, y+1) > 0 ? 1 : 0,
p6 = img->get_pixel(x, y+1) > 0 ? 1 : 0,
p7 = img->get_pixel(x-1, y+1) > 0 ? 1 : 0,
p8 = img->get_pixel(x-1, y) > 0 ? 1 : 0,
p9 = img->get_pixel(x-1, y-1)> 0 ? 1 : 0;
unsigned int connectivity =
(p2 == 0 && p3 == 1 ? 1 : 0) +
(p3 == 0 && p4 == 1 ? 1 : 0) +
(p4 == 0 && p5 == 1 ? 1 : 0) +
(p5 == 0 && p6 == 1 ? 1 : 0) +
(p6 == 0 && p7 == 1 ? 1 : 0) +
(p7 == 0 && p8 == 1 ? 1 : 0) +
(p8 == 0 && p9 == 1 ? 1 : 0) +
(p9 == 0 && p2 == 1 ? 1 : 0);
unsigned int non_zero_neighbors = p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9;
if(2 <= non_zero_neighbors && non_zero_neighbors <= 6 &&
connectivity == 1) {
if(condition_switch == true) {
if(p2 * p4 * p6 == 0 && p4 * p6 * p8 == 0) {
img->set_pixel(x, y, 0);
running = true;
}
}
else {
if(p2 * p4 * p8 == 0 && p2 * p6 * p8 == 0) {
img->set_pixel(x, y, 0);
running = true;
}
}
}
}
}
}
return running;
}

1.7.4