📄 algae.h
字号:
#ifndef ALGAE_H#define ALGAE_H#include <algae/config.h>#include <string>#include <iostream>// Data type for functions to be invoked when the// client signals a menu selection. typedef void (*menuFunction) ();struct AlgAEMenuItem;class Messages;class Visible;class AlgAE{public: struct Color { unsigned char red; unsigned char green; unsigned char blue; }; static const Color Black; static const Color White; static const Color Blue; static const Color Cyan; static const Color Green; static const Color Magenta; static const Color Red; static const Color Yellow; static const Color PaleBlue; static const Color PaleCyan; static const Color PaleGreen; static const Color PaleMagenta; static const Color PaleRed; static const Color PaleYellow; static const Color DarkGray; static const Color MedGray; enum Directions {N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW, AnyDir}; //**************************************************** // Constructor for AlgAE server. Parameters are command line // arguments passed to main(nargs, args). AlgAE (int nargs, char** args); ~AlgAE (); // Declare a menu item to appear in the client's Algorithm menu // and a corresponding function to be executed here on the server // in response to a selection of that item. void menuItem (const std::string& menuItemTitle, menuFunction theOperation); // Start the client and begin running the animation server. void run(const std::string& animationTitle, const std::string& aboutString); // Signal that a frame should be drawn, and the algorithm paused // until the client gives a "continue" signal. void FRAME (const std::string& frameIdentifier, const std::string& message); void FRAME (const std::string& message) {FRAME (message, message);} void FRAME (const char* frameIdentifier, const char* message); void FRAME (const char* message); // Pop up a dialog box requesting some input from the person operating // the client. void promptForInput (const std::string& prompt, std::string& response); // Pop up a dialog box presenting some message to the person operating // the client. void message (const std::string& msg);private: AlgAE () {} AlgAE (const AlgAE&) {} void operator= (const AlgAE&) {} void error (const std::string& msg) const; void addVisibleObject (const Visible*); void removeVisibleObject (const Visible*); void showObject (const Visible*); void hideObject (const Visible*); void hideObjectsSince (const Visible*); void describeData(); void enqueue (const Visible*); void unHighlightAll(); Messages* msgs; AlgAEMenuItem* algorithmsMenu; std::istream * instream; std::ostream * outstream; std::ostream * dbgstream; int socketNum; friend class AlgAEStreamBuffer; friend class Messages; friend class Visible; struct FrameState; FrameState* frame; };extern AlgAE* algae;// Redefine cin and cout so that standard I/O is directed to the ALGAE client.#ifdef __bad_rdbuf__// Take the cheap way out if the library does not support// reassigning the stream buffers using the ios::rdbuf(streambuf&) operator.#include <algae/astream.h>#define cout AlgAEstdioStreams::aout#define cin AlgAEstdioStreams::ain#define COUT std::cout#define CIN std::cin#else#define COUT std::cout#define CIN std::cin#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -