חזור לתיקייה: wet

MataMvidia

חיפוש בתיקיה
Ctrl K
לחץ כאן או הקש Ctrl K כדי לחפש בכל התיקיה

    MataMvidia

    02340124

    מבוא לתכנות מערכות

    רשימות הרצאה לקריאה בשבת

    MataMvidia

    הופק מתוך תקיית התואר של שקד

    uni-folder.vercel.app

    matamvidia.h

    הערה (קובץ קוד)

    קובץ זה הוא קובץ קוד מסוג C.

    #pragma once
    
    #include <iostream>
    #include <string>
    #include "Matrix.h"
    
    class MataMvidia {
    public:
        /**
         * Builds a new MataMvidia movie from it's parts.
         *
         * @param movieName The name of the movie
         * @param authorName The creator/author of the movie
         * @param frames The array of frames, witch are Matrixes
         * @param length The length of the movie in frames
        */
        MataMvidia(const std::string& movieName, const std::string& authorName,
                   const Matrix frames[], int length);
    
        /**
         * Copies a movie into a new MataMvidia movie object.
         *
         * @param movie The movie to copy
         */
        MataMvidia(const MataMvidia& movie);
    
        /**
         * Destroys the movie.
         */
        ~MataMvidia();
    
        /**
         * copies the movie given into this movie. the values of the old movie will be deleted.
         *
         * @param movie The movie to copy
         *
         * @return A reference to the current movie.
         */
        MataMvidia& operator=(const MataMvidia& movie);
    
        /**
         * gets a copy of a frame from the current movie.
         *
         * @param index The index of the frame you want to get
         *
         * @return A copy of the frame
         */
        const Matrix& operator[](int index) const;
    
        /**
         * gets a frame from the current movie.
         *
         * @param index The index of the frame you want to get
         *
         * @return The actual frame from the movie
         */
        Matrix& operator[](int index);
    
        /**
         * Appends the movie given into this movie.
         *
         * @param movie The movie to append
         *
         * @return A reference to the current movie(the one we appended to)
         */
        MataMvidia& operator+=(const MataMvidia& movie);
    
        /**
         * Adds a frame to the end of the movie
         *
         * @param matrix The frame to add
         *
         * @return A reference to the current movie
         */
        MataMvidia& operator+=(const Matrix& matrix);
    
        /**
         * Creates a new movie with the frames of both movies.
         * movie1 and then movie2.
         *
         * @param movie1 The first part of the new movie
         * @param movie2 The second part of the new movie
         *
         * @return The new movie
         */
        friend MataMvidia operator+(const MataMvidia& movie1,
                                    const MataMvidia& movie2);
    
        /**
         * Prints the current movie to the stream given.
         *
         * @param ostream The stream to print to
         * @param movie The movie to print
         *
         * @return A reference to the stream printed to
         */
        friend std::ostream& operator<<(std::ostream& ostream,
                                        const MataMvidia& movie);
    
    private:
        int length, maxLength;
        std::string movieName, authorName;
        Matrix* frames;
    
        const static int EXPANSION_RATE = 8;
    
        void expandArray(int amount = EXPANSION_RATE);
    };